summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-22 22:18:43 +0000
committerKarl Berry <karl@freefriends.org>2019-01-22 22:18:43 +0000
commit5bee6f1ca16cbb2563ba57c1a3bfa7951f453c0b (patch)
treeda2cda75fc2e5955f24b5ccd2d5240e941c98287 /Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
parenta8a4b6646d0e9e80061d89b21aee5ffcc853b90d (diff)
biblatex-gb7714-2015 (22jan19)
git-svn-id: svn://tug.org/texlive/trunk@49789 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx')
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx1350
1 files changed, 829 insertions, 521 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
index 47d9b9883f6..b2d3e61a9fe 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
@@ -10,9 +10,9 @@
%
% 版本和时间信息
%
-\ProvidesFile{gb7714-2015ay.bbx}[2018/11/04 v1.0n biblatex bibliography style]
-\def\versionofgbtstyle{2018/11/04 v1.0n}
+\def\versionofgbtstyle{2019/01/19 v1.0p}
\def\versionofbiblatex{\abx@version}
+\ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style]
\RequireBiber[3]%显式指定用biber后端
%=====================================================================
@@ -37,7 +37,8 @@
\providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前
\providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后
\providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex
- \@ifpackagelater{biblatex}{2016/03/01}{
+ \@ifpackagelater{biblatex}{2014/04/01}{
+ \@ifpackagelater{biblatex}{2016/03/01}{
\@ifpackagelater{biblatex}{2016/12/01}{
\@ifpackagelater{biblatex}{2017/11/01}{
\@ifpackagelater{biblatex}{2017/12/01}{
@@ -46,7 +47,9 @@
{\toggletrue{iftleight}\togglefalse{iftlatest}}}
{\toggletrue{iftlseven}\togglefalse{iftlatest}}}
{\toggletrue{iftlsix}\togglefalse{iftlatest}}}
- {\toggletrue{iftlfive}\togglefalse{iftlatest}}
+ {\toggletrue{iftlfive}\togglefalse{iftlatest}}}
+ {\PackageError{biblatex}{Outdated 'biblatex' package}
+ {Please update biblatex, This is a fatal error.}}
\newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令
\newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令
@@ -64,7 +67,7 @@
\providetoggle{ifCJKforgbt}
\def\testCJKfirst#1{%
\iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
- \iffieldequalstr{#1}{cn}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
+ \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
%
% 2个卷的解析函数,用于连续出版物
@@ -186,6 +189,7 @@
%定义类型和载体标识,从gb内容看载体基本属于介质。
%为与lee zeping的bst的样式统一,使用mark和medium这两域名
%为单个条目的姓名格式控制增加nameformat和namefmtid两个域
+ %为缩略信息文献表增加了shortbooktitle域
\DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
\DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
\DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
@@ -196,6 +200,14 @@
% 设置宏包选项
%=====================================================================
%
+ % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
+ % 20180814,v1.0m,hzz
+ % 原理方法:
+ % 只为兼容性考虑不做任何处理
+ \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
+ }
+
+ %
% 增加一个控制是否输出文献类型和载体标识的选项
%
% 原理方法:
@@ -233,6 +245,9 @@
\def\str@noaddress{出版地不详}
\def\str@nopublisher{出版者不详}
\def\str@edition{版}
+ \def\str@volumecn{卷}
+ \def\str@numbercn{册}
+ \def\str@serialcn{第}
\AtEndOfPackage{%
\iftoggle{bbx:codegbk}{%
@@ -288,6 +303,12 @@
}
}{}}
+ %
+ %增加一个处理佚名或noauthor的控制选项
+ \DeclareBibliographyOption{gbnoauthor}[true]{%
+ \ifstrequal{#1}{false}{}{\dealnoathor}}
+ %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
+
%
% 增加一个恢复域格式为标准样式的控制选项
@@ -320,7 +341,7 @@
\settoggle{bbx:gbpunctin}{#1}}
\ExecuteBibliographyOptions{gbpunctin}
- %
+
% 选项设置
%
\ExecuteBibliographyOptions{
@@ -328,9 +349,11 @@
date = year, %日期仅写到年
maxbibnames=3, %将文献列表和引用中最大名字数量区分开
minbibnames=3,
+ maxitems = 1,%设置列表最大数量
+ minitems = 1, %设置缩减后的列表最小数量
isbn=false,
sorting=gb7714-2015,
- sortlocale=zh__pinyin,
+ sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin,
}
%
@@ -352,15 +375,47 @@
\iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}}
%为姓名格式选择增加的计数器
- \newcounter{namefmtcase}
- \def\thenamefmtcase{\the\c@namefmtcase}
+ \newcounter{gbnamefmtcase}
+ \def\thegbnamefmtcase{\the\c@gbnamefmtcase}
+ %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
+ \newcounter{gbcitelocalcase}
+ \newcounter{gbbiblocalcase}
+ \def\thegbcitelocalcase{\the\c@gbcitelocalcase}
+ \def\thegbbiblocalcase{\the\c@gbbiblocalcase}
\@ifpackagelater{biblatex}{2016/03/27}
- {
+ { % 针对biblatex>=3.3版本的选项设置
+ % 增加本地化字符串的中英文切换选项
+ % gbcitelocal指标注中的本地化字符串
+ % gbbiblocal 指文献表中的本地化字符串
+ % gblocal 指设置文献表和标注中的本地化字符串
+ % v1.0o,20190103,hzz
+ %
+ \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
+ }
+ \ExecuteBibliographyOptions{gbcitelocal}
+
+ \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
+ }
+ \ExecuteBibliographyOptions{gbbiblocal}
+
+ \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
+ \ExecuteBibliographyOptions{gbbiblocal=#1}%
+ \ExecuteBibliographyOptions{gbcitelocal=#1}%
+ }
+ %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置
+
+
%
% 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑
- % v1.0l,20180623,hzz
+ % v1.0l,20180623,hzz
%
\DeclareBibliographyOption[string]{gbbiblabel}[bracket]{}
@@ -368,25 +423,23 @@
% 增加姓名大小写格式处理选项
%
\DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
- \ifstrequal{#1}{uppercase}{\setcounter{namefmtcase}{0}}{}%
- \ifstrequal{#1}{lowercase}{\setcounter{namefmtcase}{1}}{}%
- \ifstrequal{#1}{givenahead}{\setcounter{namefmtcase}{2}}{}%given-family
- \ifstrequal{#1}{familyahead}{\setcounter{namefmtcase}{3}}{}
- \ifstrequal{#1}{pinyin}{\setcounter{namefmtcase}{4}}{}%family-given
+ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
+ \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
+ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
+ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
}
\ExecuteBibliographyOptions{gbnamefmt}
%
% 增加标签对齐选项
%
-
%因为在作者年制中,不需要使用,这里也增加,为了与顺序编码制的兼容性考虑。
\DeclareBibliographyOption[string]{gbalign}[right]{}%
- %增加一个处理佚名或noauthor的控制选项
- \DeclareBibliographyOption{gbnoauthor}[true]{%
- \ifstrequal{#1}{false}{}{\dealnoathor}}
- %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
+
+
+
}
{
%
@@ -399,11 +452,11 @@
% 增加姓名大小写格式处理选项
%
\DeclareBibliographyOption{gbnamefmt}[uppercase]{%
- \ifstrequal{#1}{uppercase}{\setcounter{namefmtcase}{0}}{}%
- \ifstrequal{#1}{lowercase}{\setcounter{namefmtcase}{1}}{}%
- \ifstrequal{#1}{givenahead}{\setcounter{namefmtcase}{2}}{}%given-family
- \ifstrequal{#1}{familyahead}{\setcounter{namefmtcase}{3}}{}
- \ifstrequal{#1}{pinyin}{\setcounter{namefmtcase}{4}}{}%family-given
+ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
+ \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
+ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
+ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
}
\ExecuteBibliographyOptions{gbnamefmt}
@@ -413,10 +466,6 @@
%因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。
\DeclareBibliographyOption{gbalign}[right]{}%
- %增加一个处理佚名或noauthor的控制选项
- \DeclareBibliographyOption{gbnoauthor}[true]{%
- \ifstrequal{#1}{false}{}{\dealnoathor}}
- %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
}
@@ -474,9 +523,21 @@
%设置本地化字符串
%=====================================================================
%
- % 新建当地化字符串,用来记录“等”字符
+ % 新建当地化字符串,用来记录“等”字符、“和”字符
%
\NewBibliographyString{andotherscn}
+ \NewBibliographyString{andothersincitecn}
+ \NewBibliographyString{andothersincite}
+ \NewBibliographyString{andcn}
+ \NewBibliographyString{andothersjp}
+ \NewBibliographyString{andotherskr}
+ \NewBibliographyString{andjp}
+ \NewBibliographyString{andkr}
+ \NewBibliographyString{andincitecn}
+ \NewBibliographyString{andincite}
+ \NewBibliographyString{volumecn}
+ \NewBibliographyString{numbercn}
+ \NewBibliographyString{serialcn}
%
% 修改一些当地化字符串
@@ -489,108 +550,195 @@
references = {\str@references},
bytranslator= {\addcomma\ \str@bytranslator\adddot}, %将trans. by 改成 译
and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
+ andcn = {\addcomma},%\str@andcn\ and本地化字符串的中文对应词
+ andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分
+ andincite = {\addcomma},
%andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等
- andotherscn = {\str@andotherscn}, %将超过3个人名的省略,et al.改成为 等
+ andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等
+ andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分
+ andothersincite={et al.},
backrefpage = {\str@backrefpage:},
backrefpages = {\str@backrefpages:},
in={in\intitlepunct},
+ volumecn={\str@volumecn},
+ numbercn={\str@numbercn},
+ serialcn={\str@serialcn},
+ andothersjp={他},
+ andotherskr={외},
+ andjp={和},
+ andkr={和},
}
%=====================================================================
-%动态数据修改,修改输入的源文件数据,用于中文判断等操作
+% 动态数据修改
%=====================================================================
%
-% 修改输入的参考文献数据,源文件层的操作
-%
-% 原理方法:增加文献标识符如[M],[J]等
-% 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
-% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
-% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
-% 注意\DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
+% 各层次的数据映射和动态修改
+%
+% 原理方法:
+% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
+% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
+% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
+% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
+% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
+% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
+% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
+%
+% 不同的文献类型使用相同的驱动输出可以有5种方法:
+% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
+% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
+% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
+% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
+% 驱动别名定义本质上是做了驱动层映射
+% 5. 直接定义不同的类型的驱动,但驱动内容相同。
+%
+% 关于数据映射和驱动使用的考虑如下:
+% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
+% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
+% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
+% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
+% 可以在样式层映射做某些需要避免这种默认处置的转换
+% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
+%
+% 文献类型和驱动考虑如下:
+% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
+% newpaper映射为article,并以note域做区分特殊处理
+% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
+% standard映射为book或inbook,并以note域做区分特殊处理
+% collection和proceedings基本与book类似,因此做book驱动别名处理
+% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
+% 3. 专利类型有其特殊性,考虑patent类型
+% 4. 电子资源类型有其特殊性,考虑online类型
+% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更细日期
+% 因此考虑用一种类型来输出,使用report类型
+% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
+% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
+% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
+% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
+
\DeclareSourcemap{
\maps[datatype=bibtex]{
+ \map{
+ \pernottype{inbook}
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ \step[notfield=author]%当author不存在,将editor复制给author
+ \step[fieldsource=editor,fieldtarget=author]%并删除editor
+ }
+ \map{
+ \pernottype{inbook}
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ \step[notfield=author]%当author不存在,将translator复制给author
+ \step[fieldsource=translator,fieldtarget=author]%并删除translator
+ }
+ \map{
+ \step[notfield=address]%当address和location同步
+ \step[fieldsource=location,final]
+ \step[fieldset=address,origfieldval]
+ }
+ \map{
+ \step[notfield=location]%当address和location同步
+ \step[fieldsource=address,final]
+ \step[fieldset=location,origfieldval]
+ }
\map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
\step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }
- \map{%
+ }%\perdatasource{examples.bib}
+ \map{%处理在bib文件用mark标记文献类型标识符的情况
\step[fieldsource=mark,final]
\step[fieldset=usera, origfieldval]
}
- \map{%
+ \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
\step[fieldsource=nameformat,match=lowercase,final]
\step[fieldset=namefmtid,fieldvalue={1}]
}
- \map{%
+ \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
\step[fieldsource=nameformat,match=givenahead,final]
\step[fieldset=namefmtid,fieldvalue={2}]
}
- \map{%
+ \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
\step[fieldsource=nameformat,match=familyahead,final]
\step[fieldset=namefmtid,fieldvalue={3}]
}
- \map{%
+ \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
\step[fieldsource=nameformat,match=pinyin,final]
\step[fieldset=namefmtid,fieldvalue={4}]
}
- \map{%
- %\perdatasource{examples.bib}
+ \map{%根据article确定文献类型标识符
\pertype{article}
\step[fieldset=usera, fieldvalue={J}]
}
- \map{
+ \map{%根据periodical确定文献类型标识符
\pertype{periodical}
\step[fieldset=usera, fieldvalue={J}]
- \step[fieldsource=author] %有时会把author和editor混淆,处理后避免该问题
+ \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
\step[fieldset=editor, origfieldval]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后避免该问题
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
\step[fieldset=institution, origfieldval]
}
- \map{
- \pertype{newspaper}%增加一个新闻报纸的类型newspaper
- \step[fieldset=usera, fieldvalue={N}]%因为没有专门的驱动,这句的目的是定义一个usera域,方便映射为article后判断
- \step[fieldset=note, fieldvalue=news]
+ \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
+ \pertype{newspaper}
+ \step[fieldset=usera, fieldvalue={N}]
+ \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
}
- \map{
- \pertype{database}%对应增加的一个数据库类型database
- \step[fieldset=usera, fieldvalue={DB}]%没有专门的驱动,定义一个usera域,方便映射后使用
+ \map{%对应增加的一个数据库类型database确定文献类型标识符
+ \pertype{database}
+ \step[fieldset=usera, fieldvalue={DB}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
}
- \map{
- \pertype{dataset}%对应增加的一个数据集类型dataset
- \step[fieldset=usera, fieldvalue={DS}]%没有专门的驱动,定义一个usera域,方便映射后使用
+ \map{%对应增加的一个数据集类型dataset确定文献类型标识符
+ \pertype{dataset}
+ \step[fieldset=usera, fieldvalue={DS}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
}
- \map{
- \pertype{software}%对应增加的一个软件类型software
- \step[fieldset=usera, fieldvalue={CP}]%没有专门的驱动,定义一个usera域,方便映射后使用
+ \map{%对应增加的一个软件类型software确定文献类型标识符
+ \pertype{software}
+ \step[fieldset=usera, fieldvalue={CP}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
}
- \map{
- \pertype{map}%对应增加的一个舆图类型map
- \step[fieldset=usera, fieldvalue={CM}]%没有专门的驱动,定义一个usera域,方便映射后使用
+ \map{%对应增加的一个舆图类型map确定文献类型标识符
+ \pertype{map}
+ \step[fieldset=usera, fieldvalue={CM}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
}
- \map{
- \pertype{archive}%对应增加的一个档案类型archive
- \step[fieldset=usera, fieldvalue={A}]%没有专门的驱动,定义一个usera域,方便映射后使用
+ \map{%对应增加的一个档案类型archive确定文献类型标识符
+ \pertype{archive}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
}
- \map{
- \pertype{misc}%当misc类型带有网址时,将其转换为online类型
+ \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
+ %当misc类型带有网址时,直接将其转换为online类型
+ \pertype{misc}
\step[fieldsource=url,final]
\step[typesource=misc,typetarget=online]
}
- \map{
- \pertype{misc}%对应增加的一个备选类型misc
- \step[fieldset=usera, fieldvalue={Z}]%没有专门的驱动,定义一个usera域,方便映射后使用
+ \map{%对应增加的一个备选类型misc确定文献类型标识符
+ \pertype{misc}
+ \step[fieldset=usera, fieldvalue={Z}]%
}
\map{
\pertype{book}
\pertype{inbook}
\step[fieldset=usera, fieldvalue={M}]
- \step[fieldsource=version] %有时会把version和edition混淆,处理后避免该问题,可以直接用version
+ \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
\step[fieldset=edition, origfieldval]
}
\map{
- \pertype{standard}%兼容老的standard类型
- \step[fieldset=usera, fieldvalue={S}]%因为没有专门的驱动,这句的目的是定义一个usera域,方便映射为book和inbook后判断
- \step[fieldset=note, fieldvalue=standard]
+ \pertype{inbook}
+ \step[fieldsource=editor]%有时会把editor和bookauthor混淆,处理后使用bookauthor
+ \step[fieldset=bookauthor, origfieldval]
+ }
+ \map{%兼容老的standard类型,确定文献类型标识符
+ \pertype{standard}
+ \step[fieldset=usera, fieldvalue={S}]
+ \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
}
\map{
\pertype{patent}
@@ -600,67 +748,81 @@
\pertype{inproceedings}
\pertype{conference}%兼容老的conference类型
\step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution] %有时会把publisher和institution混淆,处理后避免该问题
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
\step[fieldset=publisher, origfieldval]
- \step[fieldsource=editor] %
+ \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor
\step[fieldset=bookauthor, origfieldval]
}
\map{
\pertype{proceedings}
\step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution] %有时会把publisher和institution混淆,这里处理后就没有这个问题
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{incollection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=publisher, origfieldval]
+ \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor
+ \step[fieldset=bookauthor, origfieldval]
+ }
+ \map{
+ \pertype{collection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
\step[fieldset=publisher, origfieldval]
- \step[fieldsource=editor] %%有的时候可能只填写了编者,没有author,把它复制一下
- \step[fieldset=author, origfieldval]
}
\map{
\pertype{report}
\pertype{techreport}%兼容老的techreport类型
\step[fieldset=usera, fieldvalue={R}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后避免该问题
- \step[fieldset=institution, origfieldval]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
}
\map{
\pertype{thesis}
\pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
\pertype{phdthesis}
\step[fieldset=usera, fieldvalue={D}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
}
\map{
\pertype{online}
\pertype{electronic}%兼容老的electronic类型
\pertype{www}%兼容老的www类型
\step[fieldset=usera, fieldvalue={EB}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
}
\map{
\pertype{manual}
\step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=edition] %有时会把version和edition混淆,处理后避免该问题,可以直接用version
+ \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
\step[fieldset=version, origfieldval]
- \step[fieldsource=organization]%因为用的report的驱动,所以需要institution域,把organization转成它以增强兼容性
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
\step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{incollection}
- \step[fieldset=usera, fieldvalue={G}]
- }
- \map{
- \pertype{collection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=editor] %%有的时候可能只填写了编者,没有author,把它复制一下
- \step[fieldset=author, origfieldval]
}
\map{
\pertype{unpublished}
\step[fieldset=usera, fieldvalue={Z}]
}
- \map{
+ \map{%作者的中文判断
\step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=userf, fieldvalue={cn}]
+ \step[fieldset=userf, fieldvalue={chinese}]
}
- \map{
+ \map{%译者的中文判断
\step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=usere, fieldvalue={cn}]
+ \step[fieldset=usere, fieldvalue={chinese}]
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=userc, fieldvalue={chinese}]
}
\map{%处理一些用year表示date的情况
%这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
@@ -668,24 +830,15 @@
\step[fieldsource=year]
\step[fieldset=date, origfieldval]
}
- \map{%将title信息保存到userd中避免因为标签生成原因导致title域被清除
- \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%}
- \step[fieldset=userd, fieldvalue={cn}]
+ \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
+ \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
+ \step[fieldset=userd, fieldvalue={chinese}]
}
- \map{%将entrykey放入keywords中用于后期的使用
+ \map{%将entrykey放入keywords中用于后期使用
\step[fieldsource=entrykey]
\step[fieldset=keywords, origfieldval]
}
- \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
- \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
- \step[fieldset=keywords, fieldvalue={,}, append]
- \step[fieldset=keywords, origfieldval, append]
- }
- \map{%因为要对author进行判断,所以这里先对有些只有编者而没有作者的情况进行处理
- \step[fieldsource=editor]
- \step[fieldset=author,origfieldval]
- }
- \map{%
+ \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
\step[fieldsource=language,match=english,final]
\step[fieldset=langid,fieldvalue={english}]
}
@@ -709,7 +862,8 @@
\step[fieldsource=language,match=korean,final]
\step[fieldset=langid,fieldvalue={english}]
}
- \map{%把语言信息设置language域内,而不再用userb域(20180525)
+ \map{%当没有language域信息给出时,根据title域来自动判断语言并设置本地化字符串语言
+ %把语言信息设置language域内,而不再用userb域(20180525)
%接着根据信息域字符的unicode码判断
\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
\step[fieldset=language,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
@@ -739,39 +893,99 @@
\step[fieldsource=author,match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
\step[fieldset=language,fieldvalue={chinese}]
}
- \map{\step[fieldsource=title,match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \map{
+ \step[fieldsource=title,match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
\step[fieldset=language,fieldvalue={chinese}]
}%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
\map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
\step[fieldset=language,fieldvalue={english}]
\step[fieldset=langid,fieldvalue={english}]
}
- %本来后面这些是放到DeclareStyleSourcemap中处理的,但是因为texlive2016的biblatex3.4不支持多个DeclareStyleSourcemap,
- %但又有处理特殊字符和处理gbnoauthor选项两个需求,但gbnoauthor需要用DeclareStyleSourcemap所以把这些提到这来,
- %以后将这两个功能结合到一个DeclareStyleSourcemap时,不用复制如下段代码了。
- \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义
- %但从实践看,并没有什么影响,映射过来就可以了。
- \step[typesource=newspaper, typetarget=article, final]
- }
- \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ \map{%将非中文的语言放入userd中,以便进行多语言处理
+ \step[fieldsource=language]%,notmatch={chinese},final
+ \step[fieldset=userd,origfieldval]
+ }%
+ \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
+ %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
\step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
\step[typesource=standard, typetarget=inbook, final]
}
- \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- \step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book
+ \map{%剩下的全部映射为book
+ \step[typesource=standard, typetarget=book, final]
}
- \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
+ \map{%先于标准样式的driver层映射,以取消type设置
\step[typesource=mastersthesis, typetarget=thesis, final]
%\step[fieldset=type, fieldvalue=mathesis]
}
- \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
+ \map{%先于标准样式的driver层映射,以取消type设置
\step[typesource=phdthesis, typetarget=thesis, final]
%\step[fieldset=type, fieldvalue=phdthesis]
}
- \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
+ \map{%先于标准样式的driver层映射,以取消type设置
\step[typesource=techreport, typetarget=report, final]
%\step[fieldset=type, fieldvalue=techreport]
}
+ \map{%
+ \pertype{report}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=report,typetarget=online]
+ \step[fieldset=note,fieldvalue={report}]
+ }
+ \map{%
+ \pertype{thesis}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=thesis,typetarget=online]
+ }
+ \map{%
+ \pertype{manual}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=manual,typetarget=online]
+ }
+ \map{%
+ \pertype{unpublished}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=unpublished,typetarget=online]
+ }
+ \map{%
+ \pertype{database}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=databasetypetarget=online]
+ }
+ \map{%
+ \pertype{dataset}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=dataset,typetarget=online]
+ }
+ \map{%
+ \pertype{software}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=software,typetarget=online]
+ }
+ \map{%
+ \pertype{map}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=map,typetarget=online]
+ }
+ \map{%
+ \pertype{archive}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=archive,typetarget=online]
+ }
+ \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
+ \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
+ \step[fieldset=keywords, fieldvalue={,}, append]
+ \step[fieldset=keywords, origfieldval, append]
+ }
\map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization
\step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
}
@@ -823,11 +1037,11 @@
\def\dealnoathor{
\DeclareStyleSourcemap{
\maps[datatype=bibtex]{
- \map{%默认情况下将空缺作者设置为佚名
+ \map{%默认情况下将空缺作者的中文文献设置为佚名
\step[fieldsource=language,match={chinese},final]
\step[fieldset=author, fieldvalue={佚名}]
}
- \map{%默认情况下将空缺作者设置为佚名
+ \map{%默认情况下将空缺作者的英文文献设置为A{non}
\step[fieldsource=language,match={english},final]
\step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{}
}
@@ -836,6 +1050,22 @@
}
+%
+%驱动别名等价于驱动层映射
+%
+\DeclareBibliographyAlias{newspaper}{article}%
+\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
+\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
+\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
+\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
+\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
+\DeclareBibliographyAlias{database}{manual}
+\DeclareBibliographyAlias{dataset}{manual}
+\DeclareBibliographyAlias{software}{manual}
+
+
%=====================================================================
% 设置排序格式
%=====================================================================
@@ -874,13 +1104,107 @@
\literal{0000}%3.7版是\literal{0}
}
}
+
+ %降序的nyt
+ \DeclareSortingScheme{gbnytd}{
+ \sort{
+ \field{presort}
+ }
+ \sort[final]{
+ \field{sortkey}
+ }
+ \sort{
+ \field{language}
+ }
+ \sort[direction=descending]{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+
+ %降序的ynt
+ \DeclareSortingScheme{gbyntd}{
+ \sort{
+ \field{presort}
+ }
+ \sort[final]{
+ \field{sortkey}
+ }
+ \sort{
+ \field{language}
+ }
+ \sort[direction=descending]{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+
+ %升序的ynt
+ \DeclareSortingScheme{gbynta}{
+ \sort{
+ \field{presort}
+ }
+ \sort[final]{
+ \field{sortkey}
+ }
+ \sort{
+ \field{language}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
}
-\DeclareBibliographyAlias{unpublished}{manual}
-\DeclareBibliographyAlias{database}{manual}
-\DeclareBibliographyAlias{dataset}{manual}
-\DeclareBibliographyAlias{software}{manual}
-\DeclareBibliographyAlias{map}{manual}
-\DeclareBibliographyAlias{archive}{manual}
+
%
% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本
@@ -918,6 +1242,105 @@
}
}
+ %降序的nyt
+ \DeclareSortingTemplate{gbnytd}{
+ \sort{
+ \field{presort}
+ }
+ \sort[final]{
+ \field{sortkey}
+ }
+ \sort{
+ \field{language}
+ }
+ \sort[direction=descending]{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %降序的ynt
+ \DeclareSortingTemplate{gbyntd}{
+ \sort{
+ \field{presort}
+ }
+ \sort[final]{
+ \field{sortkey}
+ }
+ \sort{
+ \field{language}
+ }
+ \sort[direction=descending]{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %升序的ynt
+ \DeclareSortingTemplate{gbynta}{
+ \sort{
+ \field{presort}
+ }
+ \sort[final]{
+ \field{sortkey}
+ }
+ \sort{
+ \field{language}
+ }
+ \sort{%[direction=ascending]
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
%
% 定义命令\defdoublelangentry,用于biblatex>v3.8版利用related实现双语文献的处理
%
@@ -949,7 +1372,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
%=====================================================================
-%参考文献列表环境
+%参考文献表环境
%=====================================================================
%
@@ -991,6 +1414,9 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
%=====================================================================
%
% 新增文献类型标识符的格式
+% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
+% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
+% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
%
\DeclareFieldFormat{gbtypeflag}{%
\iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符
@@ -1039,6 +1465,11 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
+\DeclareFieldFormat{doi}{%
+ \rmfamily{DOI}\addcolon\space
+ \ifhyperref
+ {\href{https://doi.org/#1}{\nolinkurl{#1}}}
+ {\nolinkurl{#1}}}
%
% 标题的字母大小写格式修改
%
@@ -1101,37 +1532,123 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
%\setunit{\addspace}%
\printnames[bytranslator]{translator}%
\clearname{translator}%
+ %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
+ %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
\usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
\setunit{\addspace}%
\newunit}%
\usebibmacro{withothers}}
-%
-% 下面一段没有用,但从中可以看到当地化字符串格式的引用前的代码处理
-% 比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
-% \renewbibmacro*{bytranslator+othersstrg}{%
%
% 修改作者数量超过限定值,做省略时的处理格式
+% v1.0,20160701,hzz
+% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
%
-% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用etcl。
+% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
\renewbibmacro*{name:andothers}{%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
- }{%这里做一个判断是在处理author还是translator用于两者是不同语言的情况
- \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}%
- %这句判断如果放到\andothersdelim后面会在等或etc.前增加一个空格,所以放前面
- \ifnumgreater{\value{liststop}}{1}
+ }{\ifnumgreater{\value{liststop}}{1}%
{\finalandcomma}%
{}%\finalandcomma
-\printdelim{andothersdelim}\iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{\bibstring{andothers}}
-%\andothersdelim\bibstring{andotherscn}
+\printdelim{andothersdelim}\printdelim{strandothersdelim}%
}{}}
+% 修改省略作者后的本地化字符串,比如et al.
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{strandothersdelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%%做一个判断是在处理author还是translator,用于两者是不同语言的情况
+ \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}%
+ \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}%
+ \ifcase\value{gbcitelocalcase}%
+ \iftoggle{ifCJKforgbt}{\bibstring{andothersincitecn}}{%
+\iffieldequalstr{userd}{korean}{\bibstring{andotherskr}}{}%
+\iffieldequalstr{userd}{japnese}{\bibstring{andothersjp}}{}%
+\iffieldequalstr{userd}{english}{\bibstring{andothersincite}}{}%
+\iffieldequalstr{userd}{french}{\bibstring{andothers}}{}%
+\iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}%
+}\space%
+ \or%
+ \bibstring{andothersincitecn}\space%
+ \or%
+ \bibstring{andothersincite}\space%
+ \fi}
+\DeclareDelimFormat[bib,biblist]{strandothersdelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%
+ \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}%
+ \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}%
+ \ifcase\value{gbbiblocalcase}%
+ \iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{%
+\iffieldequalstr{userd}{korean}{\bibstring{andotherskr}}{}%
+\iffieldequalstr{userd}{japnese}{\bibstring{andothersjp}}{}%
+\iffieldequalstr{userd}{english}{\bibstring{andothers}}{}%
+\iffieldequalstr{userd}{french}{\bibstring{andothers}}{}%
+\iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}%
+}\space%
+ \or%
+ \bibstring{andotherscn}\space%
+ \or%
+ \bibstring{andothers}\space%
+ \fi}
+
+%
+% 修改最后一个作者前的字符串,比如 and
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%
+ \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}%
+ \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}%
+ \ifcase\value{gbcitelocalcase}%
+ \iftoggle{ifCJKforgbt}{\bibstring{andincitecn}}{%
+\iffieldequalstr{userd}{korean}{\bibstring{andkr}}{}%
+\iffieldequalstr{userd}{japnese}{\bibstring{andjp}}{}%
+\iffieldequalstr{userd}{english}{\bibstring{andincite}}{}%
+\iffieldequalstr{userd}{french}{\bibstring{and}}{}%
+\iffieldequalstr{userd}{russian}{\bibstring{and}}{}%
+ }\space%
+ \or%
+ \bibstring{andincitecn}\space%
+ \or%
+ \bibstring{andincite}\space%
+ \fi}
+\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%
+ \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}%
+ \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}%
+ \ifcase\value{gbbiblocalcase}%
+ \iftoggle{ifCJKforgbt}{\bibstring{andcn}}{%
+\iffieldequalstr{userd}{korean}{\bibstring{andkr}}{}%
+\iffieldequalstr{userd}{japnese}{\bibstring{andjp}}{}%
+\iffieldequalstr{userd}{english}{\bibstring{and}}{}%
+\iffieldequalstr{userd}{french}{\bibstring{and}}{}%
+\iffieldequalstr{userd}{russian}{\bibstring{and}}{}%
+}\space%
+ \or%
+ \bibstring{andcn}\space%
+ \or%
+ \bibstring{and}\space%
+ \fi}
+
+%
% 重设title的输出
%
% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
@@ -1157,7 +1674,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
{\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
{\printfield[gbtypeflag]{usera}}}%其它
}}{}%
- \iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
%\newunit
}%
}}
@@ -1170,8 +1687,8 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
\DeclareNameFormat{namefmtselected}{%
\iffieldundef{namefmtid}{}%
-{\defcounter{namefmtcase}{\thefield{namefmtid}}}%
-\ifcase\value{namefmtcase}%
+{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
+\ifcase\value{gbnamefmtcase}%
\ifgiveninits
{\usebibmacro{name:gbuppercase}
{\namepartfamily}
@@ -1236,7 +1753,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
%GB/T 7714-2015 风格,全部大写
-\renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
+\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
\renewcommand*{\revsdnamepunct}{}%
\ifuseprefix%
@@ -1264,7 +1781,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
}
%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
-\renewbibmacro*{name:gblowercase}[4]{\bibauthorfont%
+\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
\ifuseprefix
@@ -1292,7 +1809,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
}
%中文常见风格,汉语拼音全拼模式
-\renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
+\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
@@ -1414,8 +1931,8 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
%%biblatex<3.2版的情况,姓名的处理格式带参数
\DeclareNameFormat{namefmtselected}{%
\iffieldundef{namefmtid}{}%
- {\defcounter{namefmtcase}{\thefield{namefmtid}}}%
- \ifcase\value{namefmtcase}%
+ {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
+ \ifcase\value{gbnamefmtcase}%
\iffirstinits
{\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}%
@@ -1424,7 +1941,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
{\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}%
\or
- \iffirstinits
+ \iffirstinits
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
\ifblank{#3#5}
@@ -1461,14 +1978,18 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
\iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}%
\iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}}
- \newbibmacro*{newsdate}{%%新增加一个新闻日期
+ \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期
\iffieldundef{year}{}{\printfield{year}%
\iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}%
\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
}
\newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空
\iffieldundef{endyear}{%
\iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}%
\iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}%
@@ -1487,7 +2008,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
}%
}%
- }%
+ }}%
}
%
@@ -1510,13 +2031,17 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
}
\newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \iffieldundef{year}{%
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
\iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
{\printtext{(}\printenddate\printtext{)}}%
}{\iffieldequalstr{year}{}{%因为year存在,但为空
}{\printtext{(}\blx@edtfdate{}{}\printtext{)}}%
}%
- }%
+ }}%
}
%
@@ -1533,19 +2058,25 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
% 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
%
% 原理方法:加上printtext避免破坏异步标点机制
- %
+ % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
+ % 所以无法再用选项设置的方法,印象需要用底层的命令
+ % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断
\newbibmacro*{newsdate}{%%
- \printtext{\blx@gbdate{}{}}%%
+ \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}%
}
\newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \iffieldundef{year}{%
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
\iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
{\printtext{(}\printenddate\printtext{)}}%
}{\iffieldequalstr{year}{}{%因为year存在,但为空
}{\printtext{(}\blx@gbdate{}{}\printtext{)}}%
}%
- }%
+ }}%
}
%
@@ -1665,12 +2196,19 @@ test{\iftoggle{iftlnine}}
}
%
-% 出版社和地址的处理
+% 当location等出版项超过maxitem缩减后不再输出etal
+%
+\DeclareListFormat{location}{%
+ \usebibmacro{list:delim}{#1}%
+ #1\isdot}
+\DeclareListAlias{institution}{location}
+\DeclareListAlias{publisher}{location}
+
+% 新增一个样式用于输出连续出版物的地址,单位,时间,
+% 用于periodical连续出版物的出版社和地址的处理
%
% v1.0k,20180425,为出版信息增加字体控制命令,hzz
-% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
-% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
-% 新增一个样式用于输出连续出版物的地址,单位,时间,%类似\newbibmacro*{publisher+location+date}
+% %类似\newbibmacro*{publisher+location+date}
\newbibmacro*{location+institution+date}{\bibpubfont%
\iftoggle{bbx:gbpub}%
{\testCJKfirst{userd}%
@@ -1701,30 +2239,27 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}%
\newunit}%
}
%
+% 通用的出版社和地址的处理
%
+% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
+% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
+% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
\renewbibmacro*{publisher+location+date}{\bibpubfont%
\iftoggle{bbx:gbpub}%
{\testCJKfirst{userd}%
-\ifboolexpr{%
-test {\iflistundef{location}} and test {\iflistundef{publisher}}%
-}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}%
-{\printtext{[S.l.\space :\space s.n.\adddot]}}%
-}{%
-\iflistundef{location}{%\adddot
-\iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
-\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}%
-}}% \bibstring{noaddress}
-{\printlist{location}\addcolon\addspace}%
-%\addcolon\addspace%
-\iflistundef{publisher}{%
-\iffieldequalstr{note}{standard}{}{%
-\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
-{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
-}}%
-{\printlist{publisher}}}%
+ \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
+ {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
+ {\iflistundef{location}{%\adddot
+ \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
+ {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
+ \iflistundef{publisher}{%
+ \iffieldequalstr{note}{standard}{}%
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
+ {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
+ {\printlist{publisher}}}%
\setunit*{\addcomma\addspace}%\addcomma\addspace%
-\usebibmacro{date}%
-%\newunit %去掉这个标点
+\usebibmacro{date}%%\newunit %去掉这个标点
}%
{\printlist{location}%
\iflistundef{publisher}
@@ -1732,21 +2267,63 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
{\setunit*{\addcolon\space}}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
- \usebibmacro{date}%
- %\newunit
+ \usebibmacro{date}%%\newunit
}%
}
+%
+% 修改了一个institution+location+date用于manual、report、thesis等类型
+%
+% 20180425,v1.0k,增加了字体控制命令,hzz
+% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
+\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
+{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
+ \iflistundef{institution}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ %\newunit
+ }}
+
+%
+% 对volume卷信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{volume}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}#1\bibstring{volumecn}}%
+{\bibstring{volume}~#1}%
+}% volume of a book
+\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal
+
+%
+% 对number册信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{number}{#1}%
+\DeclareFieldFormat[book,collection,inbook,%
+incollection,proceedings,inproceedings]{number}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}#1\bibstring{numbercn}}%
+{#1}%
+}%
%
% 对edition版本信息格式做出修改
%
\DeclareFieldFormat{edition}{%源来自biblatex.DEF
\testCJKfirst{userd}%
- \ifinteger{#1}%
- {\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}%
- {\mkbibordedition{#1}~\bibstring{edition}}}%
- {#1\isdot}}
+\iftoggle{ifCJKforgbt}%
+{\ifinteger{#1}%
+{\printtext{#1\str@edition}}%
+{#1\isdot}}%
+{\ifinteger{#1}%
+{\mkbibordedition{#1}~\bibstring{edition}}%
+{#1\isdot}}}
%
% 对version的版本信息做出修改
@@ -1951,8 +2528,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\printfield{volume}%
%\setunit*{\adddot}%去掉点号
%\printfield{number}%
- \iffieldundef{number}{}{\printfield[addnumflag]{number}}%
- %\iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
+ \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制
\iffieldundef{eid}{}{%
\setunit{\addcomma\space}%
\printfield{eid}}}}
@@ -2003,7 +2579,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
}
{\bibstring{\thefield{editortype}s}}
{\bibstring{\thefield{editortype}}}}
- {\thefield{editortype}}}
+ {\thefield{editortype}}}%
}}
%
@@ -2101,27 +2677,13 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
{\setunit{\subtitlepunct}\printfield{titleaddon}}%
\setunit{\subtitlepunct}\printfield{number}%写专利号
\iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
- \iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
%\newunit
}%
}%
}
-%
-% 修改了一个institution+location+date用于report等类型
-%
-% 20180425,v1.0k,增加了字体控制命令,hzz
-\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
- \printlist{location}%
- \iflistundef{institution}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- %\usebibmacro{modifydate}%
- %\newunit
- }
+
%
% 修改in:用于inbook、incollection、inproceedings等类型
@@ -2129,7 +2691,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
%
% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
\renewbibmacro*{in:}{%
- \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\addthinspace}}%
+ \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace
{\setunit{\adddot\addspace}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct
@@ -2142,39 +2704,38 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\DeclareBibliographyDriver{book}{%源来自standard.bbx文件
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
- \setunit{\labelnamepunct}\newblock
- \usebibmacro{maintitle+title}%
+\usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{maintitle+title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit
\printlist{language}%
-\newunit\newblock
+\newunit\newblock%
\usebibmacro{byauthor}%
\newunit\newblock}%
\usebibmacro{byeditor+others}%
-\newunit\newblock
-\printfield{edition}%
\newunit
-\iffieldundef{maintitle}
+\printfield{edition}%
+\newunit\newblock%%
+\iftoggle{bbx:gbstrict}{}{%
+\iffieldundef{maintitle}%
{\printfield{volume}%
-\printfield{part}}
+\printfield{part}}%
{}%
-\iftoggle{bbx:gbstrict}{}{%
\newunit%
\printfield{volumes}%
- \newunit\newblock
- \usebibmacro{series+number}}%
- \newunit\newblock
- %\printfield{note}%
- %\newunit\newblock
- \usebibmacro{publisher+location+date}%
- \newunit\newblock
- \usebibmacro{chapter+pages}%
- %\newunit
- \usebibmacro{doi+eprint+url}%从下面提上来
- \newunit\newblock
+\newunit\newblock%
+\usebibmacro{series+number}}%
+\newunit\newblock%
+%\printfield{note}%
+%\newunit\newblock%
+\usebibmacro{publisher+location+date}%
+%\newunit\newblock %这里标点去掉
+\usebibmacro{chapter+pages}%
+\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
+ \newunit\newblock%
\printfield{pagetotal}%
- \newunit\newblock
+ \newunit\newblock%
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
@@ -2191,59 +2752,6 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
{}%
\usebibmacro{finentry}}
-%
-% 文集中析出文献类型驱动
-%
-% 直接利用inbook做incollection
-\DeclareBibliographyDriver{incollection}{%直接用inbook的驱动
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
- \setunit{\labelnamepunct}\newblock
- \usebibmacro{title}%
- \usebibmacro{in:}%
- %\printtext{\texttt{//}\addthinspace}%
- \usebibmacro{bybookauthor}%
- \ifnameundef{bookauthor}{}{\newunit}%替换下一句
- %\newunit\newblock
- \usebibmacro{maintitle+booktitle}%
- \newunit\newblock
-% \usebibmacro{byeditor+others}%
-% \newunit\newblock
- \printfield{edition}%
- \newunit
- \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}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \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}}
@@ -2254,7 +2762,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
- \setunit{\labelnamepunct}\newblock
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit%
@@ -2272,6 +2780,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
% \usebibmacro{byeditor+others}%
% \newunit
\usebibmacro{note+pages}%
+ \iffieldequalstr{note}{news}{}{\usebibmacro{modifydate}}%带括号的修改或更新日期,当是新闻时不输出
\usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
\newunit\newblock
\iftoggle{bbx:isbn}
@@ -2301,7 +2810,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
%\setunit{\labelnamepunct}\newblock
\newunit\newblock %删除上面一行,添加这一行
\usebibmacro{title+issuetitle}%
- \newunit\newblock
+ \newunit\newblock%
\usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
\newunit\newblock%添加这一行
\iftoggle{bbx:gbstrict}{}{%
@@ -2334,7 +2843,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
- \setunit{\labelnamepunct}\newblock
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
%\usebibmacro{title}%
\usebibmacro{patenttitle}%给出专利专用的标题输出
\iftoggle{bbx:gbstrict}{}{%
@@ -2345,7 +2854,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
- %\printfield{number}%%已放到patenttitle中处理
+ %\printfield{number}%已放到patenttitle中处理
\iflistundef{location}
{}
{\setunit*{\addspace}%
@@ -2378,7 +2887,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
- \setunit{\labelnamepunct}\newblock
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit%
@@ -2386,16 +2895,17 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
- \usebibmacro{byeditor+others}}%
+ \usebibmacro{byeditor+others}%
\newunit\newblock
- \printfield{version}%
+ \printfield{note}}%
\newunit
- \printfield{note}%
+ \printfield{version}%
\newunit\newblock
- \printlist{organization}%
+% \printlist{organization}%
+ \printlist{institution}%
\newunit\newblock
%\usebibmacro{date}%
- \usebibmacro{modifydate}%修改为带括号的时间
+ \usebibmacro{modifydate}%修改或更新日期,为带括号的时间
\usebibmacro{url+urldate}%从下面移上来
\newunit\newblock
\iftoggle{bbx:eprint}
@@ -2416,57 +2926,16 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
-%
-% 学位论文修改
-%
- \DeclareBibliographyDriver{thesis}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
- \setunit{\labelnamepunct}\newblock
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock
- \printfield{type}}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \usebibmacro{doi+eprint+url}%
- \newunit
- \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}}
%
% 报告类型驱动
-% 2016-11-11,增加了译者信息
+% 当有网址无出版项时,用online输出
%
\DeclareBibliographyDriver{report}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
- \setunit{\labelnamepunct}\newblock
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit%
@@ -2484,7 +2953,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\newunit
\printfield{note}%
\newunit\newblock
- \usebibmacro{institution+location+date}%
+ \usebibmacro{publisher+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
\usebibmacro{doi+eprint+url}%
@@ -2508,15 +2977,14 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\usebibmacro{finentry}}
%
-% 手册类型驱动
+% 论文、手册类型驱动
% 2016-11-11,增加了译者信息
%
-% 直接利用report做manual
\DeclareBibliographyDriver{manual}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
- \setunit{\labelnamepunct}\newblock
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit%
@@ -2524,7 +2992,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\newunit\newblock
\usebibmacro{byauthor}}%
\newunit\newblock
- \usebibmacro{byeditor+others}%
+ \usebibmacro{byeditor+others}%增加的译者信息
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
@@ -2537,6 +3005,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\usebibmacro{institution+location+date}%
%\newunit\newblock
\usebibmacro{chapter+pages}%
+ \usebibmacro{modifydate}%修改或更新日期,为带括号的时间
\usebibmacro{doi+eprint+url}%
\newunit
\printfield{pagetotal}%
@@ -2565,7 +3034,7 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
- \setunit{\printdelim{nametitledelim}}\newblock
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit
@@ -2599,142 +3068,36 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\usebibmacro{finentry}}
-%
-% 会议论文文献类型驱动
-%
- \DeclareBibliographyDriver{inproceedings}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
- \setunit{\labelnamepunct}\newblock
- \usebibmacro{title}%
- \usebibmacro{in:}%
- %\printtext{\texttt{//}\addthinspace}%
- \usebibmacro{bybookauthor}%用类似inbook的方式处理
- \ifnameundef{bookauthor}{}{\newunit}%替换下一句
- %\newunit\newblock
- \usebibmacro{maintitle+booktitle}%
- \newunit\newblock
- \usebibmacro{event+venue+date}%
- \newunit\newblock
-% \usebibmacro{byeditor+others}%
-% \newunit\newblock
- \iffieldundef{maintitle}
- {\printfield{volume}%
- \printfield{part}}
- {}%
- \newunit
- \printfield{volumes}%
- \newunit\newblock
- \iftoggle{bbx:gbstrict}{}{%
- \usebibmacro{series+number}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock
- \printlist{organization}%
- \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}}
-%
-% 会议论文集文献类型驱动
-%
-\DeclareBibliographyDriver{proceedings}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- %\usebibmacro{editor+others}%
- \usebibmacro{author/translator+others}%
- \setunit{\labelnamepunct}\newblock
- \usebibmacro{maintitle+title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}}%
- \newunit\newblock
- \usebibmacro{event+venue+date}%
- \newunit\newblock
-% \usebibmacro{byeditor+others}%
-% \newunit\newblock
- \iffieldundef{maintitle}
- {\printfield{volume}%
- \printfield{part}}
- {}%
- \newunit
- \printfield{volumes}%
- \newunit\newblock
- \iftoggle{bbx:gbstrict}{}{%
- \usebibmacro{series+number}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock
- \printlist{organization}%
- \newunit}
- \usebibmacro{publisher+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \usebibmacro{doi+eprint+url}%
- \newunit
- \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{inbook}{%源来自standard.BBX
+\DeclareBibliographyDriver{inbook}{%源来自standard.bbx
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
- \setunit{\labelnamepunct}\newblock%
- \usebibmacro{title}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{title}%
\usebibmacro{in:}%
%\printtext{\texttt{//}\addthinspace}%
\usebibmacro{bybookauthor}%
\ifnameundef{bookauthor}{}{\newunit}%替换下一句
%\newunit\newblock
\usebibmacro{maintitle+booktitle}%
+ \setunit{\addcolon}\printfield{volume}\printfield{number}%增加卷和册信息
\newunit\newblock%
% \usebibmacro{byeditor+others}%
% \newunit\newblock
\printfield{edition}%
\newunit
- \iffieldundef{maintitle}
- {\printfield{volume}%
- \printfield{part}}
- {}%
\iftoggle{bbx:gbstrict}{}{%
- \newunit
+% \iffieldundef{maintitle}
+% {\printfield{volume}%
+% \printfield{part}}
+% {}%
+% \newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}}%
@@ -2762,58 +3125,3 @@ test {\iflistundef{location}} and test {\iflistundef{publisher}}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
-
-
-%
-% 文集类型驱动
-%
-% 直接利用book做collection
-\DeclareBibliographyDriver{collection}{%直接用book的驱动
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
- \setunit{\labelnamepunct}\newblock
- \usebibmacro{maintitle+title}%
-\iftoggle{bbx:gbstrict}{}{%
- \newunit
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%
- \newunit\newblock
- \printfield{edition}%
- \newunit
- \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}%
- \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}}