# Markdown Syntax # - FORMAT : *italic*, **bold**, `code`, ~subscript~, ^superscript^, > quote, ^[footnote] # - [](hyperlink) # - EQUATION: $inline equation$, $$display equation$$, \begin{equation} (\#eq:eq-label)\end(equation), \@ref(eq:eq-label) # - CITATION: [@bib-entry1; @bib-entry2] # - FIGURE : ![](image link), knitr::include_graphics(), \@ref(fig:fig1) # - TABLE : knitr::kable(), \@ref(tab:tab1) # - COLUMS: # ::: columns # # :::: column # :::: {.column width=.7} # left # :::: # # :::: column # right # :::: # # ::: # - NOTES: # :::notes # ::: # - HIDEN: # \invisible{ # hidden texts. # } # - INCREMENTAL: # > - Eat eggs # > - Drink coffee
This template intends to show
If you are now using RStudio, click the button 'Knit', and you can see three options beginning with 'Knit to ...'. Try them one by one. Yeah, it can create slides, a word document, and a web page with the same contents.
italic
bold
code
Superscript: mc^2^
Subscript: CO~2~
Numbered items
Unnumbered items
x = 1
quote
A footnotes can be created like this: footnote^[This is a footnote 1].
Or like this: another footnote[^footnote2]
[^footnote2]: This is another footnote.
An image can be inserted directly like this:
![](https://openr.netlify.com/img/banners/logo-rosr.png)
If you need customized images, especially cross-reference for the image like Figure \@ref(fig:image1), use R scripts like this:
(ref:image1) This is a caption of an image.
if(file.exists('logo-rosr.png')){ knitr::include_graphics('logo-rosr.png') # insert a local image } else{ plot(1) # plot an image. }
Insert a table with basic markdown like this:
column1 column2
row1 row1 row2 row2
or use scripts like Table \@ref(tab:tab1):
(ref:tab1) This is the caption of a table.
knitr::kable(head(cars), booktabs = TRUE, caption = "(ref:tab1)")
An inline equation is like this:$F(x) = \int^a_b \frac{1}{3}x^3$.
An display equation can be inserted like this:
$$F(x) = \int^a_b \frac{1}{3}x^3$$
If an equation should be numbered or cross-referred, insert it like Equation \@ref(eq:eqtest) for pdf and html:
\begin{align} F(x) = \int^a_b \frac{1}{3}x^3 (#eq:eqtest) \end{align}
and Equation (@eq-mc) for Word.
(@eq-mc) $F(x) = \int^a_b \frac{1}{3}x^3$
Suppose you have a .bib file named 'rosr.bib' (See bibliography:
in the YALM header). If not, you can create a bib file like this.
knitr::write_bib(c('knitr', 'rosr'), file = 'rosr.bib')
Now insert citations like this: @R-knitr, [@R-knitr;@R-rosr].
temperature <- 17
We can use the results. For example, the mean temperature is r temperature
degree.
Split one slide into two columns like this:
::::columns :::column
This is the left column
::: :::column
This is the right column ::: ::::
Insert notes like this:
:::notes
Choose the right option for notes:
in the YAML header of this template.
:::
Insert vertical spaces like this:
\vspace{\baselineskip}
Create columns with different widths like this:
\vspace{3\baselineskip}
::::columns ::: {.column width=.3}
This is a narrow column.
:::
::: {.column width=.7}
This is a wide one.
::: ::::
\vspace{.5in}
'in' means 'inches'.
Insert invisable texts like this:
\invisible{
Hidden texts.
}
The codes in this section are all commented, for non-'rosr' project. But if you are organizing a 'rosr' project with, you can share resources easily between manuscripts, slides, posters, and so on. In a 'rosr' project, images are placed in the 'image' folder, bibliography in the 'bib' folder, R scripts in the 'R' folder, and equations in the 'equation' folder. If this is in a 'rosr' project, uncomment the following codes and try.
Firstly, we save the working directory. switch off the warning and message display in a manuscript if you want.
# oldwd <- getwd() # knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)
set the root dir as the project directory, syc the bibliography and load data or functions within the project.
# knitr::opts_knit$set(root.dir = dirname(dirname(oldwd)))
# file.copy('bib/rosr.bib', oldwd) # source('R/rosr.R')
If you load the 'rosr' package,
# require('rosr')
an image could be inserted like this:
# fig('rosr_R.png')
and an equation could be inserted like this:
# eqs <- 'equation/rosr-eq.Rmd' # eq(eqs, label = 'sd')
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.