Inserting Figures in LaTeX: Removing "Figure 1"

  • LaTeX
  • Thread starter Juggler123
  • Start date
  • Tags
    Latex
In summary, the solution for removing the "Figure 1:" part in a LaTeX figure caption involves changing the \@makecaption macro and using the \makeatletter and \makeatother commands. This allows for a cleaner output without the figure number.
  • #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.
 
Physics news on Phys.org
  • #2
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 to Inserting Figures in LaTeX: Removing "Figure 1"

What is the purpose of inserting figures in LaTeX?

The purpose of inserting figures in LaTeX is to add visual aids to a document. Figures can include images, graphs, charts, or diagrams that help to clarify and enhance the information presented in the text.

How do I insert a figure in LaTeX?

To insert a figure in LaTeX, you need to use the \includegraphics command. This command requires the graphicx package, which can be added to your document's preamble with the \usepackage{graphicx} command. You can then specify the file path and name of the figure you want to insert.

How can I remove the "Figure 1" label from a figure in LaTeX?

To remove the "Figure 1" label from a figure in LaTeX, you can use the \caption* command instead of the \caption command. This will insert the figure without a label. Alternatively, you can use the \captionsetup{labelformat=empty} command in the preamble to remove all figure labels from your document.

Can I insert multiple figures in a single LaTeX document?

Yes, you can insert multiple figures in a single LaTeX document. To do this, you can use the \begin{figure} and \end{figure} commands to create separate figure environments for each figure. You can also use the \subfigure command to insert multiple figures within a single figure environment.

What is the best format for figures in LaTeX?

The best format for figures in LaTeX is PDF. This format supports high-quality graphics and can be easily inserted into a LaTeX document. Other acceptable formats for figures include PNG, JPG, and EPS. However, avoid using low-quality or compressed image formats, as they can result in a loss of resolution when inserted into a LaTeX document.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
4K
Back
Top