From 5aa73bd0a2820a0c89b5990dbe53abfdd5ade32d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 7 Mar 2021 15:49:02 -0800 Subject: LaTeX reader: handle table cells containing `&` in `\verb`. Closes #7129. --- src/Text/Pandoc/Readers/LaTeX/Table.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/LaTeX/Table.hs b/src/Text/Pandoc/Readers/LaTeX/Table.hs index 2ea9caf58..7833da081 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Table.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Table.hs @@ -134,6 +134,11 @@ parseTableRow :: PandocMonad m -> LP m Row parseTableRow blocks inline envname prefsufs = do notFollowedBy (spaces *> end_ envname) + -- contexts that can contain & that is not colsep: + let canContainAmp (Tok _ (CtrlSeq "begin") _) = True + canContainAmp (Tok _ (CtrlSeq "verb") _) = True + canContainAmp (Tok _ (CtrlSeq "Verb") _) = True + canContainAmp _ = False -- add prefixes and suffixes in token stream: let celltoks (pref, suff) = do prefpos <- getPosition @@ -142,7 +147,7 @@ parseTableRow blocks inline envname prefsufs = do ((lookAhead (controlSeq "parbox") >> void blocks) -- #5711 <|> - (lookAhead (controlSeq "begin") >> void inline) + (lookAhead (satisfyTok canContainAmp) >> void inline) <|> (lookAhead (symbol '$') >> void inline)) <|> -- cgit v1.2.3