Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

\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.

share|improve this answer
add comment

\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}
share|improve this answer
    
Thanks! It's always nice to have optimized code. –  Neil G Dec 17 '12 at 17:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.