Re: TeX syntax?

gah4 <gah4@u.washington.edu>
Mon, 5 Apr 2021 13:29:02 -0700 (PDT)

          From comp.compilers

Related articles
[5 earlier articles]
Re: TeX syntax? jhallen@TheWorld.com (2007-02-16)
Re: TeX syntax? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2007-02-16)
Re: TeX syntax? jhallen@TheWorld.com (2007-02-25)
Re: TeX syntax? gjthill@gmail.com (Jim Hill) (2007-02-25)
Re: TeX syntax? rockbrentwood@gmail.com (Rock Brentwood) (2021-04-04)
Re: TeX syntax? gah4@u.washington.edu (gah4) (2021-04-05)
Re: TeX syntax? gah4@u.washington.edu (gah4) (2021-04-05)
| List of all articles for this month |

From: gah4 <gah4@u.washington.edu>
Newsgroups: comp.compilers
Date: Mon, 5 Apr 2021 13:29:02 -0700 (PDT)
Organization: Compilers Central
References: 07-02-024 21-04-002 21-04-004
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="74656"; mail-complaints-to="abuse@iecc.com"
Keywords: syntax, macros
Posted-Date: 06 Apr 2021 13:38:34 EDT
In-Reply-To: 21-04-004

On Monday, April 5, 2021 at 7:55:35 AM UTC-7, gah4 wrote:


(snip, John wrote)
> [The m4 macro processor tokenizes its input and then checks to see
> if a token is a named macro. It's still used for autoconf
> configuration scripts. -John]


I know about m4, but have managed never to use it.


Things that I might have done with it, I usually do with awk.


Continuing TeX syntax, white space is ignored after a macro named
with letters, (but not the other ones). That is useful if you use a macro before
actual text words. Also it means that you can ignore newlines that come after
a macro named with letters, but not other ones. You can cause it to ignore
a newline otherwise by ending with a comment, with (usually) a %.


(As with all characters, you can change the catcode, but usually %.)


One other funny thing, though. TeX has glue specifications, such that
one might say:


      \hskip 1cm plus 0.5cm minus 0.5m


for horizontal space that can stretch or shrink in line justification.


the plus and minus parts are optional. Often macros expand to glue:


\def\somespace{\hskip 1cm}


and I actually knew someone to use such a macro followed by the word
plus that wasn't part of glue, and resulting in a very strange message.


I suppose one should put a \relax (the no-op macro) after every glue,
but that is pretty rare. What is the chance that one might actually
say 'plus' or 'minus' at that point!


But the sometimes significant sometimes not white space is a real
complication in actual use, and will also complicate a BNF
representation.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.