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
|
%% hgbbib.sty
%% Bibliography Setup
%% This file is part of the Hagenberg Thesis package for creating bachelors's and masters's theses
%% Author: Wilhelm Burger (wilhelm.burger@fh-hagenberg.at)
%% GitHub: https://github.com/Digital-Media/HagenbergThesis
%% File encoding: ASCII
\ProvidesPackage{hgbbib}[2020/10/29]%%AUTO
\usepackage{csquotes} % recommended for biblatex
%Note: biblatex with bibtex backend is frozen at version 1.7.
\usepackage[style=numeric-comp,backend=biber,bibencoding=auto]{biblatex}
\ExecuteBibliographyOptions{
bibwarn=true,
sortcites=true,
defernumbers=true,
isbn=false,
doi=false,
backref=true,
backrefstyle=three}
%% titles of reference section + 3 categories of references:
\newcommand{\@bibtitle}{Quellenverzeichnis}
\newcommand{\@bibtitleLiteratur}{Literatur}
\newcommand{\@bibtitleMedia}{Medien}
\newcommand{\@bibtitleOnline}{Online-Quellen}
\newcommand{\@bibtitleSoftware}{Software}
\ifthenelse{\equal{\hgb@MainLanguage}{english}}{%
\renewcommand{\@bibtitle}{References}
\renewcommand{\@bibtitleLiteratur}{Literature}
\renewcommand{\@bibtitleMedia}{Media}
\renewcommand{\@bibtitleOnline}{Online sources}
\renewcommand{\@bibtitleSoftware}{Software}
}{}
%% categories for a split bibliography (order of declaration is important!)
\DeclareBibliographyCategory{literature}
\DeclareBibliographyCategory{media}
\DeclareBibliographyCategory{software}
\DeclareBibliographyCategory{online}
%% headings for the bibliography categories
\defbibheading{literature}{%
\phantomsection%
\section*{\@bibtitleLiteratur}%
\addcontentsline{toc}{section}{\@bibtitleLiteratur}%
}
\defbibheading{media}{%
\pagebreak[3]%
\phantomsection%
\section*{\@bibtitleMedia}%
\addcontentsline{toc}{section}{\@bibtitleMedia}%
}
\defbibheading{online}{%
\pagebreak[3]%
\phantomsection%
\section*{\@bibtitleOnline}%
\addcontentsline{toc}{section}{\@bibtitleOnline}%
}
\defbibheading{software}{%
\pagebreak[3]%
\phantomsection%
\section*{\@bibtitleSoftware}%
\addcontentsline{toc}{section}{\@bibtitleSoftware}%
}
\defbibheading{noheader}[]{} % 'none' should be defined but isn't
%Assign a given bibliography entry to one of the defined categories.
\newcommand{\@AssignToBibCategory}[1]% argument 1: entry key
{\ifthenelse{%
\ifentrytype{online}\OR
\ifentrytype{www}}
{\addtocategory{online}{#1}}%
{\ifthenelse{%
\ifentrytype{movie}\OR
\ifentrytype{video}\OR
\ifentrytype{music}\OR
\ifentrytype{audio}\OR
\ifentrytype{image}}
{\addtocategory{media}{#1}}%
{\ifthenelse{%
\ifentrytype{software}\OR
\ifentrytype{electronic}}
{\addtocategory{software}{#1}}%
{\addtocategory{literature}{#1}}% else (default)
}}}
%Hook provided by biblatex.
\AtEveryCitekey{\@AssignToBibCategory{\thefield{entrykey}}}
%This is only a wrapper to \addbibresource to allow the use
%of the classic bibtex-workflow in the future.
\newcommand{\AddBibFile}[1]{
\addbibresource{#1}%
}
% Declare a source map so the sorting in \cite commands works across the bib categories
% The maps need to correspond to the entry types in the bib categories (which can't unfortunately used)
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{ % All entry types except for media, software and online
\pernottype{movie}
\pernottype{video}
\pernottype{music}
\pernottype{audio}
\pernottype{image}
\pernottype{software}
\pernottype{electronic}
\pernottype{online}
\pernottype{www}
\step[fieldset=presort, fieldvalue = {A}]
}
\map{ % media entry types
\pertype{movie}
\pertype{video}
\pertype{music}
\pertype{audio}
\pertype{image}
\step[fieldset=presort, fieldvalue = {B}]
}
\map{ % software entry types
\pertype{software}
\pertype{electronic}
\step[fieldset=presort, fieldvalue = {C}]
}
\map{ % online entry types
\pertype{online}
\pertype{www}
\step[fieldset=presort, fieldvalue = {D}]
}
}
}
%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}%
% allow URL hyphenation at any character (definitions in biblatex.def)
\setcounter{biburlnumpenalty}{1}%
\setcounter{biburlucpenalty}{1}%
\setcounter{biburllcpenalty}{1}%
\biburlsetup}%
{}
% 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={\@bibtitle}]
\begin{bibhyphenation}
\printbibliography[heading=noheader]
\end{bibhyphenation}
}
{% split the bibliography using the predefined categories:
\printbibheading[heading=bibintoc,title={\@bibtitle}]
\begin{bibhyphenation}
\bibbycategory
\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}}}
% To suppress warnings related to missing biblatex "drivers":
\DeclareBibliographyAlias{video}{misc}
\DeclareBibliographyAlias{movie}{misc}
\DeclareBibliographyAlias{audio}{misc}
\DeclareBibliographyAlias{software}{misc}
\DeclareBibliographyAlias{electronic}{misc}
\DeclareBibliographyAlias{image}{misc}
\DeclareBibliographyAlias{standard}{misc}
% Use a semicolon between multiple entries in \cites
%\renewcommand*{\multicitedelim}{\addsemicolon\space} %% abandoned, affects regular \cite{a,b,c,..} entries too
% New command for multiple citations with supplementary texts
% usage: \mcite[text1]{key1}[text2]{key2}...[textN]{keyN}
% see https://tex.stackexchange.com/a/132981
\DeclareMultiCiteCommand{\mcite}[\mkbibbrackets]{\cite}{\addsemicolon\space}
% Macro to produce cites with no backref entries
% Modified from http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/biblatex-contrib/biblatex-ieee/ieee.cbx
% See also https://tex.stackexchange.com/questions/344861/biblatex-backref-option-per-entry
\DeclareCiteCommand{\citenobr}%
{\usebibmacro{cite:init}%
\bibopenbracket
\backtrackerfalse\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}%
\usebibmacro{postnote}%
\bibclosebracket
}
|