Inserting Figures in LaTeX: Removing "Figure 1"

  • Context: LaTeX 
  • Thread starter Thread starter Juggler123
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary
SUMMARY

This discussion addresses the issue of removing the "Figure 1:" label from captions in LaTeX figures. The solution involves redefining the \@makecaption macro to customize the output format. By inserting specific code before the \begin{document} command, users can modify the caption to display only the text without the figure number. This method is effective for achieving cleaner figure captions in LaTeX documents.

PREREQUISITES
  • Familiarity with LaTeX document structure
  • Understanding of LaTeX figure environment
  • Basic knowledge of LaTeX macros
  • Experience with LaTeX packages and customization
NEXT STEPS
  • Explore LaTeX package options for figure formatting
  • Learn about redefining LaTeX macros for custom outputs
  • Investigate additional LaTeX figure placement techniques
  • Study advanced LaTeX caption formatting options
USEFUL FOR

LaTeX users, document authors, and researchers looking to customize figure captions in their academic papers or presentations.

Juggler123
Messages
80
Reaction score
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.
 
Physics news on Phys.org
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!
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K