使用 p 属性时的表格列对齐

使用 p 属性时的表格列对齐

我正在使用p属性以便启用文本换行。如何让第二列Numeric Rating居中对齐?

\documentclass{article}
\usepackage{multirow}
\usepackage[english]{babel}
\usepackage{booktabs}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{ p{2.75cm} p{2.75cm} p{2.75cm} p{7cm} }
\toprule
Acceptability &Numeric Rating & General Rating & Improvement Implication\\ \hline
\multirow{3}{2.75cm}{Acceptable and Satisfactory} & 10 & Excellent & No obvious room for improvement \\
 & 9 & Very Good & Minor improvement possible, but not required \\
 & 8 & Good & Some improvement possible, but not required \\ \hline
\multirow{3}{2.75cm}{Acceptable but Unsatisfactory} & 7 & Fair & Limited Improvement requested \\
 & 6 & Somewhat Poor & Significant improvement requested \\
 & 5 & Poor & Major improvement requested \\ \hline
\multirow{4}{2.75cm}{Unacceptable} & 4 & Very Poor & Some improvement mandatory \\
 & 3 & Bad & Significant improvement mandatory \\
 & 2 & Very Bad & Major improvement mandatory \\
 & 1 & Extremely Bad & Extensive improvement or major design changes are mandatory\\ \hline
 & 0 & \multicolumn{2}{l}{Can't answer question, e.g., don't remember} \\
\bottomrule
\end{tabular}
\caption[General Rating Scale]{General Rating Scale}
\label{tab:genRating}
\end{table}
\end{document}

答案1

加载数组包,它提供了>将命令插入列定义的快捷方式,这样您就可以插入\centering

\usepackage{array}
\begin{tabular}{ p{2.75cm}>{\centering\arraybackslash}p{2.75cm} p{2.75cm} p{7cm} }
...

\arraybackslash\\是一个小辅助宏,它可以恢复as的含义\tabularnewline,否则可能会被 破坏\centering

相关内容