Welcome to the UK List of
TeX Frequently Asked Questions
on the Web

Searching

The index of Frequently Asked Questions about TeX is searchable.

Please enter your keyword here:   then press here: ,    or:
Google

Why use \[\] in place of $$$$?

LaTeX defines inline- and display-maths commands, apparently duplicating the TeX primitive maths sequences which surround maths commands with single (or pairs of) dollar signs.

In fact, LaTeX’s inline maths grouping, \( ... \), has (almost) exactly the same effect as the TeX primitive version $ ... $. (The exception: the LaTeX version checks to ensure you don’t put \( and \) the wrong way round; this does occasionally detect errors….)

Since this is the case, one often finds LaTeX users, who have some experience of using Plain TeX, merely assuming that LaTeX’s display maths grouping \[ ... \] may be replaced by the TeX primitive display maths $$ ... $$.

Unfortunately, the assumption is wrong: some LaTeX code needs to patch display maths, it can only do so by patching \[ and \] (or their equivalents). Most obviously, the class option fleqn simply does not work for equations coded using $$ ... $$, whether you’re using the standard classes alone, or using package amsmath. Also, the \[ and \] construct has code for rationalising vertical spacing in some extreme cases; that code is not provided $$ ... $$, so if you use the Plain TeX version, you may occasionally observe inconsistent vertical spacing. Similar behaviour can bite if you are writing a proof; placing the “QED symbol” doesn’t work if it is in $$-displayed maths.

There are more subtle effects (especially with package amsmath), and the simple rule is “use \[ ... \] (at least) whenever displayed maths is needed in LaTeX”.

(Note that the sequence \[ ... \] is duplicated by the displaymath environment, which can be said to “look nicer”, and actually describes what’s being done.)

This answer last edited: 2013-06-05


Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=dolldoll

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.27, released on 2013-06-07.