114

How do I typeset an entire document in sans-serif, e.g. Helvetica, without littering the document with font changes for every heading/paragraph, etc.? Like in How to set the font for a \section title (and chapter etc), but with the paragraphs all in sans-serif.

For example, I've seen documents typeset in Computer Modern and then switched to Palatino, but can I do the same with Helvetica with a few commands at the beginning?

(And please don't tell me to use a serif font for body copy / paragraphs. I know. I'm trying to use latex to typeset my resume to look like the one I've created in a word processor, which is hard to maintain but looks good. I'm hoping latex will let me do more advanced formatting/layout, separating content from form.)

3 Answers 3

142

\renewcommand{\familydefault}{\sfdefault} will switch to using sans-serif for everything except mathematics. The sans-serif will be computer modern sans unless you also put \usepackage{helvet} in the preamble in order to make the default sans be Helvetica (or \usepackage{avant} for Avant-Garde, etc.

13
  • 4
    Usually yes, although it's possible that a particular distribution has been installed so that that isn't the default. For most standardly installed distributions, though, font embedding is enabled by default, AFAIK.
    – Alan Munn
    Jul 5, 2011 at 18:40
  • 6
    @Lev, Is there a package that does this automatically?, that is, without the ugly \renewcommand{\familydefault}{\sfdefault} code. (Nothing against it, but this is the kind of code makes me embarrassed to explain to newcomers)
    – alfC
    Mar 22, 2013 at 20:50
  • 13
    The command \usepackage{helvet} does not provide Helvetica font, but an Helvetica clone called Nimbus Sans L.
    – user34087
    Jul 24, 2013 at 8:09
  • 2
    @alfC: some packages (eg: sourcesanspro, cabin) provide an option. The LaTeX Font Catalogue will show this in the code example for most (but not all) packages.
    – Silke
    Jul 24, 2013 at 21:46
  • 2
    @alfC haha. ok ;) I definitely sympathise with the idea that TeX/LaTeX is the opposite of newbie-friendly (user-friendly, even). Jun 4, 2014 at 4:25
5

In ConTeXt you obviously use \setupbodyfont. This will not affect math mode.

\setupbodyfont[ss]

\starttext

Sans-Serif

\stoptext

enter image description here

4

The best way to have BOTH the text AND the math is just by adding:

\usepackage{cmbright}

in the preambule of the LaTeX document. It gives a nice and homogenous look to your document. Cheers!

4
  • 2
    cmbright is nice but in what sense it's the best solution?
    – lhf
    Feb 18, 2021 at 22:07
  • 1
    I believe it is, if you want both the text and the math to be without serif, which was the initial question :)
    – LeChat
    Feb 18, 2021 at 22:29
  • it seems that this font is not vectorized correctly, zooming in shows that the font is very pixelated? tex.stackexchange.com/questions/2095/… Nov 23, 2021 at 10:42
  • On my computer (another one from which I compiled the initial document I am checking cmbright on), I can zoom in 6400% with still no pixelation of the characters... To me, everything seems great so far. Have you tried another pdf viewer?
    – LeChat
    Mar 2 at 14:32

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.