Merge pull request #1695 from bjornbm/master

Escape inline verbatim spaces in LaTeX output
This commit is contained in:
John MacFarlane 2014-12-10 09:07:46 -08:00
commit 4ffa70970d
2 changed files with 4 additions and 2 deletions

View file

@ -746,8 +746,10 @@ inlineToLaTeX (Code (_,classes,_) str) = do
Nothing -> rawCode Nothing -> rawCode
Just h -> modify (\st -> st{ stHighlighting = True }) >> Just h -> modify (\st -> st{ stHighlighting = True }) >>
return (text h) return (text h)
rawCode = liftM (text . (\s -> "\\texttt{" ++ s ++ "}")) rawCode = liftM (text . (\s -> "\\texttt{" ++ escapeSpaces s ++ "}"))
$ stringToLaTeX CodeString str $ stringToLaTeX CodeString str
where
escapeSpaces = concatMap (\c -> if c == ' ' then "\\ " else [c])
inlineToLaTeX (Quoted qt lst) = do inlineToLaTeX (Quoted qt lst) = do
contents <- inlineListToLaTeX lst contents <- inlineListToLaTeX lst
csquotes <- liftM stCsquotes get csquotes <- liftM stCsquotes get

View file

@ -734,7 +734,7 @@ These shouldn't be math:
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \itemsep1pt\parskip0pt\parsep0pt
\item \item
To get the famous equation, write \texttt{\$e = mc\^{}2\$}. To get the famous equation, write \texttt{\$e\ =\ mc\^{}2\$}.
\item \item
\$22,000 is a \emph{lot} of money. So is \$34,000. (It worked if ``lot'' is \$22,000 is a \emph{lot} of money. So is \$34,000. (It worked if ``lot'' is
emphasized.) emphasized.)