SMAC-Group / TTS

"A Tour of Time Series Analysis with R" (TTS) is a text that is aimed to provide better explanations for students investigating dependency within observations.
6 stars 5 forks source link

Bookdown Syntax #30

Open coatless opened 8 years ago

coatless commented 8 years ago

Hi folks,

Few reminders about writing in TTS:

Syntax

TTS uses bookdown to translate to multiple formats (gitbook [html], pdf [latex], epub) and as such has its own syntax in addition to markdown

Please do not use pure latex!

Most notably:

To label equations use:

\begin{equation} 
  f\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k}
  (\#eq:binom)
\end{equation} 

To refer to an equation:

\@ref(eq:binom)

To create a theorem, lemma, definition, corollary, proposition, or example block use:

  ```{theorem, label="gotpie", name="Pi is tasty!"}
  I ate pie, therefore, pie is tasty!
 ``` `

Depending on the environment prefix the label with either thm, lem, def, cor, prp, ex

Thus, the above reference would be:

\@ref(thm:gotpie)

To reference an outside material (e.g. via bibtex) first add the entry to the book.bib file then reference the key with either @key or [@key] to get Name (Year) or (Name Year), which translates roughly to \cite and \citep.

To refer to a figure:

\@ref(fig:chunkname)

IMPORTANT

If you want to cross-reference figures or tables generated from a code chunk, please make sure the chunk label only contains alphanumeric characters (a-z, A-Z, 0-9), slashes (/), or dashes (-). Other characters do not qualify.

Environment

To edit the text, one needs to setup the environment by following the instructions in the readme of the repository. Most notably, please when you open the tts.rproj file type:

source("code/init/install_packages.R")

This installs all of the packages required to build the textbook.