# Setting up a Sans Serif Document Including Math (in 2017, using pdftex)

I try to set up an entire document using sans serif fonts including math. At the moment I would like to use pdftex.

I searched the relevant questions and answers -- this is what I found:

## kpfonts Package

This is an edit from 2017-06-09. I found kpfonts by accident and they seem to be promising.

\documentclass[preview]{standalone}

% https://www.ctan.org/pkg/kpfonts
% Complex package -- read the documentation!
\usepackage[sfmath]{kpfonts}
\usepackage{mathtools}
\renewcommand\familydefault{\sfdefault}

\begin{document}
Text
$\displaystyle abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2}f(x)\,\text{d}x$
Text
\end{document}


## cmbright Package

\documentclass[preview]{standalone}

\usepackage{cmbright}
\SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n}

\usepackage{mathtools}
\begin{document}
Text
$\displaystyle abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2}f(x)\,\text{d}x$
Text
\end{document}


## arevtext and arevmath (or simply arev) Package

\documentclass[preview]{standalone}

\usepackage{arev}
% Suggested from Mico
\SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n}

\usepackage{mathtools}
\begin{document}
Text
$\displaystyle abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2}f(x)\,\text{d}x$
Text
\end{document}


Without \SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n}

With \SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n}

## sansmathfonts and helvet Package

\documentclass[preview]{standalone}

\usepackage{sansmathfonts}
\usepackage[scaled=0.95]{helvet}
\renewcommand{\rmdefault}{\sfdefault}

\usepackage{mathtools}
\begin{document}
Text
$\displaystyle abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2}f(x)\,\text{d}x$
Text
\end{document}


## newtxsf Package

The following code is taken from the newtxsf documentation and adjusted to the code examples above.

\documentclass[preview]{standalone}

\usepackage[sfdefault,scaled=.85]{FiraSans}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[varqu,varl]{zi4}% inconsolata typewriter
\usepackage{amsmath,amsthm}
\usepackage[cmintegrals]{newtxsf}

\usepackage{mathtools}
\begin{document}
Text
$\displaystyle abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2}f(x)\,\text{d}x$
Text
\end{document}


I have trouble running the code since I get an error in the file miktex-makemf.log. I already refreshed the FNDB (MiKTeX). The error is not part of the question though.

Maybe someone can add the output of the code for me.

2017-03-21 02:02:13,987+0100 FATAL miktex-makemf - The txsys source file could not be found.

After following the comment of Ulrike Fischer (running upmap on the command window of Windows), the error is gone!

## sansmath and helvet Package

sansmath doesn't seem to be an active package (this is an assumption -- nothing more). I only found 2003-08-13, version 1.0 on CTAN.

\documentclass[preview]{standalone}

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{sansmath}
\sansmath

\usepackage{mathtools}
\begin{document}
Text
$\displaystyle abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2}f(x)\,\text{d}x$
Text
\end{document}


## More Packages That Seem Related

• stix (v1.1.2-latex from 2015/04/17)

## Actual Questions

1. What is the nowadays recommended way to set up a complete sans serif document? I aim for a solution that is considered state-of-the-art with a (if possible) complete set of symbols and font versions (Small Caps and do on).
2. What do font packages like sansmathfonts do? Do they "just" make already existing fonts (or single characters / symbols) available in a convenient package (so it's "luck" if everything fits together) or did the authors create new fonts?

## Background -- Why Do I Want This

I one of the comments (Mico) I was asked to explain what I want do to with the sans serif fonts.

• I help a friend which just started to be a teacher.
• If we create documents that are used on any kind of projectors, then the serif fonts sometimes cause readability problems.
• With documents I mean, e. g. beamer presentations or standalone diagrams.
• I attached one of the standalone diagrams below. The pictures have the same resolution.
• So it's not for a book, article or paper.

Standard Solution with Serif Fonts (no font package loaded -- I assume Computer Modern then)

Sans Serif Version -- Using the avec Package Approach from Above and Recommended by Mico

• Sans serif fonts do not usually feature either small-caps or true italics. Hence a complete solution really should not requite small-caps. Traditionally and standardly, small-caps are serifs. – cfr Mar 21 '17 at 3:42
• Why do you assume that a package last updated in 2003 is not active? Is it marked unmaintained? Many packages don't need updating and authors do not keep deluging the CTAN team with uploads just to put shiny new dates on their packages. At least, they shouldn't and I can't think why anybody would. I certainly don't. – cfr Mar 21 '17 at 3:44
• Are you fixed to pdflatex or is a transition to e.g. xelatex possible? – TeXnician Mar 21 '17 at 6:25
• It would help if you stated the purpose(s) or reason(s) for wishing to use sans-serif math and text. E.g., is it a personal preference for sans-serif over serif glyphs, is it a requirement of some publishing house, is it because you're preparing a beamer presentation and don't like the default (Computer Modern sans) sans serif choice, or still something else? Just as there will never be an "overall best" serif font, there will never be an "overall best" sans-serif font... – Mico Mar 21 '17 at 9:55
• I didn't mean to read the code of the style file. It includes a lot of commented commentary. (This may be the same as the documentation - I didn't check. For example, it discusses combining with or substituting Euler, notes limitations etc.) – cfr Mar 21 '17 at 23:14

If the document is going to take the form of a beamer presentation, I recommend you -- or the colleague you're helping to get started -- do two things:

• issue the instruction \usefonttheme{professionalfonts} in the preamble, and

• load the arev package, which loads the arevtext and arevmath packages.

In my experience, the arev text and math fonts are both a bit darker and more widely spaced than the corresponding CM Sans fonts. I consider both of these features to be significant pluses for the purpose of writing a beamer-based presentation. For beginners in the business of giving presentations, a perennial and near-fatal tempatation is to try to cram too much material into any given slide. A font that's slightly more generously spaced and therefore makes it more difficult to cram too much material into a slide is highly advantageous in this regard. :-)

Another thing I like about the arev math fonts -- however, this is clearly just a personal preference -- is that quite a few of the math-mode alphabetic glyphs actually look "italic" rather than just "slanted". This is quite apparent if one compares \textit{x} (purely slanted) with $x$ (more "italic", not just slanted). Other glyphs that have this distinctly "italic" look in math mode are a, f, i, l, u, v, and w. To repeat what I stated before, though: This is clearly just a personal preference; your preferences may very well be rather different.

A full MWE:

\documentclass{beamer}
\usefonttheme{professionalfonts}
\usepackage{arev}
\begin{document}
\begin{frame}
$\displaystyle abc + \sum_{k=1}^n \int_0^k \sqrt{2} f(x)\,\text{d}x$

\medskip\noindent
\begin{tabular}{@{}lll}
text-mode: & \emph{bcdeghjkmnopqrstyz} & \emph{afiluvwx} \\
math-mode: & $bcdeghjkmnopqrstyz$      & $afiluvwx$
\end{tabular}
\end{frame}
\end{document}

• Good point! And it has a good readability on screens and so on. Thanks. I wait till tonight to accept the answer -- maybe there are more options. – Dr. Manuel Kuehner Mar 21 '17 at 14:07
• I now use the recommendation in the diagram example above (picture is updated). Your points are clearly visible. The avec package doesn't seem to have a lot of documentation. I only found mirrors.ctan.org/fonts/arev/doc/fonts/arev/arevdoc.pdf. – Dr. Manuel Kuehner Mar 21 '17 at 14:13
• @Dr.ManuelKuehner - Also, keep in mind that it's permissible to provide the instruction \SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n} after \usepackage{arev}, should you prefer the summation and integral symbols of the iwona font, even if all other glyphs come from arev. – Mico Mar 21 '17 at 14:24
• @Dr.ManuelKuehner - Thanks. As far as I can tell, cabin is a pure text-mode font; no math support at all. If the beamer document doesn't involve any math at all, sure -- go ahead and consider using cabin. Do note that it's quite compressed -- esp. when compared with arev. Compressed sans-serif may be a virtue (or a necessity...) in some documents, but in a beamer document my view is that compressed fonts should be avoided if you have any regard for the folks in the audience... – Mico Apr 10 '17 at 19:00
• @Dr.ManuelKuehner - I don't think it would hurt -- :-) -- to mention the mathdesign package and some of its principal options (utopia, garamond, and charter). To keep things focused on the subject of documents that broadly fall into the category of beamer-type presentations, you may want to limit the discussion to just the sans-serif font possibilities. Otherwise, your already-long answer might easily become twice as long... :-) – Mico Apr 11 '17 at 19:29

As stated in the comments: This is just for reference and not a real solution for the pdflatex-specific question. The following solution is xelatex-only, because it uses mathspec, which lets you use any system-wide installed font and adjust many aspects of the math font (including specific fonts for \mathbb, \mathcal, \mathfrak etc. and the selection according to character groups "Latin", "Greek", "Digits").

This is a very simple way to get a sans-only document, since you can use multiple fonts to cover the whole unicode area as needed (most sans fonts miss the calligraphic or fraktur characters). In the following example I use the "Linux Biolinum" font.

\documentclass{article}

\usepackage{mathspec}
\setallmainfonts{Linux Biolinum G}
\setallsansfonts{Linux Biolinum G}
\setallmonofonts{Linux Biolinum G}
\setmathsfont(Digits,Latin,Greek)[ItalicFont=Linux Biolinum G Italic,%
BoldFont=Linux Biolinum G Bold]{Linux Biolinum G}%

\begin{document}

This is a test.

Text
$$\displaystyle abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2} f(x)\,\mathrm{d}x$$
Text\\

$$\alpha + \mathcal{X}$$

\end{document}

• Thanks. If I use xelatex, can I just use the same code as in pdftex? (except of the font stuff) – Dr. Manuel Kuehner Mar 21 '17 at 10:06
• @Dr.ManuelKuehner Yes, you can, except that you should remove the packages inputenc (as utf8 is expected) and fontenc (as it automatically uses open-type). – TeXnician Mar 21 '17 at 10:07
• A similar question has recently evolved : the recent availability ot two Sans Math fonts essentially solves the problem for XeLaTeX and LuaLaTex (as well as OpenType-enabled software such as LibreOffice, by the way). Unless you are dead set to use pdfLaTeX, these solutions seem to be both easier, more consistent and more æsthetically pleasing than the current kludges... – user2903730 Apr 20 '18 at 22:55