我想要一个自定义的 biblatex cite 命令,打印first last (year)
作者first
的名字last
、作者的姓氏和year
出版年份。
以下问题使我走上了正确的轨道,但由于它们没有解释发生了什么,我无法弄清楚如何编辑这些自定义定义以满足我的需要:
编辑:MWE 的答案如下:
\documentclass{report}
\usepackage{epigraph}
\usepackage{blindtext}
\setlength\epigraphwidth{8cm}
\setlength\epigraphrule{0pt}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\epigraph}{\@epitext{#1}}{\itshape\@epitext{#1}}{}{}
\makeatother
\usepackage{filecontents}
\begin{filecontents}{mytestbib.bib}
@UNPUBLISHED{mumford:quote,
author={Mumford, David},
title={ICM 2002 plenary talk},
month={9},
year={2002}
}
\end{filecontents}
\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{mytestbib.bib}
%% From https://tex.stackexchange.com/questions/24979/citing-authors-full-name-in-biblatex
\DeclareCiteCommand{\citeauthorfirstlast}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\DeclareNameAlias{labelname}{first-last}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexnames{labelname}}
{}%
\printnames{labelname}}
{\multicitedelim}
{\usebibmacro{postnote}}
%% From @moewe
\DeclareCiteCommand{\citetwfn}
{\DeclareNameAlias{labelname}{given-family}%
\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\iffirstcitekey
{\setcounter{textcitetotal}{1}}
{\stepcounter{textcitetotal}%
\textcitedelim}%
\usebibmacro{textcite}}
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}
{\usebibmacro{textcite:postnote}}
\begin{document}
\chapter{Introduction}
\setlength{\epigraphwidth}{0.5\textwidth}
%% solution from @gusbrs
\epigraph{``The world is continuous, but the mind is discrete.``}{---\textup{\citeauthorfirstlast{mumford:quote} (\cite*{mumford:quote})}}
%% solution from @moewe
\epigraph{``The world is continuous, but the mind is discrete.``}{---\textup{\citetwfn{mumford:quote} }}
%% solution from @moewe
\AtNextCite{\AtEachCitekey{\DeclareNameAlias{labelname}{given-family}}}
\epigraph{``The world is continuous, but the mind is discrete.``}{---\textup{\textcite{mumford:quote}}}
\blindtext \textcite{mumford:quote}.
\printbibliography
\end{document}
答案1
我们只需要
\DeclareNameAlias{labelname}{given-family}
始终以“姓氏”格式获取全名,而不是显示姓氏和其他姓名部分(首字母或完整名字)的默认格式,仅当按照 的要求进行消歧义时才显示uniquename
。
如果你不打算经常使用它,你可以把
\AtNextCite{\AtEachCitekey{\DeclareNameAlias{labelname}{given-family}}}
前\textcite{mumford:quote}
:
\AtNextCite{\AtEachCitekey{\DeclareNameAlias{labelname}{given-family}}}\textcite{mumford:quote}
当然,这也可以放入与样式无关的命令中
\newrobustcmd*{\citetwfn}{%
\AtNextCite{%
\AtEachCitekey{%
\DeclareNameAlias{labelname}{given-family}}}%
\textcite}
如果您最终决定要更频繁地使用它。
然后你可以简单地使用它作为
\citetwfn{mumford:quote}
\textcite
或者,我们可以简单地复制from的定义authoryear-ibid.cbx
(这是您使用的样式),并在适当的位置插入名称格式的重新定义。使用
\DeclareCiteCommand{\citetwfn}
{\DeclareNameAlias{labelname}{given-family}%
\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\iffirstcitekey
{\setcounter{textcitetotal}{1}}
{\stepcounter{textcitetotal}%
\textcitedelim}%
\usebibmacro{textcite}}
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}
{\usebibmacro{textcite:postnote}}
\textcite
您可以获得来自的输出authoryear-ibid
,但作者姓名始终以“first last”格式给出。