[Tex/LaTex] \maketitle not printing twice

titles

I am trying to \maketitle on the my title page and then also on the first page of the body of the paper.

Here is what I have:

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry}
\usepackage{setspace}

\title{#}
\author{#}
\date{#}

\begin{document}

    \begin{titlepage}
        \maketitle
        \thispagestyle{empty}  % no page #
    \end{titlepage}

    % Start paper
    \maketitle

    % 1.5 spacing
    \onehalfspacing

    % start the paper

\end{document}

For some reason the title is only printing out on the title page. Can anybody help me out?

Best Answer

Typically, when setting the title via \maketitle, the entire titling-structure is cleared after its used.

We can avoid this clearing by setting the title using an internal macro \@maketitle:

\documentclass{article}

\makeatletter
\newcommand{\settitle}{\@maketitle}
\makeatother

\title{A title}
\author{An author}
\date{A date}

\begin{document}

\settitle
\thispagestyle{empty}
\addtocounter{page}{-1}

\clearpage

% Start paper
\maketitle

\end{document}

Some page correction is needed, if you want the first page of your article to start with page 1.

Alternatively, using the titling package directly avoids this removal, allowing you to use \maketitle multiple times within your document. Just add

\usepackage{titling}

to your preamble.