This document provides a template based on the quarto system for contributions to Computo, using the quarto journal extension, the Julia 1-10 Jupyter and the Julia Pkg manager to set-up the dependencies.
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 hopefully finely tuned git repos, provides a template for writing contributions to Computo(Computo Team 2020). We show how Julia code can be included and how the repository can be set up for triggering github actions for rendering the document, with dependencies handled by the built-in Pkg manager.
1.2 Setup a github repository for preparing your submission
You can start by clicking the “use this template” button, on the top of the page of the github repository associated to this document. Of course, you can set your repository private during the preparation of your manuscript.
1.3 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.4 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
Julia and Jupyter must be installed on your computer.
1.5 Link with your usual tools
Quarto is expecting a .qmd markdown file, but will also works with a standard Jupyter notebook file if you are used to it (it will just require to add the proper YAML metadata1).
Note: More advanced Jupyter-related functionality like Myst/Jupyter book are not supported in this Quarto setup. The markdown syntax inside the Jupyter notebook should follow the Quarto syntax (c.f. below). If you are more comfortable with using Myst/Jupyter book, we provide a specific template but it will requires more formatting work for Computo editorial team, thus highly encourage authors to use the Quarto templates.
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-julia.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
This is my first item
This is my second item
This is my third item
2.2 Mathematics
2.2.1 Mathematical formulae
LaTeX code is natively supported2, which makes it possible to use mathematical formulae:
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.
Quarto uses either Jupyter or knitr to render code chunks. This can be triggered in the yaml header. In this tutorial, we use Jupyter, (Julia and Jupyter must be installed on your computer)
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
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.
In this tutorial, we simply need to add the Plots library and its dependencies. It is important that you also add IJulia to your project, since it is a required dependency for quarto to correclty render your document via Jupyter.
Once added via the Pkg manager of Julia (add Plots; add IJulia), the files Project.toml and Manifest.toml in the current project directory contains all the information required.
3.2 Continuous integration
The repository associated with this template is pre-configure to trigger an action on push that performs the following:
Check out repository on the ubuntu-latest machine
Install quarto and dependencies, including the Computo extension
Install Julia (1.10) and dependencies based on the files Project.toml and Manifest.toml
Render your .qmd file and Publish the results on a gh-page (both HTML and PDF)
The first time, you possibly need to create the branch for the action to work. This can be done by running the following command from your computer, in your git repository:
quarto publish gh-pages
Then, set the branch gh-page as the source of your github page, and trigger the action to check that everything works fine.
3.3 Data and large files
If your submission materials contain files larger than 50MB, especially data files, they won’t fit on a git repository as is. For this reason, we encourage you to put your data or any materials you deem necessary on an external “open data” centered repository hub such a Zenodo or OSF.
References
Computo Team. 2020. “Computo: Reproducible Computational/Algorithmic Contributions in Statistics and Machine Learning.”
@article{doe2024,
author = {Doe, Jane and Doe, John},
publisher = {Société Française de Statistique},
title = {Template for Contribution to {Computo}},
journal = {Computo},
date = {2024-11-17},
url = {https://computo.sfds.asso.fr/template-computo-quarto},
doi = {xxxx},
issn = {2824-7795},
langid = {en},
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.}
}
For attribution, please cite this work as:
Doe, Jane, and John Doe. 2024. “Template for Contribution to
Computo.”Computo, November. https://doi.org/xxxx.
Source Code
---title: "Template for contribution to Computo"subtitle: "Example dedicated to `Julia` users"author: - name: Jane Doe corresponding: true email: janedoe@nowhere.moon url: https://janedoe.someplace.themoon.org orcid: 0000-0000-0000-0000 affiliations: - name: Name of Affiliation one department: Statistics url: https://someplace.themoon.org - name: John Doe email: johndoe@nowhere.moon url: https://johndoe.someplace.themoon.org orcid: 0000-0000-0000-0000 affiliations: - name: Name of Afficiliation two department: Computer Science url: https://someplace.themoon.orgdate: last-modifieddate-modified: last-modifieddescription: | This document provides a template based on the [`quarto`](https://quarto.org/) system for contributions to Computo, using the [`quarto journal extension`](https://github.com/computorg/computo-quarto-extension), the Julia 1-10 Jupyter and the Julia `Pkg` manager to set-up the dependencies.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.keywords: [key1, key2, key3]citation: type: article-journal container-title: "Computo" doi: "xxxx" url: https://computo.sfds.asso.fr/template-computo-quarto publisher: "Société Française de Statistique" issn: "2824-7795"bibliography: references.bibgithub-user: computorgrepo: "template-computo-julia"draft: true # set to false once the build is runningpublished: false # will be set to true once acceptedformat: computo-html: default computo-pdf: defaultjupyter: julia-1.10---# Introduction## About this documentThis document, accompanied with the [hopefully finely tuned git repos](https://github.com/computorg/template-computo-julia/), provides a template for writing contributions to **Computo** [@computo]. We show how `Julia` code can be included and how the repository can be set up for triggering github actions for rendering the document, with dependencies handled by the built-in `Pkg` manager.## Setup a github repository for preparing your submissionYou can start by clicking the "use this template" button, on the top of the page of the [github repository associated to this document](https://github.com/computorg/template-computo-julia/). Of course, you can set your repository private during the preparation of your manuscript.## Quarto[Quarto](https://quarto.org/) 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](https://pandoc.org/MANUAL.html) document converter.## RequirementsYou need [quarto](https://quarto.org/) installed on your system and the [Computo extension](https://github.com/computorg/computo-quarto-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):```.bashquarto add computorg/computo-quarto-extension```[`Julia`](https://julialang.org/) and [`Jupyter`](https://jupyter.org/install) must be installed on your computer.## Link with your usual toolsQuarto is expecting a `.qmd` markdown file, but will also works with a standard [Jupyter notebook](https://quarto.org/docs/get-started/hello/jupyter.html) file if you are used to it (it will just require to add the proper YAML metadata^[the same metadata as in the [`template-computo-julia.qmd` file](https://github.com/computorg/template-computo-julia/blob/main/template-computo-julia.qmd) in the first cell, type "Raw", of the notebook]).**Note**: _More advanced Jupyter-related functionality like Myst/Jupyter book are not supported in this Quarto setup. The markdown syntax inside the Jupyter notebook should follow the Quarto syntax (c.f. [below](#formatting)). If you are more comfortable with using Myst/Jupyter book, we provide a [specific template](https://github.com/computorg/template-computo-myst) but it will requires more formatting work for Computo editorial team, thus highly encourage authors to use the Quarto templates._# FormattingThis section covers basic formatting guidelines for quarto documents.To render a document, run `quarto render`. By default, both PDF and HTML documents are generated:```.bashquarto render template-computo-julia.qmd # will render both to html and PDF```::: {.callout-tip}## NoteTo check the syntax of the formatting below, you can use the `</> source` button at the top left of this document.:::## 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 list1. This is my first item2. This is my second item3. This is my third item## Mathematics### Mathematical formulae[LaTeX](https://www.latex-project.org/) code is natively supported[^lualatex], which makes it possible to use mathematical formulae:[^lualatex]: We use [lualatex](https://lualatex.org/) for this purpose.$$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 @eq-mylabel:$$\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}$$ {#eq-mylabel}### Theorems and other amsthem-like environmentsQuarto includes a nice support for theorems, with predefined prefix labels for theorems, lemmas, proposition, etc. see [this page](https://quarto.org/docs/authoring/cross-references.html#theorems-and-proofs). Here is a simple example:::: {#thm-slln}## Strong law of large numbersThe sample average converges almost surely to the expected value:$$\overline{X}_n\ \xrightarrow{\text{a.s.}}\ \mu \qquad\textrm{when}\ n \to \infty.$$:::See @thm-slln.## Julia CodeQuarto uses either Jupyter or knitr to render code chunks. This can be triggered in the yaml header. In this tutorial, we use `Jupyter`, (`Julia` and `Jupyter` must be installed on your computer)``` yaml---title:"My Document"author"JaneDoe"jupyter: julia-1.10---````julia` code chunks may be embedded as follows:```{julia julia-code}using Randomrng = MersenneTwister(1234)x = randn(rng, ComplexF32, (10,1))x```## FiguresPlots can be generated as follows:```{julia stem-plot}#| label: fig-parametric#| fig-cap: "Parametric Plots"using Plotsplot(sin, x->sin(2x), 0, 2π, leg=false, fill=(0,:lavender))```It is also possible to create figures from static images::::{#fig-logo}![](https://computo.sfds.asso.fr/assets/img/logo_text_vertical.png){height=200}Computo logo (label):::**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](https://github.com/quarto-dev/quarto-cli/issues/4443))._## TablesTables (with label: `@tbl-mylabel` renders @tbl-mylabel) can be generated with markdown as follows| Tables | Are | Cool ||----------|:-------------:|------:|| col 1 is | left-aligned | $1600 || col 2 is | centered | $12 || col 3 is | right-aligned | $1 |: my table caption {#tbl-mylabel}## Handling references {#sec-references}### Bibliographic referencesReferences are displayed as footnotes using[BibTeX](http://www.bibtex.org/), e.g. `[@computo]` will be displayedas [@computo], where `computo` is the bibtex key for this specificentry. The bibliographic information is automatically retrieved fromthe `.bib` file specified in the header of this document (here:`references.bib`).### Other cross-referencesAs already (partially) seen, Quarto includes a mechanism similar to thebibliographic references for sections, equations, theorems, figures,lists, etc. Have a look at [thispage](https://quarto.org/docs/authoring/cross-references.html).## Advanced formattingAdvanced 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.::: {.callout-warning}## More information- [The Quarto web site](https://quarto.org) for comprehensive documentation, including: + [Tutorial](https://quarto.org/docs/get-started/) + [User guide](https://quarto.org/docs/guide/) + [Options reference](https://quarto.org/docs/reference/)- [The template distributed with the Computo Quarto extension](https://computo.sfds.asso.fr/computo-quarto-extension/), which uses such advanced features.- [Our mock version of the t-SNE paper](https://computo.sfds.asso.fr/published-paper-tsne/), a full and advanced example using Python and the Jupyter kernel.- [The previously published papers in Computo](https://computo.sfds.asso.fr/publications/) can be used as references.:::# Finalize your submission## Handle `Julia` dependencies with `Pkg`To make your work reproducible, you need to fix the packages and environment used to run your analysis. In `Julia`, the built-in `Pkg` package manager is a method of choice. [https://towardsdatascience.com/how-to-setup-project-environments-in-julia-ec8ae73afe9c](This simple tutorial shows how to set up a project). In this tutorial, we simply need to add the `Plots` library and its dependencies. It is important that you also add `IJulia` to your project, since it is a required dependency for quarto to correclty render your document via Jupyter.Once added via the `Pkg` manager of Julia (`add Plots; add IJulia`), the files `Project.toml` and `Manifest.toml` in the current project directory contains all the information required.## Continuous integrationThe repository associated with this template is pre-configure to trigger an action on push that performs the following:1. Check out repository on the `ubuntu-latest` machine2. Install quarto and dependencies, including the Computo extension3. Install Julia (1.10) and dependencies based on the files `Project.toml` and `Manifest.toml`4. Render your .qmd file and Publish the results on a gh-page (both HTML and PDF)The file [.github/workflows/build_n_publish.yml](https://github.com/computorg/template-computo-python/blob/main/.github/workflows/build_n_publish.yml) is largely inspired from [this file](https://quarto.org/docs/publishing/github-pages.html#example-jupyter-with-venv).Once this is successful, you are ready to submit your manuscript to the [Computo submission platform](https://computo.scholasticahq.com/).::: {.callout-warning}The first time, you possibly need to create the branch for the action to work. This can be done by running the following command from your computer, in your git repository:```.bashquarto publish gh-pages```Then, set the branch `gh-page` as the source of your github page, and trigger the action to check that everything works fine.::: ## Data and large filesIf your submission materials contain files larger than 50MB, **especially data files**, they won’t fit on a git repository as is. For this reason, we encourage you to put your data or any materials you deem necessary on an external “open data” centered repository hub such a [Zenodo](https://zenodo.org/) or [OSF](https://osf.io/).# References {.unnumbered}::: {#refs}:::