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 am writing my thesis using the template obtained from http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/ with a bit of modification to suit my needs.

I would like to have the left header to display the chapter title if there is no other sections in the page, display section title if there is a section there.

If that section is longer than 1 page (2 pages and above), I would like the header to display the section title and chapter title alternately over the pages that cover that particular section.

I use the code

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]%
{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\MakeUppercase{\thesection.\ #1}}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}
\fancyhf{}
\fancyhead[RO,LE]{\fontsize{10}{11}\selectfont \thepage}
\fancyhead[LO]{\fontseries{b}\fontsize{10}{11}\selectfont \leftmark}
\fancyhead[RE]{\fontseries{b}\fontsize{10}{11}\selectfont \leftmark} 

but the header displays only the section title on every page

How can I do it? Any code provided would be much appreciated.

share|improve this question
add comment

1 Answer 1

I've always used fancyhdr which allows you to specify things like the chapter title or section title.

\usepackage{fancyhdr}
\pagestyle{fancy}

You can specify what you want in those sections with various commands.

\fancyhead[OC]{\leftmark}
\fancyhead[EC]{\rightmark}

These commands should put the chapter title centered on the odd pages and the section title centered on the even pages. "O" and "E" refer to odd and even and "C" refers to center. You can also use "L" and "R" for left and right.

This solution will give you "CHAPTER 1. WHATEVER YOUR CHAPTER TITLE IS" in the header. There is probably a way to remove the "CHAPTER 1." portion of it if you wish, but I don't know how.

You can also specify what goes in the footer via similar commands.

\chead{}
\cfoot{}

Are also options (and work for lhead, rhead, lfoot, and rfoot as well).

share|improve this answer
    
i know that i can manipulate the header with all these code but i am not getting what i want as posted –  user25196 Feb 19 '13 at 14:40
add comment

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.