git.iko.soy/typeable/pandoc
on master help sign in
Escape spaces. Fixes jgm/pandoc#1694.
commit7960013cd4586542c2d7feab908a8befccc677f0 authorBjorn Buckwalter <bjorn@buckwalter.se> dateWed 15 Oct 2014, 21:06 (12 years ago) parent8b60d43
2 files changed+4−2
src/Text/Pandoc/Writers/LaTeX.hs+3−1 tests/writer.latex+1−1
src/Text/Pandoc/Writers/LaTeX.hs+3−1
@@ -746,8 +746,10 @@ inlineToLaTeX (Code (_,classes,_) str) = do
746746 Nothing -> rawCode
747747 Just h -> modify (\st -> st{ stHighlighting = True }) >>
748748 return (text h)
749− rawCode = liftM (text . (\s -> "\\texttt{" ++ s ++ "}"))
749+ rawCode = liftM (text . (\s -> "\\texttt{" ++ escapeSpaces s ++ "}"))
750750 $ stringToLaTeX CodeString str
751+ where
752+ escapeSpaces = concatMap (\c -> if c == ' ' then "\\ " else [c])
751753inlineToLaTeX (Quoted qt lst) = do
752754 contents <- inlineListToLaTeX lst
753755 csquotes <- liftM stCsquotes get
tests/writer.latex+1−1
@@ -734,7 +734,7 @@ These shouldn't be math:
734734\begin{itemize}
735735\itemsep1pt\parskip0pt\parsep0pt
736736\item
737− To get the famous equation, write \texttt{\$e = mc\^{}2\$}.
737+ To get the famous equation, write \texttt{\$e\ =\ mc\^{}2\$}.
738738\item
739739 \$22,000 is a \emph{lot} of money. So is \$34,000. (It worked if ``lot'' is
740740 emphasized.)