书目驱动程序:\printfield 结束单元/块

书目驱动程序:\printfield 结束单元/块

我正在使用这个自定义书目驱动程序incollection(基于standard.bbx):

\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{byeditor+others}%
  \newunit\addcomma
%  \usebibmacro{maintitle+booktitle}%
  \printtext[booktitle]{%
    \printfield[titlecase]{booktitle}%
    \setunit{\subtitlepunct}%
    \printfield[titlecase]{booksubtitle}} (\printfield{pages})%
  \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}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

我将其修改为

  • byeditor+others用逗号而maintitle+booktitle不是句号分隔
  • 打印标题栏中该部分的页面(标题/副标题后的句号之前)

第一件事成功了,第二件事失败了。它产生了类似

In <editors>, <title> (. S. 23–38).

显然,有一个我不想要的点,它应该是这样的:

In <editors>, <title> (S. 23-38).

我做错了什么?\printfield{pages}似乎完成了最后一个块(或单元?)并插入了一个点。我该如何解决这个问题?

答案1

您需要创建一个具有所需标点符号的新单元,然后页面才会出现:

\setunit{\addspace} % New unit with space added

页面本身的格式化最适合使用新方法\DeclareFieldFormat将括号添加到原始格式声明中。

所有这些都包装在一起:

\documentclass[]{article}

\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

% Make a special format for pages in parentheses
\DeclareFieldFormat{parpages}{\mkbibparens{\mkpageprefix[bookpagination]{#1}}}
\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{byeditor+others}%
  \newunit\addcomma
%  \usebibmacro{maintitle+booktitle}%
  \printtext[booktitle]{%
    \printfield[titlecase]{booktitle}%
    \setunit{\subtitlepunct}%
    \printfield[titlecase]{booksubtitle}}
    \setunit{\addspace} % Make new unit by just adding space
    \printfield[parpages]{pages}% Use new parpages format
  \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}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\begin{document}

\cite{brandt}

\printbibliography

\end{document}

引文将显示为:

图片

相关内容