%%
%% \iffalse filename: supra.dtx \fi
%%
%<*doc>
\input driver
\thisis{supra}{\emph{Supra} Short Forms}

Some citations use a short form that reads ``\meta{desc}, \emph{supra} note
\meta{num}.'' Additionally, a writer may specify the |hereinafter| reference
parameter for a reference, which applies a \emph{supra} short form to that
reference. This section describes how such citations are produced and managed.

\MacroSpec\hi@supra@form \marg{ref}\marg{desc}\\
Reference types that uses \emph{supra} short forms must execute the above macro
in the course of defining a reference. The
argument \meta{ref} is the reference name, and \meta{desc} is the description
to precede the word ``\emph{supra}.'' The description is usually the reference
author's last name, and it may use font shortcut commands as described in
\sec{fonts}.

The \param{hereinafter} parameter also calls |\hi@supra@form|, overriding any
other short form defined for the reference.

Setting up a \emph{supra} form involves performing the following tasks:
\begin{itemize}
\item Registering the description as a short citation name for duplicate
checking, as described in \sec{short}.
\item Creating both a short citation form and an inline form, where the inline
form displays the description text.
\item Records that \meta{ref} is a \emph{supra}-type reference that does not
follow the five-footnote rule, to conform with the expectations of short
citation state described in \sec{state}.
\end{itemize}

%</doc>
%<*package>
%
%    \begin{macrocode}
\def\hi@supra@form#1#2{%
    \hi@short@register{#1}{#2}{n}%
    \hi@newcite@form{sc}{#1}{%
        \hi@short@use{#1}%
        \hi@inline@only{%
            \hi@citeguts{%
                \unexpanded{#2}%
            }%
        }%
        \hi@inline@never{%
            \hi@citeguts{%
                \noexpand\hi@usevol{}%
                \unexpanded{#2}%
                \noexpand\hi@supra@word{#1}%
                \hi@maybepage{, \hi@page@atorsect}%
            }%
        }%
    }%
    \global\cslet{sc@#1@supra}\@empty
}
%    \end{macrocode}
%
% Produces the word ``supra'' with the footnote number.
%
%    \begin{macrocode}
\def\hi@supra@word#1{%
    \hi@font@comma \hi@nocap \hi@fn@latin{supra}%
    \hi@notepos{#1}%
    \@hi@dotfalse
}
%    \end{macrocode}
%
% Displays the footnote number for the \emph{supra} citation. Following the
% conventions described in \sec{state}, the number is displayed only if (1) the
% reference has only been cited in footnotes (|\hi@dfc@|\meta{ref} is positive)
% and the reference number is not the same as the current footnote number.
%
% This macro is not incorporated into |\hi@supra@word| because it is redefined
% in the tex4ht conversion file or by the cross-reference mechanism as described
% below.
%
%    \begin{macrocode}
\def\hi@notepos#1{%
    \ifnum\csname hi@dfc@#1\endcsname=\c@footnote\else
        \ifnum\csname hi@dfc@#1\endcsname>\z@
            \space note~\csname hi@dfc@#1\endcsname
        \fi
    \fi
}%
%    \end{macrocode}
%
%</package>
%<*doc>

\paragraph{Cross-Reference \emph{Supra} Forms}
\label{s:supra-xref}

In legal memoranda, \emph{supra} short citations contain no information other
than the word \emph{supra}. If the option \opt{xrefsupra} is given to \hia*,
then the short citation further includes a cross-reference to the first full
citation to the reference. The cross-reference is generated using |\hilabel| as
described in \sec{xref}.

%</doc>
%<*package>
%
%    \begin{macrocode}
\let\hi@supra@make@xref\@gobble
\def\hi@supra@opt@xref{%
    \def\hi@supra@make@xref##1{%
        \hilabel{hi@supra@xref@##1}%
    }%
    \def\hi@notepos##1{%
        \space
        \@ifundefined{r@hi@supra@xref@##1}{%
            \textbf{??}%
        }{%
            \@expand{\@unbrace\hi@supra@use@xref}{%
                \csname r@hi@supra@xref@##1\endcsname
            }{ii}%
        }%
    }%
}
\def\hi@supra@use@xref#1#2#3#4{#2#3#4}
%    \end{macrocode}
%</package>

