3

I am using a multirow inside a tabularx, but because the multirow doesn't wrap, I am putting the multirow's text inside a parbox environment:

\begin{tabularx}{\textwidth}{@{}XX@{}} \toprule
blah & \multirow{2}{*}{\parbox{\columnwidth}{blah}} \\
blah & \\
\end{tabularx}

What should I put as the parbox's width so that it responds to the column width that tabularx chooses?

6

\linewidth, since that will be the width of the column as adjusted by tabularx's X-column. Here's an example:

enter image description here

\documentclass{article}
\usepackage{tabularx,multirow,booktabs}% http://ctan.org/pkg/{tabularx,multirow,booktabs}
\begin{document}
\noindent\begin{tabularx}{\textwidth}{@{}XX@{}} \toprule
blah & \multirow{2}{*}{\setlength{\fboxsep}{-\fboxrule}\fbox{\parbox{\linewidth}{blah}}} \\
blah & \\
\end{tabularx}
\end{document}

Contrary to belief, \columnwidth does not span the width of a table column.

9

\multirow would linewrap if you passed a length rather than *

enter image description here

\documentclass{article}
\usepackage{tabularx,multirow,booktabs}% http://ctan.org/pkg/{tabularx,multirow,booktabs}
\begin{document}
\def\blah{blah blah blah blah blah blah blah blah blah blah blah blah}

\noindent\begin{tabularx}{\textwidth}{@{}XX@{}} \toprule
\blah & \multirow{2}{\linewidth}{\blah \blah} \\
\blah & \\
\end{tabularx}
\end{document}
  • Thanks @David for your suggestion on explicit passing of the length – Amir Feb 21 '16 at 14:24

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.