hushidong / biblatex-gb7714-2015

A biblatex implementation of the GB/T7714-2015 bibliography style || GB/T 7714-2015 参考文献著录和标注的biblatex样式包
773 stars 84 forks source link

在选用bibstyle = gb7714-2015ay格式排列文献条目时,如何输出图书所在丛书及其序号? #172

Open superfluous-man opened 1 year ago

superfluous-man commented 1 year ago

在选用bibstyle = gb7714-2015ay格式排列文献条目时,如何输出图书所在丛书及其序号?

@book{barnes-1975-AlgebraicIntroductionMathematical, title = {An Algebraic Introduction to Mathematical Logic}, author = {Barnes, Donald W. and Mack, John M.}, year = {1975}, series = {Graduate {{Texts}} in {{Mathematics}}}, number = {22}, publisher = {{Springer Verlag}}, address = {{New York}}, }

现在的引用格式输出的是:

Barnes, D. W., Mack, J. M., 1975. An Algebraic Introduction to Mathematical Logic [M] . New York: Springer Verlag

在中外文文献统一使用 gb7714-2015ay 格式时,如何像biblatex默认样式那样输出 series title: 22 ?

hushidong commented 1 year ago

可以设置:gbstrict=false ,让输出一些gbt7714不需要输出的信息。

然后对series+number做一下修改,比如:

\usepackage[backend=biber,style=gb7714-2015ay,gbstrict=false]{biblatex}
\renewbibmacro*{series+number}{%
  \printfield{series}%
  \setunit*{\addcolon\addspace}%
  \printfield{number}%
  \newunit%
  }

示例:

% !Mode:: "TeX:UTF-8"
% 用于测试gb7714-2015样式,对于作者姓名格式的控制和选项
% 测试gbnamefmt选项
% 测试bib文件中的nameformat域
\documentclass[twoside]{article}
\usepackage{ctex}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage[top=10pt,bottom=10pt,left=1cm,right=1cm]{geometry}

\usepackage[backend=biber,style=gb7714-2015ay,gbstrict=false]{biblatex}
\renewbibmacro*{series+number}{%
  \printfield{series}%
  \setunit*{\addcolon\addspace}%
  \printfield{number}%
  \newunit%
  }

\begin{filecontents}[force]{\jobname.bib}
@book{barnes-1975, 
title = {An Algebraic Introduction to Mathematical Logic}, 
author = {Barnes, Donald W. and Mack, John M.}, 
year = {1975}, 
series = {Graduate {{Texts}} in {{Mathematics}}}, 
number = {22}, 
publisher = {{Springer Verlag}}, 
address = {{New York}}, 
}

\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}

\printbibliography

 \end{document} 

结果为:

图片

superfluous-man commented 1 year ago

感謝!按上述方式成功達到預期樣式。

選用gbstrict=false時,biblatex 會輸出文獻語種信息。又添加下列代碼,在文獻條目中清除了語種信息。

\AtEveryBibitem{% \clearlist{language}% }

hushidong commented 1 year ago

嗯,很好的临时处理。

superfluous-man commented 1 year ago

按gbstrict=false的方式,發現一個新問題,即圖書帶有volume卷數信息時,在中外文統一使用gb7714-2015ay格式時,文獻條目在書名後與文獻類型標識後會重複輸出卷數信息。

@book{barnes-1975-AlgebraicIntroductionMathematical, title = {An Algebraic Introduction to Mathematical Logic}, author = {Barnes, Donald W. and Mack, John M.}, year = {1975}, series = {Graduate {{Texts}} in {{Mathematics}}}, number = {22}, volume = {2}, publisher = {{Springer Verlag}}, address = {{New York}}, } 這個引用輸出的格式是

Barnes, D. W., Mack, J. M., 1975. An Algebraic Introduction to Mathematical Logic: vol. 2 [M] . Vol. 2. New York: Springer Verlag

出現 vol. 2Vol. 2. 重複。如何設置以可選擇地保留其中一個,隱藏另外一個?

hushidong commented 1 year ago

可以的,把如下代码中的放到导言区即可,或者你直接改gb7714-2015ay.BBX 就是把其中的\printfield{volume}注释掉。

%   book条目类的驱动
%
  \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
\usebibmacro{maintitle+title}%
\iftoggle{bbx:gbstrict}{}{%
\newunit
\printlist{language}%
\newunit\newblock%
\usebibmacro{byauthor}%
\newunit\newblock}%
\usebibmacro{byeditor+others}%
\newunit
\printfield{edition}%
\newunit\newblock%%
\iftoggle{bbx:gbstrict}{}{%
\iffieldundef{maintitle}%
{%\printfield{volume}%
\printfield{part}}%
{}%
\newunit%
\printfield{volumes}%
\newunit\newblock%
\usebibmacro{series+number}}%
\newunit\newblock%
%\printfield{note}%
%\newunit\newblock%
\usebibmacro{publisher+location+date}%
%\newunit\newblock %这里标点去掉
\usebibmacro{chapter+pages}%
  \iffieldundef{url}{}{%当没有网址时也不输出
  \usebibmacro{modifydate}}%带括号的修改或更新日期,
\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
  \newunit\newblock%
  \printfield{pagetotal}%
  \newunit\newblock%
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  %\usebibmacro{doi+eprint+url}%
  %\newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}\usebibmacro{annotation}}
hushidong commented 1 year ago

书的卷通常放到标题后面了,所以把后面的注释掉就好了。

superfluous-man commented 1 year ago

感謝。我看了gb7714-2015ay.BBX文件的相應內容,修改起來的確很方便。