From 7fac39528497b35915a5573c1ac3faf875476272 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 2 Nov 2019 11:04:21 -0700 Subject: [PATCH] LaTeX reader: Don't omit macro definitions defined in the preamble. These were formerly omitted (though they still affected macro resolution if `latex_macros` was set). Now they are included in the document. --- src/Text/Pandoc/Readers/LaTeX.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index a8df5dd03..b4e9de258 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -1462,13 +1462,14 @@ end_ t = try (do guard $ t == txt) ("\\end{" ++ T.unpack t ++ "}") preamble :: PandocMonad m => LP m Blocks -preamble = mempty <$ many preambleBlock - where preambleBlock = spaces1 - <|> macroDef (const ()) - <|> void blockCommand - <|> void braced +preamble = mconcat <$> many preambleBlock + where preambleBlock = (mempty <$ spaces1) + <|> macroDef (rawBlock "latex") + <|> (mempty <$ blockCommand) + <|> (mempty <$ braced) <|> (do notFollowedBy (begin_ "document") - void anyTok) + anyTok + return mempty) paragraph :: PandocMonad m => LP m Blocks paragraph = do