GeneralFigure captions

LaTeX specific issues not fitting into one of the other forums of this category.
elundale
Posts: 4
Joined: Wed Jun 06, 2007 12:09 pm

Figure captions

Post by elundale »

Hiya,

I have a problem with figures. I want to make numbered figures I can refer to but I don't want my figures to have captions except for the number. So the caption should be "Figure #".
Now I tried to use \caption{}, but that produces "Figure #:". So my question is basically: how do I get rid of the semicolon?
Thanks :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
countbela666
Posts: 64
Joined: Thu Apr 26, 2007 2:44 pm

Figure captions

Post by countbela666 »

Hi,

the package caption allows you to format captions of floating environments as you wish. The following code produces your specified result:

Code: Select all

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[labelsep=none]{caption}
\begin{document}
  \begin{figure}
    \centering
    \includegraphics{foo}
    \caption{}
  \end{figure}
\end{document}
Regards
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
elundale
Posts: 4
Joined: Wed Jun 06, 2007 12:09 pm

Re: Figure captions

Post by elundale »

Thanks for helping me!
It still doesn't seem to work though, I still get "Figure 1:" as caption instead of "Figure 1". :( Maybe I'm doing something wrong.
User avatar
countbela666
Posts: 64
Joined: Thu Apr 26, 2007 2:44 pm

Figure captions

Post by countbela666 »

I would be really suprised If you got this unpleasant result by compiling my minimal working example, so my first question is: did you compile my code without altering it and did you get any error messages or warnings? If your LaTeX installation is up-to-date this example is supposed to work.

If you just copied my code into a LaTeX document of your own, a package conflict could be the reason for the failure. In order to specify the "bad guy" you should shrink your own file down to a minimal working example (MWE).

Regards
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
elundale
Posts: 4
Joined: Wed Jun 06, 2007 12:09 pm

Figure captions

Post by elundale »

When compiling your code I got these errors:
! LaTeX Error: Unknown option `demo' for package `graphics'.
! LaTeX Error: Unknown option `labelsep=none' for package `caption'.
I use pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5)

When removing the options and using this code:

Code: Select all

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
  \begin{figure}
    \centering
    \includegraphics{DEMO/Figures/rain1}
    \caption{}
  \end{figure}
\end{document}
I get the semicolons again.
User avatar
countbela666
Posts: 64
Joined: Thu Apr 26, 2007 2:44 pm

Figure captions

Post by countbela666 »

These errors show that your LaTeX installation is not up-to-date. When using the command \listfiles before my code, you get a list of the included packages with their version numbers printed to the LOG file.

My list reads like this (last update was two weeks ago):

Code: Select all

 *File List*
 article.cls    2005/09/16 v1.4f Standard LaTeX document class
  size10.clo    2005/09/16 v1.4f Standard LaTeX file (size option)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
graphics.sty    2006/02/20 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2005/12/29 v1.2 MiKTeX 'graphics' configuration
  pdftex.def    2007/04/17 v0.04g Graphics/color for pdfTeX
 caption.sty    2007/04/16 v3.0q Customising captions (AR)
caption3.sty    2007/04/11 v3.0q caption3 kernel (AR)
supp-pdf.tex
 ***********
Especially your caption.sty and your graphics.sty seem to be too old. You should update your LaTeX installation and try again.

Regards
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
elundale
Posts: 4
Joined: Wed Jun 06, 2007 12:09 pm

Re: Figure captions

Post by elundale »

Ah, that must be the problem. My packages seem to be quite old. I can't download a new version where I am right now, but I will try at home this evening. Thank you so much for helping me!
dimarcom
Posts: 26
Joined: Wed Mar 05, 2008 11:03 am

xcolor package in conflict with fbox inside figure caption

Post by dimarcom »

Hi,

I ran into a stupid problem: i need to use an fbox in the caption of a figure, because that's my convention for describing buttons in a software. I also need to use the xcolor package, because i need those fboxes to be red or green or yellow sometimes.

The fboxes and fcolorboxes don't cause any problem if they are outside the captions of figures (i haven't tried in tables - yet), but if i put them inside a caption, LaTeX will compile only if i remove the \usepackage{xcolor}.

I put a bit of code below. I use TexnicCenter on Windows.
i just need the basic colors, maybe there is another package than xcolor i could use ?

Thanks for any help...
Marie.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt]{scrbook}
\usepackage{geometry}
\usepackage{graphicx}
%\usepackage{xcolor}

\begin{document}

\begin{figure}
\centering
\caption{\fbox{\mbox{\textsl Show param}}}
\end{figure}

\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Figure captions

Post by Stefan Kottwitz »

Hi Marie,

use \textsl with param: \textsl{Show param} otherwise only the next letter will be slanted.

The caption problem can be solved by using \protect:

Code: Select all

\caption{\protect\fbox{\mbox{\textsl{Show param}}}}
Stefan
Andre Smit
Posts: 6
Joined: Fri Apr 04, 2008 10:17 pm

Figure captions

Post by Andre Smit »

How would one capitalize the FIGURE or TABLE part of the caption only and not the label itself. For example:

FIGURE 1 This Is A Figure Caption

TIA
Post Reply