How to center caption with image (Revealjs slides) #2304
-
I am trying to figure out how to center figure captions under a centered image in Revealjs (although I suppose this would apply to any .html document). Here is my code:
When I view it in the visual editor, it looks like this: And it when I have rendered this with R Markdown in the past as a Beamer slide, the caption has also been centered along with the image. But when I render it as Revealjs the caption gets left awkwardly to side of the image: Is there a way to fix it so that the caption gets centered along with the image? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
You need to provide with a full minimal and reproducible example, especially since you seem to use a template for Reveal.js. Why are you using This discussion is related to previous discussions/issues, such as #233, #799, and #1477. Edit: also related to #949 |
Beta Was this translation helpful? Give feedback.
-
@mcanouil Thanks for linking to those issues. Based on those discussions, it seems like this behavior is not a bug but rather that figure captions are left-justified by design. Further, it seems that captioned figures are centered by default but uncaptioned figures are left justified. As you can see, it looks pretty ridiculous when you have a smaller figure and a left-justified caption. I suppose I will have to find some workaround like not using a caption or using a title instead. |
Beta Was this translation helpful? Give feedback.
-
Would be nice to have a feature shortcut |
Beta Was this translation helpful? Give feedback.
@mcanouil Thanks for linking to those issues. Based on those discussions, it seems like this behavior is not a bug but rather that figure captions are left-justified by design. Further, it seems that captioned figures are centered by default but uncaptioned figures are left justified.
As you can see, it looks pretty ridiculous when you have a smaller figure and a left-justified caption. I suppose I will have to find some workaround like not using a caption or using a title instead.