I'm writing a description of a method, where the title of each section is formatted like Step X: <step title>. Now, I want to reference the section as Step X ("<step title>"). I am aware of \nameref, but I don't know how to remove the first two words of a string.
When trying to use stringstrings to remove the first two words, I get
Use of
\removeworddoesn't match its definition.
Minimum example:
\documentclass{article}
\usepackage{stringstrings}
\newcounter{step}
\begin{document}
\removeword\removeword{x1 x2 x3}
\end{document}
What can be done to have stringstrings remove the first two words?
The intended use (updated answer)
(If I should put that as separate question, I'll do)
I'm writing a description of a method, where the title of each section is formatted like Step X: <step title>. Now, I want to reference the section as Step X ("<step title>"). Currently, I'm using the solution https://tex.stackexchange.com/a/73710/9075, which suggests to redefine @currentlabelname. However, I have to type my section name twice.
Minimum example:
\documentclass{article}
\usepackage{csquotes}
\usepackage{hyperref}
\newcounter{step}
\newcommand{\titleinquotes}[1]{(\enquote{\nameref{sec:#1}})}
\begin{document}
We will see something in Step~\ref{S1} \titleinquotes{S1}.
\refstepcounter{step}
\label{S1}
\section{Step \thestep: Setup Environment}
\label{sec:S1}
\end{document}
The question is how `\titleinquotes' has to be changed to have following output
We will see something in Step 1 (“Setup Environment”)
The quick hack
\newcommand{\removedoubleword}[1]{\removeword[e]{#1} \removeword{\thestring}}
\newcommand{\titleinquotes}[1]{(\enquote{\removedoubleword{\nameref{sec:#1}}})}
does not work: Use of \\removeword doesn't match its definition.. Without using \nameref, it works.
\nameref. – egreg Nov 14 '13 at 10:57stringstrings: if it is because you want to strip the "Step X:" part to reformat the title then why not take a more structured approach such as storing the step title as\formatstep{X}{title}and redefine\formatstepaccording to the two formats when using it in the two different contexts (section title and reference)? If you are interested in this approach I could attempt an answer. – Bordaigorl Nov 14 '13 at 11:38