-
Notifications
You must be signed in to change notification settings - Fork 335
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
code in figures are centered in docx documents #11937
Comments
@ejeandel Did you look at the style of your reference document regarding figures as you chose to make your code a "figure"? Side note: could you add the proper YAML header/frontmatter to your example to make it "ready to work" without having the team or users do extra work to set format for instance? |
I don't have any reference document, the only thing in the directory is the file I rendered. fig-align=left works but I'd consider this a workaround, not a solution (fig-align=right for instance would only align right on word, not on tex/html/odt) |
You do, even if it's the default provided by Quarto/Pandoc.
You are using a figure environment to put code. Figures are centred by default. To be clear, almost everything for Edit: the following alignment issue might be at play in some regards |
I've read the doc, I meant I didn't change the default. I don't understand the point about fig-align |
Styling does not work the same way in LaTeX, Typst, HTML/CSS and Docx (OpenXML). The alignment in Word document is the same no matter if the "object" is a paragraph, a figure, a table, etc. |
The problem here is that for Docx document and cross references element, we are putting content into a docx table. And this table has its content centered aligned. By aligning on the left, the code block is not modified. So I think this is an improvement to do for our crossref, especially with code content. Note that same results with code listing https://quarto.org/docs/authoring/cross-references.html#code-listings Related issues |
Yes, but caution is required because hardcoding alignment values breaks the ability to customise Maybe, Quarto needs a modified reference document with other styles it could use. |
Bug description
When a .qmd document is rendered in docx, then each line of the python code in the figure will be centered, which makes it completely unusable.
the bug doesn't appear with the .odt, .tex or .html format
The code-line-numbers functionality also doesn't work. But nothing in the documentation states that it should work for formats other than tex and html, so maybe that's normal.
PS: (Any chance .odt will work with the book format at some point ?)
Steps to reproduce
Expected behavior
The figure should be left aligned, and the spacing from python should be respected
Actual behavior
Each row of the code in the figure is centered
Your environment
Linux Debian 12,
Quarto check output
(bug also happens on 1.7.13)
The text was updated successfully, but these errors were encountered: