Wandmalfarbe / pandoc-latex-template

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
BSD 3-Clause "New" or "Revised" License
6.13k stars 959 forks source link

Fatal problem with citeproc in Pandoc 3.1.8. and Eisvogel 2.4.1: "... missing \item." #361

Closed mfhepp closed 10 months ago

mfhepp commented 1 year ago

When I try to use the latest Eisvogel template 2.4.1 with Pandoc 3.1.8 on a Debian bookworm platform with TeX Live 2022 (texlive-full from apt), Markdown documents with references fail to compile to PDF.

pandoc citations.md -o citations-eisvogel.pdf --from markdown --citeproc --template /foo/bar/eisvogel/eisvogel.latex

Error producing PDF.
! LaTeX Error: Something's wrong--perhaps a missing \item.

They compile flawlessly with the default Pandoc 3.1.8 LaTeX template:

pandoc citations.md -o citations-default.pdf --from markdown --citeproc

My guess is that the problem is related to a change in the Pandoc LaTeX template in release 3.1.7, because there it says:

Use \cite and \bibitem to link up citations, even with citeproc. (#9031). This will give us better accessibility; when tagging is enabled, the citation can be linked to the bibliography entry. This changes some of the details of the layout and the default template. We now make CSLReferences a special enumitem list that will contain \bibitems. Internal links inside citations to ids beginning in ref- are creating using \cite instead of \hyperref.

For better debugging, I created intermediate .tex documents as follows:

citations-eisvogel.tex:

pandoc citations.md -o citations-eisvogel.tex --from markdown --citeproc --template /foo/bar/eisvogel/eisvogel.latex

citations-default.tex:

pandoc citations.md -o citations-default.tex --from markdown --citeproc

I attach the Markdown source and the resulting intermediate *.tex files (*.tex as *.tex.txt due to Github):

mfhepp commented 1 year ago

I just tried with the latest version from Github (commit 8c48a175e2f5274858f6ea9fd3e56d8a60dd5c66), which includes https://github.com/Wandmalfarbe/pandoc-latex-template/pull/358; the effect is unchanged.

Also, note that the change from Pandoc 3.1.7 wrt to the LaTeX writer has been reverted.

mfhepp commented 1 year ago

Addition: I tried going back to Eisvogel 2.4.0 and 2.3.0, to no avail. Only the error message changes slightly to

Error producing PDF.
! LaTeX Error: Lonely \item--perhaps a missing list environment.
cagix commented 1 year ago

the eisvogel template is a modified variant of pandoc's default latex template. it seems, that it needs to be synchronised again.

@Wandmalfarbe i wonder if it would be possible to rewrite this template into tex snippets to be used with the --include-xxx options and pandoc's default latex template? this could eliminate the need to rebase your work as soon as the pandoc project changes something in the template?

mfhepp commented 1 year ago

the eisvogel template is a modified variant of pandoc's default latex template. it seems, that it needs to be synchronised again.

@Wandmalfarbe i wonder if it would be possible to rewrite this template into tex snippets to be used with the --include-xxx options and pandoc's default latex template? this could eliminate the need to rebase your work as soon as the pandoc project changes something in the template?

Yes, that would be very good (but likely means major work). Quarto is using a similar approach in the hope of more stable customized templates.

cryptax commented 11 months ago

I have the same issue with Pandoc 3.1.8 and Eisvogel 2.4.1

Error producing PDF.
! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.407 \bibitem[\citeproctext]{ref-flutterdev}

Where the bibliography entry is complete and correct AFAIK. I even added a dummy author entry, just to make sure.

@misc{flutterdev,
    title        = {Flutter},
    author       = {A},
    year         = 2023,
    url          = {https://flutter.dev},
    note         = {Online; accessed 16-October-2023},
    howpublished = {\url{https://flutter.dev}}
}

FYI, I tried with an even older eisvogel.latex template, and it did not work. The error message is slightly different, but the issue is still the citation:

Error producing PDF.
! Undefined control sequence.
l.399 This is a ref (\citeproc
davidmehren commented 11 months ago

I opened https://github.com/Wandmalfarbe/pandoc-latex-template/pull/364, which imports changes from the latest upstream LaTeX template. This fixes compilation with Pandoc 3.1.8.

mfhepp commented 10 months ago

Thanks a lot!

FYI: I have not yet been able to test if this fixes my issues, as I am using a custom Debian 12-based environment in Docker with texlive-full as the TeX environment, which seems to miss a few relevant packages. And as Debian 12 is still with TeX Live 2022, it is non-trivial to add missing LaTeX components :-(.

But I trust in the others in here that the underlying issue is solved.

Again, a huge thanks to @Wandmalfarbe and @davidmehren !