<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
%                       Version 2.1
%                         6/27/86
% Written by: B.A. Leland (XHEMIA:BAL)
%             Calif Inst of Technology
% Recognizes only ascending sequential footnote numbers, prints
%           everything else as read in the list
% Required defs:
% dash : defined as $^{-}$
% checkref#1 : to determine if the reference has yet been
%                    cited --- calls quickcnt
% note#1 : initializes flags, counters, calls refext
% refext#1 : does all the work, calls checkref, then prints
%                  the footnote numbers.  If newref=true write the
%                  reference to the output file with its footnote
%                  number, and redefine the def of the reference to
%                  equal the current footnote number.  If the
%                  references are anything but ascending sequential
%                  numbers, print the numbers separated by commas.
%       quickcnt#1 : based on Knuth's length macro (TeXbook, p.219)
%                    counts the no. of non-blank characters in the
%                    reference.  If &gt; or = 4, set the newref flag to
%                    true.
% Required misc:
%       counters
%               ftnum: previous footnote number of a newly cited ref
%               prev: previous PRINTED footnote number
%       flags
%               dsh : true = enable dash printing for no. ranges
%               newref : true = a reference that has not been cited
%
%\immediate\openout1=reflist % open the ouput file 'reflist.tex'
%\newcount\ftnum   % footnote number counter
%\newcount\prev    % previous footnote number
%\newif\ifdsh      % dsh=true: enable "dash" printing for ranges of #s
%\def\dash{$^{-}$} % a dash for ranges of numbers
%---------------------------------------------------------------------
%\def\note#1{{
%\dshtrue  % toggle dsh flag to enable range printing
%\prev=0   % initialize prev counter
%\count0=0 % initialize cycle counter
%\refext#1\end}}  % call refext with list of references as argument
%---------------------------------------------------------------------
%\def\refext#1{
%\ifx#1\end   % \end is appended at end of reference list
%    \ifdsh   % dsh=true do nothing
%    \else $^{\number\prev}$\fi\let\next=\relax  % finish the range, quit
%\else\checkref#1      % see if the reference has been cited previously
%    \ifnewref\global\advance\ftnum by1 % new reference,
%                                       % inc ftnum counter
%        \immediate\write1{\noexpand\item{$^{\the\ftnum}$}#1}
%        \xdef#1{\the\ftnum} % write the reference to the output file,
%                            % and redefine the reference to be
%                            % the current footnote number
%    \fi
%    \ifnum\count0=0 $^{#1}$ % first cycle, print the first no.
%    \else \ifnum\prev=#1    % duplicate reference, ignore
%          \else\advance\prev by1 % increment the prev counter
%               \ifnum\prev=#1  % if true, sequence is sequential
%                  \ifdsh          % if dsh enabled,
%                      \dash       % print a dash for the range
%                      \dshfalse   % and disable the dsh flag
%                  \fi
%               \else\ifdsh $^{,\,#1}$  % if dsh enabled, print ", #"
%                    \else  % a dash was printed previously
%                        \advance\prev by-1 % restore prev counter
%                        $^{\number\prev ,\,#1}$ % finish the range, and
%                                    % print the new (non-sequential) no.
%                        \dshtrue  % toggle the dsh flag
%                    \fi
%               \fi
%          \fi
%    \fi
%    \prev=#1 % save current footnote number in prev counter
%    \advance\count0 by1  % increment cycle counter
%    \let\next=\refext    % recursive call
%\fi
%\next}
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%\newcount\qckcntr
%\newif\ifnewref   % newref=true: 1st occurance of a given reference
%---------------------------------------------------------------------
%\def\checkref#1{{
%\global\newreffalse % toggle the newref flag
%\qckcntr=0          % initialize cycle "register"
%\expandafter\quickcnt#1\end % expand the passed reference appending \end
%\relax}}
%---------------------------------------------------------------------
%\def\quickcnt#1{
%\ifx#1\end \let\next=\relax % relax and quit
%\else\advance\qckcntr by1   % increment cycle register
%     \ifnum\qckcntr&lt;4       % &lt;4 cycles means nothing, so do nothing
%     \else\global\newreftrue % &gt;= 4 means the reference has not been
%                             % previously cited, toggle the newref flag
%     \fi
%     \let\next=\quickcnt % recursive call
%\fi
%\next}
%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
%________________________BEGIN__DEFS__________________________________
%
\immediate\openout1=reflist % open the ouput file 'reflist.tex'
\newcount\ftnum   % footnote number counter
\newcount\prev    % previous footnote number
\newif\ifdsh      % dsh=true: enable dash printing
\def\dash{$^{-}$}
\def\note#1{{\dshtrue \prev=0 \count0=0 \refext#1\end}}
\def\refext#1{\ifx#1\end
\ifdsh\else $^{\number\prev}$\fi\let\next=\relax
\else\checkref#1\ifnewref\global\advance\ftnum by1 \immediate
\write1{\noexpand\item{$^{\the\ftnum}$}#1}\xdef#1{\the\ftnum}\fi
\ifnum\count0=0 $^{#1}$\else \ifnum\prev=#1 \else
\advance\prev by1 \ifnum\prev=#1 \ifdsh \dash\dshfalse\fi\else
\ifdsh $^{,\,#1}$\else
\advance\prev by-1 $^{\number\prev ,\,#1}$\dshtrue \fi\fi\fi\fi
\prev=#1 \advance\count0 by1 \let\next=\refext\fi \next}
%
\newcount\qckcntr
\newif\ifnewref   % newref=true: 1st occurance of a given reference
\def\checkref#1{{\global\newreffalse\qckcntr=0
\expandafter\quickcnt#1\end \relax}}
\def\quickcnt#1{\ifx#1\end \let\next=\relax
\else\advance\qckcntr by1 \ifnum\qckcntr&lt;4 \else\global\newreftrue\fi
\let\next=\quickcnt\fi \next}
%
%__________________________END__DEFS__________________________________
%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
%
%           S   A   M   P   L   E        U   S   A   G   E
%
% \def\a{this is reference a}
% \def\aaa{aaaaa}
% \def\b{this is reference b which has \reff }
% \def\c{this is reference c which has \reff }
% \def\d{this is reference d which has \reff }
% \def\e{this is reference e which has \reff }
% \def\g{this is reference e which has \reff }
% \def\reff{reference f}
%
% {\rm
% \ftnum=9
% This is the example\note{\a} of
% a\note{\b} paragraph
% which contains footnotes that will ultimately end up on
% a reference page.
% This is the
% second\note{\a} which
% is supposed to be the same as the first reference.
% If we continue, we\note{\c\b} should get another
% one\note{\d} and\note{\a} so\note{\e} on.
% If one needs to recall a couple of references\note{\aaa} one
% uses a the same macro\note{\a\b\c\d\e} as before.
% It is supposed to handle\note{\a\b\d\e} most any situation
% up to and almost including\note{\e\d\c\b\a} except
% this\note{\b\a\d\e} or this.\note{\a\b\c\d\d}  One
% must be cautioned that this has not been fully tested as yet..........
% \vskip0.5truein
% \immediate\closeout1
% \vfill\eject
% \baselineskip=14pt
% \parindent=0pt
% \parskip=0.1truein
% \input reflist.tex
% }
% \vfill\end
%
</pre></body></html>