zepinglee / citeproc-lua

A Lua implementation of the Citation Style Language (CSL) for use with LaTeX
MIT License
66 stars 8 forks source link

Error: attempt to get length of a nil value (field '?') #75

Closed kotobuki closed 2 months ago

kotobuki commented 3 months ago

Describe the bug After updating to v0.6.2, I can't compile the example with xelatex due to the error. If I comment the \chapter{Chapter} line, I can compile without the error.

Additional information

To Reproduce

\documentclass{book}

\usepackage[style=apa]{citation-style-language}
\usepackage{hyperref}

\addbibresource{example.json}

\begin{document}

\chapter{Chapter}

\section*{Section}

\cite{ITEM-1}

\nocite{ITEM-3}

\end{document}
xelatex example.tex
...
citeproc-lua example3.aux
This is citeproc-lua, Version 0.6.2
The top-level auxiliary file: example3.aux
Global style file: apa.csl
...exmf/scripts/citation-style-language/citeproc-engine.lua:744: attempt to get length of a nil value (field '?')
zepinglee commented 3 months ago

Thanks for your report! This bug was introduced when I was trying to fix #72.

zepinglee commented 2 months ago

This bug has been fixed in 4de9a65, which is already published to CTAN as v0.6.3.

julienleroux5 commented 2 months ago

Hi, I get the same error with v0.6.3 and with the lualatex engine, when trying to show two citations in two different chapters:

\documentclass{book}

\usepackage[style=elsevier-harvard]{citation-style-language}
\usepackage{hyperref}

\addbibresource{references}

\begin{document}

\chapter{Introduction}\label{introduction}

See \citet{knuth84} for additional discussion of literate programming.

\chapter{Summary}\label{summary}

In summary, this book has no content whatsoever \cite{knuth84}.

\chapter*{References}\label{references}

\printbibliography[heading=none]

\end{document}

giving this error:

...dist/scripts/citation-style-language/citeproc-engine.lua:755: attempt to get length of a nil value (field '?')
stack traceback:
        ...dist/scripts/citation-style-language/citeproc-engine.lua:755: in method 'get_preceding_cite_item'
        ...dist/scripts/citation-style-language/citeproc-engine.lua:708: in method 'set_cite_item_position'
        ...dist/scripts/citation-style-language/citeproc-engine.lua:647: in method 'get_tainted_citation_ids'
        ...dist/scripts/citation-style-language/citeproc-engine.lua:585: in method 'process_citation'
        ...ist/scripts/citation-style-language/citeproc-manager.lua:502: in method 'cite'
        [\directlua]:1: in main chunk.
\lua_now:e #1->\__lua_now:n {#1}
zepinglee commented 2 months ago

Hi, I get the same error with v0.6.3 and with the lualatex engine, when trying to show two citations in two different chapters:

Thanks for your bug report and I can reproduce it. I'll move further discussion to a new issue.