You may redefine \textsuperscript
while setting the label. Here \@firstofone
would be a good redefinition. This command simply reads the argument and uses it, as it is.
An additional \csname phantomsection\endcsname
may also be a good idea to have working links with package hyperref
:
\documentclass{article}
\usepackage{lipsum}% for demonstration only
\usepackage{hyperref}% to show, that this works
\makeatletter
\newcommand{\Step}[2]{%
\par\noindent{\rule{0pt}{0.5ex}%
\csname phantomsection\endcsname
{\let\textsuperscript\@firstofone\label{#1}}%
\hspace*{1em}\fbox{\parbox[t]{\dimexpr \linewidth-2em-2\fboxsep-2\fboxrule\relax}{%
{\bfseries Step #1.\ }\emph{#2}}}}\par
\vspace*{1.1ex}
}
\makeatother
\begin{document}
\Step{R\textsuperscript{+}4.a}{blah, blah}
See R\textsuperscript{+}4.b on page \pageref{R+4.b}.
\lipsum
\Step{R\textsuperscript{+}4.b}{blah, blah}
See R\textsuperscript{+}4.a on page \pageref{R+4.a}.
\lipsum
\end{document}
The \csname phantomsection\endcsname
would simply be \relax
, if hyperref
is not used, so it's almost nothing.
You can use the following definition of \listparticipants
:
\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\newcommand{\listparticipants}[1]{
\begin{itemize}
\renewcommand*{\do}[1]{\item[] ##1}
\docsvlist{#1}
\end{itemize}
}
\begin{document}
\listparticipants{Tom,Dick,Harry}
\end{document}
Note that you're redefining a command within another one. For the parameter text to be correctly referenced, you need to double the parameter text #
s. So, #1
refers to the argument to \listparticipants
, while ##1
refers to the argument to \do
.
This convention would hold even if you didn't require \listparticipants
to take an argument:
\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\newcommand{\listparticipants}{
\begin{itemize}
\renewcommand*{\do}[1]{\item[] ##1}
\expandafter\docsvlist\expandafter{\participants}
\end{itemize}
}
\begin{document}
\def\participants{Tom,Dick,Harry}
\listparticipants
\end{document}
Note that the first MWE might be a better approach, since it allows you to format your list of participants (using, say, \textbf{Tom},\textit{Dick},\textsf{Harry}
), while the second won't work properly with such definitions due to expansion.
Best Answer
With
\newcommand
and\renewcommand
you have to use\csname...\endcsname
, with some\expandafter
to build the control sequence before\newcommand
or\renewcommand
comes into action:This is the output on the terminal when running the example (
\stop
is just to end the run):So
\mkMak{affiliation}
defines a temporary value for\theaffiliation
and the macro\affiliation
; the call\affiliation{University}
redefines\theaffiliation
toUniversity
.