\begin{tabularx}{.96\textwidth}{@{\extracolsep{\fill}}|c|c|c| }
\hline
\textbf{Xxx1} &
\textbf{Xxx2} &
\textbf{Xxx3} \\
\hline
& & \\
\hline
\end{tabularx}
为什么 Xxx1 居中(正确)而 Xxx2 和 Xxx3 右对齐(错误)?
答案1
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\centering
space is added after the rules;
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}|c|c|c|@{}}
\hline
\textbf{Xxx1} &
\textbf{Xxx2} &
\textbf{Xxx3} \\
\hline
& & \\
\hline
\end{tabular*}
\bigskip
without rules:
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ccc@{}}
\hline
\textbf{Xxx1} &
\textbf{Xxx2} &
\textbf{Xxx3} \\
\hline
& & \\
\hline
\end{tabular*}
\bigskip
not stretched (much more readable)
\begin{tabular}{ccc}
\hline
\textbf{Xxx1} &
\textbf{Xxx2} &
\textbf{Xxx3} \\
\hline
& & \\
\hline
\end{tabular}
\bigskip tabularx
\begin{tabularx}{\textwidth}{@{\extracolsep{\fill}}
|*3{>{\centering\arraybackslash}X|}@{}}
\hline
\textbf{Xxx1} &
\textbf{Xxx2} &
\textbf{Xxx3} \\
\hline
& & \\
\hline
\end{tabularx}
\end{document}