1

I would like to remove figure 1 from the caption under my figure but to have it in my list of figures. Is it possible?

With \caption[Entry for the List of Figures (LoF)]{}\label{fig:without} I can have the caption in my list of figures but I still have "Figure 1" under my figure and I would like to remove that.

3
  • Welcome to TeX.SX. It's not very clear why the caption shouldn't appear below the figure.
    – egreg
    Nov 10, 2012 at 21:46
  • 1
    Is it good to have a figure with list entry and without caption and number in the text? Anyway, you can do \refstepcounter{figure}\addcontentsline{lof}{figure}{\numberline{\thefigure}{Caption}} instead of \caption. It increments the figure counter and adds a line to \listoffigures. (\addcontentsline{lof}{figure}{\numberline{}{Caption}} without the number and without increasing the figure counter.) Nov 10, 2012 at 21:50
  • Thank you. What exactly is the \numberline and \thefigure?
    – xaud
    Nov 10, 2012 at 22:03

1 Answer 1

3

You can use the macro \addcontentsline to add a list entry to the List of Figures (or others).

It takes three arguments:

  1. the filename-extension of the list. (toc for Table of Contents, lof for Lists of Figures, lot for List of Tables, …)
  2. the structure level
    • toc: part, chapter, section, …
    • lof: figure
    • lot: table
  3. the entry itself. Mostly it is preceeded by \protect\numberline{…} whose argument is the number for the entry and it aligns the following text.

My code provides two three commands:

  • \nocaption that adds only an caption text to the list,
  • \nocaptionbutnumber that adds additionally a number to the entry (that is incremented before, and
  • \nocaptionwithweirdalignment that doesn't use \numberline and therefore its entry text is aligned to the left (I wouldn't use it).

Minor Update

I've updated the answer so that the \addcontentsline macro doesn't have hard-coded first and second parameter. The commands should work now in table and other environment that define \@captype and the proper extension macro \ext@<\@captype>.

Code

\documentclass{article}
\makeatletter
\newcommand*{\nocaption}[1]{%
    \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}{\protect\numberline{}#1}%
}
\newcommand*{\nocaptionbutnumber}[1]{%
    \refstepcounter{figure}%
    \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}{\protect\numberline{\csname the\@captype\endcsname}#1}%%
}
\newcommand*{\nocaptionwithweirdalignment}[1]{%
    \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}{#1}%
}
\makeatother
\begin{document}
\listoffigures
\begin{figure}[!ht]
F1
\nocaption{Caption 1}
\end{figure}
\begin{figure}[!ht]
F2
\nocaptionbutnumber{Caption 2}
\end{figure}
\begin{figure}[!ht]
F3
\nocaptionbutnumber{Caption 3}
\end{figure}
\begin{figure}[!ht]
F4
\nocaptionwithweirdalignment{Caption 4}
\end{figure}
\end{document}

Output

Output

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .