LaTeX reader: improve mathEnvWith.
When converting e.g. an align environment to an aligned environment inside a Math element, we need to include a newline before the `\end{aligned}`, since the previous line might end in a comment. Closes #8122.
This commit is contained in:
parent
54b20e5733
commit
b263f38304
3 changed files with 4 additions and 3 deletions
|
@ -65,7 +65,7 @@ mathEnvWith f innerEnv name = f . mathDisplay . inner <$> mathEnv name
|
||||||
where inner x = case innerEnv of
|
where inner x = case innerEnv of
|
||||||
Nothing -> x
|
Nothing -> x
|
||||||
Just y -> "\\begin{" <> y <> "}\n" <> x <>
|
Just y -> "\\begin{" <> y <> "}\n" <> x <>
|
||||||
"\\end{" <> y <> "}"
|
"\n\\end{" <> y <> "}"
|
||||||
|
|
||||||
mathEnv :: PandocMonad m => Text -> LP m Text
|
mathEnv :: PandocMonad m => Text -> LP m Text
|
||||||
mathEnv name = do
|
mathEnv name = do
|
||||||
|
|
|
@ -11,7 +11,7 @@ E&=&F
|
||||||
[ Para
|
[ Para
|
||||||
[ Math
|
[ Math
|
||||||
DisplayMath
|
DisplayMath
|
||||||
"\\begin{aligned}\nA&=&B,\\\\\nC&=&D,\\\\\n%\\end{eqnarray}\n%\\begin{eqnarray}\nE&=&F\\end{aligned}"
|
"\\begin{aligned}\nA&=&B,\\\\\nC&=&D,\\\\\n%\\end{eqnarray}\n%\\begin{eqnarray}\nE&=&F\n\\end{aligned}"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
|
@ -62,7 +62,8 @@ x &= y\\
|
||||||
\(5-67\)
|
\(5-67\)
|
||||||
|
|
||||||
\[\begin{aligned}
|
\[\begin{aligned}
|
||||||
x &= y\\\end{aligned}\]
|
x &= y\\
|
||||||
|
\end{aligned}\]
|
||||||
|
|
||||||
\emph{hi}
|
\emph{hi}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue