## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Forum View Use Monospaced Font Show Text Part by Default Condense Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

Hello,

Rainer Schoepf wrote:

>  > Is it *stated* somewhere in documentation that one cannot use primitive TeX commands
>  > (and syntax) in a LaTeX files? ;-)
>
> No, but you were asking what are the correct LaTeX commands. See
> Appendix E of the LaTeXbook.

Ok, I agree that there are some `standard' LaTeX commands, which are
`recommended for use'. But since the only 100% correct interpreter
of LaTeX files is TeX, then, in principle, all TeX commands
are valid (and they are also LaTeX commands by definition---since LaTeX
is able to parse them). Yes, the use of some TeX constructs can seriously
hamper parsing of LaTeX source files by `third party' parsers,
and because of that one should use `undocumented' LaTeX commands
only inspecial cases.

>  > > TeX has a syntax? New concept.... :-)
>  >
>  > Of course, it has. :-) If not, than how can one get LaTeX to have syntax?
>
> By the very same argument, the ASCII code table has syntax, since you
> can build Pascal, C, C++,... out of it. That's a red herring.

I can't agree with this. :-)
There are obvious distinctions between these situations:
* first, let's sepatate TeX as a parser (interpreter) and TeX as a language
(BTW, it's *syntax* could be expressed in terms of LR(1) grammars).
* ASCII code table is not a (programming) language, because there is no obvious
parser, for which the set of all ASCII letters would be the set of tokens.
Since ASCII is not a progr. language, it is nonsensial to talk about
it's syntax, semantics, et al. All progr. languages are based on ASCII table --
but they use it only to construct their tokens. The same is TeX.
* But TeX-language *is* a language---it has syntax, because
those constructs which will not conform to this syntax, will cause
TeX-parser to produce an error message.
* Many other progr. languages are also able to dynamically change it's
`syntax rules' and semantics---e.g. via macro substitutions it is possible
to cause C or C++ to behave very strangely. ;-)
But these are not `real' (low level) syntax rules.
The same situation we have in the case of TeX---it also has macro capabilities
(although much more powerful then, say, in C).
But TeX's `low level' syntax rules may act on different levels of macro substitution.
* LaTeX is written in TeX-language, so it has the same syntax power as TeX.
* Give your definition of syntax---and I'll either prove that TeX has syntax, or
prove that LaTeX does not have one. ;-)

> TeX input has a lexical structure that is determined dynamically during
> the run, plus a macro language that doesn't have any syntax beyond the
> notion of (token,catcode) pairs.

And what about e.g. syntax rules for determining arguments of macros?
What about all those syntax rules describing TeX's notions (numbers,
syntax of \haligh construct, etc, etc), which are so pedantically written
in the TeXbook? ;-)

Catcodes in TeX are means to dynamically change it's `high level' syntax
(visible at the level of ASCII table ;-) ) and semantics.

> Not even brace tokens are proper
> syntactical elements, as the famous
>
>   \ifnum0=`{\fi
>
> example shows.

IMHO this example is in complete correspondence with TeX's syntax *and* semantics.

--
With best regards,