git.iko.soy/typeable/pandoc
on master help sign in
When parsing raw LaTeX commands, include trailing space.

Otherwise things like `\noindent foo` break and turn into `\noindentfoo`. Affects `-f latex+raw_tex` and `-f markdown` (and other formats that allow `raw_tex`). Closes #1773.

commitf4a452f89174828fea77614a4b6a067fc4675ba5 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 22 Feb 2017, 21:15 (10 years ago) parente51b32a
3 files changed+9−3
src/Text/Pandoc/Readers/LaTeX.hs+2−2 test/command/1773.md+6 test/latex-reader.native+1−1
src/Text/Pandoc/Readers/LaTeX.hs+2−2
@@ -435,7 +435,7 @@ section (ident, classes, kvs) lvl = do
435435
436436inlineCommand :: PandocMonad m => LP m Inlines
437437inlineCommand = try $ do
438− name <- anyControlSeq
438+ (name, raw') <- withRaw anyControlSeq
439439 guard $ name /= "begin" && name /= "end"
440440 guard $ not $ isBlockCommand name
441441 exts <- getOption readerExtensions
@@ -444,7 +444,7 @@ inlineCommand = try $ do
444444 let raw = do
445445 rawargs <- withRaw
446446 (skipangles *> skipopts *> option "" dimenarg *> many braced)
447− let rawcommand = '\\' : name ++ star ++ snd rawargs
447+ let rawcommand = raw' ++ star ++ snd rawargs
448448 transformed <- applyMacros' rawcommand
449449 if transformed /= rawcommand
450450 then parseFromString inlines transformed
test/command/1773.mdnew file+6
@@ -0,0 +1,6 @@
1+```
2+% pandoc -f latex+raw_tex -t native
3+\noindent hi
4+^D
5+[Para [RawInline (Format "latex") "\\noindent ",Str "hi"]]
6+```
test/latex-reader.native+1−1
@@ -261,7 +261,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
261261,Header 1 ("latex",[],[]) [Str "LaTeX"]
262262,BulletList
263263 [[Para [Cite [Citation {citationId = "smith.1899", citationPrefix = [], citationSuffix = [Str "22-23"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cite[22-23]{smith.1899}"]]]
264− ,[Para [RawInline (Format "latex") "\\doublespacing"]]
264+ ,[Para [RawInline (Format "latex") "\\doublespacing\n"]]
265265 ,[Para [Math InlineMath "2+2=4"]]
266266 ,[Para [Math InlineMath "x \\in y"]]
267267 ,[Para [Math InlineMath "\\alpha \\wedge \\omega"]]