可以从 biblatex 扩展作者姓名吗?

可以从 biblatex 扩展作者姓名吗?

知道\printnames命令biblatex是不可扩展的,因为它受到保护,而且我否则无法做很多事情;我考虑过用不受保护的命令biblatex.sty进行重建\printnames——希望能够得到一个可扩展的版本。

请注意,虽然\printfield{FIELD}不可扩展,\thefield{FIELD}但是(它只是调用以下类型的命令\abx@field@FIELD) - 所以我对“普通”字段没有太多问题。但是,对于名称,需要声明名称格式,然后需要遍历列表(最终使用\abx@name@FIELD),因此比较复杂。

这是我取得的进展的 MWE - 仍然不起作用:

\documentclass{article}

  \usepackage{trace}

  \usepackage{filecontents}
  \begin{filecontents}{\jobname.bib}
  @misc{num01,
      title = {Title1},
      author = {Author1 Authorsen1 and Author1a Authorsen1a},
      howpublished = {12-23-2001},
      eprint = {MR001},
      eprinttype = {mrnumber}}
  @misc{num02,
      title = {Title},
      author = {Author2},
      howpublished = {12-23-2002},
      eprint = {002},
      eprinttype = {mrnumber}}
  @misc{num03,
      title = {Title XX3},
      author = {Author2 Authorsen2 and Author2a Authorsen2a},
      howpublished = {12-23-2003},
      eprint = {MR003 (aa)},
      eprinttype = {mrnumber}}
  @misc{num04,
      title = {Title},
      author = {Author4},
      howpublished = {12-23-2004},
      eprint = {004 (bb)},
      eprinttype = {mrnumber}}
  \end{filecontents}

  \usepackage[bibstyle=numeric,citestyle=numeric]{biblatex}
  \ExecuteBibliographyOptions{%
  abbreviate=false,%
  uniquename=allfull,%
  maxnames=99,%
  minnames=99,%
  backend=biber,%
  }
  \addbibresource{\jobname.bib}

  \DeclareNameFormat{testauthors}{% now only this works
  \iffirstinits
    {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
    {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}%
  \usebibmacro{name:andothers}
  }%

  % copy of printnames:
  \makeatletter
  \def\getAuthsX{
  %   \let\@tempc\relax % no effect
    %
    \blx@getformat\blx@theformat{nfd}{testauthors}{author} %
    \blx@begunit
    \blx@namesetup{1}{99}{author}% {#2}{#3}{#4} - start, stop, 'namelist'
    \expandafter\blx@nameparser\blx@thedata{}&%
    \blx@endunit
  }
  \def\getAuths{\blx@listargs\getAuthsX}
  \makeatother

  % just a test for usual field: 
  \DeclareFieldFormat{myentrykey}{%
    Testing #1 %
  }

  \newbibmacro*{myentrycite}{% custom
  \printfield[myentrykey]{entrykey}
  } % end \newbibmacro*{

  \DeclareCiteCommand{\myentrycite}
    {\usebibmacro{prenote}}
    {\usebibmacro{citeindex}%
     \printtext{\usebibmacro{myentrycite}}}
    {}
    {\usebibmacro{postnote}}


\begin{document}

  \myentrycite{num03}

  \getAuths

\end{document}

我最终想使用类似\edef\mytemp{\getAuths}; 的东西,但现在,我只是在测试它是否可以在排版环境中工作。使用以下方法构建:

pdflatex test.tex
biber test
pdflatex test.tex

...并且\getAuths函数在这里中断:

! Missing \endcsname inserted.
<to be read again> 
                   \@tempc 
\KV@split ...efix \@tempa \endcsname \ifx \@tempc 
                                                  \relax \KV@errx {\@tempa \...

\KV@do ...lax #1\empty \else \KV@split #1==\relax 
                                                  \expandafter \KV@do \fi 
\setkeys ...{KV@#1@}\let \@tempc \relax \KV@do #2,
                                                  \relax ,
\blx@nameparser@i ...{\setkeys {blx@opt@name}{#1}}
                                                  \blx@theformat 
<argument> ...rt \else \blx@nameparser@i \ifblank 
                                                  \fi \advance \c@listcount ...

\@secondoftwo #1#2->#2

\getAuthsX ...dafter \blx@nameparser \blx@thedata 
                                                  {}&\blx@endunit 
\reserved@c ->\getAuthsX 
                         {}{}{}
<to be read again> 
                   \par 

据我所知,它抱怨\@tempc- 但即使我\let\@tempc\relax在运行前明确设置也无济于事(更不用说,如果我正确读取了堆栈跟踪,它应该已经设置\relax\setkeys

如果坚持要求ENTER运行完成,PDF 中的输出\getAuths如下:

,1 and ∆ ’ ¿ and ’ ¿

.... 这(似乎)意味着作者姓名循环已经运行 - 但显然,没有检索到正确的数据。

有人能确认这是否可以做到吗?如果可以,请解释一下我缺少什么才能使它发挥作用?

是不是\let不可扩展?但是在这个例子中这有什么关系呢,因为我还没有调用\edef?!


编辑:

好的,第一个问题是我的疏忽 - 调用类似的内容\thefield{FIELD}意味着有一个“当前”的 bib 项目正在被处理 - 并且\getAuths从文档主体调用并没有设置任何特定的 bib 项目。

因此,解决这个问题的方法是简单地\getAuths从选择特定书目条目的命令中调用,例如\myentrycite{num03}我知道我把所有代码都放在那里是有原因的:))。

因此,对上述示例进行以下更改:

  ....
  \DeclareFieldFormat{myentrykey}{%
    Testing #1 \getAuthsX  %
    \edef\tmpa{\getAuthsX}
  }
  ...
\begin{document}

  \myentrycite{num03}

\end{document}

num03...人们可以看到PDF 文档中排版的条目作者姓名,这是最初的意图(也可以直接\getAuthsX使用)。

但是,我仍然无法获得扩展(如无法\edef\tmpa{\getAuthsX}工作),因此我很感激任何指点......

答案1

可扩展宏可从未格式化的书目数据中定义。该\savename命令只是将未格式化的名称列表复制到宏中。这些数据也可以通过使用\DeclareNameFormat或定义的格式化指令来访问\DeclareIndexNameFormat

\DeclareIndexNameFormat旨在将数据写入索引,但我们可以使用它从列表中的每个名称中获取数据。在其生成的指令中,biber-only 名称分隔符(例如\bibinitperiod)扩展为纯文本。这很有用,因为biblatex标点符号命令仅在引用或参考书目命令中定义。

以下文档演示了一个格式指令getname,该指令将名字 ( #3)(或选项设置#4下的首字母 ( ))firstinits=true、姓氏前缀 ( #5) 和姓氏 ( #1) 附加到可扩展宏\name。该指令由引用命令执行\getauthor

\documentclass{article}
\usepackage[american]{babel}
\usepackage[backend=biber,firstinits]{biblatex}

\newcommand*{\name}{}
\DeclareIndexNameFormat{getname}{%
  \def\addcomma{,}
  \def\space{ }
  \ifnumgreater{\value{listcount}}{\value{liststart}}
    {\ifnumless{\value{listcount}}{\value{liststop}}
       {\xappto{\name}{\addcomma\space}}
       {\ifnumgreater{\value{liststop}}{2}
          {\xappto{\name}{\finalandcomma}}
          {}%
        \xappto{\name}{\space\bibxstring{and}\space}}}
    {}%
  \ifblank{#4}   % See update below
    {}
    {\iffirstinits
       {\xappto{\name}{#4\space}}
       {\xappto{\name}{#3\space}}}%
  \ifblank{#5}
    {\xappto{\name}{#1}}
    {\xappto{\name}{#5\space#1}}}

\DeclareCiteCommand{\getauthor}
  {\undef\name
   \boolfalse{citetracker}%
   \boolfalse{pagetracker}}
  {\ifnameundef{author}
     {}
     {\ifboolexpr{ test {\ifnumgreater{\value{citecount}}{1}}
                   and not test {\ifundef{\name}} }
        {\gappto{\name}{; }}
        {}%
      \indexnames[getname][1-99]{author}}}
  {}
  {}

\addbibresource{biblatex-examples.bib}
\begin{document}
\getauthor{knuth:ct,vangennep}
\edef\temp{Some text \name}
\subsubsection*{\temp}
\getauthor{companion,aristotle:anima,ctan}
\subsubsection*{\MakeUppercase{\name}}
\textcite{cms,companion,aristotle:anima,ctan}
\end{document}

更新自原始答案以来,语法\DeclareIndexNameFormat已发生变化:不再将参数 #1 至 #8 存储在全名中,而是将其存储在 #1 中,并可以通过不同的\namepart宏进行访问。上述代码受影响的部分经过以下更改后仍可正常工作:

\nameparts{#1}
\ifblank{\namepartgiveni}
  {}
  {\iffirstinits
     {\xappto{\name}{\namepartgiveni\space}}
     {\xappto{\name}{\namepartgiven\space}}}%
\ifblank{\namepartprefix}
  {\xappto{\name}{\namepartfamily}}
  {\xappto{\name}{\namepartprefix\space\namepartfamily}}}

答案2

好吧,我真是发抖!完成这件事太痛苦了!!

@Audrey 一小时前就已经回答了,不过与此同时我也找到了解决方案,所以我只想在这里记录下来……

首先 - 对我来说最重要的部分 - 这里是(不是)MWE 的终端输出,发布在最后:

(./test.aux) (./test.bbl)
taA__Authorsen1__A.\spacefactor \blx@sf@dot ______
taB__Authorsen1__Author1______
ta --Author1 Authorsen1==
taA__Authorsen1a__A.\spacefactor \blx@sf@dot ______
taB__Authorsen1a__Author1a______
ta -- and Author1a Authorsen1a.==

= currentauthors =
==Author1 Authorsen1 and Author1a Authorsen1a.==

taA__Authorson2__A.\spacefactor \blx@sf@dot ______
taB__Authorson2__Author2______
ta --Author2 Authorson2.==

= currentauthors =
==Author2 Authorson2.==

taA__Authorsen3__A.\spacefactor \blx@sf@dot ______
taB__Authorsen3__Author3______
ta --Author3 Authorsen3==
taA__Authorsen3A__A.\spacefactor \blx@sf@dot ______
taB__Authorsen3A__Author3A______
ta --, Author3A Authorsen3A==
taA__Authorsen3B__A.\spacefactor \blx@sf@dot ______
taB__Authorsen3B__Author3B______
ta --, and Author3B Authorsen3B.==

= currentauthors =
==Author3 Authorsen3, Author3A Authorsen3A, and Author3B Authorsen3B.==


Underfull \hbox (badness 10000) in paragraph at lines 407--408

名称似乎被正确扩展为“纯文本”;但是,该示例还表明这种方法仍然可以与通常的biblatex排版共存:

测试.png

可扩展过程的主要目的只是提供文本字符;然而在 MWE 中,它也排版(虽然不成功)只是作为一个例子 - 否则,只需要注释一个命令来抑制排版输出,参见代码

讨论

趁我还记得,就说几句话……基本上,一切都在原地打转,看着无尽的traceon输出,直到人们意识到这是\DeclareNameFormat可以拥有这些名称的主要部分;然后我偶然尝试将一个包装\edef在它的内部宏上:

%   \DeclareNameFormat{testauthors}{% now only this works
%   \typeout{ta==#1==#4==#5==#7==}
%   \typeout{ta==#1==#3==#5==#7==}
%   \edef\tmpa{
%   \iffirstinits
%     {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
%     {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}%
%   \usebibmacro{name:andothers}
%   }
%   \typeout{ta--\tmpa==}
%   \tmpa
%   }%

\usebibmacro...虽然失败了 - 但是它也引发了将s 单独包装的想法\edef(这是当前解决方案的基础):

%   \DeclareNameFormat{testauthors}{% now only this works
%   \typeout{ta==#1==#4==#5==#7==}
%   \typeout{ta==#1==#3==#5==#7==}
%   
%   \iffirstinits
%     {\edef\tmpa{\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}}
%     {\edef\tmpa{\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}%
%   \usebibmacro{name:andothers}
%   
%   \typeout{ta--\tmpa==}
%   \tmpa
%   }%

这也不太管用 - 但至少它开始显示哪些命令是不可扩展的;所以我可以在 .tex 文件中将它们重新定义为不受保护的命令。因此,经过漫长的traceing 过程,我开始将现有函数复制到biblatex.sty我的.tex文件中。这部分同样不简单 - 因为并非所有函数都可以在 中找到逐字定义;然后可以在 .tex 文档本身中biblatex.sty使用- 或(\showtexdef通常,当某个定义未通过一种方法显示时,它将通过另外两种方法之一显示)。

然后,我们应该记住,受保护的biblatex命令(例如\usebibmacro{name:first-last})在\abx@macro@name:delim我仍然不知道如何找出正确的关系,除了查看日志和源文件:)) 但是内部命令也可以受到保护 - 如果没有,可以使用受保护的宏;因此需要一段时间来识别所需的“最小”一组“被黑”定义。

另一件需要记住的事情\DeclareNamesFormat每一个人的名字在引用中;因此,不能期望一次性“拉出”完整的“姓名列表” - 在下面的 MWE 中,有一个“全局”的“变量”(\currentauthors),用于连接每次传递中生成的内容 - 并且应该包含完整的作者姓名列表作为扩展文本,一旦自定义引用过程完成。

另外,我应该指出,只要有可能,我就会尝试删除诸如此类的排版命令\unhbox,因为它们通常也是不可扩展的;似乎有一些biblatex基于不同跳过的标点符号计算 - 但删除它们似乎对扩展名称列表没有太大影响。

当我得到这个日志输出时我到达了一个关键点:

taA==Authorsen2==A.======
taB==Authorsen2==Author2======
ta --Author2 Authorsen2 ==
taA==Authorsen2a==A.======
taB==Authorsen2a==Author2a======
ta --\ifboolexpr {test {0}ortest 0}{, }{ and }Author2a Authorsen2a ==

... 这意味着我需要的几乎所有东西都已扩展 - 除了\ifboolexpr。首先我想到使用boolexpr包,但这与 etoolbox/biblatex 冲突...然后事实证明也有一个可扩展的\ifboolexpe-etoolbox一旦替换它,我实际上就可以删除一些多余的重新定义。

一旦整个过程开始生成合适的名称(用于组成名称列表的规则biblatex似乎被保留,对于扩展的文本输出也是如此),就会出现另一个问题:由于我基本上重新定义了“核心”宏biblatex,现在我可以有一个可扩展的自定义引用 - 但“通常”不可扩展的自定义引用将不再起作用!

通过向所有重新定义的宏名称添加前缀来解决该问题EX,以帮助将它们与默认宏名称区分开来 - 并且这似乎允许混合使用多种方法,既允许通过biblatex;通常排版作者姓名,也允许对其进行扩展。

好吧,我想这就是我能记住的全部了:),但是,代码中有很多注释 - 所以希望它能对某些人有所帮助。

MWE 代码

(使用pdflatex test.tex; biber test;构建pdflatex test.tex

\documentclass{book}

  \usepackage{trace}

  \usepackage{filecontents}
  \begin{filecontents}{\jobname.bib}
  @misc{num01,
      title = {Title1},
      author = {Author1 Authorsen1 and Author1a Authorsen1a},
      howpublished = {12-23-2001},
      eprint = {MR001},
      eprinttype = {mrnumber}}
  @misc{num02,
      title = {Title},
      author = {Author2 Authorson2},
      howpublished = {12-23-2002},
      eprint = {002},
      eprinttype = {mrnumber}}
  @misc{num03,
      title = {Title XX3},
      author = {Author3 Authorsen3 and Author3A Authorsen3A and Author3B Authorsen3B},
      howpublished = {12-23-2003},
      eprint = {MR003 (aa)},
      eprinttype = {mrnumber}}
  @misc{num04,
      title = {Title},
      author = {Author4},
      howpublished = {12-23-2004},
      eprint = {004 (bb)},
      eprinttype = {mrnumber}}
  \end{filecontents}

  \usepackage[bibstyle=numeric,citestyle=numeric]{biblatex}
  \ExecuteBibliographyOptions{%
    abbreviate=false,%
    uniquename=allfull,%
    maxnames=99,%
    minnames=99,%
    backend=biber,%
  }
  \addbibresource{\jobname.bib}

  %\usepackage{boolexpr} %tlmgr install boolexpr ; expandable? yes, but:
  % overwrites the \ifboolexpr by etoolbox (loaded by biblatex),
  % and then everything breaks.. so cannot use


  \makeatletter


  % must keep, else appears as unexpanded in output
  % was \protected ; used \isdot
  %
  % (biid): dot in mathmode;
  %         \mathchardef\blx@sf@dot=1002;
  %         1002 abbreviation period (dot)
  %         typesetting related ?! don't use, it doesn't expand
  %         doesn't run in this example (we don't typeset anymore)?
  %         but it can kick in, if \abx@dot gets added here after fi
  %
  \def\EXblx@imc@isdot{%
  \ifnum\blx@spacefactor=\blx@sf@period
    %\spacefactor%                    (rtc)
    \blx@sf@dot %                     (biid)
  \fi
  }

  % must keep, to remove unexpanded typesettin cmds
  %
  \def\EXabx@dot{%
  \ifdim\lastkern>\z@\unkern\fi
  .%
  %\spacefactor%                      (rtc)
  %\blx@sf@dot%                       (rtc)
  }%

  % must keep, to remove unexpanded \unspace
  %
  \def\EXblx@addpunct#1{%
  %\unspace%                          (rtc)
  \ifnum\blx@spacefactor<\blx@sf@threshold@low
    \csuse{blx@qp@#1}\csuse{abx@#1}%
  \else
    \ifnum\blx@spacefactor>\blx@sf@threshold@high
      \csuse{blx@qp@#1}\csuse{abx@#1}%
    \else
      \ifcsdef{blx@pp@\the\csname blx@sf@#1\endcsname} %
        {\csuse{blx@qp@#1}\csuse{abx@#1}}
        {\csuse{blx@qp@#1}}%
    \fi
  \fi
  \csuse{blx@pq@#1}}

  % must keep, else appears as unexpanded in output
  % was \protected ; used \adddot
  %
  \def\EXblx@imc@adddot{%
  \EXblx@addpunct{dot}%
  \ifnum\blx@spacefactor=\blx@sf@period
    %\spacefactor%                    (rtc)
    %\blx@sf@dot%                     (rtc)
  \fi}

  % must keep, else "! Undefined control sequence."
  % was \protected ; used \addcomma
  %
  \def\blx@imc@addcomma{%
    \EXblx@addpunct{comma}}

  % was \newrobustcmd* ; used \adddot
  %
  \def\bibinitperiod{\EXblx@imc@adddot} %  ;

  % must keep, else appears as unexpanded in output
  % was \protected
  %
  \def\EXblx@imc@resetpunctfont{%
  \blx@ifpuncthook
    {\global\let\abx@puncthook\@firstofone}
    {}}

  % (rtc) removed typesetting cmd

  % must keep, else appears as unexpanded in output
  % was \newrobustcmd
  %
  \def\EXaddlowpenspace{%
  %\unspace%                          (rtc)
  \blx@postpunct%
  %\penalty\value{lownamepenalty}%    (rtc)
  \space%
  \EXblx@imc@resetpunctfont}

  % must keep, else appears as unexpanded in output
  % was \newrobustcmd
  %
  \def\EXbibnamedelimd{\EXaddlowpenspace} %

  % must keep, else appears as unexpanded in output
  %  was \protected
  %
  \def\EXaddspace{%
  %\unspace%    %                     (rtc)
  \blx@postpunct%
  \space%
  \EXblx@imc@resetpunctfont%
  }

  % leaving \def\finalnamedelim out would cause trouble;
  %  even if by default it if not protected..
  %  that is because here, we want to avoid use of
  %  protected \bibstring => instead, \blx@imc@bibxstring
  %
  \def\EXfinalnamedelim{% not protected - for ref..
  \ifnumgreater{\value{liststop}}{2}%
  {\finalandcomma}%
  {}%
  \EXaddspace%
  \blx@imc@bibxstring{and}%\bibstring{and}%
  \space%
  }

  \def\EXlbx@finalnamedelim#1{%
    \EXfinalnamedelim%
  }


  % redef without long -- now namebreak no complain:
  %
  % if this \def for namebreak is commented,
  % then starting to get in console:
  % "### semi simple group (level 3) entered at line 333 (\begingroup)"
  %
  % but must now re-define it along w/ nameparser, to allow
  % interface with normal work
  %
  \def\EXblx@namebreak#1&{}

  \def\EXblx@nameparser#1{%
    \ifblank{#1}
      {\EXblx@namebreak\relax}
      {\ifnum\c@listcount<\c@liststart
       \else
         \EXblx@nameparser@i#1%
       \fi
       \advance\c@listcount\@ne
       \ifnum\c@listcount>\c@liststop
         \expandafter\EXblx@namebreak
       \fi
       \EXblx@nameparser}}

  \def\EXblx@nameparser@i#1{%
    \ifblank{#1}
      {}
      {\setkeys{blx@opt@name}{#1}}% this
    \blx@theformat}

  % also had previously redefined here:
  %   \DeclareRobustCommand{\KV@prefix}{}
  %   \def\blx@namesetup@i#1{%
  %   \def\blx@namesetup@ii#1#2{%
  %   \def\blx@namecodes{%
  %   \def\blx@namesetup#1#2#3{%

  % originally, here \ifboolexpr was used;
  %  when used in expandable context; \ifboolexpr will fail with
  %  "! Argument of \@secondoftwo has an extra }" - UNLESS
  %  default paths (like {True}{False} for \ifnumless;
  %  and \ifmorenames must have one char only, {1}{0}) are added!
  %  only then, not getting the \@secondoftwo problem!
  % BUT: \ifboolexpr robust = \ifboolexpe expandable
  % if using \ifboolexpe - then should NOT have the added T/F branches!
  %
  \expandafter\def\csname EXabx@macro@name:delim\endcsname#1{%
    \ifnumgreater{\value{listcount}}{\value{liststart}}%
    {\ifboolexpe{%
        test {\ifnumless{\value{listcount}}{\value{liststop}}}%
        or%
        test {\ifmorenames}%% \blx@imc@ifmorenames
      }%
      {\multinamedelim}{\EXlbx@finalnamedelim{#1}}%
    }%
    {}%
    %\show\bibstring%\typeout{==name:delim==#1==}% bibstring=\protected macro:
  }


  % (nfl1): MUST have comment after cmd here; else a spurious space
  %         appears at end of last name! also removed \blx@imc@isdot (typeset)
  % (nfl2): added: hack to "hardcode" a dot after all of the names are done
  % (nfl3): \ifmorenames -> \blx@imc@ifmorenames
  %
  \expandafter\def\csname EXabx@macro@name:first-last\endcsname#1#2#3#4{%
    \csname EXabx@macro@name:delim\endcsname{#2#3#1}%
    \csname abx@macro@name:hook\endcsname{#2#3#1}%
    \ifblank{#2}%
    {}%
    {\mkbibnamefirst{#2}\EXblx@imc@isdot\EXbibnamedelimd}%
    \ifblank{#3}%
    {}%
    {\mkbibnameprefix{#3}\EXblx@imc@isdot%
      \ifpunctmark{'}{}{%
        \ifuseprefix{\bibnamedelimc}{\EXbibnamedelimd}}%
    }%
    \mkbibnamelast{#1}\EXblx@imc@isdot%
    \ifblank{#4}{}%
    {\EXbibnamedelimd\mkbibnameaffix{#4}}%  (nfl1)
    \ifboolexpe{%                         (nfl2)
        test {\ifnumless{\value{listcount}}{\value{liststop}}}%
        or%
        test {\ifmorenames}%              (nfl3)
      }%
      {}{\EXabx@dot}%
  }


  % (dnf1): expanding name:andothers is currently a problem;
  %          fails w/ "! Argument of \@secondoftwo has an extra }."
  %          but, 'and' in names gets added automatically - without name:andothers;
  %          name:andothers just if we want it shortened ("and others").
  %          and I don't need that currently..
  % (dnf2): perform concatenation here;
  % (dnf3): this "return" output of \tmpa also typesets;
  %          comment it out if typeset not desired
  %
  \DeclareNameFormat{testauthors}{%
    \typeout{taA__#1__#4__#5__#7__}
    \typeout{taB__#1__#3__#5__#7__}
    %\traceon
    \iffirstinits%
      {\edef\tmpa{\csname EXabx@macro@name:first-last\endcsname{#1}{#4}{#5}{#7}}}%
      {\edef\tmpa{\csname EXabx@macro@name:first-last\endcsname{#1}{#3}{#5}{#7}}}%
    %\edef\tmpb{\csname abx@macro@name:andothers\endcsname } % (dnf1)
    \csname abx@macro@name:andothers\endcsname

    \typeout{ta --\tmpa==}
    \global\edef\currentauthors{\currentauthors\tmpa} % (dnf2)
    \tmpa %                                             (dnf3)
  }%


  %\blx@namesetup: {#2}{#3}{#4} - start, stop, 'namelist';
  %            eg. {1}{99}{author} - but can do without
  %
  \def\getAuthsX{%
    \blx@getformat\blx@theformat{nfd}{testauthors}{author}%
    \blx@namesetup{}{}{author}%
    \expandafter\EXblx@nameparser\blx@thedata{}&%
  }

  \makeatother


  \def\getAuths{%
    \getAuthsX%
  }

  \newbibmacro*{myentrycite}{% custom
    \global\def\currentauthors{} % init empty string for concat
    \getAuths
  }

  \DeclareCiteCommand{\myentrycite}
    {}
    {\usebibmacro{myentrycite}}
    {}
    {}

  %%%%%%%%%%%%

  \DeclareNameFormat{normauthors}{%
  \iffirstinits
    {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
    {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}%
  \usebibmacro{name:andothers}
  }%

  \newbibmacro*{normentrycite}{% custom
    \printnames[normauthors]{author}%
  }

  \DeclareCiteCommand{\normentrycite}
    {}
    {\usebibmacro{normentrycite}}
    {}
    {}


\begin{document}

  %\traceon

  \textit{Author names output of expandable cite commands:}

  % adding new cites will require a new biber run!
  \myentrycite{num01}
  \typeout{^^J= currentauthors =^^J==\currentauthors==^^J}

  \myentrycite{num02}
  \typeout{^^J= currentauthors =^^J==\currentauthors==^^J}

  \myentrycite{num03}
  \typeout{^^J= currentauthors =^^J==\currentauthors==^^J}

  \bigskip

  \textit{Author names output of usual cite command:} \\

  % will give "Runaway argument?" if all
  % defaults are reprogrammed; and not
  % handled with separate names!
  \normentrycite{num03}

\end{document}

相关内容