3 \ifcat a\noexpand @\let\next\relax\else \def\next{%
4 \documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
5 \NeedsTeXFormat{LaTeX2e}
6 \def\filename{kluref.sty}
7 \def\filedate{1998/03/17}
8 %\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi}
9 %\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname}
10 %\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\refstepcounter}
11 %\DoNotIndex{\normalsize,\numberline,\protect,\endinput}
12 %\changes{1998/03/17}{TH: Fixed optional argument to cite for numreferences}
13 %\changes{1997/02/18}{TH: Toggled lines for cite definition and citation write (3x)}
19 %\addtolength{\textwidth}{4pc}
26 %\author{Kluwer Academic Publishers\surname{}}
29 %This internal stylefile provides commands for references. Options are
30 %|openbib|, |numreferences| and |namedreferences|. This documentation
31 %is compiled on |kluwer.cls| to give some examples.
37 % This file provides |namedreferences| and |numreferences| options
38 % for the stylefiles. |namedreferences| use the syntax that is
39 % explained in the |named.sty| package, but will be repeated
40 % below. |numreferences| we wrote ourselves, the major difference with
41 % standard \LaTeX\ iss that the brackets in the `references' section
42 % have turned into a dot.
43 % \subsection{Named references}
44 % This presumes that the reference list you use is sorted
45 % alphabetically. The general chape of the references section is this:
48 % \begin{thebibliography}{}
49 % \bibitem[\protect\citeauthoryear{author's name}{year}]{key}
51 % In a `real' example this is what it looks like:
53 % \begin{thebibliography}{}
54 %\bibitem[\protect\citeauthoryear{Bisogni~Jr and Arroyo}{1991}]{BJA91}
55 %J.J. Bisogni~Jr and S.L. Arroyo.
56 %\newblock The effect of carbon dioxide equilibrium on p{H} in dilute lakes.
57 %\newblock {\em Water Research}, 25(2):185--190, 1991.
59 % This entry was generated by \BibTeX, using the file |named.bst|
60 % to do the formatting and sorting. This method of generating
61 % references is highly recommended, because it tends to prevent
62 % errors. (The |\protect| is only needed if the output is in an
63 % external file, like the |.bbl| file.) Until we have a `private'
64 % |.bst| file, |named.bst| is the best option.
66 % Allthough keying this sort of thing in is quite tedious, It also has
67 % some advantages: this allows you to use some `special' |\cite|
68 % commands that are normally not available. The following shows what
69 % the respective commands output on the previous example:
71 % \begin{tabular}{ll} \hline
72 %Call: &Produces:\\ \hline
73 %|\cite{BJA91}| &\cite{BJA91}\\
74 %|\cite*{BJA91}| &\cite*{BJA91}\\
75 %|\shortcite{BJA91}| &\shortcite{BJA91}\\
76 %|\citeyear{BJA91}| &\citeyear{BJA91}\\
77 %|\inlinecite{BJA91}| &\inlinecite{BJA91}\\
78 %|\opencite{BJA91}| &\opencite{BJA91}
80 %\section{Implementation}
81 % From the options follows that the default value is
85 \ProvidesPackage{kluref}[\filedate ]
86 \newif\if@numreferences
87 \DeclareOption{namedreferences}{\@numreferencesfalse}
88 \DeclareOption{numreferences}{\@numreferencestrue}
91 % openbib is ignored (for now ?).
94 \DeclareOption{openbib}{}
95 \ExecuteOptions{namedreferences}
100 % |\sectioncmd| is either |\section| or |\chapter|, depending on the used
101 % major stylefile. Same goes for |\Uppercase|, with regard to pagestyles.
105 \newenvironment{thebibliography}[1]{%
106 \sectioncmd*{\refname}\imarkboth{\bibname}{\bibname}%
109 \def\bibwidthlabel{\releft#1\reright}%
111 % |\releft| and |\reright| are usually empty, but they can be defined
112 % to contain brackets, for instance. This is only useful using
115 % The list and counter are defined below. They vary for the different
118 \list{\kapbib@counter}{\kapbib@list}
119 \let\makelabel\@biblabel
120 \def\newblock{\hskip .11em plus .33em minus .07em}%
124 \sfcode`\.=1000\relax
128 % \subsection{Some utilities}
130 % |\refname| and |\bibname| are not |\providecommand|'s to allow for
131 % already existing definitions, because we do need to be absolutely
132 % sure we are in control. That's why they are inside
133 % |\AtBeginDocument|, to circumvent the |babel| package.
135 % I should ask for french/german names, though.
139 \def\refname{References}%
140 \def\bibname{References}}
145 % |\releft| and |\reright| are around the text inside the optional
146 % argument to |\bibitem|. Together with |\redot|, this allows the
150 %\documentclass[numreferences]{kluwer}
151 %\renewcommand{\releft}{[}
152 %\renewcommand{\reright}{]}
153 %\renewcommand{\redot}{}
156 %\begin{thebibliography}{abs}
157 %\bibitem[abs]{key}...
159 %... and the references will look identical to \LaTeX\ Article
160 % `namedreferences', except for size. Note that this will only work
161 % using numreferences.
163 % |\coleft| and |\ccright| are the same sort of thing, they allow you
164 % to change the braces around |\cite| commands into something else.
166 % This is a hook for klups.sty (oldstyle numerals)
172 \setlength{\bibhang}{14pt}
173 \newcommand{\redot}{.}
174 \newcommand{\releft}{}
175 \newcommand{\reright}{}
176 \newcommand{\coleft}{(}
177 \newcommand{\ccright}{)}
180 % \newpage\subsection{Numbered references}
183 \typeout{KAP -- Numbered references}%
184 \def\kapbib@counter{\arabic{enumiv}}%
185 \def\labelsepwidth{1em}%
187 \setlength{\labelsep}{\labelsepwidth}%
188 \settowidth{\labelwidth}{\@biblabel{\bibwidthlabel}}%
189 \setlength{\leftmargin}{\labelwidth}%
190 \addtolength{\leftmargin}{\labelsep}%
191 \setlength{\itemindent}{0pt}%
192 \setlength{\itemsep}{0pt}%
193 \setlength{\parsep}{0pt}%
195 \let\makelabel\kap@biblabel}%
197 % This makes flush right labels
199 \def\@biblabel##1{\hfill\releft##1\redot\reright}%
201 % |\@bibitem| writes out either |\bibcite{key}{number}| or
202 % |\bibcite{number}{number}| in case there is no key given. This
203 % allows |\cite{2}| without a key.
205 \def\@bibitem##1{\item
209 \immediate\write\@auxout
210 {\string\bibcite{\thearticle \the\value{\@listctr}}%
211 {\the\value{\@listctr}}}%
215 \immediate\write\@auxout
216 {\string\bibcite{\thearticle ##1}{\the\value{\@listctr}}}%
222 % |\@lbibitem| handles the optional argument version.
225 % is given, we presume numbered references are really wanted. (It would
226 % be a bit strange to have entries like |\bibitem[A95]{}| and
227 % to reference using a counter as in |\cite{1}|).
230 \def\@lbibitem[##1]##2{%
231 \def\@biblabel####1{####1}%
232 \let\makelabel\@biblabel
235 \item[\@biblabel{\hfill\releft
236 \arabic{\@listctr}\redot\reright}]%
238 {\def\protect####1{\string ####1\space}\immediate
239 \write\@auxout{\string\bibcite{\thearticle \the\value{\@listctr}}%
240 {\the\value{\@listctr}}}}%
243 % Otherwise, typeset the argument and write out both argument and key
244 % to the |.aux| file.
247 \item[\@biblabel{\hfill\releft ##1\redot\reright}]%
249 {\def\protect####1{\string ####1\space}\immediate
250 \write\@auxout{\string\bibcite{\thearticle ##2}{##1}}}%
256 % Now allow some |namedreferences| commands to a least mean something.
258 \let\@internalcite\oldcite
259 \let\shortcite\@internalcite
260 \let\citeauthor\@internalcite
261 \let\citeyear\@internalcite
262 \let\inlinecite\@internalcite
263 \let\opencite\@internalcite
264 \let\cite\@internalcite
265 \def\citeauthoryear##1##2{}%
267 % To end: relatively standard definition of |\@citex|.
269 \def\@citex[##1]##2{%
271 \@cite{\@for\@citeb:=##2\do
272 {\@citea\def\@citea{,\penalty\@m\ }%
273 \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
274 \edef\gl@citeb{\expandafter\@firstofone\@citeb}%
275 \edef\@citeb{\thearticle\expandafter\@firstofone\@citeb}%
276 \@ifundefined{b@\@citeb}{%
277 \@ifundefined{b@\gl@citeb}{%
278 \mbox{\reset@font\bfseries ?}%
281 {Citation `\@citeb' on page \thepage \space undefined}}%
282 {\hbox{\csname b@\gl@citeb\endcsname}}}%
283 {\hbox{\csname b@\@citeb\endcsname}}%
287 %\newpage \subsection{Named references}
289 \def\namedreferences{%
290 \typeout{KAP -- Named references}%
292 % This (having no optional argument and/or key)
293 % is typically one of those things that happen if you switch from
294 % |num| to |named|. Just write out something to indicate that there
298 \def\@bibitem##1{\item
301 \if@filesw \immediate\write\@auxout{%
302 \string\bibcite{\thearticle ??}{??}}\fi
304 \if@filesw \immediate\write\@auxout{%
305 \string\bibcite{\thearticle ##1}{??}}\fi
310 % Not having a key probably indicates that the optional argument is
311 % also wrong, but hey, we can't do everything. At least now |\cite|
312 % is something useful if you can count very well...
314 % It is also possible
315 % that the optional argument is empty, but that is never a problem
316 % because it will not be typeset anyway (|\@biblabel| will gobble the
319 % 21/3/1997 inserted increment of |\@listctr| to prevent multiply
322 \def\@lbibitem[##1]##2{\item[\@biblabel{##1}\hfill]%
324 \stepcounter{\@listctr}%
326 \if@filesw{\def\protect####1{\string ####1\space}\immediate
327 \write\@auxout{\string\bibcite{\thearticle
328 \the\value\@listctr}{##1}}}\fi
330 \if@filesw{\def\protect####1{\string ####1\space}\immediate
331 \write\@auxout{\string\bibcite{\thearticle ##2}{##1}}}\fi
335 \def\labelsepwidth{1em}%
337 % Here is the list again. |\bibhang| allows control over the amount
338 % of hanging indentation.
340 \def\kapbib@counter{\relax }%
342 \setlength{\labelsep}{0em}%
343 \setlength{\labelwidth}{0pt}%
344 \setlength{\itemindent}{-\bibhang}%
345 \setlength{\itemsep}{0pt}%
346 \setlength{\parsep}{0pt}%
348 \setlength{\leftmargin}{\bibhang}%
352 % Gobble |\@biblabel|. Also, save meaning of |\cite| for later use.
355 \let\@internalcite\oldcite
357 % Differences between these |\cite| commands can be seen above.
359 \def\cite{\@ifstar{\citeyear}{\klu@cite}}%
361 \def\klu@cite{\def\@citeseppen{1000}%
362 \def\@cite####1####2{\coleft{####1\if@tempswa , ####2\fi}\ccright}%
363 \def\citeauthoryear####1####2{{\rm\i@oldseries ####1, ####2}}\@internalcite }%
365 \def\shortcite{\def\@citeseppen{1000}%
366 \def\@cite####1####2{\coleft{####1\if@tempswa , ####2\fi}\ccright}%
367 \def\citeauthoryear####1####2{{\rm\i@oldseries ####2}}\@internalcite }%
369 \def\citeauthor##1{\def\@citeseppen{1000}%
370 \def\@cite####1####2{{####1\if@tempswa , ####2\fi}}%
371 \def\citeauthoryear####1####2{\rm ####1}\@citedata{##1}}%
373 \def\citeyear##1{\def\@citeseppen{1000}%
374 \def\@cite####1####2{{####1\if@tempswa , ####2\fi}}%
375 \def\citeauthoryear####1####2{{\rm\i@oldseries ####2}}\@citedata{##1}}%
377 \def\opencite##1{\citeauthor{##1}, \citeyear{##1}}%
379 \def\inlinecite##1{\citeauthor{##1} (\citeyear{##1})}%
381 % This is rather tricky stuff, these macros come from |named.sty| and
382 % I remember that I understood them once, but not any more,
383 % apparantly. Checking this is left as an exersize to the reader.
388 \@cite{\@for\@citeb:=##1\do
389 {\@citea\def\@citea{,\penalty\@citeseppen\ }%
390 \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
391 \edef\gl@citeb{\expandafter\@firstofone\@citeb}%
392 \edef\@citeb{\thearticle\expandafter\@firstofone\@citeb}%
393 \@ifundefined{b@\@citeb}{%
394 \@ifundefined{b@\gl@citeb}{%
395 \mbox{\reset@font\bfseries ?}%
398 {Citation `\@citeb' on page \thepage \space undefined}}%
399 {\csname b@\gl@citeb\endcsname}}%
400 {\csname b@\@citeb\endcsname}}}{}}
401 \def\@citex[##1]##2{%
403 \@cite{\@for\@citeb:=##2\do
404 {\@citea\def\@citea{;\penalty\@citeseppen\ }%
405 \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
406 \edef\gl@citeb{\expandafter\@firstofone\@citeb}%
407 \edef\@citeb{\thearticle\expandafter\@firstofone\@citeb}%
408 \@ifundefined{b@\@citeb}{%
409 \@ifundefined{b@\gl@citeb}{%
410 \mbox{\reset@font\bfseries ?}%
413 {Citation `\@citeb' on page \thepage \space undefined}}%
414 {\csname b@\gl@citeb\endcsname}}%
415 {\csname b@\@citeb\endcsname}}}{##1}}
417 % Allow |\citeauthoryear| in |\write|
419 \def\citeauthoryear##1##2{\string\citeauthoryear{##1}{##2}}}
420 %%%%%%%%%%%%%%%%%%%%%%%%%
428 %\begin{thebibliography}{}
429 %\bibitem[\citeauthoryear{Bisogni~Jr and Arroyo}{1991}]{BJA91}%
430 %J.J. Bisogni~Jr and S.L. Arroyo.
431 %\newblock The effect of carbon dioxide equilibrium on p{H} in dilute lakes.
432 %\newblock {\em Water Research}, 25(2):185--190, 1991.
433 %\end{thebibliography}