Debian Codegraph @

texmf-dist/source/latex/opcit/opcit.dtx

raw
1 % \iffalse meta-comment
2 %
3 % opcit - bibliographical references as footnotes.
4 % Copyright 2002 Federico Garcia ([email protected], [email protected])
5 % -------------------------------------------
6 %
7 %
8 % This program can be redistributed and/or modified under the terms
9 % of the LaTeX Project Public License distributed from CTAN archives
10 % in the directory macros/latex/base/lppl.txt; either version 1 of
11 % the License, or (at your option) any later version.
12 %
13 %
14 %<*driver>
15 % \fi
16 \ProvidesFile{opcit.dtx}[2002/12/25 v1.1 Footnote references]
17 % \iffalse
18 \documentclass{ltxdoc}
19 \GetFileInfo{opcit.dtx}
20 \title{\texttt{opcit} (version 2.0)\\a package for footnote-style bibliographical references}
21 \date{\filedate{}}
22 \author{Federico Garcia\\\texttt{[email protected]}}
23 \begin{document}
24 \maketitle
25 \DocInput{\filename}
26 \end{document}
27 %</driver>
28 % \fi
29 %
30 %\tableofcontents
31 %
32 %\section{New features in version 2}
33 %
34 %Users of |opcit| that are familiar with the package will be interested in the following new features:
35 %
36 %\begin{itemize}
37 %\item The bug that used to forbid constructions like |\cite[pp| has been fixed, so you no longer need to type |\cite[p{}p| or |\cite[p\relax p|.
38 %\item The bibliography style has been fully recoded, and it is more complete now.
39 %\item Cross-referencing has been implemented, both between bibliographical entries (so that an article in a book makes reference to the book) and between footnotes (so that `\emph{op.~cit.}' is a hyperlink to the footnote where the work was first cited, or alternatively a reference can be made to the footnote number).
40 %\item A way to omit information in the footnotes (but still list it in the final list) is now available. Using this you can avoid the annoying repetition potential to |@INCOLLECTION| entries, like `\dots\ pages 1--20, p.~13'.
41 %\item |opcit| now checks whether the optional argument to an \emph{Idem}-citation is identical to the last one, in whose case omits it. This prevents things like two consecutive footnotes both saying `\emph{Idem}, p.~13'. Also, appearance of `\emph{Idem}' only happens if it was the immediately previous footnote that referred to the work.
42 %\item Global and local mechanisms are provided for turning off either or both `\emph{Idem}' or `\emph{op.~cit.}'\ (substituting |hereafter|'s).
43 %\end{itemize}
44 %
45 %These new features are implemented as options to the package. This means that the previous way to load the package, with a custom \textsc{Bib}\TeX\ style as an option, has changed. See section~\ref{loading} below.
46 %
47 %\bigskip
48 %\noindent This second release of |opcit| owes its existence to both the encouragement and the suggestions I got from John~Scott, the first |opcit| user I knew of (that wasn't an acquaintance of mine).
49 %
50 %\section{Introduction}
51 %
52 %The basic bibliography styles of \LaTeXe\ and \textsc{Bib}\TeX, with labels between [~and~], are very foreign to the common uses of humanities-writing. In recent times, the category of bibliographical styles known as `author-date' seems to have gained acceptance and become the standard way to refer to a final list of references. This category of styles has been successfully implemented in \LaTeX\ and \textsc{Bib}\TeX, for example in formidable packages such as |natbib|, |achicago|, and |harvard|.
53 %
54 %However, certain disciplines still use the `old way' of footnote-referencing, above all in journal articles, which do not have a final list of `References' to which a key can refer. Author-year styles have the significant drawback that the labels interfere with the flow of the discourse, both in writing and in reading; and, as Susan~King and Oren~Patashnik point out in their `Editorial note' in the |apalike.bst| file, the main reason to use them (that changes to the bibliography does not mean ``changing numbers in both references and text") is rendered meaningless by computerized typography. The `footnote category' of bibliographical styles has not been directly addressed by \LaTeX\ package-writers before |opcit|.
55 %
56 %Actually, there \emph{is} a package intended to place the bibliography as footnotes, namely |footbib|.\footnote{By Eric Domenjoud, 1995.} In this package, the labels appear as superscripts---$^{[1]}$---and the information about the source is appended to the bottom of the page. This style is a kind of `hybrid' between footnote and label styles: the numbering of the citations is independent from the footnotes, and if other footnotes (not bibliography ones) appear, they appear separated from the citations.
57 %
58 %The system provided by |opcit| makes the references footnotes in the full sense. As is customary in this kind of style, it keeps track of the sources already been cited, in order to avoid multiple copies of the same, potentially long, footnote. So, for `post-citations' (a later citation of a work already cited), it makes automatic use of conventions such as \emph{Idem} and \emph{op.~cit.}---which gives the package its name---or allows the user to set `hereafters' to repeatedly refer to the same publication.
59 %
60 %\bigskip
61 %\noindent What I regret most about this package is that I was not able to make it `|bst|-independent,' i.e., able to run with any \textsc{Bib}\TeX\ style that the user could possibly want to use. (This, for example, is one of the good things about |footbib|.) The main reason why this was not possible is that |bst| files are designed to print the information in a list, not as footnotes, inserting, for example, periods instead of commas, and giving the author names with last-name first.
62 %
63 %The \textsc{Bib}\TeX\ style I provide in this version is much more complete than that in the first one. However, I have maintained the premise that new styles can be created by the users. To that end, I have greatly expanded the comments to the code of |opcit.bst| below, so its adaptation is easier. As usual, any modification is welcome as long as the file name is changed. Also, if you are creating a new style, I would like to (collaborate and) consider it for inclusion in the |opcit| distribution.
64 %
65 %\section{Use}
66 %
67 %\subsection{Loading the package}\label{loading}
68 %
69 %As usual, you have to load the package with
70 %
71 %|\usepackage[|\meta{options}|]{opcit}|
72 %
73 %\noindent The \meta{options}, all new to the second version, are:
74 %\begin{center}\begin{tabular}{lp{9cm}}\hline
75 %|custombst| & Allows the user to issue a \verb"\bibliographystyle" command to change the \textsc{Bib}\TeX used by default.\\
76 %|nocustombst| & To use the default style. This is of course the default option.\\\hline
77 %|hyperref| & Makes the expression `\emph{op.~cit.}' (or the one set by the user) a hyperlink to the first citation of the reference. Default if the \texttt{hyperref} package has been loaded before |opcit|; otherwise, it is not default.\\
78 %|nohyperref| & No hyperlinks. Default when package \texttt{hyperref} is not loaded.\\\hline
79 %|omitting| & Omits certain information, such as pages, volume, series, etc., from the footnotes (you can of course control what is omitted and what is not). Selected by default.\\
80 %|noomitting| & Turns off the omission mechanism altogether.\\\hline
81 %|idemcheck| & Checks for identical \emph{Idem}-citations, omitting the optional argument. Selected by default.\\
82 %|noidemcheck| & Turns off the check.\\\hline
83 %\end{tabular}\end{center}
84 %
85 %See below for detailed information on the effects of these options.
86 %
87 %\subsection{Citations}
88 %\DescribeMacro{\cite}
89 %The user keeps citing with |\cite|. Thus, |\cite{texbook}| will produce the footnote `\footnote{Donald E. Knuth, \emph{The \TeX book} (Reading, Mass.: Addison Wesley, 1986).}'. The optional argument has the usual meaning, so for example, |\cite[p.~100]{taruskin}| creates `\footnote{Richard Taruskin, \emph{Defining Russia musically: Historical and Hermeneutical Essays} (Princeton: Princeton University Press, 1997), p.~100.}'.
90 %
91 %Note that |opcit| adds a period at the end of the footnotes; however, if the user adds it (for example, in |\cite[Introduction.]{gellner}|), it will not: `\footnote{Ernest Gellner, \emph{Thought and change} (Chicago: University of Chicago Press, 1964), introduction.}'. It will also avoid it after `?' or `!'; in general, after any character with a |\sfcode| equal to the one of the period. (This is lost in |\frenchspacing| and similar situations, where |opcit| has no way to `see' the period, and will \emph{always} add one.)
92 %
93 %A |\cite| command can also occur within the argument of a |\footnote|. In that case, the information on the source is added to the text of the footnote, with \emph{no} period added.\footnote{This is because it is assumed that the user will always `close' the footnote with a final period. Issuing here \texttt{\textbackslash cite\{martinb\}}, which produces Jes\'us Mart\'{\i}n-Barbero, \emph{Communication, culture, and hegemony: From media to mediations} (London: SAGE Publications, 1993), I do not want |opcit| to add a period.}
94 %
95 %The starred \DescribeMacro{\cite*}version of |\cite| omits the author's name from the footnote. So: Gellner expanded one of the ideas presented from his mentioned book in a later study.|\cite*{gellner2}|\footnote{\emph{Nations and Nationalism} (Ithaca: Cornell University Press, 1983).}
96 %
97 %\subsection{Post-citations}
98 %Post-citations---later citations of an already cited work---behave differently. For example, a new citation of the \TeX book through |\cite{texbook}| will not render the whole footnote text again, but rather `\footnote{Knuth, \emph{op.~cit.}}'. The author name has been reduced to the last-name, and the rest of the information is replaced by `\emph{op.~cit.}' Again, the period is appropriately handled: no period is added to the one at the end of this expression. But in the case of |\cite[p.~101]{taruskin}|, it is added: `\footnote{Taruskin, \emph{op.~cit.}, p.~101.}'. You can also use |\cite*| to hide the author's name for \emph{op.~cit.}-citations.
99 %
100 %This is not good when there are several works by the same author, in whose case |opcit| has no way to know which one is meant at each point. This is handled with the `hereafter' mechanism (section~\ref{hereafter}).
101 %
102 %\bigskip
103 %\noindent Another kind of situation arises when the same work is cited \emph{consecutively}. In that case, the corresponding footnote(s) will say `\emph{Idem}'. In principle, this will be followed by the optional argument, if any. \marginpar{\raggedleft\textsf{New Feature}}However, if two \emph{Idem}-citations have the same optional argument, the second time it will \emph{not} be typeset. \DescribeMacro{nocheckidem}(This can be turned off with the |nocheckidem| option.) In any case, a final period will be added if needed.
104 %
105 %Thus, a further citation here of Taruskin's book (the one that was cited last in the previous paragraph), through |\cite[p.~xxi]{taruskin}|, renders `\footnote{\emph{Idem}, p.~xxi.}'. If the same command (|\cite[p.~xxi]{taruskin}|) is issued again, the footnote will be `\footnote{\emph{Idem}.}', with no `p.~xxi' in it.
106 %
107 %Since an \emph{Idem}-citation will always hide the author's name, use of |\cite*| in those situations has has no special effect.
108 %
109 %\bigskip
110 %\noindent As a reader,\marginpar{\raggedleft\textsf{New feature}} I have had the annoying experience of needing to find a reference for which the footnote to the page says only `Barto\v s: \emph{op.~cit.}' You are forced carefully to look through all the previous footnotes in search of the whole information. It was thus very nice to come across a book\footnote{Jamie C. Kassler: \emph{Music, Science, Philosophy: Models in the Universe of Thought} (Aldershot, Burlington, Singapore and Sydney: Ashgate, 2001).} with footnote references, but in which any post-citations indicated the footnote in which the work was first cited---something like `(note 14).' I then decided to implement this in |opcit|.
111 %
112 %\DescribeMacro{\bibref}So, command |\bibref{|\meta{key}|}| produces the number in which the \meta{key} reference was |\cite|'d for the first time. (If the reference has not been |\cite|'d before, however, there will be an error message.) You can use |\bibref| anywhere, in the main text, as the optional argument to a |\cite|, or in a footnote. For example, you can post-cite the \TeX Book with |\cite[note~\bibref]{texbook}|, or |\footnote{\cite{texbook} (see footnote \bibref above).}|, etc. In the first case you would get `\footnote{Knuth, \emph{op.~cit.}, note 2.}'.
113 %
114 %\DescribeMacro{hyperref}The footnote number printed by |\bibref| (either a manual or an automatic one) will be a hyperlink if the |hyperref| option is in place. In fact, this option provides satisfactory cross-referencing with hyperlinks: the `\emph{op.~cit.}' expression itself will be a hyperlink if this option is chosen.
115 %
116 %The |hyperref| option is in force by default if the |hyperref| package has been loaded (before |opcit|). If the package is loaded, but hyperlinks for citations are not desired, they can be turned off with the |nohyperref| option to |opcit|.
117 %
118 %\subsubsection{Extra control}\label{extra}
119 %
120 %\DescribeMacro{\resetcites}In long documents, for example books with chapters, it might be desirable to reset the citations so that they are again fully cited in the footnotes (even if they were already cited, say, in a previous chapter). This is done with the command |\resetcites|. It affects all the entries in the bibliography database.
121 %
122 %\DescribeMacro{\cited}The contrary procedure---to make the next citation of a work a post-citation, with \emph{op.~cit.} instead of the full information---is possible for individual entries: |\cited{|\meta{key1}|,|\meta{key2}|,|\dots|}| will make |opcit| pretend that the entries in the argument were already cited. This is particularly useful with cross references among entries (see section~\ref{crossrefs}).
123 %
124 %\subsection{Customization}
125 %The user can change \DescribeMacro{\opcittext}\DescribeMacro{\idemtext}the expressions `\emph{op.~cit.}' and `\emph{Idem}' by |\renewcommand|'ing the |\opcittext| and |\idemtext| commands, respectively.
126 %
127 %\subsection{The `herafter' mechanism}\label{hereafter}
128 %
129 %\DescribeMacro{hereafter = ""}When two or more works by the same author are |\cite|'d, the \emph{op.~cit.}\ mechanism is not reliable. The user should then provide a `\texttt{hereafter}' value for each work by the same author in the \texttt{bib} file. Then, |opcit| will use the value of this entry in the place of \emph{op.~cit.}
130 %
131 %For example, if Gellner's mentioned books had \texttt{hereafter} entries of |"T{\&}C"| and |"N{\&}N"|, respectively, the commands |\cite{gellner}| and |\cite{gellner2}| would produce `\footnote{Gellner: \emph{T\&C}.}' and `\footnote{Gellner: \emph{N\&N}.}' (of course, from the second time these works are cited on). Note that the strings were emphasized. The starred version |\cite*| still hides the author's name, and the `\emph{Idem}' mechanism will apply if any of the works is |\cite|'d for the second time in a row.
132 %
133 %If no \texttt{hereafter} entry is found (and there are several references by the same author), a warning will be issued, and the deliberately unacceptable expression \emph{?Op.?Cit.?} substituted.
134 %
135 %The value of \texttt{hereafter}, that replaces `\emph{op.~cit.},' will be a hyperlink if the |hyperref| option is on.
136 %
137 %\DescribeMacro{\hereafter}
138 %The |\hereafter| command typesets the \texttt{hereafter} string of the last |\cite|'d work, so that we can say something like
139 %
140 %\begin{verbatim}
141 %\footnote{See \cite{gellner}; hereafter I will refer to this text as
142 %\hereafter.}
143 %\end{verbatim}
144 %
145 %This mechanism can be used also for single works of a particular author. The result of |\hereafter| is \emph{not} a hyperlink.
146 %
147 %\subsection{Omitting text from the footnotes}\label{omits}
148 %
149 %Sometimes\marginpar{\raggedleft\textsf{New Feature}} it is desirable to omit some part of the bibliographical information from the footnotes, keeping it on the final references list. \DescribeMacro{\toomit}This is now allowed by |opcit| through the command |\toomit|. You use it in the |.bib| file, like this:
150 %
151 %\begin{verbatim}
152 %address = "Aldershot\toomit{, Burlington, Singapore and Sydney}",
153 %\end{verbatim}
154 %
155 %\noindent The effect is that the argument of |\toomit| will be typeset in the final references list, but not in the footnotes.
156 %
157 %Typical cases when this is useful are:
158 %\begin{itemize}
159 %\item Long addresses (example above).
160 %\item Long titles: {\ttfamily title = "The Prisoner of Zenda|\toomit{|: being the story of three months in the life of an English gentleman|}|"}.
161 %\item Some translated titles: {\ttfamily title = "Music and Discourse|\toomit{| [Musicologie g|{\'e}|n|{\'e}|rale et s|{\'e}|miologie]|}|"}.
162 %\end{itemize}
163 %
164 %A special case of omission concerns page numbers for articles in journals or books. Since the page numbers for articles usually go at the end of the reference, they could clash with the optional argument to |\cite| (something like a `pages~1--20, p.~13'). This cannot be fixed with |\toomit|, because the particle `pages' is added by \textsc{Bib}\TeX, so it's not susceptible of |\toomit|. The same is true of the \texttt{volume}, the \texttt{series}, and \texttt{number} of a |@BOOK| entry, among others.
165 %
166 %The solution is that |opcit| omits these fields altogether from the footnotes (they still appear in the final bibliography list).
167 %
168 %This is the default behavior, but it can be overriden. \DescribeMacro{\with}The |\with{|\meta{field}|}| command forces the \meta{field} of the next reference to appear, even if it would by default be omitted. So, for example, to get a footnote that does include the pages of an article, you type |\with{pages}\cite{foo}|. Similarly, the \texttt{volume} of a book can be `de-omitted' by typing |\with{volume}\cite{foobook}|.
169 %
170 %Several |\with| commands can go in succession. For example, if you want the page numbers of the article from a collected edition, \emph{and} the volume of the book that contains, you can say |\with{pages}\with{volume}\cite{book}|.
171 %
172 %The scope of |\with| is only the next |\cite| (each |\cite| sets all default omissions back on). On the other hand, nothing happens if a |\cite| does not have the \meta{field} that was requested with |\with|.
173 %
174 %
175 %A more sophisticated version of |\toomit| allows the user to use |\with| in connection with it. |\toomit[|\meta{category}|]{|\meta{text}|}| will by default omit the \meta{text} (from the footnotes), but it could be forced typing |\with[|\meta{category}|]|. Note that the \meta{category} is not a \textsc{Bib}\TeX\ field.
176 %
177 %For example,
178 %\begin{verbatim}
179 %title = "Music and discourse: Toward a semiology of
180 % music\toomit[translation]{\ [Musicologie
181 % g{\'e}n{\'e}ral et s{\'e}miologie]}"
182 %\end{verbatim}
183 %
184 %\noindent the translation will by default be omitted in the footnote, but there will be a |\with{translation}| that will include it.
185 %
186 %\DescribeMacro{noomitting}You can turn off the omissions by specifying the |noomitting| option to the package. In that case, the commands |\toomit| and |\with| have no effect.
187 %
188 %
189 %\subsection{The final references list}
190 %
191 %The command |\bibliography| has the usual effect of producing a final section (or chapter) for `References.' According to the \textsc{Bib}\TeX\ style used, the format of the entries is different in the references list from the footnotes.
192 %
193 %\marginpar{\raggedleft\textsf{New Feature}}Frequently, a document with bibliographical references in footnote style does not include a final references list. \DescribeMacro{\nobibliography}But the user has to tell |opcit| where to find the \textsc{Bib}\TeX\ database, which is done by the |\bibliography| command. So there is now a |\nobibliography| that works just like |\bibliography| but produces no list. The command takes the file name(s) of the database(s) as its argument.
194 %
195 %Bear in mind that if you use |\nobibliography| instead of |\bibliography|, some information that is by default omitted from the footnotes (see section~\ref{omits}) might be completely lost. |opcit| emits a warning of this in the \texttt{log} file.
196 %
197 %\section{The \textsc{Bib}\TeX\ style}\label{bstyle}
198 %
199 %The \textsc{Bib}\TeX\ style (|opcit.bst|) that comes with this version~2 of |opcit| is fairly complete, but this does not mean that it can handle every conceivable combination of different pieces of information in any bibliographical reference. I have provided the standard entry types, and the fields are also about the same as in standard styles (with the notable addition of |hereafter|, discussed in section~\ref{hereafter}). So I repeat the \emph{caveat} of Oren~Patashnik: be creative in the use of entries and fields, and you will be able to achieve pretty much anything.\footnote{It is never a bad idea to read Patashnik's ``\textsc{Bib}\TeX ing'' (February 8, 1988), file \texttt{btxdoc.dvi} in \LaTeX\ standard distribution.}
200 %
201 %For example: rather than providing a field for |translation|, which would imply provision of a host of additional fields---|datetranslated|, |original|, |translator|, \dots---and would not be used very often, I have relied on the user's judicious use of fields like |note| and |howpublished|. The following conventions are true of all entry types without exception:
202 %\begin{itemize}
203 %\item \texttt{howpublished} is printed \emph{immediately after} \texttt{edition}.
204 %\item \texttt{note} is printed \emph{at the end of an entry}. It is also omitted from the footnotes (but can be retrieved with |\with{note}|).
205 %\end{itemize}
206 %
207 %\subsection{Cross referencing}\label{crossrefs}
208 %
209 %\DescribeMacro{crossref = ""}Cross referencing through the |crossref| field has been fully implemented in version~2. Its exact behavior depends on whether a reference is being cited in a footnote, or it appears in the final list.
210 %
211 %Consider, for example, the entry
212 %
213 %\begin{verbatim}
214 %@INCOLLECTION{derrida,
215 % title = "Deconstruction and actuality",
216 % author = "Jacques Derrida",
217 % crossref = "postmodern",
218 % pages="75--78"
219 % }
220 %\end{verbatim}
221 %
222 %If there is a |\cite{derrida}| in the document, the result will be equivalent to having typed: {\ttfamily|\footnote{|Jacques Derrida, ``Deconstruction and actuality,'' in |\cite{postmodern}.}|}
223 %
224 %The last |\cite| is added automatically by \texttt{opcit}, as a result of the \texttt{crossref} field. Its output will be either a full citation of the book, or an `\emph{op.~cit.}'\ expression, depending on whether the book has already been cited or not.
225 %
226 %The citation that results from the |crossref| field will by default \emph{not} count as the first citation of that entry (``\texttt{postmodern}'' in the example). This means that a later citation of this same entry (be it by itself or within another cross reference) will expand the full information again. The command |\cited| (section~\ref{extra}) can be used to override this and make future citations of the cross reference be of the \emph{op.~cit.} type.
227 %
228 % In addition, \emph{Idem} is disabled for it. However, post-citations of the main reference (``\texttt{derrida}'') are not affected at all by the cross~reference mechanism, and will use the regular `\emph{op.~cit.}' or `\emph{Idem}' expressions.
229 %
230 %\bigskip\noindent
231 %In the final references list, the effect of the |crossref| field is more familiar: the entry will get the information for the missing fields from the entry that is being cross-referenced, just as in a standard \textsc{Bib}\TeX\ style.
232 %
233 %\subsection{Other tools}
234 %
235 %The new field |hereafter| has already been explained (section~\ref{hereafter}), as well as the use of |\toomit| (section~\ref{omits}). Other features will be introduced in this section.
236 %
237 %\DescribeMacro{\bibpunctuation}The |\bibpunctuation| command expands into a comma in the footnotes, but into a period in the final references list. It is internally used by |opcit.bst| to separate the different pieces of information within an entry, and the user can use it just as well.
238 %
239 %Use of |\bibpunctuation| is likely to need complement for the capitalization of what follows. After a comma, things should start lowercase; after a period, uppercase. This ambiguous case has been conceived for |opcit| as the `bibliography-case,' and implemented in the command \marginpar{\raggedleft\textsf{New Feature}}\DescribeMacro{\bibcase}|\bibcase|. You can insert it anywhere and it will make the first letter of the following word either lower- or uppercase. For example, |opcit.bst| inserts |\bibcase| before the particle `in' of an |@INCOLLECTION| entry. Applying braces, like in |\bibcase{paideia}|, would capitalize or de-capitalize the whole argument.
240 %
241 %\DescribeMacro{\bibcite}If you have to know it all, the implementation of |crossref| described in the previous section is made through the |\bibcite| command. It takes two arguments: the label to cite within the citation, and the whole information to be typeset in the final list. You can directly use this command in any field.
242 %
243 %\subsection{The entry types}
244 %
245 %The |opcit| \textsc{Bib}\TeX\ style accepts the same entry types as the standard styles. Below you find examples of each of the entry types in both footnote and final-list layout, as well as explicit lists of omitted fields (see section~\ref{omits}).
246 %
247 %\subsubsection{Book}
248 %Omitted fields: \texttt{volume} and \texttt{series} (recovered by |\with{volume}|); \texttt{number} and \texttt{series} (|\with{number}|); \texttt{note} (|\with{note}|).
249 %
250 %\noindent\hrulefill\ 1\ \hrulefill
251 %
252 %\begin{verbatim}
253 %@BOOK{berlinsky,
254 % author="David Berlinsky",
255 % title="Newton's Gift\toomit{: How Sir Isaac Newton
256 % Unlocked the System of the World}",
257 % publisher="Simon {\&} Schuster",
258 % address="New~York and London",
259 % year="2000"}
260 %\end{verbatim}
261 %The first footnote for this entry would read:
262 %\begin{quotation}\small\noindent
263 %David Berlinsky, \emph{Newton's Gift} (New York and London: Simon \& Schuster, 2000).
264 %\end{quotation}
265 %In the final reference list, the entry looks like:
266 %\begin{quotation}\noindent
267 %\makebox[2.5em][r]{Berlinsky}, David. \emph{Newton's Gift: How Sir Isaac Newton Unlocked the System of the World}. New York and London: Simon \& Schuster, 2000.
268 %\end{quotation}
269 %
270 %\noindent\hrulefill\ 2\ \hrulefill
271 %
272 %\begin{verbatim}
273 %@BOOK{tac,
274 % author="Ernest Gellner",
275 % title="Thought and Change",
276 % series="``The Nature of Human Society'' Series (ed.\
277 % Julian Pitt-Rivers and Ernest Gellner) Press",
278 % number="1",
279 % year="1964",
280 % address="Chicago",
281 % publisher="University of Chicago"}
282 %\end{verbatim}
283 %Footnote layout:
284 %\begin{quotation}\small\noindent
285 %Ernest Gellner, \emph{Thought and Change} (Chicago: University of Chicago Press, 1964).
286 %\end{quotation}
287 %For the final-list of this and the rest of the examples see page~\pageref{examples} (footnote-layout is illustrated in the main text).
288 %
289 %\noindent\hrulefill\ 3\ \hrulefill
290 %
291 %\begin{verbatim}
292 %@BOOK{walker,
293 % title="The Final Years 1861--1886",
294 % volume="3",
295 % series="Franz Liszt",
296 % author="Alan Walker",
297 % publisher="Alfred A. Knopf",
298 % address="New York",
299 % year="1996"}
300 %\end{verbatim}
301 %Footnote layout:
302 %\begin{quotation}\small\noindent
303 %Alan Walker, \emph{The Final Years 1861--1886} (New York: Alfred A. Kopf, 1996).
304 %\end{quotation}
305 %\noindent This is a case in which you might prefer typing |\with{volume}\cite{walker}|, with the following effect:
306 %\begin{quotation}\small\noindent
307 %Alan Walker, \emph{The Final Years 1861--1886}, volume 3 of \emph{Franz Liszt} (New York: Alfred A. Kopf, 1996).
308 %\end{quotation}
309 %
310 %\subsubsection{Article}
311 %
312 %Omitted fields: \texttt{pages}, \texttt{month}, \texttt{note}.
313 %
314 %\noindent\hrulefill\ 1\ \hrulefill
315 %
316 %\begin{verbatim}
317 %@ARTICLE{sheldon,
318 % author="David A. Sheldon",
319 % title="The Galant Style Revisited and Re-Evaluated",
320 % journal="Acta Musicologica",
321 % volume="47",
322 % number="2",
323 % year="1975",
324 % pages="240--70"}
325 %\end{verbatim}
326 %Footnote layout:
327 %\begin{quotation}\small\noindent David A. Sheldon, ``The Galant Style Revisited and Re-Evaluated,'' \emph{Acta Musicologica} 47/2 (1975).\end{quotation}
328 %
329 %\noindent\hrulefill\ 2\ \hrulefill
330 %
331 %\begin{verbatim}
332 %@ARTICLE{nattiez,
333 % author="{Jean-Jacques} Nattiez and Isabelle Schulte-Technoff",
334 % title="L'etnomusicologia: strutturalismo o culturalismo?\toomit{
335 % Intervista con Jean-Jacques Nattiez di Isabelle Schulte-Technoff}",
336 % journal="Musica/Realt{\`a}",
337 % volume="61",
338 % pages="109--131",
339 % year="2000",
340 % month="March"}
341 %\end{verbatim}
342 %Footnote layout:
343 %\begin{quotation}\small\noindent Jean-Jacques Nattiez and Isabelle Schulte-Technoff, ``L'etnomusicologia: strutturalismo o culturalismo?,'' \emph{Musica/Realt\`a} 61 (2000).\end{quotation}
344 %
345 %\noindent Or, alternatively, |\with{month}\with{pages}\cite{nattiez}| produces:
346 %\begin{quotation}\small\noindent Jean-Jacques Nattiez and Isabelle Schulte-Technoff, ``L'etnomusicologia: strutturalismo o culturalismo?,'' \emph{Musica/Realt\`a} 61 (March 2000): 109--131.\end{quotation}
347 %
348 %\subsubsection{Incollection}
349 %For articles in an edited book. For use with \textsc{Bib}\TeX\ cross-reference (\texttt{crossref}) see examples 2ff.
350 %
351 %Omitted fields: \texttt{pages}, \texttt{chapter}, \texttt{note}.
352 %
353 %\noindent\hrulefill\ 1\ \hrulefill
354 %
355 %\begin{verbatim}
356 %@INCOLLECTION{laudan,
357 % title="Explaining the Success of Science\toomit{: Beyond
358 % Epistemic Realism and Relativism}",
359 % author="Larry Laudan",
360 % booktitle="Science and the Quest for Reality",
361 % editor="Alfred I. Tauber",
362 % address="London",
363 % publisher="MacMillan Press Ltd.",
364 % pages="137--161",
365 % year="1997"}
366 %\end{verbatim}
367 %Footnote layout:
368 %\begin{quotation}\small\noindent Larry Laudan, ``Explaining the Success of Science,'' in Alfred I. Tauber (ed.), \emph{Science and the Quest for Reality} (London: MacMillan Press Ltd., 1997).\end{quotation}
369 %
370 %\bigskip\noindent\hrulefill\ 2\ \hrulefill
371 %
372 %Given the following entry:
373 %\begin{verbatim}
374 %@BOOK{grove,
375 % booktitle="Grove Music Online",
376 % editor="L. Macy",
377 % url="http://www.grovemusic.com/"}
378 %\end{verbatim}
379 %another entry can make reference to it:
380 %\begin{verbatim}
381 %@INCOLLECTION{weber,
382 % title="Weber, Gottfried",
383 % author="Janna K. Saslaw",
384 % crossref="grove",
385 % urldate="October 5, 2005"}
386 %\end{verbatim}
387 %Then, citation of the latter in the footnotes will |\cite| the former. The layout of this `nested' |\cite| will depend on the kind of entry it is (usually a book), and might also be \emph{op.~cit.}, if it has already been cited. In this case the result is:
388 %\begin{quotation}\small\noindent Janna K. Saslaw, ``Weber, Gottfried,'' in L. Macy (ed.), \emph{Grove Music Online},
389 %\texttt{http://www.grovemusic.com/} (accessed October 5, 2005).\end{quotation}
390 %
391 %\subsubsection{Inbook}
392 %For individual chapters or articles from books by a single author.
393 %
394 %Omitted fields: \texttt{pages}, \texttt{chapter}, \texttt{note}.
395 %
396 %\noindent\hrulefill\ 1\ \hrulefill
397 %\begin{verbatim}
398 %@INBOOK{stuff,
399 % title="The Stuff of Change",
400 % booktitle="Thought and Change",
401 % pages="126--146",
402 % chapter="6",
403 % crossref="tac"}
404 %\end{verbatim}
405 %This entry makes reference to the first example of \texttt{@BOOK} to create the following footnote:
406 %\begin{quotation}\small\noindent Ernest Gellner, ``The Stuff of Change,'' chapter 6 of \emph{op.~cit.}\end{quotation}
407 %This would work best if the book entry had a field for \texttt{hereafter}, creating something like ``chapter 6 of \emph{Thought and Change}.'' On the other hand, |\with{pages}| adds ``\dots chapter 6 (pages 126--146) of\dots''
408 %
409 %\bigskip\noindent\hrulefill\ 2\ \hrulefill
410 %
411 %\begin{verbatim}
412 %@INBOOK{attemborough,
413 % author="David Attenborough",
414 % title="The Infinite Variety",
415 % type="Episode",
416 % chapter="1",
417 % booktitle="Life on Earth\toomit{ \upshape (videorecording)}",
418 % publisher="BBC",
419 % year="1979"}
420 %\end{verbatim}
421 %Footnote layout:
422 %\begin{quotation}\small\noindent David Attemborough, ``The Infinite Variety,'' episode~1 of \emph{Life on Earth} (BBC, 1979).\end{quotation}
423 %\subsubsection{PHDthesis}
424 %
425 %Omitted fields: \texttt{note}.
426 %
427 %\begin{verbatim}
428 %@PHDTHESIS{saslaw,
429 % author="Janna K. Saslaw",
430 % title="Gottfried Weber and the Concept of Mehrdeutigkeit",
431 % school="Columbia University",
432 % year="1992"}
433 %\end{verbatim}
434 %Footnote layout:
435 %\begin{quotation}\small\noindent Janna K. Saslaw, \emph{Gottfried Weber and the Concept of Mehrdeutigkeit} (Ph.\,D.\ diss.), Columbia University, 1992.\end{quotation}
436 %
437 %\subsubsection{Mastersthesis}
438 %
439 %Analogous to \texttt{phdthesis}, but with `M.\,A. thesis' instead of `Ph.\,D. diss.'
440 %
441 %\subsubsection{Proceedings}
442 %
443 %Essentially equivalent to |@BOOK|. One difference is the possible presence of |organization| (which only gets typeset if |editor| is missing); another is that there is no |edition|.
444 %
445 %\subsubsection{Booklet}
446 %
447 %This entry type behaves exactly as |@BOOK|.
448 %
449 %\subsubsection{Inproceedings}
450 %
451 %|@INPROCEEDINGS| is to |@PROCEEDINGS| what |@INCOLLECTION| is to |@BOOK|: there is no |edition|, and |organization| can replace |editor|. Otherwise the behavior is similar.
452 %
453 %\subsection{Modifying the bibliography style}\label{bsts}
454 %
455 %This section makes explicit the conventions that a \textsc{Bib}\TeX\ style (a \texttt{bst} file) should follow in order to support and be supported by |opcit|.
456 %
457 %The basic form of a |opcit|-supported |\bibitem| is:
458 %
459 %|\bibitem{|\meta{label}|}|
460 %
461 %|\biblastnames{|\meta{last name(s)}|}|
462 %
463 %\meta{\dots additional declarations\dots}
464 %
465 %|\opcitstart |\meta{name(s)}|\bibpunctuation \newblock|
466 %
467 %\meta{remaining info}
468 %
469 %|\opcitends|
470 %
471 %\smallskip
472 %As long as this scheme is strictly followed, |opcit| will run.\footnote{This can be easily achieved in the style by suitably modifying the |{bibstart}| and |{fin.entry}| functions.}
473 %
474 %The style has therefore to have a method of finding out only the last name(s) of author/editor, to be passed to |opcit| as the argument to |\biblastname|. This is independent from the actual formatting of the names (that happens right before the first |\bibpunctuation|).
475 %
476 %Other conventions are probably always needed, but not syntactically required:
477 %\begin{itemize}
478 %\item Instead of periods or commas, the style should append |\bibpunctuation| commands (this command is converted into commas in the footnotes, into periods in the references list).
479 %\item |\bibcase| commands should be added at strategic points (the particle `in' for \texttt{@INCOLLECTION}s, and in general everything that comes after a |\bibpunctuation|).
480 %\item \DescribeMacro{\sameauthors}If the style substitutes a line for repeated author(s)' name(s), |opcit| needs a way to know the `real' author. This is achieved by the style not typesetting the line by itself, but rather appending a |\sameauthors| command (defined by |opcit| as a rule of length |\sameauthorsrule|).
481 %\item \DescribeMacro{\bibhereafter}The style should provide for handling of the |hereafter| field: its contents (if any) should be passed on to |opcit| as the argument to |\bibhereafter|, as part of the \meta{additional declarations}.
482 %\end{itemize}
483 %
484 %Another kind of tools are those that are not hard-wired in |opcit|, but whose use is more or less mandatory with footnote-style referencing. For example, it is customary that the author's name appears, in the footnotes, as first-last name (`Ernest~Gellner'), and as last-first (`Gellner, Ernest') in the final list. This is more a feature of the |bst| than of |opcit| itself, so it is supposed to be implemented there. As a result, it should be implemented in any \textsc{Bib}\TeX\ intended for use with |opcit|.
485 %
486 %This is done by making the |bst| itself define and use its own commands, advisably at the beginning of the |bbl| file, usually in the |{begin.bib}| function.
487 %
488 %Typically, these definitions will make use of |opcit|'s \DescribeMacro{\newBibCommand}|\newBibCommand|:
489 %
490 %|\newBibCommand{|\meta{command name}|}{|\meta{footnote-style}|{|\meta{list-style}|}|
491 %
492 %This means that the new command will expand to the first meaning when encountered in footnotes, and to the second when in the final list. Use of arguments with |\newBibCommand| is surprisingly intuitive, and is illustrated in the items below.
493 %
494 %|opcit.bst| defines five tools in this way:
495 %\begin{itemize}
496 %\item|\bibparenthesis| should parenthesize its argument when in footnotes, but typeset it (after a period) in the final list. This is used for the publisher and the year of books: `(London: Penguin, 1989)' but `. London: Penguin, 1989'. This command is defined with
497 %
498 %\hfill|\newBibCommand{\bibparenthesis[1]}{ (#1)}{. \newblock #1}|.
499 %
500 %Later, the |{make.address.publisher.year}| function of the |bst| makes use of this command.
501 %\item |\newBibCommand{\SwapNames[2]}{#1 #2}{#2, #1}| implements the ordering of names. The author/editor name then is issued as, for example, |\SwapNames{Ernest}{Gellner}|.
502 %\item |\bibincite| and |\bibincitestar| are the commands used by the |bst| file to implement cross references between entries. In their definition, they use internal |opcit| commands. I would recommend to copy them from |opcit.bst|, and in any case simply to \emph{add} stuff to them. Leave the |\recover@last| alone, unless you know what you are doing!
503 %
504 %\item |\GobbleOrNot| is used to gobble (or not) the punctuation mark when a period ends the previous text. For example, the middle initial in `Donald E. Knuth' would clash with |\bibpunctuation| in the final reference list: `Knuth, Donald~E..\ \emph{The \TeX book}.' But the period has to be included in the footnote (Donald E. Knuth, \emph{The \TeX book}'). Similarly, the particle `Ph.\,D.\ diss.' has to gobble the following period in the final list, but not the closing parenthesis in the footnotes. Thus, |\GobbleOrNot| is defined as
505 %
506 %\hfill|\newBibCommand{\GobbleOrNot}{\relax}{\newblock\@gobble}|
507 %\end{itemize}
508 %
509 %\newcommand\bibparenthesis[1]{. \newblock #1}
510 %\newcommand\bibincite[2]{#2}
511 %\newcommand\bibincitestar[2]{#2}
512 %\newcommand\SwapNames[2]{#2, #1}
513 %\newcommand\GobbleOrNot{\newblock\@gobble}
514 %\def\biblastnames#1{}\let\opcitstart\relax\def\bibpunctuation{.}\def\bibcase#1{\uppercase{#1}}\let\toomit\relax
515 %\makeatletter
516 %\renewenvironment{thebibliography}[1]
517 % {\section*{The final list (examples)}
518 % \list{}%
519 % {\setlength\labelwidth{\z@}%
520 % \leftmargin\bibindent
521 % \itemindent -\bibindent
522 % \parsep \z@
523 % \@openbib@code
524 % \usecounter{enumiv}%
525 % \let\p@enumiv\@empty
526 % \renewcommand\theenumiv{\@arabic\c@enumiv}}%
527 % \sloppy
528 % \clubpenalty4000
529 % \@clubpenalty \clubpenalty
530 % \widowpenalty4000%
531 % \sfcode`\.\@m}
532 % {\def\@noitemerr
533 % {\@latex@warning{Empty `thebibliography' environment}}%
534 % \endlist}
535 %\makeatother
536 %\let\opcitend\relax\def\sameauthors{\rule{23pt}{0.4pt}}
537 %\begin{thebibliography}{}\label{examples}
538 %
539 %\bibitem{attemborough}
540 %\biblastnames{Attenborough}
541 %\opcitstart \SwapNames{David}{Attenborough}\bibpunctuation
542 %\newblock ``The Infinite Variety\bibpunctuation''
543 %\newblock \bibcase Episode 1 of {\em Life on Earth\toomit{ \upshape
544 % (videorecording)}}\bibparenthesis{BBC, 1979}\opcitend
545 %
546 %\bibitem{berlinsky}
547 %\biblastnames{Berlinsky}
548 %\opcitstart \SwapNames{David}{Berlinsky}\bibpunctuation
549 %\newblock {\em Newton's Gift\toomit{: How Sir Isaac Newton Unlocked the System
550 % of the World}}\bibparenthesis{New~York and London: Simon {\&} Schuster,
551 % 2000}\opcitend
552 %
553 %\bibitem{stuff}
554 %\biblastnames{Gellner}
555 %\opcitstart \SwapNames{Ernest}{Gellner}\bibpunctuation
556 %\newblock ``The Stuff of Change\bibpunctuation''
557 %\newblock \bibcase chapter 6\toomit[pages]{ (pages 126--146)} of
558 % \bibincitestar{tac}{{\em Thought and Change}}\opcitend
559 %
560 %\bibitem{tac}
561 %\biblastnames{Gellner}
562 %\opcitstart \sameauthors\bibpunctuation
563 %\newblock {\em Thought and Change}\toomit[number]{\bibpunctuation\bibcase
564 % \bibcase number~1 in ``The Nature of Human Society'' Series (ed.\ Julian
565 % Pitt-Rivers and Ernest Gellner) Press}\bibparenthesis{Chicago: University of
566 % Chicago, 1964}\opcitend
567 %
568 %\bibitem{laudan}
569 %\biblastnames{Laudan}
570 %\opcitstart \SwapNames{Larry}{Laudan}\bibpunctuation
571 %\newblock ``Explaining the Success of Science\toomit{: Beyond Epistemic Realism
572 % and Relativism}\bibpunctuation''
573 %\newblock \bibcase in {Alfred~I. Tauber (ed.), {\em Science and the Quest for
574 % Reality}\bibparenthesis{London: MacMillan Press Ltd.,
575 % 1997}}\toomit[pages]{\bibcase : 137--161}\opcitend
576 %
577 %\bibitem{nattiez}
578 %\biblastnames{Nattiez and Schulte-Technoff}
579 %\opcitstart \SwapNames{{Jean-Jacques}}{Nattiez} and Isabelle
580 % Schulte-Technoff\bibpunctuation
581 %\newblock ``L'etnomusicologia: strutturalismo o culturalismo?\toomit{
582 % Intervista con Jean-Jacques Nattiez di Isabelle
583 % Schulte-Technoff}\bibpunctuation''
584 %\newblock {\em Musica/Realt{\`a}} 61 (\toomit[month]{March
585 % }2000)\toomit[pages]{\bibcase : 109--131}\opcitend
586 %
587 %\bibitem{weber}
588 %\biblastnames{Saslaw}
589 %\opcitstart \SwapNames{Janna~K.}{Saslaw}\GobbleOrNot\bibpunctuation
590 %\newblock ``Weber, Gottfried\bibpunctuation''
591 %\newblock \bibcase in \bibincite{grove}{L. Macy (ed.), {\em Grove Music
592 % Online}\bibpunctuation
593 %\newblock \texttt{http://www.grovemusic.com/} (accessed October 5, 2005)}\opcitend
594 %
595 %\bibitem{saslaw}
596 %\biblastnames{Saslaw}
597 %\opcitstart \sameauthors\bibpunctuation
598 %\newblock {\em Gottfried Weber and the Concept of
599 % Mehrdeutigkeit}\bibparenthesis{Ph.\,D.\ diss\GobbleOrNot.}\bibpunctuation
600 %\newblock Columbia University\bibpunctuation
601 %\newblock 1992\opcitend
602 %
603 %\bibitem{sheldon}
604 %\biblastnames{Sheldon}
605 %\opcitstart \SwapNames{David~A.}{Sheldon}\GobbleOrNot\bibpunctuation
606 %\newblock ``The Galant Style Revisited and Re-Evaluated\bibpunctuation''
607 %\newblock {\em Acta Musicologica} 47/2 (1975)\toomit[pages]{\bibcase :
608 % 240--70}\opcitend
609 %
610 %\bibitem{walker}
611 %\biblastnames{Walker}
612 %\opcitstart \SwapNames{Alan}{Walker}\bibpunctuation
613 %\newblock {\em The Final Years
614 % 1861--1886}\toomit[volume]{\bibpunctuation\bibcase \bibcase volume~3 of {\em
615 % Franz Liszt}}\bibparenthesis{New York: Alfred A. Knopf, 1996}\opcitend
616 %
617 %\end{thebibliography}
618 %
619 %\clearpage
620 %\section{Implementation}
621 %
622 %\subsection*{Identification}
623 % \begin{macrocode}
624 %<*package>
625 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
626 \ProvidesPackage{opcit}[2006/09/20 Footnote references (Federico Garcia) Version 2]
627 \RequirePackage{xspace}
628 % \end{macrocode}
629 %
630 %\subsection*{Declarations}
631 % \begin{macrocode}
632 \newif\ifopcit@bbl\opcit@bblfalse
633 \newif\ifopcit@footnote\opcit@footnotefalse
634 \newif\ifperi@d\peri@dfalse
635 \newif\ifhyper@opcit
636 \newif\if@omitting
637 \newif\if@idem
638 \newif\ifcheck@idem
639 \newif\ifcheck@@idem
640 \newif\if@opcit
641 \newif\ifcustom@bst
642 \newcount\@lastcite
643 \newlength{\sameauthorsrule}\setlength{\sameauthorsrule}{23pt}
644 \newtoks\opcit@redefs
645 \newtoks\opcit@defs
646 \newcommand*{\last@cited}{)OpcitFirst(}
647 \newcommand*{\opcittext}{\textit{op.\,cit.}}
648 \newcommand*{\idemtext}{\textit{Idem}}
649 \newcommand*{\sameauthors}{\rule{\sameauthorsrule}{.4pt}}
650 \newcommand*\opcitwarning[1]{\PackageWarning{noopcit option is called for,
651 but `#1' has no hereafter.}}
652 \newcommand*\opcit@noreferror[1]{\PackageError{key `#1' has not been cited.}
653 {\string\bibref can be used only after the first citation of a work.
654 (You might also have mistyped the key.) Go on, but there won't be a
655 cross reference here.}\textbf{??}}
656 \let\@quoteornot\relax
657 % \end{macrocode}
658 %
659 %\subsection*{Options}
660 %
661 % \begin{macrocode}
662 \DeclareOption{hyperref}{\hyper@opcittrue}
663 \DeclareOption{nohyperref}{\hyper@opcitfalse}
664 \DeclareOption{omitting}{\@omittingtrue}
665 \DeclareOption{noomitting}{\@omittingfalse}
666 \DeclareOption{noidem}{\@idemfalse}
667 \DeclareOption{idem}{\@idemtrue}
668 \DeclareOption{checkidem}{\check@idemtrue}
669 \DeclareOption{nocheckidem}{\check@idemfalse}
670 \DeclareOption{opcit}{\@opcittrue}
671 \DeclareOption{noopcit}{\@opcitfalse}
672 \DeclareOption{nocustombst}{\newcommand\opcit@bst{\bibliographystyle{opcit}}}
673 \DeclareOption{custombst}{\let\opcit@bst\relax}
674 \@ifpackageloaded{hyperref}
675 {\ExecuteOptions{omitting,checkidem,nocustombst,idem,opcit,hyperref}}
676 {\ExecuteOptions{omitting,checkidem,nocustombst,idem,opcit}}
677 \ProcessOptions
678 \ifhyper@opcit\RequirePackage{hyperref}\fi
679 \opcit@bst
680 % \end{macrocode}
681 %
682 %\subsection{The macros}
683 %
684 %The basic idea behind the working of |opcit| is that the \texttt{bbl} file produced by \textsc{Bib}\TeX\ is read at the beginning of the document, not to produce the list of references, but to define the (internal) commands that will expand into the footnote references. For example, the entry \texttt{texbook} defines the commands |\@texbook|, |\texbook@star|, |\texbook@author|, and so on. These commands contain the actual text to be written in the footnotes.
685 %
686 %The |\cite| command itself is redefined, based on circumstances, to execute the appropriate control sequence each time. At the beginning, |\cite{texbook}| means basically |\footnote{\@texbook}|. But it also redefines |\@texbook| so that the next time it is used it will expand to `Knuth, \emph{op.~cit.}'
687 %
688 %Before reading the |bbl| file, however, we have to define the `communication commands' that enable the latter to pass information on to |opcit|.
689 %
690 %\subsubsection{Communication commands}
691 %Punctuation marks are to be added only if the last character was not a period, a question or an exclamation mark (which have a |\sfcode| of 2000).
692 %
693 % \begin{macrocode}
694 \newcommand{\newBibCommand}[3]{%
695 \newcommand#1{#2}%
696 \opcit@redefs\expandafter{\the\opcit@redefs%
697 \renewcommand#1{#3}}}
698 \let\opcitstart\relax
699 \newBibCommand{\opcitend}{\relax}{\ifnum\spacefactor=\sfcode`?\else\unskip.\fi}
700 \newBibCommand{\bibpunctuation}{,\xspace}{%
701 \ifnum\spacefactor=\sfcode`?\else\unskip.\fi\xspace}
702 \newBibCommand{\biblastnames[1]}{%
703 \global\@namedef{\@curr@bibitem @authors}{#1}}{\relax}
704 \newBibCommand{\bibhereafter[1]}{%
705 \global\expandafter\edef\csname\@curr@bibitem @hereafter\endcsname{%
706 \ifhyper@opcit
707 \noexpand\hyperlink{\@curr@bibitem @key}{#1}\else#1\fi}}{\relax}
708 \newBibCommand{\bibcase[1]}{\lowercase{#1}}{\uppercase{#1}}
709 \newBibCommand\QuoteOrNot{\gdef\@quoteornot{''\global\let\@quoteornot\relax}}{\relax}
710 % \end{macrocode}
711 %
712 %\subsubsection{Omitting mechanism}
713 %
714 %Here we use a feature of |\@nameuse|: an undefined command called by this method will not be an error, but a |\relax|. Thus, when a |\with{|\meta{field}|}| redefines |\omit@field| to be |\@gobble|, the result of |\toomit| (in the footnotes) will be either |\@gobble\@gobble| or |\relax\@gobble|. In either case, |\with| has to take care of re-omitting (adding its argument to a list, eventually gone over by |\finalize@cite|).
715 % \begin{macrocode}
716 \if@omitting
717 \newBibCommand{\toomit[2][omitted]}{%
718 \@nameuse{omit@#1}\@gobble{#2}}{#2}%
719 \newcommand\with[1]{%
720 \global\expandafter\let\csname omit@#1\endcsname\@gobble
721 \edef\@reomit{\@reomit,#1}}
722 \newcommand\@reomit{omitted}%
723 \else
724 \newcommand\toomit[2][omitted]{#2}
725 \let\with\@gobble
726 \fi
727 % \end{macrocode}
728 %
729 %\subsubsection{Reading the \texttt{bbl}}
730 %
731 %After having set up the communication, the \texttt{bbl} file is read (if it exists). This is done within a group, for |thebibliography| and |\bibitem| are redefined (the former as nothing). At the moment, the communication commands have their `footnote meaning,' the first part of their definition (the second part has been stored in |\opcit@redefs|, to be redeemed later on).
732 %
733 %In |\bibitem|, |#1| is the label for the |\cite| command; |#2| is a series of declarations written out to the |bbl| file by the \textsc{Bib}\TeX\ style (one of them, required, is the command |\biblastnames|, whose argument contains only the last name(s) of the author(s)). |#3| is the full author(s)' name(s), that appears the first time the work is |\cite|'d. Finally, |#4| is the rest of the information for the entry.
734 %
735 % \begin{macrocode}
736 \bgroup
737 \renewcommand{\newBibCommand}[3]{%
738 \newcommand#1{#2}%
739 \global\opcit@defs\expandafter{\the\opcit@defs
740 \newBibCommand{#1}{#2}{#3}}}
741 \renewenvironment{thebibliography}[1]{\relax}{\relax}
742 \def\toomit{\noexpand\toomit}%
743 \def\QuoteOrNot{\noexpand\QuoteOrNot}%
744 \long\def\bibitem#1#2\opcitstart #3\bibpunctuation \newblock#4\opcitend{%
745 \ifx#3\sameauthors\else\def\@lastauthors{#3}\fi
746 \global\expandafter\edef\csname#1@author\endcsname{\@lastauthors}%
747 \global\def\@curr@bibitem{#1}%
748 \global\expandafter\edef\csname #1@first\endcsname{%
749 \noexpand\opcit@noreferror{#1}}%
750 \global\@namedef{#1@star}{%
751 \global\expandafter\edef\csname #1@first\endcsname{\thefootnote}%
752 \ifhyper@opcit\hypertarget{#1@key}{}\fi
753 #4}%
754 \global\def\hereafter{\@nameuse{#1@hereafter}}%
755 \global\expandafter\def\csname @#1\endcsname{%
756 \@nameuse{#1@author}, \@nameuse{#1@star}}%
757 \bibhereafter{\if@opcit\noexpand\opcittext\else\opcitwarning{#1}\fi}%
758 #2}
759 \InputIfFileExists{\jobname.bbl}{\global\opcit@bbltrue}%
760 {\global\opcit@bblfalse\PackageWarningNoLine{opcit}{%
761 No \jobname.bbl file. There will be no footnote references}}
762 \egroup
763 \the\opcit@defs
764 \ifopcit@bbl
765 \renewcommand{\cite}{\@ifstar{\opcit@cite@star}{\opcit@cite}}%
766 \fi
767 % \end{macrocode}
768 %
769 %The last construction ensures that if a |bbl| was not found, \LaTeX\ will still understand |\cite|.
770 %
771 %This reading of the |bbl| happens at the beginning of the job, but it can also happen by the user's request (to reset the cites to the full information), with |\resetcites|. Here goes that. I can't remember why exactly---it has something to do with argument expansion---but this cannot be done by defining a common command for both macros.
772 %
773 % \begin{macrocode}
774 \newcommand*\resetcites{%
775 \bgroup
776 \renewcommand{\newBibCommand}[3]{%
777 \newcommand##1{##2}%
778 \global\opcit@defs\expandafter{\the\opcit@defs
779 \newBibCommand{##1}{##2}{##3}}}
780 \renewenvironment{thebibliography}[1]{\relax}{\relax}
781 \def\toomit{\noexpand\toomit}%
782 \def\QuoteOrNot{\noexpand\QuoteOrNot}%
783 \long\def\bibitem##1##2\opcitstart ##3\bibpunctuation \newblock##4\opcitend{%
784 \ifx##3\sameauthors\else\def\@lastauthors{##3}\fi
785 \global\expandafter\edef\csname##1@author\endcsname{\@lastauthors}%
786 \global\def\@curr@bibitem{##1}%
787 \global\expandafter\edef\csname ##1@first\endcsname{%
788 \noexpand\opcit@noreferror{##1}}%
789 \global\@namedef{##1@star}{%
790 \global\expandafter\edef\csname ##1@first\endcsname{\thefootnote}%
791 \ifhyper@opcit\hypertarget{##1@key}{}\fi
792 ##4}%
793 \global\def\hereafter{\@nameuse{##1@hereafter}}%
794 \global\expandafter\def\csname @##1\endcsname{%
795 \@nameuse{##1@author}, \@nameuse{##1@star}}%
796 \bibhereafter{\if@opcit\noexpand\opcittext\else\opcitwarning{##1}\fi}%
797 ##2}
798 \let\newcommand\renewcommand
799 \InputIfFileExists{\jobname.bbl}{\global\opcit@bbltrue}%
800 {\global\opcit@bblfalse\PackageWarningNoLine{opcit}{%
801 No \jobname.bbl file. There will be no footnote references}}
802 \egroup}
803 % \end{macrocode}
804 %
805 %\subsubsection{The \cs{cite}s}
806 %
807 %When |opcit| reads the |bbl| file, a series of commands are defined for each bibliographical entry. The most important are (for the entry |foo|):
808 %
809 %\begin{itemize}
810 %\item|\foo@author| has the full author name(s). It is used only the first time |foo| is |\cite|'d.
811 %\item|\foo@authors| contains the last name(s), to be used in post-citations.
812 %\item|\foo@star| contains the rest of the information for the entry. (The name of this command responds to |\cite*| being a |\cite| without author.)
813 %\item|\foo@hereafter| equals |\opcittext| by default, but is changed by a |\bibhereafter| in the |bbl| file.
814 %\item|\@foo| expands initially to |\foo@author, \foo@star|---i.e., authors (full name) followed by info.
815 %\end{itemize}
816 %
817 %This information is used by |\cite| and |\cite*| (redefined earlier as |\opcit@cite|). Before expanding into the actual information, they check if they appear in a footnote.\footnote{This requires the document class to set \cs{interfootnotelinepenalty} different from \cs{interlinepenalty}.} If not, they call a |\footnote|, appending a period at the end if necessary. Then, |\cite| calls |\@foo|, while |\cite*| calls |\foo@star|.
818 %
819 %Then they call the redefinition routine |\renew@cites| (section~\ref{renew}). The main task of this latter is to substitute |\foo@authors| (only last names) for the original |\foo@author| (full names), and redefine |\foo@star| (which was the rest of the information) as |\foo@hereafter| (which is either |\opcittext| or the user's |hereafter| field). (However, this simple main task is obscured in the code by the \emph{Idem} mechanism.)
820 %
821 % \begin{macrocode}
822 \newcommand{\opcit@cite}[2][\@empty]{\nocite{#2}%
823 \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue
824 \else\opcit@footnotefalse\expandafter\footnote\fi
825 {\@nameuse{@#2}%
826 \check@for@period{\@nameuse{@#2}}%
827 \finalize@cite{#1}{#2}}}
828 \newcommand{\opcit@cite@star}[2][\@empty]{\nocite{#2}%
829 \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue
830 \else\opcit@footnotefalse\expandafter\footnote\fi
831 {\@nameuse{#2@star}%
832 \check@for@period{\@nameuse{#2@star}}%
833 \finalize@cite{#1}{#2}}}
834 \newcommand\finalize@cite[2]{%
835 \global\@lastcite=\c@footnote\relax
836 \ifx\@empty#1\else
837 \ifcheck@@idem
838 \check@for@period{\idemtext}%
839 \def\this@opt{#1}%
840 \ifx\last@opt\this@opt\else
841 \check@for@period{#1},\@quoteornot\ #1%
842 \fi
843 \else\check@for@period{#1},\@quoteornot\ #1%
844 \fi
845 \fi
846 \ifopcit@footnote\peri@dtrue\fi
847 \ifperi@d\else.\@quoteornot\fi
848 \global\def\last@opt{#1}%
849 \check@@idemfalse
850 \if@omitting
851 \@for\@tempcsa :=\@reomit \do
852 {\global\expandafter\let\csname omit@\@tempcsa\endcsname\relax}%
853 \global\def\@reomit{omitted}%
854 \fi
855 \renew@cites{#2}%
856 }
857 % \end{macrocode}
858 %
859 %The first lines of |\finalize@cite| are part of the mechanism to catch identical optional arguments to two |\cites| in a row. It is a function whose methods are scattered here and there in the code, but it is simple enough if anyone ever needs to follow it.
860 %
861 %\subsubsection{Redefinition routine}\label{renew}
862 %
863 % The redefinition routine is in charge of catching two identical |\cite|'s in a row, in which case it typesets |\idemtext|. But the main task is to reduce |\foo@star| (the information other than author of the entry |foo|) to |\foo@hereafter|.
864 %
865 % \begin{macrocode}
866 \newcommand{\renew@cites}[1]{%
867 \recover@last%
868 \global\def\last@cited{#1}%
869 \cited{#1}%
870 \ifopcit@footnote\else\if@idem
871 \global\@namedef{@#1}{\@idem{@#1}}%
872 \global\@namedef{#1@star}{\@idem{@#1}}%
873 \fi\fi
874 \global\def\hereafter{\textit{\@nameuse{#1@hereafter}}}}%
875 \newcommand*\cited[1]{\@for\@tempcsa :=#1 \do{%
876 \global\@namedef{@#1}{\@nameuse{#1@authors},~\@nameuse{#1@hereafter}}%
877 \global\@namedef{#1@star}{\@nameuse{#1@hereafter}}}}%
878 \newcommand\recover@last{%
879 \global\expandafter\edef\csname @\last@cited\endcsname{%
880 \noexpand\@nameuse{\last@cited @authors},%
881 ~{\noexpand\@nameuse{\last@cited @hereafter}}}%
882 \global\expandafter\edef\csname\last@cited @star\endcsname{%
883 {\noexpand\@nameuse{\last@cited @hereafter}}}%
884 }
885 \newcommand\@idem[1]{\advance\@lastcite1\relax
886 \ifnum\@lastcite=\c@footnote
887 \idemtext\ifcheck@idem\check@@idemtrue\fi
888 \else
889 \check@@idemfalse\recover@last\@nameuse{#1}%
890 \fi}
891 % \end{macrocode}
892 %
893 %\subsection*{Additional functions and user commands}
894 %
895 % \begin{macrocode}
896 \def\check@for@period#1{{\normalsfcodes\setbox0\hbox{#1%
897 \ifnum\spacefactor=\sfcode`.\global\peri@dtrue\else
898 \global\peri@dfalse\fi}}}
899 \ifhyper@opcit
900 \newcommand*\bibref[1]{\hyperlink{#1@key}{\@nameuse{#1@first}}}
901 \else
902 \newcommand*\bibref[1]{\@nameuse{#1@first}}
903 \fi
904 \newcommand\nobibliography[1]{\if@filesw
905 \immediate\write\@auxout{\string\bibdata{#1}}\fi
906 \if@omitting\PackageWarningNoLine{opcit}{No final references list,
907 there might be information within \string\toomit\space commands that will be lost}\fi}
908 \let\opcit@bibliography\bibliography
909 \renewcommand{\bibliography}{%
910 \renewcommand\newBibCommand[3]{\relax}%
911 \the\opcit@redefs\opcit@bibliography}
912 \newcommand{\thebib@renew}{}
913 \@ifundefined{chapter}{%
914 \renewcommand{\thebib@renew}{\section*{\refname}\@mkboth{\refname}{\refname}}}{%
915 \renewcommand{\thebib@renew}{\chapter*{\bibname}\@mkboth{\bibname}{\bibname}}}%
916 \renewenvironment{thebibliography}[1]
917 {\thebib@renew%
918 \the\opcit@redefs%
919 \list{}%
920 {\setlength\labelwidth{\z@}%
921 \leftmargin\bibindent
922 \itemindent -\bibindent
923 \parsep \z@
924 \@openbib@code
925 \usecounter{enumiv}%
926 \let\p@enumiv\@empty
927 \renewcommand\theenumiv{\@arabic\c@enumiv}}%
928 \sloppy
929 \clubpenalty4000
930 \@clubpenalty \clubpenalty
931 \widowpenalty4000%
932 \sfcode`\.\@m}
933 {\def\@noitemerr
934 {\@latex@warning{Empty `thebibliography' environment}}%
935 \endlist}
936 % \end{macrocode}
937 %</package>
938 %\section{The \texttt{opcit.bst} bibliography style}
939 %
940 %I have had no time to fully document this bibliography style, or even to purify it and make it most economical\dots
941 % \begin{macrocode}
942 %<*bst>
943 ENTRY
944 { address
945 author
946 booktitle
947 chapter
948 edition
949 editor
950 hereafter
951 howpublished
952 institution
953 journal
954 key
955 month
956 note
957 number
958 organization
959 pages
960 publisher
961 school
962 series
963 title
964 type
965 url
966 urldate
967 volume
968 year
969 }
970 {}
971 { label }
972
973 INTEGERS { output.state before.all mid.sentence after.sentence
974 after.block quoted.state period.state }
975
976 STRINGS { s t last.authors quotes }
977
978 FUNCTION {init.state.consts}
979 { #0 'period.state :=
980 #0 'before.all :=
981 "" 'last.authors :=
982 "" 'quotes :=
983 }
984
985 FUNCTION {new.block}
986 { output.state before.all =
987 'skip$
988 { after.block 'output.state := }
989 if$
990 }
991 FUNCTION {not}
992 { { #0 }
993 { #1 }
994 if$
995 }
996
997 FUNCTION {and}
998 { 'skip$
999 { pop$ #0 }
1000 if$
1001 }
1002
1003 FUNCTION {or}
1004 { { pop$ #1 }
1005 'skip$
1006 if$
1007 }
1008
1009 FUNCTION {field.or.null}
1010 { duplicate$ empty$
1011 { pop$ "" }
1012 'skip$
1013 if$
1014 }
1015
1016 FUNCTION {emphasize}
1017 { duplicate$ empty$
1018 { pop$ "" }
1019 { "{\em " swap$ * "}" * }
1020 if$
1021 }
1022
1023 INTEGERS { nameptr namesleft numnames }
1024
1025 FUNCTION{format.names}
1026 { 's :=
1027 #1 'nameptr :=
1028 s num.names$ 'numnames :=
1029 numnames 'namesleft :=
1030 { namesleft #0 > }
1031 { s nameptr "{ff }{vv~}{ll}{,~jj}" format.name$ 't :=
1032 nameptr #1 >
1033 { namesleft #1 >
1034 { ", " * t * }
1035 { numnames #2 >
1036 { "," * }
1037 'skip$
1038 if$
1039 t "others" =
1040 { " et~al." * }
1041 { " and " * t * }
1042 if$
1043 }
1044 if$
1045 }
1046 't
1047 if$
1048 nameptr #1 + 'nameptr :=
1049 namesleft #1 - 'namesleft :=
1050 }
1051 while$
1052 }
1053
1054 FUNCTION {format.swap.names}
1055 { 's :=
1056 s num.names$ 'numnames :=
1057 "\SwapNames{" s #1 "{ff}" format.name$
1058 duplicate$ #-1 #1 substring$
1059 "." =
1060 { #1 'period.state := }
1061 'skip$
1062 if$
1063 * "}{" *
1064 s #1 "{vv~}{ll}" format.name$ * "}" *
1065 s #1 "{, jj}" format.name$ *
1066 numnames #3 >
1067 { " et~al." * #1 'period.state := }
1068 { numnames #1 >
1069 { #2 'nameptr :=
1070 numnames #1 - 'namesleft :=
1071 { namesleft #0 > }
1072 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
1073 namesleft #1 >
1074 { ", " * t * }
1075 { " and " * t * }
1076 if$
1077 nameptr #1 + 'nameptr :=
1078 namesleft #1 - 'namesleft :=
1079 }
1080 while$
1081 }
1082 'skip$
1083 if$
1084 }
1085 if$
1086 }
1087
1088 FUNCTION {format.authors}
1089 { author empty$
1090 { ""
1091 "" 'last.authors :=
1092 }
1093 { author format.names
1094 last.authors =
1095 { "\sameauthors" }
1096 { before.all output.state =
1097 { author format.swap.names }
1098 { author format.names }
1099 if$ }
1100 if$
1101 author format.names 'last.authors :=
1102 }
1103 if$
1104 }
1105
1106 FUNCTION {format.editors}
1107 { editor empty$
1108 { "" }
1109 { before.all output.state =
1110 { editor format.swap.names }
1111 { editor format.names }
1112 if$
1113 }
1114 if$
1115 }
1116
1117 FUNCTION {format.editors.ed}
1118 { editor empty$
1119 { "" }
1120 { before.all output.state =
1121 { editor format.swap.names }
1122 { editor format.names }
1123 if$
1124 editor num.names$ #1 >
1125 { " (eds.)" * }
1126 { " (ed.)" * }
1127 if$
1128 #0 'period.state :=
1129 }
1130 if$
1131 }
1132
1133 FUNCTION {n.dashify}
1134 { 't :=
1135 ""
1136 { t empty$ not }
1137 { t #1 #1 substring$ "-" =
1138 { t #1 #2 substring$ "--" = not
1139 { "--" *
1140 t #2 global.max$ substring$ 't :=
1141 }
1142 { { t #1 #1 substring$ "-" = }
1143 { "-" *
1144 t #2 global.max$ substring$ 't :=
1145 }
1146 while$
1147 }
1148 if$
1149 }
1150 { t #1 #1 substring$ *
1151 t #2 global.max$ substring$ 't :=
1152 }
1153 if$
1154 }
1155 while$
1156 }
1157
1158 FUNCTION {format.date}
1159 { year empty$
1160 { month empty$
1161 { "" }
1162 { "there's a month but no year in " cite$ * warning$
1163 "\toomit[month]{" month * " }" *
1164 }
1165 if$
1166 }
1167 { month empty$
1168 'year
1169 { "\toomit[month]{" month * " }" * year * }
1170 if$
1171 }
1172 if$
1173 }
1174
1175 FUNCTION {tie.or.space.connect}
1176 { duplicate$ text.length$ #3 <
1177 { "~" }
1178 { " " }
1179 if$
1180 swap$ * *
1181 }
1182
1183 FUNCTION{either.warning}
1184 { empty$
1185 'pop$
1186 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
1187 if$
1188 }
1189 FUNCTION {format.bvolume}
1190 { volume empty$
1191 { "" }
1192 { "\bibcase volume" volume tie.or.space.connect
1193 series empty$
1194 'skip$
1195 { " of " * series emphasize * }
1196 if$
1197 "volume and number" number either.warning
1198 }
1199 if$
1200 }
1201
1202 FUNCTION {format.number.series}
1203 { volume empty$
1204 { number empty$
1205 { series empty$
1206 { "" }
1207 { ", series " * series * "" }
1208 if$
1209 }
1210 { "\bibcase number"
1211 number tie.or.space.connect
1212 series empty$
1213 { "there's a number but no series in " cite$ * warning$ }
1214 { " in " * series * }
1215 if$
1216 }
1217 if$
1218 }
1219 { "" }
1220 if$
1221 }
1222
1223 INTEGERS { multiresult}
1224
1225 FUNCTION {multi.page.check}
1226 { 't :=
1227 #0 'multiresult :=
1228 { multiresult not
1229 t empty$ not
1230 and
1231 }
1232 { t #1 #1 substring$
1233 duplicate$ "-" =
1234 swap$ duplicate$ "," =
1235 swap$ "+" =
1236 or or
1237 { #1 'multiresult := }
1238 { t #2 global.max$ substring$ 't := }
1239 if$
1240 }
1241 while$
1242 multiresult
1243 }
1244
1245 FUNCTION {format.pages}
1246 { pages empty$
1247 { "" }
1248 { pages multi.page.check
1249 { "\toomit[pages]{\bibcase " swap$ * pages n.dashify tie.or.space.connect "}" * }
1250 { "\toomit[pages]{\bibcase " swap$ * pages tie.or.space.connect "}" * }
1251 if$
1252 }
1253 if$
1254 }
1255
1256 FUNCTION {format.vol.num.date.pages}
1257 { volume empty$
1258 'skip$
1259 { volume }
1260 if$
1261 number empty$
1262 'skip$
1263 { "/" number *
1264 volume empty$
1265 { "there's a number but no volume in " cite$ * warning$ }
1266 { * }
1267 if$
1268 }
1269 if$
1270 " (" * format.date * ")" *
1271 pages empty$
1272 'skip$
1273 { duplicate$ empty$
1274 { pop$ "" format.pages * }
1275 { ": " format.pages * }
1276 if$
1277 }
1278 if$
1279 }
1280
1281 FUNCTION {format.chapter.pages}
1282 { chapter empty$
1283 { pages empty$
1284 { "" }
1285 { ": " format.pages }
1286 if$
1287 }
1288 { "\newblock\bibpunctuation "
1289 type empty$
1290 { "\bibcase chapter" * }
1291 { type "l" change.case$ * }
1292 if$
1293 chapter tie.or.space.connect
1294 pages empty$
1295 'skip$
1296 { ", pages " * format.pages * }
1297 if$
1298 }
1299 if$
1300 }
1301
1302 FUNCTION{get.lastnames}
1303 { 's :=
1304 s num.names$ 'numnames :=
1305 s #1 "{vv~}{ll}" format.name$
1306 numnames #3 >
1307 { " et~al." * }
1308 { numnames #1 >
1309 { #2 'nameptr :=
1310 numnames #1 - 'namesleft :=
1311 { namesleft #0 > }
1312 { s nameptr "{vv~}{ll}" format.name$ 't :=
1313 namesleft #1 >
1314 { ", " * t * }
1315 { " and " * t * }
1316 if$
1317 nameptr #1 + 'nameptr :=
1318 namesleft #1 - 'namesleft :=
1319 }
1320 while$
1321 }
1322 'skip$
1323 if$
1324 }
1325 if$
1326 }
1327
1328 FUNCTION {make.address.publisher.year}
1329 { ""
1330 address empty$
1331 'skip$
1332 { address * }
1333 if$
1334 publisher empty$
1335 'skip$
1336 { address empty$
1337 { publisher * }
1338 { ": " * publisher * }
1339 if$
1340 }
1341 if$
1342 format.date duplicate$ "" =
1343 'pop$
1344 { swap$ duplicate$ "" =
1345 { * }
1346 { swap$ ", " swap$ * * }
1347 if$}
1348 if$
1349 duplicate$ "" =
1350 'skip$
1351 { "\bibparenthesis{" swap$ * "}" * }
1352 if$
1353 }
1354
1355 FUNCTION {make.url}
1356 { "\url{" url * "}" *
1357 urldate empty$
1358 { "there is url but no urldate in " cite$ * warning$ }
1359 { " (accessed " * urldate * ")" * }
1360 if$
1361 }
1362
1363 FUNCTION {output.bibitem}
1364 { newline$
1365 "\bibitem{" write$
1366 cite$ "}" * write$
1367 ""
1368 newline$
1369 "\biblastnames{" write$
1370 author empty$
1371 { editor empty$
1372 { organization empty$
1373 { "no last names in " cite$ * warning$ }
1374 { organization }
1375 if$
1376 }
1377 { editor get.lastnames
1378 editor num.names$ #1 >
1379 { " (eds.)" * }
1380 { " (ed.)" * }
1381 if$
1382 }
1383 if$
1384 }
1385 { author get.lastnames }
1386 if$
1387 "}" * write$
1388 before.all 'output.state :=
1389 }
1390
1391 FUNCTION{output.start}
1392 { hereafter empty$
1393 'skip$
1394 { "\bibhereafter{{\noexpand\em " write$ hereafter "}}" * write$ }
1395 if$
1396 newline$
1397 "\opcitstart " write$
1398 }
1399
1400 FUNCTION{output.as.block}
1401 { duplicate$ "" =
1402 'pop$
1403 { period.state #1 =
1404 { "\GobbleOrNot" #0 'period.state := }
1405 { "" }
1406 if$
1407 "\bibpunctuation" * quotes * write$ newline$ "\newblock " swap$ * write$
1408 #1 'output.state :=
1409 }
1410 if$
1411 "" 'quotes :=
1412 }
1413
1414 FUNCTION{output.omitted}
1415 { 't :=
1416 duplicate$ "" =
1417 { pop$ }
1418 { "\toomit[" t * "]{\bibpunctuation\bibcase " * swap$ * "}" * write$ }
1419 if$
1420 }
1421
1422 FUNCTION {fin.entry}
1423 { write$
1424 note empty$ {""} {note} if$ "note" output.omitted
1425 "\opcitend" write$
1426 newline$
1427 }
1428
1429 FUNCTION{empty.warning}
1430 { 't :=
1431 duplicate$ empty$
1432 { pop$ "empty " t * " in " * cite$ * warning$ ""}
1433 'skip$
1434 if$
1435 }
1436
1437 FUNCTION{empty.chapter.and.pages.warning}
1438 { 't :=
1439 chapter empty$
1440 { pages empty$
1441 { pop$ "empty " t * " in " * cite$ * warning$ "" }
1442 'skip$
1443 if$
1444 }
1445 'skip$
1446 if$
1447
1448 }
1449
1450 FUNCTION{book}
1451 { output.bibitem
1452 output.start
1453 author empty$
1454 { format.editors.ed "author and editor" empty.warning write$ }
1455 { format.authors "author and editor" editor either.warning write$ }
1456 if$
1457 title emphasize "title" empty.warning output.as.block
1458 edition empty$
1459 'skip$
1460 { "\bibcase " edition * " edition" * output.as.block }
1461 if$
1462 howpublished missing$
1463 'skip$
1464 { "\bibcase " howpublished * output.as.block }
1465 if$
1466 format.bvolume "volume" output.omitted
1467 format.number.series "number" output.omitted
1468 make.address.publisher.year write$
1469 url empty$
1470 'skip$
1471 { make.url output.as.block }
1472 if$
1473 fin.entry
1474 }
1475
1476 FUNCTION{article}
1477 { output.bibitem
1478 output.start
1479 format.authors "author" empty.warning write$
1480 "``" title * "title" empty.warning output.as.block "''" 'quotes :=
1481 howpublished empty$
1482 'skip$
1483 { "\bibpunctuation'' \newblock\toomit[howpublished]{\bibcase
1484 " howpublished * write$
1485 "}" 'quotes :=
1486 }
1487 if$
1488 journal emphasize "journal" empty.warning
1489 " " * format.vol.num.date.pages "year" empty.warning * output.as.block
1490 url empty$
1491 'skip$
1492 { make.url output.as.block }
1493 if$
1494 fin.entry
1495 }
1496
1497 FUNCTION {incollection}
1498 { output.bibitem
1499 output.start
1500 format.authors "author" empty.warning write$
1501 "``" title * "title" empty.warning output.as.block "''" 'quotes :=
1502 "\bibcase in " output.as.block
1503 crossref empty$
1504 'skip$
1505 { "\bibincite{" crossref * "}" * write$ }
1506 if$
1507 "{" write$
1508 editor empty$
1509 'skip$
1510 { format.editors.ed ", " * write$ }
1511 if$
1512 booktitle emphasize "booktitle" empty.warning write$
1513 edition empty$
1514 'skip$
1515 { "\bibcase " edition * " edition" * output.as.block }
1516 if$
1517 make.address.publisher.year write$
1518 url empty$
1519 'skip$
1520 { make.url output.as.block }
1521 if$
1522 "}" write$
1523 format.chapter.pages write$
1524 fin.entry
1525 }
1526
1527 FUNCTION {inbook}
1528 { output.bibitem
1529 output.start
1530 author empty$
1531 { format.editors.ed "author and editor" empty.warning write$ }
1532 { format.authors "author and editor" editor either.warning write$ }
1533 if$
1534 "``" title * "title" empty.warning output.as.block "''" 'quotes :=
1535 chapter empty$
1536 'skip$
1537 { type empty$
1538 { "\bibcase chapter " chapter * }
1539 { "\bibcase " type * " " * chapter * }
1540 if$
1541 }
1542 if$
1543 pages empty$
1544 'skip$
1545 { chapter empty$
1546 { "\bibcase pages" pages n.dashify tie.or.space.connect }
1547 { "\toomit[pages]{ (pages" * pages n.dashify tie.or.space.connect ")}" * }
1548 if$
1549 }
1550 if$
1551 "chapter and pages" empty.warning
1552 " of " *
1553 crossref empty$
1554 { booktitle emphasize * "booktitle" empty.warning
1555 edition empty$
1556 'skip$
1557 { ", " * edition "l" change.case$ * " edition" * }
1558 if$
1559 howpublished missing$
1560 'skip$
1561 { ", " * howpublished * }
1562 if$
1563 output.as.block
1564 make.address.publisher.year write$
1565 }
1566 { "\bibincitestar{" * crossref * "}{" * booktitle emphasize * "}" * output.as.block }
1567 if$
1568 fin.entry
1569 }
1570
1571 FUNCTION{phdthesis}
1572 { output.bibitem
1573 output.start
1574 format.authors "author" empty.warning write$
1575 title emphasize "title" empty.warning
1576 "\bibparenthesis{Ph.\,D.\ diss\GobbleOrNot.}" * output.as.block
1577 address empty$
1578 { "" }
1579 { address ": " * }
1580 if$
1581 school "school" empty.warning * output.as.block
1582 month empty$
1583 { "" }
1584 { month " " * }
1585 if$
1586 year "year" empty.warning * output.as.block
1587 fin.entry
1588 }
1589
1590 FUNCTION{mastersthesis}
1591 { output.bibitem
1592 output.start
1593 format.authors "author" empty.warning write$
1594 title emphasize "title" empty.warning
1595 "\bibparenthesis{M.\,A.\ thesis}" * output.as.block
1596 address empty$
1597 { "" }
1598 { address ": " * }
1599 if$
1600 school "school" empty.warning * output.as.block
1601 month empty$
1602 { "" }
1603 { month " " * }
1604 if$
1605 year "year" empty.warning * output.as.block
1606 fin.entry
1607 }
1608
1609 FUNCTION{proceedings}
1610 { output.bibitem
1611 output.start
1612 editor empty$
1613 { organization "editor and organization" empty.warning write$ }
1614 { format.editors.ed "editor" empty.warning write$ }
1615 if$
1616 title emphasize "title" empty.warning output.as.block
1617 format.bvolume "volume" output.omitted
1618 format.number.series "number" output.omitted
1619 make.address.publisher.year write$
1620 fin.entry
1621 }
1622
1623 FUNCTION {booklet}
1624 { book }
1625
1626 FUNCTION {inproceedings}
1627 { output.bibitem
1628 output.start
1629 format.authors "author" empty.warning write$
1630 "``" title * "title" empty.warning output.as.block "''" 'quotes :=
1631 "\bibcase in " output.as.block
1632 crossref empty$
1633 'skip$
1634 { "\bibincite{" crossref * "}" * write$ }
1635 if$
1636 "{" booktitle emphasize * "booktitle" empty.warning write$
1637 editor empty$
1638 { organization "editor and organization" empty.warning output.as.block }
1639 { ", edited by " format.editors * write$ }
1640 if$
1641 make.address.publisher.year write$
1642 "}" write$
1643 format.chapter.pages write$
1644 fin.entry
1645 }
1646
1647
1648 FUNCTION {misc}
1649 { output.bibitem
1650 output.start
1651 format.authors "author" empty.warning write$
1652 title output.as.block
1653 howpublished missing$
1654 'skip$
1655 { howpublished output.as.block }
1656 if$
1657 format.date output.as.block
1658 fin.entry
1659 }
1660
1661 FUNCTION {default.type} { misc }
1662
1663 MACRO {jan} {"January"}
1664
1665 MACRO {feb} {"February"}
1666
1667 MACRO {mar} {"March"}
1668
1669 MACRO {apr} {"April"}
1670
1671 MACRO {may} {"May"}
1672
1673 MACRO {jun} {"June"}
1674
1675 MACRO {jul} {"July"}
1676
1677 MACRO {aug} {"August"}
1678
1679 MACRO {sep} {"September"}
1680
1681 MACRO {oct} {"October"}
1682
1683 MACRO {nov} {"November"}
1684
1685 MACRO {dec} {"December"}
1686
1687 MACRO {acmcs} {"ACM Computing Surveys"}
1688
1689 MACRO {acta} {"Acta Informatica"}
1690
1691 MACRO {cacm} {"Communications of the ACM"}
1692
1693 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1694
1695 MACRO {ibmsj} {"IBM Systems Journal"}
1696
1697 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1698
1699 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1700
1701 MACRO {ieeetcad}
1702 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1703
1704 MACRO {ipl} {"Information Processing Letters"}
1705
1706 MACRO {jacm} {"Journal of the ACM"}
1707
1708 MACRO {jcss} {"Journal of Computer and System Sciences"}
1709
1710 MACRO {scp} {"Science of Computer Programming"}
1711
1712 MACRO {sicomp} {"SIAM Journal on Computing"}
1713
1714 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1715
1716 MACRO {tods} {"ACM Transactions on Database Systems"}
1717
1718 MACRO {tog} {"ACM Transactions on Graphics"}
1719
1720 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1721
1722 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1723
1724 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1725
1726 MACRO {tcs} {"Theoretical Computer Science"}
1727
1728 READ
1729
1730 FUNCTION {sortify}
1731 { purify$
1732 "l" change.case$
1733 }
1734
1735 INTEGERS { len }
1736
1737 FUNCTION {chop.word}
1738 { 's :=
1739 'len :=
1740 s #1 len substring$ =
1741 { s len #1 + global.max$ substring$ }
1742 's
1743 if$
1744 }
1745
1746 FUNCTION {sort.format.names}
1747 { 's :=
1748 #1 'nameptr :=
1749 ""
1750 s num.names$ 'numnames :=
1751 numnames 'namesleft :=
1752 { namesleft #0 > }
1753 { nameptr #1 >
1754 { " " * }
1755 'skip$
1756 if$
1757 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1758 nameptr numnames = t "others" = and
1759 { "et al" * }
1760 { t sortify * }
1761 if$
1762 nameptr #1 + 'nameptr :=
1763 namesleft #1 - 'namesleft :=
1764 }
1765 while$
1766 }
1767
1768 FUNCTION {sort.format.title}
1769 { 't :=
1770 "A " #2
1771 "An " #3
1772 "The " #4 t chop.word
1773 chop.word
1774 chop.word
1775 sortify
1776 #1 global.max$ substring$
1777 }
1778
1779 FUNCTION {author.sort}
1780 { author empty$
1781 { key empty$
1782 { "to sort, need author or key in " cite$ * warning$
1783 ""
1784 }
1785 { key sortify }
1786 if$
1787 }
1788 { author sort.format.names }
1789 if$
1790 }
1791
1792 FUNCTION {author.editor.sort}
1793 { author empty$
1794 { editor empty$
1795 { key empty$
1796 { "to sort, need author, editor, or key in " cite$ * warning$
1797 ""
1798 }
1799 { key sortify }
1800 if$
1801 }
1802 { editor sort.format.names }
1803 if$
1804 }
1805 { author sort.format.names }
1806 if$
1807 }
1808
1809 FUNCTION {author.organization.sort}
1810 { author empty$
1811 { organization empty$
1812 { key empty$
1813 { "to sort, need author, organization, or key in " cite$ * warning$
1814 ""
1815 }
1816 { key sortify }
1817 if$
1818 }
1819 { "The " #4 organization chop.word sortify }
1820 if$
1821 }
1822 { author sort.format.names }
1823 if$
1824 }
1825
1826 FUNCTION {editor.organization.sort}
1827 { editor empty$
1828 { organization empty$
1829 { key empty$
1830 { "to sort, need editor, organization, or key in " cite$ * warning$
1831 ""
1832 }
1833 { key sortify }
1834 if$
1835 }
1836 { "The " #4 organization chop.word sortify }
1837 if$
1838 }
1839 { editor sort.format.names }
1840 if$
1841 }
1842
1843 FUNCTION {presort}
1844 { type$ "book" =
1845 type$ "inbook" =
1846 or
1847 'author.editor.sort
1848 { type$ "proceedings" =
1849 'editor.organization.sort
1850 { type$ "manual" =
1851 'author.organization.sort
1852 'author.sort
1853 if$
1854 }
1855 if$
1856 }
1857 if$
1858 " "
1859 *
1860 year field.or.null sortify
1861 *
1862 " "
1863 *
1864 title field.or.null
1865 sort.format.title
1866 *
1867 #1 entry.max$ substring$
1868 'sort.key$ :=
1869 }
1870 FUNCTION {begin.bib}
1871 { preamble$ empty$
1872 'skip$
1873 { preamble$ write$ newline$ }
1874 if$
1875 "\newBibCommand{\bibparenthesis[1]}{ (#1)}{. \newblock #1}" write$ newline$
1876 "\newBibCommand{\bibincite[2]}{\recover@last\@nameuse{@#1}}{#2}" write$ newline$
1877 "\newBibCommand{\bibincitestar[2]}{\recover@last " write$ newline$
1878 " \@nameuse{#1@star}}{#2}" write$ newline$
1879 "\newBibCommand{\SwapNames[2]}{#1 #2}{#2, #1}" write$ newline$
1880 "\newBibCommand{\GobbleOrNot}{\relax}{\newblock\@gobble}" write$ newline$
1881 "\begin{thebibliography}{}" write$ newline$
1882 }
1883 ITERATE {presort}
1884
1885 SORT
1886
1887 EXECUTE {begin.bib}
1888
1889 EXECUTE {init.state.consts}
1890
1891 ITERATE {call.type$}
1892
1893 FUNCTION {end.bib}
1894 { newline$
1895 "\end{thebibliography}" write$ newline$
1896 }
1897
1898 EXECUTE {end.bib}
1899 %</bst>
1900 % \end{macrocode}