1

I need to get two figures side by side and I am using the following code:

\begin{figure} [H]
\centering
\begin{subfigure}{0.49\textwidth}
\centering
\includegraphics[width = \textwidth]{1e4}
\caption{Combined figure}
\label{fig:left}
\end{subfigure}
\begin{subfigure}{0.49\textwidth}
\centering
\includegraphics[width = \textwidth]{1e3}
\caption{Right figure}
\label{fig:right}
\end{subfigure}
\end{figure}

However, I need to caption each figure independently. How can this be done?

3
  • What do you mean with individually? Both have their own caption, right? Or do you want to replace the word subfigure with minipage to get 1 and 2 instead of a and b?
    – Johannes_B
    May 26, 2015 at 17:23
  • With subcaption package you can get it ...
    – juanuni
    May 26, 2015 at 17:24
  • No I need both having their own caption, eg: Figure 1 and Figure 2 May 26, 2015 at 17:35

2 Answers 2

1

You can use minipages inside the figure environment with a caption command for each figure:

\documentclass{article}
\usepackage{lmodern}
\usepackage{graphicx}

\begin{document}

As you can see in figs.~\ref{fig:left} and \ref{fig:right} \dots

\begin{figure}
\centering
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[width = \textwidth]{example-image-a}
\caption{Left figure}
\label{fig:left}
\end{minipage}
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[width = \textwidth]{example-image-b}
\caption{Right figure}
\label{fig:right}
\end{minipage}
\end{figure}
\end{document}

enter image description here

1

It's easy to do with the floatrow package, which is is dedicated to that, cooperates with the caption package:

\documentclass[a4paper, 11pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{floatrow}

\DeclareFloatVCode{rowsep}{\vskip 5ex}

\begin{document}



\begin{figure} [H]
  \centering\floatsetup{floatrowsep = qquad, rowpostcode = rowsep}
  \begin{floatrow}
    \ffigbox[\FBwidth]{\caption{For the Snarks were Boojums, you see…}\label{fig:left}}
    {\includegraphics[width = 0.48\textwidth]{snark.png}}
    %%%%
    \ffigbox[\FBwidth]{\caption{A Portrait of a distinguished author}\label{fig:right}}
    {\includegraphics[width = 0.48\textwidth]{Charles-Dodgson}}
  \end{floatrow}

\begin{floatrow}
\ffigbox[\FBwidth]
{\includegraphics[scale = 0.8]{sendak}}
{\caption{Where Wild Things are} \label{fig:Maurice}}
\ffigbox[\FBwidth]
{\includegraphics[scale = 0.5]{AliceSteadman}}
{\caption{Ralph} \label{fig:Wabbit}}
\end{floatrow}
\end{figure}

\end{document} 

enter image description here

2
  • thanks! and if I want four more rows for instance? May 26, 2015 at 18:45
  • One floatrow environment per row… (as long as they fit an the page). Take a look at the doc for setting parameters; there are many interesting examples, including mixing several types of floats, or beside caption. I'll add an example with two rows in a moment.
    – Bernard
    May 26, 2015 at 18:52

You must log in to answer this question.

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