[Tex/LaTex] custom footer on title page using \maketitle and book document class

fancyhdrheader-footertitles

I'm trying to add a custom footer to the title page of my thesis, in order to insert some text that is required by my university. I'm using fancyhdr to do so. However, the footer appears on the second page and not the first. How can I fix this?

\documentclass[11pt,a4paper,twoside]{book}

\usepackage{fancyhdr}

\usepackage{lipsum}

\fancypagestyle{titlepagestyle}
{
   \fancyhf{}
   \fancyfoot[C]{\emph{This text needs to appear on the title page}}
   \renewcommand{\headrulewidth}{0 mm}
}

\pagestyle{plain} 

\begin{document}

\title{The title}

\author{The author}

\maketitle
\thispagestyle{titlepagestyle}


\mainmatter

\chapter{The chapter heading}

\lipsum[1]

\end{document}

I've also tried using adding a footnote instead of using fancyhdr, with the same result.

Best Answer

You can patch the \maketitle like

\usepackage{etoolbox}

\patchcmd{\maketitle}
  {\end{titlepage}}
  {\thispagestyle{titlepagestyle}\end{titlepage}}
  {}{}

Code:

\documentclass[11pt,a4paper,twoside]{book}

\usepackage{fancyhdr}

\usepackage{lipsum}
\usepackage{etoolbox}

\patchcmd{\maketitle}
  {\end{titlepage}}
  {\thispagestyle{titlepagestyle}\end{titlepage}}
  {}{}

\fancypagestyle{titlepagestyle}
{
   \fancyhf{}
   \fancyfoot[C]{\emph{This text needs to appear on the title page}}
   \renewcommand{\headrulewidth}{0 mm}
}

\pagestyle{plain}

\begin{document}

\title{The title}

\author{The author}
%\thispagestyle{titlepagestyle}
\frontmatter
\maketitle
\mainmatter

\chapter{The chapter heading}

\lipsum[1]

\end{document}

enter image description here