Mathtools is the package you likely never knew you needed. LaTeX makes typesetting equations easy, and Mathtools makes those equations beautiful.

Mathtools is an extention of amsmath. If you include Mathtools, you can use any function or macro from that package. Amsmath is a broad set of tools for typesetting equations, and is widely used. Mathtools extends the amsmath functions to provide additional formatting options and to clean up some of the more common problems with math typesetting.

A few examples

Two-Line Fractions:

A complicated fraction can extend so wide that it exceeds the column width. Splitting the numerator or/and denominator into multiple lines is a classy way to keep it together.



Long Summation Parameters:

Without the Mathtools function \mathclap, there are extra spaces created on either side of the summation symbol, because of the indices below. A simple mathtools command condenses the result.

 P_e_i_\Delta = \sum_{j=1, j\not=k,i}E_iE_jB_i_j cos\delta_i_j \delta_i_j_\Delta + V_kE_iB_i_k cos\delta_i_k_o \delta_i_k_\Delta  
P_e_i_\Delta = \sum_{\mathclap{j=1, j\not=k,i}}E_iE_jB_i_j cos\delta_i_j \delta_i_j_\Delta + V_kE_iB_i_k cos\delta_i_k_o \delta_i_k_\Delta



Allows superscripts and subscripts to the left of (before) a symbol. Here's a chemistry example:



These full examples are a good place to start exploring Mathtools, but there are many more tools available in this package. Below is a full listing of all the macros contained in the package. For specific details about how to use each one, see the documentation for the Mathtools package.


Function Name Description  
mathclap As shown above, this function removes some stray whitespace that can occur in subscripts, exponents, etc.



Same as mathclap, but only condenses the right or left side, respectively.  
Similar to mathclap, this condenses certain items. For example, it brings exponents in a little tighter, which can be useful especially with more than one level of exponents.




Applies both cramped and mathclap (or mathrlap, etc.). Same effect as applying both separately, but with a performance boost in the processing.
smashoperator Condenses text like a combination of all the functions above. It's simpler to use in most cases, but you lose some control and may not be so pleased with the result. In that case, use the functions above individually.  
adjustlimits Works on limits (\lim), to make more complex limits align vertically.
SwapAboveDisplaySkip Elliminates some of the whitespace above an equation.




The "tags" are the equations numbers, and this set of functions allows you to modify them- change the parentheses, style, etc.
refeq An alternative way to reference functions within the document text, without causing font mis-match problems.
showonlyrefs This is a flag, not a function, but still quite useful. If set, only equations referenced in the text will receive equation numbers.
Same as showonlyrefs, but for equations where manual tags have been set.
noeqref Allows you to create an exception to the two flags above, to show an equation number or tag, even if it is not referenced in the text.







A set of functions for drawing various arrows that will expand as needed to fit the associated text.







A set of 'harpoons' or vertical arrows. Similar to the arrows, they will expand as needed



Puts a brace over or under equation. Same as the functions built into LaTeX, but will often typeset better. You can use \LaTeXoverbrace and \LaTeXunderbrace if you need the original LaTeX functions.



Goes over or under an equation like overbrace and underbrace, but with square brakets.
begin{matrix} and friends There are several options for typesetting matrices. They mostly serve to center elements better than the default settings, but have some other options as well, like smallmatrix. I suggest you look at the official mathtools documentation to determine which would serve your need best, once you have a matrix defined.
multlined Split a long equation into parts, similar to the split fractions in the first example above.
begin{cases} and friends
Tools to properly typeset piecewise equations. Again, there are many options available, rather than cover them all, I refer you to the official mathtools documentation once you know what your piecewise equation looks like.
MoveEqLeft A way to produce indentation for equations if necessary.
Aboxed Draws a box around an equation.  






These functions allow for drawing in the whitespace between equations, arrows, dots, etc.
shortintertext Like the function \intertext in amsmath, this allows for inserting a bit of text in a series of equations without upsetting the alighment. This version of the function produces less whitespace.
Allows for defining new delimiters, and example from the documentation is for creating a set of absolute value bars the proper height for a fraction. This function has some advanced options available.



Equivalent to \left(, \right). Provided for compatibility.
vcentcolon Draws a colon centered vertically.




Provides characters that are sometimes not otherwise available.
prescript Allows super- and subscripts before a character, as shown in example 3 above.
begin{spreadlines} The spreadlines environment allows you to explicitly define the vertical spacing between equations.



Allows for split numerators or denominators in fractions, as in example 1 above.

The following are direct links to some of the mathtools documentation available:


Posted by Robert Murrish on 12 Jun 2012