# LaTeX abntex package, twoside putting the page number on the wrong side of the page

I'm finishing writing my thesis, and to save paper I'm trying to use the twoside option for the package abntex. The problem is that the number is in the wrong side of the page! How can I put it on the other side?

\documentclass[a4paper,12pt,normaltoc,twoside,openright]{abnt}
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage[T1]{fontenc}
\usepackage[bitstream-charter]{mathdesign}
\usepackage[portuguese,brazil,brazilian]{babel}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{url}
\usepackage{pdflscape}
\usepackage{rotating}
\usepackage{appendix}
\usepackage{color}
\usepackage{microtype}
\usepackage{tabela-simbolos}
\usepackage{subfigure}
\usepackage[num,abnt-etal-list=0,abnt-etal-text=it,abnt-   emphasize=it,recuo=0.0cm,bibjustif,abnt-last-names=abnt]{abntcite}
\usepackage{float}
\usepackage[format=hang,font={footnotesize,singlespacing},labelfont=bf,labelsep=endash] {caption}

\onehalfspacing

\begin{document}

\include{folha_rosto}
\include{resumos}

\tableofcontents
\listoffigures
\include{introducao}
\end{document}

-

## migrated from stackoverflow.comNov 26 '11 at 0:48

This question came from our site for professional and enthusiast programmers.

Have you tried the fancyhdr package. You can then override the footer using \fancyfoot{}\fancyfoot[LE,RO]{\thepage}\pagestyle{fancy} in your document preamble, which should put the page number on the outer side. –  Werner Nov 25 '11 at 20:21
Are you sure the page-numbers are on the wrong side? If I understand right, they should be at the outer page margin, i.e. right on odd pages and left on even ones. Maybe you are simple binding the book on the wrong side? (Also, the middle margin should be about as large as each of the outer ones.) –  Paŭlo Ebermann Nov 26 '11 at 0:47
IMHO in theory there's nothing wrong with your code neither with the abnt class. The twoside option, though it's available as a class option, seems not to be abnt-compliant – the documentation clearly says so – so you should not consider it when generating the final version of your thesis. If you really want to use twoside and "fix" the position of page numbers, the documentation suggests using the fancyhdr package, by adding header as class option and redefining both plainheader and header styles. Then @Werner's code is the way to go. Hope it helps. :) –  Paulo Cereda Nov 26 '11 at 1:19
On a funny note, ABNT is not environmentally friendly. Ouch. :P –  Paulo Cereda Nov 26 '11 at 1:31
@Werner Although egreg has answered this question, I think your comment (perhaps plus some of Paulo's) is the way to go. Please turn it into an answer. –  lockstep Jan 8 '12 at 17:08

It's hard to understand what the problem is. With the twoside class option, margins are swapped on odd and even pages so that they agree on the two sides of a sheet.
Since it's impossible (well, quite difficult) to print a twoside formatted document as if it were oneside formatted because of the margin swapping, it's not a problem if page numbers are on the "wrong" side.
Step 1: prepare your thesis with the twoside option active; printouts will have the numbers on the "wrong" side, but the document can be printed on both sides of the paper as it should, so you can save paper and have correct margins.
Step 2: when your thesis is finished, just delete the twoside option, recompile and all will be good for onesided printing.