合并两个书目条目

合并两个书目条目

我的参考书目中有一些匿名文本,我需要查阅这些文本的多个版本/卷。我想根据作者或文本名称对参考书目条目进行排序。在后一种情况下,我在参考书目中得到两个条目,而不是一个。如何避免这种情况?

\documentclass[11pt,english]{scrbook}

\usepackage{csquotes}

\usepackage{fontspec}

\usepackage{polyglossia}
\setdefaultlanguage{english}
\setmainfont{Linux Libertine O}

\usepackage[
  backend=biber,
  style=philosophy-modern,
  publocformat=loccolonpub,
  inbeforejournal=true]{biblatex}

\addbibresource{biblio.bib}

以下是书目条目:

@misc{
title = {Text},
  note =     {\textit{Text}, ed. by editor, Publisher, I, place},
  date =     date,
}

@misc{
title = {Text},
  note =     {\textit{Text}, ed. by editor, Publisher, II, place},
  date =     anotherdate,
}

答案1

默认情况下,biblatex-philosophyphilosophy-modern样式仅折叠作者/编辑/翻译者列表。但经过一些工作,我们还可以让它遵守在没有作者的情况下使用的后备标题。这涉及记住我们打印的标题并检查它是否与我们再次打印的标题一致。

authorbbx:editorbbx:translator取自philosophy-modern.bbx,仅进行了少量修改(\global\undef\bbx@lasttitle如果名称已定义,则添加一个,\usebibmacro{labeltitle}并由我们的新 替换\usebibmacro{printhead:labeltitle})。printhead:labeltitle基于,但现在会执行所有标题相等性检查并将打印的标题保存在 中。labeltitlephilosophy-classic.cbx\bbx@lasttitle

\documentclass[11pt]{scrbook}
\usepackage{csquotes}
\usepackage[
  backend=biber,
  style=philosophy-modern,
  publocformat=loccolonpub,
  inbeforejournal=true]{biblatex}

\makeatletter
\newbibmacro*{printhead:labeltitle}{%
  \iffieldundef{label}
    {\iffieldundef{shorttitle}
       {\iffieldequals{title}{\bbx@lasttitle}
          {\clearfield{title}}
          {\printfield{title}%
           \savefield{title}{\bbx@lasttitle}%
           \clearfield{title}%
           \postsep}}
       {\iffieldequals{shorttitle}{\bbx@lasttitle}
          {}
          {\printfield[title]{shorttitle}%
           \savefield{shorttitle}{\bbx@lasttitle}%
           \postsep}}%
     \blx@postpunct}
    {\iffieldequals{label}{\bbx@lasttitle}
       {}
       {\printfield{label}%
        \savefield{label}{\bbx@lasttitle}%
        \postsep}}}

\renewbibmacro*{author}{%
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
    {\global\undef\bbx@lasttitle
     \usebibmacro{bbx:dashcheck}
       {}%
       {\usebibmacro{bbx:savehash}%
        \printnames{author}%
        \iffieldundef{nameaddon}{}%
        {\setunit{\addspace}%
        \printfield{nameaddon}}%*
        \postsep}%
     \usebibmacro{date+extradate}%
       \iffieldundef{authortype}
         {}%
         {\usebibmacro{authorstrg}%
         \printtext{\addcomma\space}}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{printhead:labeltitle}%
     \usebibmacro{date+extradate}%
     }%
  }

\renewbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{%
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }%
  {\global\undef\bbx@lasttitle
   \usebibmacro{bbx:dashcheck}%
    {}%
    {\printnames{editor}%
          \postsep%
    \usebibmacro{bbx:savehash}}%
    \usebibmacro{date+extradate}%
    \usebibmacro{#1}%
    \clearname{editor}%
    \printtext{\addcomma\space}%
  }%
  {\global\undef\bbx@lasthash%
   \usebibmacro{printhead:labeltitle}%
   \usebibmacro{date+extradate}%
  }%
}%

\renewbibmacro*{bbx:translator}[1]{%
  \ifboolexpr{%
    test \ifusetranslator
    and
    not test {\ifnameundef{translator}}
  }%
  {\global\undef\bbx@lasttitle
   \usebibmacro{bbx:dashcheck}%
    {}%
    {\printnames{translator}%
          \postsep%
    \usebibmacro{bbx:savehash}}%
    \usebibmacro{date+extradate}%
    \usebibmacro{#1}%
    \clearname{translator}%
    \printtext{\addcomma\space}%
  }%
  {\global\undef\bbx@lasthash%
   \usebibmacro{printhead:labeltitle}%
   \usebibmacro{date+extradate}%
  }%
}%
\makeatother

\begin{filecontents}{\jobname.bib}
@misc{a,
  title = {Text},
  note  = {\textit{Text}, ed. by editor, Publisher, I, place},
  date  = 2010,
}
@misc{b,
  title = {Text},
  note  = {\textit{Text}, ed. by editor, Publisher, II, place},
  date  = 2011,
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{a,b}
\printbibliography
\end{document}

仅以“文本”作为标题出现一次的参考书目。

我可能应该指出,将所有出版物数据放入字段违反了biblatex和文件的精神。通常,最好将字段用于编辑、出版商、地点等。我还用真实日期替换了和,因为和在此设置中无效并引发错误。我还必须向条目添加条目键(和),否则 Biber 会抱怨。.bibnoteeditorpublisherlocationdate = datedate = anotherdatedateanotherdateab

相关内容