[OS X TeX] Referring to arbitrary labels?

Will Robertson will at guerilla.net.au
Fri Nov 19 10:49:48 CET 2004


On 19 Nov 2004, at 8:09 PM, 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? Because then I could create arbitrary labels to those 
> sections that are Experiments (which, btw, could run into several 
> pages; also for all the subsections)

Check out the prettyref package. I *think* it'll do what you want.

Alternatively, download and install the fancyref package (which 
definitely will with some customisation --- read its manual), and then 
save my appended refer.sty file below which gets it working (fancyref 
is broken and the author is too busy to fix it, so you need my file 
below and then \usepackage{refer}, only, in your document) which 
coincidentally enough defines a command called "\refer" that does 
exactly what you want!

Sorry to be brief, gotta run!

Good luck,
Will

% REFER.STY 2004/07/06
%   Redefines fancyref.sty commands to prevent conflict with memoir.cls
%    \fref becomes \refer
%    \Fref becomes \Refer
%   Fixes bug in fancyref 0.9c introduced with varioref 1.3c.
%   Fixes typo in fancyref when calling the [tight] package option
%   fancyref is still to be customised as described by its own 
documentation,
%    and package options given to refer will be passed on to fancyref.
%
% Will Robertson  2004
% will at guerilla.net.au
%
% This material is subject to the LaTeX Project Public License. See
%  http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
% for the details of that license.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{refer}[2004/07/06 Alters and fixes the fancyref 
package]

\let\figref\fref   % save memoir's \fref in \figref
\let\fref\relax    % Undefine memoir's \fref

% fix bug in fancyref 0.9c for the [tight] option:
\DeclareOption{tight}{%
    \AtEndOfPackage{% delay until after fancyref is loaded
       \renewcommand*{\fancyrefdefaultspacing}{%
       \fancyreftightspacing}%
    }%
}

% load fancyref: (all options are passed through except [tight], 
because it is defined above)
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{fancyref}}
\ProcessOptions\relax
\RequirePackage{fancyref}[1999/02/03]

% fix bug in fancyref 0.9c due to updated varioref (v1.3c):
\renewcommand*{\@fancyref at page@ref}{%
   \let\vref at space\space
   \@ifnextchar[%]
   \@vpageref{\@vpageref[\unskip]}%
}

\let\refer\fref   % rename fancyref's \fref to \refer
\let\Refer\Fref   % etc
\let\fref\figref  % restore memoir's \fref to its original name
\let\figref\relax % clean up

\endinput

--------------------- 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