Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %%
3 %% Copyright (C) 2012 by Simon Sigurdhsson <[email protected]>
4 %%
5 %% This work may be distributed and/or modified under the
6 %% conditions of the LaTeX Project Public License, either version 1.3
7 %% of this license or (at your option) any later version.
8 %% The latest version of this license is in
9 %% http://www.latex-project.org/lppl.txt
10 %% and version 1.3 or later is part of all distributions of LaTeX
11 %% version 2005/12/01 or later.
12 %%
13 %% This work has the LPPL maintenance status `unmaintained'.
14 %%
15 %% This work consists of the files chscite.dtx and chscite.ins
16 %% and the derived filebase chscite.sty.
17 %%
18 % \fi
19 %
20 % \iffalse
21 %<*driver>
22 \ProvidesFile{chscite.dtx}
23 %</driver>
24 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
25 %<package>\ProvidesPackage{chscite}
26 %<*package>
27 [2012/12/16 v2.9999 Chalmers bibliography style]
28 %</package>
29 %
30 %<*driver>
31 \documentclass{ltxdoc}
32 \usepackage{chscite}[2012/12/16]
33 \AtBeginDocument{%
34 \OnlyDescription%
35 % \CodelineIndex%
36 % \EnableCrossrefs%
37 \RecordChanges%
38 }
39 \AtEndDocument{%
40 \PrintChanges%
41 \PrintIndex%
42 }
43 \begin{document}
44 \DocInput{chscite.dtx}
45 \end{document}
46 %</driver>
47 % \fi
48 %
49 % \CheckSum{0}
50 %
51 % \CharacterTable
52 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
53 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
54 % Digits \0\1\2\3\4\5\6\7\8\9
55 % Exclamation \! Double quote \" Hash (number) \#
56 % Dollar \$ Percent \% Ampersand \&
57 % Acute accent \' Left paren \( Right paren \)
58 % Asterisk \* Plus \+ Comma \,
59 % Minus \- Point \. Solidus \/
60 % Colon \: Semicolon \; Less than \<
61 % Equals \= Greater than \> Question mark \?
62 % Commercial at \@ Left bracket \[ Backslash \\
63 % Right bracket \] Circumflex \^ Underscore \_
64 % Grave accent \` Left brace \{ Vertical bar \|
65 % Right brace \} Tilde \~}
66 %
67 % \changes{v1.0}{2011/06/05}{Initial version}
68 % \changes{v2.0}{2011/06/06}{Added language options}
69 % \changes{v2.0c}{2011/06/22}{Improved translations}
70 % \changes{v2.9}{2011/09/16}{Polyglossia compatibility}
71 % \changes{v2.9}{2011/09/16}{Various bugfixes}
72 % \changes{v2.9}{2011/09/16}{Improved documentation}
73 % \changes{v2.99}{2011/09/16}{Fixed critical \texttt{.dtx} bug}
74 %
75 % \GetFileInfo{chscite.dtx}
76 %
77 % \DoNotIndex{\newcommand,\newenvironment,\ ,\null,\ifthenelse,\def,\equal}
78 %
79 % \GetFileInfo{chscite.dtx}
80 % \title{The \textsf{chscite} package\thanks{This document
81 % corresponds to \textsf{chscite}~\fileversion~(converges to 3, a
82 % completely arbitrary number), dated \filedate.}}
83 % \author{Simon Sigurdhsson \\ \texttt{[email protected]}\footnote{This package is currently unmaintained. If you'd like to maintain it, please get in touch and I'll transfer the Github repository to you.}}
84 %
85 % \maketitle
86 % \tableofcontents
87 %
88 % \section{Introduction}
89 %
90 % This package, heavily based on the \textsf{harvard} package for
91 % Harvard-style citations, provides a citation suite for students at Chalmers
92 % University of Technology that follows given recommendations. The package
93 % is aimed at the swedish audience, with additional support for english
94 % enabled by default.
95 %
96 % \section{Usage}
97 % This section assumes general knowledge of \textsc{Bib}\TeX{}, and in
98 % particular that the user knows how to create \textsc{Bib}\TeX{} databases,
99 % include these in \LaTeX{} documents and run the |bibtex| binary.
100 %
101 % \subsection{Options}
102 % The package is invoked as |\usepacakge|\oarg{language}|{chscite}|, where
103 % \meta{language} can be either |english| (the default) or |swedish|. The
104 % language option controls the language of various internal strings used by
105 % the \textsc{Bib}\TeX{} style |chscite.bst|.
106 %
107 % \subsection{Commands}
108 % The package itself contains relatively few user-exposed commands. These can
109 % be used to cite references in a few different ways. For more information on
110 % these commands, refer to the \textsf{harvard} package manual.
111 %
112 % \subsubsection{Full citations}
113 % \DescribeMacro{\nocite}
114 % The \cs{nocite}\marg{reference} command includes a reference in the
115 % bibliography without printing anything. This is useful for references that
116 % aren't actually referenced in text.
117 %
118 % \DescribeMacro{\cite}
119 % The familiar \cs{cite}\oarg{suffix}\marg{reference} command works as for
120 % standard \textsc{Bib}\TeX{} styles, except it now uses the Harvard
121 % convention for citing references. Sample output: \textbf{(Lamport 1986)}.
122 %
123 % \DescribeMacro{\citeaffixed}
124 % The \cs{citeaffixed}\oarg{suffix}\marg{reference}\marg{prefix} command works
125 % the same way as \cs{cite}, but prefixes the output with \meta{prefix}.
126 % Sample output: \textbf{(i.e.~Lamport 1986)}.
127 %
128 % \DescribeMacro{\citeasnoun}
129 % The \cs{citeasnoun}\oarg{suffix}\marg{reference} command cites a reference
130 % as a noun. Sample output: \textbf{Lamport (1986)}.
131 %
132 % \DescribeMacro{\possessivecite}
133 % The \cs{possessivecite}\oarg{suffix}\marg{reference} command cites a
134 % reference as in the possessive manner.
135 % Sample output: \textbf{Lamport's (1986)}.
136 %
137 % \subsubsection{Partial citations}
138 % \DescribeMacro{\citename}
139 % The \cs{citename}\marg{reference} command simply prints the author name(s)
140 % of the given reference.
141 %
142 % \DescribeMacro{\citeyear}
143 % The \cs{citeyear}\marg{reference} command simply prints the year
144 % of the given reference.
145 %
146 % \subsection{Using \texttt{@misc} for web sources}
147 % In this package, the \texttt{@misc} \textsc{Bib}\TeX{} style has been crafted
148 % to typeset web sources correctly as per Chalmers recommendations. Proper use,
149 % apart from usual \textsc{Bib}\TeX{} syntax, includes using the \texttt{note}
150 % field to specify retreival date and the \texttt{howpublished} field for web
151 % page title:
152 % \iffalse
153 %<*example>
154 % \fi
155 \begin{verbatim}
156 @misc{google,
157 author = {Johnson, S.},
158 year = 2007,
159 title = {Exploiting the mobile channel},
160 howpublished = {m.Net Corporation},
161 url = {http://www.mnetcorporation.com/article-exploiting-the-mobile-channel},
162 note = {2008-04-18}
163 }
164 \end{verbatim}
165 % \iffalse
166 %</example>
167 % \fi
168 %
169 % \subsection{Using the \texttt{@patent} entry type}
170 % The \texttt{@patent} included in this package is a custom alternative to
171 % \texttt{@techreport} especially made for referencing patents. Required fields
172 % are \texttt{author}, \texttt{year}, \texttt{title} and \texttt{number} (the
173 % patent number). There are no optional fields:
174 % \iffalse
175 %<*example>
176 % \fi
177 \begin{verbatim}
178 @patent{volvo,
179 author = {{Volvo Lastvagnar}},
180 year = 2006,
181 title = {Information based controlling of chassis height of a vehicle},
182 number = {SE0403224}
183 }
184 \end{verbatim}
185 % \iffalse
186 %</example>
187 % \fi
188 %
189 % \section{Known issues}
190 % The |chscite.bst| \textsc{Bib}\TeX{} style does not support cross references
191 % at the moment. This is a planned improvement.
192 %
193 % \PrintChanges
194 %
195 % \StopEventually{}
196 %
197 % \section{Implementation}
198 %
199 % \subsection{\LaTeX{} package file \texttt{chscite.sty}}
200 %
201 % \iffalse
202 %<*package>
203 % \fi
204 %
205 % \begin{macrocode}
206 \RequirePackage{ifthen}
207 \@ifundefined{url}{\RequirePackage{url}}{}
208 % \end{macrocode}
209 %
210 % \begin{macro}{\chsurl}
211 % \begin{macrocode}
212 \newcommand{\chsurl}[1]{\url{#1}}
213 % \end{macrocode}
214 % \end{macro}
215 %
216 % \begin{macrocode}
217 %% Kristoffer H. Rose <[email protected]> 1995/03/01:
218 %% do not expand macros in citations: put definitions on .aux file instead.
219 {\catcode`\:=12 \catcode`\-=12 \catcode`\>=12 \catcode`\<=12 %
220 \gdef\codeof#1{\expandafter\codeof@\meaning#1<-:}%
221 \gdef\codeof@#1:->#2<-:{#2}}
222 % \end{macrocode}
223 %
224 % \begin{macro}{\chspreambletext}
225 % \begin{macrocode}
226 \def\chspreambletext{\catcode`\#=12 \chspreambletext@}
227 % \end{macrocode}
228 % \end{macro}
229 %
230 %
231 % \begin{macro}{\chspreambletext@}
232 % \begin{macrocode}
233 \def\chspreambletext@#1{\def\next{#1}\catcode`\#=6 %
234 \immediate\write\@auxout{\string\chspreambledefs{%
235 \string\AtBeginDocument{\codeof\next}}}}
236 % \end{macrocode}
237 % \end{macro}
238 %
239 %
240 % \begin{macro}{\chspreambledefs}
241 % \begin{macrocode}
242 \def\chspreambledefs#1{#1\gdef\chspreambledefs##1{}}
243 % \end{macrocode}
244 % \end{macro}
245 %
246 %
247 % \begin{macro}{\chsitem}
248 % \begin{macrocode}
249 \newcommand{\chsitem}[4][\null]{\item[]%
250 \if@filesw{ \def\protect##1{\string ##1\space}%
251 \ifthenelse{\equal{#1}{\null}}
252 {\def\next{{#4}{#2}{#2}{#3}}}
253 {\def\next{{#4}{#2}{#1}{#3}}}
254 \immediate\write\@auxout{\string\chscite\codeof\next}%
255 }\fi%
256 \protect\hspace*{-\labelwidth}\protect\hspace*{-\labelsep}\ignorespaces%
257 }
258 % \end{macrocode}
259 % \end{macro}
260 %
261 %
262 % \begin{macro}{\chscite}
263 % \begin{macrocode}
264 \newcommand{\chscite}[4]{
265 \global\@namedef{CHS@fn@#1}{#2}
266 \global\@namedef{CHS@an@#1}{#3}
267 \global\@namedef{CHS@yr@#1}{#4}
268 \global\@namedef{CHS@df@#1}{\csname CHS@fn@#1\endcsname}
269 }
270 % \end{macrocode}
271 % \end{macro}
272 %
273 %
274 % \begin{macro}{\CHS@citetoaux}
275 % \begin{macrocode}
276 \newcommand{\CHS@citetoaux}[1]{%
277 \if@filesw\immediate\write\@auxout{\string\citation{#1}}\fi%
278 }
279 % \end{macrocode}
280 % \end{macro}
281 %
282 %
283 % \begin{macro}{\CHS@checkdef}
284 % \begin{macrocode}
285 \newcommand{\CHS@checkdef}[2]{\@ifundefined{CHS@df@#1}%
286 {\textbf{?}\@warning{Citation '#1' on page \thepage \space undefined}}%
287 {#2}%
288 }
289 % \end{macrocode}
290 % \end{macro}
291 %
292 %
293 % \begin{macro}{\CHS@dolist}
294 % \begin{macrocode}
295 \newcommand{\CHS@dolist}[2]{\def\@citea{\null}\@for\@citeb:=#1\do%
296 {\@citea\def\@citea{,\penalty\@m\ }\CHS@checkdef{\@citeb}%
297 {#2{\@citeb}\null\penalty\@m\ %
298 \CHS@year{\@citeb}\CHS@setd{\@citeb}}}%
299 }
300 % \end{macrocode}
301 % \end{macro}
302 %
303 %
304 % \begin{macro}{\@enamedef}
305 % \begin{macrocode}
306 \def\@enamedef#1{\expandafter\def\csname #1\expandafter\endcsname\expandafter}
307 % \end{macrocode}
308 % \end{macro}
309 %
310 %
311 % \begin{macro}{\CHS@name}
312 % \begin{macrocode}
313 \newcommand{\CHS@name}[1]{\csname CHS@df@#1\endcsname}
314 % \end{macrocode}
315 % \end{macro}
316 %
317 %
318 % \begin{macro}{\CHS@fname}
319 % \begin{macrocode}
320 \newcommand{\CHS@fname}[1]{\csname CHS@fn@#1\endcsname}
321 % \end{macrocode}
322 % \end{macro}
323 %
324 %
325 % \begin{macro}{\CHS@aname}
326 % \begin{macrocode}
327 \newcommand{\CHS@aname}[1]{\csname CHS@an@#1\endcsname}
328 % \end{macrocode}
329 % \end{macro}
330 %
331 %
332 % \begin{macro}{\CHS@year}
333 % \begin{macrocode}
334 \newcommand{\CHS@year}[1]{\csname CHS@yr@#1\endcsname}
335 % \end{macrocode}
336 % \end{macro}
337 %
338 %
339 % \begin{macro}{\CHS@setd}
340 % \begin{macrocode}
341 \newcommand{\CHS@setd}[1]{%
342 \global\@enamedef{CHS@df@#1}{\csname CHS@an@#1\endcsname}%
343 }
344 % \end{macrocode}
345 % \end{macro}
346 %
347 %
348 % \begin{macro}{\CHS@df@}
349 % \begin{macrocode}
350 %% Berwin A. Turlach <[email protected]>
351 \global\@namedef{CHS@df@*}{\csname CHS@fn@*\endcsname}
352 % \end{macrocode}
353 % \end{macro}
354 %
355 %
356 % \begin{macro}{\nocite}
357 % Cite a reference without printing anything.
358 % \begin{macrocode}
359 \renewcommand{\nocite}[1]{\CHS@citetoaux{#1}%
360 \@for\@citeb:=#1\do%
361 {\CHS@checkdef{\@citeb}{}}}%
362 % \end{macrocode}
363 % \end{macro}
364 %
365 %
366 % \begin{macro}{\cite}
367 % \begin{macro}{\CHS@dcite}
368 % \begin{macro}{\CHS@acite}
369 % \begin{macro}{\CHS@fcite}
370 % Cite a reference in the traditional manner.
371 % \begin{macrocode}
372 \renewcommand{\cite}{\@ifstar{\@ifstar{\CHS@acite}{\CHS@fcite}}{\CHS@dcite}}
373 \newcommand{\CHS@dcite}[2][\null]{\CHS@citetoaux{#2}%
374 {(\CHS@dolist{#2}{\CHS@name}\ifthenelse{\equal{#1}{\null}}%
375 {}{, #1})}%
376 }
377 \newcommand{\CHS@acite}[2][\null]{\CHS@citetoaux{#2}%
378 {(\CHS@dolist{#2}{\CHS@aname}\ifthenelse{\equal{#1}{\null}}%
379 {}{, #1})}%
380 }
381 \newcommand{\CHS@fcite}[2][\null]{\CHS@citetoaux{#2}%
382 {(\CHS@dolist{#2}{\CHS@fname}\ifthenelse{\equal{#1}{\null}}%
383 {}{, #1})}%
384 }
385 % \end{macrocode}
386 % \end{macro}
387 % \end{macro}
388 % \end{macro}
389 % \end{macro}
390 %
391 %
392 % \begin{macro}{\citeaffixed}
393 % \begin{macro}{\CHS@fciteaff}
394 % \begin{macro}{\CHS@aciteaff}
395 % \begin{macro}{\CHS@dciteaff}
396 % Cite a reference with affixed text.
397 % \begin{macrocode}
398 \newcommand{\citeaffixed}{\@ifstar{\@ifstar{\CHS@aciteaff}{\CHS@fciteaff}}%
399 {\CHS@dciteaff}%
400 }
401 \newcommand{\CHS@fciteaff}[3][\null]{\CHS@citetoaux{#2}%
402 {(#3\ \CHS@dolist{#2}{\CHS@fname}\ifthenelse{\equal{#1}{\null}}%
403 {}{, #1})}%
404 }
405 \newcommand{\CHS@aciteaff}[3][\null]{\CHS@citetoaux{#2}%
406 {(#3\ \CHS@dolist{#2}{\CHS@aname}\ifthenelse{\equal{#1}{\null}}%
407 {}{, #1})}%
408 }
409 \newcommand{\CHS@dciteaff}[3][\null]{\CHS@citetoaux{#2}%
410 {(#3\ \CHS@dolist{#2}{\CHS@name}\ifthenelse{\equal{#1}{\null}}%
411 {}{, #1})}%
412 }
413 % \end{macrocode}
414 % \end{macro}
415 % \end{macro}
416 % \end{macro}
417 % \end{macro}
418 %
419 %
420 % \begin{macro}{\citeasnoun}
421 % \begin{macro}{\CHS@fciteasn}
422 % \begin{macro}{\CHS@aciteasn}
423 % \begin{macro}{\CHS@dciteasn}
424 % Cite a reference as a noun.
425 % \begin{macrocode}
426 \newcommand{\citeasnoun}{\@ifstar{\@ifstar{\CHS@aciteasn}{\CHS@fciteasn}}%
427 {\CHS@dciteasn}%
428 }
429 \newcommand{\CHS@fciteasn}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
430 {\CHS@fname{#2}\ (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
431 {}{, #1})}\CHS@setd{#2}}%
432 }
433 \newcommand{\CHS@aciteasn}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
434 {\CHS@aname{#2}\ (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
435 {}{, #1})}\CHS@setd{#2}}%
436 }
437 \newcommand{\CHS@dciteasn}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
438 {\CHS@name{#2}\ (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
439 {}{, #1})}\CHS@setd{#2}}%
440 }
441 % \end{macrocode}
442 % \end{macro}
443 % \end{macro}
444 % \end{macro}
445 % \end{macro}
446 %
447 %
448 % \begin{macro}{\possessivecite}
449 % \begin{macro}{\CHS@fcitepos}
450 % \begin{macro}{\CHS@acitepos}
451 % \begin{macro}{\CHS@dcitepos}
452 % Cite a reference in the possessive.
453 % \begin{macrocode}
454 \newcommand{\possessivecite}{\@ifstar{\@ifstar{\CHS@acitepos}{\CHS@fcitepos}}%
455 {\CHS@dcitepos}%
456 }
457 \newcommand{\CHS@fcitepos}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
458 {\CHS@fname{#2}s (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
459 {}{, #1})}\CHS@setd{#2}}%
460 }
461 \newcommand{\CHS@acitepos}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
462 {\CHS@aname{#2}s (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
463 {}{, #1})}\CHS@setd{#2}}%
464 }
465 \newcommand{\CHS@dcitepos}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
466 {\CHS@name{#2}s (\CHS@year{#2}\ifthenelse{\equal{#1}{\null}}
467 {}{, #1})}\CHS@setd{#2}}%
468 }
469 % \end{macrocode}
470 % \end{macro}
471 % \end{macro}
472 % \end{macro}
473 % \end{macro}
474 %
475 %
476 % \begin{macro}{\citename}
477 % \begin{macro}{\CHS@fcitenam}
478 % \begin{macro}{\CHS@acitenam}
479 % \begin{macro}{\CHS@dcitenam}
480 % Print the name(s) of the author(s) of a specific reference.
481 % \begin{macrocode}
482 \newcommand{\citename}{\@ifstar{\@ifstar{\CHS@acitenam}\CHS@fcitenam}%
483 {\CHS@dcitenam}%
484 }
485 \newcommand{\CHS@fcitenam}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
486 {\CHS@fname{#2}\ifthenelse{\equal{#1}{\null}}
487 {}{\ (#1)}}}%
488 }
489 \newcommand{\CHS@acitenam}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
490 {\CHS@aname{#2}\ifthenelse{\equal{#1}{\null}}
491 {}{\ (#1)}}}%
492 }
493 \newcommand{\CHS@dcitenam}[2][\null]{\CHS@citetoaux{#2}\CHS@checkdef{#2}{%
494 {\CHS@name{#2}\ifthenelse{\equal{#1}{\null}}
495 {}{\ (#1)}}}%
496 }
497 % \end{macrocode}
498 % \end{macro}
499 % \end{macro}
500 % \end{macro}
501 % \end{macro}
502 %
503 %
504 % \begin{macro}{\citeyear}
505 % \begin{macro}{\CHS@citeyr}
506 % \begin{macro}{\CHS@citeyrnb}
507 % Print the year of a specific reference.
508 % \begin{macrocode}
509 \newcommand{\citeyear}{\@ifstar{\CHS@citeyrnb}{\CHS@citeyr}}
510 \newcommand{\CHS@citeyrnb}[2][\null]{\CHS@citetoaux{#2}%
511 {\def\@citea{\null}\@for\@citeb:=#2\do%
512 {\@citea\def\@citea{,\penalty\@m\ }\CHS@checkdef{\@citeb}%
513 {\CHS@year{\@citeb}}}\ifthenelse{\equal{#1}{\null}}%
514 {}{, #1}}%
515 }
516 \newcommand{\CHS@citeyr}[2][\null]{\CHS@citetoaux{#2}%
517 {(\def\@citea{\null}\@for\@citeb:=#2\do%
518 {\@citea\def\@citea{,\penalty\@m\ }\CHS@checkdef{\@citeb}%
519 {\CHS@year{\@citeb}}}\ifthenelse{\equal{#1}{\null}}%
520 {}{, #1})}%
521 }
522 % \end{macrocode}
523 % \end{macro}
524 % \end{macro}
525 % \end{macro}
526 %
527 % \changes{v2.9}{2011/09/16}{Removed \cs{CHS@hisep}}
528 % \changes{v2.9}{2011/09/16}{Removed \cs{CHS@hysep}}
529 % \changes{v2.9}{2011/09/16}{Removed \cs{chsleft}}
530 % \changes{v2.9}{2011/09/16}{Removed \cs{chsright}}
531 % \changes{v2.9}{2011/09/16}{Removed \cs{chsyearleft}}
532 % \changes{v2.9}{2011/09/16}{Removed \cs{chsyearright}}
533 % \changes{v2.9}{2011/09/16}{Removed \cs{CHS@checkcitations}}
534 %
535 %
536 % \begin{macro}{\chsWand}
537 % \begin{macro}{\chsWjanuary}
538 % \begin{macro}{\chsWfebruary}
539 % \begin{macro}{\chsWmarch}
540 % \begin{macro}{\chsWapril}
541 % \begin{macro}{\chsWmay}
542 % \begin{macro}{\chsWjune}
543 % \begin{macro}{\chsWjuly}
544 % \begin{macro}{\chsWaugust}
545 % \begin{macro}{\chsWseptember}
546 % \begin{macro}{\chsWoctober}
547 % \begin{macro}{\chsWnovember}
548 % \begin{macro}{\chsWdecember}
549 % \begin{macro}{\chsWprinting}
550 % \begin{macro}{\chsWphdthesis}
551 % \begin{macro}{\chsWmscthesis}
552 % \begin{macro}{\chsWinstitution}
553 % \begin{macro}{\chsWin}
554 % \begin{macro}{\chsPage}
555 % \begin{macro}{\chsPages}
556 % \begin{macro}{\chsEdition}
557 % \begin{macro}{\chsNumero}
558 % \begin{macro}{\chsVolume}
559 % \begin{macro}{\chsWst}
560 % \begin{macro}{\chsWnd}
561 % \begin{macro}{\chsWrd}
562 % \begin{macro}{\chsWth}
563 % \begin{macro}{\chsWeditor}
564 % \changes{v2.0e}{2011/06/23}{Fixed editor translation}
565 % \begin{macro}{\chsWelectronic}
566 % \begin{macro}{\chsWtechreport}
567 % Various translatable terms
568 % \begin{macrocode}
569 \newcommand{\chsWand}{}%
570 \newcommand{\chsWjanuary}{}%
571 \newcommand{\chsWfebruary}{}%
572 \newcommand{\chsWmarch}{}%
573 \newcommand{\chsWapril}{}%
574 \newcommand{\chsWmay}{}%
575 \newcommand{\chsWjune}{}%
576 \newcommand{\chsWjuly}{}%
577 \newcommand{\chsWaugust}{}%
578 \newcommand{\chsWseptember}{}%
579 \newcommand{\chsWoctober}{}%
580 \newcommand{\chsWnovember}{}%
581 \newcommand{\chsWdecember}{}%
582 \newcommand{\chsWprinting}{}%
583 \newcommand{\chsWphdthesis}{}%
584 \newcommand{\chsWmscthesis}{}%
585 \newcommand{\chsWinstitution}{}%
586 \newcommand{\chsWin}{}%
587 \newcommand{\chsPage}{}%
588 \newcommand{\chsPages}{}%
589 \newcommand{\chsEdition}{}%
590 \newcommand{\chsNumero}{}%
591 \newcommand{\chsVolume}{}%
592 \newcommand{\chsWst}{}%
593 \newcommand{\chsWnd}{}%
594 \newcommand{\chsWrd}{}%
595 \newcommand{\chsWth}{}%
596 \newcommand{\chsWeditor}{}%
597 \newcommand{\chsWelectronic}{}%
598 \newcommand{\chsWtechreport}{}%
599 % \end{macrocode}
600 % \end{macro}
601 % \end{macro}
602 % \end{macro}
603 % \end{macro}
604 % \end{macro}
605 % \end{macro}
606 % \end{macro}
607 % \end{macro}
608 % \end{macro}
609 % \end{macro}
610 % \end{macro}
611 % \end{macro}
612 % \end{macro}
613 % \end{macro}
614 % \end{macro}
615 % \end{macro}
616 % \end{macro}
617 % \end{macro}
618 % \end{macro}
619 % \end{macro}
620 % \end{macro}
621 % \end{macro}
622 % \end{macro}
623 % \end{macro}
624 % \end{macro}
625 % \end{macro}
626 % \end{macro}
627 % \end{macro}
628 % \end{macro}
629 % \end{macro}
630 %
631 % Set up swedish translations if |swedish| option is given.
632 % \changes{v2.0b}{2011/06/12}{Fixed a critical bug in |swedish| option}
633 % \begin{macrocode}
634 \DeclareOption{swedish}{%
635 \renewcommand{\chsWand}{och}%
636 \renewcommand{\chsWjanuary}{januari}%
637 \renewcommand{\chsWfebruary}{februari}%
638 \renewcommand{\chsWmarch}{mars}%
639 \renewcommand{\chsWapril}{april}%
640 \renewcommand{\chsWmay}{maj}%
641 \renewcommand{\chsWjune}{juni}%
642 \renewcommand{\chsWjuly}{juli}%
643 \renewcommand{\chsWaugust}{augusti}%
644 \renewcommand{\chsWseptember}{september}%
645 \renewcommand{\chsWoctober}{oktober}%
646 \renewcommand{\chsWnovember}{november}%
647 \renewcommand{\chsWdecember}{december}%
648 \renewcommand{\chsWprinting}{Under tryckning}%
649 \renewcommand{\chsWphdthesis}{Doktorsavhandling}%
650 \renewcommand{\chsWmscthesis}{Examensarbete}%
651 \renewcommand{\chsWinstitution}{inom}%
652 \renewcommand{\chsWin}{I}%
653 \renewcommand{\chsPage}{s.}%
654 \renewcommand{\chsPages}{ss.}%
655 \renewcommand{\chsEdition}{upplagan}%
656 \renewcommand{\chsNumero}{nr}%
657 \renewcommand{\chsVolume}{vol.}%
658 \renewcommand{\chsWst}{:a}%
659 \renewcommand{\chsWnd}{:a}%
660 \renewcommand{\chsWrd}{:e}%
661 \renewcommand{\chsWth}{:e}%
662 \renewcommand{\chsWeditor}{red.}%
663 \renewcommand{\chsWelectronic}{Elektronisk}%
664 \renewcommand{\chsWtechreport}{Teknisk rapport}%
665 }
666 % \end{macrocode}
667 %
668 % Set up english translations if |english| option is given.
669 % \begin{macrocode}
670 \DeclareOption{english}{%
671 \renewcommand{\chsWand}{and}%
672 \renewcommand{\chsWjanuary}{January}%
673 \renewcommand{\chsWfebruary}{February}%
674 \renewcommand{\chsWmarch}{March}%
675 \renewcommand{\chsWapril}{April}%
676 \renewcommand{\chsWmay}{May}%
677 \renewcommand{\chsWjune}{June}%
678 \renewcommand{\chsWjuly}{July}%
679 \renewcommand{\chsWaugust}{August}%
680 \renewcommand{\chsWseptember}{September}%
681 \renewcommand{\chsWoctober}{October}%
682 \renewcommand{\chsWnovember}{November}%
683 \renewcommand{\chsWdecember}{December}%
684 \renewcommand{\chsWprinting}{Unpublished}%
685 \renewcommand{\chsWphdthesis}{Ph.D.~thesis}%
686 \renewcommand{\chsWmscthesis}{Master's~thesis}%
687 \renewcommand{\chsWinstitution}{at}%
688 \renewcommand{\chsWin}{In}%
689 \renewcommand{\chsPage}{p.}%
690 \renewcommand{\chsPages}{pp.}%
691 \renewcommand{\chsEdition}{edition}%
692 \renewcommand{\chsNumero}{no.}%
693 \renewcommand{\chsVolume}{vol.}%
694 \renewcommand{\chsWst}{st}%
695 \renewcommand{\chsWnd}{nd}%
696 \renewcommand{\chsWrd}{rd}%
697 \renewcommand{\chsWth}{th}%
698 \renewcommand{\chsWeditor}{ed.}%
699 \renewcommand{\chsWelectronic}{Electronic}%
700 \renewcommand{\chsWtechreport}{Technical report}%
701 }
702 % \end{macrocode}
703 %
704 % Execute default options, process given options and choose the correct
705 % bibliography style.
706 % \begin{macrocode}
707 \ExecuteOptions{english}
708 \ProcessOptions*
709 \bibliographystyle{chscite}
710 % \end{macrocode}
711 %
712 % \iffalse
713 %</package>
714 % \fi
715 %
716 % \subsection{\textsc{Bib}\TeX{} style file \texttt{chscite.bst}}
717 % \changes{v1.0b}{2011/06/06}{Fixed bug concerning editors in \texttt{.bst} file}
718 % \changes{v2.0c}{2011/06/22}{Cleaned up \texttt{.bst} file}
719 % \changes{v2.0d}{2011/06/23}{Improved handling of editions}
720 % \changes{v2.999}{2012/05/13}{Added \texttt{@patent} and \texttt{@misc} entries}
721 % \changes{v2.9999}{2012/12/05}{Added \texttt{@techreport} style}
722 %
723 % \iffalse
724 %<*bibstyle>
725 % \fi
726 %
727 % \begin{macrocode}
728 ENTRY
729 {
730 address
731 author
732 booktitle
733 chapter
734 edition
735 editor
736 howpublished
737 institution
738 journal
739 key
740 month
741 note
742 number
743 organization
744 pages
745 publisher
746 school
747 series
748 title
749 type
750 URL
751 volume
752 year
753 }
754 { field.used }
755 { extra.label sort.label list.year }
756
757 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
758
759 FUNCTION {init.state.consts}
760 {
761 #0 'before.all :=
762 #1 'mid.sentence :=
763 #2 'after.sentence :=
764 #3 'after.block :=
765 }
766
767 STRINGS { s t f }
768
769 FUNCTION {item.check}
770 {
771 't :=
772 empty$
773 { "empty " t * " in " * cite$ * warning$ }
774 { skip$ }
775 if$
776 }
777
778 FUNCTION {new.block}
779 {
780 output.state before.all =
781 'skip$
782 { after.block 'output.state := }
783 if$
784 }
785
786 FUNCTION {lastint}
787 {
788 #-1 #1 substring$ chr.to.int$ "0" chr.to.int$ -
789 }
790
791 FUNCTION {format.number.th}
792 {
793 duplicate$ duplicate$
794 #1 =
795 { pop$ pop$ "\chsWst{}" }
796 {
797 #2 =
798 { pop$ "\chsWnd{}" }
799 {
800 #3 =
801 { "\chsWrd{}" }
802 { "\chsWth{}" }
803 if$
804 }
805 if$
806 }
807 if$
808 }
809
810 FUNCTION {not}
811 {
812 { #0 }
813 { #1 }
814 if$
815 }
816
817 FUNCTION {and}
818 {
819 'skip$
820 { pop$ #0 }
821 if$
822 }
823
824 FUNCTION {or}
825 {
826 { pop$ #1 }
827 'skip$
828 if$
829 }
830
831 FUNCTION {field.or.null}
832 {
833 duplicate$ empty$
834 { pop$ "" }
835 'skip$
836 if$
837 }
838
839 FUNCTION {emphasize}
840 {
841 duplicate$ empty$
842 { pop$ "" }
843 { "\emph{" swap$ * "}" * }
844 if$
845 }
846
847 FUNCTION {write.url}
848 {
849 URL empty$
850 'skip$
851 { " \chsurl{" URL * "}" add.period$ * write$ newline$ }
852 if$
853 }
854
855 FUNCTION {fin.entry}
856 {
857 add.period$
858 write$
859 type$ "misc" =
860 'skip$
861 'write.url
862 if$
863 newline$
864 }
865
866 INTEGERS { nameptr namesleft numnames }
867
868 FUNCTION {format.names}
869 {
870 's :=
871 'f :=
872 #1 'nameptr :=
873 s num.names$ 'numnames :=
874 numnames 'namesleft :=
875 #3 numnames >
876 {
877 { namesleft #0 > }
878 {
879 s nameptr f format.name$ 't :=
880 nameptr #1 >
881 {
882 namesleft #1 >
883 { ", " * t * }
884 {
885 t "others" =
886 { " et~al." * }
887 { " \chsWand{}\ " * t * }
888 if$
889 }
890 if$
891 }
892 't
893 if$
894 nameptr #1 + 'nameptr :=
895 namesleft #1 - 'namesleft :=
896 }
897 while$
898 }
899 { s nameptr f format.name$ " et~al." * }
900 if$
901 }
902
903 FUNCTION {format.authors}
904 {
905 author empty$
906 { "" }
907 { "{vv~}{ll}{, jj}{, f.}" author format.names }
908 if$
909 }
910
911 FUNCTION {n.dashify}
912 {
913 't :=
914 ""
915 { t empty$ not }
916 {
917 t #1 #1 substring$ "-" =
918 {
919 t #1 #2 substring$ "--" = not
920 {
921 "--" *
922 t #2 global.max$ substring$ 't :=
923 }
924 {
925 { t #1 #1 substring$ "-" = }
926 {
927 "-" *
928 t #2 global.max$ substring$ 't :=
929 }
930 while$
931 }
932 if$
933 }
934 {
935 t #1 #1 substring$ *
936 t #2 global.max$ substring$ 't :=
937 }
938 if$
939 }
940 while$
941 }
942
943 FUNCTION {format.btitle}
944 {
945 title "." * emphasize
946 }
947
948 FUNCTION {tie.or.space.connect}
949 {
950 duplicate$ text.length$ #3 <
951 { "~" }
952 { " " }
953 if$
954 swap$ * *
955 }
956
957 FUNCTION {either.or.check}
958 {
959 empty$
960 'pop$
961 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
962 if$
963 }
964
965 FUNCTION {format.editors}
966 {
967 editor empty$
968 { "" }
969 { "\chsWeditor{}" "{vv~}{ll}{, jj}{, f.}" editor format.names tie.or.space.connect }
970 if$
971 }
972
973 FUNCTION {format.book.editors}
974 {
975 editor empty$
976 { "" }
977 { "\chsWeditor{}" "{vv~}{ll}{, jj}{, f.}" editor format.names tie.or.space.connect }
978 if$
979 }
980
981 FUNCTION {format.edition}
982 {
983 edition edition lastint format.number.th *
984 }
985
986 INTEGERS { multiresult }
987
988 FUNCTION {multi.page.check}
989 {
990 't :=
991 #0 'multiresult :=
992 {
993 multiresult not
994 t empty$ not
995 and
996 }
997 {
998 t #1 #1 substring$
999 duplicate$ "-" =
1000 swap$ duplicate$ "," =
1001 swap$ "+" =
1002 or or
1003 { #1 'multiresult := }
1004 { t #2 global.max$ substring$ 't := }
1005 if$
1006 }
1007 while$
1008 multiresult
1009 }
1010
1011 FUNCTION {format.pages}
1012 {
1013 pages empty$
1014 { "" }
1015 {
1016 ","
1017 pages multi.page.check
1018 { "\chsPages{}" pages n.dashify tie.or.space.connect }
1019 { "\chsPage{}" pages tie.or.space.connect }
1020 if$
1021 tie.or.space.connect
1022 }
1023 if$
1024 }
1025
1026 INTEGERS { len }
1027
1028 FUNCTION {chop.word}
1029 {
1030 's :=
1031 'len :=
1032 s #1 len substring$ =
1033 { s len #1 + global.max$ substring$ }
1034 's
1035 if$
1036 }
1037
1038 INTEGERS { ind tsslen }
1039
1040 STRINGS { tss ret rss istr }
1041
1042 FUNCTION {replace.substring}
1043 {
1044 'rss :=
1045 'tss :=
1046 'istr :=
1047 "" 'ret :=
1048 tss text.length$ 'tsslen :=
1049 #1 'ind :=
1050 { istr ind tsslen substring$ "" = not }
1051 {
1052 istr ind tsslen substring$ tss =
1053 {
1054 ret rss * 'ret :=
1055 ind tsslen + 'ind :=
1056 }
1057 {
1058 ret istr ind #1 substring$ * 'ret :=
1059 ind #1 + 'ind :=
1060 }
1061 if$
1062 }
1063 while$
1064 ret
1065 }
1066
1067 FUNCTION {format.lab.names.abbr}
1068 {
1069 's :=
1070 s num.names$ 'numnames :=
1071 numnames #1 >
1072 {
1073 numnames #3 >
1074 { s #1 "{vv~}{ll}" format.name$ " et~al." * }
1075 {
1076 s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1077 { s #1 "{vv~}{ll}" format.name$ " et~al." * }
1078 {
1079 s #1 "{vv~}{ll}" format.name$ " \chsWand{}\ " *
1080 s #2 "{vv~}{ll}" format.name$ *
1081 }
1082 if$
1083 }
1084 if$
1085 }
1086 { s #1 "{vv~}{ll}" format.name$ }
1087 if$
1088 }
1089
1090 FUNCTION {format.lab.names.full}
1091 {
1092 's :=
1093 #1 'nameptr :=
1094 s num.names$ 'numnames :=
1095 numnames 'namesleft :=
1096 { namesleft #0 > }
1097 {
1098 s nameptr "{vv~}{ll}" format.name$ 't :=
1099 nameptr #1 >
1100 {
1101 namesleft #1 >
1102 { ", " * t * }
1103 {
1104 t "others" =
1105 { " et~al." * }
1106 { " \chsWand{}\ " * t * }
1107 if$
1108 }
1109 if$
1110 }
1111 't
1112 if$
1113 nameptr #1 + 'nameptr :=
1114 namesleft #1 - 'namesleft :=
1115 }
1116 while$
1117 }
1118
1119 INTEGERS { author.field editor.field organization.field title.field key.field }
1120
1121 FUNCTION {init.field.constants}
1122 {
1123 #0 'author.field :=
1124 #1 'editor.field :=
1125 #2 'organization.field :=
1126 #3 'title.field :=
1127 #4 'key.field :=
1128 }
1129
1130 FUNCTION {make.list.label}
1131 {
1132 author.field field.used =
1133 { format.authors }
1134 {
1135 editor.field field.used =
1136 { format.editors }
1137 {
1138 organization.field field.used =
1139 { "The " #4 organization chop.word #3 text.prefix$ }
1140 {
1141 title.field field.used =
1142 { format.btitle }
1143 {
1144 key.field field.used =
1145 { key #3 text.prefix$ }
1146 { "Internal error :001 on " cite$ * " label" * warning$ }
1147 if$
1148 }
1149 if$
1150 }
1151 if$
1152 }
1153 if$
1154 }
1155 if$
1156 }
1157
1158 FUNCTION {make.full.label}
1159 {
1160 author.field field.used =
1161 { author format.lab.names.full }
1162 {
1163 editor.field field.used =
1164 { editor format.lab.names.full }
1165 {
1166 organization.field field.used =
1167 { "The " #4 organization chop.word #3 text.prefix$ }
1168 {
1169 title.field field.used =
1170 { format.btitle }
1171 {
1172 key.field field.used =
1173 { key #3 text.prefix$ }
1174 { "Internal error :001 on " cite$ * " label" * warning$ }
1175 if$
1176 }
1177 if$
1178 }
1179 if$
1180 }
1181 if$
1182 }
1183 if$
1184 }
1185
1186 FUNCTION {make.abbr.label}
1187 {
1188 author.field field.used =
1189 { author format.lab.names.abbr }
1190 {
1191 editor.field field.used =
1192 { editor format.lab.names.abbr }
1193 {
1194 organization.field field.used =
1195 { "The " #4 organization chop.word #3 text.prefix$ }
1196 {
1197 title.field field.used =
1198 { format.btitle }
1199 {
1200 key.field field.used =
1201 { key #3 text.prefix$ }
1202 { "Internal error :001 on " cite$ * " label" * warning$ }
1203 if$
1204 }
1205 if$
1206 }
1207 if$
1208 }
1209 if$
1210 }
1211 if$
1212 }
1213
1214 FUNCTION {output.bibitem}
1215 {
1216 newline$
1217 "\chsitem{" write$
1218 make.abbr.label write$
1219 "}{" write$
1220 list.year write$
1221 "}{" write$
1222 cite$ write$
1223 "}" write$
1224 newline$
1225 ""
1226 before.all 'output.state :=
1227 }
1228
1229 FUNCTION {journal.or.series}
1230 {
1231 journal missing$
1232 { series }
1233 { journal }
1234 if$
1235 }
1236
1237 FUNCTION {publisher.or.school}
1238 {
1239 publisher missing$
1240 { school }
1241 { publisher }
1242 if$
1243 }
1244
1245 %% STYLES
1246 FUNCTION {article}
1247 { output.bibitem
1248 make.list.label "(" tie.or.space.connect list.year * ")" *
1249 author "author" item.check
1250 title missing$
1251 'skip$
1252 { title tie.or.space.connect }
1253 if$
1254 type$ "inproceedings" =
1255 type$ "conference" =
1256 or not
1257 month missing$
1258 or
1259 'skip$
1260 { ";" month year tie.or.space.connect tie.or.space.connect }
1261 if$
1262 journal missing$
1263 'skip$
1264 { add.period$ journal.or.series emphasize tie.or.space.connect
1265 volume missing$
1266 { cite$ " has journal/series with no volume!" * warning$ }
1267 { "," "\chsVolume{}" tie.or.space.connect volume tie.or.space.connect * }
1268 if$
1269 number missing$
1270 'skip$
1271 { "," "\chsNumero{}" number tie.or.space.connect tie.or.space.connect * }
1272 if$
1273 }
1274 if$
1275 pages missing$
1276 'skip$
1277 { format.pages * }
1278 if$
1279 add.period$ *
1280
1281 fin.entry
1282 }
1283
1284 FUNCTION {book}
1285 { output.bibitem
1286 make.list.label "(" tie.or.space.connect list.year * ")" *
1287 author "author" item.check
1288 chapter missing$
1289 'skip$
1290 { chapter add.period$ "\chsWin{}" tie.or.space.connect tie.or.space.connect }
1291 if$
1292 title missing$
1293 'skip$
1294 { title emphasize tie.or.space.connect }
1295 if$
1296 editor missing$
1297 'skip$
1298 { "," format.book.editors tie.or.space.connect }
1299 if$
1300 pages missing$
1301 journal missing$
1302 not or
1303 'skip$
1304 { format.pages * }
1305 if$
1306 add.period$
1307 edition missing$
1308 'skip$
1309 { edition empty$
1310 'skip$
1311 { format.edition "\chsEdition{}" add.period$ tie.or.space.connect tie.or.space.connect }
1312 if$
1313 }
1314 if$
1315 URL missing$
1316 'skip$
1317 { "[\chsWelectronic]" tie.or.space.connect }
1318 if$
1319 publisher missing$
1320 school missing$
1321 and
1322 'skip$
1323 { address missing$
1324 { cite$ " has publisher with no address!" * warning$ }
1325 { address ":" * publisher.or.school tie.or.space.connect add.period$ tie.or.space.connect }
1326 if$
1327 }
1328 if$
1329 series missing$
1330 journal missing$
1331 and
1332 'skip$
1333 { volume missing$
1334 { cite$ " has journal/series with no volume!" * warning$ }
1335 { "(" journal.or.series ":" * * volume tie.or.space.connect
1336 series missing$
1337 'skip$
1338 { format.pages * }
1339 if$
1340 ")" add.period$ * tie.or.space.connect * }
1341 if$
1342 }
1343 if$
1344
1345 type$ "mastersthesis" =
1346 type$ "phdthesis" =
1347 or
1348 'skip$
1349 { write$ fin.entry }
1350 if$
1351 }
1352
1353 FUNCTION {booklet} { book }
1354
1355 FUNCTION {inbook} { book }
1356
1357 FUNCTION {incollection} { book }
1358
1359 FUNCTION {inproceedings}
1360 { output.bibitem
1361 make.list.label "(" tie.or.space.connect list.year * ")" *
1362 author "author" item.check
1363 booktitle missing$
1364 { title emphasize tie.or.space.connect }
1365 { title add.period$ "\chsWin{}" tie.or.space.connect booktitle emphasize tie.or.space.connect tie.or.space.connect }
1366 if$
1367 month missing$
1368 'skip$
1369 { booktitle missing$
1370 { add.period$ }
1371 { ";" * }
1372 if$
1373 month "~" year * * tie.or.space.connect
1374 }
1375 if$
1376 address missing$
1377 'skip$
1378 { "," address tie.or.space.connect add.period$ * }
1379 if$
1380 pages missing$
1381 'skip$
1382 { format.pages add.period$ tie.or.space.connect }
1383 if$
1384 write$
1385
1386 fin.entry
1387 }
1388
1389 FUNCTION {conference} { inproceedings }
1390
1391 FUNCTION {manual}
1392 { cite$ ": @manual cite style not implemented!" * warning$ }
1393
1394 FUNCTION {mastersthesis}
1395 { book
1396 "(\chsWmscthesis{}" tie.or.space.connect
1397 note missing$
1398 'skip$
1399 { "\chsWinstitution{}" note tie.or.space.connect tie.or.space.connect }
1400 if$
1401 ")" add.period$ * write$
1402 fin.entry
1403 }
1404
1405 FUNCTION {phdthesis}
1406 { book
1407 "(\chsWphdthesis{}" tie.or.space.connect
1408 note missing$
1409 'skip$
1410 { "\chsWinstitution{}" note tie.or.space.connect tie.or.space.connect }
1411 if$
1412 ")" add.period$ * write$
1413 fin.entry
1414 }
1415
1416 FUNCTION {proceedings} { inproceedings }
1417
1418 FUNCTION {unpublished}
1419 { output.bibitem
1420 make.list.label "(" tie.or.space.connect list.year * ")" *
1421 author "author" item.check
1422 chapter missing$
1423 'skip$
1424 { chapter add.period$ "\chsWin{}" tie.or.space.connect tie.or.space.connect tie.or.space.connect }
1425 if$
1426 title missing$
1427 'skip$
1428 { title emphasize tie.or.space.connect }
1429 if$
1430 editor missing$
1431 'skip$
1432 { "," format.book.editors tie.or.space.connect * }
1433 if$
1434 pages missing$
1435 journal missing$
1436 not or
1437 'skip$
1438 { format.pages * }
1439 if$
1440 add.period$
1441 URL missing$
1442 { "\chsWprinting{}" tie.or.space.connect add.period$ }
1443 { "[\chsWelectronic]" tie.or.space.connect }
1444 if$
1445 publisher missing$
1446 'skip$
1447 { address missing$
1448 { cite$ " has publisher with no address!" * warning$ }
1449 { address ":" * publisher.or.school tie.or.space.connect add.period$ tie.or.space.connect }
1450 if$
1451 }
1452 if$
1453 write$
1454
1455 fin.entry
1456 }
1457
1458 FUNCTION {misc}
1459 { output.bibitem
1460 make.list.label "(" tie.or.space.connect list.year * ")" *
1461 author "author" item.check
1462 title missing$
1463 'skip$
1464 { title tie.or.space.connect add.period$ }
1465 if$
1466 howpublished missing$
1467 'skip$
1468 { howpublished emphasize tie.or.space.connect add.period$ }
1469 if$
1470 URL missing$
1471 'skip$
1472 { " \chsurl{" URL "}" * * tie.or.space.connect add.period$ }
1473 if$
1474 note missing$
1475 'skip$
1476 { "(" note ")" * * tie.or.space.connect add.period$ }
1477 if$
1478 write$
1479 fin.entry
1480 }
1481
1482 FUNCTION {techreport}
1483 { output.bibitem
1484 make.list.label "(" tie.or.space.connect list.year * ")" *
1485 author "author" item.check
1486 title missing$
1487 { cite$ " has no title!" * warning$ }
1488 { title emphasize tie.or.space.connect add.period$ }
1489 if$
1490 URL missing$
1491 'skip$
1492 { "[\chsWelectronic]" tie.or.space.connect }
1493 if$
1494 institution missing$
1495 { cite$ " has no institution!" * warning$ }
1496 { address missing$
1497 { cite$ " has institution with no address!" * warning$ }
1498 { address ":" * tie.or.space.connect }
1499 if$
1500 institution tie.or.space.connect add.period$
1501 number missing$
1502 { cite$ " has institution with no number!" * warning$ }
1503 { "(\chsWtechreport{}:" number tie.or.space.connect ")" * tie.or.space.connect }
1504 if$
1505 }
1506 if$
1507 add.period$
1508 write$
1509 fin.entry
1510 }
1511
1512 FUNCTION {patent}
1513 { output.bibitem
1514 make.list.label "(" tie.or.space.connect list.year * ")" *
1515 author "author" item.check
1516 title missing$
1517 'skip$
1518 { title emphasize tie.or.space.connect add.period$ }
1519 if$
1520 number missing$
1521 'skip$
1522 { number tie.or.space.connect add.period$ }
1523 if$
1524 write$
1525 fin.entry
1526 }
1527
1528 FUNCTION {default.type} { misc }
1529
1530 MACRO {jan} {"\chsWjanuary{}"}
1531 MACRO {feb} {"\chsWfebruary{}"}
1532 MACRO {mar} {"\chsWmarch{}"}
1533 MACRO {apr} {"\chsWapril{}"}
1534 MACRO {may} {"\chsWmay{}"}
1535 MACRO {jun} {"\chsWjune{}"}
1536 MACRO {jul} {"\chsWjuly{}"}
1537 MACRO {aug} {"\chsWaugust{}"}
1538 MACRO {sep} {"\chsWseptember{}"}
1539 MACRO {oct} {"\chsWoctober{}"}
1540 MACRO {nov} {"\chsWnovember{}"}
1541 MACRO {dec} {"\chsWdecember{}"}
1542
1543 MACRO {acmcs} {"ACM Computing Surveys"}
1544 MACRO {acta} {"Acta Informatica"}
1545 MACRO {cacm} {"Communications of the ACM"}
1546 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1547 MACRO {ibmsj} {"IBM Systems Journal"}
1548 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1549 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1550 MACRO {ieeetcad} {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1551 MACRO {ipl} {"Information Processing Letters"}
1552 MACRO {jacm} {"Journal of the ACM"}
1553 MACRO {jcss} {"Journal of Computer and System Sciences"}
1554 MACRO {scp} {"Science of Computer Programming"}
1555 MACRO {sicomp} {"SIAM Journal on Computing"}
1556 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1557 MACRO {tods} {"ACM Transactions on Database Systems"}
1558 MACRO {tog} {"ACM Transactions on Graphics"}
1559 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1560 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1561 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1562 MACRO {tcs} {"Theoretical Computer Science"}
1563
1564 READ
1565
1566 EXECUTE {init.field.constants}
1567
1568 FUNCTION {sortify}
1569 {
1570 purify$
1571 "l" change.case$
1572 }
1573
1574 FUNCTION {sortify.names}
1575 {
1576 " \chsWand{}\ " " " replace.substring
1577 " et~al." " zzz" replace.substring
1578 sortify
1579 }
1580
1581 FUNCTION {author.key.label}
1582 {
1583 author empty$
1584 {
1585 key empty$
1586 { title.field 'field.used := }
1587 { key.field 'field.used := }
1588 if$
1589 }
1590 { author.field 'field.used := }
1591 if$
1592 }
1593
1594 FUNCTION {author.editor.key.label}
1595 {
1596 author empty$
1597 {
1598 editor empty$
1599 {
1600 key empty$
1601 { title.field 'field.used := }
1602 { key.field 'field.used := }
1603 if$
1604 }
1605 { editor.field 'field.used := }
1606 if$
1607 }
1608 { author.field 'field.used := }
1609 if$
1610 }
1611
1612 FUNCTION {author.key.organization.label}
1613 {
1614 author empty$
1615 {
1616 key empty$
1617 {
1618 organization empty$
1619 { title.field 'field.used := }
1620 { organization.field 'field.used := }
1621 if$
1622 }
1623 { key.field 'field.used := }
1624 if$
1625 }
1626 { author.field 'field.used := }
1627 if$
1628 }
1629
1630 FUNCTION {editor.key.organization.label}
1631 {
1632 editor empty$
1633 {
1634 key empty$
1635 {
1636 organization empty$
1637 { title.field 'field.used := }
1638 { organization.field 'field.used := }
1639 if$
1640 }
1641 { key.field 'field.used := }
1642 if$
1643 }
1644 { editor.field 'field.used := }
1645 if$
1646 }
1647
1648 FUNCTION {sort.format.title}
1649 {
1650 't :=
1651 "A " #2
1652 "An " #3
1653 "The " #4 t chop.word
1654 chop.word
1655 chop.word
1656 sortify
1657 #1 global.max$ substring$
1658 }
1659
1660 FUNCTION {calc.label}
1661 {
1662 make.abbr.label
1663 title.field field.used =
1664 { sort.format.title }
1665 { sortify.names }
1666 if$
1667 year field.or.null purify$ #-1 #4 substring$ sortify *
1668 'sort.label :=
1669 }
1670
1671 FUNCTION {preliminaries}
1672 {
1673 type$ "book" =
1674 type$ "inbook" =
1675 or
1676 'author.editor.key.label
1677 {
1678 type$ "proceedings" =
1679 'editor.key.organization.label
1680 {
1681 type$ "manual" =
1682 'author.key.organization.label
1683 'author.key.label
1684 if$
1685 }
1686 if$
1687 }
1688 if$
1689 }
1690
1691 FUNCTION {first.presort}
1692 {
1693 calc.label
1694 sort.label
1695 title.field field.used =
1696 { skip$ }
1697 { " " * make.list.label sortify.names * " " * title field.or.null sort.format.title * }
1698 if$
1699 #1 entry.max$ substring$
1700 'sort.key$ :=
1701 }
1702
1703 ITERATE {preliminaries}
1704
1705 ITERATE {first.presort}
1706
1707 SORT
1708
1709 STRINGS { last.sort.label next.extra last.full.label }
1710
1711 INTEGERS { last.extra.num }
1712
1713 FUNCTION {initialize.confusion}
1714 {
1715 #0 int.to.chr$ 'last.sort.label :=
1716 #0 int.to.chr$ 'last.full.label :=
1717 }
1718
1719 FUNCTION {confusion.pass}
1720 {
1721 last.sort.label sort.label =
1722 'skip$
1723 {
1724 sort.label 'last.sort.label :=
1725 make.full.label sortify.names 'last.full.label :=
1726 }
1727 if$
1728 }
1729
1730 EXECUTE {initialize.confusion}
1731
1732 ITERATE {confusion.pass}
1733
1734 EXECUTE {initialize.confusion}
1735
1736 REVERSE {confusion.pass}
1737
1738 FUNCTION {initialize.last.extra.num}
1739 {
1740 #0 int.to.chr$ 'last.sort.label :=
1741 "" 'next.extra :=
1742 #0 'last.extra.num :=
1743 }
1744
1745 FUNCTION {forward.pass}
1746 {
1747 last.sort.label sort.label =
1748 {
1749 last.extra.num #1 + 'last.extra.num :=
1750 last.extra.num int.to.chr$ 'extra.label :=
1751 }
1752 {
1753 "a" chr.to.int$ 'last.extra.num :=
1754 "" 'extra.label :=
1755 sort.label 'last.sort.label :=
1756 }
1757 if$
1758 }
1759
1760 FUNCTION {reverse.pass}
1761 {
1762 next.extra "b" =
1763 { "a" 'extra.label := }
1764 'skip$
1765 if$
1766 year empty$
1767 { "n.d." extra.label * 'list.year := }
1768 { year extra.label * 'list.year := }
1769 if$
1770 extra.label 'next.extra :=
1771 }
1772
1773 ITERATE {first.presort}
1774
1775 SORT
1776
1777 EXECUTE {initialize.last.extra.num}
1778
1779 ITERATE {forward.pass}
1780
1781 REVERSE {reverse.pass}
1782
1783 FUNCTION {second.presort}
1784 {
1785 make.list.label
1786 title.field field.used =
1787 { sort.format.title }
1788 { sortify.names }
1789 if$
1790 " " * list.year field.or.null sortify * " " *
1791 title.field field.used =
1792 'skip$
1793 { title field.or.null sort.format.title * }
1794 if$
1795 #1 entry.max$ substring$
1796 'sort.key$ :=
1797 }
1798
1799 ITERATE {second.presort}
1800
1801 SORT
1802
1803 FUNCTION {begin.bib}
1804 {
1805 preamble$ empty$
1806 'skip$
1807 {
1808 "\chspreambledefs{%" write$ newline$
1809 preamble$ write$ "}" write$ newline$
1810 "\chspreambletext{%" write$ newline$
1811 preamble$ write$ "}" write$ newline$
1812 }
1813 if$
1814 "\begin{thebibliography}{xx}" write$ newline$
1815 }
1816
1817 EXECUTE {begin.bib}
1818
1819 EXECUTE {init.state.consts}
1820
1821 ITERATE {call.type$}
1822
1823 FUNCTION {end.bib}
1824 {
1825 newline$
1826 "\end{thebibliography}" write$ newline$
1827 }
1828
1829 EXECUTE {end.bib}
1830 % \end{macrocode}
1831 %
1832 % \iffalse
1833 %</bibstyle>
1834 % \fi
1835 %
1836 % \Finale
1837 \endinput