Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to place two (or more) figures with side by side. The figures are independent, so need separate captions, with no overall caption for the two. I know how to do this with minipages within a figure environment. But the captions don't line up without trail and error \vspace's before the individual captions. Is there a way to line up the captions automatically?

share|improve this question

3 Answers 3

You could use the optional argument b to the minipage environments to align the images at their bottom, this way the caption would be side by side. At least you did'nt say if you want the images aligned in another way. Though, a common baseline at their bottom would be good, especially as their captions are aligned.

Here's an example using the caption package:

\documentclass{article}
\usepackage[labelfont=bf]{caption}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[ht]
\begin{minipage}[b]{.4\linewidth}
\centering%
\includegraphics[width=140pt]{test}
\captionof{figure}{First image}
\end{minipage}%
\hfill%
\begin{minipage}[b]{.5\linewidth}
\centering%
\includegraphics[width=180pt,height=50pt]{test}
\captionof{figure}{Second image with caption}
\end{minipage}
\end{figure}
\begin{figure}[ht]
\centering%
\includegraphics{test}
\caption{Another figure}
\end{figure}
\end{document}

Output:

alt text

Using the tiny capt-of package would be sufficient. The \captionof command is important. As you can see, the numbering of the subfigures matches the numbering of normal figures.

share|improve this answer
    
Is there a reason to use a minipage here rather than \parbox? minipage seems unnecessary for almost every problem. –  TH. Nov 27 '10 at 17:51
    
I have been using the KOMA-script bundle for caption control, and have been having trouble controlling the width of the captions in side-by-side figures. But I find I can change the caption width before side-by-side cases, as here, and then return it to normal: \setcapwidth[c]{.4\textwidth} ... \setcapwidth[c]{.7\textwidth}. It looks good. –  brannerchinese Aug 29 '12 at 0:58

Would subfigure (omitting the caption argument and only using subcaptions) solve your problem? (See this example)

EDIT: Subfigure has apparently been replaced by subfig.

share|improve this answer

Use the floatrow package, particularly its floatrow environment and \ffigbox command.

\documentclass{article}

\usepackage[format=hang]{caption}

\usepackage{floatrow}

\begin{document}

\begin{figure}
\begin{floatrow}
\ffigbox{%
  \rule{3cm}{3cm}%
}{%
  \caption{A figure}%
}
\ffigbox{%
  \rule{2cm}{2cm}%
}{%
  \caption{Another figure with a long caption}%
}
\end{floatrow}
\end{figure}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.