My problem follows from my difficulties with the english explanations on the marks, from the readmes of fancyhd or titleps, in order to modify the headers. I do not understand the business behind the marks and the ones introduced by the extramarks option.
From what I gather from its readme, the titleps
package has a starred version of the marks permitting to correctly taking into account the very first subsection when it is on the same page as the the section title.
This solves the bug of LaTeX (which I do not fully follows too).
I do not prefer one package over the other, but the titleps gets me closer to what I want. Before the MWE, my wish is to have, with
\documentclass[twoside, a4paper, 11pt]{article}
on every page:
top left =
\thesection--sectiontitle
top middle =
\thepage
top right =
\thesubsection--subsectiontitle
but there is a problem when we change the section, see below.bottom middle =
\the page
For the ToC and the bibliography, I want only "Table of Content" in the top left position and the page in the top right.
With this MWE copied directly from the readme,
\documentclass[twoside, a4paper, 11pt]{article}
\usepackage[topmarks, extramarks]{titleps}
\settitlemarks*{section,subsection}
\newpagestyle{funny}{
\setfoot{\toptitlemarks Top is \thesubsection}
{\firsttitlemarks First is \thesubsection}
{\bottitlemarks Bot is \thesubsection}
\sethead{\firstextramarks{section}\thesection---\sectiontitle}
{\firstextramarks{subsection}\thesubsection---\subsectiontitle}
{\thepage}
}
\pagestyle{funny}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\newpage
\section{first section}
\lipsum[1-3]
\subsection{first subsetion of the first section}
\lipsum[1-3]
\subsection{second subsetion of the first section}
\lipsum[1-3]
\subsection{third subsetion of the first section}
\lipsum[1-11]
\section{second section}
\lipsum[1-11]
\subsection{first subsetion of the second section}
\lipsum[1-3]
\subsection{second subsetion of the second section}
\lipsum[1-11]
\subsection{third subsetion of the second section}
\lipsum[1-11]
\section{thirs section}
%\lipsum[1-3]
\subsection{first subsetion of the third section}
\lipsum[1-3]
\subsection{second subsetion of the third section}
\lipsum[1-3]
\subsection{third subsetion of the third section}
\lipsum[1-11]
\end{document}
However, there is a problem with the header of the ToC and on page 6, we can see that the header is adequate regarding the section, but not for the subsection as it displays the third subsection of the first section ! It should be,
top left= section two
top middle= the page
top right=blank
\subsectionmark{}
right before your\section{second section}
. By the way, all the "mark" stuff is just difficult unless your headers and footers are relatively static... – jon Apr 17 '14 at 15:02