4

I am trying to place the captions on the right side of each subfigures in Beamer. I'd like to be a 2*2 figure; in each subfigure its subcaption be on the right side of that subfigure with more text to explain that subfigure. Hence, it will be a figure with 4 subfigures and 4 subcaptions. Thanks.

Edited code after solution of @Mico's solution for more adjustment:

  \documentclass[demo]{beamer}
    \setbeamertemplate{caption}[numbered]% <-- added, for other option see beamer manual, page 124
    \usepackage{subcaption}

    \begin{document}
    \begin{frame}
    \begin{figure}

        \captionsetup[subfigure]{labelformat=empty}
         \begin{subfigure}{0.7\textwidth}
              \flushleft
              \begin{minipage}{0.5\linewidth}
                  \includegraphics[width=\textwidth]{Fig4}
              \end{minipage}
              \begin{minipage}{0.45\linewidth}
                  \caption{\tiny{Biological Networks: }}
                  \label{fig:BiologicalNetworks}
              \end{minipage}
          \end{subfigure}
    \hfill
         \begin{subfigure}{0.5\textwidth}
            \begin{minipage}{0.5\linewidth}
                \includegraphics[width=\textwidth]{Fig1}
            \end{minipage}
            \begin{minipage}{0.45\linewidth}
                 \caption{\tiny{Social Networks: }}
                 \label{fig:SocialNetworks}
            \end{minipage}
         \end{subfigure}

    \caption{Examples of graph data modelling}
    \label{fig:GraphModelling}
    \end{figure}

    \end{frame}
    \end{document}
  • 1
    Why don't you post a compilable example? You are leaving unnecessary work to the helpers. – Johannes_B Feb 12 '17 at 7:33
  • Thinking about it, you give the whole subfigure a width, give the actual image the width of the whole subfigure and expect omething to be next to it, meaning even wider? You need to explain better what you actually want. – Johannes_B Feb 12 '17 at 7:42
  • I edited the code. I'd like to be a 2*2 figure; in each subfigure its subcaption be on the right side of that subfigure with more text to explain that subfigure. Hence, it will be a figure with 4 subfigures and 4 subcaptions. – Amin Feb 12 '17 at 8:06
  • Why do you have \begin{subfigure}{0.7\textwidth} for the first subfigure? – Mico Feb 12 '17 at 10:47
  • 1
    @Stephen -- The width of the first subfigure is 0.7\textwidth, and that of the second is 0.5\textwidth. 0.7\textwidth+0.5\textwidth=1.2\textwidth right? So, how can they fit side by side? The answer, they can't fit... – Mico Feb 12 '17 at 12:25
5

If you want to place the captions of the subfigures to the right, rather than below, of the graphs, you need to encase the graphs and caption instructions in separate minipage environments -- and allow for the space taken up by the captions.

Judging by the look of the following screenshot, I don't think you're doing your readers a favor with this setup.

enter image description here

\documentclass[demo]{beamer}
\setbeamertemplate{caption}[numbered]% <-- added, for other option see beamer manual, page 124
\usepackage{subcaption}

\begin{document}
\begin{frame}
\begin{figure}

\begin{subfigure}{0.45\textwidth}
\begin{minipage}{0.5\linewidth}
\includegraphics[width=\textwidth]{Fig4}
\end{minipage}\hfill
\begin{minipage}{0.45\linewidth}
\caption{Social Networks}
\label{fig:SocialNetworks}
\end{minipage}
\end{subfigure}
\hfill
\begin{subfigure}{0.45\textwidth}
\begin{minipage}{0.5\linewidth}
\includegraphics[width=\textwidth]{Fig4}
\end{minipage}\hfill
\begin{minipage}{0.45\linewidth}
\caption{Energy Networks}
\label{fig:EnergyNetworks}
\end{minipage}
\end{subfigure}

\caption{Examples of graph data modelling}
\label{fig:GraphModelling}
\end{figure}

See image \ref{fig:SocialNetworks} in figure \ref{fig:GraphModelling}.
\end{frame}
\end{document}


Addendum: I would adapt your second code batch as follows:

enter image description here

\documentclass[demo]{beamer}
\setbeamertemplate{caption}[numbered]
\usepackage{subcaption,ragged2e}

\begin{document}
\begin{frame}[t] % <--- for top alignment
\begin{figure}
\captionsetup[subfigure]%
     {labelformat=empty,justification=RaggedRight}

\begin{subfigure}{0.475\textwidth}
\begin{minipage}{0.55\linewidth}
\includegraphics[width=\textwidth]{Fig4}
\end{minipage}\hfill
\begin{minipage}{0.42\linewidth}
\caption{\tiny Biological Networks: Agent based brain models for the resting state brain; Karen Joyce, Satoru Hayasaka and Paul Laurienti}
\label{fig:BiologicalNetworks}
\end{minipage}
\end{subfigure}%
\hfill % maximize space between the subfigures
\begin{subfigure}{0.475\textwidth}
\begin{minipage}{0.55\linewidth}
\includegraphics[width=\textwidth]{Fig1}
\end{minipage}\hfill
\begin{minipage}{0.42\linewidth}
\caption{\tiny Social Networks: Data: AER, JPE, Econometrica, RES, QJE (2000--present). By~Cloudly. From: www.cloudlychen.net (the higher level of connections with others)}
\label{fig:SocialNetworks}
\end{minipage}
\end{subfigure}

\caption{Examples of graph data modelling}
\label{fig:GraphModelling}
\end{figure}
A cross-reference to Figure \ref{fig:BiologicalNetworks}.
\end{frame}
\end{document}
  • Thanks @Mico. One more adjustment is that I would like to place the figure on the top of the page and left (no big margin from the above and sides); what should I do for that? – Amin Feb 12 '17 at 9:42
  • 1
    @Stephen - My code is set up to span the entire width of the textblock. Thus, no margin(s) from the sides. Does your code differ? To align the material of a frame along the top, use \begin{frame}[t]. I assume your code uses \begin{frame} -- no [t] positioning specifier. – Mico Feb 12 '17 at 9:50
  • I just edited the code above based on your solution; please kindly notice that I need to place those explanation in subcaptions. – Amin Feb 12 '17 at 9:55
  • @Stephen - I've posted an addendum to show how I would adjust your updated code. – Mico Feb 12 '17 at 10:23
  • 1
    @Stephen - As the second screenshot demonstrates, the left-hand graphic is not at center-right. Instead, is fully aligned to the left -- compare the left-hand edge of the graphic and the start of the sentence "A cross-reference to...". Isn't this what you're trying to achieve. If that's not what you're getting, it must be because your code differs in one or more places from mine. – Mico Feb 12 '17 at 10:44
5

with use of packages array, adjustbox and subcaption:

enter image description here

\documentclass[demo]{beamer}
\setbeamertemplate{caption}[numbered]
\usepackage[singlelinecheck=off]{subcaption}
\usepackage{array,booktabs}
\usepackage[export]{adjustbox}

\begin{document}
\begin{frame}
\begin{figure}
    \centering
    \begin{tabular}{@{}cm{0.2\linewidth} @{} c m{0.2\linewidth}@{}}
\includegraphics[width=0.3\linewidth,valign=m]{Fig4}
    &   \subcaption{Social Networks}
        \label{fig:Social Networks}
        &   \includegraphics[width=0.25\linewidth,valign=m]{Fig1}
            &   \subcaption{Energy Networks}
                \label{fig:Energy Networks}
    \\
\addlinespace
\includegraphics[width=0.3\linewidth,valign=m]{Fig2}
    &   \subcaption{Internet}
        \label{fig:Internet}
        &   \includegraphics[width=0.25\linewidth,valign=m]{Fig3}
            &   \subcaption{Internet}
                \label{fig:Biological Networks}
    \end{tabular}
    \caption{Examples of graph data modelling}
    \label{fig:graph modelling}
\end{figure}
See images \ref{fig:Social Networks}, \ref{fig:Energy Networks} and \ref{fig:Internet} in figure \ref{fig:graph modelling}.
\end{frame}
\end{document}

Addendum: According to last changes in question (from four images to 2, more text in sub captions) my answer can evolve into:

\documentclass[demo]{beamer}
\setbeamertemplate{caption}[numbered]
\usepackage[singlelinecheck=off, font=scriptsize]{subcaption}
\usepackage{array,booktabs}
\usepackage[export]{adjustbox}

\begin{document}
\begin{frame}
\begin{figure}
    \centering
\setlength\tabcolsep{2pt}
    \begin{tabular}{@{}cm{0.24\linewidth}  c m{0.25\linewidth}@{}}
\includegraphics[width=0.25\linewidth,valign=m]{Fig4}
    &   \subcaption{Biological Networks:\\
                    Agent based brain models for the resting state brain; Karen Joyce, Satoru Hayasaka and  Paul  Laurienti}
        \label{fig:Social Networks}
        &   \includegraphics[width=0.25\linewidth,valign=m]{Fig1}
            &   \subcaption{Data: AER, JPE, Econometrica, RES, QJE (2000 - present).                                 By Cloudly. From: www.cloudlychen.net (the higher level of connections with others)}
                \label{fig:Energy Networks}
    \end{tabular}
    \caption{Examples of graph data modelling}
    \label{fig:graph modelling}
\end{figure}
See images \ref{fig:Social Networks}, \ref{fig:Energy Networks} in figure \ref{fig:graph modelling}.
\end{frame}

\end{document}

Instead \tiny font size, which is (surprisingly) not supported in subcaption package, I use \scriptsize which I declare in options of th subcaption package. Also are reduced \tabcolsep and size of images. IN detemining size of images and sub caption are still considered default frame size (128mm x 96 mmm).

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.