-
DescriptionWhat is the most quarto way to center align a block of text like in the below example? ---
title: "How to align text in div?"
format: pdf
---
we the people
```{=latex}
\begin{center}
DECLARE!
\end{center}
```
we are pretty cool
Ideally I would like to avoid the raw latex block if possible, also because it does not work for html output; I would rather enclose the text in ::: {layout="[-1,1,-1]" layout-align="center"}
DECLARE!
:::
but the text is rendered as left aligned in the middle block (as expected really). the option |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There is no "markdown" way. See: |
Beta Was this translation helpful? Give feedback.
I stumbled upon this custom blocks in R Markdown that explain how to convert a div block in a any latex environment by adding
data-latex=""
as parameter.For example my initial example could be written as:
tex output
The div get rendered as follows in the
tex
This should work also for
html
output with by either addingstyle="text-align: center;"
or by defining a custom css like so:As a very welcome bonus the content inside the div could be treated as regular quarto markdown (bold…