Re: TeX syntax?

gah4 <>
Mon, 5 Apr 2021 13:29:02 -0700 (PDT)

          From comp.compilers

Related articles
[5 earlier articles]
Re: TeX syntax? (2007-02-16)
Re: TeX syntax? (glen herrmannsfeldt) (2007-02-16)
Re: TeX syntax? (2007-02-25)
Re: TeX syntax? (Jim Hill) (2007-02-25)
Re: TeX syntax? (Rock Brentwood) (2021-04-04)
Re: TeX syntax? (gah4) (2021-04-05)
Re: TeX syntax? (gah4) (2021-04-05)
| List of all articles for this month |

From: gah4 <>
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:; posting-host=""; logging-data="74656"; mail-complaints-to=""
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

Post a followup to this message

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