[texhax] Labels and References with "varioref"

Donald Arseneau asnd at triumf.ca
Mon Dec 30 10:42:27 CET 2013


On Sun, December 29, 2013 10:10 am, Victor Ivrii wrote:

> \usepackage{enumitem}

I should point out that ordinary LaTeX document classes without
packages do print the full hierarchical label for \ref to nested
enumeration items (but without the word "item").  The format is
set by the \p at enumi ... \p at enumiv macros.

>> \labelformat{enumi}{item~#1}
>> \labelformat{enumii}{item~#1}
>> \labelformat{enumiii}{item~#1}
>> \labelformat{enumiiii}{item~#1}

In fact, varioref's \labelformat command merely redefines \p at xxxxx
(without the need for \makeatletter).  The clear problem here is
you've completely replaced the existing prefixes (that's what the "p@"
signifies) with "item~", losing the nesting context that was already
there. (Maybe varioref should provide a way of adding text).

\labelformat{enumii}{item~\theenumi#1}
\labelformat{enumiii}{item~\theenumi(\theenumii)#1}
\labelformat{enumiv}{item~\theenumi(\theenumii)\theenumiii#1}

% NOTE "enumiv" not "enumiiii"!!!


Donald Arseneau, TRIUMF CMMS, asnd at triumf.ca



More information about the texhax mailing list