Basic Markdown
Markdown
Quatro files consist of code and markdown. We have discussed how to code in the previous chapters and will discuss markdown here. Markdown is a specific kind of markup language. What we mean by that is that the text in the document also indicates how it should be formatted in the result (For example if we surround a word by double asterikses (like so **bold**) it will bold in the resulting output. Below we will discuss the different types of markup that you can use.
Basic Formatting
Syntax | Output |
---|---|
*italics* | italics |
**bold** | bold |
***bold italics*** | bold italics |
subscript~2~ | subscript2 |
superscript^2^ | superscript2 |
~~crossed out~~ | |
`code` | code |
Headings
Syntax | Output |
---|---|
|
Header 1 |
|
Header 2 |
|
Header 3 |
|
Header 4 |
|
Header 5 |
|
Header 6 |
Links
Syntax | Output |
---|---|
<https://www.erasmusmc.nl> | https://www.erasmusmc.nl |
[EMC](https://www.erasmusmc.nl) | EMC |
Images
Syntax | Output |
---|---|
 | |
 “hovertext” | |
{fig-alt=“Alt text”} |
It is also possible to include images in links.
Lists
Markdown Syntax | Output |
---|---|
|
|
|
|
|
|
Tables
There are multiple ways to make tables
The easiest way is to use a so called pipe-table like this:
| foo| bar | Left align | Right Align | Center |
|----|-------|:-----------|------------:|:------:|
| 1 | 2 | 1 | 2 | 1|
| 3 | 4 |3 | 4 | 4 |
: an optional caption
The result is:
foo | bar | Left align | Right Align | Center |
---|---|---|---|---|
1 | 2 | 1 | 2 | 1 |
3 | 4 | 3 | 4 | 4 |
The first and last pipe character at each row are optional, the ones separating the columns are not although they do not have to be aligned. The header cannot be omitted. The relative width is determined by the number of dashes.
An alternative way to specify the relative column widths is by including the attribute after the caption, like this:
[40,15,15,15,15]"} : an optional caption {tbl-colwidths="
Sometimes it is easiest to directly make the tables from R code.
Source code
You can use delimited blocks with three backticks to use source code formatting. The syntax:
````
foo <- bar
````
Becomes:
foo <- bar
It is possible to add an R to indicate the R language is used and apply apropriate highlighting:
``` R
<- bar
foo ```
Becomes:
<- bar foo
Math
You can use TeX like syntax to format equations. Inline formulas are delimeted by single $s and display math uses double $$s.
Syntax | Output |
---|---|
$a2=b2+c^2$ | \(a^2=b^2+c^2\) |
$$a2=b2+c^2$$ | \[a^2=b^2+c^2\] |