# Table formatting error extra alignment tab

\begin{table}{ht}
\begin{tabular}{|cc|}
\hline
10g & Tryptone //
5g  & Yeast extract //
5g  & NaCl //
10g & Agar //
1ml & Ampicllin (100ng/ml)  /hline
\end{tabular}
\caption{Reagents for Lysogeny broth agar}
\label{table:LBAreagents}

\end{table}


I keep getting an error message and I can not for the life of me spot the problem, the error is said to be occurring on the yeast and agar code lines with the following code

Extra alignment tab has been changed to \cr.
l.164 5g &
Yeast //
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
! Extra alignment tab has been changed to \cr.
l.166 10g &
Agar //
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
[10]"


Any help would be very much appreciated.

n.b. Preamble

\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{color}
\usepackage{multirow}
\usepackage{soul}
\usepackage{caption}
\usepackage{natbib}
\usepackage{setspace}
\usepackage{placeins}
\usepackage[nottoc,numbib]{tocbibind}
\renewcommand{\bibname}{References}
\doublespacing
\usepackage[parfill]{parskip}

• Use \\ instead of // and \hline end of the table. – ferahfeza May 28 '14 at 21:03
• Also use [ht] not {ht}. – ferahfeza May 28 '14 at 21:09
• Superb thank you very much for your help! A simple yet infuriating mistake. – Charlie1234567 May 29 '14 at 9:29
• – Peter Grill Jun 2 '14 at 2:38

Like this?

I changed the {ht} to [ht] and then replaced the // with \\ and added an extra \\ before the last \hline

\begin{table}[ht]
\begin{tabular}{|cc|}
\hline
10g & Tryptone \\
5g  & Yeast extract \\
5g  & NaCl \\
10g & Agar \\
1ml & Ampicllin (100ng/ml) \\
\hline
\end{tabular}
\caption{Reagents for Lysogeny broth agar}
\label{table:LBAreagents}

\end{table}


I also took the liberty to update the table and introduce you to both the siunitx package for showing numbers with SI units and the mhchem package for chemical formulas and the booktabs package for nicer formatting of the table. But that is of course my preference :)

\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{color}
\usepackage{multirow}
\usepackage{soul}
\usepackage{caption}
\usepackage{natbib}
\usepackage{setspace}
\usepackage{placeins}
\usepackage[nottoc,numbib]{tocbibind}
\renewcommand{\bibname}{References}
\doublespacing
\usepackage[parfill]{parskip}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage[version=3]{mhchem}
\begin{document}
\begin{table}[ht]
\centering
\caption{Reagents for Lysogeny broth agar}
\label{table:LBAreagents}
\begin{tabular}{cc}
\toprule
Quantities & Ingredient \\
\midrule
\SI{10}{\gram} & Tryptone \\
\SI{5}{\gram}  & Yeast extract \\
\SI{5}{\gram}  & \ce{NaCl} \\
\SI{10}{\gram} & Agar \\
\SI{1}{\milli\litre} & Ampicllin (\SI{100}{\nano\gram\per\milli\litre)} \\
\bottomrule
\end{tabular}

\end{table}

\end{document}


would give something like this

• @Mico sorry, was editing the post :) – Trefex May 28 '14 at 21:20
• I am a fan of the horizontal line design, I tried using the booktabs as you suggested but it gave me error codes regarding my float placement code ([htbp]/[ht]/[h]). Thanks for your help – Charlie1234567 May 29 '14 at 9:30
• @Charlie1234567 booktabs shouldn't cause errors with regard to float placement. If that is still a problem I think you should ask a new question with a complete example that demonstrates the problem. (And please write what the error says, not just that you get an error. Error messages are meant to help you find out what is wrong, even if they're not always very clear, so they are useful information.) – Torbjørn T. Jun 2 '14 at 12:11

Here is how I would typeset the table using the powerful siunitx package:

\documentclass{report}

\usepackage[tableposition = top]{caption} % table caption position
\usepackage{booktabs}                     % horizontal lines in table
\usepackage{siunitx}                      % typesetting and aligning physical quantities
\usepackage[version = 4]{mhchem}          % format names of chemical components

\begin{document}

\begin{table}
\centering
\caption{Reagents for Lysogeny broth agar.}
\label{table:LBAreagents}
\begin{tabular}{
S[table-format = 2] @{\,}
s[table-unit-alignment = left]
l
}
\toprule
10 & \g  & Tryptone      \\
5 & \g  & Yeast extract \\
5 & \g  & \ce{NaCl}     \\
10 & \g  & Agar          \\
1 & \ml & Ampicllin (\SI[per-mode = symbol]{100}{\ng\per\ml}) \\
\bottomrule
\end{tabular}
\end{table}

\end{document}


Note the vertical alignment of the physical quantities and units in the first two columns. This is the 'correct' way of doing it.