-
Notifications
You must be signed in to change notification settings - Fork 0
/
hisbibliography.sty
148 lines (134 loc) · 5.21 KB
/
hisbibliography.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
%%
%% Copyright 2016-2017 by Thomas Fischer <[email protected]>
%%
%% This file has been released under the following license:
%% Creative Commons Attribution-Share Alike 4.0 Unported
%% (CC-BY-SA 4.0)
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hisbibliography}[2017/03/14 HiS Bibliography]
\RequirePackage[
backend=biber,
datamodel=his-thesis,
uniquename=init, % we can still disambiguate names in citations
firstinits=false, % full names are used in bibliography
style=authoryear]{biblatex}
\renewbibmacro*{urn}{%
\iffieldundef{urn}
{}%
{\adddot\space URN\addcolon\space\printfield{urn}%
}%
}
% TODO better 'inherit' the official definiton of the following macro
% from standard.bbx and then enhance it for URNs
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:doi}
{\printfield{doi}}
{}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\usebibmacro{urn}%
\newunit\newblock
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}%
}
% Some more nice reading on DeclareSourcemap for the Swedish context:
% http://blog.sigurdhsson.org/2014/04/extending-biblatex-chicago/
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
% Any PhD thesises (including licentiate thesises) that are
% part of the 'Dissertation Series' and have an URN
% from HiS given, change the type from 'phdthesis' to 'histhesis'.
% File 'his-thesis.dbx' defines a new entry type 'histhesis'
% that is very similar to the default 'thesis' entry but prints
% 'Dissertation Series, No. X' as well.
\step[fieldsource=series,match={Dissertation Series},final]
\step[fieldsource=urn,match=\regexp{^urn:nbn:se:his:},final]
\step[typesource=phdthesis,typetarget=histhesis]
}
\map{
% Remove 'url' field from entries that have a DOI defined
\step[fieldsource=doi,final]
\step[fieldset=url,null]
}
\map{
% Remove 'url' field from entries that have an ISSN defined
\step[fieldsource=issn,final]
\step[fieldset=url,null]
}
\map{
% Remove 'url' field from entries that have an ISSN defined
\step[fieldsource=isbn,final]
\step[fieldset=url,null]
}
\map{
% Remove 'url' field from entries that have an URN defined
\step[fieldsource=urn,final]
\step[fieldset=url,null]
}
}
}
\DeclareSortingScheme{seriesnumber}{%
\sort{\field{number}}%
}
% Comma between author and year when citing
\renewcommand{\nameyeardelim}{\addcomma\addspace}
% This bibliography will be used for the list of
% previous PhD/licentiate publications as generated
% by the command \dissertationlist
% The filename may be different, important is the
% label which has to equal 'dissertation-series'.
% All publications in this bibliography will be
% printed, no \cite or \nocite command is necessary.
\addbibresource[label=dissertation-series]{dissertation-series.bib}
% The following hyphenation command will take care of
% correctly wrap/breaking words with dashes.
% Add all words with dashes when adding new entries to
% this bibliography.
% Use '=' to signify that there shall be a dash in the
% word even if it is not wrapped. Use '-' to signify a
% valid breaking point. No dash will be printed unless
% the word will get wrapped/broken at this location.
%\hyphenation{Anna=Sofia e=ser-vice game=based Game=Based in-struc-tor=led multi=ob-jec-tive Multi=ob-jec-tive Multi=Ob-jec-tive on=con-di-tion On=con-di-tion pref-er-ence=based Pref-er-ence=based sim-u-la-tion=based time=con-strain Vi-sion=Based}
% Other hyphenations which seem to be problematic:
\hyphenation{Au-ton-o-mous Sköv-de}
%% Prints the list of previous dissertations published
%% in the same series. The list of dissertations is
%% determined by the references labeled 'dissertation-series'
\newcommand\dissertationlist{%
\part*{Publications in the Dissertation~Series}% List of references is an unnumbered Part
\addcontentsline{toc}{part}{Publications in the Dissertation Series}% manually add this unnumbered Part to ToC (not automatically as it is the star'ed version)
\markboth{}{\uppercase{Publications in the Dissertation Series}}% fix headings (odd pages 'Publications in the Dissertation Series', even pages empty)
\begingroup
\defbibheading{subbibliography}{%
% No title, purple-colored page right before bibliography
}
\begin{refsection}[dissertation-series]
\nocite{*}
\begin{refcontext}[sorting=seriesnumber]
\printbibliography[heading=subbibliography]
\end{refcontext}
\end{refsection}
\endgroup
}%
%% List of References as cited by the disseration
%% author in his/her report. Essentially a nice
%% wrapper around \printbibliography.
\newcommand{\listofreferences}{%
\part*{\refname}% List of references is an unnumbered Part
\addcontentsline{toc}{part}{\refname}% manually add this unnumbered Part to ToC (not automatically as it is the star'ed version)
\markboth{}{\uppercase{\refname}}% fix headings (odd pages 'References', even pages empty)
\begingroup%
\defbibheading{subbibliography}{%
% No title, purple-colored page (generated by \part*) right before bibliography
}
\begin{refcontext}[sorting=nyt]
\printbibliography[heading=subbibliography]
\end{refcontext}
\endgroup
}% end of \listofreferences