GeneralHeader text too long

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
moonlight
Posts: 10
Joined: Fri Oct 31, 2008 8:04 pm

Header text too long

Post by moonlight »

Hi all,

I'm using the fancyhdr package to get headers on each page of my document. I've put the following command at the start of the document...

Code: Select all

\pagestyle{fancy}
... and it works fine. But the trouble is that I have a section title in my first chapter that is too long so it gets written over the 'Chapter 1' bit at the right end of the header. It looks terribly messy. I tried to use a shorter alternative name in square brackets like this:

Code: Select all

\section[short name]{long name}
But I'm not really satisfied with this solution. Not only is the shorter name less informative, but it also gets inserted in the table of contents at the beginning of the document: so that's a problem. I also tried removing the header all together on the 2 pages of this section with the command:

Code: Select all

\thispagestyle{empty}
I put it in twice: once for each page. Just after the section name for the 1st page, and the second time in the middle of the text that shows up on the other page. But it only removes the header from the second page, not the first. I tried inserting the command in the middle of the text of the first page of the section too, but to no avail.

Ideally, I'd like to simply remove the chapter name from the header just for the two pages of this section.

Is this possible?

Thanks in advance,
moonlight.

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Header text too long

Post by Stefan Kottwitz »

Hi,

you could use \markboth.

Stefan
LaTeX.org admin
moonlight
Posts: 10
Joined: Fri Oct 31, 2008 8:04 pm

Header text too long

Post by moonlight »

Thanks Stefan_K,

I used

Code: Select all

\markboth{string 1}{string 2}
It worked! But how can I reset the original headings in the next section? It keeps using 'string 2' on the right hand side of the header now in the next section. I put in \pagestyle{fancy} to bring it back to the original, like in the beginning of the document, but that doesn't fix it.

Thanks,
moonlight.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Header text too long

Post by Stefan Kottwitz »

Hi,

does

Code: Select all

\markboth{string 1}{\rightmark}
help?

Stefan
LaTeX.org admin
moonlight
Posts: 10
Joined: Fri Oct 31, 2008 8:04 pm

Re: Header text too long

Post by moonlight »

Hi Stefan_K,

Thanks very much: it works!

Cordially,
moonlight.
Post Reply