我需要修改自定义采访引用样式这帖子。参考书目看起来应该如此。在引文中,作者的名字写成“Given Family”。但是,引文应该看起来像参考书目(“Family, Given”)。我该如何更改?
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@interview{homer,
interviewee = {Homer Simpson},
interviewer = {Bart Simpson},
date = {2018-07-25},
address = {Springfield},
}
\end{filecontents*}
\begin{filecontents}{interview.dbx}
\DeclareDatamodelEntrytypes{interview}
\DeclareDatamodelFields[type=list,datatype=name]{
interviewer,
interviewee,
}
\DeclareDatamodelEntryfields[interview]{
addendum,
doi,
eprint,
eprintclass,
eprinttype,
interviewer,
interviewee,
location,
note,
pubstate,
}
\end{filecontents}
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[datamodel=interview,backend=biber, style=verbose]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}
\NewBibliographyString{interview}
\DefineBibliographyStrings{german}{%
interview = {Interview},
}
\DeclareNameAlias{interviewee}{author}
\DeclareBibliographyDriver{interview}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printnames{interviewee}%
\newunit\newblock
\bibstring{interview}%
\setunit{\addspace}%
\printnames{interviewer}%
\setunit{\addcomma\space}%
\usebibmacro{date}%
\setunit{\addcomma\space}%
\printlist{location}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\newbibmacro*{cite:short:interview}{%
\usebibmacro{cite:full:citepages}%
\printtext[bibhyperlink]{%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}}
\renewbibmacro*{cite:short}{%
\ifbibmacroundef{cite:short:\strfield{entrytype}}
{\printnames{labelname}%
\setunit*{\printdelim{nametitledelim}}%
\printtext[bibhyperlink]{%
\printfield[citetitle]{labeltitle}}}
{\usebibmacro*{cite:short:\strfield{entrytype}}}}
\begin{document}
Lorem\footcite{homer}
ipsum\footcite{homer}
\printbibliography
\end{document}
答案1
verbose
的cite:full
宏通常调用\usedriver
如下
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}%
这意味着他们将 的格式sortname
(与条目相关的“主要”名称的名称格式,即名称在标题之前,通常按作者、编辑或译者的顺序排列)更改为default
。其背后的想法是default
(最终是given-family
)是“自然”的名称顺序,并且family-given/given-family
或family-given
仅在参考书目中使用,以便更容易找到名称的正确部分进行排序。在脚注中,排序问题不大,因此given-family
使用 。
的实现遵循cite:short:interview
调用 的做法。\usedriver
\DeclareNameAlias{sortname}{default}
在下面的代码中,\DeclareNameAlias{sortname}{default}
删除了cite:short:interview
(对于后续引用)以及cite:full
(对于第一次引用)
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@interview{homer,
interviewee = {Homer Simpson},
interviewer = {Bart Simpson},
date = {2018-07-25},
address = {Springfield},
}
\end{filecontents*}
\begin{filecontents}{interview.dbx}
\DeclareDatamodelEntrytypes{interview}
\DeclareDatamodelFields[type=list,datatype=name]{
interviewer,
interviewee,
}
\DeclareDatamodelEntryfields[interview]{
addendum,
doi,
eprint,
eprintclass,
eprinttype,
interviewer,
interviewee,
location,
note,
pubstate,
}
\end{filecontents}
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[datamodel=interview,backend=biber, style=verbose]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}
\NewBibliographyString{interview}
\DefineBibliographyStrings{german}{%
interview = {Interview},
}
\DeclareNameAlias{interviewee}{author}
\DeclareBibliographyDriver{interview}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printnames{interviewee}%
\newunit\newblock
\bibstring{interview}%
\setunit{\addspace}%
\printnames{interviewer}%
\setunit{\addcomma\space}%
\usebibmacro{date}%
\setunit{\addcomma\space}%
\printlist{location}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\newbibmacro*{cite:short:interview}{%
\usebibmacro{cite:full:citepages}%
\printtext[bibhyperlink]{%
\usedriver
{}
{\thefield{entrytype}}}}
\renewbibmacro*{cite:short}{%
\ifbibmacroundef{cite:short:\strfield{entrytype}}
{\printnames{labelname}%
\setunit*{\printdelim{nametitledelim}}%
\printtext[bibhyperlink]{%
\printfield[citetitle]{labeltitle}}}
{\usebibmacro*{cite:short:\strfield{entrytype}}}}
\renewbibmacro*{cite:full}{%
\usebibmacro{cite:full:citepages}%
\printtext[bibhypertarget]{%
\usedriver
{}
{\thefield{entrytype}}}%
\usebibmacro{shorthandintro}}
\begin{document}
Lorem\footcite{homer}
ipsum\footcite{homer}
\printbibliography
\end{document}