Permalink
Browse files

LaTeX reader: Made rawLaTeXInline more flexible.

Now it will also try to parse block commands.  This is usually
what we want, given how rawLaTeXInline is used in the markdown
and textile readers.  If a block-level LaTeX command is used
in the middle of a paragraph (e.g. `\subtitle` inside a title),
we can treat it as raw inline LaTeX.
  • Loading branch information...
1 parent cfc2e00 commit 40128754ab20105bce68cd072607f8877f10dca1 John MacFarlane committed Oct 12, 2012
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/Text/Pandoc/Readers/LaTeX.hs
@@ -717,10 +717,8 @@ rawLaTeXBlock = snd <$> try (withRaw (environment <|> blockCommand))
rawLaTeXInline :: Parser [Char] ParserState Inline
rawLaTeXInline = do
- (res, raw) <- withRaw inlineCommand
- if res == mempty
- then return (Str "")
- else RawInline "latex" <$> (applyMacros' raw)
+ raw <- (snd <$> withRaw inlineCommand) <|> (snd <$> withRaw blockCommand)
+ RawInline "latex" <$> applyMacros' raw
environments :: M.Map String (LP Blocks)
environments = M.fromList

0 comments on commit 4012875

Please sign in to comment.