
在台語中,雙連字符具有語法功能,使用頻率很高。例子:
Āu--ji̍t chiah koh lâi。 (後天再來。)
Āu-ji̍t chiah koh lâi。 (以後再來。)
問題是,雙連字符被轉換為 n 破折號。我知道 -{}- 可以停止轉換。然而,換行符將發生在兩個連字符之間,這也必須防止。因此,就變成了
Āu\mbox{-{}-}{\allowbreak}ji̍t chiah koh lâi.
這看起來很複雜。由於我使用的是 xelatex,我想我可以為序列定義一個命令,同時使其看起來更像一個雙連字符,即使在原始程式碼中也是如此。
\newcommand{\‐‐}{\mbox{‐‐}{\allowbreak}}
\- 中的 ‐ 不是 U+002D,而是 U+2010。與 \mbox 中的相同,這樣我就可以避免連字。據說我可以寫
Āu\‐‐ji̍t chiah koh lâi.
這更容易知道它是雙連字符。
但是,我收到一條錯誤訊息。 ! LaTeX 錯誤:缺少 \begin{document}。
令人費解的是
\newcommand{\‐}{\mbox{‐‐}{\allowbreak}}
工作正常。但它不太理想,因為它看起來不像雙連字符。
如果沒有好的解決辦法,我需要忘記這個\allowbreak
,直接寫兩個U+2010 背靠背。但是帶有雙連字符的單字很長,而且排版也很醜。
答案1
如果您能夠輸入 U+2010,則組合‐‐
(U+2010 U+2010) 將不會產生連字。
你可以有些定義\--
(帶有連字符,但這會刪除 的定義\-
)。
一種可能的替代方法是使用\0--
(帶有兩個連字符):
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Libertinus Serif}
\def\0--{‐‐\allowbreak}% two U+2010 in the body
\begin{document}
Āu--ji̍t chiah koh lâi. (Come again the day after tomorrow.) % two hyphens
Āu‐‐ji̍t chiah koh lâi. (Come again the day after tomorrow.) % two U+2010
Āu\0--ji̍t chiah koh lâi. (Come again the day after tomorrow.) % the command
Āu-ji̍t chiah koh lâi. (Come again in the future.)
\parbox[t]{0pt}{\hspace{0pt}Āu\0--ji̍t chiah koh lâi.}
\end{document}