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

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

can multirow grow to fit it's contents?

Post by chrisbare »

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:

Code: Select all

\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 137 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply