How to get the value of the document title in latex?
Using \@title
does not work because \maketitle
clears \@title
. This seems silly to me but that's the way it is. One solution is to redefine \title
to save the title somewhere else. For instance,
\def\title#1{\gdef\@title{#1}\gdef\THETITLE{#1}}
then use \THETITLE
.
You can do the other way around: \def\MYTITLE{...}
then \title{\MYTITLE}
and later use \MYTITLE
again.
I had success just writing a new command.
\newcommand{\mytitle}{...}
\title{\mytitle}