-
Notifications
You must be signed in to change notification settings - Fork 323
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
Error with fig-pos
and Single Images in Divs
#5637
Comments
fig-env
and Single Images in Divsfig-pos
and Single Images in Divs
That's tricky in general. I agree that we're failing here, but the problem lies with pinning down precisely what's "the div figure" vs. what is "what is contained within". Since we allow quite general content in either, that's generally hard.
You'll still need the |
The captions I am writing at the moment are all for my PhD thesis and so each figure caption is usually very long. I find it better for git tracking and if I am editing the document in the source view to have the caption across several lines which is possible with the divs, in comparison to putting the caption inside of the markdown Previously as well the spellcheck inside of RStudio wasn't working on the captions when they were inside of the markdown syntax but did work when it was in the div. I'm now using VSCode and it seems to work well regardless, so this isn't as much of an issue any more. I suppose it just ends up being nicer to work with when the captions are really long. Certainly not an important feature request though, and my current workaround of |
@mcanouil that's a handly little trick, I didn't realise that the markdown Currently though it seems that if you then edit in visual mode, Quarto converts it all to a single line and you lose the multi-line editing and tracking. This code below renders to PDF. # Introduction
This is a book created from markdown and executable code.
See @knuth84 for additional discussion of literate programming.
![
A multi-line caption.
With the next line here.
And and now another line.
](
cover.png
){
#fig-logo
} If however you edit in visual mode, then switch back to source mode, the # Introduction
This is a book created from markdown and executable code.
See @knuth84 for additional discussion of literate programming.
![A multi-line caption. With the next line here. And and now another line.](cover.png){#fig-logo} This brings me back to the same issue. |
I don't believe in visual editor for markdown users. VSCode provides keyboards shortcuts to bold/italicise/etc. markdown, thus what's the benefits of visual editor when you are most likely previewing the result live just next to the code? Note that the |
Updated previous comment to remove my mistaken |
Just to be clear, this was only my personal opinion as an "advanced" markdown user with the current state of the visual editor. |
(Revisiting this.) In the current pre-releases, the following example works:
Note that this isn't exactly the same as what you've written. Specifically, subfigures require a caption in order for them to appear inside a figure div with What we'll certainly do by the 1.4 release is to issue a warning in case we find images that won't work inside |
Tagging #4944 here for our own reference. |
Bug description
When setting the
fig-env
orfig-pos
in the_quarto.yml
, there is a peculiar bug where it errors if you include single images inside of custom divs. I will show some tests which reproduce the error from the default book project in VSCode when using "New Project --> Book".I have started doing all of my figures inside of their own divs. This makes writing much longer figure captions much easier, and spellcheck actually looks at them inside of VSCode rather than when they are inside of the
[]
of a regular markdown image.The below project renders OK, including a number of subfigures.
Renders OK
Doesn't Render
If I leave the YAML the same but change it to just a single figure inside of the div then this fails to render:
The actual
.tex
lines that are problematic look like this, and from what I can find googling around it doesn't like setting a floating environment inside an already floating environment.I have a solution that works if I set it up as follows:
I found that it was mentioned in the docs about setting environments inside of divs can be unstable in latex. I propose that that the global
fig-env
orfig-pos
might instead affect the div figure rather than what is contained within?I figure that this might also be a bit of an esoteric use, but I the ability to better write longer captions I think is crucial as opposed to the
![]()
markdown syntax, so potentially even a different way to include images in the div.System specs:
I have tested on both my windows 11 and MacOS 13.2 machines.
Quarto Check:
Checklist
quarto check
so we know which version of quarto and its dependencies you're running.The text was updated successfully, but these errors were encountered: