3

I am trying to generate a table that has the following structure:

table example

The problem are the red Xs - I want the text in the cell to wrap, and the cell height to adjust automatically. I tried using a minipage, adjusting the size, parbox etc. It can't seem to autosize rows and wrap at the same time. The text will always overflow to the next rows once the two multirows are full.

    \documentclass[12pt,a4paper,titlepage]{article}
    \usepackage{rotating}
        \usepackage{multirow}
        \usepackage{lscape}
        \usepackage{caption}
        \begin{document}
        \begin{landscape} 
        \captionsetup{format=plain} 
        \centering 
        \begin{tabular}{c|c c c |p{\linewidth}}     
        \multirow{3}{*}{} & \multicolumn{3}{c}{Range of} & \multirow{2}{*}{} \\ 
        & parameter1 & param 2 & param 3 &  \\ \hline   
        \multirow{2}{*}{1}  &value & value & value & \multirow{3}{*}{\begin{minipage}{15cm}pretty long description that wraps over more than two lines pretty long description that wraps over more than two linespretty long description that wraps over more than two linespretty long description that wraps over more than two linespretty long description that wraps over more than two lines\end{minipage}} \\
        & value & value & value & \\ \hline 
        \end{tabular}   
        \captionof{table}{caption caption caption}
        \end{landscape}
\end{document}
  • Please make your example compilable. – TeXnician Mar 17 '17 at 18:28
2

multirow doesn't automatically extend the spanned rows, so if the spanning entry is larger than the rest of the table you need to add some space by using \[..]

enter image description here

   \documentclass[12pt,a4paper,titlepage]{article}
    \usepackage{rotating}
        \usepackage{multirow}
        \usepackage{lscape}
        \usepackage{caption}
        \begin{document}
        \begin{landscape} 
        \captionsetup{format=plain} 
        \centering 
        \begin{tabular}{c|c c c |p{\linewidth}}     
          \multirow{3}{*}{} & \multicolumn{3}{c|}{Range of} & 
\multirow{2}{*}{} \\[10pt] 
                            & parameter1 & param 2 & param 3 &  \\[10pt]
 \hline   
          \multirow{2}{*}{1}  &value & value & value & 

  \multirow{3}{15cm}{pretty long description that
 wraps over more than two lines pretty long description 
that wraps over more than two linespretty long description 
that wraps over more than two linespretty long description 
that wraps over more than two linespretty long description 
that wraps over more than two lines} \\[20pt]


                            & value & value & value & \\[10pt]
 \hline 
        \end{tabular}   
        \captionof{table}{caption caption caption}
        \end{landscape}
\end{document}

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.