@@ -270,13 +270,16 @@ rawLaTeXBlock :: (PandocMonad m, HasMacros s, HasReaderOptions s)
270270 => ParserT String s m String
271271rawLaTeXBlock = do
272272 lookAhead (try (char '\\' >> letter))
273− snd <$> rawLaTeXParser (environment <|> macroDef <|> blockCommand)
273+ -- we don't want to apply newly defined latex macros to their own
274+ -- definitions:
275+ (snd <$> rawLaTeXParser macroDef) <|>
276+ ((snd <$> rawLaTeXParser (environment <|> blockCommand)) >>= applyMacros)
274277
275278rawLaTeXInline :: (PandocMonad m, HasMacros s, HasReaderOptions s)
276279 => ParserT String s m String
277280rawLaTeXInline = do
278281 lookAhead (try (char '\\' >> letter) <|> char '$')
279− snd <$> rawLaTeXParser (inlineEnvironment <|> inlineCommand')
282+ rawLaTeXParser (inlineEnvironment <|> inlineCommand') >>= applyMacros . snd
280283
281284inlineCommand :: PandocMonad m => ParserT String ParserState m Inlines
282285inlineCommand = do