1

I have two figures that are side by side but I want to convert them into subfigures so that they come out as Figure 1a and Figure 1b instead of Figure 1 and Figure 2.

\begin{figure}
    \centering
    \begin{minipage}{0.5\textwidth}
        \centering
        \includegraphics[width=1.04\textwidth]{Figures/figure1.png} % first figure itself
        \caption{first figure}
    \end{minipage}\hfill
    \begin{minipage}{0.5\textwidth}
        \centering
        \includegraphics[width=1.04\textwidth]{Figures/figure2.png} % second figure itself
        \caption{second figure}
    \end{minipage}
\end{figure}

1 Answer 1

2

enter image description here

with use of the packagesubcaption is simple. just replace minipage with subfigure:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}
    \begin{subfigure}{0.45\textwidth}
        \includegraphics[width=\linewidth]{Figures/figure1.png} % first figure itself
        \caption{first figure}
        \label{fig:aubfig a}
    \end{subfigure}\hfill
    \begin{subfigure}{0.45\linewidth}
        \includegraphics[width=\linewidth]{Figures/figure2.png} % second figure itself
        \caption{second figure}
        \label{fig:aubfig b}
    \end{subfigure}
\caption{My sub-figures}
\label{fig:my subfigures}
\end{figure}
\end{document}

note: it is not good idea to prescribe image width bigger from space in minipage or in subfigure.

You must log in to answer this question.

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