非常简单的问题:如何使用 Quarto 获取文档的一部分的两列?
特别是使用 PDFlatex 渲染的 PDF 文档。我正在 RStudio 中的 Mac 上工作,并通过“渲染”按钮进行渲染。
这是四开源代码:
---
format: pdf
---
Some heading text.
:::: {.columns}
::: {.column}
text in col1
:::
::: {.column}
text in col2
:::
::::
Some bottom text.
这会导致:
注意将 yaml 标头中的“pdf”更改为“html”并重新渲染会产生两列结果,这可能会有所帮助:
我相信 Quarto 语法本身尚不支持此功能,因此我们将不得不恢复使用 LaTeX 语法来实现此目标。我推荐 this 作为理解 LaTeX 中多列布局的良好开端。为了实现这一点,我们需要额外的
multicol
LaTeX 包。您可以使用以下 YAML 选项在四开本中加载此内容:
---
format:
pdf:
include-in-header:
- text: |
\usepackage{multicol}
---
然后要使用文档中的列,请执行以下操作。我正在创建一个包含 2 列的 multicols 环境,并且我在其中一列以
\columnbreak
结尾的地方中断。
Some initial text at full width for quarto, this should go all the way across
the page
\begin{multicols}{2}
Here is the first column
\columnbreak
Here is the second column
\end{multicols}
Now let us go back to normal text length now that the multicols environment
has ended.
这会产生这样的效果:
请随意提出任何其他问题,如果此答案适合您,请务必将其标记为已接受以供未来用户使用。