Skip to content

Commit 519b740

Browse files
authored
Merge pull request #921 from Octachron/latex_math_fix
latex math: remove line at the end of equation* environment It is generally a good idea to avoid spurious blank line before the end of the equation* environment. For example: \begin{equation*} \f\hat\xi\,e^{2 \pi i \xi x} \,d\xi \end{equation*} In my tests, this blank line breaks at least the amsmath version of equation*. This commit fix this issue that trimming the last part of the raw equation text before cutting a newline to end the equation* environment.
2 parents 8c8bf89 + f001d93 commit 519b740

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/latex/raw.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ let equation ppf x =
217217
let name = "equation*" in
218218
mbegin ppf name;
219219
Fmt.cut ppf ();
220+
(* A blank line before \end{equation*} is a latex error,
221+
we trim on the right the user input to avoid any surprise *)
222+
let x = Astring.String.drop ~rev:true ~sat:Astring.Char.Ascii.is_white x in
220223
Fmt.string ppf x;
221224
Fmt.cut ppf ();
222225
mend ppf name

test/generators/latex/Markup.tex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ \subsection{Math\label{math}}%
9191
\f\relax{x} = \int_{-\infty}^\infty
9292
\f\hat\xi\,e^{2 \pi i \xi x}
9393
\,d\xi
94-
9594
\end{equation*}
9695

9796
\subsection{Modules\label{modules}}%

0 commit comments

Comments
 (0)