biblatex 在参考书目中打印“family=, familyi=”等

biblatex 在参考书目中打印“family=, familyi=”等

我的目标是使用 BiBLaTeX 和 numeric-comp 样式以及 family-given/given-family 方式对作者姓名进行排序,所有姓名均以粗体显示。这是我的 MWE:

\documentclass{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage[
backend=biber,
style=numeric-comp,
sorting=none,
]{biblatex}

\addbibresource{test.bib}

\DeclareNameAlias{sortname}{family-given/given-family-bold}
\DeclareNameFormat{family-given/given-family-bold}{\mkbibbold{%
        \ifnumequal{\value{listcount}}{1}
        {\ifgiveninits
            {\usebibmacro{name:family-given}
                {\namepartfamily}
                {\namepartgiveni}
                {\namepartprefix}
                {\namepartsuffix}}
            {\usebibmacro{name:family-given}
                {\namepartfamily}
                {\namepartgiven}
                {\namepartprefix}
                {\namepartsuffix}}%
            \ifboolexpe{%
                test {\ifdefvoid\namepartgiven}
                and
                test {\ifdefvoid\namepartprefix}}
            {}
            {\usebibmacro{name:revsdelim}}}
        {\ifgiveninits
            {\usebibmacro{name:given-family}
                {\namepartfamily}
                {\namepartgiveni}
                {\namepartprefix}
                {\namepartsuffix}}
            {\usebibmacro{name:given-family}
                {\namepartfamily}
                {\namepartgiven}
                {\namepartprefix}
                {\namepartsuffix}}}%
        \usebibmacro{name:andothers}}}

    \DeclareNameAlias{sortname}{given-family-bold}

    \DeclareNameAlias{author}{given-family-bold}
    \DeclareNameAlias{editor}{given-family-bold}
    \DeclareNameAlias{translator}{given-family-bold}

    \usepackage{filecontents}

    \begin{filecontents}{test.bib}
        @book{Doe86,
            author = {Doe, John},
            year = {1986},
            title = {some book},
        }
    \end{filecontents}


\begin{document}

I'm citing \cite{Doe86}

\printbibliography

\end{document}

奇怪的是,无论我编译多少次(latex 和 biber),它都会产生以下输出。我做错了什么?

在此处输入图片描述

答案1

对于当前版本,biblatex我会使用名称包装器将粗体应用于名称。如果您想要混合顺序family-given/given-family,您仍然需要重新定义名称格式(因为数字样式的默认顺序是given-family顺序)。

\documentclass{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage[
  backend=biber,
  style=numeric-comp,
  sorting=none,
]{biblatex}

\DeclareNameAlias{sortname}{family-given/given-family}

\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}

\DeclareNameWrapperFormat{sortname}{\mkbibbold{#1}}

\DeclareNameWrapperAlias{author}{sortname}
\DeclareNameWrapperAlias{editor}{sortname}
\DeclareNameWrapperAlias{translator}{sortname}

\addbibresource{biblatex-examples.bib}

\begin{document}
I'm citing \cite{sigfridsson,nussbaum}

\printbibliography
\end{document}

**Sigfridsson, Emma 和 Ulf Ryde**。“从电势和电势矩推导原子电荷的方法比较”。刊于:《计算化学杂志》19.4 (1998),第 377-395 页。doi:10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P。//**Nussbaum, Martha**。亚里士多德的《动物运动论》。普林斯顿:普林斯顿大学出版社,1978 年。(粗体文本标有双星号)


问题出在代码中,它定义了一种名称格式(family-given/given-family-bold),但是用过的一种不同的、不存在的格式(given-family-bold)。不存在的格式会导致您得到奇怪的输出。可以按如下方式重新编写(但我还是更喜欢上面的解决方案)。

\documentclass{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage[
  backend=biber,
  style=numeric-comp,
  sorting=none,
]{biblatex}


\DeclareNameFormat{family-given/given-family-bold}{%
  \mkbibbold{%
    \ifnumequal{\value{listcount}}{1}
      {\ifgiveninits
          {\usebibmacro{name:family-given}
              {\namepartfamily}
              {\namepartgiveni}
              {\namepartprefix}
              {\namepartsuffix}}
          {\usebibmacro{name:family-given}
              {\namepartfamily}
              {\namepartgiven}
              {\namepartprefix}
              {\namepartsuffix}}%
          \ifboolexpe{%
              test {\ifdefvoid\namepartgiven}
              and
              test {\ifdefvoid\namepartprefix}}
          {}
          {\usebibmacro{name:revsdelim}}}
      {\ifgiveninits
          {\usebibmacro{name:given-family}
              {\namepartfamily}
              {\namepartgiveni}
              {\namepartprefix}
              {\namepartsuffix}}
          {\usebibmacro{name:given-family}
              {\namepartfamily}
              {\namepartgiven}
              {\namepartprefix}
              {\namepartsuffix}}}%
    \usebibmacro{name:andothers}}}

\DeclareNameAlias{sortname}{family-given/given-family-bold}

\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}


\addbibresource{biblatex-examples.bib}

\begin{document}
I'm citing \cite{sigfridsson,nussbaum}

\printbibliography
\end{document}

输出是一样的。

相关内容