I've looked in a few places for this and there are no good explanations.
2 Answers
[]
are used for passing values for package options.
Examples
\usepackage[ngerman]{babel}
loads the language pack with the option ngerman for the German language.
\usepackage[T1]{fontenc}
loads font encoding with the T1 font encoding that is an 8-bit encoding.
The []
in \usepackage[]{}
is an optional argument for package options.
This is explained in the usrguide
(LaTeX2e for authors), section 2.2 "Class and package options". The document is part of LaTeX's base, thus it should be present on your LaTeX installation. TeX Live users get it by running texdoc usrguide
on the command line.
Since the default for the optional option argument is empty, \usepackage[]{...}
is the same as \usepackage{...}
.
An additional optional argument at the end after the mandatory argument is less known. It is used to specify a version date for the package to be loaded. If the installed version is older, then LaTeX throws a warning message, for example:
\usepackage{array}[2015/05/05]
produces the warning:
LaTeX Warning: You have requested, on input line 2, version
`2015/05/05' of package array,
but only version
`2014/10/28 v2.4c Tabular extension package (FMi)'
is available.
[]
. If the[]
is specified with nothing in it, it overrides the default optional argument, replacing it with a null string.