munepi / citeproc-lua

A Lua implementation of the Citation Style Language (CSL)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

citeproc-lua

CTAN GitHub release GitHub commits

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 example/ directory.

  • LaTeX document example.tex
\documentclass{article}

\usepackage{citation-style-language}
\cslsetup{style = apa}
\addbibresource{example.bib}

\begin{document}

\cite{ITEM-1}
\printbibliography

\end{document}
  • Compiling with LuaTeX
lualatex example.tex
lualatex example.tex
  • Compiling with 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

About

A Lua implementation of the Citation Style Language (CSL)

License:MIT License


Languages

Language:Lua 85.7%Language:TeX 9.5%Language:Python 4.5%Language:Shell 0.3%Language:Makefile 0.0%Language:Perl 0.0%