Search code examples
multiple-columnspdflatexquarto

How do I get two columns in part of my PDF document created from Quarto + Latex when working in RStudio?


Pretty simple question: how do I get two columns for part of a document with Quarto?

In particular, a PDF document rendered using PDFlatex. I am working on a Mac in RStudio and rendering via the "render" button.

Here's quarto source code:

---
format: pdf
---

Some heading text.

:::: {.columns}

::: {.column}
text in col1
:::

::: {.column}
text in col2
:::

::::

Some bottom text.

Which renders to this:

reprex

It may be helpful to note that changing "pdf" to "html" in the yaml header and re-rendering yields a two-column result:

repres_html


Solution

  • A "native" quarto solution is to use {layout} instead of {.columns}according to this quarto-dev discussion:

    ---
    format: pdf
    ---
    
    Some heading text.
    
    :::: {layout="[0.5, 0.5]"}
    
    :::{#firstcol}
    text in col1
    :::
    
    :::{#secondcol}
    text in col2
    :::
    
    ::::
    
    Some bottom text.
    

    Which renders to:

    a_pdf_file