Skip to content

fig-cap-location:top does place the caption above the figure #2154

@johngoldin

Description

@johngoldin

Bug description

In chunk yaml, when I do "fig-cap-location: top" I still end up with the caption at the bottom. Setting it to "margin" works as expected. Published example is here on quarto-pub.

Might this be related to this issue? I don't know.

I have attached the qmd document that created the result linked to above that I published to quarto-pub:

---
title: "fig_caption_location_issue"
author: "John Goldin"
format: html
editor: visual
---

The fig-cap-location chunk option does not work as expected. I can do "bottom" or "margin" but "top" works the same way as "bottom". 

```{r}
#| label: fig-a
#| fig-cap: "A Sample Figure"
#| fig-cap-location: top
plot(pressure)

```


Here is yaml for the code chunk:     
#| label: fig-a   
#| fig-cap: "A Sample Figure"    
#| fig-cap-location: top  

(I tried to find a function that would allow me to fetch these
values, but I didn't see one so I've pasted them here.)

RStudio version:
RStudio 2022.07.1+554 "Spotted Wakerobin"      
Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22)     
for macOS Mozilla/5.0 (Macintosh; Intel Mac OS X 12_5_0) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

quarto --version
1.1.140

When I run this I get the fig-cap at the bottom of the figure even if I try to specify "top". 

## "Top" May Not Work, But "Margin" Does

Next I'll show I am able to change the location to "margin" and that works as expected (provided the html window is wide enough to allow for the caption
to appear in the margin).

#| label: fig-b    
#| fig-cap: "Another Sample Figure"     
#| fig-cap-location: margin     

```{r}
#| label: fig-b
#| fig-cap: "Another Sample Figure"
#| fig-cap-location: margin
plot(pressure)
```

I wonder whether there is something else going on that I don't understand. The typography
when I use "margin" seems to be a smaller font. And when I use either "bottom" or "top"
there seems to be a lot of space between the bottom of the figure and the
caption. 

session_info:

```{r}
print(devtools::session_info())
```

My system and session version info is all in the published example .

I also tried with quarto --version
1.2.8

I submit this with trepidation because it is a small, simple thing so the simplest explanation is that I made a simple mistake. But just in case I didn't, here's the report.

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