我正在写一本大约有 200 多页 A5 纸的书。在从 pdflatex 迁移到 xelatex 的过程中,我注意到一些严重的布局差异。为了找出问题所在,我开始关注 pdflatex 的 MWE。
\documentclass[paper=a5,pagesize,fontsize=13pt]{scrbook}
\usepackage{showframe}
\usepackage[T1]{fontenc}
\usepackage[osf]{libertine}
\begin{document}
Hello, here is some text without a meaning. This text
should show what a printed text will look like at this place.
\end{document}
如果
\usepackage[T1]{fontenc}
生效后,第一行文本将以“This text”结尾。如果注释掉,则将以“This text should”结尾,同样会产生一个溢出框。
答案1
差异在于
OT1:
.\OT1/LinuxLibertineT-TOsF/m/n/13 i
.\OT1/LinuxLibertineT-TOsF/m/n/13 n
.\OT1/LinuxLibertineT-TOsF/m/n/13 g
.\OT1/LinuxLibertineT-TOsF/m/n/13 .
.\glue 3.7921 plus 4.875 minus 0.36096
.\OT1/LinuxLibertineT-TOsF/m/n/13 (ligature Th)
.\OT1/LinuxLibertineT-TOsF/m/n/13 i
.\OT1/LinuxLibertineT-TOsF/m/n/13 s
.\glue 3.25 plus 1.625 minus 1.08289
.\OT1/LinuxLibertineT-TOsF/m/n/13 t
.\OT1/LinuxLibertineT-TOsF/m/n/13 e
.\kern-0.091
.\OT1/LinuxLibertineT-TOsF/m/n/13 x
.\OT1/LinuxLibertineT-TOsF/m/n/13 t
T1:
....\T1/LinuxLibertineT-TOsF/m/n/13 i
....\T1/LinuxLibertineT-TOsF/m/n/13 n
....\T1/LinuxLibertineT-TOsF/m/n/13 g
....\T1/LinuxLibertineT-TOsF/m/n/13 .
....\glue 3.7921 plus 4.875 minus 0.36096
....\T1/LinuxLibertineT-TOsF/m/n/13 T
....\T1/LinuxLibertineT-TOsF/m/n/13 h
....\T1/LinuxLibertineT-TOsF/m/n/13 i
....\T1/LinuxLibertineT-TOsF/m/n/13 s
....\glue 3.25 plus 1.625 minus 1.08289
....\T1/LinuxLibertineT-TOsF/m/n/13 t
....\T1/LinuxLibertineT-TOsF/m/n/13 e
....\kern-0.091
....\T1/LinuxLibertineT-TOsF/m/n/13 x
....\T1/LinuxLibertineT-TOsF/m/n/13 t
也就是说,OT1 字体有一个 Th 连字符,而 T1 字体中没有。这有点令人惊讶,但不一定是个错误。之后,单词长度略有不同,这足以导致段落换行符采用不同的路径。
你可以避免使用连字符
\documentclass[paper=a5,pagesize,fontsize=13pt]{scrbook}
\usepackage{showframe}
%\usepackage[T1]{fontenc}
\usepackage[osf]{libertine}
%\showoutput
\begin{document}
Hello, here is some text without a meaning. T{}his text
should show what a printed text will look like at this place.
\end{document}
答案2
microtype
你可以通过加载并发出以下命令来禁用 OT1 字体中可怕的 Th 连字符
\DisableLigatures[T]{encoding=OT1}
但这样做的缺点是针对 T 的字距调整也被禁用,如下例所示。
\documentclass[paper=a5,pagesize,fontsize=13pt]{scrbook}
\usepackage{showframe}
\usepackage[T1]{fontenc}
\usepackage[osf]{libertine}
\usepackage{microtype}
\DisableLigatures[T]{encoding=OT1}
\begin{document}
\fontencoding{OT1}\selectfont
Hello, here is some text without a meaning. This text
should show what a printed text will look like at this place.
To
\fontencoding{T1}\selectfont
Hello, here is some text without a meaning. This text
should show what a printed text will look like at this place.
To
\end{document}
所以你的问题没有真正的解决办法。你可以要求软件包的维护者libertine
添加一个选项,用于禁用 OT1 编码中的 Th 连字符(需要一组新的虚拟字体)。在我看来,这将是一个非常很好的功能,因为我觉得连字符真的很糟糕。