Theorem 2.2.2. Pythagorean theorem.
For a right triangle, if \(c\) denotes the length of the hypotenuse and \(a\) and \(b\) denote the lengths of the other two sides, we have
\begin{equation*}
a^2 + b^2 = c^2
\end{equation*}
bookdown to fill the gaps.
(#eq:label).
\begin{equation}
f\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k}
(#eq:binom)
\end{equation}
equation* environment:
\begin{equation*}
\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x)
\end{equation*}
\begin{align}
g(X_{n}) &= g(\theta)+g'({\tilde{\theta}})(X_{n}-\theta) \notag \\
\sqrt{n}[g(X_{n})-g(\theta)] &= g'\left({\tilde{\theta}}\right)
\sqrt{n}[X_{n}-\theta ] (\#eq:align)
\end{align}
split environment inside equation so that all lines share the same number (2.2.4). By default, each line in the align environment will be assigned an equation number. We suppressed the number of the first line in the previous example using \notag. In this example, the whole split environment was assigned a single number.
\begin{equation}
\begin{split}
\mathrm{Var}(\hat{\beta}) & =\mathrm{Var}((X'X)^{-1}X'y)\\
& =(X'X)^{-1}X'\mathrm{Var}(y)((X'X)^{-1}X')'\\
& =(X'X)^{-1}X'\mathrm{Var}(y)X(X'X)^{-1}\\
& =(X'X)^{-1}X'\sigma^{2}IX(X'X)^{-1}\\
& =(X'X)^{-1}\sigma^{2}
\end{split}
(\#eq:var-beta)
\end{equation}
::: {.theorem}
This is a `theorem` environment that can contain **any**
_Markdown_ syntax.
:::
| Environment | Printed Name | Label Prefix |
|---|---|---|
theorem |
Theorem | thm |
lemma |
Lemma | lem |
corollary |
Corollary | cor |
proposition |
Proposition | prp |
conjecture |
Conjecture | cnj |
definition |
Definition | def |
example |
Example | exm |
exercise |
Exercise | exr |
hypothesis |
Hypothesis | hyp |
::: {.theorem} with other environment names in TableΒ 2.2.1, e.g., ::: {.lemma}.
name attribute so its name will be printed. For example,
::: {.theorem name="Pythagorean theorem"}
For a right triangle, if $c$ denotes the length of the hypotenuse
and $a$ and $b$ denote the lengths of the other two sides, we have
$$a^2 + b^2 = c^2$$
:::
#label. For example,
::: {.theorem #foo}
A labeled theorem here.
:::
\@ref(prefix:label). See the column Label Prefix in TableΒ 2.2.1 for the value of prefix for each environment. For example, we have a labeled and named theorem below, and \@ref(thm:pyth) gives us its theorem number:
::: {.theorem #pyth name="Pythagorean theorem"}
For a right triangle, if $c$ denotes the length of the hypotenuse
and $a$ and $b$ denote the lengths of the other two sides, we have
$$a^2 + b^2 = c^2$$
:::
proof, remark, and solution. The syntax is similar to theorem environments, and proof environments can also be named using the name attribute. The only difference is that since they are unnumbered, you cannot reference them, even if you provide an ID to a proof environment.
<div></div> with the CSS class being the environment name, e.g., <div class="lemma"></div>. For LaTeX output, we have predefined the style to be definition for environments definition, example, exercise, and hypothesis, and remark for environments proof and remark. All other environments use the plain style. The style definition is done through the \theoremstyle{} command of the amsthm package. If you do not want the default theorem definitions to be automatically added by bookdown, you can set options(bookdown.theorem.preamble = FALSE).
bookdown::pdf_book with a base_format that has already included amsmath definitions.
number_sections = FALSE), all theorems are numbered sequentially from 1, 2, β¦, N. LaTeX supports numbering one theorem environment after another, e.g., let theorems and lemmas share the same counter. This is not supported for HTML/EPUB output in bookdown. You can change the numbering scheme in the LaTeX preamble by defining your own theorem environments, e.g.,
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{theorem} in your LaTeX preamble, it will not write out its default theorem definitions, which means you have to define all theorem environments by yourself. For the sake of simplicity and consistency, we do not recommend that you do this. It can be confusing when your Theorem 18 in PDF becomes Theorem 2.4 in HTML.
https://en.wikipedia.org/wiki/Characteristic_function_(probability_theory)
```{theorem pyth, name="Pythagorean theorem"}
For a right triangle, if $c$ denotes the length of the hypotenuse
and $a$ and $b$ denote the lengths of the other two sides, we have
$$a^2 + b^2 = c^2$$
```
::: {.theorem #pyth name="Pythagorean theorem"}
For a right triangle, if $c$ denotes the length of the hypotenuse
and $a$ and $b$ denote the lengths of the other two sides, we have
$$a^2 + b^2 = c^2$$
:::
bookdown::fence_theorems() to convert a whole file or a piece of text. This is a one-time operation. We have tried to do the conversion from old to new syntax safely, but we might have missed some edge cases. To make sure you do not overwrite the input file by accident, you can write the converted source to a new file, e.g.,
bookdown::fence_theorems("01-intro.Rmd", output = "01-intro-new.Rmd")
01-intro-new.Rmd. Using output = NULL will print the result of conversion in the R console, and is another way to check the conversion. If you are using a version control tool, you can set output to be the same as input, as it should be safe and easy for you to revert the change if anything goes wrong.
(PART). This kind of header is translated to part titles. If you are familiar with LaTeX, this basically means \part{}. When your book has a large number of chapters, you may want to organize them into parts, e.g.,
# (PART) Part I {-}
# Chapter One
# Chapter Two
# (PART) Part II {-}
# Chapter Three
(PART\*) (the backslash before * is required) instead of (PART) if a part title should not be numbered.
(APPENDIX), indicating that all chapters after this header are appendices, e.g.,
# Chapter One
# Chapter Two
# (APPENDIX) Appendix {-}
# Appendix A
# Appendix B
fig.cap = "A long long figure caption.") or your R code (e.g., kable(caption = "A long long table caption.")). It is also useful when these captions contain special HTML or LaTeX characters, e.g., if the figure caption contains an underscore, it works in the HTML output but may not work in LaTeX output because the underscore must be escaped in LaTeX.
(ref:label) text, where label is a unique labeltext. It must be in a separate paragraph with empty lines above and below it. The paragraph must not be wrapped into multiple lines, and should not end with a white space. For example,
(ref:foo) Define a text reference **here**.
(ref:foo) in your figure/table captions. The text can contain anything that Markdown supports, as long as it is one single paragraph. Here is a complete example:
A normal paragraph.
(ref:foo) A scatterplot of the data `cars` using **base** R graphics.
```{r foo, fig.cap='(ref:foo)'}
plot(cars) # a scatterplot
```