3

Could somebody give me a hint, why the \multirow doesn't work as it should?

\documentclass{article}
\usepackage{multirow}
\begin{document}

\begin{tabular}{c|c|c|c|c|c|}
\emph{step} & 0 & 1 & 2 & 3 & 4 \\ \hline
1. step  &  &  &  &3  &   \\ \hline \hline
\multirow{2}{*}{2nd step}  & 6 &  & 2 &3  &   \\ \hline
            &  &  &  &8  &   \\ \hline \hline

\end{tabular}

\end{document}

2 Answers 2

4

\hline is not aware of the multirow, use \cline instead:

\documentclass{article}
\usepackage{multirow}
\begin{document}

\begin{tabular}{c|c|c|c|c|c|}
\emph{step} & 0 & 1 & 2 & 3 & 4 \\ \hline
1. step  &  &  &  &3  &   \\ \hline \hline
\multirow{2}{*}{2nd step}  & 6 &  & 2 &3  &   \\ \cline{2-6}
            &  &  &  &8  &   \\ \hline \hline

\end{tabular}

\end{document}

enter image description here

1
  • thx, helped me. saved my day. I am surprised how quick the answer was :)
    – LeO
    Commented May 1, 2014 at 20:10
4

You need to remove the horizontal line between the two cells, using \cline{2-6} instead of \hline.

\documentclass{article}
\usepackage{multirow}
\begin{document}

\begin{tabular}{c|c|c|c|c|c|}
\emph{step} & 0 & 1 & 2 & 3 & 4 \\ \hline
1. step  &  &  &  &3  &   \\ \hline \hline
\multirow{2}{*}{2nd step}  & 6 &  & 2 &3  &   \\ \cline{2-6}
            &  &  &  &8  &   \\ \hline \hline

\end{tabular}

\end{document}

However, I would recommend to get rid of both the vertical lines and the multirow package:

enter image description here

\documentclass{article}
\usepackage{booktabs}
\begin{document}

\begin{tabular}{lcccccc} \toprule
 & 0 & 1 & 2 & 3 & 4 \\ \midrule[\heavyrulewidth]
\bfseries 1st step
 &   &   &   & 3 &   \\ \midrule
\bfseries 2nd step
 & 6 &   & 2 & 3 &   \\ \cmidrule{2-6}
 &   &   &   & 8 &   \\ \bottomrule
\end{tabular}

\end{document}
1
  • thx, helped me. I am surprised how quick the answer was :) (+ I can only accept one answer - sorry :) )
    – LeO
    Commented May 1, 2014 at 20:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .