diff options
| author | John MacFarlane <[email protected]> | 2025-11-04 14:02:25 +0100 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2025-11-04 14:02:25 +0100 |
| commit | 22863a3e124215e6fd24efe55a5a99fb2d605e5b (patch) | |
| tree | 5b7773a4ff87b68b02672a632c0ce3eeaf159d50 | |
| parent | 0e4c9b0ea6b6fd702083eaa4f42ea3cb6c9a556e (diff) | |
Improve parsing of raw LaTeX blocks...
containing macro definitions with `\makeatletter` and `\makeatother`.
Closes #9953, see also #11270.
| -rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 11419b15f..32195d859 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -144,12 +144,17 @@ rawLaTeXBlock = do toks <- getInputTokens snd <$> ( rawLaTeXParser toks - (macroDef (const mempty) <|> + (skipMany1 (try + (skipMany (whitespace <|> newlineTok) + *> (macroDef (const ()) + <|> void (controlSeq "makeatletter" <|> + controlSeq "mateatother"))) + <|> do choice (map controlSeq ["include", "input", "subfile", "usepackage"]) skipMany opt braced - return mempty) blocks + return mempty)) blocks <|> rawLaTeXParser toks (void (environment <|> blockCommand)) (mconcat <$> many (block <|> beginOrEndCommand))) |
