2

I have a figure that contains two images side by side. I want the first to be Figure 1 and the second image to be Figure 2. I'd like to have the caption written beneath both of them.

\begin{figure}[h]
  \centering
  \includegraphics[scale=1]{discussionfig1}
  \includegraphics[scale=1]{discussionfig2}
  \caption{}
  \caption{}
\end{figure}

This is what I have right now.

  • Are they equally sized images? Both vertically and horizontally? – Werner May 1 '15 at 19:20
1

In essence you need to place each of the elements in a block. This can be achieved either via a tabular, or via a minipage (other options also exist). Below I've used a set of minipages:

enter image description here

\documentclass{article}
\usepackage{graphicx}
\begin{document}

\begin{figure}
  \begin{minipage}[b]{.45\textwidth}
    \centering
    \includegraphics[width=.8\linewidth]{example-image-a}
    \caption{Some caption that is associated with the left figure.}
  \end{minipage}\hfill
  \begin{minipage}[b]{.45\textwidth}
    \centering
    \includegraphics[width=.7\linewidth]{example-image-b}
    \caption{Some caption that is associated with the right figure.}
  \end{minipage}
\end{figure}

\end{document}

Each minipage is aligned at the [b]ottom so that different-sized images (vertically) still have their captions aligned as expected. Of course, you can adjust this.

The width of the minipages are set to .45\textwidth, totalling 90% of the text block width. The remaining 10% is \hfilled to provide some gap between the captions (this necessarily pushes both boxes flush left/right with the text block). Again, you can adjust this to suit your needs.

|improve this answer|||||
0

Use the floatrow package for that:

\documentclass[]{report}
\usepackage[a4paper,showframe]{geometry}
\usepackage{subcaption}
\usepackage{lipsum}
\usepackage[demo]{graphicx}
\usepackage{floatrow}

\begin{document}

\vspace*{4ex}
\begin{figure}[!htb]
\begin{floatrow}[2]\
\ffigbox{\caption{discussion1} \label{fig:discussion1}}%
{\includegraphics[width=0.4\textwidth]{discussionfig1}}
%
%%%%%%
\ffigbox{\caption{discussion2}\label{fig:discussion2}}%
{\includegraphics[width=0.3\textwidth]{discussionfig1}}

\end{floatrow}
\end{figure}%

\end{document} 

enter image description here

|improve this answer|||||

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.