Latex Packages For Mathematical Typesetting: A Review Of The Best Options

Core Problem: Typesetting Complex Mathematics

LaTeX excels at typesetting mathematics, but some packages provide additional functionality to make mathematical typesetting even easier. This article reviews the best LaTeX packages for writing formulas, aligning equations, drawing graphs, including symbols, and more.

Powerful Packages for Writing Formulas

The amsmath package provides common tools like matrices and multidimensional sums to empower users to typeset complex mathematics. For example:

\usepackage{amsmath}
\begin{equation} 
  \mathbf{A} = \begin{pmatrix} 
   a_{11} & a_{12} \\
   a_{21} & a_{22} 
  \end{pmatrix}
\end{equation}

With the amsmath package, users can typeset professional-looking matrices with ease. The pmatrix environment generates a matrix with parentheses instead of brackets, with proper spacing between rows and columns. This is just one of many useful features in amsmath.

Flexibility with Multline Environments

The amsmath package also provides the multline environment for equations that are too long to fit on one line. For example:

\begin{multline}
   a+b+c+d+e+f+g+h+i+j+k\\
   +l+m+n+o+p+q+r+s+t+u+v
\end{multline}

The multline environment automatically splits the long equation over multiple lines at the designated point while alignment the equals sign. This creates a professional, easy-to-read layout.

Typesetting Multi-Row Fractions

The frac environment enables proper formatting of multi-row fractions for complex inline equations:

$k = \frac{1}{
    \frac{1}{
        \frac{1}{x}+a}+b}+c$

Without amsmath, creating nested fractions with optimal line-breaking and alignment requires manual adjustments. The frac environment handles this automatically.

Scripting with Stackrel

The stackrel command makes light work of adding superscripts and subscripts to math operators:

$\stackrel{\textstyle-}{x}+\stackrel{\textstyle-}\int$

As shown, stackrel ensures the correct relative sizing of subscripted elements compared to the main symbol. The command allows up to two arguments - one superscript and one subscript.

Spanning Operators with Spacing

When using integral, sum, or other operators that span multiple lines, the amsmath package ensures proper spacing above and below the operator:

     \documentclass{article}
     \usepackage{amsmath}

     \begin{document}

     \begin{equation*}
        \sum_{i=1}^{n} x_{i} 
     \end{equation*}

     \end{document}

Without amsmath, the spacing around large operators would be uncomfortably tight. amsmath's pre-defined spacing creates a clean, professional look.

Native Equation Numbering

The amsmath package allows equations to be numbered sequentially right within LaTeX:

     \begin{equation}
        x= y      
     \end{equation}

     \begin{equation} 
         y = z 
     \end{equation}

Numbered equations are essential in scientific documents for reference purposes. amsmath provides easy-to-use tools to handle numbering automatically.

Fine-Tuned Control Spacing

For precise control over equation spacing, amsmath provides commands like \qquad, \quad, \enspace, and more to tweak the space between elements:

$x \qquad y \quad z$

Being able to fine-tune spacing makes it possible to achieve the perfect alignment within complex mathematical expressions.

Additional Notable Environments

Other handy amsmath environments include:

  • align - Aligns sets of equations at the equals sign
  • gather - Similar to align but does not align at a specific point
  • split - For breaking large expressions across multiple lines

Flexible Alignment with eqnarray

While amsmath provides extensive alignment functionality through environments like align, users requiring even more control over equation layout can use the eqnarray environment:

\begin{eqnarray}
  x &=& y + 2 \\
  z &=& 2y
\end{eqnarray}

With eqnarray, users can align equations at any designated point, not just the equals sign. This environment can be used to achieve complex multi-line displays:

\begin{eqnarray}
   x + 3 &=& y - 2 + 4 && \text{for } x < 0 \\
   x + 3 &=& y + 5 && \text{for } x \ge 0
\end{eqnarray}

For complete flexibility over equation alignment, eqnarray is a powerful choice.

Precise Spacing Control

Like amsmath, eqnarray provides fine-grained spacing control between elements:

   
\setlength\arraycolsep{2pt}
\begin{eqnarray}
   x &=& y \\
   z &=& w
\end{eqnarray}

The \arraycolsep length controls the space between equation columns. This level of control over alignment and spacing helps optimize the reading experience.

Advanced Column Specifiers

Clamping symbols like &, &&, and \displaystyle further tune the alignment of eqnarray:

\begin{eqnarray}
   A + B &=& C \\
  && D + E &=& F
\end{eqnarray}

The && forces the second line to be aligned with the equals sign on the first line, creating an "align at" effect. The possiblities are nearly endless for mathematical layouts.

Automatic Equation Numbering

Like with amsmath environments, users can number equations typeset with eqnarray:

   
\begin{eqnarray}
  x &=& y \\
  z &=& 2y
\end{eqnarray}
\end{pre}

Referencing complex formulas in-text for explanations or proofs relies heavily on equation numbering. As such, automatic numbering is essential in documents using eqnarray.

Multiline Equations

Multiline equations can be created with ease:

\begin{eqnarray}
 x + y + z + a + b &=& 10 \\
   &=& 5 + 5 
\end{eqnarray}  

Spacing and indentation is automatically adjusted across lines, simplifying the process of typesetting long, complex expressions.

Additional Tips & Tricks

Further control over eqnarray output can be achieved by manipulating spacing, columns separators, row separators and other elements. The eqnarray environment enables fine-tuned mathematical typesetting.

Drawing Graphs Gracefully with TikZ

The TikZ package is useful for drawing a wide variety of graphs and diagrams directly within LaTeX:

  
\usepackage{tikz}
\begin{tikzpicture}
  \draw [thick, ->] (0,0) -- (2,3);  
\end{tikzpicture}

This produces a professional-quality line graph without relying on external tools. TikZ avoids problems with resolution or integration that often arise when trying to include externally-generated graphs.

Basic Shapes

TikZ contains built-in support for shapes like circles, rectangles, arrows and more:

\filldraw[fill=blue!20] (0,0) rectangle (2,2);
\draw (0,0) circle (2cm);

These basic shapes make it easy to add simple diagrams without much syntax. Shapes can be customized with tools like clipping, fading, sloping, and arrows.

Coordinate Systems

TikZ uses Cartesian coordinate systems for placing elements:

\draw (1,3) -- (3,-1);

In addition to Cartesian coordinates, TikZ supports polar coordinates for added flexibility when graphing functions.

Graphing Functions

TikZ can graph various equations and plot data sets:

\draw [domain=0:4] plot (\x, {\x});
\draw [mark=x] plot coordinates {(0,0) (1,3) (2,1)}; 

Along with built-in support for basic plots, data visualization libraries like pgfplots can be used for more advanced graphs.

Labels, Arrows & Symbols

Annotations like labels, arrows, and tick marks help highlight important aspects of graphs:

\draw [<->] (0,3) -- node [above] {$x$} (3,3);
\draw (0,2) -- (0,0) node [below] {$0$};

TikZ comes equipped with tools for augmenting graphs without cluttering up the LaTeX document itself.

Precision Drawing

For maximum precision, TikZ supports incrementally constructed paths instead of relying solely on absolute coordinates:

  
\draw (0,0) -| (3,3);
\draw (0,0) |- (3,3); 

The -| and |- operators draw horizontal and vertical lines between the specified points. This facilitates programmatic drawing for complex diagrams.

Reusable Styles

TikZ styles allow customization and reuse of graphical properties:

\tikzset{
   mydot/.style={
      fill=yellow,
      circle, 
      inner sep=2pt
   }
}
\node [mydot] at (0,0) {};

Defining styles helps maintain consistency in large documents and saves duplication efforts through reuse.

Handy Mathematical Symbols with amssymb

The amssymb package provides a collection of mathematical symbols not found in the standard LaTeX distribution:

\usepackage{amssymb}  
\Game, \eth, \vartriangleright

This enhances LaTeX's already substantial mathematical typesetting capabilities.

Binary Operators

Some notable amssymb binary operators include:

  • \Cap - Intersection operator \Cap
  • \Cup - Union operator \Cup
  • \dotplus - Dot plus \dotplus

These operators help simplify notation for set theory and other advanced mathematics.

Relations

Amssymb also provides convenient relational operators like:

  • \lessapprox - Less than or approximatel equal to \lessapprox
  • \gtrapprox - Greater than or approximately equal to \gtrapprox
  • \precsim - Precedes or equals \precsim

Including these symbols enhances math readability while reducing document clutter.

Arrows

Some notable amssymb arrows include:

  • \hookrightarrow - Right harpoon over left harpoon \hookrightarrow
  • \dashrightarrow - Dash arrow \dashrightarrow
  • \rightsquigarrow - Right squig arrow \rightsquigarrow

These provide new options for denoting relationships and mappings in mathematical expressions.

Variable-sized Symbols

Amssymb contains useful variable-sized operators like summation and integration:

  
\sum \int \prod

As displayed equations become more complex across lines, having variable symbols ensures optimum fit and spacing.

Additional Symbols

Hundreds of additional mathematical symbols are available in amssymb across various categories including:

  • Negated symbols like \nless
  • Greeked letters like \digamma
  • Modifier letters like \mathring

Amssymb contains everything from simple operators to obscure technical symbols.

Additional Useful Packages

While amsmath, eqnarray, TikZ and amssymb provide core mathematical typesetting functionality, some additional packages warrant consideration:

nccmath for Multicolumn Equations

The nccmath package improves amsmath's native handling of multicolumn layouts with equations that span column widths:

  
\usepackage{nccmath}
\begin{multline*}
  a+b+c+d+e \\ +f+g+h
\end{multline*}

Without nccmath, centered equations structured this way across multicol formats often produce misaligned elements. nccmath resolves this issue.

mathabx for Extra Mathematical Alphabets

The mathabx package provides additional mathematical alphabets like Euler Fraktur:

\usepackage{mathabx}
{\eulerfrak ABCDEF}

For users requiring specialized mathematical fonts, mathabx saves the effort of loading multiple font packages.

Other Notable Options

Some other useful mathematical typesetting packages include:

  • empheq - For emphasizing key equations
  • Physics package - Common physics notation
  • mathtools - Extends amsmath capabilities

Conclusion

Math typesetting in LaTeX provides users with publication-quality equation layout not achievable in traditional word processors. While the native LaTeX distribution already includes solid math support through the LaTeX math mode, certain packages like amsmath significantly augment these core capabilities with specialized tools and environments for complex formulas and alignment options.

For graphs and diagrams, TikZ offers a LaTeX-native solution that avoids file format and resolution challenges that often accompany external graphing package outputs. To access more mathematical symbols, the amssymb package saves users from loading multiple font and symbol packages.

For niche math typesetting needs, packages like nccmath and mathabx fill gaps in functionality around multicolumn equations and specialized mathematical alphabets, respectively.

By leveraging these packages together, LaTeX provides users with a comprehensive, fully-integrated toolchain for publishing professional scientific papers involving sophisticated mathematical expressions as well as diagrams spanning topology, geometry, statistics, physics and more. The packages reviewed here represent the best mathematical extensions to bring LaTeX's high-quality typesetting to advanced technical documents.

Leave a Reply

Your email address will not be published. Required fields are marked *