@@ -152,21 +152,13 @@ stringToLaTeX = escapeStringUsing latexEscapes
152152inCmd :: String -> Doc -> Doc
153153inCmd cmd contents = char '\\' <> text cmd <> braces contents
154154
155−-- | Remove all code elements from list of inline elements
156−-- (because it's illegal to have verbatim inside some command arguments)
157−deVerb :: [Inline] -> [Inline]
158−deVerb [] = []
159−deVerb ((Code _ str):rest) =
160− (RawInline "latex" $ "\\texttt{" ++ stringToLaTeX str ++ "}"):(deVerb rest)
161−deVerb (other:rest) = other:(deVerb rest)
162−
163155-- | Convert Pandoc block element to LaTeX.
164156blockToLaTeX :: Block -- ^ Block to convert
165157 -> State WriterState Doc
166158blockToLaTeX Null = return empty
167159blockToLaTeX (Plain lst) = inlineListToLaTeX lst
168160blockToLaTeX (Para [Image txt (src,tit)]) = do
169− capt <- inlineListToLaTeX $ deVerb txt
161+ capt <- inlineListToLaTeX txt
170162 img <- inlineToLaTeX (Image txt (src,tit))
171163 return $ "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
172164 ("\\caption{" <> capt <> char '}') $$ "\\end{figure}" $$ blankline
@@ -250,14 +242,13 @@ blockToLaTeX (DefinitionList lst) = do
250242blockToLaTeX HorizontalRule = return $
251243 "\\begin{center}\\rule{3in}{0.4pt}\\end{center}" $$ blankline
252244blockToLaTeX (Header level lst) = do
253− let lst' = deVerb lst
254− txt <- inlineListToLaTeX lst'
245+ txt <- inlineListToLaTeX lst
255246 let noNote (Note _) = Str ""
256247 noNote x = x
257− let lstNoNotes = bottomUp noNote lst'
248+ let lstNoNotes = bottomUp noNote lst
258249 -- footnotes in sections don't work unless you specify an optional
259250 -- argument: \section[mysec]{mysec\footnote{blah}}
260− optional <- if lstNoNotes == lst'
251+ optional <- if lstNoNotes == lst
261252 then return empty
262253 else do
263254 res <- inlineListToLaTeX lstNoNotes
@@ -280,7 +271,7 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
280271 then return empty
281272 else liftM ($$ "\\ML")
282273 $ (tableRowToLaTeX True aligns widths) heads
283− captionText <- inlineListToLaTeX $ deVerb caption
274+ captionText <- inlineListToLaTeX caption
284275 let capt = if isEmpty captionText
285276 then empty
286277 else text "caption = " <> captionText <> "," <> space
@@ -337,7 +328,7 @@ listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .
337328
338329defListItemToLaTeX :: ([Inline], [[Block]]) -> State WriterState Doc
339330defListItemToLaTeX (term, defs) = do
340− term' <- inlineListToLaTeX $ deVerb term
331+ term' <- inlineListToLaTeX term
341332 def' <- liftM vsep $ mapM blockListToLaTeX defs
342333 return $ "\\item" <> brackets term' $$ def'
343334
@@ -355,23 +346,23 @@ isQuoted _ = False
355346inlineToLaTeX :: Inline -- ^ Inline to convert
356347 -> State WriterState Doc
357348inlineToLaTeX (Emph lst) =
358− inlineListToLaTeX (deVerb lst) >>= return . inCmd "emph"
349+ inlineListToLaTeX lst >>= return . inCmd "emph"
359350inlineToLaTeX (Strong lst) =
360− inlineListToLaTeX (deVerb lst) >>= return . inCmd "textbf"
351+ inlineListToLaTeX lst >>= return . inCmd "textbf"
361352inlineToLaTeX (Strikeout lst) = do
362− contents <- inlineListToLaTeX $ deVerb lst
353+ contents <- inlineListToLaTeX lst
363354 modify $ \s -> s{ stStrikeout = True }
364355 return $ inCmd "sout" contents
365356inlineToLaTeX (Superscript lst) =
366− inlineListToLaTeX (deVerb lst) >>= return . inCmd "textsuperscript"
357+ inlineListToLaTeX lst >>= return . inCmd "textsuperscript"
367358inlineToLaTeX (Subscript lst) = do
368359 modify $ \s -> s{ stSubscript = True }
369− contents <- inlineListToLaTeX $ deVerb lst
360+ contents <- inlineListToLaTeX lst
370361 -- oddly, latex includes \textsuperscript but not \textsubscript
371362 -- so we have to define it (using a different name so as not to conflict with memoir class):
372363 return $ inCmd "textsubscr" contents
373364inlineToLaTeX (SmallCaps lst) =
374− inlineListToLaTeX (deVerb lst) >>= return . inCmd "textsc"
365+ inlineListToLaTeX lst >>= return . inCmd "textsc"
375366inlineToLaTeX (Cite cits lst) = do
376367 st <- get
377368 let opts = stOptions st
@@ -386,7 +377,7 @@ inlineToLaTeX (Code _ str) = do
386377 let chr = ((enumFromTo '!' '~') \\ str) !! 0
387378 if writerListings (stOptions st)
388379 then return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr]
389− else return $ text $ "\\verb" ++ [chr] ++ str ++ [chr]
380+ else return $ text $ "\\texttt{" ++ stringToLaTeX str ++ "}"
390381inlineToLaTeX (Quoted SingleQuote lst) = do
391382 contents <- inlineListToLaTeX lst
392383 let s1 = if (not (null lst)) && (isQuoted (head lst))
@@ -422,7 +413,7 @@ inlineToLaTeX (Link txt (src, _)) =
422413 [Code _ x] | x == src -> -- autolink
423414 do modify $ \s -> s{ stUrl = True }
424415 return $ text $ "\\url{" ++ x ++ "}"
425− _ -> do contents <- inlineListToLaTeX $ deVerb txt
416+ _ -> do contents <- inlineListToLaTeX txt
426417 return $ text ("\\href{" ++ stringToLaTeX src ++ "}{") <>
427418 contents <> char '}'
428419inlineToLaTeX (Image _ (source, _)) = do