Tables – How to Break Up Table Headings into Two Lines

line-breakingtables

I'd like to have the headers of my table on two lines. For example, I would like Reaction Buffer to be ABOVE (150mM sodium acetate), and etc. for each column, but I don't know how to do this.

Also, the table is far too wide for my document, does anyone know how to compress (shrink) the whole thing?

\footnotesize
\begin{table}[h]
\centering
\small
\footnotesize
\tabcolsep=0.11cm
\begin{tabular}{@{}ll@{}@{}ll@{}@{}ll@{}ll@{}}
\toprule
Tube & MilliQ Water $(\mu L)$ \, &  100 mM MgCl\_2 $(\mu L)$, & Reaction Buffer (150 mM sodium acetate) $(\mu L)$  \,  & 500 mM NaOH $(\mu L)$, & 4 mM pNPP $(\mu L)$\\ 
\midrule
    1 & 60 & 15 & 30. (pH 4.0)& {} & 600. & 30. \\
    2 & 60 & 15 & 30. (pH 5.0) & {} & 600. & 30.\\
    3 & 60 & 15 & 30. (pH 6.0) & {} & 600. & 30.\\
    4 & 60 & 15 & {} & 30. (pH 7.0) & 600. & 30. \\
    5 & 60 & 15 & {} & 30. (pH 8.0) & 600. & 30. \\
    6 & 60 & 15 & {} & 30. (pH 9.0) & 600. & 30. \\ 
\bottomrule
\end{tabular}
\end{table}

\end{homeworkProblem}

Best Answer

Use makecell for that, and its \thead command. In addition I loaded the mhchem and siunitx package.

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{array, booktabs, makecell}
\usepackage{siunitx, mhchem}
\newcommand\muL{\si{\micro\liter}}
\begin{document}

\begin{table}[h]
\centering
\small
\tabcolsep=0.11cm
\begin{tabular}{@{}*{7}{c}@{}}
\toprule
Tube & \thead{Milli-Q\\ Water \\ \muL} & \thead{100\,mM\\ \ce{MgCl2} \\ \muL} & \thead{Reaction Buffer \\ (150\,mM sodium\\ acetate) \muL} & \thead{500\,mM \\\ce{NaOH} \\ \muL} & \thead{4\,mM\\ pNPP \\\muL}\\
\midrule
    1 & 60 & 15 & 30. (pH 4.0)& {} & 600. & 30. \\
    2 & 60 & 15 & 30. (pH 5.0) & {} & 600. & 30.\\
    3 & 60 & 15 & 30. (pH 6.0) & {} & 600. & 30.\\
    4 & 60 & 15 & {} & 30. (pH 7.0) & 600. & 30. \\
    5 & 60 & 15 & {} & 30. (pH 8.0) & 600. & 30. \\
    6 & 60 & 15 & {} & 30. (pH 9.0) & 600. & 30. \\
\bottomrule
\end{tabular}
\end{table}

\end{document} 

enter image description here

Related Question