Motivation
For my CJK documents, I’m mixing TeX Gyre Termes (a Times clone) with Source Han Serif and TeX Gyre Heros (a Helvetica clone) with Source Han Sans. I’m also using the MathTime Professional 2 fonts for my formulae. However, the Latin and math letters appear smaller than the CJK characters, so I need to scale up the former.
- The Roman family: The largest cap height among the four TeX Gyre Termes fonts is
676/1000
(TeX Gyre Termes bold), while the cap height of Source Han Serif is729/1000
. So a scale factor of1.078402
(729/676) is fine. - The sans family: The cap height of TeX Gyre Heros is
729/1000
, while that of Source Han Sans is733/1000
. So a scale factor of1.005487
(733/729) is fine. - The math family: A scale factor of
1.078402
(same as the Roman family) is fine.
My attempt
The first two requests can be met by a single line of code:
\usepackage[scaled=1.078402,helvratio=0.932386]{newtxtext}
where TeX Gyre Heros is loaded at scale 1.078402*0.932386
.
The mtpro2
package doesn’t come with a scaled
key value option. To meet the third request, I resorted to a manual solution: \DeclareMathSizes
. And, according to this answer, the amsmath
package should be loaded to use text font changing commands in mathematics that resize appropriately. But using \DeclareMathSizes
leads to unexpected results:
Strange scaling within scripts
By scaling mtpro2
manually via \DeclareMathSizes
, scaling newtxtext
automatically via scaled=
and loading amsmath
, I noticed strange scaling behaviors within math scripts. If you wish to reproduce the following result, please make sure that NotoSerifCJKsc-[weight].otf is installed and please compile by XeLaTeX
:
% Please install Noto Serif CJK SC and compile by XeLaTeX
\documentclass[zihao=5,fontset=none,no-math,linespread=1.25]{ctexart}
\usepackage[lite]{mtpro2}
% Scale up math sizes manually
% Based on \DeclareMathSizes{10.5bp}{10.5bp}{7pt}{5pt} from the CTeX classes
\DeclareMathSizes{10.5bp}{11.365687pt}{7.548817pt}{5.392012pt}
% Scale up Latin size automatically
\usepackage[scaled=1.078402,helvratio=0.932386]{newtxtext}
% Set up CJK font
\setCJKmainfont{Noto Serif CJK SC}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\newcommand{\measurement}[1]{%
\setbox0=\hbox{#1}%
#1 has width \the\wd0\relax}
\newcommand{\drawembox}[1]{%
\setlength{\fboxrule}{.1pt}%
\setlength{\fboxsep}{-\fboxrule}%
\fbox{\rule[\dimexpr\the\fontdimen22#1-.5\fontdimen6#1\relax]{0pt}{\the\fontdimen6#1\relax}%
\rule{\the\fontdimen6#1\relax}{0pt}}}
\newcommand{\drawcapline}[1]{%
\leavevmode\rlap{\color{red}%
\rule[\dimexpr#1-.05pt\relax]{\linewidth}{.1pt}}}
\newcommand*{\ideographicbaseline}{-.12}
\newcommand{\drawcembox}[1]{%
\setlength{\fboxrule}{.1pt}%
\setlength{\fboxsep}{-\fboxrule}%
\fbox{\rule[\ideographicbaseline#1]{0pt}{#1}%
\rule{#1}{0pt}}}
\begin{document}
$\null$%
\verb|\the\ccwd|: \the\ccwd\relax
\verb|\fontdimen6\font|: \the\fontdimen6\font\relax
\verb|\fontdimen6\textfont2|: \the\fontdimen6\textfont2\relax
\verb|\fontdimen6\scriptfont2|: \the\fontdimen6\scriptfont2
\verb|\fontdimen6\scriptscriptfont2|: \the\fontdimen6\scriptscriptfont2
\medskip
\hrule
\medskip
\noindent
\begin{minipage}{.333\linewidth}
\verb|$M$|:
\leavevmode\rlap{\drawembox{\textfont2}}%
\drawcapline{.675\fontdimen6\textfont2}%
\measurement{$M$}
\leavevmode\rlap{\drawembox{\textfont2}}%
\drawcapline{.675\fontdimen6\textfont2}%
\measurement{$\displaystyle M$}
\leavevmode\rlap{\drawembox{\textfont2}}%
\drawcapline{.675\fontdimen6\textfont2}%
\measurement{$\textstyle M$}
\leavevmode\rlap{\drawembox{\scriptfont2}}%
\drawcapline{.722\fontdimen6\scriptfont2}%
\measurement{$\scriptstyle M$}
\leavevmode\rlap{\drawembox{\scriptscriptfont2}}%
\drawcapline{.732\fontdimen6\scriptscriptfont2}%
\measurement{$\scriptscriptstyle M$}
\end{minipage}%
\begin{minipage}{.333\linewidth}
\verb|\textbf{M}|:
\leavevmode\rlap{\drawembox{\textfont2}}%
\drawcapline{.676em}%
\measurement{\textbf{M}}
\leavevmode\rlap{\drawembox{\textfont2}}%
\drawcapline{.676\fontdimen6\textfont2}%
\measurement{$\displaystyle\textbf{M}$}
\leavevmode\rlap{\drawembox{\textfont2}}%
\drawcapline{.676\fontdimen6\textfont2}%
\measurement{$\textstyle\textbf{M}$}
\leavevmode\rlap{\drawembox{\scriptfont2}}%
\drawcapline{.729\fontdimen6\scriptfont2}%
\measurement{$\scriptstyle\textbf{M}$}
\leavevmode\rlap{\drawembox{\scriptscriptfont2}}%
\drawcapline{.729\fontdimen6\scriptscriptfont2}%
\measurement{$\scriptscriptstyle\textbf{M}$}
\end{minipage}%
\begin{minipage}{.333\linewidth}
字:
\leavevmode\rlap{\drawcembox{\ccwd}}%
\measurement{字}
\leavevmode\rlap{\drawcembox{\ccwd}}%
\measurement{$\displaystyle\text{字}$}
\leavevmode\rlap{\drawcembox{\ccwd}}%
\measurement{$\textstyle\text{字}$}
\leavevmode\rlap{\drawcembox{\fontdimen6\scriptfont2\relax}}%
\measurement{$\scriptstyle\text{字}$}
\leavevmode\rlap{\drawcembox{\fontdimen6\scriptscriptfont2\relax}}%
\measurement{$\scriptscriptstyle\text{字}$}
\end{minipage}
\end{document}
My observations
\ccwd
yields the size of the em-box for CJK characters:10.5bp = 10.539375pt
.- The first 3 rows: For
\displaystyle
or\textstyle
, both the Latin em-box and the math em-box are properly scaled by1.078402
, as expected.- MathTime Pro 2: The designed cap height is
675/1000
. After the manual scaling, the scaled cap height to the math em and to the\ccwd
ratios are0.675
and0.72792
(0.675*729/676), respectively, as expected. - TeX Gyre Termes bold: The designed cap height is
676/1000
. After the automatic scaling, the scaled cap height to the Latin em and to the\ccwd
ratios are0.676
and0.729
, respectively, as expected.
- MathTime Pro 2: The designed cap height is
- The 6 cap lines in the first 3 rows hardly have any distinction, as expected, although those of MathTime Pro 2 are in fact slightly lower.
- The 4th row: For
\scriptstyle
, it appears that all em-boxes are of the same size, as declared, which means: Math em = Latin em =\ccwd
.- MathTime Pro 2: The designed cap height is
722/1000
and its ratio to the\ccwd
(= math em) is precisely0.722
. - TeX Gyre Termes bold: The designed cap height is
676/1000
, but the actual cap height to the Latin em (=\ccwd
) ratio somehow becomes0.729
! It seems like the glyph is magnified by1.078402
but somehow the em-box stays at the same size. Why? - The math cap line is slightly lower than the Latin one: 0.722<0.729.
- MathTime Pro 2: The designed cap height is
- The 5th row: For
\scriptscriptstyle
, it also appears that all em-boxes are of the same size, as declared.- MathTime Pro 2: The designed cap height is
732/1000
and its ratio to the\ccwd
(= math em) is precisely0.732
. - TeX Gyre Termes bold: Again, the actual cap height to the Latin em (=
\ccwd
) ratio somehow becomes0.729
! Why? - The math cap line is slightly higher than the Latin one (by pixels if the PDF is magnified by 6400%): 0.732>0.729.
- MathTime Pro 2: The designed cap height is
Summary
There are 15 glyphs drawn in the MWE, all but 2 of which are understandably scaled. The bottom 2 glyphs in the middle column seem to be scaled while somehow maintain their em-boxes unchanged.
By pure coincidence (even with the aforementioned “mistake”), the actual cap height to \ccwd
ratios ended up surprisingly close to each other throughout 3 fonts and 3 math styles, which were aimed at 0.729
in the beginning.
Table: Actual cap height to \ccwd ratio
---------------------------------------------------------------------------------
display/text style script style script script style
---------------------------------------------------------------------------------
mtpro2 0.72792 0.722 0.732
Termes bold 0.729 0.729*, why? 0.729*, why?
Source Han Serif 0.729 (by design) 0.729 (by design) 0.729 (by design)
---------------------------------------------------------------------------------
* These should be 0.676, shouldn’t they?
Added on July 4, 2018: Here is a full table showing the strange scaling behaviors within math scripts.
How to properly scale up fonts from newtxtext
and mtpro2
?
I got extremely lucky with the cap heights. Is this the proper way of matching these mentioned fonts? More specifically:
Is there a better way to scale up MathTime Pro 2? It’d be nice to use it just like
\usepackage[scaled=1.1]{newtxmath}
.I’m open to modifying the
mtpro2.sty
file, as it contains many known problems. For instance, problems pointed out in this answer by @egreg and in this comment by @DavidCarlisle.In fact, a redefinition of
\left
and\right
would break the\LEFTRIGHT
command from accessing large curly parentheses and braces. I solved this by replacing\def\PEX@#1{\setbox\Pbox@\vbox{$$\left.\vcenter{\copy\prePbox@}\right)$$}%
with
\def\PEX@#1{\setbox\Pbox@\vbox{$$\originalleft.\vcenter{\copy\prePbox@}\originalright)$$}%
Why is the text font at different math styles scaled inconsistently?
\mathit
work?amsmath
seems to solve the problem (partially), but it creates something subtler. I also believe using\mathit
makes the glyphs in the whole middle column to be scaled “twice”.\textit
problem disappeared after I read this answer. I removed that MWE to highlight the very subtle and previously hidden scaling problem in math scripts.