I am trying to create a visually more appealing figure, that looks like the output of the MWE below.
\documentclass[a4paper]{book}
\usepackage[a4paper]{geometry}
\usepackage{kantlipsum}
\usepackage{tikz}
\usepackage{caption}
\newcommand{\CustomFigure}[3][.4\textwidth]
{
\stepcounter{figure}
%\captionof{figure}[The caption.]{}
\begin{tikzpicture}
\draw (0,0) node(origin) {};
%rectangle (.4\textwidth,40mm);
\draw (origin.west) +(4pt,-8pt) node(caporg){};
\draw [blue, fill=blue] (caporg.south) +(0.0,0.0) -- +(0.09,0.18) -- +(0.18,0) node (arroweast){} -- cycle;
\draw [font=\sffamily\bfseries,blue] (arroweast.east) +(-2pt,+10pt) node[anchor=north west](caption) { Figure \thefigure};
\draw [font=\sffamily,black,text justified, text width=#1] (caporg.south west) +(-1pt,-2pt) node[anchor=north west](description)
{
\mdseries #3
};
\node[anchor=south west,inner sep=0pt] (image) (origin.north west)
{\includegraphics[width=.4\textwidth]{#2}};
\label{fig:NFb}
\end{tikzpicture}
} % \CustomFigure ENDS
\begin{document}
\newgeometry{top=3cm,bottom=3cm,left=1cm,right=1cm,headsep=10pt}
\kant[7]
Some more lipsum.\newline
\begin{figure}
\begin{center}
\includegraphics[width=.4\textwidth]{example-image-a};
\caption{Just a figure.}
\label{fig:NFa}
\end{center}
\end{figure}
\CustomFigure{example-image-b}{\textbf{Header text.} The crazy monkey jumped over the sleeping lion. He met quick brown fox from his own lipsum.}
See figures '\ref{fig:NFa}' and '\ref{fig:NFb}' for details.
\newpage
\listoffigures
\end{document}
'example-image-a' is a figure as usual. Works of course.
Now the output of 'CustomImage' produces the desired visual outcome, but the list of figures is screwed up. It only shows the 'real' figure but not the custom-figure. (Btw. CustomFigure is not an environment because it would not draw more than a single char of the text.)
I though this could be solved by adding a \captionof{figure}[The caption.]{}
(which it does indeed) but then there would also be the caption itself placed as well. Is there a way to JUST set the caption for \thefigure (the figure stepped with stepcounter) invisibly, without the need to use captionof?
The list of figures must show the content of the 'hidden' caption of course.
Or do I need to re-implement \listoffigures
myself?
Many thanks in advance.
\captionlistentry{figure}{Something}
.\refstepcounter
not\stepcounter
if you want\label
to work.\caption
nor\captionof
is used/wanted, nothing writes information to the.lof
file. You have to add it manually with\addcontentsline{lof}{figure}{\protect\numberline{\thefigure~}Your caption text}
, whereYour caption text
seems to be#3
here