1

Below is my MWE.

When I use this on Overleaf however, everything come out nicely apart from having numbered pages. None of the pages are numbered, apart from the very first. How can I make all the pages be numbered at the bottom centre of each page?

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate text for the example
\usepackage[utf8]{inputenc}
\usepackage{amssymb,amsmath,amsthm}
\usepackage[runin]{abstract}
\usepackage{titlesec}
\usepackage{titlecaps}

\renewcommand{\abstractname}{\normalfont\scshape{Abstract}.}

\newtheorem{theorem}{Theorem} \newtheorem{lemma}{Lemma}

\newcommand\shorttitle{The Short Title} \newcommand\authors{Author A, Author B and AuthorC}

\fancyhf{} \renewcommand\headrulewidth{0pt} \fancyhead[C]{% \ifodd\value{page} \small\scshape\authors \else \small\scshape\shorttitle \fi } \pagestyle{fancy}

\begin{document} \title{My Paper} \author{The Author} \maketitle \titleformat{\section}[block]{\filcenter\scshape}{\thesection.}{0.5em}{\titlecap}

\section{Introduction} \lipsum[1-20]

\end{document}

yo'
  • 51,322
  • 4
    You have explicitly emptied the default page head and foot with \fancyhf{} and not added \thepage to either the head or the foot. \fancyfoot[C]{\thepage} would restore the default – David Carlisle Jan 19 '21 at 12:40
  • @DavidCarlisle Thanks. I got the \fancyhf{} etc from this answer: https://tex.stackexchange.com/questions/74034/page-header-alternatively-author-name-and-short-title but I'm not sure what he';s done, only that it worked. Would you mind quickly copying my MWO and editing it so it will work, in an answer? – A-Level Student Jan 19 '21 at 12:47
  • @DavidCarlisle Where would I add \thepage ? – A-Level Student Jan 19 '21 at 12:57
  • Hello there! This is Tom from the Overleaf Support Team. Please note that I removed the [tag:overleaf] tag as this is not directly Overleaf-related. I hope you manage to solve the issue! – yo' Jan 19 '21 at 14:15
  • @yo' that's fine. Unfortunately I haven't been able to solve the issue :( Do you think you could help me please? – A-Level Student Jan 19 '21 at 14:19
  • David's comment has given you the solution. Just add \fancyfoot[C]{\thepage} just before pagestyle{fancy} – Denis Jan 19 '21 at 14:28
  • @Denis Thanks so much!!! I'd been putting it in the wrong place and it hadn;t been working properly! :) – A-Level Student Jan 19 '21 at 14:35
  • @DavidCarlisle Thanks so much for your help!! Would you like to post it as an answer and I'll accept it? – A-Level Student Jan 19 '21 at 14:44

0 Answers0