LaTeX forum ⇒ 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).
mtnbkr
Posts: 14
Joined: Wed Dec 24, 2008 1:48 am

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

Postby mtnbkr » Wed Jan 14, 2009 7:15 pm

I'm having a problem getting my subsection mark (thru \rightmark) to display in the footer.
  1. \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:
  1. \section{James Blunt}
  2. \subsection{1973}
  3. a bunch of song lyrics filling 2 pages...
  4.  
  5. \newpage
  6. \subsection{You're Beautiful}
  7. more lyrics, only 1 page...
  8.  
  9. \newpage
  10. \section{Tom McRae}
  11. \subsection{The Ballad of Amelia Earhart}
  12. again, lyrics, say 1 page
  13.  
  14. \newpage
  15. \subsection{Bright Lights}
  16. and again 2 pages of lyrics.
  17.  
  18. % 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?

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

Postby mtnbkr » Fri Jan 16, 2009 10:35 pm

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

Postby mtnbkr » Wed Jan 21, 2009 12:15 am

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:
  1. % define new \subsec command to get subsectiontitle for the footer
  2. \newcommand{\subsectiontitle}{}
  3. \newcommand{\subsec}[1]{\subsection{#1} \renewcommand{\subsectiontitle}{#1}}


Then in the body of my document I change the footer to use the \subsectiontitle
  1. %%%%% Add the subsection name (i.e. song title) to the footer
  2. \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.


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 4 guests