4
\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}

The last column of this is too large because the Initial temp and final headers are too large. How can I make all of the multicolumn widths the same?

Bernard
  • 271,350
Rob
  • 41

4 Answers4

4

Please always provide a complete test file, I had to guess \ang and the text width here. However you can force the columns to be wide enough to take the spanning entry using w from array

enter image description here

\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}

David Carlisle
  • 757,742
4

Here is a different approach based on siunitx, booktabs and another \multicolumn that contains all the repeated information. With this approach, there is no need to articifially stretch the columns:

enter image description here

\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}

leandriis
  • 62,593
1

I would provide more structure in the table's header -- and not overload any single piece of information.

enter image description here

\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}

Mico
  • 506,678
1

I propose to use siunitx for the alignment of the numerical columns, and to fix the width of the S columns so that the multicolumns contents is not too wide for the sum of the widths of these S columns.

In addition, I propose various improvements: using the rules from booktabs, which adds some vertical padding around horizontal rules, splitting the \multicolumns onto two lines with makecell packages, etc.

\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}

enter image description here

Bernard
  • 271,350