quarto-dev / quarto-dev/quarto-cli

Incorrect Subcaption Numbering in Figures for PDF Output

Open
#11,293 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug crossref latex layout needs-discussion
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

When plotting multiple figures in a single chunk with parameters such as layout-ncol: 3 and fig-subcap, the subcaption numbering is incorrect in the PDF output. All subcaptions start with "a)" instead of incrementing as expected ("a)", "b)", "c)", etc.).

Steps to reproduce

Create and render this document to PDF.

---
title: "Test subcaption"
author: "me"
format: 
  pdf:
    keep-tex: true
  html: default
---

::: {.callout-note appearance="default"}
test
:::

::: {.callout-important appearance="simple"}
here come some plots
:::

```{r}
#| layout-ncol: 3
#| fig-subcap: 
#|   - This
#|   - is a
#|   - test
x <- c(1:100)
y <- x+x+2
plot(x, y)
hist(y, breaks=5)
barplot(table(x,y))

Or use minimal example here https://github.com/produnis/minimal_examples/tree/subcaption

Expected behavior

The 3 figures are numbered "a)", "b)", "c)"

Actual behavior

The 3 figures are numbered as "a)" "a)" "a)".

Your environment

archlinux, quarto 1.6.32 and 1.5.57

Quarto check output
$ quarto check
Quarto 1.6.32
[✓] Checking environment information...
      Quarto cache location: /home/produnis/.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.6.32
      Path: /opt/quarto/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /sbin
      Version: undefined

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.7
      Path: /sbin/python3
      Jupyter: (None)

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

[✓] Checking R installation...........OK
      Version: 4.4.2
      Path: /usr/lib64/R
      LibPaths:
        - /home/produnis/R/x86_64-pc-linux-gnu-library/4.4
        - /usr/lib/R/library
      knitr: 1.48
      rmarkdown: 2.27

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

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.

Research direction

Start with the linked minimal example and render it to PDF using the reported Quarto setup, keeping the generated TeX. Inspect the PDF and generated TeX around the three figure subcaptions, then trace the relevant Quarto rendering path. Done means the three captions are labeled "a)", "b)", and "c)" instead of repeating "a)".

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, latex, r
Domain
build-system, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.