5

Community, this question does not hold up to my standard research quality. Please excuse if there is an obvious answer. It's a bit of a deadline situation with a late change in requirements.

I have a beamer document that is compiled with LuaTeX. I have to use a system font (ttf). In the MWE below I use Consolas font as a replacement for my actual font (it is commercial).

I want to use a "normal" sans serif math font (via \usepackage{}) together with the ttf font. I use \usepackage{isomath} in my MWE.

The document compiles but the math is not all sans serif (numbers, sin, alpha, \infty are serif). I want everything to be sans serif.

\documentclass{beamer}
\usepackage{fontspec}
\usepackage{mathtools}
%\setsansfont{PorscheNextTT}
\setsansfont{Consolas} % Should be available on a Windows system
\usepackage{isomath}

\begin{document}

\begin{frame}
Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}

\begin{align}
1 + 2 &= x\\
y(t) &= \int_0^\infty \sin(\alpha) d\text{t}
\end{align}

Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}
\end{frame}

\end{document}

MWE with #Consolas# font

enter image description here

MWE with my #actual# font

enter image description here



Final Solution After Reading the Answers

\documentclass{beamer}
\usefonttheme{professionalfonts}

% Nice sans serif font
% Loads arevtext and arevmath which is not necessary in this case (arevmath would be enough)
\usepackage{arev}

% Here the magic happens
\usepackage[no-math]{fontspec}

% Never without...
\usepackage{mathtools}

% My system font for the main text
%\setsansfont{PorscheNextTT}
\setsansfont{Consolas}

% Should be the Last Font package
% Uses letters and numbers from the main font for math --> very useful
\usepackage[italic]{mathastext}

\begin{document}

\begin{frame}
Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}

\begin{align}
1 + 2 &= x\\
y(t) &= \int_0^\infty \sin(\alpha) \mathrm{d}t
\end{align}

Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}
\end{frame}

\end{document}

enter image description here

With my Actual Font enter image description here

  • 1
    Have you already tried unicode-math and its \setmathfont? It has options to appear ISO-like. – TeXnician Jan 18 '18 at 20:11
  • 1
    I don't think there exists a sans serif math font in OpenType format. The closest you can probably get is TeX Gyre DejaVu Math (showcase) which is slab serif. Otherwise I know there exists cmbright which is a Type1 sans serif math font. Alternatively you could use mathastext to use letters and numerals of the text font in math. – Henri Menke Jan 18 '18 at 20:17
  • 1
    If your actual text font and the math font look similar enough, maybe \usepackage[no-math]{fontspec} could be used? – user36296 Jan 18 '18 at 20:20
  • @TeXnician No, I did not try that. I do not have much experience with that kind of problem at all (as you can tell :). – Dr. Manuel Kuehner Jan 18 '18 at 20:22
  • 1
    The symbols from arev look nice, however a little bit too big in comparison to the surrounding font. If this is still true for your real font tex.stackexchange.com/a/249379/36296 could be helpful. – user36296 Jan 18 '18 at 21:45
7

I think your best bet is mathastext.

\documentclass{beamer}
\usepackage[no-math]{fontspec}
\setsansfont[Scale=0.9]{DejaVu Sans Mono} % no MS Windows, sorry
\usepackage[italic]{mathastext}
\usepackage{mathtools}
\usepackage{isomath}
\newcommand*\diff{\mathop{}\!\mathrm{d}}

\begin{document}

\begin{frame}
  Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}

  \begin{align}
    1 + 2 &= x\\
    y(t) &= \int_0^\infty \sin(\alpha) \diff t
  \end{align}

  Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}
\end{frame}

\end{document}

enter image description here

  • Just making (actually burning) dinner. I will look into it later. Thanks so far....1 min later...tried it...looks great! – Dr. Manuel Kuehner Jan 18 '18 at 20:25
  • Thanks for the answer. And I really appreciate your effort with \newcommand*\diff{\mathop{}\!\mathrm{d}} (which I did very wrong in my MWE). – Dr. Manuel Kuehner Jan 18 '18 at 21:09
  • Just read the documentation of the mathastext package. This seems to be a very useful package for the/my future. – Dr. Manuel Kuehner Jan 18 '18 at 21:16
6

Usually, I use arevmath for sans-serif math in beamer. Also, parts of the iwona fonts are helpful (for sans-serif integrals, for example, though big parentheses look a bit weird in this setup).

\documentclass[professionalfont]{beamer}
\usepackage{mathtools}
\usepackage{arevmath}
\SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n}
\usepackage{fontspec}
%\setsansfont{PorscheNextTT}
%\setsansfont{Consolas} % Should be available on a Windows system
\setsansfont{Fira Sans} % I'm not on Windows, so Fira Sans instead

\begin{document}

\begin{frame}
Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}

\begin{align}
1 + 2 &= x\\
y(t) &= \int_0^\infty \sin(\alpha) d\text{t}
\end{align}

Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}
\end{frame}

\end{document}

The result:

enter image description here

  • 1
    Thanks for the recommendation of arevmath - I will use this. Very good readability. – Dr. Manuel Kuehner Jan 18 '18 at 21:18
3

As a quick hack, you could use your text font for the "normal" letters in math using the no-math option of fontspec. For all symbols which are not part of your font, the default sans serif ones of beamer will be used.

% !TeX TS-program = lualatex
\documentclass{beamer}
\usepackage[no-math]{fontspec}
\usepackage{mathtools}
%\setsansfont{PorscheNextTT}
\setsansfont{Consolas} % Should be available on a Windows system

\begin{document}

\begin{frame}
Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}

\begin{align}
1 + 2 &= x\\
y(t) &= \int_0^\infty \sin(\alpha) d\text{t}
\end{align}

Testtext. Testtext. \textbf{Testtext.} Testtext. \textcolor{red}{Testtext.}
\end{frame}

\end{document}

enter image description here

  • Thanks for the answer. The no-math did the trick. – Dr. Manuel Kuehner Jan 18 '18 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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