79

I can compile this table separately but when I want to compile the whole file, it gives me an error, which is fixed by removing \multirow.

\usepackage{multirow}

\begin{table}[htbp]
\begin{center}
\begin{tabular}{|c|c|c|c|p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}|}
\hline
A & B & C & D & \multicolumn{7}{|c|}{F}  \\ \hline
\multirow{ 2}{}{1} & 0 & 6 & 230 & 35 & 40 & 55 & 25 & 40 & 35 & \\
& 1 & 5 & 195 & 25 & 50 & 35 & 40 & 45 &  &  \\ \hline
\end{tabular}
\end{center}
\label{table2}
\end{table}
129

There are some errors in your code; you need to give a second argument to \multirow (an explicit value for the cell width or * to use the natural width of the contents); also, \label must always appear after \caption in floating environments:

\documentclass{article}
\usepackage{multirow}

\begin{document}

\begin{table}[htbp]
\centering
\begin{tabular}{|c|c|c|c|p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}|}
\hline
A & B & C & D & \multicolumn{7}{|c|}{F}  \\ \hline
\multirow{ 2}{*}{1} & 0 & 6 & 230 & 35 & 40 & 55 & 25 & 40 & 35 & \\
& 1 & 5 & 195 & 25 & 50 & 35 & 40 & 45 &  &  \\ \hline
\end{tabular}
\caption{A test caption}
\label{table2}
\end{table}

\end{document}

enter image description here

It is not clear why you are using p{...} columns if the cells are not containing paragraphs.

As a side note, I used \centering instead of the center environment to avoid adding extra vertical spacing (which in most cases is not desired).

You are not using all the columns you declared, but I guess that this was just for the example.

  • 4
    Source for multirow – Jost Aug 8 '14 at 13:34
  • 7
    Note the need for using \cline{2-10} if you want a horizontal line between rows 2 and 3. – Steven C. Howell Sep 28 '15 at 14:06
  • 3
    @Gonzalo Medina In the table environment in the example code, the '\' character should be replaced by '\\'. – Abhinav Jan 31 '17 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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