2

I want to cite author name and year in my thesis using \textcite command. I can not do that since I am using IEEE style.

So please help me to turn "Mr Bla et al. [4]" to "Mr. Bla et al. (2018)" using \textcite or any other command in BibLaTeX

BibLaTeX command:

\usepackage[backend=biber,style=ieee,sorting=nyvt,maxbibnames=99,maxcitenames=2,mincitenames=1]{biblatex}
9
  • I think that if you replace style=ieee by bibstyle=ieee,citestyle=authoryear you'll have what you want. Jun 15, 2018 at 16:02
  • Do you still want to cite with numeric labels? Or should all citations be "Author (Year)"?
    – moewe
    Jun 15, 2018 at 16:05
  • 1
    But why? How would you find the corresponding citation for say "Sigfridsson and Ryde (1998)" while all other citations are numeric? That is quite an inconsistent style and should be avoided.
    – moewe
    Jun 15, 2018 at 16:24
  • 1
    @AnantShirsath I completely agree with moewe. You should stick to one citations style. But if you insist you could combine \citeauthor and \citeyear... Jun 15, 2018 at 16:30
  • 1
    Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. Jun 20, 2018 at 12:58

1 Answer 1

6

FWIW I think it makes little sense to use an author-year output in a document that has numeric citations otherwise. If for some reason you want to discuss the author or year of a work you cite do that explicitly in the text as in

In 1998 Sigfridsson and Ryde found that ...

or if you insist on using biblatex commands

In \citeyear{1998} \citeauthor{1998} found that ...

In those cases I would probably still add a proper reference to the work in numeric format with \cite{sigfridsson} so that it can be found more easily in the bibliography.

Mixing citation styles is often ill advised and can lead to confusion or at least irritation due to the inconsistency.


This is a copy of authoryear.cbx's \textcite renamed to \aytcite so that we don't overwrite the old name.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=ieee, labeldateparts, sorting=nyvt, maxbibnames=99, maxcitenames=2, mincitenames=1]{biblatex}

\addbibresource{biblatex-examples.bib}

\providebool{cbx:parens}

\newbibmacro*{citeyear}{%
  \iffieldundef{shorthand}
    {\iffieldundef{labelyear}
       {\usebibmacro{cite:label}}
       {\usebibmacro{cite:labeldate+extradate}}}
    {\usebibmacro{cite:shorthand}}}

\newbibmacro*{aytcite}{%
  \ifnameundef{labelname}
    {\iffieldundef{shorthand}
       {\usebibmacro{cite:label}%
        \setunit{%
          \global\booltrue{cbx:parens}%
          \printdelim{nonameyeardelim}\bibopenparen}%
        \ifnumequal{\value{citecount}}{1}
          {\usebibmacro{prenote}}
          {}%
        \usebibmacro{cite:labeldate+extradate}}
       {\usebibmacro{cite:shorthand}}}
    {\printnames{labelname}%
     \setunit{%
       \global\booltrue{cbx:parens}%
       \printdelim{nameyeardelim}\bibopenparen}%
     \ifnumequal{\value{citecount}}{1}
       {\usebibmacro{prenote}}
       {}%
     \usebibmacro{citeyear}}}

\newbibmacro*{cite:shorthand}{%
  \printtext[bibhyperref]{\printfield{shorthand}}}

\newbibmacro*{cite:label}{%
  \iffieldundef{label}
    {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
    {\printtext[bibhyperref]{\printfield{label}}}}

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

\newbibmacro*{aytcite:postnote}{%
  \iffieldundef{postnote}
    {\ifbool{cbx:parens}
       {\bibcloseparen}
       {}}
    {\ifbool{cbx:parens}
       {\setunit{\postnotedelim}}
       {\setunit{\extpostnotedelim\bibopenparen}}%
     \printfield{postnote}\bibcloseparen}}

\DeclareCiteCommand{\aytcite}
  {\boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \iffirstcitekey
     {\setcounter{textcitetotal}{1}}
     {\stepcounter{textcitetotal}%
      \textcitedelim}%
   \usebibmacro{aytcite}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}}
  {\usebibmacro{aytcite:postnote}}

\begin{document}
\cite{sigfridsson} or \aytcite{sigfridsson}
\printbibliography
\end{document}

enter image description here

3
  • I completely agree with you on this topic but there are research papers who have used this kind of techniques just to be clear in what they want to convey. Anyhow, I am just gonna use it for my thesis, not for research publication so I don't think it is a big deal. And thank you very much for answering my question. Jun 15, 2018 at 20:25
  • I know this is an old question, but the answer given here does not produce the expected results for me. Rather than printing author (year) it prints author ("title"). Any idea why this happens? Nov 25, 2019 at 13:17
  • @BjarneThorsted On first glance the MWE works for me. I get Author (year) and the rest of the output looks OK too. There are no deprecation warnings or other relevant messages either. If the code doesn't work for you I suggest you ask a new question with MWE and make your complete .log and .blg file available.
    – moewe
    Nov 25, 2019 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.