\documentclass{article}
\usepackage{array}
\begin{document}
\begin{tabular}{| >{\centering}p{2.5cm} | >{\centering}p{0.5cm} | >{\centering}p{2.5cm} |>{\centering}p{2.5cm} |>{\centering}p{2.5cm} |>{\centering}p{2.5cm} |}
\hline
Abc & Bcd & A long cell with text that wraps around and is centered & long cell with text & AAAlong cell with text that wraps around and is centered & SSSlong cell with text that wraps around and is centered \\
1 & 3 & qw & qe & sad &11\\
\hline
\end{tabular}
\end{document}
答案1
\centering
更改在s 和s\\
内中断的定义。您需要在之后添加以更正此问题。如果您更频繁地需要它,您还应该定义一种新的列类型:tabluar
array
\arraybackslash
\documentclass{article}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{tabular}{| C{2.5cm} | C{0.5cm} | C{2.5cm} |C{2.5cm} |C{2.5cm} |C{2.5cm} |}
\hline
Abc & Bcd & A long cell with text that wraps around and is centered & long cell with text & AAAlong cell with text that wraps around and is centered & SSSlong cell with text that wraps around and is centered \\
1 & 3 & qw & qe & sad &11\\
\hline
\end{tabular}
\end{document}
请参阅相关答案表格中中心列的指定宽度(表格环境)?对于支持换行和首词连字的高级声明。