[texhax] Macro that defines other macros

Aditya Mahajan adityam at umich.edu
Mon Jul 9 18:34:26 CEST 2007


Quoting Niall Mansfield <texhax at uit.co.uk>:

> The macro below works, sort of.  We use it to define many (about 20)
> "editorial marks" which show up in a draft manuscript.  E.g.
>
> \defineedvis{AMPLIFYthis}{amplify}
> \defineedvis{CHANGEthis}{change this}
> \defineedvis{CHECKthis}{check}
>
> It's not perfect though: when e.g. \CHANGEthis{...}{...} is called,
> it seems to swallow some stuff after the final curly bracket.
> Is there an obvious mistake?

Not tested, but my guess is that you are missing a % after ##2.

> \newcommand{\defineedvis}[2]
> {
> 	\expandafter\def\csname #1\endcsname##1##2%<<<--- Add a % here
> 		{\marginpar{\raggedleft\relsize{-3}\textcolor{blue}{\textbf{#2} ##1}}
> 		\uline{##2}}
> }
>

Aditya


More information about the texhax mailing list