I have two sections on one page. Unfortunately fancyhdr
takes the second one as the page header, which will result in something like seen in the image below.
I want to have the first section as the header title (in this case: Introduction).
Here is the code for the above image:
\documentclass[12pt, oneside]{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\fancyplain{}{\leftmark }}
\rhead{}
\usepackage{lipsum} %only for dummy text
\begin{document}
\section{Introduction}
\lipsum[2]
\section{Overview}
\lipsum[2]
\end{document}
Best Answer
titleps
- as an alternative tofancyhdr
- provides\toptitlemarks
and\bottitlemarks
to identify the top/bottom titles on a page, respectively. It should not be difficult to switch totitleps
, in my opinion. Here's a short example that illustrates this (click the image to enlarge):The above MWE produces 3 pages with headers:
Obviously page 3 presents a problem. However, you might not be interested in a dictionary-style header (showing both the first and last section on the page).
See the
titleps
documentation (section 4. Marks, p 4) for more information.