I have defined a command for writing down 'requirements' in my document. It automatically styles and numbers it and creates a label to which I can refer to get the number - really nice. However, sometimes I want to repeat the full text of the requirement when referring to it, so the reader does not have to go back in the document. I of course do not want to rewrite it, because that would be prone to errors when I change it in one place. How can I repeat the text using a command?
The current form of my command definition is as follows:
\newcommand{\requirement}[2]{
\vspace{10pt}
\noindent
\textbf{
\refstepcounter{reqnum}
\label{req:#2}
R\thereqnum: #1
}
}
I tried many variations of the following attempt, to no avail:
\newcommand{\requirement}[2]{
\vspace{10pt}
\noindent
\textbf{
\refstepcounter{reqnum}
\label{req:#2}
R\thereqnum: #1
}
\newcommand{\req{#2}}{#1}
}
\expandafter\def\csname req#2\endcsname {<definition>}should work. – MaestroGlanz Jun 08 '16 at 09:38