[Tex/LaTex] Header on even or odd pages

double-sidedheader-footer

Hi everyone I have been trying to create a different header for even or odd pages where I want to see the name of the section and the name of subsections. This is what I have done but it is not working.

\usepackage{fancyhdr}    
\makeatother

\usepackage{babel}
\begin{document}
\pagenumbering{Roman}

\renewcommand{\thesection}{\Roman{section}}    

\section{Introduction}    
\newpage

\renewcommand{\thesection}{\arabic{section}}    
\setcounter{section}{0}

\pagenumbering{arabic}    
\pagestyle{fancy}

\fancyhf{}    
\fancyfoot{}    
\fancyhead[RO,LE]{\thepage}    
\fancyhead[LO]{\small\nouppercase\leftmark}    
\fancyhead[RE]{\small\rightmark}    

\section{First Section}    
\newpage     
\subsection{First subsection}    
\newpage        
\subsection{Second subsection}    
\newpage       
\section{Second Section}
\newpage     
\subsection{First subsection}    
\newpage    
\subsection{Second subsection}

\end{document}

This is pretty much my example, I would like to see something like this: On even pages the name of the section, and on odd pages the name of the subsection, but I am having the same result always. Only the name of the section appears, and the numeration is not located according with the kind of page (even or odd).

What else do I need to add or erase?.

Best Answer

Your MWE seems to give what you are asking for if you add \documentclass[english, twoside]{article} to the beginning. The twoside option is necessary in order to have different even and odd sides.

Related Question