At the beginning of the
unravel package source code we can find some cryptic catcode settings:
\begingroup\let\c\catcode\fam32\c\fam10\advance\fam5\c\fam14\c45 12 % \c54 12\c55 12\c56 12\c57 12\c58 11\c95 11\c104 11\c106 11\c107 11 % \c113 11\c115 11\c119 11\c120 11\c121 11\c122 11\endlinechar-1 % \expandafter\ifx\csname unravel\endcsname\relax \else\endinput\expandafter\endgroup\fi \c84 11\c88 11\c35 6\c123 1\c125 2\c62 12\c61 12\c43 12 %
The package documenatation explains what happens here:
Catcode settings. In a group, set
\cto be a synonym of
\catcodefor short, set the catcode of space to be 10 (using
\famto avoid needing a space or an equal sign to separate the two integer arguments of
\catcode) and that of
%to be 14 (using
\famagain to avoid needing the digit 7 to have catcode other: we need the digit
5anyway in two steps). Then make
9other (we must assume that
5are already other), and make
zletters (other lowercase letters already need to be letters in the rest of the code). Make sure there is no
\endlinechar. We are finally ready to safely test whether the package has already been loaded and bail out in case it has.
What is still not clear to me is the exact purpose of that. The package seems to do that to check if the package has already been loaded. Therefore some other and some letter characters are reset to their normal catcodes in a tricky way. As far as I understand, it must still rely on a lot of other characters having their normal catcodes.
Perhaps I'm missing something here, but if that's the case, doesn't that make the whole catcode changing pretty much useless? The chances that half of the digits and letters still have the correct catcodes while the other half needs to be reset seem very low to me. Can someone explain why this is necessary or done?