0

I am trying to make the appendices to my Master's thesis. The template consists of several parts that are arranged in a file called "final.tex". I'm having two problems with appendices:

  1. I can keep the index the way I want it, but appendices A, B and C instead of starting with A.1, B.1 and C.1 start with A.1, A.1 and A.1 always, regardless of the letter of the appendices. I want the title of the appendices: "Anexos A", "Anexos B" and "Anexos C" not to have a letter in front, but that the subtitles have a letter, the dot and the number.
  2. The blank pages added in the appendices are not being assumed. When the number of pages is odd, the template is not putting a blank page in the appendices, as it does with the rest of the document.

How can I resolve these two issues? I've tried to see other Stack Exchange questions and tried to see if it worked, but I still haven't been able to get the template to work properly.

Code of the "final.tex" file:

\documentclass[11pt]{book}
%oneside ou openany serve para tirar paginas em branco depois das secções
% Omitting Page Numbers
\pagenumbering{gobble} 

% Packages
\usepackage[a4paper,left=2.5cm,right=2.5cm,top=4cm,bottom=4.9cm]{geometry}
\renewcommand{\baselinestretch}{1.15}
\usepackage{graphicx,kantlipsum,setspace}
\usepackage{caption}
\captionsetup[table]{font={stretch=1,footnotesize}, labelfont=bf}
\captionsetup[figure]{font={stretch=1,footnotesize}, labelfont=bf}
\usepackage[font=bf]{caption}
\usepackage{indentfirst}
\usepackage{textcomp}
\usepackage{makecell}
\usepackage{mathtools,float,geometry}
\usepackage{booktabs,array,tabularx,threeparttablex}
\usepackage[portuguese]{babel}
\usepackage{subfig}
\usepackage[version=4]{mhchem}
\usepackage{comment}
\usepackage{float}
\usepackage{catoptions}
\usepackage{graphicx}
\usepackage{bm}
\usepackage{adjustbox}
\usepackage{cite}
\usepackage{caption}
\usepackage{fontspec}
%\usepackage{natbib}
\usepackage{cite}
%\setcitestyle{square}
\usepackage{afterpage}  % blank pages
\usepackage{multirow}  % table
%\usepackage[table, dvipsnames]{xcolor}  % table
\usepackage{xpatch}  % table
\usepackage{tabu}  % table
\usepackage{hhline}  % cell color does not overlap cell line
\usepackage{fancyhdr}  % headers
\usepackage{breakcites}  % references do not go though margins
\usepackage{sectsty}  % change chapter title size
\setcounter{tocdepth}{3}  % four level contents
\setcounter{secnumdepth}{3}  % numbered four level contents
\usepackage{amsfonts}  % math
\usepackage{amsmath}  % math
\usepackage[nottoc,notlof,notlot]{tocbibind}
\usepackage{hyperref}  % references
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage{fixmath}
\usepackage{scalerel}
\newlength\bshft
\bshft=.18pt\relax
\def\fakebold#1{\ThisStyle{\ooalign{$\SavedStyle#1$\cr%
  \kern-\bshft$\SavedStyle#1$\cr%
  \kern\bshft$\SavedStyle#1$}}}
\newlength\longest
\makeatletter
\newcommand{\unchapter}[1]{%
  \begingroup
  \let\@makechapterhead\@gobble % make \@makechapterhead do nothing
  \chapter{#1}
  \endgroup
}
\makeatother
\usepackage{tcolorbox}
\usepackage{amssymb}
\tcbuselibrary{theorems}
\newtcbtheorem
  []% init options
  {definição}% name
  {Definição}% title
  {%
    colback=gray!5,
    colframe=gray!20!gray,
    fonttitle=\bfseries,
  }% options
  {def}% prefix
%\newcommand{\rectangle}{{  % rectangle
%  \ooalign{$\sqsubset\mkern3mu$\cr$\mkern3mu\sqsupset$\cr}
%}}

%\newcommand\BibTeX{B{\sc ib}\TeX}

% References
\hypersetup{
   colorlinks=true,
   linkcolor=black,
   filecolor=black,
   citecolor=black,
   urlcolor=black,
   bookmarksopen=true,
   linktocpage=true,
   pdfpagemode=UseOutlines,
   pdfstartpage=1
}

% Blank Page
\newcommand\blankpage{
    \null
    \thispagestyle{empty}
    \addtocounter{page}{-1}
    \newpage}

% Hide Blank Pages Numbers + Headers
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
  \clearpage
  {\pagestyle{empty}\origdoublepage}%
}

% Space between numbers and text
\geometry{footskip=1.2cm}

\begin{document}
\begingroup

\newgeometry{left=3cm, right=3cm, top=1cm, bottom=1.2cm}
\renewcommand{\baselinestretch}{1.9}

%\include{parts/capa_provisoria}
\include{parts/capa_definitiva}

\afterpage{\blankpage} %comentar para tirar paginas em branco

\endgroup

% Preamble for Thesis
\setmainfont{Times New Roman}
\newgeometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm}
\renewcommand{\baselinestretch}{1.15}
\pagenumbering{Roman}
\pagestyle{plain}
\let\cleardoublepage\clearemptydoublepage  % hide blank pages numbers + headers

\include{parts/agradecimentos}
%tenho um problema com a numeração das paginas
%%\afterpage{\blankpage}
\include{parts/dedicacao}
%%\afterpage{\blankpage}
\include{parts/abstract}

\include{parts/resumo}

%\include{parts/resumo_alargado}

\include{parts/contents}

\include{parts/list_of_figures}

\include{parts/list_of_tables}

\afterpage{\blankpage} %comentar para tirar paginas em branco

% After Introductory Pages
\pagenumbering{arabic}
\pagestyle{fancy}
\newgeometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm,headsep=1cm}
\setlength{\headheight}{14pt} 

\chaptertitlefont{\Huge} % to fit chapter title to one line
\chapternumberfont{\Huge} 

\include{parts/introducao}

\include{parts/propriedadesTMDs}

\include{parts/aplicacoes}

\include{parts/metodosexperimentais}

\include{parts/resultadosediscussao}

\include{parts/conclusao}

\pagestyle{plain}  % no more header 

\include{parts/bibliografia}
\appendix
\renewcommand{\thesection}{\Alph{section}.\arabic{section}}
\include{parts/AnexosA}

\include{parts/AnexosB}

\include{parts/AnexosC}
\end{document}

Appendix A part code:

%\newpage
\appendix
\section*{\Huge Anexos A}
\addcontentsline{toc}{chapter}{Anexos A}
%\chapter*{Anexos A}
%\addcontentsline{toc}{chapter}{Anexos A}
\renewcommand{\theequation}{A.\arabic{equation}}
\setcounter{equation}{0}
\vspace{1cm}
\section{Diferença de caminho óptico}

Appendix B part code:

\newpage
\appendix
\section*{\Huge Anexos B}
\addcontentsline{toc}{chapter}{Anexos B}
%\chapter*{Anexos A}
%\addcontentsline{toc}{chapter}{Anexos A}
\appendix
\renewcommand{\theequation}{B.\arabic{equation}}
\setcounter{equation}{0}
\vspace{1cm}
\section{Distribuição log-normal}

Table of contents: enter image description here

Errors with parts "Anexos A" and "Anexos B":

enter image description here enter image description here enter image description here

3

You are resetting the numbering by using \appendix multiple times. Try using it before the whole appenix part only, like this:

\documentclass{book}

\usepackage{blindtext}

\begin{document}
    \tableofcontents
    \Blinddocument

    \appendix

    \refstepcounter{chapter}
    \chapter*{\appendixname\enskip\thechapter}
    \addcontentsline{toc}{chapter}{\appendixname\enskip\thechapter}
    
    \section{Section in Appendix A}

    \refstepcounter{chapter}
    \chapter*{\appendixname\enskip\thechapter}
    \addcontentsline{toc}{chapter}{\appendixname\enskip\thechapter}

    \section{Section in Appendix B}

\end{document}
1
  • This is perfect. It worked! Thanks for the help! – Carmen González Feb 23 at 13:18

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.