latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
239 stars 28 forks source link

`! Dimension too large.` error when using multiple fonts and setting the main math font to `Scale=MatchLowercase` and other values #518

Closed lionawurscht closed 5 years ago

lionawurscht commented 5 years ago

Description

After a recent update I can't use multiple fonts when setting the main math font scale to MatchLowecase or any value smaller than one without getting a ! Dimension too large. error.

Info

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{TeXGyrePagellaX-Regular.otf}[
    ItalicFont=TeXGyrePagellaX-Italic.otf
]

\setmathfont[
    Scale=MatchLowercase % The option that makes troulbes
]{texgyredejavu-math.otf}

\setmathfont[range=it/{latin}]{texgyrepagella-math.otf}

\begin{document}
\begin{tabular}{rlrl}
    main font & n &  $\symliteral{n}$  & math font \\
    main font & \textit{n} &  $n$ & math font italic \\
    combination & \textit{n}n &  $\symliteral{n}n$ & combination \\
\end{tabular}
\end{document}

results in this error message:

! Dimension too large.
<recently read> \g__um_trial_font 

Further details

I can set multiple fonts without problems when I omit the Scale option for the main math font. However, as I am using some inline math I do need the scales to match. I tried setting Scale manually to fit my main text font but I get the same error mentioned above. I listed the scales where I get errors below:

Scale result
MatchLowercase fail
1.5 success
1.1 fail
1 success
0.999999 success
0.99999 fail
0.95 fail
0.63 fail
0.55 fail
0.1 success

When I don't try adding any additional math fonts the document renders without problems regardless of what Scale option I used for the main math font. Inspired by the discussion in #515 I tried setting ScaleAgains rather randomly for the main math font or the additional one to no avail. Unfortunately I don't understand anything about the inner workings of latex so I can't say that I explored that option exhaustively.

RuixiZhang42 commented 5 years ago

I cannot reproduce the error. Your example went through with either XeLaTeX or LuaLaTeX on my machine.

output

I also tried all the Scale’s which you claimed to fail, and again no errors with either XeLaTeX or LuaLaTeX. Judging by your list of failed Scale’s, it is safe to assume that you are still using the v0.8n unicode-math. Check unicode-math-luatex.sty and/or unicode-math-xetex.sty and look for the two lines containing ScaleAgain, the newer v0.8o should have 1.0001 and 0.9999 (4 decimals).

lionawurscht commented 5 years ago

You are correct and I am very stupid. Being used to getting my latex nice and packaged I simply failed at installing the package properly. Sorry for wasting your time but thank you very much for the notch into the right direction.