メインマター使用時に図のサブセクション番号が失われる

メインマター使用時に図のサブセクション番号が失われる

最近、図や表の設定で\frontmatter、、\mainmatterなどを追加\numberwithinしてドキュメントに書き出しましたが、エクスポート時に図がサブセクションごとに番号付けされなくなりました。LyX 内では、まだ正しい番号付けが表示されていますが、エクスポート時にサブセクション番号が失われます。私は、memoir パッケージを使用しています。以下は、私の序文の一部です。

\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}

余談ですが、個人的な意見ですが、この番号付けのスキーマを再検討することをお勧めします。数字の文字列が長すぎると、読みにくくなります。

関連情報