我想使用\textcite
命令在我的论文中引用作者姓名和年份。我无法做到这一点,因为我使用的是 IEEE 样式。
因此,请帮助我将“Mr Bla et al. [4]”转换为“Mr. Bla et al. (2018)”,使用\textcite
或 BibLaTeX 中的任何其他命令
BibLaTeX 命令:
\usepackage[backend=biber,style=ieee,sorting=nyvt,maxbibnames=99,maxcitenames=2,mincitenames=1]{biblatex}
答案1
我认为,在有数字引用的文档中使用作者年份输出没有什么意义。如果出于某种原因,你想讨论你引用的作品的作者或年份,请在文本中明确说明,例如
In 1998 Sigfridsson and Ryde found that ...
或者如果你坚持使用biblatex
命令
In \citeyear{1998} \citeauthor{1998} found that ...
在这些情况下,我可能仍会以数字格式添加对该作品的适当引用,\cite{sigfridsson}
以便在参考书目中更容易找到它。
混合引用样式通常是不明智的,并且会因不一致而导致混乱或至少引起恼怒。
authoryear.cbx
这是的副本,\textcite
已重命名为 ,\aytcite
以便我们不会覆盖旧名称。
\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}