I need a longtable
like this table shown in HTML:
but when I use \multirow
, the data inside the \multirow
is continued inside the next cell. I have tried with the following
\begin{longtable}{|>{\bfseries}p{0.18\textwidth}|>{\bfseries}p{0.1\textwidth}|p{0.18\textwidth}|p{0.18\textwidth}|p{0.18\textwidth}|p{0.18\textwidth}|}
\hline
\multicolumn{2}{|l|}{} & \textbf{QR Codes} & \textbf{PDF417} & \textbf{DataMatrix} & \textbf{Maxi Code} \\
\hline
\multirow{3}{*}{Datacapacity} & Numeric & 7.089 & 2.710 & 3.116 & 138 \\ \cline{2-6}
& Alphanumeric & 4.269 & 1.850 & 2.355 & 93 \\ \cline{2-6}
& Bytes & 2.953 & 1.018 & 1.556 & \\
\hline
\multicolumn{2}{|l|}{Pros} & \parbox{\columnwidth}{Great capacity \\ High read} & Great capacity & Little size & High read \\
\hline
\end{longtable}
I hope somebody in here can help me, and if you can help with the \parbox
-problem too, it could be great.
UPDATE
Now I only have the problem with what I previously named the \parbox
-problem, as you can see on the last row in this picture:
Now my LaTeX looks like this
\begin{longtable}{|>{\bfseries}l|>{\bfseries}l|*{4}{p{0.14\textwidth}|}}
\hline
\multicolumn{2}{|l|}{} & \textbf{QR Koder} & \textbf{PDF417} & \textbf{Data\-Matrix} & \textbf{Maxi Code} \\
\hline
...
Data- & Numerisk & 7.089 & 2.710 & 3.116 & 138 \\ \cline{2-6}
\multirow{2}{*}{kapacitet} & Alfa- & 4.269 & 1.850 & 2.355 & 93 \\
& numerisk & & & & \\ \cline{2-6}
& Bytes & 2.953 & 1.018 & 1.556 & \\
\hline
\multicolumn{2}{|l|}{Hovedtræk} & \begin{tabular}[t]{@{}l@{}}Stor kapacitet \\ Lille udskriftsstørrelse \\ Høj læsehastighed \end{tabular} & Stor kapacitet & Lille udskriftsstørrelse & Høj læsehastighed \\
\hline
\end{longtable}
Does anybody in here have an idea how to solve this?
Best Answer
The following achieves what you're after (and is possible even without
multirow
):I've avoided
\parbox
and inserted an additional row. You could use a nestedtabular
if you want lines broken inside the cell. For example,The use of
[t]
aligns thetabular
at thet
op, while@{}
removes any column padding, on both sides.*{4}{l|}
repeatsl|
4 times.p
-columns, but then you need to specify the widths in such a way that the table fits within the text block (horizontally). Your code snippet already has 5 columns of width.18\textwidth
, and then a single column of width.1\textwidth
, totalling\textwidth
. However, there is still padding around each column (roughly2\tabcolsep+\arrayrulewidth
).Without more detail on the size of your text block (or page orientation), it's difficult discussing alternatives to your table.
Finally, table representations are sprinkled with fairy dust if you consider the
booktabs
package. Moreover, there's little use in alongtable
when your table is not that long...