How do you change the document font in LaTeX?

FontsLatex

Fonts Problem Overview


How do you change the font for the whole document to sans-serif (or anything else)?

Fonts Solutions


Solution 1 - Fonts

I found the solution thanks to the link in Vincent's answer.

 \renewcommand{\familydefault}{\sfdefault}

This changes the default font family to sans-serif.

Solution 2 - Fonts

For a different approach, I would suggest using the XeTeX or LuaTex system. They allow you to access system fonts (TrueType, OpenType, etc) and set font features. In a typical LaTeX document, you just need to include this in your headers:

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setmainfont{Times}
\setmonofont{Lucida Sans Typewriter}

It's the fontspec package that allows for \setmainfont and \setmonofont. The ability to choose a multitude of font features is beyond my expertise, but I would suggest looking up some examples and seeing if this would suit your needs.

Just don't forget to replace your favorite latex compiler by the appropriate one (xelatex or lualatex).

Solution 3 - Fonts

As second says, most of the "design" decisions made for TeX documents are backed up by well researched usability studies, so changing them should be undertaken with care. It is, however, relatively common to replace Computer Modern with Times (also a serif face).

Try \usepackage{times}.

Solution 4 - Fonts

This article might be helpful with changing fonts.

From the article:

> The commands to change font attributes are illustrated by the following example:

  \fontencoding{T1}
  \fontfamily{garamond}
  \fontseries{m}
  \fontshape{it}
  \fontsize{12}{15}
  \selectfont

> This series of commands set the current font to medium weight italic > garamond 12pt type with 15pt leading in the T1 encoding scheme, and > the \selectfont command causes LaTeX to look in its mapping scheme for > a metric corresponding to these attributes.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionnickfView Question on Stackoverflow
Solution 1 - FontsnickfView Answer on Stackoverflow
Solution 2 - FontsfideliView Answer on Stackoverflow
Solution 3 - Fontsdmckee --- ex-moderator kittenView Answer on Stackoverflow
Solution 4 - FontsVincent RamdhanieView Answer on Stackoverflow