Biblatex:每个条目的引用字段均有变化

Biblatex:每个条目的引用字段均有变化

这应该是一个相对较快的问题。我使用的是 Biblatex 的作者年份(-icomp,但这并不重要)引用样式,但有少数作品的作者年份格式毫无意义,我更希望它们显示为作者标题。例如,我希望以下参考书目条目采用此格式

@BOOK{JahizBayaan,
  title = {al-Bayān wa-al-tabyīn},
  author = {al-Jāḥiẓ, Abū ʻUthman ibn Baḥr},
  editor = {Hārūn, ʻAbd al-Salām Muḥammad},
  year = {1968},
  owner = {Alexander},
  timestamp = {2011.12.23}
}

命令

\citet{JahizBayaan}

生产

贾希兹(巴彦瓦塔比因

而不是我现在得到的

贾希兹 (1968)

我显然可以专门为这位作者或这种类型的作品发出一个命令,但如果有一种方法可以针对参考书目中的每个条目执行此操作,我会非常高兴。

答案1

\documentclass{article}

\usepackage[style=authoryear]{biblatex}

\DeclareBibliographyCategory{notyear}
\addtocategory{notyear}{A01}

\AtEveryCitekey{%
  \ifcategory{notyear}{%
    \DeclareFieldFormat{labelyear}{\printfield{title}}%
    \DeclareFieldFormat{extrayear}{}%
  }{%
  }%
}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
@misc{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\textcite{A01}

\textcite{B02}

\textcite{C03}

\printbibliography

\end{document}

在此处输入图片描述

答案2

我对其进行了修改,使其基于参考书目中的关键词,这样可以在文档之间更轻松地进行翻译。

\documentclass{article}

\usepackage[style=authoryear]{biblatex}


\AtEveryCitekey{%
  \ifkeyword{notyear}{% Here I use \ifkeyword instead of \ifcategory
    \DeclareFieldFormat{labelyear}{\printfield{title}}%
    \DeclareFieldFormat{extrayear}{}%
  }{%
  }%
}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
  keywords = {notyear}
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
@misc{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\textcite{A01}

\textcite{B02}

\textcite{C03}

\printbibliography

\end{document}

输出相同。

相关内容