LaTeX reader: improve parsing of raw environments.

If parsing fails in a raw environment (e.g. due to special
characters like unescaped `_`), try again as a verbatim
environment, which is less sensitive to special characters.

This allows us to capture special environments that change
catcodes as raw tex when `-f latex+raw_tex` is used.

Closes #6034.
This commit is contained in:
John MacFarlane
2020-01-08 08:43:51 -08:00
parent bef0133fe0
commit fc78be1140
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -1942,7 +1942,7 @@ environment = try $ do
if M.member name (inlineEnvironments
:: M.Map Text (LP PandocPure Inlines))
then mzero
else rawEnv name
else rawEnv name <|> rawVerbEnv name
env :: PandocMonad m => Text -> LP m a -> LP m a
env name p = p <* end_ name
+11
View File
@@ -0,0 +1,11 @@
```
% pandoc -f latex+raw_tex -t native
\begin{figure*}
\centering
\begin{overpic}{test_pic}
\put (70,80) {Caption}
\end{overpic}
\end{figure*}
^D
[RawBlock (Format "latex") "\\begin{figure*}\n \\centering\n \\begin{overpic}{test_pic}\n \\put (70,80) {Caption}\n \\end{overpic}\n\\end{figure*}"]
```