From 48e59436ec0cb19bd7ee3966d71af0e41d2debc2 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 6 Aug 2025 20:38:57 +0200 Subject: LaTeX reader and writer: add support for soft hypens The `\-` command is parsed as a soft hyphen character; likewise, the character is written as that command when outputting LaTeX. --- src/Text/Pandoc/Readers/LaTeX/Inline.hs | 1 + src/Text/Pandoc/Writers/LaTeX/Util.hs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Text/Pandoc/Readers/LaTeX/Inline.hs b/src/Text/Pandoc/Readers/LaTeX/Inline.hs index 3021345b1..531cfb3a1 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Inline.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Inline.hs @@ -281,6 +281,7 @@ charCommands = M.fromList , ("_", lit "_") , ("{", lit "{") , ("}", lit "}") + , ("-", lit "\x00ad") -- soft hyphen , ("qed", lit "\a0\x25FB") , ("lq", return (str "‘")) , ("rq", return (str "’")) diff --git a/src/Text/Pandoc/Writers/LaTeX/Util.hs b/src/Text/Pandoc/Writers/LaTeX/Util.hs index c1f16001b..d8abb2a61 100644 --- a/src/Text/Pandoc/Writers/LaTeX/Util.hs +++ b/src/Text/Pandoc/Writers/LaTeX/Util.hs @@ -134,6 +134,7 @@ stringToLaTeX context zs = do ']' -> emits "{]}" -- optional arguments '\'' -> emitcseq "\\textquotesingle" '\160' -> emits "~" + '\x00AD' -> emits "\\-" -- shy hyphen '\x200B' -> emits "\\hspace{0pt}" -- zero-width space '\x202F' -> emits "\\," '\x2026' | ligatures -> emitcseq "\\ldots" -- cgit v1.2.3