mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
Correct computation of TeX sizes. (#755)
* Em and mu sizes are relative to current font's quad metric,
which might not be "1em" in CSS terms.
* We don't need the `emPerEx` metric, because we want to convert
TeX `ex` to CSS `em`, not TeX `ex` to TeX `em`. The `xHeight`
metric does that already: it is relative to font size.
* Mu sizes scale with the style, em and ex do not (empirically
checked; agrees with rule 2 of TeXbook Appendix G).
This corrects a bug in b866cd5224
(in which em scaled),
and a bug in previous versions (in which mu did not scale).
* Correct rule sizes. Previous comment---"the sizes of rules are
absolute"---was misleading. Rule sizes are NOT absolute---in
\large size, a rule denominated in 'em' is larger. But the 'em'
unit is not sensitive to styles. So now a 1em rule will be the
same size in super/subscript, as it should be, but an 18mu rule
will change size in super/subscript, as it should.
Note a TODO.
This commit is contained in:
committed by
Kevin Barabash
parent
782484eb75
commit
4480f2c987
BIN
test/screenshotter/images/RelativeUnits-chrome.png
Normal file
BIN
test/screenshotter/images/RelativeUnits-chrome.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
test/screenshotter/images/RelativeUnits-firefox.png
Normal file
BIN
test/screenshotter/images/RelativeUnits-firefox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@@ -170,6 +170,15 @@ OverUnderset: |
|
||||
Phantom: \dfrac{1+\phantom{x^{\blue{2}}} = x}{1+x^{\blue{2}} = x}
|
||||
PrimeSpacing: f'+f_2'+f^{f'}
|
||||
PrimeSuper: x'^2+x'''^2+x'^2_3+x_3'^2
|
||||
RelativeUnits: |
|
||||
\begin{array}{ll}
|
||||
a\kern1emb^{a\kern1emb^{a\kern1emb}} &
|
||||
{\footnotesize a\kern1emb^{a\kern1emb^{a\kern1emb}}} \\
|
||||
a\mkern18mub^{a\mkern18mub^{a\mkern18mub}} &
|
||||
{\footnotesize a\mkern18mub^{a\mkern18mub^{a\mkern18mub}}} \\
|
||||
\rule{1em}{1em}^{\rule{1em}{1em}}\rule{18mu}{18mu}^{\rule{18mu}{18mu}} &
|
||||
{\footnotesize\rule{1em}{1em}^{\rule{1em}{1em}}\rule{18mu}{18mu}^{\rule{18mu}{18mu}}}
|
||||
\end{array}
|
||||
RlapBug: \frac{\rlap{x}}{2}
|
||||
Rule: \rule{1em}{0.5em}\rule{1ex}{2ex}\rule{1em}{1ex}\rule{1em}{0.431ex}
|
||||
SizingBaseline:
|
||||
|
Reference in New Issue
Block a user