Skip to content

Instantly share code, notes, and snippets.

@lydell
Created Dec 28, 2017
Embed
What would you like to do?
LaTeX pagestyle confusion
\documentclass[twoside]{article}
\usepackage{fancyhdr}
\usepackage{extramarks}
\setlength{\headheight}{14pt}
\fancypagestyle{ttlpage}{
\fancyhf{}
\fancyhead[L]{First page head}
}
\fancypagestyle{simple}{
\fancyhf{}
\fancyhead[LE, RO]{\thepage}
}
\fancypagestyle{main}{
\fancyhf{}
\fancyhead[LE, RO]{\thepage}
\fancyhead[LO]{\firstleftmark}
\fancyhead[RE]{\lastrightmark}
}
\begin{document}
\thispagestyle{ttlpage} % Causes problems.
%\pagestyle{ttlpage} % Works fine.
first page
\newpage
\pagestyle{empty} % With \thispagestyle above, causes missing \firstleftmark and \lastrightmark
%\pagestyle{simple} % With \thispagestyle above, causes "CONTENTS" to be printed instead of "INTRODUCTION",
\tableofcontents
\newpage
\pagestyle{main}
\section{Introduction}
\subsection{Foo}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment