2015-02-17 98 views
0

所以我寫我的論文,但我被要求開始羅馬數字的頁碼,改爲阿拉伯語,然後重新取回羅馬數字的編號,但我還沒有找到這樣做的方式。乳膠重拍頁碼

回答

2

您需要操縱一些計數器才能達到此目的。使用refcount提取保存的值並通過expl3轉換它們。

enter image description here

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