自定义 @reference 和 @inreference 的书目样式,并进行自定义排序

自定义 @reference 和 @inreference 的书目样式,并进行自定义排序

我目前正在支持的论文有相当多的参考书目,因此自然会进行一些分组,主要基于关键词(\printbibliography[heading=sec,notkeyword=prim,notkeyword=med,notkeyword=hs,notkeyword=lex,notkeyword=onl]例如)

参考书目的一部分应专门介绍各种百科全书。此处明显的书目类型是@reference@inreference

有些来源只引用百科全书中的一篇文章,而这篇文章不会在其他地方被引用,对于这些来源,我选择使用 类型@inreference,提供整个百科全书的所有详细信息。其他来源是一部百科全书的多个条目,因此我使用@reference来引用整个作品,并且@inreference对于每个条目,交叉引用整个作品以获得正确的连接。正如在其他印刷书目中看到的那样,目的是首先列出所有被引用多次的作品,并给出该作品的缩写。然后是所有引用条目的列表,缩写主要作品(交叉引用)以减少混乱和冗余。

请考虑以下(希望如此) MWE:

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{filecontents}
\usepackage[style=authoryear,backend=bibtex8,sorting=nyt,mincrossrefs=1]{biblatex}

\begin{filecontents}{Bibliography.bib}
@inreference{fantametz,
 crossref = {metzler},
 author = {Antonsen, Jan Erik},
 title = {Phantastische Literatur},
 pages = {581\psq},
 keywords = {lex}
}

@inreference{metametz,
 crossref = {metzler},
 author = {Sp{\"o}rl, Uwe},
 title = {Metafiktion},
 pages = {493\psq},
 keywords = {lex}
}

@reference{metzler,
 editor = {Burdorf, Dieter and Fasbender, Christoph and Moennighoff, Burkhard},
 year = {2007},
 title = {Metzler Lexikon Literatur},
 subtitle = {Begriffe und Definitionen},
 titleaddon = {Begr{\"u}ndet v. G{\"u}nther u.  Irmgard Schweikle},
 shorttitle = {MLL},
 shorthand = {Metzler 2007},
 edition = {3., v{\"o}llig neu bearb. Aufl.},
 publisher = {Metzler},
 location = {Stuttgart},
 keywords = {lex}
}

@inreference{fidakult,
 crossref = {metzlerK},
 author = {Nieragden, G{\"o}ran},
 title = {Figurendarstelling, literarische},
 pages = {200},
 keywords = {lex}
}

@inreference{metakult,
 crossref = {metzlerK},
 author = {Wolf, Werner},
 title = {Metafiktion},
 pages = {487\psqq},
 keywords = {lex}
}

@reference{metzlerK,
 editor = {N{\"u}nning, Ansgar},
 title = {Metzler Lexikon Literatur- und Kulturtheorie},
 subtitle = {Ans{\"a}tze -- Personen -- Grundbegriffe},
 shorttitle = {MLLK},
 year = {2008},
 edition = {4., aktual. u. erw. Aufl.},
 publisher = {Metzler},
 location = {Stuttgart},
 keywords = {lex}
}

@inreference{hwphwelt,
 author = {Dirks, Ulrich},
 title = {Welt},
 pages = {407--443},
 number = {Bd. 12: W-Z},
 keywords = {lex},
 publisher = {{Schwabe Verlag}},
 editor = {Ritter, Joachim and Gr{\"u}nder, Karlfried and Gabriel, Gottfried},
 booktitle = {Historisches W{\"o}rterbuch der Philosophie},
 year = {2004},
 location = {Basel},
 booktitleaddon = {V{\"o}llig neubearbeitete Ausgabe des 
\textit{W{\"o}rterbuchs der philosophischen Begriffe} von Rudolf Eisler.},
 volumes = {13}
}

@inreference{hpgwelt,
 author = {Schmitz, Hermann},
 title = {Welt},
 pages = {2466--2484},
 number = {Bd. 3 (Quantität -- Zweifel)},
 keywords = {lex},
 publisher = {{Karl Alber}},
 editor = {Kolmer, Petra and Wildfeuer, Armin G.},
 booktitle = {Neues Handbuch philosophischer Grundbegriffe},
 year = {2011},
 location = {Freiburg and M{\"u}nchen},
 booktitleaddon = {Begr{\"u}ndet von Hermann Krings, Hans Michael Baumgartner und Christoph Wild.},
 volumes = {3}
}

@reference{routledge,
 year = {2008},
 title = {Routledge Encyclopedia of Narrative Theory},
 shorttitle = {RENT},
 publisher = {Routledge},
 keywords = {lex},
 editor = {Herman, David and Jahn, Manfred and Ryan, Marie-Laure},
 location = {London and New York}
}

@inreference{stgel,
 crossref = {routledge},
 author = {Saint-Gelais, Richard},
 title = {Transfictionality},
 pages = {612--613},
 keywords = {lex}
}

@inreference{poss,
 crossref = {routledge},
 author = {Ryan, Marie-Laure},
 title = {Possible-Worlds Theory},
 pages = {446--450},
 keywords = {lex}
}
\end{filecontents}

\addbibresource{Bibliography.bib}

\input{Bibdriver} %Custom drivers

\begin{document}

This is a sample text much like LoremIpsum, but different. Cite1:\cite{hpgwelt}, Cite2:\cite{hwphwelt}, Cite3:\cite{metakult}, Cite4:\cite{fidakult}, Cite5:\cite{metametz}, Cite6:\cite{fantametz}, Cite7:\cite{stgel}, Cite8:\cite{poss}\\

I use nocite to have one citytion for every reference:\nocite{metzlerK}\nocite{metzler}\nocite{routledge}

\printbibliography[heading=lex,type=reference,keyword=lex]

\printbibliography[heading=lexEntries,type=inreference,keyword=lex]
\end{document}

与我的自定义 Bibdriver.tex 一起:

\DefineBibliographyStrings{ngerman}{page={{}{}},pages={{}{}}} %Keine Seitenangabe
%\DefineBibliographyStrings{ngerman}{citedas={im Folgenden zit\adddotspace als}}
%\DefineBibliographyStrings{ngerman}{citedas={im Folgenden im Text zit\adddotspace als}}

% Custom headings
\defbibheading{lex}{\subsection{Lexikoneinträge}}
\defbibheading{lexEntries}{}


\DeclareBibliographyDriver{reference}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
    \iffieldundef{shorttitle}
        {}%
        {\printfield{shorttitle} =}%
    \iffieldundef{editor}
        {}{
        \usebibmacro{editor+others}%
        \setunit{\labelnamepunct}\newblock
        }
  \usebibmacro{maintitle+title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \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}%
  \newunit
  \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}}


\DeclareBibliographyDriver{inreference}{%
  \iffieldundef{crossref}%
    {\usebibmacro{crossref:full}}%
    {\usebibmacro{crossref:label}}%
 }%

\newbibmacro{crossref:full}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \usebibmacro{bytranslator}% Übersetzer anzeigen
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
%  \usebibmacro{byeditor+others}% Hier keinen Übersetzer anzeigen
    \usebibmacro{byeditor}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \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}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
%  \usebibmacro{pageref}% fügt bei erstem, vollem Zitat ein Leerfeld zwischen Gesamtseitenzahlen und Komma vor zitierter Seite ein?
  \usebibmacro{finentry}% Punkt am Ende des Eintrags
    }

\newbibmacro{crossref:label}{%
   \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \printfield{title}%
    \newunit\newblock
  \usebibmacro{in:}%
  \printfield{shorttitle}%
  \newunit\newblock
  \usebibmacro{series+number},%
    \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \usebibmacro{finentry}% Punkt am Ende des Eintrags
}

输出如下: 创建的 PDF 图像

有两个错误,我尝试修复但失败了:

  • 最明显的一个是引用百科全书(我指的是全部作品)的排序顺序。我想按shorttitle文件对它们进行排序,但是使用:

    \DeclareSortingTemplate{references}{
     \sort{
      \field{sorttitle}
      \field{title}
     }
     \sort{
      \field[strside=left,strwidth=4]{sortyear}
      \field[strside=left,strwidth=4]{year}
      \literal{9999}
     }
     \sort{
      \field{sortname}
      \field{author}
      \field{editor}
     }
    }
    

    并且\newrefcontext[sorting=references]在第一个之前强制执行\printbibliography不起作用。没有错误,只是没有打印整个参考书目。

  • 为 -reference 定义的简写metzler用于每个@incollectioncrossref 的 this @reference。使用\DeclareDataInheritance{reference}{inreference}{\noinherit{shorthand}}不会引发任何错误,但结果保持不变。

我想按简称对整个作品进行排序的原因应该很明显:布局建议按字母顺序排列列表,按 排序shorttitle。不使用的原因shorthand也是一样的:我可能会调整速记列表的输出,这样它就会显示整个参考书目条目并按速记键对所有内容进行排序,但对单个文章的每一个引用最终都会被指定为该作品的速记,这不是可行的选择。

所以 TL;DR:为什么它不起作用?我确信这可以实现,但似乎我忽略了显而易见的东西。

答案1

\DeclareSortingTemplate\DeclareDataInheritance是 Biber 独有的功能,如果您只运行 BibTeX8,则无法使用。它们只是警告中提到的两个功能

Package biblatex Warning: Using fall-back BibTeX(8) backend:
(biblatex)                functionality may be reduced/unavailable.

当您使用backend=bibtex或时获得的结果backend=bibtex8

我还建议使用

\begin{refcontext}[sorting=references]
\printbibliography[heading=lex,type=reference,keyword=lex]
\end{refcontext}
\printbibliography[heading=lexEntries,type=inreference,keyword=lex]

而不是\newrefcontext。这样更安全,因为 refcontext 现在仅限于第一个参考书目。

无需 refcontexts 即可工作的解决方案将仅填充sortkey条目的字段@reference,因为所有@reference条目都位于同一个字段中,\printbibliography因此也会根据需要对它们进行排序。(当然,您会在字段中重复信息sortkey,因此这可能感觉有点临时。)

第二个问题对我来说看起来很可疑,但实际上只是 BibTeX 的全继承方法的产物:https://github.com/plk/biblatex/issues/794。Biber 有一个更复杂的继承方案,其中shorthands没有继承。

相关内容