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 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.
z=\frac{ab+cd+ef+gh+ij+kl+mn+op+qr}{y}z=\frac{\splitfrac{ab+cd+ef+gh+ij}{+kl+mn+op+qr}}{y}
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:
\prescript{238}{92}{\mathbf{U}}
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 (as of the date this article was written). For an up-to-date list, and specific details about how to use each one, see the documentation for the mathtools
package.
mathrlap
mathllap
crampedclap
crampedrlap
crampedllap
newtagform
renewtagform
usetagform
xleftrightarrow
xLeftarrow
xRightarrow
xhookleftarrow
xhookrightarrow
xmapsto
xrightharpoondown
xleftharpoondown
xrightharpoonup
xleftharpoonup
xrightleftharpoons
xleftrightharpoons
overbrace
underbrace
overbracket
underbracket
ArrowBetweenLines
vdotswithin
shortvdotswithin
MTFlushSpaceAbove
MTFlushSpaceBelow
lparen
rparen
nuparrow
ndownarrow
bigtimes
splitfrac
splitdfrac