aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2025-08-06 20:38:57 +0200
committerJohn MacFarlane <[email protected]>2025-08-06 12:08:29 -0700
commit48e59436ec0cb19bd7ee3966d71af0e41d2debc2 (patch)
treede1ab5e41cbe1a9253f21bb06413c0b27c63e1aa
parent0b140a9a988dd6291586753e23fd955c40ae881b (diff)
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.
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/Inline.hs1
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Util.hs1
2 files changed, 2 insertions, 0 deletions
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"