这是我在这个网站上的第一个问题。我不确定我的 LaTeX 代码在这里写得好不好。这是我的表格代码。问题是前四列的文本没有在每个单元格中居中。当我在 X 列中写一段小文本时,其他四列的内容都居中了。但当我在最后一列 X 中放一段长文本时,情况并非如此。请注意,X 列的内容必须对齐。有什么解决办法吗?
\begin{sidewaystable}[h]
\footnotesize
\centering
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{c >{\centering\arraybackslash}m{1.5cm} >{\centering\arraybackslash}m{4.3cm} X}
\hline
text & text & text & text & very big text \\
\hline
text & text & text & text & VERY BIG TEXT \\
\hline
text & text & text & text & VERY BIG TEXT \\
\hline
\end{tabularx}
\captionsetup{justification=centering,margin=2cm,font={small}}
\caption{.........}
\captionsetup{font={scriptsize}}
\label{.....}
\caption*{......}
\end{sidewaystable}
答案1
您的示例经过修改,以显示重要片段。因此,egsidewaystable
改为table
。
\begin{document}
%\begin{sidewaystable}[h]
\begin{table}[h]
\footnotesize
\centering
\renewcommand{\arraystretch}{1.5}
%\begin{tabularx}{\textwidth}{c >{\centering\arraybackslash}m{1.5cm} >{\centering\arraybackslash}m{4.3cm} X}
\def\tabularxcolumn#1{m{#1}} % PS (3)
\begin{tabularx}{\textwidth}{c >{\centering\arraybackslash}m{1.5cm} >{\centering\arraybackslash}m{4.3cm} cX}
\hline
%text & text & text & text & very big text \\
text & text & text & text & very big text \\
\hline
% text & text & text & text & VERY BIG TEXT \\
text & text & text & text &very big text \\
\hline
% text & text & text & text & VERY BIG TEXT \\
text text & text text text & text text text text text text text text text text &text & very big text
text text text text text text text text text
\\
\hline
\end{tabularx}
%\captionsetup{justification=centering,margin=2cm,font={small}}
\caption{.........}
%\captionsetup{font={scriptsize}}
%\label{.....}
%\caption*{......}
%\end{sidewaystable}
\end{table}
\end{document}