[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

zepinglee/citeproc-lua

Repository files navigation

citeproc-lua

CTAN LuaRocks GitHub release GitHub commits Automated testing

The Citation Style Language (CSL) is an XML-based language that defines the formats of citations and bibliography. There are currently thousands of styles in CSL including the most widely used APA, Chicago, Vancouver, etc. The citeproc-lua project is a Lua implementation of CSL v1.0.2 processor that is aimed for use with LaTeX. The engine reads bibliographic metadata and performs sorting and formatting on both citations and bibliography according to the selected CSL style. A LaTeX package (citation-style-language.sty) is provided to communicate with the processor.

This project is in early development stage and some features of CSL are not implemented yet. Comments, suggestions and bug reports are welcome.

LaTeX example

A full LaTeX example is in the examples/ directory.

  • LaTeX document example.tex
\documentclass{article}

\usepackage{citation-style-language}
\cslsetup{style = apa}
\addbibresource{example.json}  % or example.bib or example.yaml

\begin{document}

\cite{ITEM-1}
\printbibliography

\end{document}
  • For LuaTeX
lualatex example.tex
lualatex example.tex
  • For other TeX engines
pdflatex example.tex
citeproc-lua example.aux
pdflatex example.tex

Installation

The above example should work out-of-the-box with TeX Live 2022 or later version. If you want to install the GitHub develop version of this package, you may follow the steps below.

The citation-style-language requires the following packages: filehook, l3kernel, l3packages, lua-uca, lualibs, luatex, luaxml, and url. l3build is also required for actually performing the installation. Make sure they are already installed in the TeX distribution.

git clone https://github.com/zepinglee/citeproc-lua  # Clone the repository
cd citeproc-lua
git submodule update --init --remote                 # Fetch submodules
l3build install

These commands install the package files to TEXMFHOME which is usually ~/texmf on Linux or ~/Library/texmf on macOS. Besides, the citeproc-lua executable needs to be copied to some directory in the PATH environmental variable so that it can be called directly in the shell. For example provided ~/bin is in PATH:

cp citeproc/citeproc-lua.lua "~/bin/citeproc-lua"

To uninstall the package from TEXMFHOME:

l3build uninstall

License

The LaTeX package and Lua library are released under MIT license. The CSL locale files and styles are redistributed under the Creative Commons Attribution-ShareAlike 3.0 Unported license.

Related material