%%
%% \iffalse filename: artrefs.dtx \fi
%%
%<*doc>
\input driver
\thisis{artrefs}{Articles and Manuscripts}

\input docparams
%</doc>
\hi@newcite{jrnart}{A consecutively paginated journal article}{other}{%
    \hi@abbrev@journal@check
    \hi@ifset\hi@kv@page{}{\def\hi@kv@page{?}}%
    \@expand{\find@eq{forthcoming}}{\hi@kv@page}{i}{%
        \hi@undefine\hi@kv@page
        \KV@hi@forthcoming\relax
    }{}%
    \hi@ifset\hi@kv@forthcoming{}{%
        \hi@ifset\hi@kv@vol{}{\let\hi@kv@vol\hi@kv@year}%
    }%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@ifset\hi@kv@author{%
                \hi@toa@dupauthor{\noexpand\@iden}{\hi@kv@author@sortable}%
            }{}%
            \hi@ifset\hi@kv@type{\@capnext\hi@kv@type, }{}%
            \hi@ifset\hi@kv@name{% Title
                \@expand{\hi@font@with@comma\hi@fn@arttitle}{\hi@kv@name}{i}%
            }{%
                % If no title set, if there's a citation, use that as the
                % title
                \hi@ifset\hi@kv@citation{%
                    \noexpand\hi@fn@arttitle{%
                        \protect\inline{\hi@kv@citation}%
                    },
                }{}%
            }%
            \hi@ifset\hi@kv@vol{\hi@kv@vol\space}{%
                % Prompt error unless forthcoming
                \hi@ifset\hi@kv@forthcoming{}{\hi@kv@vol\space}%
            }% Volume
            \noexpand\hi@fn@jrntitle{\hi@kv@rep}% Magazine title
            \hi@ifset\hi@kv@forthcoming{}{%
                \space
                \hi@ifset\hi@kv@useissue{%
                    No.~\hi@kv@issue, at\space
                }{}%
                \hi@fmt@page@macro\hi@kv@page % First page
                \hi@maybepage{, }% Pin cite page
            }%
        }%
        \the\hi@param@parens
        \hi@ifset\hi@kv@forthcoming{%
            \hi@parens@add\hi@paren@date{%
                forthcoming%
                \hi@ifset\hi@kv@year{ \hi@kv@year}{}%
            }%
            \noexpand\ifx\noexpand\@this@page\relax\noexpand\else
                \hi@parens@add\hi@paren@forthcomingms{%
                    manuscript at \noexpand\@this@page
                }%
            \noexpand\fi
        }{%
            \hi@ifset\hi@kv@vol{%
                \ifx\hi@kv@vol\hi@kv@year\else
                    \hi@parens@add\hi@paren@date{\hi@kv@year}%
                \fi
            }{}%
        }%
    }%
    \protected@edef\reserved@a{%
        \hi@ifset\hi@kv@authln{\@capnext\hi@kv@authln}{%
            \hi@ifset\hi@kv@type{\@capnext\hi@kv@type}{%
                \noexpand\hi@fn@arttitle{\hi@kv@name}%
            }%
        }%
    }%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}
%<*doc>
This reference type is used for articles published in consecutively paginated
journals.

\keyparameters{
    {author, name}{The author(s) and title of the article.}
    {vol, rep, page, cite}{The citation information for locating the article.
    The journal title is given in \param{rep}, and should be unabbreviated as it
    will be abbreviated according to the \abbscheme{journal} scheme. If
    the page is ``forthcoming,'' then it is treated as if the
    \param{forthcoming} parameter were set.}
    {forthcoming}{Indicates that the article is not yet published. The date
    should match the date of an available draft if one exists, or the expected
    date of publication.}
    {year}{The year of publication. If this is identical to the volume number,
    then it is omitted.}
}
\optparameters{
    {type}{The type of article (Note, Essay, Comment, etc.).}
    {citation}{Instead of an actual title, an article can use a case citation as
    a name. In this case, \param{citation} is the reference name of the case to
    be used as a title.}
    {issue}{The issue number of the journal in which the article appeared.}
    {useissue}{Include the issue number, which by default is omitted.}
}


\begin{demo}
\Example
\begin{verbatim}
\defjrnart{griswold}{
    author=Erwin N. Griswold,
    title=Government in Ignorance of the Law---A Plea
    for Better Publication of Executive Legislation,
    cite=48 Harvard Law Review 198,
    year=1934,
}
\end{verbatim}
\Produces
    Erwin N. Griswold, \emph{Government in Ignorance of the
    Law---A Plea for Better Publication of Executive
    Legislation}, 48 \textsc{Harv.\ L. Rev.}\ 198 (1934).
\end{demo}
Note the unabbreviated journal name in the input.

%</doc>
%<*package>
%    \begin{macrocode}
\make@find@eq{forthcoming}
%    \end{macrocode}
%</package>
\hi@newcite{procart}{%
    A non-consecutively paginated proceedings article%
}{other}{%
    \hi@abbrev@journal@check
    \hi@ifset\hi@kv@forthcoming{}{%
        \hi@ifset\hi@kv@vol{}{\let\hi@kv@vol\hi@kv@year}%
    }%
    \hi@ifset\hi@kv@page{}{%
        \hi@ifset\hi@kv@issue{%
            \edef\hi@kv@page{No. \expandonce\hi@kv@issue}%
        }{}%
    }%
    \hi@newcite@form{fc}{#1}{%
        \hi@inline@never{%
            \hi@citeguts{%
                \hi@ifset\hi@kv@author{%
                    \hi@toa@dupauthor{\noexpand\@iden}{\hi@kv@author@sortable}%
                }{}%
                \hi@ifset\hi@kv@type{\@capnext\hi@kv@type, }{}%
                \noexpand\hi@fn@arttitle{\hi@kv@name}%
                \hi@maybepage{ }\hi@font@comma
                \noexpand\hi@fn@sig{in}\space
                \hi@ifset\hi@kv@vol{\hi@kv@vol}{\hi@kv@year} % Volume
                \noexpand\hi@fn@jrntitle{\hi@kv@rep}%
                \hi@ifset\hi@kv@page{\space \hi@fmt@page@macro\hi@kv@page}{}%
            }%
            \hi@ifset\hi@kv@vol{%
                \ifx\hi@kv@vol\hi@kv@year\else
                    \hi@parens@add\hi@paren@date{\hi@kv@year}%
                \fi
            }{}%
            \the\hi@param@parens
        }%
        \hi@inline@only{%
            \hi@citeguts{\hi@kv@author}%
        }%
    }%
    \protected@edef\reserved@a{%
        \hi@ifset\hi@kv@authln{\@capnext\hi@kv@authln}{%
            \hi@ifset\hi@kv@type{\@capnext\hi@kv@type}{%
                \noexpand\hi@fn@arttitle{\hi@kv@name}%
            }%
        }%
    }%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}%
%<*doc>
An oddity of traditional legal citations is that scholarly works published in
journals that do not use consecutive pagination are cited as if they were
magazine articles, suggesting that they are of lower prestige. This citation
format uses a more journal-like citation format, making articles appear in
citation form more like traditional journal articles.

The parameters are largely the same as those for \rtype{jrnart}, with the
following exceptions.

\keyparameters{
    {page}{This should be an identifier of the article being cited, probably
    along the lines of \texttt{No.~12}. The pin cite will be placed after the
    article title rather than after the journal name, following the usual
    convention that the page number follows the item that is sequentially
    paginated.}
    {issue}{If given, it is equivalent to setting \param{page} to
    \texttt{No.~}\meta{issue}.}
}
%</doc>
%
\hi@newcite{magart}{A magazine article}{other}{%
    \hi@abbrev@journal@check
    \hi@ifset\hi@kv@page{%
        \protected@edef\hi@kv@page{\hi@fmt@page@macro\hi@kv@page}%
    }{}%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@ifset\hi@kv@author{\hi@kv@author@sortable, }{}%
            \@expand{\hi@font@with@comma\hi@fn@arttitle}{\hi@kv@name}{i}%
            \noexpand\hi@fn@jrntitle{\hi@kv@rep}% Magazine title
            \hi@ifset\hi@kv@publisher{ (\hi@kv@publisher)}{}%
            \hi@font@comma
            \hi@kv@year
            \hi@ifset\hi@kv@page{%
                ,
                \expandafter\hi@atorsect\expandafter{\hi@kv@page}%
                \hi@kv@page % First page number; already formatted above
                \hi@maybepage{, }%
            }{%
                \hi@maybepage{, \hi@page@atorsect}%
            }%
        }%
        \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>
This should be used for non-consecutively paginated journals that do not carry
scholarly weight.

\keyparameters{
    {author, name}{The author(s) and title of the article.}
    {rep, page}{The citation information for locating the article.
    The journal title is given in \param{rep}, and will be abbreviated according
    to the \abbscheme{journal} scheme.}
    {year}{The issue date of the magazine.}
}
\optparameters{
    {publisher}{The magazine publisher, if relevant.}
}

\begin{demo}
\Example
\begin{verbatim}
\defmagart{duhigg}{
    author=Charles Duhigg,
    title=How Companies Learn Your Secrets,
    journal=New York Times Magazine,
    page=!MM30,
    date=Jan 1 2016,
}
\end{verbatim}
\Produces Charles Duhigg, \emph{How Companies Learn Your Secrets}, \textsc{N.Y.
Times Mag.}\ MM30 (Jan.~1, 2016).
\end{demo}
Note the exclamation mark in front of the page number, which must be included
because the page number does not start with a digit (see \sec{pages}).



%</doc>
%
\hi@alias@cite{newsart}{magart}
\hi@newcite{website}{A web site or generic citation}{other}{%
    \hi@book@pubparen
    \hi@ifset\hi@kv@year{}{%
        \PackageError\hi@pkgname{Year is required for #1}{%
            Enter a date for the reference%
        }%
    }%
    \hi@ifset\hi@kv@rep{\hi@abbrev@journal@check}{}%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@ifset\hi@kv@author{%
                \hi@toa@dupauthor{\noexpand\@iden}{\hi@kv@author@sortable}%
            }{}%
            \hi@ifset\hi@kv@name{%
                \hi@ifset\hi@kv@rep{%
                    \@expand{\hi@font@with@comma\hi@fn@webtitle}{\hi@kv@name}i%
                    \hi@fn@jrntitle{\hi@kv@rep}%
                }{%
                    \hi@fn@webtitle{\hi@kv@name}{}%
                }%
            }{%
                % \hi@kv@rep assumed to be set here
                \hi@fn@jrntitle{\hi@kv@rep}%
            }%
            \hi@maybepage{ }%
        }%
        \hi@book@paren
        \the\hi@param@parens
    }%
    \protected@edef\reserved@a{%
        \hi@ifset\hi@kv@authln{\hi@kv@authln}{%
            \noexpand\hi@fn@webtitle{\hi@kv@name}%
        }%
    }%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}
%<*doc>
This reference type is useful as a catch-all for published works that do not fit
cleanly in any other category. The ``website'' denotation is somewhat
irrelevant, as the \param{url} parameter is usable independent of reference
type.

The parameters are the same as those for \rtype{magart}. However, \param{rep} is
optional, which can be occasionally useful for web pages that don't have a site
title separate from a particular page title. If given, \param{rep} will be
abbreviated according to the \abbscheme{journal} scheme.
\bookparenparameters

\begin{demo}
\Example
\begin{verbatim}
\defwebsite{mitzman}{
    author=Dany Mitzman,
    title=Nutella: How the World Went Nuts for a Hazelnut
        Spread,
    date=may 18 2014,
    journal=BBC News,
    url=http://www.bbc.com/news/magazine-27438001
}
\end{verbatim}
\Produces Dany Mitzman, \emph{Nutella: How the World Went Nuts for a Hazelnut
Spread}, \textsc{BBC News} (May 18, 2014), http://\ldots
\end{demo}


%</doc>
%
\hi@newcite{manuscript}{An unpublished manuscript}{other}{%
    \hi@book@pubparen % Why not
    \hi@ifset\hi@kv@type{}{\def\hi@kv@type{manuscript}}
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@ifset\hi@kv@author{\hi@kv@author@sortable, }{}%
            \hi@kv@name
            \hi@maybepage{\hi@page@space\hi@kv@name}%
        }%
        \hi@book@paren
        \the\hi@param@parens
        \hi@parens@add\hi@paren@manuscript{%
            unpublished \hi@kv@type
            \hi@ifset\hi@kv@onfile{, on file with \hi@kv@onfile}{}%
        }%
    }%
    \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>
This reference type is usable for any unpublished written work, including Ph.D
dissertations, manuscripts, and reports.

\keyparameters{
    {author, name}{The author(s) and title of the manuscript.}
    {type}{The type of work, by default ``manuscript.''}
    {onfile}{Where a copy of the work can be found; ``author'' is a good
    choice.}
    {year}{The date of the manuscript.}
}

\begin{demo}
\Example
\begin{verbatim}
\defmanuscript{princess-bride}{
    title=The Princess Bride,
    author=William Goldman,
    type=draft screenplay,
    date=may 3 1986,
}
\end{verbatim}
\Produces William Goldman, The Princess Bride (May 3, 1986) (unpublished
draft screenplay).
\end{demo}

%</doc>
\hi@newcite{workingpaper}{A working paper}{other}{%
    \hi@newcite@form{fc}{#1}{%
        \hi@citeguts{%
            \hi@ifset\hi@kv@author{\hi@kv@author@sortable, }{}%
            \noexpand\hi@fn@arttitle{\hi@kv@name}%
            \hi@maybepage{ }%
        }%
        \hi@parens@add{\hi@paren@date}{%
            \hi@kv@publisher,
            \hi@abbrev@pub{\hi@kv@number}{\@iden},
            \hi@kv@year
        }%
        \the\hi@param@parens
    }%
    \protected@edef\reserved@a{%
        \hi@ifset\hi@kv@authln{\@capnext\hi@kv@authln}{%
            \hi@ifset\hi@kv@type{\@capnext\hi@kv@type}{%
                \noexpand\hi@fn@arttitle{\hi@kv@name}%
            }%
        }%
    }%
    \@expand{\hi@supra@form{#1}}\reserved@a i%
}
%<*doc>
This is for working papers with a serial number issued by an institution.

\keyparameters{
    {author, name}{The author(s) and title of the paper.}
    {publisher}{The name of the institution publishing the working paper.}
    {number}{The serial number, with series name (e.g., ``Economics Working
    Paper No. X''). See the \param{serial} param to set this and the publisher
    simultaneously.}
    {year}{The date of the paper.}
}

\begin{demo}
\Example
\begin{verbatim}
\defworkingpaper{cockburn}{
    author=Iain M. Cockburn,
    author=Megan MacGarvie,
    title={Patents, Thickets, and the Financing of Early-Stage
        Firms: Evidence From the Software Industry},
    sponsor=National Bureau of Economic Research,
    serial=Working Paper No. 13644,
    year=2007,
    url=http://www.nber.org/papers/w13644.pdf
}
\end{verbatim}
\Produces
Iain M. Cockburn \& Megan MacGarvie, \emph{Patents, Thickets, and the Financing
of Early-Stage Firms: Evidence from the Software Industry} (Nat'l Bureau of
Econ.\ Res., Working Paper No. 13644, 2007).
\end{demo}

%</doc>
%<*test>

\section{artrefs.dtx}


\defjrnart{tu-kesselheim}{
S. Sean Tu & Aaron S. Kesselheim, Preserving Timely Generic Drug Competition
with Legislation on ``Skinny Labeling'', 115 Clinical Pharmacology and
Therapeutics 22 (2024)
}                                                    


\AssertBox{\note{tu-kesselheim}}{\InFootnote{S. Sean Tu \& Aaron S. Kesselheim,
\emph{Preserving Timely Generic Drug Competition with Legislation on ``Skinny
Labeling},\emph{''} 115 \textsc{Clinical Pharmacology \& Therapeutics} 22
(2024).}}

\subsection{Article Dates}


\defjrnart{jrnartyearonly}{
author=A B,
title=Year Only Article,
journal=Journal of Law,
year=2014,
page=123
}
\AssertBox{\note{jrnartyearonly}}{\InFootnote{A B, \emph{Year Only Article},
2014 \textsc{J.L.} 123.}}

\defjrnart{jrnartyearvol}{
author=C D,
title=Same Year and Volume Article,
journal=Journal of Law,
year=2014,
page=123
}

\AssertBox{\note{jrnartyearvol}}{\InFootnote{C D, \emph{Same Year and Volume
Article}, 2014 \textsc{J.L.} 123.}}


\defprocart{procartyearonly}{
author=A B,
title=Year Only Article,
journal=Proceedings of Law,
year=2014,
page=number 15,
}
\AssertBox{\note{procartyearonly}}{\InFootnote{A B, \emph{Year Only Article},
\emph{in} 2014 \textsc{Proc.\ L.} no.\ 15.}}

\defjrnart{procartyearvol}{
author=C D,
title=Same Year and Volume Article,
journal=Proceedings of Law,
year=2014,
page=number 15,
}

\AssertBox{\note{procartyearvol}}{\InFootnote{C D, \emph{Same Year and Volume
Article}, 2014 \textsc{Proc.\ L.} no.\ 15.}}


\subsection{Manuscript}


\defmanuscript{testmanuscript}{
author=John Doe,
title=My Diary,
date=jan 1 2021,
}

\AssertBox{\inline{testmanuscript}}{John Doe}

\AssertBox{\note{testmanuscript}}{\InFootnote{John Doe, My Diary (Jan.~1, 2021)
(unpublished manuscript).}}

\AssertBox{\inline{testmanuscript}}{Doe}


\subsection{Website}

\defwebsite{romano}{
author=Nick Romano,
title=Julie Andrews Recalls Wiping out While Filming ``The Sound of Music'',
date=Jul 1 2017,
journal=Entertainment Weekly,
}

\AssertBox{\note{romano}}{\InFootnote{Nick Romano, \emph{Julie Andrews Recalls
Wiping out While Filming ``The Sound of Music},\emph{''} \textsc{Ent.\ Wkly.}\
(July 1, 2017).}}



%</test>
