Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 tasks done
Tracked by #4944
johngoldin opened this issue Aug 26, 2022 · 6 comments · Fixed by #7449
Closed
4 tasks done
Tracked by #4944

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

johngoldin opened this issue Aug 26, 2022 · 6 comments · Fixed by #7449
Assignees
Labels
bug Something isn't working crossref
Milestone

Comments

@johngoldin
Copy link

johngoldin commented Aug 26, 2022

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.
@johngoldin johngoldin added the bug Something isn't working label Aug 26, 2022
@cscheid cscheid added this to the v1.2 milestone Aug 26, 2022
@johngoldin
Copy link
Author

Now I notice that if I set fig-cap-location:top in my document yaml, that displays the caption above the figure (even if I also set fig-cap-location:bottom in the chunk that creates the plot and the caption. Maybe fig-cap-location cannot vary between chunks.

@cscheid
Copy link
Collaborator

cscheid commented Aug 27, 2022

@johngoldin You're correct. The bug here is that we're incorrectly showing fig-cap-location as an option that's specific to code cells, when it should instead be only available at the top level. We'll fix this soon.

@johngoldin
Copy link
Author

Were it not for the fact that quarto is new, I would have assumed I was just doing it wrong.

The documentation for code cell options refers to the options for fig-cap-location as being [inline | margin], because it sounds like margin is supposed to be available as an option. So I take it that the documentation correctly describes the intended behavior. But code complete showed the options as [top | bottom | margin].

@cscheid cscheid modified the milestones: v1.2, v1.3 Oct 12, 2022
@cscheid
Copy link
Collaborator

cscheid commented Feb 24, 2023

This interacts with crossref because of how we do figure discovery, and so it's a big regression risk. Pushing to 1.4 to go with the rest of the crossref work.

@cscheid cscheid modified the milestones: v1.3, v1.4 Feb 24, 2023
@cscheid cscheid mentioned this issue May 23, 2023
62 tasks
@eteitelbaum
Copy link

To clarify, when this issue is fixed in a later version of Quarto, will it then be possible to control the location of the figure caption for each figure individually by using fig-cap-location as a chunk-level option? Will we eventually be able to override the top-level YAML setting for fig-cap-location at the chunk-level?

@cscheid
Copy link
Collaborator

cscheid commented Nov 2, 2023

#7449 will close this issue and allow the overriding as requested above for all float types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crossref
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants