git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Use `\textquotesingle` for `'` in inline code.

Otherwise we get curly quotes in the PDF output. Closes #1364.

commit87ab01637e1dc0f583277828bc458567a72e38ce authorJohn MacFarlane <jgm@berkeley.edu> dateMon 23 Jun 2014, 12:51 (12 years ago) parente03ed73
2 files changed+3
src/Text/Pandoc/Writers/LaTeX.hs+1 tests/Tests/Writers/LaTeX.hs+2
src/Text/Pandoc/Writers/LaTeX.hs+1
@@ -220,6 +220,7 @@ stringToLaTeX ctx (x:xs) = do
220220 '>' -> "\\textgreater{}" ++ rest
221221 '[' -> "{[}" ++ rest -- to avoid interpretation as
222222 ']' -> "{]}" ++ rest -- optional arguments
223+ '\'' | ctx == CodeString -> "\\textquotesingle{}" ++ rest
223224 '\160' -> "~" ++ rest
224225 '\x2026' -> "\\ldots{}" ++ rest
225226 '\x2018' | ligatures -> "`" ++ rest
tests/Tests/Writers/LaTeX.hs+2
@@ -63,5 +63,7 @@ tests = [ testGroup "code blocks"
6363 strikeout (code "foo" <> space
6464 <> str "bar") =?>
6565 "\\sout{\\texttt{foo} bar}"
66+ , "single quotes" =:
67+ code "dog's" =?> "\\texttt{dog\\textquotesingle{}s}"
6668 ]
6769 ]