Hi I build a customer list environment with a counter, and I'd like to be able to reference the name the label associated with the counter. The code below produces an output similar to this:
Requirements
- REQ1 Requirement one
- REQ2 Requirement two
Another Section
- We want read "Requirement One" here : Requirements.
- But instead we get the section name!
Code:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[bookmarks, colorlinks=true, linkcolor=black, citecolor=black, urlcolor=black]{hyperref}
\newcounter{reqcount}
\renewcommand{\thereqcount}{\textbf{REQ\arabic{reqcount}}}
\newenvironment{nfrequirements}
{ \begin{list}{\textbf{\thereqcount}}{\usecounter{reqcount}} }
{ \end{list} }
\newcommand{\requirement}[1]{
\item \textbf{#1}
\addcontentsline{toc}{subsection}{\thereqcount \quad #1}
}
\begin{document}
\tableofcontents
\section{Requirements Section}
\begin{requirements}
\requirement{Requirement one} \label{req_one} \\
description
\requirement{Requirement two} \label{req_two} \\
description
\end{requirements}
\section{Another Section}
We want read "Requirement One" here : \nameref{req_one}.
But instead we get the section name.
\end{document}