biblatex 和 \filteror 生成缩写组合列表

biblatex 和 \filteror 生成缩写组合列表

我的最终目标是尝试生成来自多个字段的缩写组合列表。(如果我的做法不对,我很乐意听取您的意见。)还请注意,我意识到我的实现假设特定条目仅包含一个缩写。我不一定想做这个假设,因此也欢迎对此发表评论。

我目前有两个问题:

  • 我无法\filteror返回(比如说)带有简写字段或短序列字段的条目。使用\filteror似乎可以返回所有条目。
  • 标签宽度自动设置为最宽的简写。我不确定如何将其设置为最宽的(比如说)简写和短序列的组合。(不过,我想我也许可以解决这个问题)。

这是我目前拥有的 MWE。我已打印 (作者年份) 以显示 \filteror 返回不包含速记或短序列的条目。

谢谢。

\documentclass{article}
\usepackage[style=authoryear,backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{talbert:1992,
  author = {Talbert, Charles H.},
  title = {Reading John: A Literary and Theological Commentary on the Fourth Gospel and the Johannine Epistles},
  location = {New York},
  publisher = {Crossroad},
  date = {1992}
}
@book{hofius:1989,
  author = {Hofius, Otfried},
  title = {Paulusstudien},
  series = {Wissenschaftliche Untersuchungen zum Neuen Testament},
  shortseries = {WUNT},
  number = {51},
  location = {T\"{u}bingen},
  publisher = {Mohr Siebeck},
  date = {1989}
}
@mvbook{TDNT,
  editor = {Kittel, Gerhard and Friedrich, Gerhard},
  title = {Theological Dictionary of the New Testament},
  shorthand = {TDNT},
  translator = {Bromiley, Geoffrey W.},
  volumes = {10},
  location = {Grand Rapids},
  publisher = {Eerdmans},
  date = {1964/1976}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\defbibenvironment{abbreviations}
  {\list
     {\printfield[shorthandwidth]{shortseries}%
      \printfield[shorthandwidth]{shorthand}}
     {\setlength{\labelwidth}{\shorthandwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}%
      \renewcommand*{\makelabel}[1]{##1\hss}}}
  {\endlist}
  {\item}
\DeclareBiblistFilter{abbreviations}{
  \filteror{%
    \filter[type=field,filter=shorthand]
    \filter[type=field,filter=shortseries]
  }
}
\DeclareBibliographyDriver{abbreviations}{%
  \iffieldundef{shorthand}{}{\usedriver{}{\thefield{entrytype}}}%
  \iffieldundef{shortseries}{}{\printfield{series}}%
  \setunit{\addspace}%
  \printtext{\mkbibparens{\usebibmacro*{cite}}}%
}
\defbibcheck{abbreviations}{%
  \iffieldundef{series}
    {}
    {\ifcsdef{\strfield{series}}
      {\skipentry}
      {\savefieldcs{series}{\strfield{series}}}%   
    }}
\DeclareSortingScheme{abbreviations}{%
  \sort{%
    \field{shorthand}%
    \field{shortseries}%
  }%
}
\begin{document}
\autocite{talbert:1992}
\autocite{hofius:1989}
\autocite{TDNT}
\printbiblist{abbreviations}
\printbibliography
\end{document}

答案1

好的。两个问题都解决了。感谢@moewe,我刚刚完成了整个过滤器。我还找到了标签宽度问题的解决方案(只需使用和\defbibcheck的最大值即可)。\shortserieswidth\shorthandwidth

欢迎提出任何改进建议。(我的实际代码也处理 shortjournal。)

\documentclass{article}
\usepackage[style=authoryear,backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{talbert:1992,
  author = {Talbert, Charles H.},
  title = {Reading John: A Literary and Theological Commentary on the Fourth Gospel and the Johannine Epistles},
  location = {New York},
  publisher = {Crossroad},
  date = {1992}
}
@book{hofius:1989,
  author = {Hofius, Otfried},
  title = {Paulusstudien},
  series = {Wissenschaftliche Untersuchungen zum Neuen Testament},
  shortseries = {WUNT},
  number = {51},
  location = {T\"{u}bingen},
  publisher = {Mohr Siebeck},
  date = {1989}
}
@mvbook{TDNT,
  editor = {Kittel, Gerhard and Friedrich, Gerhard},
  title = {Theological Dictionary of the New Testament},
  shorthand = {\emph{TDNT}},
  translator = {Bromiley, Geoffrey W.},
  volumes = {10},
  location = {Grand Rapids},
  publisher = {Eerdmans},
  date = {1964/1976}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\newlength{\abbrevwidth}
\def\setmaxlength#1#2{%
  \ifdim\dimexpr#2>\dimexpr#1
    \global\setlength{#1}{#2}%
  \fi
}
\defbibenvironment{abbreviations}
  {\list
     {\printfield[shorthandwidth]{shortseries}%
      \printfield[shorthandwidth]{shorthand}}
     {\setmaxlength{\abbrevwidth}{\shorthandwidth}%
      \setmaxlength{\abbrevwidth}{\shortserieswidth}%
      \setlength{\labelwidth}{\shorthandwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}%
      \renewcommand*{\makelabel}[1]{##1\hss}}}
  {\endlist}
  {\item}
\DeclareBibliographyDriver{abbreviations}{%
  \iffieldundef{shorthand}{}{\usedriver{}{\thefield{entrytype}}}%
  \iffieldundef{shortseries}{}{\printfield{series}}%
}
\defbibcheck{abbreviations}{%
  \iffieldundef{series}
    {}
    {\ifcsdef{\strfield{series}}
      {\skipentry}
      {\savefieldcs{series}{\strfield{series}}}%   
    }%
  \ifboolexpr{
    test {\iffieldundef{shorthand}}
    and
    test {\iffieldundef{shortseries}}
  }
    {\skipentry}
    {}}
\DeclareSortingScheme{abbreviations}{%
  \sort{%
    \field{shorthand}%
    \field{shortseries}%
  }%
}
\begin{document}
\autocite{talbert:1992}
\autocite{hofius:1989}
\autocite{TDNT}
\printbiblist{abbreviations}
\printbibliography
\end{document}

在此处输入图片描述

相关内容