\DeclareFieldFormat 命令不适用于 phdthesis?

\DeclareFieldFormat 命令不适用于 phdthesis?

我想修改文章和博士论文参考文献条目中标题字段的格式。奇怪的是,修改仅适用于文章,而不适用于博士论文。请参阅 MWE:

\documentclass{article}

\usepackage[%
        backend=biber,
        style=authoryear,
        %citestyle=authoryear,
        labelnumber=true,
        doi=true,
        url=true
        ]{biblatex}

        \makeatletter
        \input{numeric.bbx}
        \makeatother

        \DeclareFieldFormat[article,phdthesis]{title}{\textit{#1}}
\usepackage{filecontents}

\begin{filecontents}{test.bib}
    @book{Foo,
        title={Book title1 whatever whatever whatever and tuff tuff
        and gong gong},
        author={Author1, AB and Author2, CD and Author3, EF},
        year= {Year1},
    }
    @book{Bar,
        title={Book title2},
        author={Author2, AB},
        year= {Year2},
    }
    @phdthesis{xyz,
        title={why declarefieldformat command doesn't apply to phdthesis},
        author={Author4, AB},
        year={2000},
    }
    @article{abc,
        author = {Author, New},
        year = {2014},
        title = {the format of article entry could be changed with D.},
        pages = {16--25},
        number = {9},
        journal = {Biblatex },
    }
\end{filecontents}

\addbibresource{test.bib}
\begin{document}

text\footcite{Foo}, and text\footcite{Bar}
text\footcite{xyz}, and text\footcite{abc}

%\nocite{*}

\printbibliography

\end{document}

我做错什么了吗?

答案1

类型phdthesis是类型的别名@thesis,因为biblatex使用@thesis作为字段的条目type来指定论文的类型。

但是别名指向实际类型,因此不能在命令中使用DeclareFieldFormat。因此请使用:

\DeclareFieldFormat[article,thesis]{title}{\mkbibemph{#1}}

此外,最好使用\emph\mkbibemph\textit因为它会进行斜体校正,并且还会\emph在标题中嵌入其他内容。(正如评论中所述,\mkbibemph其行为就像\emph使用一样\emph。)

相关内容