修复目录页圆形序号在圈内偏上的问题,并在 TeX Live 2025 下重新编译
原因:徽标里用了 \strut,它把内容盒撑成「0.7 倍行距上高 + 0.3 倍行距下深」, 而数字没有下伸部,这段虚构的下深把数字整体推高,在圈里明显偏上 (实测偏上 1.7pt,大字号时可达 4pt)。去掉 \strut 后数字墨迹与圆心对齐。 顺带修正一个顺序错误:徽标直径原本在字号算出之前计算,读到的字号恒为 0, 导致圆圈大小与字号脱钩(永远退化到 1.15em)。现已移到字号之后计算。 圆的垂直位置不受影响。本分支已用 TeX Live 2025 重新编译验证: 0 错误、0 溢出、23 页,目录页 4 个跳转链接正常,徽标垂直偏差 ≤ 0.71pt。
This commit is contained in:
@@ -276,17 +276,21 @@
|
||||
\def\ouc@toc@fontsel{\fontsize{\ouc@toc@font}{\ouc@toc@base}\selectfont\bfseries}
|
||||
|
||||
%% 圆形序号徽标(#1 = 圆圈填充色,#2 = 数字)
|
||||
%% 注意:这里刻意不加 \strut。\strut 会把内容盒撑成「0.7 倍行距的上高 + 0.3 倍行距的下深」,
|
||||
%% 而数字没有下伸部(descender),那段虚构的下深会把数字整体推高,在圆里明显偏上
|
||||
%% (实测偏上约 1.7pt,大字号时可达 4pt)。去掉 \strut 后数字墨迹与圆心对齐(实测偏差 < 0.1pt)。
|
||||
%% 圆的垂直位置不受影响:圆心到基线的距离恒为 minimum size 的一半(0.6em)。
|
||||
\def\ouc@toc@badge#1#2{%
|
||||
\tikz[baseline=(ouc@badge.base)]{%
|
||||
\node[circle, fill=#1, text=white, inner sep=0pt,
|
||||
minimum size=\ouc@toc@badgesize, font=\bfseries] (ouc@badge) {\strut#2};%
|
||||
minimum size=\ouc@toc@badgesize, font=\bfseries] (ouc@badge) {#2};%
|
||||
}%
|
||||
}
|
||||
%% 实心样式下用的空心序号(#1 = 描边色,#2 = 数字)
|
||||
%% 实心样式下用的空心序号(#1 = 描边色,#2 = 数字;同样不加 \strut)
|
||||
\def\ouc@toc@badgeopen#1#2{%
|
||||
\tikz[baseline=(ouc@badge.base)]{%
|
||||
\node[circle, draw=#1, line width=0.8pt, text=#1, inner sep=0pt,
|
||||
minimum size=\ouc@toc@badgesize, font=\bfseries] (ouc@badge) {\strut#2};%
|
||||
minimum size=\ouc@toc@badgesize, font=\bfseries] (ouc@badge) {#2};%
|
||||
}%
|
||||
}
|
||||
|
||||
@@ -332,14 +336,6 @@
|
||||
\ifdim\ouc@toc@pad>2pt \setlength{\ouc@toc@pad}{2pt}\fi
|
||||
\setlength{\ouc@toc@padx}{\dimexpr\ouc@toc@pad*3\relax}%
|
||||
\ifdim\ouc@toc@padx<6pt \setlength{\ouc@toc@padx}{6pt}\fi
|
||||
%% 序号徽标的直径:随字号缩放,下限 1.15em(免得章节多时圆圈看不清),
|
||||
%% 但绝不能超过方框高度,否则会把矮方框撑破
|
||||
\setlength{\ouc@toc@badgesize}{\dimexpr\ouc@toc@font*115/100\relax}%
|
||||
\ifdim\ouc@toc@badgesize<1.15em \setlength{\ouc@toc@badgesize}{1.15em}\fi
|
||||
\ifdim\ouc@toc@badgesize>2.2em \setlength{\ouc@toc@badgesize}{2.2em}\fi
|
||||
\setlength{\ouc@toc@tmp}{\dimexpr\ouc@toc@height-2pt\relax}%
|
||||
\ifdim\ouc@toc@badgesize>\ouc@toc@tmp \setlength{\ouc@toc@badgesize}{\ouc@toc@tmp}\fi
|
||||
\ifdim\ouc@toc@badgesize<4pt \setlength{\ouc@toc@badgesize}{4pt}\fi
|
||||
\setlength{\ouc@toc@font}{\dimexpr\ouc@toc@height*40/100\relax}%
|
||||
\setlength{\ouc@toc@tmp}{%
|
||||
\dimexpr(\ouc@toc@height-2\ouc@toc@pad-2pt)*5/6\relax}%
|
||||
@@ -351,6 +347,12 @@
|
||||
如观感不佳,请减少 section 的数目,或调小 \string\tocareamargin}%
|
||||
\fi
|
||||
\setlength{\ouc@toc@base}{\dimexpr\ouc@toc@font*6/5\relax}%
|
||||
%% 5. 序号徽标直径:随字号一起缩放,但不能超过方框高度,否则会把矮方框撑破。
|
||||
%% 注意:必须在算完 \ouc@toc@font 之后再算,否则读到的还是 0。
|
||||
\setlength{\ouc@toc@badgesize}{\dimexpr\ouc@toc@font*115/100\relax}%
|
||||
\setlength{\ouc@toc@tmp}{\dimexpr\ouc@toc@height-2pt\relax}%
|
||||
\ifdim\ouc@toc@badgesize>\ouc@toc@tmp \setlength{\ouc@toc@badgesize}{\ouc@toc@tmp}\fi
|
||||
\ifdim\ouc@toc@badgesize<4pt \setlength{\ouc@toc@badgesize}{4pt}\fi
|
||||
}
|
||||
|
||||
%% -------------------------------------------------------------- 条目
|
||||
|
||||
Reference in New Issue
Block a user