0

I have a problem when I use \mainmatter. When I use it before a chapter, as shown on the code below, the mainmatter page numbering and style starts on the page before the chapter page i.e. the page numbered as "1" is the last page of the acronyms.tex file, and page numbered as "2" its the Introduction chapter page. It is the first time \mainmatter keyword is used on the entire document, and \fronmatter was at the start of the document.

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

The acronyms.tex file contains several acronyms:

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

And the introduction.tex file contains only text.

I've redefined the \mainmatter command to:

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

But still did not fixed it. Here is a visual example:

Here is an visual example

Im using the MasterDoctoralThesis.cls template, and its base class is book.

Any help would be appreciated.

For a self contained example:

%!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}
  • please make a small self contained example that shows your problem. Your redefinition of \mainmatter looks wrong you have removed the clearpage so it will affect the current page (which is what your image shows), but without a test it is hard to say more. – David Carlisle Oct 17 at 15:24
  • So, without you redefining \mainmatter, there would have been no problem? Why did you redefine it? What did you try to achieve? – Johannes_B Oct 28 at 8:55
0

you need to put new page before page numbering. /newpage

| improve this answer | |
  • Thank you. That worked. – azuqk Oct 17 at 17:21
1

The definition of \mainmatter in book.cls is

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

Your redefinition lacks \cleardoublepage, which is the cause of what you see. Fix it into

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

In your list of packages, move

\usepackage{hyperref}
\usepackage{cleveref}

as the last two loaded package, in that order. This is unrelated to the issue, but is the way as they should be loaded.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.