1

Whenever I try the following command, I get this error:

\documentclass{article}

\usepackage[no-math]{fontspec}
\usepackage{unicode-math}
\setmainfont{Old Standard}
\setmathfont{OldStandard-Regular.otf}
\setmathfont[range=\epsilon]{OldStandard-Italic.otf}


\begin{document}
    Does this work? $\epsilon$
\end{document}

Package unicode-math Error: Command \epsilon in math range is not(unicode-math) commands

My current font cannot handle \epsilon by default so I am trying to use this symbol from another font that has it.

7
  • As always here, please provide a full but minimal example that others can copy and test as is.
    – daleif
    Apr 29 at 11:00
  • This actually is an MWE. But I will complete it for the sake of completion.
    – Masum
    Apr 29 at 16:45
  • As long as one needs to add to the mwe before it can be tested, it is just a sniplet not a mwe
    – daleif
    Apr 29 at 16:47
  • 1
    Aside of the subject, there is no need to load fontspec yourself if you use unicode-math: The latter already loads the former. Apr 29 at 17:00
  • 1
    Old Standard is not a math font…
    – egreg
    Apr 29 at 17:06

2 Answers 2

2

The \epsilon command is a bit too complicated for range=, since it checks what math alphabet you are currently using.

The range= option actually wants names from “Symbols Defined by unicode-math, or a few other formats documented in the package manual. In this case, mathematical italic epsilon is \mitepsilon. So—for an OpenType math font[range=\mitepsilon] would work.

However, if you try to do that here, with this font, it won’t work because \mitepsilon is 𝜀 (U+1D700, Mathematical Italic Small Epsilon), which the font you are loading does not have. So you would get an empty square for a missing character instead.

What you actually want to do here is load the entire Greek italic alphabet from the font. Then, unicode-math will realize it doesn’t cover the Mathematical Alphanumeric Symbols block, and load the glyphs from the Greek and Coptic block instead, like you want.

\setmathfont{OldStandard-Italic.otf}[range=it/{greek,Greek}]

While I was at it, I loaded a valid main math font (I picked XITS Math, but you can choose another), and removed the no-math option to fontspec. Thus,

\documentclass{article}

\usepackage{unicode-math}
\setmainfont{Old Standard}
\setmathfont{XITS Math}[Scale=MatchLowercase]
\setmathfont{OldStandard-Italic.otf}[range=it/{greek,Greek}]

\begin{document}
    Does this work? $\epsilon$
\end{document}

Old Standard sample

Postscript

You seem to want to use symbols from Old Standard, since you are trying to load it as your main math font. This won’t work, because it doesn’t have an OpenType MATH table. You would actually want to load the upright math symbols over an OpenType math font with a separate command, something like (not extensively tested):

\documentclass{article}
\tracinglostchars=3 % Give an error if a symbol is missing.
\usepackage{unicode-math}
\setmainfont{Old Standard}
\setmathfont{XITS Math}[Scale=MatchLowercase]
\setmathfont{OldStandard-Italic.otf}[range=it]
\setmathfont{OldStandard-Regular.otf}[range={"00-"FF, % Basic Latin
                                             "2190-"2199, % Single arrowa
                                             "21D0-"21D5, % Double arrows
                                             % Mathematical Operators:
                                             "2200-"2213, "2215-"221A,
                                             "221D-"221E, "2220-"2223,
                                             "2225, "2227-"222B, "222E,
                                             "223C, "223E, "2240, "2242-"2243,
                                             "2245, "2248, "224D, "2260-"2262,
                                             "2264-"2267, "226A-"226B,
                                             "2272-"2273, "2276-"2277,
                                             "227A-"227F, "2282-"2289,
                                             "228E-"2299, "22A2-"22A5, "22A8,
                                             "22C4-"22C5,
                                             "2329-"232A, % Miscellaneous Technical
                                             "27E6-"27EB, % Miscellaneous Mathematical Symbols
                                             "2A7D-"2A7E, "2AA1-"2AA2, "2AED, % Supplemental Mathematical Operators
                                             "3008-"300B, "301A-"301B, % Brackets from CJK
                                             % Omitted: a smattering of Mathematical Fraktur.
                                             up
                                            }]

This loads all the mathematical symbols defined in Old Standard, which might not be what you want. For example, because there is no math table, the font only has symbols such as \int and \sum in text style. Display-style big operators will break.

If you want to override other alphabets, such as \symbfup or \symbfit, you will need to load those as well, with commands such as

\setmathfont{OldStandard-Bold.otf}[range=bfup]
\setmathfont{OldStandard-BoldItalic.otf}[range=bfit]
1
  • You are actually right on the money. I used FontForge to replace the corresponding unicode character with the character from Old Standard font and then it worked without the range command. On that note, many many thanks for that command of full mathematical symbol list.
    – Masum
    Apr 29 at 20:47
1

This code works (with my TeX Live 2022 distribution) for both XeLaTeX and LuaLaTeX:

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{OldStandard-Regular.otf}
\begin{document}
    Does this work? $\epsilon$
\end{document}

enter image description here

But without an actual math font loaded by a \setmathfont command, it uses the default math font, i.e. Latin Modern Math. I don't know if there is any appropriate math font (from a typographical point of view) for these Old Standard fonts… in which case you should use it.

1
  • This is also correct, however doesn't expose why this error happens. It's more apparent if you use a font that does not have the unicode character for \epsilon. My original intention was to actually use a different font but also import missing glyphs from Old Standard. That's when I faced this issue.
    – Masum
    Apr 29 at 20:50

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.