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

It seems I have a problem with the headers using the book class. On every chapter when the text is too long the chapter text and the section text merge. Also I don't know how I could make them lower case instead of upper case.

The packages I use can be seen below:


I then include each chapter like this:


Here is a bit of code from background:

\chapter{Introduction to Simulation}\label{part:background}

\section{A Simple Example}\label{sec:sim_example1} 

There is of course content in between. First page of the chapter seems fine however second page of the chapter produces the text below but mangled. It looks a lot better below.

share|improve this question
Note that you can use the option argument to \chapter, \section, etc. to provide a short version used for the table of contents and the headers. – Martin Scharrer Sep 27 '11 at 9:47
Welcome to TeX.SX! It's unusual that the header contains both the chapter and the section titles. Would you please add a short example of your code? – egreg Sep 27 '11 at 9:47
But your code snippets don't really show how you are defining the document headers, and contain some irrelevant (for the mentioned problem) packages. Can you please add to your question all relevant code involved in the header generation? – Gonzalo Medina Sep 27 '11 at 12:06
I haven't got any extra code for the headers. The headers are generated automatically with the packages I use. All the code added above is all I 've got. – Dimitris Sep 27 '11 at 12:53
up vote 12 down vote accepted

The package fancyhdr needs some code after loading it, in order to define precisely what goes in the header.

In oneside format it's not very common to have both the chapter title and the section title, because the header will be too crowded. You probably have somewhere the declaration \pagestyle{fancy}, otherwise the setting would be the standard, that prints on the header only the chapter title and the page number:

2. INTRODUCTION TO SIMULATION                            4

If you want the section title and the page number in the header, then

\pagestyle{fancy} % enable fancy page style
\renewcommand{\headrulewidth}{0pt} % comment if you want the rule
\fancyhf{} % clear header and footer
\fancyhead[L]{\rightmark} % section title on the left
\fancyhead[R]{\thepage}   % page number on the right

If you want the chapter title, change the fifth line into

\fancyhead[L]{\leftmark} % chapter title on the left

There's no practical way to make chapter and section titles to coexist, except to put them on two lines.

share|improve this answer
Thanks that worked, you have helped me a lot. – Dimitris Sep 28 '11 at 13:37
@egreg: How do you change the case of the book.cls header? – Ariel Apr 10 '12 at 14:42
@Ariel It's easy with fancyhdr: \fancyhead[L]{\nouppercase{\rightmark}} – egreg Apr 10 '12 at 14:44
@egreg thanks! As you pointed out in chat this works: \bfseries\nouppercase{\rightmark}} while this \nouppercase \bfseries\{\rightmark}} does not because the \nouppercase needs to go before the rightmark and not the \bfseries – Ariel Apr 10 '12 at 15:15
Special thanks. This is the most clear answer I have seen in an hour on this issue. – phaedrus Sep 20 '12 at 5:10

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.