Custom Styles Using Quarto and Word Templates

Building on the use of Word templates for customizing .docx output from Quarto (as described here: Quarto – Word Templates), I'd like to leverage styles in the Word template that don't align with specific Quarto styles (such as the various headers, bulleted lists, etc.).

For example, in my template, I have a style called "Body Text First Indent". I'd like to apply this particular paragraphs of body text that I want indented. Another style, called "Body Text", is not indented, and will be applied to other paragraphs.

Is there a way to tag text in a Quarto document or otherwise select portions of text so that they have the appropriate styles selected from a Word template? I'm imagining something like the below:

<style = "Body Text First Indent"> This is my first paragraph, and it's indented--hooray! </>
<style = "Body Text"> This is my second paragraph, it's not indented--double hooray! </>

We could probably add this part to our documentation, but this is Pandoc feature.
Take a look at Pandoc - Pandoc User’s Guide regarding Custom style.

You can use Divs syntax to apply a custom style to paragraph, and Spans syntax to apply character style

Dickinson starts the poem simply:

::: {custom-style="Poetry"}
| A Bird came down the Walk---
| He did not know I saw---
:::

Hope it helps

Thanks, this is exactly what I was looking for. Adding this to the documentation would be very helpful. Is there a way that I could submit a formal documentation request?

An aside: from my own testing, it seems like spaces between the = in the Divs syntax cause the style to not be applied, which is... unexpected. It would be helpful to note this in the documentation as well, if true, since style guides typically suggest separating = symbols with whitespace for legibility.

Yes this is expected that it does not work because Pandoc's syntax does not allow spaces between= for attributes. I don't know if this is mentioned in the manual (Pandoc - Pandoc User’s Guide) but this is like that.

We could add mention to that at Quarto – Markdown Basics

Style guides apply on some language and syntax, and sometime it can't apply to all. Pandoc's Markdown syntax does not allow spaces there. We can't change that on our side.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.