Latex 重拍页码

Latex retake page numbering

所以我正在写我的论文,但我被要求以罗马数字开始页码,更改为阿拉伯数字,然后在它停止的地方重新开始罗马数字的编号,但我还没有找到一种方法正在做。

您需要操作一些计数器才能实现此目的。使用 refcount and converting them via expl3.

提取保存的值

\documentclass{report}
\usepackage{lipsum}% Just for this example
\usepackage{refcount}
\usepackage{xparse}

\ExplSyntaxOn% http://tex.stackexchange.com/a/227859/5764
\DeclareExpandableDocumentCommand{\arabicnumeral}{m}
  {
  \int_from_roman:n { #1 }
  }
\ExplSyntaxOff
\begin{document}
\tableofcontents

\clearpage
\pagenumbering{roman}% Switch to roman numbering
\chapter{First chapter}
\lipsum[1-50]\lipsum[1-50]
\label{last-roman-page}% Save last page of this chapter

\clearpage
\pagenumbering{arabic}% Switch to arabic numbering
\chapter{Second chapter}
\lipsum[1-50]\lipsum[1-50]

\clearpage
\renewcommand{\thepage}{\roman{page}}% Switch to roman numbering
\edef\intpagevalue{\getpagerefnumber{last-roman-page}}% Retrieve last roman page & convert to arabic
\setcounter{page}{\number\numexpr\expandafter\arabicnumeral\expandafter{\intpagevalue}+1}% Set current page value
\chapter{Last chapter}
\lipsum[1-50]\lipsum[1-50]

\end{document}