								%-*-Web-*-
% This is APREAMBL.DOC, written by Hans-Hermann Bode (HHBODE@@DOSUNI1.BITNET).
% Use MAKEPROG to generate the program, use TeX to produce the documentation.

% This program is distributed WITHOUT ANY WARRANTY, express or implied.

% Copyright (C) 1991, 1992 Hans-Hermann Bode

% Permission is granted to make and distribute verbatim copies of this
% document provided that the copyright notice and this permission notice
% are preserved on all copies.

% Permission is granted to copy and distribute modified versions of this
% document under the conditions for verbatim copying, provided that the
% entire resulting derived work is distributed under the terms of a
% permission notice identical to this one.

% Version history:
%
% Version	Date		Author	Comment
% 1.10a		18 Jul 1991	H2B	First version for public release.
% 1.10b		10 Aug 1991	H2B	Improved handling of the language
%					switch, using MakeProg for
%					documentation.
% 1.10c		04 Apr 1992	H2B	Preventing multiple input, hiding
%					local identifiers, extending
%					documentation.
% 1.10d		15 Apr 1992	H2B	Incompatibility with german.sty 2.4a
%					fixed.
% 1.10e		28 Jun 1992	H2B	Problem with |\mdqoff| fixed.

%-----------------------------------------------------------------------------

\input docmac

\def\title{APREAMBL}
\def\curversion{1.10e}
\def\curdate{June 1992}

\def\topofcontents{\null\vfill
  \centerline{\ttitlefont\title}
  \medskip
  \centerline{Preamble definitions for the \BibTeX\ `adaptable' family}
  \medskip
  \centerline{Version \curversion, \curdate}
  \bigskip
  \centerline{\sl Hans-Hermann Bode}
  \centerline{\sl Arbeitsgruppe Systemforschung, Universit\"at Osnabr\"uck}
  \vfill}

\def\botofcontents{\vfill
  \noindent
  Copyright \copyright\ 1991,\thinspace1992 Hans-Hermann Bode
  \bigskip\noindent
  Permission is granted to make and distribute verbatim copies of this
  document provided that the copyright notice and this permission notice
  are preserved on all copies.
  \smallskip\noindent
  Permission is granted to copy and distribute modified versions of this
  document under the conditions for verbatim copying, provided that the
  entire resulting derived work is distributed under the terms of a
  permission notice identical to this one.}

%-----------------------------------------------------------------------------

%\input amssym.def
%\input btxmac
%\input sammac
\input a4c

%\frenchspacing

\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\def\LaTeX{{\rm L\kern-.36em\raise.3ex\hbox{\sc a}\kern-.15em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

\chap Introduction. %---------------------------------------------------------
This file provides preamble definitions for use with the \BibTeX\
`adaptable' family. It has to be read in at the beginning of a bibliography
that was generated by one of the adaptable styles. Usually this will be done
implicitly by means of an |@PREAMBLE| command in one of the bibliography
databases included in the |\bibliography| enumeration (e.g.,
\.{jourfull.bib} or \.{jourabbr.bib}), otherwise it must be |\input|
explicitly right before the |\bibliography| macro is executed.

\beginprog
% This is APREAMBL.TEX, version 1.10e, written by Hans-Hermann Bode
% (HHBODE@DOSUNI1.BITNET), for the BibTeX `adaptable' family, version 1.10.
% See the file APREAMBL.DOC for a detailed documentation.

% This program is distributed WITHOUT ANY WARRANTY, express or implied.

% Copyright (C) 1991, 1992 Hans-Hermann Bode

% Permission is granted to make and distribute verbatim copies of this
% document provided that the copyright notice and this permission notice
% are preserved on all copies.

% Permission is granted to copy and distribute modified versions of this
% document under the conditions for verbatim copying, provided that the
% entire resulting derived work is distributed under the terms of a
% permission notice identical to this one.
\endprog

\sect We use the---hopefully unique---identifier
|\csname__APREAMBLE_TEX\endcsname| to decide whether this file was already
read. If that identifier hasn't the meaning of |\relax|, we assume that this
event arose and execute an |\endinput|; otherwise, we continue and store the
|\catcode| of~|@| into it, which then will be set to~11 for use in local
macro names. Hence, |\csname__APREAMBLE_TEX\endcsname| now is defined to
prevent the file from multiply being input, and---on the other hand---we can
restore the |\catcode| of~|@| in the end.

\beginprog
\expandafter\ifx\csname__APREAMBLE_TEX\endcsname\relax \else\endinput\fi
\expandafter\chardef\csname__APREAMBLE_TEX\endcsname=\the\catcode`\@
\catcode`\@=11
\endprog

\chap Setting style parameters. %---------------------------------------------
The typesetting style of certain fields of the bibliography entries is
determined by the |\abtype| command. It is called by the adaptable styles
with two arguments: The first is a number that denotes the field in
question, the second is the text to format. The meaning of the first
parameter is declared in Tab.~1.
$$\hbox{\sl Table~1: The first parameter of |\abtype|.\strut}$$
$$\vbox{\halign{\strut\hfill#\hfill\quad & \vtop{\hsize=5cm\noindent#} \cr
  \noalign{\hrule\hrule}
  Value & Meaning \cr
  \noalign{\hrule}
  0 & author and editor names \cr
  1 & titles of books and series \cr
  2 & journal titles \cr
  3 & journal volumes \cr
  4 & journal numbers \cr
  5 & dates \cr
  \noalign{\hrule\hrule}
  }}
$$
A comparison with the definition below shows that {\sc author and editor
names} will be typeset in small caps, ``titles of books and series'' will be
put in quotes, {\it journal titles\/} will come out in italics, {\bf journal
volumes} will be boldface, and (journal numbers) and (dates) will be
parenthesized. This may be changed to fit your needs.

Currently, there is an English and a German version of the command. In the
German version, the commands |\glqq| and |\grqq|---defined in
\.{german.sty}---are used instead of |"`| and |"'|, in case we have
|\mdqoff| (double-quotes inactive) but |\language=\german|.

\beginprog
\gdef\abtype@english{%
\def\abtype##1##2{%
\ifcase##1{\sc##2}\or``##2''\or{\em##2\/}\or{\bf##2}\or(##2)\or(##2)\else##2\fi}}

\gdef\abtype@german{%
\def\abtype##1##2{%
\ifcase##1{\sc##2}\or\glqq##2\grqq\or{\em##2\/}\or{\bf##2}\or(##2)\or(##2)\else##2\fi}}
\endprog

\chap Definition of phrases. %------------------------------------------------
Phrases are defined by the |\abphrase| command. The only parameter is a code
for the phrase that is explained in Tab.~2.
$$\hbox{\sl Table~2: The parameter of |\abphrase|.\strut}$$
$$\vbox{\halign{\strut\hfill#\hfill\quad & \vtop{\hsize=10cm\noindent#} \cr
  \noalign{\hrule\hrule}
  Value & Meaning \cr
  \noalign{\hrule}
   0 & conjunction between two or before the last name of a name list \cr
   1 & comes before the last conjunction of a name list \cr
   2 & replaces names of co-authors and co-editors (``et al.'') \cr
   3 & marks multiple editors \cr
   4 & marks a single editor \cr
   5 & ``of'' for a volume of a series or crossref \cr
   6 & ``in'' for a number in a series \cr
   7 & ``In'' for crossrefs to books, articles, etc. \cr
   8 & comes before a volume number, lower-case \cr
   9 & comes before a volume number, upper-case \cr
  10 & comes before a series number, lower-case \cr
  11 & comes before a series number, upper-case \cr
  12 & comes after an edition number \cr
  13 & comes before multiple page numbers \cr
  14 & comes before a single page number \cr
  15 & comes before a chapter number \cr
  16 & denotes a technical report \cr
  17 & denotes a master's thesis \cr
  18 & denotes a phd thesis \cr
  \noalign{\hrule\hrule}
  }}
$$
Besides, macros for month names, edition numbers, and ``chapter'' names are
defined. (The |\abedition| command may be extended for higher edition numbers
and called directly or---better---via |@STRING| declarations in the \.{bib}
files).

For all these commands there exists a ``full'' and an ``abbreviated''
version. The |\ifabfull| switch is automatically defined by the adaptable
styles in front of the preamble and tells which version to use.

Furthermore, phrases can be supplied for various languages. For now, English
and German versions are available, but other languages might be implemented
similarly. If you carry out such an implementation, {\sl watch out for
spaces\/} that may be significant.

\sect Here is the English version:

\beginprog
\ifabfull

\gdef\abetc@english{

\def\abphrase##1{%
\ifcase##1{ and }\or{,}\or{ et~al.}\or{, editors}\or{, editor}\or%
{ of }\or{ in }\or{In }\or{volume}\or{Volume}\or{number}\or{Number}\or%
{ edition}\or{pages}\or{page}\or{chapter}\or%
{Technical Report}\or{Master's thesis}\or{PhD thesis}\fi}

\def\abmonth##1{\ifcase##1\or January\or February\or March\or April\or May\or
  June\or July\or August\or September\or October\or November\or December\fi}

\def\abedition##1{\ifcase##1\or First\or Second\or Third\or Fourth\or Fifth\or
  Sixth\or Seventh\or Eighth\or Ninth\or Tenth\else?\fi}

\def\abchapter##1{\ifcase##1Section\or Paragraph\or Appendix\or Part\fi}

}

\else

\gdef\abetc@english{

\def\abphrase##1{%
\ifcase##1{ and }\or{,}\or{ et~al.}\or{, editors}\or{, editor}\or%
{ of }\or{ in }\or{In }\or{vol.}\or{Vol.}\or{no.}\or{No.}\or%
{ ed.}\or{pp.}\or{p.}\or{ch.}\or%
{Technical Report}\or{Master's thesis}\or{PhD thesis}\fi}

\def\abmonth##1{\ifcase##1\or Jan.\or Feb.\or Mar.\or Apr.\or May\or June\or
  July\or Aug.\or Sept.\or Oct.\or Nov.\or Dec.\fi}

\def\abedition##1{\ifcase##1\or 1st\or 2nd\or 3rd\or 4th\or 5th\or
  6th\or 7th\or 8th\or 9th\or 10th\else?\fi}

\def\abchapter##1{\ifcase##1Sec.\or Par.\or App.\or Part\fi}

}

\fi
\endprog

\sect And here is the German version, in which again we bear in mind the
potential case that the current language is German but double-quotes are not
active. Thus, we use |{\kern0pt}| instead of \.{"\vbar} (from
\.{german.sty}) to get rid of ligatures and |\"| instead of |"| (ditto) for
umlauts.

\beginprog
\ifabfull

\gdef\abetc@german{

\def\abphrase##1{%
\ifcase##1{ und }\or{}\or{ und andere}\or{ (Herausgeber)}\or{ (Herausgeber)}\or%
{ aus }\or{ in }\or{In }\or{Band}\or{Band}\or{Nummer}\or{Nummer}\or%
{ Auf{\kern0pt}lage}\or{Seiten}\or{Seite}\or{Kapitel}\or%
{Bericht}\or{Diplomarbeit}\or{Dissertation}\fi}

\def\abmonth##1{\ifcase##1\or Januar\or Februar\or M\"arz\or April\or Mai\or
  Juni\or Juli\or August\or September\or Oktober\or November\or Dezember\fi}

\def\abedition##1{\ifcase##1\or Erste\or Zweite\or Dritte\or Vierte\or F\"unf\-te\or
  Sechste\or Siebte\or Achte\or Neunte\or Zehnte\else?\fi}

\def\abchapter##1{\ifcase##1Abschnitt\or Absatz\or Anhang\or Teil\fi}

}

\else

\gdef\abetc@german{

\def\abphrase##1{%
\ifcase##1{ und }\or{}\or{ u.\thinspace a.}\or{ (Hrsg.)}\or{ (Hrsg.)}\or%
{ aus }\or{ in }\or{In }\or{Bd.}\or{Bd.}\or{Nr.}\or{Nr.}\or%
{ Aufl.}\or{S.}\or{S.}\or{Kap.}\or%
{Bericht}\or{Diplomarbeit}\or{Dissertation}\fi}

\def\abmonth##1{\ifcase##1\or Jan.\or Feb.\or M\"arz\or Apr.\or Mai\or
  Juni\or Juli\or Aug.\or Sep.\or Okt.\or Nov.\or Dez.\fi}

\def\abedition##1{\ifcase##1\or 1.\or 2.\or 3.\or 4.\or 5.\or
  6.\or 7.\or 8.\or 9.\or 10.\else?\fi}

\def\abchapter##1{\ifcase##1Abschn.\or Abs.\or Anh.\or Teil\fi}

}

\fi
\endprog

\chap Establishing a language switch. %---------------------------------------
Now we have reached the point where we have to decide which of the language
versions defined above to use. We like to make this decision automatically,
without bothering the user with the declaration of an extra language
command. This, however, is a somewhat delicate task since, although \TeX~3
defines a |\language| counter, it doesn't say which code belongs to a given
actual language (and, in addition, what about former \TeX\ versions?).

It will come out that at least two groups of users should agree with our way
to handle this: those who always write English documents and those who use
the \.{german.sty} macro package. If we detect that \.{german.sty} is loaded
we follow the codes defined there, otherwise we create an English
bibliography. (Due to this, \.{german.sty} clearly has to be loaded before
\.{apreambl.tex}---if at all---; this should be no problem with \LaTeX\
where |german| is a document-style option, but with plain \TeX, take care
that |\input german.sty| comes before |\bibliography{...}| if necessary.)

Incidentally, the checking of certain conditions and the definitions made in
the following are stolen from \.{german.sty}.

First, if |\language| has not yet been declared we allocate a counter:

\beginprog
\expandafter\ifx\csname language\endcsname\relax % \ifundefined{language}
  \csname newcount\endcsname\language
\fi
\endprog

\sect If the macro |\mdqon| is undefined or is equal to |\relax|, it is
assumed that \.{german.sty} is not included. In this case we define language
codes according to \.{german.sty} and select |\USenglish| as the default
setting. The |\chardef| declarations for the other languages aren't really
necessary for \.{apreambl}, but in this manner the user can rely on the
fact that |\USenglish|, |\german|, |\austrian|, |\french|, and |\english| are
defined and have appropriate meanings whether \.{german.sty} is loaded or
not; so, he or she can make use of them in his or her \.{bib} files for
special purposes.

A slight surprise came about when \.{german.sty}, version 2.4a, was
released: the control sequences above disappeared and are replaced by
|\l@USenglish| etc. Furthermore, one can't rely on certain values for these
anymore. To fix this problem quickly, we check for that new control
sequences, if \.{german.sty} is loaded, and in case define the old ones
appropriately (this may be changed in the future). Thus, \.{apreambl} should
work with old and new versions of \.{german.sty}.

\beginprog
\expandafter\ifx\csname mdqon\endcsname\relax % \ifundefined{mdqon}
  \chardef\USenglish=0
  \chardef\german=1
  \chardef\austrian=1
  \chardef\french=2
  \chardef\english=0
  \language\USenglish
\else
  \expandafter\ifx\csname l@USenglish\endcsname\relax \else
    \chardef\USenglish=\l@USenglish\fi
  \expandafter\ifx\csname l@german\endcsname\relax \else
    \chardef\german=\l@german\fi
  \expandafter\ifx\csname l@austrian\endcsname\relax \else
    \chardef\austrian=\l@austrian\fi
  \expandafter\ifx\csname l@french\endcsname\relax \else
    \chardef\french=\l@french\fi
  \expandafter\ifx\csname l@english\endcsname\relax \else
    \chardef\english=\l@english\fi
\fi
\endprog

\sect Finally, depending on the language switch and the abbreviation mode, one
of the macro sets is chosen. (At the moment, since only English and German
macro versions are available, the German versions are used for |\german| and
|\austrian|, and the English versions are used for all other languages.)

\beginprog
\ifnum\language=\german
  \abtype@german \abetc@german
\else\ifnum\language=\austrian
  \abtype@german \abetc@german
\else
  \abtype@english \abetc@english
\fi\fi
\endprog

\chap Postlude. %-------------------------------------------------------------
At the very end, we restore the |\catcode| of~|@| and force the end of
inputting this file.

\beginprog
\catcode`\@=\csname__APREAMBLE_TEX\endcsname
\endinput
\endprog

%-----------------------------------------------------------------------------

\contentspage
