-
Notifications
You must be signed in to change notification settings - Fork 30
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
'Dimension too large' error when \setmathfont has the option Scale=MatchLowercase #515
Comments
Sorry, I think I'm doing something wrong but I can't reproduce it. Can you use fonts that are provided in TeX Live? E.g., does the following work for you?
|
Experiencing the same, but only with beamer. This does not compile : \documentclass{beamer}
\usepackage{fontspec}
\usepackage[math-style=ISO, bold-style=ISO]{unicode-math}
\setmathfont{texgyrepagella-math.otf}[Scale = MatchLowercase]
\setmathfont{Asana-Math.otf}[range={\varnothing}, Scale = MatchLowercase]
\setmathfont{texgyrepagella-math.otf}[range={\int}, Scale = MatchLowercase] %%
\begin{document}
$a\models b$
\end{document} neither does this \documentclass{beamer}
\usepackage{fontspec}
\usepackage[math-style=ISO, bold-style=ISO]{unicode-math}
\setmathfont{texgyrepagella-math.otf}[Scale = MatchLowercase]
\setmathfont{Asana-Math.otf}[range={\varnothing}]
\setmathfont{texgyrepagella-math.otf}[range={\int}] %%
\begin{document}
$a\models b$
\end{document} But this does \documentclass{article}
\usepackage{fontspec}
\usepackage[math-style=ISO, bold-style=ISO]{unicode-math}
\setmathfont{texgyrepagella-math.otf}[Scale = MatchLowercase]
\setmathfont{Asana-Math.otf}[range={\varnothing}, Scale = MatchLowercase]
\setmathfont{texgyrepagella-math.otf}[range={\int}, Scale = MatchLowercase] %%
\begin{document}
$a\models b$
\end{document} This also does \documentclass{beamer}
\usepackage{fontspec}
\usepackage[math-style=ISO, bold-style=ISO]{unicode-math}
\setmathfont{texgyrepagella-math.otf}[Scale = MatchLowercase]
\begin{document}
$a\models b$
\end{document} |
Quite possibly due to my previous proposal to move |
The behavior of the overflow is quite bizarre: In all my documents, where I have For the combination in the OP, the x-heights for Georgia and Cambria Math are \documentclass{article}
\usepackage{unicode-math}
\setmathfont[Scale=1.031380753]{latinmodern-math.otf}
\begin{document}
n $n \sqrt[n]{n}$
\end{document} with error message: ! Dimension too large.
<recently read> \l__um_font |
Oh dear! Even Ulrike Fischer’s proposed solution in the linked TeX.SX post cannot deal with \documentclass{article}
\usepackage{unicode-math}
\ExplSyntaxOn
\cs_set:Nn \__um_fontdimen_to_percent:nN
{
\fp_eval:n { \dim_to_decimal_in_sp:n { \fontdimen #1 #2 } / 100 }
}
\ExplSyntaxOff
\setmathfont[Scale=1.031380753]{latinmodern-math.otf}
\begin{document}
n $n \sqrt[n]{n}$
\end{document} I still get an error of However, neither |
I'm glad I asked for the additional validation cases — like you say @RuixiZhang42 I suspect this is quite a subtle problem and might need some creative approaches to executing the calculations with branching depending on the inputs. |
@wspr This was exactly what I feared in my comment from #287 \documentclass{article}
\usepackage{unicode-math}
\newcommand*\temp{0.7}% failed at 0.7, 0.8, 0.9, 1.1, and of course, 1.03138
\setmathfont[Scale=\temp]{latinmodern-math.otf}
\begin{document}
$n \sqrt[n]{n}$
\end{document} The |
We can be sloppy and apply |
What is |
@u-fischer & @RuixiZhang42 — sorry, I don't have time tonight to look into this further but thanks for your input! Ulrike, here's what this is supposed to be doing:
I.e., the "script size font" is supposed to be 74% of the "text size" font. (Also see Appendix D of the unicode-math package docs.) |
@RuixiZhang42 — I suspect you're correct that the problem is the unintended overlap of sizes with fam2 & fam3. Instead of multiplying by |
@u-fischer I believe when When I proposed to pre-multiply |
@wspr I came up with an algorithm which allows a dynamic
As you can see, I am instructing
In this case, we only loop once to get
|
@RuixiZhang42 Inside \r@@t the fontdimen has this value:
|
@u-fischer Thank you for providing the additional information. Your newest example illustrates the clearly wrong fontdimen 10 used, and confirms my point that You see, with your improvement, @wspr I can confirm that this is caused by overlapping font dimension parameters.
|
Why are the fontdimen remapped like this, if the families overlap? |
@u-fischer The legacy TeX fontdimens’ assume parameters come from different fonts: fam2 comes from OMS ( @wspr The current fixed IMHO, to fully overcome the problem in Theorem 1 below, I strongly encourage anyone who are interested to try the boundary values in Corollary 1.2. These special boundaries are obtained by setting the integer k in Theorem 1 to 67591, 67592 and 67593.
|
Excuse the naïve question, but is TeX’s prohibition of reloading a font at the same size a fundamental limitation of how TeX works, or is it just a restriction imposed to prevent redundancy? I ask because, if the latter is the case, it sounds like a lot of headaches could be prevented by patching XeTeX and LuaTeX to remove the restriction. |
@tail-reversion — it's just an optimisation from the '70s to save memory. (I actually thought it was different in LuaTeX but my test file shows the same behaviour as XeTeX.) It's outside my area of expertise to comment on whether it would be feasible to replace. There are other internal parts of TeX the Program that survive into the modern era (such as a relatively poor hash algorithm) that would be good to replace but no-one has attempted upgrades like this as far as I know. |
@u-fischer — @RuixiZhang42 has it right, the only reason to load fam2 and 3 remapped with "legacy" font dimensions is to avoid rewriting every part of LaTeX & amsmath & assorted packages that use fontdimens from those families for various calculations. @RuixiZhang42 — thank you so much for your extended analysis here, fascinating stuff. I took a look in the NFSS again to remind myself what my code was doing, and there's no (easy) way to add an absolute increment to the pt size being loaded (i.e., it has to be a scale value like we have). So something along the lines of your dynamic algorithm is the best approach for us to take IMO. Of course... we should probably be a little conservative in that if a maths font is set up at 12pt with the smallest scaling such that fam2 & fam3 have unique sizes, that scaling will be too small if the maths font setup is then loaded for (say) a 7pt text size. Maybe more pragmatically at this point, does |
@wspr Do you have an example that demonstrates the problem if the same font is used for all families? I always wondered about this. Here Joseph did it https://tex.stackexchange.com/questions/308749/unicode-math-at-tex-primitive-level. Did I understand correctly that the problem with fontdimen 10 (and 11) is, that it has a different meaning (and value) with legacy fonts than with open type? How could this happen? |
@wspr Please don’t go to the extreme
This means, in theory, the last problematic range end at
Therefore, as long as the user Using 3-decimal corresponds to a user Using 5-decimal (the current implementation) corresponds to 152.587%, which is |
I do not know if this helps, but I encountered a case where the error only triggers at some point in the file, not at the beginning. Attached is a tex file to generate a beamer presentation for explaining balancing of AVL trees. The trees are typeset by package forest from generated descriptions. Everything goes well until line 929 of aleat.tex (which corresponds to page 199 of the document). I can ignore these errors, and they will repeat for lines that correspond to pages 200 to 220 (pages 221 to 245 are generated without error). This is baffling because the textual content of pages 221 to 245 is a superset of the content of pages 200 to 220 (see attached PDF, were all pages seem to be rendered correctly despite the errors). One can eschew inclusion of croissant.tex to speed up compilation somewhat. |
@ysalmon Like I said in this thread, the temporary fix in your code containing Gentium Basic has an x-height of Scale = 0.968234 (or so) for TeX Gyre Pagella Math If you plug in
The safe Scale zones are
Here is what happens near
The \setmathfont{texgyrepagella-math.otf}[Scale = MatchLowercase, ScaleAgain=1.00001]
% Then proceed with Asana-Math.otf and texgyrepagella-math.otf
% No more ScaleAgain required Also, the problem appears in |
As discussed at tex.stackexchange.com/q/475792/29127, the code below produces an error saying 'Dimension too large'.
The fix has been suggested.
The text was updated successfully, but these errors were encountered: