-
Notifications
You must be signed in to change notification settings - Fork 0
/
biblatex-mnras.bbx
262 lines (231 loc) · 8.25 KB
/
biblatex-mnras.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
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
%% ---------------------------------------------------------------
%% biblatex-mnras --- A biblatex implementation of the MNRAS
%% bibliography style
%% Maintained by Fabian Scheuermann
%% E-mail: f.scheuermann@uni-heidelberg.de
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ---------------------------------------------------------------
%%
\ProvidesFile{biblatex-mnras.bbx}[2022/06/10 v1.0 biblatex bibliography style]
% Load the standard style to avoid copy-pasting unnecessary material
\RequireBibliographyStyle{authoryear}
\ExecuteBibliographyOptions{
backrefstyle=three,
doi=false,
giveninits=true,
minbibnames=1,
maxbibnames=8,
sorting=nyt
}
% ---------------------------------------------------------------
% define abbreviations for the journals
% ---------------------------------------------------------------
\InitializeBibliographyStyle{
%
% These Macros are taken from the AAS TeX macro package version 5.2
% and are compatible with the macros in the A&A document class
% version 7.0
\let\jnl@style=\textrm
\def\ref@jnl#1{{\jnl@style#1}}
\def\aj{\ref@jnl{AJ}} % Astronomical Journal
\def\actaa{\ref@jnl{Acta Astron.}} % Acta Astronomica
\def\araa{\ref@jnl{ARA\&A}} % Annual Review of Astron and Astrophys
\def\apj{\ref@jnl{ApJ}} % Astrophysical Journal
\def\apjl{\ref@jnl{ApJ}} % Astrophysical Journal, Letters
\def\apjs{\ref@jnl{ApJS}} % Astrophysical Journal, Supplement
\def\apss{\ref@jnl{Ap\&SS}} % Astrophysics and Space Science
\def\aap{\ref@jnl{A\&A}} % Astronomy and Astrophysics
\def\aapr{\ref@jnl{A\&A~Rev.}} % Astronomy and Astrophysics Reviews
\def\aaps{\ref@jnl{A\&AS}} % Astronomy and Astrophysics, Supplement
\def\baas{\ref@jnl{BAAS}} % Bulletin of the AAS
\def\cise{\ref@jnl{Comput Sci Eng}} % Computing in science & engineering
\def\epja{\ref@jnl{Eur. Phys. J. A}} % European Physical Journal A
\def\icarus{\ref@jnl{Icarus}} % Icarus
\def\mnras{\ref@jnl{MNRAS}} % Monthly Notices of the RAS
\def\pasp{\ref@jnl{PASP}} % Publications of the ASP
\def\pasj{\ref@jnl{PASJ}} % Publications of the ASJ
\def\pasc{\ref@jnl{Publ. Astron. Soc. Pac.}} % Publications of the Astronomical Society of the Pacific
\def\ssr{\ref@jnl{Space~Sci.~Rev.}} % Space Science Reviews
\def\zap{\ref@jnl{ZAp}} % Zeitschrift fuer Astrophysik
\def\nat{\ref@jnl{Nature}} % Nature
\def\iaucirc{\ref@jnl{IAU~Circ.}} % IAU Cirulars
\def\aplett{\ref@jnl{Astrophys.~Lett.}} % Astrophysics Letters
\def\planss{\ref@jnl{Planet.~Space~Sci.}} % Planetary Space Science
\def\procspie{\ref@jnl{Proc.~SPIE}} % Proceedings of the SPIE
\def\rmxaa{\ref@jnl{Rev. Mex. Astron. Astrofis.}} % Rev. Mex. Astron. Astrofis.
\def\jcap{J.~Cosmology Astropart. Phys.} % Journal of Cosmology and Astroparticle Physics
\def\na{New~Astron.} % New Astronomy
\def\jrasc{J.~R.~Astron. Soc. Canada} % Journal of the RAS of Canada
\def\pasa{Publ. Astron. Soc. Australia} % Publications of the Astronomical Society of Australia
\let\astap=\aap
\let\apjlett=\apjl
\let\apjsupp=\apjs
\let\applopt=\ao
% use comma instead of point
\renewcommand*{\newunitpunct}{\addcomma\space}
% nothing point at the end of the reference
\renewcommand*{\finentrypunct}{}
}
% ---------------------------------------------------------------
% various little changes
% ---------------------------------------------------------------
\usepackage{xpatch}
% no pagination
% https://stackoverflow.com/questions/58448860/how-can-i-add-colons-and-remove-p-pp-from-in-text-citations-with-biblatex
%\DefineBibliographyStrings{english}{%
% page = {},
% pages = {},
%}
% not used: instead we remove \mkpageprefix in the next step (where we print only the first page number)
% display only starting page of page range (only for articles)
% https://tex.stackexchange.com/questions/33565/displaying-only-the-starting-page-of-a-page-range-in-bibliographies
%\DeclareFieldFormat[article]{pages}{\mkfirstpage[{\mkpageprefix[bookpagination]}]{#1}}
\DeclareFieldFormat[article]{pages}{\mkfirstpage{#1}}
% set the journal name in roman
% https://tex.stackexchange.com/questions/454672/biblatex-journal-name-non-italic
\DeclareFieldFormat{journaltitle}{#1\isdot}
% order of surname and first name in bibliography
\DeclareNameAlias{sortname}{family-given}
% remove & in bibliography
% https://tex.stackexchange.com/questions/197435/change-author-separator-and-delete-in-bibliography-biblatex
\DeclareDelimAlias[bib]{finalnamedelim}{multinamedelim}
% the below is probably not needed
% Modify the name format
\DeclareNameFormat{default}{%
\nameparts{#1}%
\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}%
\usebibmacro{name:andothers}%
}
\renewbibmacro*{name:andothers}{%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}
{%
\ifnumgreater{\value{liststop}}{1}
{\finalandcomma}
{}%
\andothersdelim
\bibstring{andothers}%
}
{}%
}
\DefineBibliographyStrings{english}{%
backrefpage = {p.\ },% originally "cited on page"
backrefpages = {pp.\ },% originally "cited on pages"
}
% ---------------------------------------------------------------
% define links to ads and journal
% ---------------------------------------------------------------
\RequirePackage{xcolor} % specifying colors
% use the corporate design colors of Heidelberg University
\definecolor{journalcolor}{RGB}{78, 121, 167}
\definecolor{volumnecolor}{RGB}{225, 87, 89}
% https://tex.stackexchange.com/questions/286704/how-to-add-adsurl-field-as-link-to-bibliography
\DeclareDatamodelFields[type=field,datatype=verbatim]{adsurl}
\DeclareDatamodelEntryfields{adsurl}
\DeclareFieldFormat{link1}{%
\iffieldundef{doi}{%
\iffieldundef{eprint}{%
\iffieldundef{doi}{%
\iffieldundef{url}{%
#1%
}{%
\href{\thefield{url}}{\color{journalcolor}#1}%
}%
}{%
\href{\thefield{adsurl}}{\color{journalcolor}#1}%
}%
}{%
\href{https://arxiv.org/abs/\thefield{eprint}}{\color{journalcolor}#1}%
}%
}{%
\href{http://dx.doi.org/\thefield{doi}}{\color{journalcolor}#1}%
}%
}
\DeclareFieldFormat{link2}{%
\iffieldundef{adsurl}{%
\iffieldundef{eprint}{%
\iffieldundef{doi}{%
\iffieldundef{url}{%
#1%
}{%
\href{\thefield{url}}{\color{volumnecolor}#1}%
}%
}{%
\href{http://dx.doi.org/\thefield{doi}}{\color{volumnecolor}#1}%
}%
}{%
\href{https://arxiv.org/abs/\thefield{eprint}}{\color{volumnecolor}#1}%
}%
}{%
\href{\thefield{adsurl}}{\color{volumnecolor}#1}%
}%
}
% add character to year if multiple entries from one author
\renewbibmacro*{date+extrayear}{%
\iffieldundef{year}
{}
{\printtext{%
\addperiod\space\printfield{labelyear}%
\printfield{extradate}}}}
\DeclareBibliographyDriver{article}{%
\usebibmacro{begentry}%
\printnames{author}%
\newunit\newblock
\usebibmacro{date+extrayear}%
\newunit\newblock
\printtext[link1]{%
\usebibmacro{journal}%
}%
\newunit
\printtext[link2]{%
\printfield{volume}%
\newunit
\printfield{pages}%
}%
\newunit\newblock
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{inproceedings}{%
\usebibmacro{begentry}%
\printnames{author}%
\newunit\newblock
\printfield{year}%
\newunit\newblock
\printtext[link1]{%
\usebibmacro{booktitle}%
}%
\newunit
\printtext[link2]{%
\printfield{pages}%
}%
\newunit\newblock
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{book}{%
%\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printnames{author}%
\newunit\newblock
\printfield{year}%
\newunit\newblock
\printtext[link1]{%
\printlist{publisher}%
}%
\newunit
\printtext[link2]{%
\printfield{title}%
}%
\newunit\newblock
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\usebibmacro{finentry}}