[Tex/LaTex] How to change fonts

fontspackages

I'm sure this is a newbie question, but I can't figure this out.
I have tried to follow the advice here:
http://en.wikibooks.org/wiki/LaTeX/Fonts
and here:
http://www.cl.cam.ac.uk/~rf10/pstex/latexcommands.htm

But I can not seem to be able to generate any font change. I either get no change or error messages.

Here is the output of one failed attempt to change the font to Times using this command:

\rmfamily
\renewcommand{\rmdefault}{ptm}

http://pastebin.com/LJ62uC12

Apparently I either don't have a correct package installed or…

The output says " Metric (TFM) file not found." but I am not sure where to go from there.

Best Answer

Most of the time, it's advised to load the fonts you want beforehand by loading packages. A list of packages available in most TeX distributions can be found online in The LaTeX Font Catalogue.

Packages will define \rmdefault (roman), \sfdefault (sans-serif) or \ttdefault (monospaced). For example:

\usepackage{tgheros,tgtermes,tgcursor}

Will set TeX Gyre Termes as the roman font, TeX Gyre Heros as the sans-serif font and TeX Gyre Cursor as the monospaced font.

XeTeX/LuaTeX users can also change the font families using the fontspec package: using \setmainfont, \setsansfont or \setmonofont respectively.

\setmainfont{TeX Gyre Termes}\setsansfont{TeX Gyre Heros}\setmonofont{TeX Gyre Cursor}

One can change the default font family with:

\renewcommand*\familydefault{\sfdefault}

However, sometimes one wishes to specify a font directly, with fontspec this is also quite easy:

\fontspec{TeX Gyre Heros}

For Type 1 fonts this is a bit more difficult:

\fontfamily{qhv}\selectfont

More information about font names can be found in this question.