Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文献类型为@mvbook,书名后未能输出[M]? #173

Open
superfluous-man opened this issue Oct 8, 2023 · 3 comments
Open

文献类型为@mvbook,书名后未能输出[M]? #173

superfluous-man opened this issue Oct 8, 2023 · 3 comments

Comments

@superfluous-man
Copy link

superfluous-man commented Oct 8, 2023

现有一则@mvbook文献条目如下:

@mvbook{FengQi-2019-JiHeLunDaoYinJiBenLiLun,
title = {集合论导引:基本理论},
author = {{冯琦}},
date = {2019},
series = {现代数学基础丛书},
volume = {1},
number = {178},
publisher = {{科学出版社}},
location = {{北京}},
volumes = {3}
}

参考上一条Issue中的办法,修改了BBX文档,隐藏了标题后的卷数信息,保留了文献类型标识后的卷数信息。

引用上述文献后,文献列表输出的是:

冯琦, 2019. 集合论导引:基本理论. 第1卷. 3 vols. 现代数学基础丛书: 178. 北京: 科学出版社.

这个格式有总卷数(3 vols.)信息,但没有[M]文献类型标识。

而将bibtex内容调整为@book类别,则文献列表输出的是:

冯琦, 2019. 集合论导引:基本理论[M]. 第1卷. 现代数学基础丛书: 178. 北京: 科学出版社.

这个格式有[M]文献类型标识,但没有将总卷数(3 vols.)列出。

@book{FengQi-2019-JiHeLunDaoYinJiBenLiLun,
title = {集合论导引:基本理论},
author = {{冯琦}},
date = {2019},
series = {现代数学基础丛书},
volume = {1},
number = {178},
publisher = {{科学出版社}},
location = {{北京}},
volumes = {3}
}

如何调整相关设置,以使@mvbook文献条目列表输出的格式为:

冯琦, 2019. 集合论导引:基本理论[M]. 第1卷. 共3卷. 现代数学基础丛书: 178. 北京: 科学出版社.

3 vols 汉化或英文亦可。

感谢!

@hushidong
Copy link
Owner

改的要稍多一些,卷通常是跟标题放一起的。

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

\usepackage[backend=biber,style=gb7714-2015ay,gbstrict=false]{biblatex}

\DeclareStyleSourcemap{
    \maps[datatype=bibtex]{
        \map{\pertype{mvbook}
            \step[typesource=mvbook,typetarget=book]
            \step[fieldset=usera, fieldvalue={M}]%
            }
    }
}


\renewbibmacro*{title}{%
\ifboolexpr{%
    test{\iffieldundef{title}}%
    and
    test{\iffieldundef{subtitle}}}%
    {}%
    {\printtext[title]{\bibtitlefont%增加字体控制命令
       \printfield[titlecase]{title}%
       \ifboolexpr{test {\iffieldundef{subtitle}}}%增加了对子标题的判断
            {}{\setunit{\subtitlepunct}\printfield[titlecase]{subtitle}}%
       \iffieldundef{titleaddon}{}{\setunit{\subtitlepunct}\printfield{titleaddon}}%判断一下titleaddon
       \ifboolexpr{test{\ifentrytype{book}} and (not test{\iffieldundef{volume}}) and 
       test{\iffieldundef{volumes}}}%判断一下book类有没有volume
            {\setunit{\subtitlepunct}\printfield{volume}}{}%
       \iftoggle{bbx:gbtype}%
            {\iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
            {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
                  {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}% 判断是否为报纸
                  {\printfield[gbtypeflag]{usera}}}}}{}%%其它
       }%
    }%
}


\DeclareFieldFormat[book,inbook,incollection]{volumes}%
{\iffieldequalstr{userd}{chinese}{\iffieldint{volumes}%
        {共 #1\bibstring{volumecn}%
        }{#1}}%
    {\bibstring{volumes}~#1}%
}

\renewbibmacro*{series+number}{%
  \printfield{series}%
  \setunit*{\addcolon\addspace}%
  \printfield{number}%
  \newunit%
  }

\AtEveryBibitem{\clearlist{language}}


  \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}%
{\iffieldundef{volumes}{}{\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}}


\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}},
}

@mvbook{FengQi-2019-JiHeLunDaoYinJiBenLiLun,
title = {集合论导引:基本理论},
author = {{冯琦}},
date = {2019},
series = {现代数学基础丛书},
volume = {1},
number = {178},
publisher = {{科学出版社}},
location = {{北京}},
volumes = {3}
}

@book{FengQi-2019,
title = {集合论导引:基本理论},
author = {{冯琦}},
date = {2019},
series = {现代数学基础丛书},
volume = {1},
number = {178},
publisher = {{科学出版社}},
location = {{北京}},
volumes = {3}
}

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


\begin{document}

\nocite{*}

\printbibliography



 \end{document} 

结果为:

图片

@superfluous-man
Copy link
Author

感谢!

按这个思路,照葫芦画瓢临时性魔改了一下,将卷数调整至title与subtitle之间,并略改标点样式,得到以下中文条目的格式效果:

DeepinScreenshot_select-area_20231009165137.png

示例中的第3卷是略去subtitle的测试格式。

@zepinglee
Copy link
Contributor

按照国标的示例,似乎应该按照这个格式:“题名: 卷次 分卷书名”。

Screenshot 2023-12-31 at 14 51 55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants