Page LayoutProblem with Headers due to '\chapter*' Command

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
ydwolf
Posts: 4
Joined: Sat Nov 05, 2011 11:49 am

Problem with Headers due to '\chapter*' Command

Post by ydwolf »

Hi,

For my thesis, I want to work with fancy headers. I used following code:

Code: Select all

\renewcommand{\chaptermark}[1]{\markright{\MakeUppercase{#1}}}
\renewcommand{\sectionmark}[1]{\markright{\thesection~#1}}

\newcommand{\headerfmt}[1]{\textsl{\textsf{#1}}}
\newcommand{\headerfmtpage}[1]{\textsf{#1}}

\fancyhf{}
\fancyhead[LE,RO]{\headerfmtpage{\thepage}}
\fancyhead[LO]{\headerfmt{\rightmark}}
\fancyhead[RE]{\headerfmt{\leftmark}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}

\fancypagestyle{plain}{ % eerste bladzijde van een hoofdstuk
  \fancyhf{}
  \fancyhead[LE,RO]{\headerfmtpage{\thepage}}
  \fancyhead[LO]{\headerfmt{\rightmark}}
  \fancyhead[RE]{\headerfmt{\leftmark}}
  \renewcommand{\headrulewidth}{0.5pt}
  \renewcommand{\footrulewidth}{0pt}
}
But the problem is, this doesn't work because I am using the \chapter* command, so latex doesn't capture my chapter* titles. Can somebody tell me what to do? Tnx!
Last edited by localghost on Sat Nov 05, 2011 11:59 am, 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.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

Re: Problem with Headers due to '\chapter*' Command

Post by Stefan Kottwitz »

Hi,

after \chapter* you can call \chaptermark manually.

Stefan
LaTeX.org admin
ydwolf
Posts: 4
Joined: Sat Nov 05, 2011 11:49 am

Problem with Headers due to '\chapter*' Command

Post by ydwolf »

Tnx for your reply.
But how should I do that exactly?
The following doesn't seem to work.

Code: Select all

\chapter*{1. Inleiding}
\renewcommand{\chaptermark}[1]{\markright{\MakeUppercase{#1}}}
This either:

Code: Select all

\chapter*{{\chaptermark}[1]{\markright{\MakeUppercase{#1}} 1. Inleiding}
Should I still put this command in my preamble?

Code: Select all

\renewcommand{\chaptermark}[1]{\markright{\MakeUppercase{#1}}}
Last edited by Stefan Kottwitz on Sat Nov 05, 2011 2:17 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

Problem with Headers due to '\chapter*' Command

Post by Stefan Kottwitz »

Call it, don't redefine it:

Code: Select all

\chapter*{1. Inleiding}
\chaptermark{1. Inleiding}
The redefinition belongs to the preamble, keep it there.

However, it's unusual to do manual numbering with \chapter*. \chapter* is for unnumbered headings, \chapter for numbered.

Stefan
LaTeX.org admin
Post Reply