我正在準備我的論文,該論文由 11 章組成,後面是附錄,最後是另一章(即荷蘭語摘要)。在最後一章(荷蘭語摘要)中,我有幾個數字,並且想要恢復數字編號(例如,荷蘭語摘要章節的第一個數字應編號為 12.1)。這是說明問題的程式碼:
\documentclass[11pt,twoside,openright]{memoir}
\begin{document}
\begin{KeepFromToc}
\tableofcontents \cleardoublepage
\end{KeepFromToc}
\chapter{Introduction}
This is chapter 1.
\begin{figure}
\caption{Body figure.}
\label{bodyfigure1}
\end{figure}
\appendix
\addcontentsline{toc}{part}{Appendices}
\part*{Appendices}
\chapter{Appendix A1}
This is A1.
\begin{figure}
\caption{Body figure.}
\label{bodyfigure2}
\end{figure}
\backmatter
\chapter{Dutch Summary}
This is chapter 2.
\begin{figure}
\caption{Body figure.}
\label{bodyfigure3}
\end{figure}
\end{document}
當您編譯此圖時,您會看到第1 章中的第一個圖正確編號為“圖1.1”,但是,荷蘭語摘要章節中的圖編號為“圖1”,但它應該顯示為“圖2.1」。非常感謝任何有關如何解決此問題的想法!
答案1
這是一個具有xassoccnt
其\BackupCountersGroup
功能的版本\RestoreBackupCounterGroup
,儲存指定數量的計數器的計數器值並稍後重新註入它們。
\documentclass[11pt,twoside,openright]{memoir}
\usepackage{xassoccnt}
\DeclareBackupCountersGroupName{dutchchapter}
\AssignBackupCounters[name=dutchchapter,cascading=true]{chapter}
\makeatletter
\newcommand{\StoreCounterFormats}{%
\let\latex@@thechapter\thechapter
\let\latex@@thefigure\thefigure
\let\latex@@thetable\thetable
}
\newcommand{\ContinueOldCounting}[2]{%
\RestoreBackupCounterGroup[backup-id=#1]{#2}%
\refstepcounter{chapter}%
\let\thechapter\latex@@thechapter
\let\thefigure\latex@@thefigure
\let\thetable\latex@@thetable
}
\makeatother
\AtBeginDocument{%
\StoreCounterFormats%
}
\begin{document}
\begin{KeepFromToc}
\tableofcontents \cleardoublepage
\end{KeepFromToc}
\chapter{Introduction}
This is chapter 1.
\begin{figure}
\caption{Body figure.}
\label{bodyfigure1}
\end{figure}
%Code to produce some dummy chapters
\makeatletter
\newcount\foocnt
\foocnt\c@chapter
\loop\unless\ifnum\foocnt=11
\advance\foocnt by 1
\chapter{Dummy chapter \the\foocnt}
\repeat
\makeatother
%End of dummy chapters production
% Make a backup of the state!
\BackupCounterGroup[backup-id=beforeappendices]{dutchchapter}
\appendix
\addcontentsline{toc}{part}{Appendices}
\part*{Appendices}
\chapter{Appendix A1}
This is A1.
\begin{figure}
\caption{Body figure.}
\label{bodyfigure2}
\end{figure}
\backmatter
% Restore the old state
\ContinueOldCounting{beforeappendices}{dutchchapter}
\chapter{Dutch Summary}
This is chapter \thechapter
\begin{figure}
\caption{Body figure.}
\label{bodyfigure3}
\end{figure}
\end{document}
我正在考慮在即將發布的版本之一中添加儲存\the....
巨集的可能性。xassoccnt
答案2
這是一個快速修復。
\chapter{Dutch Summary}
\setcounter{chapter}{11}
\refstepcounter{chapter}
\renewcommand\thechapter{\arabic{chapter}}
\renewcommand\thefigure{\thechapter.\arabic{figure}} % for figures
\renewcommand\thetable{\thechapter.\arabic{table}} % for tables