🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #4948

Re: Command environment for TeX?

#4948
From: Ken McGlothlen
Date: Thu, 28 Jul 1988 23:16
77 lines
3374 bytes
In the referenced article, kelly@turing.arc.nasa.gov.UUCP (Jim Kelly) writes:
+----------
|  [...]
| One of TeX's major flaws is how the two [commands and text to be typeset]
| are distinguished.  TeX takes the whole document verbatim, except for a
| few special characters and words beginning with backslashes.  For most
| English text, this works fine, and nobody minds a few backslashes mixed
| in with the text, but for defining macros it's a disaster--spaces put in
| the macro for legibility appear in the output, and your file is 20% 
| backslashes.
|
| I'd like an environment where the default is reversed--one in which
| everything is assumed to be a control sequence unless escaped (maybe
| put in an hbox).  Macros could be defined from within the environment
| and could contain all the white space legibility demands, without a
| single backslash.
| [...]
|
| Jim Kelly (kelly@pluto.arc.nasa.gov)
+----------

Whee.  Quite a different approach to an admitted weakness of TeX--it wasn't
really meant for programming.

The way I see it, you're missing several approaches.

For one thing, any escaped symbol (say, \def) uses a non-letter as its
delimiter.  This includes another backslash (\def\bs{...}), or a space,
which, after an escaped token, is ignored.  You might not be able to
write

     \def\ooga{
          \vskip 6pt plus 2pt minus 1pt
          {\bf Ooga \biggle.\giggle:}
          \hfil \break
          \vskip 4pt plus 1pt minus 1pt
     }

because it would have spaces at the following asterisks:

     \def\ooga{*
          \vskip 6pt plus 2pt minus 1pt
          {\bf Ooga \biggle.\giggle:}*
          \hfil \break
          \vskip 4pt plus 1pt minus 1pt
     }

HOWEVER, because whitespace is ignored after a control sequence, you
could use

     \def\ooga{\vskip 6pt plus 2pt minus 1pt
          {\bf Ooga \biggle.\giggle:}\hfil \break
          \vskip 4pt plus 1pt minus 1pt
     }

Admittedly, this is much less readable, but macro readability is not
quite TeX's forte.  Another possibility is defining a null macro for
the end of a line where you don't want a space:

     \def\z{}

     \def\ooga{\z
          \vskip 6pt plus 2pt minus 1pt
          {\bf Ooga \biggle.\giggle:}\z
          \hfil \break
          \vskip 4pt plus 1 pt minus 1pt
     }

If you're really determined to get TeX to ignore those spaces, you can
try changing the \catcode of a space to 9 (null character), and use
something else for a deliberate space (\catcode 10).  That could get
*QUITE* messy, though, and I don't recommend it.

				--Ken McGlothlen
				  mcglk@scott.biostat.washington.edu
				  mcglk@max.acs.washington.edu
				  mcglk@max.bitnet
Technical Details
Message-ID: <956@entropy.ms.washington.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!ll-xn!mit-eddie!uw-beaver!uw-june!uw-entropy!scott!mcglk
References: <854@hydra.riacs.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!ll-xn!mit-eddie!uw-beaver!uw-june!uw-entropy!scott!mcglk
From: mcglk@scott.stat.washington.edu (Ken McGlothlen)
Newsgroups: comp.text
Subject: Re: Command environment for TeX?
Summary: Allowing whitespace to be treated as <null> in TeX?
Keywords: whitespace, TeX, macros, readability
Message-ID: <956@entropy.ms.washington.edu>
Date: 28 Jul 88 23:16:21 GMT
References: <854@hydra.riacs.edu>
Sender: news@entropy.ms.washington.edu
Reply-To: mcglk@scott.biostat.washington.edu
Organization: Biostatistics Department, University of WA, Seattle, WA, USA
Lines: 76