4

The existing question Typeset WHOLE document in sans-serif, Including Math Mode uses the sansmath package to use helvet glyphs also in math-mode. But being not designed for use in math mode, the results don't look convincing.

According to this survey of free math fonts, it seems to be possible to use another font (mentioned are cmbright and lxfonts as similar) for math-mode in combination with helvet for text-mode. However, I cannot find pointers on how to setup the document appropriately. (How) can it be done?

The obligatory MWE:

\documentclass{article}

\usepackage{helvet} % for text-mode
\renewcommand{\familydefault}{\sfdefault}

% \usepackage{cmbright} % one of these for...
% \usepackage{lxfonts}  % math-mode only

\usepackage[math]{blindtext}
\begin{document}
\blindmathpaper
\end{document}
5

Update, use sansmathfonts instead of sansmath

A year later, I finally found a combination of text and math font for a helvet-based document. Source: Egreg's answer to my question about arev's strange placement of subscripts.

Result

helvet text with sansmathfonts math blindmathpaper

New code

\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage{sansmathfonts}
%\usepackage[scaled=0.86]{beramono} % for code listings
\usepackage[scaled=0.95]{helvet}
\renewcommand{\rmdefault}{\sfdefault}

\usepackage[T1]{fontenc}
\usepackage[math]{blindtext}
\begin{document}
\blindmathpaper
\end{document}

Old (helvet + arev)

I should have read the survey link I provided more carefully. The author was so nice to not only provide the comparison as pdf, but also as tex for each font combination. He explains how to combine the math font of Arev with text font of Heros, which is a Helvetica clone. So with a slight change from tgheros to helvet, my working example becomes:

\documentclass{article}

\usepackage{arev} % sans-serif math font
\usepackage{helvet} % sans-serif text font
\renewcommand{\rmdefault}{\sfdefault}

\usepackage[math]{blindtext}
\begin{document}
\blindmathpaper
\end{document}
3

The manual of sansmath states the following:

The actual sans fonts are OT1 encodings of those indicated by the meaning of \sfdefault WHEN THE PACKAGE WAS LOADED, not the meaning at each maths environment!

We can exploit this fact by first loading the desired math font, then sansmath, and finally helvet for the text font. This is straightforward when cmbright is used for maths:

Sample with Helvetica text and CM Bright maths

\documentclass{article}
\usepackage{cmbright}
\usepackage{sansmath}
\sansmath
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[math]{blindtext}
\begin{document}
\blindmathpaper
\end{document}

Some other technique would be needed for lxfonts which acts at the end of the preamble, overriding earlier font settings (helvet).

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.