如何使用作者年份样式更改文内引用中名字和姓氏的顺序?

如何使用作者年份样式更改文内引用中名字和姓氏的顺序?

我正在尝试将 bibtex 转换为 biblatex + biber,并且很难实现使用 bibtex .bst 文件轻松实现的样式。基本上,我希望作者的名字和/或首字母出现在文内引用中的姓氏之后(例如 [Alexander G. and Williams D. 1968] 而不是 [G. Alexander and D. Williams 1968])。通过查看此论坛上的问题,我已设法在参考书目中实现此目的,如下所示:

在此处输入图片描述

然而,我在引用方面未能取得同样的成果。因此,非常感谢大家的帮助。

\documentclass[a4paper,11pt]{scrreprt}

\usepackage[english]{babel}
\usepackage[usenames,dvipsnames]{color}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[autostyle]{csquotes}
\usepackage{lmodern}
\usepackage[
    backend=biber,
    style=authoryear-comp,
    sortlocale=auto,
    maxbibnames=6,
    minbibnames=6,
    maxcitenames=2,
    mincitenames=1,
    firstinits=true
]{biblatex}

\DeclareNameAlias{last-first/first-last}{last-first}

\makeatletter
\newrobustcmd*{\parentexttrack}[1]{
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  \blx@bibopenparen#1\blx@bibcloseparen
  \endgroup}
\AtEveryCite{
  \let\parentext=\parentexttrack
  \let\bibopenparen=\bibopenbracket
  \let\bibcloseparen=\bibclosebracket}
\makeatother

\DeclareFieldFormat[article]{title}{`#1'}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

\renewbibmacro{in:}{\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
\renewbibmacro*{volume+number+eid}{\printfield{volume}\printfield{number}}

 \setlength\bibitemsep{1.5\itemsep} 

\begin{filecontents}{test.bib}
@article{alexanderg68,
   author = {Alexander, G and Williams, D.},
   title = {Shivering and non-shivering thermogenesis during summit metabolism in young lambs},
   journaltitle = {J Physiol},
   volume = {198},
   number = {2},
   pages = {251-276},
   year = {1968}
}
@article{alexanderr11,
   author = {Alexander, R. and Lodish, H. and Sun, L.},
   title = {MicroRNAs in adipogenesis and as therapeutic targets for obesity},
   journaltitle = {Expert Opin Ther Targets},
   volume = {15},
   number = {5},
   pages = {623-636},
   year = {2011}
}
@article{williamss99,
   author = {Williams, S. and Davie, G. and Lam, F.},
   title = {Predicting BMI in young adults from childhood data using two approaches to modelling adiposity rebound},
   journaltitle = {Int J Obes},
   volume = {23},
   number = {4},
   pages = {348-354},
   year = {1999}
}
\end{filecontents}

\addbibresource{test.bib}

\begin{document}
First authors~\parencite{alexanderg68}. Second authors~\parencite{alexanderr11}. Third authors~\parencite{williamss99}.
\printbibliography 
\end{document}

答案1

引用使用printnames{labelname}来打印作者姓名。然后您可以修改或声明formatlabelname最简单的方法是使用alias。这意味着:

\DeclareNameAlias{labelname}{last-first}

但上面的代码不支持该选项,uniquename因为last-first声明不支持。然后另一种形式是修改。我复制了文件中 DeclareNameFormat{labelname}的定义并更改了\DeclareNameFormat{labelname}biblatex.def first-last经过last-first

  \DeclareNameFormat{labelname}{%
    \ifcase\value{uniquename}%
      \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
    \or
      \ifuseprefix
        {\usebibmacro{name:last-first}{#1}{#4}{#5}{#8}}
        {\usebibmacro{name:last-first}{#1}{#4}{#6}{#8}}%
    \or
      \usebibmacro{name:last-first}{#1}{#3}{#5}{#7}%
    \fi
    \usebibmacro{name:andothers}}

相关内容