LaTeX 最后一列与其他多列相比太大

LaTeX 最后一列与其他多列相比太大
\begin{table}[H]
\centering
\begin{tabular}{c c c c c c c}
\hline
\multirow{2}{*}{\textbf{Metal}} & \multicolumn{3}{c}{\textbf{Initial temperature, $\pm 0.01 (\ang{-}C)$}} & \multicolumn{3}{c}{\textbf{Final temperature, $\pm 0.01 (\ang{-}C)$}} \\ \cline{2-7} 
                       &  \textbf{1} & \textbf{2} & \textbf{3} & \textbf{1} & \textbf{2} & \textbf{3}   \\ \hline
Iron                   & $18.1$  & $19.0$  & $18.7$  & $21.9$  & $24.3$  & $24.4$  \\ 
Zinc                   & $18.9$  & $18.9$  & $18.8$  & $32.7$  & $38.5$  & $41.0$  \\ 
Magnesium              & $18.8$  & $18.7$  & $18.9$  & $72.8$  & $76.4$  & $75.8$  \\
Tin                    & $19.0$  & $18.9$  & $18.6$  & $20.1$  & $20.9$  & $19.4$  \\ 
Aluminium              & $18.7$  & $18.9$  & $18.7$  & $18.8$  & $18.9$  & $18.7$  \\ \hline
\end{tabular}
\caption{Initial and final temperatures of metals reacting with Copper Sulphate solution}
\end{table}

最后一列太大,因为初始温度和最终标题太大。如何使所有多列宽度相同?

答案1

请始终提供完整的测试文件,我不得不猜测\ang这里的文本宽度。但是,您可以强制列足够宽以使用w来自array

在此处输入图片描述

\documentclass[a4paper]{article}

\usepackage{float,multirow,array}
\newcommand\ang[1]{??}
\addtolength\textwidth{50pt}
\begin{document}

\begin{table}[H]
\centering
\setlength\extrarowheight{2pt}
\begin{tabular}{@{}l *{6}{wc{45pt}}@{}}
\hline
\multirow{2}{*}{\textbf{Metal}} & \multicolumn{3}{c}{\textbf{Initial temperature, $\pm 0.01 (\ang{-}C)$}} & \multicolumn{3}{c}{\textbf{Final temperature, $\pm 0.01 (\ang{-}C)$}} \\ \cline{2-7} 
                       &  \textbf{1} & \textbf{2} & \textbf{3} & \textbf{1} & \textbf{2} & \textbf{3}   \\ \hline
Iron                   & $18.1$  & $19.0$  & $18.7$  & $21.9$  & $24.3$  & $24.4$  \\ 
Zinc                   & $18.9$  & $18.9$  & $18.8$  & $32.7$  & $38.5$  & $41.0$  \\ 
Magnesium              & $18.8$  & $18.7$  & $18.9$  & $72.8$  & $76.4$  & $75.8$  \\
Tin                    & $19.0$  & $18.9$  & $18.6$  & $20.1$  & $20.9$  & $19.4$  \\ 
Aluminium              & $18.7$  & $18.9$  & $18.7$  & $18.8$  & $18.9$  & $18.7$  \\ \hline
\end{tabular}
\caption{Initial and final temperatures of metals reacting with Copper Sulphate solution}
\end{table}
\end{document}

答案2

以下是基于 的另一种方法siunitxbooktabs以及\multicolumn包含所有重复信息的方法。使用此方法,无需人为拉伸列:

在此处输入图片描述

\documentclass{article}
\usepackage{siunitx}
\usepackage{makecell}
\usepackage{booktabs}

\begin{document}

\begin{table}
\centering
\begin{tabular}{l *{6}{S[table-format=1.2]}}
\toprule
\textbf{Metal} & \multicolumn{6}{c}{\bfseries Temperature, \SI{\pm 0.01}{\celsius}}\\
\cmidrule{2-7}
               & \multicolumn{3}{c}{\bfseries Initial} &  \multicolumn{3}{c}{\bfseries Final} \\ 
\cmidrule(r){2-4} \cmidrule(l){5-7}
               &  \textbf{1} & \textbf{2} & \textbf{3} & \textbf{1} & \textbf{2} & \textbf{3}   \\
                       \midrule
Iron                   & 18.1  & 19.0  & 18.7  & 21.9  & 24.3  & 24.4  \\ 
Zinc                   & 18.9  & 18.9  & 18.8  & 32.7  & 38.5  & 41.0  \\ 
Magnesium              & 18.8  & 18.7  & 18.9  & 72.8  & 76.4  & 75.8  \\
Tin                    & 19.0  & 18.9  & 18.6  & 20.1  & 20.9  & 19.4  \\ 
Aluminium              & 18.7  & 18.9  & 18.7  & 18.8  & 18.9  & 18.7  \\ 
\bottomrule
\end{tabular}
\caption{Initial and final temperatures of metals reacting with Copper Sulphate solution}
\end{table}

\end{document}

答案3

我将在表格的标题中提供更多的结构——并且不会使任何单一信息超载。

在此处输入图片描述

\documentclass{article}
\usepackage{siunitx} % for '\SI' macro
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ @{} l cccccc @{}}
\toprule
& \multicolumn{6}{c}{Temperatures, in \si{\celsius}} \\
\cmidrule(l){2-7}
& \multicolumn{3}{c}{Initial} & \multicolumn{3}{c}{Final} \\ 
\cmidrule(lr){2-4} \cmidrule(l){5-7}
Metal & 1 & 2 & 3 & 1 & 2 & 3 \\
\midrule
Iron      & 18.1  & 19.0  & 18.7  & 21.9  & 24.3  & 24.4  \\ 
Zinc      & 18.9  & 18.9  & 18.8  & 32.7  & 38.5  & 41.0  \\ 
Magnesium & 18.8  & 18.7  & 18.9  & 72.8  & 76.4  & 75.8  \\
Tin       & 19.0  & 18.9  & 18.6  & 20.1  & 20.9  & 19.4  \\ 
Aluminium & 18.7  & 18.9  & 18.7  & 18.8  & 18.9  & 18.7  \\
\bottomrule
\multicolumn{7}{@{}l}{\footnotesize Note: All temperatures are accurate to${}\pm\SI{0.1}{\celsius}$.}
\end{tabular}
 
\caption{Initial and final temperatures of metals reacting with copper sulphate solution}
\end{table}
\end{document}

答案4

我建议使用siunitx数字列的对齐方式,并固定列的宽度 S,以便多列内容对于这 S 列的宽度总和来说不会太宽。

此外,我提出了各种改进:使用来自的规则booktabs,在水平规则周围添加一些垂直填充,使用包将 \multicolumns 分成两行makecell,等等。

\documentclass[]{article}
\usepackage{multirow, makecell, booktabs}
\usepackage{float}
\usepackage{siunitx}
\renewcommand{\theadfont}{\normalsize\bfseries}

\begin{document}

    \begin{table}[H]
    \centering\sisetup{detect-weight, table-format=2.1, table-number-alignment=center, table-column-width=8mm}
    \begin{tabular}{c*{7}{S}}
    \toprule
    \multirow{3.5}{*}{\textbf{Metal}} & \multicolumn{3}{c}{\thead{Initial temperature\\\SI[detect-weight]{\pm 0.01}{\celsius}}} & \multicolumn{3}{c}{\thead{Final temperature, \\ \SI{\pm 0.01}{\celsius}}} \\  \cmidrule(lr){2-4}\cmidrule(lr){5-7}
                           & {\bfseries 1} & {\bfseries 2} & {\bfseries 3} & {\bfseries 1} & {\bfseries 2} & {\bfseries 3} \\ \midrule
    Iron & 18.1 & 19.0 & 18.7 & 21.9 & 24.3 & 24.4 \\
    Zinc & 18.9 & 18.9 & 18.8 & 32.7 & 38.5 & 41.0 \\
    Magnesium & 18.8 & 18.7 & 18.9 & 72.8 & 76.4 & 75.8 \\
    Tin & 19.0 & 18.9 & 18.6 & 20.1 & 20.9 & 19.4 \\
    Aluminium & 18.7 & 18.9 & 18.7 & 18.8 & 18.9 & 18.7 \\ \bottomrule
    \end{tabular}
    \caption{Initial and final temperatures of metals reacting with Copper Sulphate solution}
    \end{table}

\end{document} 

在此处输入图片描述

相关内容