# Clear header except page numbering

Edit: Due to failure in answer, I will break the problem into two parts -- simple and complex with the intention of being more clear on what the question deals with.

Simple problem:

With respect to the following MWE, is there a way to clear the header from the first page of Appendix, but leaving the horizontal ruler and page number (just like it is for the very first page of Chapter 1)?

\documentclass[12pt, openright, twoside, a4paper, chapter=TITLE, english]{memoir}

\usepackage{lipsum}

\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\normalsize\scshape\bfseries}{\thechapter}{1em}{}
\titleformat{\section}{\normalfont\normalsize\scshape\bfseries}{\thesection}{1em}{}

\usepackage{fancyhdr}
\pagestyle{empty}
\pagestyle{fancy}
\fancyhf{} %... clears all headers and footers
\fancyhead[LE, RO]{\thepage} %... left-even right-odd page numbering
\fancyhead[LO]{\rightmark} %... left-odd page section title
\fancyhead[RE]{\leftmark} %... right-even page subsection title

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------- STANDARD POS-TEXTUAL ELEMENTS ---------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-> Create counter for appendix
\newcounter{appendix}
\newcounter{appsection}[appendix]
\newcounter{appsubsection}[appsection]

%-> Change numbering format to capitalized alphabetic
\renewcommand{\theappendix}{\Alph{appendix}}

%-> Create appendix title command
\newcommand{\Appendix}[1]{%
%... make sure an odd blank page will be created for the Bibliography environment
\cleardoublepage

%... increase appendix counter
\refstepcounter{appendix}

%... make sure the appendix pages will be fancy
\fancyhf{} %... clears headers and footers
\fancyhead[LE, RO]{\thepage} %... left-even right-odd page numbering
% \def\thispagestyle##1{}

%-> Format title font and positioning
\rule{0cm}{0cm}\bigskip\vspace{3em}

\noindent
{\scshape\textbf{APPENDIX \theappendix\ -- #1}}

\bigskip\vspace{3em}
}

%-> Create appendix section command
\newcommand{\appsec}[1]{%
\def\appsecname{#1}
\refstepcounter{appsection}
\bigskip
\noindent
{\scshape\textbf{\theappendix.\theappsection\hspace{1em}#1}}

\bigskip
}

%-> Create appendix subsection command
\newcommand{\appsubsec}[1]{%
\refstepcounter{appsubsection}
\bigskip
\noindent
{\scshape\textbf{\theappendix.\theappsection.\theappsubsection\hspace{1em} #1}}

\bigskip
}

%-----> BEGIN DOCUMENT <-----%
\begin{document}

\chapter{This is the first chapter} \thispagestyle{fancy}
\section{This is the first section}
\lipsum[1-5]

\section{This is the second section}
\lipsum[6-10]

\Appendix{This is one appendix} \thispagestyle{fancy}
\lipsum[11-12]

\appsec{This is an appendix section}
\lipsum[13-20]

\end{document}


Complex problem:

This is just an addendum motivated by the suggestive use of built-in \appedix.

The reason I avoid \appendix is that I need a table with different horizontal levels for chapters and appendices. The complete piece of code that attempt to do this is the following:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-------- STANDARD POS-TEXTUAL ELEMENTS ---------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-> Create counter for appendix
\newcounter{appendix}
\newcounter{appsection}[appendix]
\newcounter{appsubsection}[appsection]

%-> Change numbering format to capitalized alphabetic
\renewcommand{\theappendix}{\Alph{appendix}}

%-> Create the command to start pos-text
\def\startpostext{%
%-> Format title font and positioning
\titleformat{\chapter}{\normalfont\normalsize\scshape\bfseries}{APPENDIX \thechapter\ -- }{0em}{}
}

%-> Create appendix title command
\newcommand{\Appendix}[1]{%
%... make sure an odd blank page will be created for the Bibliography environment
\cleardoublepage

%... make sure the \leftmark and the \rightmark will be printed correctly
% \phantomsection

%... increase appendix counter
\refstepcounter{appendix}

%... mannualy add the appendix to the ToC

%... make sure the appendix pages will be fancy
\fancyhf{}
\fancyhead[LE, RO]{\thepage} %... left-even right-odd page numbering

%-> Format title font and positioning
\rule{0cm}{0cm}\bigskip\vspace{3em}

\noindent
{\scshape\textbf{APPENDIX \theappendix\ -- #1}}
\thispagestyle{empty}

\bigskip\vspace{3em}
}

%-> Create appendix section command
\newcommand{\appsec}[1]{%
\def\appsecname{#1}
\refstepcounter{appsection}
\bigskip
\noindent
{\scshape\textbf{\theappendix.\theappsection\hspace{1em}#1}}

\bigskip
}

%-> Create appendix subsection command
\newcommand{\appsubsec}[1]{%
\refstepcounter{appsubsection}
\bigskip
\noindent
{\scshape\textbf{\theappendix.\theappsection.\theappsubsection\hspace{1em} #1}}

\bigskip
}


Observe here that \addcontentsline{toc}{chapter}{\protect\numberline{}\textbf{APPENDIX \theappendix\ -- #1}} adds the Appendices to the ToC with the desired indentation (horizontal level) ahead of the chapters. In addition, It is labeld, for instance, APPENDIX A -- Appendix title in the ToC.

Summary:

If there is a way of using \appendix that allows me to alter their horizontal level and display in ToC, that is fine.

If there is a way fo using the definition \Appendix as presented here and clear the header (except for horizontal ruler and page number), that is also okay!

What you call "failure in answer" actually is "failure in specifying all requirements at once".

Be that as it may—let's invent our own wheel by means of memoir: ;-)

\documentclass[12pt, openright, twoside, a4paper]{memoir}

\usepackage{lipsum}

%\usepackage{hyperref}

\makepagestyle{mypagestyle}
\makeevenfoot{mypagestyle}{}{}{}
\makeoddfoot{mypagestyle}{}{}{}
\pagestyle{mypagestyle}
\aliaspagestyle{chapter}{mypagestyle}

\makeatletter
\newcommand\chs@mychapterstyle{%
\@chs@def@ult
\chapterstyle{default}%
\setlength{\beforechapskip}{3em}%
\setlength{\afterchapskip}{3em}%
\renewcommand{\printchaptername}{}%
\renewcommand{\chaptitlefont}{\normalfont\normalsize\bfseries}%
\renewcommand{\chapnumfont}{\chaptitlefont}%
\renewcommand{\afterchapternum}{}%
}%
\newcommand\chs@myappendixstyle{%
\@chs@def@ult
\chapterstyle{default}%
\setlength{\beforechapskip}{3em}%
\setlength{\afterchapskip}{3em}%
\renewcommand{\printchaptername}{\chaptitlefont\MakeTextUppercase{\appendixname}~}%
\renewcommand{\chaptitlefont}{\normalfont\normalsize\bfseries}%
\renewcommand{\chapnumfont}{\chaptitlefont}%
\renewcommand{\printchapternum}{\chapnumfont\thechapter~--~}%
\renewcommand{\afterchapternum}{}%
\renewcommand\chaptermark[1]{%
\@setclcnt{chapter}{@memmarkcntra}%
\markboth{%
\ifnum\c@secnumdepth>\c@@memmarkcntra
\if@mainmatter
\@nameuse{chaptermarksn}%
{\@chapapp\ \@nameuse{thechapter}~--~}%
\fi
\fi
##1%
}
}{}%
}%
}%
\makeatother
\chapterstyle{mychapterstyle}%
\newcommand\chapternumberlinetoappendixnumberline{%
\renewcommand\chapternumberline[1]{\MakeTextUppercase{\appendixname}~##1~--~}%
}%

%-----> BEGIN DOCUMENT <-----%
\begin{document}

\tableofcontents*

\chapter{This is the first chapter}
\section{This is the first section}
\lipsum[1-5]

\section{This is the second section}
\lipsum[6-10]

\appendix
\settocdepth{chapter}
\chapterstyle{myappendixstyle}%

\chapter{This is one appendix}
\lipsum[11-12]

\section{This is an appendix section}
\lipsum[13-20]

\end{document}


Page 1:

Page 2:

Page 3:

Page 4:

Page 5:

Page 6:

Page 7:

Page 8:

Page 9:

• Kkkkkk yes @UlrichDiez you are right. I didn't intend to minimize your contribution. But, as my defense, My question was precisely "How to clear header except for the page number and horizontal ruler using the presented MWE as reference". Your solution now works for me. Thank you again and excellent job! :) – Brasil Jun 13 at 15:14
• My contribution is not that relevant. It merely consisted of skimming over the memoir-manual. The point is: The MWE presented in the initial release of your question did not exhibit in whatsoever way the desired appearance for entries within the table of contents. Statements regarding that came with your edit which took place when my first answer was already submitted. As a rule of thumb, when it comes to fiddling/struggling with LaTeX, it is good practice to state all requirements at once in order to avoid the need of (sometimes totally) reworking things... – Ulrich Diez Jun 13 at 15:28
• Sure! I will pay attention next times! Thank you! – Brasil Jun 13 at 19:03