latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.9k stars 263 forks source link

Relational operator sizes not agreeing at size 12pt #341

Open xsrvmy opened 4 years ago

xsrvmy commented 4 years ago

Brief outline of the bug

The width of =, < and \le are the same in size 10pt and 11pt, but not 12pt, which can cause misalignment in AMS align enviroments. Extracting the embedded pdf fonts, one can see that \le comes from CMSY10 while = and < comes from CMMI12, so the error probably has something to do with optical size mismatches.

Minimal example showing the bug

\RequirePackage{latexbug}
\documentclass[12pt]{article}
\usepackage{calc}
\setlength\parindent{0pt}

\begin{document}
\newlength\mathwidth
\setlength\mathwidth{\widthof{$a=b$}}
\the\mathwidth

\setlength\mathwidth{\widthof{$a<b$}}
\the\mathwidth

\setlength\mathwidth{\widthof{$a\le b$}}
\the\mathwidth

$a=b|$\\
$a<b|$\\
$a\le b|$
\end{document}

Log file (required) and possibly PDF file

test.log test.pdf

Note that the widths are different, and the | characters are not aligned.

Removing the 12pt option will not produce this bug, but then of course the font is smaller.

RuixiZhang42 commented 4 years ago

I’d say this was by design.

By default, the =, < and > signs were taken from the Text Roman (Upright) font, while the \le and \ge math signs were taken from the Math Symbol font.

For TeX, Knuth never designed a “12-point Math Symbol font” (because he never typeset math formulas at more than 10-point font size). So in LaTeX, when you declare the 12pt class option, the font selection mechanism uses the “10-point Math Symbol font, scaled to 12 points”. Therefore, the “misalignment” is understandable or to be expected.

Sure, it was undesirable. But I don’t think the LaTeX kernel team can do anything about this. I also don’t think Knuth and/or the AMS will consider creating a new optical sized font. You can try to create your own “Computer Modern Math Symbols 12 point” metafont source cmsy12.mf, by tweaking some parameters, though…

Apart from creating a new font, you may also try my “macro” solution: https://tex.stackexchange.com/a/448751

xsrvmy commented 4 years ago

I was more wondering if there could be an option to force the 10 pt math font instead of 12pt actually. I'm comprimising by using 11pt because that still uses 10 pt math.

RuixiZhang42 commented 4 years ago

[…] an option to force the 10 pt math font […]

Not quite… What you want is to force 10-point text font (scaled to 12pt), because the =, < and > signs are from the text font.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity.