我需要引用一些由一些专业组织创建的文章,因此没有列出作者或编辑:
@Article{noname2012,
author = {},
title = {This is the title},
publisher = {This is the publisher},
year = {2012},
address = {Miami}
}
我在 ConTeXT 中使用 APA 样式,设置如下:
\setupbibtex[database={Bibliography}, sort=author]
\setuppublications[alternative=apa]
每当我引用时,\cite{noname2012}
它都会显示如下:
(noname2012, 2012)
当名称和编辑者字段为空时,如何让参考书目显示标题而不是名称?
答案1
这是一个最小工作示例。这是一个小小的妥协,因为它要求您将标题添加到 .tex 文件中。
\setupbibtex[database={Bibliography}, sort=author]
\setuppublications[alternative=apa]
\def\citeTitle{\dosingleempty\dociteTitle}
\def\dociteTitle[#1]#2{%
\iffirstargument\cite[inbetween=,left={(#1,\ },right=)][#2]\else
\cite[inbetween=,left=(,right=)][#2]\fi}
\starttext
The Bib\TeX\ file needs to have the nameless author as a nested pair of
empty braces.
\starttyping
@Article{noname2012,
author = {{}},
title = {This is the title},
publisher = {This is the publisher},
year = {2012},
address = {Miami}
}
\stoptyping
Now, whenever I place a citation, \type{\cite{noname2012}} it displays like
this: \cite{noname2012} which is still unsatisfactory. If I add an
optional argument and put the label in square brackets,
\type{\cite[inbetween=][noname2012]}
it displays like this: \cite[inbetween=][noname2012]. Still not quite
right, but I can add the title manually,
\type{\cite[inbetween=,left={(This is the title,\ }][noname2012]}
so that it displays like this:
\cite[inbetween=,left={(This is the title,\ }][noname2012].
With the user||defined command \type{\citeTitle}, it looks like this
\citeTitle{noname2012} or like this
\citeTitle[This is the title]{noname2012}
\stoptext
答案2
对于引用,可以为您知道没有作者的情况定义一个新选项:
% Define a new type of APA citation for title
\definebtx[apa:cite:noauthor][apa:cite:authoryear]
\startsetups btx:apa:cite:noauthor
\btxcitereference
\quotation{\btxflush{title}}
\btxcomma
\btxflush{year}
\stopsetups
因此\cite[noname2012]
,你应该使用\cite[noauthor][noname2012]
。此解决方案基于第 52 页的示例出版物手册。
至于参考书目,你可能必须覆盖基本文章定义。对于以下内容,我从来源并添加一个开关来测试是否没有作者:
% Define a switch in bibliography entry
\startsetups btx:apa:list:article
\doiftextelse{\btxdirect{author}} {
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}
} {
%If no author, use title as first entry
\btxflush{title}
\btxperiod
\btxleftparenthesis
\btxflush{year}
\btxrightparenthesis
\btxperiod
}
\btxdoif {type} {
\btxleftbracket
\btxflush{type}
\btxrightbracketperiod
}
\texdefinition{btx:apa:journal-volume-number-pages}
\texdefinition{btx:apa:url-doi-note}
\stopsetups
如果需要,可以在引用中使用类似的开关来自动处理作者/无作者的情况。
结合演示:
\startbuffer[ref]
@article{solo,
author = {Lastname, Firstname},
title = {Title with author},
journal = {Journal},
year = {2000},
month = {1},
volume = {1}
}
@article{none,
author = {},
title = {Title with no author},
journal = {Journal},
month = {1},
year = {2000},
volume = {1}
}
\stopbuffer
% Boilerplate to set up references
\loadbtxdefinitionfile[apa]
\usebtxdataset[ref][ref.buffer]
\setupbtx[dataset=ref]
\definebtxrendering[ref]
[dataset=ref,
specification=apa]
\setupbtx[apa:cite]
[alternative=authoryear,
etallimit=1]
% Define a new type of APA citation for title
\definebtx[apa:cite:noauthor][apa:cite:authoryear]
\startsetups btx:apa:cite:noauthor
\btxcitereference
\quotation{\btxflush{title}}
\btxcomma
\btxflush{year}
\stopsetups
% Define a switch in bibliography entry
\startsetups btx:apa:list:article
\doiftextelse{\btxdirect{author}} {
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}
} {
%If no author, use title as first entry
\btxflush{title}
\btxperiod
\btxleftparenthesis
\btxflush{year}
\btxrightparenthesis
\btxperiod
}
\btxdoif {type} {
\btxleftbracket
\btxflush{type}
\btxrightbracketperiod
}
\texdefinition{btx:apa:journal-volume-number-pages}
\texdefinition{btx:apa:url-doi-note}
\stopsetups
% Testing
\starttext
Normal citations: \cite[solo] vs. \cite[none] \\
Noauthor citations: \cite[noauthor][solo] vs. \cite[noauthor][none]
\startsubject[title=Bibliography]
\placelistofpublications[ref][method=dataset]
\stopsection
\stoptext
结果是:
然而,正如 Mico 在评论中所建议的那样,简单地让组织成为作者会更容易:
\startbuffer[ref]
@article{solo,
author = {Lastname, Firstname},
title = {Title with author},
journal = {Journal},
year = {2000},
month = {1},
volume = {1}
}
@article{none,
author = {{Professional organization XYZ}},
title = {Title with no author},
journal = {Journal},
month = {1},
year = {2000},
volume = {1}
}
\stopbuffer
% Boilerplate to set up references
\loadbtxdefinitionfile[apa]
\usebtxdataset[ref][ref.buffer]
\setupbtx[dataset=ref]
\definebtxrendering[ref]
[dataset=ref,
specification=apa]
\setupbtx[apa:cite]
[alternative=authoryear,
etallimit=1]
% Testing
\starttext
Normal citations: \cite[solo] vs. \cite[none] \\
\startsubject[title=Bibliography]
\placelistofpublications[ref][method=dataset]
\stopsection
\stoptext
结果是:
答案3
您可以随时尝试使用该natbib
包以及\bibliographystyle
定义为阿帕莱克或者纽瓦帕。因此,您的代码将如下所示:
\usepackage{natbib}
\bibliographystyle{apalike} % or newapa, depending on what you are using
\bibliography{bibliography} % your bibliography.bib file
然后,您可以使用\citep{authorlabel}
(获取括号中的完整参考资料)或\citet{authorlabel}
(获取括号中的年份和括号外的作者)。我强烈建议您参阅natbib
文档了解更多信息。