Math & ScienceEquation mode

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
jhapk
Posts: 81
Joined: Tue Apr 20, 2010 9:33 pm

Equation mode

Post by jhapk »

Hi,

I often notice that many authors use "\[" and "\]" instead of "\begin{equation}" and "\end{equation}" respectively. Any particular reasons for this?

Also, does anyone know of any potential advantages or disadvantages of the "gather" environment?

Thanks
Last edited by jhapk on Thu Jul 15, 2010 7:25 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Equation mode

Post by localghost »

jhapk wrote:[...] I often notice that many authors use "\[" and "\]" instead of "\begin{equation}" and "\end{equation}" respectively. Any particular reasons for this? [...]
Why don't you just test it and compare the results? Or do some basic reading.
jhapk wrote:[...] Also, does anyone know of any potential advantages or disadvantages of the "gather" environment? [...]
Read the amsmath manual and the »Math mode« document to find out.


Thorsten
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Equation mode

Post by meho_r »

Those two aren't interchangeable. \[ ... \] are shortcuts to \begin{displaymath} ... \end{displaymath}, not \begin{equation} ... \end{equation}. The difference: displaymath environment just do as the name says: put a mathematical expression in a separate line, text centered (i.e. display style), while equation do the same with the addition of a sequential equation number.

Instead of \[ ... \] you may also use $$ ... $$ (EDIT: but, as noted by Stefan and localghost, it's better to avoid their use).
Last edited by meho_r on Thu Jul 15, 2010 8:38 pm, edited 2 times in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Equation mode

Post by Stefan Kottwitz »

Hi,
jhapk wrote:I often notice that many authors use "\[" and "\]" instead of "\begin{equation}" and "\end{equation}" respectively. Any particular reasons for this?
The equation environment would be numbered, but formulas written with \[ ... \] won't be numbered. It's not the same.
Perhaps you mean the displaymath environment. Indeed that's nearly the same, latex.ltx defines:

Code: Select all

\def\displaymath{\[}
\def\enddisplaymath{\]\@ignoretrue}
jhapk wrote:Also, does anyone know of any potential advantages or disadvantages of the "gather" environment?
The gather environment may be used for a group of equations, each one will be centered. It's easier to use gather instead of several consecutive equation environments.

Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Equation mode

Post by Stefan Kottwitz »

meho_r wrote: Instead of \[ ... \] you may also use $$ ... $$
I would'nt recommend $$...$$ because inconsistent vertical spacing might occur, further $$ doesn't respect the fleqn class option. Formulas done by $$ would be centered even when fleqn has been set, but \[ .. \] acts accordingly and puts the formulas to the left side.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Equation mode

Post by localghost »

meho_r wrote:[...] Instead of \[ ... \] you may also use $$ ... $$
Very bad idea. See l2tabu.
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: Equation mode

Post by meho_r »

Right, thanks :) Corrected.
Post Reply