我有以下 MWE:
\RequirePackage{filecontents}
\begin{filecontents*}{biblatextest.bib}
@article{W00,
author = "Wayne, J.",
title = "Article with volume number and doi",
journal = "Journal A",
volume = "X",
number = "Y",
pages = "1-2",
year = "2000",
doi = "10.1007/...",
url = ""
}
@article{L00,
author = "Lee, B.",
title = "Article without volume number, but with url",
journal = "Journal B",
volume = "",
number = "Y",
pages = "3-4",
year = "2000",
doi = "",
url = "https://..."
}
@book{J92,
author = "Jordan, M.",
title = "{Fundamentals of Basketball}",
edition = "1",
publisher = "Chicago University Press",
location = "Chicago",
isbn = "87654321",
doi = "",
url = "",
year = "1992"
}
@inproceedings{D21,
author = "Delon, A.",
title = "{Article title}",
editor = "Edith, I.",
booktitle = "{Proceedings of Symposium A}",
series = "Series of Symposia Proceedings",
volume = "1",
edition = "2",
pages = "5-6",
publisher = "Cambridge University Press",
location = "London",
isbn = "12345678",
doi = "",
url = "",
year = "2021",
eventtitle = "Symposium A",
venue = "Oxford",
eventdate = "2020-09-01/2020-09-05"
}
\end{filecontents*}
\documentclass{article}
\usepackage{fullpage}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa, natbib=true, backend=biber]{biblatex}
\DeclareLanguageMappingSuffix{-apa}
\usepackage{hyperref}
\hypersetup{allcolors=blue,colorlinks=true,linktocpage,bookmarksopen,bookmarksnumbered}
\usepackage{xpatch}
\xpretobibmacro{doi+url}{\printfield{isbn}}{}{}
\makeatletter
\renewbibmacro*{cite:plabelyear+extradate}{%
\iffieldundef{labelyear}{}
{\clearfield{labelmonth}% don't want months in citations
\clearfield{labelday}% don't want days in citations
\clearfield{labelendmonth}% don't want months in citations
\clearfield{labelendday}% don't want days in citations
\iffieldsequal{labelyear}{labelendyear}% Don't want no-op year ranges
{\clearfield{labelendyear}}
{}%
\iffieldundef{origyear}
{}
{\printorigdate%
\setunit*{\addslash}}%
\iffieldundef{related}
{}
{\iffieldequalstr{relatedtype}{reprintfrom}
{\entrydata*{\thefield{related}}{\printlabeldateextra}%
\setunit*{\addslash}}
{}}%
\printlabeldateextra}}
\renewbibmacro*{citeyear}{%
\iffieldundef{labelyear}
{\usebibmacro{cite:init}}
{\iffieldequals{fullhash}{\cbx@lasthash}
{\setunit{\compcitedelim}%
\printtext[bibhyperref]{\usebibmacro{cite:plabelyear+extradate}}}
{\printtext[bibhyperref]{\usebibmacro{cite:plabelyear+extradate}}%
\savefield{fullhash}{\cbx@lasthash}}}%
\setunit{\multicitedelim}}
\renewbibmacro*{cite:author}{%
\iffieldequals{fullhash}{\cbx@lasthash}
{\setunit{\compcitedelim}%
\printtext[bibhyperref]{\usebibmacro{cite:plabelyear+extradate}}}%
{\printtext[bibhyperref]{%
\ifnameundef{labelname}
{\usebibmacro{cite:noname}%
\savefield{fullhash}{\cbx@lasthash}}
{\ifnameundef{shortauthor}
{\printnames{labelname}}%
{\cbx@apa@ifnamesaved
{\printnames{shortauthor}}
{\ifnameundef{groupauthor}
{\printnames[labelname]{author}}
{\printnames[labelname]{groupauthor}}%
\addspace\printnames[sabrackets]{shortauthor}}}%
\savefield{fullhash}{\cbx@lasthash}}}}%
\setunit{\multicitedelim}}
\renewbibmacro*{cite}{%
\iffieldequals{fullhash}{\cbx@lasthash}
{\setunit{\compcitedelim}%
\printtext[bibhyperref]{%
\usebibmacro{cite:plabelyear+extradate}}}%
{\printtext[bibhyperref]{%
\ifnameundef{labelname}
{\usebibmacro{cite:noname}%
\setunit{\printdelim{nameyeardelim}}%
\usebibmacro{cite:plabelyear+extradate}%
\savefield{fullhash}{\cbx@lasthash}}
{\ifnameundef{shortauthor}
{\printnames{labelname}}%
{\cbx@apa@ifnamesaved
{\printnames{shortauthor}}
{\ifnameundef{groupauthor}
{\printnames[labelname]{author}}
{\printnames[labelname]{groupauthor}}%
\addspace\printnames[sabrackets]{shortauthor}}}%
\setunit{\printdelim{nameyeardelim}}%
\usebibmacro{cite:plabelyear+extradate}%
\savefield{fullhash}{\cbx@lasthash}}}}%
\setunit{\multicitedelim}}
\renewbibmacro*{textcite}{%
\iffieldequals{fullhash}{\cbx@lasthash}
% Compact cite - more than one thing for same author
{\setunit{\compcitedelim}%
\printtext[bibhyperref]{%
\usebibmacro{cite:plabelyear+extradate}}}
% New cite
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\setunit{\textcitedelim}%
\ifnameundef{labelname}
% No author/editor
{\iffieldundef{shorthand}%
% Cite using title
{\printtext[bibhyperref]{\usebibmacro{cite:noname}}%
\setunit{\global\booltrue{cbx:parens}\addspace\bibopenparen}%
\printtext[bibhyperref]{\usebibmacro{cite:plabelyear+extradate}}}
% Cite using shorthand
{\printtext[bibhyperref]{\usebibmacro{cite:shorthand}}}}
% Normal cite with author/editor
% Normal full cite
{\printtext[bibhyperref]{%
\ifnameundef{shortauthor}%
% Normal full cite
{\printnames{labelname}}
% Cite using short author
{\cbx@apa@ifnamesaved
{\printnames{shortauthor}}
{\ifnameundef{groupauthor}
{\printnames[labelname]{author}}
{\printnames[labelname]{groupauthor}}}}}%
% Year
\setunit{\global\booltrue{cbx:parens}\addspace\bibopenparen}%
% Put the shortauthor inside the year brackets if necessary
\printtext[bibhyperref]{%
\ifnameundef{shortauthor}
{}
{\cbx@apa@ifnamesaved
{}
{\printnames{shortauthor}%
\setunit{\printdelim{nameyeardelim}}}}%
% Print prenote (belongs to first cite)
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
% Actual year printing
\usebibmacro{cite:plabelyear+extradate}}%
% Save name hash for checks later
\savefield{fullhash}{\cbx@lasthash}}%
\stepcounter{textcitecount}}}
\makeatother
\addbibresource{biblatextest.bib}
\begin{document}
\sloppy
\citep{W00}
\citet{L00}
\citep{J92}
\citet{D21}
\printbibliography
\fussy
\end{document}
如您所见,使用 APA 格式时,并非所有书籍和会议论文集参考资料的字段都以标准方式写入 .pdf 输出文件。我该如何写入所有这些字段?请注意,在 hyperref 包设置后,我已经可以使用两行代码写入 ISBN 字段(该字段未以 APA 格式标准打印)(尽管 ISBN 字体不同,因此这可能是一个相当快速的修复方法)。此后直到文档开始的大量代码与超链接作者 + 年份有关,这在另一个问题中得到解决。还请注意会议论文集的邪恶年份输出。使用 biblatex 时,可能应该在整个 .bib 文件中使用日期字段,而不是年份字段。我将尝试在接下来的几个小时内添加书籍集合类型的条目。这样,人们应该有望解决大多数(如果不是所有)相关类型的 APA 格式书目条目的定制问题。我知道有人可能会自定义其他样式,如作者年份或其变体,而不是自定义 APA 样式,但请记住,目标是基本上采用 APA 样式,但打印书籍、论文集、书籍收藏等所有字段,或者至少可以选择这样做。次要目标可能是删除 & 之前的逗号(或保留逗号并删除所有 &,如某些“哈佛样式”中所示),用于双作者参考文献;但优先级较低。
谢谢你的帮助!