diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx | 1754 |
1 files changed, 1038 insertions, 716 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx index 346898f9f66..ae4afff4c54 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 @@ -3,11 +3,6 @@ %% biblatex-gb7714-2015 --- A biblatex implementation of the %% GBT7714-2015 bibliography style,numerical sequence %% Maintained by huzhenzhen -%% history: -%% 2016/05/20 v1.0 2016/10/23 v1.0a 2016/11/11 v1.0b -%% 2016/11/14 v1.0c 2016/11/24 v1.0d 2016/12/07 v1.0e -%% 2017/02/26 v1.0g 2017/04/11 v1.0h 2017/11/21 v1.0i -%% 2018/01/20 v1.0j 2018/04/03 v1.0k %% E-mail: hzzmail@163.com %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- @@ -16,9 +11,10 @@ % % 版本和时间信息 % -\ProvidesFile{gb7714-2015.bbx}[2018/04/03 v1.0k biblatex bibliography style] -\def\versionofgbtstyle{2018/04/03 v1.0k} +\ProvidesFile{gb7714-2015.bbx}[2018/06/01 v1.0l biblatex bibliography style] +\def\versionofgbtstyle{2018/06/01 v1.0l} \def\versionofbiblatex{\abx@version} +\RequireBiber[3]%显式指定用biber后端 %===================================================================== % 加载标准样式 @@ -36,21 +32,15 @@ % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen % % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest - \providetoggle{iftlfive}%用于处理biblatex3.2之前的版本 - \providetoggle{iftlsix}%用于处理biblatex3.3开始改变的新的姓名机制后版本 - \providetoggle{iftlseven}%用于处理biblatex3.7的兼容性 - \providetoggle{iftleight}%用于处理biblatex3.8到3.9的兼容性 - \providetoggle{iftlnine}%用于处理biblatex10的兼容性 - \providetoggle{iftlatest}%用于最新版biblatex,目前是biblatex3.11,20180402 + \providetoggle{iftlfive}\togglefalse{iftlfive}%用于处理biblatex3.2之前的版本 + \providetoggle{iftlsix}\togglefalse{iftlsix}%用于处理biblatex3.3开始改变的新的姓名机制后版本 + \providetoggle{iftlseven}\togglefalse{iftlseven}%用于处理biblatex3.7的兼容性 + \providetoggle{iftleight}\togglefalse{iftleight}%用于处理biblatex3.8到3.9的兼容性 + \providetoggle{iftlnine}\togglefalse{iftlnine}%用于处理biblatex10的兼容性 + \providetoggle{iftlatest}\toggletrue{iftlatest}%假设是最新版biblatex \StrBefore{\abx@version}{.}[\numinteger]%以点区分整数和小数 \StrBehind{\abx@version}{.}[\numdigital]%小数部分可能带字母所以需将其去掉,见下一行代码 \IfInteger{\numdigital}{}{\StrGobbleRight{\numdigital}{1}[\numdigital]} - \togglefalse{iftlfive} - \togglefalse{iftlsix} - \togglefalse{iftlseven} - \togglefalse{iftleight} - \togglefalse{iftlnine} - \toggletrue{iftlatest} \ifnumcomp{\numinteger}{=}{3}{ \ifnumcomp{\numdigital}{=}{10}{\toggletrue{iftlnine}\togglefalse{iftlatest}}{}%3.10版本 \ifnumcomp{\numdigital}{<}{10}{\ifnumcomp{\numdigital}{>}{7}{\toggletrue{iftleight}\togglefalse{iftlatest}}{}}{}%>3.8版本用iftleight=true表示 @@ -71,28 +61,18 @@ % % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 + % v1.0k,20180509,hzz % - % 原理方法: - % 2E00-2E7F 追加标点 - % 2E80-2EFF cjk部首补充 - % 2FF0-2FFF 表意文字描述符 - % 3000-303F cjk符号和标点 - % 3300-33FF cjk兼容 - % 3400-4DBF cjk统一表意符号扩展 - % 4E00-9FBF cjk统一表意符号 - % 中文范围4E00-9FA5 + % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 + % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 + % 编码用xelatex编译的问题。 + % + % 原理是:利用perl正则将中文标识记录到域中, + % 然后利用\iffieldundef和\iffieldequalstr进行判断 \providetoggle{ifCJKforgbt} - \def\testCJKfirstchar#1#2&{%#1#2& - \ifnumgreater{`#1}{"2E7F}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}% - }% - % 利用edef展开或xstring抽取第一个字符判断 - % 现在采用xstring方法,避免抽取的是编组符号 \def\testCJKfirst#1{% - %\edef\tempa{#1}% - %\expandarg%\noexpandarg - \exploregroups% - \StrChar{#1}{1}[\tempa]% - \expandafter\testCJKfirstchar\tempa&} + \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% + \iffieldequalstr{#1}{cn}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} % % 2个卷的解析函数,用于连续出版物 @@ -114,6 +94,111 @@ {\def\multinumberfirst{#1}\def\multinumbersecond{}}% } + % 对没有分隔符环境命令的低版本biblatex做增补,避免报错 + % + \iftoggle{iftlfive}{ + + \def\blx@inf@delimdeclare#1#2{% + \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}} + + \def\blx@warn@delimuse#1#2{% + \blx@warning{Delimiter '#1' in context '#2' undefined}} + % Delimiter interface + + % [<contextname, ...>]{<name, ...>}{<code>} + \newrobustcmd*{\DeclareDelimFormat}{% + \@ifstar + {\blx@declaredelimclear} + {\blx@declaredelim}} + + \newrobustcmd*{\blx@declaredelimclear}[3][]{% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{\csundef{blx@printdelim@##1@#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}% + \cslet{blx@declaredelimcontexts@#2}\@empty + \ifblank{#1} + {\blx@declaredelim{#2}{#3}} + {\blx@declaredelim[#1]{#2}{#3}}} + + \newrobustcmd*{\blx@declaredelim}[3][]{% + \ifblank{#1} + {\blx@declaredelim@i{}{}{#2}{#3}} + {\def\do##1{% + \listcsadd{blx@declaredelimcontexts@#2}{##1}% + \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}% + \docsvlist{#1}}}% + + \def\blx@declaredelim@i#1#2#3#4{% + \def\do@i##1{% + \ifcsdef{#1##1} + {\blx@inf@delimdeclare{##1}{#2}} + {}% + \csdef{#1##1}{#4}}% + \forcsvlist{\do@i}{#3}} + + % *[<contextname, ...>]{<alias>}{<delim>} + \newrobustcmd*{\DeclareDelimAlias}{% + \@ifstar + {\blx@declaredelimalias} + {\blx@declaredelimaliasauto}} + + \newrobustcmd*{\blx@declaredelimalias}[3][]{% + \ifblank{#1} + {\blx@declaredelimalias@i{}{#2}{#3}} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}% + \docsvlist{#1}}} + + \newrobustcmd*{\blx@declaredelimaliasauto}[2]{% + \blx@declaredelimalias@i{}{#1}{#2}% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}} + + \def\blx@declaredelimalias@i#1#2#3{% + \ifcsdef{#1#2} + {\blx@inf@delimdeclare{#2}{#1}} + {}% + \csdef{#1#2}{\csuse{#1#3}}} + + \def\blx@delimcontext{none} + \newcommand*{\printdelim}[2][]{% + \ifblank{#1} + {\ifcsdef{blx@printdelim@\blx@delimcontext @#2} + {\csuse{blx@printdelim@\blx@delimcontext @#2}} + {\ifcsdef{#2}% fall back on legacy macros + {\csuse{#2}} + {\blx@warn@delimuse{#2}{*}}}} + {\ifcsdef{blx@printdelim@#1@#2} + {\csuse{blx@printdelim@#1@#2}} + {\blx@warn@delimuse{#2}{#1}}}} + + \newcommand*{\delimcontext}[1]{% + \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} + + \def\blx@delimcontextalias#1{% + \ifcsdef{blx@delimcontextalias@#1} + {\csuse{blx@delimcontextalias@#1}} + {#1}} + + \newcommand*{\DeclareDelimcontextAlias}[2]{% + \csgdef{blx@delimcontextalias@#1}{#2}} + }{} + + +%===================================================================== +% 数据模型定义 +%===================================================================== + %定义类型和载体标识,从gb内容看载体基本属于介质。 + %为与lee zeping的bst的样式统一,使用mark和medium这两域名 + %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 + \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} + \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} + + %===================================================================== % 设置宏包选项 @@ -130,6 +215,102 @@ \settoggle{bbx:gbtype}{#1}} \ExecuteBibliographyOptions{gbtype} + % + % 增加一个源文件编码选择选项,当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}} + \ExecuteBibliographyOptions{gbcodegbk} + + \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}} + \ExecuteBibliographyOptions{gbstrict} + + % + % 增加一个控制标题域超链接设置的选项 + % v1.0k, 2018.05.24, by hzz + % + % 原理方法: + % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 + % 设置为true,则标题设置超链接 + \newtoggle{bbx:titlelink} + \DeclareBibliographyOption{gbtitlelink}[false]{% + \settoggle{bbx:titlelink}{#1}} + \ExecuteBibliographyOptions{gbtitlelink} + + % + % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 + % v1.0l, 2018.07.02, by hzz + % + % 原理方法: + % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 + \newtoggle{bbx:ctexset} + \DeclareBibliographyOption{gbctexset}[true]{% + \settoggle{bbx:ctexset}{#1}} + \ExecuteBibliographyOptions{gbctexset} + + \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}% + \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% + } + \ExecuteBibliographyOptions{gbfieldstd} % % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 @@ -140,40 +321,21 @@ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} \ExecuteBibliographyOptions{gbpub} - - % - % 增加一个处理佚名或noauthor的控制选项 % - % 原理方法:因为在顺序编码制中,不需要使用,这里也增加,为了与作者年制的兼容性考虑。 - \DeclareBibliographyOption{gbnoauthor}[true]{}% + % 增加控制析出文献来源前的标点符号//输出的选项 + % v1.0k, 2018.04.20,added in by hzz + \newtoggle{bbx:gbpunctin} + \DeclareBibliographyOption{gbpunctin}[true]{% + \settoggle{bbx:gbpunctin}{#1}} + \ExecuteBibliographyOptions{gbpunctin} -% -% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 -% -\defversion{3.0}{opt}{ % - % 增加姓名大小写格式处理选项 + % 增加一个处理佚名或noauthor的控制选项 % - \DeclareBibliographyOption{gbnamefmt}[uppercase]{% - %\ifstrequal{##1}{gbuppercase}{}{}% - \ifstrequal{##1}{lowercase}{\execgblowercase}{}% - \ifstrequal{##1}{none}{\execnamedefault}{} - \ifstrequal{##1}{pinyin}{\execnamepinyin}{} - } - %\ExecuteBibliographyOptions{gbnamefmt} + % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错 + \DeclareBibliographyOption{gbnoauthor}[true]{}% - % - % 增加标签对齐选项 - % - % 原理方法:right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式, - % 因为在这种biblatex低版本中,舍弃了list类环境后,会出错。 - % 注意:texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明 - \DeclareBibliographyOption{gbalign}[right]{% - \ifstrequal{##1}{right}{}{} - \ifstrequal{##1}{left}{\setalignleft}{} - \ifstrequal{##1}{gb7714-2015}{}{} - } % % 选项设置 @@ -181,143 +343,160 @@ \ExecuteBibliographyOptions{ sorting=none, useprefix=true, %名字的信息包括前缀 - firstinits=true, %名字有缩写,参考3.1.2.3 Internal - %giveninits=true, date = year, %日期仅写到年 - maxnames = 3,%设置名字最大数量 - minnames = 3 %设置缩减后的名字最小数量 - %uniquename = init + maxbibnames = 3,%设置名字最大数量 + minbibnames = 3, %设置缩减后的名字最小数量 + isbn=false, } -} + % + %为日期相关选项增加选项值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} + + +\@ifpackagelater{biblatex}{2016/03/27} + { % 针对biblatex>=3.3版本的选项设置 + % 增加序号标签格式处理选项 + % v1.0l,20180623,hzz + % + \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% + \csuse{gbbiblabelopt@#1} + } + \ExecuteBibliographyOptions{gbbiblabel} -% -% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版 -% -\defversion{3.4}{opt}{ % % 增加姓名大小写格式处理选项 % \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% - %\ifstrequal{##1}{gbuppercase}{}{}% - \ifstrequal{##1}{lowercase}{\execgblowercase}{}% - \ifstrequal{##1}{none}{\execnamedefault}{} - \ifstrequal{##1}{pinyin}{\execnamepinyin}{} + \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 } - %\ExecuteBibliographyOptions{gbnamefmt} + \ExecuteBibliographyOptions{gbnamefmt} % % 增加标签对齐选项 % % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 \DeclareBibliographyOption[string]{gbalign}[right]{% - \ifstrequal{##1}{left}{\setalignleft}{} - \ifstrequal{##1}{gb7714-2015}{\setaligngbstyle}{} + \ifstrequal{#1}{right}{\setcounter{alignlabel}{0}}{} + \ifstrequal{#1}{left}{\setcounter{alignlabel}{1}}{} + \ifstrequal{#1}{center}{\setcounter{alignlabel}{2}}{} + \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} } - + } + {% 针对biblatex<3.3版本的选项设置 % - % 选项设置 + % 增加序号标签格式处理选项 + % v1.0l,20180623,hzz % - \ExecuteBibliographyOptions{ - sorting=none, - useprefix=true, %名字的信息包括前缀 - %firstinits=true, %名字有缩写,参考3.1.2.3 Internal - giveninits=true, - date = year, %日期仅写到年 - maxnames = 3 , %设置名字最大数量 - minnames = 3 %设置缩减后的名字最小数量 - %uniquename = init + \DeclareBibliographyOption{gbbiblabel}[bracket]{% + \csuse{gbbiblabelopt@#1} } -} - + \ExecuteBibliographyOptions{gbbiblabel} -% -% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 -% -\defversion{3.7}{opt}{ % % 增加姓名大小写格式处理选项 % - \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% - %\ifstrequal{##1}{gbuppercase}{}{}% - \ifstrequal{##1}{lowercase}{\execgblowercase}{}% - \ifstrequal{##1}{none}{\execnamedefault}{} - \ifstrequal{##1}{pinyin}{\execnamepinyin}{} + \DeclareBibliographyOption{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 } - %\ExecuteBibliographyOptions{gbnamefmt} + \ExecuteBibliographyOptions{gbnamefmt} % % 增加标签对齐选项 % - % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 - \DeclareBibliographyOption[string]{gbalign}[right]{% - \ifstrequal{##1}{left}{\setalignleft}{} - \ifstrequal{##1}{gb7714-2015}{\setaligngbstyle}{} + % 原理方法:right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式, + % 因为在这种biblatex低版本中,舍弃了list类环境后,会出错。 + % 注意:texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明 + \DeclareBibliographyOption{gbalign}[right]{% + \ifstrequal{#1}{right}{\setcounter{alignlabel}{0}}{} + \ifstrequal{#1}{left}{\setcounter{alignlabel}{1}}{} + \ifstrequal{#1}{center}{\setcounter{alignlabel}{2}}{} + \ifstrequal{#1}{gb7714-2015}{}{} } + } - % - % 选项设置 - % + +% +% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 +% +\defversion{3.0}{opt}{ + \ExecuteBibliographyOptions{ + firstinits=true, %名字有缩写,参考3.1.2.3 Internal + } +} +% +% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版 +% +\defversion{3.4}{opt}{ + \ExecuteBibliographyOptions{ + giveninits=true, %名字有缩写,参考3.1.2.3 Internal + } +} +% +% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 +% +\defversion{3.7}{opt}{ \ExecuteBibliographyOptions{ - sorting=none, - useprefix=true, %名字的信息包括前缀 - %firstinits=true, %名字有缩写,参考3.1.2.3 Internal giveninits=true, - date = year, %日期仅写到年 urldate =edtf, %iso8601 eventdate =edtf, - maxnames = 3 , %设置名字最大数量 - minnames = 3 %设置缩减后的名字最小数量 - %uniquename = init } } - % % 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 % \defversion{3.10}{opt}{ - % - % 增加姓名大小写格式处理选项 - % - \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% - %\ifstrequal{##1}{gbuppercase}{}{}% - \ifstrequal{##1}{lowercase}{\execgblowercase}{}% - \ifstrequal{##1}{none}{\execnamedefault}{} - \ifstrequal{##1}{pinyin}{\execnamepinyin}{} - } - %\ExecuteBibliographyOptions{gbnamefmt} - - % - % 增加标签对齐选项 - % - % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 - \DeclareBibliographyOption[string]{gbalign}[right]{% - \ifstrequal{##1}{left}{\setalignleft}{} - \ifstrequal{##1}{gb7714-2015}{\setaligngbstyle}{} - } - - % - % 选项设置 - % \ExecuteBibliographyOptions{ - sorting=none, - useprefix=true, %名字的信息包括前缀 - %firstinits=true, %名字有缩写,参考3.1.2.3 Internal giveninits=true, - date = year, %日期仅写到年 - urldate =iso, %iso8601,edtf - eventdate =iso, - maxnames = 3 , %设置名字最大数量 - minnames = 3 %设置缩减后的名字最小数量 - %uniquename = init + urldate =gb7714-2015, %iso,iso8601,edtf + eventdate =gb7714-2015, } } - % % 根据biblatex版本信息,选择选项设置 % -% 原理方法:如下这种选择机制能自动兼容新的版本,但对于老版本 +% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本 % 必须要把情况列全。 \iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2 \iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6 @@ -334,8 +513,6 @@ % 新建当地化字符串,用来记录“等”字符 % \NewBibliographyString{andotherscn} - \NewBibliographyString{noaddress} - \NewBibliographyString{nopublisher} % % 修改一些当地化字符串 @@ -343,18 +520,18 @@ % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 % 当然也可以增加比如上面定义的andotherscn % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 + \DefineBibliographyStrings{english}{ - bibliography = {参考文献}, - references = {参考文献}, + bibliography = {\str@bibliography}, + references = {\str@references}, %bytranslator= {\addcomma\ 译\adddot}, %将trans. by 改成 译 - bytranslator= {\addcomma\ 译},%\addperiod + bytranslator= {\addcomma\ \str@bytranslator},%\addperiod and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 - andotherscn = {等}, %将超过3个人名的省略,et al.改成为 等 - noaddress = {[S.l.]}, - nopublisher = {[s.n.]}, - backrefpage = {引用页:}, - backrefpages = {引用页:}, + andotherscn = {\str@andotherscn}, %将超过3个人名的省略,et al.改成为 等 + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, } @@ -376,6 +553,26 @@ \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}] @@ -394,6 +591,30 @@ \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 + \step[fieldset=usera, fieldvalue={Z}]%没有专门的驱动,定义一个usera域,方便映射后使用 + } + \map{ \pertype{book} \pertype{inbook} \step[fieldset=usera, fieldvalue={M}] @@ -402,7 +623,7 @@ } \map{ \pertype{standard}%兼容老的standard类型 - \step[fieldset=usera, fieldvalue={M}]%因为没有专门的驱动,这句的目的是定义一个usera域,方便映射为book和inbook后判断 + \step[fieldset=usera, fieldvalue={S}]%因为没有专门的驱动,这句的目的是定义一个usera域,方便映射为book和inbook后判断 \step[fieldset=note, fieldvalue=standard] } \map{ @@ -468,16 +689,22 @@ \step[fieldset=usera, fieldvalue={Z}] } \map{ - \step[fieldsource=author] - \step[fieldset=userf, origfieldval] - \step[fieldsource=translator] - \step[fieldset=usere, origfieldval] + \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{([^\\\{])}]%} - \step[fieldset=userd, fieldvalue={$1}] + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%} + \step[fieldset=userd, fieldvalue={cn}] } \map{%将entrykey放入keywords中用于后期的使用 \step[fieldsource=entrykey] @@ -488,6 +715,67 @@ \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}] + } } } @@ -605,31 +893,63 @@ {\switchversion{3.4}{map}}%%当采用3.3<=biblatex版本时 \DeclareBibliographyAlias{newspaper}{article}%定义驱动别名,尝试以替代驱动层映射,实践表明是可行的。 +\DeclareBibliographyAlias{unpublished}{misc} +\DeclareBibliographyAlias{database}{misc} +\DeclareBibliographyAlias{dataset}{misc} +\DeclareBibliographyAlias{software}{misc} +\DeclareBibliographyAlias{map}{misc} +\DeclareBibliographyAlias{archive}{manual} %===================================================================== % 参考文献表环境 %===================================================================== - % -% 默认的参考文献列表格式,放这里作为参考 +% 列表格式 % -%\defbibenvironment{bibliography} +% 增加一个\bibitemindent尺寸用于控制list环境的itemindent +% v1.0l,20180615,hzz +\newlength{\bibitemindent} +\setlength{\bibitemindent}{0pt} +\setlength{\bibhang}{\biblabelsep}% -% -% 顺序编码制标签对齐方式处理 -% -% 原理方法:修改序号标签格式为左对齐,注意各参考文献内容还是对齐的, -% 这样就会使得序号标签与参考文献内容的间隔增大,这个问题是没有办法解决的 -% 因为采用list做具有一定宽度的序号标签,\labelwidth只能设置一个,且是最宽的标签的宽度 -% 但总的来说参考文献内容对齐是合理和漂亮的, -% 而标签则只能对齐一个方向,要么左对齐要么右对齐,看个人选择了。 +\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} -% \iftoggle{alignleft}{\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}\hfill}}{}%这种方式无效是因为加载时就已经展开了。 -% -% 修改序号标签格式为左对齐 -\def\setalignleft{\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{##1}\hfill}} +\DeclareFieldFormat{labelnumberwidth}{% +\ifcase\value{alignlabel}%右对齐,整个标签为右对齐 + \mkgbnumlabel{#1}% +\or%左对齐,整个标签为左对齐 + \mkgbnumlabel{#1}\hfill% +\or%中间对齐,比如:序号数字居于[]中间 + \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% +\fi} + % % 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 \def\setaligngbstyle{% @@ -665,14 +985,17 @@ \newlength{\lengthid} \newlength{\lengthlw} \newcommand{\itemcmd}{% -\settowidth{\lengthid}{[\printfield{labelnumber}]} +\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 -[\printfield{labelnumber}]\hspace{\biblabelsep}} +\mkgbnumlabel{\printfield{labelnumber}}% +\hspace{\biblabelsep}} +% +% 简单的段落环境 \defbibenvironment{bibliography} {\begingroup\setlength{\parindent}{0em}} {\endgroup} @@ -702,34 +1025,38 @@ % \DeclareFieldFormat{gbtypeflag}{% \iftoggle{bbx:url}{\iffieldundef{url}%当存在url时,增加一个OL标识符 -{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% +{\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{]}}} +}{\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{]}\nobreak}% +{\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\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{]}\nobreak}% +{\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}} +}{\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}} % % 重设title等参考文献信息的输出格式 % % 原理方法:修改来自biblatex.def文件的原格式 -\DeclareFieldFormat{title}{#1\adddot\addthinspace}% -\DeclareFieldFormat{journaltitle}{#1\isdot} +\newcommand{\bibtitlefont}{} +\newcommand{\bibauthorfont}{} +\newcommand{\bibpubfont}{} + +\DeclareFieldFormat{title}{#1\adddot\addthinspace} +\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 \DeclareFieldFormat{issuetitle}{#1} \DeclareFieldFormat{maintitle}{#1} \DeclareFieldFormat{booktitle}{#1} @@ -738,20 +1065,45 @@ {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 [inbook,incollection,inproceedings] - {title}{#1\nopunct\unspace} + {title}{#1}%\nopunct\unspace \DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def +\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily +%\urlstyle{rm} %使用这句也一样 +\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 +\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 +\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 % % 标题的字母大小写格式修改 % -% 注意:修改标题的字母大小写,不同用前面的title的格式而要用titlecase +% 注意:修改标题的字母大小写,不能用前面的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} \DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 +\def\execgbfdfmtstd{%恢复到标准样式的设置 +\DeclareFieldFormat{title}{\mkbibemph{##1}} +\DeclareFieldFormat + [article,inbook,incollection,inproceedings,patent,thesis,unpublished] + {title}{\mkbibquote{##1\isdot}} +\DeclareFieldFormat + [suppbook,suppcollection,suppperiodical] + {title}{##1} +\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} +\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} +\DeclareFieldFormat{maintitle}{\mkbibemph{##1}} +\DeclareFieldFormat{booktitle}{\mkbibemph{##1}} +\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} +\DeclareFieldFormat{titlecase}{##1} +\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} +} + % % 文献标题后的标点问题 -% 20180405,v1.0k,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen +% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen % % 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: % texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 @@ -763,11 +1115,11 @@ test{\iftoggle{iftlsix}} }{}% {%texlive 2017对应iftlseven以上版本 + \@ifclassloaded{beamer}{ \DeclareFieldFormat{title}{#1}% \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} \AtBeginDocument{% - \@ifclassloaded{beamer} - {\patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}{}} + \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} } @@ -797,26 +1149,25 @@ % % 原理方法:判断作者或译者是否中文,若中文用字符等,否则用etcl。 \renewbibmacro*{name:andothers}{% - \ifboolexpr{% + \ifboolexpr{ test {\ifnumequal{\value{listcount}}{\value{liststop}}} and test \ifmorenames - }% - {%这里做一个判断是在处理author还是translator用于两者是不同语言的情况 - \ifcurrentname{translator}{\testCJKfirst{\thefield{usere}}}{\testCJKfirst{\thefield{userf}}}% + }{%这里做一个判断是在处理author还是translator用于两者是不同语言的情况 + \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% %这句判断如果放到\andothersdelim后面会在等或etc.前增加一个空格,所以放前面 - \ifnumgreater{\value{liststop}}{1}% + \ifnumgreater{\value{liststop}}{1} {\finalandcomma}% - {\finalandcomma}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 -\andothersdelim\iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{\bibstring{andothers}}% + {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 +\printdelim{andothersdelim}\iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{\bibstring{andothers}}% %\andothersdelim\bibstring{andotherscn} -}% -{}} +}{}} % % 重设title的输出 % +% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen % 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 % 利用toggle做标识符是否输出的判断 \renewbibmacro*{title}{% @@ -826,7 +1177,7 @@ test{\iffieldundef{subtitle}}% }% {}% - {\printtext[title]{% + {\printtext[title]{\bibtitlefont%增加字体控制命令 \printfield[titlecase]{title}% \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 {}{\setunit{\subtitlepunct}% @@ -845,355 +1196,284 @@ }} % -% 作者信息的输出格式,针对biblatex<3.3版本,gbt7714-2015的姓名全大写格式 +% 作者信息的输出格式 % -\defversion{3.0}{name}{ - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY - %\renewrobustcmd*{\bibinithyphendelim}{\addnbspace}%biblatex.STY,名中间带-符号的情况下的首字母缩写中间的分隔符 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - %biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 - \renewbibmacro*{name:last-first}[4]{% - \ifuseprefix - {\usebibmacro{name:delim}{##3##1}% - \usebibmacro{name:hook}{##3##1}% - \ifblank{##3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{##3}}\isdot} - {\mkbibnameprefix{##3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - %\mkbibnamelast{#1}\isdot - \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{\MakeUppercase{##1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 - %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{##2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{##2}}\isdot}% - \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}} - {\usebibmacro{name:delim}{##1}% - \usebibmacro{name:hook}{##1}% - %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{\MakeUppercase{##1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{##2##3}{}{\revsdnamepunct}% - \ifblank{##2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{##2}}\isdot}% - \ifblank{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot}% - \addcomma\addspace% - \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}% - } - } - \renewbibmacro*{name:first-last}[4]{% - \usebibmacro{name:last-first}{##1}{##2}{##3}{##4}} +% 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}}% } -% -% 作者信息的输出格式,针对biblatex>=3.3版本,gbt7714-2015的姓名全大写格式 -% -\defversion{3.4}{name}{ - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY - %\renewrobustcmd*{\bibinithyphendelim}{\addnbspace}%biblatex.STY,名中间带-符号的情况下的首字母缩写中间的分隔符 +%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 +\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - %biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 - \renewbibmacro*{name:given-family}[4]{%用family-given修改后的内容定义given-family - \ifuseprefix - {\usebibmacro{name:delim}{##3##1}% - \usebibmacro{name:hook}{##3##1}% - \ifdefvoid{##3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{##3}}\isdot} - {\mkbibnameprefix{##3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{##2}{\mkbibnamefamily{\MakeCapital{##1}}}{\mkbibnamefamily{\MakeUppercase{##1}}}\isdot% - \ifdefvoid{##2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{##2}}\isdot}%\MakeCapital - \ifdefvoid{##4}{}{\bibnamedelimd\mkbibnamesuffix{##4}\isdot}} - {\usebibmacro{name:delim}{##1}% - \usebibmacro{name:hook}{##1}% - \ifdefvoid{##2}{\mkbibnamefamily{\MakeCapital{##1}}}{\mkbibnamefamily{\MakeUppercase{##1}}}\isdot% - % - \ifboolexpe{% - test {\ifdefvoid{##2}} - and - test {\ifdefvoid{##3}}} - {} - {\revsdnamepunct}% - \ifdefvoid{##2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{##2}}\isdot}%\MakeCapital - \ifdefvoid{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot} - \ifdefvoid{##4}{}{\bibnamedelimd\mkbibnamesuffix{##4}\isdot}} - } - \renewbibmacro*{name:family-given}[4]{% - \usebibmacro{name:given-family}{##1}{##2}{##3}{##4}} + \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}}% } -% -% 作者信息的输出格式,针对biblatex<3.3版本,姓名大小写格式不变 -% -\defversion{3.0}{nameb}{ - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY - %\renewrobustcmd*{\bibinithyphendelim}{\addnbspace}%biblatex.STY,名中间带-符号的情况下的首字母缩写中间的分隔符 +%中文常见风格,汉语拼音全拼模式 +\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}}% +} + + +\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况 + {}{ + %GB/T 7714-2015 风格,全部大写 + \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - %biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 - \renewbibmacro*{name:last-first}[4]{% \ifuseprefix - {\usebibmacro{name:delim}{##3##1}% - \usebibmacro{name:hook}{##3##1}% - \ifblank{##3}{}{% + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% \ifcapital - {\mkbibnameprefix{\MakeCapital{##3}}\isdot} - {\mkbibnameprefix{##3}\isdot}% + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% \ifpunctmark{'}{}{\bibnamedelimc}}% %\mkbibnamelast{#1}\isdot - \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{{##1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} %\mkbibnamelast{\MakeUppercase{#1}}\isdot %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{##2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{##2}}\isdot}% - \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}} - {\usebibmacro{name:delim}{##1}% - \usebibmacro{name:hook}{##1}% + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{{##1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase %\mkbibnamelast{\MakeUppercase{#1}}\isdot %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{##2##3}{}{\revsdnamepunct}% - \ifblank{##2}{}{\bibnamedelimd\mkbibnamefirst{{##2}}\isdot}% - \ifblank{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot}% + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% \addcomma\addspace% - \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}% - } + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% + }% } - \renewbibmacro*{name:first-last}[4]{% - \usebibmacro{name:last-first}{##1}{##2}{##3}{##4}} -} -% -% 作者信息的输出格式,针对biblatex>=3.3版本,姓名大小写格式不变 -% -\defversion{3.4}{nameb}{ - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY - %\renewrobustcmd*{\bibinithyphendelim}{\addnbspace}%biblatex.STY,名中间带-符号的情况下的首字母缩写中间的分隔符 + %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 + \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - %biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 - \renewbibmacro*{name:given-family}[4]{%用family-given修改后的内容定义given-family - \ifuseprefix - {\usebibmacro{name:delim}{##3##1}% - \usebibmacro{name:hook}{##3##1}% - \ifdefvoid{##3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{##3}}\isdot} - {\mkbibnameprefix{##3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{##2}{\mkbibnamefamily{\MakeCapital{##1}}}{\mkbibnamefamily{{##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}} - } - \renewbibmacro*{name:family-given}[4]{% - \usebibmacro{name:given-family}{##1}{##2}{##3}{##4}} -} - -% -% 作者信息的输出格式,针对biblatex<3.3版本,姓名大小写格式采用标准样式 -% -\defversion{3.0}{namec}{ - \renewrobustcmd*{\bibinitperiod}{\adddot} - \renewrobustcmd*{\bibinithyphendelim}{\adddot\addnbspace}%biblatex.STY,名中间带-符号的情况下的首字母缩写中间的分隔符 - \renewcommand*{\revsdnamepunct}{\addcomma} - %biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 - \renewbibmacro*{name:last-first}[4]{% \ifuseprefix - {\usebibmacro{name:delim}{##3##1}% - \usebibmacro{name:hook}{##3##1}% - \ifblank{##3}{}{% + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% \ifcapital - {\mkbibnameprefix{\MakeCapital{##3}}\isdot} - {\mkbibnameprefix{##3}\isdot}% + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% \ifpunctmark{'}{}{\bibnamedelimc}}% - \mkbibnamelast{##1}\isdot - \ifblank{##4}{}{\bibnamedelimd\mkbibnameaffix{##4}\isdot}%这句放到后面 - \ifblank{##2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{##2}}\isdot}} - {\usebibmacro{name:delim}{##1}% - \usebibmacro{name:hook}{##1}% - \mkbibnamelast{##1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{##4}{}{\bibnamedelimd\mkbibnameaffix{##4}\isdot}%这句放到后面 - \ifblank{##2##3}{}{\revsdnamepunct}% - \ifblank{##2}{}{\bibnamedelimd\mkbibnamefirst{{##2}}\isdot}% - \ifblank{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot}% - } + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \addcomma\addspace% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% + }% } - \renewbibmacro*{name:first-last}[4]{% - \usebibmacro{name:last-first}{##1}{##2}{##3}{##4}} -} -% -% 作者信息的输出格式,针对biblatex>=3.3版本,姓名大小写格式采用标准样式 -% -\defversion{3.4}{namec}{ - \renewrobustcmd*{\bibinitperiod}{\adddot} - \renewrobustcmd*{\bibinithyphendelim}{\adddot\addnbspace}%biblatex.STY,名中间带-符号的情况下的首字母缩写中间的分隔符 - \renewcommand*{\revsdnamepunct}{\addcomma} - \renewbibmacro*{name:given-family}[4]{% - \usebibmacro{name:delim}{##2##3##1}% - \usebibmacro{name:hook}{##2##3##1}% - \ifdefvoid{##2}{}{\mkbibnamegiven{##2}\isdot\bibnamedelimd}% - \ifdefvoid{##3}{}{% - \mkbibnameprefix{##3}\isdot - \ifprefchar - {} - {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}% - \mkbibnamefamily{##1}\isdot - \ifdefvoid{##4}{}{\bibnamedelimd\mkbibnamesuffix{##4}\isdot}} - \DeclareNameAlias{family-given}{default} - - \renewbibmacro*{name:family-given}[4]{% - \usebibmacro{name:given-family}{##1}{##2}{##3}{##4}} -} - -% -% 作者信息的输出格式,针对biblatex<3.3版本,姓名大小写格式采用拼音样式 -% -\defversion{3.0}{named}{ - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY + %中文常见风格,汉语拼音全拼模式 + \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \renewrobustcmd*{\bibnamedelima}{\mbox{-}} - - \DeclareNameFormat{first-last}{% - \usebibmacro{name:first-last}{##1}{##3}{##5}{##7}% - \usebibmacro{name:andothers}} - - %biblatex3.3版前(比如texlive2015中的3.0版)的使用方式 - \renewbibmacro*{name:last-first}[4]{% + \renewrobustcmd*{\bibnamedelima}{\mbox{-}}% \ifuseprefix - {\usebibmacro{name:delim}{##3##1}% - \usebibmacro{name:hook}{##3##1}% - \ifblank{##3}{}{% + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% \ifcapital - {\mkbibnameprefix{\MakeCapital{##3}}\isdot} - {\mkbibnameprefix{##3}\isdot}% + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% \ifpunctmark{'}{}{\bibnamedelimc}}% - %\mkbibnamelast{#1}\isdot - \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{\MakeUppercase{##1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 - %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{##2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{##2}}\isdot}% - \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}} - {\usebibmacro{name:delim}{##1}% - \usebibmacro{name:hook}{##1}% - %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{##2}{\MakeCapital##1}{\mkbibnamelast{\MakeUppercase{##1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{##2##3}{}{\revsdnamepunct}% - \ifblank{##2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{##2}}\isdot}% - \ifblank{##3}{}{\bibnamedelimd\mkbibnameprefix{##3}\isdot}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% \addcomma\addspace% - \ifblank{##4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{##4}\isdot}% - } + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% + }% } - \renewbibmacro*{name:first-last}[4]{% - \usebibmacro{name:last-first}{##1}{##2}{##3}{##4}} -} -% -% 作者信息的输出格式,针对biblatex>=3.3版本,姓名大小写格式采用拼音样式 -% -\defversion{3.4}{named}{ - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \renewrobustcmd*{\bibnamedelima}{\mbox{-}} - - \DeclareNameFormat{given-family}{% - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven}%用全名而不是首字母缩写 - {\namepartprefix} - {\namepartsuffix}}% + %%biblatex<3.2版的情况,姓名的处理格式带参数 + \DeclareNameFormat{namefmtselected}{% + \iffieldundef{namefmtid}{}% + {\defcounter{namefmtcase}{\thefield{namefmtid}}}% + \ifcase\value{namefmtcase}% + \iffirstinits + {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}% + \or + \iffirstinits + {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}% + \or + \iffirstinits + {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% + \ifblank{#3#5} + {} + {\usebibmacro{name:revsdelim}}% + \or + \iffirstinits + {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}% + \or + \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}% + \fi \usebibmacro{name:andothers}} - - %biblatex3.3版后(比如texlive2016中的3.4版)的使用方式 - \renewbibmacro*{name:given-family}[4]{%用family-given修改后的内容定义given-family - \ifuseprefix - {\usebibmacro{name:delim}{##3##1}% - \usebibmacro{name:hook}{##3##1}% - \ifdefvoid{##3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{##3}}\isdot} - {\mkbibnameprefix{##3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{##2}{\mkbibnamefamily{\MakeCapital{##1}}}{\mkbibnamefamily{\MakeUppercase{##1}}}\isdot% - \ifdefvoid{##2}{}{\revsdnamepunct\bibnamedelimd\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}} - } - \renewbibmacro*{name:family-given}[4]{% - \usebibmacro{name:given-family}{##1}{##2}{##3}{##4}} } % -% 根据姓名格式控制选项做处理 -% -\iftoggle{iftlfive}%根据texlive/biblatex版本选择 - {%%当采用biblatex<=3.3版本时 - \switchversion{3.0}{name} - }{%%当采用3.3<=biblatex版本时 - \switchversion{3.4}{name} - } -% -\def\execnamedefault{ -\iftoggle{iftlfive}%根据texlive/biblatex版本选择 - {%%当采用biblatex<=3.3版本时 - \switchversion{3.0}{namec} - }{%%当采用3.3<=biblatex版本时 - \switchversion{3.4}{namec} - } -} -% -\def\execgblowercase{ -\iftoggle{iftlfive}%根据texlive/biblatex版本选择 - {%%当采用biblatex<=3.3版本时 - \switchversion{3.0}{nameb} - }{%%当采用3.3<=biblatex版本时 - \switchversion{3.4}{nameb} - } -} -% -\def\execnamepinyin{ -\iftoggle{iftlfive}%根据texlive/biblatex版本选择 - {%%当采用biblatex<=3.3版本时 - \switchversion{3.0}{named} - }{%%当采用3.3<=biblatex版本时 - \switchversion{3.4}{named} - }} - - -% -% url和url日期信息的输出格式 +% url和url日期格式 % \renewbibmacro*{url+urldate}{% %\usebibmacro{url}%%更换url的位置,放到下面 @@ -1205,6 +1485,8 @@ \renewbibmacro*{url}{\printfield{url}} + + % % 日期信息的输出格式,针对biblatex<3.7版本 % @@ -1286,9 +1568,11 @@ % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen % % 原理方法:加上printtext避免破坏异步标点机制 - % + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 \newbibmacro*{newsdate}{%% - \printtext{\blx@isodate{}{}}%% + \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% } \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 @@ -1296,7 +1580,7 @@ \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% {\printtext{(}\printenddate\printtext{)}}% }{\iffieldequalstr{year}{}{%因为year存在,但为空 - }{\printtext{(}\blx@isodate{}{}\printtext{)}}% + }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% }% }% } @@ -1446,13 +1730,14 @@ test{\iftoggle{iftlnine}} % % 出版社和地址的处理 % +% v1.0k,20180425,为出版信息增加字体控制命令,hzz % 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 % 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 % 新增一个样式用于输出连续出版物的地址,单位,时间,%类似\newbibmacro*{publisher+location+date} -\newbibmacro*{location+institution+date}{% +\newbibmacro*{location+institution+date}{\bibpubfont% \iftoggle{bbx:gbpub}% -{\testCJKfirst{\thefield{userd}} -\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}}{\printtext{[S.l.\adddot]}}}% +{\testCJKfirst{userd} +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% {\printlist{location}}% % \iflistundef{institution} % {\setunit*{\addcomma\space}} @@ -1461,7 +1746,7 @@ test{\iftoggle{iftlnine}} % \setunit*{\addcomma\space}% \addcolon\addspace% \iflistundef{institution}{% -\iftoggle{ifCJKforgbt}{\printtext{[出版者不详]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot] +\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot] {\printlist{institution}}% \setunit{\addcomma\addspace}% %\usebibmacro{date}% @@ -1480,18 +1765,18 @@ test{\iftoggle{iftlnine}} } % % -\renewbibmacro*{publisher+location+date}{% +\renewbibmacro*{publisher+location+date}{\bibpubfont% \iftoggle{bbx:gbpub}% -{\testCJKfirst{\thefield{userd}}% +{\testCJKfirst{userd}% \iflistundef{location}{%\adddot \iffieldequalstr{note}{standard}{}{%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 -\iftoggle{ifCJKforgbt}{\printtext{[出版地不详]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}% +\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{[出版者不详]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% +\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}}% @@ -1514,10 +1799,10 @@ test{\iftoggle{iftlnine}} % 对edition版本信息格式做出修改 % \DeclareFieldFormat{edition}{%源来自biblatex.DEF -\testCJKfirst{\thefield{userd}}% +\testCJKfirst{userd}% \iftoggle{ifCJKforgbt}% {\ifinteger{#1}% -{\printtext{#1版}}% +{\printtext{#1\str@edition}}% {#1\isdot}}% {\ifinteger{#1}% {\mkbibordedition{#1}~\bibstring{edition}}% @@ -1527,14 +1812,12 @@ test{\iftoggle{iftlnine}} % 对version的版本信息做出修改 % \DeclareFieldFormat{version}{%源来自biblatex.DEF -\testCJKfirst{\thefield{userd}}% +\testCJKfirst{userd}% \ifinteger{#1}% -{\iftoggle{ifCJKforgbt}{\printtext{#1版}}% +{\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% {\mkbibordedition{#1}~\bibstring{version}}}% {#1\isdot}} - - % % 修改析出文献的文集的标题与附加标题间的符号 % @@ -1545,7 +1828,7 @@ test{\iftoggle{iftlnine}} test {\iffieldundef{booksubtitle}} } {} - {\printtext[booktitle]{% + {\printtext[booktitle]{\bibtitlefont% \printfield[titlecase]{booktitle}% \setunit{\subtitlepunct}% \printfield[titlecase]{booksubtitle}}% @@ -1557,7 +1840,8 @@ test{\iftoggle{iftlnine}} % % 调整期刊名的格式 % -\renewbibmacro*{journal+issuetitle}{%源来自standard.bbx +% v1.0k,20180425,增加了字体控制命令,hzz +\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx \usebibmacro{journal}% %\setunit*{\addspace}% \setunit*{\addcomma\addspace}%修改为增加一个逗号 @@ -1577,6 +1861,26 @@ test{\iftoggle{iftlnine}} %\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}}}} + % % 调整期刊年份的格式 % @@ -1599,18 +1903,6 @@ test{\iftoggle{iftlnine}} } % -% 调整期刊卷和期的格式 -% -\renewbibmacro*{volume+number+eid}{%源来自standard.bbx - \printfield{volume}% - %\setunit*{\adddot}%去掉点号 - %\printfield{number}% - \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 - \iffieldundef{eid}{}{% - \setunit{\addcomma\space}% - \printfield{eid}}} - -% % 调整页码前的标点和去掉期刊文章等页码后面的标点 % \renewbibmacro*{note+pages}{%源来自standard.bbx @@ -1670,7 +1962,7 @@ test{\iftoggle{iftlnine}} \renewbibmacro*{periodical}{%源来自biblatex.DEF \iffieldundef{title} {} - {\printtext[title]{% + {\printtext[title]{\bibtitlefont% \printfield[titlecase]{title}% %\setunit{\subtitlepunct}% \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 @@ -1750,7 +2042,7 @@ test{\iftoggle{iftlnine}} test{\iffieldundef{subtitle}}% }% {}% - {\printtext[title]{% + {\printtext[title]{\bibtitlefont% \printfield[titlecase]{title}% \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 {}{\setunit{\subtitlepunct}% @@ -1768,7 +2060,8 @@ test{\iftoggle{iftlnine}} % % 修改了一个institution+location+date用于report等类型 % -\renewbibmacro*{institution+location+date}{%当没有institution时不处理。 +% 20180425,v1.0k,增加了字体控制命令,hzz +\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 \printlist{location}% \iflistundef{institution} {\setunit*{\addcomma\space}} @@ -1780,6 +2073,15 @@ test{\iftoggle{iftlnine}} %\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 + %===================================================================== %设置驱动格式 @@ -1798,12 +2100,12 @@ test{\iftoggle{iftlnine}} {\setunit{\labelnamepunct}\newblock}}% {\setunit{\labelnamepunct}\newblock}%这个注释去除标题前空格 \usebibmacro{maintitle+title}% -%\usebibmacro{patenttitle}% -\newunit% +\iftoggle{bbx:gbstrict}{}{% +\newunit \printlist{language}% \newunit\newblock% \usebibmacro{byauthor}% -\newunit\newblock% +\newunit\newblock}% \usebibmacro{byeditor+others}% \newunit\newblock% \printfield{edition}% @@ -1812,10 +2114,11 @@ test{\iftoggle{iftlnine}} {\printfield{volume}% \printfield{part}}% {}% +\iftoggle{bbx:gbstrict}{}{% \newunit% \printfield{volumes}% \newunit\newblock% -\usebibmacro{series+number}% +\usebibmacro{series+number}}% \newunit\newblock% %\printfield{note}% %\newunit\newblock% @@ -1843,128 +2146,6 @@ test{\iftoggle{iftlnine}} {}% \usebibmacro{finentry}} - - -% -% 专著中的析出文献的格式修改 -% -\DeclareBibliographyDriver{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}% -%\nopunct -\printtext{\texttt{//}\addthinspace}%%\texttt{//}\addnbthinspace -\usebibmacro{bybookauthor}% -\ifnameundef{bookauthor}{\newblock}{\newunit\newblock}%替换下一句 -%\newunit\newblock -\usebibmacro{maintitle+booktitle}%}% - \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock - \printfield{edition}% - \newunit - \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% - \newunit - \printfield{volumes}% - \newunit\newblock - \usebibmacro{series+number}% - \newunit\newblock - %\printfield{note}% - %\newunit\newblock - \usebibmacro{publisher+location+date}% -%\newunit\newblock - \usebibmacro{chapter+pages}% - \usebibmacro{doi+eprint+url}%移到上面来 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}} -% - - - -% -% 文集类型驱动 -% -% 直接利用book做collection - \DeclareBibliographyDriver{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} - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock - \printfield{edition}% - \newunit - \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% - \newunit - \printfield{volumes}% - \newunit\newblock - \usebibmacro{series+number}% - \newunit\newblock - %\printfield{note}% - %\newunit\newblock - \usebibmacro{publisher+location+date}% - %\newunit\newblock %这里标点去掉 - \usebibmacro{chapter+pages}% - \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 - \newunit\newblock - %\newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}} - % % 文集中析出文献类型驱动 % @@ -1983,14 +2164,15 @@ test{\iftoggle{iftlnine}} {\setunit{\labelnamepunct}\newblock}% %\setunit{\labelnamepunct}\newblock \usebibmacro{title}% -\printtext{\texttt{//}\addthinspace}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后 +\usebibmacro{in:}% +%\printtext{\texttt{//}\addthinspace}% \usebibmacro{bybookauthor}% -\ifnameundef{bookauthor}{\newblock}{\newunit\newblock}%替换下一句 +\ifnameundef{bookauthor}{}{\newunit}%替换下一句 %\newunit\newblock \usebibmacro{maintitle+booktitle}% \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock +% \usebibmacro{byeditor+others}% +% \newunit\newblock \printfield{edition}% \newunit \iffieldundef{maintitle} @@ -2005,15 +2187,17 @@ test{\iftoggle{iftlnine}} %\printfield{note}% %\newunit\newblock \usebibmacro{publisher+location+date}% - \newunit\newblock + %\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{doi+eprint+url}% +% \newunit\newblock \usebibmacro{addendum+pubstate}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% @@ -2024,6 +2208,9 @@ test{\iftoggle{iftlnine}} {}% \usebibmacro{finentry}} + + +% % 期刊文章,连续出版物中的析出文献的格式 % \DeclareBibliographyDriver{article}{% @@ -2032,6 +2219,7 @@ test{\iftoggle{iftlnine}} \usebibmacro{author/translator+others}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock @@ -2039,7 +2227,7 @@ test{\iftoggle{iftlnine}} \newunit\newblock \usebibmacro{bytranslator+others}% \newunit\newblock - \printfield{version}% + \printfield{version}}% \newunit\newblock %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 \usebibmacro{journal+issuetitle}% @@ -2077,15 +2265,16 @@ test{\iftoggle{iftlnine}} %\setunit{\labelnamepunct}\newblock \newunit\newblock %删除上面一行,添加这一行 \usebibmacro{title+issuetitle}% - \newunit% + \newunit\newblock% \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 \newunit\newblock%添加这一行 + \iftoggle{bbx:gbstrict}{}{% \printlist{language}% \newunit\newblock \usebibmacro{byeditor}% \newunit\newblock \printfield{note}% - \newunit\newblock + \newunit\newblock} \iftoggle{bbx:isbn} {\printfield{issn}} {}% @@ -2112,18 +2301,19 @@ test{\iftoggle{iftlnine}} \setunit{\labelnamepunct}\newblock %\usebibmacro{title}% \usebibmacro{patenttitle}%给出专利专用的标题输出 + \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock - \usebibmacro{byauthor}% + \usebibmacro{byauthor}}% \newunit\newblock \printfield{type}% \setunit*{\addspace}% - %\printfield{number}% + %\printfield{number}%已放到patenttitle中处理 \iflistundef{location} {} {\setunit*{\addspace}% - \printtext[parens]{% + \printtext{%[parens] \printlist[][-\value{listtotal}]{location}}}% \newunit\newblock \usebibmacro{byholder}% @@ -2144,6 +2334,7 @@ test{\iftoggle{iftlnine}} {}% \usebibmacro{finentry}} + % % 在线文献驱动 % @@ -2159,12 +2350,13 @@ test{\iftoggle{iftlnine}} {\setunit{\labelnamepunct}\newblock}% %\setunit{\labelnamepunct}\newblock \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock \usebibmacro{byauthor}% \newunit\newblock - \usebibmacro{byeditor+others}% + \usebibmacro{byeditor+others}}% \newunit\newblock \printfield{version}% \newunit @@ -2192,6 +2384,8 @@ test{\iftoggle{iftlnine}} {}% \usebibmacro{finentry}} + + % % 学位论文修改 % @@ -2201,6 +2395,7 @@ test{\iftoggle{iftlnine}} \usebibmacro{author}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock @@ -2208,8 +2403,8 @@ test{\iftoggle{iftlnine}} \newunit\newblock \printfield{note}% \newunit\newblock - \printfield{type}% - \newunit + \printfield{type}}% + \newunit\newblock \usebibmacro{institution+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% @@ -2243,10 +2438,11 @@ test{\iftoggle{iftlnine}} \usebibmacro{author}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock - \usebibmacro{byauthor}% + \usebibmacro{byauthor}}% \newunit\newblock \usebibmacro{byeditor+others}%增加的译者信息 \newunit\newblock @@ -2286,17 +2482,17 @@ test{\iftoggle{iftlnine}} % 2016-11-11,增加了译者信息 % % 直接利用report做manual -%\DeclareBibliographyDriver{report}{% \DeclareBibliographyDriver{manual}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock - \usebibmacro{byauthor}% + \usebibmacro{byauthor}}% \newunit\newblock \usebibmacro{byeditor+others}%增加的译者信息 \newunit\newblock @@ -2332,19 +2528,20 @@ test{\iftoggle{iftlnine}} \usebibmacro{finentry}} % -% 未出版物类型驱动 +% 备选类型驱动 % -% 直接利用report做unpublished -\DeclareBibliographyDriver{unpublished}{% +% 直接利用report做misc +\DeclareBibliographyDriver{misc}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author}% \setunit{\labelnamepunct}\newblock \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% \newunit% \printlist{language}% \newunit\newblock - \usebibmacro{byauthor}% + \usebibmacro{byauthor}}% \newunit\newblock \printfield{type}% \setunit*{\addspace}% @@ -2392,17 +2589,17 @@ test{\iftoggle{iftlnine}} % \newunit\newblock % \usebibmacro{byauthor}% % \newunit\newblock - %\usebibmacro{in:}% - \printtext{\texttt{//}\addthinspace}%似乎顶格加百分号可以避免一些不必要的空格加入,特别是这种直接处理的语句前后 +\usebibmacro{in:}% +%\printtext{\texttt{//}\addthinspace}% \usebibmacro{bybookauthor}%用类似inbook的方式处理 - \ifnameundef{bookauthor}{\newblock}{\newunit\newblock}%替换下一句 + \ifnameundef{bookauthor}{}{\newunit}%替换下一句 %\newunit\newblock \usebibmacro{maintitle+booktitle}% \newunit\newblock \usebibmacro{event+venue+date}% \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock +% \usebibmacro{byeditor+others}% +% \newunit\newblock \iffieldundef{maintitle} {\printfield{volume}% \printfield{part}} @@ -2410,14 +2607,15 @@ test{\iftoggle{iftlnine}} \newunit \printfield{volumes}% \newunit\newblock + \iftoggle{bbx:gbstrict}{}{% \usebibmacro{series+number}% \newunit\newblock \printfield{note}% \newunit\newblock \printlist{organization}% - \newunit + \newunit} \usebibmacro{publisher+location+date}% - \newunit\newblock + %\newunit\newblock \usebibmacro{chapter+pages}% \newunit\newblock \iftoggle{bbx:isbn} @@ -2446,8 +2644,9 @@ test{\iftoggle{iftlnine}} \usebibmacro{author/translator+others}% \setunit{\labelnamepunct}\newblock \usebibmacro{maintitle+title}% + \iftoggle{bbx:gbstrict}{}{% \newunit% - \printlist{language}% + \printlist{language}}% \newunit\newblock \usebibmacro{event+venue+date}% \newunit\newblock @@ -2460,12 +2659,13 @@ test{\iftoggle{iftlnine}} \newunit \printfield{volumes}% \newunit\newblock + \iftoggle{bbx:gbstrict}{}{% \usebibmacro{series+number}% \newunit\newblock \printfield{note}% \newunit\newblock \printlist{organization}% - \newunit + \newunit} \usebibmacro{publisher+location+date}% %\newunit\newblock \usebibmacro{chapter+pages}% @@ -2488,3 +2688,125 @@ test{\iftoggle{iftlnine}} \usebibmacro{related}} {}% \usebibmacro{finentry}} + + +% +% 专著中的析出文献的格式修改 +% +\DeclareBibliographyDriver{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 + \DeclareBibliographyDriver{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}} |