@@ -186,8 +186,7 @@ import Data.Char ( toLower, toUpper, ord, chr, isAscii, isAlphaNum,
186186import Data.List ( intercalate, transpose, isSuffixOf )
187187import Text.Pandoc.Shared
188188import qualified Data.Map as M
189−import Text.TeXMath.Readers.TeX.Macros (applyMacros, Macro,
190− parseMacroDefinitions)
189+import Text.TeXMath.Readers.TeX.Macros (applyMacros, Macro, pMacroDefinition)
191190import Text.HTML.TagSoup.Entity ( lookupEntity )
192191import Text.Pandoc.Asciify (toAsciiChar)
193192import Data.Monoid ((<>))
@@ -1263,21 +1262,17 @@ token pp pos match = tokenPrim pp (\_ t _ -> pos t) match
12631262-- Macros
12641263--
12651264
1266−-- | Parse a \newcommand or \renewcommand macro definition.
1265+-- | Parse a \newcommand or \newenviroment macro definition.
12671266macro :: (Stream [Char] m Char, HasMacros st, HasReaderOptions st)
12681267 => ParserT [Char] st m Blocks
12691268macro = do
12701269 apply <- getOption readerApplyMacros
1271− inp <- getInput
1272− case parseMacroDefinitions inp of
1273− ([], _) -> mzero
1274− (ms, rest) -> do def' <- count (length inp - length rest) anyChar
1275− if apply
1276− then do
1277− updateState $ \st ->
1278− updateMacros (ms ++) st
1279− return mempty
1280− else return $ rawBlock "latex" def'
1270+ (m, def') <- withRaw pMacroDefinition
1271+ if apply
1272+ then do
1273+ updateState $ \st -> updateMacros (m:) st
1274+ return mempty
1275+ else return $ rawBlock "latex" def'
12811276
12821277-- | Apply current macros to string.
12831278applyMacros' :: (HasReaderOptions st, HasMacros st, Stream [Char] m Char)