According to a recent article in "Die TeXnische Komödie", this should be the way to get Latin Modern Math to work with lualatex and the latest TeXLive 2011:
\documentclass[professionalfonts]{beamer}
\usepackage[english]{babel}
\usepackage{iftex}
\ifPDFTeX
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\else
\ifLuaTeX
\usepackage{luatextra}
\defaultfontfeatures{Ligatures=TeX,Numbers=OldStyle}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\fi
\fi
\newcommand{\ip}[2]{(#1, #2)}
\begin{document}
\begin{frame}{Speaker's Name}{About Our Next Speaker}
\LaTeX\ is good at typesetting mathematical formulas
like
\( x-3y + z = 7 \)
or
\( a_{1} > x^{2n} + y^{2n} > x' \)
or
\( \ip{A}{B} = \sum_{i} a_{i} b_{i} \).
\end{frame}
\end{document}
It works (at least according to pdffonts
), but unicode-math
complains:
* unicode-math warning: "disable-beamer"
*
* Disabling beamer's math setup.
* Please load beamer with the [professionalfonts] class option.
And this message is repeated a dozen times:
* fontspec warning: "icu-feature-not-exist-in-font"
*
* OpenType feature 'Numbers=OldStyle' (+onum) not available
* for font 'LatinModernMath',
* with script 'Math', and language 'Default'.
What's wrong with my setup?
EDIT:
The fontspec warnings go away if one removes the Numbers=OldStyle
from the \defaultfontfeatures
.
EDIT2:
I removed the ifxetex
package and changed the \ifluatex
to \ifLuaTeX
.
Best Answer
Regarding the first message, there is a beamer class option
professionalfont
which sets an\if
, specifically\ifbeamer@suppressreplacements
to decide whether beamer would handle some special font stuff or there was some other package to do it instead.unicode-math
checks to see if that\if
has been set to true and if not, it issues the warning and then sets it to true. So loadingunicode-math
ensures that that\if
is set to true, but it might not be done as early as if you'd set the class option.However, if you do set the class option, then you will get the warning:
There are two things to notice here. First is that the class option is not
professionalfonts
(asunicode-math
claims) butprofessionalfont
. Second, that it is obsolete. Rather, you should issue the command:somewhere in your preamble. What this does is:
so it sets the same
\if
but only inpresentation
mode. Thus it is ignored inarticle
mode. Since theunicode-math
test only checks for the class being beamer, and not for thebeamerarticle
package, this is consistent. Thus the correct preamble is:Lastly, there should not be any actual problem if the middle line is missed since all it does is what
unicode-math
does when checking for thebeamer
class. Thus the actual effect of the middle line is to suppress the warning with theunicode-math
package.(Andrew now goes off and changes the preamble of his presentations because he'd been getting that warning with the
professionalfonts
class option and not understanding why he got it.)