Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

def, let, newcommand, declarerobustcommand

586 views
Skip to first unread message

Fredrik Engström

unread,
Jul 1, 2002, 4:24:07 AM7/1/02
to
Could anyone explain the difference between the commands
\def
\let
\newcommand
\declarerobustcommand
etc...?

Is there a really good reference for this sort of questions? Something
explaining what LaTeX-commands (and AMS-LaTeX-commands) do for someone
who knows TeX (or at least owns the TeXbook)?

Cheers,
Fredrik

Markus Kohm

unread,
Jul 1, 2002, 5:11:40 AM7/1/02
to
Fredrik Engström wrote:

> Is there a really good reference for this sort of questions?

\def and \let are explained at The TeXbook.
\newcommand and \DeclareRobustCommand (see remark A) are explained at
usrguide or clsguide, which are parts of LaTeX.

Remark A: TeX is case sensitiv and there is no \declarerobustcommand at
LaTeX. If there is a \declarerobustcommand at a package, see the package
documentation.

Something explaining what LaTeX-commands (and AMS-LaTeX-commands) do for
someone who knows TeX (or at least owns the TeXbook)?

LaTeX: see The LaTeX manual or source2e, if you realy know TeX (but you
don't, because you don't know the difference between \def and \let).

AMS-LaTeX: see the documentation, which is part of AMS-LaTeX.

Maybe you should also have a look at the FAQ.

--
Markus

Fredrik Engström

unread,
Jul 1, 2002, 5:54:06 AM7/1/02
to
Markus Kohm wrote:
>
> Fredrik Engström wrote:
>
> > Is there a really good reference for this sort of questions?
>
> \def and \let are explained at The TeXbook.
> \newcommand and \DeclareRobustCommand (see remark A) are explained at
> usrguide or clsguide, which are parts of LaTeX.

No, not really. I've looked there, but it only tells you how to _use_
\newcommand and \DeclareRobustCommand, not what they really _do_.

I'd like something wich is not as complicated as the source but at least
tells me a bit more than usrguid.



> Remark A: TeX is case sensitiv and there is no \declarerobustcommand at
> LaTeX. If there is a \declarerobustcommand at a package, see the package
> documentation.

I know, sorry...



> Something explaining what LaTeX-commands (and AMS-LaTeX-commands) do for
> someone who knows TeX (or at least owns the TeXbook)?
>
> LaTeX: see The LaTeX manual or source2e, if you realy know TeX (but you
> don't, because you don't know the difference between \def and \let).

See above. I know the difference between \let and \def, I only included
\let to get the whole picture... but you're right I don't really know
TeX, so the source would be a bit too difficult for me.



> AMS-LaTeX: see the documentation, which is part of AMS-LaTeX.

AMS-LaTeX documentation is even worse than usrguid and clsguide. It
doesn't say anything apart from how to use the commands.

> Maybe you should also have a look at the FAQ.

I have!

Cheers,
Fredrik

Markus Kohm

unread,
Jul 1, 2002, 8:22:35 AM7/1/02
to
Fredrik Engström wrote:

> No, not really. I've looked there, but it only tells you how to use
> \newcommand and \DeclareRobustCommand, not what they really do.

That's not true.

--- from clsguide: ---
\DeclareRobustCommand[...]
[...]
This command taked the same arguments as \newcommand but it declares a
robust command, even if some code within the<definition> is fragile. You
can use this command to define new robust commands, or to redefine existing
commands and make them robust.
--- end of snapshot ---

So it tells you not only, how to use \DeclareRobustCommand, but also what it
does. At the example it even tells something about why you need robust
commands. But if you don't know the difference between robust and fragile
have a look at The TeXbook or simply at following example:

\documentclass{article}
\usepackage{makeidx}\makeindex
\newcommand*{\Fragile}{This command is fragile}
\DeclareRobustCommand*{\Robust}{This command is robust}
\newcommand*{\Index}[1]{\texttt{\string#1}\index{#1}}
\begin{document}
\Index{\Robust} is robust, but \Index{\Fragile} is fragile.

\renewcommand*{\Fragile}{The command was fragile}
\DeclareRobustCommand*{\Robust}{The command was and is still robust}
\printindex
\end{document}

You may alo have a look at the idx- oder ind-fiel so see the differences.

And if you don't know, what the commands are doing but how they do this, you
have to look into the source (source2e.dvi), because only the source
answers this.

--
Markus

Michael J Downes

unread,
Jul 8, 2002, 10:05:48 AM7/8/02
to
Fredrik Engström <engs...@math.chalmers.se> wrote

> AMS-LaTeX documentation is even worse than usrguid and clsguide. It
> doesn't say anything apart from how to use the commands.

It's not clear (you did not say anything to indicate one way or
another) that you know how to print/view .dtx files? Did you look at
amsmath.dtx and some of the other .dtx files? But the commentary
assumes a substantial knowledge on the reader's part of the
conventions used in the LaTeX kernel.

0 new messages