TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try the following code I get some errors about misplaced \noalign, however I almost entirely copied the code from the wikipage. What is going wrong?

\begin{table}[hbt]
\centering
\begin{tabular}{|>{\centering}m{2cm}<{\centering}|>{\centering}m{2cm}<{\centering}|>{\centering}m{2cm}<{\centering}|>{\centering}m{2cm}<{\centering}|>{\centering}m{2cm}<{\centering}|}
\hline
A&I&J&K&L\\\hline
B&\verb/--/&\verb/++/&\verb/++/&\verb/++/\\\hline
C&\verb/++/&\verb/+/&\verb/-/&\verb/--/\\\hline
D&\verb/--/&\verb/-/&\verb/++/&\verb/+/\\\hline
E&\multicolumn{2}{c}{F}&G&H\hline
\end{tabular}
\end{table}
share|improve this question
up vote 5 down vote accepted

You are short a \\ in the final row before \hline. Here's your code snippet in the form of a minimal document with some modifications using array to set a column type M (rather than duplicating the same column perpetually):

enter image description here

\documentclass{article}
\usepackage{array}% http://ctan.org/pkg/array
\newcolumntype{M}{>{\centering\arraybackslash}m{2cm}<{\centering\arraybackslash}|}
\begin{document}
\begin{table}[hbt]
  \centering
  \begin{tabular}{|*{5}{M}}
    \hline
    A & I & J & K & L \\ \hline
    B & \verb/--/ & \verb/++/ & \verb/++/ & \verb/++/ \\ \hline
    C & \verb/++/ & \verb/+/  & \verb/-/  & \verb/--/ \\ \hline
    D & \verb/--/ & \verb/-/  & \verb/++/ & \verb/+/  \\ \hline
    E & \multicolumn{2}{c}{F} & G & H \\ \hline % <--- missed "\\"
  \end{tabular}
\end{table}
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.