Skip to content

Instantly share code, notes, and snippets.

@lydell
Created December 28, 2017 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lydell/d3ac472684c000d3735f30f910169943 to your computer and use it in GitHub Desktop.
Save lydell/d3ac472684c000d3735f30f910169943 to your computer and use it in GitHub Desktop.
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