为什么目录的最后一页被视为文档的第 1 页?

为什么目录的最后一页被视为文档的第 1 页?

我为这件事烦恼了太久,所以现在想请求帮助,看看我哪里做错了。

最小工作示例:

\documentclass[12pt,a4paper,twoside]{report}

\usepackage{newxjobb}
\usepackage[swedish]{babel}   % date format and hyphenation rules(?)
\selectlanguage{swedish}

\usepackage{blindtext}

%--------------------
% Four subsections
\usepackage{titlesec}
\setcounter{secnumdepth}{4}

% Fugly hack to remove section numbers in ToC
\renewcommand{\thesection}{}
\renewcommand{\thesubsection}{}
\renewcommand{\thesubsubsection}{}

%-------------------- Remove section numbering
\makeatletter
\renewcommand{\@seccntformat}[1]{}
\makeatother
%--------------------

\begin{document}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagenumbering{roman}
\pagestyle{empty} % Empty until the abstract

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page

\hfil\hspace*{-4mm}
\begin{minipage}{100mm}
  \center {
    \vbox to 56mm{\vfil\LARGE\textbf{Shiny Title}}}
  \vspace*{2.5mm}
  \textbf{Things and stuff} \\
  \vspace*{7mm}
  \textbf{\large Mr. Name Nameson} \\
  City 2019 \\
  \vspace*{7mm}
  Should you fancy something erronious, drop a mail: \\
  [email protected]
\end{minipage}\hfil
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\clearpage

\thispagestyle{empty}
\setcounter{page}{0}
\tableofcontents

%-------------------- Document start
\pagenumbering{arabic}
\pagestyle{fancy}

\chapter{Foo}
\blindtext
\subsection{asdf0}
\subsection{asdf1}
\subsection{asdf2}
\subsection{asdf3}
\subsection{asdf4}
\subsection{asdf5}
\subsection{asdf6}
\subsection{asdf7}
\subsection{asdf8}
\subsection{asdf9}

\chapter{Bar}
\blindtext[2]
\subsection{asdf0}
\subsection{asdf1}
\subsection{asdf2}
\subsection{asdf3}
\subsection{asdf4}
\subsection{asdf5}
\subsection{asdf6}
\subsection{asdf7}
\subsection{asdf8}
\subsection{asdf9}

\chapter{Gazonk}
\blindtext[3]
\subsection{asdf0}
\subsection{asdf1}
\subsection{asdf2}
\subsection{asdf3}
\subsection{asdf4}
\subsection{asdf5}
\subsection{asdf6}
\subsection{asdf7}
\subsection{asdf8}
\subsection{asdf9}

\end{document}

生成包含以下内容的 PDF:

目录最后一页 第一章第一页

软件包“newxjobb”是一个非标准软件包(不是我制作的),我所在学院的一些学生会使用它,因此我也在这里添加了它,以防出现错误。此软件包一直用于英语文档,我的文档是第一个使用瑞典语的文档。我不知道这是否是问题的原因。

包“newxjobb”:

%  Package file with options making me feel better...
%  (Author: Stefan Langemark)
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{newxjobb}[2018/11/16 *** To be reviewed! ***]

\RequirePackage{parskip}
\RequirePackage{geometry}
\RequirePackage[T1]{fontenc} % ... the following line doesn't make much sense 
                             % without this one
\RequirePackage[utf8]{inputenc}
\RequirePackage{fancyhdr}

%
%--------------------------------
%    Paper layout
%    (no room for margin notes)
%--------------------------------
%
% paper=b5paper,
\geometry{ 
  paperwidth = 165mm, paperheight = 240mm,
%   paper = a4paper,
   total = {130mm,200mm},
%  marginparsep = 2mm,
%  marginparwidth = 15mm,
  includemp = false,
  %twosideshift = 10pt
}
\addtolength{\headheight}{10pt} % ??? (use "\geometry{...}" instead!)

%-------------------------------
%    Header/Footer
%-------------------------------
\pagenumbering{arabic}
\renewcommand{\headrulewidth}{0.4pt}
\fancyhf{}
\fancyhead[RO]{\bfseries\leftmark}
\fancyhead[LE]{\bfseries\rightmark}
\fancyhead[RO,LE]{\bfseries\thepage}
\pagestyle{fancy}
\fancypagestyle{headings}{%
     \fancyhf{}%
     \renewcommand{\headrulewidth}{0pt}
}

%
%-------------------------------------
%  Redefine {chapter,section}mark to
%  remove ugly all-uppercase
%-------------------------------------
%
% feck off
\renewcommand{\chaptermark}[1]{\markboth{\bfseries ARNE}{HEJHEJ}}
\renewcommand{\sectionmark}[1]{\markright{\bfseries \chaptername\ \thechapter.\enspace #1}}

%
%-------------------------------
%  Redefining section styles
%  to suit parskip > 0
%-------------------------------
%
%\addtocounter{secnumdepth}{1}% Number subsubsections too
%\addtocounter{tocdepth}{1}%    Include subsections in table of contents.

\renewcommand\section{\@startsection%
  {section}%
  {1}%
  {\z@}%
  {-2.5ex \@plus -1ex \@minus -.2ex}%
  {1.3ex \@plus.2ex}%
  {\normalfont\Large\bfseries}%
}
\renewcommand\subsection{\@startsection%
  {subsection}%
  {2}%
  {\z@}%
  {-2.25ex\@plus -1ex \@minus -.2ex}%
  {0.5ex \@plus .2ex}%
  {\normalfont\large\bfseries}%
}
\renewcommand\subsubsection{\@startsection%
  {subsubsection}%
  {3}%
  {\z@}%
  {-2.25ex\@plus -1ex \@minus -.2ex}%
  {0.1pt \@plus .2ex}%
  {\normalfont\mdseries\large\itshape}%
}



%
%
\renewcommand\tableofcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname}%
    \markboth{\contentsname}{\contentsname}%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
    }
\renewcommand\listoffigures{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listfigurename}%
    \markboth{\listfigurename}{\listfigurename}%
    \@starttoc{lof}%
    \if@restonecol\twocolumn\fi
    }
\renewcommand\listoftables{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listtablename}%
    \markboth{\listtablename}{\listtablename}%
    \@starttoc{lot}%
    \if@restonecol\twocolumn\fi
    }
%
%-------------------------------------------
%  Chapter (stolen from Kluwer book style)
%-------------------------------------------
%
\newcommand*\chapnumber{% chapter number
    \fontsize{50}{60}%
    \usefont{T1}{lmr}{bx}{n}%
}
\newcommand*\chaptitle{% chapter title
    \fontsize{20}{24}%
    \usefont{T1}{lmr}{bx}{n}%
}

\def\bigraggedleft{\leftskip0pt plus1fil\relax}

\def\@makechapterhead#1{%\null\vskip-5pc
\vbox to 8pc{\hbox to\textwidth{\hfill\chapnumber\thechapter}
\hyphenpenalty=10000 % No hyphenation in chapter heads
\vskip8pt
\hrule height 2.5pt
\vskip12pt\vskip-\parskip
\def\\ {\vskip-\parskip}\parfillskip=0pt
\bigraggedleft
\chaptitle{\def\\ {\vskip-\parskip}#1}\vskip1sp
\vfill}}

\def\@makeschapterhead#1{\vbox to 7.5pc{
\hrule height 1.5pt
\hyphenpenalty=10000 % No hyphenation in chapter heads
\vskip12pt\vskip-\parskip
\def\\ {\vskip-\parskip}\parfillskip=0pt
\bigraggedleft
\chaptitle{#1}\vskip1sp\vfill}}
% END newxjobb-package

我不知道为什么会出现编号问题,现在我已经放弃寻找它了。

我是否犯了一个明显的错误?

答案1

你有

\begin{document}
\pagenumbering{roman}
\pagestyle{empty} % Empty until the abstract

% Title page

\hfil\hspace*{-4mm}
\begin{minipage}{100mm}
  \center {
    \vbox to 56mm{\vfil\LARGE\textbf{Shiny Title}}}
  \vspace*{2.5mm}
  \textbf{Things and stuff} \\
  \vspace*{7mm}
  \textbf{\large Mr. Name Nameson} \\
  City 2019 \\
  \vspace*{7mm}
  Should you fancy something erronious, drop a mail: \\
  [email protected]

\end{minipage}\hfil

\clearpage

\thispagestyle{empty}
\setcounter{page}{0}
\tableofcontents

%-------------------- Document start
\pagenumbering{arabic}
\pagestyle{fancy}

其中存在一些不一致之处。

第一个\pagenumbering{roman}最好是\pagenumbering{Alph}(当你添加时你就会明白为什么hyperref)。

接下来,将 改为\setcounter{page}{0}\clearpage\pagenumbering{roman}并将\pagenumbering{arabic}改为\clearpage\pagenumbering{arabic}

有什么问题?您\pagenumbering{arabic}TeX 已弹出目录的最后一页,因此该页的编号为 1。

\pagestyle{fancy}應該移到之前\tableofcontents

顺便说一句,如果你不想对章节和小节进行编号,那么发布

\setcounter{secnumdepth}{0} % only numbers chapters

这是一个编辑过的版本。

\documentclass[12pt,a4paper,twoside]{report}

\usepackage{newxjobb}
\usepackage[swedish]{babel}   % date format and hyphenation rules(?)

\usepackage{blindtext}

%--------------------
% Four subsections
\usepackage{titlesec}
\setcounter{secnumdepth}{0}

\begin{document}

\pagenumbering{Alph}
\pagestyle{empty} % Empty until the abstract

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page

\begin{center}
  {\LARGE\textbf{Shiny Title}\\}
  \textbf{Things and stuff} \\[7mm]
  {\large\textbf{Mr. Name Nameson} \\}
  {\large City 2019 \\[7mm]}
  Should you fancy something erroneous, drop a mail: \\
  [email protected]
\end{center}

\clearpage
\pagenumbering{roman}

\pagestyle{fancy}

\tableofcontents

%-------------------- Document start

\clearpage
\pagenumbering{arabic}

\chapter{Foo}
\blindtext
\subsection{asdf0}
\subsection{asdf1}
\subsection{asdf2}
\subsection{asdf3}
\subsection{asdf4}
\subsection{asdf5}
\subsection{asdf6}
\subsection{asdf7}
\subsection{asdf8}
\subsection{asdf9}

\chapter{Bar}
\blindtext[2]
\subsection{asdf0}
\subsection{asdf1}
\subsection{asdf2}
\subsection{asdf3}
\subsection{asdf4}
\subsection{asdf5}
\subsection{asdf6}
\subsection{asdf7}
\subsection{asdf8}
\subsection{asdf9}

\chapter{Gazonk}
\blindtext[3]
\subsection{asdf0}
\subsection{asdf1}
\subsection{asdf2}
\subsection{asdf3}
\subsection{asdf4}
\subsection{asdf5}
\subsection{asdf6}
\subsection{asdf7}
\subsection{asdf8}
\subsection{asdf9}

\end{document}

在此处输入图片描述

最后评论:錯誤的呃,错误

相关内容