Now that your Gitbook project is setup, you can edit the .Rmd
files with your content. The Rgitbook
package adds two important features: The ability to include R code directly in your documents and support for MathJax. RStudio has an excellent tutorial on using R Markdown on their website at http://www.rstudio.com/ide/docs/authoring/using_markdown. However, the basic format is:
```{r label, options}
# R code
```
The full list of options that alter how the R markdown chunck is processed and displayed is avaiable here: http://yihui.name/knitr/options.
MathJax is a JavaScript library that allows for embedding LaTeX style formulas in HTML, for example \( a^2 + b^2 = c^2 \).
$${ e }^{ i\pi }+1=0$$
For inline equations, use surround the equation with \\(
and \\)
. For equations on their own line, the typical LaTeX formatting applies by surround the equation between $$
. If you are new to LaTeX equations, the Daum Equation Editor for Google Chrome or Mac OS X provides a nice user interface for designing equations.
Building Gitbooks is a two step processes. First, R Markdown files must be converted to plain Markdown files and second, the Markdown files be converted to a Gitbook (either HTML, PDF, or eBook). The next two sections outline the functions and options for building.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.