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"?
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"?
You can use the hyperref package to refer to some label and choose your own text for the reference, for example:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{description}
\item[42] \phantomsection\label{p:1}Some text.
\item[2010] \phantomsection\label{p:2}Some more text.
\end{description}
Arbitrary numbers for the items.
\newpage
texttext \hyperref[p:1]{p:1}, \hyperref[p:2]{p:2} text
\end{document}
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?
\makeatletter
\newcommand\deflabel[1]{\def\@currentlabel{#1}}
\newcommand\mylabel[1]{#1\deflabel{#1}}
\makeatother
\begin{document}
\begin{description}
\item[\mylabel{foo}\label{l:1}] bar
\item[\mylabel{baz}\label{l:2}] quux
\end{description}
See \ref{l:1} and \ref{l:2},
\labelwhere you want to use\ref. – jmc Mar 27 '12 at 15:20\documentclassand 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\begin{description}list which don't have any numbers, but the ones i manualy specified. – 71GA Mar 27 '12 at 17:42