SeuThesiY/config/gb7714-2015ms.cbx

191 lines
5.6 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

%%
%% ---------------------------------------------------------------
%% biblatex-gb7714-2015 --- A biblatex implementation of the
%% GBT7714-2015 citation style,numerical sequence
%% Maintained by huzhenzhen
%% E-mail: hzzmail@163.com
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
\def\versionofgbtstyle{2019/03/28 v1.0r}
\ProvidesFile{gb7714-2015ms.cbx}[\versionofgbtstyle biblatex citation style]
%
% 加载标准样式
%
\RequireCitationStyle{numeric-comp} %numeric
%
% 选项设置
%
\ExecuteBibliographyOptions{
autocite = superscript ,
autopunct = true ,
%sorting = none ,
maxcitenames=1,
mincitenames=1,
}
%textcite标注命令中的标点设置
%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
%
% 定义一个上标方括号wrapper
%
\newcommand*\mkbibsuperbracket[1]{%
\mkbibsuperscript{\mkbibbrackets{#1}}%
}
% 修改postnote的输出格式
\DeclareFieldFormat{postnote}{#1}
%
% 重定义cite命令
%
% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
% v1.0p版后将cite的处理方式修改为类似pagescite而不再使用biblatex的标准方式
\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
{[\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]%
\printfield{postnote}}
% v1.0p 以前用的方式
%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号
% {\usebibmacro{cite:init}%
% \usebibmacro{prenote}}
% {\usebibmacro{citeindex}%
% \usebibmacro{cite:comp}}
% {}
% {\usebibmacro{cite:dump}%
% \usebibmacro{postnote}}
%
% 定义upcite命令
% 20180604v1.0lhzz
% 20190409v1.0rhzz
% 方法:对supercite增加[]
\newrobustcmd*{\upcite}{%
\cite}
%
% 重定义parencite命令以满足标签带页码的国标要求
%
\DeclareCiteCommand{\parencite}%[\mkbibbrackets]
{[\usebibmacro{cite:init}%]
\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{%[
\usebibmacro{cite:dump}]%
\mkbibsuperscript{\printfield{postnote}}}
%
% 新定义pagescite命令以满足标签带页码的国标要求
%
% 原理方法:
% 1.新增页码输出宏
\newbibmacro*{postpages}{%
\iffieldundef{postnote}
{\printfield[postnote]{pages}}
{\printfield{postnote}}}
% 2.新增\pagescite引用命令
\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
{[\usebibmacro{cite:init}%]直接添加方括号
\usebibmacro{prenote}%
}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]%
\usebibmacro{postpages}}
%
% 定义yearpagescite为与ay样式兼容等同于\pagescite
%
\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
{[\usebibmacro{cite:init}%]直接添加方括号
\usebibmacro{prenote}%
}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]%
\usebibmacro{postpages}}
%
% 定义\yearcite命令为与ay样式兼容且提供不输出页码的标签格式
%
% 原理方法:等同于\pagescite但不要页码
\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
{[\usebibmacro{cite:init}%]直接添加方括号
\usebibmacro{prenote}%
}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]}
%
% 定义\authornumcite命令输出作者信息然后在后面带上顺序编码
% 20180427v1.0k增加hzz
% gb7714样式新定义的命令都把cite放到最后比如前面的pagesciteyearcite这里的\authornumcite
% 区别于biblatex定义的命令都把cite放到前面比如citeauthor等。
%见numeric.CBX
\newbibmacro*{cite}{%
\printtext[bibhyperref]{%
\printfield{labelprefix}%
\printfield{labelnumber}%
\ifbool{bbx:subentry}
{\printfield{entrysetcount}}
{}}}
%见numeric.CBX\DeclareCiteCommand{\cite},
\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript]
{\usebibmacro{prenote}}
{\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
{\renewcommand*{\andothersdelim}{\addspace}}%
\printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
\usebibmacro{cite}}}}
{\multicitedelim}
{\mkbibsuperscript{\printfield{postnote}}}
%
% 增加如下多个命令
% 20190409v1.0rhzz
% 方法:利用newcommand或newrobustcmd命令进行定义
% 注意\citet和\citep命令之所以不用newrobustcmd是为避免加载natbib模块后产生冲突
\DeclareCiteCommand{\citet}%
{\usebibmacro{prenote}}
{\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
{\renewcommand*{\andothersdelim}{\addspace}}%
\printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
\usebibmacro{cite}}}}
{\multicitedelim}
{\mkbibsuperscript{\printfield{postnote}}}
\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
{[\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]%
\printfield{postnote}}
\newrobustcmd*{\citetns}%
{\textcite}
\newrobustcmd*{\citepns}%
{\parencite}
\newrobustcmd*{\inlinecite}%
{\parencite}