# Treating odd and even numbered pages differently? [duplicate]

I was wondering how to treat odd and even numbered pages differently, for example I want the page number appear on the upper right corner of the page on odd pages while upper left corner of the page on even pages. How can I accomplish this? Many thanks in advance

## marked as duplicate by egreg, Stefan Pinnow, user36296, Maarten Dhondt, ZarkoMar 17 '17 at 11:47

• Check this out: Different headers for odd and even pages – Werner Mar 17 '17 at 3:14
• There are many ways to achieve this, like using fancyhdr, or using the in built commands of the KOMA class etc. It depends largely on the document class that you are using – Troy Mar 17 '17 at 3:16
• Just don't specify a [oneside] document class. – John Kormylo Mar 17 '17 at 4:13
• @JohnKormylo - Some document classes, incl. article and report, set the option oneside by default. For such classes, it's necessary to specify twoside explicitly in order to get the page number placement to depend on whether the page number is even or odd. – Mico Mar 17 '17 at 7:53

Assuming you're using the article or report document class, or a class that's based on one of these classes, you may achieve your objective, which I'll paraphrase as

I want the page number to appear in the upper right corner of the page on odd-numbered pages but in the upper left corner of the page on even-numbered pages

by specifying the document class option twoside explicitly and by inserting the instruction

\pagestyle{myheadings}


in the preamble.

A full MWE (minimum working example):

\documentclass[twoside]{article} % or: "report"

There are other, far more general, ways of determining what goes in the header and footer lines of a page. You may want to study the user guide of the fancyhdr package for some of the possibilities. Some document classes, such as the memoir class and the KOMA-Script family of document classes, provide further possibilities in this regard.