# When I load multiple font packages, which one will win?

I haven't used more than one font package. But I noticed some people use multiple font packages. Shortly speaking, which one will win if we load multiple font packages?

-
The last one ;-) –  Marco Daniel Aug 10 '12 at 16:36
@MarcoDaniel: only the last one? –  Who is crazy first Aug 10 '12 at 16:37
@GarbageCollector It depends on what they do. For example, `\usepackage{mathptmx,helvet,courier}` will work fine, as the first alters the serif font, the second the sanserif and the last the monospaced. –  Joseph Wright Aug 10 '12 at 16:40

It depends.

Generally speaking, the font you get is the last one you specified. Thus usually when you use multiple font packages, the last one wins.

However, it depends on the actual commands in the packages. A font package do not always do the same thing as another font package, some times they work together.

An example is:

``````\usepackage{times}
\usepackage{utopia}
``````

If you use the two packages in your document, you will see the main font is Utopia. You may say `utopia` wins. That isn't the truth. You might also notice that `\textsf` becomes Helvetica and `\texttt` becomes Courier, that's `times` package's effect.

When you look into the code of the packages, you will know why:

``````% in times.sty
\renewcommand{\sfdefault}{phv}
\renewcommand{\rmdefault}{ptm}
\renewcommand{\ttdefault}{pcr}

% in utopia.sty
\renewcommand{\rmdefault}{put}
\renewcommand\bfdefault{b}
``````

What we obtain at last is the same as:

``````% mixed
\renewcommand{\sfdefault}{phv}
\renewcommand{\ttdefault}{pcr}
\renewcommand{\rmdefault}{put}
\renewcommand\bfdefault{b}
``````
-