Should work with polyglossia and babel
[code/biblatex-sbg-linguistics.git] / sbg-linguistics.bbx
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % sbg-linguistics.bbx, v0.1
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either version 1.3
6 % of this license or (at your option) any later version.
7 % The latest version of this license is in
8 % http://www.latex-project.org/lppl.txt
9 % and version 1.3 or later is part of all distributions of LaTeX
10 % version 2005/12/01 or later.
11 %
12 % A bibliography style for use with biblatex
13 % Developed by Andreas Bilke,
14 % based on the guidlines of the linguistics department at the
15 % University of Salzburg
16 %
17 % This work consists of the files sbg-linguistics.bbx,
18 % sbg-lingusitics.dbx, sbg-linguistics.ctx and ngerman-sbg-linguistics.lbx
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20
21 \ProvidesFile{sbg-linguistics.bbx}
22 \RequireBiber[3]
23
24 \RequireBibliographyStyle{authoryear}
25 \NewBibliographyString{onlinestrg}
26
27 \DeclareLanguageMapping{ngerman}{german-sbg-linguistics}
28 \DeclareLanguageMapping{german}{german-sbg-linguistics}
29
30 \DeclareDataInheritance{book,proceedings,collection}{inbook,inproceedings,incollection}{
31 \inherit{year}{bookyear}
32 }
33
34 \usepackage{xpatch}
35
36 \ExecuteBibliographyOptions{
37 isbn=false, % Entferne ISBN
38 doi=false, % Entferne DOI
39 uniquename=init,
40 dashed=false, % entferne Dash bei Autoren in Bibliographie die aufeinanderfolgen
41 alldates=long,
42 dateabbrev=false
43 }
44
45 \DeclareFieldFormat{url}{\bibstring{url}\addcolon\space\textless\url{#1}\textgreater}
46 \DeclareFieldFormat{urldate}{{[}\bibstring{urlseen}\space#1{]}}
47
48 \DeclareNameAlias{sortname}{last-first}
49 \DeclareNameAlias{default}{last-first}
50
51 \DeclareFieldFormat[book, thesis]{title}{\emph{#1}}
52 \DeclareFieldFormat[inproceedings, incollection, inbook]{labeltitle}{#1}
53 \DeclareFieldFormat[article, inproceedings, incollection, inbook]{title}{#1}
54
55 \DeclareFieldFormat[online]{title}{\emph{#1}\space{[}\bibxstring{onlinestrg}{]}}
56
57 % In: kursiv machen
58 \renewbibmacro*{in:}{%
59 \printtext{%
60 \emph{\bibstring{in}}\intitlepunct}}
61
62
63 % Klammer um Jahreszahl entfernen
64 \xpatchbibmacro{date+extrayear}{%
65 \printtext[parens]%
66 }{%
67 \setunit{\addperiod\space}%
68 \addcomma\printtext%
69 }{}{}
70
71 % Komma zwischen Journaltitle und Volumne(Edtion)
72 \xpatchbibmacro{journal+issuetitle}{%
73 \usebibmacro{volume+number+eid}%
74 }{%
75 \setunit{\addcomma\space}%
76 \usebibmacro{volume+number+eid}%
77 }{}{}
78
79 % Journal volumne + numberm, Form: Volume(Number)
80 \renewbibmacro*{volume+number+eid}{%
81 \printfield{volume}%
82 \printfield[parens]{number}%
83 \setunit{\addcomma\space}%
84 \printfield{eid}%
85 }
86
87 % Editor Aussehen umdefinieren. Form NAME, Hrsg.
88 \renewbibmacro*{byeditor+others}{%
89 \ifnameundef{editor}
90 {}
91 {\printnames[byeditor]{editor}\addcomma\space \bibstring{editor}%
92 \clearname{editor}%
93 \newunit}%
94 \usebibmacro{byeditorx}%
95 \usebibmacro{bytranslator+others}}
96
97 % Übersetzer Aussehen umdefinieren, Form: NAME, Übers.
98 \renewbibmacro*{bytranslator+others}{
99 \ifnameundef{translator}
100 {}
101 {\printnames[bytranslator]{translator}\addcomma\space \bibstring{translator}%
102 \clearname{translator}%
103 \newunit}%
104 \usebibmacro{withothers}}
105
106 % Autorenform: NACHNAME, F.
107 \DeclareNameFormat{author}{%
108 \ifthenelse{\value{listcount}=\value{liststop}}
109 {%
110 \ifthenelse{\value{listcount}>1}
111 {%
112 {\bibstring{and}\space }%
113 }{}%
114 }{}%
115 {\textsc{#1}\ifblank{#4}{}{\addcomma\space #4}}%
116 \ifthenelse{\value{listcount}<\value{liststop}}%
117 {%
118 {\addcomma\space}%
119 }{}%
120 }
121
122 % Editorform (als Autor): NACHNAME, F.
123 \DeclareNameFormat{editor}{%
124 \ifthenelse{\value{listcount}=\value{liststop}}
125 {%
126 \ifthenelse{\value{listcount}>1}
127 {%
128 {\bibstring{and}\space }%
129 }{}%
130 }{}%
131 {\textsc{#1}\ifblank{#4}{}{\addcomma\space #4}}%
132 \ifthenelse{\value{listcount}<\value{liststop}}%
133 {%
134 {\addcomma\space}%
135 }{}%
136 }
137
138 % Editorform: F. NACHNAME
139 \DeclareNameFormat{byeditor}{%
140 \ifthenelse{\value{listcount}=\value{liststop}}
141 {%
142 \ifthenelse{\value{listcount}>1}
143 {%
144 {\bibstring{and}\space }%
145 }{}%
146 }{}%
147 {\ifblank{#4}{}{#4\space}\textsc{#1}}%
148 \ifthenelse{\value{listcount}<\value{liststop}}%
149 {%
150 {\addcomma\space}%
151 }{}%
152 }
153
154 % Translatorform (als Autor): NACHNAME, F.
155 \DeclareNameFormat{translator}{%
156 \ifthenelse{\value{listcount}=\value{liststop}}
157 {%
158 \ifthenelse{\value{listcount}>1}
159 {%
160 {\bibstring{and}\space }%
161 }{}%
162 }{}%
163 {\textsc{#1}\ifblank{#4}{}{\addcomma\space #4}}%
164 \ifthenelse{\value{listcount}<\value{liststop}}%
165 {%
166 {\addcomma\space}%
167 }{}%
168 }
169
170 % Translatorform: F. NACHNAME
171 \DeclareNameFormat{bytranslator}{%
172 \ifthenelse{\value{listcount}=\value{liststop}}
173 {%
174 \ifthenelse{\value{listcount}>1}
175 {%
176 {\bibstring{and}\space }%
177 }{}%
178 }{}%
179 {\ifblank{#4}{}{#4\space}\textsc{#1}}%
180 \ifthenelse{\value{listcount}<\value{liststop}}%
181 {%
182 {\addcomma\space}%
183 }{}%
184 }
185
186 \DeclareBibliographyDriver{article}{%
187 \usebibmacro{bibindex}%
188 \usebibmacro{begentry}%
189 \usebibmacro{author/translator+others}%
190 \setunit{\labelnamepunct}\newblock
191 \usebibmacro{title}%
192 \newunit
193 \printlist{language}%
194 \newunit\newblock
195 \usebibmacro{byauthor}%
196 \newunit\newblock
197 \usebibmacro{bytranslator+others}%
198 \newunit\newblock
199 \printfield{version}%
200 \newunit\newblock
201 % OHNE In:!
202 % \usebibmacro{in:}%
203 \usebibmacro{journal+issuetitle}%
204 \newunit
205 \usebibmacro{byeditor+others}%
206 \newunit
207 \usebibmacro{note+pages}%
208 \newunit\newblock
209 \iftoggle{bbx:isbn}
210 {\printfield{issn}}
211 {}%
212 \newunit\newblock
213 \usebibmacro{doi+eprint+url}%
214 \newunit\newblock
215 \usebibmacro{addendum+pubstate}%
216 \setunit{\bibpagerefpunct}\newblock
217 \usebibmacro{pageref}%
218 \newunit\newblock
219 \usebibmacro{related}%
220 \usebibmacro{finentry}}
221
222 % Extra Feld für Jahr eines Buches (genutzt z. B. bei Inbook)
223 \newbibmacro*{bookyear}{%
224 \setunit*{\addcomma\space}%
225 \iffieldundef{bookyear}
226 {\printfield{year}}%
227 {\printfield{bookyear}}%
228 \newunit}
229
230 \DeclareBibliographyDriver{inbook}{%
231 \usebibmacro{bibindex}%
232 \usebibmacro{begentry}%
233 \usebibmacro{author/translator+others}%
234 \setunit{\labelnamepunct}\newblock
235 \usebibmacro{title}%
236 \newunit
237 \printlist{language}%
238 \newunit\newblock
239 \usebibmacro{byauthor}%
240 \newunit\newblock
241 \usebibmacro{in:}%
242 \usebibmacro{byeditor+others}%
243 \newunit\newblock
244 \usebibmacro{bybookauthor}%
245 \newunit\newblock
246 \usebibmacro{maintitle+booktitle}%
247 \newunit\newblock
248 \printfield{edition}%
249 \newunit
250 \iffieldundef{maintitle}
251 {\printfield{volume}%
252 \printfield{part}}
253 {}%
254 \newunit
255 \printfield{volumes}%
256 \newunit\newblock
257 \usebibmacro{series+number}%
258 \newunit\newblock
259 \printfield{note}%
260 \newunit\newblock
261 \usebibmacro{publisher+location+date}%
262 \usebibmacro{bookyear}%
263 \newunit\newblock
264 \usebibmacro{chapter+pages}%
265 \newunit\newblock
266 \iftoggle{bbx:isbn}
267 {\printfield{isbn}}
268 {}%
269 \newunit\newblock
270 \usebibmacro{doi+eprint+url}%
271 \newunit\newblock
272 \usebibmacro{addendum+pubstate}%
273 \setunit{\bibpagerefpunct}\newblock
274 \usebibmacro{pageref}%
275 \newunit\newblock
276 \usebibmacro{related}%
277 \usebibmacro{finentry}}
278
279 \DeclareBibliographyDriver{incollection}{%
280 \usebibmacro{bibindex}%
281 \usebibmacro{begentry}%
282 \usebibmacro{author/translator+others}%
283 \setunit{\labelnamepunct}\newblock
284 \usebibmacro{title}%
285 \newunit
286 \printlist{language}%
287 \newunit\newblock
288 \usebibmacro{byauthor}%
289 \newunit\newblock
290 \usebibmacro{in:}%
291 \usebibmacro{byeditor+others}%
292 \newunit\newblock
293 \usebibmacro{maintitle+booktitle}%
294 \newunit\newblock
295 \printfield{edition}%
296 \newunit
297 \iffieldundef{maintitle}
298 {\printfield{volume}%
299 \printfield{part}}
300 {}%
301 \newunit
302 \printfield{volumes}%
303 \newunit\newblock
304 \usebibmacro{series+number}%
305 \newunit\newblock
306 \printfield{note}%
307 \newunit\newblock
308 \usebibmacro{publisher+location+date}%
309 \usebibmacro{bookyear}%
310 \newunit\newblock
311 \usebibmacro{chapter+pages}%
312 \newunit\newblock
313 \iftoggle{bbx:isbn}
314 {\printfield{isbn}}
315 {}%
316 \newunit\newblock
317 \usebibmacro{doi+eprint+url}%
318 \newunit\newblock
319 \usebibmacro{addendum+pubstate}%
320 \setunit{\bibpagerefpunct}\newblock
321 \usebibmacro{pageref}%
322 \newunit\newblock
323 \usebibmacro{related}%
324 \usebibmacro{finentry}}
325
326 \DeclareBibliographyDriver{inproceedings}{%
327 \usebibmacro{bibindex}%
328 \usebibmacro{begentry}%
329 \usebibmacro{author/translator+others}%
330 \setunit{\labelnamepunct}\newblock
331 \usebibmacro{title}%
332 \newunit
333 \printlist{language}%
334 \newunit\newblock
335 \usebibmacro{byauthor}%
336 \newunit\newblock
337 \usebibmacro{in:}%
338 \usebibmacro{byeditor+others}%
339 \newunit\newblock
340 \usebibmacro{maintitle+booktitle}%
341 \newunit\newblock
342 \usebibmacro{event+venue+date}%
343 \newunit\newblock
344 \iffieldundef{maintitle}
345 {\printfield{volume}%
346 \printfield{part}}
347 {}%
348 \newunit
349 \printfield{volumes}%
350 \newunit\newblock
351 \usebibmacro{series+number}%
352 \newunit\newblock
353 \printfield{note}%
354 \newunit\newblock
355 \printlist{organization}%
356 \newunit
357 \usebibmacro{publisher+location+date}%
358 \usebibmacro{bookyear}%
359 \newunit\newblock
360 \usebibmacro{chapter+pages}%
361 \newunit\newblock
362 \iftoggle{bbx:isbn}
363 {\printfield{isbn}}
364 {}%
365 \newunit\newblock
366 \usebibmacro{doi+eprint+url}%
367 \newunit\newblock
368 \usebibmacro{addendum+pubstate}%
369 \setunit{\bibpagerefpunct}\newblock
370 \usebibmacro{pageref}%
371 \newunit\newblock
372 \usebibmacro{related}%
373 \usebibmacro{finentry}}
374
375 % Thesis
376 \DeclareBibliographyDriver{thesis}{%
377 \usebibmacro{bibindex}%
378 \usebibmacro{begentry}%
379 \usebibmacro{author}%
380 \setunit{\labelnamepunct}\newblock
381 \printfield{type}%
382 \newunit\newblock
383 \usebibmacro{title}%
384 \newunit
385 \printlist{language}%
386 \newunit\newblock
387 \usebibmacro{byauthor}%
388 \newunit\newblock
389 \printfield{note}%
390 \newunit
391 \usebibmacro{institution+location+date}%
392 \newunit\newblock
393 \usebibmacro{chapter+pages}%
394 \newunit
395 \printfield{pagetotal}%
396 \newunit\newblock
397 \iftoggle{bbx:isbn}
398 {\printfield{isbn}}
399 {}%
400 \newunit\newblock
401 \usebibmacro{doi+eprint+url}%
402 \newunit\newblock
403 \usebibmacro{addendum+pubstate}%
404 \setunit{\bibpagerefpunct}\newblock
405 \usebibmacro{pageref}%
406 \newunit\newblock
407 \usebibmacro{related}%
408 \usebibmacro{finentry}}
409
410 \DeclareBibliographyDriver{online}{%
411 \usebibmacro{bibindex}%
412 \usebibmacro{begentry}%
413 \usebibmacro{author/editor+others/translator+others}%
414 \setunit{\labelnamepunct}\newblock
415 \usebibmacro{title}%
416 \newunit
417 \printlist{language}%
418 \newunit\newblock
419 \usebibmacro{byauthor}%
420 \newunit\newblock
421 \usebibmacro{byeditor+others}%
422 \newunit\newblock
423 \printfield{version}%
424 \newunit
425 \printfield{note}%
426 \newunit\newblock
427 \printlist{organization}%
428 \newunit\newblock
429 \usebibmacro{publisher+location+date}%
430 \usebibmacro{date}%
431 \newunit\newblock
432 \iftoggle{bbx:eprint}
433 {\usebibmacro{eprint}}
434 {}%
435 \newunit\newblock
436 \usebibmacro{url+urldate}%
437 \newunit\newblock
438 \usebibmacro{addendum+pubstate}%
439 \setunit{\bibpagerefpunct}\newblock
440 \usebibmacro{pageref}%
441 \newunit\newblock
442 \usebibmacro{related}%
443 \usebibmacro{finentry}}
444
445 \endinput