Skip to content

Commit

Permalink
Adapt for latexmk
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Sep 23, 2022
1 parent f144d46 commit 95ea0e2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion citeproc/citeproc-cli.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions latex/citation-style-language.sty
Original file line number Diff line number Diff line change
Expand Up @@ -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} }


Expand All @@ -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
}

Expand Down

0 comments on commit 95ea0e2

Please sign in to comment.