0

I want to put both year of a author together in a content refering.

I want:

Smith (1992 & 1993) 

But: I used:

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

cing

\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, 
  backend=biber, 
  maxcitenames=2,
  giveninits
]{biblatex}
\addbibresource{\jobname.bib} % \jobname to use the bib file created with filecontents

\DeclareNameAlias{sortname}{family-given}
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}

\usepackage[unicode,colorlinks,citecolor=blue]{hyperref}
% \renewcommand*{\nameyeardelim}{\addcomma\space}

\newcommand{\mycite}[1]{\citeauthor{#1}'s \citeyear{#1}}

\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]
\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


\begin{document}



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

\printbibliography
\end{document}
aan
  • 2,663

1 Answers1

2

use \textcite{journal1,journal2} and authoryear-comp. This nearly gives what you want just \renewcommand{\compcitedelim}{\space\&\space} to replace comma with &

\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-comp, 
  backend=biber, 
  maxcitenames=2,
  giveninits
]{biblatex}
\addbibresource{\jobname.bib} % \jobname to use the bib file created with filecontents

\DeclareNameAlias{sortname}{family-given}
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}

\usepackage[unicode,colorlinks,citecolor=blue]{hyperref}
% \renewcommand*{\nameyeardelim}{\addcomma\space}



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


\begin{document}



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

\printbibliography
\end{document}

enter image description here

Sybil
  • 145
  • I tried added in citestyle=authoryear. but not working – aan Sep 12 '19 at 15:31
  • \usepackage[% style=authoryear-comp, backend=biber, maxcitenames=2, giveninits, citestyle=authoryear ]{biblatex}, is not working – aan Sep 12 '19 at 15:32
  • thanks. I want to add in citestyle=authoryear. Thus, \usepackage[ style=authoryear-comp, backend=biber, maxcitenames=2, giveninits, citestyle=authoryear ]{biblatex}, it not working. Without citestyle=authoryear is working. – aan Sep 12 '19 at 23:44
  • @aan Don't use authoryear, use authoryear-comp. It is the same as authoryear but with combining two cites from same author in one bracket - this is what your questions asks – Sybil Sep 13 '19 at 13:55