引用同一作者的命令,例如 Smith (1992 & 1993)

引用同一作者的命令,例如 Smith (1992 & 1993)

我问的问题几乎和类似问题的链接

我希望有

Smith (1998 & 1999)

但是,对于这个问题,我补充说

style=authoryear-comp. 

\renewcommand{\compcitedelim}{\space\&\space} 

对我的 MWE 来说,不起作用

可能是因为

citestyle=authoryear

在此处输入图片描述

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}

@article{journal1,
  title={title ABC},
  author={Smith, Bether},
  journal={Behavior Research Methods, Instruments, \& Computers},
  volume={24},
  number={2},
  pages={258--264},
  year={1992},
  publisher={Springer}
}

@article{journal2,
  title={title CBD},
  author={Smith, Bether},
  journal={Behavior Research Methods, Instruments, \& Computers},
  volume={25},
  number={2},
  pages={242--249},
  year={1993},
  publisher={Springer}
}


@article{journal2,
  title={journal123456},
  author={Abc, Def, GhI},
  journal={Journal of Neurology, Neurosurgery \& Psychiatry},
  volume={62},
  number={1},
  pages={22--26},
  year={1999},
}


\end{filecontents}


\documentclass[british]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}

\usepackage{csquotes}
\usepackage[%
  style=authoryear, 
  style=authoryear-comp, 
  backend=biber, 
  maxcitenames=2,
  giveninits,
 dashed=false,
  citestyle=authoryear,
]{biblatex}
\addbibresource{\jobname.bib} % \jobname to use the bib file created with filecontents

\usepackage[unicode,colorlinks,citecolor=blue]{hyperref}

\DeclareNameAlias{sortname}{family-given} %for second and third author name



% for references 's studies (year)
\renewcommand*{\nameyeardelim}{\addcomma\space}
\newcommand{\mycite}[1]{\citeauthor{#1}'s \citeyear{#1}}

% for combine both year for an author
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}
\renewcommand{\compcitedelim}{\space\&\space}

\DeclareCiteCommand{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printtext[bibhyperref]{\printnames{labelname}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeyear} % <======================================
    {}
    {(\bibhyperref{\printdate})}
    {\multicitedelim}
    {}

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


\makeatletter
\let\abx@macro@textciteOrig\abx@macro@textcite
\renewbibmacro{textcite}{% <============================================
   \bibhyperref{%
   \let\bibhyperref\relax\relax%
   \abx@macro@textciteOrig%
   }%
}%
\makeatother
% for references 's studies (year)

\begin{document}



ABC studies is done by \textcite{journal1, journal2}.

\printbibliography
\end{document}

答案1

这是因为您有两个选项,并且以设置中的选项style结束。citestylebiblatex

style设置citestylebibstyle

删除所有并保留style=authoryear-comp

\usepackage[%
  style=authoryear-comp, 
  maxcitenames=2,
  giveninits,
  dashed=false,
]{biblatex}

而且,backend=biber这是默认的,不需要。

使用authoryear-comp还意味着你必须稍微改变你的重新定义\parencite

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

我还怀疑您尝试将名称设置为超链接\textcite会给您带来麻烦。除了右括号未超链接之外,名称应该指向哪个书目条目?在这种情况下,链接年份才有意义。(虽然,我猜它有点像您拥有的那样。)

相关内容