2

Example image of table caption's lineup

I got these three figures side-by-side. All of the figures are in different sizes and I got different number of lines of text in the caption for each of the figures. My problem is that I want all of the captions (first row of the captions, "Figure 1:", "Figure 2:", "Figure 3:") to be lined up horizontally. *I put in an example image.

I know that with tables I'am able to use [t] as table-captions are above the table, but figure-captions are below the figure and by that it suddenly becomes alot harder for me to solve the problem as I'm not able to use [b].

\begin{minipage}{\textwidth}
    \begin{minipage}{0.2\textwidth}
        \begin{figure}[H]
            \centering
            \includegraphics[width = 1\textwidth]{f01.jpg}
            \caption{Myyyy teeeexxxxt}
            \label{f04}
        \end{figure}
    \end{minipage}
    \hspace{0.02\textwidth}
    \begin{minipage}{0.35\textwidth}
        \begin{figure}[H]
            \centering
            \includegraphics[width = 1\textwidth]{f02.jpg}
            \caption{My texty texttext}
            \label{f01}
        \end{figure}
    \end{minipage}
    \hspace{0.02\textwidth}
    \begin{minipage}{0.35\textwidth}
        \begin{figure}[H]
            \centering
            \includegraphics[width = 1\textwidth]{f03.jpg}
            \caption{Textytex[![enter image description here][1]][1]t of my text which is text}
            \label{f03}
        \end{figure}
    \end{minipage}
\end{minipage}
2

Note that using a floating environment like figure inside a minibox environment does not make sense. The way around makes sense.

caption.sty provides an undocumented macro \captionbox which comes handy for your use case:

\documentclass[a4paper]{article}

\usepackage{caption,graphicx,geometry}
\geometry{showframe}

\begin{document}

\begin{figure}[t]
  \centering
  \rule{\textwidth}{2pt}\par
  \vspace{1ex}
  \fbox{%
    \captionbox{Some caption text which is not so
      long\label{fig:one}}[.45\textwidth][c]{%
      \includegraphics[width=.2\textwidth,keepaspectratio]{example-image-a}%
    }%
  }%
  \hfill
  \fbox{%
    \captionbox{Some caption text which is now longer and therefore
      has more text\label{fig:two}}[.45\textwidth][c]{%
      \includegraphics[width=.3\textwidth,keepaspectratio]{example-image-b}%
    }%
  }%
  \par\vspace{1ex}
  \rule{\textwidth}{2pt}
\end{figure}

\end{document}

enter image description here

1

Cheat! ;-)

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\begin{figure}[htp]
\centering

\begin{minipage}[b]{.45\textwidth}
\centering

\includegraphics[height=5cm,width=3cm]{example-image-a}

\begin{minipage}[t]{\textwidth}
\caption{This is a short caption on two lines}
\end{minipage}

\end{minipage}%
\hfill
\begin{minipage}[b]{.45\textwidth}
\centering

\includegraphics[height=3cm,width=3cm]{example-image-b}

\begin{minipage}[t]{\textwidth}
\caption{This is a long caption on three lines, I hope
this text suffices for the task at hand.}
\end{minipage}

\end{minipage}

\end{figure}

\end{document}

The minipage is bottom aligned, but its bottom is the top of the caption!

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.