使用 biblatex-apa 在引文首字母后留半个空格

使用 biblatex-apa 在引文首字母后留半个空格

我正在使用 biblatex-apa,有两个姓氏相同的作者。当我进行文内引用时,他们的首字母会打印在名字之前。看起来首字母后和姓氏前有一个完整的空格。我该如何将其改为半个空格?

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{williams1980,
    title = {Predication},
    volume = {11},
    timestamp = {2017-06-05T20:27:26Z},
    eprinttype = {jstor},
    eprint = {4178153},
    number = {1},
    journaltitle = {Linguistic inquiry},
    author = {Williams, Edwin},
    date = {1980},
    pages = {203--238}
}
@inproceedings{williams2012,
    title = {Null Complement Anaphors as Definite Descriptions},
    volume = {22},
    url =     {http://journals.linguisticsociety.org/proceedings/index.php/SALT/article/view/2646},
    timestamp = {2017-06-05T20:27:31Z},
    booktitle = {Semantics and {{Linguistic Theory}}},
    author = {Williams, Alexander},
    urldate = {2016-02-01},
    date = {2012},
    pages = {125--145}
}
\end{filecontents}

\usepackage[style=apa]{biblatex}
    \usepackage[utf8]{inputenc}
    \usepackage{csquotes}
    \usepackage[american]{babel}
    \DeclareLanguageMapping{american}{american-apa}
    \addbibresource{\jobname.bib}

\begin{document}
    \textcite{williams2012} or \textcite{williams1980}

    A.\,Williams (2012) or E.\,Williams (1980)

\end{document}

得出的结果为:

威廉斯

\textcite{williams2012}空间比 大A.\,Williams (2012)。如何让\textcite产生一半的空间?

答案1

\renewrobustcmd*{\bibnamedelimi}{\addnbthinspace}

这是一个有希望的开始,但由于如果名字是首字母缩写biblatex,则不会自动\bibnamedelimi在名字后使用,因此我们必须自己这样做。因为biblatex-apa这归结为

\newbibmacro*{name:giveni-family}[4]{%
  \usebibmacro{name:delim}{#2#3#1}%
  \usebibmacro{name:hook}{#2#3#1}%
  \ifdefvoid{#2}{}{\mkbibnamegiven{#2}\isdot\bibnamedelimi}%
  \ifdefvoid{#3}{}{%
    \mkbibnameprefix{#3}\isdot
    \ifprefchar
      {}
      {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
  \mkbibnamefamily{#1}\isdot
  \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}

\renewbibmacro*{labelname:doname}[8]{%
  \ifboolexpr{test {\ifnumcomp{\value{listcount}}{>}{1}}
              or
              test {\ifuniqueprimaryauthor}}
    {\setcounter{uniquename}{0}}
    {}%
  \ifcase\value{uniquename}%
    \ifuseprefix
      {\usebibmacro{name:family}{#1}{#3}{#5}{\relax}}
      {\usebibmacro{name:family}{#1}{#3}{\relax}{\relax}}%
  \or
     \ifuseprefix
       {\usebibmacro{name:giveni-family}{#1}{#4}{#5}{\relax}}
       {\usebibmacro{name:giveni-family}{#1}{#4}{\relax}{\relax}}%
  \or
     \ifuseprefix
       {\usebibmacro{name:given-family}{#1}{#3}{#5}{\relax}}
       {\usebibmacro{name:given-family}{#1}{#3}{\relax}{\relax}}%
  \fi
  \usebibmacro{name:andothers}}

我们定义了一个新名称宏,它是的name:giveni-family副本,但它不是在给定名称后打印,而是打印。当我们在 的 1 分支中重新定义以调用而不是时,我们使用了这个宏。biblatex.defname:given-family\bibnamedelimd\bibnamedelimiapa.cbxlabelname:donamename:giveni-familyname:given-family\ifcase\value{uniquename}%

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{williams1980,
    title = {Predication},
    volume = {11},
    timestamp = {2017-06-05T20:27:26Z},
    eprinttype = {jstor},
    eprint = {4178153},
    number = {1},
    journaltitle = {Linguistic inquiry},
    author = {Williams, Edwin},
    date = {1980},
    pages = {203--238}
}
@inproceedings{williams2012,
    title = {Null Complement Anaphors as Definite Descriptions},
    volume = {22},
    url =     {http://journals.linguisticsociety.org/proceedings/index.php/SALT/article/view/2646},
    timestamp = {2017-06-05T20:27:31Z},
    booktitle = {Semantics and {{Linguistic Theory}}},
    author = {Williams, Alexander},
    urldate = {2016-02-01},
    date = {2012},
    pages = {125--145}
}
\end{filecontents}

\usepackage[style=apa]{biblatex}
    \usepackage[utf8]{inputenc}
    \usepackage{csquotes}
    \usepackage[american]{babel}
    \DeclareLanguageMapping{american}{american-apa}
    \addbibresource{\jobname.bib}

\renewrobustcmd*{\bibnamedelimi}{\addnbthinspace}

\newbibmacro*{name:giveni-family}[4]{%
  \usebibmacro{name:delim}{#2#3#1}%
  \usebibmacro{name:hook}{#2#3#1}%
  \ifdefvoid{#2}{}{\mkbibnamegiven{#2}\isdot\bibnamedelimi}%
  \ifdefvoid{#3}{}{%
    \mkbibnameprefix{#3}\isdot
    \ifprefchar
      {}
      {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
  \mkbibnamefamily{#1}\isdot
  \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}

\renewbibmacro*{labelname:doname}[8]{%
  \ifboolexpr{test {\ifnumcomp{\value{listcount}}{>}{1}}
              or
              test {\ifuniqueprimaryauthor}}
    {\setcounter{uniquename}{0}}
    {}%
  \ifcase\value{uniquename}%
    \ifuseprefix
      {\usebibmacro{name:family}{#1}{#3}{#5}{\relax}}
      {\usebibmacro{name:family}{#1}{#3}{\relax}{\relax}}%
  \or
     \ifuseprefix
       {\usebibmacro{name:giveni-family}{#1}{#4}{#5}{\relax}}
       {\usebibmacro{name:giveni-family}{#1}{#4}{\relax}{\relax}}%
  \or
     \ifuseprefix
       {\usebibmacro{name:given-family}{#1}{#3}{#5}{\relax}}
       {\usebibmacro{name:given-family}{#1}{#3}{\relax}{\relax}}%
  \fi
  \usebibmacro{name:andothers}}

\begin{document}
  \textcite{williams2012} or \textcite{williams1980}

  A.\,Williams (2012) or E.\,Williams (1980)
\end{document}

示例输出

相关内容