Theses, Books, Title pagesThe \rightmark in fancyhdr is recognized as chapter

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

The \rightmark in fancyhdr is recognized as chapter

Post by templateuser »

Hi,

I changed the document from to "twopage". I would like at the header to appear the chapter name on the one page and the section name on the other (this is the default fancyhdr style I think). But the \rightmark is not recognized as section but as chapter, just like the \leftmark.

I tried to add a new command and use it insted of \rightmark:

Code: Select all

\renewcommand{\sectionmark}[1]{ \markright{#1}{} }
But an error appears when the first subsesection appears.

Are there any ideas how to solve this problem?

Thank you.

elinach

Recommended reading 2024:

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

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

User_2015
Posts: 1
Joined: Thu May 28, 2015 4:39 pm

The \rightmark in fancyhdr is recognized as chapter

Post by User_2015 »

Hi,

It is important to note that in every chapter and corresponding file, the header is overwritten (\lhead). This has to be removed.

I worked for me, when i used the following in Thesis.cls

Code: Select all

\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\thechapter\ #1}{}}
\renewcommand{\sectionmark}[1]{\btypeout{\thesection\space #1}\markright{\thesection\ #1}}
And in main.tex added:

Code: Select all

\pagestyle{fancy} % Return the page headers back to the "fancy" style
\lhead[\rm\thepage]{\fancyplain{}{\sl{\leftmark}}}
\rhead[\fancyplain{}{\sl{\rightmark}}]{\rm\thepage}
before the chapters are loaded

Code: Select all

\input{Chapters/Chapter1}
Post Reply