Skip to content

Figure numbering for multiple figures not as subfigures #12167

Open
@kandolfp

Description

@kandolfp

Bug description

The referencing for figures that are not subfigures but multiple figures defined via a single computation is not working as expected. The label always points to the last figure and extending the label with -1, -2 as for subfigures is not working.

Steps to reproduce

--- 
title: "foo"
---

Example form the [docs](https://quarto.org/docs/authoring/figures.html#layout):

```{python}
#| label: fig-test
#| layout-ncol: 2
#| fig-cap: 
#|   - "Line Plot 1"
#|   - "Line Plot 2"

import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()

plt.plot([8,65,23,90])
plt.show()
```

Referencing the different Figures is not working correctly

- `@fig-test`: @fig-test
- `@fig-test-1`: @fig-test-1
- `@fig-test-1`: @fig-test-2
              

Actual behavior

I run:

quarto render file.qmd --to pdf

Starting python3 kernel...Done

Executing 'file.quarto_ipynb'
  Cell 1/1: 'fig-test'...Done

pandoc 
  to: latex
  output-file: file.tex
  standalone: true
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  
metadata
  documentclass: scrartcl
  classoption:
    - DIV=11
    - numbers=noendperiod
  papersize: letter
  header-includes:
    - \KOMAoption{captions}{tableheading}
  block-headings: true
  title: foo
  
WARNING (/tmp/quartobug/.venv/lib/python3.12/site-packages/quarto_cli/share/filters/main.lua:13878) Unable to resolve crossref @fig-test-1
WARNING (/tmp/quartobug/.venv/lib/python3.12/site-packages/quarto_cli/share/filters/main.lua:13878) Unable to resolve crossref @fig-test-2

Rendering PDF
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023/Debian) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
running xelatex - 2
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023/Debian) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  

Output created: file.pdf

The label with no extension references the second figure, the two other labels do not exist.

Expected behavior

I expected a table with different labels. The first is ambiguous and (in my opinion) should not provide a result. The second and third line should reference the two figures.

If I do the same with html as output both figures have <div id="fig-test"

Your environment

  • Ubuntu 24.04
  • Quarto > 1.6.40 (tested also with latest build on github)

Quarto check output

quarto check
Quarto 1.7.3
[✓] Checking environment information...
      Quarto cache location: ~/.cache/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.7.3
      Path: /tmp/quartodebug/.venv/lib/python3.12/site-packages/quarto_cli/quarto-1.7.3/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/bin
      Version: 2023

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.3
      Path: /tmp/quartodebug/.venv/bin/python3
      Jupyter: 5.7.2
      Kernels: python3

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

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

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions