forked from sjtug/SJTUThesis
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgb7714-2015.cbx
93 lines (85 loc) · 2.53 KB
/
gb7714-2015.cbx
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
%%
%% ---------------------------------------------------------------
%% biblatex-gb7714-2015 --- A biblatex implementation of the
%% GBT7714-2015 citation style,numerical sequence
%% Maintained by huzhenzhen
%% history:
%% 2016/05/20 v1.0 2016/10/23 v1.0a 2016/11/11 v1.0b
%% 2016/11/14 v1.0c 2016/11/24 v1.0d 2016/12/07 v1.0e
%% 2017/02/26 v1.0g 2017/04/11 v1.0h 2017/11/21 v1.0i
%% 2018/01/20 v1.0j 2018/04/03 v1.0k
%% E-mail: [email protected]
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
\ProvidesFile{gb7714-2015.cbx}[2018/04/03 v1.0k biblatex citation style]
%
% 加载标准样式
%
\RequireCitationStyle{numeric-comp}
%\RequireCitationStyle{numeric}
%
% 选项设置
%
\ExecuteBibliographyOptions{
autocite = superscript ,
autopunct = true ,
sorting = none ,
}
%
% 重定义cite命令
%
% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{⟨precode⟩}{⟨loopcode⟩}{⟨sepcode⟩}{⟨postcode⟩}
\DeclareCiteCommand{\cite}[\mkbibsuperscript]
{[\usebibmacro{cite:init}%直接添加方括号
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}%
\usebibmacro{postnote}]}
%
% 新定义pagescite命令,以满足标签带页码的国标要求
%
% 原理方法:
% 1.修改postnote的输出格式
\DeclareFieldFormat{postnote}{#1}
% 2.新增页码输出宏
\newbibmacro*{postpages}{%
\iffieldundef{postnote}
{\printfield{pages}}
{\printfield{postnote}}}
% 3.新增\pagescite引用命令
\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
{[\usebibmacro{cite:init}%
\usebibmacro{prenote}%
}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]%
\usebibmacro{postpages}}
%
% 定义yearpagescite,为与ay样式兼容,等同于\pagescite
%
\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
{[\usebibmacro{cite:init}%
\usebibmacro{prenote}%
}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]%
\usebibmacro{postpages}}
%
% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式,
%
% 原理方法:等同于\pagescite,但不要页码
\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
{[\usebibmacro{cite:init}%
\usebibmacro{prenote}%
}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]}