21

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}

enter image description here

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}

enter image description here

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} enter image description here

With \SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n} enter image description here

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}

enter image description here

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.

enter image description here

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!

enter image description here

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}

enter image description here

More Packages That Seem Related

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

Other Related Information

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) enter image description here


Sans Serif Version -- Using the avec Package Approach from Above and Recommended by Mico enter image description here

  • 1
    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 03:42
  • 2
    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 03:44
  • Did you read the commentary on sansmath.sty. It tells you what it does, what it doesn't do and what you might be better doing instead of using it. – cfr Mar 21 '17 at 03:47
  • 1
    Are you fixed to pdflatex or is a transition to e.g. xelatex possible? – TeXnician Mar 21 '17 at 06:25
  • I'm not sure there's any development available. – egreg Mar 21 '17 at 08:13
  • The miktex error probably means that you should run updmap on a command (the document compiles fine for me). – Ulrike Fischer Mar 21 '17 at 08:47
  • @TeXnician I personally will use pdflatex but if you can provide an alternative for others. And now I see that I should include this in the question -- thanks for asking. – Dr. Manuel Kuehner Mar 21 '17 at 09:07
  • @UlrikeFischer Thanks -- that did the trick. I updated the question. – Dr. Manuel Kuehner Mar 21 '17 at 09:10
  • @cfr a) About sansmath -- I just assumed it. And I didn't intend to be negative about it. If the assumption is wrong -- good. b) I read the documentation of sansmathfonts and I understood that it "just" uses existing "stuff". Unlike some of you guys I cannot read style files like plain text :). c) The whole font stuff is still very confusing for me. Normally I just use lmodern and I was happy so far. Right now I am helping a math and physics teacher (who just started as a teacher) setting up LaTeX and for some kind of documents, the sans serif font are helpful. – Dr. Manuel Kuehner Mar 21 '17 at 09:25
  • @egreg Thanks -- so you mean that the examples I collected are "all" there is. Which solution would you use? – Dr. Manuel Kuehner Mar 21 '17 at 09:27
  • 1
    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 09:55
  • @Mico Good point. I added some information. I am offline now (at least not on a computer, only mobile). – Dr. Manuel Kuehner Mar 21 '17 at 10:09
  • 1
    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

2 Answers2

11

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:

enter image description here

\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}
Mico
  • 506,678
  • 1
    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
  • 1
    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 http://mirrors.ctan.org/fonts/arev/doc/fonts/arev/arevdoc.pdf. – Dr. Manuel Kuehner Mar 21 '17 at 14:13
  • 1
    @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
  • Thanks. I updated the example in the question with a comparison, accordingly. – Dr. Manuel Kuehner Mar 21 '17 at 14:33
  • I just saw the cabin package (https://www.ctan.org/pkg/cabin) in a comment (http://tex.stackexchange.com/questions/364060). It looks interesting. Do you think that I should add it as an example in the question? – Dr. Manuel Kuehner Apr 10 '17 at 18:52
  • 1
    @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
  • Please allow me an additional question, no problem if that's too much to ask (I am amazed what effort some people provide here). Is the mathdesign package (https://www.ctan.org/pkg/mathdesign) something that should be added into the collection in my question? – Dr. Manuel Kuehner Apr 11 '17 at 19:07
  • 1
    @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
4

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.

biolinum

\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}
TeXnician
  • 33,589
  • 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
  • 2
    @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