Open jjallaire opened 2 years ago
Simply to make it easier to see the issue without having to follow the whole thread, below the information about the generated tex file depending on the cite-method
It appears there is an issue (ot at least an undocumented behaviour in https://quarto.org/docs/authoring/footnotes-and-citations.html#bibliography-generation) when using
cite-method: natbib
(probably the same thing forcite-method: biblatex
), which can be replicated also with other formats such as https://github.com/quarto-journals/jss
default cite-method (i.e., Pandoc citeproc)
\hypertarget{references}{% \subsubsection*{References}\label{references}} \addcontentsline{toc}{subsubsection}{References} \hypertarget{refs}{} \begin{CSLReferences}{1}{0} \leavevmode\vadjust pre{\hypertarget{ref-CameronTrivedi2013}{}}% Cameron, A. Colin, and Pravin K. Trivedi. 2013. \emph{Regression Analysis of Count Data}. 2nd ed. Cambridge: Cambridge University Press. \end{CSLReferences}
natbib
\hypertarget{references}{% \subsubsection*{References}\label{references}} \addcontentsline{toc}{subsubsection}{References} \hypertarget{refs}{} \begin{CSLReferences}{0}{0} \end{CSLReferences}
and at the end
\bibliography{bibliography.bib} \end{document}
The LaTeX partial
biblio.tex
is added to the end, no matter ifrefs
div is set and where it is set. It's possible to manually move it (and remove the title with e.g.,\renewcommand{\bibsection}{}
) to make it look how it is supposed to. My guess is that it could be fixed in one of the pre/post processing scripts/filters used in Quarto.
Source: https://github.com/quarto-dev/quarto-cli/discussions/2009#discussioncomment-3439550
I believe using
::: {#refs}
:::
to place bibliography is a Pandoc Citeproc only feature. (https://pandoc.org/MANUAL.html#placement-of-the-bibliography)
I don't think this work in Pandoc itself when using --natbib
or --biblatex
. In those case, the LaTeX template will be used, with whichever content about natbib or biblatex is included.
So the difference between default pdf
format and the one in aft-pdf
made for the template is for me because of that : The demo format explicitly use a .bst
file for styling and --natbib
(https://github.com/quarto-journals/article-format-template/blob/main/_extensions/aft/_extension.yml#L26) and not Pandoc citeproc.
The question is here to me: Do we want to extend the bibliography placement feature from Pandoc citeproc to work also with other cite method by tweaking provided template, potentially building on our partial system ?
For quarto-journals
and any other custom format, one could change the default template using partials system or the whole template. That is what quarto-journals/aft-pdf
has done by tweaking the default pdf
format.
Hopefully the above makes sense.
The easy and faster solution is to better document the feature in https://quarto.org/docs/authoring/footnotes-and-citations.html#bibliography-generation by mentioning that it only works using citeproc.
The more long term solution should be, in my opinion, a filter that mimic citeproc workflow by adding the bibliography command where the refs div is and when using natbib/biblatex.
Just a note for future implementation - we could definitely detect this div in a filter (ensure that this is targeting PDF and not using citeproc) and insert the appropriate LaTeX in the div. We would then need to ensure we prevent the extra \bibliography
from being written by the template (perhaps by adding additional conditionality to the template itself or worst case trying to strip it in a post processor).
This is a little more of a can worms than I initially expected (it affects things like the positioning of backmatter and has some other negative interactions with the underlying latex template). I will have to give this some additional thought.
Discussed in https://github.com/quarto-dev/quarto-cli/discussions/2009
@dragonstyle You should read to the bottom of the discussion to see the clearest explanation of what the bug is.