Center align columns in table ignoring minus signs?

I have some tables of numbers, most of which are small (0, 1, -1), but occasionally I have fractions. If I just has 0, 1, -1's I'd right align so the $-$ signs will line up, but the fractions throw things off. Center align doesn't look great either, nor does left align. Here is a small example of a right and center align: \begin{tabular}{rr}
$\frac 1{24}$ & $-\frac 1{24}$ \\
$1$ & $-1$ \\
$-1$ & $0$ \\
\end{tabular}
\begin{tabular}{cc}
$\frac 1{24}$ & $-\frac 1{24}$ \\
$1$ & $-1$ \\
$-1$ & $0$ \\
\end{tabular}


Can I center align the numbers without the signs, so the top two rows will look like they do on the right in the example above, and the bottom two rows will look like the do on the left in the above example?

Here I make - active (inside a limited group) and define it as a \mathllap. I use a TABstack with enough column separation to allow for the -.

\documentclass{article}
\usepackage{tabstackengine,mathtools}
\TABstackMath
\begin{document}
\bgroup
\setstackgap{L}{16pt}
\setstacktabbedgap{13pt}
\let\svm-
\catcode-=\active
\def-{\mathllap{\svm}}
\Matrixstack{\frac 1{24} & -\frac 1{24} \\ 1 & -1 \\ -1 & 0}
\quad\Matrixstack{\frac 1{24} & -\frac 1{24} \\ 1 & -1 \\ -1 & 0 }
\egroup
\end{document} With \phantom you can insert an invisible -: \documentclass{article}

\begin{document}
\begin{tabular}{cc}
$\phantom{-}\frac 1{24}$ & $-\frac 1{24}$ \\
$\phantom{-}1$ & $-1$ \\
$-1$ & $\phantom{-}0$ \\
\end{tabular}
\end{document}


If your table contains only (mostly) math, you might want to use array instead of tabular.

• Thanks for your answer. It's a good "local" solution for a small number of table entries, but since I can only accept one answer, I am accepting the answer with the more "global" approach that scales better. – Kimball Apr 17 at 23:27 \documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{tabular}{cc}
$\frac 1{24}$ & $\mathllap-\frac 1{24}$ \\
$1$ & $\mathllap-1$ \\
$\mathllap-1$ & $0$ \\
\end{tabular}

\end{document}
`
• Thanks for your answer. It's a good "local" solution for a small number of table entries, but since I can only accept one answer, I am accepting the answer with the more "global" approach that scales better. – Kimball Apr 17 at 23:28