pbs-assess / csasdown

:book: An R package for creating CSAS reports in PDF or Word format with R Markdown and bookdown
Other
47 stars 17 forks source link

Tech report failing to build due to error from reference section #237

Closed clayton33 closed 1 year ago

clayton33 commented 1 year ago

Describe the bug Tech report unable to build, appears to be associated with reference section.

To Reproduce

  1. Run `csasdown::draft("resdoc")
  2. Knit the document.
  3. See error :
    
    ! LaTeX Error: Something's wrong--perhaps a missing \item.

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

l.688 \end{CSLReferences}

in `techreport.log`.

**Expected behavior**
It creates a `.pdf` file.

**Observed behavior**
It is not building due to above LaTeX error.

**Desktop (please complete the following information):**
 - Operating system: Windows
 - R version: `R version 4.2.1 (2022-06-23 ucrt)`
 - csasdown version: `‘0.1.0’`
 - LaTeX version : I just updated it as it notified me that there was an update, it was also not working on previous version of LaTeX. I'm not sure what my previous version was.

tlmgr revision 66798 (2023-04-08 02:15:21 +0200) tlmgr using installation: C:/Users/laytonc/AppData/Roaming/TinyTeX TeX Live (https://tug.org/texlive) version 2023

seananderson commented 1 year ago

This is due to the pandoc version and this issue. The templates are set up to work with the latest pandoc (3.1.8), but now evidently fail with older pandoc versions. You can check with:

rmarkdown::pandoc_version()

The simplest solution might be to check the pandoc version when we render and pick an appropriate version of the .sty files. That's not ideal because we will have twice the .sty files for a while. The alternative, a bunch of regular expressions, doesn't seem ideal either. Maybe the regular expressions wouldn't be too bad we surrounded the options in some tag that's easy to detect?

seananderson commented 1 year ago

So I don't forget, the code as of this commit was actually working with pandoc 3.1.7. Version 3.1.8 changed the templates again! https://github.com/jgm/pandoc/releases/tag/3.1.8

seananderson commented 1 year ago

As of a commit I just pushed, rendering should work with old and current pandoc versions. @clayton33 can you report back if this is working for you?

clayton33 commented 1 year ago

Works for me, thanks. I'll close this, but feel free to re-open.