Skip to content

Commit f4d3604

Browse files
committed
Trim whitespaces from the end of environment contents when rendering
1 parent a58b25e commit f4d3604

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

library/PhpLatex/Renderer/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static function toLatex($node) // {{{
108108
$children = array_slice($children, $argsEnd);
109109

110110
return "\\begin{" . $node->value . "}" . self::toLatex($args) . "\n"
111-
. self::toLatex($children) . "\n"
111+
. rtrim(self::toLatex($children)) . "\n"
112112
. "\\end{" . $node->value . "}";
113113

114114
case PhpLatex_Parser::TYPE_DOCUMENT:

tests/PhpLatex/Test/Renderer/AbstractTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public function testTabular()
2424

2525
$this->assertEquals(
2626
'\begin{tabular}{ |c|c|c| }
27-
\hline cell1 & cell2 & cell3 \\\\ cell4 & cell5 & cell6 \\\\ cell7 & cell8 & cell9 \\\\ \hline' . ' ' . '
27+
\hline cell1 & cell2 & cell3 \\\\ cell4 & cell5 & cell6 \\\\ cell7 & cell8 & cell9 \\\\ \hline
2828
\end{tabular}\par \begin{tabular}{c}
29-
cell 1'. ' ' . '
29+
cell 1
3030
\end{tabular}\par {\huge Foobar}', $output);
3131
}
3232

@@ -48,7 +48,7 @@ public function testIssue6()
4848
$output = PhpLatex_Renderer_Abstract::toLatex($parser->parse($input));
4949

5050
$this->assertEquals('\[ \begin{array}{c}
51-
\eta _{1} \\\\ \eta _{12} \\\\ \eta _{21} \\\\ \eta _{2}' . ' ' . '
51+
\eta _{1} \\\\ \eta _{12} \\\\ \eta _{21} \\\\ \eta _{2}
5252
\end{array} \]', $output);
5353
}
5454
}

0 commit comments

Comments
 (0)