TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Actually I am using the fancyhdr package, and trying to put the current part name in the right header.

I know that \rightmark and \leftmark are used to represent the current section and chapter heading respectively, but I can not find anything similar to represent the part name.

share|improve this question
up vote 11 down vote accepted

That would depend on what type of "part" you are refering to, \chaptername, \sectionname, \thepage, \thesection, \thechapter, etc... See this link for details.

EDIT: In light of your comment, this thread seems to be discussing a solution (note: there is a typo, it must be \renewcommand{\part}..., i.e. a backslash must be added):

For using the parts, you can do the following:


and then use \parttitle in the header.

Another alternative is to use the titlesec package which provides commands like \partmark that you can use.

share|improve this answer
I am refering to \part - en.wikibooks.org/wiki/LaTeX/… – yolo Mar 14 '11 at 14:16
thank you very much - the solution from the thread works! – yolo Mar 14 '11 at 14:44
Note that this redefinition doesn't support the optional argument of \part. – Martin Scharrer Mar 14 '11 at 15:48
I just installed titlesec for this. However \partmark doesn't do anything for me. I checked their documentation and cannot find the phrase \partmark. – oldmankit May 1 '13 at 0:35
To avoid a bug when using this together with \AtBeginPart, the last line could rather be: \renewcommand{\part}[1]{\renewcommand{\parttitle}{#1}\Oldpart{#1}} – Turion Jul 27 '15 at 20:21

Putting the part title into the header is not common, therefore there are no default macros for this.

You could redefine the \part macro to save its argument to e.g. a \parttitle macro which then can be used in the custom defined headers:

   \ifx\\#1\\% optional argument not present?
share|improve this answer

In the KOMA-classes \part executes a \partmark command which you could use to set either \rightmark or \leftmark to the part title.

But as \part always generates a new page and you probably need the header only on the next page you can also do something simple like this:



and then use \partcontent in the header.

share|improve this answer
+1 for \partmark, which is not mentioned in the KOMA-script manual. – lockstep Mar 14 '11 at 14:36

You could use \markboth{left headmark}{right headmark}% to put the title into the header. Some classes provide a \partmark command for it, which you could redefine for calling \markboth inside.

Standard classes don't provide \partmark. For example, book.cls even calls \markboth{}{} to remove the header entries when \part is called. You could redefine \part or hook somehow into it.

I would choose an extended class such as those of KOMA-Script instead of reinventing the wheel every time a new feature is required.

Deferring \markboth to the following page could be solved using the afterpage package:

\afterpage{\markboth{}{part title}}
share|improve this answer

I couldn't find a macro that saves the part's title, so I used the etoolbox package to patch the internals within the \part command to do that. Then you just take that save macro and put it wherever.

\title{part name in right mark}

% patch \@part[#1]{#2} and \@spart (see the class file) to save the part name




\part{First part}

\chapter{first chapter}


\chapter{second chapter}


\part{Second part}

\chapter{third chapter}


\chapter{fourth chapter}


share|improve this answer
a more elegant solution... the marked answer was causing a few problems in another document – yolo May 15 '11 at 11:48
@umar: It is perfectly admissible to "un-accept" an answer and accept another one instead. – lockstep Dec 4 '11 at 20:45
No works in book class, just appears "#1" ... at least in my case – juanuni May 2 '15 at 1:39
@juanuni: The book class might have a different implementation of \part. My patching of auxiliary macros was specific to how report did it. – Matthew Leingang May 8 '15 at 15:01
@MatthewLeingang I saw that ... – juanuni May 8 '15 at 15:56

I would like to expand a little on Martin Scharrer's answer. If you also need the chapter number, you can do this:

\directlua{partcount = 0}
   \ifx\\#1\\% optional argument not present?
   \directlua{partcount = partcount + 1}%

It defines the \partnumber command, to get the part number, as well as the \parttitle command.

This is using LuaTex, but something similar is probably also possible in plain LaTeX.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.