[OS X TeX] A problem with catcodes

Morten Høgholm morten.hoegholm at gmail.com
Thu Apr 12 12:20:45 EDT 2007

On 4/12/07, Ross Moore <ross at ics.mq.edu.au> wrote:

> > \def\bbb #1{#1}
>   ... the argument is read-in when \bbb is encountered ...
> >
> > \begin{document}
> >
> > $\aaa .$
> >
> > \bbb{$\aaa .$}
>    ... so this cannot work as you want it to.

Yes it can, one just have to unlock the catcodes again.


  \gdef\aaa {\catcode`.=\active\let.=\times}

  \endlinechar=-1\relax% otherwise \endlinechar is inserted
  % can also be prevented by \noexpand at the end but requires
  % \endlinechar to be -1, 13 or 32 and \everyoef to be empty.
  \everyeof{}% clear it, just to be safe

\def\bbb #1{\ReactivateChars{#1}}


$\aaa .$

\bbb{$\aaa .$}no space added I hope

\bbb{$\aaa .$} normal space added I hope


The problem here of course being that then it only works for commands
being augmented with \ReactivateChars. I could do something like that
for xparse though since there I have control over all arguments being
parsed at the document level.

------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/

More information about the MacOSX-TeX mailing list