Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to remove the title of a chapter from the header, but the page number must stay intact.

I'm using a the book class

\documentclass[11pt,a4paper,twoside,openright]{book}
\usepackage{lipsum}
\begin{document}
\chapter{Some title}
\lipsum
\end{document}

The script generates two pages. The second page contains a header, page number and title. Now I want to remove the title from that particular page.

-edit- I found out that you can use \thispagestyle{plain}, however when I use this the page number, which is located at the top right, is then placed at the bottom.

share|improve this question
    
If your aim is to remove the header only on a particular page, then \thispagestyle{empty} is the easiest solution. Would you please be more precise? –  egreg Jun 12 '12 at 21:24
    
@egreg yes I see I put my question wrong. Sorry. The thing is is that the page number is also in the header... I only want to have the title of the chapter removed, but not the page number. –  WG- Jun 12 '12 at 21:27
1  
Is it on all pages or only in that particular one? –  egreg Jun 12 '12 at 21:31

2 Answers 2

up vote 2 down vote accepted

Assuming that you want to suppress the chapter name from the header lines of all pages (other than pages which contain the chapter title, which are set in a different pagestyle anyway), you could use the following code. It relies on the etoolbox package and its \patchcmd macro.

\documentclass[11pt,a4paper,twoside]{book} 
\usepackage{etoolbox}
\makeatletter
\if@twoside
   \patchcmd{\ps@headings}%
      {\@evenhead{\thepage\hfil\slshape\leftmark}}%
      {\@evenhead{\thepage\hfil}}{}{}
\fi
   \patchcmd{\ps@headings}%
      {\@oddhead{{\slshape\rightmark}\hfil\thepage}}%
      {\@oddhead{\hfil\thepage}}{}{}  
\makeatother
\pagestyle{headings}
\usepackage{lipsum}
\begin{document}
\chapter{Some title}
\lipsum[1-30]
\end{document}

If the twoside option is in effect, LaTeX will typeset the page numbers on the right-hand side of the header line on odd-numbered pages and on the left-hand side of the header line on even-numbered pages. If the oneside document option is set, all page numbers will be set on the right-hand side of the header line (and, of course, without the chapter name on the left-hand side of the header lines).

By the way, this code works with both the book (default document option setting: twoside) and the report (default document option setting: oneside) document classes.

share|improve this answer
    
"Assuming that you want to suppress the chapter name from the header lines of all pages" Ah well I can live with that. Thanks for your answer. –  WG- Jun 13 '12 at 0:19
    
@Wouter -- If you only want to have the modified headings page style apply to even-numbered pages, just remove the second \patchcmd macro (which extends over three lines) from the code above. By the way, do note that I've generalized the code relative to the initial answer so that it can be used with either the twoside or the oneside document class option. –  Mico Jun 13 '12 at 0:48
    
To the person who down-voted this answer, almost exactly two years after I wrote it: please enlighten me as to what it is about my answer you find incorrect or objectionable. –  Mico Jun 7 at 8:35

Much easier solution (if I'm understanding the original question):

Just use \pagestyle{myheadings}

This will keep your footer, remove the title from your header, and keep the page number in your header.

share|improve this answer
1  
Welcome to TeX.sx! A tip: You can use backticks ` to mark your inline code as I did in my edit. –  doncherry Aug 1 '12 at 12:47

Your Answer

 
discard

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.