Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 9 down vote accepted

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}
share|improve this answer
    
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
add comment

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}
share|improve this answer
    
@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! –  Herbert Dec 24 '12 at 11:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.