# Re: Defining a control sequence with uppercase roman numerals

Jellby <me@xxxxxxxxxxx> wrote:

But I can't find the way to do it with uppercase numerals, even though
exercise 7.9 is a hint. I tried with:

\newcommand{\mycommand}{\csname
myhiddencommand\uppercase\expandafter{\romannumeral\number\mytype}\endcsname}

This is more tricky, because \uppercase cannot be used inside \csname.

But you are using LaTeX, thus you can use \@Roman that is expandable,
because it explicitly looks for the limited range of roman letters and
replaces them by the uppercase variants:

| \def\@Roman#1{\expandafter\@slowromancap\romannumeral #1@}
| \def\@slowromancap#1{\ifx @#1% then terminate
| \else
| \if i#1I\else\if v#1V\else\if x#1X\else\if l#1L\else\if
| c#1C\else\if d#1D\else \if m#1M\else#1\fi\fi\fi\fi\fi\fi\fi
| \expandafter\@slowromancap
| \fi
| }

The result:
\makeatletter
\newcommand{\mycommand}{%
\csname myhiddencommand\@Roman{\mytype}\endcsname
}
or
\newcommand{\mycommand}{%
\@nameuse{myhiddencommand\@Roman\mytype}%
}%

and all kinds of \string, \expandafter and \noexpand I could think of (I
don't really understand them, you'd have noticed), to no avail. Is there
(of course there is, but how?) a way to get it?

If \@Roman cannot be used, then \uppercase helps, but it must be
used outside of \csname:

\newcommand{\@exch}[2]{#2#1}

\newcommand{\mycommand}{%
\uppercase\expandafter{%
\expandafter\csname
\expandafter\@exch\expandafter{%
\romannumeral\mytype
}%
}%
{myhiddencommand}%
\endcsname
}

Yours sincerely
Heiko <oberdiek@xxxxxxxxxxxxxxx>
.

• Follow-Ups:
• References:

## Relevant Pages

• Re: Defining a control sequence with uppercase roman numerals
... exercise 7.9 is a hint. ... This is more tricky, because \uppercase cannot be used inside \csname. ... LaTeX:) ...
(comp.text.tex)
• Re: C program question
... >successfully the first part of the exercise, ... Your next problem is that you have not taken the hint given; ... The ultimate truth is that there is no Ultimate Truth ...
(alt.comp.lang.learn.c-cpp)
• Re: Possible Spam from Microsoft poser?
... How is that "tricky"? ...  Does ikl1l1.com even hint to you that it belongs ... to Microsoft? ...
(microsoft.public.outlook.general)
• Re: Variables in XSLT
... I'll mark ... direction shouldn't be all that tricky without the extra ... Hint #1: You wrote the code to do pretty much the same ... into a separate named template. ...
(comp.text.xml)
• Re: hints on this limit?
... that has weaker hypotheses and also a weaker conclusion...) ... from what most people call MVT: ... The reason it's tricky is that the existence of ... Exercise: Show that if you assume that B and D are ...
(sci.math)