3

Running the following MWE

\documentclass{article}
\begin{document}
Test $\mathrm{VARfi}$
\end{document}

using XeLaTeX or LuaLaTeX, I observed that Test was rendered in OpenType Latin Modern Roman while VAR was rendered in TFM-based Computer Modern Roman. Is it possible to change \mathrm to use OpenType Latin Modern Roman?

Ruixi Zhang
  • 9,553

1 Answers1

5

Add

\usepackage{fontspec}

to your preamble.

cfr
  • 198,882
  • 1
    Hmm… No. I’ll admit that this is a trick question: The kerning between V and A and the fi ligature will both disappear, and therefore the result is not the full OpenType Latin Modern Roman. – Ruixi Zhang Oct 22 '19 at 04:00
  • 1
    Welcome back cfr! I didn't see you around for a while or am I wrong? – Dr. Manuel Kuehner Oct 22 '19 at 04:28
  • @RuixiZhang - In addition to loading the fontspec package, one also needs to execute \setmainfont{Latin Modern Roman} to get your desired outcome, viz., kerning between V and A and the fi ligature. – Mico Oct 22 '19 at 04:45
  • 2
    @RuixiZhang if you want ligatures you need to force base mode with luatex: https://tex.stackexchange.com/a/277395/2388 – Ulrike Fischer Oct 22 '19 at 07:41
  • @RuixiZhang Well, it depends what you mean by 'full'. I guess you mean 'with the kerning and ligature features of traditional maths fonts', but that should be in your question. Probably the question is a duplicate of one of the earlier ones in that case, though there doesn't seem to be a solution for XeLaTeX (?). – cfr Oct 22 '19 at 14:02
  • @cfr Let's agree to disagree. If I asked “how to use OpenType XXX in LaTeX?”, I (implicitly) expect my professional fonts can be used with LaTeX out of the box, or that their features can be accessed without too much work, or a answer that simply says “no, but some packages are working on it”. On another note, there seems to be no solutions for XeTeX for over four years :(. – Ruixi Zhang Oct 22 '19 at 15:32
  • @Mico Math font families $\mathrm{VARfi}$ need more works and XeTeX refuses to kern or to join letters into ligatures as far as I know. – Ruixi Zhang Oct 22 '19 at 15:34
  • @RuixiZhang - Indeed: I tested out my earlier claim with LuaLaTeX, not XeLaTeX. I wasn't aware until now of XeLaTeX's limitations in this respect. – Mico Oct 22 '19 at 16:11
  • It is just than now the question seems to be a duplicate of https://tex.stackexchange.com/questions/252493/ligatures-are-not-used-in-opentype-maths-families, even though that isn't obvious from the question. @RuixiZhang – cfr Oct 22 '19 at 22:21