4

I'm having some difficulty with the text alignment in some table columns and was wondering if someone could help me work out what's going on? I've provided a MWE and image of the table output.

Before using the \multicolumn command for the last 2 columns of the top row, all the text was centered as a result of the \begin{tabular}{*{7}{c}} command. However, when using \multicolumn, this appears to override the centering for everything in the last two columns. How can I change this so that the text is centered again?

Also, I'd like to make the text in columns 1, 3 and 5 vertically aligned to the left, so that the first letter/number starts in the same position for each entry, but have it so the text is centered to the width of the column i.e. so the text is centered for the longest character entry for a column and everything else is left aligned to it. Is this possible?

I know that I could specify \begin{tabular}{l c l c l c c }, to left align the columns, but this doesn't quite achieve what I want.

\documentclass[12pt,a4paper]{report}
\usepackage{amsmath}
\usepackage{caption}
\usepackage{array,booktabs,threeparttable}
\usepackage{chemformula}
\usepackage[utf8]{inputenc}

\begin{document}

\begin{table}
\centering
\caption[Alpha emitting radioactive decay series.]{Alpha emitting radioactive decay series.}
\label{tab:alpha decay series}
\begin{threeparttable}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{*{7}{c}}
\toprule
            &             &                &                            &                & \multicolumn{2}{c}{Number of decays} \\
Series type & Series name & Parent nucleus & Half-life ($10^{9}$ years) & Stable nucleus & $\alpha$ & $\beta^{-}$ \\
\midrule
$A = 4n$    & Thorium           & \ch{^{232}Th} & 14.05     & \ch{^{208}Pb}     & 6 & 4 \\
$A = 4n+1$  & Neptunium         & \ch{^{237}Np} & 0.0021    & \ch{^{205}Tl}     & 8 & 5 \\
$A = 4n+2$  & Radium (Uranium)  & \ch{^{238}U}  & 4.4683    & \ch{^{206}Pb}     & 8 & 6 \\
$A = 4n+3$  & Actinium          & \ch{^{235}U}  & 0.7038    & \ch{^{207}Pb}     & 7 & 4 \\
\bottomrule
\end{tabular}%
}
\end{threeparttable}
\end{table}
\end{document}

enter image description here

5

If \ spanning cell is wider than the natural width of the cells that it spans then all the extra width is placed in the last spanned cell, which is almost never what you want.

One way is to force the alpha and beta to be wider, so the width is shared between the last two columns.

\documentclass[12pt,a4paper]{report}
\usepackage{amsmath}
\usepackage{caption}
\usepackage{array,booktabs,threeparttable}
\usepackage{chemformula}
\usepackage[utf8]{inputenc}

\begin{document}

\begin{table}
\centering
\caption[Alpha emitting radioactive decay series.]{Alpha emitting radioactive decay series.}
\label{tab:alpha decay series}
\begin{threeparttable}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{*{7}{c}}
\toprule
            &             &                &                            &                & \multicolumn{2}{c}{Number of decays} \\
Series type & Series name & Parent nucleus & Half-life ($10^{9}$ years) & Stable nucleus & 
\makebox[1.5cm]{$\alpha$} &
\makebox[1.5cm]{$\beta^{-}$} \\
\midrule
$A = 4n$    & Thorium           & \ch{^{232}Th} & 14.05     & \ch{^{208}Pb}     & 6 & 4 \\
$A = 4n+1$  & Neptunium         & \ch{^{237}Np} & 0.0021    & \ch{^{205}Tl}     & 8 & 5 \\
$A = 4n+2$  & Radium (Uranium)  & \ch{^{238}U}  & 4.4683    & \ch{^{206}Pb}     & 8 & 6 \\
$A = 4n+3$  & Actinium          & \ch{^{235}U}  & 0.7038    & \ch{^{207}Pb}     & 7 & 4 \\
\bottomrule
\end{tabular}%
}
\end{threeparttable}
\end{table}
\end{document}
  • Thanks for the quick reply. Can I ask why you used a value of 1.5 cm, specifically? Is this just an arbitrary value? The reason I ask is because I'm also using the \resizebox command. So, if for instance I had a similar table but I was using multicolumn for 3 columns rather than 2, would I have to drop the \makebox size down to 1 cm each? – cjms85 Feb 8 '14 at 15:33
  • 1
    @cjms85 by eye,1cm wasn't enough:-) yes you may need less if you span more columns, you can automate it more by measuring the heading first with \settowidth or similar and then dividing by the number of columns, taking account of tabcolsep etc, but for hand written tables as opposed to a database dump, just guessing is simpler:-) – David Carlisle Feb 8 '14 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.