I have two major problems with my footer in my thesis. In my whole document, my text switch on every pages - it works perfect. But when the reader came to the last two "chapters": 1) References and 2) Appendices - the system won't work.
If someone can help me, I would appreciate it much!
My preamble look like this:
\documentclass[12pt,a4paper,twoside]{report}
% Page layout
\usepackage[bindingoffset=0mm]{geometry}
% Random text
\usepackage{lipsum}
% Page style
\usepackage{fancyhdr}
% References
\usepackage[round, colon, sort, authoryear]{natbib}
% Defining the DEFAULT style
\fancypagestyle{MyStyle}{%
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO]{\small{\leftmark} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \small{\thepage}}
\fancyfoot[LE]{\small{\thepage} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \lsstyle\small{\MakeUppercase{\chaptername}}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\lsstyle\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}
\fancyfoot[LE]{\thepage \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
\begin{document}
\pagestyle{plain}
...pages in plain style...
\pagestyle{MyStyle}
\chapter{Introduction}
\chaptermark*{Introduction}
\section{First section}
\lipsum
\section{Second section}
\lipsum
\chapter{Second chapter title}
\section{Third section}
\lipsum
\section{Fourth section}
\lipsum
\bibliography{References}
\addcontentsline{toc}{chapter}{References}
\chaptermark*{References}
\bibliography{References}
\addcontentsline{toc}{chapter}{References}
\chaptermark*{References}
\clearpage
\appendix
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\chaptermark*{Appendix A}
\end{document}
Text marked by red - is where I would like to put text in - if that make any sense?
--- EDIT ---
By wonderful help by @cfr - I can now type "References" in my footers, but when it comes to my Appendix it won't let "Appendix A" be on both marks. In the first part of the thesis, I am using MyStyle - that is why three different styles are defined.
In my preamble, I added @cfr's code and into it - but I really don't know why it can't show Appendix in footer?
% Page style
\usepackage{fancyhdr}
\pagestyle{fancy}% <- !
% Defining MyStyle
\fancypagestyle{MyStyle}{%
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO]{\small{\leftmark} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \small{\thepage}}
\fancyfoot[LE]{\small{\thepage} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \lsstyle\small{\MakeUppercase{\chaptername}}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\lsstyle\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}
\fancyfoot[LE]{\thepage \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
\fancypagestyle{ref}{%
\fancyhf{}%
\fancyfoot[RO]{\small\rightmark \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}%
\fancyfoot[LE]{\small\thepage \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \leftmark}%
\renewcommand{\headrulewidth}{0pt}% % Remove header rule
\renewcommand{\chaptermark}[2][\chaptername~\thechapter]{\markboth{\lsstyle\MakeUppercase{##1}}{\lsstyle\uppercase{##2}}}%
}
\clearpage
\pagestyle{ref}
\bibliographystyle{apalike}
\bibliography{ref}
\addcontentsline{toc}{chapter}{References}
\markboth{\MakeUppercase{References}}{\MakeUppercase{References}}
%\restoregeometry
\clearpage
\pagestyle{ref}
\appendix
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\chaptermark[Appendix A]{Appendix A}
\markboth{\MakeUppercase{Appendix A}}{\MakeUppercase{Appendix A}}
EDIT - ALMOST FULL PREAMBLE
\documentclass[a4paper,11pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{layout}
\usepackage[protrusion=true,expansion=true]{microtype}
% Different usepackages
\usepackage[T1]{fontenc}
\usepackage[lf]{MinionPro} %% MinionPro
\usepackage{icomma}
\usepackage{setspace}
\setstretch{1.10}
\usepackage{siunitx,booktabs}
\usepackage{graphicx}
%% \usepackage{tocloft} - add if customize TOC
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\usepackage{tabu}
% Chapter
\usepackage[pagestyles ,newparttoc, explicit]{titlesec}%
\usepackage{titletoc}
\SetTracking[no ligatures = {f}]{encoding = }{100}
\usepackage[explicit]{titlesec}
\titleformat{name=\chapter}[display]{ \figureversion{lining}}{\lsstyle\Large\MakeUppercase\chaptername\enspace \LARGE\thechapter}{2ex}{\LARGE\bfseries#1}%\uppercase
\titleformat{name=\chapter, numberless}{\lsstyle\LARGE}{}{0pt}{\MakeUppercase{#1}} \titlespacing{\chapter}{0pt}{2.5ex}{6ex}
\raggedbottom
% Table of Contents
\titlecontents{chapter}[0em]{\large\bfseries\protect\addvspace{15pt}}%\thecontentslabel\brlap[1.25\baselineskip]
{\textssc{\mdseries\MakeLowercase\chaptername~{\footnotesize\thecontentslabel}}\\\medskip}
{}%
{\hfill\contentspage}%
\addtocontents{toc}{\protect\thispagestyle{empty}}
% item / enumerate
\usepackage{enumitem}
% HTML code
\usepackage{listings}
\usepackage{xcolor}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=Java,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=3
}
% Figure & Table names (1, 2, 3, 4 etc.)
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{equation}{chapter}
% More pdf-pages at same site
\usepackage{pdfpages}
% References
\usepackage[round, colon, sort, authoryear]{natbib}
\setlength{\bibsep}{0.0pt}
\setlength{\bibhang}{2em}
\bibpunct{(}{)}{;}{a}{}{}
\setcitestyle{notesep={: }}
\def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}
% Quotes
\usepackage{csquotes}
\MakeOuterQuote{"}
% Page margins
\usepackage[left=3.5cm,right=3.5cm,top=3.4cm,bottom=3.4cm]{geometry}
% PDF background
\usepackage{eso-pic}
% Random text
\usepackage{lipsum}
% Page style
\usepackage{fancyhdr}
\pagestyle{fancy}% <- !
% Defining MyStyle
\fancypagestyle{MyStyle}{%
\fancyhead{}
\fancyfoot{}
\fancyfoot[RO]{\small{\leftmark} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \small{\thepage}}
\fancyfoot[LE]{\small{\thepage} \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \lsstyle\small{\MakeUppercase{\chaptername}}\ \thechapter}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\chaptermark}[1]{\markboth{\lsstyle\uppercase{##1}}{}}
}
% Redefining the PLAIN style
\fancypagestyle{plain}{%
\fancyhead{} %Clean headers
\fancyfoot{} %Clean footers
\fancyfoot[RO]{{\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}
\fancyfoot[LE]{\thepage \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt}}
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
\fancypagestyle{ref}{%
\fancyhf{}%
\fancyfoot[RO]{\small\rightmark \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \thepage}%
\fancyfoot[LE]{\small\thepage \ \ \hspace{2pt} {\vrule height 10pt width 1pt} \hspace{2pt} \ \leftmark}%
\renewcommand{\headrulewidth}{0pt}% % Remove header rule
\renewcommand{\chaptermark}[2][\chaptername~\thechapter]{\markboth{\lsstyle\MakeUppercase{##1}}{\lsstyle\uppercase{##2}}}%
}
% Margin
\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}
% Tabular
\usepackage{threeparttable}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\includepdfset{pagecommand=\thispagestyle{plain}}
\renewcommand{\TPTnoteSettings}{\footnotesize}
\renewcommand{\TPTnoteLabel}[1]{#1}
\usepackage{float}
% Rotate
\usepackage{pdflscape}




\chaptermark*since you don't use that information in the headers or footers, and\renewcommand\chaptermark...isn't really doing anything either. – cfr Aug 15 '15 at 12:22\leftmarkor\rightmarkin the headers, then you can set the marks explicitly and you will have some effect. Else you need some alternative mechanism which doesn't involve manipulating the marks. – cfr Aug 15 '15 at 12:26\leftmarkbut you are not using\rightmarkever in the footer configuration. But, also, what is\bibliography{References}supposed to do? This says that your.bibfile is calledReferences.bibbut you don't declare a bibliography style (BibTeX) or use\printbibliography(Biblatex). How are you managing references? – cfr Aug 15 '15 at 12:36refas well asMyStyle. Note that\smalldoes not take an argument. Also\addcontentsline...and\chaptermark[References]{References}should come before\bibliography{}- not after. – cfr Aug 16 '15 at 12:06tabuunless you don't mind your document suddenly breaking at some future point. The author has promised backwards-incompatible changes and will not fix serious bugs in the meantime. I'm guessing that thetitlesec/titlecontentsstuff is responsible for things not working as you expect. Try commenting those out just to help with diagnosis. – cfr Aug 16 '15 at 16:21fancyhdrandtitleps. Use one or the other - not both. – cfr Aug 16 '15 at 16:23pagestylestotitlesec, which loadstitleps. This isn't bad but you should use it instead offancyhdr, if you wish to, rather than in addition since you don't want two packages competing with each other to configure the same document elements. – cfr Aug 16 '15 at 18:56