在 TeXbook 中,Knuth 指出斜体可能会导致对齐问题:
练习 14.16
当整个段落以斜体或倾斜字体排版时,有时看起来相对于其他段落在页面上偏移。解释如何使用\leftskip
和\rightskip
将段落的所有行向左移动 1pt
。
下面的文字表明,甚至可以得到飘动边距:
\documentclass{article}
\textwidth=3.85cm
\begin{document}
\it\noindent
This is a small text. If jam is what you like, two fingers up,
or whatever. Under certain conditions you see that the left and
right margins flutter.
\end{document}
效果有点被小的 所强调\textwidth
,但编译后并没有显示任何过满的水平盒子。特别是左边距在我看来看起来很糟糕。
有没有办法在 TeX 中解决这个问题?我更喜欢 LaTeX 答案,但最终我对任何 TeX 版本都持开放态度。
我知道这实际上是一个字体问题;这是由于 CM 斜体字体的设计方式造成的。(事实上,我已经问和已回答有关斜体问题的几个问题。)是否存在斜体字体的问题不太明显甚至不存在?
答案1
使用 2.5 版 microtype
包,自 2013 年 3 月 13 日起在 CTAN 上可用,我的问题的简单答案是“使用 microtype
“。
谢谢 Herbert 和 Joseph 告诉我这个microtype
包可以实现。我知道这个包microtype
可以调整边距字距,但我一直以为这只适用于标点符号。实际上,你可以调整每个字母的边距字距。
我一直在想:为什么 Herbert 和 Joseph 的答案中的输出稍好一些,但仍然远远不够好?答案当然是提供的边距字距调整表microtype
不够好。所以我继续浏览了所有字母...输出现在如下所示,我对此非常满意:
以下是代码,主要由调整后的边距字距表组成(现已添加到 microtype
包裹):
\documentclass{article}
\textwidth=3.85cm
\usepackage{microtype}
\LoadMicrotypeFile{cmr}
\SetProtrusion
[ name = cmr-it ]
{ }
{
A = {100,100},
B = {83,-40},
C = {165,-75},
D = {75, -28},
E = {80,-55},
F = {85,-80},
G = {153,-15},
H = {73,-60},
I = {140,-120},
J = {135,-80},
K = {70,-30},
L = {87, 40},
M = {67,-45},
N = {75,-55},
O = {150,-30},
P = {82,-50},
Q = {150,-30},
R = {75, 15},
S = {90,-65},
$ = {100,-20},
T = {220,-85},
U = {230,-55},
V = {260,-60},
W = {185,-55},
X = {70,-30},
Y = {250,-60},
Z = {90,-60},
a = {150,-10},
b = {170, },
c = {173,-10},
d = {150,-55},
e = {180, },
f = { ,-250},
g = {150,-10},
h = {100, },
i = {210, },
j = { ,-40},
k = {110,-50},
l = {240,-110},
m = {80, },
n = {115, },
o = {155, },
p = { , },
q = {170,-40},
r = {155,-40},
s = {130, },
t = {230,-10},
u = {120, },
v = {140,-25},
w = {98,-20},
x = {65,-40},
y = {130,-20},
z = {110,-80},
0 = {170,-85},
1 = {230,110},
2 = {130,-70},
3 = {140,-70},
4 = {130,80},
5 = {160, },
6 = {175,-30},
7 = {250,-150},
8 = {130,-40},
9 = {155,-80},
. = { ,500},
{,}= { ,450},
: = { ,300},
; = { ,300},
& = {130,30},
\% = {180,50},
* = {380,20},
+ = {180,200},
@ = {180,10},
~ = {200,150},
( = {300, }, ) = { ,70},
/ = {100,100},
- = {500,300},
\textendash = {500,300}, \textemdash = {400,170},
\textquoteleft = {800,200}, \textquoteright = {800,-20},
\textquotedblleft = {540,100}, \textquotedblright = {500,100}
}
\begin{document}
\noindent\itshape
This is a small text. If jam is what you like, two fingers up,
or whatever. Under certain conditions you see that the left and
right margins flutter.
\end{document}
答案2
microtype 有一个可选参数,你可以允许将字符向右移动更多,例如[factor=1300]
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern,picture}
\usepackage{microtype}
\textwidth=3.85cm
\begin{document}
\itshape\noindent\makebox(0,0){\put(\textwidth,-2cm){\line(0,-1){80}}}%
This is a small text. If jam is what you like, two fingers up,
or whatever. Under certain conditions you see that the left and
right margins flutter.
\end{document}
这里的输出带有可选[factor=1100,stretch=80]
参数microtype
答案3
我个人认为使用拉丁现代字体microtype
似乎是更好的方法
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern,microtype}
\textwidth=3.85cm
\begin{document}
\it\noindent
This is a small text. If jam is what you like, two fingers up,
or whatever. Under certain conditions you see that the left and
right margins flutter.
\end{document}