# Changing Font Family as in LaTeX wikibook example

I want to vary the font family in my document, as demonstrated in this example from the LaTeX wikibook. I built and compiled an mwe using that same code, but in the document I generated, the font does not change.

\documentclass{article}

%% wikibooks example
%% https://en.wikibooks.org/wiki/LaTeX/Fonts#cite_ref-1

\begin{document}

% Default font (\familydefault = \rmdefault = Computer Modern Roman)
Lorem ipsum dolor sit amet, consectitur adipiscing elit.

% Palatino font (ppl must be installed).
\renewcommand*\rmdefault{ppl}
Lorem ipsum dolor sit amet, consectitur adipiscing elit.

% Iwona font (iwona must be installed).
\renewcommand*\rmdefault{iwona}
Lorem ipsum dolor sit amet, consectitur adipiscing elit.

\end{document}


I saw the admonition that those fonts must be installed, but I believe they are. I got no warnings or errors during compilation; the only seemingly suspicious and related output in the log file was the following:

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Try loading font information for OT1+iwona on input line 18
.

(/usr/local/texlive/2017/texmf-dist/tex/latex/iwona/ot1iwona.fd
File: ot1iwona.fd 2008/07/22 v0.995 font definition file for OT1/iwona (MW)
) [1

{/usr/local/texlive/2017/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./mwe.
aux) )


However, that to me doesn't indicate a problem. I have tried using fonts other than those listed in the examples, with no better results. I can add \usepackage{iwona} to the prelude, and this changes the font from the default, but for the entire document. To be clear, I'm hoping to see a change in font each time I redefine rmdefault, as in the wikibooks example. Any suggestions?

• Redefine \rmdefault only works in the preamble, and therefore, you can use effectively only one time. – Fran Sep 10 '17 at 7:04

\documentclass{article}
%\usepackage{iwona}    % it must work when correctly installed ;)
%\usepackage{palatino} % Idem
\begin{document}

% Default font
Lorem ipsum dolor sit amet, consectitur adipiscing elit.

% Palatino font (ppl must be installed).
{\fontfamily{ppl}\selectfont
Lorem ipsum dolor sit amet, consectitur adipiscing elit.}

% Iwona font (iwona must be installed).
{\fontfamily{iwona}\selectfont
Lorem ipsum dolor sit amet, consectitur adipiscing elit.}

% default again
Lorem ipsum dolor sit amet, consectitur adipiscing elit.

\end{document}


The Wikibook page glosses over several points, the main of which is that

\renewcommand{\rmdefault}{family}


command should be issued in the document preamble. After all, there should be just one default font family in a document.

The other main point it glosses over is that generally no user will ever do that setting, but load a suitable package for the font. For instance, if one wants Palatino, the package mathpazo used to be recommended, rather than \usepackage{palatino}, because the former also sets up suitable math fonts. It also provides the sc option that loads a “true” small caps font. For Palatino there's also the combination

\usepackage{newpxtext}
\usepackage{newpxmath}


(the second one accepts various options, look for texdoc newpx on your system or at http://texdoc.net).

For Iwona, do \usepackage{iwona}, which not only sets \rmdefault.

There are scores of font packages in TeX Live/MiKTeX nowadays, several of them accompanied by matching math fonts.

• I think that the true issue of Jason is not fix the default font or what font is better, but how to change the default font in some parts of the text. – Fran Sep 10 '17 at 11:14