2

I use caption package and use figure inside theorem environment. Most of my theorem have only 1 figure but sometimes 1 of them has more figures. I usually renew \thecaption to renumber the figure such as (These figure have no captionname) enter image description here

In list of figure (right image), I want to remove figure 1.16b (only inside list) and change thefigure 1.16a to be 1.16 (delete a letter, only inside list). How should I do?

See my document below

\documentclass{article}

\usepackage{caption}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]
\renewcommand{\thefigure}{\textbf{\thetheorem}}
\setcounter{theorem}{15}
\renewcommand{\figurename}{\textbf{Figure}}

\begin{document}
\section{Figure}

\begin{theorem}
Some thing
\begin{figure}[h]
\renewcommand{\thefigure}{\textbf{\thetheorem a}}
  \caption[a]{My caption 1}
\end{figure}
and something
\begin{figure}[h]
\renewcommand{\thefigure}{\textbf{\thetheorem b}}
  \caption{My caption 2}
\end{figure} 

\end{theorem}


\begin{theorem}
Some thing
\begin{figure}[h]
  \caption[a]{My caption 3}% Does not appear in LoF
\end{figure}
and something
\end{theorem}
\listoffigures

\end{document}

1 Answers1

3

One solution is to stop using \caption altogether.

\documentclass{article}

\usepackage{caption}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]
\renewcommand{\thefigure}{\textbf{\thetheorem}}
\setcounter{theorem}{15}
\renewcommand{\figurename}{\textbf{Figure}}

\begin{document}
\section{Figure}

\begin{theorem}
Some thing
\begin{figure}[h]
  \makebox[\textwidth]{\textbf{Figure \thetheorem a}: My caption 1}
  \addtocontents{lof}{\string\contentsline{figure}{\string\numberline {\string\textbf{\thetheorem}}%
    {\ignorespaces Alternate caption}}{\thepage}}
\end{figure}
and something
\begin{figure}[h]
  \makebox[\textwidth]{\textbf{Figure \thetheorem b}: My caption 2}
\end{figure} 

\end{theorem}


\begin{theorem}
Some thing
\begin{figure}[h]
  \makebox[\textwidth]{\textbf{Figure \thetheorem}: My caption 3}
  \addtocontents{lof}{\string\contentsline{figure}{\string\numberline {\string\textbf{\thetheorem}}{}}{\thepage}}% no caption
\end{figure}
and something
\end{theorem}
\listoffigures

\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120