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}
1
  • Please make your example compilable.
    – TeXnician
    Commented Mar 17, 2017 at 18:28

1 Answer 1

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .