需要帮助配置 biblatex-dw 的条目类型驱动程序。不同的条目类型有不同的引用样式 sa

需要帮助配置 biblatex-dw 的条目类型驱动程序。不同的条目类型有不同的引用样式 sa

我需要一些帮助来重写书目驱动程序。但让我们从头开始:

我使用biblatexbiblatex-dw样式。在脚注中,我的引用显示为name shorttitlepage

除了常规文献之外,我还研究了大量未出版的档案材料。我的问题是如何组织这些资料。

它们根本没有名字,而是通过签名单独处理。总是有档案名称、类别、子类别和箱号:

例如:( Archiv Newtown Dep 1 Ru 4 354各个部分之间没有逗号)

因此,每次使用此类未发表的资料时,脚注中都必须有完整的署名。当然,参考书目中的资料也应按正确的字母数字顺序排列。

另一点是,在文本中的引用中,该Ibid.功能应该起作用。我的意思是,如果连续两次使用相同的来源,它应该给出Ibid.我不需要的Ibid.签名(例如,如果类别、子类别或框发生变化)。

因此在文本中它应该是这样的

--------------------------------------------
1 ArchNew Ho1 Ru8 356.
2 Mueller 1994, p. 18.
3 ArchNew Ho1 Ru8 356.
4 Ibid.
5 ArchNew FAS Ru7 321

并在参考书目中

**Literature**

Mueller, Claus: Something. Berlin 1994

**Sources**

*Archive Newtown*

ArchNew Ho1 Ru8 356
ArchNew FAS Ru7 321

我找到了一个有几乎相同问题和解决方案的帖子这里,但我担心我无法重写那里的代码来满足我的需求。

不同之处在于,在此解决方案中,源也有名称,因此可以通过其名称和签名来处理。我只需要签名。

此外,由于我的签名较长,我还需要另一个子类别。也许我可以使用现在免费的名称字段来实现此目的?

有人能帮我吗?我会非常非常感激。

我需要改变的代码如下所示:

\documentclass{article}
\usepackage[ngerman]{babel}

\usepackage{xpatch}

\usepackage[
    style=authortitle-dw,
    firstfull=true
]{biblatex}

\DefineBibliographyStrings{ngerman}{
  chapter = {Bd.}
}

\renewbibmacro*{cite}{%
  \usebibmacro{cite:citepages}%
  \global\boolfalse{cbx:loccit}%
  \ifentrytype{unpublished}%
     {\ifthenelse{\ifciteibid\and\not\iffirstonpage}%
        {\usebibmacro{cite:ibid}}{\usebibmacro{cite:firstfull}}}%
     {\ifbool{cbx:firstfull}%
        {\ifciteseen%
          {\usebibmacro{cite:normal}}
          {\usebibmacro{cite:firstfull}}}
        {\usebibmacro{cite:normal}}}%
  \usebibmacro{savestuff}%  
}

\newbibmacro{savestuff}{%
  \savelist{institution}{\lastinstitution}%
  \savelist{location}{\lastlocation}%
  \savefield{chapter}{\lastchapter}}

\xapptobibmacro{finentry}{\usebibmacro{savestuff}}{}{}

\DeclareBibliographyDriver{unpublished}{%
  \iffirstonpage{\def\lastinstitution{}%
    \def\lastlocation{}%
    \def\lastchapter{}}{}%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{title}%
  \newunit
  \usebibmacro{in:}%
  \iflistequals{institution}{\lastinstitution}%
    {\bibstring{ibidem}%
     \newunit\newblock%
     \iflistequals{location}{\lastlocation}%
       {\iffieldequals{chapter}{\lastchapter}%
         {}{\printfield{chapter}}}%
       {\printlist{location}\newunit\newblock%
        \iffieldequals{chapter}{\lastchapter}%
          {\bibstring{ibidem}}%
          {\printfield{chapter}}}%
    }%
    {\printlist{institution}\newunit\newblock%
     \iflistequals{location}{\lastlocation}%
       {\bibstring{ibidem}\newunit\newblock%
         \iffieldequals{chapter}{\lastchapter}%
           {}{\printfield{chapter}}}%
       {\printlist{location}\newunit\newblock%
        \iffieldequals{chapter}{\lastchapter}%
          {\bibstring{ibidem}}%
          {\printfield{chapter}}}%
    }%
  \newunit\newblock%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}

@unpublished {test1,
    title = {subcategory},
    institution = {Archive 1},
    location = {Category 1,
    chapter = {Box1}
}

@unpublished {test2,
    title = {subcategory},
    institution = {Archive 1},
    location = {Category 1},
    chapter = {Box2}
}

@unpublished {test3,
    title = {subcategory},
    institution = {Archive 1,
    location = {Category 2},
    chapter = {Box2}
}

@article{test4,
  title={Something},
  author={Mueller, Claus}
}

\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\footcite{test1}
\footcite{test1}
\footcite{test4}
\footcite{test1}
\footcite{test2}
\footcite{test3}
\footcite{test1}
\footcite{test4}
\clearpage
\footcite{test1}

\printbibliography

\end{document}

答案1

@archive正如我在上面的评论中提到的,我认为创建一个完全符合您需求的新条目类型是有益的。

我们必须创建一个新的数据模型文件archives.dbx,并将其放在 LaTeX 可以找到的地方(与当前文件相同的目录肯定可以)。

\ProvidesFile{archives.dbx}[2014/04/02 supplement archive]
\RequireBiber[3]

\DeclareDatamodelEntrytypes{archive}
\DeclareDatamodelEntryfields[archive]{category,subcategory,archive,box}
\DeclareDatamodelConstraints[archive]{
  \constraint[type=mandatory]{
    \constraintfield{archive}
    \constraintfield{category}
    \constraintfield{box}
  }
}

\DeclareDatamodelFields[type=field,datatype=literal]{category}
\DeclareDatamodelEntryfields[archive]{category}
\DeclareDatamodelFields[type=field,datatype=literal]{subcategory}
\DeclareDatamodelEntryfields[archive]{subcategory}
\DeclareDatamodelFields[type=field,datatype=literal]{archive}
\DeclareDatamodelEntryfields[archive]{archive}
\DeclareDatamodelFields[type=field,datatype=literal]{box}
\DeclareDatamodelEntryfields[archive]{box}
\endinput

我们定义一个新的条目类型,@archive它包含字段archivecategory和(前三个是必填字段,为可选字段)。boxsubcategorysubcategory

然后我们告诉biblatex如何处理新的条目类型

\DeclareBibliographyDriver{archive}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printfield{archive}%
  \setunit{\addspace}%
  \printfield{category}%
  \setunit{\addspace}%
  \printfield{subcategory}%
  \setunit{\addspace}%
  \printfield{box}%
  \newunit\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

这非常简单(并且根本不太复杂):只需打印所有用空格分隔的字段。

我们必须在加载时间选项中告诉通过(不带扩展)biblatex使用该数据模型。datamodel=archives.dbx

对于排序,我们可以定义一个名为的自定义排序方案archive

\DeclareSortingScheme{archive}{
  \sort{
    \field{archive}
  }
  \sort{
    \field{category}
  }
  \sort{
    \field{subcategory}
  }
  \sort{
    \field{box}
  }
}

正如人们所期望的那样,它按archivecategory、排序。在参考书目中,我们通过根据需要附加来使用此排序方案。subcategoryboxsorting=archive

为了引用authortitle-dw,我们必须重新定义cite:normal

\renewbibmacro*{cite:normal}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifentrytype{archive}
         {\usedriver
          {\DeclareNameAlias{sortname}{default}}
          {\thefield{entrytype}}}
       {\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}%
                                 \AND\NOT\iffirstonpage}
           {\usebibmacro{cite:idem}%
            \usebibmacro{cite:title}%
            \usebibmacro{cite:save}}
           {\ifnameundef{labelname}
             {}
             {\usebibmacro{cite:name}}%
              \usebibmacro{cite:title}}%
            \ifbool{cbx:omiteditor}
              {}
              {\ifnameundef{labelname}
                {\newunit
                 \usebibmacro{cite:byeditor}}
                {}}%
           \usebibmacro{cite:save}}}}%
    {\ifbool{cbx:shorthandibid}%
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}%
         {\usebibmacro{cite:ibid}}
         {\usebibmacro{cite:shorthand}}}%
       {\usebibmacro{cite:shorthand}}}}

我们仅检查所引用的条目是否属于类型@archive;如果是,则根据需要生成整个引用(不存在简短形式)。*

为了能够按档案分开参考书目,我们将为bibcategory每个档案定义一个新的archive,如下所示

\DeclareBibliographyCategory{archive1}
\DeclareBibliographyCategory{archnew}

然后我们设立了一个检查archive

\AtDataInput[archive]{
  \iffieldequalstr{archive}{Archive 1}
    {\addtocategory{archive1}{\thefield{entrykey}}}
    {}
  \iffieldequalstr{archive}{ArchNew}
    {\addtocategory{archnew}{\thefield{entrykey}}}
    {}
}

此测试仅检查archive字段是否包含特定字符串,如果是,则将条目添加到适当的类别。

打印分开的书目就像

\printbibliography[category=archive1,heading=subbibliography,title={Archive 1},sorting=archive]
\printbibliography[category=archnew,heading=subbibliography,title={Archive Newtown},sorting=archive]
\printbibliography[nottype=archive,heading=subbibliography]

完整的示例(显然archives.dbx是在这里创建的,filecontents如果您有效地使用该文件,您将在适当的位置保存该文件的副本)

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[
    style=authortitle-dw,
    firstfull=true,
    datamodel=archives,
]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@archive{test1,
  subcategory = {subcategory},
  archive     = {Archive 1},
  category    = {Category 1},
  box         = {Box1},
}
@archive{test2,
  subcategory = {subcategory},
  archive     = {Archive 1},
  category    = {Category 1},
  box         = {Box2},
}
@archive{test3,
  subcategory = {subcategory},
  archive     = {Archive 1},
  category    = {Category 2},
  box         = {Box2},
}
@archive{test5,
  subcategory = {Ru7},
  archive     = {ArchNew},
  category    = {FAS},
  box         = {321},
}
@article{test4,
  title   = {Something},
  author  = {Mueller, Claus},
  journal = {A Journal},
}
\end{filecontents*}
\begin{filecontents*}{archives.dbx}
\ProvidesFile{archives.dbx}[2014/04/02 supplement archive]
\RequireBiber[3]

\DeclareDatamodelEntrytypes{archive}
\DeclareDatamodelEntryfields[archive]{category,subcategory,archive,box}
\DeclareDatamodelConstraints[archive]{
  \constraint[type=mandatory]{
    \constraintfield{archive}
    \constraintfield{category}
    \constraintfield{box}
  }
}

\DeclareDatamodelFields[type=field,datatype=literal]{category}
\DeclareDatamodelEntryfields[archive]{category}
\DeclareDatamodelFields[type=field,datatype=literal]{subcategory}
\DeclareDatamodelEntryfields[archive]{subcategory}
\DeclareDatamodelFields[type=field,datatype=literal]{archive}
\DeclareDatamodelEntryfields[archive]{archive}
\DeclareDatamodelFields[type=field,datatype=literal]{box}
\DeclareDatamodelEntryfields[archive]{box}
\endinput
\end{filecontents*}

\DeclareBibliographyDriver{archive}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printfield{archive}%
  \setunit{\addspace}%
  \printfield{category}%
  \setunit{\addspace}%
  \printfield{subcategory}%
  \setunit{\addspace}%
  \printfield{box}%
  \newunit\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\renewbibmacro*{cite:normal}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifentrytype{archive}
         {\usedriver
          {\DeclareNameAlias{sortname}{default}}
          {\thefield{entrytype}}}
       {\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}%
                                 \AND\NOT\iffirstonpage}
           {\usebibmacro{cite:idem}%
            \usebibmacro{cite:title}%
            \usebibmacro{cite:save}}
           {\ifnameundef{labelname}
             {}
             {\usebibmacro{cite:name}}%
              \usebibmacro{cite:title}}%
            \ifbool{cbx:omiteditor}
              {}
              {\ifnameundef{labelname}
                {\newunit
                 \usebibmacro{cite:byeditor}}
                {}}%
           \usebibmacro{cite:save}}}}%
    {\ifbool{cbx:shorthandibid}%
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}%
         {\usebibmacro{cite:ibid}}
         {\usebibmacro{cite:shorthand}}}%
       {\usebibmacro{cite:shorthand}}}}

\DeclareBibliographyCategory{archive1}
\DeclareBibliographyCategory{archnew}
\AtDataInput[archive]{
  \iffieldequalstr{archive}{Archive 1}
    {\addtocategory{archive1}{\thefield{entrykey}}}
    {}
  \iffieldequalstr{archive}{ArchNew}
    {\addtocategory{archnew}{\thefield{entrykey}}}
    {}
}


\DeclareSortingScheme{archive}{
  \sort{
    \field{archive}
  }
  \sort{
    \field{category}
  }
  \sort{
    \field{subcategory}
  }
  \sort{
    \field{box}
  }
}

\addbibresource{\jobname.bib}
\begin{document}
  Lorem\footcite{test3}
  ipsum\footcite{test3}
  dolor\footcite{test1}
  sit\footcite{test1}
  amet\footcite{test2}
  consecetur\footcite{test3}
  blah\footcite{test1}
  bleurg\footcite{test4}
  more\footcite{test5}

  \clearpage

  Trallala\footcite{test1}

  \printbibliography[category=archive1, heading=subbibliography, title={Archive 1}, sorting=archive]
  \printbibliography[category=archnew, heading=subbibliography, title={Archive Newtown}, sorting=archive]
  \printbibliography[nottype=archive, heading=subbibliography]
\end{document}

脚注引用 分割书目:现在排序正确

* 如果您愿意,也可以实现简短形式。

答案2

这应该是对 moewe 的回答的评论。它只是作为答案,因为我还不被允许发表评论。

由于每次引用档案来源时,整个签名都应出现在脚注中,或者如果连续引用两次或两次以上,则应完全替换为Ibid.,将所有信息(例如档案、书架、盒子、文件编号)简单地视为所述来源的标题不是更容易吗?为此,您可以使用已经存在的条目类型,例如@misc

@misc {test1,
    title = {ArchNew Ho1 Ru8 356}
}

@misc {test2,
    title = {ArchNew FAS Ru7 321}
}

这应该会产生脚注所需的结果,而无需改变代码。

为了解决第二个问题,即参考书目中引用的来源的外观,为每个档案创建不同的条目类型(例如@archnew@archold等等)可能确实会有所帮助。这样,可以使用以下命令根据参考书目中的档案排列引用的不同来源:

\printbibliography[type=archnew,heading=subbibliography,title={Archive Newtown}]
\printbibliography[type=archold,heading=subbibliography,title={Archive Oldtown}]

我现在真的没有机会测试这个,所以它可能不完整。

相关内容