# Page number is not placed at the right position

I'm trying to place my page numbers on the left on even pages and on the right on odd ones. As far as I understand the following code should do exactly this, but my page numbers are all on the right side.

\documentclass[11pt]{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\begin{document}
foo
\newpage
bar
\newpage
bat
\end{document}


You have to choose a document class that have different left and right pages. Either use the book or report class, or add the option twoside to the article class.

Be aware that the option twoside also triggers the flushbottom setting, which means that the the page content is vertically stretched so that the lines flush at the bottom of the page. This may lead to nasty white space between paragraphs, or above sections, tabulars and figures. Therefore, consider to use the \raggedbottom command in your preamble.

If you have footnotes in your document, you will see that \raggedbottom places the footnotes in a fixed distance from the bottom of the text, which is not nice. You can avoid this by either use scrartcl (from KOMA-script) instead of \article, or load the package footmisc with the option bottom:

\documentclass[twoside, 11pt]{article}
\usepackage[bottom]{footmisc}               %% Treat footnotes correctly
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}