我使用caption
包并在定理环境中使用图形。我的大多数定理只有 1 个图形,但有时其中一个有多个图形。我通常会重新\thecaption
编号图形,例如(这些图形没有标题名称)
在图形列表中(右图),我想删除图形1.16b
(仅在列表内),并将图形更改1.16a
为1.16
(删除字母,仅在列表内)。我该怎么做?
请参阅下面的我的文档
\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
一个解决方案就是\caption
完全停止使用。
\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}