diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx | 568 |
1 files changed, 470 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx index 23517c5562b..593f17155a9 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx @@ -10,10 +10,10 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2019/02/11 v1.0q} +\def\versionofgbtstyle{2019/03/28 v1.0r} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style] -\RequireBiber[3]%显式指定用biber后端 +%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 %===================================================================== %加载标准样式 @@ -190,9 +190,11 @@ %为与lee zeping的bst的样式统一,使用mark和medium这两域名 %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 %为缩略信息文献表增加了shortbooktitle域 + %为多语言排序增加了lansortorder域 \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} + \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} @@ -200,6 +202,14 @@ % 设置宏包选项 %===================================================================== % + % 增加一个控制是否输出type域的选项 + % 20190212,v1,0q,hzz + \newtoggle{bbx:gbfieldtype} + \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 + \settoggle{bbx:gbfieldtype}{#1}} + \ExecuteBibliographyOptions{gbfieldtype} + + % % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 % 20190203,v1.0p,hzz % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 @@ -209,7 +219,11 @@ \ifstrequal{#1}{false}{}{\execgbfootbib}} \ExecuteBibliographyOptions{gbfootbib} - %% + %% + \newlength{\footbibmargin} + \newlength{\footbiblabelsep} + \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 + \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 \def\execgbfootbib% {% %开启引用跟踪计数器,为使用\ifciteseen等测试命令 @@ -221,8 +235,79 @@ %beamer类因为其特殊性,为避免冲突不调footmisc。 %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 - \PassOptionsToPackage{perpage,hang}{footmisc} - \RequirePackage{footmisc}} + %\PassOptionsToPackage{perpage,hang}{footmisc}% + %\RequirePackage{footmisc}% + + %重新实现脚注的根据单页重设脚注号码 + %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 + %v1.0q 20190317 hzz + \@addtoreset{footnote}{page}%重设计数器 + +\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 + \long\def\H@@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} + + } % %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 @@ -238,16 +323,22 @@ % %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 + %v1.0q 20190309 区分使脚注标注适应minipage中的情况 \newbibmacro*{citesavefn}{% - \ifciteseen%当被引用过,则为true + \ifciteseen%当被引用过为true {\ifcsdef{sec\arabic{refsection}et\thefield{entrykey}}%当已经定义过脚注序号信息 {\csgdef{labelsec\arabic{refsection}et\thefield{entrykey}}{% - \str@sameentry\xdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}% - \@makefnmark}% - }% - {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}% + \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}% + \@makefnmark% + }}% + {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + }}% }% - {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}% + {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% } % @@ -320,6 +411,10 @@ \def\str@numbercn{册} \def\str@serialcn{第} \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@editorcn{主编} \AtEndOfPackage{% \iftoggle{bbx:codegbk}{% @@ -458,6 +553,41 @@ \@ifpackagelater{biblatex}{2016/03/27} { % 针对biblatex>=3.3版本的选项设置 + + % 增加不同语言排序的切换选项 + % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru + % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr + % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔 + % v1.0q,20190307,hzz + % + \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{% + \ifstrequal{#1}{chineseahead}%%中文在前的顺序 + {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}% + \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}% + {% + \ifstrequal{#1}{englishahead}% + {\execlanodeah\dealsortlan}% + {\execlanodudf{#1}\dealsortlan}% + }% + } + \ExecuteBibliographyOptions{gblanorder} + + \def\execlanodeah{%中文在后的顺序 + \gdef\lancnorder{4} + \gdef\lanjporder{5} + \gdef\lankrorder{6} + \gdef\lanenorder{1} + \gdef\lanfrorder{2} + \gdef\lanruorder{3}} + + \newcounter{lanordernum} + \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr + \setcounter{lanordernum}{0} + \DeclareListParser{\parsinglanorder}{;} + \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}} + \parsinglanorder{#1} + } + % 增加本地化字符串的中英文切换选项 % gbcitelocal指标注中的本地化字符串 % gbbiblocal 指文献表中的本地化字符串 @@ -498,8 +628,9 @@ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family - \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} - \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given + \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}%family-given + \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}% + \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family } \ExecuteBibliographyOptions{gbnamefmt} @@ -514,6 +645,13 @@ } { + % 增加不同语言排序的切换选项 + % biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项 + % 这里给出仅为兼容性考虑 + % v1.0q,20190307,hzz + % + \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{} + % % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑 % v1.0l,20180623,hzz @@ -529,6 +667,7 @@ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given + \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family } \ExecuteBibliographyOptions{gbnamefmt} @@ -610,6 +749,11 @@ \NewBibliographyString{volumecn} \NewBibliographyString{numbercn} \NewBibliographyString{serialcn} + \NewBibliographyString{incn} + \NewBibliographyString{mathesiscn} + \NewBibliographyString{phdthesiscn} + \NewBibliographyString{editorcn} + \NewBibliographyString{editorscn} % % 修改一些当地化字符串 @@ -639,6 +783,11 @@ andotherskr={외}, andjp={和}, andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, } @@ -815,11 +964,6 @@ \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition \step[fieldset=edition, origfieldval] } - \map{ - \pertype{inbook} - \step[fieldsource=editor]%有时会把editor和bookauthor混淆,处理后使用bookauthor - \step[fieldset=bookauthor, origfieldval] - } \map{%兼容老的standard类型,确定文献类型标识符 \pertype{standard} \step[fieldset=usera, fieldvalue={S}] @@ -835,8 +979,6 @@ \step[fieldset=usera, fieldvalue={C}] \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution \step[fieldset=publisher, origfieldval] - \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor - \step[fieldset=bookauthor, origfieldval] } \map{ \pertype{proceedings} @@ -849,8 +991,6 @@ \step[fieldset=usera, fieldvalue={G}] \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution \step[fieldset=publisher, origfieldval] - \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor - \step[fieldset=bookauthor, origfieldval] } \map{ \pertype{collection} @@ -1050,28 +1190,36 @@ \step[fieldset=userd,origfieldval] } \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - \step[fieldsource=language,match=english,final] + %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分 + %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式 + \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lanenorder] } \map{ - \step[fieldsource=language,match=russian,final] + \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] \step[fieldset=langid,fieldvalue={russian}] + \step[fieldset=lansortorder,fieldvalue=\lanruorder] } \map{% - \step[fieldsource=language,match=french,final] + \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] \step[fieldset=langid,fieldvalue={french}] + \step[fieldset=lansortorder,fieldvalue=\lanfrorder] } \map{% - \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, + \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lancnorder] } \map{% - \step[fieldsource=language,match=japnese,final]%中日韩语目前都用english, + \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lanjporder] } \map{% - \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, + \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lankrorder] } \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 @@ -1082,14 +1230,14 @@ \map{%剩下的全部映射为book \step[typesource=standard, typetarget=book, final] } - \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=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] @@ -1253,6 +1401,41 @@ } } +% +% 不同语言分集调整的实现方式 +% +% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序 +\def\dealsortlan{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + \step[fieldsource=language,match=english,final] + \step[fieldset=lansortorder,fieldvalue=\lanenorder] + } + \map[overwrite]{ + \step[fieldsource=language,match=russian,final] + \step[fieldset=lansortorder,fieldvalue=\lanruorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=french,final] + \step[fieldset=lansortorder,fieldvalue=\lanfrorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lancnorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lanjporder] + } + \map[overwrite]{% + \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lankrorder] + } + } + } +} + % %驱动别名等价于驱动层映射 @@ -1285,15 +1468,13 @@ \field{sortkey} } \sort{ - \field{language} + \field{lansortorder}%language } \sort{%[direction=descending] \field{sortname} \field{author} \field{editor} \field{translator} - \field{sorttitle} - \field{title} } \sort{ \field{sortyear} @@ -1318,15 +1499,13 @@ \field{sortkey} } \sort{ - \field{language} + \field{lansortorder}%language } \sort[direction=descending]{ \field{sortname} \field{author} \field{editor} \field{translator} - \field{sorttitle} - \field{title} } \sort{ \field{sortyear} @@ -1351,7 +1530,7 @@ \field{sortkey} } \sort{ - \field{language} + \field{lansortorder}%language } \sort[direction=descending]{ \field{sortyear} @@ -1362,8 +1541,6 @@ \field{author} \field{editor} \field{translator} - \field{sorttitle} - \field{title} } \sort{ \field{sorttitle} @@ -1384,7 +1561,7 @@ \field{sortkey} } \sort{ - \field{language} + \field{lansortorder}%language } \sort{ \field{sortyear} @@ -1395,8 +1572,6 @@ \field{author} \field{editor} \field{translator} - \field{sorttitle} - \field{title} } \sort{ \field{sorttitle} @@ -1422,15 +1597,13 @@ \field{sortkey} } \sort{ - \field{language} + \field{lansortorder}%language } \sort{%[direction=descending] \field{sortname} \field{author} \field{editor} \field{translator} - \field{sorttitle} - \field{title} } \sort{ \field{sortyear} @@ -1455,15 +1628,13 @@ \field{sortkey} } \sort{ - \field{language} + \field{lansortorder}%language } \sort[direction=descending]{% \field{sortname} \field{author} \field{editor} \field{translator} - \field{sorttitle} - \field{title} } \sort{ \field{sortyear} @@ -1488,7 +1659,7 @@ \field{sortkey} } \sort{ - \field{language} + \field{lansortorder}%language } \sort[direction=descending]{ \field{sortyear} @@ -1499,8 +1670,6 @@ \field{author} \field{editor} \field{translator} - \field{sorttitle} - \field{title} } \sort{ \field{sorttitle} @@ -1521,7 +1690,7 @@ \field{sortkey} } \sort{ - \field{language} + \field{lansortorder}%language } \sort{%[direction=ascending] \field{sortyear} @@ -1532,8 +1701,6 @@ \field{author} \field{editor} \field{translator} - \field{sorttitle} - \field{title} } \sort{ \field{sorttitle} @@ -1623,28 +1790,42 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 % 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 % \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}}]}}} +\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]}}% + }% + {\ifentrytype{online}% + {\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}} +\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}} +\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等参考文献信息的输出格式 @@ -1751,20 +1932,21 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 % v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim % % 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 +% \printnames由start-stop控制项数,默认是1和maxnames/minnames \renewbibmacro*{name:andothers}{% \ifboolexpr{ test {\ifnumequal{\value{listcount}}{\value{liststop}}} and test \ifmorenames - }{\ifnumgreater{\value{liststop}}{1}% - {\finalandcomma}% - {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。 + }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma + {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。 + {}% \printdelim{andothersdelim}\printdelim{strandothersdelim}% }{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: %袁训来, 陈哲, 肖书海, 等. %胡泳, 范海燕, 译. %潘惠霞, 魏婧, 杨艳, 等译. -\ifcurrentname{translator}{\addcomma}{}% +\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 }} % 修改省略作者后的本地化字符串,比如et al. @@ -1775,18 +1957,16 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 % 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 % 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 \DeclareDelimFormat{strandothersdelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效 + \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}% + \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}% + \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}% + \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}% \ifcase\value{gbcitelocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andothersincitecn}}{}%中文已经通过english本地化字符串定义 - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%韩语未定义,所以与bib中一致 - \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}%日与同韩语 - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothersincite}}{}%英语已定义 + \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致 + \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语 + \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义 \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 \or% @@ -1795,9 +1975,8 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \bibstring{andothersincite}% \fi} + \DeclareDelimFormat[bib,biblist]{strandothersdelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - \addspace% \edef\userfieldabcde{userd}% \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% @@ -1806,7 +1985,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \ifcase\value{gbbiblocalcase}% \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% - \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% @@ -1836,7 +2015,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \ifcase\value{gbcitelocalcase}% \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andincite}}{}% \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% @@ -1858,7 +2037,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \ifcase\value{gbbiblocalcase}% \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% @@ -1965,6 +2144,36 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 {\namepartgiven} {\namepartprefix} {\namepartsuffix}% +\or + \ifnumequal{\value{listcount}}{1} + {\ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% + \ifboolexpe{% + test {\ifdefvoid\namepartgiven} + and + test {\ifdefvoid\namepartprefix}} + {} + {\usebibmacro{name:revsdelim}}} + {\ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}}% \fi \usebibmacro{name:andothers}} @@ -2176,6 +2385,17 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}% \or \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}% + \or + \ifnumequal{\value{listcount}}{1} + {\iffirstinits + {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% + \ifblank{#3#5} + {} + {\usebibmacro{name:revsdelim}}} + {\iffirstinits + {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}% \fi \usebibmacro{name:andothers}} } @@ -2606,6 +2826,7 @@ incollection,proceedings,inproceedings]{number}{% {\printdateextralabel}% {\printfield{labelyear}% \printfield{extrayear}}}}}% + \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} } \defversion{3.4}{dateextra}{ @@ -2619,6 +2840,7 @@ incollection,proceedings,inproceedings]{number}{% {\printdateextralabel}% {\printfield{labelyear}% \printfield{extrayear}}}}}% + \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} } \defversion{3.7}{dateextra}{ \DeclareDelimFormat{nameyeardelim}{\addcomma\space} @@ -2631,6 +2853,8 @@ incollection,proceedings,inproceedings]{number}{% {\printlabeldateextra}% {\printfield{labelyear}% \printfield{extrayear}}}}}% + +\newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} } \defversion{3.8}{dateextra}{ \DeclareDelimFormat{nameyeardelim}{\addcomma\space} @@ -2666,8 +2890,40 @@ incollection,proceedings,inproceedings]{number}{% \iflabeldateisdate {\printdateextra} {\printlabeldateextra}}}}% + } + +% +%为mergedate增加选项none,即实现年份不提前到作者后面的标签中 +%也不打印用于区分同作者同年份文献的标识符如(a,b,c) +%目的是实现一些特殊的文献表样式比如ucas的作者年制 +%v1.0q,20190212,hzz +\def\bbx@opt@mergedate@none{% + \renewbibmacro*{date+extradate}{% + \iffieldundef{labelyear} + {} + {}}%[parens]\printtext{\printlabeldateextra} +\renewbibmacro*{bbx:ifmergeddate}{\@secondoftwo}% +\renewbibmacro*{issue+date}{%去掉括号 +\setunit{\addcomma\addspace}% + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}% + {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% + \setunit*{\addspace}}% + %\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}}% + %\newunit + }} + \iftoggle{iftlfive}{\switchversion{3.0}{dateextra}}{}%biblatex<=3.2 \iftoggle{iftlsix}{\switchversion{3.4}{dateextra}}{}%3.3<=biblatex<=3.6 \iftoggle{iftlseven}{\switchversion{3.7}{dateextra}}{}%biblatex=3.7 @@ -2781,7 +3037,46 @@ incollection,proceedings,inproceedings]{number}{% } % +% 编者的符号修改一下 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype前的标点 +% +\renewbibmacro*{editor}{% + \ifboolexpr{ + test \ifuseeditor + and + not test {\ifnameundef{editor}} + } + {\usebibmacro{bbx:dashcheck} + {%\bibnamedash + \printnames{editor}% + } + {\printnames{editor}% + %\setunit{\printdelim{editortypedelim}}% + %\usebibmacro{bbx:savehash} + }% + \usebibmacro{editorstrg}% + %\clearname{editor}% + \setunit{\printdelim{nameyeardelim}}}% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\printdelim{nonameyeardelim}}}% + \ifboolexpr{% +test {\ifentrytype{inbook}} +or +test {\ifentrytype{incollection}} +or +test {\ifentrytype{inproceedings}} +or +test {\ifentrytype{conference}} +}% +{}% +{\usebibmacro{date+extradate}}} + +% % 编者类型做一修改 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 % \renewbibmacro*{editorstrg}{%源来自biblatex.DEF \printtext[editortype]{% @@ -2801,12 +3096,71 @@ incollection,proceedings,inproceedings]{number}{% or test {\ifandothers{editor}} } - {\bibstring{\thefield{editortype}s}} - {\bibstring{\thefield{editortype}}}} + {\printdelim{streditortypes}} + {\printdelim{streditortype}}} {\thefield{editortype}}}% }} % +% 编者类型的本地化字符串输出 +% v1.0q 2019-03-01 hzz +% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 +% 能对不同文境作设置的包括排序,标签等 +% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 +% +\DeclareDelimFormat{streditortypes}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \or% + \bibstring{\thefield{editortype}scn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}s}% + \fi} +% +\DeclareDelimFormat{streditortype}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \or% + \bibstring{\thefield{editortype}cn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}}% + \fi} + + +% +% bookauthor域的输出, +% v1.0q 2019-03-01 hzz +% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, +% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype +\renewbibmacro*{bybookauthor}{% + \ifnameundef{bookauthor}% + {\ifnameundef{editor}% + {}% + {\ifnamesequal{author}{editor}% + {}{\usebibmacro{editor}}}% + }% + {\ifnamesequal{author}{bookauthor}% + {}{\printnames{bookauthor}}% + }% +} + +% % 修改期刊的标题 % \renewbibmacro*{periodical}{%源来自biblatex.DEF @@ -2912,12 +3266,26 @@ incollection,proceedings,inproceedings]{number}{% % % 修改in:用于inbook、incollection、inproceedings等类型 % 2018.04.20,v1.0k,renewed marco,by hzz +% 20190212,v1.0q,增加中英文区分,by hzz % % 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 \renewbibmacro*{in:}{% \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace - {\setunit{\adddot\addspace}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct - + {\setunit{\adddot\addspace}% + \iffieldequalstr{userd}{chinese}% + {\printtext{\bibstring{incn}}}% + {\printtext{\bibstring{in}}}% + }}%\newunit\newblock\intitlepunct + +% +% 修改type域的输出格式 +% 2019.02.12,v1.0q,byhzz +% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 +\DeclareFieldFormat{type}% +{\iffieldequalstr{userd}{chinese}% + {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% + {\ifbibstring{#1}{\bibstring{#1}}{#1}}% +} %===================================================================== %设置驱动格式 @@ -3224,8 +3592,10 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{ \newunit\newblock \usebibmacro{byeditor+others}%增加的译者信息 \newunit\newblock - \printfield{type}% + \iftoggle{bbx:gbfieldtype}{% + \printfield{type}% \setunit*{\addspace}% + }{}% \printfield{number}% \newunit\newblock \printfield{version}% @@ -3314,7 +3684,9 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{ \usebibmacro{in:}% %\printtext{\texttt{//}\addthinspace}% \usebibmacro{bybookauthor}% - \ifnameundef{bookauthor}{}{\newunit}%替换下一句 + \ifnameundef{bookauthor}{% + \ifnameundef{editor}{}{\newunit}% + }{\newunit}%替换下一句 %\newunit\newblock \usebibmacro{maintitle+booktitle}% \setunit{\addcolon}\printfield{volume}\printfield{number}%增加卷和册信息 |