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 am having some problems using sub-floats. I am trying to put two images side by side in the same row to avoid wasting space, for which I used sub-floats. However, they touch each other that it is hard to read their captions at first. See this output:

enter image description here

Any idea how to solve this problem?! Moreover, those figures are not really related to each other (although they are illustrating the same problem), so I think they should be figure 2.2 and 2.3 rather than 2.2a and 2.2b, right? If yes, how can I do that?!

EDIT: Here is the code I used to produce this:

\usepackage{graphicx}
\usepackage{cite}
\usepackage{subfig}

\begin{figure}
  \centering
  \subfloat
  [
  Halper et al. \cite{HHS01} pointed out that in a configuration like this, the
  hemicube method of Philips et al. \cite{PBG92} would fail to find the position
  P to avoid occlusion while shooting the target. Image taken from \cite{HHS01}.
  ]
  {
    \label{fig:halper1}
    \includegraphics[width=0.45\textwidth]{halper1}
  }
  \subfloat
  [
  Volumes of partial and total occlusion. Image taken from \cite{CN05}.
  ]
  {
    \label{fig:occlusion_cones}
    \includegraphics[width=0.45\textwidth]{occlusion_cones}
  }
  \caption{}
  \label{fig:halper1}
\end{figure}
share|improve this question
1  
Could you please provide a minimal working example? –  N.N. Jun 15 '11 at 9:50
    
OK, I included the exact code I used. –  Promather Jun 15 '11 at 9:53
    
A minimal example should generally be a complete document, including preamble, not just a snippet. That way we don't have to guess/search to find out which package(s) you have used. –  Torbjørn T. Jun 15 '11 at 9:59
    
I thought the subfloat in LaTeX is well known! Anyway, I updated the code. Thanks. –  Promather Jun 15 '11 at 10:03
4  
Well yes, I assumed that you used the subfig package, but it was more a general comment. Having a complete example helps those who want to help you, as we can just copy-paste the entire code and compile it. To nitpick a little more, your example is still not complete, as there is no \documentclass and no document environment. –  Torbjørn T. Jun 15 '11 at 10:09

2 Answers 2

up vote 5 down vote accepted

To increase the space between the captions of the subfloats, one way is to add margin=<length> as an option to the subfig package, e.g.

\usepackage[margin=10pt]{subfig}

But this adds the margin to both sides of the caption. The package has many options for customizing the caption in that way, see the manual.

If you do not want fig. 2.2a, 2.2b, but fig. 2.2, 2.3, you can use two minipages within the figure environment:

\begin{figure}
  \begin{minipage}{0.45\textwidth}
    \centering
    \includegraphics{a}
    \caption{Caption A}
  \end{minipage}\hfill
  \begin{minipage}{0.45\textwidth}
    \centering
    \includegraphics{b}
    \caption{Caption B}
  \end{minipage}\hfill
\end{figure}
share|improve this answer

put a \hfill between the images:

\begin{figure}
  \centering
  \subfloat
  [
  Halper et al. \cite{HHS01} pointed out that in a configuration like this, the
  hemicube method of Philips et al. \cite{PBG92} would fail to find the position
  P to avoid occlusion while shooting the target. Image taken from \cite{HHS01}.
  ]
  {
    \label{fig:halper1}
    \includegraphics[width=0.45\textwidth]{halper1}
  }\hfill%%%%%%%%%%%%%%%%%%%%%% <========
  \subfloat
  [
  Volumes of partial and total occlusion. Image taken from \cite{CN05}.
  ]
  {
    \label{fig:occlusion_cones}
    \includegraphics[width=0.45\textwidth]{occlusion_cones}
  }
  \caption{}
  \label{fig:halper1}
\end{figure}
share|improve this answer
    
Good solution. However, @Torbjorn's solution below seems to be more flexible, since the margin can be adjusted. –  Promather Jun 15 '11 at 10:35

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.