\def\fileversion{v1.9} \def\filedate{2002/02/28} % smartref.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Giuseppe Bilotta % % Phone +39 095 338103 % % Email: bourbaki@bigfoot.com % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This package is distributed under the terms % of the LaTeX Project Public License % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Please read the readme.txt file for details % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{smartref}[\filedate\space\fileversion\space Increase reference capability (deep reference)] % \newcounter{@smartlistlen} \newcounter{less@smartlist} \setcounter{less@smartlist}{-2} \newcommand*{\@increasesmartlist}{% \addtocounter{@smartlistlen}{1}% \addtocounter{less@smartlist}{1}} \def\sm@rtreflist{{\@currentlabel}} \@increasesmartlist % \newcommand*{\@getsmartreflist}[3]{% \ifx#1% \relax\protect\G@refundefinedtrue% \@latex@warning {SmartReference `#2' on page % \thepage \space undefined}% \nfss@text{\reset@font \bfseries ??}% \else% \expandafter #2#1% \fi} \newcounter{@currsmartlistplace} \newcommand*{\@getsmartref}[3]{%Paramaters are: #1: Where #2: Label, #3: place in list \edef\@smartlistplace{#3}% \setcounter{@currsmartlistplace}{0}% \edef\@originalsmartlist{% \expandafter\@getsmartreflist\csname sr@#2\endcsname{}{}}% \edef\@currsmartlist{\@originalsmartlist}% \loop% \edef\@currsmartvalue{\expandafter\@car\@currsmartlist\@nil}% \ifnum\the@currsmartlistplace=\theless@smartlist \edef\@currsmartlist{\noexpand{\expandafter\@cdr\@currsmartlist\@nil\noexpand}}% \else \edef\@currsmartlist{\expandafter\@cdr\@currsmartlist\@nil}% \fi \ifnum\the@currsmartlistplace<\@smartlistplace% \addtocounter{@currsmartlistplace}{1}% \repeat \edef#1{\@currsmartvalue}% % \typeout{Got Smart Reference (place #3, value \@currsmartvalue)}% } % Hack label: also write the SmartRef data ... \def\newsmartlabel{\@newl@bel {sr}} %save previous \label \AtBeginDocument{% \let\sr@ldlabel=\label \renewcommand*{\label}[1]{% \sr@ldlabel{#1}% \@bsphack% \protected@write\@auxout{}% {\string\newsmartlabel{#1}{\sm@rtreflist}}% \@esphack}% % This one is needed for those who use AMS-LaTeX, to ensure that % smartref labelling system is used wih equations too (AMS-LaTeX % uses its own labeling system for equations \let\ltx@label=\label} % Command to add new items to reflist: % \newtoks\sm@rtintern@ltok \newcommand*{\addtoreflist}[1]{% Add item ... \@ifundefined{c@#1}% Check if real counter; {\@nocounterr{#1}}% If not, give error {\@ifundefined{#1posinlist}{% If yes, check if already defined: \sm@rtintern@ltok=\expandafter{\sm@rtreflist}% If not, define everything ... \expandafter\edef\csname sm@rtreflist\endcsname{% \the\sm@rtintern@ltok{\noexpand\csname the#1\endcsname}}% Add it ... % Set position of counter in list: \expandafter\edef\csname #1posinlist\endcsname{\the@smartlistlen}% \@increasesmartlist% % Define SmartCommands: % Define command to get number of for