I'm wondering how I can get the document title in latex, for use elsewhere in the document. I just want to be able to be able to echo it.
+3
A:
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
.
lhf
2010-03-26 12:34:19
Thanks, that did the trick, although I had to enclose the define in `\makeatletter` and `\makeatother`, which starts to be a whole lot of effort. So since I only need to use the title one other time, there's not much point. It'd be nice if there were a more sensible solution.
humble coffee
2010-03-28 09:36:03
You can do the other way around: \def\MYTITLE{...} then \title{\MYTITLE} and later use \MYTITLE again.
lhf
2010-03-29 00:25:47