Essentially, what I wish to do is fully reference the numbers of an object's part, chapter and section using only the label of the object itself (and not the labels of the part, and section). I have the following commands with its own counter (that resets with every new section):
\newcounter{important}[section]
\newcommand{\imp}[3]{\refstepcounter{important} \todo[inline, color=red!30,caption={}]{\hypertarget{#1}{\underline{Important (#2) \thepart.\thesection.\theimportant $\longrightarrow$ \label{#1}}} #3}}
\newcommand{\impref}[3]{\hyperlink{#1}{Important \ref{#2}.\ref{#3}.\ref{#1}}}
I can use them like this
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, linkcolor=blue]{hyperref}
\newcounter{important}[section]
\newcounter{importantref}[section]
\newcommand{\imp}[3]{\refstepcounter{important} \todo[inline, color=red!30,caption={}]{\hypertarget{#1}{\underline{Important (#2) \thepart.\thesection.\theimportant $\longrightarrow$ \label{#1}}} #3}}
\newcommand{\impref}[3]{\hyperlink{#1}{Important \ref{#2}.\ref{#3}.\ref{#1}}}
\begin{document}
\part{this is a part} \label{pt: partlabel1}
\chapter{this is a chapter}
\section{this is a section} \label{sec: seclabel1}
\imp{important: label}{Brief name}{description}
\part{another part} \label{pt: partlabel2}
\chapter{another chapter}
\section{another section} \label{sec: seclabel2}
Here I am referencing this thing from another part chapter and section \impref{important: label}{pt: partlabel1}{sec: seclabel1}
\end{document}
Which produces the following output:
Right now, my code does what I want. As you can see, I have successfully fully referenced the part, chapter and section number of the object as well as the object's counter itself.;so you might be wondering okay.. so what's the problem?
Well my issue is that every time I want to reference the object's part, chapter and section using \impref I have to go and manually find the labels of the part and section the object is in as well, and input those labels into the command \impref. What I wish to do is to somehow (I believe) create a new type of label that automatically stores the part number and section number that the object was created in when the label is created for the object, so that when I want to reference it later, the only information I need to input into \impref is the label of the object itself so that the \impref command may be reduced to one that requires only a single input, rather than three.
\makeatletter \renewcommand*{\p@important}{Important~} \makeatother \renewcommand*{\theimportant}{\thepart.\thesection.\arabic{important}} \newcommand{\imp}[3]{\refstepcounter{important} \todo[inline, color=red!30,caption={}]{\hypertarget{#1}{\underline{Important (#2) \theimportant $\longrightarrow$ \label{#1}}} #3}} \newcommand{\impref}[3]{\hyperlink{#1}{\ref{#1}}}
should work\thepart
\thechapter
and\thesection
?