# Extra alignment tab has been changed to \cr

\begin{table}[ht!]
\begin{center}
\begin{tabular}{p{0.6cm}p{0.6cm}p{2.3cm}p{1.4cm}p{2.3cm}p{1.45cm}}
\hline
\bf p & \bf N & \bf $\|u-u_{h}\|_{L^{2}(0,1)}$ & \bf $L^{2}$ Rate & \bf $\|u-u_{h}\|_{H^{1}(0,1)}$ & \bf $H^{1}$ Rate\\
\hline
1  & 2  & $1.1735 \times 10^{-2}$ & \centering -- & $2.3671 \times 10^{-2}$ & \centering --\\
-- & 4  & $3.0549 \times 10^{-3}$ & 1.9416        & $1.1547 \times 10^{-2}$ & 1.0356\\
-- & 8  & $7.4722 \times 10^{-4}$ & 2.0315        & $5.4262 \times 10^{-3}$ & 1.0895\\
\hline
\end{tabular}
\end{center}
\end{table}


So I'm getting that error with the above code and I know it's because in the last column of the second row of entries (i.e. the first row with actual data), I have "centering --". I'm confused why that doesn't work though since it works for the 2nd row, 4th column entry.

If you need only a correction, here you are:

\documentclass{article}
\begin{document}

\begin{table}[ht!]
\begin{center}
\begin{tabular}{p{0.6cm}p{0.6cm}p{2.3cm}p{1.4cm}p{2.3cm}p{1.45cm}}
\hline
\bf p & \bf N & \bf $\|u-u_{h}\|_{L^{2}(0,1)}$ & \bf $L^{2}$ Rate & \bf $\|u-u_{h}\|_{H^{1}(0,1)}$ & \bf $H^{1}$ Rate\\
\hline
%       1  & 2  & $1.1735 \times 10^{-2}$ & \centering -- & $2.3671 \times 10^{-2}$ & \centering --\\
1  & 2  & $1.1735 \times 10^{-2}$ & \multicolumn{1}{c}{ --} & $2.3671 \times 10^{-2}$ & \multicolumn{1}{c}{ --}\\
-- & 4  & $3.0549 \times 10^{-3}$ & 1.9416        & $1.1547 \times 10^{-2}$ & 1.0356\\
-- & 8  & $7.4722 \times 10^{-4}$ & 2.0315        & $5.4262 \times 10^{-3}$ & 1.0895\\
\hline
\end{tabular}
\end{center}
\end{table}

\end{document}


If your data are all homogeneous in columns as in the example you show, you can let TeX compute the column widths:

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{table}[htp]
\centering
\begin{tabular}{*{6}{c}}
\toprule
\bfseries p & \bfseries N & $\|u-u_{h}\|_{L^{2}(0,1)}$ &
\bfseries $L^{2}$ Rate & $\|u-u_{h}\|_{H^{1}(0,1)}$ & \bfseries $H^{1}$ Rate\\
\midrule
1  & 2  & $1.1735 \times 10^{-2}$ & --      & $2.3671 \times 10^{-2}$ & -- \\
-- & 4  & $3.0549 \times 10^{-3}$ & 1.9416  & $1.1547 \times 10^{-2}$ & 1.0356\\
-- & 8  & $7.4722 \times 10^{-4}$ & 2.0315  & $5.4262 \times 10^{-3}$ & 1.0895\\
\toprule
\end{tabular}
\end{table}
\end{document}


Use \centering and not the center environment inside table; also use \bfseries and not \bf that's obsolete.

The problem was due to the fact that \centering changes the meaning of \\ so the \\ after it wasn't interpreted as a "end of row".

Don't worry about using \centering as advised, because tabular restores the meaning of \\ to the right thing. The problem is in using \centering inside a tabular.

• @barbara-beeton Just curious and I have some spare time:-). When you edit an answer or a question, do you keep the uppercase letters or do you turn them into lowercase? – user10274 Mar 26 '17 at 15:33
• @null -- when i edit on tex.sx, if i'm correcting an error that involves an incorrect case (for example, \LaTex, which should be \LaTeX unless the definition of the "unusual" form is present in the quesion or answer), i would change it to the correct form. but i try not to make any changes unless it's for accuracy or searchability. for a current question, if it doesn't make sense, but i can guess what it's likely to mean, i'll usually make a comment, not an edit, and ask for the op to follow up. – barbara beeton Mar 26 '17 at 16:08
• I knew that already. Sorry for wasting your time:-) – user10274 Mar 26 '17 at 16:12