[texhax] Defining a command which runs differently based ion input argument

Uwe Lueck uwe.lueck at web.de
Thu Dec 30 13:28:55 CET 2010

"Reinhard Kotucha" <reinhard.kotucha at web.de>, 30.12.2010 02:39:15:
> But I don't think that we need more category codes.  The sole purpose
> of them is to assign different meanings to one and the same character,
> which is not desirable at all.

The author or Ant says something like that, but TeX and LaTeX 
progammers do assign different meanings to the same character, 
and I like it.

> But how should, for instance a text editor, distinguish between the
> different meanings of curly braces in order to provide proper syntax
> highlighting, if each occurrence of "{" has a different meaning?

Apart from this, my idea to introduce new category codes for 
group delimiters and for box delimiters would imply that 
you could not use \hbox{...} and {\bfseries ...} and \emph{...} 
"at the same time", or it requires \catcode changing while 
processing document source, which really tends to make 
things difficult. 

But I proposed a non-TeX, of course you need different 
highlighting settings for different programs, and right 
now some editors offer different highlighting settings 
for different programming languages.

> I don't know whether DEK is still convinced that the invention of
> catcodes was a good idea.  He avoided them in Metafont, at least.

In Metafont, there is no need to distinguish text from markup ...

In a package of mine, category codes make safe expandable 
emptyness tests (etc.) possible -- the input is read with \catcode`\$=12 
and in the testing macro with \ifx$#1$ uses a different \catcode`\$.

Similarly private characters in macros in general, such as with LaTeX.

Active characters can allow tayloring syntax for special purposes. 
It is difficult and can be very tedious to program, but without 
category codes this possibility just doesn't exist. 



More information about the texhax mailing list