Skip to content

Float crossrefs with unlabeled subfloats #2492

@rgaiacs

Description

@rgaiacs

Bug description

Consider the following minimal working example

---
title: "MWE"

format:
  pdf:
    documentclass: article
    pdf-engine: xelatex
    keep-tex: true
---

Figures

::: {#fig-elephants layout-ncol="2"}

![Surus](elephant.png)

![Hanno](elephant.png)

Famous Elephants
:::

It produces

Screenshot from 2022-09-19 10-05-42

Note that the subfigures are label as normal figures. The LaTeX produced by Quarto is

\begin{figure}

\begin{minipage}[t]{0.50\linewidth}

{\centering 

\raisebox{-\height}{

\includegraphics{elephant.png}

}

\caption{Surus}

}

\end{minipage}%
%
\begin{minipage}[t]{0.50\linewidth}

{\centering 

\raisebox{-\height}{

\includegraphics{elephant.png}

}

\caption{Hanno}

}

\end{minipage}%

\caption{\label{fig-elephants}Famous Elephants}

\end{figure}

Now compare the minimal working example with a patched version of it that has cross reference information.

---
title: "MWE"

format:
  pdf:
    documentclass: article
    pdf-engine: xelatex
    keep-tex: true
---

Figures

::: {#fig-elephants layout-ncol="2"}

![Surus](elephant.png){#fig-surus}

![Hanno](elephant.png){#fig-hanno}

Famous Elephants
:::

It produces

Screenshot from 2022-09-19 10-09-03

Note that the subfigures are label properly. The LaTeX produced by Quarto is

\begin{figure}

\begin{minipage}[t]{0.50\linewidth}

{\centering 

\raisebox{-\height}{

\includegraphics{elephant.png}

}

}

\subcaption{\label{fig-surus}Surus}
\end{minipage}%
%
\begin{minipage}[t]{0.50\linewidth}

{\centering 

\raisebox{-\height}{

\includegraphics{elephant.png}

}

}

\subcaption{\label{fig-hanno}Hanno}
\end{minipage}%

\caption{\label{fig-elephants}Famous Elephants}

\end{figure}

Would be great if Quarto can generate a cross reference information for the subfigures so that users avoid experience the issue reported in the minimal working example.

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcrossref

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions