Debian Codegraph @

texmf-dist/doc/latex/biblatex-software/software-biblatex.tex

raw
1 \documentclass{ltxdockit}
2 \usepackage{a4wide}
3 \usepackage{hyperref}
4 \usepackage[T1]{fontenc}
5 \usepackage[utf8]{inputenc}
6 \usepackage{alltt}
7 \usepackage{listings}
8 \usepackage{shortvrb}
9 \MakeShortVerb{\|}
10
11 \titlepage{%
12 title={Bib\LaTeX\ style extension for Software},
13 subtitle={Citation and References macros for Bib\LaTeX},
14 url={https://www.ctan.org/tex-archive/macros/latex/contrib/biblatex-contrib/biblatex-software},
15 author={Roberto Di Cosmo},
16 email={[email protected]},
17 revision={1.2-8},
18 date={2025-12-26}}
19
20 \hypersetup{%
21 pdftitle={Bib\LaTeX\ style extension for Software},
22 pdfsubject={Style for Bib\LaTeX},
23 pdfauthor={Roberto Di Cosmo},
24 pdfkeywords={latex, biblatex, software, style}}
25
26 \begin{document}
27
28 \printtitlepage
29 \tableofcontents
30
31 \section{Introduction}\label{sec:intro}
32
33 \subsection{About}
34
35 Software plays a significant role in modern research, and it must be properly
36 acknowledged and referenced in scholarly works. To this end, specific
37 bibliographic entries for describing \emph{software}, \emph{software versions},
38 \emph{software modules} and \emph{code fragments} have been designed by a
39 dedicated task force at Inria in 2020 that brought together researchers from
40 Computer Science and Applied Mathematics to discuss best practices for archiving
41 and referencing software source code~\cite{2020GtCitation}.\\
42
43 This package is a Bib\LaTeX\ \emph{style extension} that adds support for these
44 four \emph{software entry types} to any other Bib\LaTeX\ style used in documents
45 typeset in \latex. It is made up of the following key components: a references
46 section style (\path{software.bbx}), a data model extension
47 (\path{software.dbx}) and string localisation files
48 (\path{<language>-software.lbx})\footnote{String localisations are provided for
49 some languages: localisations for other languages are welcome, feel free to
50 contribute them on the official repository, see Section \emph{Contributing} below.}.\\
51
52 The distribution contains other material, for demonstration purposes, and for
53 more advanced use.
54
55 \subsection{License}
56
57 Permission is granted to copy, distribute and/or modify this software under
58 the terms of the \latex Project Public License, version
59 1.3c\footnote{\url{http://www.latex-project.org/lppl.txt}}. The current
60 maintainer is Roberto Di Cosmo (\textcopyright\ 2020-2026).
61
62 \subsection{History}
63
64 When I decided to start the Software Heritage initiative in 2015, software in
65 general and research software in particular was not yet a first class citizen in
66 the scholarly world. The absence of support for properly citing software in a
67 bibliography was just one of the many signs of this lack of recognition.
68
69 In order to properly reference a software project, and ensure that these
70 references are stable enough to pass the test of time, it was necessary to build
71 a \emph{universal archive} for software source code, and to equip every software
72 artifact with \emph{intrinsic} identifiers.
73
74 Now that \href{https://www.softwareheritage.org}{Software Heritage} is providing
75 the universal archive~\cite{swhcacm2018}, with Software Heritage \emph{intrinsic
76 identifiers} (SWH-IDs) widely available~\cite{cise-2020-doi}, it is finally
77 possible to propose proper bibliographic entries for software, at various levels
78 of granularity, down to the line of code.
79
80 \subsection{Acknowledgments}
81
82 Thanks to the Inria working group members for their precious feedback and
83 contribution to the desing of the software bibliography entries: Pierre Alliez,
84 Benjamin Guedj, Alain Girault, Morane Gruenpeter, Mohand-Said Hacid, Arnaud
85 Legrand, Xavier Leroy, Nicolas Rougier and Manuel Serrano.
86
87 \section{Software entries}
88 \input{swentries}
89
90 \section{Use}\label{ref:use}
91 \label{use}
92
93 This package can be used as a standalone on the fly extension, or to produce
94 full bibliographic styles that extend pre-existing styles.
95
96 \subsection{Use as an \emph{on the fly} extension}
97
98 The simplest way to use this package is to follow the example given in the
99 \path{sample-use-sty.tex} that shows how one can \emph{extend on the fly} any
100 existing Bib\LaTeX\ style by just doing the following:
101
102 \begin{itemize}
103 \item pass the \texttt{datamodel=software} option to the \texttt{biblatex} package as in
104 \begin{ltxcode}
105 \usepackage[datamodel=software]{biblatex}
106 \end{ltxcode}
107 \item load the software biblatex style using
108 \begin{ltxcode}
109 \usepackage{software-biblatex}
110 \end{ltxcode}
111 \item set software specific bibliography options using the macro |\ExecuteBibliographyOptions|;
112 the options with their default values (all shown below) are as in
113 \begin{ltxcode}
114 \ExecuteBibliographyOptions{
115 halid=true,
116 swhid=true,
117 shortswhid=false,
118 swlabels=true,
119 vcs=true,
120 license=true,
121 addendum=true}
122 \end{ltxcode}
123 Note that all options default to |true| except |shortswhid| which defaults to |false|.
124 \end{itemize}
125
126 This is quite handy to add support for software entries in a single article, as
127 it is enough to add \path{software.dbx}, \path{software.bbx},
128 \path{<language>-software.lbx} and \path{software-biblatex.sty} to make it work.
129
130 \subsection{Generate extended styles}
131
132 When a more systematic use is foreseen, as for institution-wide reports, or
133 conference and journal proceedings, it is more appropriate to generate a new
134 biblatex style that includes support for the software entries right away.
135
136 The following simple mechanism is provided for this use case:
137
138 \begin{itemize}
139 \item add to the \path{stublist} file the names of all the existing styles that must be extended
140 \item run \texttt{make biblatex-styles} to produce new style files, with an added \texttt{+sw} suffix,
141 for each of the existing style
142 \item install the newly generated files in the standard path where Bib\LaTeX\ files are found
143 \end{itemize}
144
145 The stock \path{stublist} file contains the names of all the standard Bib\LaTeX\
146 styles. If this approach is followed, then one can load directly the extended
147 file, and the software specific bibliography options become available when
148 loading the Bib\LaTeX\ package directly. See the \path{sample.tex} file for a
149 working example.
150
151 \subsection{Installation}\label{sec:install}
152
153 This package may become available in standard distributions like \TeX Live as
154 |biblatex-software|. To install manually, you can download it from CTAN and
155 then, put the relevant files in your texmf tree, usually:\\
156
157 \noindent\path{<texmf>/tex/latex/biblatex-software/software-biblatex.sty}\\
158 \path{<texmf>/tex/latex/biblatex-software/software.bbx}\\
159 \path{<texmf>/tex/latex/biblatex-software/software.dbx}\\
160 \path{<texmf>/tex/latex/biblatex-software/<language>-software.lbx}\\
161
162
163 \subsection{Package options}\label{sec:options}
164
165 The following options are available to control the typesetting of
166 software related entries.
167
168 \begin{ltxcode}
169 swlabels=true|false
170 \end{ltxcode}
171
172 \noindent Software is a special research output, distinct from
173 publications, hence software entries in a bibliography are
174 distinguished by a special label by default.
175 This behaviour can be disabled by setting this option to |false|.
176
177 \begin{ltxcode}
178 license=true|false
179 \end{ltxcode}
180
181 \noindent This option controls whether license information for
182 the software entry is typeset. The default is |true|.
183
184 \begin{ltxcode}
185 halid=true|false
186 \end{ltxcode}
187
188 \noindent This option controls the inclusion of the identifier on the HAL repository of the
189 metadata record for the software described in the entry. The default is |true|.
190
191 \begin{ltxcode}
192 swhid=true|false
193 \end{ltxcode}
194
195 \noindent This option controls the inclusion of the identifier on the Software Heritage archive
196 (SWHID) of the source code of the software described in the entry. The default is |true|.
197
198 \begin{ltxcode}
199 shortswhid=true|false
200 \end{ltxcode}
201
202 \noindent This option controls the way the SWHID is displayed. Setting it to true will include
203 only the core part of the SWHID in the printed version, and keep the full SWHID, with all contextual
204 information, in the hyperlink. The default is |false|.
205
206 \begin{ltxcode}
207 vcs=true|false
208 \end{ltxcode}
209
210 \noindent This option controls the inclusion of the url of the code hosting
211 platform where the software described in the enttry is developed. The default is |true|.
212
213 \begin{ltxcode}
214 addendum=true|false
215 \end{ltxcode}
216
217 \noindent This option controls whether the addendum field is typeset in software entries.
218 The addendum field can be used to include additional information at the end of a bibliography entry.
219 The default is |true|.
220
221 \begin{ltxcode}
222 crossrefexpansion=verbose|conditional
223 \end{ltxcode}
224
225 \noindent This option controls how crossref entries are displayed in the bibliography.
226 When a child entry references a parent entry via the |crossref| field, this option determines
227 the formatting behavior:
228
229 \begin{itemize}
230 \item |verbose| (default): Always show the full entry with all fields, even if the parent
231 entry is also cited in the bibliography.
232 \item |conditional|: Show a concise format when the parent entry is cited in the bibliography,
233 displaying only fields that differ from the parent along with a citation reference to the parent.
234 If the parent is not cited, show the full entry.
235 \end{itemize}
236
237 \subsection{Entry Relationships and Inheritance}
238
239 Software bibliography entries can reference parent entries using the |crossref| field, creating
240 inheritance chains where child entries automatically inherit fields from their parents. This
241 enables concise bibliography formatting by showing only the differences between child and parent
242 entries.
243
244 \subsubsection{Supported Inheritance Chains}
245
246 The following inheritance chains are supported:
247
248 \begin{itemize}
249 \item \textbf{2-level}: Software → Version
250 \item \textbf{3-level}: Software → Version → Module
251 \item \textbf{3-level}: Software → Version → Fragment
252 \item \textbf{4-level}: Software → Version → Module → Fragment
253 \end{itemize}
254
255 The inheritance mechanism works as follows: when a child entry has a |crossref| field pointing
256 to a parent entry, any fields not explicitly set in the child entry are automatically inherited
257 from the parent. The system then compares the child's fields with the parent's fields to determine
258 what to display in the bibliography.
259
260 \subsubsection{Field Comparison and Concise Format}
261
262 When |crossrefexpansion=conditional| is set and the parent entry is cited in the bibliography,
263 the system displays only fields that differ from the parent, along with a citation reference to
264 the parent entry. The comparison is performed for the following fields:
265
266 \begin{itemize}
267 \item Title, author, editor
268 \item Date (year, month, day components)
269 \item Version
270 \item Institution
271 \item URL and HAL ID
272 \item License
273 \item Entry-specific fields: |swhid|, |repository|, |introducedin|
274 \end{itemize}
275
276 Fields that match the parent entry are automatically omitted to reduce repetition in the bibliography.
277
278 Different entry types use different relationship text in the concise format:
279 \begin{itemize}
280 \item Versions: ``version X of [citation]''
281 \item Modules: ``part of [citation]''
282 \item Fragments: ``from [citation]''
283 \end{itemize}
284
285 \subsubsection{Examples}
286
287 The following examples demonstrate crossref functionality using real-world entries from the
288 |biblio.bib| file.
289
290 \textbf{Example 1: Software → Version}
291
292 Consider the Scilab software and its version:
293
294 \begin{ltxcode}
295 @software {delebecque:hal-02090402,
296 title = {Scilab},
297 author = {Delebecque, Fran{\c c}ois and Gomez, Claude and Goursat, Maurice
298 and Nikoukhah, Ramine and Steer, Serge and Chancelier, Jean-Philippe},
299 date = {1994},
300 institution = {Inria},
301 license = {Scilab license},
302 hal_id = {hal-02090402},
303 hal_version = {v1},
304 url = {https://www.scilab.org/},
305 repository = {https://github.com/scilab/scilab},
306 abstract = {Software for Numerical Computation freely distributed.}
307 }
308
309 @softwareversion {delebecque:hal-02090402v1,
310 version = {1.1},
311 date = {1994-01},
312 file = {https://hal.inria.fr/hal-02090402/file/scilab-1.1.tar.gz},
313 swhid = {swh:1:dir:1ba0b67b5d0c8f10961d878d91ae9d6e499d746a;
314 origin=https://hal.archives-ouvertes.fr/hal-02090402},
315 note = {First Scilab version. It was distributed by anonymous ftp.},
316 crossref = {delebecque:hal-02090402}
317 }
318 \end{ltxcode}
319
320 When both entries are cited and |crossrefexpansion=conditional| is set, the version entry
321 will be displayed in concise format showing only the differing fields (version, date, file,
322 swhid, note) along with a reference to the parent entry.
323
324 \textbf{Example 2: Software → Version → Module}
325
326 The CGAL library demonstrates a 3-level inheritance chain:
327
328 \begin{ltxcode}
329 @software {cgal,
330 title = {The Computational Geometry Algorithms Library},
331 author = {{The CGAL Project}},
332 editor = {{CGAL Editorial Board}},
333 date = {1996},
334 url = {https://cgal.org/}
335 }
336
337 @softwareversion {cgal:5-0-2,
338 crossref = {cgal},
339 version = {{5.0.2}},
340 url = {https://docs.cgal.org/5.02},
341 date = {2020},
342 swhid = {swh:1:rel:636541bbf6c77863908eae744610a3d91fa58855;
343 origin=https://github.com/CGAL/cgal/}
344 }
345
346 @softwaremodule {cgal:lp-gi-20a,
347 crossref = {cgal:5-0-2},
348 author = {Menelaos Karavelas},
349 subtitle = {{2D} Voronoi Diagram Adaptor},
350 license = {GPL},
351 introducedin = {cgal:3-1},
352 url = {https://doc.cgal.org/5.0.2/Manual/packages.html#PkgVoronoiDiagram2}
353 }
354 \end{ltxcode}
355
356 The module entry inherits fields from the version entry, which in turn inherits from the
357 base software entry. When all three are cited, the module will show only its specific fields
358 (subtitle, author, license, introducedin, url) with a ``part of [citation]'' reference.
359
360 \textbf{Example 3: Software → Version → Fragment}
361
362 The Parmap library demonstrates a version with a code fragment:
363
364 \begin{ltxcode}
365 @software {parmap,
366 title = {The Parmap library},
367 author = {Di Cosmo, Roberto and Marco Danelutto},
368 date = {2012},
369 institution = {{Inria} and {University of Paris} and {University of Pisa}},
370 license = {LGPL-2.0},
371 url = {https://rdicosmo.github.io/parmap/},
372 repository = {https://github.com/rdicosmo/parmap}
373 }
374
375 @softwareversion {parmap-1.1.1,
376 crossref = {parmap},
377 date = {2020},
378 version = {1.1.1},
379 swhid = {swh:1:rel:373e2604d96de4ab1d505190b654c5c4045db773;
380 origin=https://github.com/rdicosmo/parmap}
381 }
382
383 @codefragment {simplemapper,
384 crossref = {parmap-1.1.1},
385 subtitle = {Core mapping routine},
386 swhid = {swh:1:cnt:43a6b232768017b03da934ba22d9cc3f2726a6c5;
387 origin=https://github.com/rdicosmo/parmap;
388 visit=swh:1:snp:2a6c348c53eb77d458f24c9cbcecaf92e3c45615;
389 anchor=swh:1:rel:373e2604d96de4ab1d505190b654c5c4045db773;
390 path=/src/parmap.ml;
391 lines=192-228}
392 }
393 \end{ltxcode}
394
395 The code fragment inherits from the version entry, showing only its specific fields (subtitle,
396 swhid with path and lines information) with a ``from [citation]'' reference.
397
398 \subsubsection{Known Biber Warnings}
399
400 When using multiline |swhid| fields with semicolons, Biber may emit ``possible runaway string''
401 warnings. These warnings are \emph{false positives} and can be safely ignored.
402
403 The warnings occur because BibTeX's parser sees a semicolon followed by a newline in multiline
404 |swhid| fields and becomes cautious, thinking the string might be unclosed. However, the fields
405 are correctly formatted. For example:
406
407 \begin{ltxcode}
408 swhid = {swh:1:dir:1ba0b67b5d0c8f10961d878d91ae9d6e499d746a;
409 origin=https://hal.archives-ouvertes.fr/hal-02090402}
410 \end{ltxcode}
411
412 The |DeclareStyleSourcemap| in |software.bbx| normalizes these fields by removing whitespace,
413 so the multiline format is handled correctly. The warnings do not affect the functionality or
414 correctness of the bibliography output.
415
416 \subsection{Adding support for additional software identifiers}
417
418 It would not be reasonable to have a dedicated field for each of the many software releated identifiers that exist.
419 If you want to create bibliographic records that use identifiers not natively supported by this package, you
420 can use the standard Bib\LaTeX\ mechanism that uses the |eprint|, |eprinttype| and |eprintclass| fields.\\
421
422 The default formatting of these fields may be what you want, but if it's not the case, you can define
423 your own format, as explained in the official Bib\LaTeX\ documentation.\\
424
425 As an example, this style already contains a specific formatting definition for the Astrophysics Source Code Library (ASCL) software records,
426 via the following declaration in the \verb|software.bbx| file:
427
428 \begin{verbatim}
429 \DeclareFieldFormat{eprint:ascl}{%
430 \mkbibacro{ASCL}\addcolon\addspace%
431 \ifhyperref
432 {\href{https://ascl.net/#1}{%
433 \(\langle\)ascl\addcolon\nolinkurl{#1}\(\rangle\)%
434 \iffieldundef{eprintclass}
435 {}
436 {\addspace\texttt{\mkbibbrackets{\thefield{eprintclass}}}}}}
437 {\(\langle\)ascl\addcolon\nolinkurl{#1}\(\rangle\)%
438 \iffieldundef{eprintclass}
439 {}
440 {\addspace\texttt{\mkbibbrackets{\thefield{eprintclass}}}}}
441 }
442 \end{verbatim}
443
444 If you want to adapt this very example to an identifier |foo| with resolver prefix |https://myfoo.org/|, just replace in the \LaTeX{} code above |https://ascl.net/| with |https://myfoo.org/|, |ascl| with |foo| and |ASCL| with |FOO|.
445
446 \section{Details}
447
448 The detailed information for this style is contained in the example document and
449 accompanying \path{.bib} files:
450 \begin{description}
451 \item[\path{software-biblatex.tex}] This document.
452 \item[\path{biblio.bib}] An example bibliography showcasing all the software entries.
453 \item[\path{sample-use-sty.tex}]\footnote{\path{sample-use-sty.pdf} is also
454 provided and is the typeset version of this \latex source file.} This document
455 exerces most useful feature of this style extension, using the
456 \path{biblio.bib} entries.
457 \item[\path{sample.tex}] This document produces the same output as
458 \path{sample-use-sty.tex}, but instead of extending on the fly and existing
459 style, it assumes that an extended bibliographic style \texttt{numeric+sw} has
460 been created starting from the standard \texttt{numeric} style.
461 \item[\path{software.bbx}] The |biblatex-software| references style.
462 \item[\path{software.dbx}] The |biblatex-software| data model additions.
463 \item[\path{*.lbx}] The |biblatex-software| localisation files.
464 \item[\path{software-biblatex.sty}] The |software-biblatex| \LaTeX\ package for extending on the fly any preloaded Bib \LaTeX\ style.
465 \end{description}
466
467 \section{Contributing}
468
469 This style extension is currently developed on a git-based repository at
470 \url{https://gitlab.inria.fr/gt-sw-citation/bibtex-sw-entry/}.
471 Contributions and bug reports are very welcome. In particular, translation
472 of the localization strings for other languages are needed.
473
474 \section{Revision history}\label{rev}
475
476 \begin{changelog}
477
478 \input{history}
479
480 \end{changelog}
481
482 \bibliography{manual}
483 \bibliographystyle{abbrv}
484
485 \end{document}