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.

Is it possible to use the p attribute in a multicol, with a multirow embedded?

A previous post doesn't provide a useful answer, since it only works with attributes other than p. It is exactly my issue.

When a try to do that, I ran into the following error: Overfull \hbox (901.70518pt too wide) in paragraph at lines 27--27

Code snippet:

\documentclass[final,5p,times]{elsarticle}

\usepackage{multirow}
\usepackage{multicol}

\begin{document}

\begin{table}

   \begin{tabular}{|c|l|l|c|p{9cm}|}

      \hline

         1 & & Lorem Ipsum quia & no & \\

      \cline{1-1}   
      \cline{3-4}

         2 & \multirow{-2}{*}{Lorem Ipsum} & Lorem Ipsum dolor & yes &
           \multicolumn{1}{p{9cm}}{\multirow{-2}{*}{Ut justo ante, euismod a viverra
           nec, blandit a diam. Quisque placerat, urna ut fringilla imperdiet, leo nisl
           rhoncus lectus, volutpat luctus felis ante in lectus. Sed gravida gravida
           neque nec bibendum. Duis fringilla urna et mi tempus in pellentesque velit
           cursus. Nullam sit amet porta massa.}}\\

      \hline

   \end{tabular}

\end{table}

\end{document}

Below is a snapshot of such unexpected error:

snapshot-pdf-unexpected

UPDATED

The expected output would be like this:

enter image description here

share|improve this question
    
I think you have to enclose the multi-column content within a \parbox{9cm}{}. –  Peter Grill Jul 5 '12 at 20:09
    
@PeterGrill By using the \parbox command I don't reach my expected result. See the @DavidCarlisle post/answer below. –  Ivan Machado Jul 5 '12 at 20:41
    
your expected image has 4 columns and "Lorem ipsum" once, your code fragment has 5 columns and "Lorum Ipsum" 3 times. The code I posted would produce the result requested if you just remove the third column with two lorum ipsum –  David Carlisle Jul 5 '12 at 20:56
    
Nope... (I've updated the image, replacing it with a more correct expected output). The point is: I need that all the content of the last column be placed within the cell limits; Besides, I also intend to have equal rows height, regardless of the number of lines occupied by the last column. –  Ivan Machado Jul 5 '12 at 21:07
add comment

1 Answer

up vote 3 down vote accepted

[2nd attempt] something like this:

enter image description here

\documentclass{article}

\usepackage{multirow}


\begin{document}

\begin{table}
\def\arraystretch{3}
   \noindent
\begin{tabular}{|c|l|l|c|p{9cm}|}

      \hline

         1 & 
 \multirow{2}{*}{Lorem Ipsum}&
Lorem Ipsum quia & no & 
\multirow{2}{9cm}{Ut justo ante, euismod a viverra
           nec, blandit a diam. Quisque placerat, urna ut fringilla imperdiet, leo nisl
           rhoncus lectus, volutpat luctus felis ante in lectus. Sed gravida gravida
           neque nec bibendum. Duis fringilla urna et mi tempus in pellentesque velit
           cursus. Nullam sit amet porta massa.}\\

      \cline{1-1}   
      \cline{3-4}

         2 & & Lorem Ipsum dolor & yes &
           \\

      \hline

   \end{tabular}

\end{table}

\end{document}
share|improve this answer
    
Now it worked properly! –  Ivan Machado Jul 5 '12 at 22:07
1  
It seems multirow doesn't really support the spanning entry being larger than the rows it spans, so I used arraystretch locally to stretch the rows apart so the two normal rows made enough space for the last big entry, –  David Carlisle Jul 5 '12 at 22:09
    
I see your point. It's exactly what I was wondering about, but I didn't realize that it couldn't be possible. Then, in sum, we can't use a \multirow inside a \multicolumn with a p (attribute) together, right? –  Ivan Machado Jul 5 '12 at 22:14
1  
well there's no need as multrow's width argument implies p effectively. so you can have a multicolumn containing a multirow with a specified width, acting like a p column, but you need to make sure the other entries are big enough as the spanning entry will overprint if not. –  David Carlisle Jul 5 '12 at 22:18
    
I got your point. –  Ivan Machado Jul 5 '12 at 22:19
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.