Page Layoutheaders in chapter with no sections

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
lauraf
Posts: 29
Joined: Tue Jan 13, 2009 12:44 pm

headers in chapter with no sections

Post by lauraf »

Hi all,

For my thesis, I am using fancyhdr with the following specifications:

Code: Select all

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]% 
{\markboth{\MakeUppercase{\thechapter.\ #1}}{}} 
\renewcommand{\sectionmark}[1]% 
{\markright{\MakeUppercase{\thesection.\ #1}}} 
\fancyhf{}
\fancyhead[RO]{\bfseries\rightmark}
\fancyhead[LE]{\bfseries\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}
\fancypagestyle{plain}{
  \fancyhead{}
  \renewcommand{\headrulewidth}{0pt}
}
The thesis is one-sided. In most chapters, this produces a header including a rule and the section number/title as text, for example:

3.2 DATA AND METHODS

However, Chapter 7, the conclusion chapter, has no sections/subsections, so in this case the header includes the rule but no text. What I want instead is the rule with the chapter title as text, i.e.:

7. CONCLUSION

Can anybody help? I have read through the fancyhdr documentation carefully but could not figure this out.

Many many thanks!
Laura
Last edited by lauraf on Wed Nov 25, 2009 12:28 pm, edited 1 time in total.

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
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

headers in chapter with no sections

Post by localghost »

Try \markboth to customize the page style.


Best regards
Thorsten
lauraf
Posts: 29
Joined: Tue Jan 13, 2009 12:44 pm

headers in chapter with no sections

Post by lauraf »

Thank you Thorsten. This does the trick:

Code: Select all

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]% 
{\markright{\MakeUppercase{\thechapter.\ #1}}{}} 
\renewcommand{\sectionmark}[1]% 
{\markright{\MakeUppercase{\thesection.\ #1}}} 
\fancyhf{}
\fancyhead[R]{\bfseries\rightmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}
\fancypagestyle{plain}{%
  \fancyhead{}
  \renewcommand{\headrulewidth}{0pt}
}
Best regards,
Laura
Post Reply