Bib latex - 如何删除作者和年份之间的句号

Bib latex - 如何删除作者和年份之间的句号

我正在努力寻找一种适应 APA 标准的方法。我想删除作者部分后面的句号。参考书目应如下所示:

作者 XYZ(2017 年)。标题。于 2017 年 11 月 15 日发表https://url.xy

但是,APA 会在作者后添加一个句号:

作者 XYZ。(2017 年)。标题。于 2017 年 11 月 15 日发表https://url.xy

我试过了\renewcommand{\labelnamepunct}{\space},但它只是删除了年份后的句点。

梅威瑟:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{csquotes}

\usepackage[style=apa]{biblatex}
\DeclareLanguageMapping{german}{german-apa}
\addbibresource{sample.bib}
\DefineBibliographyStrings{german}{
   retrieved = {Abgerufen am},
   from = {von},
   nodate = {{}ohne Datum},
}
\DeclareFieldFormat[online]{title}{\mkbibemph{#1}}

\begin{filecontents}{\sample.bib}
   @online{onlinekoerperschaft,
           author = {{Author XYZ}},
           title = "Title",
           url = {https://url.xy},
           urldate = "2017-11-15"
   }
\end{filecontents}
\begin{document}
\nocite{*}
\printbibliography
\end{document} 

答案1

biblatex-apa针对v9.0+ 的更新

请记住,句号是 APA 样式所规定的,参见。https://apastyle.apa.org/style-grammar-guidelines/references/examples/report-government-agency-references

对于biblatex-apa实现第 7 版 APA 样式的 v9 及以上版本,我们可以重新定义 bibmacroauthor/editor来使用nameyeardelim,然后我们可以按照标准样式对其进行自定义。

\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=apa]{biblatex}

\DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addspace}
\DeclareDelimAlias*[bib,biblist]{nonameyeardelim}{nameyeardelim}
\renewbibmacro*{author/editor}{%
  \ifthenelse{\ifnameundef{author}\AND\ifnameundef{groupauthor}}
    {\ifnameundef{editor}
      {\usebibmacro{title}%
       % need to clear all title fields so we don't get them again later
       \clearfield{title}%
       \clearfield{subtitle}%
       \clearfield{titleaddon}%
       \setunit{\printdelim{nonameyeardelim}}\newblock}
      {\usebibmacro{editorinauthpos}%
       \setunit{\printdelim{nameyeardelim}}\newblock}}
    {\usebibmacro{author}%
     \setunit{\printdelim{nameyeardelim}}\newblock}%
  %
  \usebibmacro{labelyear+extradate}}

\begin{filecontents}{\jobname.bib}
@report{nci,
  author      = {{National Cancer Institute}},
  year        = {2019},
  title       = {Taking Time},
  subtitle    = {Support for People With Cancer},
  type        = {NIH Publication},
  number      = {18-2059},
  institution = {U.S. Department of Health and Human Services,
                 National Institutes of Health},
  url         = {https://www.cancer.gov/publications/patient-education/takingtime.pdf},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson,nci}

\printbibliography
\end{document}

美国国家癌症研究所 (2019)。花时间:为癌症患者提供支持 (NIH 出版物编号 18-2059)。美国卫生与公众服务部、国立卫生研究院。https://www.cancer.gov/publications/patient-education/takingtime.pdf

也可以看看调整参考书目/作者和年份之间没有逗号/没有斜体字体https://github.com/plk/biblatex-apa/pull/117


旧答案

您需要稍微改变两个biblatex-apa宏。

\renewbibmacro*{author}{%
  \ifnameundef{author}
    {\usebibmacro{labeltitle}}
    {\printnames[apaauthor][-\value{listtotal}]{author}%
     \setunit*{\addspace}%
     \printfield{nameaddon}%
     \ifnameundef{with}
       {}
       {\setunit{}\addspace\mkbibparens{\printtext{\bibstring{with}\addspace}%
        \printnames[apaauthor][-\value{listtotal}]{with}}
        \setunit*{\addspace}}}%
  \setunit{\addspace}\newblock%
  \usebibmacro{labelyear+extradate}}

\renewbibmacro*{editorinauthpos}{%
    \global\booltrue{bbx:editorinauthpos}%
    \printnames[apaauthor][-\value{listtotal}]{editor}%
    \setunit{\addspace}%
    \ifnameundef{editor}
      {}
      {\printtext[parens]{\usebibmacro{apaeditorstrg}{editor}}%
       % need to clear editor so we don't get an "In" clause later
       % But we also need to set a flag to say we did this so we
       % don't lose sight of the fact we once had an editor for
       % various year placement tests
       \clearname{editor}%
       \setunit{\addspace}%
       \usebibmacro{labelyear+extradate}%
       \setunit{\adddot\addspace}}}

唯一的变化是在调用之前\usebibmacro{labelyear+extradate}。在author宏中,a\newunit被替换为\setunit{\addspace};在editorinauthpos宏中,它是\setunit{\adddot\addspace}

此解决方案假定当前biblatex-apa版本为 7.5。如果您正在运行旧版本,请考虑更新(记得更新biblatex到 3.8a 并将 Biber 更新到 2.8)。如果这根本不可能,请labelyear+extradatelabelyear+extrayearinn 替换上述宏,这样应该可以让代码在较新版本的软件包中也能运行。

相关内容