9

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.

8
  • No idea about the first message, but since you are not loading any text fonts with fontspec, the \defaultfontfeatures line makes no sense, you neither need (or want) TeX quote ligatures nor old style numbers in math mode. Commented Aug 28, 2011 at 23:58
  • 1
    also, don't directly load luatextra, it is a low-level package that is for other packages to load, you don't need to load it in your document. Commented Aug 29, 2011 at 0:01
  • Beamer change math alphabets unless it detects certain packages. Load it with professionalfonts option prevent this. You should read the manual.
    – Yan Zhou
    Commented Aug 29, 2011 at 6:48
  • 1
    @Yan: If you look at the example given you will see that Martin does load it with the professionalfonts option. Actually the class option is professionalfont and is now obsolete. The manual is also slightly confusing on this issue since on p19 it refers to a class option whereas on p193 to a font theme. Also, unicode-maths warning adds to the confusion by getting the class option wrong. Finally, please do not swear, not even in abbreviations. Commented Aug 29, 2011 at 7:02
  • 1
    @Martin: I see, my information was outdated (predating the introduction of luatexbase). Commented Aug 29, 2011 at 18:59

2 Answers 2

13

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 loading unicode-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:

"professionalfont" is obsolete. Use font theme "professionalfonts" instead

There are two things to notice here. First is that the class option is not professionalfonts (as unicode-math claims) but professionalfont. Second, that it is obsolete. Rather, you should issue the command:

\usefonttheme{professionalfonts}

somewhere in your preamble. What this does is:

\mode<presentation>{\beamer@suppressreplacementstrue}

so it sets the same \if but only in presentation mode. Thus it is ignored in article mode. Since the unicode-math test only checks for the class being beamer, and not for the beamerarticle package, this is consistent. Thus the correct preamble is:

\documentclass{beamer}
\usefonttheme{professionalfonts}
\usepackage{unicode-math}

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 the beamer class. Thus the actual effect of the middle line is to suppress the warning with the unicode-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.)

2
  • 1
    Thanks for a well written answer. And good luck changing your documents. :-) Commented Aug 29, 2011 at 17:15
  • 1
    For future reference: if you are using a beamer font style (e.g. serif), you still have to specify \beamer@suppressreplacementstrue manually.
    – Evpok
    Commented Sep 10, 2013 at 14:02
3
\documentclass[professionalfont]{beamer}
\usepackage[english]{babel}
\usepackage{iftex,ifxetex}
\ifPDFTeX
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
  \usepackage{lmodern}
\else
  \ifluatex
    \usepackage{unicode-math} 
    \defaultfontfeatures{Ligatures=TeX,Numbers=OldStyle}
    \setmathfont{Latin Modern Math}
    \setsansfont{Linux Biolinum O}
  \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} \).

012345 $012345$ ff ffl ffi

\end{frame}
\end{document}
1
  • Thanks for showing me how to get oldstyle numbers working with beamer. Commented Aug 29, 2011 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .