Document Classes ⇒ Standard classes: relationship between \author and \@author?
Standard classes: relationship between \author and \@author?
I'm using the texlive-2008 distribution through gentoo linux, and I'm trying to learn a little bit about class file structure in order to edit what I need (writing a thesis). Most of the things seem more or less straightforward, but I cannot find any information about the differences between "\title" and "\@title" or "\author" and "\@author" in the standard report class file (report.cls), if any.
My understanding is that since we use commands "\author{}" and "\title{}" in the preamble of the document to set those variables, they must be defined and used in the class file. But do we have to put an "@" after the "\" in the class file when we refer to the variables we set in the preamble (like "\@author" for "\author{}")?
For example, suppose I wanted to insert a dedication page into my document and in the preamble of the document, I would like to enter the text for my dedication page as:
\dedication{To my family.}
then in the class file, do I define/refer to this as "\@dedication" or just "\dedication"?
Many thanks!
Denis
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
-
- Site Moderator
- Posts: 814
- Joined: Tue Jul 01, 2008 2:19 pm
Standard classes: relationship between \author and \@author?
Code: Select all
\author{First}
\author{Second}
Code: Select all
\def\author#1{\def\author{#1}}
Standard classes: relationship between \author and \@author?
I am a beginner at this, so I am still confused. Why do standard class files contain \@author AND \author simultaneously? I don't understand which one links to the declaration within the preamble of the document. And why would things go wrong from your second example?josephwright wrote:There is nothing magic about \@title, \@author, etc. The main idea is to use a different name from \author, \title, and so on so thatdoes not give odd results. If you did something like:Code: Select all
\author{First} \author{Second}
then things would go wrong if \author was used more than once in the preamble.Code: Select all
\def\author#1{\def\author{#1}}
Are we talking about \author and \@author being separate variables? But how would you declare \@author in the preamble when the codes containing \@ aren't allowed in the preamble?
Standard classes: relationship between \author and \@author?
I looked at the classes.dtx file and answered my own question. Sorry for being dense about the basics.deniss wrote:I cannot find any information about the differences between "\title" and "\@title" or "\author" and "\@author" in the standard report class file (report.cls), if any.
My understanding is that since we use commands "\author{}" and "\title{}" in the preamble of the document to set those variables, they must be defined and used in the class file. But do we have to put an "@" after the "\" in the class file when we refer to the variables we set in the preamble (like "\@author" for "\author{}")?
For example, suppose I wanted to insert a dedication page into my document and in the preamble of the document, I would like to enter the text for my dedication page as:
\dedication{To my family.}
then in the class file, do I define/refer to this as "\@dedication" or just "\dedication"?
What I need is:
Code: Select all
\newcommand*{\dedication}[1]{\gdef\@dedication{#1}}
So what actually happens if you do
Code: Select all
\author{me}
\author{you}
-
- Site Moderator
- Posts: 814
- Joined: Tue Jul 01, 2008 2:19 pm
Standard classes: relationship between \author and \@author?
Code: Select all
\author{First}
\author{Second}