
我最近在文件中添加了\frontmatter
、\mainmatter
等以及我的圖形和表格的設置,但現在我的圖形在導出時不再按小節編號。\numberwithin
在 LyX 內部,它們仍然顯示正確的編號,但我在匯出時丟失了小節編號。我正在使用回憶錄包。這是我的序言的一部分:
\setsecnumdepth{subsubsection}
\maxtocdepth{subsubsection}
\numberwithin{figure}{subsubsection}
\numberwithin{table}{subsubsection}
在插入語句之前所有編號均已正常運作\...matter
。
答案1
在內部,memoir
確實
\newcommand\@memmain@floats{%
\counterwithin{figure}{chapter}
\counterwithin{table}{chapter}
}
即主體中的圖、表從屬於計數器編號chapter
;要覆蓋它,您可以添加到序言中
\makeatletter
\renewcommand\@memmain@floats{%
\counterwithin{figure}{subsubsection}
\counterwithin{table}{subsubsection}
}
\makeatother
一個完整的例子:
\documentclass{memoir}
\usepackage{amsmath}
\setsecnumdepth{subsubsection}
\maxtocdepth{subsubsection}
\numberwithin{figure}{subsubsection}
\numberwithin{table}{subsubsection}
\makeatletter
\renewcommand\@memmain@floats{%
\counterwithin{figure}{subsubsection}
\counterwithin{table}{subsubsection}
}
\makeatother
\begin{document}
\mainmatter
\chapter{Test chapter}
\vfill% just for the example
\section{Test section}
\subsection{Test subsection}
\subsubsection{Test subsubsection}
\begin{figure}
\caption{test}
\end{figure}
\end{document}
順便說一下,由於memoir
內部使用了chngcntr
,因此您可以直接使用\counterwithin
而不是\numberwithin
:
\counterwithin{figure}{subsubsection}
\counterwithin{table}{subsubsection}
作為個人說明,我建議您重新考慮這個編號模式;使用如此長的數字字串對讀者來說不太友好。