Take the 2-minute tour ×
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.

This is probably very simple question: I am trying to generate a table with multiple rows in the last two columns. I have tried the following:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\begin{document}
\begin{table}
\begin{tabular}{|l|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{Type} \\
\hline
  & A  &    B & C & D \\
    \hline
    X & 53,2\%  &  51,6\%  &  \multirow{2}{*}{49\%} & \multirow{2}{*}{49\%} \\ 
    Y  & 53,8\%  &  52,2\%  &  \\
\hline
\end{tabular}
\end{table}
\end{document}

But the table I get has an incomplete line down right:

enter image description here

How can I get a table with complete line? Is this the optimal way to generate such a table?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

you forgot a ''&''

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\begin{document}
\begin{table}
\begin{tabular}{|l|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{Type} \\
\hline
  & A  &    B & C & D \\
    \hline
    X & 53,2\%  &  51,6\%  &  \multirow{2}{*}{49\%} & \multirow{2}{*}{49\%} \\ 
    Y  & 53,8\%  &  52,2\%  & & \\
\hline
\end{tabular}
\end{table}
\end{document}
share|improve this answer
add comment

The last row misses the last &. The rightmost line is only set, if the last cell is used. An empty last cell will do:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\begin{document}
\begin{table}
\begin{tabular}{|l|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{Type} \\
\hline
  & A  &    B & C & D \\
    \hline
    X & 53,2\%  &  51,6\%  &  \multirow{2}{*}{49\%} & \multirow{2}{*}{49\%}
 \\
    Y  & 53,8\%  &  52,2\%  &  & \\
\hline
\end{tabular}
\end{table}
\end{document}

Result

share|improve this answer
add comment

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.