# Booktabs help alignment

For some strange reason, the right column is left aligned in contrast with the other columns. I'm not seeing what I did wrong. This is due in 3 hours, but I haven't noticed it until now. Please help if you can. Very much appreciated!

\documentclass[letterpaper]{article}
\special{papersize=8.5in,11in}
\usepackage{mathtools}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{array}
\usepackage[margin=1in]{geometry}
\setlength{\parskip}{1em}

\begin{document}
\begin{table}[h!]

\renewcommand\arraystretch{2}
\begin{center}
\caption{Processed data (rate of reaction)}
\vspace{.5 em}
\begin{tabular}{@{}lccl@{}}
\toprule


\midrule \renewcommand\arraystretch{2}

one piece of $\ce{Mg}$ ribbon & $2 \times 10^{-3}$                                                                                                           & 17.04                                                                                                                &   $1 \times 10^{-4}$                  \\

small cut up pieces of $\ce{Mg}$ & $2 \times 10^{-3}$                                                                                                                 & 16.03                                                                                                                &  $1 \times 10^{-4}$                  \\

\bottomrule

\end{tabular}
\end{center}
\end{table}
\end{document}


I've put my preamble and the entire table.

Edit: code

Here's a picture.

• Aren't you explicitly telling it to be left aligned by lccl? Oct 11 '18 at 11:15
• @samcarter Idk, I just went to tablesgenerator.com/# and typed in the table. What should it be changed to? Oct 11 '18 at 11:16
• try lccc if you want it to be centred. Oct 11 '18 at 11:17
• (tablesgenerator explains why the code is so strange...) Oct 11 '18 at 11:17
• I would also suggest to not use a center environment, but simply \centering to prevent the additional vertical spacing. Oct 11 '18 at 11:19

The last column is left aligned, because by using the l alignment specifier, you tell it t be so. if you want it to be centred, use c

I would suggest a couple of changes to simplify your code:

• you are loading the siunitx package, but don't use it. For example instead of $1 \times 10^{-4}$ simply write \num{1e-4}. Or \SI{0.01}{s} to automatically get the correct spacing between number an unit without hard coding lengths that will scale badly with the font.

• using nested tables for the multiline heads seems very complicate. The makecell package has nice solutions for that

• use \centering instead of the center environment to prevent additional spaces

• instead of manually messing with the spacing between caption and table, the caption package will automatically give a nice looking space

• replace all you \left( and \right) with (), they are not necessary in the context you are using them (which is true most of the time)

• using [h!] is basically a guarantee for suboptimal placement of your table. Let latex do what it can best and use [htbp]

\documentclass[letterpaper]{article}
\special{papersize=8.5in,11in}
\usepackage{mathtools}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{array}
\usepackage[margin=1in]{geometry}
\usepackage{makecell}
\usepackage{caption}

\setlength{\parskip}{1em}

\begin{document}

\begin{table}[h!]
\renewcommand\arraystretch{2}
\caption{Processed data (rate of reaction)}
\centering
\begin{tabular}{@{}lccc@{}}
\toprule
&
\thead{moles of $\ce{Mg_{(s)}}$ (\si{mol})\\$(\pm \SI{20}{\percent})$} &
\thead{time (\si{s})\\$(\pm \SI{0.01}{s})$} &
\thead{reaction rate (\si{mol.s^{-1}})\\$(\pm \SI{20}{\percent})$}\\
\midrule
one piece of $\ce{Mg}$ ribbon & \num{2e-3} & \num{17.04} & \num{1e-4}\\
small cut up pieces of $\ce{Mg}$ & \num{2e-3} & 16.03 & \num{1e-4}\\
\bottomrule
\end{tabular}
\end{table}

\end{document}