7

I recently asked the opposite question, and got some really awesome answers, but just realized I'm uncertain of a counterpart for converting letters to numbers.

Here's the code I'm using to convert numbers to letters:

\newcommand\makeAlph[1]{%
\ifcase #1 a\or b\or c\or d\or e\or f\or g\or h\or
i\or j\or k\or l\or m\or n\or o\or p\or q\or r\or
s\or t\or u\or v\or w\or x\or y\or z\fi}

Because it appears that \ifcase expects a number, I'm unsure how to tweak this code to accept a letter and convert to numbers instead; it could be because it can't, in its current form, and there's another solution. I've looked at various packages but can't quite find the solution, but I feel that I'm again overlooking something subtle, but simple.

Basically, I'd like to work on a 36-character alphabet (a-z0-9), where a=0, b=1...8=34, 9=35. Ideally, there'd be some command like this, \makeNum{}, like \makeAlph{} in the example above.

Thankful for any guidance on this one, as with the other! Happy to provide any more detail as well as dive into any resources that I might have missed. Cheers!

1
  • @UlrichDiez Thanks for calling that out! I just added that in. Cheers! – Justin Troutman May 8 at 0:55
7

You can use the primitive \number to produce a number (unsurprisingly), and use the `<char> syntax to get the ASCII index of the <char>. You can then use \numexpr to subtract the index of `A from the argument:

\documentclass{article}
\newcommand\makefromAlph[1]{\number\numexpr`#1-`A\relax}
\newcommand\makefromalph[1]{\number\numexpr`#1-`a\relax}
\begin{document}
\makefromAlph{B}--\makefromalph{x}
\end{document}

produces 1--23.

You can also use expl3's \int_from_alph:n:

\documentclass{article}
\ExplSyntaxOn
\NewExpandableDocumentCommand \makefromAlph { m }
  { \int_eval:n { \int_from_alph:n {#1} - 1 } }
\ExplSyntaxOff
\begin{document}
\typeout{\makefromAlph{B}--\makefromAlph{x}}
\end{document}

which produces the same 1--23. Note that here the same \int_from_alph:n understands both uppercase and lowercase letters.

Note also that neither version checks the validity of the input.


Making A-Z map to 0-25 is easy because they are sequential in the ASCII table,, but appending characters 0-9 there is a bit trickier (far from impossible, of course). You can either have a 1-to-1 mapping as in Steven's answer, which may be more straightforward to code (and maybe faster, depending how you implement it), or you can write a range.

In the code below, the numerical expansion of the input is passed to \makealphaux along with A or a, for the uppercase and lowercase versions. The number is then compared against `0 and `9, and if it is within the range, it is computed as #1-`0+26 to give what you expect, otherwise it is computed as #1-`A (or #1-`a). The output from the code below is 1--23--26--35:

\documentclass{article}
\newcommand\makefromAlph[1]{\expandafter\makealphaux\number`#1;A}
\newcommand\makefromalph[1]{\expandafter\makealphaux\number`#1;a}
\def\makealphaux#1;#2{%
  \number\numexpr#1-%
  \ifnum0%
      \ifnum`0>#1    \else 1\fi
      \ifnum   #1>`9 \else 1\fi
      =11 %
    `0+26%
  \else
    `#2%
  \fi\relax}
\begin{document}
\makefromAlph{B}--\makefromalph{x}--\makefromalph{0}--\makefromalph{9}
\end{document}

or with expl3:

\documentclass{article}
\ExplSyntaxOn
\NewExpandableDocumentCommand \makefromAlph { m }
  {
    \exp_args:Nff \__troutman_from_alph_aux:nn
      { \int_eval:n { \int_from_alph:n {#1} } }
      { \int_eval:n { \int_from_alph:n { 0 } } }
  }
\cs_new:Npn \__troutman_from_alph_aux:nn #1#2
  {
    \int_compare:nTF { 0 <= #1-#2 <= 9 }
      { \int_eval:n { #1-#2 + 26 } }
      { \int_eval:n { #1-1 } }
  }
\ExplSyntaxOff
\begin{document}
\makefromAlph{B}--\makefromAlph{x}--\makefromAlph{0}--\makefromAlph{9}
\end{document}
3
  • Ah, very nice -- I'm digging more into expl3 as a result of answers to both my questions. That said, can the above code handle the need to also convert some numbers to other numbers? That's a bit confusing, so here's what I mean: The end of the alphabet is Z, where Z=25, but what if I want to extend my alphabet further, where after Z you have 0, which equals 26, 1=27, ... ending in 9=35? I suppose this introduces some conflict, where the alphabet is actually alphanumeric. – Justin Troutman May 4 at 3:24
  • 1
    @JustinTroutman You can have a look to the package alphalph: texdoc.org/serve/alphalph/0 – Rmano May 4 at 7:07
  • 1
    @JustinTroutman I added a version that prints 26-35 for 0-9 – Phelype Oleinik May 4 at 13:24
4

An approach with \tokcycle. Of course, the invocation is not expandable, but the resulting token list is.

An interesting thing about this approach is that any symbols that have not be remapped are retained in their original form. Thus, capital letters and punctuation will pass through the environment unchanged.

\documentclass{article}
\usepackage{tokcycle}
\tokcycleenvironment\remaptext
    {\addcytoks[x]{\tcremap{##1}}}
    {\processtoks{##1}}
    {\addcytoks{##1}}
    {\addcytoks{##1}}
\newcommand*\tcmapto[2]{\expandafter\def\csname tcmapto#1\endcsname{#2}}
\newcommand*\tcremap[1]{\ifcsname tcmapto#1\endcsname
  \csname tcmapto#1\expandafter\endcsname\else\expandafter#1\fi}
\tcmapto a{0}   \tcmapto b{1}   \tcmapto c{2}   \tcmapto d{3}   
\tcmapto e{4}   \tcmapto f{5}   \tcmapto g{6}   \tcmapto h{7}
\tcmapto i{8}   \tcmapto j{9}   \tcmapto k{10}  \tcmapto l{11}
\tcmapto m{12}  \tcmapto n{13}  \tcmapto o{14}  \tcmapto p{15}
\tcmapto q{16}  \tcmapto r{17}  \tcmapto s{18}  \tcmapto t{19}
\tcmapto u{20}  \tcmapto v{21}  \tcmapto w{22}  \tcmapto x{23}
\tcmapto y{24}  \tcmapto z{25}  \tcmapto 0{26}  \tcmapto 1{27}
\tcmapto 2{28}  \tcmapto 3{29}  \tcmapto 4{30}  \tcmapto 5{31}
\tcmapto 6{32}  \tcmapto 7{33}  \tcmapto 8{34}  \tcmapto 9{35}
\begin{document}
\remaptext a b c, l m n, z 0 1, 7 8 9. ABC\endremaptext

Also retained in cytoks token list:\\
\detokenize\expandafter{\the\cytoks}
\end{document}

enter image description here

Here is a macro version of it, which does not immediately print out the result but retains it in the \cytoks token list:

\documentclass{article}
\usepackage{tokcycle}
\newcommand\Remaptext[1]{\tokcycle
    {\addcytoks[x]{\tcremap{##1}}}
    {\processtoks{##1}}
    {\addcytoks{##1}}
    {\addcytoks{##1}}{#1}}
\newcommand*\tcmapto[2]{\expandafter\def\csname tcmapto#1\endcsname{#2}}
\newcommand*\tcremap[1]{\ifcsname tcmapto#1\endcsname
  \csname tcmapto#1\expandafter\endcsname\else\expandafter#1\fi}
\tcmapto a{0}   \tcmapto b{1}   \tcmapto c{2}   \tcmapto d{3}   
\tcmapto e{4}   \tcmapto f{5}   \tcmapto g{6}   \tcmapto h{7}
\tcmapto i{8}   \tcmapto j{9}   \tcmapto k{10}  \tcmapto l{11}
\tcmapto m{12}  \tcmapto n{13}  \tcmapto o{14}  \tcmapto p{15}
\tcmapto q{16}  \tcmapto r{17}  \tcmapto s{18}  \tcmapto t{19}
\tcmapto u{20}  \tcmapto v{21}  \tcmapto w{22}  \tcmapto x{23}
\tcmapto y{24}  \tcmapto z{25}  \tcmapto 0{26}  \tcmapto 1{27}
\tcmapto 2{28}  \tcmapto 3{29}  \tcmapto 4{30}  \tcmapto 5{31}
\tcmapto 6{32}  \tcmapto 7{33}  \tcmapto 8{34}  \tcmapto 9{35}
\begin{document}
\Remaptext{a b c, l m n, z 0 1, 7 8 9. ABC}

Retained in cytoks token list:\\
\the\cytoks
\end{document}
3

You can access the character code of the letter “a” with

`a

So a solution is quite easy:

\documentclass{article}

\ExplSyntaxOn

\NewExpandableDocumentCommand{\makeAlph}{m}
 {
  \int_compare:nTF { `a <= `#1 <= `z }
   {% a letter
    \int_eval:n { `#1 - `a }
   }
   {% a digit
    \int_eval:n { `#1 - `0 + 26 }
   }
 }

\ExplSyntaxOff

\begin{document}

\makeAlph{a}

\makeAlph{b}

\makeAlph{x}

\makeAlph{z}

\makeAlph{0}

\makeAlph{9}

\end{document}

enter image description here

3

Due to the 30000-character-limit I needed to split in two answers.

This is my first answer.

(The second answer is a continuation of the first answer).

If you wish to upvote, please upvote only one of the two answers. This prevents unfair reputation-gain. If you wish to downvote, dovnvote whichever answer(s) you like to downvote.


If you like, you can use a macro that processes a delimited argument for distingusihing the 64 cases a-z, A-Z, 0-9, ⟨argument empty⟩, ⟨argument none of the further⟩ from each other.

With the example below the macro \makeNum takes two arguments, the first argument being the character to convert to number, the second argument denoting tokens to be delivered in case of error, i.e., in case the first argument not being one of a-z, A-Z, 0-9.

Forking/branching is done by means of a delimited argument so that no \if../\ifcase...\or...\else...\fi is invoked. This circumstance implies that weird things like \makeNum{\fi Problem!}{⟨error tokens⟩} yield ⟨error tokens⟩ instead of unexpected/unpredictable behavior.

With the example below argument-delimiters are explicit character-tokens that at definition-time are read and tokenized under standard-catcode-régime. Therefore with \makeNum's first argument, i.e., with the character-token to convert, you are bound to standard-catcode-régime, i.e., a-z and A-Z must be of category code 11(letter) and 0-9 must be of category code 12(other).

(The binding to standard-catcode-régime can be loosened, e.g., by

  • defining a macro \makeNuminner similar to what is \makeNum in the example below and
  • a macro \makeNumfork similar to what is \makeNumfork in the example below, but with these two macros character-tokens belonging to argument-delimiters being read and tokenized as (or via \edef and \noexpand and \string being transformed to) character-tokens of category-code 12(other),
  • and defining \makeNum to apply \string to the 1st argument before passing it to \makeNuminner...)

 

\errorcontextlines=10000
\documentclass{article}

\makeatletter
\@ifdefinable\gobbletoexclam{\long\def\gobbletoexclam#1!{}}%
\newcommand\makeNum[2]{%
  % Test if #1 contains exclamation-mark:
  \ifcat$\detokenize\expandafter{\gobbletoexclam#1!}$%
  \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
  {%
    % #1 does not contain exclamation-mark:
    \makeNumfork
    !#1!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!0!1!2!3!4!5!6!7!8!9!{#2}% argument empty
    !!#1!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!0!1!2!3!4!5!6!7!8!9!{0}%
    !!a!#1!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!0!1!2!3!4!5!6!7!8!9!{1}%
    !!a!b!#1!d!e!f!g!h!i!j!k!l!m!n!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G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!0!1!2!3!4!5!6!7!8!9!{#2}% argument s.th. else without exclamtion-mark
    !!!!%
  }{%
    % #1 does contain exclamation-mark -> argument s.th. else with exclamtion-mark:
    #2%
  }%
}%
\@ifdefinable\makeNumfork{%
  \long\def\makeNumfork#1!!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!%
                           A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!%
                           0!1!2!3!4!5!6!7!8!9!#2#3!!!!{#2}%
}%
% An error-message-command:
\newcommand\makeNumerrordefault{%
  %\PackageError{Package-Name}{Invalid argument for \string\makeNum}{Only values a-z, 0-9 are allowed!}%
  \GenericError{(macro \string\makeNum)\@spaces \@spaces \@spaces \@spaces }%
               {macro \string\makeNum Error: Invalid argument for \string\makeNum}%
               {See the comments for explanation.}%
               {Only values a-z, A-Z, 0-9 are allowed!}%
}%
\makeatother


\begin{document}

\vspace*{-3cm}%
\footnotesize

\noindent
\verb|\makeNum{a}{\makeNumerrordefault}| yields: \makeNum{a}{\makeNumerrordefault}\\
\verb|\makeNum{A}{\makeNumerrordefault}| yields: \makeNum{A}{\makeNumerrordefault}\\
\verb|\makeNum{b}{\makeNumerrordefault}| yields: \makeNum{b}{\makeNumerrordefault}\\
\verb|\makeNum{B}{\makeNumerrordefault}| yields: \makeNum{B}{\makeNumerrordefault}\\
\verb|\makeNum{c}{\makeNumerrordefault}| yields: \makeNum{c}{\makeNumerrordefault}\\
\verb|\makeNum{C}{\makeNumerrordefault}| yields: \makeNum{C}{\makeNumerrordefault}\\
\verb|\makeNum{d}{\makeNumerrordefault}| yields: \makeNum{d}{\makeNumerrordefault}\\
\verb|\makeNum{D}{\makeNumerrordefault}| yields: \makeNum{D}{\makeNumerrordefault}\\
\verb|\makeNum{e}{\makeNumerrordefault}| yields: \makeNum{e}{\makeNumerrordefault}\\
\verb|\makeNum{E}{\makeNumerrordefault}| yields: \makeNum{E}{\makeNumerrordefault}\\
\verb|\makeNum{f}{\makeNumerrordefault}| yields: \makeNum{f}{\makeNumerrordefault}\\
\verb|\makeNum{F}{\makeNumerrordefault}| yields: \makeNum{F}{\makeNumerrordefault}\\
\verb|\makeNum{g}{\makeNumerrordefault}| yields: \makeNum{g}{\makeNumerrordefault}\\
\verb|\makeNum{G}{\makeNumerrordefault}| yields: \makeNum{G}{\makeNumerrordefault}\\
\verb|\makeNum{h}{\makeNumerrordefault}| yields: \makeNum{h}{\makeNumerrordefault}\\
\verb|\makeNum{H}{\makeNumerrordefault}| yields: \makeNum{H}{\makeNumerrordefault}\\
\verb|\makeNum{i}{\makeNumerrordefault}| yields: \makeNum{i}{\makeNumerrordefault}\\
\verb|\makeNum{I}{\makeNumerrordefault}| yields: \makeNum{I}{\makeNumerrordefault}\\
\verb|\makeNum{j}{\makeNumerrordefault}| yields: \makeNum{j}{\makeNumerrordefault}\\
\verb|\makeNum{J}{\makeNumerrordefault}| yields: \makeNum{J}{\makeNumerrordefault}\\
\verb|\makeNum{k}{\makeNumerrordefault}| yields: \makeNum{k}{\makeNumerrordefault}\\
\verb|\makeNum{K}{\makeNumerrordefault}| yields: \makeNum{K}{\makeNumerrordefault}\\
\verb|\makeNum{l}{\makeNumerrordefault}| yields: \makeNum{l}{\makeNumerrordefault}\\
\verb|\makeNum{L}{\makeNumerrordefault}| yields: \makeNum{L}{\makeNumerrordefault}\\
\verb|\makeNum{m}{\makeNumerrordefault}| yields: \makeNum{m}{\makeNumerrordefault}\\
\verb|\makeNum{M}{\makeNumerrordefault}| yields: \makeNum{M}{\makeNumerrordefault}\\
\verb|\makeNum{n}{\makeNumerrordefault}| yields: \makeNum{n}{\makeNumerrordefault}\\
\verb|\makeNum{N}{\makeNumerrordefault}| yields: \makeNum{N}{\makeNumerrordefault}\\
\verb|\makeNum{o}{\makeNumerrordefault}| yields: \makeNum{o}{\makeNumerrordefault}\\
\verb|\makeNum{O}{\makeNumerrordefault}| yields: \makeNum{O}{\makeNumerrordefault}\\
\verb|\makeNum{p}{\makeNumerrordefault}| yields: \makeNum{p}{\makeNumerrordefault}\\
\verb|\makeNum{P}{\makeNumerrordefault}| yields: \makeNum{P}{\makeNumerrordefault}\\
\verb|\makeNum{q}{\makeNumerrordefault}| yields: \makeNum{q}{\makeNumerrordefault}\\
\verb|\makeNum{Q}{\makeNumerrordefault}| yields: \makeNum{Q}{\makeNumerrordefault}\\
\verb|\makeNum{r}{\makeNumerrordefault}| yields: \makeNum{r}{\makeNumerrordefault}\\
\verb|\makeNum{R}{\makeNumerrordefault}| yields: \makeNum{R}{\makeNumerrordefault}\\
\verb|\makeNum{s}{\makeNumerrordefault}| yields: \makeNum{s}{\makeNumerrordefault}\\
\verb|\makeNum{S}{\makeNumerrordefault}| yields: \makeNum{S}{\makeNumerrordefault}\\
\verb|\makeNum{t}{\makeNumerrordefault}| yields: \makeNum{t}{\makeNumerrordefault}\\
\verb|\makeNum{T}{\makeNumerrordefault}| yields: \makeNum{T}{\makeNumerrordefault}\\
\verb|\makeNum{u}{\makeNumerrordefault}| yields: \makeNum{u}{\makeNumerrordefault}\\
\verb|\makeNum{U}{\makeNumerrordefault}| yields: \makeNum{U}{\makeNumerrordefault}\\
\verb|\makeNum{v}{\makeNumerrordefault}| yields: \makeNum{v}{\makeNumerrordefault}\\
\verb|\makeNum{V}{\makeNumerrordefault}| yields: \makeNum{V}{\makeNumerrordefault}\\
\verb|\makeNum{w}{\makeNumerrordefault}| yields: \makeNum{w}{\makeNumerrordefault}\\
\verb|\makeNum{W}{\makeNumerrordefault}| yields: \makeNum{W}{\makeNumerrordefault}\\
\verb|\makeNum{x}{\makeNumerrordefault}| yields: \makeNum{x}{\makeNumerrordefault}\\
\verb|\makeNum{X}{\makeNumerrordefault}| yields: \makeNum{X}{\makeNumerrordefault}\\
\verb|\makeNum{y}{\makeNumerrordefault}| yields: \makeNum{y}{\makeNumerrordefault}\\
\verb|\makeNum{Y}{\makeNumerrordefault}| yields: \makeNum{Y}{\makeNumerrordefault}\\
\verb|\makeNum{z}{\makeNumerrordefault}| yields: \makeNum{z}{\makeNumerrordefault}\\
\verb|\makeNum{Z}{\makeNumerrordefault}| yields: \makeNum{Z}{\makeNumerrordefault}\\
\verb|\makeNum{0}{\makeNumerrordefault}| yields: \makeNum{0}{\makeNumerrordefault}\\
\verb|\makeNum{1}{\makeNumerrordefault}| yields: \makeNum{1}{\makeNumerrordefault}\\
\verb|\makeNum{2}{\makeNumerrordefault}| yields: \makeNum{2}{\makeNumerrordefault}\\
\verb|\makeNum{3}{\makeNumerrordefault}| yields: \makeNum{3}{\makeNumerrordefault}\\
\verb|\makeNum{4}{\makeNumerrordefault}| yields: \makeNum{4}{\makeNumerrordefault}\\
\verb|\makeNum{5}{\makeNumerrordefault}| yields: \makeNum{5}{\makeNumerrordefault}\\
\verb|\makeNum{6}{\makeNumerrordefault}| yields: \makeNum{6}{\makeNumerrordefault}\\
\verb|\makeNum{7}{\makeNumerrordefault}| yields: \makeNum{7}{\makeNumerrordefault}\\
\verb|\makeNum{8}{\makeNumerrordefault}| yields: \makeNum{8}{\makeNumerrordefault}\\
\verb|\makeNum{9}{\makeNumerrordefault}| yields: \makeNum{9}{\makeNumerrordefault}\\
% \makeNumerrordefault delivers an error-message. Instead we want the phrase "Error-Tokens".
% \verb|\makeNum{&}{\makeNumerrordefault}| yields: \makeNum{&}{\makeNumerrordefault}\\
\verb|\makeNum{&}{Error-Tokens.}| yields: \makeNum{&}{Error-Tokens.}\\
% \verb|\makeNum{What?}{\makeNumerrordefault}| yields: \makeNum{What?}{\makeNumerrordefault}\\
\verb|\makeNum{What?}{Error-Tokens.}| yields: \makeNum{What?}{Error-Tokens.}\\
% \verb|\makeNum{!a!b}{\makeNumerrordefault}| yields: \makeNum{!a!b}{\makeNumerrordefault}\\
\verb|\makeNum{!a!b}{Error-Tokens.}| yields: \makeNum{!a!b}{Error-Tokens.}

\end{document}

enter image description here


Due to the 30000-character-limit I needed to split in two answers.

This is my first answer.

(The second answer is a continuation of the first answer).

1

Due to the 30000-character-limit I needed to split in two answers.

This is my second answer.

(The second answer is a continuation of the first answer.)

If you wish to upvote, please upvote only one of the two answers. This prevents unfair reputation-gain. If you wish to downvote, dovnvote whichever answer(s) you like to downvote.


The binding of \makeNum's first argument, which denotes the character-token to convert, to standard-category-code-régime can be loosened, e.g., by defining a macro \makeNuminner similar to what is \makeNum in the example of my first answer and a macro \makeNumfork, but both macros by means of a scratch-macro which reads the delimiters while catcodes of delimiting characters within a group temporarily are switched to 12(other), closes the group and defines the macros, and defining \makeNum to apply \string to the 1st argument before passing it to \makeNuminner—but be aware that any character of catcode 10(space) will be tokenized as explicit space-token, i.e., as an explicit character token of category-code 10(space) and character-code 32(!!!); applying \string to such a token in any case yields an explicit space-token. Therefore, like the approaches presented in other answers, the approach in this answer does not work out if catcodes of characters to convert are switched to 10(space) (or to some value which implies that no token at all will be created when in the .tex-input-file encountering the corresponding character).

\makeNum's applying of \string implies that \makeNum can be tricked into accepting not only character-tokens but also one-letter-control-sequence-tokens \a..\z, \A..\Z, \0.. \9 by (temporarily) assigning the integer-parameter \escapechar a negative value.

\errorcontextlines=10000
\documentclass{article}

\makeatletter
%
\newcommand\makeNum[1]{\expandafter\innermakeNum\expandafter{\string#1}}%
%
% ======================================================================
% Step 1: Open up a new group/local scope:
% ======================================================================
\begingroup
% ======================================================================
% Step 2: Define a one-letter-scratch-macro \X to close the group and 
%         to define the macros \innermakeNum, \makeNumfork and 
%         \gobbletoexclam from its arguments (which will be
%         read/tokenized under temporarily changed catcode-régime):
% ======================================================================
\def\X#1#2#3{%
  %------------------------------
  \endgroup
  %------------------------------
  \newcommand\innermakeNum[2]{%
    % Test if ##1 contains exclamation-mark:
    \ifcat$\detokenize\expandafter{\gobbletoexclam##1#3}$%
    \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
    {%
      % ##1 does not contain exclamation-mark:
      \makeNumfork#1%
      #3#3#3#3%
    }{%
      % ##1 does contain exclamation-mark -> argument s.th. else with exclamtion-mark:
      ##2%
    }%
  }%
  %------------------------------
  \@ifdefinable\makeNumfork{%
    \long\def\makeNumfork##1#2##2##3#3#3#3#3{##2}%
  }%
  %------------------------------
  \@ifdefinable\gobbletoexclam{\long\def\gobbletoexclam##1#3{}}%
  %------------------------------
}%
% ======================================================================
% Step 3: Temporarily change the catcode-régime:
% ======================================================================
\def\@makeotherrecursion#1{%
  \ifx\X#1\else\catcode`#1=12\relax\expandafter\@makeotherrecursion\fi
}%
\@makeotherrecursion !abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\X%
% ======================================================================
% Step 4: Call the scratch-macro \X. The scratch-macro \X has TeX
%         - read and tokenize the arguments under temporarily changed
%           catcode-régime.
%         - close the group/local scope and thus annihilate all local
%           assignments like macro-definitions and catcode-changes that 
%           took place within that scope. (The scratch-macro \X will be
%           annihilated/undefined, too.)
%         - define \innermakeNum, \makeNumfork and \gobbletoexclam
%           from the arguments.
% ======================================================================
\X{%
  !#1!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!0!1!2!3!4!5!6!7!8!9!{#2}% argument empty
  !!#1!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!0!1!2!3!4!5!6!7!8!9!{0}%
  !!a!#1!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!0!1!2!3!4!5!6!7!8!9!{1}%
  !!a!b!#1!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!A!B!C!D!E!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!X!Y!Z!0!1!2!3!4!5!6!7!8!9!{#2}% argument s.th. else without exclamtion-mark
}{%
  !!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!%
  A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!%
  0!1!2!3!4!5!6!7!8!9!%
}{!}%
% \X does \endgroup and defines \innermakeNum, \makeNumfork and \gobbletoexclam.
%
% An error-message-command:
\newcommand\makeNumerrordefault{%
  %\PackageError{Package-Name}{Invalid argument for \string\makeNum}{Only values a-z, 0-9 are allowed!}%
  \GenericError{(macro \string\makeNum)\@spaces \@spaces \@spaces \@spaces }%
               {macro \string\makeNum Error: Invalid argument for \string\makeNum}%
               {See the comments for explanation.}%
               {Only values a-z, A-Z, 0-9 are allowed!}%
}%
\makeatother

\begin{document}

\vspace*{-4cm}%
\enlargethispage{1cm}%
\footnotesize

\noindent
\verb|\makeNum{a}{\makeNumerrordefault}| yields: \makeNum{a}{\makeNumerrordefault}\\
\verb|\makeNum{A}{\makeNumerrordefault}| yields: \makeNum{A}{\makeNumerrordefault}\\
\verb|\makeNum{b}{\makeNumerrordefault}| yields: \makeNum{b}{\makeNumerrordefault}\\
\verb|\makeNum{B}{\makeNumerrordefault}| yields: \makeNum{B}{\makeNumerrordefault}\\
\verb|\makeNum{c}{\makeNumerrordefault}| yields: \makeNum{c}{\makeNumerrordefault}\\
\verb|\makeNum{C}{\makeNumerrordefault}| yields: \makeNum{C}{\makeNumerrordefault}\\
\verb|\makeNum{d}{\makeNumerrordefault}| yields: \makeNum{d}{\makeNumerrordefault}\\
\verb|\makeNum{D}{\makeNumerrordefault}| yields: \makeNum{D}{\makeNumerrordefault}\\
\verb|\makeNum{e}{\makeNumerrordefault}| yields: \makeNum{e}{\makeNumerrordefault}\\
\verb|\makeNum{E}{\makeNumerrordefault}| yields: \makeNum{E}{\makeNumerrordefault}\\
\verb|\makeNum{f}{\makeNumerrordefault}| yields: \makeNum{f}{\makeNumerrordefault}\\
\verb|\makeNum{F}{\makeNumerrordefault}| yields: \makeNum{F}{\makeNumerrordefault}\\
\verb|\makeNum{g}{\makeNumerrordefault}| yields: \makeNum{g}{\makeNumerrordefault}\\
\verb|\makeNum{G}{\makeNumerrordefault}| yields: \makeNum{G}{\makeNumerrordefault}\\
\verb|\makeNum{h}{\makeNumerrordefault}| yields: \makeNum{h}{\makeNumerrordefault}\\
\verb|\makeNum{H}{\makeNumerrordefault}| yields: \makeNum{H}{\makeNumerrordefault}\\
\verb|\makeNum{i}{\makeNumerrordefault}| yields: \makeNum{i}{\makeNumerrordefault}\\
\verb|\makeNum{I}{\makeNumerrordefault}| yields: \makeNum{I}{\makeNumerrordefault}\\
\verb|\makeNum{j}{\makeNumerrordefault}| yields: \makeNum{j}{\makeNumerrordefault}\\
\verb|\makeNum{J}{\makeNumerrordefault}| yields: \makeNum{J}{\makeNumerrordefault}\\
\verb|\makeNum{k}{\makeNumerrordefault}| yields: \makeNum{k}{\makeNumerrordefault}\\
\verb|\makeNum{K}{\makeNumerrordefault}| yields: \makeNum{K}{\makeNumerrordefault}\\
\verb|\makeNum{l}{\makeNumerrordefault}| yields: \makeNum{l}{\makeNumerrordefault}\\
\verb|\makeNum{L}{\makeNumerrordefault}| yields: \makeNum{L}{\makeNumerrordefault}\\
\verb|\makeNum{m}{\makeNumerrordefault}| yields: \makeNum{m}{\makeNumerrordefault}\\
\verb|\makeNum{M}{\makeNumerrordefault}| yields: \makeNum{M}{\makeNumerrordefault}\\
\verb|\makeNum{n}{\makeNumerrordefault}| yields: \makeNum{n}{\makeNumerrordefault}\\
\verb|\makeNum{N}{\makeNumerrordefault}| yields: \makeNum{N}{\makeNumerrordefault}\\
\verb|\makeNum{o}{\makeNumerrordefault}| yields: \makeNum{o}{\makeNumerrordefault}\\
\verb|\makeNum{O}{\makeNumerrordefault}| yields: \makeNum{O}{\makeNumerrordefault}\\
\verb|\makeNum{p}{\makeNumerrordefault}| yields: \makeNum{p}{\makeNumerrordefault}\\
\verb|\makeNum{P}{\makeNumerrordefault}| yields: \makeNum{P}{\makeNumerrordefault}\\
\verb|\makeNum{q}{\makeNumerrordefault}| yields: \makeNum{q}{\makeNumerrordefault}\\
\verb|\makeNum{Q}{\makeNumerrordefault}| yields: \makeNum{Q}{\makeNumerrordefault}\\
\verb|\makeNum{r}{\makeNumerrordefault}| yields: \makeNum{r}{\makeNumerrordefault}\\
\verb|\makeNum{R}{\makeNumerrordefault}| yields: \makeNum{R}{\makeNumerrordefault}\\
\verb|\makeNum{s}{\makeNumerrordefault}| yields: \makeNum{s}{\makeNumerrordefault}\\
\verb|\makeNum{S}{\makeNumerrordefault}| yields: \makeNum{S}{\makeNumerrordefault}\\
\verb|\makeNum{t}{\makeNumerrordefault}| yields: \makeNum{t}{\makeNumerrordefault}\\
\verb|\makeNum{T}{\makeNumerrordefault}| yields: \makeNum{T}{\makeNumerrordefault}\\
\verb|\makeNum{u}{\makeNumerrordefault}| yields: \makeNum{u}{\makeNumerrordefault}\\
\verb|\makeNum{U}{\makeNumerrordefault}| yields: \makeNum{U}{\makeNumerrordefault}\\
\verb|\makeNum{v}{\makeNumerrordefault}| yields: \makeNum{v}{\makeNumerrordefault}\\
\verb|\makeNum{V}{\makeNumerrordefault}| yields: \makeNum{V}{\makeNumerrordefault}\\
\verb|\makeNum{w}{\makeNumerrordefault}| yields: \makeNum{w}{\makeNumerrordefault}\\
\verb|\makeNum{W}{\makeNumerrordefault}| yields: \makeNum{W}{\makeNumerrordefault}\\
\verb|\makeNum{x}{\makeNumerrordefault}| yields: \makeNum{x}{\makeNumerrordefault}\\
\verb|\makeNum{X}{\makeNumerrordefault}| yields: \makeNum{X}{\makeNumerrordefault}\\
\verb|\makeNum{y}{\makeNumerrordefault}| yields: \makeNum{y}{\makeNumerrordefault}\\
\verb|\makeNum{Y}{\makeNumerrordefault}| yields: \makeNum{Y}{\makeNumerrordefault}\\
\verb|\makeNum{z}{\makeNumerrordefault}| yields: \makeNum{z}{\makeNumerrordefault}\\
\verb|\makeNum{Z}{\makeNumerrordefault}| yields: \makeNum{Z}{\makeNumerrordefault}\\
\verb|\makeNum{0}{\makeNumerrordefault}| yields: \makeNum{0}{\makeNumerrordefault}\\
\verb|\makeNum{1}{\makeNumerrordefault}| yields: \makeNum{1}{\makeNumerrordefault}\\
\verb|\makeNum{2}{\makeNumerrordefault}| yields: \makeNum{2}{\makeNumerrordefault}\\
\verb|\makeNum{3}{\makeNumerrordefault}| yields: \makeNum{3}{\makeNumerrordefault}\\
\verb|\makeNum{4}{\makeNumerrordefault}| yields: \makeNum{4}{\makeNumerrordefault}\\
\verb|\makeNum{5}{\makeNumerrordefault}| yields: \makeNum{5}{\makeNumerrordefault}\\
\verb|\makeNum{6}{\makeNumerrordefault}| yields: \makeNum{6}{\makeNumerrordefault}\\
\verb|\makeNum{7}{\makeNumerrordefault}| yields: \makeNum{7}{\makeNumerrordefault}\\
\verb|\makeNum{8}{\makeNumerrordefault}| yields: \makeNum{8}{\makeNumerrordefault}\\
\verb|\makeNum{9}{\makeNumerrordefault}| yields: \makeNum{9}{\makeNumerrordefault}\\
% \makeNumerrordefault delivers an error-message. Instead we want the phrase "Error-Tokens".
% \verb|\makeNum{&}{\makeNumerrordefault}| yields: \makeNum{&}{\makeNumerrordefault}\\
\verb|\makeNum{&}{Error-Tokens.}| yields: \makeNum{&}{Error-Tokens.}\\
% \verb|\makeNum{What?}{\makeNumerrordefault}| yields: \makeNum{What?}{\makeNumerrordefault}\\
\verb|\makeNum{What?}{Error-Tokens.}| yields: \makeNum{What?}{Error-Tokens.}\\
% \verb|\makeNum{!a!b}{\makeNumerrordefault}| yields: \makeNum{!a!b}{\makeNumerrordefault}\\
\verb|\makeNum{!a!b}{Error-Tokens.}| yields: \makeNum{!a!b}{Error-Tokens.}\\
\verb|\catcode`\w=7 \catcode`\5=11|\\
\verb|\makeNum{w}{\makeNumerrordefault}| yields: \begingroup\catcode`\w=7 \makeNum{w}{\makeNumerrordefault}\endgroup\\
\verb|\makeNum{5}{\makeNumerrordefault}| yields: \begingroup\catcode`\5=11 \makeNum{5}{\makeNumerrordefault}\endgroup\\
\verb|\escapechar=-1|\\
\verb|\makeNum{\V}{\makeNumerrordefault}| yields: \begingroup\escapechar=-1 \makeNum{\V}{\makeNumerrordefault}\endgroup

\end{document}

enter image description here


Due to the 30000-character-limit I needed to split in two answers.

This is my second answer.

(The second answer is a continuation of the first answer.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.