自定义详细引用样式

自定义详细引用样式

我必须为我的论文使用非常具体的引用格式。由于verbose这是我能找到的最接近这种格式的格式,所以我决定对其进行自定义。

是我迄今为止的进展。MWE 将是:

\ProvidesFile{biblatex.cfg}

% -- No prefix for pages
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

% -- No italic titles
\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat{booktitle}{#1}
\DeclareFieldFormat{citetitle}{#1}
\DeclareFieldFormat{journaltitle}{#1}

% -- No "'" for title
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{citetitle}{#1}
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1}

% -- Authors and editors in italic and only show surname
\DeclareNameFormat{family}{\mkbibemph{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}}%
  \usebibmacro{name:andothers}}
\DeclareNameAlias{default}{family}
\DeclareNameAlias{sortname}{default}
\DeclareNameAlias{labelname}{default}

% -- "/" between names but "," and "and" in textcite
\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimFormat{finalnamedelim}{\slash}
\DeclareDelimFormat[textcite]{multinamedelim}{,\space}
\DeclareDelimFormat[textcite]{finalnamedelim}{~and\space}

\AtEveryCitekey{%
  \clearlist{publisher}%
  \clearlist{language}%
  \clearlist{location}%
  \clearfield{isbn}%
  \clearfield{issn}%
  \clearfield{doi}%
  \clearfield{note}%
  \ifentrytype{book}{%
    \clearfield{series}%
    \clearfield{number}%
    \clearfield{volume}%
    \clearfield{day}%
    \clearfield{month}%
    \clearfield{pagetotal}%
    \clearfield{pages}%
    \clearfield{url}%
    \clearfield{urlyear}%
    \clearfield{review}%
    \clearfield{series}}{}}

\AtEveryBibitem{%
  \clearlist{publisher}%
  \clearlist{language}%
  \clearlist{location}%
  \clearfield{isbn}%
  \clearfield{issn}%
  \clearfield{doi}%
  \clearfield{note}%
  \ifentrytype{book}{%
    \clearfield{series}%
    \clearfield{number}%
    \clearfield{volume}%
    \clearfield{day}%
    \clearfield{month}%
    \clearfield{pagetotal}%
    \clearfield{pages}%
    \clearfield{url}%
    \clearfield{urlyear}%
    \clearfield{review}%
    \clearfield{series}}{}}
\endinput

.tex 文件 MWE 如下所示:

\documentclass{article}
\usepackage[backend=biber, style=verbose, autocite=footnote, citepages=suppress]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{alexyRechtVernunftDiskurs1995,
  title = {Recht, Vernunft, Diskurs: Studien zur Rechtsphilosophie},
  shorttitle = {Recht, Vernunft, Diskurs},
  author = {Alexy, Robert},
  date = {1995},
  edition = {1},
  publisher = {{Suhrkamp}},
  location = {{Frankfurt am Main}},
  isbn = {978-3-518-28767-5},
  langid = {german},
  note = {OCLC: 243802548},
  number = {1167},
  pagetotal = {292},
  series = {Suhrkamp-Taschenbuch Wissenschaft}
}
\end{filecontents}

\begin{document}

\cite{alexyRechtVernunftDiskurs1995}

\printbibliography

\end{document}

下一步,我想正确引用书籍。使用上述 MWE,详细输出:

阿列克谢。法,效力,讨论:法哲学研究。第 1 版1995年,75。

我想要的是:

阿列克谢,《法,适用》,《讨论:法哲学研究》¹(1995 年),75。

第一次提及后,引用应该是(它应该显示简称而不是标题):

阿列克谢,《法律与权利讨论》¹(1995 年),75。

我怎样才能实现这个目标?

答案1

如果你想操纵这样的样式,你可能需要看看源代码。在这种情况下,你需要看看

这些文件在此处链接到 GitHub 上的发布版本,但您可以(可能应该)查看系统上安装的版本。您可以通过kpsewhich <file>在命令行中输入来找出文件隐藏的位置。另请参阅biblatex 引用样式文件位于哪里?

常规设置

相关部分verbose.cbx来自

\newbibmacro*{cite}{%
  \usebibmacro{cite:citepages}%
  \ifciteseen
    {\iffieldundef{shorthand}
       {\usebibmacro{cite:short}}
       {\usebibmacro{cite:shorthand}}}
    {\usebibmacro{cite:full}}}

\newbibmacro*{cite:full}{%
  \usebibmacro{cite:full:citepages}%
  \printtext[bibhypertarget]{%
    \usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}}%
  \usebibmacro{shorthandintro}}

\newbibmacro*{cite:short}{%
  \printnames{labelname}%
  \setunit*{\printdelim{nametitledelim}}%
  \printtext[bibhyperlink]{%
    \printfield[citetitle]{labeltitle}}}

这意味着对条目的第一次引用和所有后续引用cite执行。调用,这意味着它产生与参考书目相同的输出。cite:fullcite:shortcite:full\usedriver

因此,如果您想更改第一个引文的输出,您实际上需要更改参考书目输出。对于后续引文,您需要修改cite:short

自定义后续引文

请注意,目前所有条目类型都使用相同的cite:short定义,因为它只打印作者/编辑者和(短)标题,这几乎是通用的。如果您想添加其他数据,如果附加数据可能取决于条目类型,则可能不得不求助于更复杂的设置。它大致像这样工作

\newbibmacro*{cite:short-standard}{%
  \printnames{labelname}%
  \setunit*{\printdelim{nametitledelim}}%
  \printtext[bibhyperlink]{%
    \printfield[citetitle]{labeltitle}}}

\newbibmacro*{cite:short:book}{%
  \printnames{labelname}%
  \setunit*{\printdelim{nametitledelim}}%
  \printtext[bibhyperlink]{%
    \printfield[citetitle]{labeltitle}%
    \printfield{edition}}%
  \setunit{\addspace}%
  \printdate}

\renewbibmacro*{cite:short}{%
  \ifbibmacroundef{cite:short:\strfield{entrytype}}
    {\usebibmacro{cite:short-standard}}
    {\usebibmacro*{cite:short:\strfield{entrytype}}}}

例如,在自定义文档的自定义引用样式并用于自定义详细引用看起来不像参考书目自定义@interview类型的引用,并在为书籍、文章、收藏品定制第二次引用使 style=verbose 的 @online 简短引文更加详细@online(类似原则在演示参考文献——无标题脚注,允许 arXiv使用 bibulous 自定义引文

自定义第一个引文

如上所述,第一个引用本质上是参考书目输出的副本,因此要修改第一个引用,最简单的方法是修改参考书目输出。

如果你的参考书目输出和第一次引用看起来不同,有两种选择

  • 可以通过<precode>的论点获得微小的差异\usedriver,例如cite:full

    \usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}
    

    这样(使用标准设置和style=verbose)您会在引文中得到“Emma Sigfridsson 和 Ulf Ryde”,但参考书目将显示“Sigfridsson, Emma 和 Ulf Ryde”。

    根据变化的具体性质和结构,您甚至可以在这里提取相当重大的变化。

  • 如果首次引用和参考书目之间存在很大差异,则可能需要考虑不同的方案。例如,可以复制文件\DeclareBibliographyDriver中声明的每个驱动程序.bbx,并编写专用的驱动程序进行引用。这也是我在第一次被开罚单后更换司机. 那么你可能会

    \DeclareBibliographyDriver{article}{%
    ... bib output for @article ...
    }
    
    \DeclareBibliographyDriver{cite:article}{%
    ... first cite output for @article ...
    }
    
    \DeclareBibliographyDriver{book}{%
    ... bib output for @book ...
    }
    
    \DeclareBibliographyDriver{cite:book}{%
    ... first cite output for @book ...
    }
    
    \renewbibmacro*{cite:full}{%
      \usebibmacro{cite:full:citepages}%
      \printtext[bibhypertarget]{%
        \usedriver
          {\DeclareNameAlias{sortname}{default}}
          {cite:\thefield{entrytype}}}%
      \usebibmacro{shorthandintro}}
    

关于你的不相关观察biblatex.cfg

在您的 和中,您有一个详尽的命令biblatex.cfg列表。这不是特别容易阅读(我发现)并且效率不高。\clear...\AtEveryCitekey\AtEveryBibitem

\DeclareSourcemap通常,当您不想大量修改所使用的样式时,我更喜欢使用它来删除文档中不需要的字段。例如如果使用 \fullcite,则无法删除 biblatex 中的多余字段。优点是使用源映射删除的字段永远不会被 Biber 处理,并且您只需执行一次,而不必分别针对参考书目和引文进行处理。

但是,如果你正在编写样式,通常可以通过简单地重新定义(或不​​使用)打印字段的 bibmacros 来抑制字段。而不是说(抑制“系列”字段的问题

\AtEveryCitekey{%
  \ifentrytype{book}{%
    \clearfield{series}%
    \clearfield{number}}{}}

\AtEveryBibitem{%
  \ifentrytype{book}{%
    \clearfield{series}%
    \clearfield{number}}{}}

或者

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
       \pertype{book}
       \step[fieldset=series, null]
       \step[fieldset=number, null]
    }
  }
}

你可以说

\renewbibmacro*{series+number}{}

或者从驱动程序中删除该宏,字段就消失了。

一般来说,应该避免在中对文本或标点符号进行硬编码biblatexbiblatex而应使用 bibstrings 和 标点符号命令。

代替

% -- "/" between names but "," and "and" in textcite
\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimFormat{finalnamedelim}{\slash}
\DeclareDelimFormat[textcite]{multinamedelim}{,\space}
\DeclareDelimFormat[textcite]{finalnamedelim}{~and\space}

\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareDelimFormat[textcite]{multinamedelim}{\addcomma\space}
% not sure if a no-breaking space is the best choice here,
% so I'd probably prefer \addspace over \addnbspace
\DeclareDelimFormat[textcite]{finalnamedelim}{\addnbspace\bibstring{and}\space}

可以使用包装器来应用名称字段的整体格式。因此

\DeclareNameFormat{family}{\mkbibemph{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}}%
  \usebibmacro{name:andothers}}

将会

\DeclareNameFormat{family}{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}%
  \usebibmacro{name:andothers}}

 \DeclareNameWrapperFormat{family}{\mkbibemph{#1}}

@book以下是(非常相似的)驱动程序的开始@collection

\documentclass[naustrian]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber,
  style=verbose,
  citepages=suppress,
  autocite=footnote,
  dashed=false,
]{biblatex}

\renewcommand*{\newunitpunct}{\addcomma\space}

\DeclareNameFormat{family}{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}%
  \usebibmacro{name:andothers}}

\DeclareNameWrapperFormat{family}{\mkbibemph{#1}}

\DeclareNameAlias{default}{family}
\DeclareNameAlias{sortname}{default}
\DeclareNameAlias{labelname}{default}

\DeclareNameWrapperAlias{default}{family}
\DeclareNameWrapperAlias{sortname}{default}
\DeclareNameWrapperAlias{labelname}{default}

\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareDelimFormat[textcite]{multinamedelim}{\addcomma\space}
% not sure if a no-breaking space is the best choice here,
% so I'd probably prefer \addspace over \addnbspace
\DeclareDelimFormat[textcite]{finalnamedelim}{\addspace\bibstring{and}\space}


\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}

\renewcommand*{\subtitlepunct}{\addcolon\space}

\DeclareFieldFormat*{title}{#1}
\DeclareFieldFormat*{booktitle}{#1}
\DeclareFieldFormat*{citetitle}{#1}
\DeclareFieldFormat*{journaltitle}{#1}

\DeclareFieldFormat{volume}{\RN{#1}}

\DeclareFieldFormat{date}{\mkbibparens{#1}}

\DeclareFieldFormat{superedition}{\mkbibsuperscript{#1}}

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{maintitle+title}%
  \setunit{\space}%
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \setunit{}%
  \printfield[superedition]{edition}%
  \setunit{\addspace}\newblock
  \usebibmacro{date}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{collection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{editor}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{maintitle+title}%
  \setunit{\space}%
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \setunit{}%
  \printfield[superedition]{edition}%
  \setunit{\addspace}\newblock
  \usebibmacro{date}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\renewcommand*{\finentrypunct}{}

\begin{filecontents}{\jobname.bib}
@book{alexyRechtVernunftDiskurs1995,
  title      = {Recht, Vernunft, Diskurs},
  subtitle   = {Studien zur Rechtsphilosophie},
  author     = {Alexy, Robert},
  date       = {1995},
  edition    = {1},
  publisher  = {Suhrkamp},
  location   = {Frankfurt am Main},
  isbn       = {978-3-518-28767-5},
  langid     = {german},
  note       = {OCLC: 243802548},
  number     = {1167},
  pagetotal  = {292},
  series     = {Suhrkamp"=Taschenbuch Wissenschaft},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Lorem \autocite{alexyRechtVernunftDiskurs1995}
ipsum \autocite{alexyRechtVernunftDiskurs1995}

\printbibliography
\end{document}

Alexy,《Recht, Vernunft》,《讨论:法哲学研究》¹(1995 年)。

我决定尽可能多地重新使用现有的宏,但如果其中一些不能完全满足您的要求,您可能需要考虑重新定义它们或使用您自己的版本。

相关内容