summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx')
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx206
1 files changed, 175 insertions, 31 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx
index 49a4f328c6..475f9bee60 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.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-2015mx.bbx}[\versionofgbtstyle biblatex bibliography style]
%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
@@ -591,6 +591,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}}{}%全拼
}
\ExecuteBibliographyOptions{gbnamefmt}
@@ -603,6 +604,7 @@
\ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
\ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
\ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{}
+ \ifstrequal{#1}{gb7714-2015ay}{\setaligngbstyleay}{}
}
\ExecuteBibliographyOptions{
@@ -759,21 +761,17 @@
\DeclareSourcemap{
\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的。
@@ -806,6 +804,10 @@
\step[fieldsource=nameformat,match=pinyin,final]
\step[fieldset=namefmtid,fieldvalue={4}]
}
+ \map{%处理在bib文件中直接给出文献的姓名格式为全拼的情况
+ \step[fieldsource=nameformat,match=quanpin,final]
+ \step[fieldset=namefmtid,fieldvalue={6}]
+ }
\map{%根据article确定文献类型标识符
\pertype{article}
\step[fieldset=usera, fieldvalue={J}]
@@ -1589,6 +1591,44 @@
{\endgroup}
{\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}
+}
+
+\defbibenvironment{numerical}%作者年制中数字标签的文献表环境
+ {\setlength{\bibhang}{\biblabelsep}%
+ \setlength{\labelnumberwidth}{2em}%
+ \setlength{\bibitemindent}{0pt}%
+ \setlength{\biblabelextend}{0pt}%
+ \setlength{\biblabelextend}{0pt}%
+ \list
+ {\printtext[labelnumberwidth]{\arabic{refnumeric}}}
+ {\usecounter{refnumeric}%
+ \addtolength{\labelnumberwidth}{\biblabelextend}%
+ \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}
%=====================================================================
% 设置单元或块等的标点
@@ -1603,6 +1643,8 @@
% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}
\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
+% 2021.08.19,增加出版地和出版社之间的标点,hzz
+\newcommand{\publocpunct}{\addcolon\addspace}%出版项中:出版社地址后面的标点
%\renewcommand{\relateddelim}{}%\par
%=====================================================================
@@ -1781,6 +1823,7 @@
% v1.0w,20210401,hzz,针对其它语言的译者后的标点与中文不同做处理
% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
% \printnames由start-stop控制项数,默认是1和maxnames/minnames
+\newcommand{\aftertransdelim}{\addcomma\addthinspace}
\renewbibmacro*{name:andothers}{\bibauthorfont%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
@@ -1794,10 +1837,11 @@
%袁训来, 陈哲, 肖书海, 等.
%胡泳, 范海燕, 译.
%潘惠霞, 魏婧, 杨艳, 等译.
-\ifcurrentname{translator}{\iffieldequalstr{usere}{chinese}{\addcomma\addthinspace}{}}{}%为了实现上述第二个示例情况做的处理
+\ifcurrentname{translator}{\iffieldequalstr{usere}{chinese}{\aftertransdelim}{}}{}%为了实现上述第二个示例情况做的处理
}}
+
%
% 修改省略作者后的本地化字符串,比如et al.
% v1.0o,20190103,hzz
@@ -2021,6 +2065,12 @@
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}%
+\or
+\usebibmacro{name:gbquanpin}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}%
\fi
\usebibmacro{name:andothers}}
@@ -2117,6 +2167,37 @@
\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}}%
+}
+
+
%
% url和url日期格式
@@ -2254,7 +2335,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.}}}}%
{\printlist{institution}}}%
@@ -2267,7 +2348,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}%
@@ -2286,8 +2367,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}}%
@@ -2299,7 +2380,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
@@ -2315,7 +2396,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}%
@@ -2573,6 +2654,31 @@ incollection,proceedings,inproceedings]{number}{%
}%
}
+% 责任者如果没有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}}
+ {}}
+
+
%
% 修改期刊的标题
%
@@ -2722,7 +2828,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
@@ -2907,8 +3013,8 @@ incollection,proceedings,inproceedings]{number}{%
\DeclareBibliographyDriver{online}{%源来自standard.BBX
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit%
@@ -2955,8 +3061,8 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\DeclareBibliographyDriver{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%
@@ -3004,8 +3110,8 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\DeclareBibliographyDriver{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%
@@ -3056,8 +3162,8 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\DeclareBibliographyDriver{misc}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit
@@ -3345,6 +3451,44 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
{}%
{\usebibmacro{date+extradate}}}
+% 责任者如果没有author用editor或translator替代
+% 20210521 v1.0y hzz
+%专著如果责任者是editor那么不用输出类型信息
+\renewbibmacro*{editor+others}{%
+ \ifboolexpr{
+ test \ifuseeditor
+ and
+ not test {\ifnameundef{editor}}
+ }
+ {\usebibmacro{bbx:dashcheck}
+ {\bibnamedash}
+ {\printnames{editor}%
+ \usebibmacro{bbx:savehash}}%
+ \clearname{editor}%
+ \setunit{\printdelim{nameyeardelim}}}%
+ {\global\undef\bbx@lasthash
+ \usebibmacro{labeltitle}%
+ \setunit*{\printdelim{nonameyeardelim}}}%
+ \usebibmacro{date+extradate}}
+%要注意要使用translator那么需要开启usetranslator选项的。
+%注意其中的标点处理。
+\renewbibmacro*{translator+others}{%
+ \ifboolexpr{
+ test \ifusetranslator
+ and
+ not test {\ifnameundef{translator}}
+ }
+{\usebibmacro{bbx:dashcheck}
+ {\bibnamedash}
+ {\renewcommand{\aftertransdelim}{\adddot\addspace}\printnames{translator}%
+ \usebibmacro{bbx:savehash}}%
+ \clearname{translator}%
+ \setunit{\printdelim{nameyeardelim}}}%
+ {\global\undef\bbx@lasthash
+ \usebibmacro{labeltitle}%
+ \setunit*{\printdelim{nonameyeardelim}}}%
+ \usebibmacro{date+extradate}}
+
}{}