%% %% --------------------------------------------------------------- %% biblatex-gb7714-2015 --- A biblatex implementation of the %% GBT7714-2015 bibliography style,numerical sequence %% Maintained by huzhenzhen %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% % % 版本和时间信息 % \ProvidesFile{gb7714-2015ms.bbx}[2018/11/04 v1.0n biblatex bibliography style] \def\versionofgbtstyle{2018/11/04 v1.0n} \def\versionofbiblatex{\abx@version} \RequireBiber[3]%显式指定用biber后端 %===================================================================== % 加载标准样式 %===================================================================== \RequireBibliographyStyle{numeric-comp} \RequireBibliographyStyle{standard} %===================================================================== % 功能函数 %===================================================================== % % biblatex版本判断 % 20180629,v1.0k,hzz % % 原理方法:适用于3.10以上版本的biblatex,否则给出警告 \@ifpackagelater{biblatex}{2017/12/28}{}{ \blx@warning@noline{% biblatex version is too old for this style\MessageBreak if errors raised,Please update biblatex to the latest version.} } % % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 % v1.0k,20180509,hzz % % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 % 编码用xelatex编译的问题。 % % 原理是:利用perl正则将中文标识记录到域中, % 然后利用\iffieldundef和\iffieldequalstr进行判断 \providetoggle{ifCJKforgbt} \def\testCJKfirst#1{% \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% \iffieldequalstr{#1}{cn}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} % % 2个卷的解析函数,用于连续出版物 % % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 \newcommand{\multivolparser}[1]{% \IfSubStr{#1}{-}% {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% {\def\multivolfirst{#1}\def\multivolsecond{}}% } % % 2个期的解析函数,用于连续出版物 % \newcommand{\multinumberparser}[1]{% \IfSubStr{#1}{-}% {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% {\def\multinumberfirst{#1}\def\multinumbersecond{}}% } %===================================================================== % 数据模型定义 %===================================================================== %定义类型和载体标识,从gb内容看载体基本属于介质。 %为与lee zeping的bst的样式统一,使用mark和medium这两域名 %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} %===================================================================== % 设置宏包选项 %===================================================================== % % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 % 20180814,v1.0m,hzz % 原理方法: % 当gbstyle=true,则所有的文献使用国标样式,否则仅中文文献使用国标样式 \newtoggle{bbx:gbstyle} \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 \settoggle{bbx:gbstyle}{#1}} % % 增加一个控制是否输出文献类型和载体标识的选项 % % 原理方法: % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 \newtoggle{bbx:gbtype} %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 \settoggle{bbx:gbtype}{#1}} % % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 % v1.0k, 2018.05.08, by hzz % % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 % 另外注意: % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 \newtoggle{bbx:codegbk} \DeclareBibliographyOption{gbcodegbk}[false]{% \settoggle{bbx:codegbk}{#1}} \def\str@bibliography{参考文献} \def\str@references{参考文献} \def\str@bytranslator{译} \def\str@andotherscn{等} \def\str@backrefpage{引用页} \def\str@backrefpages{引用页} \def\str@noaddress{出版地不详} \def\str@nopublisher{出版者不详} \def\str@edition{版} \AtEndOfPackage{% \iftoggle{bbx:codegbk}{% \ExecuteBibliographyOptions{texencoding = GBK} \input{gb7714-2015-gbk.def} }{}} % % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 % v1.0k, 2018.05.08, by hzz % % 原理方法: % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 % 可能需要用于中英文判断的language域的信息。 \newtoggle{bbx:gbstrict} \DeclareBibliographyOption{gbstrict}[true]{% \settoggle{bbx:gbstrict}{#1}} % % 增加一个控制标题域超链接设置的选项 % v1.0k, 2018.05.24, by hzz % % 原理方法: % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 % 设置为true,则标题设置超链接 \newtoggle{bbx:titlelink} \DeclareBibliographyOption{gbtitlelink}[false]{% \settoggle{bbx:titlelink}{#1}} % % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 % v1.0l, 2018.07.02, by hzz % % 原理方法: % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 \newtoggle{bbx:ctexset} \DeclareBibliographyOption{gbctexset}[true]{% \settoggle{bbx:ctexset}{#1}} \AtEndOfPackage{% \iftoggle{bbx:ctexset}{% \def\blx@defbibstrings#1#2{% \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% \abx@dostrings \csuse{abx@strings@#1}% \setkeys{blx@lbx}{#2}% \let\do\blx@defbibstrings@i \csxdef{abx@strings@#1}{\abx@dostrings}% } }{}} % % 增加一个恢复域格式为标准样式的控制选项 % v1.0k, 2018.05.15, by hzz % % 原理方法: % 默认设置该选项为false,采用国标要求的域格式输出相关域 % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 \newtoggle{bbx:gbfieldstd} \DeclareBibliographyOption{gbfieldstd}[false]{% \settoggle{bbx:gbfieldstd}{#1}% } % % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 % \newtoggle{bbx:gbpub} \DeclareBibliographyOption{gbpub}[true]{% %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} % % 增加控制析出文献来源前的标点符号//输出的选项 % v1.0k, 2018.04.20,added in by hzz \newtoggle{bbx:gbpunctin} \DeclareBibliographyOption{gbpunctin}[true]{% \settoggle{bbx:gbpunctin}{#1}} % % 增加一个处理佚名或noauthor的控制选项 % % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错 \DeclareBibliographyOption{gbnoauthor}[true]{}% % %为日期控制格式增加一个gb7714-2015选项 % \csdef{mkdaterangegb7714-2015}#1{% \begingroup \blx@metadateinfo{#1}% \iffieldundef{#1year} {} {\printtext[#1date]{% \blx@gbdate{#1}{}}}% \endgroup} \newrobustcmd*{\blx@gbdate}[3][]{% \dateeraprintpre{#2#3year}% \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} %为姓名格式选择增加的计数器 \newcounter{namefmtcase} \def\thenamefmtcase{\the\c@namefmtcase} %为数字标签格式选择增加的计数器/命令 %\newcounter{bibnumlabel} %\def\thebibnumlabel{\the\c@bibnumlabel} \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} \newcounter{alignlabel} \def\thealignlabel{\the\c@alignlabel} % % 增加序号标签格式处理选项 % v1.0l,20180623,hzz % \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% \csuse{gbbiblabelopt@#1} } % % 增加姓名大小写格式处理选项 % \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% \ifstrequal{#1}{uppercase}{\setcounter{namefmtcase}{0}}{}% \ifstrequal{#1}{lowercase}{\setcounter{namefmtcase}{1}}{}% \ifstrequal{#1}{givenahead}{\setcounter{namefmtcase}{2}}{}%given-family \ifstrequal{#1}{familyahead}{\setcounter{namefmtcase}{3}}{} \ifstrequal{#1}{pinyin}{\setcounter{namefmtcase}{4}}{}%family-given } % % 增加标签对齐选项 % % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 \DeclareBibliographyOption[string]{gbalign}[right]{% \ifstrequal{#1}{right}{\setcounter{alignlabel}{0}}{} \ifstrequal{#1}{left}{\setcounter{alignlabel}{1}}{} \ifstrequal{#1}{center}{\setcounter{alignlabel}{2}}{} \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} } % % 选项设置 % \ExecuteBibliographyOptions{ %firstinits=true, 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 giveninits=true, %针对3.3<=biblatex<3.5版本,比如texlive2016中的3.4版 sorting=none, useprefix=true, %名字的信息包括前缀 date = year, %日期仅写到年 maxbibnames = 3,%设置名字最大数量 minbibnames = 3, %设置缩减后的名字最小数量 isbn=false, gbstyle=true, gbtype=true, gbcodegbk=false, gbstrict=true, gbtitlelink=false, gbfieldstd=false, gbpub=true, gbpunctin=true, gbbiblabel=bracket, gbnamefmt=uppercase, gbalign=right, gbctexset=true, %urldate =edtf, %针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 %eventdate =edtf,%针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 urldate =gb7714-2015, %iso,针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 eventdate =gb7714-2015, } %===================================================================== % 设置本地化字符串 %===================================================================== % % 新建当地化字符串,用来记录“等”字符 % \NewBibliographyString{andotherscn} % % 修改一些当地化字符串 % % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 % 当然也可以增加比如上面定义的andotherscn % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 \DefineBibliographyStrings{english}{ bibliography = {\str@bibliography}, references = {\str@references}, %bytranslator= {\addcomma\ 译\adddot}, %将trans. by 改成 译 bytranslator= {\addcomma\ \str@bytranslator},%\addperiod and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 andotherscn = {\str@andotherscn}, %将超过3个人名的省略,et al.改成为 等 backrefpage = {\str@backrefpage:}, backrefpages = {\str@backrefpages:}, in={in\intitlepunct}, } %===================================================================== % 动态数据修改,修改输入的源文件数据,用于中文判断等 %===================================================================== % % 修改输入的参考文献数据,源文件层的操作 % % 原理方法:增加文献标识符如[M],[J]等 % 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 % 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, % 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 % 注意\DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 \DeclareSourcemap{ \maps[datatype=bibtex]{% \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] } \map{% \step[fieldsource=mark,final] \step[fieldset=usera, origfieldval] } \map{% \step[fieldsource=nameformat,match=lowercase,final] \step[fieldset=namefmtid,fieldvalue={1}] } \map{% \step[fieldsource=nameformat,match=givenahead,final] \step[fieldset=namefmtid,fieldvalue={2}] } \map{% \step[fieldsource=nameformat,match=familyahead,final] \step[fieldset=namefmtid,fieldvalue={3}] } \map{% \step[fieldsource=nameformat,match=pinyin,final] \step[fieldset=namefmtid,fieldvalue={4}] } \map{% %\perdatasource{examples.bib} \pertype{article} \step[fieldset=usera, fieldvalue={J}] } \map{ \pertype{periodical} \step[fieldset=usera, fieldvalue={J}] \step[fieldsource=author] %有时会把author和editor混淆,处理后避免该问题 \step[fieldset=editor, origfieldval] \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后避免该问题 \step[fieldset=institution, origfieldval] } \map{ \pertype{newspaper}%增加一个新闻报纸的类型newspaper \step[fieldset=usera, fieldvalue={N}]%因为没有专门的驱动,这句的目的是定义一个usera域,方便映射为article后判断 \step[fieldset=note, fieldvalue=news] } \map{ \pertype{database}%对应增加的一个数据库类型database \step[fieldset=usera, fieldvalue={DB}]%没有专门的驱动,定义一个usera域,方便映射后使用 } \map{ \pertype{dataset}%对应增加的一个数据集类型dataset \step[fieldset=usera, fieldvalue={DS}]%没有专门的驱动,定义一个usera域,方便映射后使用 } \map{ \pertype{software}%对应增加的一个软件类型software \step[fieldset=usera, fieldvalue={CP}]%没有专门的驱动,定义一个usera域,方便映射后使用 } \map{ \pertype{map}%对应增加的一个舆图类型map \step[fieldset=usera, fieldvalue={CM}]%没有专门的驱动,定义一个usera域,方便映射后使用 } \map{ \pertype{archive}%对应增加的一个档案类型archive \step[fieldset=usera, fieldvalue={A}]%没有专门的驱动,定义一个usera域,方便映射后使用 } \map{ \pertype{misc}%当misc类型带有网址时,将其转换为online类型 \step[fieldsource=url,final] \step[typesource=misc,typetarget=online] } \map{ \pertype{misc}%对应增加的一个备选类型misc \step[fieldset=usera, fieldvalue={Z}]%没有专门的驱动,定义一个usera域,方便映射后使用 } \map{ \pertype{book} \pertype{inbook} \step[fieldset=usera, fieldvalue={M}] \step[fieldsource=version] %有时会把version和edition混淆,处理后避免该问题,可以直接用version \step[fieldset=edition, origfieldval] } \map{ \pertype{standard}%兼容老的standard类型 \step[fieldset=usera, fieldvalue={S}]%因为没有专门的驱动,这句的目的是定义一个usera域,方便映射为book和inbook后判断 \step[fieldset=note, fieldvalue=standard] } \map{ \pertype{patent} \step[fieldset=usera, fieldvalue={P}] } \map{ \pertype{inproceedings} \pertype{conference}%兼容老的conference类型 \step[fieldset=usera, fieldvalue={C}] \step[fieldsource=institution] %有时会把publisher和institution混淆,处理后避免该问题 \step[fieldset=publisher, origfieldval] \step[fieldsource=editor] % \step[fieldset=bookauthor, origfieldval] } \map{ \pertype{proceedings} \step[fieldset=usera, fieldvalue={C}] \step[fieldsource=institution] %有时会把publisher和institution混淆,这里处理后就没有这个问题 \step[fieldset=publisher, origfieldval] \step[fieldsource=editor] %有的时候可能只填写了编者,没有author,把它复制一下 \step[fieldset=author, origfieldval] } \map{ \pertype{report} \pertype{techreport}%兼容老的techreport类型 \step[fieldset=usera, fieldvalue={R}] \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后避免该问题 \step[fieldset=institution, origfieldval] } \map{ \pertype{thesis} \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 \pertype{phdthesis} \step[fieldset=usera, fieldvalue={D}] } \map{ \pertype{online} \pertype{electronic}%兼容老的electronic类型 \pertype{www}%兼容老的www类型 \step[fieldset=usera, fieldvalue={EB}] } \map{ \pertype{manual} \step[fieldset=usera, fieldvalue={A}] \step[fieldsource=edition] %有时会把version和edition混淆,处理后避免该问题,可以直接用version \step[fieldset=version, origfieldval] \step[fieldsource=organization]%因为用的report的驱动,所以需要institution域,把organization转成它以增强兼容性 \step[fieldset=institution, origfieldval] } \map{ \pertype{incollection} \step[fieldset=usera, fieldvalue={G}] } \map{ \pertype{collection} \step[fieldset=usera, fieldvalue={G}] \step[fieldsource=editor] %%有的时候可能只填写了编者,没有author,把它复制一下 \step[fieldset=author, origfieldval] } \map{ \pertype{unpublished} \step[fieldset=usera, fieldvalue={Z}] } \map{ \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] \step[fieldset=userf, fieldvalue={cn}] } \map{ \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] \step[fieldset=usere, fieldvalue={cn}] } \map{%处理一些用year表示date的情况 %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 \step[fieldsource=year] \step[fieldset=date, origfieldval] } \map{%将title信息保存到userd中避免因为标签生成原因导致title域被清除 \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%} \step[fieldset=userd, fieldvalue={cn}] } \map{%将entrykey放入keywords中用于后期的使用 \step[fieldsource=entrykey] \step[fieldset=keywords, origfieldval] } \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 \step[fieldset=keywords, fieldvalue={,}, append] \step[fieldset=keywords, origfieldval, append] } \map{% \step[fieldsource=language,match=english,final] \step[fieldset=langid,fieldvalue={english}] } \map{ \step[fieldsource=language,match=russian,final] \step[fieldset=langid,fieldvalue={russian}] } \map{% \step[fieldsource=language,match=french,final] \step[fieldset=langid,fieldvalue={french}] } \map{% \step[fieldsource=language,match=chinese,final] \step[fieldset=langid,fieldvalue={english}] } \map{% \step[fieldsource=language,match=japnese,final] \step[fieldset=langid,fieldvalue={english}] } \map{% \step[fieldsource=language,match=korean,final] \step[fieldset=langid,fieldvalue={english}] } \map{%把语言信息设置language域内,而不再用userb域(20180525) %接着根据信息域字符的unicode码判断 \step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF \step[fieldset=language,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 \step[fieldset=langid,fieldvalue={french}] } \map{% \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] \step[fieldset=language,fieldvalue={russian}]%俄语 \step[fieldset=langid,fieldvalue={russian}] } \map{% \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] \step[fieldset=language,fieldvalue={japanese}]%日语 \step[fieldset=langid,fieldvalue={english}]%中日韩语目前都用english, } %确定形式后可增加类似andotherscn这样的本地化字符串处理 \map{% \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] \step[fieldset=language,fieldvalue={korean}]%韩语 \step[fieldset=langid,fieldvalue={english}] } \map{%因为无法进行cjk字符判断,所以用反的思路,判断没有英文字符,没有空格,没有逗号等字符情况下 %认为是中文的,将文献language设置成chinese,用于排序 %参考4.5.8 姓名首字母生成控制 %\step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\\\/\-\x22\x26\:0-9\p{IsP}\p{PosixPunct}\x{2bf}\x{2018}\xE9\p{IsASCII}]},final] %对于带重音符号的字符似乎无法匹配。比如\'e %最后选择直接匹配cjk字符,unicode编码位置从2FF0到9FA5 \step[fieldsource=author,match=\regexp{[\x{2FF0}-\x{9FA5}]},final] \step[fieldset=language,fieldvalue={chinese}] } \map{\step[fieldsource=title,match=\regexp{[\x{2FF0}-\x{9FA5}]},final] \step[fieldset=language,fieldvalue={chinese}] }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 \step[fieldset=language,fieldvalue={english}] \step[fieldset=langid,fieldvalue={english}] } } } % % 修改输入的参考文献数据,样式层的操作 % % 原理方法:biblatex3.4以上版本map可使用foreach选项来处理特殊字符 \DeclareStyleSourcemap{ \maps[datatype=bibtex]{ % \map{%尝试未定义数据模型的newspaper类型映射为article,newspaper完全是针对gb7714的新类型,在biblatex中完全没有定义 % %但从实践看,并没有什么影响,映射过来就可以了。 % \step[typesource=newspaper, typetarget=article, final] % } \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook \step[typesource=standard, typetarget=inbook, final] } \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 \step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book } \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 \step[typesource=mastersthesis, typetarget=thesis, final] %\step[fieldset=type, fieldvalue=mathesis] } \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 \step[typesource=phdthesis, typetarget=thesis, final] %\step[fieldset=type, fieldvalue=phdthesis] } \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 \step[typesource=techreport, typetarget=report, final] %\step[fieldset=type, fieldvalue=techreport] } \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] } \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] } \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% address,location,institution,organization}]{ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] } } } \DeclareBibliographyAlias{newspaper}{article}%定义驱动别名,尝试以替代驱动层映射,实践表明是可行的。 \DeclareBibliographyAlias{unpublished}{manual} \DeclareBibliographyAlias{database}{manual} \DeclareBibliographyAlias{dataset}{manual} \DeclareBibliographyAlias{software}{manual} \DeclareBibliographyAlias{map}{manual} \DeclareBibliographyAlias{archive}{manual} %===================================================================== % 参考文献表环境 %===================================================================== % % 列表格式 % % 增加一个\bibitemindent尺寸用于控制list环境的itemindent % v1.0l,20180615,hzz \newlength{\bibitemindent} \setlength{\bibitemindent}{0pt} \setlength{\bibhang}{\biblabelsep}% \defbibenvironment{bibliography} {\list {\printtext[labelnumberwidth]{% \printfield{labelprefix}% \printfield{labelnumber}}} {\setlength{\labelwidth}{\labelnumberwidth}% \setlength{\labelsep}{\biblabelsep}% \setlength{\leftmargin}{\bibhang}% \addtolength{\leftmargin}{\labelnumberwidth}% \setlength{\itemindent}{\bibitemindent}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% \renewcommand*{\makelabel}[1]{\hss##1}} {\endlist} {\item} % % 顺序编码制-标签对齐方式处理 % % 原理方法:利用选项提供的计数器数值做选择 % 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 % 项对齐则是在段落环境下做的处理。 % 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 % 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 % 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 % 修改序号标签格式为: % \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX % \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} \DeclareFieldFormat{labelnumberwidth}{% \ifcase\value{alignlabel}%右对齐,整个标签为右对齐 \mkgbnumlabel{#1}% \or%左对齐,整个标签为左对齐 \mkgbnumlabel{#1}\hfill% \or%中间对齐,比如:序号数字居于[]中间 \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% \fi} % % 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 \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 {}} \newlength{\lengthid} \newlength{\lengthlw} \newcommand{\itemcmd}{% \settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} \addtolength{\lengthid}{\biblabelsep} \setlength{\lengthlw}{\textwidth} \addtolength{\lengthlw}{-\lengthid} \addvspace{\bibitemsep}%恢复\bibitemsep的作用 %\parshape 2 0em \textwidth \lengthid \lengthlw \hangindent\lengthid \mkgbnumlabel{\printfield{labelnumber}}% \hspace{\biblabelsep}} % % 简单的段落环境 \defbibenvironment{bibliography} {\begingroup\setlength{\parindent}{0em}} {\endgroup} {\itemcmd}} %===================================================================== % 设置单元或块等的标点 %===================================================================== \renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin \renewcommand*{\subtitlepunct}{\addcolon\space} %修改标题和其它标题信息间的标点,来源biblatex.def, % % 利用set实现的多语言文献不同语言间的分隔符 % 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 % % 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets % 这里调整一下两种语言参考文献的间隔,源来自biblatex.def \renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} \renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 %===================================================================== % 修改域的格式,重定义域的输出宏 %===================================================================== % % 新增文献类型标识符的格式 % \DeclareFieldFormat{gbtypeflag}{% \iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符 {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% }{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}} % % 新增用于报纸的文献类型标识符的格式 % \DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper \iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符 {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% }{\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}} % % 新增用于标准的文献类型标识符的格式 % \DeclareFieldFormat{gbtypeflags}{%用于标准standard \iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符 {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% }{\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}} % % 重设title等参考文献信息的输出格式 % % 原理方法:修改来自biblatex.def文件的原格式 \newcommand{\bibtitlefont}{} \newcommand{\bibauthorfont}{} \newcommand{\bibpubfont}{} % % 作者信息的输出格式 % % 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen % 20180603,v1.0l,增加使用nameformat域来选择姓名格式 \DeclareNameFormat{namefmtselected}{% \iffieldundef{namefmtid}{}% {\defcounter{namefmtcase}{\thefield{namefmtid}}}% \ifcase\value{namefmtcase}% \ifgiveninits {\usebibmacro{name:gbuppercase} {\namepartfamily} {\namepartgiveni} {\namepartprefix} {\namepartsuffix}} {\usebibmacro{name:gbuppercase} {\namepartfamily} {\namepartgiven} {\namepartprefix} {\namepartsuffix}}% \or \ifgiveninits {\usebibmacro{name:gblowercase} {\namepartfamily} {\namepartgiveni} {\namepartprefix} {\namepartsuffix}} {\usebibmacro{name:gblowercase} {\namepartfamily} {\namepartgiven} {\namepartprefix} {\namepartsuffix}}% \or \ifgiveninits {\usebibmacro{name:given-family} {\namepartfamily} {\namepartgiveni} {\namepartprefix} {\namepartsuffix}} {\usebibmacro{name:given-family} {\namepartfamily} {\namepartgiven} {\namepartprefix} {\namepartsuffix}}% \or \ifgiveninits {\usebibmacro{name:family-given} {\namepartfamily} {\namepartgiveni} {\namepartprefix} {\namepartsuffix}} {\usebibmacro{name:family-given} {\namepartfamily} {\namepartgiven} {\namepartprefix} {\namepartsuffix}}% \or \usebibmacro{name:gbpinyin} {\namepartfamily} {\namepartgiven} {\namepartprefix} {\namepartsuffix}% \fi \usebibmacro{name:andothers}} \DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 \DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family \DeclareNameAlias{citename}{default}% Default used by \citename \DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} %\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% %GB/T 7714-2015 风格,全部大写 \newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 \renewcommand*{\revsdnamepunct}{}% \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}}% } %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 \newbibmacro*{name:gblowercase}[4]{\bibauthorfont% \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def \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{{#1}}}\isdot% \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} {\usebibmacro{name:delim}{#1}% \usebibmacro{name:hook}{#1}% \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% \ifboolexpe{% test {\ifdefvoid{#2}} and test {\ifdefvoid{#3}}} {}{\revsdnamepunct}% \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% } %中文常见风格,汉语拼音全拼模式 \newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def \renewrobustcmd*{\bibnamedelima}{\mbox{-}}% \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\MakeSentenceCase{\mkbibnamegiven{#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{\MakeCapital{#2}}\isdot}%\MakeCapital \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% } \def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily %\urlstyle{rm} %使用这句也一样 \setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 \setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 \setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 \DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 % % beamer中文献标题后的标点问题 % v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen % % 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: % texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 % 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 % 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct \@ifclassloaded{beamer}{ \DeclareFieldFormat{title}{#1}% \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} \AtBeginDocument{% \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} % % 专利的公告日期、或报纸的日期的输出宏 % 20160701,v1.0,新增加 % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen % % 原理方法:加上printtext避免破坏异步标点机制 % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 % 所以无法再用选项设置的方法,印象需要用底层的命令 % 这里可以用\blx@isodate,但用自定义的\blx@gbdate,以避免版本判断 \newbibmacro*{newsdate}{%% \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% } \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 \iffieldundef{year}{% \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% {\printtext{(}\printenddate\printtext{)}}% }{\iffieldequalstr{year}{}{%因为year存在,但为空 }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% }% }% % % biblatex>v3.8版利用related实现双语文献的处理 % %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 \newcommand{\defdoublelangentry}[2]{% \edef\entrykeya{#1} \edef\entrykeyb{#2} \DeclareStyleSourcemap{ \maps[datatype=bibtex]{ \map{ \step[fieldsource=entrykey, match=\entrykeya, final] \step[fieldset=related, fieldvalue=\entrykeyb] } } } } % 关联文献的输出格式 % % 关联文献间的分隔符 % \renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 % % 关联文献块前的分隔符,针对biblatex>3.11 % % 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 \ifdef{\begrelateddelim}{\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}}{} % % 新增一个样式用于调整期刊年份的格式,只打印年份 % \newbibmacro*{periodical+issue}{% \printtext{%去掉了[parens] \iffieldundef{issue} {%\usebibmacro{date}%修改为下一句 }% {\printfield{issue}% \setunit*{\addspace}% %\usebibmacro{date}%修改为下一句 }% }% %\newunit } % % 重设专利title的输出,将文献类型标识符输出出去 % \newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 \ifboolexpr{% test{\iffieldundef{title}}% and% test{\iffieldundef{subtitle}}% }% {}% {\printtext[title]{\bibtitlefont% \printfield[titlecase]{title}% \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 {}{\setunit{\subtitlepunct}% \printfield[titlecase]{subtitle}}% \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 {\setunit{\subtitlepunct}\printfield{titleaddon}}% \setunit{\subtitlepunct}\printfield{number}%写专利号 \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 %\newunit }% }% } %===================================================================== %设置驱动格式 %===================================================================== \AtEveryBibitem{% \ifboolexpr{ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{cn}} } { \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} \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 [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}{\iftoggle{bbx:titlelink}{% \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} {} {%\usebibmacro{bytranslator+othersstrg} %\setunit{\addspace}% \printnames[bytranslator]{translator}% \clearname{translator}% \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 \setunit*{\addspace}% \newunit}% \usebibmacro{withothers}} % % 修改作者数量超过限定值,做省略时的处理格式 % % 原理方法:判断作者或译者是否中文,若中文用字符等,否则用etcl。 \renewbibmacro*{name:andothers}{% \ifboolexpr{ test {\ifnumequal{\value{listcount}}{\value{liststop}}} and test \ifmorenames }{%这里做一个判断是在处理author还是translator用于两者是不同语言的情况 \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% %这句判断如果放到\andothersdelim后面会在等或etc.前增加一个空格,所以放前面 \ifnumgreater{\value{liststop}}{1} {\finalandcomma}% {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 \printdelim{andothersdelim}\iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{\bibstring{andothers}}% %\andothersdelim\bibstring{andotherscn} }{}} % % url和url日期格式 % \renewbibmacro*{url+urldate}{% %\usebibmacro{url}%%更换url的位置,放到下面 \iffieldundef{urlyear}% {}{%\setunit*{\addspace}% \usebibmacro{urldate}}% \setunit{\addperiod\addspace}% \usebibmacro{url}} \renewbibmacro*{url}{\printfield{url}} % % 重设title的输出 % % 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen % 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 % 利用toggle做标识符是否输出的判断 \renewbibmacro*{title}{% \ifboolexpr{% test{\iffieldundef{title}}% and test{\iffieldundef{subtitle}}% }% {}% {\printtext[title]{\bibtitlefont%增加字体控制命令 \printfield[titlecase]{title}% \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 {}{\setunit{\subtitlepunct}% \printfield[titlecase]{subtitle}}% \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 {\setunit{\subtitlepunct}\printfield{titleaddon}}% \iftoggle{bbx:gbtype}{% \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 {\printfield[gbtypeflag]{usera}}}%其它 }}{}% %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 %\newunit }% }} % % 日期信息的输出格式,针对biblatex<3.7版本 % \DeclareFieldFormat{urldate}{#1} \renewbibmacro*{urldate}{% \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 % % 调整doi+eprint+url格式 % % 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 \renewbibmacro*{doi+eprint+url}{% % \iftoggle{bbx:doi}%把doi的位置放到url后面 % {\printfield{doi}} % {}% %\newunit\newblock \iftoggle{bbx:eprint} {\usebibmacro{eprint}} {}% %\newunit\newblock \iftoggle{bbx:url} {\usebibmacro{url+urldate}} {} \newunit\newblock \iftoggle{bbx:doi} {\printfield{doi}} {}} % % 调整页码的格式,即chapter+pages格式 % \renewbibmacro*{chapter+pages}{% \printfield{chapter}% \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 \setunit{\bibpagespunct}% \printfield{pages}}% %\newunit %这里的标点去掉 } % % 出版社和地址的处理 % % v1.0k,20180425,为出版信息增加字体控制命令,hzz % 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 % 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 % 新增一个样式用于输出连续出版物的地址,单位,时间,%类似\newbibmacro*{publisher+location+date} \newbibmacro*{location+institution+date}{\bibpubfont% \iftoggle{bbx:gbpub}% {\testCJKfirst{userd}% \ifboolexpr{% test {\iflistundef{location}} and test {\iflistundef{institution}}% }{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% {\printtext{[S.l.\space :\space s.n.\adddot]}}% }{% \iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% {\printlist{location}}% \addcolon\addspace% \iflistundef{institution}{% \iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot] {\printlist{institution}}}% \setunit{\addcomma\addspace}% %\usebibmacro{date}% \printfield{year}% \bibrangedash% \iffieldundef{endyear}{}{\printfield{endyear}}% \newunit}% {\printlist{location}% \iflistundef{institution}% {\setunit*{\addcomma\space}} {\setunit*{\addcolon\space}}% \printlist{institution}% \setunit*{\addcomma\space}% \usebibmacro{date}% \newunit}% } % % \renewbibmacro*{publisher+location+date}{\bibpubfont% \iftoggle{bbx:gbpub}% {\testCJKfirst{userd}% \ifboolexpr{% test {\iflistundef{location}} and test {\iflistundef{publisher}}% }{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% {\printtext{[S.l.\space :\space s.n.\adddot]}}% }{% \iflistundef{location}{%\adddot \iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 \iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}% }}% \bibstring{noaddress} {\printlist{location}\addcolon\addspace}% %\addcolon\addspace% \iflistundef{publisher}{% \iffieldequalstr{note}{standard}{}{% \iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% }}% {\printlist{publisher}}}% \setunit*{\addcomma\addspace}%\addcomma\addspace% \usebibmacro{date}% %\newunit %去掉这个标点 }% {\printlist{location}% \iflistundef{publisher} {\setunit*{\addcomma\space}} {\setunit*{\addcolon\space}}% \printlist{publisher}% \setunit*{\addcomma\space}% \usebibmacro{date}% %\newunit }% } % % 对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}}} % % 对version的版本信息做出修改 % \DeclareFieldFormat{version}{%源来自biblatex.DEF \testCJKfirst{userd}% \ifinteger{#1}% {\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% {\mkbibordedition{#1}~\bibstring{version}}}% {#1\isdot}} % % 修改析出文献的文集的标题与附加标题间的符号 % \renewbibmacro*{booktitle}{% \ifboolexpr{ test {\iffieldundef{booktitle}} and test {\iffieldundef{booksubtitle}} } {} {\printtext[booktitle]{\bibtitlefont% \printfield[titlecase]{booktitle}% \setunit{\subtitlepunct}% \printfield[titlecase]{booksubtitle}}% \newunit%标点换成下一句 \setunit{\subtitlepunct}}% \printfield{booktitleaddon}} % % 调整期刊名的格式 % % v1.0k,20180425,增加了字体控制命令,hzz \renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx \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*{volume+number+eid}{%源来自standard.bbx \iftoggle{bbx:gbfieldstd}{% \printfield{volume}% \setunit*{\adddot}% \printfield{number}% \setunit{\addcomma\space}% \printfield{eid}}{% \printfield{volume}% %\setunit*{\adddot}%去掉点号 %\printfield{number}% \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 \iffieldundef{eid}{}{% \setunit{\addcomma\space}% \printfield{eid}}}} % % 调整期刊年份的格式 % \renewbibmacro*{issue+date}{%去掉括号 \printtext{%去掉了[parens] \iffieldundef{issue} {%\usebibmacro{date} \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 {\usebibmacro{date}}% }}% {\printfield{issue}% \setunit*{\addspace}% %\usebibmacro{date} \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 {\usebibmacro{date}}% }}}% %\newunit } % % 调整页码前的标点和去掉期刊文章等页码后面的标点 % \renewbibmacro*{note+pages}{%源来自standard.bbx %\printfield{note}%不要note,note用来判断是否是报纸newspaper \iffieldundef{pages}{}{ \setunit{\bibpagespunct}% \printfield{pages}}% %\newunit } % % 编者的符号修改一下 % \renewbibmacro*{editor}{%源来自biblatex.DEF \ifboolexpr{ test \ifuseeditor and not test {\ifnameundef{editor}} } {\printnames{editor}% \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 {\setunit\addspace}%当没有editortype时,直接用句点 {\setunit{\addcomma\space}% \usebibmacro{editorstrg}}% \clearname{editor}} {}} % % 编者类型做一修改 % \renewbibmacro*{editorstrg}{%源来自biblatex.DEF \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}}}}} % % 修改期刊的标题 % \renewbibmacro*{periodical}{%源来自biblatex.DEF \iffieldundef{title} {} {\printtext[title]{\bibtitlefont% \printfield[titlecase]{title}% %\setunit{\subtitlepunct}% \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 {}{\setunit{\subtitlepunct} \printfield[titlecase]{subtitle}}% % %\iffieldundef{usera}{}{}%在标题后直接给出文献标识字母 \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% }%把编组结束移到这里 }% } % % 期刊的标题做修改 % \renewbibmacro*{title+issuetitle}{%源来自standard.BBX \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}}}% }% {\multivolparser{\thefield{volume}}% \printfield{year}% \setunit{\addcomma\space}%将冒号修改为逗号 \printtext{\multivolfirst}% \printtext{\mkbibparens{\multinumberfirst}}% \bibrangedash% \iffieldundef{endyear}{}{% \printfield{endyear}% \setunit{\addcomma\space}%将冒号修改为逗号 \printtext{\multivolsecond}% \printtext{\mkbibparens{\multinumbersecond}}}% }% \setunit{\addcomma\space}% \printfield{eid}% \setunit{\addspace}% %\usebibmacro{issue+date}% %\setunit{\addcolon\space}% \usebibmacro{issue}% \newunit} % % 修改了一个institution+location+date用于report等类型 % % 20180425,v1.0k,增加了字体控制命令,hzz \renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 \printlist{location}% \iflistundef{institution} {\setunit*{\addcomma\space}} {\setunit*{\addcolon\space}}% \printlist{institution}% \setunit*{\addcomma\space}% \usebibmacro{date}% %\usebibmacro{modifydate}% %\newunit } % % 修改in:用于inbook、incollection、inproceedings等类型 % 2018.04.20,v1.0k,renewed marco,by hzz % % 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 \renewbibmacro*{in:}{% \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\addthinspace}}% {\setunit{\adddot\addspace}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct % % book条目类的驱动 % \csdef{blx@bbx@book}{%%源来自standard.bbx文件 \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}% \iftoggle{bbx:gbstrict}{}{% \newunit \printlist{language}% \newunit\newblock% \usebibmacro{byauthor}% \newunit\newblock}% \usebibmacro{byeditor+others}% \newunit\newblock% \printfield{edition}% \newunit% \iffieldundef{maintitle}% {\printfield{volume}% \printfield{part}}% {}% \iftoggle{bbx:gbstrict}{}{% \newunit% \printfield{volumes}% \newunit\newblock% \usebibmacro{series+number}}% \newunit\newblock% %\printfield{note}% %\newunit\newblock% \usebibmacro{publisher+location+date}% %\newunit\newblock %这里标点去掉 \usebibmacro{chapter+pages}% \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}} % % 文集中析出文献类型驱动 % % 直接利用inbook做incollection \csdef{blx@bbx@incollection}{% \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}% \usebibmacro{in:}% %\printtext{\texttt{//}\addthinspace}% \usebibmacro{bybookauthor}% \ifnameundef{bookauthor}{}{\newunit}%替换下一句 %\newunit\newblock \usebibmacro{maintitle+booktitle}% \newunit\newblock % \usebibmacro{byeditor+others}% % \newunit\newblock \printfield{edition}% \newunit \iffieldundef{maintitle} {\printfield{volume}% \printfield{part}} {}% \newunit \printfield{volumes}% \newunit\newblock \usebibmacro{series+number}% \newunit\newblock %\printfield{note}% %\newunit\newblock \usebibmacro{publisher+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% %\newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isbn}} {}% \newunit\newblock % \usebibmacro{doi+eprint+url}% % \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}} % % 期刊文章,连续出版物中的析出文献的格式 % \csdef{blx@bbx@article}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/translator+others}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \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}} % % 连续出版物的驱动 % \csdef{blx@bbx@periodical}{%源来自standard.BBX \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{editor}% %\setunit{\labelnamepunct}\newblock \newunit\newblock %删除上面一行,添加这一行 \usebibmacro{title+issuetitle}% \newunit\newblock% \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 \newunit\newblock%添加这一行 \iftoggle{bbx:gbstrict}{}{% \printlist{language}% \newunit\newblock \usebibmacro{byeditor}% \newunit\newblock \printfield{note}% \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}} % % 专利文献驱动 % \csdef{blx@bbx@patent}{%源来自standard.BBX \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author}% \setunit{\labelnamepunct}\newblock %\usebibmacro{title}% \usebibmacro{patenttitle}%给出专利专用的标题输出 \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor}}% \newunit\newblock \printfield{type}% \setunit*{\addspace}% %\printfield{number}%已放到patenttitle中处理 \iflistundef{location} {} {\setunit*{\addspace}% \printtext{%[parens] \printlist[][-\value{listtotal}]{location}}}% \newunit\newblock \usebibmacro{byholder}% \newunit\newblock \printfield{note}% \newunit\newblock \usebibmacro{newsdate}% %\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}} % % 在线文献驱动 % \csdef{blx@bbx@online}{%源来自standard.BBX \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}% %\setunit{\labelnamepunct}\newblock \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor}% \newunit\newblock \usebibmacro{byeditor+others}}% \newunit\newblock \printfield{version}% \newunit \printfield{note}% \newunit\newblock \printlist{organization}% \newunit\newblock %\usebibmacro{date}% \usebibmacro{modifydate}%修改为带括号的时间 \usebibmacro{url+urldate}%从下面移上来 \newunit\newblock \iftoggle{bbx:eprint} {\usebibmacro{eprint}} {}% \newunit\newblock %\usebibmacro{url+urldate}% %\newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}} % % 学位论文修改 % \csdef{blx@bbx@thesis}{%源来自standard.BBX \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor}% \newunit\newblock \printfield{note}% \newunit\newblock \printfield{type}}% \newunit\newblock \usebibmacro{institution+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% \usebibmacro{doi+eprint+url}% \newunit \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isbn}} {}% \newunit\newblock % \usebibmacro{doi+eprint+url}% % \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}} % % 报告类型驱动 % 2016-11-11,增加了译者信息 % \csdef{blx@bbx@report}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor}}% \newunit\newblock \usebibmacro{byeditor+others}%增加的译者信息 \newunit\newblock \printfield{type}% \setunit*{\addspace}% \printfield{number}% \newunit\newblock \printfield{version}% \newunit \printfield{note}% \newunit\newblock \usebibmacro{institution+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% \usebibmacro{doi+eprint+url}% \newunit \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isrn}} {}% \newunit\newblock % \usebibmacro{doi+eprint+url}% % \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}} % % 手册类型驱动 % 2016-11-11,增加了译者信息 % % 直接利用report做manual \csdef{blx@bbx@manual}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor}}% \newunit\newblock \usebibmacro{byeditor+others}%增加的译者信息 \newunit\newblock \printfield{type}% \setunit*{\addspace}% \printfield{number}% \newunit\newblock \printfield{version}% \newunit \printfield{note}% \newunit\newblock \usebibmacro{institution+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% \usebibmacro{doi+eprint+url}% \newunit \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isrn}} {}% \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的misc驱动 \csdef{blx@bbx@misc}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/editor+others/translator+others}% \setunit{\printdelim{nametitledelim}}\newblock \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit \printlist{language}% \newunit\newblock \usebibmacro{byauthor}% \newunit\newblock \usebibmacro{byeditor+others}}% \newunit\newblock \printfield{howpublished}% \newunit\newblock \printfield{type}% \newunit \printfield{version}% \newunit \printfield{note}% \newunit\newblock \usebibmacro{institution+location+date}% %\usebibmacro{organization+location+date}% %\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}} % % 会议论文文献类型驱动 % \csdef{blx@bbx@inproceedings}{%源来自standard.BBX \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/translator+others}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% % \newunit % \printlist{language}% % \newunit\newblock % \usebibmacro{byauthor}% % \newunit\newblock \usebibmacro{in:}% %\printtext{\texttt{//}\addthinspace}% \usebibmacro{bybookauthor}%用类似inbook的方式处理 \ifnameundef{bookauthor}{}{\newunit}%替换下一句 %\newunit\newblock \usebibmacro{maintitle+booktitle}% \newunit\newblock \usebibmacro{event+venue+date}% \newunit\newblock % \usebibmacro{byeditor+others}% % \newunit\newblock \iffieldundef{maintitle} {\printfield{volume}% \printfield{part}} {}% \newunit \printfield{volumes}% \newunit\newblock \iftoggle{bbx:gbstrict}{}{% \usebibmacro{series+number}% \newunit\newblock \printfield{note}% \newunit\newblock \printlist{organization}% \newunit} \usebibmacro{publisher+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isbn}} {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}} % % 会议论文集文献类型驱动 % \csdef{blx@bbx@proceedings}{%源来自standard.BBX \usebibmacro{bibindex}% \usebibmacro{begentry}% %\usebibmacro{editor+others}% \usebibmacro{author/translator+others}% \setunit{\labelnamepunct}\newblock \usebibmacro{maintitle+title}% \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}}% \newunit\newblock \usebibmacro{event+venue+date}% \newunit\newblock % \usebibmacro{byeditor+others}% % \newunit\newblock \iffieldundef{maintitle} {\printfield{volume}% \printfield{part}} {}% \newunit \printfield{volumes}% \newunit\newblock \iftoggle{bbx:gbstrict}{}{% \usebibmacro{series+number}% \newunit\newblock \printfield{note}% \newunit\newblock \printlist{organization}% \newunit} \usebibmacro{publisher+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% \usebibmacro{doi+eprint+url}%从下面移上来 \newunit \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isbn}} {}% \newunit\newblock % \usebibmacro{doi+eprint+url}% % \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}} % % 专著中的析出文献的格式修改 % \csdef{blx@bbx@inbook}{%源来自standard.bbx \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}% \usebibmacro{in:}% %\printtext{\texttt{//}\addthinspace}%%\texttt{//}\addnbthinspace \usebibmacro{bybookauthor}% \ifnameundef{bookauthor}{}{\newunit}%替换下一句\newblock %\newunit\newblock \usebibmacro{maintitle+booktitle}%}% \newunit\newblock % \usebibmacro{byeditor+others}% % \newunit\newblock \printfield{edition}% \newunit \iffieldundef{maintitle} {\printfield{volume}% \printfield{part}} {}% \iftoggle{bbx:gbstrict}{}{% \newunit \printfield{volumes}% \newunit\newblock \usebibmacro{series+number}}% \newunit\newblock %\printfield{note}% %\newunit\newblock \usebibmacro{publisher+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% %\newunit\newblock \usebibmacro{doi+eprint+url}%移到上面来 \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isbn}} {}% \newunit\newblock %\usebibmacro{doi+eprint+url}% % \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}} % % % 文集类型驱动 % % 直接利用book做collection \csdef{blx@bbx@collection}{% \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} \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor}}% \newunit\newblock \usebibmacro{byeditor+others}% \newunit\newblock \printfield{edition}% \newunit \iffieldundef{maintitle} {\printfield{volume}% \printfield{part}} {}% \newunit \printfield{volumes}% \newunit\newblock \usebibmacro{series+number}% \newunit\newblock %\printfield{note}% %\newunit\newblock \usebibmacro{publisher+location+date}% %\newunit\newblock %这里标点去掉 \usebibmacro{chapter+pages}% \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 \newunit\newblock \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} {\printfield{isbn}} {}% \newunit\newblock %\usebibmacro{doi+eprint+url}% %\newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% \usebibmacro{finentry}} }{} }