在引用中将年份括起来

在引用中将年份括起来

我有以下 Latex 代码,其中我使用 biber 和 chicago 风格进行引用:

\documentclass[12pt,a4paper]{article}
\usepackage[english,ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[authordate,bibencoding=auto,strict,backend=biber]{biblatex-chicago}
\selectlanguage{ngerman}

\bibliography{bibliography}

\begin{document}

    \cite{Herlocker2004}

    \newpage

    \printbibliography
\end{document} 

和这个bibliography.bib

@article{Herlocker2004,
author = {Herlocker, Jonathan L. and Konstan, Joseph a. and Terveen, Loren G. and Riedl, John T.},
journal = {ACM Transactions on Information Systems},
month = jan,
number = {1},
pages = {5--53},
title = {{Evaluating collaborative filtering recommender systems}},
volume = {22},
year = {2004}
}

这产生了

Herlocker u.a. 2004

但我想把年份放在括号里,并u.a.用德语替换et al.,这样它看起来像这样

Herlocker et al. (2004)

有没有什么办法可以将我的引文格式化成这样?

答案1

这是我的建议。我添加了natbib选项biblatex。这样你就可以使用引用命令\citep(括号中是整个引用)和\citet(括号中只有年份)。然后我重新定义了andothers德语的参考书目字符串,如下所示

\DefineBibliographyStrings{german}{%
  andothers = {et al.},
}

我建议您使用\addbibresource序言中的命令,而不是\bibliography传统的命令(参见 biblatex 手册 v.2.5,第 82 页)。

我对你的工作示例的建议是

\begin{filecontents*}{\jobname.bib}
@article{Herlocker2004,
author = {Herlocker, Jonathan L. and Konstan, Joseph a. and Terveen, Loren G. and Riedl, John T.},
journal = {ACM Transactions on Information Systems},
month = jan,
number = {1},
pages = {5--53},
title = {{Evaluating collaborative filtering recommender systems}},
volume = {22},
year = {2004}
}

\end{filecontents*}

\documentclass[12pt,a4paper]{article}
\usepackage[english,ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[authordate,bibencoding=auto,strict,backend=biber,natbib]{biblatex-chicago}

\addbibresource{\jobname.bib}

\DefineBibliographyStrings{german}{%
  andothers = {et al.},
}


\selectlanguage{ngerman}


\begin{document}

    \citet{Herlocker2004}

    \printbibliography
\end{document}

在此处输入图片描述

答案2

以下是如何将年份括在括号中并避免出现同上样式的问题。

当使用 ibid 样式时,指定 natbib 选项并使用 citet 命令(如接受的答案中所述)无法按预期工作。

考虑以下:

\documentclass[paper=a4]{scrreprt}
\usepackage[style=authoryear-ibid]{biblatex}
\begin{document}

    \cite[21]{keyxyz}
    % outputs: someauthor (2003, p. 21)
   \citet[23]{keyxyz}
    % outputs: someauthor (ibid., p.23) <-- that's fine
   \citet{keyxyz}
    % outputs: someauthor (ibid.) <-- the isssue:
    % what if you want to refer to the authors work as a whole, without
    % referencing the page number as well (as ibid usually implies)?

\end{document}

一个快速的解决方法是:

\documentclass[paper=a4]{scrreprt}
\usepackage[style=authoryear-ibid]{biblatex}

\newcommand{\citeauthorandyear}[2][]{
   \citeauthor{#2} (\citeyear[#1]{#2})
}

\begin{document}

    \cite[21]{keyxyz}
    % outputs: someauthor (2003, p. 21)
    \citeauthorandyear{keyxyz}
    % outputs: someauthor (2003) <- that's better now
    \citet[22]{keyxyz}
    % outputs: someauthor (ibid., p.22)

\end{document}

对于更复杂的重写,请参阅 biblatex 手册第 131 页,4.3.1 \DeclareCiteCommand。

相关内容