summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.bbx
blob: 161dcacd8baf2b5fb4998f24fac50b28e97d29b8 (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
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
%%
%% ---------------------------------------------------------------
%% erj.bbx --- A bibliography style of Economic Research Journal in china
%% modified from gb7714-2015ay at the request of ddswhu
%% Maintained by huzhenzhen
%% E-mail: hzzmail@163.com
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
%%用法:类似于标准的样式在biblatex加载时设置样式
%%文献表正常处理,标注命令主要用cite和textcite
\ProvidesFile{chinese-erj.bbx}[2019/03/28 v1.0 a biblatex bibliography style for ERJ]


%==================================================
%加载gb样式
%==================================================
\RequireBibliographyStyle{gb7714-2015ay}
\RequirePackage{mfirstuc}%单词首字母大写的问题
\MFUnocap{in}%
\MFUnocap{the}%
\MFUnocap{of}%
\MFUnocap{on}%
\MFUnocap{and}%
\MFUnocap{for}%


%==================================================
%考虑多音字增加multipinyin排序,是其可以根据key域添加拼音来排序
%==================================================
\DeclareSortingTemplate{multipinyin}{
      \sort{
        \field{presort}
      }
      \sort{
    	\field{lansortorder}%language
      }
      \sort{
        \field{sortkey}
      }
      \sort{%[direction=descending]
        \field{sortname}
        \field{author}
        \field{editor}
        \field{translator}
      }
      \sort{
        \field{sortyear}
        \field{year}
      }
      \sort{
        \field{sorttitle}
        \field{title}
      }
      \sort{
        \field{volume}
        \literal{0}
      }
    }

%==================================================
%选项设置
%==================================================
    \ExecuteBibliographyOptions{
    maxbibnames=99,
    gbtype=false,
    gbpub=false,
    gbnamefmt=reverseorder,
    sorting=multipinyin,
    doi=false,
    url=false,
    }

%==================================================
%为标注和文献表中标点格式,重设and本地化字符串
%==================================================
\DefineBibliographyStrings{english}{
    and         = { and},%and后面的空格在finalnamedelim已经加过了,所以这里去掉20191009
    andcn       = {、},
    andincitecn = {和},%将标注中的分开,便于与文献表中的区分
    andincite   = {\&},
    %andotherscn={等},
    %mathesiscn={[硕士学位论文]},
    %phdthesiscn={[博士学位论文]},
}


%==================================================
%设置一些标点格式为中文的标点
%==================================================
\DeclareFieldFormat{titlecase}{\iffieldequalstr{userd}{chinese}{#1}{\capitalisewords{#1}}}
\DeclareFieldFormat*{title}{\iffieldequalstr{userd}{chinese}{《#1》}{#1\isdot}}
\DeclareFieldFormat[article]{title}{\iffieldequalstr{userd}{chinese}{《#1》}{\mkbibquote{#1}\isdot}}
\DeclareFieldFormat*{journaltitle}{\iffieldequalstr{userd}{chinese}{《#1》}{\textit{#1}}}%
%\DeclareFieldFormat*{booktitle}{《#1》}
\renewcommand*{\revsdnamepunct}{,}%%来源biblatex.def
\DeclareDelimFormat*{multinamedelim}{\iffieldequalstr{userd}{chinese}{、}{,}}%\addcomma\addspace
\DeclareDelimFormat{finalnamedelim}{%
  %\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{gbcitelocalcase}%
    \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
    \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
    \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
    \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}%
    \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
    \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
%\space%
  \or%
  \bibstring{andincitecn}\space%
  \or%
  \bibstring{andincite}\space%
  \fi}
\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
%  \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{andcn}}{}%
    \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
    \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
    \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
    \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
    \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
\space%
  \or%
  \bibstring{andcn}\space%
  \or%
  \bibstring{and}\space%
  \fi}
\DeclareDelimFormat{nameyeardelim}{,}%\addcomma\addspace
\DeclareDelimFormat[bib,biblist]{nameyeardelim}{,}%\addcomma\addspace
\DeclareDelimFormat{bibpagespunct}{\iffieldequalstr{userd}{chinese}{}{,}}%\addcomma\addspace
\renewcommand*{\newunitpunct}{,}%\addcomma\space %,
\renewcommand*{\finentrypunct}{\iffieldequalstr{userd}{chinese}{。}{\adddot}}

%==================================================
%调整部分域的输出格式
%==================================================
%
%   修改number和volume的格式
%
\newcounter{numberwithoutzero}
\DeclareFieldFormat[article,periodical]{number}%
    {\iffieldequalstr{userd}{chinese}{%
        \iffieldint{number}{\setcounter{numberwithoutzero}{#1}\printtext{\bibstring{serialcn}\addthinspace\arabic{numberwithoutzero}\addthinspace 期}}
        {\printtext{\bibstring{serialcn}\addthinspace#1\addthinspace 期}}%
    }%
        {\printtext{(}#1\printtext{)}}}% %
\DeclareFieldFormat[article,periodical]{volume}%
    {\iffieldequalstr{userd}{chinese}{}%
    {#1}}% volume of a book

%
%   调整期刊名的格式
%
%   原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。
%   v1.0k,20180425,增加了字体控制命令,hzz
\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
  \usebibmacro{journal}%
  %\setunit*{\addspace}%
  %\setunit*{\addcomma\addspace}%修改为增加一个逗号
  \iffieldundef{series}%
    {}%
    {\newunit%
     \printfield{series}%
     \setunit{\addspace}}%
  %\usebibmacro{volume+number+eid}%
  %\setunit{\addspace}%
  \usebibmacro{issue+date}%
  %\setunit{\addcolon\space}%
  %\iffieldundef{volume}{}{\setunit{\addcomma\space}}%
  %换成逗号和空格
  \usebibmacro{issue}%
  \usebibmacro{volume+number+eid}%把卷期放到年份后面
  %\newunit
  }

%   调整期刊卷和期的格式
%
\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
\iffieldequalstr{userd}{chinese}{%\printfield{volume}%
  \iffieldundef{number}{}{\printfield{number}}%区别于顺序编码制
    }
  {\newunit\printfield{volume}%
  %\setunit*{\adddot\space}%
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}}

%
%   重设title的输出
%
%   20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
%   原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
%   利用toggle做标识符是否输出的判断
\renewbibmacro*{title}{%
  \ifboolexpr{%
    test{\iffieldundef{title}}%
    and
    test{\iffieldundef{subtitle}}%
  }%
    {}%
    {\setunit{:}\printtext[title]{\bibtitlefont%增加字体控制命令%增加了标点:
       \printfield[titlecase]{title}%
       \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
       {}{\setunit{\subtitlepunct}%
       \printfield[titlecase]{subtitle}}%
       \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
        {\setunit{\subtitlepunct}\printfield{titleaddon}}%
        \iftoggle{bbx:gbtype}{%
         \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
        {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
                                         {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}% 判断是否为报纸
                                                                      {\printfield[gbtypeflag]{usera}}}% 其它
        }}{}%
     %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
     %\newunit
     }%
}}

\DeclareFieldFormat{pages}{\iffieldequalstr{userd}{chinese}{}{#1}}%页码引用格式的修改%去掉前面引导页码的pp.等字符

\setlength{\bibitemindent}{1.5\ccwd} % bibitemindent表示一条文献中第一行相对后面各行的缩进
\setlength{\bibhang}{0pt} % 作者年制中 bibhang 表示的各行起始位置到页
                          % 边的距离,顺序编码制中
                          % bibhang+labelnumberwidth 表示各行起始位置
                          % 到页边的距离