我偏爱的引用样式biblatex
是numeric-comp
带有autocite=superscript
选项的样式。但是偶尔我需要在文本中引用特定参考文献,因此想切换到类似authoryear
本例中的样式。
使用\textcite
只会否定上标选项。是否可以编写一个新功能,让我可以混合这两种引用样式?
梅威瑟:
\documentclass{report}
\begin{filecontents}{example.bib}
@article {Example_article,
AUTHOR = {Author, A. B.},
TITLE = {A example paper},
JOURNAL = {Example journal},
VOLUME = {1},
YEAR = {2018},
NUMBER = {1},
PAGES = {1-100}}
\end{filecontents}
\usepackage[style=numeric-comp,
autocite=superscript,
backend=biber
]{biblatex}
\addbibresource{example.bib}
\begin{document}
I normally cite like this \autocite{Example_article} which is great but sometimes I want to do this \textcite{Example_article} but it doesn't seem to to work.
\end{document}
得出的结果为:
我通常引用像这样的1,这很好,但有时我想这样做作者 [1],但它似乎不起作用。
当我想要的是:
我通常引用像这样的1,这很好,但有时我想引用这个作者(2018),但它似乎不起作用。
当有多位作者时,最好只列出一位作者等(年份)。
答案1
一般来说,通过 定义新命令\DeclareCiteCommand
比将多个\cite...
命令集中在一起更好\newcommand
。虽然您可能看不到特定用例的好处,但避免坏习惯是个好主意。这种\newcommand
方法可能会出错,尤其是在有前后注释或您想同时引用多个来源的情况下。
\documentclass{report}
\usepackage[style=numeric-comp,
minbibnames=3,
maxbibnames=5,
maxcitenames=2,
mincitenames=1,
autocite=superscript,
backend=biber,
labeldateparts,
]{biblatex}
\usepackage{hyperref}
\newbibmacro{aycite}{%
\printtext[bibhyperref]{%
\printnames{labelname}%
\setunit{\addspace}%
\printtext[parens]{%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\printlabeldate
\setunit{\addsemicolon\space}%
\printtext{ref\adddot}%
\setunit{\addspace}%
\printfield{labelprefix}%
\printfield{labelnumber}%
\ifnumequal{\value{citecount}}{\value{citetotal}}
{\usebibmacro{postnote}}
{}}}}
\DeclareCiteCommand{\aycite}
{}
{\usebibmacro{citeindex}%
\usebibmacro{aycite}}
{\multicitedelim}
{}
\addbibresource{biblatex-examples.bib}
\begin{document}
How about this where \aycite{sigfridsson} discus a topic.
How about this where \aycite[cf.][1]{sigfridsson} discuss a topic.
How about this where \aycite{sigfridsson,worman} discuss a topic.
\printbibliography
\end{document}
答案2
我找到了一个我认为令人满意的答案。在这个过程中,这两个问题很有帮助:问题 1和问题2
我还应该说我同意 @cfr 关于参考标签的评论,但这并不是我最先想到的,因为我通常使用该hyperref
软件包,因此引用和参考是相互关联的。我通常只是单击引用,而不是将它们用作参考表中的键。因此,我将标签合并到我的解决方案中。
这就是我得到的:
\documentclass{report}
\begin{filecontents}{example.bib}
@article {Example_article,
AUTHOR = {Author, A. B.},
TITLE = {A example paper},
JOURNAL = {Example journal},
VOLUME = {1},
YEAR = {2018},
NUMBER = {1},
PAGES = {1-100}}
\end{filecontents}
\usepackage[style=numeric-comp,
minbibnames=3,
maxbibnames=5,
maxcitenames=2,
mincitenames=1,
autocite=superscript,
backend=biber
]{biblatex}
\usepackage{hyperref}
\DeclareCiteCommand{\tabcite}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}%
\usebibmacro{postnote}}
\addbibresource{example.bib}
\newcommand{\citelink}[2]{\hyperlink{cite.\therefsection @#1}{\citeauthor{#1} (\citeyear{#1}; ref. \tabcite{#1})}}
\begin{document}
How about this where \citelink{Example_article}{} discusses a topic.
\printbibliography
\end{document}
生成结果:
作者(2018;参考文献 1)讨论某个主题时,情况如何?
链接到适当的参考书目。