quarto-dev / quarto-dev/quarto-cli

Citation order within brackets affects citation grouping

Open
#11,971 14 comments 0 reactions 1 assignee View on GitHub

@cderv is already working on this.

Since Jan 30, 2025.

bug citations pandoc
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

This issue is triggered under very specific conditions. I tried to reduce the problem as much as possible, and a reproducible example is available in this repository: https://github.com/apcamargo/quarto-citations-bug

In certain cases, multiple citations within square brackets fail to group correctly in the resulting HTML (see the first line of the screenshot below). Through testing, I identified that this issue is triggered, in this specific example, when the following conditions are met:

  1. The text preceding the citations is highlighted using quarto-highlight-text.
  2. The text preceding the citations is enclosed in parentheses ().
  3. The word Figures is used instead of Figure.
  4. The citations within the square brackets are in a specific order. In this case: [@soto_perez_crispr_cas_2019; @gregory_gut_2020; @nayfach_metagenomic_2021] or [@soto_perez_crispr_cas_2019; @nayfach_metagenomic_2021; @gregory_gut_2020].
Image
Steps to reproduce
git clone git@github.com:apcamargo/quarto-citations-bug.git
cd quarto-citations-bug.git
quarto preview
Expected behavior

Citations within square brackets should be grouped regardless of the order of the citations or the text preceding the opening of the brackets.

Actual behavior

The text preceding the citations as well as the order of citations within the square brackets can prevent citations from being grouped.

Your environment
  • IDE: Positron Version: 2025.01.0 (Universal) build 39
  • OS: macOS 15.2 (24C101)
Quarto check output
Quarto 1.6.40
[✓] Checking environment information...
      Quarto cache location: /Users/APCamargo-M55/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.6.40
      Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

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

[✓] Checking Python 3 installation....OK
      Version: 3.9.20 (Conda)
      Path: /Users/APCamargo-M55/.mambaforge/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with conda install jupyter

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.