3

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}
dexteritas
  • 9,161

1 Answers1

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

moewe
  • 175,683
  • 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. – Anant Shirsath Jun 15 '18 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? – Bjarne Thorsted Nov 25 '19 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 '19 at 16:11