Hello I am using a fancyhdr
package and I want that the page number appear in the right side of the heading for odd pages and in the left side of the heading for the left side. I alredy used the command \fancyhead[RO,LE]{\thepage}
but it does not work. Here is my code:
\documentclass[twoside,12pt]{elsarticle}%
\usepackage{amscd}
\usepackage{thmdefs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage[margin=0.5in]{geometry}
\setcounter{MaxMatrixCols}{30}
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
\numberwithin{equation}{section}
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newtheorem{condition}[theorem]{Condition}
\journal{}
\pagestyle{fancy}
\newcommand\shorttitle{------------------------------}
\newcommand\authors{--------------------------}
\fancyhf{}
\renewcommand\headrulewidth{0pt}
\fancyhead[C]{%
\ifodd\value{page}
\small\scshape\authors
\else
\small\scshape\shorttitle
\fi }
\fancyhead[RO,LE]{\thepage}
\begin{document}
HELLO!!!!
\end{document}
I think it is something related to the class elsarticle
, because if I change to another the class everything works well.
Best Answer
The
elsarticle
class doesn't usetwoside
, so there's no way forfancyhdr
to distinguish between the two cases.Use a trick similar to the one you're using for alternating title and author: if the page number is even, push the page number all the way to the left with
\hfill
.On the other hand, if you're submitting the paper to Elsevier, such changes shouldn't be made.