%%
%% \iffalse filename: bookparams.dtx \fi
%%
%<*doc>
\input driver
\thisis{bookparams}{Parameters for Books and Articles}

This section describes parameters typically specific to books and articles not
otherwise described above. Some of the parameters will be applicable to other
reference types such as statutes, because they use the publication parenthetical
described in \sec{bookrefs-pubparen}. This section also includes parameters for
the
\rtype{citecontainer} reference type, because those are typically books.

\input docparams

%</doc>
\hi@defparam{edition}{Edition number of book}{%
    \protected@edef\reserved@a{\ifnum\m@ne<0#1 \fi}%
    \ifx\reserved@a\@empty
        \edef\hi@kv@edition{#1\hi@numtoord{#1} ed.}%
    \else
        \hi@abbrev@pub{#1}{\def\hi@kv@edition}%
    \fi
}
%<*doc>
If the value is a number, then it will be converted to an ordinal number (e.g.,
|3| becomes ``3d'') and the word ``ed.''\ will be appended to it. Otherwise, the
value is abbreviated in accordance with the \abbscheme{pub} abbreviation scheme.
%</doc>
%
\hi@defparam{editor}{Editor(s) of book}{%
    \hi@nameproc@person{#1}{\hi@namelist@addtwo\hi@kv@editor\relax}%
}
%<*doc>
The value should be a name, as described in \sec{names}. For more than one
editor, enter this parameter as many times as needed, but \param{noetal} must be
used if there are three or more editors. The ``\param{editor}'' parameter is
also used for translators or other roles; see \param{edtype}. For institutional
editors, see parameter \param{insted}.
%</doc>
%
\hi@defparam{edtype}{Editor type (default ed.)}{%
    \hi@abbrev@pub{#1}{\def\hi@kv@edtype}%
}
%<*doc>
Changes the abbreviation placed after the editors. For example, use ``trans.''\
for translators, and ``eds.\ \& trans.''\ for editors who also translated. Note
that there is currently no support for works with an editor who is different
from a translator. This will be abbreviated according to the \abbscheme{pub}
abbreviation scheme.
%</doc>
%
\hi@newparam@noval{forthcoming}{Journal article is forthcoming}
\hi@defparam{in}{Reference name of a citation that the current item is in}{%
    \hi@anonref{#1}{\def\hi@kv@in}%
}
%<*doc>
The value may be a reference name or an anonymous reference definition (see
\sec{anonymous}). The primary use of this parameter is to identify the
containing
work in a \rtype{citecontainer}.
%</doc>
%
\hi@defparam{insted}{Institutional editor}{%
    \hi@nameproc@inst{#1}{\hi@namelist@addinst}{\hi@kv@editor}%
}
%<*doc>
Adds an institutional editor to the \param{editor} parameter list.
%</doc>
%
\hi@newparam{issue}{Issue number of journal}
\hi@param@alias{issuer}{publisher}
\hi@newparam@noval{noabbrevjrn}{Don't abbreviate the journal name}
%<*doc>
This is useful if the journal was entered abbreviated already.
%</doc>
%
\hi@defparam{publisher}{Publisher of book}{%
    \hi@abbrev@name{#1}{\def\hi@kv@publisher}%
}
%<*doc>
The publisher name will automatically be abbreviated by the \abbscheme{name}
abbreviation
scheme.
%</doc>
%
\hi@defparam{serial}{Serial number of a published work}{%
    \find@in{: }{#1}{%
        \@tworun\KV@hi@publisher\KV@hi@number
    }{%
        \find@in{, }{#1}{%
            \@tworun\KV@hi@publisher\KV@hi@number
        }{\KV@hi@number{#1}}%
    }%
}
\make@find@in{: }
\make@find@in{, }
%<*doc>
This parameter is essentially an alias for \param{number}, except if it contains
a comma or colon, the prefix is used to set the \param{publisher} parameter.
%</doc>
%
\hi@newparam@noval{singleauthor}{All works in a collection are by one author}
%<*doc>
This is used in \rtype{citecontainer} to change the font used for the author.
%</doc>
%
\hi@newparam@noval{usetitle}{Use title rather than author in short cites}
\hi@newparam@noval{useissue}{Include issue number in journal citations}
%<*test>
\section{bookparams.dtx}

\begingroup

    \defbook{a}{A A, Title (2020); edition=3}
    \AssertBox{\note{a}}{\InFootnote{\textsc{A A}, \textsc{Title} (3d ed.\
    2020).}}
    \defbook{b}{B B, Title (2020); edition={revision 3, special edition}}
    \AssertBox{\note{b}}{\InFootnote{\textsc{B B}, \textsc{Title} (rev.\ 3,
    spec.\ ed.\ 2020).}}

    \defbook{c-d}{title=Compilation, year=2020, editor=C C, editor=D D}
    \AssertBox{\note{c-d}}{\InFootnote{\textsc{Compilation} (C C \& D D eds.,
    2020).}}

\endgroup

\begingroup
    \let\hi@kv@publisher\@empty
    \let\hi@kv@number\@empty

    \KV@hi@serial{11}%
    \AssertMacro\hi@kv@number{11}
    \AssertMacro\hi@kv@publisher{}

    \KV@hi@serial{Congressional Research Service, No. 12345}
    \AssertMacro\hi@kv@number{No. 12345}
    \AssertMacro\hi@kv@publisher{Cong. Rsch. Serv.}

    \KV@hi@serial{Congressional Research Service: No. 12345}
    \AssertMacro\hi@kv@number{No. 12345}
    \AssertMacro\hi@kv@publisher{Cong. Rsch. Serv.}

\endgroup

\begingroup
    \hi@param@clear
    \KV@hi@edtype{editors and translators}
    \AssertMacro\hi@kv@edtype{eds. \& trans.}
\endgroup

%</test>
