![如何修改 APA Biblatex 样式使其看起来像“elsarticle-harv”样式?](https://linux22.com/image/262576/%E5%A6%82%E4%BD%95%E4%BF%AE%E6%94%B9%20APA%20Biblatex%20%E6%A0%B7%E5%BC%8F%E4%BD%BF%E5%85%B6%E7%9C%8B%E8%B5%B7%E6%9D%A5%E5%83%8F%E2%80%9Celsarticle-harv%E2%80%9D%E6%A0%B7%E5%BC%8F%EF%BC%9F.png)
我一直在使用\bibliographystyle{elsarticle-harv}
风格我已经很久没有使用过了,自从我新切换到 以来biblatex
,它只适用于natbib
,那么如何修改默认biblatex
风格或者具体的APA
风格,使得引用风格与 相同elsarticle-harv
。
作者elsarticle-harv
年份引用格式:
\cite{LathamVOF:2012} -----> Latham (2012)
\citep{LathamDEM:2012} -----> (Latham,2012)
\cite{LathamM:2010} -----> Latham et al.(2010) % multi-author
\cite{LathamMeer:2011} -----> Latham and Meer (2011) % 2 authors
\cite{LathamVOF:2012,LathamDEM:2012} -----> Latham (2012a, b)
biblatex
给出了新的设置:
\usepackage{csquotes}
\usepackage[
style=apa,
backend=biber,
refsection=chapter,
natbib=true ] {biblatex}
\DeclareLanguageMapping{british}{british-apa}
然而,APA
风格是这样的:
\cite{LathamVOF:2012} -----> Latham, 2012
\citep{LathamDEM:2012} -----> (Latham,2012) % <--- same
\cite{LathamM:2010} -----> Latham, A & B, 2010 % <--- too many cited authors!
\cite{LathamMeer:2011} -----> Latham & Meer, 2011 % & instead of and!
\cite{LathamVOF:2012,LathamDEM:2012} -----> Latham, 2012a,2012b
()
那么,如何在使用时确定年份\cite{}
并减少作者(如果> 3)FirstAuthor et al.
编辑1:
使用\LetLtxMacro{\cite}{\citet}
使年份为()
,但是设置maxcitenames=2
似乎不起作用。此外,如何将 更改&
为and
?
MWE 代码:
\documentclass[12pt, a4paper]{book}
\usepackage{hyperref}
\usepackage{color}
\usepackage[ ]{libertine}
\usepackage[ T1 ]{fontenc}
\definecolor{DarkBlue}{RGB}{0,51,153}
\hypersetup{
colorlinks,%
linktocpage =true,
citecolor=DarkBlue,%
filecolor=red,%
linkcolor=DarkBlue,%
urlcolor=green,
} % colorlinks setting
\usepackage[UKenglish]{babel}
\usepackage{csquotes}
\usepackage[
style=apa,
backend=biber,
refsection=chapter,
maxcitenames=2,
natbib=true ] {biblatex}
\DeclareLanguageMapping{british}{british-apa}
\LetLtxMacro{\cite}{\citet} % year in ()
\addbibresource{reffile.bib}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Introduction}
\citep[e.g.][]{Tsuji:2008, TsujiDEM:2008}
\cite{TsujiDEM2D:2008, TsujiDEM:2008}
\cite{Shirgaonkar:2009}.
\citep{Sorensen:2006}
\printbibliography[heading=subbibintoc]
\end{document}
和reffile.bib
@ARTICLE{Tsuji:2008,
author = {Tsuji, T. and Yabumoto, K. and Tanaka, T. and Peter, B.},
title = {Spontaneous structures in three-dimensional bubbling gas-fluidized bed by paralled {DEM-CFD} coupling simulation},
journal = { Powder Technology },
year = { 2008 },
volume = { 184 },
pages = { 132-140 },
number = {5 }
}
@ARTICLE{TsujiDEM:2008,
author = {Tsuji, T. },
title = {Spontaneous structures in three-dimensional bubbling},
journal = { Powder Technology },
year = { 2008 },
volume = { 11 },
pages = { 11-17 },
number = {2 }
}
@ARTICLE{TsujiDEM2D:2008,
author = {Tsuji, T. },
title = {Spontaneous structures in 2-{D} bubbling },
journal = { Powder Technology },
year = { 2008 },
volume = { 10 },
pages = { 13-19 },
number = { 7}
}
@ARTICLE{Shirgaonkar:2009,
author = {Shirgaonkar, A. A. and Maclver, M. A. and Patankar, N. A.},
title = {A new mathematical formulation and fast algorithm for fully resovled simulation of self-propulsion},
journal = {Journal of Computional Physics},
year = { 2009 },
volume = { 228 },
pages = { 2366-2390 },
number = {11 }
}
@ARTICLE{Haeri:2012,
author = {Haeri, S. and Shrimpton, J. S.},
title = {On the application of immersed boundary, fictitious domain and body-conformal mesh methods to many particle multiphase flows},
journal = {International Journal of Multiphase Flow},
year = { 2012 },
volume = { 40 },
pages = { 38-55 },
number = { 18}
}
@BOOK{Sorensen:2006,
author = {Sorensen, R. M.},
title = { {Basic Coastal Engineering} },
publisher = {Springer Science, New York},
edition = {Third},
year = { 2006 },
}
输出:在引文中显示 3-5 位作者看起来很奇怪:(
,但maxcitenames
在APA
印刷的参考文献样式:期刊名称和卷数为italic
,如何将其设置为正常字体;或者只是将volume
数字改为非斜体,因为组合18(5)(其中 5 是数字)看起来很奇怪。
natbib
为了便于比较,还附上了原始输出:
答案1
我认为 的问题在于maxcitenames
APA 格式要求在第一次引用作品时列出所有名称。这由labelname
中的格式控制apa.cbx
。我修改了
\DeclareNameFormat{labelname}{%
...
{\ifboolexpr{test {\ifnumcomp{\value{listtotal}}{>}{5}}
or test {\ifciteseen}}
...
}
成为
\DeclareNameFormat{labelname}{%
...
{\ifboolexpr{test {\ifnumcomp{\value{listtotal}}{>}{\value{maxnames}}}}
...
}
我相信您可以复制原文并将修改后的版本粘贴到您的序言中,或者您可以定义自己的引用样式。
至于处理 & 和“and”,我会
\renewcommand*{\finalnamedelim}{\addspace{}\bibstring{and}\space}
我不记得这是否能正确处理语言的变化。
答案2
biblatex-apa 包经过精心定制,符合 APA 格式的标准。您的要求相对简单,可能与标准格式的功能有更多共同之处authoryear-comp
。
您需要做的大多数更改authoryear-comp
已在此站点上的其他帖子中得到解决。
以下示例应该可以帮您完成大部分操作。我在这里使用 BibTeX 作为后端,因为我不明白您的风格为什么需要 biber。如果您希望使用 biber,请使用以下命令加载 biblatex:
\usepackage[backend=biber,style=authoryear-comp,natbib,uniquename=false,
uniquelist=false,maxcitenames=2,firstinits,dashed=false]{biblatex}
这将禁用名称和名称列表消歧义。后者将覆盖maxcitenames=2
以确保引用中的名称列表是唯一的。请注意,在后端之间切换时,您应该在重新编译之前删除辅助文件(*.aux、*.bbl、*.bcf 等)。
\documentclass{article}
\usepackage[backend=bibtex,style=authoryear-comp,natbib,maxcitenames=2,
firstinits,dashed=false]{biblatex}
% \cite like \textcite
\renewrobustcmd*{\cite}{\citet}
\renewrobustcmd*{\Cite}{\Citet}
\renewrobustcmd*{\cites}{\textcites}
% all titles upright, no quotes
\DeclareFieldFormat{journaltitle}{#1}
\DeclareFieldFormat{issuetitle}{#1}
\DeclareFieldFormat{maintitle}{#1}
\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{#1}
% no "In: " preceding journal titles
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
% volume (number)
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\ifentrytype{article}
{\setunit*{\addspace}}
{\setunit*{\adddot}}%
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
% no page prefix
\DeclareFieldFormat{pages}{#1}
% no parentheses around dates
\renewbibmacro*{date+extrayear}{%
\iffieldundef{year}{}{\printtext{\printdateextra}}}%
% no and before last name in list
\AtBeginBibliography{%
\renewcommand*{\finalnamedelim}{\addcomma\space}}
% all names last-first
\DeclareNameAlias{sortname}{last-first}
\addbibresource{biblatex-examples.bib}
\begin{document}
\noindent
\cite[e.g.][10--15]{glashow}, \citet[e.g.][10--15]{glashow} \\
\cite{companion}, \citet{companion}, \citep{companion} \\
\cite*{companion}, \citet*{companion} \\
\cites[e.g.][10--15]{bertram}[10--14]{knuth:ct:a} \\
\cite{glashow,bertram,knuth:ct:a,knuth:ct:b,knuth:ct:c} \\
\citet{glashow,bertram,knuth:ct:a,knuth:ct:b,knuth:ct:c}
\printbibliography
\end{document}
答案3
要将括号添加到使用生成的引用中\cite
,可以使用包letltxmacro
将其定义\cite
为\citet
\LetLtxMacro{\cite}{\citet}
使用 et. al. 之前要打印的作者数量maxcitenames
由 的选项之一的参数控制biblatex
,即
\usepackage[maxcitenames=2]{biblatex}