
我發現這個問題,但這似乎特別適用於基於小數的中心,並且我的表格不是數字數據。我正在嘗試為四元數製作凱萊表,我的表的一個最小工作示例是:
\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}
產生以下輸出。
我會做什麼喜歡表格看起來像這樣:
我確信該網站上已經有類似的問題,但我找不到任何適用於非數位儲存格值的內容。
答案1
我幾乎 100% 確定有更好的解決方案,但你可以使用\phantom{-}
:
\documentclass[12pt,letterpaper]{article}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\begin{document}
\begin{table}[h]
\begin{center}
\begin{tabular}{l|llllllll}
$*$ & $\phantom{-}1$ & $-1$ & $\phantom{-}i$ & $-i$ & $\phantom{-}j$ & $-j$ & $\phantom{-}k$ & $-k$ \\\hline
$\phantom{-}1$ & $\phantom{-}1$ & $-1$ & $\phantom{-}i$ & $-i$ & $\phantom{-}j$ & $-j$ & $\phantom{-}k$ & $-k$ \\
$-1$ & $-1$ & $\phantom{-}1$ & $-i$ & $\phantom{-}i$ & $-j$ & $\phantom{-}j$ & $-k$ & $\phantom{-}k$ \\
$\phantom{-}i$ & $\phantom{-}i$ & $-i$ & $-1$ & $\phantom{-}1$ & $\phantom{-}k$ & $-k$ & $-j$ & $\phantom{-}j$ \\
$-i$ & $-i$ & $\phantom{-}i$ & $\phantom{-}1$ & $-1$ & $-k$ & $\phantom{-}k$ & $\phantom{-}j$ & $-j$ \\
$\phantom{-}j$ & $\phantom{-}j$ & $-j$ & $-k$ & $\phantom{-}k$ & $-1$ & $\phantom{-}1$ & $\phantom{-}i$ & $-i$ \\
$-j$ & $-j$ & $\phantom{-}j$ & $\phantom{-}k$ & $-k$ & $\phantom{-}1$ & $-1$ & $-i$ & $\phantom{-}i$ \\
$\phantom{-}k$ & $\phantom{-}k$ & $-k$ & $-j$ & $\phantom{-}j$ & $-i$ & $\phantom{-}i$ & $\phantom{-}1$ & $-1$ \\
$-k$ & $-k$ & $\phantom{-}k$ & $\phantom{-}j$ & $-j$ & $\phantom{-}i$ & $-i$ & $-1$ & $\phantom{-}1$ \\
\end{tabular}
\end{center}
\end{table}
\end{document}
或者,在這種情況下,即使只是將列向右對齊也可以(但它不會產生完全相同的輸出):
\documentclass[12pt,letterpaper]{article}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\begin{document}
\begin{table}[h]
\begin{center}
\begin{tabular}{r|rrrrrrrr}
$*$ & $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}
也,表格中的數學模式,無需到處使用 $...$可能會感興趣。一切順利!