# Beamer: Using sans serif numbers in math mode together with LuaLaTeX and the fontspec package

This is a follow up on my last question. I want to produce a beamer presentation using the font Helvetica Neue. I am using this MWE:

\documentclass[]{beamer}

\usepackage{fontspec}
\setsansfont[
BoldFont=HelveticaNeueLTCom-Md,
ItalicFont=HelveticaNeueLTCom-LtIt,
SmallCapsFont=TeXGyre Heros,
SmallCapsFeatures={Letters=SmallCaps},
]{HelveticaNeueLTCom-Lt}

\begin{document}

\begin{frame}{Test 1 2 3}

\begin{itemize}
\item \textit{italic}
\item \textbf{bold}
\item normal
\item numbers: 1, 2, 3 and 4
\item math
\begin{align}
a^2 + b^2 &= c^\text{2} \text{ (used \texttt{\textbackslash text} to produce sans serif 2 for $c$)}\\
\alpha^2 + \beta^2 &= \gamma^2
\end{align}
\item \textsc{SmallCaps}
\item Dash -- Dash
\end{itemize}

\end{frame}

\end{document}


With the following result:

1. How do I change the font with is used for numbers in math mode? I can use \text all the time but this is not a clever solution.
2. Is the code ok that way? I didn't use the \usefonttheme{professionalfonts} beamer command because I think this is not useful in my case.
3. The dash -- does not work. How can that be fixed?
4. The SmallCaps font look too thick in combination with the thin main font. Has anybody a suggestion for a better SmallCaps replacement? I looked here http://www.gust.org.pl/projects/e-foundry/tex-gyre/ and it also says that

TeX Gyre Heros can be used as a replacement for a popular font Helvetica

Update

Following Mico's advice leads to missing greek letters such like \alpha and \beta. I removed the greek and Greek option but the letters are still missing:

\setmathfont[range=\mathup/{latin,Latin,num}]{HelveticaNeueLTCom-Th}
\setmathfont[range=\mathit/{latin,Latin,num}]{HelveticaNeueLTCom-ThIt}
\setmathfont[range=\mathbfup/{latin,Latin,num}]{HelveticaNeueLTCom-Roman}
\setmathfont[range=\mathbfit/{latin,Latin,num}]{HelveticaNeueLTCom-It}


The warnings in the log file look like:

*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
*
* OpenType feature 'Style=MathScript' (+ssty) not available for font
* 'HelveticaNeueLTCom-ThIt' with script 'Math' and language 'Default'.
*************************************************
luaotfload: font no 25 (HelveticaNeueLTCom-ThIt) does not define feature ssty fo
r script latn with language dflt
luaotfload: no font with id 25
*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
*
* OpenType feature 'Style=MathScriptScript' (+ssty) not available for font
* 'HelveticaNeueLTCom-ThIt' with script 'Math' and language 'Default'.
*************************************************


Using \usefonttheme{professionalfonts} or not does not have an effect on the output (as far as I can see).

• Regarding your new question: The reason why the small-caps glyphs of TexGyre Heros look to thick next to the glyphs of HelveticaNeueLTCom-Th is because the latter is (as its name indicates) designed to be, well, "thin". See if you can get a better match if you choose either HelveticaNeueLTCom-Lt or HelveticaNeueLTCom-Roman as the main (sans-serif) font. – Mico Jan 25 '14 at 20:25
• HelveticaNeueLTCom has no math! – user2478 Jan 30 '14 at 17:14
• Hello Herbert. Thereofre I thought that using \setmathfont[range=\mathup/{latin,Latin,num}]{HelveticaNeueLTCom-Th} would help. – Dr. Manuel Kuehner Jan 31 '14 at 8:04
• Ahhhh....I didn't see the mathup part...maybe I should use something different – Dr. Manuel Kuehner Jan 31 '14 at 8:38

try

\usepackage[no-math]{fontspec}
\usepackage{unicode-math}
\setsansfont[
BoldFont=HelveticaNeueLTCom-Md,
ItalicFont=HelveticaNeueLTCom-LtIt,
SmallCapsFont=TeXGyre Heros,
SmallCapsFeatures={Letters=SmallCaps},
]{HelveticaNeueLTCom-Lt}
\setmathfont{HelveticaNeueLTCom-Lt}
\setmathfont[range=\mathit/{greek}]{TeXGyre Heros Italic}

• I will try it later (I am not at my PC). Thanks – Dr. Manuel Kuehner Feb 3 '14 at 13:43

Taking your questions in reverse order:

• To enable the automatic substitution of -- and --- with endash and emdash symbols, be sure to load the font in question with the option Ligatures=TeX, i.e.,

\setsansfont[Ligatures=TeX,
Extension=.ttf,
BoldFont=HelveticaNeueLTCom-Md,
ItalicFont=HelveticaNeueLTCom-LtIt,
SmallCapsFont=TeXGyre Heros,
SmallCapsFeatures={Letters=SmallCaps},
]{HelveticaNeueLTCom-Lt}


I can't show the output that would result from this modification because I don't have these fonts on my system. Setting the option Ligatures=TeX option will also replace  with typographically correct opening double-quote marks.

• You've so far specified a text (sans serif) font but no math font; thus, the math parts show up in Computer/Latin Modern. You should load the unicode-math package (which, in turn, loads the fontspec package) and issue a few directives that tell LuaLaTeX to use, as much as possible, characters from the text font families. (As far as I'm aware, there are no opentype sans-serif math font available.)

\usepackage{unicode-math}
\setsansfont{TeXGyre Heros}
\setmathfont[range=\mathup/{greek,Greek,latin,Latin,num}]{TeXGyre Heros}
\setmathfont[range=\mathit/{greek,Greek,latin,Latin,num}]{TeXGyre Heros Italic}
\setmathfont[range=\mathbfup/{greek,Greek,latin,Latin,num}]{TeXGyre Heros Bold}
\setmathfont[range=\mathbfit/{greek,Greek,latin,Latin,num}]{TeXGyre Heros Bold Italic}


Here, I've used various weights and shapes of the TeXGyre Heros fonts. Assuming that the HelveticaNeue fonts have Greek letters, you may be able to replace TeXGyre Heros with HelveticaNeueLTCom-Lt, etc.

If you have a lot of math in your beamer doc, you you consider seriously using one of professionalfonts options, say, the arev class.

• The preceding discussion should also enable the use of sans-serif numbers in math mode.

• Thanks. I updated the question. It doesn't work with my font. Maybe the fonts are not good/complete enough. – Dr. Manuel Kuehner Jan 25 '14 at 19:51