[Tex/LaTex] Centered page numbers although set “twoside” option

articledouble-sidedheader-footerpage-numbering

Using article class and the twoside option still gives me the page numbers in the center of the page. Isn't the twoside option supposed to put the page numbers on the left in even pages and on the right in odd pages?

Here is my MWE:

\documentclass[a4paper,twoside,titlepage,12pt]{article}
\linespread{1.3}

\usepackage[cm-default]{fontspec}

\usepackage{xgreek}

\setmainfont[Mapping=tex-text]{GFS Didot}

\title{Fuzzy Control}
\author{My Name}

\begin{document}
\maketitle
\newpage
\thispagestyle{empty}
\mbox{}

\begin{abstract}
That's it!
\end{abstract}

\tableofcontents

\include{intro}
\include{outro}
\end{document}

Thanks for any help!

Best Answer

In the standard document classes there are four predefined page styles; the following is a quote taken directly from the fancyhdr package documentation:

enter image description here

The default behaviour for the standard article, report or book document classes is to use the plain page style, so simply using the twoside class option won't give you the desired position for the page number.

If you want to change the default page style, you can use \pagestyle{headings}, or \pagestyle{myheadings} (and perhaps supply information for the header). Both options will give you, with the twoside option, headers containing the page numbers to the right on odd-numbered pages, and to the left on even-numbered pages.

If further customization is required, use a package such as titleps or fancyhdr to define your own page style. In any case, you will have to "activate" the page style by using the \pagestyle command.

A little example using titleps to define a new page style:

\documentclass[a4paper,twoside,titlepage,12pt]{article}
\usepackage{titleps}

\newpagestyle{mystyle}{
  \sethead[a][b][c]{left}{center}{right}
  \setfoot[a][b][c]{left}{center}{right}
}
\pagestyle{mystyle}

\begin{document}

test\clearpage test

\end{document}

A more realistic example: no footer, header for even-numbered pages: page number to the left, section number and title to the right; header for odd-numbered pages: subsection title to the left, page number to the right; all information with \small font size:

\documentclass[twoside]{article}
\usepackage{titleps}
\usepackage{lipsum}% just to generate filler text

\newpagestyle{mystyle}[\small]{
  \sethead[\thepage][][\thesection~\sectiontitle]{\subsectiontitle}{}{\thepage}
}
\pagestyle{mystyle}

\begin{document}

\section{Test Section}
\lipsum[1]
\subsection{Test Subsection}
\lipsum[1-20]

\end{document}