-
Notifications
You must be signed in to change notification settings - Fork 84
/
gb7714-SEU.bbx
338 lines (311 loc) · 10.3 KB
/
gb7714-SEU.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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
%%
%% ---------------------------------------------------------------
%% gb7714-SEU.bbx --- A bibliography style for SEUthesis template
%% ---------------------------------------------------------------
%%
%%用法:类似于标准的样式在biblatex加载时设置样式
%%文献表正常处理,标注命令主要用cite和parencite
\ProvidesFile{gb7714-SEU.bbx}
[2022/03/10 v0.1 a biblatex bibliography style for SEUthesis]
%==================================================
%加载gb样式
%==================================================
\RequireBibliographyStyle{gb7714-2015}
%==================================================
%选项设置
%==================================================
\ExecuteBibliographyOptions{
maxnames=3,
minnames=3,
%url=false,
doi=false,
gbfieldtype=true,
gbpunctin=false,
gbpub=false,
gbnamefmt=lowercase,
gbbiblabel=dot,
}
%==================================================
%为标注和文献表中标点格式,重设and本地化字符串
%==================================================
\DefineBibliographyStrings{english}{
mathesiscn={[硕士学位论文]},
phdthesiscn={[博士学位论文]},
in={In:\addthinspace},
incn={见:\addthinspace},
}
%==================================================
%设置一些标点格式为中文的标点
%==================================================
\renewcommand*{\bibpagespunct}{%
\ifentrytype{article}{\addcolon\addthinspace}{\adddot\addthinspace}%
}%
%==================================================
%调整部分域的输出格式
%==================================================
\DeclareFieldFormat%将thesis的标题格式重设
[thesis]
{title}{#1}%\mkbibquote{#1\isdot}
%
% url和url日期格式
%
\renewbibmacro*{url+urldate}{%
\usebibmacro{url}%%更换url的位置,放到下面
\iffieldundef{urlyear}%
{}{%\setunit*{\addspace}%
\usebibmacro{urldate}}%
\setunit{\addperiod\addspace}%
}
\renewbibmacro*{urldate}{%
\setunit{\addcomma\addthinspace}\printtext{\printurldate}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令
%
% 修改作者数量超过限定值,做省略时的处理格式
% v1.0,20160701,hzz
% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
%
% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
\renewbibmacro*{name:andothers}{%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}{\ifnumgreater{\value{liststop}}{1}%
{\finalandcomma}%
{}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。
%\printdelim{andothersdelim}
\printdelim{strandothersdelim}%
}{%当是译者的时候需要特殊处理:从7.2节看等/译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
%袁训来, 陈哲, 肖书海, 等.
%胡泳, 范海燕, 译.
%潘惠霞, 魏婧, 杨艳, 等译.
%\ifcurrentname{translator}{\addcomma}{}%
}}
%
% 修改省略作者后的本地化字符串,比如et al.
% v1.0o,20190103,hzz
%
% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
% 非默认情况,根据选项信息,选择选择强制中文或英文
% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
\DeclareDelimFormat{strandothersdelim}{%
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
%\addspace%
\edef\userfieldabcde{userd}%
\ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
\ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
\ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
\ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
\ifcase\value{gbbiblocalcase}%
\iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
\iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
\iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}%
\iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
\iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
\iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
\or%
\bibstring{andotherscn}%
\or%
\bibstring{andothers}%
\fi}
%
% 重设专利title的输出,将文献类型标识符输出出去
%
\renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件
\ifboolexpr{%
test{\iffieldundef{title}}%
and%
test{\iffieldundef{subtitle}}%
}%
{}%
{\printtext[title]{\bibtitlefont%
\printfield[titlecase]{title}%
\ifboolexpr{test {\iffieldundef{subtitle}}}%
{}{\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}%
\iffieldundef{titleaddon}{}%
{\setunit{\subtitlepunct}\printfield{titleaddon}}%
\iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
%\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
%\newunit
}%
}%
}
%==================================================
%调整部分类型驱动
%==================================================
\DeclareBibliographyAlias{conference}{inproceedings}%会议论文文献类型驱动
\DeclareBibliographyAlias{incollection}{inproceedings}%文集中析出文献类型驱动
%
%%
%% 专利文献驱动
%%
\DeclareBibliographyDriver{patent}{%源来自standard.BBX
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
%\usebibmacro{title}%
\usebibmacro{patenttitle}%给出专利专用的标题输出
\iftoggle{bbx:gbstrict}{}{%
\newunit%
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}}%
\newunit\newblock
\printfield{type}%
\setunit*{\addcomma\addspace}%
\printfield{number}%已放到patenttitle中处理
\iflistundef{location}
{}
{\setunit*{\addspace}%
\printtext{%[parens]
\printlist[][-\value{listtotal}]{location}}}%
\newunit\newblock
\usebibmacro{byholder}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{newsdate}%
\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}}
\DeclareBibliographyDriver{thesis}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{title}%
\newunit\newblock
\usebibmacro{byeditor+others}%增加的译者信息
\newunit\newblock
\iftoggle{bbx:gbfieldtype}{%
\setunit{\addcolon\addspace}
\printfield{type}%
\setunit*{\addspace}}{}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\usebibmacro{institution+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
\iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
\usebibmacro{modifydate}}%修改或更新日期为带括号的时间
\usebibmacro{doi+eprint+url}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isrn}}
{}%
\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}}
%
% book条目类的驱动
%
\DeclareBibliographyDriver{book}{%源来自standard.bbx文件
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{maintitle+title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit
\printlist{language}%
\newunit\newblock%
\usebibmacro{byauthor}%
\newunit\newblock}%
\printfield{edition}%
\newunit
\usebibmacro{byeditor+others}%
\newunit\newblock%%
\iftoggle{bbx:gbstrict}{}{%
\iffieldundef{maintitle}%
{\printfield{volume}%
\printfield{part}}%
{}%
\newunit%
\printfield{volumes}%
\newunit\newblock%
\usebibmacro{series+number}}%
\newunit\newblock%
%\printfield{note}%
%\newunit\newblock%
\usebibmacro{publisher+location+date}%
%\newunit\newblock %这里标点去掉
\usebibmacro{chapter+pages}%
\iffieldundef{url}{}{%当没有网址时也不输出
\usebibmacro{modifydate}}%带括号的修改或更新日期,
\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
\newunit\newblock%
\printfield{pagetotal}%
\newunit\newblock%
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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}}
\DeclareBibliographyDriver{inproceedings}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit\newblock
\usebibmacro{in:}%
\usebibmacro{editor}%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\newunit
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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}}