Page LayoutSubsection Titles in Header of first Page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
LavaTyper
Posts: 69
Joined: Sat Feb 11, 2012 2:38 am

Subsection Titles in Header of first Page

Post by LavaTyper »

Greetings!

I have been searching for hours on trying to figure out why I cannot get a subsection title to appear on the first page of my document.

I have loaded fancyhdr and use \pagestyle{fancy} but I cannot get the subsection to appear when I use \rightmark.

There was a thread posted in 2009 on this very same topic, but no one responded to this person's inquiry.

I am stuck in the same boat, and I couldn't find an answer for why I still have this problem when I did several comprehensive general internet searches and various placements of \pagestyle{fancy} and other related commands.

What's going on?

Here is an example.

Code: Select all

Code, edit and compile here:
\documentclass[11pt]{article}
\usepackage{fancyhdr}
\begin{document}
\pagestyle{fancy}
\fancyhead[L]{}
\fancyhead[R]{\rightmark}
% This won't work on first page and I cannot for the life of me figure out why.
\thispagestyle{fancy} % doesn't matter where I put this
\section{Section title}
\subsection{I want this at the top of all pages including the first}
% subsection not present at the top of the first page
Stuff on the first page
Second paragraph of the first page
\newpage
% subsection is present at the top of the second page
Second page text
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Subsection Titles in Header of first Page

Post by Stefan Kottwitz »

A quick fix would be using \markright or \markboth, such as:

Code: Select all

Code, edit and compile here:
\clearpage
\markright{Text you want}
\section{Section title}
\subsection{I want this at the top of all pages including the first}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Section starting pages are a bit different. However, one could use \subsectionmark or \sectionmark within the argument to \section. But the subsection counter is still not at the desired value at this position. The first fix would help though.

Stefan
LaTeX.org admin
Post Reply