---title: "My Quarto file"author: "Your Name"date: "2025-04-04"format: html---Summary of `mtcars````{r}summary(mtcars)```
Main components of a Quarto file:
Header (YAML metadata)
Body (Markdown content and code chunks)
Header
index.qmd
---title: "My Quarto file"author: "Your Name"date: "2025-04-04"format: htmltoc: true---
Defines document properties and settings, for examples:
title: Document title
author: Authorship
date: Date this document was published
format:
Webpage: html
Presentation: revealjs
MS Word: docx
Report/Manuscript: pdf
toc: table of contents
Body
index.qmd
---title: "Hello, Quarto"date: 2025-01-06author: "Biostats and Modelling"format: html: code-overflow: wrap embed-resources: truenumber-sections: truenavbar: falsetoc: false---## Introduction to QuartoQuarto is a publishing system that allows you to create documents, presentations, websites, and more using Markdown syntax and additional tools. ## Header LevelsQuarto supports multiple header levels to create a hierarchical structure in your document. For example:- Level 1 header: `# Header`- Level 2 header: `## Subheader`- Level 3 header: `### Sub-subheader`### Nested HeadersUsing headers, you can create nested sections to structure your document in a clear and organized way.## Inline Text FormattingYou can format your text inline to add emphasis or other styling options.- **Bold text**: `**bold**`- *Italic text*: `*italic*`- Inline `code`: `` `code` ``- [Underline]{.underline}: `[underline]{.underline}`> Blockquotes can be used to highlight important information or quotes by adding `> ` at the beginning of a line.## ListsQuarto supports both ordered and unordered lists.### Unordered ListTo create an unordered list, use an asterisk `*` before each item:* First item* Second item* Third item### Ordered ListTo create an ordered list, use numbers before each item:1. First item2. Second item3. Third item## Links and images<http://example.com>[linked phrase](http://example.com)## Tables| First Header | Second Header ||--------------|---------------|| Content Cell | Content Cell || Content Cell | Content Cell |## Code blockQuarto also supports code blocks, making it easy to include and execute code within your document. Here’s an example of a code block to create a simple plot using R:```{r}#| fig-width: 4#| fig-height: 3#| out-width: "100%"x <- c(1, 2, 3, 4, 5)y <- c(1, 4, 9, 16, 25)plot(x, y, type = "o", col = "blue", main = "Simple plot", xlab = "x", ylab = "y")```## FootnotesFootnotes can be added inline to provide additional information or references. Here's an example of a footnote in Quarto: ^[This is an example footnote.]
index.html
MS Word-like interface
Rendering output
Save your Quarto file.
Render it using the “Render” button in RStudio or by pressing Ctrl+Shift+K.
Let’s write a manuscript
Create tables
There are many packages to create beautiful tables in R:
Templates help make your document look professional without extra effort
You can use pre-built templates or create your own for a custom style
Some templates are designed for academic journals, presentations, or reports
Click here to see a list of available journal templates in Quarto
What is a Quarto template?
A Quarto template is a pre-designed document layout that controls the appearance of your output (PDF, Word, HTML, or presentation).
Let’s try a template for journals published by Elsevier.
Template
Paste this code in the terminal (not the console or your coding panel).
quarto use template quarto-journals/elsevier
Say “Yes” to everything it gonna ask.
Template
paper.qmd
---title: Short Papersubtitle: A Short Subtitleauthor: - name: Alice Anonymous email: alice@example.com affiliations: - id: some-tech name: Some Institute of Technology department: Department Name address: Street Address city: City state: State postal-code: Postal Code attributes: corresponding: true note: This is the first author footnote. - name: Bob Security email: bob@example.com affiliations: - id: another-u name: Another University department: Department Name address: Street Address city: City state: State postal-code: Postal Code note: | Another author footnote, this is a very long footnote and it should be a really long footnote. But this footnote is not yet sufficiently long enough to make two lines of footnote text. - name: Cat Memes email: cat@example.com affiliations: - ref: another-u note: Yet another author footnote. - name: Derek Zoolander email: derek@example.com affilations: - ref: some-techabstract: | This is the abstract. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum augue turpis, dictum non malesuada a, volutpat eget velit. Nam placerat turpis purus, eu tristique ex tincidunt et. Mauris sed augue eget turpis ultrices tincidunt. Sed et mi in leo porta egestas. Aliquam non laoreet velit. Nunc quis ex vitae eros aliquet auctor nec ac libero. Duis laoreet sapien eu mi luctus, in bibendum leo molestie. Sed hendrerit diam diam, ac dapibus nisl volutpat vitae. Aliquam bibendum varius libero, eu efficitur justo rutrum at. Sed at tempus elit.keywords: - keyword1 - keyword2date: last-modifiedbibliography: bibliography.bibformat: elsevier-pdf: keep-tex: true journal: name: Journal Name formatting: preprint # model: 3p # Don't set a model with preprint cite-style: authoryear---Please make sure that your manuscript follows the guidelines in the Guide for Authors of the relevant journal. It is not necessary to typeset your manuscript in exactly the same way as an article, unless you are submitting to a camera-ready copy (CRC) journal.For detailed instructions regarding the elsevier article class, see <https://www.elsevier.com/authors/policies-and-guidelines/latex-instructions># Bibliography stylesHere are two sample references: @Feynman1963118 @Dirac1953888.With this template using elsevier class, natbib will be used. Three bibliographic style files (*.bst) are provided and their use controled by `cite-style` option: - `citestyle: number` (default) will use `elsarticle-num.bst` - can be used for the numbered scheme- `citestyle: numbername` will use `elsarticle-num-names.bst` - can be used for numbered with new options of natbib.sty- `citestyle: authoryear` will use `elsarticle-harv.bst` — can be used for author year schemeThis `citestyle` will insert the right `.bst` and set the correct `classoption` for `elsarticle` document class.Using `natbiboptions` variable in YAML header, you can set more options for `natbib` itself . Example ```yamlnatbiboptions: longnamesfirst,angle,semicolon```## Using CSL If `cite-method` is set to `citeproc` in `elsevier_article()`, then pandoc is used for citations instead of `natbib`. In this case, the `csl` option is used to format the references. By default, this template will provide an appropriate style, but alternative `csl` files are available from <https://www.zotero.org/styles?q=elsevier>. These can be downloadedand stored locally, or the url can be used as in the example header.# EquationsHere is an equation:$$ f_{X}(x) = \left(\frac{\alpha}{\beta}\right) \left(\frac{x}{\beta}\right)^{\alpha-1} e^{-\left(\frac{x}{\beta}\right)^{\alpha}}; \alpha,\beta,x > 0 .$$Inline equations work as well: $\sum_{i = 2}^\infty\{\alpha_i^\beta\}$# Figures and tables@fig-meaningless is generated using an R chunk.```{r}#| label: fig-meaningless#| fig-cap: A meaningless scatterplot#| fig-width: 5#| fig-height: 5#| fig-align: center#| out-width: 50%#| echo: falseplot(runif(25), runif(25))```# Tables coming from RTables can also be generated using R chunks, as shown in @tbl-simple example.```{r}#| label: tbl-simple#| tbl-cap: Caption centered above table#| echo: trueknitr::kable(head(mtcars)[,1:4])```# References {-}
Let’s make a presentation
Revealjs
Quarto + Revealjs = Interactive Presentations
Uses Markdown for content
Simple, flexible, and powerful!
Slide structure
index.qmd
---title: "My Presentation"author: "Your Name"format: revealjs: chalkboard: truetoc: false---## Slide Title- Bullet point 1- Bullet point 2## Code Blocks & HighlightingYou can add code blocks like this:```{r}# R code blocksummary(cars)```
Set format: revealjs
Use ## for slide titles and Markdown for content
Slide structure
index.qmd
---title: "My Presentation"author: "Your Name"format: revealjs: chalkboard: truetoc: false---## Slide Title- Bullet point 1- Bullet point 2## Code Blocks & HighlightingYou can add code blocks like this:```{r}# R code blocksummary(cars)```
Now create your own Quarto manuscript and presentation!