🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #108

Re: Should I use \newtoks here?

#108
From: leichter
Date: Fri, 30 Oct 1992 00:41
30 lines
1914 bytes
In article <HANDL.92Oct28122328@crypt9.cs.uni-sb.de>,
handl@crypt9.cs.uni-sb.de (Ralf Handl) writes:
| I need to `append' something to a definition, which can be done, 
| according to The TeXbook, Solution to exercise 20.15, with
| 
| 	\def\addcs#1#2{\toks0=\expandafter{#1}\toks2=\expandafter{#2}
| 	   \edef#1{\the\toks0 \the\toks2 }}
| 
| [example omitted]
| 
| Why did DEK choose token registers 0 and 2 explicitly?
| 
| Can I do it without raising problems?
| 
| Or should I better use \newtoks here? 
| (But then two token registers are `wasted'.)
| 
The convention in Plain is that registers 0-9 of all types (except count
registers, since TeX uses those for the page numbers) are reserved for
temporary "scratch" use.  ANY macro is allowed to clobber them, so you
can only use them in code that calls no macros.  In addition, the odd-
numbered registers should only be used with \global, and the even-numbered
ones only WITHOUT \global.  (This convention avoids stack buildup that
occurs if you mix global and local uses of the same register.)

\addcs follows these conventions, and will work properly with other code
that follows the same conventions.  You don't need to use \newtoks.

All this is discussed on page 346 of the TeXbook.
							-- Jerry
Technical Details
Message-ID: <1992Oct29.194109.1@zodiac.rutgers.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!rutgers!igor.rutgers.edu!zodiac.rutgers.edu!leichter
References: <HANDL.92Oct28122328@crypt9.cs.uni-sb.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!rutgers!igor.rutgers.edu!zodiac.rutgers.edu!leichter
From: leichter@zodiac.rutgers.edu
Newsgroups: comp.text.tex
Subject: Re: Should I use \newtoks here?
Message-ID: <1992Oct29.194109.1@zodiac.rutgers.edu>
Date: 30 Oct 92 00:41:09 GMT
References: <HANDL.92Oct28122328@crypt9.cs.uni-sb.de>
Sender: news@igor.rutgers.edu
Distribution: comp
Organization: Rutgers University Department of Computer Science
Lines: 30
Nntp-Posting-Host: pisces.rutgers.edu