我有一份报告,每页都从 1 开始编号。但这份报告的三个章节总共有 10 页的限制。我想在正常页码之上为它们单独编页码。
因此,在每页的页脚中我仍然会有正常的页码,但对于三个特殊章节,我希望有类似“页面限制部分 --- 第 X 页,共 10 页”在标题中。
是否可以?
平均能量损失:
\documentclass{report}
\begin{document}
\chapter{First}
% Here should start the double numbering
\chapter{Second}
\chapter{Third}
% Here should stop the double numbering
\chapter{Fourth}
\end{document}
答案1
您可能想尝试以下代码:
\documentclass{report}
\usepackage{fancyhdr}
\usepackage{lipsum} % just for the example
% normal report page style
\fancypagestyle{normal}{%
\renewcommand{\headrulewidth}{0pt}%
\fancyhf{}%
\fancyfoot[C]{\thepage}%
}
\fancypagestyle{special}{%
\renewcommand{\headrulewidth}{0pt}%
\fancyhf{}%
\fancyfoot[C]{\thepage}%
\fancyhead[R]{Page limited section --- Page \the\numexpr\value{page}-\pagesuptonow+1\relax\ of 10}%
}
\newcommand{\normalchapter}{%
\clearpage
\pagestyle{normal}%
\chapter
}
\newcommand{\specialchapter}{%
\clearpage
\edef\pagesuptonow{\thepage}%
\pagestyle{special}%
\chapter
}
\begin{document}
\normalchapter{Normal 1}
\lipsum[1-15]
\specialchapter{Special 1}
\lipsum[1-30]
\specialchapter{Special 2}
\lipsum[31-60]
\normalchapter{Normal 2}
\lipsum[61-90]
\end{document}
答案2
只是为了玩计数器的乐趣:
\documentclass{report}
\usepackage{everyshi}
\newcounter{pagecnt}[chapter]
\EveryShipout{\stepcounter{pagecnt}}
\newcommand{\pagestart}{%
\renewcommand{\thepage}{Page %
\ifnum\thepagecnt=0
1%
\addtocounter{pagecnt}{1}%
\else%
\arabic{pagecnt}%
\fi%
\space of 10 -- \arabic{page}
}%
}
\newcommand{\pagestop}{\renewcommand{\thepage}{\arabic{page}}}
\begin{document}
\chapter{First}
\newpage
a
\chapter{Second}
% Here should start the double numbering
\pagestart
\newpage
a
\chapter{Third}
\newpage
a
\chapter{Fourth}
% Here should stop the double numbering
\pagestop
\end{document}