]> Softwares of Agnibho - biblatex-vancouver.git/blob - vancouver.bbx
No space betweent volume and issue
[biblatex-vancouver.git] / vancouver.bbx
1 % Copyright (c) 2020 Agnibho Mondal
2 % All rights reserved
3 %
4 % This file is part of BibLaTex Vancouver.
5 %
6 % BibLaTex Vancouver is free software: you can redistribute it and/or modify it
7 % under the terms of the GNU General Public License as published by the Free
8 % Software Foundation, either version 3 of the License, or (at your option) any
9 % later version.
10 %
11 % BibLaTex Vancouver is distributed in the hope that it will be useful, but
12 % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 % FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 % details.
15 %
16 % You should have received a copy of the GNU General Public License along with
17 % BibLaTex Vancouver. If not, see <http://www.gnu.org/licenses/>.
18 %
19 % Agnibho Mondal
20 % contact@agnibho.com
21 % www.agnibho.com
22
23 \ProvidesFile{vancouver.bbx}[2020/05/20 v0.1 biblatex vancouver]
24
25 \RequireBiber[2]
26 \RequireBibliographyStyle{numeric}
27
28 \RequirePackage{ifthen}
29
30 % Set default bibliography options
31 \ExecuteBibliographyOptions{
32 sorting=none,
33 giveninits=true,
34 terseinits=true,
35 isbn=false,
36 maxbibnames=99
37 }
38
39 % Remove unwanted punctuations
40 \renewcommand*{\revsdnamepunct}{}
41 \renewcommand*{\finentrypunct}{}
42 \renewcommand*{\bibpagespunct}{}
43
44 % Remove 'in:' string
45 \renewbibmacro{in:}{}
46
47 % Provide three letter month names
48 \newcommand*{\shortmonth}[1]{
49 \ifthenelse{\NOT\equal{#1}{}}{
50 \ifcase#1\relax
51 \or Jan
52 \or Feb
53 \or Mar
54 \or Apr
55 \or May
56 \or Jun
57 \or Jul
58 \or Aug
59 \or Sep
60 \or Oct
61 \or Nov
62 \or Dec
63 \fi
64 }
65 }
66
67 % Family name first
68 \DeclareNameAlias{default}{family-given}
69
70 % Remove unwanted formatting
71 \DeclareFieldFormat*{title}{#1}
72 \DeclareFieldFormat*{journaltitle}{#1}
73 \DeclareFieldFormat*{labelnumberwidth}{#1\adddot}
74 \DeclareFieldFormat*{pages}{:\mkcomprange{#1}}
75 \DeclareFieldFormat*{url}{Available from: \url{#1}}
76 \DeclareFieldFormat*[article]{issue}{(#1)}
77 \DeclareFieldFormat*{date}{
78 \thefield{year}%
79 \shortmonth{\thefield{month}}\addspace
80 \thefield{day}\isdot
81 }
82 \DeclareFieldFormat*{urldate}{
83 {[}Accessed on:
84 \thefield{urlyear}%
85 \shortmonth{\thefield{urlmonth}}\addspace
86 \thefield{urlday}{]}
87 }
88
89 % Some string replacements
90 \DeclareSourcemap{
91 \maps[datatype=bibtex]{
92 \map[overwrite=true]{
93 \step[fieldsource=journaltitle, match=\regexp{(\.)}, replace={}]
94 \step[fieldsource=journaltitle, match=\regexp{($)}, replace={.}]
95 }
96 }
97 }
98
99 % Code adapted from biblatex-nejm package
100
101 \renewbibmacro*{volume+number+eid}{
102 \printfield{volume}%
103 \printfield{issue}%
104 \printfield{eid}%
105 }
106
107 %Order year;volume:page
108 \renewbibmacro*{issue+date}{
109 \setunit*{\addspace}%
110 \usebibmacro{date}%
111 \newunit%
112 }
113
114 \renewbibmacro*{journal+issuetitle}{
115 \usebibmacro{journal}%
116 \iffieldundef{series}
117 {}
118 {\newunit
119 \printfield{series}}%
120 \setunit*{\addspace}%
121 \usebibmacro{issue+date}%
122 \setunit*{\addsemicolon\addspace}%
123 \usebibmacro{volume+number+eid}%
124 \usebibmacro{issue}%
125 \newunit}