[Tex/LaTex] Change page number position with \pagestyle{theheadings}

header-footer

I am using \pagestyle{myheadings} in a LaTeX document, which by default shows the page number in the top right corner of the page. How can I change the position of the page number to bottom right?

Best Answer

Here's a solution without any other package, copied from article.cls and renamed to myotherheadings (The blindtext package is only for filling up the pages)

\documentclass[twoside]{article}

\usepackage{blindtext}
\makeatletter
\def\ps@myotherheadings{%
  \def\@evenfoot{\thepage\hfil}%  -> page number then fill
  \def\@oddfoot{\hfil\thepage} %  -> fill, then page number
  \def\@oddhead{{\slshape\rightmark}\hfil} % remove the page number
  \def\@evenhead{\hfil\slshape\leftmark}%
  \let\@mkboth\@gobbletwo
  \let\sectionmark\@gobble
  \let\subsectionmark\@gobble
}

\makeatother

\begin{document}
\pagestyle{myotherheadings}
\section{First}
\blindtext[10]
\end{document}

Here's a fancyhdr version:

\documentclass[twoside]{article}

\usepackage{blindtext}
\usepackage{fancyhdr}

\renewcommand{\headrulewidth}{0pt}
\fancyhead[RO]{}
\fancyfoot{}
\fancyfoot[RO,LE]{\thepage}

\pagestyle{fancy}

\begin{document}
\section{First}
\blindtext[10]
\end{document}