diff options
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx')
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx | 165 |
1 files changed, 126 insertions, 39 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx index f325830019..2ae26b511e 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx @@ -11,7 +11,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2021/05/06 v1.0y} +\def\versionofgbtstyle{2021/08/19 v1.0z} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style] %\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 @@ -31,10 +31,13 @@ % 20180629,v1.0k,hzz % % 原理方法:适用于3.10以上版本的biblatex,否则给出警告 - \@ifpackagelater{biblatex}{2017/12/28}{}{ + \providetoggle{iftlatest} + \@ifpackagelater{biblatex}{2017/12/28}{% + \toggletrue{iftlatest} %假设是最新版biblatex + }{% \blx@warning@noline{% biblatex version is too old for this style\MessageBreak - if errors raised,Please update biblatex to the latest version.} + if errors raised,Please update biblatex to the latest version.}% } @@ -525,6 +528,7 @@ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family + \ifstrequal{#1}{quanpin}{\setcounter{gbnamefmtcase}{6}}{}%全拼 } @@ -537,6 +541,7 @@ \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} + \ifstrequal{#1}{gb7714-2015ay}{\setaligngbstyleay}{} } @@ -708,21 +713,17 @@ \DeclareSourcemap{%\perdatasource{examples.bib} \maps[datatype=bibtex]{% - \map{%当没有作者时将editor转成author - \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 - \pernottype{inproceedings} - \pernottype{incollection} - \pernottype{periodical}%因为peridical直接使用editor,所以排除 - %注意notfield在低版本biblatex中没有 - %\step[notfield=author,final]%当author不存在,将editor复制给author - \step[fieldsource=editor,fieldtarget=author]%并删除editor + \map{%如果author或者editor或者translator存在,那么设置namea便于后面判断。 + \step[fieldsource=author,final] + \step[fieldset=namea,origfieldval] } - \map{%当没有作者时将translator转成author - \pernottype{inbook} - \pernottype{inproceedings} - \pernottype{incollection} - %\step[notfield=author,final]%当author不存在,将translator复制给author - \step[fieldsource=translator,fieldtarget=author]%并删除translator + \map{% + \step[fieldsource=editor,final] + \step[fieldset=namea,origfieldval] + } + \map{% + \step[fieldsource=translator,final] + \step[fieldset=namea,origfieldval] } \map{%让address和location同步,biblatex中address是location的别名 %因此输出的时候只有location信息,但处理过程中是可以存在address的。 @@ -755,6 +756,10 @@ \step[fieldsource=nameformat,match=pinyin,final] \step[fieldset=namefmtid,fieldvalue={4}] } + \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 + \step[fieldsource=nameformat,match=quanpin,final] + \step[fieldset=namefmtid,fieldvalue={6}] + } \map{%根据article确定文献类型标识符 \pertype{article} \step[fieldset=usera, fieldvalue={J}] @@ -1281,13 +1286,13 @@ \newlength{\lengthid} \newlength{\lengthlw} \newcommand{\itemcmd}{% -\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} -\addtolength{\lengthid}{\biblabelsep} -\setlength{\lengthlw}{\textwidth} -\addtolength{\lengthlw}{-\lengthid} +\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 +\hangindent\lengthid% \mkgbnumlabel{\printfield{labelnumber}}% \hspace{\biblabelsep}} % @@ -1298,6 +1303,25 @@ {\itemcmd}} +% +% 增加一个作者年制文献表格式的文献表输出环境。 +% 20210411,hzz,v1.0x +\def\setaligngbstyleay{% +\setlength{\bibhang}{1em} +\setlength{\bibitemindent}{-\bibhang} +\setlength{\bibitemsep}{4.5pt} +\defbibenvironment{bibliography} + {\list + {} + {\setlength{\leftmargin}{\bibhang}% + \setlength{\itemindent}{\bibitemindent}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}} + {\endlist} + {\item} +} + + %===================================================================== % 设置单元或块等的标点 %===================================================================== @@ -1311,6 +1335,8 @@ % 这里调整一下两种语言参考文献的间隔,源来自biblatex.def \renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} \renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 +% 2021.08.19,增加出版地和出版社之间的标点,hzz +\newcommand{\publocpunct}{\addcolon\addspace}%出版项中:出版社地址后面的标点 %\renewcommand{\relateddelim}{}%\par %===================================================================== @@ -1464,6 +1490,12 @@ {\namepartgiven} {\namepartprefix} {\namepartsuffix}}}% +\or +\usebibmacro{name:gbquanpin} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}% \fi \usebibmacro{name:andothers}} @@ -1560,6 +1592,36 @@ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% } +%中文常见风格,汉语拼音全拼模式 +\newbibmacro*{name:gbquanpin}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY +\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def +\renewrobustcmd*{\bibnamedelima}{}% + \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{\MakeCapital{#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{\MakeCapital{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {} + {\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% +} + \def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily %\urlstyle{rm} %使用这句也一样 @@ -1744,6 +1806,8 @@ %===================================================================== %设置驱动格式 %===================================================================== +%定义译者后面的标点,便于在不同环境下修改。 +\newcommand{\aftertransdelim}{\addcomma\addthinspace}% %中文环境的局部化代码 \def\localsetchinesecode{% @@ -1792,7 +1856,7 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% \iffieldequalstr{usere}{chinese}{\usebibmacro{bytranslator+othersstrg}}{}%“译”的位置换到下面来,即放到译者后面。 %\setunit{\addspace}% \newunit}% - \usebibmacro{withothers}} + \usebibmacro{withothers}}% % \renewbibmacro*{bytranslator+othersstrg}{% \def\abx@tempa{bytranslator}% @@ -1814,7 +1878,7 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% \clearname{afterword}} {}}}% \iffieldequalstr{usere}{chinese}{\bibstring{bytranslatorcn}} - {\bibstring{\abx@tempa}}} + {\bibstring{\abx@tempa}}}% % % 修改作者数量超过限定值,做省略时的处理格式 % v1.0,20160701,hzz @@ -1835,8 +1899,8 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% %袁训来, 陈哲, 肖书海, 等. %胡泳, 范海燕, 译. %潘惠霞, 魏婧, 杨艳, 等译. -\ifcurrentname{translator}{\iffieldequalstr{usere}{chinese}{\addcomma\addthinspace}{}}{}%为了实现上述第二个示例情况做的处理 -}} +\ifcurrentname{translator}{\iffieldequalstr{usere}{chinese}{\aftertransdelim}{}}{}%为了实现上述第二个示例情况做的处理 +}}% % % 修改省略作者后的本地化字符串,比如et al. % v1.0o,20190103,hzz @@ -1993,7 +2057,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% }{% \iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% {\printlist{location}}% -\addcolon\addspace% +\publocpunct% \iflistundef{institution}{% \iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot] {\printlist{institution}}}% @@ -2006,7 +2070,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% {\printlist{location}% \iflistundef{institution}% {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% + {\setunit*{\publocpunct}}% \printlist{institution}% \setunit*{\addcomma\space}% \usebibmacro{date}% @@ -2025,8 +2089,8 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% {\iflistundef{location}{%\adddot \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 - {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} - {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% + {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\publocpunct}}}% \bibstring{noaddress} + {\printlist{location}\publocpunct}%%\addcolon\addspace% \iflistundef{publisher}{% \iffieldequalstr{note}{standard}{}% {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% @@ -2038,7 +2102,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% {\printlist{location}% \iflistundef{publisher} {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% + {\setunit*{\publocpunct}}% \printlist{publisher}% \setunit*{\addcomma\space}% \usebibmacro{date}%%\newunit @@ -2053,7 +2117,7 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}% {\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 \iflistundef{institution} {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% + {\setunit*{\publocpunct}}% \printlist{institution}% \setunit*{\addcomma\space}% \usebibmacro{date}% @@ -2252,6 +2316,29 @@ incollection,proceedings,inproceedings]{number}{% {}{\printnames{bookauthor}}% }% }% +% 责任者如果没有author用editor或translator替代 +% 20210521 v1.0y hzz +%专著如果责任者是editor那么不用输出类型信息 +\renewbibmacro*{editor+others}{% + \ifboolexpr{% + test \ifuseeditor + and + not test {\ifnameundef{editor}}% + }% + {\printnames{editor}% + \clearname{editor}}% + {}}% +%要注意要使用translator那么需要开启usetranslator选项的。 +%注意其中的标点处理。 +\renewbibmacro*{translator+others}{% + \ifboolexpr{% + test \ifusetranslator + and + not test {\ifnameundef{translator}}% + }% + {\renewcommand{\aftertransdelim}{\adddot\addspace}\printnames{translator}% + \clearname{translator}}% + {}}% % % 修改期刊的标题 % @@ -2339,7 +2426,7 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 \usebibmacro{maintitle+title}% \iftoggle{bbx:gbstrict}{}{% \newunit @@ -2517,7 +2604,7 @@ incollection,proceedings,inproceedings]{number}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit% @@ -2562,8 +2649,8 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{ \csdef{blx@bbx@report}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit% @@ -2611,8 +2698,8 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{ \csdef{blx@bbx@manual}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit% @@ -2663,7 +2750,7 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{ \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 \usebibmacro{title}% \iftoggle{bbx:gbstrict}{}{% \newunit |