Skip to content
Permalink
Browse files
LaTeX reader: improve handling of newif.
Adding a pair of braces around the second argument of `\def`
prevents LaTeX from an emergency stop with:  Closes #6096.

```
pandoc -f markdown -o test.pdf
\newif\ifepub

\epubtrue

\ifepub

hi

\fi
^D
```
  • Loading branch information
jgm committed Jan 23, 2022
1 parent 9da69c4 commit 67f2b25c05c3142aca430f46d53f1a9bb83375f6
Showing 1 changed file with 4 additions and 0 deletions.
@@ -130,13 +130,17 @@ newif = do
Macro GroupScope ExpandWhenUsed [] Nothing
[ Tok pos (CtrlSeq "def") "\\def"
, Tok pos (CtrlSeq name) ("\\" <> name)
, Tok pos Symbol "{"
, Tok pos (CtrlSeq "iftrue") "\\iftrue"
, Tok pos Symbol "}"
])
, (base <> "false",
Macro GroupScope ExpandWhenUsed [] Nothing
[ Tok pos (CtrlSeq "def") "\\def"
, Tok pos (CtrlSeq name) ("\\" <> name)
, Tok pos Symbol "{"
, Tok pos (CtrlSeq "iffalse") "\\iffalse"
, Tok pos Symbol "}"
])
]

0 comments on commit 67f2b25

Please sign in to comment.