1

I would like to use Alegreya font since I like it very much. I'm using XeLaTeX because I want to write the source directly in UTF8.

(EDITED)

However this font doesn't seem to have math support. As an MWE consider the following:

\documentclass{article}
\usepackage{unicode-math} 
\usepackage{fontspec}
\setmainfont[
  SmallCapsFont={Alegreya SC},   
  ItalicFeatures={SmallCapsFont=AlegreyaSC-Italic},
  BoldFeatures={SmallCapsFont=AlegreyaSC-Bold},
  BoldItalicFeatures={SmallCapsFont=AlegreyaSC-BoldItalic},
  Ligatures=TeX,
]{Alegreya}

\begin{document}
\textsc{Example Document}
This is an example document where I like to put some math:
$$
i \neq \mathrm{i} 
$$
also 
$$
∫ \neq ∑ 
$$  
finally
$$
e^θ = \cos \Re θ + i\sin \Im θ
$$
\end{document}

QUESTIONS

  1. I noticed that roman font invoked by \mathrm and by operators like \sin are taken from Alegreya while the others are standard Computer Modern Math, since is the default choice and I didn't use \setmathfont. It is possible to make XeLaTeX use Alegreya Italic in math? How is possible to do it? What are disadvantages in doing this?

  2. I noticed that the Euler font in LaTeX harmonizes very well with Alegreya. It is possible to use it in XeLaTeX? (I found that the project Neo Euler seems inactive.)

  3. Would you suggest another math font to use with Alegreya? I tried the standard XeLaTeX math font (STIX, XITS, TeX Gyre Something), which are well designed but do not match well will Alegreya.

3

Get euler.otf from https://github.com/khaledhosny/euler-otf

\documentclass{article}

\usepackage{unicode-math} % loads fontspec

\setmainfont[
SmallCapsFont={Alegreya SC},   
ItalicFeatures={SmallCapsFont=AlegreyaSC-Italic},
BoldFeatures={SmallCapsFont=AlegreyaSC-Bold},
BoldItalicFeatures={SmallCapsFont=AlegreyaSC-BoldItalic},
]{Alegreya}

\setmathfont{Neo Euler}
\setmathrm{Alegreya}
\setmathfont[range=it]{Alegreya-Italic}
\setmathfont[range=bfit]{Alegreya-BoldItalic}
\setmathfont[range={}]{Neo Euler} % empty range to get the correct metrics

\begin{document}

\textsc{Example Document}
This is an example document where I like to put some math:
\[ i \neq \mathrm{i} \]
also 
\[ ∫ \neq ∑ \]
finally
\[ e^z = \cos \Re z + i\sin \Im z \]

\end{document}

enter image description here

If you instead want to use legacy Euler, use this

\documentclass{article}

\usepackage{eulervm}
\usepackage[no-math]{fontspec}

\setmainfont[
SmallCapsFont={Alegreya SC},   
ItalicFeatures={SmallCapsFont=AlegreyaSC-Italic},
BoldFeatures={SmallCapsFont=AlegreyaSC-Bold},
BoldItalicFeatures={SmallCapsFont=AlegreyaSC-BoldItalic},
]{Alegreya}

\begin{document}

\textsc{Example Document}
This is an example document where I like to put some math:
\[ i \neq \mathrm{i} \]
also 
\[ \int \neq \sum \] % sorry, no unicode input
finally
\[ e^z = \cos \Re z + i\sin \Im z \]

\end{document}

enter image description here

  • What is the difference between '\setmathrm{}' and '\setmatfont[range=up]{}'? – MaPo Jan 26 '18 at 9:56
  • However the major problem is that greek letter are not shown – MaPo Jan 26 '18 at 10:07

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.