biblatex-apa:当没有数字时获取@(tech)报告的类型

biblatex-apa:当没有数字时获取@(tech)报告的类型

我仍在使用设置:biblatex-apa与 koma-script 书籍类一起scrbook,这里是 MWE

\documentclass[10pt,ngerman]{scrbook}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@report{aut1,
    author      = {Uthor, A.},
    title       = {Title title},
    year        = {1990},
    address     = {Paris},
    institution = {Organisation for Economic Co-operation {a}nd Development},
    type        = {Project report},
}
@report{aut2,
    author      = {Uthor, B.},
    title       = {Title title},
    year        = {1992},
    address     = {Paris},
    institution = {Organisation for Economic Co-operation {a}nd Development},
    type        = {Project report},
    number      = {2}
}
@techreport{aut3,
    author      = {Uthor, C.},
    title       = {Title title},
    year        = {1994},
    address     = {Paris},
    institution = {Organisation for Economic Co-operation {a}nd Development},
    type        = {Project report}
}
\end{filecontents}

\usepackage[ngerman]{babel}
\usepackage[backend=biber, style=apa, natbib=true, refsegment=chapter, defernumbers=true]{biblatex}
\DeclareLanguageMapping{ngerman}{ngerman-apa}

\addbibresource{\jobname.bib}

\begin{document}        
    \nocite{*}
    \printbibliography
\end{document}

1) 我很好奇的是,为什么在没有给出数字的情况下,我无法在参考文献中看到报告的类型,以及如何更改这种行为。也就是说,在我想看到的参考文献中

Uthor,A.(1992 年)。标题 标题(项目报告)。经济合作与发展组织。巴黎。

或/和

Uthor,C.(1992 年)。标题 标题(项目报告)。经济合作与发展组织。巴黎。

如果可能的话,我不想使用@misc或,@PhdThesis因为这些不能充分描述引用的技术含义。我确实尝试过使用某种非打印字符,比如在字段~number,但结果只会是这样的

..(项目报告编号)..

答案1

biblatex-apa使用一些复杂的代码来确保type只有数字存在时才打印该字段(强制性警告:如果按照此处显示的方式修改样式,可能会失去 APA 合规性)。您可以使用

\DeclareFieldFormat[report]{number}{\bibcpstring{number}~\apanum{#1}}

\renewbibmacro*{apa:reportnum}{%
  \ifboolexpr{not test {\iffieldundef{type}} or not test {\iffieldundef{number}}}
    {\printtext[parens]{%
       \printfield{type}%
       \setunit{\addspace}%
       \printfield{number}}}
    {}}

type如果存在或 则打印一些内容number

当然,你可以使用重新定义

\renewbibmacro*{apa:reportnum}{%
  \iffieldundef{type}
    {}
    {\printtext[parens]{%
       \printfield{type}%
       \setunit{\addspace}%
       \printfield{number}}}}

以避免打印单个数字。(上面的方法可以实现。)

平均能量损失

\documentclass[10pt,ngerman]{article}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@report{aut1,
    author      = {Uthor, A.},
    title       = {Title title},
    year        = {1990},
    address     = {Paris},
    institution = {Organisation for Economic Co-operation {and} Development},
    type        = {Project report},
}
@report{aut2,
    author      = {Uthor, B.},
    title       = {Title title},
    year        = {1992},
    address     = {Paris},
    institution = {Organisation for Economic Co-operation {and} Development},
    type        = {Project report},
    number      = {2}
}
@techreport{aut3,
    author      = {Uthor, C.},
    title       = {Title title},
    year        = {1994},
    address     = {Paris},
    institution = {Organisation for Economic Co-operation {and} Development},
    type        = {Project report}
}
\end{filecontents*}

\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=apa, natbib=true]{biblatex}
\DeclareLanguageMapping{ngerman}{ngerman-apa}

\addbibresource{\jobname.bib}

\DeclareFieldFormat[report]{number}{\bibcpstring{number}~\apanum{#1}}

\renewbibmacro*{apa:reportnum}{%
  \ifboolexpr{not test {\iffieldundef{type}} or not test {\iffieldundef{number}}}
    {\printtext[parens]{%
       \printfield{type}%
       \setunit{\addspace}%
       \printfield{number}}}
    {}}

\begin{document}        
    \nocite{*}
    \printbibliography
\end{document}

给出

Uthor, A. (1990)。标题 (项目报告)。经济合作与发展组织。巴黎。

Uthor, B. (1992)。标题 (项目报告编号 2)。经济合作与发展组织。巴黎。

Uthor, C. (1994)。标题 (项目报告)。经济合作与发展组织。巴黎。

相关内容