Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
perf~\ref{soft_reset_perf}

\phantomsection
\item[perf]:~\label{soft_reset_perf} Indicates that a soft reset has been performed.

It shows next to 'perf' the section number. How can I just get a link without section number?

With ~\nameref{soft_reset_perf} I get the name of the section in which the label is defined. I want the item name ('perf' in this case) to be displayed instead of the section name.

share|improve this question

migrated from stackoverflow.com Dec 7 '11 at 16:02

This question came from our site for professional and enthusiast programmers.

    
If you want to refer to an item in a list why don't you simply use cross-reference by \ref? –  N.N. Dec 7 '11 at 11:59
    
Welcome to TeX.sx chandras! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Dec 7 '11 at 17:54

2 Answers 2

Here is one alternative to achieve your output. Since you're after referencing the name of a label, using a sectional unit is ideal.

In the example below, I've defined \Item to be similar to \paragraph (it is set at the "paragraph level" with some spacing adjustments) in the sense that it is now a sectional unit. As such, using \label{<lab>} and \nameref{<lab>} works as expected:

enter image description here

\documentclass{article}
\usepackage{nameref}% http://ctan.org/pkg/nameref
\makeatletter
\newcommand\Item{\@startsection{paragraph}{4}{-2em}%
                               {0pt}%
                               {0pt}%
                               {\normalfont\normalsize\bfseries}}
\makeatother
\begin{document}

For more information, see~\nameref{soft_reset_perf} or~\nameref{something}.

\begingroup
\setlength{\leftskip}{2em}% Correct for \Item adjustment
\Item{perf}:~\label{soft_reset_perf} Indicates that a soft 
  reset has been performed. Here is some more text. Here is some 
  more text. Here is some more text. Here is some more text.
\Item{something}:~\label{something} This is just an interesting 
  item that will be referenced by name at a different location in 
  the document.\par
\endgroup
\end{document}

To mimic an itemize environment, I've typeset the \Item with a 2em negative indent (undent?). As such, to correct for horizontal shift, the left margin has been pushed right by 2em (by setting \leftskip). For help on the specific components in the definition of \Item, consider reading Where can I find help files or documentation for commands like \@startsection for LaTeX?

Although I've used nameref, it works just as well with hyperref.

share|improve this answer
\documentclass{article}
\usepackage{nameref}
\begin{document}

For more information, see~\nameref{soft_reset_perf} or~\nameref{something}.

\paragraph{perf}:~\label{soft_reset_perf} Indicates that a soft 
  reset has been performed. Here is some more text. Here is some 
  more text. Here is some more text. Here is some more text.
\paragraph{something}:~\label{something} This is just an interesting 
  item that will be referenced by name at a different location in 
  the document.

\end{document}

enter image description here

share|improve this answer
    
In principle, how is this different from my answer? –  Werner Dec 9 '11 at 6:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.