3

This is exactly the same question. However, the answer does not include centering in case of even number of rows. Here is the same example. How can I place word Spring in the center between Model 2 and Model 4?

enter image description here

The code,

 \documentclass{report}
    \usepackage{array,booktabs}
    \newcommand{\bla}{blah blah blah blah blah blah blah blah}
    \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
    \begin{document}
    \begin{table}[ht]
      \centering
        \begin{tabular}{p{20mm}p{20mm}M{20mm}} \toprule
            Type   & Specs   & Uses \\ \midrule
            --     & Model 1 & \bla \\ \cmidrule{1-3}
            Spring & Model 2 & \bla \\ \cmidrule(l){2-3}
                   & Model 4 & \bla \\ \bottomrule
        \end{tabular}
    \end{table}
    \end{document}

Please if possible using tabular .

2 Answers 2

3

If you check the multirow documentation, you will find out that the basic syntax for \multirow is as follows:

\multirow[<vpos>]{<nrows>}[<bigstruts>]{<width>}[<vmove>]{<text>}

Of these arguments, the optional [<vmove>] can raise or lower the position of the text in the multi-row cell when the position is not calculated automatically. The details of all arguments are given in the documentation.

\documentclass{report}
    \usepackage{array,booktabs,multirow}
    \newcommand{\bla}{blah blah blah blah blah blah blah blah}
    \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
    \begin{document}
    \begin{table}[ht]
      \centering
        \begin{tabular}{p{20mm}p{20mm}M{20mm}} \toprule
            Type   & Specs   & Uses \\ \midrule
            --     & Model 1 & \bla \\ \cmidrule{1-3}
            \multirow{2}{*}[-2em]{Spring} & Model 2 & \bla \\ \cmidrule(l){2-3}
                   & Model 4 & \bla \\ \bottomrule
        \end{tabular}
    \end{table}
    \end{document}

enter image description here

4

Note that, with the last versions of multirow you can enter a non-integer number of lines instead of a number of rows, for rows which consist of several lines. Thus you can have a slightly simpler code:

\documentclass{report}
    \usepackage{array,booktabs,multirow}
    \newcommand{\bla}{blah blah blah blah blah blah blah blah}
    \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}

\begin{table}[!ht]
  \centering
    \begin{tabular}{p{20mm}p{20mm}M{20mm}} \toprule
        Type & Specs & Uses \\ \midrule
        -- & Model 1 & \bla \\ \cmidrule{1-3}
        \multirow{5.25}{*}{Spring} & Model 2 & \bla \\ \cmidrule(l){2-3}
               & Model 4 & \bla \\ \bottomrule
    \end{tabular}
\end{table}

\end{document}

enter image description here

You must log in to answer this question.

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