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 use the code trying to have the header to display chapter and section alternately

\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[R]{\fontsize{10}{11}\selectfont \thepage}
\fancyhead[L]{\ifthenelse{\isodd{\value{page}}}{\leftmark}{\rightmark}}

but instead of displaying the headers based on the value of pages, I would like to have the header to display section first on the header after every new chapter

My template was obtained from http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/

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

share|improve this question
2  
You're getting the chapter titles, I believe. Can you add a minimal preamble, to show the options you're using with the class? –  egreg Feb 19 '13 at 18:10
2  
The section mark is obtained with \rightmark, while your code only uses \leftmark. Also, note that the above code seem to be made for twosided output (\documentclass[twoside]{...}): RO means "right on odd-numbered pages, LE left on even-numbered pages, LO left on odd-numbered pages and RE right on even-numbered pages. –  Xavier Feb 19 '13 at 23:43
    
@Xavier how can I change the code for onesided output? I just realised that the document is defined for onesided output. –  user25196 Feb 21 '13 at 11:30
    
It really depends on what you are trying to achieve. The fancyhdr manual gives a lot of examples with code. Also, if you want to alternate page styles, you should use twoside as a class option, because that it really what you are designing (even if you don't print as a two-sided document)! Without it, you will basically try to hack yourself a two-sided output based on a one-sided class, with extra bugs (ever thought on how to handle new chapter pages for example?)... –  Xavier Feb 21 '13 at 15:56
add comment

closed as unclear what you're asking by lockstep, Charles Stewart, Claudio Fiandrino, Stefan Kottwitz Jul 17 '13 at 6:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.