GeneralHeader width

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
gregatustra
Posts: 9
Joined: Fri Apr 25, 2008 11:56 am

Header width

Post by gregatustra »

Hello there,

i have my header defined like this:

Code: Select all

\pagestyle{fancy}
\fancyhead{}
\renewcommand{\chaptermark}[1]{\markboth{\textsf{Chapter \thechapter:\ #1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\textsf{\thesection\  #1}}{}}
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
\fancyhead[LE,RO]{\thepage}
\fancyfoot{}
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.0pt}
The problem is, if my section/chapter is too long, it gets too close to the page number. If very long, the header is printed ok in 2 lines but still the page number is too close. Anybody has an idea of how to solve this?

Two pictures of my headers are attached (at page 10 of my document).

Tnx,
Greg
Attachments
header_page10_2line.jpg
header_page10_2line.jpg (14.57 KiB) Viewed 12200 times
header_page10.jpg
header_page10.jpg (8.85 KiB) Viewed 12201 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Header width

Post by Stefan Kottwitz »

Hi gregatustra,

that's explained in the fancyhdr user's manual: 12 The width of the headers and footers.

Stefan
LaTeX.org admin
gregatustra
Posts: 9
Joined: Fri Apr 25, 2008 11:56 am

Re: Header width

Post by gregatustra »

I can't get it working with:

\fancyheadoffset[place]{offset}

because all i can set is the left and right offset of the entire header. This results in:

1. the entire header being moved left or right on the page
2. the header being resized

But i would like the header to remain exactly the same size (entire text width), just the chapter/section name of the header to be resized (the page number should stay where it is).

Is this possible?

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

Header width

Post by Stefan Kottwitz »

Hi Greg,

another idea is to limit the width of the chapter mark by a parbox.For example:

Code: Select all

\newcommand*\stdleftmark{}
\let\stdleftmark\leftmark
\renewcommand*\leftmark{\parbox[b]{0.96\textwidth}{\hfill\stdleftmark}}
0.96\textwidth was written quickly, alternatively you may use the calc package to subtract a certain width from \textwidth.
Similar for \rightmark.

But also consider to use the optional parameter of \chapter and \section: \chapter[short text]{long text}

Stefan
LaTeX.org admin
gregatustra
Posts: 9
Joined: Fri Apr 25, 2008 11:56 am

Re: Header width

Post by gregatustra »

Tnx, i actually used minipage instead of parbox to make it work, otherwise in a twoline header the text was not left aligned corrrectly.

Greg
Post Reply