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.bbx113
1 files changed, 73 insertions, 40 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 62bdf65054..84729ef0fd 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{2022/05/17 v1.1i}
+\def\versionofgbtstyle{2022/08/29 v1.1j}
\def\versionofbiblatex{\abx@version}
\ProvidesFile{gb7714-2015mx.bbx}[\versionofgbtstyle biblatex bibliography style]
%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
@@ -118,6 +118,7 @@
%为多样式文献表增加的stylesections、styleaysection域:
\DeclareDatamodelFields[type=field,datatype=integer]{aysections}
\DeclareDatamodelFields[type=field,datatype=literal]{styleaysection}
+ \DeclareDatamodelFields[type=field,datatype=integer]{refnumber}
%因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
%不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
@@ -127,6 +128,19 @@
\DeclareDatamodelEntrytypes{newspaper}%
}{}
+%%
+%%符号的垂直位置调整一下
+%% 20220625,hzz,v1.1i
+\newlength{\BracketLift}
+\setlength{\BracketLift}{0.0ex}
+\renewcommand*{\bibleftparen}{\blx@postpunct\raise\BracketLift\hbox{(}}
+\renewcommand*{\bibrightparen}{\blx@postpunct\raise\BracketLift\hbox{)}\midsentence}
+\renewcommand*{\bibleftbracket}{\blx@postpunct\raise\BracketLift\hbox{[}}
+\renewcommand*{\bibrightbracket}{\blx@postpunct\raise\BracketLift\hbox{]}\midsentence}
+\newcommand*{\gbleftparen}{\raise\BracketLift\hbox{(}}
+\newcommand*{\gbrightparen}{\raise\BracketLift\hbox{)}}
+\newcommand*{\gbleftbracket}{\raise\BracketLift\hbox{[}}
+\newcommand*{\gbrightbracket}{\raise\BracketLift\hbox{]}}
%=====================================================================
@@ -155,20 +169,25 @@
% 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
% 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
\DeclareBibliographyOption{gbfootbib}[false]{%
- \ifstrequal{#1}{false}{}{\execgbfootbib}}
+ \ifstrequal{#1}{false}{}{\execgbfootbib\execgbfootbibfmt}}
\ExecuteBibliographyOptions{gbfootbib}
+ %
+ % 增加一个选项,用于控制分离后的脚注的格式
+ % 20220829,v1.1j,hzz
+ % 将原来的一个gbfootbib选项控制所有格式分离为由两个选项gbfootbib和gbfootbibfmt控制
+ % 分离后,gbfootbibfmt实现同(4)这样的方式,gbfootbib则实现全部的格式
+ \DeclareBibliographyOption{gbfootbibfmt}[false]{%
+ \ifstrequal{#1}{false}{}{\execgbfootbib}}
+ \ExecuteBibliographyOptions{gbfootbibfmt}
%%
\newlength{\footbibmargin}
\newlength{\footbiblabelsep}
\setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
\setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
- \def\execgbfootbib%
- {%
- %开启引用跟踪计数器,为使用\ifciteseen等测试命令
- \ExecuteBibliographyOptions{citetracker=true}
- %
- %利用footmisc宏包来实现脚注文献的悬挂对齐
+
+ \def\execgbfootbibfmt%
+ {%利用footmisc宏包来实现脚注文献的悬挂对齐
\AtEndPreamble{
\@ifclassloaded{beamer}{}{
%beamer类因为其特殊性,为避免冲突不调footmisc。
@@ -261,6 +280,12 @@
}%
}{}{}
}
+ }
+
+ \def\execgbfootbib%
+ {%
+ %开启引用跟踪计数器,为使用\ifciteseen等测试命令
+ \ExecuteBibliographyOptions{citetracker=true}
%
%判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
@@ -295,14 +320,14 @@
}%
{\usebibmacro{citesavefn}%
\ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
- {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct
+ {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}%
{\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
}%
{\multicitedelim}%
{\usebibmacro{postnote}}
-
}
+
%
% 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
% 20180814,v1.0m,hzz
@@ -344,6 +369,7 @@
\def\str@references{参考文献}
\def\str@bytranslator{译}
\def\str@andotherscn{等}
+ \def\str@andcn{和}
\def\str@backrefpage{引用页}
\def\str@backrefpages{引用页}
\def\str@noaddress{出版地不详}
@@ -1639,7 +1665,7 @@
\addvspace{\bibitemsep}%恢复\bibitemsep的作用
%\parshape 2 0em \textwidth \lengthid \lengthlw
\hangindent\lengthid
-\mkgbnumlabel{\printfield{labelnumber}}%
+\leavevmode\mkgbnumlabel{\printfield{labelnumber}}%
\hspace{\biblabelsep}}
%
% 简单的段落环境
@@ -1717,14 +1743,14 @@
\iftoggle{bbx:gbmedium}%
{\iftoggle{bbx:url}%
{\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{{\SlashFont/}\thefield{medium}}\gbrightbracket}}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak#1\nobreak\printtext{{\SlashFont/}OL\gbrightbracket}}%
}%
{\ifentrytype{online}%
- {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak#1\nobreak\printtext{{\SlashFont/}OL\gbrightbracket}}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{{\SlashFont/}\thefield{medium}}\gbrightbracket}}%
}}%
- {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak#1\nobreak\printtext{\gbrightbracket}}%
}
%
@@ -1734,11 +1760,11 @@
\iftoggle{bbx:gbmedium}%
{\iftoggle{bbx:url}%
{\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\allowbreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak N\printtext{\iffieldundef{medium}{}{{\SlashFont/}\thefield{medium}}\gbrightbracket}\nobreak}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak N\printtext{{\SlashFont/}OL\gbrightbracket}\nobreak}%
}%
- {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\allowbreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak N\printtext{\iffieldundef{medium}{}{{\SlashFont/}\thefield{medium}}\gbrightbracket}\nobreak}%
+}{\allowbreak\printtext{\gbleftbracket}\nobreak N\printtext{\gbrightbracket}\nobreak}%
}
%
@@ -1748,11 +1774,11 @@
\iftoggle{bbx:gbmedium}%
{\iftoggle{bbx:url}%
{\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\allowbreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak S\printtext{\iffieldundef{medium}{}{{\SlashFont/}\thefield{medium}}\gbrightbracket}\nobreak}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak S\printtext{{\SlashFont/}OL\gbrightbracket}\nobreak}%
}%
- {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\allowbreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
+ {\allowbreak\printtext{\gbleftbracket}\nobreak S\printtext{\iffieldundef{medium}{}{{\SlashFont/}\thefield{medium}}\gbrightbracket}\nobreak}%
+}{\allowbreak\printtext{\gbleftbracket}\nobreak S\printtext{\gbrightbracket}\nobreak}%
}
%
@@ -1776,6 +1802,7 @@
{title}{#1}%\nopunct\unspace
\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def
\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
+\def\SlashFont{\ttfamily}%设置斜杠的字体,比如:[J/OL]中的斜杠;\rmfamily
%\urlstyle{rm} %使用这句也一样
\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
@@ -2283,7 +2310,7 @@
%
\DeclareFieldFormat{urldate}{#1}
\renewbibmacro*{urldate}{%
- \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令
+ \addthinspace\printtext{\gbleftbracket}\printurldate\printtext{\gbrightbracket}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令
%
% 专利的公告日期、或报纸的日期的输出宏
@@ -2305,10 +2332,10 @@
}%
{}%更新或修改日期通常有day信息
{\iffieldundef{year}{%
- \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
- {\printtext{(}\printenddate\printtext{)}}%
+ \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{\gbleftparen}\printeventdate\printtext{\gbrightparen}}}%
+ {\printtext{\gbleftparen}\printenddate\printtext{\gbrightparen}}%
}{\iffieldequalstr{year}{}{%因为year存在,但为空
- }{\printtext{(}\blx@gbdate{}{}\printtext{)}}%
+ }{\printtext{\gbleftparen}\blx@gbdate{}{}\printtext{\gbrightparen}}%
}%
}}%
@@ -2396,14 +2423,15 @@
{\testCJKfirst{userd}%
\ifboolexpr{%
test {\iflistundef{location}} and test {\iflistundef{institution}}%
-}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}%
-{\printtext{[S.l.\space :\space s.n.\adddot]}}%
+}{\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@noaddress}\space :\space\str@nopublisher\gbrightbracket}%
+ {\printtext{\gbleftbracket S.l.\space :\space s.n.\adddot\gbrightbracket}}%
}{%
-\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}%
+\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@noaddress\gbrightbracket}}
+ {\printtext{\gbleftbracket S.l.\adddot\gbrightbracket}}}%
{\printlist{location}}%
\publocpunct%
\iflistundef{institution}{%
-\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}%
+\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@nopublisher\gbrightbracket}}{\printtext{\mkbibbrackets{s.n.}}}}%
{\printlist{institution}}}%
\setunit{\addcomma\addspace}%
%\usebibmacro{date}%
@@ -2430,14 +2458,17 @@ test {\iflistundef{location}} and test {\iflistundef{institution}}%
\iftoggle{bbx:gbpub}%
{\testCJKfirst{userd}%
\ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
- {\iffieldequalstr{entrysubtype}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
+ {\iffieldequalstr{entrysubtype}{standard}{}
+ {\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@noaddress}\space :\space\str@nopublisher\gbrightbracket}%
+ {\printtext{\gbleftbracket S.l.\space :\space s.n.\adddot\gbrightbracket}}}}%
{\iflistundef{location}{%\adddot
\iffieldequalstr{entrysubtype}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
- {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\publocpunct}}}% \bibstring{noaddress}
+ {\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@noaddress\gbrightbracket}\addcolon\addspace}
+ {\printtext{\gbleftbracket S.l.\adddot\gbrightbracket}\publocpunct}}}% \bibstring{noaddress}
{\printlist{location}\publocpunct}%%\addcolon\addspace%
\iflistundef{publisher}{%
\iffieldequalstr{entrysubtype}{standard}{}%
- {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
+ {\iftoggle{ifCJKforgbt}{\printtext{\gbleftbracket\str@nopublisher\gbrightbracket}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
{\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
{\printlist{publisher}}}%
\setunit*{\addcomma\addspace}%\addcomma\addspace%
@@ -2513,7 +2544,7 @@ incollection,proceedings,inproceedings]{number}{%
%
% 对version的版本信息做出修改
%
-\DeclareFieldFormat{version}{%源来自biblatex.DEF
+\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF
\testCJKfirst{userd}%
\ifinteger{#1}%
{\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}%
@@ -2543,10 +2574,11 @@ incollection,proceedings,inproceedings]{number}{%
% 调整期刊名的格式
%
% v1.0k,20180425,增加了字体控制命令,hzz
+% v1.1j,20220527,修复期刊名不存在时多余的标点
\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
\usebibmacro{journal}%
%\setunit*{\addspace}%
- \setunit*{\addcomma\addspace}%修改为增加一个逗号
+ \iffieldundef{journaltitle}{}{\setunit*{\addcomma\addspace}}%修改为增加一个逗号
\iffieldundef{series}
{}
{\newunit
@@ -2554,9 +2586,9 @@ incollection,proceedings,inproceedings]{number}{%
\setunit{\addspace}}%
%\usebibmacro{volume+number+eid}%
%\setunit{\addspace}%
- \usebibmacro{issue+date}%
+ \printtext{\usebibmacro{issue+date}}%使用printtext配合后面的\setunit*来实现后面的逗号的自动处理
%\setunit{\addcolon\space}%
- \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
+ \iffieldundef{volume}{}{\setunit*{\addcomma\space}}%
%换成逗号和空格
\usebibmacro{issue}%
\usebibmacro{volume+number+eid}%把卷期放到年份后面
@@ -2858,8 +2890,9 @@ incollection,proceedings,inproceedings]{number}{%
% 20190212,v1.0q,增加中英文区分,by hzz
%
% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
+% 需要注意\bibstring命令会把首字母大写的。
\renewbibmacro*{in:}{%
- \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace
+ \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak{\SlashFont//}\allowbreak}}%\addthinspace
{\setunit{\adddot\addspace}%
\iffieldequalstr{userd}{chinese}%
{\printtext{\bibstring{incn}}}%