Hi, guys,

I've got this message from Alexander Blüm asking for some more details of my
class layout. I tried to send it to the list via email, but somehow it
never made it to the list (AFAIK). So here it is once more through
gmane.org.

Matěj

On Thursday 31 of March 2005 14:48, Alexander Blüm wrote:
> I once sent this mail (similar one) to the mailing list, but
> didn't get any reply, so I assume it never reached the
> mailinglist...

I will post this back to the list, so that no one is robbed of 
the excitement of listening to my pearls of wisdom :-)

> I just don't get a few things there. Matej, would you be so
> kind and send me a version without the "hodina" environment
> definition?

BTW, "hodina" is "class" in Czech.

> so, what is the "[EMAIL PROTECTED]@empty" ?
> - does it mean "allow" hodina in maketitle processing? or is
> it setting the hodina env to "empty" ? if so then what does
> empty mean here? - also: what are those "@" signs infront of
> these words? - there are {<many lines here>} - what are those?
>   - [EMAIL PROTECTED] :: I understand
>       "\newcommand{}[]" - but why def inside it ?

OK, this is slightly difficult, I admit. What you need is to 
collect some information in point of the LaTeX document and 
print it somewhere else. Some other typesetting programs (Lout) 
has a special constructs for doing this, but in TeX and LaTeX 
you have to do it yourself. What you do is to define two macros: 
one which means "print here something" (it is [EMAIL PROTECTED]) and the 
other one means "collect here the information" (which is what 
\hodina does). The most simple way how to do it (BTW, this is 
the same way how \date and [EMAIL PROTECTED] works) is that the latter 
macro defines the former one.

So you put somewhere in the document itself (after 
\begin{document}) the latter macro and in the macro which prints 
the content (in this case [EMAIL PROTECTED]) put the former one. 
However, there are is one problem -- what if user decides not 
use the latter macro (for example, she does not want to identify 
herself and she does not use \author)? Then [EMAIL PROTECTED] would 
tried to use [EMAIL PROTECTED] (or [EMAIL PROTECTED]) and it wouldn't be 
defined 
and you get one nice error in compilation of document. 
Therefore, \hodina should not create new macro, but just 
redefine the previous one, which has empty content before.

The rest is just a set of conventions -- \@ sign is a standard 
way how to create macros which cannot be used in a document 
itself, just in preamble (in between \makeatletter and 
\makeatother commands -- LyX puts these commands automagically 
in the beginning and the end of preamble), or in packages 
(downloaded by \usepackage), or in classes (downloaded by 
\documentclass). Macros with \@ in the name are used in the 
basic LaTeX classes (or in private documents, when it doesn't 
matter that much) and in packages you usually create some 
special convention (for example, my package manuscript uses \MS@ 
in the beginning of all its internal macros).

The last thing. \def is TeX elementary command (more primitive 
version of what LaTeX's \newcommand, \providecommand, and 
\renewcommand and bunch of others do). It is macho (and 
sometimes stupid) thing to use \def (or its variants, like 
\gdef, \xdef, and others) instead of \newcommand.

Is it clear now?

Happy LaTeXing,

 Matěj

-- 
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
Just remember, brothers and sisters--their skins may be white,
but their souls are just as black as ours!
   -- a black preacher

Reply via email to