summaryrefslogtreecommitdiff
path: root/biblio/tib/inputs/Macros.ttx
blob: 0944e236f1eff5478d90a1eb02a89ca8917d45dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
%   Basic control strings and macros for tib bibliography formatting,
%   and default definitions.
%
%   tib and the accompaning TeX macros assume the \catcode of plain TeX
%   e.g. { demarks the beginning of a group, % demarks a comment, etc.
%   See D.E. Knuth, The TeXbook, p. 37.
%   So far as possible, definitions have been reduced to primitive TeX
%   strings, to make tib as compatible with any TeX as possible.
%   Two possible exceptions: the fonts \rm, \sl, \sevenrm are assumed 
%   to have been loaded by TeX.  If not, this file should be modified below.
%   Also macros for footnotes are tailored to the particular TeX, since
%   the footnote macros of different TeXs differ.  Footnote macro files
%   ending in .p are for plain TeX; those ending in .l are for LaTeX.
%
%   \Resetstrings and \Refformat are called within a local group---
%   the string names will not conflict with uses elsewhere in the document.
%   Other control strings are defined globally.  The following is
%   a complete list of such globally defined control strings (except those
%   the user might define in a private tib formatting file).
%
%      \Resetstrings     \Refformat        \Rpunct           \Lpunct
%      \Lspace           \Lperiod          \Lcomma           \Lquest
%      \Lcolon           \Lscolon          \Lbang            \Lquote
%      \Lqquote          \Lrquote          \Rspace           \Rperiod
%      \Rcomma           \Rquest           \Rcolon           \Rscolon
%      \Rbang            \Rquote           \Rqquote          \Rrquote
%      \Refstd           \Refstda          \Smallcapsaand    \Smallcapseand
%      \Acomma           \Aand             \Aandd            \Ecomma
%      \Eand             \Eandd            \acomma           \aand
%      \aandd            \ecomma           \eand             \eandd
%      \Namecomma        \Nameand          \Nameandd         \Revcomma
%      \Initper          \Initgap          \Citefont         \ACitefont
%      \Authfont         \Titlefont        \Tomefont         \Volfont
%      \Flagfont         \Reffont          \Smallcapsfont    \Underlinemark
%      \Citebrackets     \Citeparen        \Citesuper        \Citenamedate
%      \Lcitemark        \Rcitemark        \LAcitemark       \RAcitemark
%      \LIcitemark       \RIcitemark       \Citehyphen       \Citecomma
%      \Citebreak        \Resetstrings     \ztest            \zstr
%      \Ztest            \Zstr        
%      \journalarticleformat      \conferencereportformat    \bookformat
%      \technicalreportformat     \bookarticleformat         \otherformat
%
%   This file is \input first in a document processed by tib.
%   Secondly any tib format files are processed.  Then the input
%   document file is read and processed.  Thus the default definitions
%   of this file can be overridden either in the tib format files
%   or the input document.
%
%   \Refformat calls macros for creating the actual bibliography listings.
%   Such macros are generally kept in tibtex files and \input by a statement
%   in the tib format file.

\def\Resetstrings{%Clears all strings before processing reference listing.
%   The strings (\Astr, etc.) are fields taken from the database.
%   If the string is present, the appropriate test (\Atest, etc) is set
%   equal to \present---thus allowing the macros to test for the presence 
%   or absence of a field.  All reference processing is done in a local
%   group--the control string names will not conflict with uses
%   elsewhere in the document.
    \def\present{ }\let\bgroup={\let\egroup=}%primitive TeX
    \def\Astr{}\def\astr{}\def\Atest{}\def\atest{}%
    \def\Bstr{}\def\bstr{}\def\Btest{}\def\btest{}%
    \def\Cstr{}\def\cstr{}\def\Ctest{}\def\ctest{}%
    \def\Dstr{}\def\dstr{}\def\Dtest{}\def\dtest{}%
    \def\Estr{}\def\estr{}\def\Etest{}\def\etest{}%
    \def\Fstr{}\def\fstr{}\def\Ftest{}\def\ftest{}%
    \def\Gstr{}\def\gstr{}\def\Gtest{}\def\gtest{}%
    \def\Hstr{}\def\hstr{}\def\Htest{}\def\htest{}%
    \def\Istr{}\def\istr{}\def\Itest{}\def\itest{}%
    \def\Jstr{}\def\jstr{}\def\Jtest{}\def\jtest{}%
    \def\Kstr{}\def\kstr{}\def\Ktest{}\def\ktest{}%
    \def\Lstr{}\def\lstr{}\def\Ltest{}\def\ltest{}%
    \def\Mstr{}\def\mstr{}\def\Mtest{}\def\mtest{}%
    \def\Nstr{}\def\nstr{}\def\Ntest{}\def\ntest{}%
    \def\Ostr{}\def\ostr{}\def\Otest{}\def\otest{}%
    \def\Pstr{}\def\pstr{}\def\Ptest{}\def\ptest{}%
    \def\Qstr{}\def\qstr{}\def\Qtest{}\def\qtest{}%
    \def\Rstr{}\def\rstr{}\def\Rtest{}\def\rtest{}%
    \def\Sstr{}\def\sstr{}\def\Stest{}\def\stest{}%
    \def\Tstr{}\def\tstr{}\def\Ttest{}\def\ttest{}%
    \def\Ustr{}\def\ustr{}\def\Utest{}\def\utest{}%
    \def\Vstr{}\def\vstr{}\def\Vtest{}\def\vtest{}%
    \def\Wstr{}\def\wstr{}\def\Wtest{}\def\wtest{}%
    \def\Xstr{}\def\xstr{}\def\Xtest{}\def\xtest{}%
    \def\Ystr{}\def\ystr{}\def\Ytest{}\def\ytest{}%
}
\Resetstrings\def\Ztest{}\def\ztest{}

\def\Refformat{%Determines the kind of reference by the presence or
%   absence of certain fields in the database listing, and calls the
%   appropriate macro.
         \if\Jtest\present
             {\if\Vtest\present\journalarticleformat
                  \else\conferencereportformat\fi}
            \else\if\Btest\present\bookarticleformat
               \else\if\Rtest\present\technicalreportformat
                  \else\if\Itest\present\bookformat
                     \else\otherformat\fi\fi\fi\fi}

\def\Rpunct{%Default punctuation control strings if the punctuation
%   is to appear after the citation.  (tib looks for punctuation to
%   precede the incomplete citation in the input document; the TeX
%   output puts it to the left or right depending on the style of citation.)
   \def\Lspace{ }%
   \def\Lperiod{ }%  .
   \def\Lcomma{ }%    ,
   \def\Lquest{ }%     ?
   \def\Lcolon{ }%   :
   \def\Lscolon{ }%   ;
   \def\Lbang{ }%      !
   \def\Lquote{ }%   '
   \def\Lqquote{ }%   "
   \def\Lrquote{ }%    `
   \def\Rspace{}%
   \def\Rperiod{.}%  .
   \def\Rcomma{,}%    ,
   \def\Rquest{?}%     ?
   \def\Rcolon{:}%   :
   \def\Rscolon{;}%   ;
   \def\Rbang{!}%      !
   \def\Rquote{'}%   '
   \def\Rqquote{"}%   "
   \def\Rrquote{`}%    `
   }

\def\Lpunct{%Default punctuation control strings if the punctuation
%   is to appear before the citation.  (tib looks for punctuation to
%   precede the incomplete citation in the input document; the TeX
%   output puts it to the left or right depending on the style of citation.)
   \def\Lspace{}%
   \def\Lperiod{\unskip.}%  .
   \def\Lcomma{\unskip,}%    ,
   \def\Lquest{\unskip?}%     ?
   \def\Lcolon{\unskip:}%   :
   \def\Lscolon{\unskip;}%   ;
   \def\Lbang{\unskip!}%      !
   \def\Lquote{\unskip'}%   '
   \def\Lqquote{\unskip"}%   "
   \def\Lrquote{\unskip`}%    `
   \def\Rspace{\spacefactor=1000}%
   \def\Rperiod{\spacefactor=3000}%  .
   \def\Rcomma{\spacefactor=1250}%    ,
   \def\Rquest{\spacefactor=3000}%     ?
   \def\Rcolon{\spacefactor=2000}%   :
   \def\Rscolon{\spacefactor=1250}%   ;
   \def\Rbang{\spacefactor=3000}%      !
   \def\Rquote{\spacefactor=1000}%   '
   \def\Rqquote{\spacefactor=1000}%   "
   \def\Rrquote{\spacefactor=1000}%    `
   }

\def\Refstd{%Standard control strings for formatting bibliography listings.
     \def\Acomma{\unskip, }%between multiple author names
     \def\Aand{\unskip\ and }%between two author names
     \def\Aandd{\unskip\ and }%between last two of multiple author names
     \def\Ecomma{\unskip, }%between multiple editor names
     \def\Eand{\unskip\ and }%between two editor names
     \def\Eandd{\unskip\ and }%between last two of multiple author names
     \def\acomma{\unskip, }%same for authors of reviewed material
     \def\aand{\unskip\ and }%same for authors of reviewed material
     \def\aandd{\unskip\ and }%same for authors of reviewed material
     \def\ecomma{\unskip, }%same for translators
     \def\eand{\unskip\ and }%same for translators
     \def\eandd{\unskip\ and }%same for translators
     \def\Namecomma{\unskip, }%same for citations using authors' names
     \def\Nameand{\unskip\ and }%same for citations using authors' names
     \def\Nameandd{\unskip\ and }%same for citations using authors' names
     \def\Revcomma{\unskip, }%between last and first name of reversed name
     \def\Initper{.\ }%punctuation after initial
     \def\Initgap{\dimen0=\spaceskip\divide\dimen0 by 2\hskip-\dimen0}%
                           %gap between initials of abbreviated first name
   }

\def\Smallcapsaand{%Smallcaps redefinition of \Aand and \Aandd for \Refstd
     \def\Aand{\unskip\bgroup{\Smallcapsfont\ AND }\egroup}%
     \def\Aandd{\unskip\bgroup{\Smallcapsfont\ AND }\egroup}%
     \def\eand{\unskip\bgroup\Smallcapsfont\ AND \egroup}%
     \def\eandd{\unskip\bgroup\Smallcapsfont\ AND \egroup}%
   }

\def\Smallcapseand{%Smallcaps redefinition of \Eand, \Eeand, etc for Refstd
     \def\Eand{\unskip\bgroup\Smallcapsfont\ AND \egroup}%
     \def\Eandd{\unskip\bgroup\Smallcapsfont\ AND \egroup}%
     \def\aand{\unskip\bgroup\Smallcapsfont\ AND \egroup}%
     \def\aandd{\unskip\bgroup\Smallcapsfont\ AND \egroup}%
   }

\def\Refstda{%Standard control strings for formatting bibliography listings.
%                         \Refstda sets an Ampersand instead of the word "and".
    \chardef\Ampersand=`\&%primitive TeX
    \def\Acomma{\unskip, }%between multiple author names
    \def\Aand{\unskip\ \Ampersand\ }%between two author names
    \def\Aandd{\unskip\ \Ampersand\ }%between last two of multiple author names
    \def\Ecomma{\unskip, }%between multiple editor names
    \def\Eand{\unskip\ \Ampersand\ }%between two editor names
    \def\Eandd{\unskip\ \Ampersand\ }%between last two of multiple author names
    \def\acomma{\unskip, }%same for authors of reviewed material
    \def\aand{\unskip\ \Ampersand\ }%same for authors of reviewed material
    \def\aandd{\unskip\ \Ampersand\ }%same for authors of reviewed material
    \def\ecomma{\unskip, }%same for translators
    \def\eand{\unskip\ \Ampersand\ }%same for translators
    \def\eandd{\unskip\ \Ampersand\ }%same for translators
    \def\Namecomma{\unskip, }%same for citations using authors' names
    \def\Nameand{\unskip\ \Ampersand\ }%same for citations using authors' names
   \def\Nameandd{\unskip\ \Ampersand\ }%same for citations using authors' names
    \def\Revcomma{\unskip, }%between last and first name of reversed name
    \def\Initper{.\ }%punctuation after initial
    \def\Initgap{\dimen0=\spaceskip\divide\dimen0 by 2\hskip-\dimen0}%
                           %gap between initials of abbreviated first name
  }

%default fonts
   \def\Citefont{}%citations
   \def\ACitefont{}%alternate citations
   \def\Authfont{}%authors
   \def\Titlefont{}%titles
   \def\Tomefont{\sl}%journals or books
   \def\Volfont{}%volume number of journal
   \def\Flagfont{}%citation flag
   \def\Reffont{\rm}%set at beginning of reference listing
   \def\Smallcapsfont{\sevenrm}%small caps
   \def\Flagstyle#1{\hangindent\parindent\indent\hbox to0pt%flag style
       {\hss[{\Flagfont#1}]\kern.5em}\ignorespaces}%        for references

\def\Underlinemark{\vrule height .7pt depth 0pt width 3pc}%for replacing
%   successive listings of identical author(s) by underline (U option
%      in tib format file or -u flag on call).

\def\Citebrackets{\Rpunct%defaults for putting citations in brackets [].
   \def\Lcitemark{\def\Cfont{\Citefont}[\bgroup\Cfont}%mark at left of citation
   \def\Rcitemark{\egroup]}%mark at right of citation
   \def\LAcitemark{\def\Cfont{\ACitefont}\bgroup\ACitefont}%
                         %mark at left of alternate citation
   \def\RAcitemark{\egroup}%mark at right of alternate citation
   \def\LIcitemark{\egroup}%mark at left of insertion in citation
   \def\RIcitemark{\bgroup\Cfont}%mark at right of insertion in citation
   \def\Citehyphen{\egroup--\bgroup\Cfont}%separater for string of citations
   \def\Citecomma{\egroup,\hskip0pt\bgroup\Cfont}%
                                          %separater for multiple citations
   \def\Citebreak{}%mark between parts of citation (e.g. author\Citebreak date)
   }

\def\Citeparen{\Rpunct%defaults for putting citations in parenthesis ().
   \def\Lcitemark{\def\Cfont{\Citefont}(\bgroup\Cfont}%mark at left of citation
   \def\Rcitemark{\egroup)}%mark at right of citation
   \def\LAcitemark{\def\Cfont{\ACitefont}\bgroup\ACitefont}%
                         %mark at left of alternate citation
   \def\RAcitemark{\egroup}%mark at right of alternate citation
   \def\LIcitemark{\egroup}%mark at left of insertion in citation
   \def\RIcitemark{\bgroup\Cfont}%mark at right of insertion in citation
   \def\Citehyphen{\egroup--\bgroup\Cfont}%separater for string of citations
   \def\Citecomma{\egroup,\hskip0pt\bgroup\Cfont}%
                                          %separater for multiple citations
   \def\Citebreak{}%mark between parts of citation (e.g. author\Citebreak date)
   }

\def\Citesuper{\Lpunct%defaults for making superscript citations
   \def\Lcitemark{\def\Cfont{\Citefont}\raise1ex\hbox\bgroup\bgroup\Cfont}%
                         %mark at left of citation
   \def\Rcitemark{\egroup\egroup}%mark at right of citation
   \def\LAcitemark{\def\Cfont{\ACitefont}\bgroup\ACitefont}%
                         %mark at left of alternate citation
   \def\RAcitemark{\egroup}%mark at right of alternate citation
   \def\LIcitemark{\egroup\egroup}%mark at left of insertion in citation
   \def\RIcitemark{\raise1ex\hbox\bgroup\bgroup\Cfont}%
                         %mark at right of insertion in citation
   \def\Citehyphen{\egroup--\bgroup\Cfont}%separater for string of citations
   \def\Citecomma{\egroup,\hskip0pt\bgroup%
      \Cfont}%separater for multiple citations
   \def\Citebreak{}%mark between parts of citation (e.g. author\Citebreak date)
   } 

\def\Citenamedate{\Rpunct%defaults for making name-date citations
   \def\Lcitemark{%mark at left of citation--also sets internal punctuation
      \def\Citebreak{\egroup\ [\bgroup\Citefont}%separater in citation
      \def\Citecomma{\egroup]; %between multiple citations
         \bgroup\let\uchyph=1\Citefont}(\bgroup\let\uchyph=1\Citefont}%
   \def\Rcitemark{\egroup])}%mark at right of citation
   \def\LAcitemark{%mark at left of alternate citation
      \def\Citebreak{\egroup\ [\bgroup\Citefont}\def\Citecomma{\egroup], %
         \bgroup\ACitefont }\bgroup\let\uchyph=1\ACitefont}%
   \def\RAcitemark{\egroup]}%mark at right of alternate citation
  \def\Citehyphen{\egroup--\bgroup\Citefont}%separater for string of citations
   \def\LIcitemark{\egroup}%mark at left of insertion in citation
   \def\RIcitemark{\bgroup\Citefont}%mark at right of insertion in citation
   }