[OS X TeX] PlainTeX Macro to Define Macros in Uppercase

Ross Moore ross at ics.mq.edu.au
Mon Jan 5 05:33:13 CET 2009


Hi Brad (or Angie, or both of you  :-)

On 05/01/2009, at 2:50 PM, Brad & Angie wrote:

> Here are the details.  (Sorry about not providing enough  
> information the first time.)  My real problem is that I need to  
> change a macro parameter to uppercase, but both snippets of code  
> produce the same error.  Thanks for taking a look.  Brad.

> This works to typeset:  brad dallas
>
> \def\brad{brad dallas}
> \def\BRAD{BRAD DALLAS}
> My name is \csname\uppercase{brad}\endcsname

No; the \uppercase has to be outside the \csname, as follows:

	\bgroup
	  \uppercase{\def\thisupper{#1}}%
	  \expandafter\gdef\csname x\thisupper\endcsname
		{\noindent\hbox to\wdx{(\hfil#1\hfil)}}%
	\egroup

The extra \bgroup...\egroup is to contain any extra local
definitions or counter settings (such as \thisupper here)
to within that group. The \gdef forces \xA to become global.


> \vfil\eject\bye

Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------






More information about the macostex-archives mailing list