我正在尝试将翻译者信息添加到 cite 命令中(我已经根据我的需要对参考书目本身进行了修改)。
如果出版物没有作者或编辑,则译者会打印在引用中,这是正确的。此外,我想添加信息,即它是译者。(我使用的是德语,因此译者信息将以德语打印Übers.
)例如
为textcite
:姓氏(姓氏)(2010:1-2)
为parencite
:(姓氏(名字)2010:1-2)
书目示例条目:
@incollection{Kern.2010-EarlyChineseLiterature,
translator = {Kern, Martin},
booktitle = {The Cambridge History of Chinese Literature},
date = {2010-04-01},
isbn = {978-1-139-09541-9},
pages = {1--115},
publisher = {Cambridge University Press},
title = {Early Chinese Literature, Beginnings Through Western Han},
}
(这只是一个例子)
梅威瑟:
%----------------------------------------------------------------------------
% LAYOUT
%----------------------------------------------------------------------------
\documentclass[
12pt,
a4paper,
headings=standardclasses,
listof=totoc,
numbers=noenddot
]{scrartcl}
\usepackage[hmargin=2.5cm, top=2.5cm, bottom=2cm, footskip=1cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[main=ngerman, english]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[ngerman]{isodate}
\usepackage[ngerman]{datetime}
%----------------------------------------------------------------------------
% BIB
%----------------------------------------------------------------------------
\usepackage[
backend=biber,
style=ext-authoryear,
sorting=nyvt,
datamodel=customstyles,
maxnames=25,
innamebeforetitle=true,
usetranslator=true,
alldates=terse,
labeldate=year,
dashed=false,
doi=false,
isbn=false,
url=false
]{biblatex}
\AtEveryBibitem{%
\clearlist{language}%
\clearfield{pagetotal}%
}
\addbibresource{library.bib}
\usepackage[hidelinks, pdfencoding=auto]{hyperref}
\usepackage{microtype}% avoid bib formatting issues
% editor in parentheses
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}
\DeclareFieldAlias{translatortype}{editortype}
%----------------------------------------------------------------------------
% MAIN
%----------------------------------------------------------------------------
\begin{document}
\textcite[][1--2]{Kern.2010-EarlyChineseLiterature}
\parencite[][1--2]{Kern.2010-EarlyChineseLiterature}
\autocite[][1--2]{Kern.2010-EarlyChineseLiterature}
\cite[][1--2]{Kern.2010-EarlyChineseLiterature}
\nocite{*}
\clearpage
\printbibliography
\end{document}
答案1
我们可以借鉴BibLaTex - 在引用和参考书目中标记编辑器(标签名称)。本质上,我们检查labelnamesource
名称的类型(author
/ editor
/ translator
),并使用适合该工作的 bibmacro。然后我们只需要重新定义cite
,tetxcite
这样它们就可以打印增强的名称。
\documentclass[
12pt,
a4paper,
]{scrartcl}
\usepackage[main=ngerman, english]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[
backend=biber,
style=ext-authoryear,
sorting=nyvt,
datamodel=customstyles,
maxnames=25,
innamebeforetitle=true,
usetranslator=true,
alldates=terse,
labeldate=year,
dashed=false,
doi=false,
isbn=false,
url=false
]{biblatex}
\AtEveryBibitem{%
\clearlist{language}%
\clearfield{pagetotal}%
}
\usepackage[hidelinks, pdfencoding=auto]{hyperref}
\usepackage{microtype}% avoid bib formatting issues
% editor in parentheses
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}
\DeclareFieldAlias{translatortype}{editortype}
\newbibmacro{cite:labelname}{%
\printnames{labelname}%
\iffieldequalstr{labelnamesource}{author}
{\setunit{\printdelim{authortypedelim}}%
\usebibmacro{authorstrg}}
{\iffieldequalstr{labelnamesource}{editor}
{\setunit{\printdelim{editortypedelim}}%
\usebibmacro{editor+othersstrg}}
{\iffieldequalstr{labelnamesource}{translator}
{\setunit{\printdelim{editortypedelim}}%
\usebibmacro{translator+othersstrg}}
{}}}}
\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\usebibmacro{cite:labelname}%
\setunit{\printdelim{nameyeardelim}}}%
\usebibmacro{cite:labeldate+extradate}}
{\usebibmacro{cite:shorthand}}}
\makeatletter
\renewbibmacro*{textcite}{%
\ifnameundef{labelname}
{\iffieldundef{shorthand}
{\usebibmacro{cite:label}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nonameyeardelim}%
\csuse{extblx@citedelim@\blx@delimcontext @inner@open}}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{cite:labeldate+extradate}}
{\usebibmacro{cite:shorthand}}}
{\usebibmacro{cite:labelname}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nameyeardelim}%
\csuse{extblx@citedelim@\blx@delimcontext @inner@open}}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{citeyear}}}
\makeatother
\begin{filecontents}[overwrite]{\jobname.bib}
@incollection{Kern.2010-EarlyChineseLiterature,
translator = {Kern, Martin},
booktitle = {The Cambridge History of Chinese Literature},
date = {2010-04-01},
isbn = {978-1-139-09541-9},
pages = {1--115},
publisher = {Cambridge University Press},
title = {Early Chinese Literature, Beginnings Through Western Han},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\textcite[][1--2]{Kern.2010-EarlyChineseLiterature}
\parencite[][1--2]{Kern.2010-EarlyChineseLiterature}
\autocite[][1--2]{Kern.2010-EarlyChineseLiterature}
\cite[][1--2]{Kern.2010-EarlyChineseLiterature}
\nocite{*}
\clearpage
\printbibliography
\end{document}