Skip to content
Discussion options

You must be logged in to vote

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:

---
title: "How to align text in div?"
format: pdf

---

we the people


::: {.center data-latex=""}

DECLARE!

:::

we are pretty cool
tex output

The div get rendered as follows in the tex

\begin{center}
DECLARE!

\end{center}

This should work also for html output with by either adding style="text-align: center;" or by defining a custom css like so:

.center {
    text-align: center;
}

As a very welcome bonus the content inside the div could be treated as regular quarto markdown (bold…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kompre
Comment options

Answer selected by kompre
@mcanouil
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
latex LaTeX engines related libraries and technologies
2 participants