可見連字符,為什麼?

可見連字符,為什麼?

lualatex如果使用(版本 beta-0.80.0)編譯,以下小範例文件的 pdf 輸出是錯誤的:

\documentclass{article}
\usepackage{fontspec}% {2016/02/01}{2.5a} 
\begin{document}
lm – Latin mod­ern fonts in out­line for­mats
\end{document}

隱藏的連字符(unicode 軟連字符;html 實體­)可見,但不應可見。輸出看起來像

lm – Latin mod-ern fonts in out-line for-­mats

文字複製自 CTAN 網站:

http://www.ctan.org/tex-archive/fonts/lm

編譯的同一範例xelatex給出了正確的輸出。我在 Linux 上使用最新的 TeXLive。

答案1

如果您期望軟連字符對 XeTeX/LuaTeX 有意義,那麼恐怕您就錯了。

確實,它在 XeTeX 中不可見,但這並不意味著它可以工作。

但是,您可以定義代表 的字元\-

\documentclass{article}
\usepackage{fontspec}                    

\usepackage{newunicodechar}
\newunicodechar{­}{\-}

\begin{document}

lm – Latin mod­ern fonts in out­line for­mats

\parbox[t]{0pt}{
lm – Latin mod­ern fonts in out­line for­mats
}

\end{document}

\parbox是為了顯示盡可能多的連字符點。

在此輸入影像描述

嘗試評論該\newunicodechar行,你會看到單字將被連字符連接。

相關內容