# catcode as used in defining Hypergeometric Function

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.

-

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, is

\usepackage{amsmath} % for \genfrac

\newmuskip\pFqskip
\pFqskip=6mu
\mathchardef\pFcomma=\mathcode, % keep a copy of the comma

\newcommand*\pFq[5]{%
\begingroup
\begingroup\lccode~=,
\lowercase{\endgroup\def~}{\pFcomma\mkern\pFqskip}%
\mathcode,=\string"8000
{}_{#1}F_{#2}\biggl[\genfrac..{0pt}{}{#3}{#4};#5\biggr]%
\endgroup
}


The 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

  \begingroup\lccode~=,
\lowercase{\endgroup\def~}{\pFcomma\mkern\pFqskip}%


define locally a meaning for the active comma, then this meaning is triggered by \mathcode,=\string"8000 (the \string may be necessary in case babel` is used). The rest is as in the previous version.

-
Well, shivver me timbers...aye, certainly what I was looking for, with a touch of the sublime as well. Many thanks... –  asllearner Mar 8 '12 at 1:27