summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/biblatex-nejm/nejm.bbx
blob: 43630319e41316c670813b010ecfe84199f7007c (plain)
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
%% Copyright (C) 2011, 2018 by Marco Daniel
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Marco Daniel.
%%
%% This work consists of the files nejm.bbx, nejm.cbx, biblatex-nejm.tex
%% and biblatex-nejm.pdf

%%$Id: nejm.bbx 30 2018-07-28 11:01:00Z marco $
%%$Rev: 30 $
%%$Author: marco $
%%$Date: 2018-07-28 13:01:00Z +0200 (Sa, 28. Jul 2018) $
\def\biblatexnejmversionbbx{v0.5}
\def\biblatexnejmpackagenamebbx{nejm.bbx}
\def\biblatexnejmsvnbbx$#1: #2 #3 #4-#5-#6 #7 #8${#4/#5/#6\space }
\ProvidesFile{nejm.bbx}[\biblatexnejmsvnbbx$Id: nejm.bbx 30 2018-07-28 11:01:00Z marco $ \biblatexnejmversionbbx: \biblatexnejmpackagenamebbx]

%use numeric.cbx as base
%Warning if backend isn't biber
\RequireBiber[2]
%need style:
\RequireBibliographyStyle{numeric}

\providetoggle{bbx:articledoi}
\DeclareBibliographyOption[boolean]{articledoi}[true]{%
  \settoggle{bbx:articledoi}{#1}}

\providetoggle{bbx:articlein}
\DeclareBibliographyOption[boolean]{articlein}[true]{%
  \settoggle{bbx:articlein}{#1}}

\providetoggle{bbx:printlang}
\DeclareBibliographyOption[boolean]{printlang}[true]{%
  \settoggle{bbx:printlang}{#1}}

%set options to biblatex
\ExecuteBibliographyOptions
  {
    isbn         = false ,
    labelnumber  = true ,
    minnames     = 3 ,
    maxnames     = 6 ,
    giveninits   = true ,
    terseinits   = true ,
    sorting      = none ,
    date         = year ,
    articledoi   = false,
    articlein    = false,
    printlang    = false,
  }


\AtBeginDocument{%
  \iftoggle{bbx:printlang}
    {}
    {\DeclareStyleSourcemap{
       \maps[datatype=bibtex]{
         \map{
           \step[fieldset=language, null]
         }
       }
     }}%
}

%remove punctuation and space after initials -- require biber
\renewrobustcmd*{\bibinitperiod}{}
%separator printed before the pages field
\renewcommand*{\bibpagespunct}{\addcolon}
%no bracktes in thebibliography and add dot
\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
%not formating pages
\DeclareFieldFormat*{pages}{\mkcomprange{#1}}
%not formated journaltitle
\DeclareFieldFormat*{journaltitle}{#1}
%not formated title
\DeclareFieldFormat*{title}{#1}


%Set name format
\DeclareNameAlias{default}{family-given}
\DeclareNameAlias{sortname}{family-given}

%remove comma between family name and given name
\renewcommand*{\revsdnamepunct}{}

%option articledoi -- no doi / eprint / url in article
\letbibmacro{doi+eprint+url-use}{doi+eprint+url}

\renewbibmacro*{doi+eprint+url}{%
  \ifboolexpr{test {\ifentrytype{article}} and not togl {bbx:articledoi}}
    {}
    {\usebibmacro{doi+eprint+url-use}}%
}

%no bibstring in in article:
\renewbibmacro*{in:}{%
  \ifboolexpr{test {\ifentrytype{article}} and not togl {bbx:articlein}}
    {}
    {\printtext{\bibstring{in}\intitlepunct}}%
}

%no number in ouput of bibliography
\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
%  \setunit*{\adddot}%
%  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}

%Order year;volume:page
\renewbibmacro*{issue+date}{%
  \printfield{issue}%
  \setunit*{\addspace}%
  \usebibmacro{date}%
  \newunit}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}}%
  \setunit*{\addspace}%
  \usebibmacro{issue+date}%
  \setunit*{\addsemicolon}
  \usebibmacro{volume+number+eid}%
  \setunit{\addcomma\space}%
  \usebibmacro{issue}%
  \newunit}

\endinput