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.

One of my figures should not have a caption, only the normal numbering. To get this, I use this code:

\begin{wrapfigure}{l}{4cm}
  \begin{center}
    \includegraphics[width=3cm]{graphic.pdf}
    \caption[Caption for the list of figures]{}
    \label{fig:figureX}
  \end{center}
\end{wrapfigure}

But now I get "Figure x.y:" as caption of my figure. How can I remove the ":", if the caption is empty? I found some solutions with renewcommand, but this changes the caption style in the whole document. I want to remove the colon only if the caption is empty. In any other case, it is good to have "Figure x.y: My Caption".

share|improve this question
    
Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. –  Martin Scharrer May 8 '11 at 10:36
2  
I thought that it would be more polite to say "thank you" explicitly... –  strauberry May 8 '11 at 10:53
2  
yes, that's a reasonable assumption, but we're all "old friends" here (including you) so we save a bit of time, space, and life-keystrokes by taking the politeness as a given... Welcome. –  Brent.Longborough May 8 '11 at 11:07
add comment

2 Answers 2

up vote 23 down vote accepted

Just loading the caption package should solve this. It makes the colon a proper "separator", i.e. it only appears when there is something to separate.

\documentclass{article}
\usepackage{wrapfig}
\usepackage[demo]{graphicx}
\usepackage{caption}

\begin{document}
\begin{wrapfigure}{l}{4cm}
  \begin{center}
    \includegraphics[width=3cm]{graphic.pdf}
    \caption[Caption for the list of figures]{}
    \label{fig:figureX}
  \end{center}
\end{wrapfigure}
\begin{wrapfigure}{l}{4cm}
  \begin{center}
    \includegraphics[width=3cm]{graphic.pdf}
    \caption[Caption for the list of figures]{With caption}
    \label{fig:figureX}
  \end{center}
\end{wrapfigure}
\end{document}

figures

share|improve this answer
    
Thank you very much for this answer, it is working perfectly! I'll accept the answer as soon as I am allowed to do so :-) (5 minutes rule...) –  strauberry May 8 '11 at 10:30
add comment

found some solutions with renewcommand, but this changes the caption style in the whole document.

you can use the solution local (inside the wrapfigure environment)

You don't present a working minimal example. So we don't know any packages or the class in your document.

share|improve this answer
    
Thank you for the hint with the local option! I guessed that there is some trick, but I didn't think that it is that easy :-) Sorry for the lack of a minimal example! I had provided one if no answers were be given ;-) (Damn, conjuctive in the past... not easy ^^) –  strauberry May 8 '11 at 10:29
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.