git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Allow @ as a letter in control sequences.

@ is commonly used in macros using `\makeatletter`. Ideally we'd make the tokenizer sensitive to `\makeatletter` and `\makeatother`, but until then this seems a good change.

commit425b731050f48739749cd99c29c15aa011dbcabb authorJohn MacFarlane <jgm@berkeley.edu> dateSun 13 Aug 2017, 12:24 (9 years ago) parentbf9ec6d
1 file changed+8−2
src/Text/Pandoc/Readers/LaTeX.hs+8−2
src/Text/Pandoc/Readers/LaTeX.hs+8−2
@@ -320,8 +320,12 @@ totoks (lin,col) t =
320320 case T.uncons rest of
321321 Nothing -> [Tok (lin, col) Symbol (T.singleton c)]
322322 Just (d, rest')
323− | isLetter d ->
324− let (ws, rest'') = T.span isLetter rest
323+ | isLetterOrAt d ->
324+ -- \makeatletter is common in macro defs;
325+ -- ideally we should make tokenization sensitive
326+ -- to \makeatletter and \makeatother, but this is
327+ -- probably best for now
328+ let (ws, rest'') = T.span isLetterOrAt rest
325329 (ss, rest''') = T.span isSpaceOrTab rest''
326330 in Tok (lin, col) (CtrlSeq ws) ("\\" <> ws <> ss)
327331 : totoks (lin,
@@ -367,6 +371,8 @@ totoks (lin,col) t =
367371 where isSpaceOrTab ' ' = True
368372 isSpaceOrTab '\t' = True
369373 isSpaceOrTab _ = False
374+ isLetterOrAt '@' = True
375+ isLetterOrAt c = isLetter c
370376
371377isLowerHex :: Char -> Bool
372378isLowerHex x = x >= '0' && x <= '9' || x >= 'a' && x <= 'f'