继续在附录后使用附录前的值进行页码编排

继续在附录后使用附录前的值进行页码编排

我正在写论文,遇到了以下问题。我希望附录中的页码从 1 开始,附录之后,页码应该继续使用主文中的原始页码。例如:1、2、3、附录 -1-、附录 -2-、附录 -3-、4、5、6 ... 我无法做到这一点。下面是包含一些文本的 MWE。

学校的模板结构如下

\mainmatter
% Here do the chapters come
\appendix
%a appendix text
\backmatter
% bibliography

我只想更改附录的页码。我随后定义了自己的自定义页码样式,\appendix如下所示:

\appendix
\pagenumbering{arabic}% resets `page` counter to 1
\renewcommand*{\thepage}{App. - \arabic{page} -}

最小工作示例:

\documentclass{memoir}

\begin{document}

\mainmatter

\chapter{First chapter}
Here is text.
This is normal arabic page numbering.
\newpage
Some more text
\newpage

\appendixpage
\appendix
\pagenumbering{arabic}% resets `page` counter to 1
\renewcommand*{\thepage}{App. - \arabic{page} -}

\chapter{First appendix}
\newpage

\backmatter
\pagenumbering{arabic}% this line make the arabic page number reset to one , but it    should continue where the pagenumber before the appendix stopped. 
Here comes the bibliography. I want this page numbering to be arabic and have a value that is the arabic value when there where no appendices. This page should have page number `4'

so 1, 2, 3 App. -1-, App. -2-, App. -3-, 4 , 5...

\end{document}

提前致谢!Lennert

答案1

使用虚拟页面计数器保存页码并在内容开始后将其恢复\backmatter

\documentclass{memoir}


\newcounter{originalpagenumber}%
\begin{document}

\mainmatter

\chapter{First chapter}
Here is text.
This is normal arabic page numbering.
\newpage
Some more text
\newpage


\setcounter{originalpagenumber}{\number\value{page}}%
\setcounter{page}{0}
\pagenumbering{arabic}% resets `page` counter to 1
\appendixpage
\appendix
\renewcommand*{\thepage}{App. - \arabic{page} -}

\chapter{First appendix}
\newpage
\chapter{Second Appendix}%

\backmatter
\pagenumbering{arabic}% 
\setcounter{page}{\number\value{originalpagenumber}}
%this line make the arabic page number reset to one , but it    should continue where the pagenumber before the appendix stopped. 
Here comes the bibliography. I want this page numbering to be arabic and have a value that is the arabic value when there where no appendices. This page should have page number `4'

so 1, 2, 3 App. -1-, App. -2-, App. -3-, 4 , 5...

\end{document}

改进版本,具有自动切换页码的功能

\documentclass{memoir}%

\newcounter{PageNumberBeforeAppendix}%

\let\LaTeXStandardThePage\thepage
\let\LaTeXStandardAppendix\appendix%
\renewcommand{\appendix}{%
\cleardoublepage
\setcounter{PageNumberBeforeAppendix}{\number\value{page}}%
\setcounter{page}{1}%
\LaTeXStandardAppendix%
}%

\let\LaTeXStandardBackmatter\backmatter
\renewcommand{\backmatter}{%
\cleardoublepage%
\pagenumbering{arabic}%
\renewcommand{\thepage}{\LaTeXStandardThePage}%
\setcounter{page}{\number\value{PageNumberBeforeAppendix}}
\LaTeXStandardBackmatter%
}%


\begin{document}
\mainmatter

\chapter{First chapter}
Here is text.
This is normal arabic page numbering.
\newpage
Some more text
\newpage


\renewcommand*{\thepage}{App. - \arabic{page} -}
%\appendixpage 
\appendix

\chapter{First appendix}


\backmatter
%this line make the arabic page number reset to one , but it    should continue where the pagenumber before the appendix stopped. 
Here comes the bibliography. I want this page numbering to be arabic and have a value that is the arabic value when there where no appendices. This page should have page number `4'

so 1, 2, 3 App. -1-, App. -2-, App. -3-, 4 , 5...

\end{document}

相关内容