Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate citekeys discard bibliography #14

Closed
michal-h21 opened this issue May 4, 2022 · 3 comments
Closed

Duplicate citekeys discard bibliography #14

michal-h21 opened this issue May 4, 2022 · 3 comments

Comments

@michal-h21
Copy link
Contributor

When you have duplicate citekyes in the bibliography source file, Citeproc issues runtime error:

Module csl Error: Duplicate entry key "texbook" in "examples.bib". on input line 7

stack traceback:
        [C]: in function 'error'
        ...ocal/texlive/2022/texmf-dist/tex/latex/base/ltluatex.lua:110: in field 'module_error'
        ...ichal/texmf/scripts/citation-style-language/csl-core.lua:21: in function 'csl-core.error'
        ...ichal/texmf/scripts/citation-style-language/csl-core.lua:115: in upvalue 'read_data_files'
        ...ichal/texmf/scripts/citation-style-language/csl-core.lua:126: in function 'csl-core.make_citeproc_sys'
        ...ichal/texmf/scripts/citation-style-language/csl-core.lua:162: in function 'csl-core.init'
        /home/michal/texmf/scripts/citation-style-language/csl.lua:34: in function 'csl.init'
        [\directlua]:1: in main chunk.
\lua_now:e #1->\__lua_now:n {#1}
                                 
l.7 \begin{document}
                   

What is worse, processing of the bibliography and in-text citations fails, nothing is produced. I've found this thanks to this question on TeX.sx.

Here is a MWE:

\documentclass{article}

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

\begin{document}

\cite{texbook}
\printbibliography

\end{document}

examples.bib:

@book{texbook,
  author = {Donald E. Knuth},
  year = {1986},
  title = {The {TeX} Book},
  publisher = {Addison-Wesley Professional}
}

@book{texbook,
  author = {Donald E. Knuth},
  year = {1986},
  title = {The {TeX} Book},
  publisher = {Addison-Wesley Professional}
}


@bdarcus
Copy link

bdarcus commented May 5, 2022

Notwithstanding error handling, technically a bib file with duplicate keys is invalid. So citeproc-lua should throw an error?

@michal-h21
Copy link
Contributor Author

Sure, it is invalid, so warning or error message would be fine.

@zepinglee
Copy link
Owner

The package follows BibTeX which raises an error in case of repeated keys. Since it's run inside LuaTeX, the error blocks the TeX interpreter and causes empty output.

The BibTeX error message:

Repeated entry---line 8 of file examples.bib
 : @book{texbook
 :              ,
I'm skipping whatever remains of this entry

Biber only given warnings in such cases:

WARN - Duplicate entry key: 'texbook' in file 'examples.bib', skipping ...

I suppose warning messages would be enough for duplicate entry keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants