5

I am using xelatex and the mathspec package to use the Calibri font found on recent Windows machines. The font metrics used to typeset italic characters are fine for text but not for math; glyphs often collide.

With mathspec, one can precede a character in math mode with " to increase its spacing. The characters in the figure below were typeset using

$f(x)$, $"f(x)$, $f'(x)$, $"f'(x)$, $e^{jx}$,$"e^{"jx}$.

enter image description here

While this works fine when one only has to use it infrequently, for a long document it becomes tedious. Is there a way to always use this corrected spacing without manually preceding every character of the alphabet with "?

  • 1
    Short answer: no. Longer answer: mathspec does its best in order to emulate math fonts, but if the fonts lack the necessary specifications for being used in math mode, it's a lost battle. – egreg Dec 15 '14 at 22:50
  • Bummer. I really like using alternate fonts but some of the math definitely looks wrong without tweaking. I was hoping there was a global setting I could use ... Thanks. – GregH Dec 16 '14 at 13:38
3

A “real” math font, such as those that can be used with unicode-math, has glyphs specially tailored for math fonts.

For instance with

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

\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}

\begin{document}

\textit{f} $f(x)$

\end{document}

the character used for the second “f” is U+1D453 MATHEMATICAL ITALIC SMALL F in Latin Modern Math, which has the same shape as an italic “f” (the first one), but different side bearings and other metric parameters.

If you use mathspec, say with

\documentclass{article}
\usepackage{mathspec}

\setmainfont{Hoefler Text}
\setmathfont(Latin){Hoefler Text}

\begin{document}

\textit{f} $f(x)$ $"f(x)$

\end{document}

you get

enter image description here

The package makes its best for getting decent output, but using glyphs not specially designed for a math font clashes with the rules of TeX's math mode, in particular when the letters are slanted.

Thus the "f trick is a “necessary evil”. You see that in some cases you need it, in others you don't: it depends on pairs of adjacent characters that are taken from different fonts. With unicode-math the same font is used, but this is not the main aspect; the relevant fact is that the math letters have special parameters.

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.