1
\documentclass{article}


\begin{document}
Both:

$\triangle fil$ with vertices $f$, $i$, $l$

and


$\triangle \mathit{fil}$ with vertices $f$, $i$, $l$

do not give a correct result.


\end{document}

In the first case the spacing of the triangle is awful, in the second --- the font is different.

Is it possible to write in the mathematical mode, using glyphs from math italic font, but with kerning as if they form ordinary words?

2 Answers 2

4

No, tex adds no extra kerning the wider sidebearings are in the font itself so by design the math italic font can not be used for multi-letter words.

That is you can not reasonably do this in TeX, it would of course be possible to (in theory) to make a virtual (or real) font that took the glyphs from a math font and adjusted the metrics to give something more reasonable as a text italic. In luatex that could be done on the fly using its Lua access to the font data, but it's more a font design than a tex issue by then.

For a one-off case You can add extra kerns by hand

enter image description here

\documentclass{article}


\begin{document}
Both:

$\triangle fil$ with vertices $f$, $i$, $l$

and


$\triangle \mathit{fil}$ with vertices $f$, $i$, $l$

do not give a correct result.

$\triangle f\mkern-2.7mu i\mkern-.8mu l$ with vertices $f\!$, $i$, $l$


\end{document}
1

Your options include:

Load fontspec

This redefines \mathit to represent italicized words in math mode. This is technically not the exact same font as your OML-encoded math letters, but by default the glyphs look identical.

Specifically, you get the ItalicFont of the \setmathrm font, which is by default the same as \setmainfont. So long as you set matching text and math fonts, this should work. If you want to specify italic math symbols, use \mathnormal, or load unicode-math and use \symit.

\documentclass{article}
\usepackage{fontspec}

\begin{document}
\(\triangle \mathit{fil}\) with vertices \(f\), \(i\), \(l\)
\end{document}

Latin Modern + cm sample

In some contexts, you might get better spacing if you write \mathop{\mathit{fil}}, which typesets it as a log-like operator. But not if you want, for example, \mathit{fil} \cdot x.

I also left the f, i, l code you wrote essentially unchanged, since the purpose seemed to be to compare the shapes of the \mathit and \mathnormal glyphs, but the spacing is wrong there too, due to the transition from math-mode f to text-mode comma. You would want to change it in an actual document.

Switch to Text Mode

You can use \text, \textnormal, \textit and so on in math mode. Here, I use \textnormal to prevent formatting such as \bfseries or \sffamily from bleeding through. If you want this—let’s say you define bold headers and want your math symbols to match—you can instead use \textit.

\documentclass{article}
\usepackage{lmodern} % Also works with fontspec.

\begin{document}
\(\triangle \textnormal{\itshape fil}\) with vertices \(f\), \(i\), \(l\)
\end{document}

lmodern sample

To suppress the fi-ligature, write f{}il.

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.