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.
commitfc78be1140532dcd7dc4ef614ac753cca5cf8b1e
authorJohn MacFarlane <jgm@berkeley.edu>
dateWed 8 Jan 2020, 08:43 (7 years ago)
parentbef0133
src/Text/Pandoc/Readers/LaTeX.hs+1−1
@@ -1942,7 +1942,7 @@ environment = try $ do
19421942 if M.member name (inlineEnvironments
19431943 :: M.Map Text (LP PandocPure Inlines))
19441944 then mzero
1945− else rawEnv name
1945+ else rawEnv name <|> rawVerbEnv name
19461946
19471947env :: PandocMonad m => Text -> LP m a -> LP m a
19481948env name p = p <* end_ name
test/command/6034.mdnew file+11
@@ -0,0 +1,11 @@
1+```
2+% pandoc -f latex+raw_tex -t native
3+\begin{figure*}
4+ \centering
5+ \begin{overpic}{test_pic}
6+ \put (70,80) {Caption}
7+ \end{overpic}
8+\end{figure*}
9+^D
10+[RawBlock (Format "latex") "\\begin{figure*}\n \\centering\n \\begin{overpic}{test_pic}\n \\put (70,80) {Caption}\n \\end{overpic}\n\\end{figure*}"]
11+```