3

I'm trying to make a table with some subfigures in it, and for the moment I obtained this (showframe activated): enter image description here

But I'd like to obtain something like this, where the legend is vertically centered in the multirow on the left (modified it with paint): enter image description here

I didn't find a solution online, and some people even say it's impossible with \multirow :/. Could anyone help me? Here's my code:

\documentclass[11pt, oneside]{Thesis} % The default font size and one-sided printing (no margin offsets)

\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored

\usepackage[T1]{fontenc}
\usepackage{mathtools}  % loads »amsmath«
\usepackage{amsmath}
\usepackage{physics}
\usepackage{float}
\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage[english]{babel}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{showframe} % for demo
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{lua-visual-debug}
\usepackage{multirow}
\usepackage{graphicx} 
\usepackage{caption} 
\usepackage{subcaption}
\usepackage[square, numbers, comma, sort&compress]{natbib} 
\usepackage{booktabs}
%\usepackage[table,xcdraw]{xcolor}

\hypersetup{urlcolor=blue, colorlinks=true} % Colors hyperlinks in blue - change to black if annoying
\title{\ttitle} % Defines the thesis title - don't touch this

\begin{document}

\begin{table}[H]
\centering
\begin{tabular}{l c c}
\multirow{2}{*}{
    \begin{subfigure}[m{2cm}]{0.1\textwidth}
    \includegraphics[height=8cm]{legend_u}
    \end{subfigure} 
    }
& \begin{subfigure}[t]{0.4\textwidth}
    \caption*{k-$\varepsilon$ RNG}
    \includegraphics[height=8cm]{keRNG_u}
  \end{subfigure} 
& \begin{subfigure}[t]{0.4\textwidth}
    \caption*{k-$\varepsilon$ Realizable}
    \includegraphics[height=8cm]{keReal_u}
  \end{subfigure} \\
& \begin{subfigure}[t]{0.4\textwidth}
    \caption*{k-$\omega$ SST}
    \includegraphics[height=8cm]{koSST_u}
  \end{subfigure} 
& \begin{subfigure}[t]{0.4\textwidth}
    \caption*{LES}
    \includegraphics[height=8cm]{LES_u}
  \end{subfigure}
\end{tabular}
\end{table}

\end{document}  
1
  • what is \vspace{<dimen>} to push the legend down.... and includegraphics width and height are specified? it works for me.
    – doed
    Commented Sep 10, 2015 at 14:26

2 Answers 2

3

Main obstacle to vertical position picture included in multirow is parameter [t] in subfigure environments. It move their anchors, which multirow consider as rows, on the top of table row.

Removing all unnecessary content of your MWE and use example-image from package graphicx from code below

\documentclass[11pt]{article}
    \usepackage{array,booktabs,multirow,tabularx}

    \usepackage{graphicx}
    \usepackage{caption}
    \usepackage{subcaption}

    \usepackage{showframe} % for demo

\begin{document}
    \begin{table}[h]
\centering
\begin{tabularx}{\textwidth}{c*{2}{>{\centering\arraybackslash}X}@{}}
\multirow{2}{*}{\includegraphics[width=1cm,height=8cm]{example-image}}
&   \begin{subfigure}{\hsize}
        \caption*{k-$\varepsilon$ RNG}
        \includegraphics[width=\hsize,height=8cm]{example-image}
    \medskip
    \end{subfigure}
    &   \begin{subfigure}{\hsize}
            \caption*{k-$\varepsilon$ Realizable}
            \includegraphics[width=\hsize,height=8cm]{example-image}
    \medskip
        \end{subfigure}     
        \\
&   \begin{subfigure}{\hsize}
       \caption*{k-$\omega$ SST}
        \includegraphics[width=\hsize,height=8cm]{example-image}
    \end{subfigure}
    &   \begin{subfigure}{\hsize}
            \caption*{LES}
            \includegraphics[width=\hsize,height=8cm]{example-image}
        \end{subfigure}
\end{tabularx}
    \end{table}
\end{document}

I obtain:

enter image description here

For picture size with preserved aspect ratio you need to determine only width of picture, i.e.: \includegraphics[width=\hsize]{<real picture>}

2
  • Thanks :D! Your code works perfectly (even though I'm not entirely sure why, but it works :p).
    – Romain
    Commented Aug 8, 2015 at 14:38
  • In my answer I try to explain why it works. Essentially my MWE differ from yours in two details: (i) I remove option[t] in subcaption (which is responsible for vertical centering) and (ii) I use tabularx instead tabular (which allow to write more concise code). If you like my answer, then please fill free to up vote or even accept it :)
    – Zarko
    Commented Aug 8, 2015 at 16:08
2

No need for \multirow: these are two different tables. Note that the [H] option is usually the bad thing to do; in this case it's completely useless, as this will be a page float anyway.

\documentclass[11pt]{article}

\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\usepackage{showframe} % for demo

\begin{document}

\begin{table}
\centering

\begin{tabular}{@{}c@{}}% for centering
\includegraphics[width=0.1\textwidth,height=8cm]{example-image-9x16}
\end{tabular}
\begin{tabular}{@{}cc@{}}
  \begin{subfigure}{0.4\textwidth}
  \caption*{k-$\varepsilon$ RNG}
  \includegraphics[width=\textwidth,height=8cm]{example-image-9x16}
  \end{subfigure}
&
  \begin{subfigure}{0.4\textwidth}
  \caption*{k-$\varepsilon$ Realizable}
  \includegraphics[width=\textwidth,height=8cm]{example-image-9x16}
  \end{subfigure}
\\
\\
  \begin{subfigure}{0.4\textwidth}
  \caption*{k-$\omega$ SST}
  \includegraphics[width=\textwidth,height=8cm]{example-image-9x16}
  \end{subfigure}
&
  \begin{subfigure}{0.4\textwidth}
  \caption*{LES}
  \includegraphics[width=\textwidth,height=8cm]{example-image-9x16}
  \end{subfigure}
\end{tabular}

\end{table}

\end{document}

I added height=8cm just to distort the available images and make them similar to yours; of course you'll not add it.

enter image description here

You must log in to answer this question.

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