git.iko.soy/typeable/pandoc
on master help sign in
Add thin space when needed in LaTeX quote ligatures.

Closes #5685.

commit0b2fb9b8f952f20000e48c19527f35c2a16dddb1 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 14 Aug 2019, 11:05 (7 years ago) parentace4cdf
2 files changed+15−4
src/Text/Pandoc/Writers/LaTeX.hs+9−4 test/command/5685.md+6
src/Text/Pandoc/Writers/LaTeX.hs+9−4
@@ -333,6 +333,11 @@ stringToLaTeX context zs = do
333333 | ctx == TextString
334334 -> cs <> xs
335335 _ -> cs <> "{}" <> xs
336+ emitquote cs = do
337+ case xs of
338+ '`':_ -> cs <> "\\," <> xs -- add thin space
339+ '\'':_ -> cs <> "\\," <> xs -- add thin space
340+ _ -> cs <> xs
336341 in case x of
337342 '?' | ligatures -> -- avoid ?` ligature
338343 case xs of
@@ -367,10 +372,10 @@ stringToLaTeX context zs = do
367372 '\160' -> emits "~"
368373 '\x202F' -> emits "\\,"
369374 '\x2026' -> emitcseq "\\ldots"
370− '\x2018' | ligatures -> emits "`"
371− '\x2019' | ligatures -> emits "'"
372− '\x201C' | ligatures -> emits "``"
373− '\x201D' | ligatures -> emits "''"
375+ '\x2018' | ligatures -> emitquote "`"
376+ '\x2019' | ligatures -> emitquote "'"
377+ '\x201C' | ligatures -> emitquote "``"
378+ '\x201D' | ligatures -> emitquote "''"
374379 '\x2014' | ligatures -> emits "---"
375380 '\x2013' | ligatures -> emits "--"
376381 _ | writerPreferAscii opts
test/command/5685.mdnew file+6
@@ -0,0 +1,6 @@
1+```
2+% pandoc -f native -t latex
3+[Str "\8222\8218Der",Space,Str "Erz\228hler.",Space,Str "Betrachtungen",Space,Str "zum",Space,Str "Werk",Space,Str "Nikolai",Space,Str "Lesskows\8216\8220."]
4+^D
5+„‚Der Erzähler. Betrachtungen zum Werk Nikolai Lesskows`\,``.
6+```