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 followed the instructions here to make subfigures http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Subfloats

However there were no space between the figure and I got double brackets for the captions. I cannot find any instruction on the Internet. I hope anyone can help me here.

My code is like this

\begin{figure}[H]
  \centering
  \subfloat[a]{\label{fig:a}\includegraphics[width=.5\textwidth,height=15em]{appendix/1.jpg}}
  \subfloat[b]{\label{fig:b}\includegraphics[height=15em]{solution.jpg}}     
  \caption[The short caption]{The long caption}
  \label{fig:preparation}
\end{figure}

------- Update --------

Problem solved! For the spacing I used \qquad and for double brackets, I found out that I have both packages subfigure and subfig enabled. I deleted package subfigure then I get single brackets as expected.

Thank you all for helping me solve this problem!

share|improve this question
    
where do you get this? In the actual caption, when referring? Try to be a little more specific and add a minimal working example illustrating the problem. –  Roelof Spijker Oct 17 '11 at 11:16
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. Also, you are linking to the Wrap text around figures section, which looks like a mistake to me. –  Martin Scharrer Oct 17 '11 at 11:29
    
Thank you @wh1t3! I've updated my question with my codes. Hope it looks fine this time. –  clarezoe Oct 17 '11 at 12:20
    
Maybe the width and height options interfere with the subfig package? Try to remove them, and then maybe add \hfill between the two figures. –  Dror Oct 17 '11 at 12:29
    
I am affraid I still don't see the issue. When I compile your code (after changing textwidth to \textwidth and adding graphicx with the demo option (since I don't have your pictures) I get the following output: i.imgur.com/BwUIV.png , which seems fine to me. If there is a problem there, can you explain what it is? If not, there is a problem on your end that the example does not illustrate. –  Roelof Spijker Oct 17 '11 at 12:35
show 3 more comments

2 Answers

The syntax of the subfloat command is

\subfloat[list-of-floats-caption][subcaption]{body}

The subcaption part is not used for the numbering of the subcaptions (which is done automatically). You should only use the first optional argument if you need a different caption inside the list of floats.

So to get just (a) and (b) you should use:

\subfloat[]{\label{fig:a}\includegraphics[width=.5textwidth,height=15em]{appendix/1.jpg}}

You need to insert space manually between the two \subfloat commands. You can do this with \qquad or any other horizontal spacing command such as \hfil or \hspace{}.

Here's a minimal example to show what I did. (In future, you should ask your questions by providing an full example like this instead of just a fragment.) Your "double" brackets are coming from somewhere else.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\begin{document}

\begin{figure}[H]
  \centering
  \subfloat[A sub caption]{\label{fig:a}\includegraphics[width=.2\textwidth,height=15em]{appendix/1.jpg}}
  \qquad
  \subfloat[A sub caption]{\label{fig:b}\includegraphics[width=.2\textwidth,height=15em]{solution.jpg}}     
  \caption[The short caption]{The long caption}
  \label{fig:preparation}
\end{figure}

\end{document}

output of code

share|improve this answer
    
Thank you @alan-munn! For the subcption, a and b I used are for captions which will be replaced by other texts. But I still get the double brackets ((a)) Caption a and ((b)) Caption b. –  clarezoe Oct 17 '11 at 12:58
    
Thank you for your demonstration. What do you mean by "full example"? Do you mean I should use \documentclass{aricle}... and \usepackage as well? The code I've provided is pretty much I have, and others are not relevant. –  clarezoe Oct 17 '11 at 13:31
    
@clarezoe Yes. Clearly some of the other code is relevant, since my example has no extra brackets and yours does. By providing a complete document (with all the unnecessary stuff removed) it's easier for someone here to just compile your example rather than have to make their own. The process of doing so can also solve your problem as it seems to have. How were we to know that you were loading both the subfig and subfigure packages without a complete example? –  Alan Munn Oct 17 '11 at 16:21
    
by "other codes" I meant the package setting, and other chapters, maybe the complete code you mean should be everything that can reproduce the problem. This was my first time posting a questions here and it was very urgent I didn't have time to read all the details and rules. I apologies for that. For subfigure is included in the template I'm using and it was in a separate file which was rather difficult to find out. Thanks you again for your kind help and patience. I will definitely do better next time :) –  clarezoe Oct 19 '11 at 9:25
    
@Clarezoe There's no need to apologize. And, yes, I meant the smallest code that could reproduce the problem, not your entire source document. Welcome to the site, and please don't take my comments as enforcing "the rules". There aren't really any rules, but questions with minimal examples will likely get faster and more accurate responses than those that post only fragments. And you'll find that we're a pretty friendly bunch here. –  Alan Munn Oct 19 '11 at 15:11
show 1 more comment

I had the same problem. The way to get rid of the double brackets and turn ((a)) into (a) is to simply include the subcaption package.

\usepackage{subcaption}
share|improve this answer
add comment

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.