# How to set lining numbers in math in Beamer (with EB Garamond) under XeLaTeX

I'm using EB Garamond with XeLaTeX and Beamer as follows. (I'm not actually sure whether it's all necessary--advice accepted.):

\usepackage[T1]{fontenc}  % not sure why
\usepackage[urw-garamond]{mathdesign} % use URW Garamond rather than Computer Modern in math when EB Garamond is missing a character
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text} % not sure why
\setromanfont[Mapping=tex-text]{EB Garamond}


(I previously loaded EB Garamond as a system font on a Mac using its Font book app.)

EB Garamond uses oldstyle numbers by default. I can easily change to lining numbers in regular text by various means, e.g. by inserting this at the top of the document: \addfontfeatures{Numbers=Lining}. However, none of the methods I've tried has any effect on math in , , etc.; the oldstyle numbers remain. This is a Beamer issue--the problem doesn't occur with the article class.

How can I switch to lining numbers in math mode (without resorting to \mbox)? A full minimal working example is below.

Thanks!

\documentclass[12pt]{beamer}

\usepackage[T1]{fontenc}
\usepackage[urw-garamond]{mathdesign}
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{EB Garamond}

\usefonttheme{serif}

\begin{document}
\begin{frame}
text (default, oldstyle): 1234567890\\
text (lining): 1234567890\\
math (why is this oldstyle?): $1234567890$
\end{frame}

\end{document}

-
Are you meaning beamer rather than article? I don't think it's a good idea to use Garamond for a presentation. –  egreg Feb 6 '13 at 10:07
Thanks egreg. Yes, the class was beamer. Not sure how that typo got into the MWE--won't run with article. I just fixed it. (I'm not someone in the "presentations must be in san serif" camp. For me a Garamond is a good choice for presentations; I've given it quite a bit of thought, and have worked up a Beamer class that I like.) –  Mars Feb 6 '13 at 14:36

I found a solution. It's easy, it's obvious, and though it's not a complete solution, it's good enough for me. The solution is to moveNumbers=Lining from \addfontfeatures to defaultfontfeatures, like this:
\defaultfontfeatures{Mapping=tex-text, Numbers=Lining}

This isn't a complete solution because it affects math mode throughout the document. I still don't know how to switch back and forth between lining and oldstyle numbers in math mode. Adding additional calls to \addfontfeature or \defaultfontfeature in the document have no effect on math mode. However, using lining numbers everywhere is what I wanted, anyway.