Figures in Latex

  • Thread starter Juggler123
  • Start date
  • #1
83
0

Main Question or Discussion Point

Hi I have a problem inserting figures into latex, if I write the following script;

\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{gull}
\caption{Close-up of a gull}
\label{gull}
\end{figure}

I get a picture of gull and underneath it says Figure 1: Close-up of a gull

That's fine but I need it to say JUST

Close-up of a gull

Is there anyway of getting rid of the "Figure 1:" part!?

Any help would be great. Thanks.
 

Answers and Replies

  • #2
AlephZero
Science Advisor
Homework Helper
6,994
291
There are probably some LaTex packages that let you do this cleanly, but the following works. Change the \@makecaption macro, which outputs the caption.

Put this code just before \begin{document}

Code:
\makeatletter
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#2}%
  \ifdim \wd\@tempboxa >\hsize
    #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\makeatother
The original version (in the book and article styles) had the lines
\sbox\@tempboxa{#1: #2}%
and
#1: #2\par

Parameter #1 is the figure number, #2 is the text of the caption.

If should be fairly obvious what the changes do to the output format. The rest of the code is to decide if the caption is short enough to fit on one line or needs a complete paragraph. If you only want to use LaTeX rather than understand it, just copy and paste!
 

Related Threads on Figures in Latex

  • Last Post
Replies
3
Views
3K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
5
Views
30K
  • Last Post
Replies
7
Views
13K
  • Last Post
Replies
7
Views
2K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
19
Views
4K
  • Last Post
Replies
1
Views
1K
Top