使用罗马页码的奇怪行为

使用罗马页码的奇怪行为

我将其用于pagenumbering{roman}标题页表格和pagenumbering{arabic}其他部分。我的问题是,罗马数字部分的行为很奇怪,我尝试解释如下:

first page/titlepage: no numbering
second page:          i
third page:           no numbering
fourth page:          iii
fifth page:           no numbering
sixth page:           v
seventh page:         no numbering
eighth page:          no numbering
ninth page:           viii

我想要的是从 i 到 viii 不间断的编号。

有人可以帮我吗?

PS:这是我的序言的精简版本:

\documentclass[a4paper,12pt]{report}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[ansinew,latin1]{inputenc}
\usepackage{setspace}
\usepackage{geometry}
\onehalfspacing
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{1}

\begin{document}

\pagestyle{empty}
\clearpage
\pagenumbering{roman}

\begin{titlepage}
\newgeometry{margin=3cm}
\centering

Some text

\end{titlepage}


\tableofcontents
\cleardoublepage
\newpage
more text
\newpage
some more text

\newpage
some more text

\newpage
some more text

\newpage
some more text

\newpage
some more text

\pagestyle{plain}
\clearpage
\pagenumbering{arabic}
main document


:
:
\end{document}

答案1

页码的可见性可以用以下方式解释:

  • 第 1 页:\thispagestyle{empty}作者\begin{titlepage}

  • 第 2页:\thispagestyle{plain}作者\chapter*\tableofcontents

  • 第 3 至 8 页:\pagestyle{empty}紧接着\begin{document}

  • 第 9 页:\pagestyle{plain}就在之前\clearpage

页面样式empty意味着页码不可见。

同时\begin{titlepage}\end{titlepage}页面计数器重置为 1。

\pagestyle{plain}因此,可以使用而不是\pagestyle{empty}修补环境来修复该示例titlepage

\documentclass[a4paper,12pt]{report}

\usepackage{etoolbox}
\makeatletter
\patchcmd\titlepage{\thispagestyle{empty}}{}
  {}{\errmessage{Cannot patch \string\titlepage}}
\patchcmd\titlepage{\setcounter{page}\@ne}{}
  {}{\errmessage{Cannot patch \string\titlepage}}
\patchcmd\endtitlepage{\setcounter{page}\@ne}{}
  {}{\errmessage{Cannot patch \string\endtitlepage}}
\makeatother

\begin{document}

\pagestyle{plain}
\clearpage
\pagenumbering{roman}

\begin{titlepage}
\centering

Some text

\end{titlepage}


\tableofcontents
\cleardoublepage
\newpage
more text
\newpage
some more text

\newpage
some more text

\newpage
some more text

\newpage
some more text

\newpage
some more text

\pagestyle{plain}
\clearpage
\pagenumbering{arabic}
main document 
\end{document}

或者修补环境,titlepage可以手动设置页面样式和页码:

\documentclass[a4paper,12pt]{report}

\begin{document}

\pagestyle{plain}
\clearpage
\pagenumbering{roman}

\begin{titlepage}
\thispagestyle{plain}
\centering

Some text

\end{titlepage}
\setcounter{page}{2}

\tableofcontents
\cleardoublepage
\newpage
more text
\newpage 
some more text

\newpage
some more text

\newpage
some more text

\newpage
some more text

\newpage
some more text

\pagestyle{plain}
\clearpage
\pagenumbering{arabic}
main document
\end{document}

相关内容