summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-07-04 22:06:51 +0000
committerKarl Berry <karl@freefriends.org>2017-07-04 22:06:51 +0000
commit72ab27e8dbc6f44e906e1d570e98e957566cb603 (patch)
tree10a81193ec4ab1160c50a4ded282b51b6729ee9c /Master/texmf-dist/tex/latex
parent67228e148954896e0a854965c68ced6595691099 (diff)
biblatex-gb7714-2015 (4jul17)
git-svn-id: svn://tug.org/texlive/trunk@44750 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx204
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx3
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx419
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx3
4 files changed, 428 insertions, 201 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx
index 36bc75e38ec..f9eaf107f0d 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx
@@ -12,22 +12,29 @@
%% 2016/12/07 v1.0e
%% 2016/12/31 v1.0f
%% 2017/02/26 v1.0g
+%% 2017/04/11 v1.0h
%% E-mail: hzzmail@163.com
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
-\ProvidesFile{gb7714-2015.bbx}[2017/02/26 v1.0g biblatex bibliography style]
+\ProvidesFile{gb7714-2015.bbx}[2017/04/11 v1.0h biblatex bibliography style]
+
+%=====================================================================
%=====================================================================
%加载标准样式
+%=====================================================================
\RequireBibliographyStyle{numeric-comp}%Load the standard style to avoid copy-pasting unnecessary material
\RequireBibliographyStyle{standard}
\RequirePackage{xstring}%为兼容texlive2015的biblatex3.0不加载xstring包的问题
+
+%=====================================================================
%=====================================================================
%增加一些功能函数
-\providetoggle{iftexlivesix}
+%=====================================================================
%版本判断,根据biblatex更新历史可知,版本3.3开始使用新的姓名机制
+\providetoggle{iftexlivesix}
%所以当版本大于3.2开始,就用设置\toggletrue{iftexlivesix}
\def\numparserta#1.#2\relax{#1}%注意relax的重要性
\def\numparsertb#1.#2\relax{#2}
@@ -35,18 +42,31 @@
\def\numdigital{\expandafter\numparsertb\abx@version\relax}
\ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftexlivesix}}{\togglefalse{iftexlivesix}}
-\providetoggle{ifCJKforgbt}%定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成
+%定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成
+%2E00-2E7F 追加标点
+%2E80-2EFF cjk部首补充
+%2FF0-2FFF 表意文字描述符
+%3000-303F cjk符号和标点
+%3300-33FF cjk兼容
+%3400-4DBF cjk统一表意符号扩展
+%4E00-9FBF cjk统一表意符号
+%中文范围4E00-9FA5
+\providetoggle{ifCJKforgbt}
\def\testCJKfirstchar#1#2&{%
\ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}%
}%
+%利用edef展开或xstring抽取第一个字符判断
+%现在采用xstring方法,避免抽取的是编组符号
\def\testCJKfirst#1{%
%\edef\tempa{#1}%
\exploregroups%
\StrChar{#1}{1}[\tempa]%
\expandafter\testCJKfirstchar\tempa&}
-%\providetoggle{ifnoteeqstandard}%判断是否是标准
+
+%判断是否是标准
+%\providetoggle{ifnoteeqstandard}
%\def\testifnoteeqstd{%
%\iffieldundef{note}{\togglefalse{ifnoteeqstandard}}%判断一下,是否是标准
% {\def\comparetmp{standard}\edef\comparetmpb{\thefield{note}}%
@@ -83,7 +103,7 @@
\gbt@parse@rangeii#2\@empty%
\fi}
-%这里写的number的解析函数,与上面的是类似的。
+%这里写的number的解析函数,与上面的卷解析函数是类似的。
\def\multinumberparser#1{%
\edef\gbnumbertmp{#1}%
\expandafter\multinumberparsetoparts\gbnumbertmp-\@empty}
@@ -105,17 +125,30 @@
%=====================================================================
+%=====================================================================
%设置宏包选项
+%=====================================================================
+
+\iftoggle{iftexlivesix}{% Alter settings that carry through from biblatex
+%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式
-% Alter settings that carry through from biblatex
-\iftoggle{iftexlivesix}
-{%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式
%增加标签对齐选项,right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
\DeclareBibliographyOption[string]{align}[right]{%
\ifstrequal{#1}{left}{\setalignleft}{}
\ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{}
}
+%增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
+\newtoggle{bbx:gbpub}
+\DeclareBibliographyOption[boolean]{gbpub}[true]{%
+%\settoggle{bbx:gbpub}{#1} %或采用下面这一句
+ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
+\ExecuteBibliographyOptions{gbpub}
+
+%增加一个处理佚名或noauthor的控制选项
+%因为在顺序编码制中,不需要使用,这里也增加,为了与作者年制的兼容性考虑。
+\DeclareBibliographyOption[boolean]{gbnoauthor}[true]{}%
+
\ExecuteBibliographyOptions{
sorting=none,
useprefix=true, %名字的信息包括前缀
@@ -135,6 +168,17 @@
\ifstrequal{#1}{gb7714-2015}{}{}
}
+%增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
+\newtoggle{bbx:gbpub}
+\DeclareBibliographyOption{gbpub}[true]{%
+%\settoggle{bbx:gbpub}{#1} %或采用下面这一句
+ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
+\ExecuteBibliographyOptions{gbpub}
+
+%增加一个处理佚名或noauthor的控制选项
+%因为在顺序编码制中,不需要使用,这里也增加,为了与作者年制的兼容性考虑。
+\DeclareBibliographyOption{gbnoauthor}[true]{}%
+
\ExecuteBibliographyOptions{
sorting=none,
useprefix=true, %名字的信息包括前缀
@@ -147,16 +191,20 @@
}
}
+
+%=====================================================================
%=====================================================================
%设置本地化字符串
+%=====================================================================
%新建一个当地化字符串,用来记录“等”字符
\NewBibliographyString{andotherscn}
\NewBibliographyString{noaddress}
\NewBibliographyString{nopublisher}
-%直接利用当地化格式english进行修改一些中文的格式,
-%具体可以修改哪些需要的参考english.lbx文件
+%直接利用当地化格式english进行修改一些中文的格式
+%具体可以修改哪些,参考english.lbx文件
%当然也可以增加比如上面定义的andotherscn
+%注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
\DefineBibliographyStrings{english}{
bibliography = {参考文献},
references = {参考文献},
@@ -171,10 +219,13 @@ backrefpage = {引用页:},
backrefpages = {引用页:},
}
+
+%=====================================================================
%=====================================================================
%动态数据修改,修改输入的源文件数据,用于中文判断等
+%=====================================================================
%修改输入的源文件数据,用于中文判断等
-%首先把作者和译者信息准确的记录到userf,usere中,用于判断是否是cjk字符。
+%首先把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
%注意\DeclareSourcemap命令只能出现一次
\DeclareSourcemap{
\maps[datatype=bibtex]{%增加文献标识符如[M],[J]等,下面首先生成这一信息
@@ -183,10 +234,10 @@ backrefpages = {引用页:},
\pertype{article}
\step[fieldset=usera, fieldvalue={J}]
}
- \map{ %使用下面biber动态修改bbl文件的方法是正确的
+ \map{
\pertype{periodical}
\step[fieldset=usera, fieldvalue={J}]
- \step[fieldsource=author] %有时会把version和edition混淆,这里处理后就没有这个问题,可以直接用version
+ \step[fieldsource=author] %有时会把author和editor混淆,这里处理后就没有这个问题
\step[fieldset=editor, origfieldval]
}
\map{
@@ -214,7 +265,7 @@ backrefpages = {引用页:},
\pertype{inproceedings}
\pertype{conference}%兼容老的conference类型
\step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution] %有时会把version和edition混淆,这里处理后就没有这个问题,可以直接用version
+ \step[fieldsource=institution] %有时会把publisher和institution混淆,这里处理后就没有这个问题
\step[fieldset=publisher, origfieldval]
\step[fieldsource=editor] %
\step[fieldset=bookauthor, origfieldval]
@@ -231,7 +282,7 @@ backrefpages = {引用页:},
\pertype{report}
\pertype{techreport}%兼容老的techreport类型
\step[fieldset=usera, fieldvalue={R}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,这里处理后就没有这个问题,可以直接用version
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,这里处理后就没有这个问题
\step[fieldset=institution, origfieldval]
}
\map{
@@ -388,9 +439,11 @@ backrefpages = {引用页:},
\DeclareBibliographyAlias{newspaper}{article}%定义驱动别名,尝试以替代驱动层映射,实践表明是可行的。
+
+%=====================================================================
%=====================================================================
%参考文献表环境
-
+%=====================================================================
%默认的参考文献列表格式,放这里作为参考
%\defbibenvironment{bibliography}
@@ -401,11 +454,11 @@ backrefpages = {引用页:},
%而标签则只能对齐一个方向,要么左对齐要么右对齐,看个人选择了。
%\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX
%\DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill}
-%\iftoggle{alignleft}{\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}\hfill}}{}
+%\iftoggle{alignleft}{\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}\hfill}}{}%这种方式无效是应为加载时就已经展开了。
%修改序号标签格式为左对齐
\def\setalignleft{\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{##1}\hfill}}
-%修改序号标签格式为以各条参文献为基础进行对齐的方式
+%修改序号标签格式为以各条参文献为基础进行对齐的方式
\def\setaligngbstyle{%
\def\blx@bibitem##1{%
\blx@ifdata{##1}
@@ -436,6 +489,8 @@ backrefpages = {引用页:},
\blx@endlangbib}%
\par\endgroup}%这里增加了一个\par
{}}
+\newlength{\lengthid}
+\newlength{\lengthlw}
\newcommand{\itemcmd}{%
\settowidth{\lengthid}{[\printfield{labelnumber}]}
\addtolength{\lengthid}{\biblabelsep}
@@ -445,8 +500,6 @@ backrefpages = {引用页:},
%\parshape 2 0em \textwidth \lengthid \lengthlw
\hangindent\lengthid
[\printfield{labelnumber}]\hspace{\biblabelsep}}
-\newlength{\lengthid}
-\newlength{\lengthlw}
\defbibenvironment{bibliography}
{\begingroup\setlength{\parindent}{0em}}
{\endgroup}
@@ -454,7 +507,9 @@ backrefpages = {引用页:},
%=====================================================================
+%=====================================================================
%设置单元或块等的标点
+%=====================================================================
%\renewrobustcmd*{\bibinitperiod}{\adddot} %来源biblatex2.STY
\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
%\newcommand*{\revsdnamepunct}{\addcomma} %来源biblatex.def
@@ -464,14 +519,16 @@ backrefpages = {引用页:},
%关于双语言或多语言的参考文献,可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
%这里调整一下两种语言参考文献的间隔
%\renewcommand*{\entrysetpunct}{\addsemicolon\space}%源来自biblatex.def
-\renewcommand*{\entrysetpunct}{\adddot\par\nobreak}
+\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}%%双语之间用newline替换par(20170411 v1.0h),避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
%页码引用格式的修改
%\newcommand*{\bibpagespunct}{\addcomma\space}
\renewcommand*{\bibpagespunct}{\addcolon\space}%修改为用冒号
-%=====================================================================
-%修改域的格式
+%=====================================================================
+%=====================================================================
+%修改域的格式,重定义域的输出宏
+%=====================================================================
%新增文献类型标识符的格式
%\DeclareFieldFormat{gbtypeflag}{\nobreak\mkbibbrackets{\nobreak#1}\nobreak}
\DeclareFieldFormat{gbtypeflag}{%
@@ -714,28 +771,27 @@ backrefpages = {引用页:},
\addspace\printtext{[}\printfield{urlyear}%
\iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}%
\iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}}
+
\newbibmacro*{newsdate}{%%新增加一个新闻日期
\iffieldundef{year}{}{\printfield{year}%
\iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}%
\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
}
-\newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示表示电子资源的更新和修改日期,而公告日期安按日期格式
-\iffieldundef{date}{%
-\iffieldundef{enddate}{%
-\printtext{%
-\iffieldundef{eventyear}{}{\mkbibparens{\printtext{\printfield{eventyear}}%
+
+\newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+\iffieldundef{year}{%
+\iffieldundef{endyear}{%
+\iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}%
\iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}%
\iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}%
}%
}{%
-\printtext{%
-\iffieldundef{endyear}{}{\mkbibparens{\printtext{\printfield{endyear}}%
+\iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}%
\iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}%
\iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}%
}%
}}{%
-\printtext{%
-\iffieldundef{year}{}{\mkbibparens{\printtext{\printfield{year}}%
+\iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}%
\iffieldundef{month}{}{\bibrangedash\thefield{month}}%
\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
}}%
@@ -768,30 +824,75 @@ backrefpages = {引用页:},
%\newunit %这里的标点去掉
}
-%出版社和地址的处理,当没有出版社地址时
-%直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
+%出版社和地址的处理
+%当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
%事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
+%新增一个样式用于输出连续出版物的地址,单位,时间,%类似\newbibmacro*{publisher+location+date}
+\newbibmacro*{location+institution+date}{%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{\thefield{title}}
+\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}%
+ {\printlist{location}}%
+% \iflistundef{institution}
+% {\setunit*{\addcomma\space}}
+% {\setunit*{\addcolon\space}}%
+% \printlist{institution}%
+% \setunit*{\addcomma\space}%
+\addcolon\addspace%
+\iflistundef{institution}{%
+\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot]
+{\printlist{institution}}%
+\setunit{\addcomma\addspace}%
+ %\usebibmacro{date}%
+ \printfield{year}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}}%
+ \newunit}%
+{ \printlist{location}%
+ \iflistundef{institution}%
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ \newunit}%
+}
+
+
\renewbibmacro*{publisher+location+date}{%
-\testCJKfirst{\thefield{title}}%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{\thefield{title}}%
%\testifnoteeqstd%
\iflistundef{location}{%\adddot
\iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准低19页看到,标准存在出版项时输出,没有时完全省略。
%\iftoggle{ifnoteeqstandard}{}{%}替换为上一句,尽可能用biblatex提供的函数
-\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
+\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}%
+}}% \bibstring{noaddress}
{\printlist{location}\addcolon\addspace}%
%\addcolon\addspace%
\iflistundef{publisher}{%
\iffieldequalstr{note}{standard}{}{%
%\iftoggle{ifnoteeqstandard}{}{%}替换为上一句,尽可能用biblatex提供的函数
\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
-{\printtext{\mkbibbrackets{s.n.}}\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 %去掉这个标点
+%\newunit %去掉这个标点
+}%
+{\printlist{location}%
+ \iflistundef{publisher}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{publisher}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ %\newunit
+ }%
}
-%对版本信息做出修改,源来自biblatex.DEF
+%对edition版本信息做出修改,源来自biblatex.DEF
\DeclareFieldFormat{edition}{%
\testCJKfirst{\thefield{title}}%
\iftoggle{ifCJKforgbt}%
@@ -1006,28 +1107,6 @@ backrefpages = {引用页:},
%\newunit
}
-%新增一个样式用于输出连续出版物的地址,单位,时间
-%类似与上面的\newbibmacro*{publisher+location+date}
-\newbibmacro*{location+institution+date}{%
-\testCJKfirst{\thefield{title}}
-\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}%
- {\printlist{location}}%
-% \iflistundef{institution}
-% {\setunit*{\addcomma\space}}
-% {\setunit*{\addcolon\space}}%
-% \printlist{institution}%
-% \setunit*{\addcomma\space}%
-\addcolon\addspace%
-\iflistundef{institution}{%
-\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot]
-{\printlist{institution}}%
-\setunit{\addcomma\addspace}%
- %\usebibmacro{date}%
- \printfield{year}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}}%
- \newunit}
-
%重设专利title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件
\newbibmacro*{patenttitle}{%
\ifboolexpr{%
@@ -1064,8 +1143,11 @@ backrefpages = {引用页:},
%\newunit
}
+
+%=====================================================================
%=====================================================================
%设置驱动格式
+%=====================================================================
%book条目类的驱动,源来自standard.bbx文件
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx
index 7a8b5332d63..7d022f84d87 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx
@@ -11,11 +11,12 @@
%% 2016/11/24 v1.0d
%% 2016/12/07 v1.0e
%% 2017/02/26 v1.0g
+%% 2017/04/11 v1.0h
%% E-mail: hzzmail@163.com
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
-\ProvidesFile{gb7714-2015.cbx}[2017/02/26 v1.0g biblatex citation style]
+\ProvidesFile{gb7714-2015.cbx}[2017/04/11 v1.0h biblatex citation style]
\RequireCitationStyle{numeric-comp}
%\RequireCitationStyle{numeric}
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 f34aa1aff85..d4572f9e8dd 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
@@ -19,13 +19,19 @@
\ProvidesFile{gb7714-2015ay.bbx}[2017/02/26 v1.0g biblatex bibliography style]
%=====================================================================
+%=====================================================================
%加载标准样式
+%=====================================================================
\RequireBibliographyStyle{authoryear} % Load the standard style to avoid copy-pasting unnecessary material
\RequirePackage{xstring}%为兼容texlive2015的biblatex3.0不加载xstring包的问题
+
+%=====================================================================
%=====================================================================
%增加一些功能函数
+%=====================================================================
\providetoggle{iftexlivesix}
+\providetoggle{iftexliveseven}
%版本判断,根据biblatex更新历史可知,版本3.3开始使用新的姓名机制
%所以当版本大于3.2开始,就用设置\toggletrue{iftexlivesix}
\def\numparserta#1.#2\relax{#1}%注意relax的重要性
@@ -33,13 +39,24 @@
\def\numinteger{\expandafter\numparserta\abx@version\relax}
\def\numdigital{\expandafter\numparsertb\abx@version\relax}
\ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftexlivesix}}{\togglefalse{iftexlivesix}}
+\ifnumcomp{\numdigital}{>}{6}{\toggletrue{iftexliveseven}}{\togglefalse{iftexliveseven}}
%定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成
+%2E00-2E7F 追加标点
+%2E80-2EFF cjk部首补充
+%2FF0-2FFF 表意文字描述符
+%3000-303F cjk符号和标点
+%3300-33FF cjk兼容
+%3400-4DBF cjk统一表意符号扩展
+%4E00-9FBF cjk统一表意符号
+%中文范围4E00-9FA5
\providetoggle{ifCJKforgbt}
\def\testCJKfirstchar#1#2&{%
\ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}%
}%
+%利用edef展开或xstring抽取第一个字符判断
+%现在采用xstring方法,避免抽取的是编组符号
\def\testCJKfirst#1{%
%\edef\tempa{#1}%
\exploregroups%
@@ -84,7 +101,7 @@
\gbt@parse@rangeii#2\@empty%
\fi}
-%这里写的number的解析函数,与上面的是类似的。
+%这里写的number的解析函数,与上面的卷解析函数是类似的。
\def\multinumberparser#1{%
\edef\gbnumbertmp{#1}%
\expandafter\multinumberparsetoparts\gbnumbertmp-\@empty}
@@ -104,13 +121,31 @@
\multinumberparsetopartsb#2\@empty%
\fi}
+
+
+%=====================================================================
%=====================================================================
%设置宏包选项
-\iftoggle{iftexlivesix}{% Alter settings that carry through from biblatex
+%=====================================================================
+\iftoggle{iftexlivesix}{%Alter settings that carry through from biblatex
%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式
+
%增加标签对齐选项,right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
-%因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。
+%因为在作者年制中,不需要使用,这里也增加,为了与顺序编码制的兼容性考虑。
\DeclareBibliographyOption[string]{align}[right]{}%
+
+%增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
+\newtoggle{bbx:gbpub}
+\DeclareBibliographyOption[boolean]{gbpub}[true]{%
+%\settoggle{bbx:gbpub}{#1} %或采用下面这一句
+ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
+\ExecuteBibliographyOptions{gbpub}
+
+%增加一个处理佚名或noauthor的控制选项
+\DeclareBibliographyOption[boolean]{gbnoauthor}[true]{%
+ \ifstrequal{#1}{false}{\dealnoathorfalse}{\dealnoathor}}
+%\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能利用宏包加载时给出选项达到目的。
+
\ExecuteBibliographyOptions{
useprefix = true, %名字的信息包括前缀
%firstinits = true, %名字有缩写,参考3.1.2.3 Internal
@@ -125,6 +160,19 @@
%增加标签对齐选项,right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
%因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。
\DeclareBibliographyOption{align}[right]{}%
+
+%增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
+\newtoggle{bbx:gbpub}
+\DeclareBibliographyOption{gbpub}[true]{%
+%\settoggle{bbx:gbpub}{#1} %或采用下面这一句
+ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
+\ExecuteBibliographyOptions{gbpub}
+
+%增加一个处理佚名或noauthor的控制选项
+\DeclareBibliographyOption{gbnoauthor}[true]{%
+ \ifstrequal{#1}{false}{\dealnoathorfalse}{\dealnoathor}}
+%\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
+
\ExecuteBibliographyOptions{
useprefix = true, %名字的信息包括前缀
firstinits = true, %名字有缩写,参考3.1.2.3 Internal
@@ -136,16 +184,20 @@
%uniquename=init,
}}
+
+%=====================================================================
%=====================================================================
%设置本地化字符串
+%=====================================================================
%新建一个当地化字符串,用来记录“等”字符
\NewBibliographyString{andotherscn}
\NewBibliographyString{noaddress}
\NewBibliographyString{nopublisher}
%直接利用当地化格式english进行修改一些中文的格式,
-%具体可以修改哪些需要的参考english.lbx文件
+%具体可以修改哪些,参考english.lbx文件
%当然也可以增加比如上面定义的andotherscn
+%注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
\DefineBibliographyStrings{english}{
bibliography = {参考文献},
references = {参考文献},
@@ -159,24 +211,15 @@ backrefpage = {引用页:},
backrefpages = {引用页:},
}
+
+%=====================================================================
%=====================================================================
%动态数据修改,修改输入的源文件数据,用于中文判断等
-%首先把作者和译者信息准确的记录到userf,usere中,用于判断是否是cjk字符。
+%=====================================================================
+%首先把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
%注意\DeclareSourcemap命令只能出现一次
\DeclareSourcemap{
\maps[datatype=bibtex]{
- \map{%因为要做佚名处理,所以这里先对有些只有编者而没有作者的情况进行处理
- \step[fieldsource=editor]
- \step[fieldset=author,origfieldval]
- }
- \map{%默认情况下将空缺作者设置为佚名
- \step[fieldset=author, fieldvalue={佚名}]
- }
- \map[overwrite]{%当标题带有英文字符,且作者为佚名的情况,设置作者为noauthor,
- %也有一些特殊情况可能处理不到,比如标题中英混合,作者又却是
- \step[fieldsource=title,match=\regexp{[a-zA-Z]},final]
- \step[fieldsource=author,match=\regexp{佚名}, replace={NOAUTHOR}]
- }
\map{
\pertype{article}
\step[fieldset=usera, fieldvalue={J}]
@@ -184,7 +227,7 @@ backrefpages = {引用页:},
\map{
\pertype{periodical}
\step[fieldset=usera, fieldvalue={J}]
- \step[fieldsource=author] %有时会把version和edition混淆,这里处理后就没有这个问题,可以直接用version
+ \step[fieldsource=author] %有时会把author和editor混淆,这里处理后就没有这个问题
\step[fieldset=editor, origfieldval]
}
\map{
@@ -212,7 +255,7 @@ backrefpages = {引用页:},
\pertype{inproceedings}
\pertype{conference}%兼容老的conference类型
\step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution] %有时会把version和edition混淆,这里处理后就没有这个问题,可以直接用version
+ \step[fieldsource=institution] %有时会把publisher和institution混淆,这里处理后就没有这个问题
\step[fieldset=publisher, origfieldval]
\step[fieldsource=editor] %
\step[fieldset=bookauthor, origfieldval]
@@ -220,7 +263,7 @@ backrefpages = {引用页:},
\map{
\pertype{proceedings}
\step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution] %有时会把version和edition混淆,这里处理后就没有这个问题,可以直接用version
+ \step[fieldsource=institution] %有时会把publisher和institution混淆,这里处理后就没有这个问题
\step[fieldset=publisher, origfieldval]
\step[fieldsource=editor] %%有的时候可能只填写了编者,没有author,把它复制一下
\step[fieldset=author, origfieldval]
@@ -229,7 +272,7 @@ backrefpages = {引用页:},
\pertype{report}
\pertype{techreport}%兼容老的techreport类型
\step[fieldset=usera, fieldvalue={R}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,这里处理后就没有这个问题,可以直接用version
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,这里处理后就没有这个问题
\step[fieldset=institution, origfieldval]
}
\map{
@@ -283,43 +326,58 @@ backrefpages = {引用页:},
\step[fieldset=keywords, fieldvalue={,}, append]
\step[fieldset=keywords, origfieldval, append]
}
+ \map{%因为要对author进行判断,所以这里先对有些只有编者而没有作者的情况进行处理
+ \step[fieldsource=editor]
+ \step[fieldset=author,origfieldval]
+ }
\map{%因为无法进行cjk字符判断,所以用反的思路,判断没有英文字符,没有空格,没有逗号等字符情况下
%认为是中文的,将文献userb设置成cn,用于排序
- \step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\-]},final]
+ %参考4.5.8 姓名首字母生成控制
+ %\step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\\\/\-\x22\x26\:0-9\p{IsP}\p{PosixPunct}\x{2bf}\x{2018}\xE9\p{IsASCII}]},final]
+ %对于带重音符号的字符似乎无法匹配。比如\'e
+ %最后选择直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldsource=author,match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
\step[fieldset=userb,fieldvalue={cn}]
}
+ \map{\step[fieldsource=title,match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=userb,fieldvalue={cn}]
+ }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
\map{%将没有设置的userb设置成en,即认为不是中文的就是英文的。
\step[fieldset=userb,fieldvalue={en}]
}
- }
-}
-
-\iftoggle{iftexlivesix}{
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义
+ %本来后面这些是放到DeclareStyleSourcemap中处理的,但是因为texlive2016的biblatex3.4不支持多个DeclareStyleSourcemap,
+ %但有处理特殊字符和处理gbnoauthor选项的需求,所以把这些提到这来,让后让这两个功能结合到一个DeclareStyleSourcemap时,
+ %不用复制如下段代码了。
+ \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义
%但从实践看,并没有什么影响,映射过来就可以了。
\step[typesource=newspaper, typetarget=article, final]
}
- \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
\step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
\step[typesource=standard, typetarget=inbook, final]
}
- \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
\step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book
}
- \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]
}
+ }
+}
+
+\def\dealnoathorfalse{
+\iftoggle{iftexlivesix}{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
\map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
\step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
}
@@ -335,28 +393,74 @@ backrefpages = {引用页:},
}{
\DeclareStyleSourcemap{
\maps[datatype=bibtex]{
- \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义
- %但从实践看,并没有什么影响,映射过来就可以了。
- \step[typesource=newspaper, typetarget=article, final]
+ \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization
+ \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
}
- \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
- \step[typesource=standard, typetarget=inbook, final]
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
}
- \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- \step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book
+ \map[overwrite]{
+ \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
}
- \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
- \step[typesource=mastersthesis, typetarget=thesis, final]
- %\step[fieldset=type, fieldvalue=mathesis]
+ \map[overwrite]{
+ \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
}
- \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
- \step[typesource=phdthesis, typetarget=thesis, final]
- %\step[fieldset=type, fieldvalue=phdthesis]
+ \map[overwrite]{
+ \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
}
- \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
- \step[typesource=techreport, typetarget=report, final]
- %\step[fieldset=type, fieldvalue=techreport]
+ \map[overwrite]{
+ \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
+ }
+ }
+ }
+}}
+
+\def\dealnoathor{
+\iftoggle{iftexlivesix}{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{%默认情况下将空缺作者设置为佚名
+ \step[fieldsource=userb,match={cn},final]
+ \step[fieldset=author, fieldvalue={佚名}]
+ }
+ \map{%默认情况下将空缺作者设置为佚名
+ \step[fieldsource=userb,match={en},final]
+ \step[fieldset=author, fieldvalue={NOAUTHOR}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
+ address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ }
+ }
+}{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{%默认情况下将空缺作者设置为佚名
+ \step[fieldsource=userb,match={cn},final]
+ \step[fieldset=author, fieldvalue={佚名}]
+ }
+ \map{%默认情况下将空缺作者设置为佚名
+ \step[fieldsource=userb,match={en},final]
+ \step[fieldset=author, fieldvalue={NOAUTHOR}]
}
\map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization
\step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
@@ -390,10 +494,13 @@ backrefpages = {引用页:},
}
}
}
-}
+}}
+
%=====================================================================
+%=====================================================================
%设置排序格式
+%=====================================================================
%排序用降序或userb域
\DeclareSortingScheme{nyt}{
\sort{
@@ -427,8 +534,11 @@ backrefpages = {引用页:},
}
}
+
+%=====================================================================
%=====================================================================
%参考文献列表环境
+%=====================================================================
\defbibenvironment{bibliography}%修改参考文献列表环境,不要缩进
{\list
{}
@@ -441,8 +551,11 @@ backrefpages = {引用页:},
{\endlist}
{\item}
+
+%=====================================================================
%=====================================================================
%设置单元或块等的标点
+%=====================================================================
%将名字简写后的点去掉
%\renewrobustcmd*{\bibinitperiod}{\adddot} %来源biblatex2.STY
\renewrobustcmd*{\bibinitperiod}{}
@@ -462,7 +575,9 @@ backrefpages = {引用页:},
%=====================================================================
+%=====================================================================
%修改域的格式
+%=====================================================================
%新增文献类型标识符的格式
%\DeclareFieldFormat{gbtypeflag}{\nobreak\mkbibbrackets{\nobreak#1}\nobreak}
@@ -681,28 +796,27 @@ backrefpages = {引用页:},
\addspace\printtext{[}\printfield{urlyear}%
\iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}%
\iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}}
+
\newbibmacro*{newsdate}{%%新增加一个新闻日期
\iffieldundef{year}{}{\printfield{year}%
\iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}%
\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}
}%
+
\newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示表示电子资源的更新和修改日期,而公告日期安按日期格式
-\iffieldundef{date}{%
-\iffieldundef{enddate}{%
-\printtext{%
-\iffieldundef{eventyear}{}{\mkbibparens{\printtext{\printfield{eventyear}}%
+\iffieldundef{year}{%
+\iffieldundef{endyear}{%
+\iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}%
\iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}%
\iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}%
}%
}{%
-\printtext{%
-\iffieldundef{endyear}{}{\mkbibparens{\printtext{\printfield{endyear}}%
+\iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}%
\iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}%
\iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}%
}%
}}{%
-\printtext{%
-\iffieldundef{year}{}{\mkbibparens{\printtext{\printfield{year}}%
+\iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}%
\iffieldundef{month}{}{\bibrangedash\thefield{month}}%
\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
}}%
@@ -738,7 +852,7 @@ backrefpages = {引用页:},
%\newunit %这里的标点去掉
}
-%对版本信息做出修改,源来自biblatex.DEF
+%对edition版本信息做出修改,源来自biblatex.DEF
\DeclareFieldFormat{edition}{%
%\testCJKfirst{\thefield{title}}%
\iffieldundef{title}{}{\testCJKfirst{\thefield{title}}}%
@@ -783,7 +897,25 @@ backrefpages = {引用页:},
\usebibmacro{date+extrayear}
}
+
+%设置因为mergedate默认为true时的情况,来自\bbx@opt@mergedate@compact
+%去掉作者后面包围年份的圆括号
+%这里因为biblatex版本的不同,做不同的处理,texlive2017版的在iftexliveseven=true中设置
+%2016等低版本的在iftexliveseven=false中设置
+%当然其实这还有更简单的解决方法就是:
+% \let\printdateextralabel=\printlabeldateextra
+%只是这里为了清楚区分才用判断的方式。
%重设date+extrayear格式,源来自authoryear.BBX
+\iftoggle{iftexliveseven}{%
+ \renewbibmacro*{date+extrayear}{%
+ \iffieldundef{labelyear}
+ {}
+ {\printtext{%[parens]%这里把括号去掉
+ \iffieldsequal{year}{labelyear}
+ {\printlabeldateextra}%
+ {\printfield{labelyear}%
+ \printfield{extrayear}}}}}%
+}{%
\renewbibmacro*{date+extrayear}{%
\iffieldundef{\thefield{datelabelsource}year}
{}
@@ -792,6 +924,7 @@ backrefpages = {引用页:},
{\printdateextralabel}%
{\printfield{labelyear}%
\printfield{extrayear}}}}}%
+}
%修改译者位置格式,bytranslator+others原格式来自biblatex.def文件
\renewbibmacro*{bytranslator+others}{%
@@ -824,31 +957,75 @@ backrefpages = {引用页:},
}
{}}
-%出版社和地址的处理,当没有出版社地址时
-%直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
+
+%出版社和地址的处理
+%当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
%事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
+%新增一个样式用于输出连续出版物的地址,单位,时间,%类似\newbibmacro*{publisher+location+date}
+\newbibmacro*{location+institution+date}{%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{\thefield{title}}
+\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}%
+ {\printlist{location}}%
+% \iflistundef{institution}
+% {\setunit*{\addcomma\space}}
+% {\setunit*{\addcolon\space}}%
+% \printlist{institution}%
+% \setunit*{\addcomma\space}%
+\addcolon\addspace%
+\iflistundef{institution}{%
+\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot]
+{\printlist{institution}}%
+\setunit{\addcomma\addspace}%
+ %\usebibmacro{date}%
+ \printfield{year}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}}%
+ \newunit}%
+{ \printlist{location}%
+ \iflistundef{institution}%
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ \newunit}%
+}
+
\renewbibmacro*{publisher+location+date}{%
-\iffieldundef{title}{}{\testCJKfirst{\thefield{title}}}%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{\thefield{title}}%
%\testifnoteeqstd%
\iflistundef{location}{%\adddot
-\iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准低19页看到,标准存在出版项时输出,没有时完全省略。
-%\iftoggle{ifnoteeqstandard}{}{%%}替换为上一句,尽可能用biblatex提供的函数
-\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}\setunit*{\addcolon\addspace}}{\printtext{[S.l.\adddot]}\setunit*{\addcolon\addspace}}}}% \bibstring{noaddress}
-{\printlist{location}\setunit*{\addcolon\addspace}}%
+\iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
+%\iftoggle{ifnoteeqstandard}{}{%}替换为上一句,尽可能用biblatex提供的函数
+\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}%
+}}% \bibstring{noaddress}
+{\printlist{location}\addcolon\addspace}%
%\addcolon\addspace%
\iflistundef{publisher}{%
-\iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准低19页看到,标准存在出版项时输出,没有时完全省略。
-%\iftoggle{ifnoteeqstandard}{}{%%}替换为上一句,尽可能用biblatex提供的函数
-\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}\setunit{\adddot\addspace}\setunit*{\addcolon\addspace}}
-%\mkbibbrackets
-%{{%{\printtext{[s.n.\adddot]}\setunit{\adddot\addspace}\setunit*{\addcolon\addspace}}}}%\bibstring{nopublisher}
-{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcolon\addspace}}}}
-{\printlist{publisher}\setunit*{\addcolon\addspace}}%
+\iffieldequalstr{note}{standard}{}{%
+%\iftoggle{ifnoteeqstandard}{}{%}替换为上一句,尽可能用biblatex提供的函数
+\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}\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}%
+\usebibmacro{date}%
%\newunit %去掉这个标点
+}%
+{\printlist{location}%
+ \iflistundef{publisher}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{publisher}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ %\newunit
+ }%
}
+
%修改析出文献的文集的标题与附加标题间的符号
\renewbibmacro*{booktitle}{%
\ifboolexpr{
@@ -869,60 +1046,50 @@ backrefpages = {引用页:},
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
%\setunit*{\addspace}%
- \setunit*{\addcomma\addspace}%修改为增加一个逗号
- \iffieldundef{series}
- {}
- {\newunit
+ %\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}%
+ \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
\usebibmacro{volume+number+eid}%把卷期放到年份后面
%\newunit
}
-%调整期刊年份的格式,去掉括号
-\renewbibmacro*{issue+date}{%
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸和标准
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
-% \def\comparetmp{news}\edef\comparetmpb{\thefield{note}}%
-% \ifx\comparetmp\comparetmpb%
-% \usebibmacro{newsdate}%
-% \else%
-% \usebibmacro{date}%
-% \fi
- }}%
- {\printfield{issue}%
- \setunit*{\addspace}%
- %\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸和标准
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
-% \def\comparetmp{news}\edef\comparetmpb{\thefield{note}}%
-% \ifx\comparetmp\comparetmpb%
-% \usebibmacro{newsdate}%
-% \else%
-% \usebibmacro{date}%
-% \fi
- }}}%
- %\newunit
- }
+%调整journal,首先判断子标题,然后在设置标点。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格
+\renewbibmacro*{journal}{%
+ \iffieldundef{journaltitle}%
+ {}%
+ {\printtext[journaltitle]{%
+ \printfield[titlecase]{journaltitle}%
+ \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{journalsubtitle}}}}}
+
+%调整issue+date,原在authoryear.BBX中\bbx@opt@mergedate@compact中定义
+%当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格
+ \renewbibmacro*{issue+date}{%
+ \iffieldundef{issue}%
+ {}%
+ {\printtext[parens]{\printfield{issue}}\newunit}}
+
+%增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格
+\DeclareFieldFormat{addnumflag}{%
+\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}}
%调整期刊卷和期的格式,源来自standard.bbx
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
%\setunit*{\adddot}%去掉点号
%\printfield{number}%
- \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
+ \iffieldundef{number}{}{\printfield[addnumflag]{number}}%
+ %\iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
\iffieldundef{eid}{}{%
\setunit{\addcomma\space}%
\printfield{eid}}}
@@ -1029,31 +1196,6 @@ backrefpages = {引用页:},
%\newunit
}
-%新增一个样式用于输出连续出版物的地址,单位,时间
-%类似与上面的\newbibmacro*{publisher+location+date}
-\newbibmacro*{location+institution+date}{%
-\testCJKfirst{\thefield{title}}
-\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}%
- {\printlist{location}}%
-% \iflistundef{institution}
-% {\setunit*{\addcomma\space}}
-% {\setunit*{\addcolon\space}}%
-% \printlist{institution}%
-% \setunit*{\addcomma\space}%
-\addcolon\addspace%
-\iflistundef{institution}{%
-%注意这里\printtext{\mkbibbrackets{s.n.}}和\printtext{[s.n.\adddot]}是不同的,这里的]不影响标点追踪,
-%这里要理解的是newunit插入的是period,看def中的命令:\newcommand*{\newunitpunct}{\addperiod\space},\newcommand*{\finentrypunct}{\addperiod}
-\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}}{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}}}% \bibstring{nopublisher}
-{\printlist{institution}}%
-\setunit{\addcomma\addspace}%
- %\usebibmacro{date}%
-% \printfield{year}%
-% \bibrangedash%
-% \iffieldundef{endyear}{}{\printfield{endyear}}%
- \newunit%
-}
-
%重设专利title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件
\newbibmacro*{patenttitle}{%
\ifboolexpr{%
@@ -1092,8 +1234,9 @@ backrefpages = {引用页:},
%=====================================================================
+%=====================================================================
%设置驱动格式
-
+%=====================================================================
%修改book的驱动,源来自standard.BBX
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx
index 0ab9e051428..05b2ff256fa 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx
@@ -11,11 +11,12 @@
%% 2016/11/24 v1.0d
%% 2016/12/07 v1.0e
%% 2017/02/26 v1.0g
+%% 2017/04/11 v1.0h
%% E-mail: hzzmail@163.com
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
-\ProvidesFile{gb7714-2015ay.cbx}[2017/02/26 v1.0g biblatex citation style]
+\ProvidesFile{gb7714-2015ay.cbx}[2017/04/11 v1.0h biblatex citation style]
\RequireCitationStyle{authoryear}
%\RequireCitationStyle{numeric}