我在 tabularx 环境中遇到了多列问题。当我有一个多列(在第一行)时,它的格式正确:
这是我的 TEX:
\begin{table}[h!]
\caption{\itshape raw data table of time elapsed from when the heater is placed within the metal (seconds / at increments of 60 seconds) against amperage and voltage measured at that increment (amperes / volts respectively)}
\bigskip
\centering
\begin{tabularx}{\linewidth}{ | c | *{8}{Y |}}
\hline
\multirow{2}{*}{Time elapsed / \SI[separate-uncertainty = true]{1(1)}{\second}} &
\multicolumn{8}{Y |}{Amperage measured | Voltage measured at that time interval / \SI[separate-uncertainty = true]{1.00(1)}{\ampere} | \SI[separate-uncertainty = true]{1.00(1)}{\volt} (respectively)}
\\
\cline{2-9}
&
\multicolumn{2}{ Y |}{Trial 1} &
\multicolumn{2}{ Y |}{Trial 2} &
\multicolumn{2}{ Y |}{Trial 3} &
\multicolumn{2}{ Y |}{Trial 4} \\
\hline
0 &
3.62 &
8.94 &
3.68 &
9.00 &
3.68 &
9.01 &
3.73 &
9.13 \\
\hline
\end{tabularx}
\end{table}
我做错了什么?有没有什么办法可以让我正确地将文本置于每个框的中央?任何答案都将不胜感激。
答案1
一种简单的解决方案是将长单元格的一部分文本简单地\multicolumn
放在新行中。我假设您将 Y 列类型定义为居中 X 类型。
\usepackage{array}
\begin{tabularx}{\linewidth}{|c|*8{>{\centering\arraybackslash}}X|}}
\hline
\multirow{3}{*}{Time elapsed / \SI[separate-uncertainty = true]{1(1)}{\second}} & \multicolumn{8}{c|}{Amperage measured | Voltage measured at that time interval /} \\
& \multicolumn{8}{c|}{\SI[separate-uncertainty = true]{1.00(1)}{\ampere} | \SI[separate-uncertainty = true]{1.00(1)}{\volt} (respectively)}\\ \cline{2-9}
& \multicolumn{2}{c|}{Trial 1} & \multicolumn{2}{c|}{Trial 2} & \multicolumn{2}{c|}{ Trial 3} & \multicolumn{2}{c|}{ Trial 4} \\ \hline
0 & 3.62 & 8.94 & 3.68 & 9.00 & 3.68 & 9.01 & 3.73 & 9.13 \\ \hline
这应该可行,但肯定有更优雅的解决方案。