7

I've looked in a few places for this and there are no good explanations.

2
  • 6
    Optional arguments are enclosed with []. If the [] is specified with nothing in it, it overrides the default optional argument, replacing it with a null string. May 5, 2015 at 17:09
  • 2
    Could you say where you've looked? This is covered in for example LaTeX: A Document Preparation System.
    – Joseph Wright
    May 5, 2015 at 17:53

2 Answers 2

8

[] 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.

6

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.