# Formatting inside a table

\documentclass{article}
\usepackage{float}
\usepackage{mathtools}
\newcommand{\unit}[1]{\hat{\mathbf{#1}}}
\begin{document}
\begin{table}[H]
\centering
\begin{alignat*}{4}
\unit{j}\times\unit{k} &= \unit{i}\\
\unit{j}\times\unit{i} &= -\unit{k}\\
\unit{k}\times\unit{j} &= -\unit{i}
\end{alignat*}
\caption[Unit Vectors]{Calculation of unit vectors in 3 dimensions.}
\label{unitvecs}
\end{table}
\end{document}


I really don't like the spacing between the alignment and the table caption but when I use tabular, the identities look weird not aligned. How best can I format this?

• Try \captionsetup{skip=0pt} after having loaded caption package. Sep 1 '13 at 21:04
• @karlkoeller I don't want to affect every caption in the document just this one. Sep 1 '13 at 21:07
• Use it inside the table. Sep 1 '13 at 21:10

For this particular table I would use a special ten column formatting, in order to emphasize the symmetries:

\documentclass{article}
\usepackage{mathtools,array}
\newcommand{\unit}[1]{\hat{\textbf{#1}}}
\newcommand{\ui}{\unit{\i}}
\newcommand{\uj}{\unit{\j}}
\newcommand{\uk}{\unit{k}}
\begin{document}
\begin{table}
\centering
$\begin{array}{ @{} c @{} >{{}}c<{{}} @{} c @{} >{{}}c<{{}} @{} c @{} c @{\qquad\qquad} c @{} >{{}}c<{{}} @{} c @{} >{{}}c<{{}} @{} c @{} c @{} } \ui & \times & \uj & = & & \uk & \uj & \times & \ui & = & - & \uk\\ \uj & \times & \uk & = & & \ui & \uk & \times & \ui & = & - & \ui\\ \uk & \times & \ui & = & & \uj & \ui & \times & \uk & = & - & \uj \end{array}$
\caption[Unit Vectors]{Calculation of unit vectors in 3 dimensions.}
\label{unitvecs}
\end{table}
\end{document}


The spacing is the one used in normal math formulas, but i, j and k are made up to occupy the same horizontal space.

I'd prefer also changing the order, for didactical clarity. Also, i and j should lose their dots.

You don't say precisely which alignment you really expect. But perhaps you are interested in this approach with the array environment in in-line math mode. The distance between the equations and the caption should shrink to standard measure again.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}

\newcommand{\unit}[1]{\hat{\mathbf{#1}}}

\begin{document}
\begin{table}[htb]
\centering
$$\begin{array}{r@{\:\times\:}l@{\;=\;}r@{\qquad\qquad}r@{\:\times\:}l@{\;=\;}r} \unit{i} & \unit{j} & \unit{k} & \unit{j} & \unit{k} & \unit{i} \\ \unit{k} & \unit{i} & \unit{j} & \unit{j} & \unit{i} & -\unit{k} \\ \unit{i} & \unit{k} & -\unit{j} & \unit{k} &\unit{j} & -\unit{i} \end{array}$$
\caption[Unit Vectors]{Calculation of unit vectors in 3 dimensions.}
\label{unitvecs}
\end{table}
\end{document}


• The usual space around \times is a medmuskip, ergo \:; but it would be probably easier and more consistent to simply use {}\times{} and {}={}. Sep 1 '13 at 21:24
• @Qrrbrbirlbel: Thanks for that hint. I just hit the wrong key and corrected it. Your second suggestion is quite interesting. Sep 1 '13 at 21:32