0

I've had the problem, that I needed a prefix in my list of figures/tables, but fortunately I found this solution. I work with the fancyhdr package, so I need the tocloft package with the title option. I use it for my list of symbols and equations only. But no bad, because I make use of the code from "Mico" (same thread):

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@caption}{\csname the#1\endcsname}{\csname fnum@#1\endcsname:}{}{}
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{4.5em}} % default for 3rd arg: 2.3em
\let\l@table\l@figure % as in article.cls
\makeatother

It works basically, but the list shows all figures/tables, even the ones who are hidden with \caption[]{example}:

Screenshot

This is a huge problem, that I can't solve. I'm a LaTeX beginner, but I think the \patchcdm just need a condition?! Any ideas?


Edit 1: Adding an example

\documentclass{article}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@caption}{\csname the#1\endcsname}{\csname fnum@#1\endcsname:}{}{}
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{4.5em}} % default for 3rd arg: 2.3em
\let\l@table\l@figure % as in article.cls
\makeatother

\begin{document} \listoffigures \listoftables

\begin{figure}[h] \caption{list this figure} \centering show \end{figure}

\begin{figure}[h] \caption[]{don't list this figure} \centering hide \end{figure}

\begin{table}[h] \caption[]{don't list this table} \centering hide \end{table}

\begin{table}[h] \caption{list this table} \centering show \end{table}

\end{document}

Screenshot Example

epR8GaYuh
  • 2,432
  • Can you please add a minimal example from \documentclass to \end{document}? And welcome! – egreg Jul 02 '20 at 19:38
  • All figures/tabels which should not be seen, will be at the end of the document. So unlike shown in the example, you may not worry about blank spaces above or betwenn other list elements. – flowmymind Jul 02 '20 at 21:09

0 Answers0