Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The location of references list is not assigned by #refs block #6867

Closed
XiangyunHuang opened this issue Sep 18, 2023 · 10 comments · Fixed by #7621
Closed

The location of references list is not assigned by #refs block #6867

XiangyunHuang opened this issue Sep 18, 2023 · 10 comments · Fixed by #7621
Assignees
Labels
books bug Something isn't working citations Issues with citations latex LaTeX engines related libraries and technologies
Milestone

Comments

@XiangyunHuang
Copy link

Bug description

The location of references list is not assigned by #refs block

Steps to reproduce

Step 1: create book project

quarto create-project mybook --type book

Step 2: modify _quarto.yml as follow

I add an appendix after the references.

project:
  type: book

book:
  title: "mybook"
  author: "Norah Jones"
  date: "9/17/2023"
  chapters:
    - index.qmd
    - intro.qmd
    - references.qmd
  appendices:
    - summary.qmd

bibliography: references.bib

format:
  html:
    theme: cosmo
  pdf:
    documentclass: book
    keep-tex: true

Expected behavior

The references's location is assigned by #refs block.

Actual behavior

The following block doesn't work when output is pdf.

::: {#refs}
:::

the location of references list is not assigned by #refs block

截屏2023-09-18 09 00 39

references append to appendix.

截屏2023-09-18 08 59 18

Your environment

  • RStudio 2023.06.2+561 "Mountain Hydrangea" Release (de44a3118f7963972e24a78b7a1ad48b4be8a217, 2023-08-25) for macOS
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.06.2+561 Chrome/110.0.5481.208 Electron/23.3.0 Safari/537.36
  • macOS 13.5.2 (22G91)

Quarto check output

quarto check

Quarto 1.4.369
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.8: OK
      Dart Sass version 1.55.0: OK
      Deno version 1.33.4: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.369
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (external install)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/xiangyun/Library/TinyTeX/bin/universal-darwin
      Version: 2023

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.5
      Path: /usr/local/opt/python@3.11/bin/python3.11
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.3.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library
      knitr: 1.44
      rmarkdown: 2.24

[✓] Checking Knitr engine render......OK


@XiangyunHuang XiangyunHuang added the bug Something isn't working label Sep 18, 2023
@cscheid cscheid added this to the v1.4 milestone Sep 18, 2023
@cscheid cscheid added the books label Sep 18, 2023
@cscheid
Copy link
Collaborator

cscheid commented Sep 18, 2023

Thanks for the report! I can repro the issue as described.

@XiangyunHuang
Copy link
Author

@cscheid I re-test the above minimal example with Quarto 1.4.367 and Quarto 1.4.366, and find that Quarto 1.4.366 is ok while Quarto 1.4.367 is not ok.

@cderv
Copy link
Collaborator

cderv commented Sep 20, 2023

@cscheid it seems it comes from #6620 (8ba05ff) - verified with a git bisect but can't access the detailled commit that fails because it was squashed.

A bit surprised as this should be a Pandoc feature directly (https://pandoc.org/MANUAL.html#placement-of-the-bibliography) - so not sure how we have messed with it. You know best the changes

@XiangyunHuang
Copy link
Author

Here is a minimal example, and I find that Pandoc's side is ok.

---
title: "This is the title"
author: "Author One"
documentclass: book
link-citations: true
colorlinks: true
toc: true
numbersections: true
---

# chapter

## section

**knitr** [@Xie2015] is a general-purpose package for dynamic report generation in R.

# references {.unnumbered}

::: {#refs}
:::

\appendix

# appendix

Hello

Create PDF from markdown with

# Pandoc 3.1.8
quarto pandoc --citeproc --pdf-engine xelatex -t pdf \
  --bibliography=refer.bib \
  --standalone \
  -f markdown refer-test.md \
  -o refer-test.pdf

file refer.bib as follow:

@Book{Xie2015,
  title = {Dynamic Documents with {R} and knitr},
  author = {Yihui Xie},
  publisher = {Chapman and Hall/CRC},
  address = {Boca Raton, Florida},
  year = {2015},
  edition = {2nd},
  note = {ISBN 978-1498716963},
  url = {https://yihui.org/knitr/},
}

refer-test.pdf

@cscheid
Copy link
Collaborator

cscheid commented Sep 20, 2023

verified with a git bisect but can't access the detailled commit that fails because it was squashed.

Yes, that's unfortunately but our codebase isn't at a state where we could have done the crossref work in clean bisectable commits, and merging would have made bisecting even harder.

@EllaKaye
Copy link

EllaKaye commented Nov 8, 2023

Hello. Commenting to follow here because I'm experiencing a similar issue with v1.4.487. My version of a reprex for this is at https://github.com/EllaKaye/book-bug

@XiangyunHuang
Copy link
Author

#7432 is a similar issue.

@andrewheiss
Copy link

Chiming in to say I'm running into the same problem with 1.4.504, but (1) in a standalone document, not a book, and (2) only in PDFs. It works fine and as expected with HTML:

---
title: "References location"
format:
  html: default
  pdf:
    keep-tex: true

references:
- type: article-journal
  id: Lovelace1842
  author:
  - family: Lovelace
    given: Augusta Ada
  issued:
    date-parts:
    - - 1842
  title: >-
    Sketch of the analytical engine invented by Charles Babbage, by LF Menabrea, 
    officer of the military engineers, with notes upon the memoir by the translator
  container-title: Taylor’s Scientific Memoirs
  volume: 3
  page: 666-731
  language: en-GB
---

## Some section

@Lovelace1842

## Another section

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor 
incididunt ut labore et dolore magna aliqua.

## References

::: {#refs}
:::

## Appendix

Blah.

In HTML it's great:

image

In LaTeX the references appear at the end:

image

For a long time this evening, I thought it was a floating issue—I had tables in my appendix and I figured they were behaving strangely with the references—so I'm glad I found this issue! It made me check the tex output, which sticks the references at the end, leaving the references subsection empty

\subsection{Another section}\label{another-section}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.

\subsection{References}\label{references}

\subsection{Appendix}\label{appendix}

Blah.

\phantomsection\label{refs}
\begin{CSLReferences}{1}{0}
\bibitem[\citeproctext]{ref-Lovelace1842}
Lovelace, Augusta Ada. 1842. {``Sketch of the Analytical Engine Invented
by Charles Babbage, by LF Menabrea, Officer of the Military Engineers,
with Notes Upon the Memoir by the Translator.''} \emph{Taylor's
Scientific Memoirs} 3: 666--731.

@cderv
Copy link
Collaborator

cderv commented Nov 17, 2023

Thanks a lot for the report.

This is an issue in our Lua filter chain. @cscheid I believe this comes from #6952 to fix something for beamer.

Div = function(div)
-- only flatten out divs that have no classes or attributes
-- (see https://github.com/quarto-dev/quarto-cli/issues/6936)
if #div.classes == 0 and #div.attributes == 0 then
return div.content
end

This filters does flatten div with only identifiers like

::: {#refs}
:::

which breaks the Pandoc reference position feature (because no more div of id refs when citeproc runs).

This filters applies on LaTeX output only, hence why it works with HTML

Easy fix is to test also for idenfier.

@cderv cderv added latex LaTeX engines related libraries and technologies citations Issues with citations labels Nov 17, 2023
cderv added a commit that referenced this issue Nov 17, 2023
Otherwise #refs div for positionning does not work

This complements #6952 to fix  #6936

fix #6867
@cderv cderv self-assigned this Nov 17, 2023
@andrewheiss
Copy link

Ah, great!

As a temporary workaround, this is fixable by adding a class to the refs div so that it doesn't get flattened:

## References

::: {#refs .blah}
:::

But that's just until #7621 happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
books bug Something isn't working citations Issues with citations latex LaTeX engines related libraries and technologies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants