-
DescriptionI have created a new template document, which is essentially a totally new document with the "Image Caption" style changed to Arial 9 and making sure it's center aligned: But when I create the caption, it's still left-aligned. Is it anyway to make figure caption centered? Also, I understand that "Image Caption" style is used on both figure and table captions. Is there any way to bypass this so that ONLY figure captions are centralized?
Interesting enough, in the output word file, if we change the caption to another type and then back to "Image Caption", we can see that the caption gets centralized: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The issue is because the alignment does not come from the style but seems to be added/hardcoded on top of it. Let's modify the Image Caption style in obvious ways in addition to make it centred. Generate the Word document
If you look at the style of the caption, it get "+ Left" Now, if you use standard figure (not cross-referenceable):
@cscheid Is it on purpose that the alignment is set this way for Word? This means you no longer can change caption alignment via reference document which is the only way for this format. (known behaviour in the feature matrix) |
Beta Was this translation helpful? Give feedback.
-
Alignment is hardcoded by Quarto
In theory, Now, if I remove the alignment hardcoded/added, in addition to get function docxParaStyles(align)
local styles = "<w:pPr>\n"
- local captionAlign = docxAlign(align)
- if captionAlign then
- styles = styles ..
- "<w:jc w:val=\"" .. captionAlign .. "\"/>\n"
- end
styles = styles ..
"<w:spacing w:before=\"200\" />\n" ..
"<w:pStyle w:val=\"ImageCaption\" />\n" ..
"</w:pPr>\n"
return styles
end Unfortunately, the code which adds the alignment is needed for table caption to be aligned according to the document level For short, the current implementation is in conflict with itself resulting in more bad results than good. Quarto document
---
title: "Quarto Playground"
format:
docx:
reference-doc: centre-caption.docx
tbl-align: left
---
![An image 1]({{< placeholder 600 400 >}}){#fig-placeholder-1}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
: A table 1 {#tbl-table-1}
![An image 2]({{< placeholder 600 400 >}}){#fig-placeholder-2 fig-align="right"}
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
: A table 2 {#tbl-table-2 tbl-align="right"}
|
Beta Was this translation helpful? Give feedback.
I've opened an issue as I do believe this to be a bug in the codebase that needs fixing.