| 1 |
% |
| 2 |
% Copyright (c) 2021-2026 Zeping Lee |
| 3 |
% Released under the MIT License. |
| 4 |
% Repository: https://github.com/zepinglee/citeproc-lua |
| 5 |
% |
| 6 |
|
| 7 |
\documentclass{l3doc} |
| 8 |
|
| 9 |
\usepackage{mathpazo} |
| 10 |
\usepackage{helvet} |
| 11 |
\usepackage{listings} |
| 12 |
|
| 13 |
\NewDocumentCommand\opt{m}{\texttt{#1}} |
| 14 |
\NewDocumentCommand\field{m}{\texttt{#1}} |
| 15 |
\NewDocumentCommand\entrytype{m}{\texttt{#1}} |
| 16 |
|
| 17 |
\lstnewenvironment{LaTeXdemo}{ |
| 18 |
\lstset{ |
| 19 |
basicstyle = \ttfamily\small, |
| 20 |
basewidth = 0.51em, |
| 21 |
frame = single, |
| 22 |
gobble = 2, |
| 23 |
language = [LaTeX]TeX, |
| 24 |
} |
| 25 |
}{} |
| 26 |
|
| 27 |
\lstnewenvironment{bash}{ |
| 28 |
\lstset{ |
| 29 |
basicstyle = \ttfamily\small, |
| 30 |
basewidth = 0.51em, |
| 31 |
% gobble = 2, |
| 32 |
language = bash, |
| 33 |
} |
| 34 |
}{} |
| 35 |
|
| 36 |
% \hypersetup{hidelinks} |
| 37 |
% \urlstyle{same} |
| 38 |
|
| 39 |
\begin{document} |
| 40 |
|
| 41 |
\title{% |
| 42 |
Bibliography formatting with \pkg{citation-style-language} |
| 43 |
} |
| 44 |
|
| 45 |
\author{% |
| 46 |
Zeping Lee% |
| 47 |
\thanks{% |
| 48 |
E-mail: |
| 49 |
\href{mailto:[email protected]} |
| 50 |
{[email protected]}% |
| 51 |
}% |
| 52 |
} |
| 53 |
|
| 54 |
\date{2026-03-24 v0.9.2} |
| 55 |
|
| 56 |
\maketitle |
| 57 |
|
| 58 |
% \begin{abstract} |
| 59 |
% Foo |
| 60 |
% \end{abstract} |
| 61 |
|
| 62 |
\begin{documentation} |
| 63 |
|
| 64 |
\section{Introduction} |
| 65 |
|
| 66 |
The Citation Style Language\footnote{\url{https://citationstyles.org/}} (CSL) |
| 67 |
is an XML-based language that defines the formats of citations and bibliographies. |
| 68 |
There are currently thousands of styles in CSL, including widely used styles such as |
| 69 |
APA, Chicago, and Vancouver. |
| 70 |
The \pkg{citation-style-language} package aims to provide another reference-formatting method |
| 71 |
for LaTeX that utilizes CSL styles. |
| 72 |
It contains a citation processor implemented in pure Lua (\pkg{citeproc-lua}) |
| 73 |
which reads bibliographic metadata and performs sorting and formatting on both |
| 74 |
citations and bibliography according to the selected CSL style. |
| 75 |
A LaTeX package (\file{citation-style-language.sty}) is provided to communicate with the processor. |
| 76 |
|
| 77 |
Note that this project is in an early stage of development and some features of CSL |
| 78 |
are not implemented yet. |
| 79 |
Comments, suggestions, and bug reports are welcome. |
| 80 |
|
| 81 |
|
| 82 |
\section{Installation} |
| 83 |
|
| 84 |
This package is available in TeX Live 2022 and later. |
| 85 |
For most users, the easiest way is to install it via |tlmgr|. |
| 86 |
If you want to install the GitHub development version of this package, |
| 87 |
you may follow the steps below. |
| 88 |
|
| 89 |
The \pkg{citation-style-language} requires the following packages: |
| 90 |
\pkg{filehook}, \pkg{l3kernel}, \pkg{l3packages}, \pkg{lua-uca}, \pkg{lualibs}, |
| 91 |
\pkg{luatex}, \pkg{luaxml}, and \pkg{url}. |
| 92 |
\pkg{l3build} is also required for actually performing the installation. |
| 93 |
Make sure they are already installed in the TeX distribution. |
| 94 |
|
| 95 |
\begin{bash} |
| 96 |
git clone https://github.com/zepinglee/citeproc-lua # Clone the repository |
| 97 |
cd citeproc-lua |
| 98 |
git submodule update --init --remote # Fetch submodules |
| 99 |
l3build install |
| 100 |
\end{bash} |
| 101 |
|
| 102 |
These commands install the package files to |TEXMFHOME|, which is usually |
| 103 |
|~/texmf| on Linux or |~/Library/texmf| on macOS. |
| 104 |
In addition, the |citeproc-lua| executable needs to be copied to a directory in |
| 105 |
the |PATH| environment variable so that it can be called directly in the shell. |
| 106 |
For example, provided that |~/bin| is in |PATH|: |
| 107 |
|
| 108 |
\begin{bash} |
| 109 |
cp citeproc/citeproc-lua.lua "~/bin/citeproc-lua" |
| 110 |
\end{bash} |
| 111 |
|
| 112 |
To uninstall the package from |TEXMFHOME|, just run |l3build uninstall|. |
| 113 |
|
| 114 |
\section{Getting started} |
| 115 |
|
| 116 |
An example of using the \pkg{citation-style-language} package is as follows. |
| 117 |
|
| 118 |
\begin{LaTeXdemo} |
| 119 |
\documentclass{...} |
| 120 |
\usepackage[style=apa]{citation-style-language} |
| 121 |
\addbibresource{bibfile.json} |
| 122 |
\begin{document} |
| 123 |
\cite{...} |
| 124 |
... |
| 125 |
\printbibliography |
| 126 |
\end{document} |
| 127 |
\end{LaTeXdemo} |
| 128 |
|
| 129 |
The compilation procedure differs across engines. |
| 130 |
|
| 131 |
\paragraph{LuaTeX} |
| 132 |
|
| 133 |
The CSL processor is written in Lua and can be run directly in LuaTeX |
| 134 |
without the need of running external programs. |
| 135 |
For LuaTeX, the compilation procedure is simply running \file{latex} twice, |
| 136 |
which is the same as for documents with cross-references. |
| 137 |
|
| 138 |
\paragraph{Other engines} |
| 139 |
|
| 140 |
For engines other than LuaTeX, the \file{citeproc-lua} executable must be run |
| 141 |
on the \file{.aux} file to generate the citations and bibliography. |
| 142 |
The general procedure is similar to the traditional BibTeX workflow. |
| 143 |
\begin{enumerate} |
| 144 |
\item Run \file{latex} on \file{example.tex}. |
| 145 |
\item Run \file{citeproc-lua} on \file{example.aux}. |
| 146 |
The engine reads the \file{.csl} style, CSL locale files, and |
| 147 |
\file{.bib} database and then writes the processed citations and |
| 148 |
bibliography to \file{example.bbl}. |
| 149 |
\item Run \file{latex} on \file{example.tex}. |
| 150 |
The \file{.bbl} file is loaded and all the citations and bibliography |
| 151 |
are printed. |
| 152 |
\end{enumerate} |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
\section{Package setup} |
| 157 |
|
| 158 |
\begin{function}{\cslsetup} |
| 159 |
\begin{syntax} |
| 160 |
\cs{cslsetup}\marg{options} |
| 161 |
\end{syntax} |
| 162 |
\end{function} |
| 163 |
|
| 164 |
Package options may be set when the package is loaded or at any later stage |
| 165 |
with the \cs{cslsetup} command. |
| 166 |
These two methods are equivalent. |
| 167 |
\begin{LaTeXdemo} |
| 168 |
\usepackage[style=apa]{citation-style-language} |
| 169 |
% OR |
| 170 |
\usepackage{citation-style-language} |
| 171 |
\cslsetup{style = apa} |
| 172 |
\end{LaTeXdemo} |
| 173 |
|
| 174 |
\DescribeOption{style} |
| 175 |
The \opt{style=}\meta{style-id} option selects the style file |
| 176 |
\meta{style-id}\file{.csl} for both citations and bibliography. |
| 177 |
The implemented CSL style files are available in the official GitHub |
| 178 |
repository\footnote{\url{https://github.com/citation-style-language/styles}} |
| 179 |
as well as the Zotero style |
| 180 |
repository\footnote{\url{https://www.zotero.org/styles}}. |
| 181 |
The user may search and download the \file{.csl} file to the working directory. |
| 182 |
The following styles are distributed within the package and |
| 183 |
each of them can be directly loaded without downloading. |
| 184 |
|
| 185 |
\begin{description} |
| 186 |
\item[\opt{american-chemical-society}] American Chemical Society |
| 187 |
\item[\opt{american-medical-association}] American Medical Association 11th edition |
| 188 |
\item[\opt{american-political-science-association}] American Political Science Association |
| 189 |
\item[\opt{american-sociological-association}] American Sociological Association 6th edition |
| 190 |
\item[\opt{apa}] American Psychological Association 7th edition |
| 191 |
\item[\opt{chicago-author-date}] Chicago Manual of Style 17th edition (author-date) |
| 192 |
\item[\opt{chicago-fullnote-bibliography}] Chicago Manual of Style 17th edition (full note) |
| 193 |
\item[\opt{chicago-note-bibliography}] Chicago Manual of Style 17th edition (note) |
| 194 |
\item[\opt{elsevier-harvard}] Elsevier - Harvard (with titles) |
| 195 |
\item[\opt{harvard-cite-them-right}] Cite Them Right 11th edition - Harvard |
| 196 |
\item[\opt{ieee}] IEEE |
| 197 |
\item[\opt{modern-humanities-research-association}] Modern Humanities Research Association 3rd edition (note with bibliography) |
| 198 |
\item[\opt{modern-language-association}] Modern Language Association 9th edition |
| 199 |
\item[\opt{nature}] Nature |
| 200 |
\item[\opt{vancouver}] Vancouver |
| 201 |
\end{description} |
| 202 |
|
| 203 |
\DescribeOption{locale} |
| 204 |
The \opt{locale} option receives an ISO 639-1 two-letter language code |
| 205 |
(e.g., ``\opt{en}'', ``\opt{zh}''), optionally with a two-letter locale code |
| 206 |
(e.g., ``\opt{de-DE}'', ``\opt{de-AT}''). |
| 207 |
This option affects sorting of the entries and the output of dates, numbers, |
| 208 |
and terms (e.g., ``et al.''). |
| 209 |
It may also be set \opt{auto} (default) and the \opt{default-locale} attribute in |
| 210 |
the CSL style file will be used. |
| 211 |
The locale falls back to ``\opt{en}'' (English) if the attribute is not set. |
| 212 |
When \pkg{babel} package is loaded, the selected main language is implicitly set |
| 213 |
as the \opt{locale} for \pkg{citation-style-language}. |
| 214 |
|
| 215 |
\DescribeOption{use-bbl} |
| 216 |
The \opt{use-bbl} option controls whether to load the manually edited contents |
| 217 |
in a \file{.bbl} file when used with LuaTeX. |
| 218 |
If the option is set to |true| and a \file{.bbl} file is not present, the |
| 219 |
latter will be generated. |
| 220 |
This option does not affect engines other than LuaTeX. |
| 221 |
|
| 222 |
\DescribeOption{ref-section} |
| 223 |
This option automatically starts a new reference section at the given document |
| 224 |
heading such as a chapter or a section. This is equivalent to the |
| 225 |
\cs{newrefsection} command. The following choices are available: |
| 226 |
|
| 227 |
\begin{description} |
| 228 |
\item[\opt{none}] Disable this feature (default). |
| 229 |
\item[\opt{part}] Start a reference section at every \cs{part} command. |
| 230 |
\item[\opt{chapter}] Start a reference section at every \cs{chapter} command. |
| 231 |
\item[\opt{chapter+}] Start a reference section at every \cs{chapter} and |
| 232 |
every higher level of sectioning, i.e. \cs{part}. |
| 233 |
\item[\opt{section}] Start a reference section at every \cs{section} command. |
| 234 |
\item[\opt{section+}] Start a reference section at every \cs{section} and |
| 235 |
every higher level of sectioning, i.e. \cs{part} and \cs{chapter}. |
| 236 |
\item[\opt{subsection}] Start a reference section at every \cs{subsection} command. |
| 237 |
\item[\opt{subsection+}] Start a reference section at every \cs{subsection} and every higher level of sectioning, i.e. \cs{part}, \cs{chapter} and \cs{section}. |
| 238 |
\end{description} |
| 239 |
|
| 240 |
\DescribeOption{bib-font} |
| 241 |
Usually, the list of references is printed in the same font style and size as |
| 242 |
the main text. |
| 243 |
The \opt{bib-font} option is used to set different formats in the |
| 244 |
\env{thebibliography} environment. |
| 245 |
It may override the \opt{line-spacing} attribute configured in the CSL style. |
| 246 |
For example, to force double-spacing in the bibliography: |
| 247 |
\begin{LaTeXdemo} |
| 248 |
\cslsetup{bib-font = \linespread{2}\selectfont} |
| 249 |
\end{LaTeXdemo} |
| 250 |
|
| 251 |
\DescribeOption{bib-label-sep} |
| 252 |
The horizontal space between labels and entry contents in the bibliography. |
| 253 |
This default length is the value of \cs{labelsep} at load-time. |
| 254 |
|
| 255 |
\DescribeOption{bib-item-sep} |
| 256 |
The vertical space between entries in the bibliography is configured in the |
| 257 |
CSL style. |
| 258 |
It can be overridden by this \opt{bib-item-sep} option. |
| 259 |
It is recommended to set \opt{bib-item-sep} to stretchable glue rather than |
| 260 |
a fixed length to help reduce page breaks in the middle of an entry. |
| 261 |
\begin{LaTeXdemo} |
| 262 |
\cslsetup{bib-item-sep = 8 pt plus 4 pt minus 2 pt} |
| 263 |
\end{LaTeXdemo} |
| 264 |
|
| 265 |
\DescribeOption{bib-name-sep} |
| 266 |
Vertical space to be inserted between two name groups in a per-author reference |
| 267 |
list. |
| 268 |
The default value is zero. |
| 269 |
Note that this option only takes effect when its value is larger than |
| 270 |
\opt{bib-item-sep} because it's used with \cs{addvspace}. |
| 271 |
|
| 272 |
\DescribeOption{bib-after-name-sep} |
| 273 |
Vertical space to be inserted between the author block and the following |
| 274 |
entries in a per-author reference list. |
| 275 |
The default value is zero. |
| 276 |
Note that this option only takes effect when its value is larger than |
| 277 |
\opt{bib-item-sep} because it's used with \cs{addvspace}. |
| 278 |
|
| 279 |
\DescribeOption{bib-hang} |
| 280 |
The \opt{bib-hang} option sets the hanging indentation length which is |
| 281 |
usually used for author-date style references. |
| 282 |
By default, it is 1 em (with respect to the \opt{bib-font} size if set). |
| 283 |
|
| 284 |
\DescribeOption{bib-par-indent} |
| 285 |
The paragraph indentation of references if they are in normal paragraph style |
| 286 |
rather than labelled or hanging indented. |
| 287 |
By default, it is the \cs{parindent} when printed out. |
| 288 |
|
| 289 |
|
| 290 |
\begin{function}{\addbibresource} |
| 291 |
\begin{syntax} |
| 292 |
\cs{addbibresource}\marg{resource} |
| 293 |
\end{syntax} |
| 294 |
\end{function} |
| 295 |
|
| 296 |
The \cs{addbibresource} command loads bibliographic data from \meta{resource} |
| 297 |
file. CSL-JSON is the preferred format especially when the data are exported |
| 298 |
from a reference manager like Zotero. Other formats like CSL-YAML and |
| 299 |
Bib(La)TeX (for compatibility) are also supported but they need to be converted |
| 300 |
to CSL-JSON for internal processing. Note that the files must be specified with |
| 301 |
their extension names and the content should be encoded in UTF-8. |
| 302 |
\begin{LaTeXdemo} |
| 303 |
\addbibresource{file1.json} |
| 304 |
\addbibresource[journal-abbreviation = false]{file2.bib} |
| 305 |
\end{LaTeXdemo} |
| 306 |
|
| 307 |
\DescribeOption{journal-abbreviation} |
| 308 |
The \opt{journal-abbreviation} option controls whether to search for abbreviations of journal titles when a \file{.bib} file is converted to CSL-JSON. |
| 309 |
The \texttt{journal} field in a traditional BibTeX database can be either a full title or an abbreviation, |
| 310 |
but a CSL style assumes that both forms are available. |
| 311 |
For example, \texttt{journal = ''Aquacult. Eng.''} is an abbreviation, but a CSL style like \file{apa.csl} may require the full title. |
| 312 |
With \opt{journal-abbreviation} enabled (the default), the CSL engine tries to find the full title ``Aquacultural Engineering'' from the data at \url{https://github.com/JabRef/abbrv.jabref.org}. |
| 313 |
This can be disabled by setting it to \opt{false}. |
| 314 |
Note that this option is only valid for \file{.bib} files. |
| 315 |
|
| 316 |
\section{Citation commands} |
| 317 |
|
| 318 |
\begin{function}{\cite} |
| 319 |
\begin{syntax} |
| 320 |
\cs{cite}\oarg{options}\marg{keys} |
| 321 |
\end{syntax} |
| 322 |
\end{function} |
| 323 |
|
| 324 |
The citation command is similar to the one in standard LaTeX except that the |
| 325 |
\meta{options} is in key-value style. |
| 326 |
\DescribeOption{prefix} |
| 327 |
\DescribeOption{suffix} |
| 328 |
\DescribeOption{page} |
| 329 |
\DescribeOption{figure} |
| 330 |
The \meta{options} can be \opt{prefix}, \opt{suffix}, or one of the locators like |
| 331 |
\opt{page} or \opt{figure}. |
| 332 |
The full list of supported locators is detailed in Table~\ref{tab:locators}. |
| 333 |
An example is as follows. |
| 334 |
\begin{LaTeXdemo} |
| 335 |
\cite[prefix = {See }, page = 42]{ITEM-1} |
| 336 |
\end{LaTeXdemo} |
| 337 |
|
| 338 |
\DescribeOption{unsorted} |
| 339 |
Some styles specify the order of items in the citations (e.g., alphabetical |
| 340 |
or chronological) and the \opt{unsorted} option can be used to disable this |
| 341 |
behavior. This is useful in cases like citing secondary sources. The following |
| 342 |
example produces “(Rabitt, 1982, as cited in Lyon 2014)”. |
| 343 |
|
| 344 |
\begin{LaTeXdemo} |
| 345 |
\cites{rabitt1982}[prefix={, as cited in}, unsorted = true]{lyon2014} |
| 346 |
\end{LaTeXdemo} |
| 347 |
|
| 348 |
\begin{table} |
| 349 |
\centering |
| 350 |
\caption{The locators supported in CSL v1.0.2.} |
| 351 |
\label{tab:locators} |
| 352 |
\begin{tabular}{lll} |
| 353 |
\toprule |
| 354 |
\opt{act} & \opt{folio} & \opt{section} \\ |
| 355 |
\opt{appendix} & \opt{issue} & \opt{sub-verbo} \\ |
| 356 |
\opt{article} & \opt{line} & \opt{supplement} \\ |
| 357 |
\opt{book} & \opt{note} & \opt{table} \\ |
| 358 |
\opt{canon} & \opt{opus} & \opt{timestamp} \\ |
| 359 |
\opt{chapter} & \opt{page} & \opt{title} \\ |
| 360 |
\opt{column} & \opt{paragraph} & \opt{verse} \\ |
| 361 |
\opt{elocation} & \opt{part} & \opt{version} \\ |
| 362 |
\opt{equation} & \opt{rule} & \opt{volume} \\ |
| 363 |
\opt{figure} & \opt{scene} & \\ |
| 364 |
\bottomrule |
| 365 |
\end{tabular} |
| 366 |
\end{table} |
| 367 |
|
| 368 |
The traditional form \cs{cite}\oarg{prenote}\oarg{postnote}\marg{keys} |
| 369 |
introduced in \pkg{natbib} and \pkg{biblatex} is also supported but not |
| 370 |
recommended. |
| 371 |
If only one optional argument is provided, it is treated as \meta{postnote}. |
| 372 |
The \meta{postnote} is used as a page locator if it consists of only digits. |
| 373 |
|
| 374 |
\begin{function}{\parencite,\citep} |
| 375 |
\begin{syntax} |
| 376 |
\cs{parencite}\oarg{options}\marg{keys} |
| 377 |
\end{syntax} |
| 378 |
\end{function} |
| 379 |
|
| 380 |
The \cs{parencite} and \cs{citep} command are aliases of \cs{cite}. |
| 381 |
They are added for compatibility with \pkg{biblatex} and \pkg{natbib} packages. |
| 382 |
If the citation format defined in the CSL style does not have affixes, |
| 383 |
these commands in \pkg{citation-style-language} do not enclose the output with |
| 384 |
brackets, which is different from other packages. |
| 385 |
|
| 386 |
\begin{function}{\textcite,\citet} |
| 387 |
\begin{syntax} |
| 388 |
\cs{textcite}\oarg{options}\marg{keys} |
| 389 |
\end{syntax} |
| 390 |
\end{function} |
| 391 |
|
| 392 |
These commands produce narrative in-text citations where the author name is |
| 393 |
part of the running text followed by the year in parentheses. |
| 394 |
These commands only work with author-date styles. |
| 395 |
|
| 396 |
\DescribeOption{infix} |
| 397 |
An extra option \opt{infix} can be given to specify the text inserted between |
| 398 |
the author and year parts. For example, “Kesey’s early work (1962)” can be |
| 399 |
produced by |\textcite[infix={'s early work}]{ITEM-1}|. |
| 400 |
By default the infix is a space. |
| 401 |
|
| 402 |
\begin{function}{\footcite} |
| 403 |
\begin{syntax} |
| 404 |
\cs{footcite}\oarg{options}\marg{keys} |
| 405 |
\end{syntax} |
| 406 |
\end{function} |
| 407 |
|
| 408 |
This command is similar to \cs{cite}. It is for compatibility with |
| 409 |
\pkg{biblatex}. |
| 410 |
|
| 411 |
\begin{function}{\cites} |
| 412 |
\begin{syntax} |
| 413 |
\cs{cites}\oarg{options}\marg{key}...[options]\marg{key} |
| 414 |
\end{syntax} |
| 415 |
\end{function} |
| 416 |
|
| 417 |
The \cs{cites} accepts multiple cite items in a single citation. |
| 418 |
This command scans greedily for arguments and a following bracket may be |
| 419 |
mistakenly recognized as a delimiter. |
| 420 |
To prevent this, an explicit \cs{relax} command is required to terminate the |
| 421 |
scanning process. The following example illustrates its usage. |
| 422 |
|
| 423 |
\begin{LaTeXdemo} |
| 424 |
\cites[prefix = {See }, page = 6]{key1}[section = 2.3]{key2}\relax [Text] |
| 425 |
\end{LaTeXdemo} |
| 426 |
|
| 427 |
\begin{function}{\citeauthor} |
| 428 |
\begin{syntax} |
| 429 |
\cs{citeauthor}\marg{key} |
| 430 |
\end{syntax} |
| 431 |
\end{function} |
| 432 |
|
| 433 |
This command prints the author name. |
| 434 |
If the original citation does not contain the author name (e.g., a numeric |
| 435 |
style), an optional |<intext>| element can be supplied as a sibling to the |
| 436 |
|<citation>| and |<bibliography>| elements in the CSL style (see |
| 437 |
\href{https://citeproc-js.readthedocs.io/en/latest/running.html#citation-flags-with-processcitationcluster}{citeproc-js's documentation} for details). |
| 438 |
|
| 439 |
\begin{function}{\citeyear} |
| 440 |
\begin{syntax} |
| 441 |
\cs{citeyear}\marg{key} |
| 442 |
\end{syntax} |
| 443 |
\end{function} |
| 444 |
|
| 445 |
This command prints the publication year of the citation. |
| 446 |
|
| 447 |
\begin{function}{\citeyearpar} |
| 448 |
\begin{syntax} |
| 449 |
\cs{citeyearpar}\oarg{options}\marg{keys} |
| 450 |
\end{syntax} |
| 451 |
\end{function} |
| 452 |
|
| 453 |
This command suppresses the author names in the citation. |
| 454 |
It is equivalent to \cs{cite} with \opt{suppress-author} option enabled. |
| 455 |
|
| 456 |
\begin{function}{\fullcite} |
| 457 |
\begin{syntax} |
| 458 |
\cs{fullcite}\oarg{options}\marg{keys} |
| 459 |
\end{syntax} |
| 460 |
\end{function} |
| 461 |
|
| 462 |
This command prints a full citation similar to the bibliographic entry. |
| 463 |
The contents are generated from the |<bibliography>| element in the CSL style |
| 464 |
rather than the |<citation>| element. |
| 465 |
|
| 466 |
\begin{function}{\nocite} |
| 467 |
\begin{syntax} |
| 468 |
\cs{nocite}\marg{keys} |
| 469 |
\end{syntax} |
| 470 |
\end{function} |
| 471 |
|
| 472 |
This command produces no output but makes the entries included in the |
| 473 |
bibliography, which is the same in standard \LaTeX. |
| 474 |
If the special key |*| is given (\cs{nocite\{*\}}), all the entries in the |
| 475 |
database are included. |
| 476 |
|
| 477 |
|
| 478 |
\section{Bibliography commands} |
| 479 |
|
| 480 |
\begin{function}{\printbibliography} |
| 481 |
\begin{syntax} |
| 482 |
\cs{printbibliography} |
| 483 |
\cs{printbibliography}\oarg{options} |
| 484 |
\end{syntax} |
| 485 |
\end{function} |
| 486 |
|
| 487 |
This command prints the reference list. |
| 488 |
It also accepts an optional argument in square brackets which is a list of |
| 489 |
key-value options. The following options are available. |
| 490 |
|
| 491 |
\begin{variable}{heading} |
| 492 |
\begin{syntax} |
| 493 |
heading = \meta{name} |
| 494 |
\end{syntax} |
| 495 |
\end{variable} |
| 496 |
|
| 497 |
This option selects the section heading style defined with \cs{defbibheading}. |
| 498 |
The default heading for \cs{printbibliography} is \opt{bibliography}. |
| 499 |
|
| 500 |
\begin{variable}{title} |
| 501 |
\begin{syntax} |
| 502 |
title = \meta{text} |
| 503 |
\end{syntax} |
| 504 |
\end{variable} |
| 505 |
|
| 506 |
This option sets the title in the heading. |
| 507 |
|
| 508 |
\begin{variable}{label} |
| 509 |
\begin{syntax} |
| 510 |
label = \meta{label} |
| 511 |
\end{syntax} |
| 512 |
\end{variable} |
| 513 |
|
| 514 |
This option is equivalent to \cs{label}\marg{label} after the heading so that |
| 515 |
it can be \cs{ref}ed from other parts in the document. |
| 516 |
|
| 517 |
\begin{variable}{prenote, postnote} |
| 518 |
\begin{syntax} |
| 519 |
prenote = \meta{name} |
| 520 |
postnote = \meta{name} |
| 521 |
\end{syntax} |
| 522 |
\end{variable} |
| 523 |
|
| 524 |
\begin{variable}{type} |
| 525 |
\begin{syntax} |
| 526 |
type = \meta{entrytype} |
| 527 |
\end{syntax} |
| 528 |
\end{variable} |
| 529 |
|
| 530 |
Print only the entries of the given \meta{entrytype}. |
| 531 |
Note that the \meta{entrytype} should be the name of a CSL entry type rather |
| 532 |
than BibTeX entry type (e.g., use |article-journal| rather than |article|). |
| 533 |
|
| 534 |
\begin{variable}{nottype} |
| 535 |
\begin{syntax} |
| 536 |
nottype = \meta{entrytype} |
| 537 |
\end{syntax} |
| 538 |
\end{variable} |
| 539 |
|
| 540 |
Print only the entries that are not \meta{entrytype}. |
| 541 |
This option may be used multiple times. |
| 542 |
|
| 543 |
\begin{variable}{keyword} |
| 544 |
\begin{syntax} |
| 545 |
keyword = \meta{keyword} |
| 546 |
\end{syntax} |
| 547 |
\end{variable} |
| 548 |
|
| 549 |
Print only the entries whose \field{keyword} field includes the given |
| 550 |
\meta{keyword}. This option may be used multiple times. |
| 551 |
|
| 552 |
\begin{variable}{notkeyword} |
| 553 |
\begin{syntax} |
| 554 |
notkeyword = \meta{keyword} |
| 555 |
\end{syntax} |
| 556 |
\end{variable} |
| 557 |
|
| 558 |
Print only the entries whose \field{keyword} field does not include the given |
| 559 |
\meta{keyword}. This option may be used multiple times. |
| 560 |
|
| 561 |
\begin{variable}{category} |
| 562 |
\begin{syntax} |
| 563 |
category = \meta{category} |
| 564 |
\end{syntax} |
| 565 |
\end{variable} |
| 566 |
|
| 567 |
Print only the entries assigned to the given category. |
| 568 |
This option may be used multiple times. |
| 569 |
|
| 570 |
|
| 571 |
\begin{variable}{notcategory} |
| 572 |
\begin{syntax} |
| 573 |
notcategory = \meta{category} |
| 574 |
\end{syntax} |
| 575 |
\end{variable} |
| 576 |
|
| 577 |
Print only the entries assigned to the given category. |
| 578 |
This option may be used multiple times. |
| 579 |
|
| 580 |
|
| 581 |
\subsection{Bibliography Sections} |
| 582 |
|
| 583 |
The \env{refsection} environment is used in the document body to mark a |
| 584 |
reference section. |
| 585 |
This environment is useful if you want separate, independent |
| 586 |
bibliographies and bibliography lists in each chapter, section, or any other |
| 587 |
part of a document. |
| 588 |
Within a reference section, all cited works are assigned labels which are local |
| 589 |
to the environment. Technically, reference sections are completely independent |
| 590 |
from document divisions such as \cs{chapter} and \cs{section} even though they |
| 591 |
will most likely be used per chapter or section. |
| 592 |
See the refsection package option in § 3.1.2.1 for a way to automate this. |
| 593 |
Also see § 3.14.3 for usage examples. |
| 594 |
|
| 595 |
\begin{function}{\begin{refsection}, \end{refsection}} |
| 596 |
\begin{syntax} |
| 597 |
\cs{begin}\{refsection\} |
| 598 |
\cs{begin}\{refsection\}[style = \meta{style-id}, bib-resource = <datafile>, ...] |
| 599 |
\end{syntax} |
| 600 |
\end{function} |
| 601 |
|
| 602 |
All citations given outside a \env{refsection} environment are assigned to |
| 603 |
the global section. |
| 604 |
If \cs{printbibliography} is used within a refsection, it will automatically |
| 605 |
select the current section. |
| 606 |
Note that \env{refsection} environments may not be nested. |
| 607 |
Beginning a new reference section automatically ends the active reference context (see § 3.8.10). |
| 608 |
The optional argument is a list of key-value configurations. The following options are available. |
| 609 |
|
| 610 |
|
| 611 |
\DescribeOption{style} |
| 612 |
The \opt{style} option specifies the CSL style used in this reference section. |
| 613 |
If this is not given, the global style will be used by default which is defined |
| 614 |
via package options or \cs{cslsetup}. |
| 615 |
|
| 616 |
\DescribeOption{bib-resource} |
| 617 |
The bibliographic data files are specified with this option. |
| 618 |
In the case of multiple data files, remember to enclose the file list in curly braces |
| 619 |
so that the key-value pairs are correctly parsed |
| 620 |
(e.g., \texttt{bib-resource = \{foo.json, bar.bib\}}). |
| 621 |
By default, the global bib resources are used if no \opt{bib-resource} is given. |
| 622 |
|
| 623 |
\DescribeOption{locale} |
| 624 |
This option sets the locale used in this reference section. |
| 625 |
By default the global locale is used. |
| 626 |
|
| 627 |
|
| 628 |
\begin{function}{\newrefsection, \endrefsection} |
| 629 |
\begin{syntax} |
| 630 |
\cs{newrefsection}[style = \meta{style-id}, bib-resource = <datafile>, ...] |
| 631 |
\cs{endrefsection} |
| 632 |
\end{syntax} |
| 633 |
\end{function} |
| 634 |
|
| 635 |
The \cs{newrefsection} command is similar to the \env{refsection} environment |
| 636 |
except that it is a standalone command rather than an environment. |
| 637 |
It automatically ends the previous reference section (if any) and immediately |
| 638 |
starts a new one. |
| 639 |
The \cs{endrefsection} command terminates the current reference section and restores |
| 640 |
the global section. |
| 641 |
|
| 642 |
|
| 643 |
\subsection{Bibliography Headings} |
| 644 |
|
| 645 |
\begin{function}{\defbibheading} |
| 646 |
\begin{syntax} |
| 647 |
\cs{defbibheading}\marg{name}\oarg{title}\marg{code} |
| 648 |
\end{syntax} |
| 649 |
\end{function} |
| 650 |
|
| 651 |
This command defines a bibliographic heading which can be used with the |
| 652 |
\opt{bibheading} option of \cs{printbibliography}. The \meta{name} is an |
| 653 |
identifier assigned to the defined style. |
| 654 |
If a \opt{title} option is given in the \cs{printbibliography}, it is passed |
| 655 |
to the \opt{code} as |#1|. Otherwise the value \meta{title} in the optional |
| 656 |
argument is used by default. The following is the definition of the default |
| 657 |
heading when used in a \cls{book} class. |
| 658 |
|
| 659 |
\begin{LaTeXdemo} |
| 660 |
\defbibheading{bibliography}[\bibname]{% |
| 661 |
\chapter*{#1}% |
| 662 |
\markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}% |
| 663 |
} |
| 664 |
\end{LaTeXdemo} |
| 665 |
|
| 666 |
|
| 667 |
The following are predefined headings which can be used directly. |
| 668 |
|
| 669 |
\begin{description} |
| 670 |
\item[\opt{bibliography}] The default heading used by \cs{printbibliography}. |
| 671 |
\item[\opt{subbibliography}] Similar to \opt{bibliography} but one sectioning level lower. |
| 672 |
\item[\opt{bibintoc}] Similar to \opt{bibliography} but adds an entry to the table of contents. |
| 673 |
\item[\opt{subbibintoc}] Similar to \opt{subbibliography} but adds an entry to the table of contents. |
| 674 |
\item[\opt{bibnumbered}] Similar to \opt{bibliography} but uses \cs{chapter} |
| 675 |
or \cs{section} to create a numbered heading which is also added to the table of contents. |
| 676 |
\item[\opt{subbibnumbered}] Similar to \opt{subbibliography} but uses \cs{chapter} |
| 677 |
or \cs{section} to create a numbered heading which is also added to the table of contents. |
| 678 |
\item[\opt{none}] An empty heading. |
| 679 |
% \item[\opt{biblist}] |
| 680 |
% \item[\opt{biblistintoc}] |
| 681 |
% \item[\opt{biblistnumbered}] |
| 682 |
\end{description} |
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
% \markdownInput{bib-csl-mapping.md} |
| 687 |
|
| 688 |
|
| 689 |
\section{Compatibility with other packages} |
| 690 |
|
| 691 |
\paragraph{\pkg{babel}} |
| 692 |
|
| 693 |
The main language set by \pkg{babel} is used as the locale for \pkg{citation-style-language}. |
| 694 |
In general, \pkg{babel} is supposed to be loaded before \pkg{citation-style-language}. |
| 695 |
|
| 696 |
\paragraph{\pkg{beamer}} |
| 697 |
|
| 698 |
Most of this package's features work fine with \pkg{beamer} except the |
| 699 |
\opt{backref} option. At the moment this can be addressed with \pkg{hyperref}'s |
| 700 |
\opt{backref} option. |
| 701 |
|
| 702 |
|
| 703 |
\paragraph{\pkg{hyperref}} |
| 704 |
|
| 705 |
When \pkg{hyperref} is loaded, the DOIs, PMIDs, and PMCIDs are correctly |
| 706 |
rendered as hyperlinks. |
| 707 |
|
| 708 |
\paragraph{Incompatible packages} |
| 709 |
|
| 710 |
The following packages are not compatible with \pkg{citation-style-language}. |
| 711 |
An error will be triggered if any of them is loaded together with \pkg{citation-style-language}. |
| 712 |
\begin{itemize} |
| 713 |
\item \pkg{babelbib} |
| 714 |
\item \pkg{backref} |
| 715 |
\item \pkg{biblatex} |
| 716 |
\item \pkg{bibtopic} |
| 717 |
\item \pkg{bibunits} |
| 718 |
\item \pkg{chapterbib} |
| 719 |
\item \pkg{cite} |
| 720 |
\item \pkg{citeref} |
| 721 |
\item \pkg{inlinebib} |
| 722 |
\item \pkg{jurabib} |
| 723 |
\item \pkg{mcite} |
| 724 |
\item \pkg{mciteplus} |
| 725 |
\item \pkg{multibib} |
| 726 |
\item \pkg{natbib} |
| 727 |
\item \pkg{splitbib} |
| 728 |
\end{itemize} |
| 729 |
|
| 730 |
|
| 731 |
\section{License} |
| 732 |
|
| 733 |
\begin{itemize} |
| 734 |
\item The LaTeX package and Lua library are released under MIT license. |
| 735 |
\item The CSL styles and locale files are redistributed under the |
| 736 |
\href{https://creativecommons.org/licenses/by-sa/3.0/}{Creative Commons Attribution-ShareAlike 3.0 Unported} license. |
| 737 |
\item The journal abbreviation data are generated from |
| 738 |
\url{https://github.com/JabRef/abbrv.jabref.org} and are redistributed under |
| 739 |
the \href{https://github.com/JabRef/abbrv.jabref.org/blob/main/LICENSE.md}{CC0 1.0} |
| 740 |
license. |
| 741 |
\end{itemize} |
| 742 |
|
| 743 |
\end{documentation} |
| 744 |
|
| 745 |
\end{document} |