如果字母樣式標籤沒有作者或編輯者,請使用組織

如果字母樣式標籤沒有作者或編輯者,請使用組織

在 biblatex 中產生樣式的引文標籤時,如何使用出版物中的組織來替代作者或編輯alphabetic

我知道我可以使用該label欄位手動分配標籤,但自動解決方案會很好。

微量元素:

\documentclass{article}

\usepackage{filecontents}

\usepackage[style=alphabetic,backend=biber]{biblatex}
\bibliography{test}

\begin{filecontents}{test.bib}
@online{Wikipedia2017,
 date = {2016-12-20},
 organization = {Wikipedia},
 title = {Resource contention},
 url = {https://en.wikipedia.org/w/index.php?oldid=755891262},
 urldate = {2017-04-26}
}
@techreport{Volpe2000,
 author = {Volpe, Richard and Nesnas, Issa A. D. and Estlin, Tara and Mutz, Darren and Petras, Richard and Das, Hari},
 date = {2000},
 institution = {Jet Propulsion Laboratory, California Institute of Technology},
 location = {Pasadena, California},
 title = {{CLARAty}: Coupled Layer Architecture for Robotic Autonomy}
}
\end{filecontents}

\begin{document}
This is a test~\autocite{Wikipedia2017}. And this works as expected~\autocite{Volpe2000}.

\printbibliography{}
\end{document}

在此輸入影像描述

我想看看類似的標籤Wik16

答案1

嘗試

\DeclareSourcemap{
  \maps[datatype=bibtex]{
     \map{
       \step[fieldsource=organization, final]
       \step[fieldset=usera, origfieldval]
     }
  }
}

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{label}
    \field[strwidth=3,strside=left,ifnames=1]{labelname}
    \field[strwidth=1,strside=left]{labelname}
    \field[strwidth=3]{usera}
  }
  \labelelement{
    \field[strwidth=2,strside=right]{year}    
  }
}

由於organization是一個列表\DeclareLabelalphaTemplate無法正確處理它。因此,我們必須將內容複製到不是清單的欄位(usera因此我們不需要定義新的資料模型)。然後我們就可以在\labelelementof中使用它了\DeclareLabelalphaTemplate

相關內容