在回复帖子中修改 biblatex 的 authortitle 中的姓氏名字分隔符它展示了如何自定义格式作者的姓名。
我需要一种略有不同的格式,即“Fox P., R. Rabbit”而不是“Fox P, R. Rabbit”(按照我国的国家标准,逗号前要有一个点)。如何修改从上面引用的帖子中借用的以下脚本,以便在“Fox P”后面的“,”之前添加一个点,并使其适用于任何数量的作者?我的意思是,如果只有一位作者,“Fox P.”不应转换为“Fox P..”。
\RequirePackage{filecontents}
\begin{filecontents}{sample.bib}
@ARTICLE{liu:11,
author = {Peter Fox and Richard Rabbit and Franc Bird},
title = {Animals are the better humans},
journal = {Horse and Hound},
year = {2011},
volume = {10},
pages = {11--15}
}
\end{filecontents}
\documentclass[a4paper,ngerman]{scrartcl}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[style=authortitle,firstinits=true]{biblatex}
% =================================
% biblatex modification
\makeatletter
\def\MKbibnamefirst#1{\expandafter\mkbibnamefirst@i#1..\@nil}
\def\mkbibnamefirst@i#1.#2.#3\@nil{#1}
\renewbibmacro*{name:last-first}[4]{%
\ifuseprefix
{\usebibmacro{name:delim}{#3#1}%
\usebibmacro{name:hook}{#3#1}%
\ifblank{#3}{}{%
\ifcapital
{\mkbibnameprefix{\MakeCapital{#3}}\isdot}
{\mkbibnameprefix{#3}}%
\ifpunctmark{'}{}{\addhighpenspace}}%
\mkbibnamelast{#1}\isdot
\ifblank{#4}{}{\addlowpenspace\mkbibnameaffix{#4}\isdot}%
\ifblank{#2}{}{\addlowpenspace\mkbibnamefirst{#2}}}
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
\mkbibnamelast{#1}\isdot
\ifblank{#4}{}{\addlowpenspace\mkbibnameaffix{#4}\isdot}%
% \ifblank{#2#3}{}{\addcomma}%
\ifblank{#2}{}{\addlowpenspace\MKbibnamefirst{#2}}%
% \ifblank{#3}{}{\addlowpenspace\mkbibnameprefix{#3}\isdot}
}}
\makeatother
% =================================
\bibliography{sample}
\begin{document}
Samplecite~\cite{liu:11}.
\printbibliography
\end{document}
答案1
解决方法是删除您所引用的问题中的示例中的所有多余的代码。
\RequirePackage{filecontents}
\begin{filecontents}{sample.bib}
@ARTICLE{liu:11,
author = {Peter Fox and Richard Rabbit and Franc Bird},
title = {Animals are the better humans},
journal = {Horse and Hound},
year = {2011},
volume = {10},
pages = {11--15}
}
\end{filecontents}
\documentclass[a4paper,ngerman]{scrartcl}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[style=authortitle,firstinits=true]{biblatex}
\bibliography{sample,newmainjournals}
\begin{document}
Samplecite~\cite{liu:11}.
\printbibliography
\end{document}