rjournal / rjtools

Tools for AUTHORS to use for checking and submitting articles to the R Journal
https://rjournal.github.io/rjtools/
Other
31 stars 14 forks source link

LaTeX error with CSLReferences in Pandoc >= 3.1.7 #117

Open bastistician opened 10 months ago

bastistician commented 10 months ago

rmarkdown::render()ing the article template fails when using recent versions of Pandoc (>= 3.1.7), presumably due to changes in its LaTeX writer with respect to the CSLReferences environment.

With Pandoc 3.1.7, the error is (as previously reported in #113)

! Undefined control sequence.
<argument> \cslentryspacing 

l.84 \setlength{\cslentryspacing}{0em}

With Pandoc 3.1.8 to 3.1.11.1 (current) the error is

! LaTeX Error: Lonely \item--perhaps a missing list environment.

In Pandoc 3.1.6.2, the LaTeX writer had produced, e.g.,

\leavevmode\vadjust pre{\hypertarget{ref-crosstalk}{}}%

to open a new bib item, whereas it now (Pandoc >= 3.1.7) produces

\bibitem[\citeproctext]{ref-crosstalk}

This is incompatible with the outdated definition of CSLReferences in RJwrapper.tex. See the changes in Pandoc's default LaTeX template between 3.1.6.2 and 3.1.11.1.

dicook commented 10 months ago

Thanks! We need to update csl to better match the referencing between pdf and html versions. So this is extra motivation to work on that.

ngreifer commented 5 months ago

Should anyone else spend hours upon hours finding a solution, mine was to run

pandoc::with_pandoc_version(
    version = '3.1.6.2',
    rmarkdown::render('article.Rmd')
)

Thanks for the lead @bastistician.

BerriJ commented 3 months ago

This seems related to: https://github.com/Wandmalfarbe/pandoc-latex-template/issues/361 They fixed the problem here: https://github.com/Wandmalfarbe/pandoc-latex-template/pull/364/files