I'm following How to use \multirow to try and create a table. I have five columns and two rows, but the first column of the two rows need to be merged into one cell. The code I have is:
\documentclass{article}
\usepackage{multirow}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}{|P{6 cm}|P{2.7 cm}|c|P{2 cm}|P{2 cm}|}
\hline
A & B & C & D & E \\ \hline
\multirow{ 2}{*}{1} & 0 & 6 & 230 & 35 & \\
& 1 & 5 & 195 & 25 \\ \hline
\end{tabular}
\caption{A test caption}
\label{table2}
\end{table}
\end{document}
But the table I see looks like this
The vertical lines are broken, and I also need a horizontal line to separate the two rows in columns B,C,D, and E.
to allow column headers to be centered while having fixed widths.
What am I doing wrong?
&
after 35.l
type columns instead ofp
type ones. Probably, again also depending on the actual contents,tabularx
could also come in handy to ensure the table fits into the textwidth.&
since there are 11 columns used, but the35
entry is in the tenth. You will therefore need a&
to get a cotinuous vertical line at the right side of the table. In your example, you define 5 columns and the35
already is in the fifth. With the&
you would jump to the non existant sixth column, hence the "Extra alignment tab..." error that you get from your example.