我怎样才能仅将“coluna 3”居中?我尝试创建新的列类型,但没有成功。
谢谢
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage[table,xcdraw]{xcolor}
\usepackage{tabularx,booktabs}
\usepackage{multirow}
\usepackage{geometry}
\geometry{margin=1in}
\begin{document}
\newcolumntype{D}{>{\arraybackslash}X}
\begin{table}[ht!]
\centering
\small
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{tabularx}{\textwidth}{
>{\hsize=0.8\hsize}D
>{\hsize=1.4\hsize}D
>{\hsize=0.8\hsize}D
}
\toprule
\textbf{Coluna 1} & \textbf{Coluna 2} & \textbf{coluna 3}\\
\midrule
\multirow{4}{=}{Neque porro quisquam} & Quisque eget augue ac diam egestas facilisis a non sapien. Phasellus nec feugiat ligula & 1 \\
& Ipsum & 2 \\
& Dolor & 3 \\
& Consectetur & 4 \\
\hline
\multirow{3}{=}{Ut aliquam lacus id malesuada sagittis} & Pellentesque & 5 \\
& Adipiscing & 6 \\
& Amet & 7 \\
\bottomrule
\end{tabularx}
\caption{Ut aliquam lacus id malesuada sagittis}
\label{tab:locaiseduracao}
\end{table}
\end{document}
答案1
应该\centering
在>{...}
,并且,因为它在最后一列,用来\arraybackslash
恢复表格含义\\
所以不是
>{\hsize=0.8\hsize}\centering
但反而
>{\hsize=0.8\hsize \centering\arraybackslash}