3

I want to make some headings on my thesis.

I use the following codes in my cls file.

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter. #1 }}{}}
\renewcommand{\sectionmark}[1]{}
\fancyhf{}
\fancyhead[RO]{\rightmark}
\fancyhead[LE]{\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}
\fancypagestyle{plain}{
  \fancyhead{}
  \renewcommand{\headrulewidth}{0pt}
}

However only a line appear in the upperspace of the pages and no headings. So i try to use

\markboth{aaaa}{bbbb}

Then the headings appear. But what i want is "aaaa" appears on every odd page and "bbb" appears on every even page

1
  • If i use markboth as above then only "bbbb" appearing on every page. Jul 4 '13 at 7:01
7

Note that you can use different headers on odd and even pages only if your document class is loaded with the twoside option.

For example, if you have:

\documentclass{book}
\fancyhead[RO]{aaaa}
\fancyhead[LE]{bbbb}

then aaaa is printed on the right side of odd pages and bbbb is printed on the left side of even pages. This because the document class book is automatically loaded with the twoside option.

If you want to achieve the same result with document classes such as report, you have to explicitly load them with the twoside option. E.g.

\documentclass[twoside]{report}
\fancyhead[RO]{aaaa}
\fancyhead[LE]{bbbb}

Also note that, an empty redefinition of \sectionmark causes \markright to be empty as well, so, unless you change it, you will have no header in odd pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.