-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbibstyle-patch.sty
85 lines (81 loc) · 2.2 KB
/
bibstyle-patch.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
\RequirePackage{biblatex}
% Change DOI and eprint handling (adapted from biblatex.def)
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:url}
{\usebibmacro{url+urldate}}
{}%
%\newunit
\newblock
\iftoggle{bbx:doi}
{\printfield{doi}}
{}%
\newunit
\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
}
\def\bib@urlsize{\small}
% Specify how doi fields are typeset
\DeclareFieldFormat{doi}{%
\newline%
{\bib@urlsize
\ifhyperref
{\href{https://dx.doi.org/#1}{\nolinkurl{doi:#1}}}
{\nolinkurl{doi:#1}}}}
% Assume all eprints are arxiv links
\DeclareFieldAlias{eprint}{eprint:arxiv}
% Specify how arxiv fields are typeset
\DeclareFieldFormat{eprint:arxiv}{%
\newline%
{\bib@urlsize
\ifhyperref
{\href{https://arxiv.org/\abx@arxivpath/#1}{%
\nolinkurl{arXiv:#1}%
\iffieldundef{eprintclass}
{}
{\addspace\texttt{\mkbibbrackets{\thefield{eprintclass}}}}}}
{\nolinkurl{arXiv:#1}
\iffieldundef{eprintclass}
{}
{\addspace\texttt{\mkbibbrackets{\thefield{eprintclass}}}}}}}
% Change font size of url field
\ifcsname textls\endcsname%
\appto\bibsetup{%
% Ever so slightly squish the letters together in urls in the bibliography.
% This fixes an annoying overfull hbox in the EJC urls.
% The difference in spacing is given in thousands of em.
\DeclareFieldFormat{url}{\newline{\small\textls[-7]{\url{#1}}}}
}%
\else%
\DeclareFieldFormat{url}{\newline{\small\url{#1}}}
\fi
% restyle unpublished bib entries to be more similar to articles
\DeclareBibliographyDriver{unpublished}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{howpublished}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{location+date}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}