[texhax] how to access author and title in book class

Herbert Voss Herbert.Voss at FU-Berlin.DE
Sun Jan 2 18:45:28 CET 2011


Am 02.01.2011 18:05, schrieb Niall Mansfield:
> > How can I access or print the author and title of a book?
> > (I am using book.cls).
> >
> > It seems that the \@author macro is zeroed by \maketitle
> > so that once the title page of the book has been printed,
> > \@author is useless.
> >
> > This is my workaround -- use one's own macro to
> > keep an accessible version of the author (and title).
> > It seems ugly.  Is there a "proper" way to do it instead?
> >
> > \newcommand{\mycopyoftitle}{A Little Book of Energy and Carbon
Emissions}
> > \title{\mycopyoftitle}
> > \newcommand{\mycopyofauthor}{Nicola Terry}
> > \author{\mycopyofauthor}
\documentclass{article}

\title{Me, I and myself}
\author{hv}

\makeatletter
\let\Title\@title
\let\Author\@author
\makeatother

\begin{document}

\maketitle
The article ,,\Title``
was written by \Author.

\end{document}

Herbert


More information about the texhax mailing list