apollo@ecf.toronto.edu (Vince Pugliese) (04/20/89)
i was wondering if it is possible to make def's unique by simply appending a number to the macro definition, e.g. \def\dummy_macro{..... \def\dummy_macro2{...... LaTeX does not seem to like the second def when it used in the body of the text arguing that the definition of dummy_macro2 does not exist. any suggestions or ideas? thanks vince
tbrakitz@phoenix.Princeton.EDU (Byron Rakitzis) (04/21/89)
In article <838@mv03.ecf.toronto.edu> apollo@ecf.toronto.edu (Vince Pugliese) writes: > > i was wondering if it is possible to make def's unique by simply > appending a number to the macro definition, e.g. > \def\dummy_macro{..... > \def\dummy_macro2{...... > > LaTeX does not seem to like the second def when it used in the > body of the text arguing that the definition of dummy_macro2 does > not exist. any suggestions or ideas? > thanks > vince This is in the TeXbook.... but hey, I'll give it a shot anyway. Here's the full answer: Control sequence names have to be made up of characters with category code 11 (letter). Plain TeX is set up so that only [a-Z] satisfy this condition. You'll notice, however, that certain plain TeX macros contain an @ in them. This is because at the beginning of the plain TeX macros, the command \catcode`\@=11 is executed. SO, if you want anything but letters appearing in your control sequence names, all you have to do is \catcode them to 11. HOWEVER, I would suggest that you didn't do that for the characters 0-9, since you're setting yourself up for trouble e.g. \vskip10pt will flag an "undefined control sequence" error. It just takes a bit of getting used to, but you CAN get used to naming your control sequences with letters only \def\dummymacrowithdescriptivename \def\newdummymacrowithdescriptivename Control sequence names can be as long as you like. (well, pretty long, anyway) Ok? -- "I've found it much easier on my ulcer to stop trying to clean out the Augean stables of the net." Chuq Von Rospach Byron Rakitzis. (tbrakitz@phoenix.princeton.edu ---- tbrakitz@pucc.bitnet)
maujt@warwick.ac.uk (Richard J Cox) (04/23/89)
In article <838@mv03.ecf.toronto.edu> apollo@ecf.toronto.edu (Vince Pugliese) writes:
%
% i was wondering if it is possible to make def's unique by simply
% appending a number to the macro definition, e.g.
% \def\dummy_macro{.....
% \def\dummy_macro2{......
%
% LaTeX does not seem to like the second def when it used in the
% body of the text arguing that the definition of dummy_macro2 does
% not exist. any suggestions or ideas?
This is TeX's fault, you can't have digits as part of a macro/function
name and hence the same applies to LaTeX.
- RC
/*--------------------------------------------------------------------------*/
JANET: maujt@uk.ac.warwick.cu BITNET: maujt%uk.ac.warwick.cu@UKACRL
ARPA: maujt@cu.warwick.ac.uk UUCP: maujt%cu.warwick.ac.uk@ukc.uucp
Richard Cox, 84 St. Georges Rd, Coventry, CV1 2DL; UK PHONE: (0203) 520995