diff options
author | Karl Berry <karl@freefriends.org> | 2018-01-13 22:25:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-01-13 22:25:19 +0000 |
commit | 3bdc043bee564bb6b5e9d65d69982e664ced332c (patch) | |
tree | c5f21be510b07faa8b3268b2b7863d03d6cb9e8b /Master/texmf-dist/tex/latex/biblatex-gb7714-2015 | |
parent | ac9663467d3cef3ff83c9f7e3e13b5926c5dc04b (diff) |
biblatex-gb7714-2015 (13jan18)
git-svn-id: svn://tug.org/texlive/trunk@46298 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-gb7714-2015')
4 files changed, 1289 insertions, 958 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 f9eaf107f0d..e1d62786091 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 @@ -4,20 +4,15 @@ %% GBT7714-2015 bibliography style,numerical sequence %% Maintained by huzhenzhen %% history: -%% 2016/05/20 v1.0 -%% 2016/10/23 v1.0a -%% 2016/11/11 v1.0b -%% 2016/11/14 v1.0c -%% 2016/11/24 v1.0d -%% 2016/12/07 v1.0e -%% 2016/12/31 v1.0f -%% 2017/02/26 v1.0g -%% 2017/04/11 v1.0h +%% 2016/05/20 v1.0 2016/10/23 v1.0a 2016/11/11 v1.0b +%% 2016/11/14 v1.0c 2016/11/24 v1.0d 2016/12/07 v1.0e +%% 2017/02/26 v1.0g 2017/04/11 v1.0h +%% 2017/11/21 v1.0i %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\ProvidesFile{gb7714-2015.bbx}[2017/04/11 v1.0h biblatex bibliography style] +\ProvidesFile{gb7714-2015.bbx}[2017/11/21 v1.0i biblatex bibliography style] %===================================================================== @@ -31,201 +26,255 @@ %===================================================================== %===================================================================== -%增加一些功能函数 +%新增功能函数 %===================================================================== -%版本判断,根据biblatex更新历史可知,版本3.3开始使用新的姓名机制 -\providetoggle{iftexlivesix} -%所以当版本大于3.2开始,就用设置\toggletrue{iftexlivesix} -\def\numparserta#1.#2\relax{#1}%注意relax的重要性 -\def\numparsertb#1.#2\relax{#2} -\def\numinteger{\expandafter\numparserta\abx@version\relax} -\def\numdigital{\expandafter\numparsertb\abx@version\relax} -\ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftexlivesix}}{\togglefalse{iftexlivesix}} - -%定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成 -%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} -%\def\testifnoteeqstd{% -%\iffieldundef{note}{\togglefalse{ifnoteeqstandard}}%判断一下,是否是标准 -% {\def\comparetmp{standard}\edef\comparetmpb{\thefield{note}}% -% \ifx\comparetmp\comparetmpb% -% \toggletrue{ifnoteeqstandard}% -% \else% -% \togglefalse{ifnoteeqstandard}% -% \fi}} -%\iffieldequalstr{note}{standard}{true}{false} %可以利用这一函数代替 - -%用于解析连续出版物,2个卷期的情况 -\def\multivolumeparsetoparts#1/#2{\def\multivolumefirst{#1}\def\multivolumesecond{#2}} -%\def\multinumberparsetoparts#1/#2{\def\multinumberfirst{#1}\def\multinumbersecond{#2}} - -%这里利用李志奇的范围数据解析函数,修改后用来处理卷volume的范围。 -%他的这个函数是通用的,只能在使用数据前使用,如果多次使用前一次得到的数据就会被冲掉 -%这里的范围起止判断符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 -\def\gbt@parse@range#1{% - \edef\gbt@tmpa{#1}% - \expandafter\gbt@parse@rangei\gbt@tmpa-\@empty} -\def\gbt@parse@rangei#1-#2\@empty{% - \global\def\gbt@range@first{#1}% - \def\gbt@tmpa{#2}% - \ifx\gbt@tmpa\@empty% - \global\def\gbt@range@second{}% - \else% - \gbt@parse@rangeii#2\@empty% - \fi} -\def\gbt@parse@rangeii#1-#2\@empty{% - \def\gbt@tmpa{#2}% - \ifx\gbt@tmpa\@empty% - \global\def\gbt@range@second{#1}% - \else% - \gbt@parse@rangeii#2\@empty% - \fi} - -%这里写的number的解析函数,与上面的卷解析函数是类似的。 -\def\multinumberparser#1{% - \edef\gbnumbertmp{#1}% - \expandafter\multinumberparsetoparts\gbnumbertmp-\@empty} -\def\multinumberparsetoparts#1-#2\@empty{% - \def\multinumberfirst{#1}% - \def\gbnumbertmp{#2}% - \ifx\gbnumbertmp\@empty% - \def\multinumbersecond{}% - \else% - \multinumberparsetopartsb#2\@empty% - \fi} -\def\multinumberparsetopartsb#1-#2\@empty{% - \def\gbnumbertmp{#2}% - \ifx\gbnumbertmp\@empty% - \def\multinumbersecond{#1}% - \else% - \multinumberparsetopartsb#2\@empty% - \fi} + %版本判断 + \providetoggle{iftlfive}%用于处理biblatex3.2之前的版本,即texlive2015以下版本中的biblatex + \providetoggle{iftlsix}%用于处理biblatex3.3开始改变的新的姓名机制后版本,包括 + \providetoggle{iftlseven}%用于处理biblatex3.7的兼容性 + \providetoggle{iftleight}%用于处理>=biblatex3.8的兼容性 + \providetoggle{iftlnine}%用于处理>=biblatex3.10的兼容性 + \StrBefore{\abx@version}{.}[\numinteger] + \StrBehind{\abx@version}{.}[\numdigital] + \IfInteger{\numdigital}{}{\StrGobbleRight{\numdigital}{1}[\numdigital]} + %2.x版本统一用iftlfive=true表示 + %3.0-3.2版本用iftlfive=true表示 + %3.3-3.6版本用iftlsix=true表示 + %3.7版本用iftlseven=true表示 + %>3.8版本用iftleight=true表示 + \ifnumcomp{\numinteger}{=}{3}{ + \ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftlsix}\togglefalse{iftlfive}}{\togglefalse{iftlsix}\toggletrue{iftlfive}} + \ifnumcomp{\numdigital}{>}{6}{\toggletrue{iftlseven}\togglefalse{iftlsix}}{\togglefalse{iftlseven}} + \ifnumcomp{\numdigital}{>}{7}{\toggletrue{iftleight}\togglefalse{iftlseven}}{\togglefalse{iftleight}} + \ifnumcomp{\numdigital}{>}{9}{\toggletrue{iftlnine}\togglefalse{iftleight}}{\togglefalse{iftlnine}} + }{\ifnumcomp{\numinteger}{>}{3}{ + \toggletrue{iftleight}\blx@warning@noline{% + biblatex version is >= 4.x.\MessageBreak + if errors raised,Please contact biblatex-gb7714-2015 pkg author.}% + }{\toggletrue{iftlfive}\blx@warning@noline{% + biblatex version is <= 2.x.\MessageBreak + if errors raised,Please contact biblatex-gb7714-2015 pkg author.}% + }} + \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令 + \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令 + + %定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成 + %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&{%#1#2& + \ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}% + }% + + %利用edef展开或xstring抽取第一个字符判断 + %现在采用xstring方法,避免抽取的是编组符号 + \def\testCJKfirst#1{% + %\edef\tempa{#1}% + %\expandarg%\noexpandarg + \exploregroups% + \StrChar{#1}{1}[\tempa]% + \expandafter\testCJKfirstchar\tempa&} + + %用于解析连续出版物,2个卷期的情况 + %范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 + \newcommand{\multivolparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% + {\def\multivolfirst{#1}\def\multivolsecond{}}% + } + \newcommand{\multinumberparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% + {\def\multinumberfirst{#1}\def\multinumbersecond{}}% + } %===================================================================== %===================================================================== %设置宏包选项 %===================================================================== +\defversion{3.0}{opt}{ + %biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 + %增加标签对齐选项,right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式,因为舍弃了list类环境后出错。 + \DeclareBibliographyOption{align}[right]{%texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明 + \ifstrequal{##1}{right}{}{} + \ifstrequal{##1}{left}{\setalignleft}{} + \ifstrequal{##1}{gb7714-2015}{}{} + } -\iftoggle{iftexlivesix}{% Alter settings that carry through from biblatex -%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{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, %名字的信息包括前缀 + firstinits=true, %名字有缩写,参考3.1.2.3 Internal + %giveninits=true, + date = year, %日期仅写到年 + maxnames = 3 , %设置名字最大数量 + minnames = 3 %设置缩减后的名字最小数量 + %uniquename = init + } } -%增加一个出版项自动处理控制选项,当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, %名字的信息包括前缀 - %firstinits=true, %名字有缩写,参考3.1.2.3 Internal - giveninits=true, - date = year, %日期仅写到年 - maxnames = 3 , %设置名字最大数量 - minnames = 3 %设置缩减后的名字最小数量 - %uniquename = init -} -} -{%biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 -%增加标签对齐选项,right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式,因为舍弃了list类环境后出错。 -\DeclareBibliographyOption{align}[right]{%texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明 -\ifstrequal{#1}{right}{}{} -\ifstrequal{#1}{left}{\setalignleft}{} -\ifstrequal{#1}{gb7714-2015}{}{} +\defversion{3.4}{opt}{ + % Alter settings that carry through from biblatex + %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, %名字的信息包括前缀 + %firstinits=true, %名字有缩写,参考3.1.2.3 Internal + giveninits=true, + date = year, %日期仅写到年 + maxnames = 3 , %设置名字最大数量 + minnames = 3 %设置缩减后的名字最小数量 + %uniquename = init + } } -%增加一个出版项自动处理控制选项,当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, %名字的信息包括前缀 - firstinits=true, %名字有缩写,参考3.1.2.3 Internal - %giveninits=true, - date = year, %日期仅写到年 - maxnames = 3 , %设置名字最大数量 - minnames = 3 %设置缩减后的名字最小数量 - %uniquename = init +\defversion{3.7}{opt}{ + %biblatex3.7版后(比如texlive2017中的3.7版)的使用方式 + %增加标签对齐选项,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, %名字的信息包括前缀 + %firstinits=true, %名字有缩写,参考3.1.2.3 Internal + giveninits=true, + date = year, %日期仅写到年 + urldate =edtf, %iso8601 + eventdate =edtf, + maxnames = 3 , %设置名字最大数量 + minnames = 3 %设置缩减后的名字最小数量 + %uniquename = init + } } + +\defversion{3.10}{opt}{ + %biblatex3.7版后(比如texlive2017中的3.7版)的使用方式 + %增加标签对齐选项,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, %名字的信息包括前缀 + %firstinits=true, %名字有缩写,参考3.1.2.3 Internal + giveninits=true, + date = year, %日期仅写到年 + urldate =iso, %iso8601,edtf + eventdate =iso, + maxnames = 3 , %设置名字最大数量 + minnames = 3 %设置缩减后的名字最小数量 + %uniquename = init + } } +\iftoggle{iftlfive} + {\switchversion{3.0}{opt}}%%当采用texlive2015以下版本时,biblatex3.0 + {\iftoggle{iftlsix}% + {\switchversion{3.4}{opt}}%%当采用texlive2016版本时,biblatex3.4 + {\iftoggle{iftlnine}% + {\switchversion{3.10}{opt}}%%当采用biblatex3.10以上版本时 + {\switchversion{3.7}{opt}}%%当采用biblatex3.4以上版本时 + } + } + %===================================================================== %===================================================================== %设置本地化字符串 %===================================================================== -%新建一个当地化字符串,用来记录“等”字符 -\NewBibliographyString{andotherscn} -\NewBibliographyString{noaddress} -\NewBibliographyString{nopublisher} - -%直接利用当地化格式english进行修改一些中文的格式 -%具体可以修改哪些,参考english.lbx文件 -%当然也可以增加比如上面定义的andotherscn -%注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 -\DefineBibliographyStrings{english}{ -bibliography = {参考文献}, -references = {参考文献}, -%bytranslator= {\addcomma\ 译\adddot}, %将trans. by 改成 译 -bytranslator= {\addcomma\ 译},%\addperiod -and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 -%andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 -andotherscn = {等}, %将超过3个人名的省略,et al.改成为 等 -noaddress = {[S.l.]}, -nopublisher = {[s.n.]}, -backrefpage = {引用页:}, -backrefpages = {引用页:}, -} + %新建一个当地化字符串,用来记录“等”字符 + \NewBibliographyString{andotherscn} + \NewBibliographyString{noaddress} + \NewBibliographyString{nopublisher} + + %直接利用当地化格式english进行修改一些中文的格式,具体可以修改哪些,参考english.lbx文件 + %当然也可以增加比如上面定义的andotherscn + %注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 + \DefineBibliographyStrings{english}{ + bibliography = {参考文献}, + references = {参考文献}, + %bytranslator= {\addcomma\ 译\adddot}, %将trans. by 改成 译 + bytranslator= {\addcomma\ 译},%\addperiod + and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 + %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 + andotherscn = {等}, %将超过3个人名的省略,et al.改成为 等 + noaddress = {[S.l.]}, + nopublisher = {[s.n.]}, + backrefpage = {引用页:}, + backrefpages = {引用页:}, + } %===================================================================== %===================================================================== %动态数据修改,修改输入的源文件数据,用于中文判断等 %===================================================================== -%修改输入的源文件数据,用于中文判断等 +%修改输入的源文件数据,用于中文判断等操作 %首先把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 +%注意这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, +%如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 %注意\DeclareSourcemap命令只能出现一次 \DeclareSourcemap{ \maps[datatype=bibtex]{%增加文献标识符如[M],[J]等,下面首先生成这一信息 @@ -239,6 +288,8 @@ backrefpages = {引用页:}, \step[fieldset=usera, fieldvalue={J}] \step[fieldsource=author] %有时会把author和editor混淆,这里处理后就没有这个问题 \step[fieldset=editor, origfieldval] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,这里处理后就没有这个问题 + \step[fieldset=institution, origfieldval] } \map{ \pertype{newspaper}%增加一个新闻报纸的类型newspaper @@ -327,6 +378,10 @@ backrefpages = {引用页:}, \step[fieldsource=year] \step[fieldset=date, origfieldval] } + \map{%title + \step[fieldsource={title}, match=\regexp{([^\\\{])}] + \step[fieldset=userd, fieldvalue={$1}] + } \map{%将entrykey放入keywords中用于后期的使用 \step[fieldsource=entrykey] \step[fieldset=keywords, origfieldval] @@ -339,7 +394,7 @@ backrefpages = {引用页:}, } } -\iftoggle{iftexlivesix}{ +\defversion{3.0}{map}{ \DeclareStyleSourcemap{ \maps[datatype=bibtex]{ % \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义 @@ -365,19 +420,41 @@ backrefpages = {引用页:}, \step[typesource=techreport, typetarget=report, final] %\step[fieldset=type, fieldvalue=techreport] } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] + \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization + \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% - address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + \map[overwrite]{ + \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \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\\\%}] } } } -}{ +} + +\defversion{3.4}{map}{ \DeclareStyleSourcemap{ \maps[datatype=bibtex]{ % \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义 @@ -403,40 +480,24 @@ backrefpages = {引用页:}, \step[typesource=techreport, typetarget=report, final] %\step[fieldset=type, fieldvalue=techreport] } - \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization - \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \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, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] } - \map[overwrite]{ - \step[fieldsource={booktitle}, 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]{ - \step[fieldsource={booktitle}, 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}] } } } } +\iftoggle{iftlfive}% + {\switchversion{3.0}{map}}% + {\switchversion{3.4}{map}} + \DeclareBibliographyAlias{newspaper}{article}%定义驱动别名,尝试以替代驱动层映射,实践表明是可行的。 @@ -454,11 +515,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} @@ -510,19 +571,14 @@ backrefpages = {引用页:}, %===================================================================== %设置单元或块等的标点 %===================================================================== -%\renewrobustcmd*{\bibinitperiod}{\adddot} %来源biblatex2.STY -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 -%\newcommand*{\revsdnamepunct}{\addcomma} %来源biblatex.def -\renewcommand*{\revsdnamepunct}{} -%\newcommand*{\subtitlepunct}{\newunitpunct} %修改标题和其它标题信息间的标点 -\renewcommand*{\subtitlepunct}{\addcolon\space} %来源biblatex.def, -%关于双语言或多语言的参考文献,可以参考3.11.5 Entry Sets,4.11.1 Entry Sets -%这里调整一下两种语言参考文献的间隔 -%\renewcommand*{\entrysetpunct}{\addsemicolon\space}%源来自biblatex.def -\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}%%双语之间用newline替换par(20170411 v1.0h),避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 -%页码引用格式的修改 -%\newcommand*{\bibpagespunct}{\addcomma\space} -\renewcommand*{\bibpagespunct}{\addcolon\space}%修改为用冒号 +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY +\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def +\renewcommand*{\subtitlepunct}{\addcolon\space} %修改标题和其它标题信息间的标点,来源biblatex.def, +%双语言或多语言的参考文献,可以参考3.11.5 Entry Sets,4.11.1 Entry Sets +%这里调整一下两种语言参考文献的间隔,源来自biblatex.def +%%双语之间用newline替换par(20170411 v1.0h),避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 +\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} +\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 %===================================================================== @@ -530,28 +586,12 @@ backrefpages = {引用页:}, %修改域的格式,重定义域的输出宏 %===================================================================== %新增文献类型标识符的格式 -%\DeclareFieldFormat{gbtypeflag}{\nobreak\mkbibbrackets{\nobreak#1}\nobreak} \DeclareFieldFormat{gbtypeflag}{% \iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符 {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% }{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}} -%\DeclareFieldFormat{gbtypeflag}{% -%\iffieldundef{url}%当存在url时,增加一个OL标识符 -%{\printtext{\nobreak[\nobreak}#1\printtext{]\nobreak}}% -%{\printtext{\nobreak[\nobreak}#1\printtext{\texttt{/}OL]\nobreak}}% -%} -%\DeclareFieldFormat{gbtypeflag}{% -%\iffieldundef{url}%当存在url时,增加一个OL标识符 -%{\nobreak[\nobreak#1]\nobreak}% -%{\nobreak[\nobreak#1\texttt{/}OL]\nobreak}% -%} -%\DeclareFieldFormat{gbtypeflag}{% -%\iffieldundef{url}%当存在url时,增加一个OL标识符 -%{\printtext{\mkbibbrackets{#1}}}%\nopunct -%{\printtext{\mkbibbrackets{#1\texttt{/}OL}}}% -%} \DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper \iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符 {\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% @@ -565,36 +605,20 @@ backrefpages = {引用页:}, }{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}} %重设title的输出格式,不加emph,原格式来自biblatex.def文件 -%\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}} -%\DeclareFieldFormat{issuetitle}{\mkbibemph{#1}} -%\DeclareFieldFormat{maintitle}{\mkbibemph{#1}} -%\DeclareFieldFormat{title}{\mkbibemph{#1}} -%\DeclareFieldFormat{booktitle}{\mkbibemph{#1}} \DeclareFieldFormat{title}{#1\adddot\addthinspace}% \DeclareFieldFormat{journaltitle}{#1\isdot} \DeclareFieldFormat{issuetitle}{#1} \DeclareFieldFormat{maintitle}{#1} \DeclareFieldFormat{booktitle}{#1} -%\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished] -% {title}{\mkbibquote{#1\isdot}} \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 [article,patent,thesis,unpublished] - {title}{#1\adddot\addthinspace}% + {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 [inbook,incollection,inproceedings] {title}{#1\nopunct\unspace}% - -%url相关输出,源来自biblatex.def -%\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{#1}} -\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行 -%\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\space#1}} - -%重设标题格式,将其修改为首字母大写 -%\DeclareFieldFormat{titlecase}{#1} -\DeclareFieldFormat{titlecase}{\MakeCapital#1} - -%\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{#1}} -\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符 +\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def +\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1} %修改译者位置格式,bytranslator+others原格式来自biblatex.def文件 \renewbibmacro*{bytranslator+others}{% @@ -650,16 +674,6 @@ backrefpages = {引用页:}, {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 {\printfield[gbtypeflag]{usera}}}%其它 -% \def\comparetmp{news}\def\comparetmpa{standard}\edef\comparetmpb{\thefield{note}}% -% \ifx\comparetmp\comparetmpb%判断是否为报纸 -% \printfield[gbtypeflagn]{usera}% -% \else% -% \ifx\comparetmpa\comparetmpb%判断是否为标准 -% \printfield[gbtypeflags]{usera}% -% \else% -% \printfield[gbtypeflag]{usera}% -% \fi% -% \fi% }% %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 %\newunit @@ -667,96 +681,78 @@ backrefpages = {引用页:}, }% } -\iftoggle{iftexlivesix}%姓名的格式处理 -{%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 -\renewbibmacro*{name:given-family}[4]{%利用family-given定义given-family - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot - % - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {} - {\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}} +\defversion{3.0}{name}{ + %biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 + \renewbibmacro*{name:last-first}[4]{% + \ifuseprefix + {\usebibmacro{name:delim}{##3##1}% + \usebibmacro{name:hook}{##3##1}% + \ifblank{##3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{##3}}\isdot} + {\mkbibnameprefix{##3}\isdot}% + \ifpunctmark{'}{}{\bibnamedelimc}}% + %\mkbibnamelast{#1}\isdot + \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{\MakeUppercase{##1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 + %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} + %\mkbibnamelast{\MakeUppercase{#1}}\isdot + %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 + \ifblank{##2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{##2}}\isdot}% + \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}} + {\usebibmacro{name:delim}{##1}% + \usebibmacro{name:hook}{##1}% + %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} + \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{\MakeUppercase{##1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + %\mkbibnamelast{\MakeUppercase{#1}}\isdot + %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 + \ifblank{##2##3}{}{\revsdnamepunct}% + \ifblank{##2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{##2}}\isdot}% + \ifblank{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot}% + \addcomma\addspace% + \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}% + } + } + \renewbibmacro*{name:first-last}[4]{% + \usebibmacro{name:last-first}{##1}{##2}{##3}{##4}} } -{%biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 -\renewbibmacro*{name:first-last}[4]{% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - %\mkbibnamelast{#1}\isdot - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 - %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% - }} - -\renewbibmacro*{name:last-first}[4]{% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - %\mkbibnamelast{#1}\isdot - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 - %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% - }} + +\defversion{3.4}{name}{ + %biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 + \renewbibmacro*{name:given-family}[4]{%用family-given修改后的内容定义given-family + \ifuseprefix + {\usebibmacro{name:delim}{##3##1}% + \usebibmacro{name:hook}{##3##1}% + \ifdefvoid{##3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{##3}}\isdot} + {\mkbibnameprefix{##3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{##2}{\mkbibnamefamily{\MakeCapital{##1}}}{\mkbibnamefamily{\MakeUppercase{##1}}}\isdot + \ifdefvoid{##2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{##2}}\isdot}%\MakeCapital + \ifdefvoid{##4}{}{\bibnamedelimd\mkbibnamesuffix{##4}\isdot}} + {\usebibmacro{name:delim}{##1}% + \usebibmacro{name:hook}{##1}% + \ifdefvoid{##2}{\mkbibnamefamily{\MakeCapital{##1}}}{\mkbibnamefamily{\MakeUppercase{##1}}}\isdot + % + \ifboolexpe{% + test {\ifdefvoid{##2}} + and + test {\ifdefvoid{##3}}} + {} + {\revsdnamepunct}% + \ifdefvoid{##2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{##2}}\isdot}%\MakeCapital + \ifdefvoid{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot} + \ifdefvoid{##4}{}{\bibnamedelimd\mkbibnamesuffix{##4}\isdot}} + } + \renewbibmacro*{name:family-given}[4]{% + \usebibmacro{name:given-family}{##1}{##2}{##3}{##4}} } +\iftoggle{iftlfive}%根据texlive/biblatex版本选择 + {\switchversion{3.0}{name}}% + {\switchversion{3.4}{name}} + \renewbibmacro*{url+urldate}{% %\usebibmacro{url}%%更换url的位置,放到下面 \iffieldundef{urlyear}% @@ -764,38 +760,176 @@ backrefpages = {引用页:}, \usebibmacro{urldate}}% \setunit{\addperiod\addspace}% \usebibmacro{url}} - \renewbibmacro*{url}{\printfield{url}} -%\newbibmacro*{urldate}{\printurldate} %引用时间修改如下一行,即带方括号 -\renewbibmacro*{urldate}{% -\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}}}}% + +\defversion{3.4}{date}{ + \renewbibmacro*{urldate}{% + \addthinspace\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}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空 + \iffieldundef{endyear}{% + \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% + \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% + \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% + }% + }{% + \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% + \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% + \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% + }% + }% + }% + {% + \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% + \iffieldundef{month}{}{\bibrangedash\thefield{month}}% + \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% + }% + }% + }% } -\newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 -\iffieldundef{year}{% -\iffieldundef{endyear}{% -\iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% -\iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% -\iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% -}% -}{% -\iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% -\iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% -\iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% -}% -}}{% -\iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% -\iffieldundef{month}{}{\bibrangedash\thefield{month}}% -\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% -}}% -}% +\defversion{3.7}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + \newbibmacro*{newsdate}{%%新增加一个新闻日期 + \blx@edtfdate{}{}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}% + }% + }% +} + +\defversion{3.10}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + \newbibmacro*{newsdate}{%%新增加一个新闻日期 + \blx@isodate{}{}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@isodate{}{}\printtext{)}}% + }% + }% +} + +\defversion{3.8}{dblang}{ + %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, + %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 + %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 + \newcommand{\defdoublelangentry}[2]{% + \edef\entrykeya{##1} + \edef\entrykeyb{##2} + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{ + \step[fieldsource=entrykey, match=\entrykeya, final] + \step[fieldset=related, fieldvalue=\entrykeyb] + } + } + } + } +} + +\iftoggle{iftlfive}%%根据texlive/biblatex版本选择 + {\switchversion{3.4}{date}}% + {\iftoggle{iftlsix}% + {\switchversion{3.4}{date}}% + {\iftoggle{iftlnine}% + {\switchversion{3.10}{date}}%biblatex3.10版 + {\switchversion{3.7}{date}}% + }% + } + +\iftoggle{iftlnine} + {\switchversion{3.8}{dblang}} + {\iftoggle{iftleight} + {\switchversion{3.8}{dblang}} + {} + } + +\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par + +\renewbibmacro*{related}{% + \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} } + {} + {\usebibmacro{begrelated}% + \def\bbx@tempa{}% + \setcounter{bbx:relatedtotal}{0}% + \def\do##1{% + \entrydata{##1}{% + \ifrelatedloop + {} + {\stepcounter{bbx:relatedtotal}% + \gappto{\bbx@tempa}{##1,}}}}% + \docsvfield{related}% + \restorefield{related}{\bbx@tempa}% + \ifnumgreater{\value{bbx:relatedtotal}}{0} + {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}% + \iffieldundef{clonesourcekey} + {} + {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}% + \setcounter{bbx:relatedcount}{0}% + \def\do{% + \stepcounter{bbx:relatedcount}% + \ifnumgreater{\value{bbx:relatedcount}}{0} + {\ifcsundef{relateddelim\strfield{relatedtype}} + {\printtext{\relateddelim}} + {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}} + {}}% + \ifbibmacroundef{related:\strfield{relatedtype}} + {\appto{\do}{\usebibmacro{related:default}}} + {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}% + \iffieldformatundef{related:\strfield{relatedtype}} + {\def\bbx@tempa{related}} + {\def\bbx@tempa{related:\strfield{relatedtype}}}% + \iffieldformatundef{relatedstring:\strfield{relatedtype}} + {\def\bbx@tempb{relatedstring:default}} + {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% + \printtext[\bbx@tempa]{% + \usebibmacro{begrelatedloop}% + \iffieldundef{relatedstring} + {\ifboolexpr{ + test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} + and + test {\ifbibxstring{\thefield{relatedtype}s}} + } + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} + {\iffieldbibstring{relatedtype} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} + {}}} + {\iffieldbibstring{relatedstring} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} + {\printfield[\bbx@tempb]{relatedstring}}}% + \docsvfield{related}% + \usebibmacro{endrelatedloop}}}% + {}% + \usebibmacro{endrelated}}} %调整doi+eprint+url格式,源来自standard.bbx %因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 @@ -830,7 +964,7 @@ backrefpages = {引用页:}, %新增一个样式用于输出连续出版物的地址,单位,时间,%类似\newbibmacro*{publisher+location+date} \newbibmacro*{location+institution+date}{% \iftoggle{bbx:gbpub}% -{\testCJKfirst{\thefield{title}} +{\testCJKfirst{\thefield{userd}} \iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}% {\printlist{location}}% % \iflistundef{institution} @@ -858,21 +992,17 @@ backrefpages = {引用页:}, \newunit}% } - \renewbibmacro*{publisher+location+date}{% \iftoggle{bbx:gbpub}% -{\testCJKfirst{\thefield{title}}% -%\testifnoteeqstd% +{\testCJKfirst{\thefield{userd}}% \iflistundef{location}{%\adddot -\iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准低19页看到,标准存在出版项时输出,没有时完全省略。 -%\iftoggle{ifnoteeqstandard}{}{%}替换为上一句,尽可能用biblatex提供的函数 +\iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 \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}}% }}% @@ -894,7 +1024,7 @@ backrefpages = {引用页:}, %对edition版本信息做出修改,源来自biblatex.DEF \DeclareFieldFormat{edition}{% -\testCJKfirst{\thefield{title}}% +\testCJKfirst{\thefield{userd}}% \iftoggle{ifCJKforgbt}% {\ifinteger{#1}% {\printtext{#1版}}% @@ -905,7 +1035,7 @@ backrefpages = {引用页:}, %对version的版本信息做出修改,源来自biblatex.DEF \DeclareFieldFormat{version}{% -\testCJKfirst{\thefield{title}}% +\testCJKfirst{\thefield{userd}}% \ifinteger{#1}% {\iftoggle{ifCJKforgbt}{\printtext{#1版}}% {\mkbibordedition{#1}~\bibstring{version}}}% @@ -940,12 +1070,6 @@ backrefpages = {引用页:}, \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}% @@ -953,19 +1077,12 @@ backrefpages = {引用页:}, \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 } %调整期刊卷和期的格式,源来自standard.bbx \renewbibmacro*{volume+number+eid}{% -%\ifnumerals{\thefield{volume}}{htruei}{hfalsei} \printfield{volume}% %\setunit*{\adddot}%去掉点号 %\printfield{number}% @@ -1073,16 +1190,16 @@ backrefpages = {引用页:}, \bibrangedash% \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% }% - {\gbt@parse@range{\thefield{volume}}% + {\multivolparser{\thefield{volume}}% \printfield{year}% \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\gbt@range@first}% + \printtext{\multivolfirst}% \printtext{\mkbibparens{\multinumberfirst}}% \bibrangedash% \iffieldundef{endyear}{}{% \printfield{endyear}% \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\gbt@range@second}% + \printtext{\multivolsecond}% \printtext{\mkbibparens{\multinumbersecond}}}% }% \setunit{\addcomma\space}% @@ -1258,8 +1375,7 @@ backrefpages = {引用页:}, %\setunit{\labelnamepunct}\newblock \usebibmacro{title}% %\nopunct -%\iffieldundef{booktitle}{\adddot\addspace}{%兼容standard时,如果standard没有booktitle的应转换为book类,因为都转成inbook类,所以这里做如下处理 -\printtext{\texttt{//}\addnbthinspace}%%\texttt{//} +\printtext{\texttt{//}\addthinspace}%%\texttt{//}\addnbthinspace \usebibmacro{bybookauthor}% \ifnameundef{bookauthor}{\newblock}{\newunit\newblock}%替换下一句 %\newunit\newblock @@ -1551,7 +1667,6 @@ backrefpages = {引用页:}, \usebibmacro{finentry}} %直接利用report做unpublished -%\DeclareBibliographyDriver{report}{% \DeclareBibliographyDriver{unpublished}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% @@ -1663,7 +1778,7 @@ backrefpages = {引用页:}, {\setunit{\labelnamepunct}\newblock}% %\setunit{\labelnamepunct}\newblock \usebibmacro{title}% -\printtext{\texttt{//}\addnbthinspace}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后 +\printtext{\texttt{//}\addthinspace}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后 \usebibmacro{bybookauthor}% \ifnameundef{bookauthor}{\newblock}{\newunit\newblock}%替换下一句 %\newunit\newblock @@ -1717,7 +1832,7 @@ backrefpages = {引用页:}, % \usebibmacro{byauthor}% % \newunit\newblock %\usebibmacro{in:}% - \printtext{\texttt{//}\addnbthinspace}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后 + \printtext{\texttt{//}\addthinspace}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后 \usebibmacro{bybookauthor}%用类似inbook的方式处理 \ifnameundef{bookauthor}{\newblock}{\newunit\newblock}%替换下一句 %\newunit\newblock 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 7d022f84d87..23a1cc08434 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 @@ -4,19 +4,15 @@ %% GBT7714-2015 citation style,numerical sequence %% Maintained by huzhenzhen %% history: -%% 2016/05/20 v1.0 -%% 2016/10/23 v1.0a -%% 2016/11/11 v1.0b -%% 2016/11/14 v1.0c -%% 2016/11/24 v1.0d -%% 2016/12/07 v1.0e -%% 2017/02/26 v1.0g -%% 2017/04/11 v1.0h +%% 2016/05/20 v1.0 2016/10/23 v1.0a 2016/11/11 v1.0b +%% 2016/11/14 v1.0c 2016/11/24 v1.0d 2016/12/07 v1.0e +%% 2017/02/26 v1.0g 2017/04/11 v1.0h +%% 2017/11/21 v1.0i %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\ProvidesFile{gb7714-2015.cbx}[2017/04/11 v1.0h biblatex citation style] +\ProvidesFile{gb7714-2015.cbx}[2017/11/21 v1.0i 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 d4572f9e8dd..24ab3e1650b 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 @@ -4,19 +4,15 @@ %% GBT7714-2015 bibliography style,author year sequence %% Maintained by huzhenzhen %% history: -%% 2016/05/20 v1.0 -%% 2016/10/23 v1.0a -%% 2016/11/11 v1.0b -%% 2016/11/14 v1.0c -%% 2016/11/24 v1.0d -%% 2016/12/07 v1.0e -%% 2016/12/31 v1.0f -%% 2017/02/26 v1.0g +%% 2016/05/20 v1.0 2016/10/23 v1.0a 2016/11/11 v1.0b +%% 2016/11/14 v1.0c 2016/11/24 v1.0d 2016/12/07 v1.0e +%% 2017/02/26 v1.0g 2017/04/11 v1.0h +%% 2017/11/21 v1.0i %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\ProvidesFile{gb7714-2015ay.bbx}[2017/02/26 v1.0g biblatex bibliography style] +\ProvidesFile{gb7714-2015ay.bbx}[2017/11/21 v1.0i biblatex bibliography style] %===================================================================== %===================================================================== @@ -28,18 +24,37 @@ %===================================================================== %===================================================================== -%增加一些功能函数 +%新增功能函数 %===================================================================== -\providetoggle{iftexlivesix} -\providetoggle{iftexliveseven} -%版本判断,根据biblatex更新历史可知,版本3.3开始使用新的姓名机制 -%所以当版本大于3.2开始,就用设置\toggletrue{iftexlivesix} -\def\numparserta#1.#2\relax{#1}%注意relax的重要性 -\def\numparsertb#1.#2\relax{#2} -\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}} + %版本判断 + \providetoggle{iftlfive}%用于处理biblatex3.2之前的版本,即texlive2015以下版本中的biblatex + \providetoggle{iftlsix}%用于处理biblatex3.3开始改变的新的姓名机制后版本,包括 + \providetoggle{iftlseven}%用于处理biblatex3.7的兼容性 + \providetoggle{iftleight}%用于处理>=biblatex3.8的兼容性 + \providetoggle{iftlnine}%用于处理>=biblatex3.10的兼容性 + \StrBefore{\abx@version}{.}[\numinteger] + \StrBehind{\abx@version}{.}[\numdigital] + \IfInteger{\numdigital}{}{\StrGobbleRight{\numdigital}{1}[\numdigital]} + %2.x版本统一用iftlfive=true表示 + %3.0-3.2版本用iftlfive=true表示 + %3.3-3.6版本用iftlsix=true表示 + %3.7版本用iftlseven=true表示 + %>3.8版本用iftleight=true表示 + \ifnumcomp{\numinteger}{=}{3}{ + \ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftlsix}\togglefalse{iftlfive}}{\togglefalse{iftlsix}\toggletrue{iftlfive}} + \ifnumcomp{\numdigital}{>}{6}{\toggletrue{iftlseven}\togglefalse{iftlsix}}{\togglefalse{iftlseven}} + \ifnumcomp{\numdigital}{>}{7}{\toggletrue{iftleight}\togglefalse{iftlseven}}{\togglefalse{iftleight}} + \ifnumcomp{\numdigital}{>}{9}{\toggletrue{iftlnine}\togglefalse{iftleight}}{\togglefalse{iftlnine}} + }{\ifnumcomp{\numinteger}{>}{3}{ + \toggletrue{iftleight}\blx@warning@noline{% + biblatex version is >= 4.x.\MessageBreak + if errors raised,Please contact biblatex-gb7714-2015 pkg author.}% + }{\toggletrue{iftlfive}\blx@warning@noline{% + biblatex version is <= 2.x.\MessageBreak + if errors raised,Please contact biblatex-gb7714-2015 pkg author.}% + }} + \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令 + \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令 %定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成 %2E00-2E7F 追加标点 @@ -51,7 +66,7 @@ %4E00-9FBF cjk统一表意符号 %中文范围4E00-9FA5 \providetoggle{ifCJKforgbt} -\def\testCJKfirstchar#1#2&{% +\def\testCJKfirstchar#1#2&{%#1#2& \ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}% }% @@ -59,143 +74,182 @@ %现在采用xstring方法,避免抽取的是编组符号 \def\testCJKfirst#1{% %\edef\tempa{#1}% +%\expandarg% \exploregroups% \StrChar{#1}{1}[\tempa]% \expandafter\testCJKfirstchar\tempa&} -%判断是否是标准 -%\providetoggle{ifnoteeqstandard} -%\def\testifnoteeqstd{% -%\iffieldundef{note}{\togglefalse{ifnoteeqstandard}}%判断一下,是否是报纸和标准 -% {\def\comparetmp{standard}\edef\comparetmpb{\thefield{note}}% -% \ifx\comparetmp\comparetmpb% -% \toggletrue{ifnoteeqstandard}% -% \else% -% \togglefalse{ifnoteeqstandard}% -% \fi}} -%\iffieldequalstr{note}{standard}{true}{false} %可以利用这一函数代替 - %用于解析连续出版物,2个卷期的情况 -\def\multivolumeparsetoparts#1/#2{\def\multivolumefirst{#1}\def\multivolumesecond{#2}} -%\def\multinumberparsetoparts#1/#2{\def\multinumberfirst{#1}\def\multinumbersecond{#2}} - -%这里利用李志奇的范围数据解析函数,修改后用来处理卷volume的范围。 -%他的这个函数是通用的,只能在使用数据前使用,如果多次使用前一次得到的数据就会被冲掉 -%这里的范围起止判断符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 -\def\gbt@parse@range#1{% - \edef\gbt@tmpa{#1}% - \expandafter\gbt@parse@rangei\gbt@tmpa-\@empty} -\def\gbt@parse@rangei#1-#2\@empty{% - \global\def\gbt@range@first{#1}% - \def\gbt@tmpa{#2}% - \ifx\gbt@tmpa\@empty% - \global\def\gbt@range@second{}% - \else% - \gbt@parse@rangeii#2\@empty% - \fi} -\def\gbt@parse@rangeii#1-#2\@empty{% - \def\gbt@tmpa{#2}% - \ifx\gbt@tmpa\@empty% - \global\def\gbt@range@second{#1}% - \else% - \gbt@parse@rangeii#2\@empty% - \fi} - -%这里写的number的解析函数,与上面的卷解析函数是类似的。 -\def\multinumberparser#1{% - \edef\gbnumbertmp{#1}% - \expandafter\multinumberparsetoparts\gbnumbertmp-\@empty} -\def\multinumberparsetoparts#1-#2\@empty{% - \def\multinumberfirst{#1}% - \def\gbnumbertmp{#2}% - \ifx\gbnumbertmp\@empty% - \def\multinumbersecond{}% - \else% - \multinumberparsetopartsb#2\@empty% - \fi} -\def\multinumberparsetopartsb#1-#2\@empty{% - \def\gbnumbertmp{#2}% - \ifx\gbnumbertmp\@empty% - \def\multinumbersecond{#1}% - \else% - \multinumberparsetopartsb#2\@empty% - \fi} - - +%范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 +\newcommand{\multivolparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% + {\def\multivolfirst{#1}\def\multivolsecond{}}% +} +\newcommand{\multinumberparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% + {\def\multinumberfirst{#1}\def\multinumbersecond{}}% +} %===================================================================== %===================================================================== %设置宏包选项 %===================================================================== -\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 - giveninits = true, - date = year, %日期仅写到年 - %maxnames = 3 , %设置名字最大数量 - %minnames = 3, %设置缩减后的名字最小数量 - maxbibnames=3, %将文献列表和引用中最大名字数量区分开 - minbibnames=3, -}} -{%biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 -%增加标签对齐选项,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 - date = year, %日期仅写到年 - %maxnames = 3 , %设置名字最大数量 - %minnames = 3, %设置缩减后的名字最小数量 - maxbibnames=3, %将文献列表和引用中最大名字数量区分开 - minbibnames=3, - %uniquename=init, -}} +\defversion{3.0}{opt}{ + %biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 + %增加标签对齐选项,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 + date = year, %日期仅写到年 + %maxnames = 3 , %设置名字最大数量 + %minnames = 3, %设置缩减后的名字最小数量 + maxbibnames=3, %将文献列表和引用中最大名字数量区分开 + minbibnames=3, + %uniquename=init, + } +} + +\defversion{3.4}{opt}{ + %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 + giveninits = true, + date = year, %日期仅写到年 + %maxnames = 3 , %设置名字最大数量 + %minnames = 3, %设置缩减后的名字最小数量 + maxbibnames=3, %将文献列表和引用中最大名字数量区分开 + minbibnames=3, + %datezeros=true, + } +} + +\defversion{3.7}{opt}{ + %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 + giveninits = true, + date = year, %日期仅写到年 + urldate =edtf, + eventdate =edtf, + %maxnames = 3 , %设置名字最大数量 + %minnames = 3, %设置缩减后的名字最小数量 + maxbibnames=3, %将文献列表和引用中最大名字数量区分开 + minbibnames=3, + %datezeros=true, + } +} + +\defversion{3.10}{opt}{ + %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 + giveninits = true, + date = year, %日期仅写到年 + urldate =iso, + eventdate =iso, + %maxnames = 3 , %设置名字最大数量 + %minnames = 3, %设置缩减后的名字最小数量 + maxbibnames=3, %将文献列表和引用中最大名字数量区分开 + minbibnames=3, + %datezeros=true, + } +} + +\iftoggle{iftlfive} + {\switchversion{3.0}{opt}}%%当采用texlive2015以下版本时,biblatex3.0 + {\iftoggle{iftlsix}% + {\switchversion{3.4}{opt}}%%当采用texlive2016版本时,biblatex3.4 + {\iftoggle{iftlnine}% + {\switchversion{3.10}{opt}}%%当采用biblatex3.10以上版本时 + {\switchversion{3.7}{opt}}%%当采用biblatex3.4以上版本时 + } + } %===================================================================== %===================================================================== %设置本地化字符串 %===================================================================== -%新建一个当地化字符串,用来记录“等”字符 -\NewBibliographyString{andotherscn} -\NewBibliographyString{noaddress} -\NewBibliographyString{nopublisher} + %新建一个当地化字符串,用来记录“等”字符 + \NewBibliographyString{andotherscn} + \NewBibliographyString{noaddress} + \NewBibliographyString{nopublisher} -%直接利用当地化格式english进行修改一些中文的格式, -%具体可以修改哪些,参考english.lbx文件 +%直接利用当地化格式english进行修改一些中文的格式,具体可以修改哪些,参考english.lbx文件 %当然也可以增加比如上面定义的andotherscn %注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 \DefineBibliographyStrings{english}{ @@ -214,7 +268,7 @@ backrefpages = {引用页:}, %===================================================================== %===================================================================== -%动态数据修改,修改输入的源文件数据,用于中文判断等 +%动态数据修改,修改输入的源文件数据,用于中文判断等操作 %===================================================================== %首先把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 %注意\DeclareSourcemap命令只能出现一次 @@ -229,6 +283,8 @@ backrefpages = {引用页:}, \step[fieldset=usera, fieldvalue={J}] \step[fieldsource=author] %有时会把author和editor混淆,这里处理后就没有这个问题 \step[fieldset=editor, origfieldval] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,这里处理后就没有这个问题 + \step[fieldset=institution, origfieldval] } \map{ \pertype{newspaper}%增加一个新闻报纸的类型newspaper @@ -314,9 +370,17 @@ backrefpages = {引用页:}, \step[fieldset=userf, origfieldval] \step[fieldsource=translator] \step[fieldset=usere, origfieldval] - \step[fieldsource=year]%处理一些用year表示date的情况 + } + \map{%处理一些用year表示date的情况 + %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 + %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 + \step[fieldsource=year] \step[fieldset=date, origfieldval] } + \map{%将title信息保存到userd中避免因为标签生成原因导致title域被清除 + \step[fieldsource=title, match=\regexp{([^\\\{])}] + \step[fieldset=userd, fieldvalue={$1}] + } \map{%将entrykey放入keywords中用于后期的使用 \step[fieldsource=entrykey] \step[fieldset=keywords, origfieldval] @@ -346,7 +410,7 @@ backrefpages = {引用页:}, \step[fieldset=userb,fieldvalue={en}] } %本来后面这些是放到DeclareStyleSourcemap中处理的,但是因为texlive2016的biblatex3.4不支持多个DeclareStyleSourcemap, - %但有处理特殊字符和处理gbnoauthor选项的需求,所以把这些提到这来,让后让这两个功能结合到一个DeclareStyleSourcemap时, + %但有处理特殊字符和处理gbnoauthor选项的需求,所以把这些提到这来,以后将这两个功能结合到一个DeclareStyleSourcemap时, %不用复制如下段代码了。 \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义 %但从实践看,并没有什么影响,映射过来就可以了。 @@ -375,126 +439,126 @@ backrefpages = {引用页:}, } \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\\\#}] - } - \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}] + \iftoggle{iftlfive}{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization + \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \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\\\%}] + } } } - } -}{ - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization - \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \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\\\%}] + }{\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\\\#}] + } + \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}] + } } } } -}} +} \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}] + \iftoggle{iftlfive}{ + \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}] + } + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \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\\\%}] + } } } - } -}{ - \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}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \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\\\%}] + }{ \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}] + } } } } -}} +} %===================================================================== @@ -502,38 +566,101 @@ backrefpages = {引用页:}, %设置排序格式 %===================================================================== %排序用降序或userb域 -\DeclareSortingScheme{nyt}{ - \sort{ - \field{presort} - } - \sort[final]{ - \field{sortkey} - } - \sort{ - \field{userb} - } - \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} - \literal{0000} - } +\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释 + \DeclareSortingScheme{nyt}{ + \sort{ + \field{presort} + } + \sort[final]{ + \field{sortkey} + } + \sort{ + \field{userb} + } + \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} + } + } +} + +\defversion{3.8}{sort}{ + \DeclareSortingTemplate{nyt}{ + \sort{ + \field{presort} + } + \sort[final]{ + \field{sortkey} + } + \sort{ + \field{userb} + } + \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} + } + } + + %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, + %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 + %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 + \newcommand{\defdoublelangentry}[2]{% + \edef\entrykeya{##1} + \edef\entrykeyb{##2} + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{ + \step[fieldsource=entrykey, match=\entrykeya, final] + \step[fieldset=related, fieldvalue=\entrykeyb] + } + } + } + } } +\iftoggle{iftlfive} + {\switchversion{3.7}{sort}}%%当采用texlive2015以下版本时 + {\iftoggle{iftlsix}% + {\switchversion{3.7}{sort}}%%当采用texlive2016版本时 + {\iftoggle{iftlseven}% + {\switchversion{3.7}{sort}}%%当采用texlive2017版本时 + {\switchversion{3.8}{sort}}%%当采用biblatex3.8a以上版本时 + }% + } + + %===================================================================== %===================================================================== @@ -544,8 +671,8 @@ backrefpages = {引用页:}, {} {%\setlength{\leftmargin}{\bibhang}% %\setlength{\itemindent}{-\leftmargin}% - \setlength{\leftmargin}{0pt}% - \setlength{\itemindent}{0pt}% + \setlength{\leftmargin}{1em}% + \setlength{\itemindent}{-1em}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}} {\endlist} @@ -556,31 +683,20 @@ backrefpages = {引用页:}, %===================================================================== %设置单元或块等的标点 %===================================================================== -%将名字简写后的点去掉 -%\renewrobustcmd*{\bibinitperiod}{\adddot} %来源biblatex2.STY -\renewrobustcmd*{\bibinitperiod}{} -%\newcommand*{\revsdnamepunct}{\addcomma} %来源biblatex.def -\renewcommand*{\revsdnamepunct}{} -%\newcommand*{\subtitlepunct}{\newunitpunct} %修改标题和其它标题信息间的标点 -\renewcommand*{\subtitlepunct}{\addcolon\space} %来源biblatex.def - -%关于双语言或多语言的参考文献,可以参考3.11.5 Entry Sets,4.11.1 Entry Sets -%这里调整一下两种语言参考文献的间隔 -%\renewcommand*{\entrysetpunct}{\addsemicolon\space}%源来自biblatex.def +\renewrobustcmd*{\bibinitperiod}{} %将名字简写后的点去掉%来源biblatex2.STY +\renewcommand*{\revsdnamepunct}{}%来源biblatex.def +\renewcommand*{\subtitlepunct}{\addcolon\space} %修改标题和其它标题信息间的标点%来源biblatex.def +%双语言或多语言的参考文献,可以参考3.11.5 Entry Sets,4.11.1 Entry Sets +%这里调整一下两种语言参考文献的间隔,%源来自biblatex.def \renewcommand*{\entrysetpunct}{\adddot\par\nobreak} - -%页码引用格式的修改 -%\newcommand*{\bibpagespunct}{\addcomma\space} -\renewcommand*{\bibpagespunct}{\addcolon\space}%修改为用冒号 - +\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%页码引用格式的修改%修改为用冒号 +%\renewcommand{\relateddelim}{}%\par %===================================================================== %===================================================================== %修改域的格式 %===================================================================== %新增文献类型标识符的格式 -%\DeclareFieldFormat{gbtypeflag}{\nobreak\mkbibbrackets{\nobreak#1}\nobreak} - \DeclareFieldFormat{gbtypeflag}{% \iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符 {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% @@ -600,147 +716,93 @@ backrefpages = {引用页:}, }{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}} %重设title的输出格式,不加emph,原格式来自biblatex.def文件 -%\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}} -%\DeclareFieldFormat{issuetitle}{\mkbibemph{#1}} -%\DeclareFieldFormat{maintitle}{\mkbibemph{#1}} -%\DeclareFieldFormat{title}{\mkbibemph{#1}} -%\DeclareFieldFormat{booktitle}{\mkbibemph{#1}} \DeclareFieldFormat{title}{#1\adddot\addthinspace} \DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot,用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 \DeclareFieldFormat{issuetitle}{#1} \DeclareFieldFormat{maintitle}{#1} \DeclareFieldFormat{booktitle}{#1} -%\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished] -% {title}{\mkbibquote{#1\isdot}} \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 [article,patent,thesis,unpublished] {title}{#1\adddot\addthinspace} \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 [inbook,incollection,inproceedings] {title}{#1\nopunct\unspace} +\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 + + +\defversion{3.0}{name}{ + %biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 + \renewbibmacro*{name:last-first}[4]{% + \ifuseprefix + {\usebibmacro{name:delim}{##3##1}% + \usebibmacro{name:hook}{##3##1}% + \ifblank{##3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{##3}}\isdot} + {\mkbibnameprefix{##3}\isdot}% + \ifpunctmark{'}{}{\bibnamedelimc}}% + %\mkbibnamelast{#1}\isdot + \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{\MakeUppercase{##1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 + %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} + %\mkbibnamelast{\MakeUppercase{#1}}\isdot + %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 + \ifblank{##2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{##2}}\isdot}% + \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}} + {\usebibmacro{name:delim}{##1}% + \usebibmacro{name:hook}{##1}% + %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} + \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{\MakeUppercase{##1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + %\mkbibnamelast{\MakeUppercase{#1}}\isdot + %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 + \ifblank{##2##3}{}{\revsdnamepunct}% + \ifblank{##2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{##2}}\isdot}% + \ifblank{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot}% + \addcomma\addspace% + \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}% + } + } -%重设标题格式,将其修改为首字母大写 -%\DeclareFieldFormat{titlecase}{#1} -\DeclareFieldFormat{titlecase}{\MakeCapital#1} - -\iftoggle{iftexlivesix}{ -%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 -\renewbibmacro*{name:given-family}[4]{%利用family-given定义given-family - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital{#2} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot - % - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {} - {\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital{#2} - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}} - -\renewbibmacro*{name:family-given}[4]{%利用family-given定义given-family - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital{#2} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot - % - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {} - {\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%%\MakeCapital{#2} - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}} - + \renewbibmacro*{name:first-last}[4]{% + \usebibmacro{name:last-first}{##1}{##2}{##3}{##4}} } -{%biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 -%作者名字的处理,参考文档4.2.3节,3.12.4 Name Parts and Name Spacing -\renewbibmacro*{name:last-first}[4]{% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - %\mkbibnamelast{#1}\isdot - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 - %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% - }} - -\renewbibmacro*{name:first-last}[4]{% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - %\mkbibnamelast{#1}\isdot - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 - %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% - }} + +\defversion{3.4}{name}{ + %biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 + \renewbibmacro*{name:given-family}[4]{%利用family-given定义given-family + \ifuseprefix + {\usebibmacro{name:delim}{##3##1}% + \usebibmacro{name:hook}{##3##1}% + \ifdefvoid{##3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{##3}}\isdot} + {\mkbibnameprefix{##3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{##2}{\mkbibnamefamily{\MakeCapital{##1}}}{\mkbibnamefamily{\MakeUppercase{##1}}}\isdot + \ifdefvoid{##2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{##2}}\isdot}%\MakeCapital + \ifdefvoid{##4}{}{\bibnamedelimd\mkbibnamesuffix{##4}\isdot}} + {\usebibmacro{name:delim}{##1}% + \usebibmacro{name:hook}{##1}% + \ifdefvoid{##2}{\mkbibnamefamily{\MakeCapital{##1}}}{\mkbibnamefamily{\MakeUppercase{##1}}}\isdot + % + \ifboolexpe{% + test {\ifdefvoid{##2}} + and + test {\ifdefvoid{##3}}} + {} + {\revsdnamepunct}% + \ifdefvoid{##2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{##2}}\isdot}%\MakeCapital + \ifdefvoid{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot} + \ifdefvoid{##4}{}{\bibnamedelimd\mkbibnamesuffix{##4}\isdot}} + } + \renewbibmacro*{name:family-given}[4]{% + \usebibmacro{name:given-family}{##1}{##2}{##3}{##4}} } +\iftoggle{iftlfive}%根据texlive/biblatex版本选择 + {\switchversion{3.0}{name}}% + {\switchversion{3.4}{name}} + %重设title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件 \renewbibmacro*{title}{% \ifboolexpr{% @@ -760,16 +822,6 @@ backrefpages = {引用页:}, {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 {\printfield[gbtypeflag]{usera}}}%其它 -% \def\comparetmp{news}\def\comparetmpa{standard}\edef\comparetmpb{\thefield{note}}% -% \ifx\comparetmp\comparetmpb%判断是否为报纸 -% \printfield[gbtypeflagn]{usera}% -% \else% -% \ifx\comparetmpa\comparetmpb%判断是否为标准 -% \printfield[gbtypeflags]{usera}% -% \else% -% \printfield[gbtypeflag]{usera}% -% \fi% -% \fi% }% \iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 %\newunit @@ -777,11 +829,7 @@ backrefpages = {引用页:}, }% } -%url相关输出,源来自biblatex.def -%\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{#1}} -\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行 -%\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\space#1}} - +\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行%url相关输出,源来自biblatex.def \renewbibmacro*{url+urldate}{% %\usebibmacro{url}%%更换url的位置,放到下面 \iffieldundef{urlyear}% @@ -789,41 +837,151 @@ backrefpages = {引用页:}, \usebibmacro{urldate}}% \setunit{\addperiod\addspace}% \usebibmacro{url}} - \renewbibmacro*{url}{\printfield{url}} -%\newbibmacro*{urldate}{\printurldate} %引用时间修改如下一行 -\renewbibmacro*{urldate}{% -\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{year}{% -\iffieldundef{endyear}{% -\iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% -\iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% -\iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% -}% -}{% -\iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% -\iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% -\iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% -}% -}}{% -\iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% -\iffieldundef{month}{}{\bibrangedash\thefield{month}}% -\iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% -}}% -}% +\defversion{3.4}{date}{ + \renewbibmacro*{urldate}{% + \addthinspace\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}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空 + \iffieldundef{endyear}{% + \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% + \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% + \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% + }% + }{% + \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% + \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% + \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% + }% + }% + }% + {% + \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% + \iffieldundef{month}{}{\bibrangedash\thefield{month}}% + \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% + }% + }% + }% +} + +\defversion{3.7}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + \newbibmacro*{newsdate}{%%新增加一个新闻日期 + \blx@edtfdate{}{}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}% + }% + }% +} -%\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{#1}}%页码引用格式的修改 -\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符 +\defversion{3.10}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + \newbibmacro*{newsdate}{%%新增加一个新闻日期 + \blx@isodate{}{}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@isodate{}{}\printtext{)}}% + }% + }% +} + +\iftoggle{iftlfive}%%根据texlive/biblatex版本选择 + {\switchversion{3.4}{date}}% + {\iftoggle{iftlsix}% + {\switchversion{3.4}{date}}% + {\iftoggle{iftlnine}% + {\switchversion{3.10}{date}}%biblatex3.10版 + {\switchversion{3.7}{date}}% + }% + } + +\renewbibmacro*{related}{% + \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} } + {} + {\usebibmacro{begrelated}% + \def\bbx@tempa{}% + \setcounter{bbx:relatedtotal}{0}% + \def\do##1{% + \entrydata{##1}{% + \ifrelatedloop + {} + {\stepcounter{bbx:relatedtotal}% + \gappto{\bbx@tempa}{##1,}}}}% + \docsvfield{related}% + \restorefield{related}{\bbx@tempa}% + \ifnumgreater{\value{bbx:relatedtotal}}{0} + {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}% + \iffieldundef{clonesourcekey} + {} + {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}% + \setcounter{bbx:relatedcount}{0}% + \def\do{% + \stepcounter{bbx:relatedcount}% + \ifnumgreater{\value{bbx:relatedcount}}{0} + {\ifcsundef{relateddelim\strfield{relatedtype}} + {\printtext{\relateddelim}} + {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}} + {}}% + \ifbibmacroundef{related:\strfield{relatedtype}} + {\appto{\do}{\usebibmacro{related:default}}} + {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}% + \iffieldformatundef{related:\strfield{relatedtype}} + {\def\bbx@tempa{related}} + {\def\bbx@tempa{related:\strfield{relatedtype}}}% + \iffieldformatundef{relatedstring:\strfield{relatedtype}} + {\def\bbx@tempb{relatedstring:default}} + {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% + \printtext[\bbx@tempa]{% + \usebibmacro{begrelatedloop}% + \iffieldundef{relatedstring} + {\ifboolexpr{ + test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} + and + test {\ifbibxstring{\thefield{relatedtype}s}} + } + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} + {\iffieldbibstring{relatedtype} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} + {}}} + {\iffieldbibstring{relatedstring} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} + {\printfield[\bbx@tempb]{relatedstring}}}% + \docsvfield{related}% + \usebibmacro{endrelatedloop}}}% + {}% + \usebibmacro{endrelated}}} + +\DeclareFieldFormat{pages}{#1}%页码引用格式的修改%去掉前面引导页码的pp.等字符 %调整doi+eprint+url格式,源来自standard.bbx %因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 @@ -854,10 +1012,7 @@ backrefpages = {引用页:}, %对edition版本信息做出修改,源来自biblatex.DEF \DeclareFieldFormat{edition}{% -%\testCJKfirst{\thefield{title}}% -\iffieldundef{title}{}{\testCJKfirst{\thefield{title}}}% -%直接用title不行?可能是需要在该句后面在加一个{},在展开的时候需要。 -%\testCJKfirst{\thefield{title}} %直接用这句不行,原因不明 +\iffieldundef{title}{}{\testCJKfirst{\thefield{userd}}}% \ifinteger{#1}% {\iftoggle{ifCJKforgbt}{\printtext{#1版}}% {\mkbibordedition{#1}~\bibstring{edition}}}% @@ -865,13 +1020,13 @@ backrefpages = {引用页:}, %对version的版本信息做出修改,源来自biblatex.DEF \DeclareFieldFormat{version}{% -\iffieldundef{title}{}{\testCJKfirst{\thefield{title}}}% +\iffieldundef{title}{}{\testCJKfirst{\thefield{userd}}}% \ifinteger{#1}% {\iftoggle{ifCJKforgbt}{\printtext{#1版}}% {\mkbibordedition{#1}~\bibstring{version}}}% {#1\isdot}} -\renewbibmacro*{author}{% +\renewbibmacro*{author}{%author for biblatex version <=3.7 \ifboolexpr{ test \ifuseauthor and @@ -897,34 +1052,73 @@ backrefpages = {引用页:}, \usebibmacro{date+extrayear} } - +%设置标注和文献表中作者和年份之间的分隔符 + \DeclareDelimFormat{nameyeardelim}{\addcomma\space} %设置因为mergedate默认为true时的情况,来自\bbx@opt@mergedate@compact %去掉作者后面包围年份的圆括号 -%这里因为biblatex版本的不同,做不同的处理,texlive2017版的在iftexliveseven=true中设置 -%2016等低版本的在iftexliveseven=false中设置 -%当然其实这还有更简单的解决方法就是: -% \let\printdateextralabel=\printlabeldateextra -%只是这里为了清楚区分才用判断的方式。 +%这里因为biblatex版本的不同,做不同的处理,texlive2017版/2016等低版本分开处理 %重设date+extrayear格式,源来自authoryear.BBX -\iftoggle{iftexliveseven}{% +\defversion{3.4}{dateextra}{ + \renewbibmacro*{date+extrayear}{% + \iffieldundef{\thefield{datelabelsource}year} + {} + {\printtext{%[parens]%这里把括号去掉 + \iffieldsequal{year}{\thefield{datelabelsource}year} + {\printdateextralabel}% + {\printfield{labelyear}% + \printfield{extrayear}}}}}% +} +\defversion{3.7}{dateextra}{ \renewbibmacro*{date+extrayear}{% \iffieldundef{labelyear} {} - {\printtext{%[parens]%这里把括号去掉 + {\printtext[parens]{% \iffieldsequal{year}{labelyear} {\printlabeldateextra}% {\printfield{labelyear}% \printfield{extrayear}}}}}% -}{% -\renewbibmacro*{date+extrayear}{% - \iffieldundef{\thefield{datelabelsource}year} +} +\defversion{3.8}{dateextra}{ +\renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author + \ifboolexpr{ + test \ifuseauthor + and + not test {\ifnameundef{author}} + } + {\usebibmacro{bbx:dashcheck} + {%\bibnamedash %去掉相同作者用横线代替的处理 + \printnames{author}% + } + {\usebibmacro{bbx:savehash}% + \printnames{author}% + \iffieldundef{authortype} + {\setunit{\printdelim{nameyeardelim}}} + {\setunit{\printdelim{authortypedelim}}}}% + \iffieldundef{authortype} + {} + {\usebibmacro{authorstrg}% + \setunit{\printdelim{nameyeardelim}}}}% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\printdelim{nonameyeardelim}}}% + \usebibmacro{date+extradate}} + \renewbibmacro*{date+extradate}{% + \iffieldundef{labelyear} {} - {\printtext{%[parens]%这里把括号去掉 - \iffieldsequal{year}{\thefield{datelabelsource}year} - {\printdateextralabel}% - {\printfield{labelyear}% - \printfield{extrayear}}}}}% + {\printtext{%[parens]%这里去掉括号 + \iflabeldateisdate + {\printdateextra} + {\printlabeldateextra}}}}% } +\iftoggle{iftlfive}%%根据texlive/biblatex版本选择 + {\switchversion{3.4}{dateextra}}% + {\iftoggle{iftlsix}% + {\switchversion{3.4}{dateextra}}% + {\iftoggle{iftlseven}% + {\switchversion{3.7}{dateextra}}% + {\switchversion{3.8}{dateextra}}% + }% + } %修改译者位置格式,bytranslator+others原格式来自biblatex.def文件 \renewbibmacro*{bytranslator+others}{% @@ -947,7 +1141,8 @@ backrefpages = {引用页:}, test \ifmorenames } {%这里做一个判断是在处理author还是translator用于两者是不同语言的情况 - \ifcurrentname{translator}{\testCJKfirst{\thefield{usere}}}{\testCJKfirst{\thefield{userf}}}% + \ifcurrentname{translator}{\iffieldundef{usere}{\togglefalse{ifCJKforgbt}}{\testCJKfirst{\thefield{usere}}}}% + {\iffieldundef{usere}{\togglefalse{ifCJKforgbt}}{\testCJKfirst{\thefield{userf}}}}% %这句判断如果放到\andothersdelim后面会在等或etc.前增加一个空格,所以放前面 \ifnumgreater{\value{liststop}}{1} {\finalandcomma} @@ -964,7 +1159,7 @@ backrefpages = {引用页:}, %新增一个样式用于输出连续出版物的地址,单位,时间,%类似\newbibmacro*{publisher+location+date} \newbibmacro*{location+institution+date}{% \iftoggle{bbx:gbpub}% -{\testCJKfirst{\thefield{title}} +{\testCJKfirst{\thefield{userd}} \iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}% {\printlist{location}}% % \iflistundef{institution} @@ -994,18 +1189,15 @@ backrefpages = {引用页:}, \renewbibmacro*{publisher+location+date}{% \iftoggle{bbx:gbpub}% -{\testCJKfirst{\thefield{title}}% -%\testifnoteeqstd% +{\testCJKfirst{\thefield{userd}}% \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} {\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}}% }}% @@ -1162,16 +1354,16 @@ backrefpages = {引用页:}, \bibrangedash% \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% }% - {\gbt@parse@range{\thefield{volume}}% + {\multivolparser{\thefield{volume}}% \printfield{year}% \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\gbt@range@first}% + \printtext{\multivolfirst}% \printtext{\mkbibparens{\multinumberfirst}}% \bibrangedash% \iffieldundef{endyear}{}{% \printfield{endyear}% \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\gbt@range@second}% + \printtext{\multivolsecond}% \printtext{\mkbibparens{\multinumbersecond}}}% }% \setunit{\addcomma\space}% @@ -1301,7 +1493,7 @@ backrefpages = {引用页:}, % \usebibmacro{byauthor}% % \newunit\newblock % \usebibmacro{in:}% - \printtext{\texttt{//}\addnbthinspace}% + \printtext{\texttt{//}\addthinspace}% \usebibmacro{bybookauthor}% \ifnameundef{bookauthor}{}{\newunit\newblock}%替换下一句 %\newunit\newblock @@ -1408,7 +1600,7 @@ backrefpages = {引用页:}, % \usebibmacro{byauthor}% % \newunit\newblock % \usebibmacro{in:}% - \printtext{\texttt{//}\addnbthinspace}% + \printtext{\texttt{//}\addthinspace}% \usebibmacro{bybookauthor}% \ifnameundef{bookauthor}{}{\newunit\newblock}%替换下一句 %\newunit\newblock @@ -1792,7 +1984,7 @@ backrefpages = {引用页:}, % \usebibmacro{byauthor}% % \newunit\newblock %\usebibmacro{in:}% - \printtext{\texttt{//}\addnbthinspace}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后 + \printtext{\texttt{//}\addthinspace}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后 \usebibmacro{bybookauthor}%用类似inbook的方式处理 \ifnameundef{bookauthor}{}{\newunit\newblock}%替换下一句 %\newunit\newblock 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 05b2ff256fa..035877308e1 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 @@ -4,36 +4,64 @@ %% GBT7714-2015 citation style,author year sequence %% Maintained by huzhenzhen %% history: -%% 2016/05/20 v1.0 -%% 2016/10/23 v1.0a -%% 2016/11/11 v1.0b -%% 2016/11/14 v1.0c -%% 2016/11/24 v1.0d -%% 2016/12/07 v1.0e -%% 2017/02/26 v1.0g -%% 2017/04/11 v1.0h +%% 2016/05/20 v1.0 2016/10/23 v1.0a 2016/11/11 v1.0b +%% 2016/11/14 v1.0c 2016/11/24 v1.0d 2016/12/07 v1.0e +%% 2017/02/26 v1.0g 2017/04/11 v1.0h +%% 2017/11/21 v1.0i %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\ProvidesFile{gb7714-2015ay.cbx}[2017/04/11 v1.0h biblatex citation style] +\ProvidesFile{gb7714-2015ay.cbx}[2017/11/21 v1.0i biblatex citation style] \RequireCitationStyle{authoryear} %\RequireCitationStyle{numeric} -\ExecuteBibliographyOptions{ - %autocite = superscript , - %autopunct = true , - %sorting = none , - maxcitenames=1, - mincitenames=1, - uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突 - labeldate=true, - uniquelist=minyear, +\defversion{3.4}{cbxopt}{ + \ExecuteBibliographyOptions{ + %autocite = superscript , + %autopunct = true , + %sorting = none , + maxcitenames=1, + mincitenames=1, + uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突 + labeldate=true, + uniquelist=minyear + } } +\defversion{3.7}{cbxopt}{ + \ExecuteBibliographyOptions{ + %autocite = superscript , + %autopunct = true , + %sorting = none , + maxcitenames=1, + mincitenames=1, + uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突 + labeldateparts=true, + %labeldate=true, + uniquelist=minyear %minyear, + } +} + +\iftoggle{iftlfive} + {\switchversion{3.4}{cbxopt}}%%当采用texlive2015以下版本时 + {\iftoggle{iftlsix}% + {\switchversion{3.4}{cbxopt}}%%当采用texlive2016版本时 + {\iftoggle{iftlseven}% + {\switchversion{3.7}{cbxopt}}%%当采用texlive2017版本时 + {\switchversion{3.7}{cbxopt}}%%当采用biblatex3.8a版本时 + }% + } + +%当条目是set时,所有的信息都没有于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格 +\renewbibmacro*{cite:label}{% + \iffieldundef{label}% + {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey + {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}% + {\printtext[bibhyperref]{\printfield{label}}}} + %\DeclareCiteCommand{\cite}[\mkbibparens]{⟨precode⟩}{⟨loopcode⟩}{⟨sepcode⟩}{⟨postcode⟩} -% \DeclareCiteCommand{\cite}[\mkbibparens] {\usebibmacro{prenote}} {\usebibmacro{citeindex}% |