5

I'm looking for the way (assuming there is one) of putting the current page's chapter title in the header of the page. Basically, what I want is:

enter image description here

where only the chapter's title ("First Chapter" in this case) shows up.

However, what I get is:

enter image description here

or some variant, but always with "Chapter 1" or just "Chapter" in there.

My code is:

 % AUTHOR: Enter the title, all letters in upper case
\def \booktitle{Trial Title}
\def \currentrevision{A}
\def \documentnumber{ME-MAN-001}

\title{\booktitle}


\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\leftmark}

% \fancyhead[LE,RO]{FIRST CHAPTER}

\fancyhead[RE,LO]{\documentnumber~Rev.~\currentrevision}
\fancyfoot[LE,RO]{\thepage}

Yes, I am using fancyhdr and I've reviewed the documentation and tried the variants, but nothing seems to work. I've also tried too many things to detail here.

0
10

You have to adjust \chaptermark to avoid inserting the \@chapapp \thechapter. prefix. It's truly as simple as adding

\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}

to your preamble. Here's a complete, minimal example:

enter image description here

\documentclass{book}
\usepackage{fancyhdr,lipsum}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\leftmark}

\fancyhead[RE,LO]{\documentnumber~Rev.~\currentrevision}
\fancyfoot[LE,RO]{\thepage}

\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}

\def \currentrevision{A}
\def \documentnumber{ME-MAN-001}

\begin{document}

\chapter{First chapter}
\lipsum[1-50]

\end{document}

This is also fairly straight-forward using titleps:

enter image description here

\documentclass{book}
\usepackage{titleps,lipsum}
\newpagestyle{main}{
  \setheadrule{.4pt}% Header rule
  %\setfootrule{.4pt}% Footer rule
  \sethead[\documentnumber~Rev.~\currentrevision]% odd-left
          []% odd-center
          [\MakeUppercase{\chaptertitle}]% odd-right
          {\MakeUppercase{\chaptertitle}}% even-left
          {}% even-center
          {\documentnumber~Rev.~\currentrevision}% even-right
  \setfoot[]% odd-left
          []% odd-center
          [\thepage]% odd-right
          {\thepage}% even-left
          {}% even-center
          {}% even-right
}
\pagestyle{main}

\def \currentrevision{A}
\def \documentnumber{ME-MAN-001}

\begin{document}

\chapter{First chapter}
\lipsum[1-50]

\end{document}

If you're interested in switching from fancyhdr to titleps, see titleps for fancyhdr users.

4
  • 3
    I love titlesec and friends, but boy do they make the simple things seem complicated. Jan 7 '15 at 5:36
  • Ah!! The key was that the \renewcommand must come after the \pagestyle declaration. Seems obvious now, but not then. Anyway, I really appreciate the responses. Thanks.
    – Dave
    Jan 8 '15 at 7:11
  • @Dave: You can place it before the \pagestyle as well. Try it out. If this answered your question, consider accepting it as such.
    – Werner
    Jan 8 '15 at 15:19
  • @Werner: That's why I pointed it out...it doesn't work if you (well, I) put it before \pagestyle. Now I want to do the same with Section (i.e. get rid of the numbering.)Thanks
    – Dave
    Jan 9 '15 at 4:36

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