2
\documentclass{article}
\usepackage{unicode-math}

\setmathfont{Latin Modern Sans}

\usepackage{mwe}
\blindmathtrue

\begin{document}
\Blinddocument
\end{document}

The above fails with the error

ERROR: Internal error: bad native font flag in `map_char_to_glyph'

--- TeX said ---
--- HELP ---
No help available

What is causing this error and how can I pick fonts to avoid this in the future?

  • 3
    Latin Modern Sans has no math table. You have to use a font which has it, such as Latin Modern Math. If you want to use a font without a math table in mathmode with xelatex you have to use the mathspec package. – Henri Menke Feb 7 '15 at 15:23
  • See also my question here: tex.stackexchange.com/questions/118244/… – Henri Menke Feb 7 '15 at 15:23
  • 1
    not having a math table is perhaps a sign that it's not intended for math, as with classic tex math fonts though, once you have set up the main math font, you can if required set up text fonts for use as math alphabets – David Carlisle Feb 7 '15 at 15:26
  • For explanation, see my answer here: tex.stackexchange.com/a/166185. For information on fonts which will work, see my answer here: tex.stackexchange.com/a/219414. – cfr Feb 7 '15 at 15:31
1

You have two options to overcome this issue.

1. Use an OpenType Math Font

For unicode-math to work you have to use an OpenType font which provides the math table, such as Latin Modern Math. This unfortunately defeats the implicit purpose of your MWE to use a sans serif font for maths.

\documentclass{article}
\pagestyle{empty}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\begin{document}
Lorem ipsum
\[ \sum_{k=0}^\infty a_0q^k = \lim_{n\to\infty}\sum_{k=0}^n a_0q^k =
            \lim_{n\to\infty} a_0\frac{1-q^{n+1}}{1-q} = \frac{a_0}{1-q} \]
dolor sit amet
\end{document}

enter image description here

2. Use the mathspec Package

The mathspec allows to use any OpenType font for mathmode (at the cost of bad spacing).

\documentclass{article}
\usepackage{mathspec}
\setmathfont(Latin,Digits,Greek){Latin Modern Sans}
\setmathrm{Latin Modern Sans}
\begin{document}
Lorem ipsum
\[ \sum_{k=0}^\infty a_0q^k = \lim_{n\to\infty}\sum_{k=0}^n a_0q^k =
            \lim_{n\to\infty} a_0\frac{1-q^{n+1}}{1-q} = \frac{a_0}{1-q} \]
dolor sit amet
\end{document}

enter image description here

|improve this answer|||||

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.