Почему последняя страница содержания рассматривается как страница 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-файл со следующим содержимым:

последняя страница ToC первая страница первой главы

Пакет "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}

введите описание изображения здесь

Последний комментарий:ошибочныйэто, э-э,ошибочный.

Связанный контент