LaTeX reader: handle \DeclareRobustCommand.

Currently it's just treated as a synonym for `\newcommand`.

Handles the second case mentioned in #3983.
This commit is contained in:
John MacFarlane 2017-10-19 11:50:16 -07:00
parent 9bb8a1f170
commit e941ba05b9

View file

@ -1610,7 +1610,7 @@ isBlockCommand s =
treatAsBlock :: Set.Set Text treatAsBlock :: Set.Set Text
treatAsBlock = Set.fromList treatAsBlock = Set.fromList
[ "let", "def" [ "let", "def", "DeclareRobustCommand"
, "newcommand", "renewcommand" , "newcommand", "renewcommand"
, "newenvironment", "renewenvironment" , "newenvironment", "renewenvironment"
, "providecommand", "provideenvironment" , "providecommand", "provideenvironment"
@ -1838,7 +1838,8 @@ newcommand = do
pos <- getPosition pos <- getPosition
Tok _ (CtrlSeq mtype) _ <- controlSeq "newcommand" <|> Tok _ (CtrlSeq mtype) _ <- controlSeq "newcommand" <|>
controlSeq "renewcommand" <|> controlSeq "renewcommand" <|>
controlSeq "providecommand" controlSeq "providecommand" <|>
controlSeq "DeclareRobustCommand"
optional $ symbol '*' optional $ symbol '*'
Tok _ (CtrlSeq name) txt <- withVerbatimMode $ anyControlSeq <|> Tok _ (CtrlSeq name) txt <- withVerbatimMode $ anyControlSeq <|>
(symbol '{' *> spaces *> anyControlSeq <* spaces <* symbol '}') (symbol '{' *> spaces *> anyControlSeq <* spaces <* symbol '}')