Draft

  Template for contribution to Computo

Example dedicated to R users

Creative Commons BY License ISSN 2824-7795

Template for preparing a submission to Computo, using the quarto journal extension, the knitr kernel (R user) and renv to set-up the dependencies.

For a detailed, step-by-step guide on preparing your article, setting up the continuous integration and submitting it to Computo, please consult the guidelines for authors.

Authors
Affiliations
Published

August 10, 2025

Modified

August 10, 2025

Keywords

key1, key2, key3

Status

draft

Abstract

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur posuere vestibulum facilisis. Aenean pretium orci augue, quis lobortis libero accumsan eu. Nam mollis lorem sit amet pellentesque ullamcorper. Curabitur lobortis libero eget malesuada vestibulum. Nam nec nibh massa. Pellentesque porttitor cursus tellus. Mauris urna erat, rhoncus sed faucibus sit amet, venenatis eu ipsum.

1 Introduction

1.1 About this document

This document, accompanied with the tuned git repos, provides a template for writing contributions to Computo (Computo Team 2020).

Note

The content of this document only provides key formatting principles. For a detailed, step-by-step guide on preparing your article and submitting it to Computo, please consult the guidelines for authors.

1.2 Quarto

Quarto is a versatile formatting system for authoring documents integrating markdown, LaTeX and code blocks interpreted either via Jupyter or Knitr (thus supporting Python, R and Julia). It relies on the Pandoc document converter.

1.3 Requirements

You need quarto installed on your system and the Computo extension to prepare your document. For the latter, once quarto is installed, run the following to install the extension in the current directory (it creates a _extension directory which is ignored by git thanks to .gitignore by default):

quarto add computorg/computo-quarto-extension

R and the following R packages must be installed on your computer: knitr, markdown.

2 Formatting

This section covers basic formatting guidelines for quarto documents.

To render a document, run quarto render. By default, both PDF and HTML documents are generated:

quarto render template-computo-R.qmd # will render both to html and PDF
Note

To check the syntax of the formatting below, you can use the </> source button at the top left of this document.

2.1 Basic markdown formatting

Bold text or italic

  • This is a list
  • With more elements
  • It isn’t numbered.

But we can also do a numbered list

  1. This is my first item
  2. This is my second item
  3. This is my third item

2.2 Mathematics

2.2.1 Mathematical formulae

LaTeX code is natively supported1, which makes it possible to use mathematical formulae:

f(x_1, \dots, x_n; \mu, \sigma^2) = \frac{1}{\sigma \sqrt{2\pi}} \exp{\left(- \frac{1}{2\sigma^2}\sum_{i=1}^n(x_i - \mu)^2\right)}

It is also posible to cross-reference an equation, see Equation 1:

\begin{aligned} D_{x_N} & = \frac12 \left[\begin{array}{cc} x_L^\top & x_N^\top \end{array}\right] \, \left[\begin{array}{cc} L_L & B \\ B^\top & L_N \end{array}\right] \, \left[\begin{array}{c} x_L \\ x_N \end{array}\right] \\ & = \frac12 (x_L^\top L_L x_L + 2 x_N^\top B^\top x_L + x_N^\top L_N x_N), \end{aligned} \tag{1}

2.2.2 Theorems and other amsthem-like environments

Quarto includes a nice support for theorems, with predefined prefix labels for theorems, lemmas, proposition, etc. see this page. Here is a simple example:

Theorem 1 (Strong law of large numbers) The sample average converges almost surely to the expected value:

\overline{X}_n\ \xrightarrow{\text{a.s.}}\ \mu \qquad\textrm{when}\ n \to \infty.

See Theorem 1.

2.3 R Code

Quarto uses either Jupyter or knitr to render code chunks. This can be triggered in the yaml header. In this tutorial, we use knitr (R and packages knitr, markdown must be installed on your computer).

---
title: "My Document"
author "Jane Doe"
---

R code (R Core Team 2020) chunks may be embedded as follows:

Hide/Show the code
x <- rnorm(10)

2.4 Figures

Plots can be generated as follows:

Hide/Show the code
library("ggplot2")
p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  geom_smooth()
p

It is also possible to create figures from static images:

Note: Until Quarto version 1.3+ is released, including a remote image (from a web URL) in a document (like the image above) will work in the rendered HTML document but will generate an error when building the PDF document (c.f. related bug report).

2.5 Tables

Tables (with label: @tbl-mylabel renders Table 1) can be generated with markdown as follows

Table 1: my table caption
Tables Are Cool
col 1 is left-aligned $1600
col 2 is centered $12
col 3 is right-aligned $1

Table can also be generated by some code, for instance with knitr here:

Hide/Show the code
knitr::kable(summary(cars), caption = "Table caption.")
Table caption.
speed dist
Min. : 4.0 Min. : 2.00
1st Qu.:12.0 1st Qu.: 26.00
Median :15.0 Median : 36.00
Mean :15.4 Mean : 42.98
3rd Qu.:19.0 3rd Qu.: 56.00
Max. :25.0 Max. :120.00

2.6 Handling references

2.6.1 Bibliographic references

References are displayed as footnotes using BibTeX, e.g. [@computo] will be displayed as (Computo Team 2020), where computo is the bibtex key for this specific entry. The bibliographic information is automatically retrieved from the .bib file specified in the header of this document (here: references.bib).

2.6.2 Other cross-references

As already (partially) seen, Quarto includes a mechanism similar to the bibliographic references for sections, equations, theorems, figures, lists, etc. Have a look at this page.

2.7 Advanced formatting

Advanced formatting features are possible and documented (including interactive plots, pseudo-code, (Tikz) diagrams, Lua filters, mixing R + Python in the same document), but are beyond the scope of this simple introduction. We point several entries in this direction.

More information

References

Computo Team. 2020. “Computo: Reproducible Computational/Algorithmic Contributions in Statistics and Machine Learning.”
R Core Team. 2020. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.

Session information

Hide/Show the code
sessionInfo()
R version 4.5.0 (2025-04-11)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] ggplot2_3.5.2

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5        nlme_3.1-168       cli_3.6.5          knitr_1.50        
 [5] rlang_1.1.6        xfun_0.52          renv_1.1.4         jsonlite_2.0.0    
 [9] labeling_0.4.3     glue_1.8.0         htmltools_0.5.8.1  scales_1.4.0      
[13] rmarkdown_2.29     grid_4.5.0         evaluate_1.0.4     tibble_3.3.0      
[17] fastmap_1.2.0      yaml_2.3.10        lifecycle_1.0.4    compiler_4.5.0    
[21] RColorBrewer_1.1-3 pkgconfig_2.0.3    mgcv_1.9-3         lattice_0.22-7    
[25] farver_2.1.2       digest_0.6.37      R6_2.6.1           splines_4.5.0     
[29] pillar_1.10.2      magrittr_2.0.3     Matrix_1.7-3       tools_4.5.0       
[33] withr_3.0.2        gtable_0.3.6      

Footnotes

  1. We use lualatex for this purpose.↩︎

Reuse

CC-BY-4.0