Eplain defines \xrlabel
to produce control sequence names for cross-reference labels, et al.
This macro expands to its argument with an `_' appended. (It does
this because the usual use of \xrlabel
is to generate a control
sequence name, and we naturally want to avoid conflicts between control
sequence names.)
Because \xrlabel
is fully expandable, to make a control
sequence name out of the result you need only do
\csname \xrlabel{label}\endcsname
The \csname
primitive makes a control sequence name out
of any sequence of character tokens, regardless of category code.
Labels can therefore include any characters except for `\',
`{', `}', and `#', all of which are used in macro
definitions themselves.
\sanitize
takes a control sequence as an argument and converts
the expansion of the control sequence into a list of character tokens.
This is the behavior you want when writing information like chapter
titles to an output file. For example, here is part of the definition
of \writenumberedtocentry
; #2
is the title that the user
has given.
... \def\temp{#2}% ... \write\tocfile{% ... \sanitize\temp ... }%