Path: blob/main/tests/docs/crossrefs/v1.4/figure-crossrefs.qmd
6479 views
---
title: All ways to get a figure crossref
keep-md: true
# format: pdf
---
## Floats
### Knitr Crossref Figure
```{r}
#| label: fig-plot
#| fig-cap: "Plot"
plot(cars)
```
### Simple Figure
{#fig-elephant}
{#fig-elephant-2}
[{#fig-linked-elephant-2}](https://www.example.com)
### Figure Div
::: {#fig-foo}

This is the figure
:::
### Linked Figure Div
::: {#fig-linked-foo}
[](https://www.example.com)
This is the figure
:::
See @fig-plot, @fig-elephant, @fig-elephant-2, @fig-foo, @fig-linked-foo, @fig-linked-elephant-2.
## Subfloats
### Simple subfloats
::: {#fig-sub-elephant layout-ncol=2}
{#fig-sub-elephant-sub1}
{#fig-sub-elephant-sub2}
Overall caption
:::
### Div subfloats
::: {#fig-sub-elephant-2 layout-ncol=2}
::: {#fig-sub-elephant-2-sub1}

This is a subfigure
:::
::: {#fig-sub-elephant-2-sub2}

another elephant
:::
Overall caption
:::
### Mixed subfloats
::: {#fig-sub-elephant-3 layout-ncol=2}
{#fig-sub-elephant-3-sub1}
::: {#fig-sub-elephant-3-sub2}

another elephant
:::
Overall caption
:::
::: {#fig-sub-elephant-3 layout-ncol=2}
{#fig-sub-elephant-3-sub1}
```{r}
#| label: fig-sub-elephant-3-sub2
#| fig-cap: "Not an elephant"
plot(cars)
```
Overall caption
:::