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
|
%% Biblatex settings.
%%
%% Settings necessary to make the bibliography with Biblatex. Keeping all
%% BibLaTeX settings in a separate preamble was done in the spirit of
%% modularity to 1) easily managable, 2) If a similar BibLaTeX
%% configuration is necessary in another LaTeX compilation, this file can
%% just be copied there and used.
%%
%% USAGE:
%% - `tex/src/references.tex': the file containing Bibtex source of each
%% reference. The file suffix doesn't have to be `.bib'. This naming
%% helps in clearly identifying the files and avoiding places that
%% complain about `.bib' files.
%
%% Original author:
%% Mohammad Akhlaghi <mohammad@akhlaghi.org>
%% Contributing author(s):
%% Copyright (C) 2018-2019, Mohammad Akhlaghi.
%
%% This template is free software: you can redistribute it and/or modify it
%% under the terms of the GNU General Public License as published by the
%% Free Software Foundation, either version 3 of the License, or (at your
%% option) any later version.
%
%% This template is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%% General Public License for more details.
%
%% You should have received a copy of the GNU General Public License along
%% with this template. If not, see <http://www.gnu.org/licenses/>.
%% To break up highlighted text (for example texttt when some it is on the
%% line break) and also to no underline emphasized words (like journal
%% titles in the references).
\usepackage[normalem]{ulem}
% Basic BibLaTeX settings
\usepackage[
doi=false,
url=false,
dashed=false,
eprint=false,
maxbibnames=4,
minbibnames=1,
hyperref=true,
maxcitenames=2,
mincitenames=1,
style=authoryear,
uniquelist=false,
backend=biber,natbib]{biblatex}
\DeclareFieldFormat[article]{pages}{#1}
\DeclareFieldFormat{pages}{\mkfirstpage[{\mkpageprefix[bookpagination]}]{#1}}
\addbibresource{tex/src/references.tex}
\renewbibmacro{in:}{}
\renewcommand*{\bibfont}{\footnotesize}
\DefineBibliographyStrings{english}{references = {References}}
%% Include the adsurl field key into those that are recognized:
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=adsurl,fieldtarget=iswc]
\step[fieldsource=gbkurl,fieldtarget=iswc]
}
}
}
%% Set the color of the doi link to mymg (magenta) and the ads links
%% to mypurp (or purple):
\definecolor{mypurp}{cmyk}{0.75,1,0,0}
\newcommand{\doihref}[2]{\href{#1}{\color{magenta}{#2}}}
\newcommand{\adshref}[2]{\href{#1}{\color{mypurp}{#2}}}
\newcommand{\blackhref}[2]{\href{#1}{\color{black}{#2}}}
%% Define a format for the printtext commands in
%% DeclareBibliographyDriver to make links for the doi, ads link and
%% arxiv link:
\DeclareFieldFormat{doilink}{
\iffieldundef{doi}{#1}{\doihref{http://dx.doi.org/\thefield{doi}}{#1}}}
\DeclareFieldFormat{adslink}{
\iffieldundef{iswc}{#1}{\adshref{\thefield{iswc}}{#1}}}
\DeclareFieldFormat{arxivlink}{
\iffieldundef{eprint}{#1}{\href{http://arxiv.org/abs/\thefield{eprint}}{#1}}}
\DeclareListFormat{doiforbook}{
\iffieldundef{doi}{#1}{\doihref{http://dx.doi.org/\thefield{doi}}{#1}}}
\DeclareFieldFormat{googlebookslink}{
\iffieldundef{iswc}{#1}{\adshref{\thefield{iswc}}{#1}}}
%% Set the formatting to make the last three values into the
%% appropriate link. Note that the % signs are necessary. Without
%% them, the items will be indented.
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\newunit%
\ifdefined\makethesis\printtext{\usebibmacro{title}}\fi%
\newunit%
\printtext[doilink]{\usebibmacro{journal}}%
\addcomma%
\printtext[adslink]{\printfield{volume}}%
\addcomma%
\printtext[arxivlink]{\printfield{pages}}%
\addperiod%
}
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\newunit%
\printtext{\usebibmacro{title}}%
\addperiod%
\addspace%
\printlist[doiforbook]{publisher}%
\addcomma%
\addspace%
\printfield[googlebookslink]{edition}%
\printtext{ ed.}%
\addperiod%
}
%% In order to have et al. instead of et al.,:
\renewcommand*{\nameyeardelim}{\addspace}
|