Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctex: 默认字号设置会破坏 LaTeX logo #467

Open
stone-zeng opened this issue Nov 22, 2019 · 2 comments
Open

ctex: 默认字号设置会破坏 LaTeX logo #467

stone-zeng opened this issue Nov 22, 2019 · 2 comments

Comments

@stone-zeng
Copy link
Member

stone-zeng commented Nov 22, 2019

\documentclass[fontset=fandol,zihao=false,autoindent=0pt]{ctexart}
\begin{document}
          \LaTeX{} \textbf{\LaTeX} \par
\large    \LaTeX{} \textbf{\LaTeX} \par
\Large    \LaTeX{} \textbf{\LaTeX} \par
\LARGE    \LaTeX{} \textbf{\LaTeX} \par
\huge     \LaTeX{} \textbf{\LaTeX} \par
\Huge     \LaTeX{} \textbf{\LaTeX} \par
\end{document}

移除 zihao=false 后(右),\Large\LARGE 中的「A」明显变大,与其他字母不能很好地匹配:

@stone-zeng
Copy link
Member Author

最小示例:

\documentclass{minimal}
\DeclareMathSizes{15.05624}{15.05624}{12.045}{9.03374}

\begin{document}
\fontsize{15.05624}{18.06749}\selectfont
\LaTeX{} \textbf{\LaTeX{}}
\end{document}

用 pdffonts 查看,得到:

name                                           type              emb sub uni prob object ID
---------------------------------------------- ----------------- --- --- --- ---- ---------
NBKRPE+LMRoman17-Regular-Identity-H            CID Type 0C       yes yes yes           5  0
QTUMYX+LMRoman12-Regular-Identity-H            CID Type 0C       yes yes yes           7  0
JIIWXQ+LMRoman12-Bold-Identity-H               CID Type 0C       yes yes yes           9  0

而如果改为 \DeclareMathSizes{15.05624}{15.05624}{10}{9},则

name                                           type              emb sub uni prob object ID
---------------------------------------------- ----------------- --- --- --- ---- ---------
FYIPDY+LMRoman17-Regular-Identity-H            CID Type 0C       yes yes yes           5  0
ERATBH+LMRoman10-Regular-Identity-H            CID Type 0C       yes yes yes           7  0
XAAVWO+LMRoman12-Bold-Identity-H               CID Type 0C       yes yes yes           9  0
WCRQAP+LMRoman10-Bold-Identity-H               CID Type 0C       yes yes yes          11  0

\LaTeX 中的「A」会用 LMRoman10,这样的结果比较正常(右):


因为,问题就在于,ctex 中目前的字号设置,是否合理、是否有必要修改呢?以及具体数值的出处在哪里?

ctex-kit/ctex/ctex.dtx

Lines 9148 to 9167 in dacf770

\clist_map_inline:nn
{
{ 8 }{ 8 }{ 5pt }{ 5pt } ,
{ 7 }{ 7 }{ 5pt }{ 5pt } ,
{ -6 }{ -6 }{ 5pt }{ 5pt } ,
{ 6 }{ 6 }{ 5pt }{ 5pt } ,
{ -5 }{ -5 }{ 6pt }{ 5pt } ,
{ 5 }{ 5 }{ 7pt }{ 5pt } ,
{ -4 }{ -4 }{ 8pt }{ 6pt } ,
{ 4 }{ 4 }{ 5 }{ 6 } ,
{ -3 }{ -3 }{ -4 }{ -5 } ,
{ 3 }{ 3 }{ 4 }{ 5 } ,
{ -2 }{ -2 }{ -3 }{ -4 } ,
{ 2 }{ 2 }{ 3 }{ 4 } ,
{ -1 }{ -1 }{ -2 }{ -3 } ,
{ 1 }{ 1 }{ 2 }{ 3 } ,
{ -0 }{ -0 }{ -1 }{ -2 } ,
{ 0 }{ 0 }{ 1 }{ 2 }
}
{ \ctex_declare_math_sizes:nnnn #1 }

@RuixiZhang42
Copy link
Member

从「向后兼容旧文档」的角度来说,不应该更改 \clist_map_inline:nn 列表的值。

这些字号设定的合理性,可以从 LaTeX2e 的 fontdef.dtxslides.dtx 找源头:

https://github.com/latex3/latex2e/blob/abb82c1299b37a12ab40779ee4b64db717f6004b/base/fontdef.dtx#L602-L613

 \DeclareMathSizes{5}{5}{5}{5}
 \DeclareMathSizes{6}{6}{5}{5}
 \DeclareMathSizes{7}{7}{5}{5}
 \DeclareMathSizes{8}{8}{6}{5}
 \DeclareMathSizes{9}{9}{6}{5}
 \DeclareMathSizes{\@xpt}{\@xpt}{7}{5}
 \DeclareMathSizes{\@xipt}{\@xipt}{8}{6}
 \DeclareMathSizes{\@xiipt}{\@xiipt}{8}{6}
 \DeclareMathSizes{\@xivpt}{\@xivpt}{\@xpt}{7}
 \DeclareMathSizes{\@xviipt}{\@xviipt}{\@xiipt}{\@xpt}
 \DeclareMathSizes{\@xxpt}{\@xxpt}{\@xivpt}{\@xiipt}
 \DeclareMathSizes{\@xxvpt}{\@xxvpt}{\@xxpt}{\@xviipt}

https://github.com/latex3/latex2e/blob/abb82c1299b37a12ab40779ee4b64db717f6004b/base/slides.dtx#L541-L547

\DeclareMathSizes{13.82}{13.82}{10}{7}
\DeclareMathSizes{16.59}{16.59}{12}{7}
\DeclareMathSizes{19.907}{19.907}{16.59}{13.82}
\DeclareMathSizes{23.89}{23.89}{19.907}{16.59}
\DeclareMathSizes{28.66}{28.66}{23.89}{19.907}
\DeclareMathSizes{34.4}{34.4}{28.66}{23.89}
\DeclareMathSizes{41.28}{41.28}{34.4}{28.66}

基层 classes 设定数学一二级角标的字号,基本上是参考以下数值 https://github.com/latex3/latex2e/blob/abb82c1299b37a12ab40779ee4b64db717f6004b/base/ltfssbas.dtx#L1794-L1795

\def\defaultscriptratio{.7}
\def\defaultscriptscriptratio{.5}

除非:

% 字号不宜低于 5pt,例如:
\DeclareMathSizes{6}{6}{5}{5}

% 整数 pt 优先,例如:
\DeclareMathSizes{\@xiipt}{\@xiipt}{8}{6} % 而不是 \DeclareMathSizes{\@xiipt}{\@xiipt}{8.4}{6}

% 大字号时,已经是几何 1.2 倍增长,则直接挑选已有字号,例如:
\DeclareMathSizes{\@xxpt}{\@xxpt}{\@xivpt}{\@xiipt}
\DeclareMathSizes{23.89}{23.89}{19.907}{16.59}

另 1,mtpro2 字体包定义

\def\defaultscriptratio{.7}
\def\defaultscriptscriptratio{.55}
...
\DeclareMathSizes{9}{9}{7}{5.5}
\DeclareMathSizes{\@xpt}{\@xpt}{7}{5.5}
...

另 2,unicode-math 包有自己的算法,
latex3/unicode-math#510
latex3/unicode-math#514


总结:设定 \DeclareMathSizes 的任务应该交由字体包与/或特制文档类(各高校的模板),底层 CTeX 文档类不宜改动。

@stone-zeng stone-zeng mentioned this issue Jan 10, 2020
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants