diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dd051a6..6f14880c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- `latexmk` can automatically call citeproc-lua when compiling with `pdflatex` or `xelatex` (thanks to [John Collins](http://personal.psu.edu/~jcc8/)). + ## [v0.2.1] - 2022-09-18 ### Changed diff --git a/citeproc/citeproc-cli.lua b/citeproc/citeproc-cli.lua index a199c8e6..95800892 100644 --- a/citeproc/citeproc-cli.lua +++ b/citeproc/citeproc-cli.lua @@ -101,7 +101,7 @@ local function read_aux_file(aux_file) if match then bib_style = string.sub(match, 2, -2) else - match = string.match(line, "^\\bibdata%s*(%b{})") + match = string.match(line, "^\\csl@data%s*(%b{})") if match then for _, bib in ipairs(util.split(string.sub(match, 2, -2), "%s*,%s*")) do table.insert(bib_files, bib) diff --git a/example/README.md b/example/README.md index e577b33b..99b4715d 100644 --- a/example/README.md +++ b/example/README.md @@ -24,7 +24,7 @@ lualatex example.tex The `latexmk` can also be used. ```bash -latexmk -cd -lualatex -bibtex- example/example.tex +latexmk -cd -lualatex example/example.tex ``` For engines other than LuaLaTeX, the `citeproc` executable is required to run as BibTeX. diff --git a/latex/citation-style-language.sty b/latex/citation-style-language.sty index bc4acd29..cd3d0241 100644 --- a/latex/citation-style-language.sty +++ b/latex/citation-style-language.sty @@ -745,8 +745,11 @@ { \clist_put_right:Nn \l__csl_bib_resources_clist {#2} } +% In earlier time, \bibdata{xxx.json} was used but this causes latexmk unable +% to find xxx.json.bib and it refuses to run the $bibtex procedure. +% John Collins suggests using a different command than \bibdata. \clist_new:N \g__csl_aux_bib_files_clist -\cs_set:Npn \bibdata #1 +\cs_new:Npn \csl@data #1 { \clist_gput_right:Nn \g__csl_aux_bib_files_clist {#1} } @@ -759,7 +762,7 @@ \cs_new:Npn \__csl_write_aux_bibdata:n #1 { \if@filesw - \iow_now:Nx \@auxout { \token_to_str:N \bibdata {#1} } + \iow_now:Nx \@auxout { \token_to_str:N \csl@data {#1} } \fi }