LaTeX reader: more careful placement of withVerbatimMode.
for macros
This commit is contained in:
parent
6f6ad0514d
commit
d04ded4ca9
1 changed files with 16 additions and 14 deletions
|
@ -1541,8 +1541,9 @@ newcommand = do
|
||||||
controlSeq "renewcommand" <|>
|
controlSeq "renewcommand" <|>
|
||||||
controlSeq "providecommand" <|>
|
controlSeq "providecommand" <|>
|
||||||
controlSeq "DeclareRobustCommand"
|
controlSeq "DeclareRobustCommand"
|
||||||
optional $ symbol '*'
|
Tok _ (CtrlSeq name) txt <- withVerbatimMode $ do
|
||||||
Tok _ (CtrlSeq name) txt <- withVerbatimMode $ anyControlSeq <|>
|
optional (symbol '*')
|
||||||
|
anyControlSeq <|>
|
||||||
(symbol '{' *> spaces *> anyControlSeq <* spaces <* symbol '}')
|
(symbol '{' *> spaces *> anyControlSeq <* spaces <* symbol '}')
|
||||||
spaces
|
spaces
|
||||||
numargs <- option 0 $ try bracketedNum
|
numargs <- option 0 $ try bracketedNum
|
||||||
|
@ -1564,18 +1565,19 @@ newenvironment = do
|
||||||
Tok _ (CtrlSeq mtype) _ <- controlSeq "newenvironment" <|>
|
Tok _ (CtrlSeq mtype) _ <- controlSeq "newenvironment" <|>
|
||||||
controlSeq "renewenvironment" <|>
|
controlSeq "renewenvironment" <|>
|
||||||
controlSeq "provideenvironment"
|
controlSeq "provideenvironment"
|
||||||
|
name <- withVerbatimMode $ do
|
||||||
optional $ symbol '*'
|
optional $ symbol '*'
|
||||||
spaces
|
spaces
|
||||||
name <- untokenize <$> braced
|
untokenize <$> braced
|
||||||
|
numargs <- withVerbatimMode $ do
|
||||||
spaces
|
spaces
|
||||||
numargs <- option 0 $ try bracketedNum
|
option 0 $ try bracketedNum
|
||||||
let argspecs = map (\i -> ArgNum i) [1..numargs]
|
let argspecs = map (\i -> ArgNum i) [1..numargs]
|
||||||
|
optarg <- withVerbatimMode $ do
|
||||||
spaces
|
spaces
|
||||||
optarg <- option Nothing $ Just <$> try bracketedToks
|
option Nothing $ Just <$> try bracketedToks
|
||||||
spaces
|
startcontents <- withVerbatimMode $ spaces >> bracedOrToken
|
||||||
startcontents <- withVerbatimMode bracedOrToken
|
endcontents <- withVerbatimMode $ spaces >> bracedOrToken
|
||||||
spaces
|
|
||||||
endcontents <- withVerbatimMode bracedOrToken
|
|
||||||
when (mtype == "newenvironment") $ do
|
when (mtype == "newenvironment") $ do
|
||||||
macros <- sMacros <$> getState
|
macros <- sMacros <$> getState
|
||||||
case M.lookup name macros of
|
case M.lookup name macros of
|
||||||
|
|
Loading…
Add table
Reference in a new issue