I am referencing a label like this texttext \ref{p:1}, \ref{p:2} text and after compiling my document I always get an output like this "texttext 8, 9 text".

Is there a way I can force an output like "texttext 1, 2 text"?

  • 4
    What exactly do you mean? I get the idea that you use \label where you want to use \ref. – jmc Mar 27 '12 at 15:20
  • Oh sorry i fixed that. – 71GA Mar 27 '12 at 15:48
  • 1
    The numbers that come out are the numbers used in whatever you have labeled, do you want the section number to be "8" but the reference to that section to be "1" ? – David Carlisle Mar 27 '12 at 15:55
  • 2
    While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. In this case it would go a long way towards clarifying the question and also serve as a test case to ensure that the solutions provided actually work for your particular case. – Peter Grill Mar 27 '12 at 16:07
  • 2
    How were we to guess that:-) That is why we always ask people to supply a full example. If you use enumerate rather than description, the numbering is automatic and \ref will pick up the numbering, If that doesn't do what you want, edit your question with a complete example see the link in Peter's comment. – David Carlisle Mar 27 '12 at 18:32

You can use the hyperref package to refer to some label and choose your own text for the reference, for example:



\item[42] \phantomsection\label{p:1}Some text.

\item[2010] \phantomsection\label{p:2}Some more text.

Arbitrary numbers for the items.


texttext \hyperref[p:1]{p:1}, \hyperref[p:2]{p:2} text


where \hyperref's [...] contains the label's name and {...} the text to be displayed for the reference. The \phantomsections are necessary, else the hyperlinks will aim at the beginning of the description. When the hyperref package is used, at least two compier runs are necessary.


Is this what you want?


\item[\mylabel{foo}\label{l:1}]  bar
\item[\mylabel{baz}\label{l:2}]  quux

See \ref{l:1} and \ref{l:2},

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.