除非另有定义,否则默认 pagination=none

除非另有定义,否则默认 pagination=none

在我写的文本中,我不想在简单页面中使用像“p”这样的页面前缀,但仍想在其他地方保留前缀(例如列、诗句、章节等)。因此,设置\DeclareFieldFormat{postnote}{#1}不是一种选择。我试图通过定义来暂时帮助自己

\DefineBibliographyStrings{english}{%
  page = {},
  pages = {},
}

然而,这样做的缺点是\notecite命令不能正常工作,并会在页码前引入多余的空格:

\textcite、\notecite、\autocite 和 \pnotecite 的格式

由于我已经将问题追溯到这一点,我的问题是,如何将postnote字段格式定义为默认格式,none而不是page除非条目选项另有定义pagination,例如verse等。也就是说,我想要的是这种引用多伊(1986:123)(45),但定义的方式要保持充足(1971:第 2345 版)(第 678 节)


梅威瑟:

\documentclass{article}

\usepackage[
  style=unified,
  backend=biber,
  natbib,
]{biblatex}

\DefineBibliographyStrings{english}{%
  page = {},
  pages = {},
}

\begin{filecontents*}{\jobname.bib}
@book{doe1986,
  author = {John F. Doe},
  title = {A book with a title},
  publisher = {Erewhon University Press},
  location = {Erewhon},
  date = {1986},
}

@book{ample1971,
  editor = {Jane X. Ample},
  title = {James the {W}riter},
  subtitle = {The noble knight of {S}omeplaceshire},
  publisher = {Erewhon University Press},
  location = {Erewhon},
  date = {1971},
  pagination = {verse},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
\noindent
Lorem ipsum dolor sit amet \textcite[123]{doe1986}. \\
Lorem ipsum dolor sit amet \notecite[45]{doe1986}. \\
Lorem ipsum dolor sit amet \autocite[123]{doe1986}. \\
Lorem ipsum dolor sit amet \pnotecite[45]{doe1986}. \\

\noindent
Lorem ipsum dolor sit amet \textcite[2345]{ample1971}. \\
Lorem ipsum dolor sit amet \notecite[678]{ample1971}. \\
Lorem ipsum dolor sit amet \autocite[2345]{ample1971}. \\
Lorem ipsum dolor sit amet \pnotecite[678]{ample1971}.

\printbibliography
\end{document}

答案1

一个非常简单的解决方案是让 Biber 源映射pagination = {none},为文件pagination中没有字段的所有条目进行设置.bib

\documentclass{article}

\usepackage[
  style=unified,
  backend=biber,
  natbib,
]{biblatex}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldset=pagination, fieldvalue={none}]
    }
  }
}

\begin{filecontents*}{\jobname.bib}
@book{doe1986,
  author    = {John F. Doe},
  title     = {A Book with a Title},
  publisher = {Erewhon University Press},
  location  = {Erewhon},
  date      = {1986},
}
@book{ample1971,
  editor     = {Jane X. Ample},
  title      = {James the {Writer}},
  subtitle   = {The Noble Knight of {Someplaceshire}},
  publisher  = {Erewhon University Press},
  location   = {Erewhon},
  date       = {1971},
  pagination = {verse},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
Lorem ipsum dolor sit amet \textcite[123]{doe1986}.

Lorem ipsum dolor sit amet \notecite[45]{doe1986}.

Lorem ipsum dolor sit amet \autocite[123]{doe1986}.

Lorem ipsum dolor sit amet \pnotecite[45]{doe1986}.

Lorem ipsum dolor sit amet \textcite[2345]{ample1971}.

Lorem ipsum dolor sit amet \notecite[678]{ample1971}.

Lorem ipsum dolor sit amet \autocite[2345]{ample1971}.

Lorem ipsum dolor sit amet \pnotecite[678]{ample1971}.

\printbibliography
\end{document}

Lorem ipsum dolor sit amet Doe(1986:123)。 Lorem ipsum dolor sit amet 45. Lorem ipsum dolor sit amet (Doe 1986: 123)。 Lorem ipsum dolor sit amet(45)。 Lorem ipsum dolor sit amet Ample(1971:v.2345)。 Lorem ipsum dolor sit amet v. 678。Lorem ipsum dolor sit amet (Ample 1971: v. 2345)。 Lorem ipsum dolor sit amet(第 678 节)。


或者,您可以重新定义 的内部定义,\mkpageprefix使其表现得好像 的“默认”值为pagination一样none

\makeatletter
\renewrobustcmd*{\blx@imc@mkpageprefix}[1][pagination]{%
  \begingroup
  \def\blx@tempa{\blx@mkpageprefix@i}%
  \iffieldundef{#1}
    {}
    {\iffieldequalstr{#1}{none}
       {\def\blx@tempa{\blx@mkpageprefix@i}}
       {\iffieldbibstring{#1}
          {\edef\blx@tempa{\blx@mkpageprefix{\thefield{#1}}}}
          {\blx@warning@entry{%
             Unknown pagination type '\strfield{#1}'}}}}%
  \@ifnextchar[%]
    {\blx@tempa}
    {\blx@tempa[\@firstofone]}}
\makeatother

由于这依赖于命令的内部结构,因此\mkpageprefix该解决方案不太稳定。

相关内容