我正在try 让Quarto在呈现为both个PDF和HTML时正确对齐一些文本.但我只能让它做其中的一个,不能两个都做.下面是一个最小的例子,带有PDF和HTML输出的源代码和屏幕截图.您可以看到源代码成功地将LaTeX \begin{flushright}
用于PDF输出,并成功地将::: {style="text-align: right"}
用于HTML输出,但两者不能很好地结合在一起.还有别的办法吗?
---
title: "How to right justify both html and pdf"
---
Here is some intitial text in usual left-justified format.
::: {style="text-align: right"}
Attempt 1. This text should be right justified.
:::
\begin{flushright}
Attempt 2. This text should be right justified.
\end{flushright}
::: {style="text-align: right"}
\begin{flushright}
Attempt 3. This text should be right justified.
\end{flushright}
:::
\begin{flushright}
::: {style="text-align: right"}
Attempt 4. This text should be right justified.
:::
\end{flushright}
Here is some *more* text in usual left-justified format.
HTML output. Notice only Attempt 1 appears (correctly), but the other attempts don't appear at all: