%%
%% \iffalse filename: otherrefs.dtx \fi
%%
%<*doc>
\input driver
\thisis{otherrefs}{Other Reference Types}

\input docparams
%</doc>
\hi@newcite{letter}{A letter or memorandum}{other}{%
    \hi@ifset\hi@kv@type{}{\def\hi@kv@type{Letter}}
    \@expand{\find@in{, }}{\hi@kv@author}i{%
        \def\reserved@a{, }\@gobbletwo
    }{\def\reserved@a{ }}%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \@capnext\hi@kv@type
            \hi@ifset\hi@kv@author{ from \hi@kv@author}{}%
            \hi@ifset\hi@kv@to{\reserved@a to \hi@kv@to}{}%
            \hi@ifset\hi@kv@name{, \noexpand\hi@fn@arttitle{\hi@kv@name}}{}%
            \hi@maybepage{ }%
        }%
        \hi@parens@add{\hi@paren@date}{\hi@kv@year}%
        \the\hi@param@parens
    }%
    \hi@newcite@form{lc}{#1}{%
        \hi@citeguts{%
            \hi@ifset\hi@kv@author{%
                \hi@toa@dupauthor{}{\hi@kv@author@sortable}\hi@kv@type
            }{%
                \@capnext\hi@kv@type
            }%
            \hi@ifset\hi@kv@to{ to \hi@kv@to}{}%
            \hi@ifset\hi@kv@name{, \noexpand\hi@fn@arttitle{\hi@kv@name}}{}%
        }%
        \hi@parens@add{\hi@paren@date}{\hi@kv@year}%
        \the\hi@param@parens
    }%
    \@expand{\hi@supra@form{#1}}\hi@kv@authln i%
}
%<*doc>
The defining characteristic of this reference type is that it is a communication
sent from one party to another. Nevertheless, the recipient is optional and can
be omitted, useful perhaps for open letters or memoranda not directed to any
particular person.

Letters between institutions are typically still signed by and addressed to
individuals. As a result, the ability to attach institutional affiliations to
human authors (see \sec{names}) is especially useful for these references, to
identify the companies, agencies, or institutions that are the actual
communicants.

\keyparameters{
    {author}{The sender of the letter.}
    {to}{The recipient of the letter.}
    {date}{The date the letter was sent.}
}
\optparameters{
    {type}{The type of document, default ``Letter.''}
    {name}{A subject line or title of the letter (more common for memoranda).}
}

\begin{demo}
\Example
\begin{verbatim}
\defletter{alice-memo}{
    date=may 13 2013,
    type=Memorandum,
    author={Andrew H. Hirshfeld, United States Patent
        and Trademark Office},
    instto=Patent Examining Corps,
    title=Federal Circuit Decision in \emph{CLS Bank
        et al. v. Alice Corp.},
}
\end{verbatim}
\Produces Memorandum from Andrew H. Hirshfeld, U.S. Patent \& Trademark Off., to
Patent Examining Corps, \emph{Federal Circuit Decision in \emph{CLS Bank et al.\
v.\ Alice Corp.}}\ (May 13, 2013).
\end{demo}


%</doc>
%
\hi@newcite{pressrelease}{A press release}{other}{%
    \hi@ifset\hi@kv@type{}{\def\hi@kv@type{Press Release}}%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@kv@type,
            \hi@ifset\hi@kv@author{\hi@kv@author@sortable, }{}%
            \hi@ifset\hi@kv@name{\noexpand\hi@fn@arttitle{\hi@kv@name}}{}% Title
            \hi@maybepage{ }%
        }%
        \hi@parens@add{\hi@paren@date}{\hi@kv@year}%
        \the\hi@param@parens
    }%
    \protected@edef\reserved@a{%
        \hi@ifset\hi@kv@authln{\@capnext\hi@kv@authln}{%
            \noexpand\hi@fn@arttitle{\hi@kv@name}%
        }%
    }%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}
%<*doc>

\keyparameters{
    {name}{The title of the press release.}
    {year}{The date of the press release.}
}
\optparameters{
    {type}{The type of document, default ``Press Release.''}
    {author, instauth}{The name of the issuer of the press release. This is
    optional and not included in other citation systems, but unless the issuer
    is in the press release title, there may be no other way to identify who
    published the press release.}
}

\begin{demo}
\Example
\begin{verbatim}
\defpressrelease{lockyer-pr}{
    title=Attorney General Bill Lockyer Files ``Friend
        of Court'' Brief over Unocal Gasoline Patent,
    date=Sep 14 2000,
}
\end{verbatim}
\Produces Press Release, \emph{Attorney General Bill Lockyer Files ``Friend of
Court'' Brief over Unocal Gasoline Patent} (Sept.\ 14, 2000).
\end{demo}

%</doc>
%
\hi@newcite{speech}{A speech, address, or presentation}{other}{%
    \hi@ifset\hi@kv@type{}{\def\hi@kv@type{Address}}
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@ifset\hi@kv@author{\hi@kv@author@sortable, }{}%
            \hi@kv@type
            \hi@ifset\hi@kv@place{\space at the \hi@kv@place}{}%
            \hi@ifset\hi@kv@name{: \hi@kv@name}{}%
            \hi@maybepage{\hi@page@space\hi@kv@name}%
        }%
        \the\hi@param@parens
        \hi@parens@add\hi@paren@date{\hi@kv@year}%
    }%
    \protected@edef\reserved@a{%
        \hi@ifset\hi@kv@authln{\@capnext\hi@kv@authln}{\hi@kv@name}%
    }%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}
%<*doc>
Besides the obvious uses for delivered speeches, this reference form is useful
for citing slide decks made available online. The more conventional practice of
citing slide decks as books is undesirable insofar as it gives more apparent
authoritative weight than is due most slide decks.

\keyparameters{
    {author}{The speaker or presenter.}
    {year}{The date the speech was given.}
}
\optparameters{
    {type}{The type of speech, default ``Address.'' For slide decks,
    ``Presentation'' is a good choice.}
    {place}{The location, event, or institution where the speech was given.}
    {name}{A title of the speech.}
}

\begin{demo}
\Example
\begin{verbatim}
\defspeech{purvis}{
    author={Sue A. Purvis, U.S. Patent and Trademark Office},
    type=Presentation,
    title=The Role of the Patent Examiner,
    date=april 8 2013,
}
\end{verbatim}
\Produces Sue A. Purvis, U.S. Patent \& Trademark Off., Presentation: The Role
of the Patent Examiner (Apr.~8, 2013).
\end{demo}

%</doc>
%
\hi@newcite{film}{A film (movie/motion picture)}{other}{%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \noexpand\hi@fn@booktitle{\hi@kv@name}%
        }%
        \hi@parens@add{\hi@paren@date}{\hi@kv@publisher\space\hi@kv@year}%
        \the\hi@param@parens
    }%
    \protected@edef\reserved@a{%
        \noexpand\hi@fn@booktitle{\hi@kv@name}%
    }%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}
%<*doc>
This format is somewhat deprecated as it can be implemented entirely with
\rtype{website}.

\keyparameters{
    {name}{The name of the film.}
    {publisher}{The studio that published the film. It is unclear which entity
    this is when there are multiple studios involved in the distribution chain.}
    {year}{The year the film was released.}
}

%</doc>
%
\hi@newcite{tvshow}{A television show}{other}{%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@fn@arttitle{\hi@kv@name}%
        }%
        \the\hi@param@parens
        \hi@parens@add{\hi@paren@date}{%
            \hi@param@optspc\hi@kv@publisher\hi@kv@year
        }%
    }%
    \protected@edef\reserved@a{%
        \noexpand\hi@fn@arttitle{\hi@kv@name}%
    }%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}
%<*doc>
This format is somewhat deprecated as it can be implemented entirely with
\rtype{website}.

\keyparameters{
    {name}{The name of the show.}
    {publisher, broadcaster}{The broadcaster of the show.}
    {year}{The year the show aired.}
}

%</doc>
%
\hi@newcite{opinion}{An ethics or other opinion}{other}{%
    \hi@ifset\hi@kv@type{}{\def\hi@kv@type{Formal Opinion}}%
    \@expand\hi@abbrev@cdoc\hi@kv@type i{\def\hi@kv@type}%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@kv@author,
            \hi@kv@type\space \hi@kv@number
            \hi@maybepage{, \hi@page@atorsect}%
        }%
        \hi@parens@add{\hi@paren@date}{\hi@kv@year}%
        \the\hi@param@parens
    }%
    \protected@edef\reserved@a{\hi@kv@type\space \hi@kv@number}%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}
%<*doc>
These are issued by the American Bar Association, for example. Opinions issued
by the government should use a different reference type.

\keyparameters{
    {author}{The author of the opinion.}
    {number}{The serial number of the opinion.}
    {year}{The date of the opinion.}
}
\optparameters{
    {type}{The type of document, default ``Formal Opinion.''}
}
%</doc>
%
\hi@newcite{custom}{A custom, user-defined reference}{other}{%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \noexpand\hi@custom@setuppin
            \expandonce\hi@kv@customfull
        }%
        \hi@ifset\hi@kv@year{%
            \hi@parens@add{\hi@paren@date}{\hi@kv@year}%
        }{}%
        \the\hi@param@parens
    }%
    \hi@ifset\hi@kv@custominline{%
        \hi@newcite@form{ifc}{#1}{%
            \hi@citeguts{%
                \noexpand\hi@custom@setuppin
                \expandonce\hi@kv@custominline
            }%
        }%
    }{}%
    \hi@ifset\hi@kv@customsupra{%
        \@expand{\hi@supra@form{#1}}\hi@kv@customsupra{i}%
    }{%
        \hi@ifset\hi@kv@customshort{%
            \hi@newcite@form{sc}{#1}{%
                \hi@citeguts{%
                    \noexpand\hi@custom@setuppin
                    \expandonce\hi@kv@customshort
                }%
            }%
        }{}%
    }%
    \hi@ifset\hi@kv@customshortinline{%
        \hi@newcite@form{isc}{#1}{%
            \hi@citeguts{%
                \noexpand\hi@custom@setuppin
                \expandonce\hi@kv@customshortinline
            }%
        }%
    }{}%
}
%<*doc>
The text of the citation is defined by the parameters given below. Within these
parameters, the macro |\pin| may be used for any given pin cite, and
|\ifpin|\marg{yes}\marg{no} may be used to produce different text depending on
the presence of a pin cite. For example:

\begin{demo}
\Example
\begin{verbatim}
\defcustom{comedian}{
    customfull={Maurizio Cattelan,
        \emph{Comedian}\ifpin{, at \pin}{}},
    year=2019,
    customsupra=Cattelan,
    paren=banana taped to wall,
}
\end{verbatim}
\Produces
Maurizio Cattelan, \emph{Comedian}, at \# (2019) (banana taped to wall).\\
\ldots\\
Cattelan, \emph{supra} note \#.
\end{demo}

\keyparameters{
    {customfull}{The full citation form.}
}
\optparameters{
    {custominline}{The inline form.}
    {customshort}{The short form.}
    {customshortinline}{The short inline form.}
    {customsupra}{The \emph{supra} short form. This parameter implies that this
    reference should be cited using \emph{supra} rather than the five-footnote
    rule, as explained in \sec{supra}.}
    {year}{A date, to be appended as a parenthetical if given.}
}
%</doc>
%
%<*package>
%
% Sets up the pin cite macros for the custom reference type.
%
%    \begin{macrocode}
\def\hi@custom@setuppin{%
    \let\pin\@this@page
    \let\ifpin\hi@ifpage
}
%    \end{macrocode}
%
%</package>
%<*test>
\section{otherrefs.dtx}

\defcustom{freedom-statue}{
customfull={Thomas Crawford, \emph{Statue of Freedom}, atop the U.S.
Capitol\ifpin{, at \pin}{}},
year=installed 1863,
customshort=Crawford\ifpin{ at \pin}{},
custominline=Crawford's \emph{Statue of Freedom},
customshortinline=\emph{Statue of Freedom},
}

\AssertBox{\inline{freedom-statue}}{Crawford's \emph{Statue of Freedom}}

\AssertBox{\note{see also freedom-statue at 10 (front
view)}}{\InFootnote{\emph{See also} Thomas Crawford, \emph{Statue of Freedom},
atop the U.S. Capitol, at 10 (installed 1963) (front view).}}

\AssertBox{\inline{freedom-statue}}{\emph{Statue of Freedom}}

\HiNoId

\AssertBox{\note{freedom-statue}}{\InFootnote{Crawford.}}

\HiNoId

\AssertBox{\note{freedom-statue at 15}}{\InFootnote{Crawford at 15.}}

\defcustom{comedian}{
customfull={Maurizio Cattelan, \emph{Comedian}},
year=2019,
customsupra=Cattelan,
paren=banana taped to wall,
}

\AssertBox{\note{see comedian}}{\InFootnote{\emph{See} Maurizio Cattelan,
\emph{Comedian} (2019) (banana taped to wall).}}

\edef\ComedianFootnote{\the\c@footnote}

\AssertBox{\footnote{\inline{comedian}}}{\InFootnote{Cattelan}}

\HiNoId

\AssertBox{\note{see also comedian at 15}}{\InFootnote{\emph{See also} Cattelan,
\emph{supra} note \ComedianFootnote, at 15.}}



%</test>
