Adding Supplementary figures via embed shortcode #13734
-
DescriptionHello Quarto team I have been trying to use the custom reference and embed features to write a manuscript with supplementary figures. Perhaps the way I am trying is not the intended one, as I am getting an incorrect rendering of my document here a small example in main.qmd ---
title: "Supplementary figures"
author: "Juan"
format: html
crossref:
custom:
- kind: float
key: suppfig
latex-env: suppfig
reference-prefix: Figure S
space-before-numbering: false
latex-list-of-description: Supplementary Figure
---
This is an embedded figure from a code chunk
{{< embed notebook.qmd#fig-example >}}
but if I use a div, it is loaded as a subfigure (note the *(a)*)
::: {#suppfig-example}
{{< embed notebook.qmd#fig-example >}}
:::
in notebook.qmd ---
title: "notebook"
format: html
---
```{r}
#| label: fig-example
#| fig-cap: "this is an example figure"
x <- seq(1,10, 0.05)
plot(x, sin(x)+cos(x^2), type = "l")
```when rendering to html, I obtain this at the end of my document
note the (a) placed below, and below it it is the caption for Figure S1. It seems the embedded figure is loaded as a subfigure, while the actual suppfig caption is empty. Additionally, rendering the document to pdf gives me this error Looking at the generated tex, I obtain this % I did not copy the front matter to make it more readable
\begin{document}
\maketitle
This is an embedded figure from a code chunk
\begin{figure}
\centering{
\pandocbounded{\includegraphics[keepaspectratio]{test_files/figure-latex/notebook-fig-example-output-1.png}}
}
\caption{\label{fig-example}this is an example figure}
\end{figure}%
but if I use a div, it is loaded as a subfigure (note the \emph{(a)})
\begin{suppfig}
\centering{
\centering{
\pandocbounded{\includegraphics[keepaspectratio]{test_files/figure-latex/notebook-fig-example-output-1.png}}
}
\subcaption{\label{fig-example}this is an example figure}
}
\caption{\label{suppfig-example}}
\end{suppfig}%
\end{document}again, I am not sure if this would be the intended way to use supplementary figures using an embed shortcode, so if there is another better way please let me know! thank you!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
You are embedding a cross-reference (fig-example) inside another one (suppfig-example). It's like writing the below, I don't think you even want that. :::: {#suppfig-example}
:::: {#fig-example}
Text
Caption
:::
Caption
:::I suggest to drop the :::: {#fig-example}
{{< embed notebook.qmd#example >}}
:::
:::: {#suppfig-example}
{{< embed notebook.qmd#example >}}
::: |
Beta Was this translation helpful? Give feedback.

The following works for R and Python.
The second embedding does not have the "source" link, but it works.
With
cell.qmd: