6

I am using the book class for my thesis. In every page that is not the beginning of a chapter, LaTeX writes the number and name of the chapter in the header. Is there any simple (emphasis on the simple) way to remove it? I'd like to have simple headers, with nothing on them but the page number.

MWE

\documentclass[10pt]{book}
\usepackage{blindtext}
\usepackage[a4paper]{geometry}
\usepackage{fancyhdr}

\fancyhead[LE,RO]{\thepage}
\fancyfoot{}
%\fancyhead[RO,LE]{\thepage}
%\fancyhead[LO]{\leftmark}
%\fancyhead[RE]{\rightmark}

\cfoot{} % get rid of the page number 

\pagestyle{fancy}

\begin{document}
  \blinddocument
\end{document}
2
  • Have you tried fancyhdr? I haven't used it with book class, but it almost certainly does what you want!
    – FionaSmith
    Apr 10 '14 at 9:30
  • Oops, xpost there :)
    – FionaSmith
    Apr 10 '14 at 9:30
5

Solution with nothing

\documentclass[12pt,a4paper]{book}
\usepackage{blindtext} % just for the example

\renewcommand{\chaptermark}[1]{}
\renewcommand{\sectionmark}[1]{}
\makeatletter
\renewcommand{\@mkboth}[2]{}
\makeatother

\begin{document}

\blinddocument

\end{document}

Explanation

The text in the headers is controlled by the argument given to \chaptermark and \sectionmark, which are emitted automatically when \chapter or \section are processed.

For the “special units” such as the table of contents and the bibliography, LaTeX uses \@mkboth, an internal variant of those commands, so we need to disable it, too.

Comment

Of course the methods with packages such as fancyhdr, titleps or scrlayer-scrpage (the newer version of scrpage2) are more powerful. But for “no header” this method is much easier.

1
  • I am all for learning the simplest solution to any problem!
    – FionaSmith
    Apr 10 '14 at 12:18
2

Solution with fancyhdr

\documentclass[12pt,a4paper]{book}
\usepackage{fancyhdr}
\usepackage{blindtext} % just for the example

\fancyhf{}
\fancyhead[R]{\thepage}
\pagestyle{fancy}

% redefine the plain pagestyle
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\thepage} % except the center
}
\renewcommand{\headrulewidth}{0pt} 
\begin{document}

\blinddocument

\end{document}

Solution with titleps

\documentclass{scrbook}


\usepackage{blindtext}

\usepackage[a4paper]{geometry}


\usepackage{titleps}% http://ctan.org/pkg/titleps
\newpagestyle{main}{
\setheadrule{0pt}% Header rule
\sethead{}% left
        {}% center
        {\thepage}%       right
}
\pagestyle{main}
\begin{document}
\blinddocument
\end{document}

Solution with scrpage

\documentclass[a4paper,11pt]{scrbook}

%\usepackage{scrlayer-scrpage} %head-foot koma new
\usepackage{scrpage2} % Old package
\clearscrheadfoot
\ohead{\thepage}

\usepackage{blindtext} % just for the example

\begin{document}
\pagestyle{scrheadings}
\blinddocument

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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