I'm using XeTeX
and the fontspec
and unicode-math
packages. In order to use a different math font for Greek letters, I do something like this, using the range
option of \setmathfont
:
\setmathfont[Path=/usr/share/texmf/fonts/opentype/public/tex-gyre-math/]{texgyretermes-math.otf}
\setmathfont[range=\mathit/{greek,Greek},Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/]{texgyretermes-regular.otf}
Now, how could I change the font for only one Greek letter (say \phi
) ?
Update
Based on @egreg's answer (which is deleted now), I tried the following code. The $\phi$
does not appear in the output. If I replace this line by the commented line, then $\phi$ appears in the output but it is not in regular font.
% !TeX program = XeLaTeX
% !Mode:: "TeX:UTF-8"
\documentclass[fontsize=12pt]{scrartcl}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{unicode-math}
\usepackage{fontspec}
\setmonofont[Path=/usr/share/fonts/truetype/freefont/,Scale = 1.05]{FreeMonoBold.ttf}
\setmainfont
[ Scale = 1.1,
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
]{xits}
\setmathfont[Path=/usr/share/texmf/fonts/opentype/public/tex-gyre-math/]{texgyretermes-math.otf}
\setmathfont[range={\mitvarphi,\mitphi},Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/]{texgyretermes-regular.otf}
% \setmathfont[range=\mathit/{varphi,phi},Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/]{texgyretermes-regular.otf}
\setmathfont[range=\int,Path=/usr/share/texmf/fonts/opentype/public/tex-gyre-math/]{texgyretermes-math.otf}
\begin{document}
$\phi = \psi+1$.
\end{document}
Second update
Since I use only three greek letters in my document, phi
, mu
and lambda
, the following code works :
\setmathfont[Path=/usr/share/texmf/fonts/opentype/public/tex-gyre-math/]{texgyretermes-math.otf}
\setmathfont[range=\mathit/{greek,Greek},Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/]{texgyretermes-regular.otf}
\setmathfont[range={\mitmu,\mitlambda},Path=/usr/share/texmf/fonts/opentype/public/tex-gyre-math/]{texgyretermes-math.otf}
\mitphi
and\mitvarphi
.range=\mathit/{"03D5}
Path
for fonts installed in the texmf free. Also, this question is aboutunicode-math
, notfontspec
. But is this a question any more?