🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10042

Re: Math mode in LaTeX

#10042
From: Don Hosek
Date: Sun, 02 Jun 1991 02:38
49 lines
2671 bytes
In article <4648@undis.cs.chalmers.se>, jeffrey@cs.chalmers.se (Alan Jeffrey) writes:
> In article <1991May28.070140.16324@neon.Stanford.EDU> espie@ibis.Stanford.EDU (Marc Espie) writes:
>>So, now redefining !thing! to act like \mbox{thing} is not really 
>>difficult. Here is a quick answer, it should work with little or no
>>modification.
 
> Except that this will produce strange results for writers with a
> tendency to use exclaimation marks in their text!
 
> You could try
 
> \newtoks\everytext
> \newtoks\everyendtext
> \def\textshriek{!}
> \catcode`\!=\active
> \def!{\relax\ifmmode\expandafter\mathshriek\else\textshriek\fi}
> \def\mathshriek#1!{\hbox{\the\everytext#1\the\everyendtext}}
 
> This also gives you token lists \everytext and \everyendtext, which
> are used at the beginning and end of every !...! pair.  For example,
> if you want all of this text to be set in the upright font, with a
> quad space before and after, you could say

Alternatively, assign ! a mathcode of "8000. See p.155 of the
TeXbook for details (so am I the only one who knew about this
feature?)

> Exercise for the interested reader: why the \relax and why the
> \expandafter?  (The answers to these questions, as with any other you
> may have about life, the universe and everything, are kept within the
> covers of the TeXbook.)

Hmm, I don't think I've ever seen this use of \expandafter
before. I've more typically said:

\ifwhatever \let\next=\a\else\let\next=\b\fi \next

it still has uses but your technique is quite slick.

-dh
 
-- 
Don Hosek                  | To retrieve files from ymir via the mailserver,
dhosek@ymir.claremont.edu  | send a message to mailserv@ymir.claremont.edu 
Quixote Digital Typography | with a line saying send [DIRECTORY]FILENAME
714-625-0147               | where DIRECTORY is the FTP directory (sans 
---------------------------+ "anonymous") and FILENAME is the filename, e.g. 
"send [tex]00readme.txt". There is a list of files in each directory under the 
name 00files.txt. Binary files are not available by this technique.
Technical Details
Message-ID: <1991Jun1.193841.1@hmcvax.claremont.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!jarthur!hmcvax.claremont.edu!dhosek
References: <1991May15.205919.12393@serval.net.wsu.edu> <JEFFT.91May16102428@tailgunner.mit.edu> <1991May28.070140.16324@neon.Stanford.EDU> <4648@undis.cs.chalmers.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!jarthur!hmcvax.claremont.edu!dhosek
From: dhosek@hmcvax.claremont.edu (Don Hosek)
Newsgroups: comp.text.tex
Subject: Re: Math mode in LaTeX
Message-ID: <1991Jun1.193841.1@hmcvax.claremont.edu>
Date: 2 Jun 91 02:38:41 GMT
References: <1991May15.205919.12393@serval.net.wsu.edu> <JEFFT.91May16102428@tailgunner.mit.edu> <1991May28.070140.16324@neon.Stanford.EDU> <4648@undis.cs.chalmers.se>
Sender: news@jarthur.Claremont.EDU
Organization: Quixote Digital Typography
Lines: 49