3

I wrote the following table using multirow

enter image description here

Although as far as I know multirow should automatically do the vertical alignment, for me this happens only as long as I don't include pictures. What I am trying to do is the vertical centering of the content of the cells in the first column. Does anyone have any advice on how to solve this issue? The code is the following

\documentclass{article}
\usepackage{amsmath}
\usepackage{multirow,graphics,graphicx}
usepackage{booktabs}
\usepackage{array}

\begin{document}
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{c|m{1.5cm}m{2cm}l} 
MR & GS & Typ & Sym \\ \hline
\multirow{4}*{ 1} & \includegraphics[width=1cm, height=1cm]{F1} & Tria&                        \\  
               & \includegraphics[width=1cm, height=1cm]{F1} & Obl           &            \\ 
                   & \includegraphics[width=1cm, height=1cm]{F1} & Sq            &            \\                    & \includegraphics[width=1cm,     height=1cm]{F1} & Rec   &            \\ \hline
\multirow{2}{*}{2} & \includegraphics[width=1cm, height=1cm]{F1} &     SqSnSq       &            \\ 
                   & \includegraphics[width=1cm, height=1cm]{F1} &     TrHex     &            \\ \hline
\multirow{2}{*}{3} & \includegraphics[width=1cm, height=1cm]{F1} &     TrKag        &            \\ 
                   & \includegraphics[width=1cm, height=1cm]{F1} &     RecShSq&            \\ 
\hline  
\end{tabular}
\end{table}

\end{document} 
  • See 3.8 Dealing with tall entries in the documentation of multirow. – Ulrike Fischer Apr 28 '17 at 22:20
3

I think it's easier not to use multirow and just use a nested tabular to the right, as tabular are vertically centred by default.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{multirow,graphics,graphicx}
\usepackage{booktabs}
\usepackage{array}

\begin{document}
\begin{table}
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{c|l} 
MR & 
\begin{tabular}[t]{@{}p{1cm}p{2cm}p{2cm}@{}}GS & Typ & Sym\end{tabular}
\\ \midrule
1 &
\begin{tabular}{@{}m{1cm}m{2cm}m{2cm}@{}}
 \includegraphics[width=1cm]{example-image} & Tria&                        \\  
 \includegraphics[width=1cm]{example-image} & Obl           &            \\ 
 \includegraphics[width=1cm]{example-image} & Sq            & \\
 \includegraphics[width=1cm]{example-image} & Rec   &  
\end{tabular}
    \\ \midrule
2 & 
\begin{tabular}{@{}m{1cm}m{2cm}m{2cm}@{}}
\includegraphics[width=1cm]{example-image} &     SqSnSq       &            \\ 
\includegraphics[width=1cm]{example-image} &     TrHex     & 
\end{tabular}
    \\ \midrule
3 &
\begin{tabular}{@{}m{1cm}m{2cm}m{2cm}@{}}
\includegraphics[width=1cm]{example-image} &     TrKag        &            \\ 
\includegraphics[width=1cm]{example-image} &     RecShSq&       
\end{tabular}
\\ \bottomrule 
\end{tabular}
\end{table}

\end{document} 
6

I don't know whether this is the best solution, but you could use the vpos and vmove optional parameters of the multirow commands, as seen below

Roughly:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{array}

\begin{document}
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{c|m{1.5cm}m{2cm}l} 
MR & GS & Typ & Sym \\ \hline
\multirow[c]{4}{*}[-1cm]{1} & \includegraphics[width=1cm, height=1cm]{imma}& Tria&\\ 
               & \includegraphics[width=1cm, height=1cm]{imma} & Obl&    \\ 
                   & \includegraphics[width=1cm, height=1cm]{imma} & Sq & \\                    & \includegraphics[width=1cm,     height=1cm]{imma} & Rec   &            \\ \hline
\multirow[c]{2}{*}[-0.4cm]{2} & \includegraphics[width=1cm, height=1cm]{imma} &     SqSnSq       &            \\ 
                   & \includegraphics[width=1cm, height=1cm]{imma} &     TrHex     &            \\ \hline
\multirow[c]{2}{*}[-0.4cm]{3} & \includegraphics[width=1cm, height=1cm]{imma} &     TrKag        &            \\ 
                   & \includegraphics[width=1cm, height=1cm]{imma} &     RecShSq&            \\ 
\hline  
\end{tabular}
\end{table}

\end{document} 

Yielding:

enter image description here

Basically the syntax you would use is \multirow[vpos]{x}{*}[-y]{T} where:

  • vpos is either b (bottom), c (centre), or t top

  • x is the number of columns to span

  • y is the vertical adjustment to insert. I put a minus before it because you have to move things down.

  • T is the text of your multirow.

ALSO please mark that graphics is superseded by graphicx thus is no more needed

3

Moriambar’s solution is good, under the assumption that \multirow should be used.

Here's a different solution, under the assumption that empty cells denote repetition of the value.

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage[export]{adjustbox}

\begin{document}

\begin{table}[htp]
\centering

\caption{My caption}
\label{my-label}

\begin{tabular}{ccll}
\toprule
MR & GS & Typ & Sym \\
\midrule
1 & \includegraphics[width=1cm,height=1cm,valign=c]{example-image} & Tria    &  \\
\addlinespace[2pt]
  & \includegraphics[width=1cm,height=1cm,valign=c]{example-image} & Obl     &  \\
\addlinespace[2pt]
  & \includegraphics[width=1cm,height=1cm,valign=c]{example-image} & Sq      &  \\
\addlinespace[2pt]
  & \includegraphics[width=1cm,height=1cm,valign=c]{example-image} & Rec     &  \\
\midrule
2 & \includegraphics[width=1cm,height=1cm,valign=c]{example-image} & SqSnSq  &  \\
\addlinespace[2pt]
  & \includegraphics[width=1cm,height=1cm,valign=c]{example-image} & TrHex   &  \\
\midrule
3 & \includegraphics[width=1cm,height=1cm,valign=c]{example-image} & TrKag   &  \\
\addlinespace[2pt]
  & \includegraphics[width=1cm,height=1cm,valign=c]{example-image} & RecShSq &  \\
\bottomrule
\end{tabular}

\end{table}

\end{document} 

enter image description here

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.