LaTeX writer: Avoid inadvertently creating ? or ! ligatures.

These are upside down ? and !, resp.

Closes #5407.
This commit is contained in:
John MacFarlane 2019-03-29 10:04:22 -07:00
parent 5fa4ea8eb1
commit 93ee73e1dc
2 changed files with 22 additions and 0 deletions

View file

@ -340,6 +340,14 @@ stringToLaTeX context zs = do
-> cs <> xs -> cs <> xs
_ -> cs <> "{}" <> xs _ -> cs <> "{}" <> xs
in case x of in case x of
'?' | ligatures -> -- avoid ?` ligature
case xs of
'`':_ -> emits "?{}"
_ -> emitc x
'!' | ligatures -> -- avoid !` ligature
case xs of
'`':_ -> emits "!{}"
_ -> emitc x
'{' -> emits "\\{" '{' -> emits "\\{"
'}' -> emits "\\}" '}' -> emits "\\}"
'`' | ctx == CodeString -> emitcseq "\\textasciigrave" '`' | ctx == CodeString -> emitcseq "\\textasciigrave"

14
test/command/5407.md Normal file
View file

@ -0,0 +1,14 @@
```
% pandoc -t latex --wrap=preserve
hi there?“
hi there!“
hi there?
hi there!
hi there!
^D
hi there?{}``
hi there!{}``
hi there?{}`
hi there!{}`
hi there!
```