git.iko.soy/typeable/pandoc
on master help sign in
Fixed regression in LateX tokenization.

This mainly affects the Markdown reader when parsing raw LaTeX with escaped spaces. Closes #4159.

commit044d58bb24cf41493222a14612e2de4f8d05ea6a authorJohn MacFarlane <jgm@berkeley.edu> dateFri 15 Dec 2017, 09:45 (9 years ago) parent61133b5
2 files changed+10−2
src/Text/Pandoc/Readers/LaTeX.hs+2−2 test/command/4159.md+8
src/Text/Pandoc/Readers/LaTeX.hs+2−2
@@ -320,7 +320,7 @@ totoks pos t =
320320 : totoks (incSourceColumn pos (1 + T.length cs)) rest'
321321 | c == '\\' ->
322322 case T.uncons rest of
323− Nothing -> [Tok pos Symbol (T.singleton c)]
323+ Nothing -> [Tok pos (CtrlSeq " ") "\\"]
324324 Just (d, rest')
325325 | isLetterOrAt d ->
326326 -- \makeatletter is common in macro defs;
@@ -338,7 +338,7 @@ totoks pos t =
338338 Just ('\n', r2)
339339 -> (T.pack "\n",
340340 T.span isSpaceOrTab r2)
341− _ -> (mempty, (w1, r1))
341+ _ -> (mempty, (mempty, r1))
342342 in case T.uncons r3 of
343343 Just ('\n', _) ->
344344 Tok pos (CtrlSeq " ") ("\\" <> w1)
test/command/4159.mdnew file+8
@@ -0,0 +1,8 @@
1+```
2+% pandoc -f markdown -t native
3+\newcommand{\gen}{a\ Gen\ b}
4+abc
5+^D
6+[RawBlock (Format "latex") "\\newcommand{\\gen}{a\\ Gen\\ b}"
7+,Para [Str "abc"]]
8+```