4

I would like to set the math font as Garamond-Math (here) except that greek letters should come from a different font (for an illustration, computer modern in the example below.). But it seems declaring the new font does not work.

How to achieve this?

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[math-style=ISO, bold-style=ISO]{unicode-math}
\setmathfont{Garamond-Math.otf}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareSymbolFont{gs}{OML}{cmm}{m}{it}
\DeclareMathSymbol{\alpha}{\mathalpha}{gs}{11}
\DeclareMathSymbol{\beta}{\mathalpha}{gs}{12}
\DeclareMathSymbol{\gamma}{\mathalpha}{gs}{13}

\begin{document}
\[2a\alpha=\theta\]
\end{document}
4

unicode-math does many things \AtBeginDocument, you can delay your declarations:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Garamond-Math.otf}

\DeclareSymbolFont{gs}{OML}{cmm}{m}{it}
\newcommand*\RedeclareMathSymbol[4]{%
  \let#1\relax
  \DeclareMathSymbol{#1}{#2}{#3}{#4}%
}

\AtBeginDocument{%
  \RedeclareMathSymbol{\alpha}{\mathalpha}{gs}{11}%
  \RedeclareMathSymbol{\beta}{\mathalpha}{gs}{12}%
}

\begin{document}
\[2a\alpha=\beta\theta\]
\end{document}

mixing fonts

| improve this answer | |
5

It doesn't work because unicode-math sets the font tables at begin document.

You should use the range feature instead:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[math-style=ISO, bold-style=ISO]{unicode-math}

\setmathfont{Garamond-Math.otf}
\setmathfont{latinmodern-math.otf}[
  Scale=MatchLowercase,
  range=it/{greek,Greek},
]
\setmathfont{Garamond-Math.otf}[range=\int]


\begin{document}

\[2a\alpha=\theta\]

\end{document}

enter image description here

| improve this answer | |

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.