git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Avoid inadvertently creating ?` or !` ligatures.

These are upside down ? and !, resp. Closes #5407.

commit93ee73e1dc0405ddf71417d907656c2a8726f133 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 29 Mar 2019, 10:04 (8 years ago) parent5fa4ea8
2 files changed+22
src/Text/Pandoc/Writers/LaTeX.hs+8 test/command/5407.md+14
src/Text/Pandoc/Writers/LaTeX.hs+8
@@ -340,6 +340,14 @@ stringToLaTeX context zs = do
340340 -> cs <> xs
341341 _ -> cs <> "{}" <> xs
342342 in case x of
343+ '?' | ligatures -> -- avoid ?` ligature
344+ case xs of
345+ '`':_ -> emits "?{}"
346+ _ -> emitc x
347+ '!' | ligatures -> -- avoid !` ligature
348+ case xs of
349+ '`':_ -> emits "!{}"
350+ _ -> emitc x
343351 '{' -> emits "\\{"
344352 '}' -> emits "\\}"
345353 '`' | ctx == CodeString -> emitcseq "\\textasciigrave"
test/command/5407.mdnew file+14
@@ -0,0 +1,14 @@
1+```
2+% pandoc -t latex --wrap=preserve
3+hi there?“
4+hi there!“
5+hi there?‘
6+hi there!‘
7+hi there!
8+^D
9+hi there?{}``
10+hi there!{}``
11+hi there?{}`
12+hi there!{}`
13+hi there!
14+```