![使用 APA 格式时,无法强制 Overleaf 在参考书目中显示“组织”字段](https://linux22.com/image/433070/%E4%BD%BF%E7%94%A8%20APA%20%E6%A0%BC%E5%BC%8F%E6%97%B6%EF%BC%8C%E6%97%A0%E6%B3%95%E5%BC%BA%E5%88%B6%20Overleaf%20%E5%9C%A8%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E4%B8%AD%E6%98%BE%E7%A4%BA%E2%80%9C%E7%BB%84%E7%BB%87%E2%80%9D%E5%AD%97%E6%AE%B5.png)
我正在使用 Overleaf,并试图修复参考书目问题。
我遇到的问题是无法强制 biblatex 在参考书目中显示组织字段。
首先,我使用 biblatex 来编制参考书目。我也使用 APA6 样式。
\usepackage[
backend=biber,
style=apa6,]{biblatex}
我将提供一个使用 Microsoft Word 需要实现的功能的示例。我还将展示在 Overleaf 中打印参考书目的当前状态。
让我们从期望的结果开始。以下代码片段显示了在 Microsoft Word 中创建的期望格式的参考书目字段:
Usability. (n.d.). Retrieved May 4, 2021, from Interaction Design Foundation: https://www.interaction-design.org/literature/topics/usability
在上面的代码片段中要查找的关键是“2021 年 5 月 4 日检索”之后和 URL 之前的部分。
而在 Overleaf 中我只能实现以下格式:
Usability. (n.d.). Retrieved May 4, 2021, from https://www.interaction-design.org/literature/topics/usability
上述代码片段的问题在于,它缺少“来自交互设计基金会”的部分,而这部分在使用 APA 样式引用时至关重要。
以下代码片段显示了.bib 文件中的引用:
@online{usability_definition_designfoundation,
title = {Usability},
urldate = {2021-05-04},
organization = {Interaction Design Foundation},
url = {https://www.interaction-design.org/literature/topics/usability},
keywords = {usability, definition},
}
我尽力解释了情况,如果有不清楚的地方请告诉我,我会尽力澄清。
答案1
url 格式在文件中定义apa6.bbx
。您可以复制此定义并在那里添加组织。当然,如果没有组织,它也应该可以工作,因此您可以添加检查以检查组织是否存在,如果存在,则打印它以及周围的空格和标点符号,如果不存在,则不打印任何内容。检查示例如下:
\iflistundef{organization}{}{\addspace\printlist{organization}\addcolon}
您可以使用包\xpatchbibmacro
中的xpatch
来修改书目宏。用于打印 URL 的宏称为url+urldate
。此宏包含一行打印from
(使用当前语言)。在此行之后,可以添加打印组织的修改。
语法\xpatchbibmacro
是:
\xpatchbibmacro{macroname}{search string}{replace string}
{code to execute on succesful patch}{code to execute on failed patch}
最后两个参数可以留空,如下面的 MWE 所示。
梅威瑟:
\documentclass{article}
\usepackage{xpatch}
\begin{filecontents}{\jobname.bib}
@online{usability_definition_designfoundation,
title = {Usability},
urldate = {2021-05-04},
organization = {Interaction Design Foundation},
url = {https://www.interaction-design.org/literature/topics/usability},
keywords = {usability, definition},
}
@online{noorg,
title = {Checkability},
urldate = {2021-05-04},
url = {https://www.example.com},
}
\end{filecontents}
\usepackage[style=apa6]{biblatex}
\addbibresource{\jobname.bib}
\xpatchbibmacro{url+urldate}{\printtext{\bibstring{from}}}{%
\printtext{\bibstring{from}}%
\iflistundef{organization}{}{\addspace\printlist{organization}\addcolon}}{}{}
\begin{document}
See \cite{usability_definition_designfoundation}.
Without organization: \cite{noorg}.
\printbibliography
\end{document}
结果:
为了完整性,无需xpatch
复制完整的宏定义并添加修改:
\documentclass{article}
\begin{filecontents}{\jobname.bib}
@online{usability_definition_designfoundation,
title = {Usability},
urldate = {2021-05-04},
organization = {Interaction Design Foundation},
url = {https://www.interaction-design.org/literature/topics/usability},
keywords = {usability, definition},
}
@online{noorg,
title = {Checkability},
urldate = {2021-05-04},
url = {https://www.example.com},
}
\end{filecontents}
\usepackage[style=apa6]{biblatex}
\addbibresource{\jobname.bib}
% copied from apa6.bbx
\renewbibmacro*{url+urldate}{%
\ifthenelse{\(\iffieldundef{url}\AND\iffieldundef{abstracturl}\AND\iffieldundef{abstractloc}\)\OR\NOT\iffieldundef{doi}}
{}
{\ifthenelse{\iffieldundef{abstracturl}\AND\iffieldundef{abstractloc}}
{}
{\printtext{\bibcpstring{abstract}}\addspace}%
\iffieldequalstr{entrysubtype}{{DVD}}
{\printtext{\bibstring{available}}}
{\printtext{\bibstring{retrieved}}}%
\setunit{\addspace}%
\iffieldundef{urlyear}
{}
{\printtext{\printurldate}%
\setunit*{\urldatecomma}}%
\printtext{\bibstring{from}}%
\iflistundef{organization}{}{\addspace\printlist{organization}\addcolon}
\setunit*{\addspace}%
\printfield{urldescription}%
\setunit*{\addcolon\addspace}%
\iffieldundef{url}{}{\printfield{url}\renewcommand*{\finentrypunct}{\relax}}%
\iffieldundef{abstractloc}{}{\printfield{abstractloc}\renewcommand*{\finentrypunct}{\relax}}%
\iffieldundef{abstracturl}{}{\printfield{abstracturl}\renewcommand*{\finentrypunct}{\relax}}}}
\begin{document}
See \cite{usability_definition_designfoundation}.
Without organization: \cite{noorg}.
\printbibliography
\end{document}
答案2
biblatex-apa6
有一个特殊字段,用于urldescription
在 URL 前插入一些组织(或其他)详细信息
\documentclass{article}
\usepackage[style=apa6]{biblatex}
\begin{filecontents}{\jobname.bib}
@online{usability_definition_designfoundation,
title = {Usability},
urldate = {2021-05-04},
urldescription = {Interaction Design Foundation},
url = {https://www.interaction-design.org/literature/topics/usability},
keywords = {usability, definition},
}
@online{noorg,
title = {Checkability},
urldate = {2021-05-04},
url = {https://www.example.com},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
See \autocite{usability_definition_designfoundation}.
Without organization: \autocite{noorg}.
\printbibliography
\end{document}
此类字段不适用于biblatex-apa
(实现第 7 版 APA 样式)。