-
Notifications
You must be signed in to change notification settings - Fork 0
/
bababib.bbx
123 lines (110 loc) · 3.56 KB
/
bababib.bbx
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
%% ---------------------------------------------------------------
%% bababib --- Modern biblatex style based on the ``nature'' style.
%% Maintained by Jabir Ali Ouassou
%% E-mail: [email protected]
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ---------------------------------------------------------------
%%
\ProvidesFile{bababib.bbx}[2017/07/01 v1.3a biblatex bibliography style]
\RequirePackage{nowidow}
% Load the parent style
\RequireBibliographyStyle{nature}
% Select the bibliography font
\renewcommand*{\bibfont}{\raggedright}
% Sacrifice a tree to obtain better readability
\ExecuteBibliographyOptions{block=nbpar}
% Only list the doi/isbn/arxiv links
\ExecuteBibliographyOptions{url=false,doi=true,isbn=true,eprint=true}
% Do not sort the bibliography
\ExecuteBibliographyOptions{sorting=none}
% Modify the name format
\renewrobustcmd*{\bibinitdelim}{}
\DeclareNameFormat{default}{\mkbibbold{%
\nameparts{#1}%
\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}%
\usebibmacro{name:andothers}}%
}
% Field formats for the bibliography environment
\DeclareFieldFormat{labelnumberwidth}{\mkbibbold{\addfontfeatures{Numbers={Lining,Tabular}}\phantom{.}#1.}}
% Custom field formats
\DeclareFieldFormat*{booktitle}{\mkbibemph{#1}\nopunct}
\DeclareFieldFormat*{series}{\mkbibemph{#1}\nopunct}
\DeclareFieldFormat*{title}{\mkbibemph{#1}}
\DeclareFieldFormat*{journaltitle}{#1}
\DeclareFieldFormat*{volume}{{#1}}
\DeclareFieldFormat[book]{volume}{#1}
\DeclareFieldFormat[book,collection]{number}{#1}
\DeclareFieldFormat*{pages}{#1}
\DeclareFieldFormat{doi}{\textsc{doi}:~\href{https://dx.doi.org/#1}{\MakeLowercase{#1}}\nopunct}
\DeclareFieldFormat{isbn}{\textsc{isbn}:~\href{https://isbnsearch.org/isbn/#1}{#1}\nopunct}
% Simple modifications to punctuation, etc.
\renewcommand*{\finalnamedelim}{,\addspace}
\renewcommand*{\intitlepunct}{\addspace}
\newbibmacro*{bookdate}{\printtext[parens]{\usebibmacro{date}}}
% Bibliography drivers for custom classes
\DeclareBibliographyAlias{customa}{article}
% Bibliography drivers for standard classes
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newblock
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{bytranslator+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
\usebibmacro{journal+issuetitle}%
\newunit
\usebibmacro{byeditor+others}%
\newunit
\usebibmacro{note+pages}%
\newunit
\setunit{\addspace}
\usebibmacro{issue+date}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\usebibmacro{related}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\usebibmacro{finentry}%
}
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+title}%
\setunit{\addspace}%
\printfield{edition}%
\newunit
\usebibmacro{byauthor}%
\newunit
\usebibmacro{byeditor+others}%
\newunit
\printfield{volumes}%
\newunit
\usebibmacro{series+number}%
\newunit
\usebibmacro{chapter+pages}%
\nopunct
\usebibmacro{bookdate}%
\newunit\newblock
\printfield{isbn}
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\usebibmacro{finentry}%
}