1

This question already has an answer here:

When I use subfig package to have two images in one figure the marker (a) stays bottom aligned with (b) but the image is not centred vertically (Figure 1). When I use minipage command to have two images in one figure the marker (a) doesn't stays bottom aligned with (b) but the image is centred vertically (Figure 2).

How can I have the image centred vertically and have the marker remain aligned with the other marker?

\documentclass{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{subfig}
\usepackage{caption}
\begin{document}

\begin{figure}
    \centering
    \begin{tabular}{cc}
        \subfloat[]{\includegraphics[trim=0cm 0cm 0cm 0cm, clip=true, width = 0.45\textwidth, frame]{latexlogo}} \hspace*{0.5em}
        \subfloat[]{\includegraphics[trim=0cm 0.2cm 0cm 0.2cm, clip=true, width = 0.45\textwidth, frame]{latexlogosmall}}
    \end{tabular}
    \caption{}
\end{figure}

\begin{figure}
        \centering
        \subfloat[]{%
        \begin{minipage}[c]{0.45\textwidth}%
        \includegraphics[trim=0cm 0cm 0cm 0cm, clip=true, width = 1\textwidth, frame]{latexlogo}%
        \end{minipage}} \hspace*{0.5em}
        \subfloat[]{%
        \begin{minipage}[c]{0.45\textwidth}%
        \includegraphics[trim=0cm 0.2cm 0cm 0.2cm, clip=true, width = 1\textwidth, frame]{latexlogosmall}%
        \end{minipage}}
        \caption{}
\end{figure}

\end{document}

Figure 1 and 2 Edit: I am aware that I could alter the code of Figure 2 to:

\begin{figure}
        \centering
        \subfloat[]{%
        \begin{minipage}[c][0.55\width]{0.45\textwidth}%
        \includegraphics[trim=0cm 0cm 0cm 0cm, clip=true, width = 1\textwidth, frame]{latexlogo}%
        \end{minipage}} \hspace*{0.5em}
        \subfloat[]{%
        \begin{minipage}[c][0.55\width]{0.45\textwidth}%
        \includegraphics[trim=0cm 0.2cm 0cm 0.2cm, clip=true, width = 1\textwidth, frame]{latexlogosmall}%
        \end{minipage}}
        \caption{}
\end{figure}

This doesn't really answer the question as I would need to edit the \width parameter for every figure.

marked as duplicate by Werner, darthbith, Reinstate Monica - M. Schröder, user13907, adn May 11 '15 at 19:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

You could try floatrow:

\documentclass[12pt]{article}

\usepackage{caption,floatrow}

\DeclareCaptionSubType[alph]{figure}
\captionsetup[figure]{labelsep=colon}
\captionsetup[subfigure]{labelformat=brace,labelsep=space,labelfont=bf}
\floatsetup[subfigure]{capposition=bottom,heightadjust=all,valign=c}

\begin{document}
\begin{figure}[htp]
  \ffigbox[\FBwidth]
  {\begin{subfloatrow}
      \ffigbox
        {\caption{First subfigure}}%
        {\rule{3cm}{3cm}}

        \ffigbox
        {\caption{Second subfigure with more Text so we have a line break}}%
        {\rule{1.5cm}{1.5cm}}
  \end{subfloatrow}}
  {\caption{Two figures}}
\end{figure}
\end{document}

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.