zepinglee / citeproc-lua

A Lua implementation of the Citation Style Language (CSL)
MIT License
62 stars 7 forks source link

Bug with AZR CSL Style: context.lua:70: attempt to index a nil value (field 'cite') #39

Closed daniel-eder closed 1 year ago

daniel-eder commented 1 year ago

Describe the bug When trying to buid a .tex file using the example bib of the AZR csl style I run into the error "context.lua:70: attempt to index a nil value (field 'cite')".

The sample bib can be found here: https://github.com/PhilippTh/austrian-legal-citation-style/blob/master/Beispiele/Beispiele.bib In the below tex file the content is in a file "min.bib". The current official csl for AZR can be found here: https://github.com/citation-style-language/styles/blob/master/azr-abkurzungs-und-zitierregeln-der-osterreichischen-rechtssprache-und-europarechtlicher-rechtsquellen.csl In the below example it is placed as "acr.csl" next to "example.tex"

The error does not happen for all bib entries. zankl_kunstliche_2019 works, while schweighofer_rechtsinformatik_1999 causes the error. A handful of other entries seem to work, while most others also cause it.

When clearing out the bib file and leaving e.g only schweighofer_rechtsinformatik_1999 the issue remains.

For all entries that the error does not happen a correct pdf is created when running lualatex example.tex twice.

Additional information

To Reproduce

\documentclass{article}

\usepackage{citation-style-language} 
\usepackage{hyperref}

\addbibresource{min.bib}
\cslsetup{style = azr}

\newcommand\cs[1]{\texttt{\textbackslash #1}}
\pagestyle{empty}
\setlength{\parindent}{0pt}

\begin{document}

\section*{The standard \cs{cite} command}

\cite{schweighofer_rechtsinformatik_1999}

% Print the reference list
\printbibliography

\end{document}

Screenshots N/A

zepinglee commented 1 year ago

Thanks for your feedback and I can reproduce the bug. It's mainly because there is a <text variable="locator"> in the <bibliography>.

Fixed in 0afdf91.

daniel-eder commented 1 year ago

You are a lifesaver! Many thanks. Will the issue close on next release or should I close it?

zepinglee commented 1 year ago

Just find your test case doesn't work with pdflatex. I'll fix it before making a release to CTAN.

You can close the issue when your local build passes.