主要内容从上一页开始

主要内容从上一页开始

我在使用 \mainmatter 时遇到了一个问题。当我在章节前使用它时,如下面的代码所示,mainmatter 页码和样式从章节页之前的页面开始,即编号为“1”的页面是 acronyms.tex 文件的最后一页,编号为“2”的页面是简介章节页面。这是第一次在整个文档中使用 \mainmatter 关键字,而 \frommatter 位于文档的开头。

% -------------- ACRONYMS --------------
\chapter*{List of Abbreviations and Acronyms}
\input{acronyms.tex}
\mainmatter
% -------------- INTRODUCTION --------------
\chapter{Introduction}
\input{Introduction/introduction.tex}

acronyms.tex 文件包含几个首字母缩略词:

\begin{acronym}[DCLS---]
\acro{...}{...}
\end{acronym}

并且introduction.tex文件只包含文本。

我已将 \mainmatter 命令重新定义为:

\makeatletter
\renewcommand{\mainmatter}{%
  \@mainmattertrue%
  \pagenumbering{arabic}%
}
\makeatother

但还是没能修复。下面是一个直观的例子:

这是一个直观的例子

我正在使用 MasterDoctoralThesis.cls 模板,它的基类是book

任何帮助,将不胜感激。

举一个独立的例子:

%!TEX TS-program = xelatex
%--------------------------------------------
%%  Packages e Configurações
%--------------------------------------------
\documentclass[
    12pt, % The default document font size, options: 10pt, 11pt, 12pt
    oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
    english,% ngerman for German
    singlespacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
    hidelinks,
    %draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
    %nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
    %liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
    %toctotoc, % Uncomment to add the main table of contents to the table of contents
    %parskip, % Uncomment to add space between paragraphs
]{MastersDoctoralThesis} % The class file specifying the document structure

\usepackage{color}      %cor no pdf (nos comandos)
\usepackage{xcolor}
\usepackage{hyperref}   %autoref para figuras
\usepackage{subcaption}
\usepackage{listings}   %listing, snippets de código
\usepackage{graphicx}   %imagens
\usepackage{enumerate}  %enumerate (inside sentence or just because enumerate)
\usepackage[inline]{enumitem}   %use (i)(ii)(iii)... and undifined sequence \item A...
%\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage{fontspec}
\usepackage{acronym} % Acronyms
\usepackage{setspace}
\usepackage{xcolor}
\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the 
\usepackage{pdfpages}
\usepackage{comment}
\usepackage{indentfirst}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{appendix}
\usepackage{float}
\usepackage{blindtext}
\usepackage{svg}
\usepackage{cleveref}
\usepackage{pdflscape}
\usepackage[textwidth=20mm]{todonotes}
\usepackage{ccicons}
\usepackage{blindtext}
\setmainfont[Mapping=tex-text, AutoFakeSlant=0.35,
Path = Fonts/,
UprightFont = *-regular,
BoldFont = *-bold,
BoldItalicFeatures={FakeSlant=0.35}
]{NewsGotT}

\makeatletter
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{0ex}%
    {-3.25ex plus -1ex minus -0.2ex}%
    {1.5ex plus 0.2ex}%
    {\normalfont\normalsize\bfseries}}
\makeatother

\makeatletter
\renewcommand{\subparagraph}{\@startsection{subparagraph}{4}{0ex}%
    {-3.25ex plus -1ex minus -0.2ex}%
    {1.5ex plus 0.2ex}%
    {\normalfont\normalsize\bfseries}}
\makeatother

\makeatletter
\renewcommand{\mainmatter}{%
  \@mainmattertrue%
  %\pagestyle{thesis}
  \pagenumbering{arabic}%
}
\makeatother

\renewcommand{\baselinestretch}{1.5}

\AtBeginDocument{\def\figureautorefname{Figure}} %nome figura em referencia a figura
\AtBeginDocument{\def\tableautorefname{Table}} %nome tabela em referencia a tabela
\AtBeginDocument{\def\chapterautorefname{Chapter}} %nome capitulo
\AtBeginDocument{\def\sectionautorefname{Section}} %nome secção
\AtBeginDocument{\def\lstlistingautorefname{Listing}} %nome listagem
\renewcommand{\lstlistingname}{Listing}% Listing -> Listagem
\renewcommand\labelitemi{\normalfont\bfseries --}   %bullets instead of dashes
\renewcommand\labelitemii{$\m\bullet$}  %bullets instead of dashes
\AtBeginDocument{\renewcommand{\labelitemi}{$\bullet$}} %bullet points nos items
\providecommand{\keywords}[1]{\textbf{\textit{Keywords:}} #1}
\AtBeginDocument{\renewcommand{\contentsname}{Table of Contents}}
\AtBeginDocument{\renewcommand{\listfigurename}{List of Figures}}
\AtBeginDocument{\renewcommand{\listtablename}{List of Tables}}
\AtBeginDocument{\renewcommand{\lstlistlistingname}{List of Listings}}
\AtBeginDocument{\renewcommand{\appendixname}{Appendix}}
\AtBeginDocument{\renewcommand{\bibname}{References}}

\begin{document}
\frontmatter % Use roman page numbering style (i, ii, iii, iv...) for the pre-content pages
\pagestyle{plain} 
% -------------- ACRONYMS --------------
\chapter*{List of Abbreviations and Acronyms}
\begin{acronym}[DCLS---] % Give the longest label here so that the list is nicely aligned
  \acro{ADC}{Analog to Digital Converter}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
  \acro{API}{Application Program Interface}
\end{acronym}
\mainmatter
% -------------- INTRODUCTION --------------
\chapter{Introduction}
\blindtext
\end{document}

答案1

您需要在页码之前添加新页面。/newpage

答案2

\mainmatter的定义book.cls

% book.cls, line 288:
\newcommand\mainmatter{%
    \cleardoublepage
  \@mainmattertrue
  \pagenumbering{arabic}}

您的重新定义缺少\cleardoublepage,这就是您看到的结果。将其修复为

\makeatletter
\renewcommand{\mainmatter}{%
  \cleardoublepage
  \@mainmattertrue
  %\pagestyle{thesis}%
  \pagenumbering{arabic}%
}
\makeatother

在您的软件包列表中,移动

\usepackage{hyperref}
\usepackage{cleveref}

作为最后两个加载的包,按此顺序。这与问题无关,但这是它们应该被加载的方式。

相关内容