I would like to know what the difference is between \mathit
and setting [math-style = TeX]
regarding italics in math mode.
This code will explain it better
\documentclass{article}
\usepackage[math-style = TeX]{unicode-math}
\begin{document}
\[ \mathit{\rho} \rho \]
\end{document}
Only the latter showing up with an "italic" style (TeX math-style).
If an unicode math font such as STIX Two Math is loaded, the same will happen, but this time a cross inside a rectangular box will show up as \mathit{\rho}
Here's the code for said scenario
\documentclass{article}
\usepackage[math-style = TeX]{unicode-math}
\setmathfont{STIX Two Math}
\begin{document}
\[ \mathit{\rho} \rho \]
\end{document}
Best Answer
There's a huge difference between (a) loading the
unicode-math
package and selecting amath-style
(e.g., "TeX" or "ISO") that employs italics for lowercase Latin and Greek letters and (b) using\mathit
. (Aside: For more information on the math styles provided by theunicode-math
package, see section 5.1 of the package's user guide.)Using
\mathit
operates quite independently of the chosen math style. Using\mathit
can generate outcomes which may be unexpected -- at least at first. This is because the\mathit
directive accesses its letters from the text font, not from the math font. This is by design. According to David Carlisle's comment (see below),\mathit
should be used for multi-letter identifiers, such as the names of variables. For variable names, it's better to use italics from the text font, rather than "true" math-mode italics.Consider the table below, which shows the four available math styles (ISO, TeX, french, and upright), with lowercase and uppercase Latin and Greek letters. The math font is set to
Stix Two Text
, while the text font is set toCalibri
. I chose a sans-serif text font to make the difference between text and math fonts glaringly obvious.Confirming what I asserted above, observe that the
\mathit
output, shown in the final column, does not employ letters from the math font family. Instead, it quite evidently employs letters from the text font family.