Tx · LaTeX & TikZ

How to Use Plus and Minus Superscripts in a LaTeX bmatrix

Published By the 9to5Science editorial team

At a glance

  1. 1. Load amsmath

    Add the amsmath package to your document preamble to use the bmatrix environment.

  2. 2. Add superscripts

    Write ^{+} or ^{-} after the matrix entry that should carry the sign.

  3. 3. Compile the example

    Use the complete example to check the spacing and placement of the superscripts.

To put a plus or minus sign in the superscript position of an entry in a bmatrix, use ^{+} or ^{-}. For example, x^{+} displays xx with a plus sign as its superscript. The bmatrix environment comes from the amsmath package.

Complete example

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\begin{bmatrix}
  x^{+} & y^{-} \\
  z^{-} & w^{+}
\end{bmatrix}
\]

\end{document}

The amsmath package defines bmatrix, which typesets a matrix with square brackets. Within each entry, ^ starts a superscript. Braces group the sign into the superscript, so ^{+} and ^{-} are clear and work consistently.

Superscript on the whole matrix

If the plus or minus sign is meant to label the entire matrix, put it after the closing environment instead:

\[
\begin{bmatrix}
  a & b \\
  c & d
\end{bmatrix}^{+}
\]

Use \begin{bmatrix} ... \end{bmatrix}^{+} for a superscript on the matrix, and put ^{+} or ^{-} on an individual entry for a superscript on that entry.

Common mistakes

  • Leaving out braces: x^+ is valid because + is a single math token, but x^{+} makes the intended superscript explicit. Braces are essential when the superscript has more than one character, as in x^{12}.
  • Using \pm for a single plus sign: \pm produces the combined plus-or-minus symbol, ±\pm. For a plus sign alone, use + or ^{+}; for a minus sign alone, use - or ^{-}.
  • Forgetting the package: If LaTeX reports that bmatrix is undefined, add \usepackage{amsmath} in the preamble.
  • Using text-mode braces for the matrix: Keep the matrix inside math mode, such as \[ ... \] in the example. The bmatrix environment is for mathematical expressions, not ordinary paragraph text.

References

  1. The amsmath package

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.