Biblatex/Biber:将系列、卷数和编号放在末尾

Biblatex/Biber:将系列、卷数和编号放在末尾

我想要实现这样的目标:

卡夫卡,弗朗茨:《命运多舛》。斯图加特:Philipp Reclam 2001(通用图书馆号 9900)。

而“Universal-Bibliothek”是系列,“Nr. 9900”是编号。

我确实到处寻找解决方案,但一无所获 :-( 我可以发布 MWE,但我认为这种基本内容实际上不需要它。但我可以发布我是如何实现括号等的:

\renewbibmacro*{series+number}{%
    \iffieldundef{series}%
    {}
    {\printtext[parens]{%
        \printfield{series}%
        \iffieldundef{number}%
            {}
            {\setunit{\space}%
            %\bibstring{volume}~
            \printfield{number}}%
        %\adddot
        }}}

它看起来是这样的:

卡夫卡,弗朗茨:《命运多舛》。 (回收通用图书馆编号 9900)。斯图加特:Philipp Reclam 2001。

提前感谢四位帮助:-)

PS:这是 .bib 条目:

@Book{Kafka.2001,
  Title                    = {Die Verwandlung},
  Author                   = {Kafka, Franz},
  Publisher                = {Philipp Reclam},
  Year                     = {2001},
  Address                  = {Stuttgart},
  Number                   = {Nr. 9900},
  Series                   = {Reclams Universal-Bibliothek}
}

答案1

重新排序书目驱动程序中的字段并不总是很容易,但在xpatch包我们可以大大加快这个过程。

首先,我们需要将系列和数字括在括号中

\renewbibmacro*{series+number}{%
  \iffieldundef{series}
    {}
    {\printtext[parens]{%
       \printfield{series}%
       \setunit*{\addspace}%
       \printfield{number}%
       \newunit}}}

然后我们定义一个新命令来摆脱series+number宏,然后稍后添加它。

\newcommand*\patchseries[1]{%
  \xpatchbibdriver{#1}
    {\usebibmacro{series+number}}
    {}
    {}
    {\typeout{Warning: Failed to remove series+number from driver #1.}}
  \xpatchbibdriver{#1}
    {\usebibmacro{publisher+location+date}}
    {\usebibmacro{publisher+location+date}%
     \setunit{\addspace}%
     \usebibmacro{series+number}}
    {}
    {\typeout{Warning: Failed to add series+number to driver #1.}}}

然后你只需使用

\patchseries{book}\patchseries{inbook}
\patchseries{collection}\patchseries{incollection}
\patchseries{proceedings}\patchseries{inproceedings}

对于您想要修补的类型。

平均能量损失

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authortitle]{biblatex}
\usepackage{microtype}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Kafka.2001,
  Title                    = {Die Verwandlung},
  Author                   = {Kafka, Franz},
  Publisher                = {Philipp Reclam},
  Year                     = {2001},
  Address                  = {Stuttgart},
  Number                   = {9900},
  Series                   = {Reclams Universal-Bibliothek}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\usepackage{xpatch}

\renewbibmacro*{series+number}{%
  \iffieldundef{series}
    {}
    {\printtext[parens]{%
       \printfield{series}%
       \setunit*{\addspace}%
       \printfield{number}%
       \newunit}}}

\newcommand*\patchseries[1]{%
  \xpatchbibdriver{#1}
    {\usebibmacro{series+number}}
    {}
    {}
    {\typeout{Warning: Failed to remove series+number from driver #1.}}
  \xpatchbibdriver{#1}
    {\usebibmacro{publisher+location+date}}
    {\usebibmacro{publisher+location+date}%
     \setunit{\addspace}%
     \usebibmacro{series+number}}
    {}
    {\typeout{Warning: Failed to add series+number to driver #1.}}}

\patchseries{book}\patchseries{inbook}
\patchseries{collection}\patchseries{incollection}
\patchseries{proceedings}\patchseries{inproceedings}

\DeclareFieldFormat{number}{\bibstring{number}~#1}

\begin{document}
\blockcquote{Kafka.2001}{Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem ungeheueren Ungeziefer verwandelt.}.

\nocite{sigfridsson,worman,brandt,baez/article}

\printbibliography
\end{document}

示例输出

相关内容