我不确定如何在参考书目中列出软件。似乎参考书目是在许可证尚未困扰任何人的时代制作的。;-) 我现在做的是:
@misc{ref2,
Author = {xceedsoftware},
Title = {wpftoolkit},
Note = {\url{https://github.com/xceedsoftware/wpftoolkit}},
Version = {Ms-PL}
},
但这实际上不符合我的需要,因为它将许可证列为版本 Ms-PL。我必须参考的软件包中处理许可证的正确方法是什么?
MWE解决方案:
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[sfdefault,light]{FiraSans}
\begin{filecontents}{license.dbx}
\DeclareDatamodelFields[type=field,datatype=literal]{license}
\DeclareDatamodelEntryfields[software]{license}
\end{filecontents}
\usepackage[backend=biber, style=numeric, defernumbers, datamodel=license]{biblatex}
\DeclareBibliographyCategory{skipbibliography}
\DeclareCiteCommand{\cite}[\mkbibfootnote]
{\usebibmacro{prenote}}
{\addtocategory{skipbibliography}{\thefield{entrykey}}%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\usepackage{csquotes}
\appto{\bibsetup}{\emergencystretch=1em}
\NewBibliographyString{license}
\DefineBibliographyStrings{english}{license = {license},}
\DefineBibliographyStrings{german}{license = {Lizenz},}
\DeclareFieldFormat{license}{\bibstring{license}\addcolon\space#1}
\renewbibmacro{addendum+pubstate}{%
\printfield{license}%
\newunit\newblock
\printfield{addendum}%
\newunit\newblock
\printfield{pubstate}}
\begin{filecontents}{\jobname.bib}
@software{wpf,
author = {{Xceed}},
title = {Extended WPF Toolkit},
url = {https://github.com/xceedsoftware/wpftoolkit},
license = {Ms-PL},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson,wpf}
\printbibliography
\end{document}
答案1
您的问题标有biblatex
,因此我强烈建议您使用专用url
字段而不是note
。
我不知道有任何样式具有显式license
字段,因此您可以使用不同的通用字段(note
适用于几乎所有样式,或类似biblatex
BibTeX;或addendum
或)titleaddon
biblatex
@software{wpf,
author = {{Xceed}},
title = {Extended WPF Toolkit},
url = {https://github.com/xceedsoftware/wpftoolkit},
note = {License: Ms-PL}
}
或者您可以使用的biblatex
动态数据模型来添加license
字段(请参阅将字段“tome”添加到 biblatex 条目),在这种情况下,您还需要找到一种方法将字段注入license
到参考书目中的合适位置(在下面的例子中,我们进行了修补,addendum+pubstate
因为那似乎是一个合适的地方,而且对于条目来说这样做相当简单@software
,其他地方的代码会更加密集)。
该解决方案与 bibstring 一起使用来打印“许可证”,因此您需要为打算使用的每种语言定义字符串,MWE 会为英语和德语显示该字符串。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{license.dbx}
\DeclareDatamodelFields[type=field,datatype=literal]{license}
\DeclareDatamodelEntryfields[software]{license}
\end{filecontents}
\usepackage[style=authoryear, backend=biber, datamodel=license]{biblatex}
\NewBibliographyString{license}
\DefineBibliographyStrings{english}{%
license = {license},
}
\DefineBibliographyStrings{german}{%
license = {Lizenz},
}
\DeclareFieldFormat{license}{\bibstring{license}\addcolon\space#1}
\renewbibmacro{addendum+pubstate}{%
\printfield{license}%
\newunit\newblock
\printfield{addendum}%
\newunit\newblock
\printfield{pubstate}}
\begin{filecontents}{\jobname.bib}
@software{wpf,
author = {{Xceed}},
title = {Extended WPF Toolkit},
url = {https://github.com/xceedsoftware/wpftoolkit},
license = {Ms-PL},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson,wpf}
\printbibliography
\end{document}