引用作品时缺少引用(作者年份对照)

引用作品时缺少引用(作者年份对照)

我正在使用 biblatex 和 authoryear-comp 来处理我的文档。它对 authoryear 很有效,但当我引用引用的作品时,authoryear-comp 会漏掉引用(或部分引用)。以下是最小的工作示例:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[vietnamese,german,english]{babel}
\selectlanguage{english}
%Bib:
\usepackage[    style=authoryear-comp,
            %natbib=true,
            backend=biber,
            maxcitenames=2,
            firstinits=true,
            maxbibnames=9,
            sorting=nyvt,
            dashed=false,
            eprint=false,
            %numbermonth=false,
            clearlang=true,
            doi=false,
            isbn=false,
            url=false ]{biblatex}
\addbibresource{lab.bib}
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
%\AtEveryCitekey{\clearfield{month}}
    \AtEveryBibitem{
      \clearfield{edition}
      \clearfield{endday}%
      \clearfield{endmonth}
      \clearfield{month}%
      \clearfield{day}
      \clearfield{language}
      \clearfield{editor}}
\renewcommand\multicitedelim{\addcomma\space}
\renewcommand*{\bibfont}{\small}
%\usepackage{chapterbib}
%\newcommand{\scite}{[\cite{#1}]};

\DeclareCiteCommand{\cite}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}

\DeclareCiteCommand*{\cite}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{citeyear}}}
{\multicitedelim}
{\usebibmacro{postnote}}

\usepackage{etoolbox}
\renewcommand{\bibname}{References}
\defbibheading{secbib}[\bibname]{\section*{#1}}
\defbibheading{subbibliography}[\refname]{\section*{#1}}

\begin{document}

Multiple works~(\cite{Jaynes1957a,Jaynes1957b,Jaynes1988a})

Reciting:~(\cite{Jaynes1957a})

\printbibliography[heading=subbibliography]

\end{document}

使用 bib 文件

@article{Jaynes1957a,
Author = {Jaynes, E T},
Date-Added = {2014-11-13 15:17:17 +0000},
Date-Modified = {2014-11-13 15:17:17 +0000},
Journal = {Phys. Rev.},
Keywords = {information; probability; statistical-mechanics},
Number = {4},
Pages = {620},
Title = {Infomation theory and statistical mechanics {I}},
Volume = {106},
Year = {1957}}

@article{Jaynes1957b,
Author = {Jaynes, E T},
Date-Added = {2014-11-13 15:17:17 +0000},
Date-Modified = {2014-11-13 15:17:17 +0000},
Journal = {Phys. Rev.},
Keywords = {information; probability; statistical-mechanics;},
Pages = {171},
Title = {Information theory and statistical mechanics {II}},
Volume = {108},
Year = {1957}}

@incollection{Jaynes1988a,
Author = {Jaynes, E T},
Booktitle = {Maximum Entropy and Baysian Methods in Science and Engineering},
Date-Added = {2014-11-13 15:17:17 +0000},
Date-Modified = {2014-11-13 15:17:17 +0000},
Editor = {Erickson, G. J. and Smith C. R.},
Keywords = {information; thermodynamics;},
Publisher = {Kluwer Academic Publishers},
Title = {The evolution of Carnot's principle},
Volume = {1},
Year = {1988}}

输出如下:

输出作者年份

在其他情况下(我的文档),情况甚至更糟:第二次引用时什么都没有出现。另一方面,authoryear 工作正常。你们有人能帮我解决 authoryear-comp 的问题吗?非常感谢!

答案1

问题在于 bibmacro将上次使用的引文的(每个作者姓名独有)和年份cite保存hash在变量(实际上是命令)中。 的当前定义\cite不能确保清除变量中存储的值。重置这些变量的 bibmacro 是cite:init。该宏必须为每个 cite 命令执行,因此修改后的定义将是:

\DeclareCiteCommand{\cite}
{\usebibmacro{cite:init}\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
 \printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}

或者,可以使用当前定义并添加

\AtEveryCite{\usebibmacro{cite:init}}

在此处输入图片描述

相关内容