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
& \renewcommand\arraystretch{1.5} \begin{tabular}[c]{@{}c@{}} moles of $\ce{Mg_{(s)}} \hspace{1mm} \left( \si{mol} \right)$ \\ $\left( \pm \hspace{1mm} 20 \% \right)$ \end{tabular} & \renewcommand\arraystretch{1.5} \begin{tabular}[c]{@{}c@{}}time $\left( \si{s} \right)$ \\ $\left( \pm 0.01 \hspace{1mm} \si{s} \right)$ \end{tabular} & \renewcommand\arraystretch{1.5} \begin{tabular}[c]{@{}c@{}} reaction rate $ \left( \si{mol.s^{-1}} \right)$ \\ $\left( \pm \hspace{1mm} 20 \% \right)$ \end{tabular} \\
\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.
Best Answer
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, usec
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 thatuse
\centering
instead of thecenter
environment to prevent additional spacesinstead of manually messing with the spacing between caption and table, the
caption
package will automatically give a nice looking spacereplace 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]