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.

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.

share|improve this question
    
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

1 Answer 1

up vote 9 down vote accepted

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
share|improve this answer
    
Horay =) hit 1000 mark with this answer ;-) –  Dima Aug 29 '10 at 22:34
    
Ah, I understand my mistake. Thanks, Dima. –  wishihadabettername Aug 29 '10 at 23:45

Your Answer

 
discard

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

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