Usng unicode-math, I am trying (in LyX) to use a font for my main font, and also for math Latin and Greek characters, while keeping the rest as is.

At the same time, I want to use blindtext.

Blindtext only allows \blindmathtrue if the language has been set to English.

This I believe I have to do via the language package custom area in the LyX document preferences, however using \usepackage[english]{babel} breaks unicode-math.

I get

! Font \l_tmpb_font has only 8 fontdimen parameters.

If I use the default language package, all works, except, as stated above, blindtext English/math.

%This is in my preamble:
\setmathfont{Latin Modern Math} % this is obligatory or no math font will
be set...
%everything works to here. But this setmathfonts is causing the problem
\setmathfont[range=\mathit/{latin, Latin}]{SNsanafonmaruP} 
% upper and lower case latin and numbers 
% any font will do

\setmainfont[Mapping= tex-text]{SNsanafonmaruP} % not actually relevant....

I don't believe the font I used is the problem; I get the same behavior whatever text only font I use, even common ones like Biolinium or Hoefler Text.

(N.B. The example is heavily redacted from a larger set of uses of unicode-math for nefarious purposes, so this a best effort to produce a MWE for what seems to be the crux of the matter.)

The problem is not with LyX. Here is a TeX (TeXShop) document that does not work:

% tell TeXShop to use xelatex, open/save in Unicode
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\setmathfont{Latin Modern Math} % obligatory or no math font will be set...

% using text only font: I also tried Hoefler Text, etc. The font I really want is SNsanafonmaruP
%\setmathfont[range=\mathit/{latin, Latin}]{Linux Biolinum O} %  upper and lower case  latin and numbers
%Using a font like LLO however, does work
%\setmathfont[range=\mathit/{latin, Latin}]{Linux Libertine O} %  upper and lower case  latin and numbers


No math:\blindtext
With Math:\blindtext

  • This is not a MWE, because if I add a class declaration and a minimal document environment all goes well. I changed the font into one that is surely a text only font.
    – egreg
    May 7, 2014 at 8:57
  • @egreg: Perhaps I was too optimistic. I have added the full source code to my answer (If needed I will upload the lyx file). Which text only font did you use? I have no idea if the problem is really with the packages, or my LyX or TeX setup, or my computer or what. But I do know that the only line I changed was the second setmathfont...When you say all goes well, you mean you get english blindtext with math and all. Could you send me that so I can test it on my system.
    – asllearner
    May 7, 2014 at 14:19
  • @egreg: BTW I have tried using both memoir and article classes, and using xetex and dvi output; no go. I am working on Mac 10.6.8 with MacTeX and LyX 2.0.8. Any other information I ought to provide?
    – asllearner
    May 7, 2014 at 14:30
  • I have updated with what I hope will be a real minimal (14 line plus comments) working example created in TeXShop, removing all the LyX stuff.
    – asllearner
    May 8, 2014 at 0:55
  • 1
    A formula or another is irrelevant, when investigating upon what seems to be a bug. Solving it for $\sqrt[3]{2}$ would probably solve also your (unspecified) problem. That it's a bug is confirmed by the fact that LuaLaTeX doesn't raise an error, but typesets the formula incorrectly. Surely the fact that the selected font is not meant for math has its influence.
    – egreg
    May 8, 2014 at 9:03

1 Answer 1


well, with egreg's and google's help I have found the answer. The answer can be found here (github) and here (tex.stackexchange) and consists of adding \setmathfont[range=\int]{Latin Modern Math} to the end of the preamble.

(alternately, using polyglossia instead of babel works.)

Here is a blow by blow:

Egreg correctly suggested I use $\sqrt[3]{2}$ as my minimal example. When I did this, I was able to eliminate blindtext as the culprit, since even without blindtext I got the error.

In addition, he astutely pointed out that the problem was with the fact that "the selected font is not meant for math has its influence". This got me thinking that range=\mathit/{latin, Latin}, in addition to changing the default math font to the text font for "latin" characters (the desired behavior), had somehow captured the square root sign. Since this isn't present in the text font, it threw the error. I thought to solve this by adding a further \setmathfont, which got me googling "setmathfont range", where I regognized egreg's infamous square root: \sqrt[n]{x} breaks if \setmathfont is used more than twice, linking to \sqrt[x]{y} Breaks With unicode-math.

It appears that this is a bug (you were right again, egreg) in unicode-math that seems to "map the last font set with \setmathfont to \l_um_font and then uses it in \r@@t [the square root] to get the \fontdimen values". "Adding all of the other symbols and alphabets [one] need[s] to see if anything else breaks"! may be necessary. Furthermore, "the redefinition [of the square root] is different for LuaTeX and XeTeX, so you only see the issue with XeTeX."

Later, someone in the LyX user's group suggested switching to polyglossia, and this works too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.