Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was trying to write a custom LaTeX class where I need to access the value of \@title. I wrote

\newcommand{\makeack}{Hello World  \@title World}

But the value of \@title is not printed when I use \makeack in the .tex file. But I could successfully use \@title in the modified \@maketitle I defined like

\def\@maketitle{% 
....
....
}

I am a beginner in writing classes.

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

The default document classes make the title-related macros (\@title, \@date and \@author) empty once you call \maketitle. If you wish to keep copies of them around, you need to store these elsewhere. One way would be to update the \title (and friends) macro to not only store its contents in \@title (yes, that's what \title does), but also in something for your use, like \stored@title, say:

\def\title#1{\gdef\@title{#1}\gdef\stored@title{#1}}
\def\author#1{\gdef\@author{#1}\gdef\stored@author{#1}}
\def\date#1{\gdef\@date{#1}\gdef\stored@date{#1}}

The titling package does a similar thing, if you're interested.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.