Forcefully positioning header page numbers for even and odd pages

Course Queries Syllabus Queries 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I'm trying to write a syllabus and I want the page numbers to be on alternating sides of each page. I am using the package fancyhdr, and know the command to accomplish this, \fancyhead[LE,RO]{\thepage}. But, when I typeset it, the page numbers stay on the right side of the header in all pages. How do I fix this? Please and thank you.

\documentclass[11pt, a4paper]{article}
%\usepackage{geometry}
\usepackage[inner=1.5cm,outer=1.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\pagestyle{empty}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color}
\definecolor{darkblue}{rgb}{0,0,.6}
\definecolor{darkred}{rgb}{.7,0,0}
\definecolor{darkgreen}{rgb}{0,.6,0}
\definecolor{red}{rgb}{.98,0,0}
\usepackage[colorlinks,pagebackref,pdfusetitle,urlcolor=darkblue,citecolor=darkblue,linkcolor=darkred,bookmarksnumbered,plainpages=false]{hyperref}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{ACC 202: Intro to Managerial Accounting}
%\lhead{ \fancyplain{}{Spring 2019 Syllabus} }
%\chead{ \fancyplain{}{} }
%\rhead{ \fancyplain{}{\emph{ACC 202: Intro to Managerial Accounting}} }
%\rfoot{\fancyplain{}{page \thepage\ of \pageref{LastPage}}}
%\fancyfoot[RO, LE] {page \thepage\ of \pageref{LastPage} }
\thispagestyle{plain}

%%%%%%%%%%%% LISTING %%%
\usepackage{listings}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
\usepackage{verbatim} % used to display code
\usepackage{fancyvrb}
\usepackage{acronym}
\usepackage{amsmath}
\usepackage{amsthm}
%\VerbatimFootnotes % Required, otherwise verbatim does not work in footnotes!
\newcommand{\SubItem}[1]{
    {\setlength\itemindent{15pt} \item[-] #1}
}
\usepackage{setspace}
\usepackage{enumitem}
\usepackage{array}


\definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}

                                                
                                                
0 views
0 shares
profilepic.png
manpreet 2 years ago

Well, class article is onesided. If you want to be printed twosided you need to add class option twoside. Or perhaps you can then use class report with option twoside, depending on what should happen with the title(page) ...

Please see the following MWE with used package blindtext to generate some dummy text with command \blinddocument

\documentclass[%
  11pt, a4paper,
  twoside % <===========================================================
]{article}
%\usepackage{geometry}
\usepackage[inner=1.5cm,outer=1.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\pagestyle{empty}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color}
\definecolor{darkblue}{rgb}{0,0,.6}
\definecolor{darkred}{rgb}{.7,0,0}
\definecolor{darkgreen}{rgb}{0,.6,0}
\definecolor{red}{rgb}{.98,0,0}
\usepackage[colorlinks,pagebackref,pdfusetitle,urlcolor=darkblue,citecolor=darkblue,linkcolor=darkred,bookmarksnumbered,plainpages=false]{hyperref}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{ACC 202: Intro to Managerial Accounting}
%\lhead{ \fancyplain{}{Spring 2019 Syllabus} }
%\chead{ \fancyplain{}{} }
%\rhead{ \fancyplain{}{\emph{ACC 202: Intro to Managerial Accounting}} }
%\rfoot{\fancyplain{}{page \thepage\ of \pageref{LastPage}}}
%\fancyfoot[RO, LE] {page \thepage\ of \pageref{LastPage} }
\thispagestyle{plain}

%%%%%%%%%%%% LISTING %%%
\usepackage{listings}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
\usepackage{verbatim} % used to display code
\usepackage{fancyvrb}
\usepackage{acronym}
\usepackage{amsmath}
\usepackage{amsthm}
%\VerbatimFootnotes % Required, otherwise verbatim does not work in footnotes!
\newcommand{\SubItem}[1]{
    {\setlength\itemindent{15pt} \item[-] #1}
}
\usepackage{setspace}
\usepackage{enumitem}
\usepackage{
                                                    
                                                    
0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.