I found this question, but that seems to specifically apply to center based on the decimal, and my table isn't numeric data. I'm trying to make the Cayley table for the quaternions, and a minimal working example for what my table looks like is:
\documentclass[12pt,letterpaper]{article}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\begin{document}
\begin{table}[h]
\begin{center}
\begin{tabular}{l|llllllll}
$*$&$1$&$-1$&$i$&$-i$&$j$&$-j$&$k$&$-k$\\\hline
$1$&$1$&$-1$&$i$&$-i$&$j$&$-j$&$k$&$-k$\\
$-1$&$-1$&$1$&$-i$&$i$&$-j$&$j$&$-k$&$k$\\
$i$&$i$&$-i$&$-1$&$1$&$k$&$-k$&$-j$&$j$\\
$-i$&$-i$&$i$&$1$&$-1$&$-k$&$k$&$j$&$-j$\\
$j$&$j$&$-j$&$-k$&$k$&$-1$&$1$&$i$&$-i$\\
$-j$&$-j$&$j$&$k$&$-k$&$1$&$-1$&$-i$&$i$\\
$k$&$k$&$-k$&$-j$&$j$&$-i$&$i$&$1$&$-1$\\
$-k$&$-k$&$k$&$j$&$-j$&$i$&$-i$&$-1$&$1$\\
\end{tabular}
\end{center}
\end{table}
\end{document}
which produces the following output.
What I'd like for the table to look like is this:
I'm sure that there's already a similar question on this site, but I couldn't find anything that applied to non-numeric cell values.


