This is perhaps not a very intelligent question, as I am not (of great intelligence nor) well versed in raw tex, even more so \catcode
but in the code given in a previous answer there is a use of \catcode
:
\newcommand*\pFqskip{8mu}
\catcode`,\active
\newcommand*\pFq{\begingroup
\catcode`\,\active
\def ,{\mskip\pFqskip\relax}%
\dopFq
}
\catcode`\,12
\def\dopFq#1#2#3#4#5{%
{}_{#1}F_{#2}\biggl[\genfrac..{0pt}{}{#3}{#4};#5\biggr]%
\endgroup
}
Is there a reason why the first
\catcode`,\active
has no backslash and the later ones do? This former answer explains that the backslash is for "special catcode" characters, whate'er that may be, but why is it omitted in the first instance and not the second?
Then of course, my real question is what is the \catcode
's purpose there? I roughly understand what an active character is, but not its role in the code. Would it perhaps explain why when I use the command as follows:
\pFq{3}{2}{a,b,c}{d,e}{z}
I get no commas between the a, b, and c, or the d and e, as I would prefer?
[update, I think I just figured it out that the first part redefines comma to be small skips, given by \pFqskip{8mu}
, but I am not sure why, but I can see why this would cause the commas to disappear.]
Again, probably elementary questions, but I am a bear of little TeX.
Best Answer
There is no reason why it should be
\catcode`,=\active
in the first case and\catcode`\,=\active
in the second. Both could be either with\,
or,
. Escaping the character is necessary only for\
,%
(and other less important cases), but escaping is not harming either.Probably the author of the macros was concerned that an active character might do something strange if not escaped.
The commas disappear because, when a character is active, it is like a macro and it is replaced by the replacement text, in this case
\mskip\pFqskip\relax
.Actually this is not the best way to define that macro for typesetting hypergeometric functions parameters.
A cleaner way, that allows
\pFq
to be the argument to another command, isThe comma is made "math active", and its meaning becomes: "print a comma and insert a space" (if you don't want the comma, remove
\pFcomma
from the definition). I've reduced the spacing, because commas add some after them.The lines
define locally a meaning for the active comma, then this meaning is triggered by
\mathcode`,=\string"8000
(the\string
may be necessary in casebabel
is used). The rest is as in the previous version.