1

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?

3

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}
2

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

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.