Page Layout in R

Hello everyone,
I am writing a research paper in R Markdown, and I want to create a page layout where content is divided into two columns with space in between in R Markdown. How do I do this? I wanted to install and use the multicol package, but that package is not compatible with my studio version. Any other alternative

There is some information at 5.8 Multi-column layout (*) | R Markdown Cookbook

What are some alternative packages to multicol that can be used for creating two-column layouts in R Markdown?

What error messages, etc., are you getting? Also what is your OS, and versions of R and RStudio?

This simple (once I figured it out!) example seems to work for me. it is a bit of a pain to use and I am not sure how easily it would adapt to a research paper unless you are quite familiar with LaTeX.

I'm running RStudio 2023.12.1+402 with R version 4.4.0 under Ubuntu 22.04.4 LTS

---
title: "Authoring"
author: "Anon."
date: today
date-format: iso
number-sections: false
format: pdf
header-includes:
  - \usepackage{lipsum}
  - \usepackage{multicol}
---

## Introduction

```{=tex}
\begin{multicols}{2}


\lipsum[1-5]

\end{multicols}

Methods

\begin{multicols}{2}

\lipsum[6-10]

\end{multicols}

Another possibility is to use the line classoption: twocolumn in the YAML header, as suggested here:

---
output: html_document
classoption: twocolumn
---

:::::::::::::: {.columns}
::: {.column width="45%"}
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
:::
::: {.column width="10%"}
[space] 
:::
::: {.column width="45%"}
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
:::
::::::::::::::

As much as I like Rmarkdown/Quarto , depending on what kind of research paper you are writing and any Style Manual demands you are expected to conform to, you might want to consider using Lyx. It is a rather powerful front-end to LaTeX, among other things, and often can supply a template or format for the journal you are targeting.

It is slightly more complicated to use but its interface with R shares much of the philosophy and even syntax that Rmarkdown uses. Well, it should, much of its integration with R is due to Yihui.

I have never tried it but my guess is that moving text and code from Rmarkdown to Lyx would be relatively straightforward.

PS. Multiple column are a doodle in most cases.

1 Like