3

According to section 3 Getting Started on p. 4 of the unicode-math package documentation for the user version 2020/01/31 0.8q (which is the current version), here's an example using the filename syntax to load the TeX Gyre Pagella Math font:

\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{texgyrepagella-math.otf}

What if a math font encompasses several .otf files? For instance, the STIX Two font encompasses 5 .otf files:

  • STIX2Math.otf
  • STIX2Text-Regular.otf
  • STIX2Text-Bold.otf
  • STIX2Text-Italic.otf
  • STIX2Text-BoldItalic.otf.

How can I configure the document to use this font in math mode? (And only in math mode.)

Or should I be concerned only with STIX2Math.otf if I want to use the STIX font only in math mode, because the other files are intended for use in text mode? But maybe the STIX2Text-....otf files are meant for typesetting variables in math mode, in which case they are indispensable.

P.S. I use LuaLaTeX as my LaTeX compiler.

7
  • 2
    just use stix2math the others are text fonts Commented Dec 28, 2022 at 7:04
  • @DavidCarlisle Is this the usual case, that OpenType fonts meant to be used in math mode comprise only a single .otf file? Or do some popular fonts require several files? In the latter case, I'll appreciate a general answer, and not just one that pertains to STIX Two.
    – Evan Aad
    Commented Dec 28, 2022 at 7:06
  • 1
    The text parts inside math uses the text font, so you should combine a text and a math fonts that work well together. In this answer you find a way to set up Lucida, that comes with a (not so complete) bold math font (six years old, but I guess it still applies).
    – mickep
    Commented Dec 28, 2022 at 7:39
  • 2
    Variables are in the math font too, for text you switch to text mode and then it depends how you did set up the text fonts with fontspec. Commented Dec 28, 2022 at 7:43
  • 2
    it is exactly the same as the tex gyre pagella example you show, you just used the math font and did not list all the tex gyre pagella textfonts. Why do you think stix is different? Commented Dec 28, 2022 at 8:28

1 Answer 1

2

If you're interested in using both the text and math fonts of the Stix Two font family, you could execute (under LuaLaTeX)

\usepackage{unicode-math}
\setmainfont{Stix Two Text} % access STIX2Text-Regular.otf, STIX2Text-Bold.otf, 
                            %   STIX2Text-Italic.otf, and STIX2Text-BoldItalic.otf.
\setmathfont{Stix Two Math} % access STIX2Math.otf

Nothing more to it.

Of course, if you prefer to refer to the font file names directly, you are free to do so.

10
  • Hope it will supports XeLaTeX too!!
    – GowriSaro
    Commented Dec 28, 2022 at 13:21
  • @GowriSaro - Assuming the font files are present on your system, the exact form of the arguments of \setmainfont and \setmathfont may differ between XeLaTeX and LuaLaTeX, depending mainly on which operating system and which TeX distribution you employ -- of which I'm afraid I have no knowledge... That's why I limited my answer to the LuaLaTeX case.
    – Mico
    Commented Dec 28, 2022 at 13:57
  • 1
    You people are like Guru for beginners like me
    – GowriSaro
    Commented Dec 28, 2022 at 14:22
  • 1
    @GowriSaro - So glad we're all ok. I've gone ahead and deleted one of my earlier comments.
    – Mico
    Commented Dec 28, 2022 at 14:25
  • 1
    @EvanAad - Absolutely not. If you're interested solely in the Stix Two text fonts, you'd use just the \setmainfont directive. (You wouldn't want to use either \setsansfont or \setmonofont, though, as Stix Two is neither a sans-serif nor a monospaced font. Well, if you like to run the risk of needlessly and hopelessly confusing yourself...) If you're interested solely in the Stix Two math font, you'd use just the \setmathfont directive. Finally (cumulatively?), if you're interested in both the Stix Two text and Stix Two math fonts, you'd use both \setmainfont and \setmathfont.
    – Mico
    Commented Dec 28, 2022 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .