2

This MWE compiles fine in lualatex and xelatex.

\documentclass{article}
  \usepackage{unicode-maths}
   \setmainfont{STIX}
    \setmathfont{STIX Math Regular}
  \newfontface{\chaptitlefont}{STIX-Bold}[Scale=1.6]
  \newfontface{\sectionfont}{STIX-Bold}[Scale=1.4]
  \newfontface{\subsectionfont}{STIX-Bold}[Scale=1.2]
  \setmonofont{InconsolataN}[Scale=MatchLowercase]
\begin{document}
    This is a test.\\
    {\chaptitlefont Chapter title}\\
    {\sectionfont Section font}\\
    \(
    \cos^2\theta+\sin^2\theta=1
    \)\\
    \(\mathbf{x^2+y^2=1}\).\\
\verb|Where|
\end{document}

It gives the following warning message.

Package unicode-math Warning: The first font loaded by unicode-math must be an
(unicode-math)                OpenType Math font (with script=math). If you
(unicode-math)                simply want ‘the default’ before loading
(unicode-math)                supplementary fonts over the top for certain
(unicode-math)                ranges, use: 
(unicode-math)                  \setmathfont{latinmodern-math.otf}

Instead of using STIX Math, it uses latinmorder-math.otf as can be seen at the end of the log file produced by lulatex:

<c:/texlive/2020/texmf-dist/fonts/opentype/public/inconsolata/InconsolataN-Regul
ar.otf><c:/texlive/2020/texmf-dist/fonts/opentype/public/stix/STIX-Bold.otf><c:/
texlive/2020/texmf-dist/fonts/opentype/public/lm-math/latinmodern-math.otf><c:/t
exlive/2020/texmf-dist/fonts/opentype/public/lm-math/latinmodern-math.otf><c:/te
xlive/2020/texmf-dist/fonts/opentype/public/stix/STIX-Regular.otf><c:/texlive/20
20/texmf-dist/fonts/opentype/public/stix/STIX-Bold.otf><c:/texlive/2020/texmf-di
st/fonts/opentype/public/stix/STIX-Regular.otf>

It shows warning about STIX Math:

Package fontspec Warning: Font "STIXMathRegular" does not contain requested
(fontspec)                Script "Math".

If I set math font as latinmodern-math before STIX Math, as in the following MWE, it compiles OK.

 \documentclass{article}
\usepackage{unicode-math}
   \setmainfont{STIX}
     \setmathfont{latinmodern-math.otf}
   \setmathfont{STIX Math Regular}
  \newfontface{\chaptitlefont}{STIX-Bold}[Scale=1.6]
  \newfontface{\sectionfont}{STIX-Bold}[Scale=1.4]
  \newfontface{\subsectionfont}{STIX-Bold}[Scale=1.2]
  \setmonofont{InconsolataN}[Scale=MatchLowercase]
\begin{document}
    This is a test.\\
    {\chaptitlefont Chapter title}\\
    {\sectionfont Section font}\\
    \(
    \cos^2\theta+\sin^2\theta=1
    \)\\
    \(\mathbf{x^2+y^2=1}\).\\
\verb|Where|
\end{document}

It compiles fine on both xelatex and lualatex. I get the following warnings in Lualatex.

Package fontspec Warning: Font "STIXMathRegular" does not contain requested
(fontspec)                Script "Math".


Package fontspec Info: Could not resolve font "STIXMathRegular/B" (it probably
(fontspec)             doesn't exist).

unicode-math still gives the warning that the first font must be an open type math font. Yet, from the last part of the log file, it seems to be using the STIX Math.

<c:/texlive/2020/texmf-dist/fonts/opentype/public/inconsolata/InconsolataN-Regul
ar.otf><c:/texlive/2020/texmf-dist/fonts/opentype/public/stix/STIX-Bold.otf><c:/
texlive/2020/texmf-dist/fonts/opentype/public/stix/STIXMath-Regular.otf><c:/texl
ive/2020/texmf-dist/fonts/opentype/public/stix/STIX-Regular.otf><c:/texlive/2020
/texmf-dist/fonts/opentype/public/stix/STIX-Bold.otf><c:/texlive/2020/texmf-dist
/fonts/opentype/public/stix/STIX-Regular.otf>

In the case of xelatex I can confirm using adobe acrobat reader that the stix math is used. What is happening? enter image description here

If, earlier, if xelatex found STIX Math unusable, how did it become useable after loading latinmodern-math? Why is it still showing these warning messages?

Again, I get the error message

Package fontspec Info: Could not resolve font "STIXMathRegular/B" (it probably
(fontspec)             doesn't exist).

The Mathematics content in bold is printed. I can't detect any font substitution for the bold also. From the last part of the log file produced by lualatex, one can see it is not using any font other than stix or inconsolata. What is happening here?

8
  • I'm not sure, but try with \usepackage{xltxtra} \usepackage{xunicode} \usepackage{fontspec} and run with XeLaTeX it may help you....
    – MadyYuvi
    Jun 24, 2020 at 6:31
  • @MadyYuvi It doesn't work . I still get the warning messages. By, the way, the first two packages can be used only with xelatex. Jun 24, 2020 at 6:43
  • Please make your code compilable. For instance, shouldn't one load the unicode-math package before issuing the directive` \setmathfont`?
    – Mico
    Jun 24, 2020 at 7:14
  • 1
    Incidentally, instead of writing \(\mathbf{x^2+y^2=1}\), do consider writing \( \symbf{x}^2+\symbf{y}^2=\symbf{1} \). (\mathbf draws glyphs from the main text font, whereas \symbf draws glyphs from the math font.)
    – Mico
    Jun 24, 2020 at 7:16
  • 1
    Just a guess: the math table in STIX is incomplete, compare: % otfinfo -t /usr/share/fonts/opentype/stix-word/STIXMath-Regular.otf |grep MATH 5652 MATH % otfinfo -t /usr/share/texlive/texmf-dist/fonts/opentype/public/xits/XITSMath-Regular.otf |grep MATH 15910 MATH. XITS Math can be used as a drop-in replacement of STIX Math version 1. Jun 24, 2020 at 7:22

2 Answers 2

11

Khaled Hosny’s XITS and XITS Math are forks of STIX that fix its bugs, and have the same glyphs. While STIX Two also works as a replacement, it’s a noticeably different font and might meet your requirements. For example, it will not match the house style of a journal that typesets in STIX.

As a bonus, XITS offers a bold math font, which unicode-math loads automatically. If you use \boldmath or \boldsymbol, XITS Math will work out of the box.

\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
\setmainfont{XITS}[Scale=1.0]
\setmathfont{XITS Math}
0

Use

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{STIX Two Text}
\setmathfont{STIX2Math.otf}
[...]

The STIX (one) fonts have the script definition "math" missing in the font. Which is, of course, no real problem: You can ignore the warning. However, using STIX2 makes more sense.

You must log in to answer this question.

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