I am trying to place the page number at the right top of the page, and it is working in the chapters, but at the beginning of the document it is not working as I was expecting. This are the lines I am using to set the page numbering:
% Page numbering: top right
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{plain}{
\fancyhf{} % clear all header and footer fields
\fancyhead[RO,RE]{\thepage} %RO=right odd, RE=right even
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
I am getting this:
First, I am getting that horizontal line at the top in several pages. In addition, this page has a number, and it is not supposed to have it, and other pages too. Finally, the pages that have the contents are numbered too. How can I solve this issue?
P.S.: I need no header neither footer.
Best Answer
Assuming you are using a standard class, you should be using either
titlepage
or\maketitle
to create your title. This automatically sets the page style toempty
orplain
. Presumably, you are not doing that, so you are getting thefancy
style which includes headings and a page number in the footer by default.Probably, you want to set up a suitable style for standard pages.
But, in any case, if you do not use
titlepage
or\maketitle
or equivalent, you should say\thispagestyle{empty}
on the first page to avoid both header and footer.This is, of course, a wild guess (see comment). Hence it could be quite wrong. Without a minimal example, it is impossible to do better.