0

I'm currently writing my dissertation and used this template; https://www.sharelatex.com/templates/thesis/graduate-thesis

However I'm getting the most unusual error when using fancyhdr to display the chapter name in the header.

I want it so on the left side it displays the chapter name, and the page number on the right. Previously in the template the following was used;

\lhead{\emph{Contents}}  % Set the left side page header to "Contents"
\tableofcontents  % Write out the Table of Contents

So I copied this syntax when including the chapters like so ;

\input{Chapters/Chapter1} % Introduction
\lhead{\emph{Introduction}}  % Set the left side page header to "Introduction"

\input{Chapters/Chapter2} % Background Research 
\lhead{\emph{Background Research}}  % Set the left side page header to "Background Research"

The problem I am getting is that the chapter names are messing up, for example: Chapter 4 = Project Planning, and chapter 5 = Design, but for chapter 5 it wont display 'Design' in the header at all and carry on displaying 'Project Planning'.

Something else that is baffling me is that I originally had a chapter named 'Development' , and another named 'Testing', however I merged the two into one (just deleted the testing chapter and put the content into the development chapter), and renamed the lhead to 'Development & Testing', however when compiling and viewing the PDF, some pages will show 'Development' in the header, and others 'Development & Testing'.

I don't know why this is happening, the compiling I am doing is;

PdfLaTeX + Bib(la)tex + PdfLaTeX (x2) + View Pdf

If more code is required, I can supply it, but I thought If I were to link the template I am using, it would show what the code would look like.

Many Thanks for your help.

6
  • 2
    Welcome. I have troubeling news for you. This template is very very bad and you shouldn't use it. There are several better templates around. If you go on working with this template, you will get more issues. Sorry.
    – Johannes_B
    Apr 30, 2017 at 11:52
  • Your issue: you input some file and then set the header afterwards. It is not astonishing that your "error" occurs. Try putting the header information at the right place, before.
    – TeXnician
    Apr 30, 2017 at 11:55
  • If you are interested in the history of the template: github.com/johannesbottcher/templateConfusion/blob/master/…
    – Johannes_B
    Apr 30, 2017 at 12:00
  • Even having the header information before the chapter inclusion, I get a similar problem. As for this template, I dreaded hearing this, are there any templates you would recommend?
    – Richard G
    Apr 30, 2017 at 12:00
  • Hi Richard - welcome to tex.stackexchange. A better solution than manual use of \lhead (or whatever) is to get latex to keep track of your chapter names (and/or section names) itself. There are examples around that show how to use \leftmark and \rightmark to keep track of these. Apr 30, 2017 at 12:02

1 Answer 1

2

Thanks all for the comments and advice. Reading the link supplied by Johannes_B;

https://github.com/johannesbottcher/templateConfusion/blob/master/ourFamousThesisTemplate.md

A quick fix to the solution is to include the following in each chapter file (providing you remove the \lhead{chapter name goes here} from the main file);

\chapter{Background Research}
\label{Chapter2}
\lhead{\emph{Background Research}} % Write in your own chapter title to set the page header

This fixes the problem if you don't have the time to start fresh / use a better template.

However, for myself I think it will be best to start a fresh minimal template to reduce further errors from the template I have been using.

Thank you to those who have contributed.

2
  • 1
    I recommend starting with the book class
    – Moriambar
    Apr 30, 2017 at 12:25
  • Using \lhead still is wrong. The whole template does strange things.
    – Johannes_B
    Apr 30, 2017 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .