1

I am trying to arange four images in a 2 by 2 grid. The caption of the entire figure (not the subfigure) should appear on the right side and not on the bottom. I tried using the caption and subcaption package and minipages and came up with this code:

\begin{figure*}[t!]
    \centering 

    \begin{minipage}[l]{0.7\textwidth}
        \begin{subfigure}{.33\linewidth}
            \centering
            \fakeimage
            \caption{Colum 1}\label{fig:image1}
        \end{subfigure}
        \begin{subfigure}{.33\linewidth}
            \centering
            \fakeimage
            \caption{Colum 2}\label{fig:image2}
        \end{subfigure}

        \bigskip
        \begin{subfigure}{.33\linewidth}
            \centering
            \fakeimage
        \end{subfigure}
        \begin{subfigure}{.33\linewidth}
            \centering
            \fakeimage
        \end{subfigure}
    \end{minipage}

    \begin{minipage}[r]{.10\textwidth}
        \centering
         \caption{This is the caption for all four images.}
     \end{minipage}
\end{figure*}

Sadly, the caption does not appear right to the images but under the bottom right image. How can I fix this?

2

1 Answer 1

1

The main cause of your problem is the empty line between the first ...\end{minipage} and the second \begin{minipage}.... You should remove it.

However, there are problems with your code:

  1. For minipage, there are no options l or r. There are only t (top aligned), c (vertically center aligned) and b (bottom aligned).
  2. Why are you creating a 70% column for your four figures while only 10% for you caption on the right?
  3. Meanwhile, within your 70% column, each figure only takes up 33% of the width. Why?

I propose the following solution. Note the use of the comment character %.

\documentclass[a4paper]{article}

\usepackage{graphicx}
\newcommand*\fakeimage{\includegraphics[width=\linewidth]{example-image}}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure*}
    \centering
    \begin{minipage}[t]{0.7\linewidth}
        \begin{subfigure}{0.48\linewidth}
            \centering
            \fakeimage
            \caption{Colum 1}\label{fig:image1}
        \end{subfigure}% <- don't forget this %
        \hfill
        \begin{subfigure}{0.48\linewidth}
            \centering
            \fakeimage
            \caption{Colum 2}\label{fig:image2}
        \end{subfigure}

        \begin{subfigure}{0.48\linewidth}
            \centering
            \fakeimage
            \caption{Colum 1}\label{fig:image3}
        \end{subfigure}% <- don't forget this %
        \hfill
        \begin{subfigure}{0.48\linewidth}
            \centering
            \fakeimage
            \caption{Colum 2}\label{fig:image4}
        \end{subfigure}
    \end{minipage}% <- don't forget this %
    \hfill
    \begin{minipage}[b]{0.27\linewidth}
        \caption{This is the caption for all four images.}
    \end{minipage}
\end{figure*}

\end{document}

caption to the right

The above should not be consider as a good practice. To me, it seems like you are looking for a format that places figure caption in the “margin note” position.

3
  • I would like this use this to show two pairs of related images (first and second row of my example) to the reader. Each of the figures should span ~33% of the page's width to show the content correctly. To save some space, I'd like to position the caption of the entire figure not below the four images, but in the "third" empty column. Do you still consider this as bad practice?
    – zimmerrol
    Aug 25, 2018 at 7:27
  • @FlashTek I see. 1. The problem with your intended “33%”: By using 0.33\linewidth, you end up with 0.7*0.33=23.1% of the text width, since \linewidth represents the current column width. So perhaps you want to use 0.33\textwidth. My solution produces 0.7*0.48=33.6% of the text width (what a coincidence) so mine actually fits your need. 2. When I said “not a good practice”, I was referring to how “side-note caption” is achieved. I believe you’d want a uniform look for all your figure captions (on the right). This post may be helpful. Aug 25, 2018 at 17:31
  • @FlashTek P.S. The minipage method is mentioned in that post, but you can read from the comments below that answer to find out vertical alignment is tricky. Note how I used [t] for the four images while using [b] for the caption in my answer. Aug 25, 2018 at 17:39

You must log in to answer this question.

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