I'm not proficient in LaTeX enough to solve the following. I have a macro that takes two parameters, creates a nice box, puts the first argument in bold, and the second argument in an emphasized text:
\newcommand{\Step}[2]{%
\noindent{\\[0pt] \rule{0pt}{0.5ex}%
\hspace*{1em}\fbox{\parbox[t]{0.92\columnwidth}{{\bfseries Step #1.\ }\emph{#2}}}}
\vspace*{1.1ex} }
I call this macro 10-15 times in text (that many steps I have). In order to be able to refer to the page where this macro is expanded, I would now like to place a label. If I change the last line to:
\vspace*{1.1ex} \label{step:mode:#1} }
errors start to pop up. I get this, on a completely unrelated line:
! Missing \endcsname inserted.
<to be read again>
\protect
l.160 ...aults Occur\relax }{figure.caption.52}{}}
This line probably comes from some auxiliary file.
How to properly expand the first argument and use it as an argument to label? First argument does not have spaces, and will never have them.
Best Answer
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 packagehyperref
:The
\csname phantomsection\endcsname
would simply be\relax
, ifhyperref
is not used, so it's almost nothing.