Figures in Latex

  • Thread starter Juggler123
  • Start date
  • #1
Juggler123
83
0
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
7,002
297
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!
 

Suggested for: Figures in Latex

  • Last Post
Replies
3
Views
35K
  • Last Post
Replies
6
Views
3K
  • Last Post
Replies
4
Views
40K
  • Last Post
Replies
11
Views
14K
  • Last Post
Replies
6
Views
17K
  • Last Post
Replies
2
Views
85K
  • Last Post
Replies
5
Views
23K
  • Last Post
Replies
2
Views
14K
  • Last Post
Replies
6
Views
44K
Replies
1
Views
20K
Top