Biblatex:如何在 authortitle-ibid 脚注末尾插入年份

Biblatex:如何在 authortitle-ibid 脚注末尾插入年份

我正在尝试使用 biblatex 和 biber 设置我的引用样式,并且我遇到了 authortitle-ibid 样式,它在使用 \footcite 时几乎完全满足我的需要。

我唯一缺少的是,我希望年份出现在脚注中,就在标题之后和后注之前。(在我的示例中为 [S. 32-33])

如果有人知道如何实现这一点,我将不胜感激!谢谢。

\documentclass[12pt]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[ngerman]{babel}
\usepackage[style=authortitle-ibid,sorting=none,backend=biber]{biblatex}
\begin{filecontents}{\jobname.bib}
    @article{einstein,
        author = {Albert Einstein},
        title = {the true about tree},
        journaltitle = {Annalen der Physik},
        year = {1905},
        volume = {322},
        number = {10},
        pages = {891--921}
    }
   @Online {laubpage,
    author = {Laubheimer, Page},
    title = {Virtual Tours: High Interaction Cost, Moderate Usefulness},
    date = {2020-08-30},
    year = {2020},
    file = {:./references/articles-virtual-tours-.html:html},
    url = {https://www.nngroup.com/articles/virtual-tours/},
    urldate = {2021-01-18}
    }
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}


Cite this\footcite[Vgl.][S. 32-33]{einstein} and this\footcite{laubpage} please.

\printbibliography
\end{document}

答案1

您正在构建的是混合样式。首先,我们需要创建宏来打印年份。这是从 借鉴而来的authoryear.bbx

\renewbibmacro*{cite:labeldate+extradate}{%
  \iffieldundef{labelyear}
  {}
  {\printtext[bibhyperref]{\printlabeldateextra}}}

然后我们必须将这个宏插入到打印标题的宏中(前面添加逗号和空格):

\renewbibmacro*{cite:title}{%
  \printtext[bibhyperref]{%
    \printfield[citetitle]{labeltitle}%
    \setunit{\addcomma\space}%
    \usebibmacro{cite:labeldate+extradate}}}

或者,如果您更喜欢一体化解决方案:

\usepackage{xpatch}
\xapptobibmacro{cite:title}{%
  \setunit{\addcomma\space}%
  \iffieldundef{labelyear}{}
  {\printtext[bibhyperref]{\printlabeldateextra}}}{}{}

最后,我们需要labeldateparts选项:

\usepackage[<...>,labeldateparts]{biblatex}

相关内容