The macro \mycaption
uses \thefigure
for captions and \arabic{figure}
for the lof
(plus a few other formatting changes). Note that \@captype
can be figure
or table
.
\documentclass{article}
\usepackage{caption}% required
\makeatletter
\newcommand{\mycaption}[2][\@empty]% #1 = short caption (optionl), #2 = caption
{\refstepcounter\@captype
\caption@caption*{\csname fnum@\@captype\endcsname{: }#2}%
\ifx\@empty#1
\addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
{\csname\@captype name\endcsname\space\arabic{\@captype}: #2}%
\else
\addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
{\csname\@captype name\endcsname\space\arabic{\@captype}: #1}%
\fi
}
\makeatother
\begin{document}
\listoffigures
\begin{figure}
\renewcommand{\thefigure}{1.1}%
\caption{normal caption}
\renewcommand{\thefigure}{2.6}%
\mycaption{my caption}
\end{figure}
\end{document}
![demo](https://i.stack.imgur.com/wZIeE.png)
If you don't want to rename all your \caption
s to \mycaption
, just use
\let\caption=\mycaption
instead. However, \caption*
will no longer work.
Odds are the figure counter is being reset to 0 at the start of each chapter, in which case you will need to use a different counter.
\newcounter{myfigure}
\newcounter{mytable}
\makeatletter
\newcommand{\mycaption}[2][\@empty]% #1 = short caption (optionl), #2 = caption
{\refstepcounter\@captype
\caption@caption*{\csname fnum@\@captype\endcsname{: }#2}%
\stepcounter{my\@captype}%
\ifx\@empty#1
\addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
{\csname\@captype name\endcsname\space\arabic{my\@captype}: #2}%
\else
\addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
{\csname\@captype name\endcsname\space\arabic{my\@captype}: #1}%
\fi
}
\makeatother
Finally, I despise this programming style, as it is almost unreadable. So for my own peace of mind:
\makeatletter
\def\mycaption{\csname\@captype @caption\endcsname}
\newcommand{\figure@caption}[2][\@empty]% #1 = short caption(optional), #2 = caption
{\refstepcounter{figure}%
\caption@caption*{\fnum@figure{: }#2}%
\stepcounter{myfigure}%
\ifx\@empty#1
\addcontentsline{lof}{figure}{\figurename\space\arabic{myfigure}: #2}%
\else
\addcontentsline{lof}{figure}{\figurename\space\arabic{myfigure}: #1}%
\fi
}
\newcommand{\table@caption}[2][\@empty]% #1 = short caption(optional), #2 = caption
{\refstepcounter{table}%
\caption@caption*{\fnum@table{: }#2}%
\stepcounter{mytable}%
\ifx\@empty#1
\addcontentsline{lot}{table}{\tablename\space\arabic{mytable}: #2}%
\else
\addcontentsline{lot}{table}{\tablename\space\arabic{mytable}: #1}%
\fi
}
\makeatother
Best Answer
Since
\listoftheorems
uses internally\listoffigures
, you can use theetoolbox
package to patch\listoffigures
changing the default\chapter*
to\chapter
(for a solution usingamsbook
, please see the second example below):A similar patch can be easily done for other lists if required. For example, for the list of tables, one would say
A request has been made to perform a similar modification but using
amsbook
; in this case, some additional work has to be done: