I would like to have a precise control on references to custom counters.
For instance,
- I would like to give a reference to a series of two independent counters
- I would like to choose the formatting of the reference
I have looked around but I haven't found a solution.
Here is a MWE.
\documentclass{article}
\newcounter{counterOne}
\newcounter{counterTwo}
\renewcommand{\thecounterTwo}{\alph{counterTwo}}
\begin{document}
\refstepcounter{counterOne}
\refstepcounter{counterTwo}
\label{here} Here
It was \ref{here}.
\bigskip
I would like that it displays : It was \textbf{1.(a)}
\end{document}
EDIT:
I've tried David's answer but it doesn't work. Here is a MWE. Unfortunately, as I don't understand the commands used in the answer, I can't fix by myself the errors.
\documentclass{article}
\newcounter{counterOne}
\newcounter{counterTwo}
\renewcommand{\thecounterTwo}{\alph{counterTwo}}
\makeatletter
\def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1}
\makeatother
\labelformat{counterTwo}{\textbf{\thecounterOne.(#1)}}
\begin{document}
\refstepcounter{counterOne}
\refstepcounter{counterTwo}
\label{here} Here
It was \ref{here}.
\bigskip
I would like that it displays : It was \textbf{1.(a)}
\end{document}
The error is
Argument of @firstofone has an extra }. \par l.23 \end{document}
\makeatletter..\makeatother
block (the form in my question which works for current latex) then add\usepackage{varioref}
to define\labelformat
in older releases.\usepackage{varioref}
\labelformat
mechanism came from varioref you probably don't need the entire package but apparently you need more than the one line, but loading the package seems easier than picking out exactly what lines are needed in old releases.