定义自定义 biblatex 引用样式并显示所有作者

定义自定义 biblatex 引用样式并显示所有作者

我正在尝试为我的文本定义自定义引用样式。MWE 如下

\documentclass{report}

\usepackage[backend=biber,sorting=none,style=phys, biblabel=brackets,pageranges=false,chaptertitle=false]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{xxx1.bib}
@article{key1,
  author = {Author, A. and Author, B. and Author, C.},
  title = {paper title},
  journal = {journal name},
  volume = {50}, 
  issue = {4},              
  pages = {15},
  year = {2019}
}
\end{filecontents}

\addbibresource{xxx1.bib}

\DeclareCiteCommand{\citelong}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {
   [%   
   \ifciteindex
     {\indexfield{indextitle}}
     {}%
     \printnames{author},
     \printfield[citetitle]{labeltitle},
     \textit{\printfield[citefield]{journaltitle}}
     \textbf{\printfield[citefield]{volume}},
     \iffieldundef{pages}{% NEW
       \printfield{number}%
     }{% NEW
       \printfield{pages}
     }
     (\printfield[citefield]{year})%
   ]%
  } 
  {\multicitedelim}
  {\usebibmacro{postnote}}

\begin{document}    
They went to the beach and met with a mermaid \citelong{key1}.    
\printbibliography    
\end{document}

上述代码生成 在此处输入图片描述 现在,与上面的不同,我希望显示所有作者,而不仅仅是第一个作者,后面跟着 et al。Biblatex 文档说 printnames 应该打印其所有参数,但我的代码没有。我知道我定义自定义引用格式的方式可能不是最好的,这是我通过查看 biblatex 手册自己能做到的。因此,如果您的修改不会过多地改变上述引用样式代码,我将不胜感激。

答案1

biblatex-phys样式biblatex使用以下选项加载:

maxnames=999, maxcitenames=2

maxcitenames因此,您只需要在加载时覆盖 的值即可biblatex。您只需使用maxnames同时设置maxcitenames和 的选项即可maxbibnames

\usepackage[sorting=none,style=phys, maxnames=999, biblabel=brackets, pageranges=false, chaptertitle=false]{biblatex}

要直接在宏中设置名称的数量\citelong,您可以使用\printnames[][-\value{listtotal}]{author}

我还整理了一下你的宏,以便标点符号更加强大。

\DeclareFieldFormat{citejournaltitle}{\mkbibemph{#1}}

\DeclareCiteCommand{\citelong}[\mkbibbrackets]
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexfield{indextitle}}
     {}%
   \printnames[][-\value{listtotal}]{author}%
   \newunit
   \printfield[citetitle]{labeltitle}%
   \newunit
   \printfield[citejournaltitle]{journaltitle}%
   \setunit*{\addspace}%
   \printfield{volume}%
   \newunit
   \iffieldundef{pages}
     {\printfield{number}}
     {\printfield{pages}}%
   \setunit{\addspace}%
   \printtext[parens]{\usebibmacro{date}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

相关内容