# How can I change \ref s output from 5.1 to “some text”

I'm currently developing a doclet which translates javadoc to LaTeX.

I'm compiling the LaTeX document using pdflatex with a sty file I have from my school it generates a PDF document with links (red box) for all references this means that a I don't need the chapter.section representation
I'm generating a label for example

\label{com.domain.package.Class}


when I reference it I get something like 5.1.

How can I change it ?

-

It depends on what you exactly want. The nameref package (comes with hyperref) provides \nameref which gives the reference name instead of the number, e.g. the section title not the section number. There is also \autoref (hyperref package) which gives e.g. "Section 5.1".
For arbitrary link texts I would recommend to use \hypertarget and \hyperlink (both from hyperref) instead of \label and \ref.
There is also the zref package (written by the hyperref author) which gives you a lot of advanced cross-referencing options. See also the TeX FAQ Referring to things by their name.