LaTeX forum ⇒ Graphics, Figures & Tablescan multirow grow to fit it's contents?

Information and discussion about graphics, figures & tables in LaTeX documents.
chrisbare
Posts: 1
Joined: Fri Jan 08, 2021 1:50 am

can multirow grow to fit it's contents?

Postby chrisbare » Fri Jan 08, 2021 2:04 am

I'm trying to make a table using multi-row. The contents of each cell come from a database, so I don't know how long they will be. I used a \parbox to wrap the contents at the desired width, and for normal cells they grow as need to contain the contents.
However, with multi-row the contents do not cause the cell to grow (longer) if need.
It also doesn't obey the [t] top alignment when the contents are longer than the box.

Here's an example:
\documentclass[10pt, letterpaper]{letter}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{array}

\begin{document}
\begin{longtable}{|l|l|}
 \hline 

\multirow[t]{2}{*}{\parbox{4cm}{
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sodales mi purus, nec dapibus diam volutpat vel. Cras vel ipsum mauris. Morbi mollis purus purus, quis sodales urna porttitor ultrices. Sed ac metus euismod, facilisis nulla a, convallis lacus. Quisque pellentesque sit amet lacus et condimentum. Pellentesque vel diam non purus vulputate faucibus eget quis sapien. Mauris feugiat finibus lectus, a commodo nulla dictum ut. Morbi ultricies nec justo eu dapibus. Donec lacus lorem, iaculis in viverra at, lacinia in metus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec non tristique quam.
}} & 

\parbox{4cm}{
Mauris et fringilla justo. Nunc et dapibus leo. In ut dapibus tortor, semper fringilla risus.
}

\\ \cline{2-2}
 & \parbox{4cm}{
Duis et nisl ornare, volutpat magna non, tristique felis. Fusce lacinia varius neque eget maximus. Fusce sed sagittis arcu, ut lobortis diam.
}
\\ \hline 

\end{longtable}
\end{document}


I've tried many different things, including a table inside the multirow, but so far nothing has worked.
Is there a way to make multirow behave like I want?
Attachments
sample.pdf
(18.19 KiB) Downloaded 17 times

Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests