[Tex/LaTex] How to use \multirow

multirowtables

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}

Best Answer

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.

Related Question