Skip to content

Issue with custom float numbering with non-uniquereference-prefix #13522

@maia-sh

Description

@maia-sh

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide

Bug description

I have a Quarto document with multiple Custom Float Cross-Reference Types which share the same reference-prefix. I do this to be able to restart numbering while keeping the same prefix. My specific use-case is an academic paper with multiple supplements which need independently numbered figures and tables, similar to Example: Supplemental Figures. In other words, tables in the main paper with key tbl and prefix Table should start at "Table 1"; tables in supplement a with key supptbla and prefix Table should start at "Table 1"; tables in supplement b with key supptblb and prefix Table should start at "Table 1", etc.

This desired behavior worked in a previous Quarto version (I unfortunately don't know which, but 1.4.something) and not in the current version (see below). However, the Quarto documentation does not say reference-prefix must be unique, so I believe this is a bug.

I get a warning of the following format: WARNING (/Applications/quarto/share/filters/main.lua:3224) ref type 'tbl' does not match category ref type 'supptbla'. Looking into that section of the lua shows:

--[[
Return the ref type ("tbl", "fig", etc) for a given FloatRefTarget custom AST element.
]]
---@param float table # the FloatRefTarget element
---@return string # ref type for the given float
function ref_type_from_float(float)
  local category = crossref.categories.by_name[float.type]
  if category == nil then
    fail("unknown float type '" .. float.type .. "'");
    return ""
  end
  local result = refType(float.identifier)
  if result ~= nil and result ~= category.ref_type then
    warn("ref type '" .. result .. "' does not match category ref type '" .. category.ref_type .. "'");
  end
  return category.ref_type
end

I am not familiar enough with lua to debug further.

Steps to reproduce

---
title: "Quarto reference-prefix issue"
format: html
crossref:
  custom:
    - kind: float
      reference-prefix: Table
      key: supptbla
    - kind: float
      reference-prefix: Table
      key: supptblb
---

# Main Text {.unnumbered}

The available animals are in @tbl-animals.

::: {#tbl-animals}
| animal | number |
|--------|--------|
| dogs   | 2      |
| cats   | 1      |

Animals
:::

See [Supplement @sec-dogs] @supptbla-color to learn about the dogs' colors.
See [Supplement @sec-cats] @supptblb-color to learn about the cats' colors.

# Supplements {.unnumbered}

# Supplement about dogs {#sec-dogs}

::: {#supptbla-color}
| dog   | color  |
|-------|--------|
| daisy | golden |
| bobby | brown  |

Dogs
:::

# Supplement about cats {#sec-cats}

::: {#supptblb-color}
| dog   | color  |
|-------|--------|
| missy | black |

Cats
:::

Actual behavior

Image

Expected behavior

Image

Your environment

-IDE: RStudio 2025.09.1+401
-OS: macOS 15.7.1

Quarto check output

Quarto 1.7.13
[✓] Checking environment information...
      Quarto cache location: /Users/maia/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.7.13
      Path: /Applications/quarto/bin

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

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

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

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

[✓] Checking Python 3 installation....OK
      Version: 3.9.6
      Path: /Library/Developer/CommandLineTools/usr/bin/python3
      Jupyter: (None)

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

[✓] Checking R installation...........OK
      Version: 4.5.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
      knitr: 1.50
      rmarkdown: 2.30

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcrossref

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions