Page Layout\rightmark not appearing for 1st pg of 1st subsection

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
mtnbkr
Posts: 14
Joined: Wed Dec 24, 2008 1:48 am

\rightmark not appearing for 1st pg of 1st subsection

Post by mtnbkr »

I'm having a problem getting my subsection mark (thru \rightmark) to display in the footer.

Code: Select all

\fancyfoot[LE,RO]{\LFootFont \rightmark}
Above is the command I'm using, and it mostly works, i.e., the subsection # and title appear in the appropriate part of the footer for all pages EXCEPT the first page of the first subsection of each section. The subsequent pages of the first subsection have the correct footer --- it is only the 1st page that is incorrect. This problem is repeated after starting each new section. Note there are no issues (or shouldn't be as I understand them) of having multiple subsections on the same page (thus redefining the \rightmark), as a \newpage command is given immediately before each \subsection command (except for the first subsection in each section).

Am I being confusing enough? Here's an example to clarify.

example:

Code: Select all

\section{James Blunt}
\subsection{1973}
a bunch of song lyrics filling 2 pages...

\newpage
\subsection{You're Beautiful}
more lyrics, only 1 page...

\newpage
\section{Tom McRae}
\subsection{The Ballad of Amelia Earhart}
again, lyrics, say 1 page

\newpage
\subsection{Bright Lights}
and again 2 pages of lyrics.

% etc.
For this example, the first section ``James Blunt'' will have two songs, each appearing on there own page(s). The first ``1973" will not have a footer on the first page, but the second page of lyrics will have something like ``1.1 1973'' in the footer. The next page will be a single page of lyrics and the footer will read ``1.2 You're Beautiful''.

The next section ``Tom McRae'' will also have two songs (subsections). The first titled ``The Ballad of Amelia Earhart'' will not have a footer. The next, titled ``Bright Lights'' will have the footer ``2.2 Bright Lights'' appear on BOTH pages of lyrics (as I want it to).

Is it clear now?

Any ideas on how to get the \rightmark to appear on ALL pages?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
mtnbkr
Posts: 14
Joined: Wed Dec 24, 2008 1:48 am

Re: \rightmark not appearing for 1st pg of 1st subsection

Post by mtnbkr »

Okay, no bites so far. Maybe I can restate the question in order to get what I need.

I can avoid the above problem if I use \thesubsection in the footer instead of \rightmark ... BUT then I don't get the title of the subsection - just the number. Soooo .... how do I get at the subsection title? What is that called?

My guess is that I could create a footer with {\thesubsection~~\thesubsectiontitle} and have it solve my problem. The problem is \thesubsectiontitle isn't a real command, but is there the equivalent command already out there? If so, what is the name of it?

Yes, I could create the command, but the problem with that is then, whenever I create a new subsection, I would have to follow it with the custom \thesubsectiontitle command with an argument (i.e., title) that is identical to that which is already in the \subsection argument ... redundant and cumbersome :(.

Any ideas?
mtnbkr
Posts: 14
Joined: Wed Dec 24, 2008 1:48 am

\rightmark not appearing for 1st pg of 1st subsection

Post by mtnbkr »

Still no ideas? Well, I thought I'd post my solution to getting the footer that I want. It is a bit of a hack as it means that I have to use my custom defined command \subsec in place of the \subsection command.

In my preamble I define the \subsec & \subsectiontitle commands:

Code: Select all

% define new \subsec command to get subsectiontitle for the footer
\newcommand{\subsectiontitle}{}
\newcommand{\subsec}[1]{\subsection{#1} \renewcommand{\subsectiontitle}{#1}}
Then in the body of my document I change the footer to use the \subsectiontitle

Code: Select all

%%%%% Add the subsection name (i.e. song title) to the footer
\fancyfoot[LE,RO]{\LFootFont \thesubsection~~\subsectiontitle}
This doesn't need to be in the main body, but here I have different footers for different parts of my document, thus this appears at the beginning of the "song lyrics" part of my guitar chordbook.

The other thing to note is that whenever the \subsection command would normally be used, you have to use \subsec in its place. The way it is defined above means that it does exactly the same thing (even shows up appropriately in the table of contents) but gives access to the actual title of the subsection ... or song in my case.

I still don't really like this, and think it is a hackish solution, but I can't figure out why I am getting the current behavior from \rightmark. If anyone knows the answer to that and has a nonhackish solution, let me know.
Post Reply