pbs-assess / csasdown

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

References end up in wrong location with recent pandoc #255

Closed seananderson closed 6 months ago

seananderson commented 6 months ago

Tested on resdocs. Run the basic unit test: https://github.com/pbs-assess/csasdown/blob/e909aa5cfdd60445bdbd39af0b10383f927c512d/tests/testthat/test-render-resdoc.R#L18-L24

Output:

image

Expectation: Bibliography is positioned after the references header before the appendices.

Confirmed to happen with pandoc 3.1.12.3. Does not happen with 3.1.1 (baked into RStudio).

Any fix will have to detect the pandoc version, I assume.

jdunic commented 6 months ago

The bibliography position is correct as of pandoc 3.1.6.2 and no longer works as of pandoc 3.1.8 (3.1.7 unsupported).

seananderson commented 6 months ago

Thanks for the detective work, @jdunic! Fixed.

hypertarget{refs}{}

in pandoc < 3.1.7/8 becomes

\phantomsection\label{refs}

in pandoc >= 3.1.7/8