From c2f5f1c59926d4978f29940a871b9548e15f8035 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 8 Feb 2019 22:57:41 +0000 Subject: biblatex-gb7714-2015 (8feb19) git-svn-id: svn://tug.org/texlive/trunk@49977 c570f23f-e606-0410-a88d-b1316a301751 --- .../latex/biblatex-gb7714-2015/gb7714-2015-gbk.def | 1 + .../tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx | 255 +++++++++++--- .../tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx | 42 ++- .../latex/biblatex-gb7714-2015/gb7714-2015ay.bbx | 200 +++++++++-- .../latex/biblatex-gb7714-2015/gb7714-2015ay.cbx | 108 +++--- .../latex/biblatex-gb7714-2015/gb7714-2015ms.bbx | 377 ++++++++++++--------- .../latex/biblatex-gb7714-2015/gb7714-2015ms.cbx | 44 ++- 7 files changed, 733 insertions(+), 294 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def index 249c3a40773..17afbf67cee 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def @@ -20,3 +20,4 @@ \def\str@volumecn{} \def\str@numbercn{} \def\str@serialcn{} + \def\str@sameentry{ͬ} 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 dd3603b3d29..38970eecc52 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 @@ -11,7 +11,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2019/01/19 v1.0p} +\def\versionofgbtstyle{2019/02/07 v1.0q} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style] \RequireBiber[3]%显式指定用biber后端 @@ -202,6 +202,73 @@ %===================================================================== % 设置宏包选项 %===================================================================== + % + % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 + % 20190203,v1.0p,hzz + % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 + % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 + % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 + \DeclareBibliographyOption{gbfootbib}[false]{% + \ifstrequal{#1}{false}{}{\execgbfootbib}} + \ExecuteBibliographyOptions{gbfootbib} + + %% + \def\execgbfootbib% + {% + %开启引用跟踪计数器,为使用\ifciteseen等测试命令 + \ExecuteBibliographyOptions{citetracker=true} + % + %利用footmisc宏包来实现脚注文献的悬挂对齐 + \AtEndPreamble{ + \@ifclassloaded{beamer}{}{ + %beamer类因为其特殊性,为避免冲突不调footmisc。 + %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 + %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 + \PassOptionsToPackage{perpage,hang}{footmisc} + \RequirePackage{footmisc}} + + % + %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 + \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} + %做patch使得脚注内容中的脚注数字标签不上标 + \pretocmd{\@makefntext}{% + \def\@makefnmark{% + \hbox{\textcircled{\tiny\@thefnmark}}% + }% + }{}{} + } + + % + %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) + %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 + \newbibmacro*{citesavefn}{% + \ifciteseen%当被引用过为true + {\ifcsdef{sec\arabic{refsection}et\thefield{entrykey}}%当已经定义过脚注序号信息 + {\csgdef{labelsec\arabic{refsection}et\thefield{entrykey}}{% + \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}% + \@makefnmark% + }}% + {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}% + }% + {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 + \usebibmacro{prenote}}% + {\usebibmacro{citesavefn}% + \ifcsdef{labelsec\arabic{refsection}et\thefield{entrykey}}% + {\csuse{labelsec\arabic{refsection}et\thefield{entrykey}}\nopunct}% + {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% + }% + {\multicitedelim}% + {\addcolon\usebibmacro{postnote}} + + } + % % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 % 20180814,v1.0m,hzz @@ -251,6 +318,7 @@ \def\str@volumecn{卷} \def\str@numbercn{册} \def\str@serialcn{第} + \def\str@sameentry{同} \AtEndOfPackage{% \iftoggle{bbx:codegbk}{% @@ -578,7 +646,7 @@ \DefineBibliographyStrings{english}{ bibliography = {\str@bibliography}, references = {\str@references}, - bytranslator= {\addcomma\ \str@bytranslator},%\addperiod,%将trans. by 改成 译 + bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\ and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 andcn = {\addcomma},%and本地化字符串的中文对应词 andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 @@ -646,6 +714,20 @@ % 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 % 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, % 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 +% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 +% 更多的信息,因此不存在网址时,独立做一个备选格式 +% 9. 出版项主要以如下方式处理: +% (a) location+institution+date 仅用于连续出版物 +% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report +% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 +% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 +% (e) 不输出,主要用于连续出版物析出的文献 +% 10. 日期以如下方式处理: +% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year +% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate +% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date +% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate + \DeclareSourcemap{ \maps[datatype=bibtex]{% @@ -653,23 +735,25 @@ \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} - \step[notfield=author]%当author不存在,将editor复制给author + %注意notfield在低版本biblatex中没有 + %\step[notfield=author,final]%当author不存在,将editor复制给author \step[fieldsource=editor,fieldtarget=author]%并删除editor } \map{ \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} - \step[notfield=author]%当author不存在,将translator复制给author + %\step[notfield=author,final]%当author不存在,将translator复制给author \step[fieldsource=translator,fieldtarget=author]%并删除translator } - \map{ - \step[notfield=address]%当address和location同步 + \map{%让address和location同步,biblatex中address是location的别名 + %因此输出的时候只有location信息,但处理过程中是可以存在address的。 + %\step[notfield=address,final] \step[fieldsource=location,final] \step[fieldset=address,origfieldval] } - \map{ - \step[notfield=location]%当address和location同步 + \map{%让address和location同步 + %\step[notfield=location,final] \step[fieldsource=address,final] \step[fieldset=location,origfieldval] } @@ -778,7 +862,7 @@ \pertype{inproceedings} \pertype{conference}%兼容老的conference类型 \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher \step[fieldset=publisher, origfieldval] \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor \step[fieldset=bookauthor, origfieldval] @@ -792,7 +876,7 @@ \map{ \pertype{incollection} \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher \step[fieldset=publisher, origfieldval] \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor \step[fieldset=bookauthor, origfieldval] @@ -930,8 +1014,10 @@ \step[fieldset=language,fieldvalue={english}] \step[fieldset=langid,fieldvalue={english}] } - \map{%将非中文的语言放入userd中,以便进行多语言处理 - \step[fieldsource=language,fieldtarget=userd,final] + \map{%将一条文献的主体语言放入userd中,以便进行多语言处理 + %之所以这么说,是因为一条文献可能是混合语言的,比如作者用的是英文 + \step[fieldsource=language] + \step[fieldset=userd,origfieldval] } } } @@ -967,56 +1053,92 @@ } \map{% \pertype{report} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=report,typetarget=online] \step[fieldset=note,fieldvalue={report}] } \map{% \pertype{thesis} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=thesis,typetarget=online] } \map{% \pertype{manual} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=manual,typetarget=online] } \map{% \pertype{unpublished} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=unpublished,typetarget=online] } \map{% \pertype{database} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=databasetypetarget=online] } \map{% \pertype{dataset} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=dataset,typetarget=online] } \map{% \pertype{software} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=software,typetarget=online] } \map{% \pertype{map} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=map,typetarget=online] } \map{% \pertype{archive} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=archive,typetarget=online] } @@ -1089,56 +1211,92 @@ } \map{% \pertype{report} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=report,typetarget=online] \step[fieldset=note,fieldvalue={report}] } \map{% \pertype{thesis} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=thesis,typetarget=online] } \map{% \pertype{manual} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=manual,typetarget=online] } \map{% \pertype{unpublished} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=unpublished,typetarget=online] } \map{% \pertype{database} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=databasetypetarget=online] } \map{% \pertype{dataset} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=dataset,typetarget=online] } \map{% \pertype{software} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=software,typetarget=online] } \map{% \pertype{map} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=map,typetarget=online] } \map{% \pertype{archive} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=archive,typetarget=online] } @@ -1429,10 +1587,11 @@ %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 - \setunit*{\addspace}% + %\setunit{\addspace}% \newunit}% \usebibmacro{withothers}} + % % 修改作者数量超过限定值,做省略时的处理格式 % v1.0,20160701,hzz @@ -1444,11 +1603,16 @@ test {\ifnumequal{\value{listcount}}{\value{liststop}}} and test \ifmorenames - }{\ifnumgreater{\value{liststop}}{1} + }{\ifnumgreater{\value{liststop}}{1}% {\finalandcomma}% {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 \printdelim{andothersdelim}\printdelim{strandothersdelim}% -}{}} +}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: +%袁训来, 陈哲, 肖书海, 等. +%胡泳, 范海燕, 译. +%潘惠霞, 魏婧, 杨艳, 等译. +\ifcurrentname{translator}{\addcomma}{}% +}} % @@ -1471,11 +1635,11 @@ \iffieldequalstr{userd}{english}{\bibstring{andothers}}{}% \iffieldequalstr{userd}{french}{\bibstring{andothers}}{}% \iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}% -}\space% +}% \or% - \bibstring{andotherscn}\space% + \bibstring{andotherscn}% \or% - \bibstring{andothers}\space% + \bibstring{andothers}% \fi} % @@ -1925,6 +2089,7 @@ \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% } + % \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 \ifboolexpr{% test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% @@ -2074,7 +2239,8 @@ test{\iftoggle{iftlnine}} % 调整页码的格式,即chapter+pages格式 % \renewbibmacro*{chapter+pages}{% - \printfield{chapter}% +\iftoggle{bbx:gbstrict}{}{% + \printfield{chapter}}% \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 \setunit{\bibpagespunct}% \printfield{pages}}% @@ -2510,6 +2676,8 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{publisher+location+date}% %\newunit\newblock %这里标点去掉 \usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}%带括号的修改或更新日期, \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 \newunit\newblock% \printfield{pagetotal}% @@ -2556,7 +2724,9 @@ incollection,proceedings,inproceedings]{number}{% % \usebibmacro{byeditor+others}% % \newunit \usebibmacro{note+pages}% - \iffieldequalstr{note}{news}{}{\usebibmacro{modifydate}}%带括号的修改或更新日期,当是新闻时不输出 + \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}}%带括号的修改或更新日期, \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 \newunit\newblock \iftoggle{bbx:isbn} @@ -2681,8 +2851,10 @@ incollection,proceedings,inproceedings]{number}{% %\printlist{organization}% \printlist{institution}% \newunit\newblock - %\usebibmacro{date}% - \usebibmacro{modifydate}%修改或更新日期,为带括号的时间 +\ifboolexpr{% +test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% +}{\usebibmacro{date}}% +{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 \usebibmacro{url+urldate}%从下面移上来 \newunit\newblock \iftoggle{bbx:eprint} @@ -2780,7 +2952,8 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{institution+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% - \usebibmacro{modifydate}%修改或更新日期,为带括号的时间 + \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 + \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 \usebibmacro{doi+eprint+url}% \newunit \printfield{pagetotal}% 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 e63eddf2792..7802151895d 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 @@ -7,7 +7,7 @@ %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\def\versionofgbtstyle{2019/01/19 v1.0p} +\def\versionofgbtstyle{2019/02/07 v1.0q} \ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style] % @@ -37,18 +37,31 @@ \mkbibsuperscript{\mkbibbrackets{#1}}% } +% 修改postnote的输出格式 +\DeclareFieldFormat{postnote}{#1} + % % 重定义cite命令 % % 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} -\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 - {\usebibmacro{cite:init}% +% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 +\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 + {[\usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{cite:comp}} {} - {\usebibmacro{cite:dump}% - \usebibmacro{postnote}} + {\usebibmacro{cite:dump}]% + \printfield{postnote}} +% v1.0p 以前用的方式 +%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 +% {\usebibmacro{cite:init}% +% \usebibmacro{prenote}} +% {\usebibmacro{citeindex}% +% \usebibmacro{cite:comp}} +% {} +% {\usebibmacro{cite:dump}% +% \usebibmacro{postnote}} % % 定义upcite命令 @@ -68,18 +81,29 @@ {} {\usebibmacro{cite:dump}} +% +% 重定义parencite命令,以满足标签带页码的国标要求 +% +\DeclareCiteCommand{\parencite}%[\mkbibbrackets] + {[\usebibmacro{cite:init}%] + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {%[ + \usebibmacro{cite:dump}]% + \mkbibsuperscript{\printfield{postnote}}} + % % 新定义pagescite命令,以满足标签带页码的国标要求 % % 原理方法: -% 1.修改postnote的输出格式 -\DeclareFieldFormat{postnote}{#1} -% 2.新增页码输出宏 +% 1.新增页码输出宏 \newbibmacro*{postpages}{% \iffieldundef{postnote} {\printfield[postnote]{pages}} {\printfield{postnote}}} -% 3.新增\pagescite引用命令 +% 2.新增\pagescite引用命令 \DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 {[\usebibmacro{cite:init}%]直接添加方括号 \usebibmacro{prenote}% 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 b2d3e61a9fe..dc5407b7a7a 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx @@ -10,7 +10,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2019/01/19 v1.0p} +\def\versionofgbtstyle{2019/02/07 v1.0q} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style] \RequireBiber[3]%显式指定用biber后端 @@ -199,6 +199,73 @@ %===================================================================== % 设置宏包选项 %===================================================================== + % + % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 + % 20190203,v1.0p,hzz + % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 + % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 + % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 + \DeclareBibliographyOption{gbfootbib}[false]{% + \ifstrequal{#1}{false}{}{\execgbfootbib}} + \ExecuteBibliographyOptions{gbfootbib} + + %% + \def\execgbfootbib% + {% + %开启引用跟踪计数器,为使用\ifciteseen等测试命令 + \ExecuteBibliographyOptions{citetracker=true} + % + %利用footmisc宏包来实现脚注文献的悬挂对齐 + \AtEndPreamble{ + \@ifclassloaded{beamer}{}{ + %beamer类因为其特殊性,为避免冲突不调footmisc。 + %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 + %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 + \PassOptionsToPackage{perpage,hang}{footmisc} + \RequirePackage{footmisc}} + + % + %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 + \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} + %做patch使得脚注内容中的脚注数字标签不上标 + \pretocmd{\@makefntext}{% + \def\@makefnmark{% + \hbox{\textcircled{\tiny\@thefnmark}}% + }% + }{}{} + } + + % + %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) + %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 + \newbibmacro*{citesavefn}{% + \ifciteseen%当被引用过,则为true + {\ifcsdef{sec\arabic{refsection}et\thefield{entrykey}}%当已经定义过脚注序号信息 + {\csgdef{labelsec\arabic{refsection}et\thefield{entrykey}}{% + \str@sameentry\xdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}% + \@makefnmark}% + }% + {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}% + }% + {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 + \usebibmacro{prenote}}% + {\usebibmacro{citesavefn}% + \ifcsdef{labelsec\arabic{refsection}et\thefield{entrykey}}% + {\csuse{labelsec\arabic{refsection}et\thefield{entrykey}}\nopunct}% + {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% + }% + {\multicitedelim}% + {\addcolon\usebibmacro{postnote}} + + } + % % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 % 20180814,v1.0m,hzz @@ -248,6 +315,7 @@ \def\str@volumecn{卷} \def\str@numbercn{册} \def\str@serialcn{第} + \def\str@sameentry{同} \AtEndOfPackage{% \iftoggle{bbx:codegbk}{% @@ -548,7 +616,7 @@ \DefineBibliographyStrings{english}{ bibliography = {\str@bibliography}, references = {\str@references}, - bytranslator= {\addcomma\ \str@bytranslator\adddot}, %将trans. by 改成 译 + bytranslator= {\str@bytranslator\adddot}, %将trans. by 改成 译 and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 andcn = {\addcomma},%\str@andcn\ and本地化字符串的中文对应词 andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 @@ -616,6 +684,19 @@ % 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 % 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, % 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 +% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 +% 更多的信息,因此不存在网址时,独立做一个备选格式 +% 9. 出版项主要以如下方式处理: +% (a) location+institution+date 仅用于连续出版物 +% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report +% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 +% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 +% (e) 不输出,主要用于连续出版物析出的文献 +% 10. 日期以如下方式处理: +% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year +% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate +% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date +% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate \DeclareSourcemap{ \maps[datatype=bibtex]{ @@ -623,23 +704,24 @@ \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} - \step[notfield=author]%当author不存在,将editor复制给author + %\step[notfield=author,final]%当author不存在,将editor复制给author \step[fieldsource=editor,fieldtarget=author]%并删除editor } \map{ \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} - \step[notfield=author]%当author不存在,将translator复制给author + %\step[notfield=author,final]%当author不存在,将translator复制给author \step[fieldsource=translator,fieldtarget=author]%并删除translator } - \map{ - \step[notfield=address]%当address和location同步 + \map{%让address和location同步,biblatex中address是location的别名 + %因此输出的时候只有location信息,但处理过程中是可以存在address的。 + %\step[notfield=address,final] \step[fieldsource=location,final] \step[fieldset=address,origfieldval] } - \map{ - \step[notfield=location]%当address和location同步 + \map{%让address和location同步 + %\step[notfield=location,final] \step[fieldsource=address,final] \step[fieldset=location,origfieldval] } @@ -901,10 +983,11 @@ \step[fieldset=language,fieldvalue={english}] \step[fieldset=langid,fieldvalue={english}] } - \map{%将非中文的语言放入userd中,以便进行多语言处理 - \step[fieldsource=language]%,notmatch={chinese},final + \map{%将一条文献的主体语言放入userd中,以便进行多语言处理 + %之所以这么说,是因为一条文献可能是混合语言的,比如作者用的是英文 + \step[fieldsource=language] \step[fieldset=userd,origfieldval] - }% + } \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 @@ -928,56 +1011,92 @@ } \map{% \pertype{report} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=report,typetarget=online] \step[fieldset=note,fieldvalue={report}] } \map{% \pertype{thesis} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=thesis,typetarget=online] } \map{% \pertype{manual} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=manual,typetarget=online] } \map{% \pertype{unpublished} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=unpublished,typetarget=online] } \map{% \pertype{database} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=databasetypetarget=online] } \map{% \pertype{dataset} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=dataset,typetarget=online] } \map{% \pertype{software} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=software,typetarget=online] } \map{% \pertype{map} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=map,typetarget=online] } \map{% \pertype{archive} - \step[notfield=address,final]%当address不存在则继续 + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 \step[fieldsource=url,final]%地址不存在且存在url那么转变为online \step[typesource=archive,typetarget=online] } @@ -1535,7 +1654,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 - \setunit{\addspace}% + %\setunit{\addspace}% \newunit}% \usebibmacro{withothers}} @@ -1554,9 +1673,14 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 test \ifmorenames }{\ifnumgreater{\value{liststop}}{1}% {\finalandcomma}% - {}%\finalandcomma + {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 \printdelim{andothersdelim}\printdelim{strandothersdelim}% -}{}} +}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: +%袁训来, 陈哲, 肖书海, 等. +%胡泳, 范海燕, 译. +%潘惠霞, 魏婧, 杨艳, 等译. +\ifcurrentname{translator}{\addcomma}{}% +}} % 修改省略作者后的本地化字符串,比如et al. % v1.0o,20190103,hzz @@ -1577,11 +1701,11 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \iffieldequalstr{userd}{english}{\bibstring{andothersincite}}{}% \iffieldequalstr{userd}{french}{\bibstring{andothers}}{}% \iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}% -}\space% +}% \or% - \bibstring{andothersincitecn}\space% + \bibstring{andothersincitecn}% \or% - \bibstring{andothersincite}\space% + \bibstring{andothersincite}% \fi} \DeclareDelimFormat[bib,biblist]{strandothersdelim}{% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% @@ -1595,11 +1719,11 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \iffieldequalstr{userd}{english}{\bibstring{andothers}}{}% \iffieldequalstr{userd}{french}{\bibstring{andothers}}{}% \iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}% -}\space% +}% \or% - \bibstring{andotherscn}\space% + \bibstring{andotherscn}% \or% - \bibstring{andothers}\space% + \bibstring{andothers}% \fi} % @@ -2188,7 +2312,8 @@ test{\iftoggle{iftlnine}} % 调整页码的格式,即chapter+pages格式 % \renewbibmacro*{chapter+pages}{% - \printfield{chapter}% +\iftoggle{bbx:gbstrict}{}{% + \printfield{chapter}}% \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 \setunit{\bibpagespunct}% \printfield{pages}}% @@ -2732,6 +2857,8 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{publisher+location+date}% %\newunit\newblock %这里标点去掉 \usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}%带括号的修改或更新日期, \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 \newunit\newblock% \printfield{pagetotal}% @@ -2780,7 +2907,9 @@ incollection,proceedings,inproceedings]{number}{% % \usebibmacro{byeditor+others}% % \newunit \usebibmacro{note+pages}% - \iffieldequalstr{note}{news}{}{\usebibmacro{modifydate}}%带括号的修改或更新日期,当是新闻时不输出 + \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}}%带括号的修改或更新日期, \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 \newunit\newblock \iftoggle{bbx:isbn} @@ -2904,8 +3033,10 @@ incollection,proceedings,inproceedings]{number}{% % \printlist{organization}% \printlist{institution}% \newunit\newblock - %\usebibmacro{date}% - \usebibmacro{modifydate}%修改或更新日期,为带括号的时间 +\ifboolexpr{% +test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% +}{\usebibmacro{date}}% +{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 \usebibmacro{url+urldate}%从下面移上来 \newunit\newblock \iftoggle{bbx:eprint} @@ -3005,7 +3136,8 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{institution+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% - \usebibmacro{modifydate}%修改或更新日期,为带括号的时间 + \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 + \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 \usebibmacro{doi+eprint+url}% \newunit \printfield{pagetotal}% 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 c21620cff80..04ba5093130 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 @@ -7,15 +7,13 @@ %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\def\versionofgbtstyle{2019/01/19 v1.0p} +\def\versionofgbtstyle{2019/02/07 v1.0q} \ProvidesFile{gb7714-2015ay.cbx}[\versionofgbtstyle biblatex citation style] % % 加载标准样式 % -\RequireCitationStyle{authoryear} - - +\RequireCitationStyle{authoryear-comp} \ExecuteBibliographyOptions{ %autocite = superscript , @@ -26,6 +24,7 @@ uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突 uniquelist=minyear } + % % 选项设置,针对3.7以下版本 % @@ -63,9 +62,9 @@ test {\iftoggle{iftlseven}}%3.7=biblatex %textcite标注命令中的标点设置,注意只针对textcite命令。 \DeclareDelimFormat[textcite]{nameyeardelim}{}%\addcomma\space -\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{cn}{\addthinspace}{\addspace}}% +\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}% \AtEveryCitekey{% -\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace +\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace {\renewcommand*{\andothersdelim}{\addspace}}% } @@ -86,52 +85,68 @@ test {\iftoggle{iftlseven}}%3.7=biblatex % 重定义cite命令 % % 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} -\DeclareCiteCommand{\cite}[\mkbibparens] - {\usebibmacro{prenote}} +% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 +\DeclareCiteCommand{\cite} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + (\usebibmacro{prenote}}%) {\usebibmacro{citeindex}% \usebibmacro{cite}} - {\multicitedelim} - {\usebibmacro{postnote}} + {} + {%( + )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } % % 定义upcite命令 % 20180604,v1.0l,hzz % 方法:与yearcite命令相同 -\DeclareCiteCommand{\upcite} - {\printtext{(}\usebibmacro{prenote}} - {\usebibmacro{cite:labeldate+extradate}}% - {\multicitedelim} +\DeclareCiteCommand{\upcite}%仅输出年份,不要页码 + {\usebibmacro{cite:init}% + \printtext{(}\usebibmacro{prenote}}% + {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear} + {\multicitedelim}% {\printtext{)}} % % 重定义parencite命令 % -\DeclareCiteCommand{\parencite}[\mkbibparens] - {\usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite}} - {\multicitedelim} - {\usebibmacro{postnote}} +%\DeclareCiteCommand{\parencite} +% {\usebibmacro{cite:init}% +% \renewbibmacro*{postnote}{% +% \iffieldundef{postnote}% +% {}% +% {\nopunct% +% \printfield{postnote}}}% +% (\usebibmacro{prenote}}%) +% {\usebibmacro{citeindex}% +% \usebibmacro{cite}} +% {} +% {%( +% )\mkbibsuperscript{\usebibmacro{postnote}}} % % 新定义pagescite命令,以满足标签带页码的国标要求 % % 原理方法: -% 1.修改postnote的输出格式 -\newbibmacro*{postpages}{% - \iffieldundef{postnote} - {\printfield{pages}} - {\printfield{postnote}}} -% 2.新增页码输出宏(括号外的页码格式) -\DeclareFieldFormat{postnote}{#1} -% 3.新增\pagescite引用命令 +% 新增\pagescite引用命令 \DeclareCiteCommand{\pagescite} - {\printtext{(}\usebibmacro{prenote}} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {\thefield{pages}}% + {\thefield{postnote}}}% + (\usebibmacro{prenote}%) + }% {\usebibmacro{citeindex}% \usebibmacro{cite}} - {\multicitedelim} - {\printtext{)}\textsuperscript{\usebibmacro{postpages}}} + {} + {%( + )\mkbibsuperscript{\usebibmacro{postnote}}} % % 定义yearpagescite,用于当文中作者已经存在,需要页码和年份的情况 @@ -139,28 +154,41 @@ test {\iftoggle{iftlseven}}%3.7=biblatex % 原理:增加一个命令yearpagescite % 参考biblatex.DEF中的\DeclareCiteCommand*{\citeyear}命令 \DeclareCiteCommand{\yearpagescite} - {\printtext{(}\usebibmacro{prenote}} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {\thefield{pages}}% + {\thefield{postnote}}}% + \printtext{(}\usebibmacro{prenote}}% {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear} - {\multicitedelim} - {\printtext{)}\textsuperscript{\usebibmacro{postpages}}} + {\multicitedelim}% + {\printtext{)}\textsuperscript{\usebibmacro{postnote}}} % % 定义yearcite,用于当文中作者已经存在,仅需要年份的情况 % % 原理:增加一个命令yearcite \DeclareCiteCommand{\yearcite}%仅输出年份,不要页码 - {\printtext{(}\usebibmacro{prenote}} + {\usebibmacro{cite:init}% + \printtext{(}\usebibmacro{prenote}}% {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear} - {\multicitedelim} + {\multicitedelim}% {\printtext{)}} % % 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 % 20180427,v1.0k,增加,hzz % 为与顺序编码制兼容,增加了命令,定义与cite相同 -\DeclareCiteCommand{\authornumcite}[\mkbibparens] - {\usebibmacro{prenote}} +\DeclareCiteCommand{\authornumcite} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + (\usebibmacro{prenote}}%) {\usebibmacro{citeindex}% \usebibmacro{cite}} - {\multicitedelim} - {\usebibmacro{postnote}} + {} + {%( + )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx index 6a83013c810..4db440f8671 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx @@ -11,7 +11,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2019/01/19 v1.0p} +\def\versionofgbtstyle{2019/02/07 v1.0q} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style] \RequireBiber[3]%显式指定用biber后端 @@ -89,6 +89,73 @@ %===================================================================== % 设置宏包选项 %===================================================================== + % + % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 + % 20190203,v1.0p,hzz + % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 + % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 + % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 + \DeclareBibliographyOption{gbfootbib}[false]{% + \ifstrequal{#1}{false}{}{\execgbfootbib}} + \ExecuteBibliographyOptions{gbfootbib} + + %% + \def\execgbfootbib% + {% + %开启引用跟踪计数器,为使用\ifciteseen等测试命令 + \ExecuteBibliographyOptions{citetracker=true} + % + %利用footmisc宏包来实现脚注文献的悬挂对齐 + \AtEndPreamble{ + \@ifclassloaded{beamer}{}{ + %beamer类因为其特殊性,为避免冲突不调footmisc。 + %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 + %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 + \PassOptionsToPackage{perpage,hang}{footmisc} + \RequirePackage{footmisc}} + + % + %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 + \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} + %做patch使得脚注内容中的脚注数字标签不上标 + \pretocmd{\@makefntext}{% + \def\@makefnmark{% + \hbox{\textcircled{\tiny\@thefnmark}}% + }% + }{}{} + } + + % + %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) + %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 + \newbibmacro*{citesavefn}{% + \ifciteseen%当被引用过为true + {\ifcsdef{sec\arabic{refsection}et\thefield{entrykey}}%当已经定义过脚注序号信息 + {\csgdef{labelsec\arabic{refsection}et\thefield{entrykey}}{% + \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}% + \@makefnmark% + }}% + {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}% + }% + {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 + \usebibmacro{prenote}}% + {\usebibmacro{citesavefn}% + \ifcsdef{labelsec\arabic{refsection}et\thefield{entrykey}}% + {\csuse{labelsec\arabic{refsection}et\thefield{entrykey}}\nopunct}% + {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% + }% + {\multicitedelim}% + {\addcolon\usebibmacro{postnote}} + + } + % % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 % 20180814,v1.0m,hzz @@ -137,6 +204,7 @@ \def\str@volumecn{卷} \def\str@numbercn{册} \def\str@serialcn{第} + \def\str@sameentry{同} \AtEndOfPackage{% \iftoggle{bbx:codegbk}{% @@ -380,7 +448,7 @@ \DefineBibliographyStrings{english}{ bibliography = {\str@bibliography}, references = {\str@references}, - bytranslator= {\addcomma\ \str@bytranslator},%\addperiod,%将trans. by 改成 译 + bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译 and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 andcn = {\addcomma},%and本地化字符串的中文对应词 andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 @@ -448,6 +516,19 @@ % 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 % 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, % 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 +% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 +% 更多的信息,因此不存在网址时,独立做一个备选格式 +% 9. 出版项主要以如下方式处理: +% (a) location+institution+date 仅用于连续出版物 +% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report +% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 +% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 +% (e) 不输出,主要用于连续出版物析出的文献 +% 10. 日期以如下方式处理: +% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year +% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate +% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date +% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate \DeclareSourcemap{ \maps[datatype=bibtex]{% @@ -455,23 +536,24 @@ \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} - \step[notfield=author]%当author不存在,将editor复制给author + %\step[notfield=author,final]%当author不存在,将editor复制给author \step[fieldsource=editor,fieldtarget=author]%并删除editor } \map{ \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} - \step[notfield=author]%当author不存在,将translator复制给author + %\step[notfield=author,final]%当author不存在,将translator复制给author \step[fieldsource=translator,fieldtarget=author]%并删除translator } - \map{ - \step[notfield=address]%当address和location同步 + \map{%让address和location同步,biblatex中address是location的别名 + %因此输出的时候只有location信息,但处理过程中是可以存在address的。 + \step[notfield=address,final]% \step[fieldsource=location,final] \step[fieldset=address,origfieldval] } \map{ - \step[notfield=location]%当address和location同步 + \step[notfield=location,final]% \step[fieldsource=address,final] \step[fieldset=location,origfieldval] } @@ -732,8 +814,10 @@ \step[fieldset=language,fieldvalue={english}] \step[fieldset=langid,fieldvalue={english}] } - \map{%将非中文的语言放入userd中,以便进行多语言处理 - \step[fieldsource=language,fieldtarget=userd,final] + \map{%将一条文献的主体语言放入userd中,以便进行多语言处理 + %之所以这么说,是因为一条文献可能是混合语言的,比如作者用的是英文 + \step[fieldsource=language] + \step[fieldset=userd,origfieldval] } } } @@ -1101,7 +1185,7 @@ \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}}% + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 {\usebibmacro{name:delim}{#1}% \usebibmacro{name:hook}{#1}% \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% @@ -1112,7 +1196,7 @@ {}{\revsdnamepunct}% \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 } %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 @@ -1129,7 +1213,7 @@ \ifprefchar{}{\bibnamedelimc}}% \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 {\usebibmacro{name:delim}{#1}% \usebibmacro{name:hook}{#1}% \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% @@ -1140,7 +1224,7 @@ {}{\revsdnamepunct}% \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 } %中文常见风格,汉语拼音全拼模式 @@ -1216,13 +1300,17 @@ } \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \iffieldundef{year}{% + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldundef{year}{% \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% {\printtext{(}\printenddate\printtext{)}}% }{\iffieldequalstr{year}{}{%因为year存在,但为空 }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% }% - }% + }}% % @@ -1303,53 +1391,53 @@ %设置驱动格式 %===================================================================== -\AtEveryBibitem{% -\ifboolexpr{ -togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}} -} -{ - -\iftoggle{bbx:gbfieldstd}{}{ -\DeclareFieldFormat{title}{#1\adddot\addthinspace} -\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 -\DeclareFieldFormat{issuetitle}{#1} -\DeclareFieldFormat{maintitle}{#1} -\DeclareFieldFormat{booktitle}{#1} +%中文环境的局部化代码 +\def\localsetchinesecode{% +\ifboolexpr{% +togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% +}% +{% +\iftoggle{bbx:gbfieldstd}{}{% +\DeclareFieldFormat{title}{##1\adddot\addthinspace}% +\DeclareFieldFormat{journaltitle}{##1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 +\DeclareFieldFormat{issuetitle}{##1}% +\DeclareFieldFormat{maintitle}{##1}% +\DeclareFieldFormat{booktitle}{##1}% \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [article,patent,thesis,unpublished] - {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} + [article,patent,thesis,unpublished]% + {title}{##1\adddot\addthinspace}%\mkbibquote{##1\isdot} \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [inbook,incollection,inproceedings] - {title}{#1}%\nopunct\unspace -\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def + [inbook,incollection,inproceedings]% + {title}{##1}%\nopunct\unspace +\DeclareFieldFormat{url}{\url{##1}}%%url相关输出,url域修改如本行,源来自biblatex.def % % 标题的字母大小写格式修改 % % 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase % 因为titlecase is applied to the contents of the field directly,title is not -%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 +%\DeclareFieldFormat{titlecase}{\MakeCapital##1}%重设标题格式,将其修改为首字母大写 \DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% -\iffieldundef{url}{\MakeCapital#1}{% -\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1} -} - +\iffieldundef{url}{\MakeCapital##1}{% +\href{\thefield{url}}{##1}}}{\MakeCapital##1}}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{pages}{##1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{##1} +}% % % 修改译者位置格式 % % 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 \renewbibmacro*{bytranslator+others}{% - \ifnameundef{translator} - {} + \ifnameundef{translator}% + {}% {%\usebibmacro{bytranslator+othersstrg} %\setunit{\addspace}% \printnames[bytranslator]{translator}% \clearname{translator}% + %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 + %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 - \setunit*{\addspace}% + %\setunit{\addspace}% \newunit}% - \usebibmacro{withothers}} - + \usebibmacro{withothers}}% % % 修改作者数量超过限定值,做省略时的处理格式 % v1.0,20160701,hzz @@ -1357,16 +1445,20 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}} % % 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 \renewbibmacro*{name:andothers}{% - \ifboolexpr{ - test {\ifnumequal{\value{listcount}}{\value{liststop}}} + \ifboolexpr{% + test {\ifnumequal{\value{listcount}}{\value{liststop}}}% and test \ifmorenames - }{\ifnumgreater{\value{liststop}}{1} + }{\ifnumgreater{\value{liststop}}{1}% {\finalandcomma}% {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 \printdelim{andothersdelim}\printdelim{strandothersdelim}% -}{}} - +}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: +%袁训来, 陈哲, 肖书海, 等. +%胡泳, 范海燕, 译. +%潘惠霞, 魏婧, 杨艳, 等译. +\ifcurrentname{translator}{\addcomma}{}% +}}% % % 修改省略作者后的本地化字符串,比如et al. % v1.0o,20190103,hzz @@ -1387,13 +1479,12 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}} \iffieldequalstr{userd}{english}{\bibstring{andothers}}{}% \iffieldequalstr{userd}{french}{\bibstring{andothers}}{}% \iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}% - }\space% + }% \or% - \bibstring{andotherscn}\space% + \bibstring{andotherscn}% \or% - \bibstring{andothers}\space% - \fi} - + \bibstring{andothers}% + \fi}% % % 修改最后一个作者前的字符串,比如 and % v1.0o,20190103,hzz @@ -1419,8 +1510,7 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}} \bibstring{andcn}\space% \or% \bibstring{and}\space% - \fi} - + \fi}% % % url和url日期格式 % @@ -1430,9 +1520,8 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}} {}{%\setunit*{\addspace}% \usebibmacro{urldate}}% \setunit{\addperiod\addspace}% - \usebibmacro{url}} - \renewbibmacro*{url}{\printfield{url}} - + \usebibmacro{url}}% + \renewbibmacro*{url}{\printfield{url}}% % % 重设title的输出 % @@ -1462,16 +1551,13 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}} %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 %\newunit }% -}} - +}}% % % 日期信息的输出格式,针对biblatex<3.7版本 % -\DeclareFieldFormat{urldate}{#1} +\DeclareFieldFormat{urldate}{##1}% \renewbibmacro*{urldate}{% \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 - - % % 调整doi+eprint+url格式 % @@ -1491,28 +1577,26 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}} \newunit\newblock \iftoggle{bbx:doi} {\printfield{doi}} - {}} - + {}}% % % 调整页码的格式,即chapter+pages格式 % \renewbibmacro*{chapter+pages}{% - \printfield{chapter}% +\iftoggle{bbx:gbstrict}{}{% + \printfield{chapter}}% \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 \setunit{\bibpagespunct}% \printfield{pages}}% %\newunit %这里的标点去掉 -} - +}% % % 当location等出版项超过maxitem缩减后不再输出etal % \DeclareListFormat{location}{% - \usebibmacro{list:delim}{#1}% - #1\isdot} -\DeclareListAlias{institution}{location} -\DeclareListAlias{publisher}{location} - + \usebibmacro{list:delim}{##1}% + ##1\isdot}% +\DeclareListAlias{institution}{location}% +\DeclareListAlias{publisher}{location}% % 新增一个样式用于输出连续出版物的地址,单位,时间, % 用于periodical连续出版物的出版社和地址的处理 % @@ -1546,7 +1630,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% \setunit*{\addcomma\space}% \usebibmacro{date}% \newunit}% -} +}% % % 通用的出版社和地址的处理 % @@ -1578,10 +1662,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% \setunit*{\addcomma\space}% \usebibmacro{date}%%\newunit }% -} - - - +}% % % 修改了一个institution+location+date用于manual、report、thesis等类型 % @@ -1596,8 +1677,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% \setunit*{\addcomma\space}% \usebibmacro{date}% %\newunit - }} - + }}% % % 对volume卷信息格式做出修改 % v1.0o,20190105,hzz @@ -1605,65 +1685,60 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% \DeclareFieldFormat{volume}{% \testCJKfirst{userd}% \iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}#1\bibstring{volumecn}}% -{\bibstring{volume}~#1}% +{\bibstring{serialcn}##1\bibstring{volumecn}}% +{\bibstring{volume}~##1}% }% volume of a book -\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal - +\DeclareFieldFormat[article,periodical]{volume}{##1}% volume of a journal % % 对number册信息格式做出修改 % v1.0o,20190105,hzz % -\DeclareFieldFormat{number}{#1}% +\DeclareFieldFormat{number}{##1}% \DeclareFieldFormat[book,collection,inbook,% incollection,proceedings,inproceedings]{number}{% \testCJKfirst{userd}% \iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}#1\bibstring{numbercn}}% -{#1}% +{\bibstring{serialcn}##1\bibstring{numbercn}}% +{##1}% }% - % % 对edition版本信息格式做出修改 % \DeclareFieldFormat{edition}{%源来自biblatex.DEF \testCJKfirst{userd}% \iftoggle{ifCJKforgbt}% -{\ifinteger{#1}% -{\printtext{#1\str@edition}}% -{#1\isdot}}% -{\ifinteger{#1}% -{\mkbibordedition{#1}~\bibstring{edition}}% -{#1\isdot}}} - +{\ifinteger{##1}% +{\printtext{##1\str@edition}}% +{##1\isdot}}% +{\ifinteger{##1}% +{\mkbibordedition{##1}~\bibstring{edition}}% +{##1\isdot}}}% % % 对version的版本信息做出修改 % \DeclareFieldFormat{version}{%源来自biblatex.DEF \testCJKfirst{userd}% -\ifinteger{#1}% -{\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% -{\mkbibordedition{#1}~\bibstring{version}}}% -{#1\isdot}} - +\ifinteger{##1}% +{\iftoggle{ifCJKforgbt}{\printtext{##1\str@edition}}% +{\mkbibordedition{##1}~\bibstring{version}}}% +{##1\isdot}}% % % 修改析出文献的文集的标题与附加标题间的符号 % \renewbibmacro*{booktitle}{% - \ifboolexpr{ + \ifboolexpr{% test {\iffieldundef{booktitle}} and test {\iffieldundef{booksubtitle}} - } - {} + }% + {}% {\printtext[booktitle]{\bibtitlefont% \printfield[titlecase]{booktitle}% \setunit{\subtitlepunct}% \printfield[titlecase]{booksubtitle}}% \newunit%标点换成下一句 \setunit{\subtitlepunct}}% - \printfield{booktitleaddon}} - + \printfield{booktitleaddon}}% % % 调整期刊名的格式 % @@ -1686,8 +1761,7 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{issue}% \usebibmacro{volume+number+eid}%把卷期放到年份后面 %\newunit - } - + }% % % 调整期刊卷和期的格式 % @@ -1704,8 +1778,7 @@ incollection,proceedings,inproceedings]{number}{% \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 \iffieldundef{eid}{}{% \setunit{\addcomma\space}% - \printfield{eid}}}} - + \printfield{eid}}}}% % % 调整期刊年份的格式 % @@ -1725,8 +1798,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{date}}% }}}% %\newunit - } - + }% % % 调整页码前的标点和去掉期刊文章等页码后面的标点 % @@ -1736,9 +1808,7 @@ incollection,proceedings,inproceedings]{number}{% \setunit{\bibpagespunct}% \printfield{pages}}% %\newunit - } - - + }% % % 编者的符号修改一下 % @@ -1754,8 +1824,7 @@ incollection,proceedings,inproceedings]{number}{% {\setunit{\addcomma\space}% \usebibmacro{editorstrg}}% \clearname{editor}} - {}} - + {}}% % % 编者类型做一修改 % @@ -1780,14 +1849,13 @@ incollection,proceedings,inproceedings]{number}{% {\bibstring{\thefield{editortype}s}} {\bibstring{\thefield{editortype}}}} {\thefield{editortype}}}% - }} - + }}% % % 修改期刊的标题 % \renewbibmacro*{periodical}{%源来自biblatex.DEF \iffieldundef{title} - {} + {}% {\printtext[title]{\bibtitlefont% \printfield[titlecase]{title}% %\setunit{\subtitlepunct}% @@ -1797,10 +1865,9 @@ incollection,proceedings,inproceedings]{number}{% %}%把编组结束移到后面去 \iftoggle{bbx:gbtype}{% \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 - \printfield[gbtypeflag]{usera}}}{} - }} - } - + \printfield[gbtypeflag]{usera}}}{}% + }}% + }% % % 期刊的标题做修改 % @@ -1809,7 +1876,7 @@ incollection,proceedings,inproceedings]{number}{% %\setunit*{\addspace}% \setunit*{\adddot\addspace}%标点修改为句点 \iffieldundef{series} - {} + {}% {\newunit \printfield{series}% \setunit{\addspace}}% @@ -1840,9 +1907,7 @@ incollection,proceedings,inproceedings]{number}{% %\usebibmacro{issue+date}% %\setunit{\addcolon\space}% \usebibmacro{issue}% - \newunit} - - + \newunit}% % % 修改in:用于inbook、incollection、inproceedings等类型 % 2018.04.20,v1.0k,renewed marco,by hzz @@ -1851,7 +1916,6 @@ incollection,proceedings,inproceedings]{number}{% \renewbibmacro*{in:}{% \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace {\setunit{\adddot\addspace}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct - % % book条目类的驱动 % @@ -1886,6 +1950,8 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{publisher+location+date}% %\newunit\newblock %这里标点去掉 \usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}%带括号的修改或更新日期, \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 \newunit\newblock% \printfield{pagetotal}% @@ -1904,9 +1970,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - - + \usebibmacro{finentry}}% % % 期刊文章,连续出版物中的析出文献的格式 % @@ -1932,7 +1996,9 @@ incollection,proceedings,inproceedings]{number}{% % \usebibmacro{byeditor+others}% % \newunit \usebibmacro{note+pages}% - \iffieldequalstr{note}{news}{}{\usebibmacro{modifydate}}%带括号的修改或更新日期,当是新闻时不输出 + \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}}%带括号的修改或更新日期, \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 \newunit\newblock \iftoggle{bbx:isbn} @@ -1949,10 +2015,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - - - + \usebibmacro{finentry}}% % % 连续出版物的驱动 % @@ -1987,8 +2050,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - + \usebibmacro{finentry}}% % % 专利文献驱动 % @@ -2030,9 +2092,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - - + \usebibmacro{finentry}}% % % 在线文献驱动 % @@ -2057,8 +2117,10 @@ incollection,proceedings,inproceedings]{number}{% %\printlist{organization}% \printlist{institution}% \newunit\newblock - %\usebibmacro{date}% - \usebibmacro{modifydate}%修改或更新日期,为带括号的时间 +\ifboolexpr{% +test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% +}{\usebibmacro{date}}% +{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 \usebibmacro{url+urldate}%从下面移上来 \newunit\newblock \iftoggle{bbx:eprint} @@ -2075,10 +2137,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - - - + \usebibmacro{finentry}}% % % 报告类型驱动 % 2016-11-11,增加了译者信息 @@ -2126,8 +2185,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - + \usebibmacro{finentry}}% % % 手册类型驱动 % 2016-11-11,增加了译者信息 @@ -2158,7 +2216,8 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{institution+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% - \usebibmacro{modifydate}%修改或更新日期,为带括号的时间 + \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 + \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 \usebibmacro{doi+eprint+url}% \newunit \printfield{pagetotal}% @@ -2177,8 +2236,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - + \usebibmacro{finentry}}% % % 备选类型驱动 % @@ -2218,9 +2276,7 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - - + \usebibmacro{finentry}}% % % 专著中的析出文献的格式修改 % @@ -2274,10 +2330,9 @@ incollection,proceedings,inproceedings]{number}{% {\usebibmacro{related:init}% \usebibmacro{related}} {}% - \usebibmacro{finentry}} - - - - -}{} + \usebibmacro{finentry}}% +}{}% } + +\AtEveryBibitem{\localsetchinesecode}% +\AtEveryCite{\localsetchinesecode}% diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx index 2011cd03af8..e97013f79a1 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx @@ -7,7 +7,7 @@ %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\def\versionofgbtstyle{2019/01/19 v1.0p} +\def\versionofgbtstyle{2019/02/07 v1.0q} \ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style] % @@ -37,18 +37,31 @@ \mkbibsuperscript{\mkbibbrackets{#1}}% } +% 修改postnote的输出格式 +\DeclareFieldFormat{postnote}{#1} + % % 重定义cite命令 % % 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} -\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 - {\usebibmacro{cite:init}% +% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 +\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 + {[\usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{cite:comp}} {} - {\usebibmacro{cite:dump}% - \usebibmacro{postnote}} + {\usebibmacro{cite:dump}]% + \printfield{postnote}} +% v1.0p 以前用的方式 +%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 +% {\usebibmacro{cite:init}% +% \usebibmacro{prenote}} +% {\usebibmacro{citeindex}% +% \usebibmacro{cite:comp}} +% {} +% {\usebibmacro{cite:dump}% +% \usebibmacro{postnote}} % % 定义upcite命令 @@ -68,18 +81,29 @@ {} {\usebibmacro{cite:dump}} +% +% 重定义parencite命令,以满足标签带页码的国标要求 +% +\DeclareCiteCommand{\parencite}%[\mkbibbrackets] + {[\usebibmacro{cite:init}%] + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {%[ + \usebibmacro{cite:dump}]% + \mkbibsuperscript{\printfield{postnote}}} + % % 新定义pagescite命令,以满足标签带页码的国标要求 % % 原理方法: -% 1.修改postnote的输出格式 -\DeclareFieldFormat{postnote}{#1} -% 2.新增页码输出宏 +% 1.新增页码输出宏 \newbibmacro*{postpages}{% \iffieldundef{postnote} {\printfield[postnote]{pages}} {\printfield{postnote}}} -% 3.新增\pagescite引用命令 +% 2.新增\pagescite引用命令 \DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 {[\usebibmacro{cite:init}%]直接添加方括号 \usebibmacro{prenote}% @@ -103,6 +127,8 @@ {\usebibmacro{cite:dump}]% \usebibmacro{postpages}} + + % % 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, % -- cgit v1.2.3