4

The screenshot has the bottom part of a figure with two subfigures. As you can see, the labels have a very narrow width. I don't understand why.

\begin{figure}[htp]
  \centering
  \subfloat[Frequency Histogram]{}\includegraphics[width=2.75in,height=2.5in]{left-figure}
  \subfloat[Boxplots]{}\includegraphics[width=2.75in]{right-figure}
  \caption{The caption of the entire figure which displays fine but not shown here} 
  \label{whatever}
\end{figure}

alt text

What I am trying to achieve is the same layout as in this wikibook page (where the subfigure text fits on a line under each image).

Thanks ahead for the advice.

  • what if one of your figures is very thin and the subcaption therefore wraps every few letters - do you know a way around this? I tried using \mbox{subcaption} but then the subcaption doesn't line up with the index. Any ideas? Thanks! – user6987 Jul 30 '11 at 15:41
9

The layout is correct for the code you are using! i.e.

  1. centering
  2. Empty subfloat with a "subcaption"
  3. graphic
  4. Empty subfloat with a "subcaption"
  5. graphic
  6. caption

Anything that you want to appear as a subfloat needs to be enclosed in the

\subfloat[Optional TOC caption][Sub-caption]{subfloat body}

So for your example try ths:

\begin{figure}[htp]
  \centering
  \subfloat[Frequency Histogram]{\includegraphics[width=2.75in,height=2.5in]{left-figure}}
  \subfloat[Boxplots]{\includegraphics[width=2.75in]{right-figure}}
  \caption{The caption of the entire figure which displays fine but not shown here} 
  \label{whatever}
\end{figure}

This results in:

  1. centering
  2. Subfloat with a "subcaption"
    1. contents graphic
  3. Subfloat with a "subcaption"
    1. contents graphic
  4. caption

NB!

\subfloat { body } % correct
\subfloat {} body  % wrong

For more info & more examples see:

$texdoc subfig
  • Horay =) hit 1000 mark with this answer ;-) – Dima Aug 29 '10 at 22:34

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.