1

In XeLaTex and using mathspec, one can simply use text Greek letters of Minion Pro for math symbols:

\documentclass{article}

\usepackage{mathtools} \usepackage{mathspec} \usepackage{fontspec} \setmainfont{Minion Pro} \setmathsfont(Digits,Greek,Latin)[Numbers={Proportional}]{Minion Pro} \setmathrm{Minion Pro}

\begin{document} Here is an equation. \begin{equation} |\psi_{u,v}|^2 = 1 \end{equation}

\end{document}

enter image description here

I want to achieve the same in LuaLaTex using unicode-math and mathastext. Following the answer here, I ended up with

\documentclass{article}

\usepackage{mathtools} \usepackage{fontspec} \usepackage{unicode-math} \setmainfont{MinionPro}

\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{MinionPro} \setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}]{MinionPro-Bold} \setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}]{MinionPro-It} \setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}]{MinionPro-BoldIt} \setmathrm{MinionPro} \usepackage[italic]{mathastext}

\begin{document} Here is an equation. \begin{equation} |\psi_{u,v}|^2 = 1 \end{equation}

\end{document}

that yields the error below:

Package unicode-math Error: No main maths font has been set up yet. \setmathfont

But I have already set a math font. What is a work-around here?

  • 1
    as the mathastext documentation writes "Particularly in the latter case (i.e. using unicode-math) you probably don’t need, don’t want, and should not use mathastext". So don't do it. Use only unicode-math, and set up as base font a real math font. – Ulrike Fischer May 18 '22 at 07:03
  • @UlrikeFischer: I don't have the real base math of my desired font. –  May 18 '22 at 07:26
  • well then you will have to choose some other math font. E.g. \setmathfont{Cambria Math} or whatever. unicode-math requires a math font, you can't fake that by combining letters from various text fonts. – Ulrike Fischer May 18 '22 at 07:30
  • @User so you do, that's odd (I deleted the comment) I can' believe mathspec really needs xetex,I wonder why it has that test) – David Carlisle May 18 '22 at 07:31
  • @DavidCarlisle it relies on \XeTeXglyphbounds (I looked in the code). – Ulrike Fischer May 18 '22 at 07:33
  • @UlrikeFischer yes was just looking. you and Marcel could fix that in luaotfload? :-) – David Carlisle May 18 '22 at 07:34
  • @DavidCarlisle see https://tex.stackexchange.com/a/522751/2388. Probably mathspec only needs to adopt that. – Ulrike Fischer May 18 '22 at 07:35
  • @UlrikeFischer: I was under the impression that LuaLaTeX (and related packages working with it) can do anything XeLaTeX (and its related packages) can do, including such font-faking tricks. –  May 18 '22 at 07:35
  • oh https://tex.stackexchange.com/a/522751/1090 I was going to say same:-) – David Carlisle May 18 '22 at 07:36
  • 1
    @User that lualatex can theoretically do something doesn't imply that a package implements it. Make a feature request for mathspec ... – Ulrike Fischer May 18 '22 at 07:37

0 Answers0