[OS X TeX] Referring to arbitrary labels?

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Fri Nov 19 20:43:08 CET 2004


The package nameref.sty is already part of Gerben's distribution. It is 
also automatically loaded, if hyperref is used.

I experimented a bit and noticed that for any label, e.g., 
\label{whatever},\nameref{whatever} will return the optional title, if 
one is present, otherwise the title of the section, the referred object 
belongs to, regardless of its nature.

Claus

On 19.11.2004, at 16:39, peter.frings at agfa.com wrote:

> on 2004/11/19 10:39, Mohinish Shukla wrote:
>
>> -> Is it possible to have a kind of \refer{sectionlabel} which, 
>> instead
>> of returning the section NUMBER, returns the section NAME or 
>> SHORTNAME?
>
> \nameref seems to work for me. See
>
> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=nameref
>
>
> For example:
> \newcommand{\seesec}[1]{%
>   Section~\ref{sec:#1}:~\textsl{\nameref{sec:#1}}%
> }
>
>
> \subsection{A chapter somewhere} \label{sec:a-label}
>
> ... as explained in \seesec{a-label}.
>
>
>
> Cheers,
> Peter.
>
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>            & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list