tags:

views:

239

answers:

2

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.

A: 

\@title contains it.

tonio
+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
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
You can do the other way around: \def\MYTITLE{...} then \title{\MYTITLE} and later use \MYTITLE again.
lhf