对于目录,我将页脚中的页码从罗马数字更改为阿拉伯数字。但问题是,目录后的页码将重置为 1。我想让它继续跟随目录的页码。有人能告诉我怎么做吗?
以下是我设置页眉页脚和章节页的代码:
% Setup fancy headings
\pagestyle{fancyplain}
\newcommand{\clearemptydoublepage}{%
\newpage{\pagestyle{empty}\cleardoublepage}%
}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}%
}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}%
}
\fancyhead[LE]{\fancyplain{}{\includegraphics[height=0.56in, width=1.5in]{logo.jpg}}}
\fancyhead[CE]{\fancyplain{}{}}
\fancyhead[RE]{\fancyplain{}{}}
\fancyhead[LO]{\fancyplain{}{}}
\fancyhead[CO]{\fancyplain{}{}}
\fancyhead[RO]{\fancyplain{}{\includegraphics[height=0.56in, width=1.5in]{logo.jpg}}}
\fancyfoot[LE]{\fancyplain{}{\bfseries\ page \arabic{page}\ of \pageref{LastPage}}}
\fancyfoot[CE]{\fancyplain{}{}}
\fancyfoot[RE]{\fancyplain{}{}}
\fancyfoot[LO]{\fancyplain{}{}}
\fancyfoot[CO]{\fancyplain{}{}}
\fancyfoot[RO]{\fancyplain{}{\bfseries\ page \arabic{page}\ of \pageref{LastPage}}}
%---------- Set up chapter style -------------------------------------
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 2pt \hfill \kern \z@}
\def\@makechapterhead#1{%
\thispagestyle {fancyplain}
\vspace*{10\p@}%
{\parindent \z@
{\raggedleft \reset@font%
\fontencoding{OT1}\fontfamily{cmr}\fontseries{b}\fontshape{n}\fontsize{22pt}{12}\selectfont%
\bfseries\thechapter\nobreak\hspace{1ex}}%
{\raggedright \reset@font%
\fontencoding{OT1}\fontfamily{cmr}\fontseries{b}\fontshape{n}\fontsize{22pt}{12}\selectfont%
\bfseries #1}%
\interlinepenalty\@M
\par\nobreak
\textcolor{orange}{\thickhrulefill}
\vspace{26pt}
\par\nobreak
}}
\def\@makeschapterhead#1{%
\thispagestyle {fancyplain}
\vspace*{10\p@}%
{\parindent \z@
{\raggedright \reset@font%
\fontencoding{OT1}\fontfamily{cmr}\fontseries{b}\fontshape{n}\fontsize{22pt}{12}\selectfont%
\bfseries #1}%
\interlinepenalty\@M
\par\nobreak
\textcolor{orange}{\thickhrulefill}
\vspace{26pt}
\par\nobreak
}}
\makeatother
答案1
切换到不同的\pagenumbering
会重置计数器。使用辅助计数器保存ToC 之后page
的值,并在切换到 后将计数器重置为该值。page
page
arabic
\documentclass{report}
\usepackage[english]{babel}
\usepackage{blindtext}
\pagenumbering{roman}
\newcounter{mypageno}
\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{%
\oldtableofcontents
\cleardoublepage
\setcounter{mypageno}{\value{page}}%
\pagenumbering{arabic}%
\setcounter{page}{\value{mypageno}}%
}
\begin{document}
\tableofcontents
\blinddocument
\blinddocument
\blinddocument
\blinddocument
\blinddocument
\end{document}
(这盲文包仅用于向示例添加一些虚拟文本。)
编辑:MWE 已更改 -\tableofcontents
在序言中重新定义(这可以在文件中使用.sty
)。请注意,我假设目录后应该有一个分页符。