@@ -1049,14 +1049,12 @@ inlineCommand' :: PandocMonad m => LP m Inlines
10491049inlineCommand' = try $ do
10501050 Tok _ (CtrlSeq name) cmd <- anyControlSeq
10511051 guard $ name /= "begin" && name /= "end"
1052− (star, rawstar) <- withRaw $ option "" ("*" <$ symbol '*' <* optional sp)
1052+ star <- option "" ("*" <$ symbol '*' <* optional sp)
10531053 let name' = name <> star
10541054 let names = ordNub [name', name] -- check non-starred as fallback
10551055 let raw = do
10561056 guard $ isInlineCommand name || not (isBlockCommand name)
1057− (_, rawargs) <- withRaw
1058− (skipangles *> skipopts *> option "" dimenarg *> many braced)
1059− let rawcommand = T.unpack $ cmd <> untokenize (rawstar ++ rawargs)
1057+ rawcommand <- getRawCommand (cmd <> star)
10601058 (guardEnabled Ext_raw_tex >> return (rawInline "latex" rawcommand))
10611059 <|> ignore rawcommand
10621060 lookupListDefault raw names inlineCommands
@@ -1353,7 +1351,11 @@ rawInlineOr name' fallback = do
13531351getRawCommand :: PandocMonad m => Text -> LP m String
13541352getRawCommand txt = do
13551353 (_, rawargs) <- withRaw
1356− (many (try (optional sp *> opt)) *>
1354+ ((if txt == "\\write"
1355+ then () <$ satisfyTok isWordTok -- digits
1356+ else return ()) *>
1357+ skipangles *>
1358+ skipopts *>
13571359 option "" (try (optional sp *> dimenarg)) *>
13581360 many braced)
13591361 return $ T.unpack (txt <> untokenize rawargs)
@@ -1631,7 +1633,7 @@ blockCommand = try $ do
16311633 let names = ordNub [name', name]
16321634 let raw = do
16331635 guard $ isBlockCommand name || not (isInlineCommand name)
1634− rawBlock "latex" <$> getRawCommand txt
1636+ rawBlock "latex" <$> getRawCommand (txt <> star)
16351637 lookupListDefault raw names blockCommands
16361638
16371639closing :: PandocMonad m => LP m Blocks
@@ -2128,8 +2130,8 @@ block = (mempty <$ spaces1)
21282130 <|> environment
21292131 <|> include
21302132 <|> macroDef
2131− <|> paragraph
21322133 <|> blockCommand
2134+ <|> paragraph
21332135 <|> grouped block
21342136
21352137blocks :: PandocMonad m => LP m Blocks