@@ -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'