45

Unfortunately I cannot solve the error with noalign on my own:

! Misplaced \noalign.
\hline ->\noalign 
                  {\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
l.12 ... & \centering{B} & \centering{C} \\ \hline

I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.

I already tried it with \cline, but this didn't work either. By searching the web I found out that in all cases \\ at the end of the line is missing. However, I have a \\ at the end of the line:

\documentclass[12pt,a4paper]{article}
\usepackage{multicol}
\usepackage{multirow}

\begin{document}

\begin{tabular}{|p{40pt} p{60pt}|p{120pt}|}
\hline
\multicolumn{3}{|p{220pt}|}{\multirow{2}{220pt}{\centering{\textbf{Title}}}} \\
\multicolumn{3}{|c|}{} \\ \hline
\centering{A} & \centering{B} & \centering{C} \\ \hline
\end{tabular}

\end{document}

I'd appreciate any help.

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
Emerell
  • 451

2 Answers2

40

\centering does not take an argument so as you used it its scope reaches to the end of the cell, but it redefines \\ to be a centred new line so you can use the unambiguous form of the array row separator: \tabularnewline

\documentclass[12pt,a4paper]{article}
\usepackage{multicol}
\usepackage{multirow}

\begin{document}

\begin{tabular}{|p{40pt} p{60pt}|p{120pt}|}
\hline
\multicolumn{3}{|p{220pt}|}{\multirow{2}{220pt}{\centering \textbf{Title}}} \tabularnewline
\multicolumn{3}{|c|}{} \\ \hline
\centering A & \centering B & \centering C \tabularnewline \hline
\end{tabular}

\end{document}

Title A B C

David Carlisle
  • 757,742
8

This seems to be caused by the \centering in the very last cell of your table. I do not know exactly why this fails, but if you centre C manually, the problem goes away.

\documentclass[12pt,a4paper]{article}
\usepackage{multicol}
\usepackage{multirow}

\begin{document}

\begin{tabular}{|p{40pt} p{60pt}|p{120pt}|}
\hline
\multicolumn{3}{|p{220pt}|}{\multirow{2}{220pt}{\centering{\textbf{Title}}}} \\
\multicolumn{3}{|c|}{} \\ \hline
\centering{A} & \centering{B} & \hfil C \hfil \\ \hline

\end{tabular}

\end{document}
ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
Ian Thompson
  • 43,767