@@ -126,14 +126,16 @@ rawLaTeXBlock :: (PandocMonad m, HasMacros s, HasReaderOptions s)
126 => ParserT String s m String
126 => ParserT String s m String
127rawLaTeXBlock = do
127rawLaTeXBlock = do
128 lookAhead (try (char '\\' >> letter))
128 lookAhead (try (char '\\' >> letter))
130+ let toks = tokenize "source" $ T.pack inp
129− snd <$> (rawLaTeXParser False macroDef blocks
131+ snd <$> (rawLaTeXParser toks False macroDef blocks
130− <|> (rawLaTeXParser True
132+ <|> (rawLaTeXParser toks True
131 (do choice (map controlSeq
133 (do choice (map controlSeq
132 ["include", "input", "subfile", "usepackage"])
134 ["include", "input", "subfile", "usepackage"])
133 skipMany opt
135 skipMany opt
135 return mempty) blocks)
137 return mempty) blocks)
136− <|> rawLaTeXParser True
138+ <|> rawLaTeXParser toks True
137 (environment <|> blockCommand)
139 (environment <|> blockCommand)
138 (mconcat <$> (many (block <|> beginOrEndCommand))))
140 (mconcat <$> (many (block <|> beginOrEndCommand))))
@@ -155,11 +157,13 @@ rawLaTeXInline :: (PandocMonad m, HasMacros s, HasReaderOptions s)
155 => ParserT String s m String
157 => ParserT String s m String
156rawLaTeXInline = do
158rawLaTeXInline = do
157 lookAhead (try (char '\\' >> letter))
159 lookAhead (try (char '\\' >> letter))
161+ let toks = tokenize "source" $ T.pack inp
158 raw <- snd <$>
162 raw <- snd <$>
159− ( rawLaTeXParser True
163+ ( rawLaTeXParser toks True
160 (mempty <$ (controlSeq "input" >> skipMany opt >> braced))
164 (mempty <$ (controlSeq "input" >> skipMany opt >> braced))
162− <|> rawLaTeXParser True (inlineEnvironment <|> inlineCommand')
166+ <|> rawLaTeXParser toks True (inlineEnvironment <|> inlineCommand')
165 finalbraces <- mconcat <$> many (try (string "{}")) -- see #5439
169 finalbraces <- mconcat <$> many (try (string "{}")) -- see #5439
@@ -168,7 +172,10 @@ rawLaTeXInline = do
168inlineCommand :: PandocMonad m => ParserT String ParserState m Inlines
172inlineCommand :: PandocMonad m => ParserT String ParserState m Inlines
169inlineCommand = do
173inlineCommand = do
170 lookAhead (try (char '\\' >> letter))
174 lookAhead (try (char '\\' >> letter))
176+ let toks = tokenize "source" $ T.pack inp
171− fst <$> rawLaTeXParser True (inlineEnvironment <|> inlineCommand') inlines
177+ fst <$> rawLaTeXParser toks True (inlineEnvironment <|> inlineCommand')
173-- inline elements:
180-- inline elements: