0

I'm having a little problem with the appendices environment that probably is very easy to solve, but for the life of me I haven't been able to figure it out. Here is the deal, I need to add appendices to a document and in order for this part to be in the same style as the entire document, I need for the appendices first page to have a header. Right now it just produces the title "Apéndice" (in spanish on purpose) and the page number, but not the header that the rest of the document has, i.e., the page number and the chapter title. Basically I want the appendix page to have a header with the word "Apéndice" in it like the rest of the document and I only get the number. Any ideas???

PD: Just to clarify, the rest of the appendix is working fine. It's just the first page.

Thanks in advance!!

Here is a short version of the LaTeX code I have.

\documentclass[english, a4paper, 12pt, openany, twoside]{book} 
\usepackage{textcomp}
\usepackage[T1]{fontenc, url}
\usepackage[utf8]{inputenc} 
\usepackage{titlesec} 
\setcounter{secnumdepth}{4} 
\usepackage{multirow} 
\usepackage{minted} 
\usepackage{adjustbox}
\usepackage{graphicx} 
\usepackage{amsmath, amssymb, amsthm}
\usepackage{parskip} 
\urlstyle{sf} 
\usepackage{color}
\usepackage{subcaption}
\usepackage[toc,page]{appendix}
\usepackage{chngcntr} 
\counterwithin{table}{section}
\counterwithin{figure}{section} 
\numberwithin{equation}{section}
\hyphenpenalty=100000
\sloppy 
\raggedbottom
\usepackage{xparse,nameref} 
\usepackage[bottom]{footmisc}
\usepackage{lipsum} 

% ----- Header and footer -----

\fancypagestyle{plain}{
\fancyhf{} 
\fancyhead[RO,LE]{\thepage} 
\fancyhead[RE,LO]{\nouppercase{\leftmark}} 
\fancyfoot{} 
}

\pagestyle{fancy} 
\fancyhead[RO,LE]{\thepage}
\fancyhead[RE,LO]{\nouppercase{\rightmark}}
\fancyfoot{} 


%--- Document Begins---

\begin{document}

%-------------- index.    
\newpage
{\setstretch{1.0} % interlineado de la lista.
\tableofcontents
}

\newpage
\addtocontents{toc}{\protect\setcounter{tocdepth}{4}} 

\newpage

some text and chapters

%------- Appendix page ----
\newpage
\renewcommand{\appendixpagename}{Apéndice} % Title in spanish
\renewcommand{\appendixtocname}{Apéndice} % title in spanish in TOC

\begin{appendices} 
    \subfile{Capitulos/Apendice} %calls appendix file
\end{appendices}

\end{document}
1

You could patch \@chap@pppage (command provided by package appendix for the appendix page):

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@chap@pppage}
  {\markboth{}{}}
  {\markboth{\appendixpagename}{\appendixpagename}}
  {}{\PatchFailed}
\makeatother

Example (without the unrelated stuff):

\documentclass[a4paper,12pt,openany]{book}
\usepackage{blindtext}% only for dummy text in the example
\usepackage[T1]{fontenc}

\usepackage[toc,page]{appendix}
\renewcommand{\appendixpagename}{Apéndice}
\renewcommand{\appendixtocname}{Apéndice}

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@chap@pppage}
  {\markboth{}{}}
  {\markboth{\appendixpagename}{\appendixpagename}}
  {}{\PatchFailed}
\makeatother


% ----- Header and footer -----
\usepackage{fancyhdr}
\fancypagestyle{plain}{
  \fancyhf{} 
  \fancyhead[RO,LE]{\thepage} 
  \fancyhead[RE,LO]{\nouppercase{\leftmark}} 
  \fancyfoot{} 
}

\pagestyle{fancy} 
\fancyhead[RO,LE]{\thepage}
\fancyhead[RE,LO]{\nouppercase{\rightmark}}
\fancyfoot{} 

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\raggedbottom

\begin{document}
\tableofcontents
\blinddocument

\begin{appendices}
  \blinddocument
\end{appendices}
\end{document}

Result:

enter image description here

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.