[Tex/LaTex] How to add page number to title page

page-numberingtitles

Because of some stupid format check requirement I need to add page number at the bottom of title page.

Here's a minimal working example that doesn't produce the page number on title page:

\documentclass{report}
\begin{document}
\author{test}
\title{mytitle}
\maketitle
\end{document}

What should I do to add page number to this title page?

Best Answer

You can patch \titlepage to change the default empty page style used there to plain:

\documentclass{report}
\usepackage{etoolbox}

\patchcmd{\titlepage}
  {\thispagestyle{empty}}
  {\thispagestyle{plain}}
  {}
  {}

\begin{document}
\author{test}
\title{mytitle}
\maketitle
\end{document}

Without the patching, you can redefine the environment as defined in report.cls:

\documentclass{report}

\makeatletter
\renewenvironment{titlepage}
    {%
      \if@twocolumn
        \@restonecoltrue\onecolumn
      \else
        \@restonecolfalse\newpage
      \fi
      \thispagestyle{plain}% the change was made here
      \setcounter{page}\@ne
    }%
    {\if@restonecol\twocolumn \else \newpage \fi
     \if@twoside\else
        \setcounter{page}\@ne
     \fi
    }
\makeatother

\begin{document}
\author{test}
\title{mytitle}
\maketitle
\end{document}