Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookdown Syntax #30

Open
coatless opened this issue Oct 17, 2016 · 0 comments
Open

Bookdown Syntax #30

coatless opened this issue Oct 17, 2016 · 0 comments

Comments

@coatless
Copy link
Contributor

coatless commented Oct 17, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant