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.

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:

\documentclass[12pt,oneside]{book}
\usepackage[english]{babel} 
\usepackage{graphicx} 
\usepackage{natbib}
\usepackage{appendix}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[english]{isodate}
\usepackage[parfill]{parskip} 
\usepackage[colorlinks,pagebackref,pdfpagelabels=true,plainpages=false]{hyperref} 
\usepackage{fancyhdr} 
\usepackage{makecell} 
\usepackage{amsthm} 
\usepackage{pdflscape} 
\usepackage{multirow} 
\usepackage{mdwlist} 

I then include each chapter like this:

\begin{document}
\input{title.tex}
\tableofcontents
\input{overview/overview.tex}
\input{background/background.tex}
\input{chapter1/chapter1.tex}
\end{document}

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.

2.1. A SIMPLE EXAMPLEPART 2. INTRODUCTION TO SIMULATION
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
1  
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
2  
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

1 Answer 1

up vote 9 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

\usepackage{fancyhdr}
\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
1  
@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

 
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.