7

I'm using fontspec in lualatex to get a OTF main font, but I'd like to use one of the good old math fonts (like the default TeX one). After trying different packages, I didn't manage to make it work with utf-8 input:

\documentclass{minimal}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\begin{document}
Test for $\alpha$ and $α$.
\end{document}

This renders only the first math symbol correctly. What do I miss exactly?

9

You must declare the alpha. E.g. in fontmath.ltx the command \alpha is set up this way:

\DeclareMathSymbol{\alpha}{\mathord}{letters}{"0B}

You need the same declaration for the alpha (the ^^^^03b1 are only ascii substitutes for the alpha, you can replace them):

\documentclass{minimal}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\DeclareMathSymbol{^^^^03b1}{\mathord}{letters}{"0B}
\begin{document}
Test for $\alpha$ and $^^^^03b1$.
\end{document}
  • Ok. Is there any package that include these definitions for the most common symbols? – Stéphane Gimenez Nov 16 '11 at 10:25
  • I don't know such a package. – Ulrike Fischer Nov 16 '11 at 10:35
  • Ok thank you! Maybe I'll make mine :-) – Stéphane Gimenez Nov 16 '11 at 10:54
  • @StéphaneGimenez In case you did, would you mind publishing it? – Tobias Kienzler Dec 14 '12 at 11:06
  • @StéphaneGimenez, Did you make yours? :) or find an alternative (within pdflatex). It would be very useful. – alfC Dec 24 '12 at 10:18
6

use the Latin Modern Math font:

\documentclass{minimal}
\usepackage{unicode-math,fontspec}
\setmainfont{TeX Gyre Pagella}
\setmathfont{lmmath-regular.otf}
\begin{document}
Test for $\alpha$ and $α$.
\end{document}
  • @Hebert, So fontspec or unicode-math} needs xelatex or lualatex. Once you use one of them, the document compiles and generates the expected output, even with the the two lines \setmainfont{... lines. It even works without the fontspec package. (in TeXLive 2012 at least) – alfC Dec 24 '12 at 10:17
  • @alfC: sure it loads Latin Modern by default but I wanted to use Pagella! – user2478 Dec 24 '12 at 11:36

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.