4

I was reading some post here at SE and I noticed that many people load packages one by one. For example,

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}

and so on. Usually, I load those on a single command, like

\usepackage{amsfonts,amsthm,amsmath,amssymb}

Is this correct or some problems could appear?

I know that there are some packages which should be loaded before than others.

Sigur
  • 37,330

1 Answers1

10

Semantically,

\usepackage{amsfonts,amsthm,amsmath,amssymb}

is the same as

\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}

and clearly, the former looks more tidy and compact in the document.

The following reasons can make one still prefer the latter form:

  1. Package options would be given to all packages at once, which is not always desirable. If one has already written down the preamble and then notices an option needs to be added or removed, this is usually more convenient with one \usepackage call per package.
  2. It is easier to comment one package out (or in) this way.

I usually copy preambles between documents, and one package per line makes customizing easier.

Note that before LaTeX2e, there was only one \documentstyle call (giving the document class as mandatory argument) and all packages had to be given in a big option list to that. This initial command always looked like a total mess in my documents, spread over several lines with a lot of lines commented out.

Being able to say \usepackage was a big relief compared to that!