-
Notifications
You must be signed in to change notification settings - Fork 0
/
hgbbib.sty
executable file
·153 lines (133 loc) · 5.32 KB
/
hgbbib.sty
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
%% File encoding: ASCII
%% --------------- Bibliography setup ---------------------------------------
\ProvidesPackage{hgbbib}
\usepackage{csquotes} % recommended for biblatex
%\usepackage[babel,german=quotes]{csquotes} % utf8-change ??
%utf8-change
%Note: biblatex with bibtex backend is frozen at version 1.7.
\usepackage[style=numeric-comp,backend=biber,bibencoding=auto]{biblatex}[2013/01/10] %utf8-change
\ExecuteBibliographyOptions{bibwarn=true,sortcites=true,defernumbers=true,isbn=false,doi=false,backref=true}
%% titles of reference section + 3 categories of references:
\newcommand{\@bibtitle}{Quellenverzeichnis}
\newcommand{\@bibtitleLiteratur}{Literatur}
\newcommand{\@bibtitleAvmedia}{Filme und audiovisuelle Medien}
\newcommand{\@bibtitleSoftware}{Software und Libraries}
\newcommand{\@bibtitleOnline}{Online-Quellen}
\ifthenelse{\equal{\hgb@MainLanguage}{english}}{%
\renewcommand{\@bibtitle}{References}
\renewcommand{\@bibtitleLiteratur}{Literature}
\renewcommand{\@bibtitleAvmedia}{Films and audio-visual media}
\renewcommand{\@bibtitleSoftware}{Software and Libraries}
\renewcommand{\@bibtitleOnline}{Online sources}
}{}
\defbibfilter{literature}{
not ( type=movie or type=video or type=music or type=audio or
type=online or type=electronic or type=www or type=software )}
\defbibfilter{avmedia}{%
( type=movie or type=video or type=music or type=audio )}
\defbibfilter{software}{( type=software )}
\defbibfilter{online}{%
( type=online or type=electronic or type=www )}
\defbibheading{noheader}[]{} % 'none' should be defined but isn't
% utf8-change (deactivated):
% German format in biblatex is flawed: it adds wrong spaces and prohibits
% line breaking within date strings. Corrected by Wilbur as follows.
% Taken from german.lbx: replaced \thinspace by breaking zero space \hskip0pt
%\DefineBibliographyExtras{ngerman}{%
%\def\mkbibdatelong#1#2#3{%
%\iffieldundef{#3}
%{\hskip0pt}
%{\mkbibordinal{\thefield{#3}}%
%\iffieldundef{#2}{}{\space}}% %was: \nobreakspace
%\iffieldundef{#2}
%{\hskip0pt}
%{\mkbibmonth{\thefield{#2}}%
%\iffieldundef{#1}{\hskip0pt}{\space}}%
%\stripzeros{\thefield{#1}}}%
%%
%\def\mkbibdateshort#1#2#3{%
%\iffieldundef{#3}
%{\hskip0pt}
%{\mkdatezeros{\thefield{#3}}\adddot
%\iffieldundef{#2}{}{\hskip0pt}}%
%\iffieldundef{#2}
%{\hskip0pt}
%{\mkdatezeros{\thefield{#2}}%
%\iffieldundef{#1}
%{\hskip0pt}
%{\iffieldundef{#3}{/}{\adddot\hskip0pt}}}%
%\mkdatezeros{\thefield{#1}}}%
%}
% utf8-change (deactivated):
% Similar problem with badly braking date strings in english.
% Taken from english.lbx: added breaking zero space \hskip0pt to /
%\DefineBibliographyExtras{english}{%
%\def\mkbibdatelong#1#2#3{%
%\iffieldundef{#2}
%{}
%{\mkbibmonth{\thefield{#2}}%
%\iffieldundef{#3}
%{\iffieldundef{#1}{}{\space}}
%{\space}}% %was: \nobreakspace
%\iffieldundef{#3}
%{}
%{\stripzeros{\thefield{#3}}%
%\iffieldundef{#1}{}{,\space}}%
%\stripzeros{\thefield{#1}}}%
%%
%\def\mkbibdateshort#1#2#3{%
%\iffieldundef{#2}
%{}
%{\mkdatezeros{\thefield{#2}}%
%\iffieldundef{#3}
%{\iffieldundef{#1}{}{/{\hskip0pt}}}
%{/{\hskip0pt}}}%
%\iffieldundef{#3}
%{}
%{\mkdatezeros{\thefield{#3}}%
%\iffieldundef{#1}{}{/{\hskip0pt}}}%
%\mkdatezeros{\thefield{#1}}}%
%}
%This is only a wrapper to \addbibresource to allow the use
%of the classic bibtex-workflow in the future.
\newcommand{\AddBibFile}[1]{
\addbibresource{#1}%
}
%See http://www.jr-x.de/publikationen/latex/tipps/zeilenumbruch.html
\newenvironment{bibhyphenation}%
{\hyphenpenalty=2% (default 50)
\tolerance=9999% (default 200)
\exhyphenpenalty=2% (default 50)
\linepenalty=1% (default 10)
\setlength{\emergencystretch}{3em}}%
{}
% Currently the only public macro:
% \MakeBibliography ... creates a reference section split subsections (default)
% \MakeBibliography[nosplit] ... creates a one-piece reference section
\newcommand{\MakeBibliography}[1][]{
% opt. arg (#1): optional argument "nosplit" to get a 1-piece bibliography
%\clearpage
\ifthenelse{\equal{#1}{nosplit}}%
{% create a single bibliography with all entries:
%\printbibheading[heading=bibintoc,title={#2}]
\printbibheading[heading=bibintoc,title={\@bibtitle}]
\begin{bibhyphenation}
\printbibliography[heading=noheader]
\end{bibhyphenation}
}
{% split the bibliography using the predefined categories:
%\printbibheading[heading=bibintoc,title={#2}]
\printbibheading[heading=bibintoc,title={\@bibtitle}]
\begin{bibhyphenation}
\printbibliography[filter=literature,heading=subbibintoc,title={\@bibtitleLiteratur}]
\printbibliography[filter=avmedia,heading=subbibintoc,title={\@bibtitleAvmedia}]
\printbibliography[filter=software,heading=subbibintoc,title={\@bibtitleSoftware}]
\printbibliography[filter=online,heading=subbibintoc,title={\@bibtitleOnline}]
\end{bibhyphenation}
}%
}
% Suppress unusual "In:" within journal article references.
% see http://tex.stackexchange.com/questions/10682/suppress-in-biblatex
\renewbibmacro{in:}{%
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}