diff options
author | Karl Berry <karl@freefriends.org> | 2017-01-02 23:52:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-01-02 23:52:12 +0000 |
commit | aa1a932fe76016a8027d7db1c45d07963bf2f6d5 (patch) | |
tree | a3a9f83736a7d1c26aba11c7cf8f90d99e7baf84 /Master/texmf-dist/tex | |
parent | 1bdf1e01dea15d5b489d680cc0730a717f48c2c4 (diff) |
biblatex-gb7714-2015 (27dec16)
git-svn-id: svn://tug.org/texlive/trunk@42846 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
4 files changed, 1001 insertions, 925 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 a5f45c0a66b..e20501baad9 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 @@ -9,16 +9,20 @@ %% 2016/11/11 v1.0b %% 2016/11/14 v1.0c %% 2016/11/24 v1.0d +%% 2016/12/07 v1.0e %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\ProvidesFile{gb7714-2015.bbx}[2016/11/24 v1.0d biblatex bibliography style] +\ProvidesFile{gb7714-2015.bbx}[2016/12/07 v1.0e biblatex bibliography style] -% Load the standard style to avoid copy-pasting unnecessary material -\RequireBibliographyStyle{numeric-comp} %加载标准样式 +%===================================================================== +%加载标准样式 +\RequireBibliographyStyle{numeric-comp}%Load the standard style to avoid copy-pasting unnecessary material \RequireBibliographyStyle{standard} +%===================================================================== +%增加一些功能函数 \providetoggle{iftexlivesix} %版本判断,根据biblatex更新历史可知,版本3.3开始使用新的姓名机制 %所以当版本大于3.2开始,就用设置\toggletrue{iftexlivesix} @@ -28,130 +32,18 @@ \def\numdigital{\expandafter\numparsertb\abx@version\relax} \ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftexlivesix}}{\togglefalse{iftexlivesix}} -%设置一些全局选项 -% Alter settings that carry through from biblatex -\iftoggle{iftexlivesix} -{%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 -\ExecuteBibliographyOptions{ - sorting=none, - useprefix=true, %名字的信息包括前缀 - %firstinits=true, %名字有缩写,参考3.1.2.3 Internal - giveninits=true, - date = year, %日期仅写到年 - maxnames = 3 , %设置名字最大数量 - minnames = 3 %设置缩减后的名字最小数量 - %uniquename = init -} - -\newbibmacro*{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}}} - -} -{%biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 -\ExecuteBibliographyOptions{ - sorting=none, - useprefix=true, %名字的信息包括前缀 - firstinits=true, %名字有缩写,参考3.1.2.3 Internal - %giveninits=true, - date = year, %日期仅写到年 - maxnames = 3 , %设置名字最大数量 - minnames = 3 %设置缩减后的名字最小数量 - %uniquename = init -} -\newbibmacro*{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}% - }} - -\newbibmacro*{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}% - }} -} - -%定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成 -\providetoggle{ifCJKforgbt} +\providetoggle{ifCJKforgbt}%定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成 \def\testCJKfirstchar#1#2&{% -\ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}% +\ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}% +}% + \def\testCJKfirst#1{% -\edef\tempa{#1}% +%\edef\tempa{#1}% +\exploregroups% +\StrChar{#1}{1}[\tempa]% \expandafter\testCJKfirstchar\tempa&} -%判断是否是标准 -\providetoggle{ifnoteeqstandard} +\providetoggle{ifnoteeqstandard}%判断是否是标准 \def\testifnoteeqstd{% \iffieldundef{note}{\togglefalse{ifnoteeqstandard}}%判断一下,是否是标准 {\def\comparetmp{standard}\edef\comparetmpb{\thefield{note}}% @@ -161,67 +53,6 @@ \togglefalse{ifnoteeqstandard}% \fi}} -%修改序号标签格式为左对齐,注意各参考文献内容还是对齐的, -%这样就会使得序号标签与参考文献内容的间隔增大,这个问题是没有办法解决的 -%因为采用list做具有一定宽度的序号标签,\labelwidth只能设置一个,且是最宽的标签的宽度 -%但总的来说参考文献内容对齐是合理和漂亮的, -%而标签则只能对齐一个方向,要么左对齐要么右对齐,看个人选择了。 -%\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX -%\DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} -\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}\hfill} - -%默认的参考文献列表格式,放这里作为参考 -%\defbibenvironment{bibliography} -% {\list -% {\printtext[labelnumberwidth]{% -% \printfield{prefixnumber}% -% \printfield{labelnumber}}} -% {\setlength{\labelwidth}{\labelnumberwidth}% -% \setlength{\leftmargin}{\labelwidth}% -% \setlength{\labelsep}{\biblabelsep}% -% \addtolength{\leftmargin}{\labelsep}% -% \setlength{\itemsep}{\bibitemsep}% -% \setlength{\parsep}{\bibparsep}}% -% \renewcommand*{\makelabel}[1]{\hss##1}} -% {\endlist} -% {\item} - -%将名字简写后的点去掉 -%\renewrobustcmd*{\bibinitperiod}{\adddot} %来源biblatex2.STY -\renewrobustcmd*{\bibinitperiod}{} -%\newcommand*{\revsdnamepunct}{\addcomma} %来源biblatex.def -\renewcommand*{\revsdnamepunct}{} -%\newcommand*{\subtitlepunct}{\newunitpunct} %修改标题和其它标题信息间的标点 -\renewcommand*{\subtitlepunct}{\addcolon\space} %来源biblatex.def, - -%新建一个当地化字符串,用来记录“等”字符 -\NewBibliographyString{andotherscn} -\NewBibliographyString{noaddress} -\NewBibliographyString{nopublisher} - -%直接利用当地化格式english进行修改一些中文的格式, -%具体可以修改哪些需要的参考english.lbx文件 -%当然也可以增加比如上面定义的andotherscn -\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 = {引用页:}, -} - -%关于双语言或多语言的参考文献,可以参考3.11.5 Entry Sets,4.11.1 Entry Sets -%这里调整一下两种语言参考文献的间隔 -%\renewcommand*{\entrysetpunct}{\addsemicolon\space}%源来自biblatex.def -\renewcommand*{\entrysetpunct}{\adddot\par\nobreak} - - %用于解析连续出版物,2个卷期的情况 \def\multivolumeparsetoparts#1/#2{\def\multivolumefirst{#1}\def\multivolumesecond{#2}} %\def\multinumberparsetoparts#1/#2{\def\multinumberfirst{#1}\def\multinumbersecond{#2}} @@ -269,42 +100,67 @@ backrefpages = {引用页:}, \fi} -%修改译者位置格式,bytranslator+others原格式来自biblatex.def文件 -\newbibmacro*{bytranslator+others}{% - \ifnameundef{translator} - {} - {%\usebibmacro{bytranslator+othersstrg} - %\setunit{\addspace}% - \printnames[bytranslator]{translator}% - \clearname{translator}% - \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 - \setunit*{\addspace}% - \newunit}% - \usebibmacro{withothers}} +%===================================================================== +%设置宏包选项 +%增加标签对齐选项,right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 +\DeclareBibliographyOption[string]{align}[right]{% +\ifstrequal{#1}{left}{\setalignleft}{} +\ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} +} -%下面一段没有作用,但从中可以看到当地化字符串格式的引用前的代码处理 -%比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 -\newbibmacro*{bytranslator+othersstrg}{% - \def\abx@tempa{bytranslator}% - \ifnamesequal{translator}{commentator}% - {\appto\abx@tempa{co}% - \clearname{commentator}}% - {\ifnamesequal{translator}{annotator}% - {\appto\abx@tempa{an}% - \clearname{annotator}}% - {}}% - \ifnamesequal{translator}{introduction} - {\appto\abx@tempa{in}% - \clearname{introduction}}% - {\ifnamesequal{translator}{foreword}% - {\appto\abx@tempa{fo}% - \clearname{foreword}}% - {\ifnamesequal{translator}{afterword}% - {\appto\abx@tempa{af}% - \clearname{afterword}}% - {}}}% -\bibstring{\abx@tempa}} +% Alter settings that carry through from biblatex +\iftoggle{iftexlivesix} +{%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 +\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版)的使用方式 +\ExecuteBibliographyOptions{ + sorting=none, + useprefix=true, %名字的信息包括前缀 + firstinits=true, %名字有缩写,参考3.1.2.3 Internal + %giveninits=true, + date = year, %日期仅写到年 + maxnames = 3 , %设置名字最大数量 + minnames = 3 %设置缩减后的名字最小数量 + %uniquename = init +} +} + +%===================================================================== +%设置本地化字符串 +%新建一个当地化字符串,用来记录“等”字符 +\NewBibliographyString{andotherscn} +\NewBibliographyString{noaddress} +\NewBibliographyString{nopublisher} +%直接利用当地化格式english进行修改一些中文的格式, +%具体可以修改哪些需要的参考english.lbx文件 +%当然也可以增加比如上面定义的andotherscn +\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字符。 %注意\DeclareSourcemap命令只能出现一次 @@ -388,30 +244,97 @@ backrefpages = {引用页:}, \map{%将entrykey放入keywords中用于后期的使用 \step[fieldsource=entrykey] \step[fieldset=keywords, origfieldval] - \step[fieldsource=note,final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 - \step[fieldset=keywords, fieldvalue={,},append] - \step[fieldset=keywords, origfieldval,append] + } + \map[overwrite]{%这里还必须有overwrite,怎么之前会觉得没有问题呢,可能是之前版本拷错了,还是之前是texlive2015变16后biber有了变化(2016-1207修改正确) + \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 + \step[fieldset=keywords, fieldvalue={,}, append] + \step[fieldset=keywords, origfieldval, append] } } } -%判断作者或译者是否中文,若中文用字符等,否则用etcl。 -\newbibmacro*{name:andothers}{% - \ifboolexpr{% - test {\ifnumequal{\value{listcount}}{\value{liststop}}} - and - test \ifmorenames - }% - {%这里做一个判断是在处理author还是translator用于两者是不同语言的情况 - \ifcurrentname{translator}{\testCJKfirst{\thefield{usere}}}{\testCJKfirst{\thefield{userf}}}% - %这句判断如果放到\andothersdelim后面会在等或etc.前增加一个空格,所以放前面 - \ifnumgreater{\value{liststop}}{1}% - {\finalandcomma}% - {\finalandcomma}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 -\andothersdelim\iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{\bibstring{andothers}}% -%\andothersdelim\bibstring{andotherscn} -}% -{}} +%===================================================================== +%参考文献表环境 + +%默认的参考文献列表格式,放这里作为参考 +%\defbibenvironment{bibliography} + +%修改序号标签格式为左对齐,注意各参考文献内容还是对齐的, +%这样就会使得序号标签与参考文献内容的间隔增大,这个问题是没有办法解决的 +%因为采用list做具有一定宽度的序号标签,\labelwidth只能设置一个,且是最宽的标签的宽度 +%但总的来说参考文献内容对齐是合理和漂亮的, +%而标签则只能对齐一个方向,要么左对齐要么右对齐,看个人选择了。 +%\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX +%\DeclareFieldFormat{labelnumberwidth}{\ttfamily\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} + {\begingroup + \blx@getdata{##1}% + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \blx@setdefaultrefcontext{##1}% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \addtocounter{instcount}\@ne + \blx@initsep + \blx@namesep + \csuse{blx@item@\blx@theenv}\relax +% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 +% \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglangbib + \bibsentence + \blx@pagetracker + \blx@driver\abx@field@entrytype + \blx@postpunct + \blx@endlangbib}% + \par\endgroup}%这里增加了一个\par + {}} +\newcommand{\itemcmd}{% +\settowidth{\lengthid}{[\printfield{labelnumber}]} +\addtolength{\lengthid}{\biblabelsep} +\setlength{\lengthlw}{\textwidth} +\addtolength{\lengthlw}{-\lengthid} +\addvspace{\bibitemsep}%恢复\bibitemsep的作用 +%\parshape 2 0em \textwidth \lengthid \lengthlw +\hangindent\lengthid +[\printfield{labelnumber}]\hspace{\biblabelsep}} +\newlength{\lengthid} +\newlength{\lengthlw} +\defbibenvironment{bibliography} +{\begingroup\setlength{\parindent}{0em}} +{\endgroup} +{\itemcmd}} + + +%===================================================================== +%设置单元或块等的标点 +%\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\par\nobreak} +%页码引用格式的修改 +%\newcommand*{\bibpagespunct}{\addcomma\space} +\renewcommand*{\bibpagespunct}{\addcolon\space}%修改为用冒号 + +%===================================================================== +%修改域的格式 %新增文献类型标识符的格式 %\DeclareFieldFormat{gbtypeflag}{\nobreak\mkbibbrackets{\nobreak#1}\nobreak} @@ -466,12 +389,55 @@ backrefpages = {引用页:}, [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.等字符 + +%修改译者位置格式,bytranslator+others原格式来自biblatex.def文件 +\renewbibmacro*{bytranslator+others}{% + \ifnameundef{translator} + {} + {%\usebibmacro{bytranslator+othersstrg} + %\setunit{\addspace}% + \printnames[bytranslator]{translator}% + \clearname{translator}% + \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 + \setunit*{\addspace}% + \newunit}% + \usebibmacro{withothers}} + +%下面一段没有作用,但从中可以看到当地化字符串格式的引用前的代码处理 +%比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 +%\renewbibmacro*{bytranslator+othersstrg}{% + +%判断作者或译者是否中文,若中文用字符等,否则用etcl。 +\renewbibmacro*{name:andothers}{% + \ifboolexpr{% + test {\ifnumequal{\value{listcount}}{\value{liststop}}} + and + test \ifmorenames + }% + {%这里做一个判断是在处理author还是translator用于两者是不同语言的情况 + \ifcurrentname{translator}{\testCJKfirst{\thefield{usere}}}{\testCJKfirst{\thefield{userf}}}% + %这句判断如果放到\andothersdelim后面会在等或etc.前增加一个空格,所以放前面 + \ifnumgreater{\value{liststop}}{1}% + {\finalandcomma}% + {\finalandcomma}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 +\andothersdelim\iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{\bibstring{andothers}}% +%\andothersdelim\bibstring{andotherscn} +}% +{}} + %重设title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件 -\newbibmacro*{title}{% +\renewbibmacro*{title}{% \ifboolexpr{% test{\iffieldundef{title}}% and% @@ -503,12 +469,97 @@ backrefpages = {引用页:}, }% } -%url相关输出,源来自biblatex.def -%\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{#1}} -\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行 -%\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\space#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 + \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}}} +} +{%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}% + }} +} -\newbibmacro*{url+urldate}{% +\renewbibmacro*{url+urldate}{% %\usebibmacro{url}%%更换url的位置,放到下面 \iffieldundef{urlyear}% {}{%\setunit*{\addspace}% @@ -516,11 +567,12 @@ backrefpages = {引用页:}, \setunit{\addperiod\addspace}% \usebibmacro{url}} -\newbibmacro*{url}{\printfield{url}} +\renewbibmacro*{url}{\printfield{url}} %\newbibmacro*{urldate}{\printurldate} %引用时间修改如下一行,即带方括号 -\newbibmacro*{urldate}{% -%\iffieldundef{year}{}{\nopunct}%%这里增加了这一句是为了把year后直接跟urlyear中间的点去掉。这已经没有必要了在driver中去掉点了。 -\addspace\printtext{[}\printfield{urlyear}\bibrangedash\printfield{urlmonth}\bibrangedash\printfield{urlday}\printtext{]}} +\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}}% @@ -533,16 +585,9 @@ backrefpages = {引用页:}, \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% }}% - -%页码引用格式的修改 -%\newcommand*{\bibpagespunct}{\addcomma\space} -\renewcommand*{\bibpagespunct}{\addcolon\space}%修改为用冒号 -%\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{#1}} -\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符 - %调整doi+eprint+url格式,源来自standard.bbx %因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 -\newbibmacro*{doi+eprint+url}{% +\renewbibmacro*{doi+eprint+url}{% % \iftoggle{bbx:doi}%把doi的位置放到url后面 % {\printfield{doi}} % {}% @@ -559,7 +604,7 @@ backrefpages = {引用页:}, {\printfield{doi}} {}} -\newbibmacro*{chapter+pages}{% +\renewbibmacro*{chapter+pages}{% \printfield{chapter}% \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 \setunit{\bibpagespunct}% @@ -570,7 +615,7 @@ backrefpages = {引用页:}, %出版社和地址的处理,当没有出版社地址时 %直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 %事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 -\newbibmacro*{publisher+location+date}{% +\renewbibmacro*{publisher+location+date}{% \testCJKfirst{\thefield{title}}% \testifnoteeqstd% \iflistundef{location}{%\adddot @@ -582,7 +627,7 @@ backrefpages = {引用页:}, \iftoggle{ifnoteeqstandard}{}{% \iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% -{\printlist{publisher}\addcomma\addspace}% +{\printlist{publisher}\setunit*{\addcomma\addspace}}% %\addcomma\addspace% \usebibmacro{date}% %\newunit %去掉这个标点 @@ -607,66 +652,8 @@ backrefpages = {引用页:}, {\mkbibordedition{#1}~\bibstring{version}}}% {#1\isdot}} - - -%book条目类的驱动,源来自standard.bbx文件 - \DeclareBibliographyDriver{book}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% -\usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{%这一段用于去除作者不存在时多出的标点 -\ifnameundef{editor}{% -\ifnameundef{translator}{\relax}% -{\setunit{\labelnamepunct}\newblock}}% -{\setunit{\labelnamepunct}\newblock}}% -{\setunit{\labelnamepunct}\newblock}%这个注释去除标题前空格 -\usebibmacro{maintitle+title}% -\newunit -\printlist{language}% -\newunit\newblock% -\usebibmacro{byauthor}% -\newunit\newblock% -\usebibmacro{byeditor+others}% -\newunit\newblock% -\printfield{edition}% -\newunit% -\iffieldundef{maintitle}% -{\printfield{volume}% -\printfield{part}}% -{}% -\newunit% -\printfield{volumes}% -\newunit\newblock% -\usebibmacro{series+number}% -\newunit\newblock% -%\printfield{note}% -%\newunit\newblock% -\usebibmacro{publisher+location+date}% -%\newunit\newblock %这里标点去掉 -\usebibmacro{chapter+pages}% -\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 - \newunit\newblock% - %\newunit - \printfield{pagetotal}% - \newunit\newblock% - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}} - %调整期刊名的格式,源来自standard.bbx -\newbibmacro*{journal+issuetitle}{% +\renewbibmacro*{journal+issuetitle}{% \usebibmacro{journal}% %\setunit*{\addspace}% \setunit*{\addcomma\addspace}%修改为增加一个逗号 @@ -687,7 +674,7 @@ backrefpages = {引用页:}, } %调整期刊年份的格式,去掉括号 -\newbibmacro*{issue+date}{% +\renewbibmacro*{issue+date}{% \printtext{%去掉了[parens] \iffieldundef{issue} {%\usebibmacro{date} @@ -715,7 +702,8 @@ backrefpages = {引用页:}, } %调整期刊卷和期的格式,源来自standard.bbx -\newbibmacro*{volume+number+eid}{% +\renewbibmacro*{volume+number+eid}{% +%\ifnumerals{\thefield{volume}}{htruei}{hfalsei} \printfield{volume}% %\setunit*{\adddot}%去掉点号 %\printfield{number}% @@ -725,7 +713,7 @@ backrefpages = {引用页:}, \printfield{eid}}} %调整页码前的标点和去掉期刊文章等页码后面的标点,源来自standard.bbx -\newbibmacro*{note+pages}{% +\renewbibmacro*{note+pages}{% %\printfield{note}%不要note,note用来判断是否是报纸newspaper \iffieldundef{pages}{}{ \setunit{\bibpagespunct}% @@ -733,49 +721,8 @@ backrefpages = {引用页:}, %\newunit } - -%期刊文章,连续出版物中的析出文献的格式 - \DeclareBibliographyDriver{article}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% - \setunit{\labelnamepunct}\newblock - \usebibmacro{title}% - \newunit - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{bytranslator+others}% - \newunit\newblock - \printfield{version}% - \newunit\newblock - %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 - \usebibmacro{journal+issuetitle}% - %\newunit -% \usebibmacro{byeditor+others}% -% \newunit - \usebibmacro{note+pages}% - \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}} - %修改析出文献的文集的标题与附加标题间的符号 -\newbibmacro*{booktitle}{% +\renewbibmacro*{booktitle}{% \ifboolexpr{ test {\iffieldundef{booktitle}} and @@ -790,66 +737,8 @@ backrefpages = {引用页:}, \setunit{\subtitlepunct}}% \printfield{booktitleaddon}} - -%专著中的析出文献的格式修改,源来自standard.bbx -\DeclareBibliographyDriver{inbook}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{%这一段用于去除作者不存在时多出的标点 -\ifnameundef{editor}{% -\ifnameundef{translator}{\relax}% -{\setunit{\labelnamepunct}\newblock}}% -{\setunit{\labelnamepunct}\newblock}}% -{\setunit{\labelnamepunct}\newblock}% -%\setunit{\labelnamepunct}\newblock -\usebibmacro{title}% -%\nopunct -\printtext{\texttt{//}}% -%\texttt{//} -\usebibmacro{bybookauthor}% -\ifnameundef{bookauthor}{\newblock}{\newunit\newblock}%替换下一句 -%\newunit\newblock -\usebibmacro{maintitle+booktitle}% - \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock - \printfield{edition}% - \newunit - \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% - \newunit - \printfield{volumes}% - \newunit\newblock - \usebibmacro{series+number}% - \newunit\newblock - %\printfield{note}% - %\newunit\newblock - \usebibmacro{publisher+location+date}% -%\newunit\newblock - \usebibmacro{chapter+pages}% - \usebibmacro{doi+eprint+url}%移到上面来 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}} - %编者的符号修改一下,源来自biblatex.DEF -\newbibmacro*{editor}{% +\renewbibmacro*{editor}{% \ifboolexpr{ test \ifuseeditor and @@ -864,7 +753,7 @@ backrefpages = {引用页:}, {}} %编者类型做一修改,源来自biblatex.DEF -\newbibmacro*{editorstrg}{% +\renewbibmacro*{editorstrg}{% \printtext[editortype]{% \iffieldundef{editortype} { @@ -887,7 +776,7 @@ backrefpages = {引用页:}, {\thefield{editortype}}}}} %修改期刊的标题,源来自biblatex.DEF -\newbibmacro*{periodical}{% +\renewbibmacro*{periodical}{% \iffieldundef{title} {} {\printtext[title]{% @@ -904,7 +793,7 @@ backrefpages = {引用页:}, } %期刊的标题做修改,源来自standard.BBX -\newbibmacro*{title+issuetitle}{% +\renewbibmacro*{title+issuetitle}{% \usebibmacro{periodical}% %\setunit*{\addspace}% \setunit*{\adddot\addspace}%标点修改为句点 @@ -978,6 +867,197 @@ backrefpages = {引用页:}, \iffieldundef{endyear}{}{\printfield{endyear}}% \newunit} +%重设专利title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件 +\newbibmacro*{patenttitle}{% + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \setunit{\subtitlepunct}\printfield{number}%写专利号 + \printfield[gbtypeflag]{usera}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}% +} + +%修改了一个institution+location+date用于report等的,当没有institution时不处理。 +\renewbibmacro*{institution+location+date}{% + \printlist{location}% + \iflistundef{institution} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + %\usebibmacro{modifydate}% + %\newunit + } + +%===================================================================== +%设置驱动格式 +%book条目类的驱动,源来自standard.bbx文件 + \DeclareBibliographyDriver{book}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% +\usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{%这一段用于去除作者不存在时多出的标点 +\ifnameundef{editor}{% +\ifnameundef{translator}{\relax}% +{\setunit{\labelnamepunct}\newblock}}% +{\setunit{\labelnamepunct}\newblock}}% +{\setunit{\labelnamepunct}\newblock}%这个注释去除标题前空格 +\usebibmacro{maintitle+title}% +\newunit +\printlist{language}% +\newunit\newblock% +\usebibmacro{byauthor}% +\newunit\newblock% +\usebibmacro{byeditor+others}% +\newunit\newblock% +\printfield{edition}% +\newunit% +\iffieldundef{maintitle}% +{\printfield{volume}% +\printfield{part}}% +{}% +\newunit% +\printfield{volumes}% +\newunit\newblock% +\usebibmacro{series+number}% +\newunit\newblock% +%\printfield{note}% +%\newunit\newblock% +\usebibmacro{publisher+location+date}% +%\newunit\newblock %这里标点去掉 +\usebibmacro{chapter+pages}% +\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 + \newunit\newblock% + %\newunit + \printfield{pagetotal}% + \newunit\newblock% + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}} + +%期刊文章,连续出版物中的析出文献的格式 + \DeclareBibliographyDriver{article}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% + \setunit{\labelnamepunct}\newblock + \usebibmacro{title}% + \newunit + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{bytranslator+others}% + \newunit\newblock + \printfield{version}% + \newunit\newblock + %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 + \usebibmacro{journal+issuetitle}% + %\newunit +% \usebibmacro{byeditor+others}% +% \newunit + \usebibmacro{note+pages}% + \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}} + +%专著中的析出文献的格式修改,源来自standard.bbx +\DeclareBibliographyDriver{inbook}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{%这一段用于去除作者不存在时多出的标点 +\ifnameundef{editor}{% +\ifnameundef{translator}{\relax}% +{\setunit{\labelnamepunct}\newblock}}% +{\setunit{\labelnamepunct}\newblock}}% +{\setunit{\labelnamepunct}\newblock}% +%\setunit{\labelnamepunct}\newblock +\usebibmacro{title}% +%\nopunct +\printtext{\texttt{//}}% +%\texttt{//} +\usebibmacro{bybookauthor}% +\ifnameundef{bookauthor}{\newblock}{\newunit\newblock}%替换下一句 +%\newunit\newblock +\usebibmacro{maintitle+booktitle}% + \newunit\newblock + \usebibmacro{byeditor+others}% + \newunit\newblock + \printfield{edition}% + \newunit + \iffieldundef{maintitle} + {\printfield{volume}% + \printfield{part}} + {}% + \newunit + \printfield{volumes}% + \newunit\newblock + \usebibmacro{series+number}% + \newunit\newblock + %\printfield{note}% + %\newunit\newblock + \usebibmacro{publisher+location+date}% +%\newunit\newblock + \usebibmacro{chapter+pages}% + \usebibmacro{doi+eprint+url}%移到上面来 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}} + %修改连续出版物的驱动,源来自standard.BBX \DeclareBibliographyDriver{periodical}{% \usebibmacro{bibindex}% @@ -1011,31 +1091,6 @@ backrefpages = {引用页:}, {}% \usebibmacro{finentry}} - -%重设专利title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件 -\newbibmacro*{patenttitle}{% - \ifboolexpr{% - test{\iffieldundef{title}}% - and% - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{% - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \setunit{\subtitlepunct}\printfield{number}%写专利号 - \printfield[gbtypeflag]{usera}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}% -} - - %处理专利文献,源来自standard.BBX \DeclareBibliographyDriver{patent}{% \usebibmacro{bibindex}% @@ -1161,18 +1216,6 @@ backrefpages = {引用页:}, {}% \usebibmacro{finentry}} -\newbibmacro*{institution+location+date}{% - \printlist{location}% - \iflistundef{institution} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - %\usebibmacro{modifydate}% - %\newunit - } - %2016-11-11增加了译者信息 \DeclareBibliographyDriver{report}{% \usebibmacro{bibindex}% diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx index 404e52e8df2..2198deb8603 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 @@ -9,11 +9,12 @@ %% 2016/11/11 v1.0b %% 2016/11/14 v1.0c %% 2016/11/24 v1.0d +%% 2016/12/07 v1.0e %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\ProvidesFile{gb7714-2015.cbx}[2016/11/24 v1.0d biblatex citation style] +\ProvidesFile{gb7714-2015.cbx}[2016/12/07 v1.0e biblatex citation style] \RequireCitationStyle{numeric-comp} %\RequireCitationStyle{numeric} @@ -35,14 +36,14 @@ {\usebibmacro{cite:dump}% \usebibmacro{postnote}]} -\DeclareCiteCommand{\parencite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}% - \usebibmacro{postnote}]} +%\DeclareCiteCommand{\parencite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 +% {[\usebibmacro{cite:init}% +% \usebibmacro{prenote}} +% {\usebibmacro{citeindex}% +% \usebibmacro{cite:comp}} +% {} +% {\usebibmacro{cite:dump}% +% \usebibmacro{postnote}]} \newbibmacro*{postpages}{% \iffieldundef{postnote} 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 98751e89e90..e5e0cb13bec 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 @@ -9,15 +9,19 @@ %% 2016/11/11 v1.0b %% 2016/11/14 v1.0c %% 2016/11/24 v1.0d +%% 2016/12/07 v1.0e %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\ProvidesFile{gb7714-2015ay.bbx}[2016/11/24 v1.0d biblatex bibliography style] +\ProvidesFile{gb7714-2015ay.bbx}[2016/12/07 v1.0e biblatex bibliography style] -% Load the standard style to avoid copy-pasting unnecessary material -\RequireBibliographyStyle{authoryear} %加载标准样式 +%===================================================================== +%加载标准样式 +\RequireBibliographyStyle{authoryear} % Load the standard style to avoid copy-pasting unnecessary material +%===================================================================== +%增加一些功能函数 \providetoggle{iftexlivesix} %版本判断,根据biblatex更新历史可知,版本3.3开始使用新的姓名机制 %所以当版本大于3.2开始,就用设置\toggletrue{iftexlivesix} @@ -27,155 +31,16 @@ \def\numdigital{\expandafter\numparsertb\abx@version\relax} \ifnumcomp{\numdigital}{>}{2}{\toggletrue{iftexlivesix}}{\togglefalse{iftexlivesix}} -%设置一些全局选项 -% Alter settings that carry through from biblatex -\iftoggle{iftexlivesix}{ -%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 -\ExecuteBibliographyOptions{ - useprefix = true, %名字的信息包括前缀 - %firstinits = true, %名字有缩写,参考3.1.2.3 Internal - giveninits = true, - date = year, %日期仅写到年 - %maxnames = 3 , %设置名字最大数量 - %minnames = 3, %设置缩减后的名字最小数量 - maxbibnames=3, %将文献列表和引用中最大名字数量区分开 - minbibnames=3, -} - -\newbibmacro*{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}}} - -\newbibmacro*{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}}} - -} -{ -%biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 -\ExecuteBibliographyOptions{ - useprefix = true, %名字的信息包括前缀 - firstinits = true, %名字有缩写,参考3.1.2.3 Internal - date = year, %日期仅写到年 - %maxnames = 3 , %设置名字最大数量 - %minnames = 3, %设置缩减后的名字最小数量 - maxbibnames=3, %将文献列表和引用中最大名字数量区分开 - minbibnames=3, - %uniquename=init, -} - -%作者名字的处理,参考文档4.2.3节,3.12.4 Name Parts and Name Spacing -\newbibmacro*{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}% - }} - -\newbibmacro*{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}% - }} -} - %定义判断中文字符的函数,用于判断作者等信息是否由中文字符构成 \providetoggle{ifCJKforgbt} \def\testCJKfirstchar#1#2&{% -\ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}% +\ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}% +}% + \def\testCJKfirst#1{% -\edef\tempa{#1}% +%\edef\tempa{#1}% +\exploregroups% +\StrChar{#1}{1}[\tempa]% \expandafter\testCJKfirstchar\tempa&} %判断是否是标准 @@ -189,41 +54,6 @@ \togglefalse{ifnoteeqstandard}% \fi}} -%将名字简写后的点去掉 -%\renewrobustcmd*{\bibinitperiod}{\adddot} %来源biblatex2.STY -\renewrobustcmd*{\bibinitperiod}{} -%\newcommand*{\revsdnamepunct}{\addcomma} %来源biblatex.def -\renewcommand*{\revsdnamepunct}{} -%\newcommand*{\subtitlepunct}{\newunitpunct} %修改标题和其它标题信息间的标点 -\renewcommand*{\subtitlepunct}{\addcolon\space} %来源biblatex.def - -%新建一个当地化字符串,用来记录“等”字符 -\NewBibliographyString{andotherscn} -\NewBibliographyString{noaddress} -\NewBibliographyString{nopublisher} - -%直接利用当地化格式english进行修改一些中文的格式, -%具体可以修改哪些需要的参考english.lbx文件 -%当然也可以增加比如上面定义的andotherscn -\DefineBibliographyStrings{english}{ -bibliography = {参考文献}, -references = {参考文献}, -bytranslator= {\addcomma\ 译\adddot}, %将trans. by 改成 译 -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 = {引用页:}, -} - -%关于双语言或多语言的参考文献,可以参考3.11.5 Entry Sets,4.11.1 Entry Sets -%这里调整一下两种语言参考文献的间隔 -%\renewcommand*{\entrysetpunct}{\addsemicolon\space}%源来自biblatex.def -\renewcommand*{\entrysetpunct}{\adddot\par\nobreak} - - %用于解析连续出版物,2个卷期的情况 \def\multivolumeparsetoparts#1/#2{\def\multivolumefirst{#1}\def\multivolumesecond{#2}} %\def\multinumberparsetoparts#1/#2{\def\multinumberfirst{#1}\def\multinumbersecond{#2}} @@ -270,8 +100,61 @@ backrefpages = {引用页:}, \multinumberparsetopartsb#2\@empty% \fi} +%===================================================================== +%设置宏包选项 +%增加标签对齐选项,right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 +%因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。 +\DeclareBibliographyOption[string]{align}[right]{}% + +\iftoggle{iftexlivesix}{% Alter settings that carry through from biblatex +%biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 +\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版)的使用方式 +\ExecuteBibliographyOptions{ + useprefix = true, %名字的信息包括前缀 + firstinits = true, %名字有缩写,参考3.1.2.3 Internal + date = year, %日期仅写到年 + %maxnames = 3 , %设置名字最大数量 + %minnames = 3, %设置缩减后的名字最小数量 + maxbibnames=3, %将文献列表和引用中最大名字数量区分开 + minbibnames=3, + %uniquename=init, +}} + +%===================================================================== +%设置本地化字符串 +%新建一个当地化字符串,用来记录“等”字符 +\NewBibliographyString{andotherscn} +\NewBibliographyString{noaddress} +\NewBibliographyString{nopublisher} -%修改输入的源文件数据,用于中文判断等 +%直接利用当地化格式english进行修改一些中文的格式, +%具体可以修改哪些需要的参考english.lbx文件 +%当然也可以增加比如上面定义的andotherscn +\DefineBibliographyStrings{english}{ +bibliography = {参考文献}, +references = {参考文献}, +bytranslator= {\addcomma\ 译\adddot}, %将trans. by 改成 译 +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字符。 %注意\DeclareSourcemap命令只能出现一次 \DeclareSourcemap{ @@ -365,13 +248,15 @@ backrefpages = {引用页:}, \map{%将entrykey放入keywords中用于后期的使用 \step[fieldsource=entrykey] \step[fieldset=keywords, origfieldval] - \step[fieldsource=note,final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 - \step[fieldset=keywords, fieldvalue={,},append] - \step[fieldset=keywords, origfieldval,append] + } + \map[overwrite]{%这里还必须有overwrite,怎么之前会觉得没有问题呢,可能是之前版本拷错了,还是之前是texlive2015变16后biber有了变化(2016-1207修改正确) + \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 + \step[fieldset=keywords, fieldvalue={,}, append] + \step[fieldset=keywords, origfieldval, append] } \map{%因为无法进行cjk字符判断,所以用反的思路,判断没有英文字符,没有空格,没有逗号等字符情况下 %认为是中文的,将文献userb设置成cn,用于排序 - \step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}]},final] + \step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\-]},final] \step[fieldset=userb,fieldvalue={cn}] } \map{%将没有设置的userb设置成en,即认为不是中文的就是英文的。 @@ -380,7 +265,8 @@ backrefpages = {引用页:}, } } - +%===================================================================== +%设置排序格式 %排序用降序或userb域 \DeclareSortingScheme{nyt}{ \sort{ @@ -414,6 +300,42 @@ backrefpages = {引用页:}, } } +%===================================================================== +%参考文献列表环境 + \defbibenvironment{bibliography}%修改参考文献列表环境,不要缩进 + {\list + {} + {%\setlength{\leftmargin}{\bibhang}% + %\setlength{\itemindent}{-\leftmargin}% + \setlength{\leftmargin}{0pt}% + \setlength{\itemindent}{0pt}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}} + {\endlist} + {\item} + +%===================================================================== +%设置单元或块等的标点 +%将名字简写后的点去掉 +%\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\par\nobreak} + +%页码引用格式的修改 +%\newcommand*{\bibpagespunct}{\addcomma\space} +\renewcommand*{\bibpagespunct}{\addcolon\space}%修改为用冒号 + + +%===================================================================== +%修改域的格式 %新增文献类型标识符的格式 %\DeclareFieldFormat{gbtypeflag}{\nobreak\mkbibbrackets{\nobreak#1}\nobreak} \DeclareFieldFormat{gbtypeflag}{% @@ -456,8 +378,126 @@ backrefpages = {引用页:}, %\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}}} + +} +{%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}% + }} +} + %重设title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件 -\newbibmacro*{title}{% +\renewbibmacro*{title}{% \ifboolexpr{% test{\iffieldundef{title}}% and% @@ -494,7 +534,7 @@ backrefpages = {引用页:}, \DeclareFieldFormat{url}{\url{#1}} %url域修改如本行 %\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\space#1}} -\newbibmacro*{url+urldate}{% +\renewbibmacro*{url+urldate}{% %\usebibmacro{url}%%更换url的位置,放到下面 \iffieldundef{urlyear}% {}{%\setunit*{\addspace}% @@ -502,9 +542,12 @@ backrefpages = {引用页:}, \setunit{\addperiod\addspace}% \usebibmacro{url}} -\newbibmacro*{url}{\printfield{url}} +\renewbibmacro*{url}{\printfield{url}} %\newbibmacro*{urldate}{\printurldate} %引用时间修改如下一行 -\newbibmacro*{urldate}{\addspace\printtext{[}\printfield{urlyear}\bibrangedash\printfield{urlmonth}\bibrangedash\printfield{urlday}\printtext{]}} +\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}}% @@ -517,15 +560,12 @@ backrefpages = {引用页:}, \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% }}% -%页码引用格式的修改 -%\newcommand*{\bibpagespunct}{\addcomma\space} -\renewcommand*{\bibpagespunct}{\addcolon\space}%修改为用冒号 -%\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{#1}} +%\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{#1}}%页码引用格式的修改 \DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符 %调整doi+eprint+url格式,源来自standard.bbx %因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 -\newbibmacro*{doi+eprint+url}{% +\renewbibmacro*{doi+eprint+url}{% % \iftoggle{bbx:doi}%把doi的位置放到url后面 % {\printfield{doi}} % {}% @@ -542,7 +582,7 @@ backrefpages = {引用页:}, {\printfield{doi}} {}} -\newbibmacro*{chapter+pages}{% +\renewbibmacro*{chapter+pages}{% \printfield{chapter}% \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 \setunit{\bibpagespunct}% @@ -606,7 +646,7 @@ backrefpages = {引用页:}, \printfield{extrayear}}}}}% %修改译者位置格式,bytranslator+others原格式来自biblatex.def文件 -\newbibmacro*{bytranslator+others}{% +\renewbibmacro*{bytranslator+others}{% \ifnameundef{translator} {} {%\usebibmacro{bytranslator+othersstrg} @@ -619,7 +659,7 @@ backrefpages = {引用页:}, \usebibmacro{withothers}} %判断作者或译者是否中文,若中文用字符等,否则用etal。 -\newbibmacro*{name:andothers}{% +\renewbibmacro*{name:andothers}{% \ifboolexpr{ test {\ifnumequal{\value{listcount}}{\value{liststop}}} and @@ -639,7 +679,7 @@ backrefpages = {引用页:}, %出版社和地址的处理,当没有出版社地址时 %直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 %事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 -\newbibmacro*{publisher+location+date}{% +\renewbibmacro*{publisher+location+date}{% \iffieldundef{title}{}{\testCJKfirst{\thefield{title}}}% \testifnoteeqstd% \iflistundef{location}{%\adddot @@ -659,6 +699,248 @@ backrefpages = {引用页:}, %\newunit %去掉这个标点 } +%修改析出文献的文集的标题与附加标题间的符号 +\renewbibmacro*{booktitle}{% + \ifboolexpr{ + test {\iffieldundef{booktitle}} + and + test {\iffieldundef{booksubtitle}} + } + {} + {\printtext[booktitle]{% + \printfield[titlecase]{booktitle}% + \setunit{\subtitlepunct}% + \printfield[titlecase]{booksubtitle}}% + \newunit%标点换成下一句 + \setunit{\subtitlepunct}}% + \printfield{booktitleaddon}} + +%调整期刊名的格式,源来自standard.bbx +\renewbibmacro*{journal+issuetitle}{% + \usebibmacro{journal}% + %\setunit*{\addspace}% + \setunit*{\addcomma\addspace}%修改为增加一个逗号 + \iffieldundef{series} + {} + {\newunit + \printfield{series}% + \setunit{\addspace}}% + %\usebibmacro{volume+number+eid}% + %\setunit{\addspace}% + \usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \iffieldundef{volume}{}{\setunit{\addcomma\space}}% + %换成逗号和空格 + \usebibmacro{issue}% + \usebibmacro{volume+number+eid}%把卷期放到年份后面 + %\newunit + } + +%调整期刊年份的格式,去掉括号 +\renewbibmacro*{issue+date}{% + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸和标准 + {\def\comparetmp{news}\edef\comparetmpb{\thefield{note}}% + \ifx\comparetmp\comparetmpb% + \usebibmacro{newsdate}% + \else% + \usebibmacro{date}% + \fi}% + } + {\printfield{issue}% + \setunit*{\addspace}% + %\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸和标准 + {\def\comparetmp{news}\edef\comparetmpb{\thefield{note}}% + \ifx\comparetmp\comparetmpb% + \usebibmacro{newsdate}% + \else% + \usebibmacro{date}% + \fi}% + }% + }% + %\newunit + } + +%调整期刊卷和期的格式,源来自standard.bbx +\renewbibmacro*{volume+number+eid}{% + \printfield{volume}% + %\setunit*{\adddot}%去掉点号 + %\printfield{number}% + \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 + \iffieldundef{eid}{}{% + \setunit{\addcomma\space}% + \printfield{eid}}} + +%调整页码前的标点和去掉期刊文章等页码后面的标点,源来自standard.bbx +\renewbibmacro*{note+pages}{% + %\printfield{note}%不要note,note用来判断是否是报纸newspaper + \iffieldundef{pages}{}{ + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit + } + +%编者类型做一修改,源来自biblatex.DEF +\renewbibmacro*{editorstrg}{% + \printtext[editortype]{% + \iffieldundef{editortype} + { +% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 +% test {\ifnumgreater{\value{editor}}{1}} +% or +% test {\ifandothers{editor}} +% } +% {\bibstring{editors}} +% {\bibstring{editor}} + } + {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 + {\ifboolexpr{ + test {\ifnumgreater{\value{editor}}{1}} + or + test {\ifandothers{editor}} + } + {\bibstring{\thefield{editortype}s}} + {\bibstring{\thefield{editortype}}}} + {\thefield{editortype}}} + }} + +%修改期刊的标题,源来自biblatex.DEF +\renewbibmacro*{periodical}{% + \iffieldundef{title} + {} + {\printtext[title]{% + \printfield[titlecase]{title}% + %\setunit{\subtitlepunct}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct} + \printfield[titlecase]{subtitle}}% + %}%把编组结束移到后面去 + \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 + \printfield[gbtypeflag]{usera}} + }} + } + +%期刊的标题做修改,源来自standard.BBX +\renewbibmacro*{title+issuetitle}{% + \usebibmacro{periodical}% + %\setunit*{\addspace}% + \setunit*{\adddot\addspace}%标点修改为句点 + \iffieldundef{series} + {} + {\newunit + \printfield{series}% + \setunit{\addspace}}% + \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 +\iffieldundef{number}{}{%%进一步处理有范围的数字 + \multinumberparser{\thefield{number}}}% + \iffieldundef{volume}% + {\printfield{year}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% + }% + {\gbt@parse@range{\thefield{volume}}% + \printfield{year}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\gbt@range@first}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{% + \printfield{endyear}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\gbt@range@second}% + \printtext{\mkbibparens{\multinumbersecond}}}% + }% + \setunit{\addcomma\space}% + \printfield{eid}% + \setunit{\addspace}% + %\usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \usebibmacro{issue}% + \newunit} + +%新增一个样式用于调整期刊年份的格式,只打印年份 +\newbibmacro*{periodical+issue}{% + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date}%修改为下一句 + }% + {\printfield{issue}% + \setunit*{\addspace}% + %\usebibmacro{date}%修改为下一句 + }% + }% + %\newunit +} + +%新增一个样式用于输出连续出版物的地址,单位,时间 +%类似与上面的\newbibmacro*{publisher+location+date} +\newbibmacro*{location+institution+date}{% +\testCJKfirst{\thefield{title}} +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +% \iflistundef{institution} +% {\setunit*{\addcomma\space}} +% {\setunit*{\addcolon\space}}% +% \printlist{institution}% +% \setunit*{\addcomma\space}% +\addcolon\addspace% +\iflistundef{institution}{% +%注意这里\printtext{\mkbibbrackets{s.n.}}和\printtext{[s.n.\adddot]}是不同的,这里的]不影响标点追踪, +%这里要理解的是newunit插入的是period,看def中的命令:\newcommand*{\newunitpunct}{\addperiod\space},\newcommand*{\finentrypunct}{\addperiod} +\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}}{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}}}% \bibstring{nopublisher} +{\printlist{institution}}% +\setunit{\addcomma\addspace}% + %\usebibmacro{date}% +% \printfield{year}% +% \bibrangedash% +% \iffieldundef{endyear}{}{\printfield{endyear}}% + \newunit% +} + +%重设专利title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件 +\newbibmacro*{patenttitle}{% + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \setunit{\subtitlepunct}\printfield{number}%写专利号 + \printfield[gbtypeflag]{usera}% + \iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}% +} + +%修改了一个institution+location+date用于report等的,当没有institution时不处理。 +\renewbibmacro*{institution+location+date}{% + \printlist{location}% + \iflistundef{institution} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + %\usebibmacro{modifydate}% + %\newunit + } + + +%===================================================================== +%设置驱动格式 + %修改book的驱动,源来自standard.BBX \DeclareBibliographyDriver{book}{% \usebibmacro{bibindex}% @@ -710,35 +992,6 @@ backrefpages = {引用页:}, {}% \usebibmacro{finentry}} -%修改参考文献列表环境,不要缩进 - \defbibenvironment{bibliography} - {\list - {} - {%\setlength{\leftmargin}{\bibhang}% - %\setlength{\itemindent}{-\leftmargin}% - \setlength{\leftmargin}{0pt}% - \setlength{\itemindent}{0pt}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}} - {\endlist} - {\item} - -%修改析出文献的文集的标题与附加标题间的符号 -\newbibmacro*{booktitle}{% - \ifboolexpr{ - test {\iffieldundef{booktitle}} - and - test {\iffieldundef{booksubtitle}} - } - {} - {\printtext[booktitle]{% - \printfield[titlecase]{booktitle}% - \setunit{\subtitlepunct}% - \printfield[titlecase]{booksubtitle}}% - \newunit%标点换成下一句 - \setunit{\subtitlepunct}}% - \printfield{booktitleaddon}} - %修改inbook的驱动,源来自standard.BBX \DeclareBibliographyDriver{inbook}{% \usebibmacro{bibindex}% @@ -902,75 +1155,6 @@ backrefpages = {引用页:}, {}% \usebibmacro{finentry}} -%调整期刊名的格式,源来自standard.bbx -\newbibmacro*{journal+issuetitle}{% - \usebibmacro{journal}% - %\setunit*{\addspace}% - \setunit*{\addcomma\addspace}%修改为增加一个逗号 - \iffieldundef{series} - {} - {\newunit - \printfield{series}% - \setunit{\addspace}}% - %\usebibmacro{volume+number+eid}% - %\setunit{\addspace}% - \usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \iffieldundef{volume}{}{\setunit{\addcomma\space}}% - %换成逗号和空格 - \usebibmacro{issue}% - \usebibmacro{volume+number+eid}%把卷期放到年份后面 - %\newunit - } - -%调整期刊年份的格式,去掉括号 -\newbibmacro*{issue+date}{% - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸和标准 - {\def\comparetmp{news}\edef\comparetmpb{\thefield{note}}% - \ifx\comparetmp\comparetmpb% - \usebibmacro{newsdate}% - \else% - \usebibmacro{date}% - \fi}% - } - {\printfield{issue}% - \setunit*{\addspace}% - %\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸和标准 - {\def\comparetmp{news}\edef\comparetmpb{\thefield{note}}% - \ifx\comparetmp\comparetmpb% - \usebibmacro{newsdate}% - \else% - \usebibmacro{date}% - \fi}% - }% - }% - %\newunit - } - -%调整期刊卷和期的格式,源来自standard.bbx -\newbibmacro*{volume+number+eid}{% - \printfield{volume}% - %\setunit*{\adddot}%去掉点号 - %\printfield{number}% - \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 - \iffieldundef{eid}{}{% - \setunit{\addcomma\space}% - \printfield{eid}}} - -%调整页码前的标点和去掉期刊文章等页码后面的标点,源来自standard.bbx -\newbibmacro*{note+pages}{% - %\printfield{note}%不要note,note用来判断是否是报纸newspaper - \iffieldundef{pages}{}{ - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit - } - - %期刊文章,连续出版物中的析出文献的格式 \DeclareBibliographyDriver{article}{% \usebibmacro{bibindex}% @@ -1011,125 +1195,6 @@ backrefpages = {引用页:}, {}% \usebibmacro{finentry}} -%编者类型做一修改,源来自biblatex.DEF -\newbibmacro*{editorstrg}{% - \printtext[editortype]{% - \iffieldundef{editortype} - { -% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 -% test {\ifnumgreater{\value{editor}}{1}} -% or -% test {\ifandothers{editor}} -% } -% {\bibstring{editors}} -% {\bibstring{editor}} - } - {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 - {\ifboolexpr{ - test {\ifnumgreater{\value{editor}}{1}} - or - test {\ifandothers{editor}} - } - {\bibstring{\thefield{editortype}s}} - {\bibstring{\thefield{editortype}}}} - {\thefield{editortype}}} - }} - -%修改期刊的标题,源来自biblatex.DEF -\newbibmacro*{periodical}{% - \iffieldundef{title} - {} - {\printtext[title]{% - \printfield[titlecase]{title}% - %\setunit{\subtitlepunct}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct} - \printfield[titlecase]{subtitle}}% - %}%把编组结束移到后面去 - \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 - \printfield[gbtypeflag]{usera}} - }} - } - -%期刊的标题做修改,源来自standard.BBX -\newbibmacro*{title+issuetitle}{% - \usebibmacro{periodical}% - %\setunit*{\addspace}% - \setunit*{\adddot\addspace}%标点修改为句点 - \iffieldundef{series} - {} - {\newunit - \printfield{series}% - \setunit{\addspace}}% - \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 -\iffieldundef{number}{}{%%进一步处理有范围的数字 - \multinumberparser{\thefield{number}}}% - \iffieldundef{volume}% - {\printfield{year}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% - }% - {\gbt@parse@range{\thefield{volume}}% - \printfield{year}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\gbt@range@first}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{% - \printfield{endyear}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\gbt@range@second}% - \printtext{\mkbibparens{\multinumbersecond}}}% - }% - \setunit{\addcomma\space}% - \printfield{eid}% - \setunit{\addspace}% - %\usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \usebibmacro{issue}% - \newunit} - -%新增一个样式用于调整期刊年份的格式,只打印年份 -\newbibmacro*{periodical+issue}{% - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date}%修改为下一句 - }% - {\printfield{issue}% - \setunit*{\addspace}% - %\usebibmacro{date}%修改为下一句 - }% - }% - %\newunit -} - -%新增一个样式用于输出连续出版物的地址,单位,时间 -%类似与上面的\newbibmacro*{publisher+location+date} -\newbibmacro*{location+institution+date}{% -\testCJKfirst{\thefield{title}} -\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}% - {\printlist{location}}% -% \iflistundef{institution} -% {\setunit*{\addcomma\space}} -% {\setunit*{\addcolon\space}}% -% \printlist{institution}% -% \setunit*{\addcomma\space}% -\addcolon\addspace% -\iflistundef{institution}{% -%注意这里\printtext{\mkbibbrackets{s.n.}}和\printtext{[s.n.\adddot]}是不同的,这里的]不影响标点追踪, -%这里要理解的是newunit插入的是period,看def中的命令:\newcommand*{\newunitpunct}{\addperiod\space},\newcommand*{\finentrypunct}{\addperiod} -\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}}{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}}}% \bibstring{nopublisher} -{\printlist{institution}}% -\setunit{\addcomma\addspace}% - %\usebibmacro{date}% -% \printfield{year}% -% \bibrangedash% -% \iffieldundef{endyear}{}{\printfield{endyear}}% - \newunit% -} - - %修改连续出版物的驱动,源来自standard.BBX \DeclareBibliographyDriver{periodical}{% \usebibmacro{bibindex}% @@ -1163,29 +1228,6 @@ backrefpages = {引用页:}, {}% \usebibmacro{finentry}} -%重设专利title的输出,将文献类型标识符输出出去,原输出来自biblatex.def文件 -\newbibmacro*{patenttitle}{% - \ifboolexpr{% - test{\iffieldundef{title}}% - and% - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{% - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \setunit{\subtitlepunct}\printfield{number}%写专利号 - \printfield[gbtypeflag]{usera}% - \iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}% -} - %处理专利文献,源来自standard.BBX \DeclareBibliographyDriver{patent}{% \usebibmacro{bibindex}% @@ -1305,17 +1347,6 @@ backrefpages = {引用页:}, {}% \usebibmacro{finentry}} -\newbibmacro*{institution+location+date}{% - \printlist{location}% - \iflistundef{institution} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - %\usebibmacro{modifydate}% - %\newunit - } %2016-11-11增加了译者信息 \DeclareBibliographyDriver{report}{% 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 8cf90ff65cb..cb704b51f1c 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 @@ -9,11 +9,12 @@ %% 2016/11/11 v1.0b %% 2016/11/14 v1.0c %% 2016/11/24 v1.0d +%% 2016/12/07 v1.0e %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\ProvidesFile{gb7714-2015ay.cbx}[2016/11/24 v1.0d biblatex citation style] +\ProvidesFile{gb7714-2015ay.cbx}[2016/12/07 v1.0e biblatex citation style] \RequireCitationStyle{authoryear} %\RequireCitationStyle{numeric} |