I am using my own solution to this question to create custom cross-references.
\documentclass{article}
\usepackage{hyperref}
\usepackage{lipsum}
\title{My notes for Bla}
\author{myself}
\newcommand{\thingnamestyle}[1]{\textsc{#1}}
\newcommand{\thingnamerefstyle}[1]{[\textsc{#1}]}
% This works, but is unnecessarily complicated
% \newcounter{thing}
% \newcommand{\thing}[1]{%
% \thingnamestyle{#1}%
% \renewcommand{\thething}{\thingnamerefstyle{#1}}%
% \refstepcounter{thing}%
% }
\makeatletter
\newcommand{\thing}[1]{%
\thingnamestyle{#1}%
\def\@currentlabel{\thingnamerefstyle{#1}}%
}
\makeatother
\begin{document}
\section{Bla}
\lipsum[1]
\thing{thing-Quick} \label{quick}
\lipsum[1]
\thing{Task-Brown} \label{brown}
\lipsum[1]
And \ref{quick} has been completed.
\end{document}
This works but hyperref inserts the wrong link in the \ref: clicking on it would jump to the section title, which, I suppose, is the last thing that sets \@currentlable other than my \thing macro.
If one defines \thing using ref counters as in the commented code above, the link seems to work properly.
What's missing to make \thing compatible with hyperref?
\protectcomment is also helpful. – Bordaigorl Sep 01 '14 at 11:07\phantomsectionis not very suggestive of its effect though. Could you expand a little on its meaning? – Bordaigorl Sep 01 '14 at 11:08\section. As such, since hyperlinks could be used for things other than jumps to sectional units, the author decided to create a "phantom section" to mark these locations. Look at the code for\phantomsectionand you'll see that it's just an abbreviation for setting an appropriately-raised (to avoid jumping to the baseline of where it's called) hyperlink anchor. – Werner Sep 02 '14 at 05:10