Chapter 10: test
10.1 RStudio
10.1.1 RMarkdown preview LaTeX equation options
https://tex.stackexchange.com/questions/474458/r-markdown-preview-latex-by-scrolling-over
10.1.2 writer options
https://rstudio.github.io/visual-markdown-editing/markdown.html#writer-options
10.1.2.1 line wrapping
https://rstudio.github.io/visual-markdown-editing/markdown.html#line-wrapping
10.1.2.2 ensuring the same markdown between source / visual mode
canonical mode
https://rstudio.github.io/visual-markdown-editing/markdown.html#canonical-mode
10.1.3 Rtools
Rtools43 for Windows https://cran.r-project.org/bin/windows/Rtools/rtools43/rtools.html
10.1.4 addins
https://github.com/rstudio/addinexamples
if (!requireNamespace("devtools", quietly = TRUE))
install.packages("devtools")
devtools::install_github("rstudio/htmltools")
devtools::install_github("rstudio/shiny")
devtools::install_github("rstudio/miniUI")
10.1.5 Git
commit: filename or extension is too long
https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows
10.2 RMarkdown
https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf
https://slides.yihui.org/2020-taipei-satrday-rmarkdown.html#1
10.2.1 verbatim
https://community.rstudio.com/t/continued-issues-with-new-verbatim-in-rstudio/139737
https://bookdown.org/yihui/rmarkdown-cookbook/verbatim-code-chunks.html
10.2.2 Pandoc link
https://pandoc.org/chunkedhtml-demo/8.16-links-1.html
https://stackoverflow.com/questions/39281266/use-internal-links-in-rmarkdown-html-output
https://community.rstudio.com/t/how-to-hyperlink-between-different-rmd-files-in-rmarkdown/62289
10.2.3 URL
https://stackoverflow.com/questions/29787850/how-do-i-add-a-url-to-r-markdown
[I'm an inline-style link](https://www.google.com)
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself]
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
10.2.4 arrow
https://reimbar.org/dev/arrows/
Up arrow: ↑
Down arrow: ↓
Left arrow: ←
Right arrow: →
Double headed arrow: ↔
10.2.5 superscript and subscript
scriptsuperscriptsubscript
script^superscript^
scriptsuperscript
~subscript~
scriptsubscript
10.2.5.1 LaTeX
https://tex.stackexchange.com/questions/580824/subscript-not-distinguished-enough
https://tex.stackexchange.com/questions/262295/make-subscript-size-smaller-always
10.2.5.3 aligned
\[ \begin{aligned} c^{2} = & a^{2}+b^{2} \\ = & b^{2}+a^{2} \quad +\text{commutavie} \\ = & b^{2}+a^{2} \qquad +\text{commutavie} \\ = & b^{2}+a^{2} \qquad \Box \end{aligned} \]
\[ \begin{aligned} c^{2} = & a^{2}+b^{2} \\ = & b^{2}+a^{2} & +\text{commutavie} \\ = & a^{2}+b^{2} & +\text{commutavie} \\ = & b^{2}+a^{2} & \Box \end{aligned} \]
\[ \begin{aligned} c^{2} = & a^{2}+b^{2} & & & c^{2} = & a^{2}+b^{2} \\ = & b^{2}+a^{2} & +\text{commutavie} & +\text{commutavie} & = & b^{2}+a^{2} & +\text{commutavie} \\ = & a^{2}+b^{2} & +\text{commutavie} & +\text{commutavie} & = & a^{2}+b^{2} & +\text{commutavie} \\ = & b^{2}+a^{2} & \Box & +\text{commutavie} & = & b^{2}+a^{2} & \Box \end{aligned} \]
10.2.5.4 proof QED
https://math.meta.stackexchange.com/questions/3582/qed-for-mathjax-here-on-stackexchange
\tag*{$\Box$}
\[ a^2+b^2=c^2 \tag*{$\Box$} \]
\tag*{$\blacksquare$}
\[ a^2+b^2=c^2 \tag*{$\blacksquare$} \]
10.2.6 image
https://stackoverflow.com/questions/25166624/insert-picture-table-in-r-markdown
10.2.6.1 DiagrammeR / mermaid flowchart
Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML.
If your aiming to have some HTML widgets shown in non-HTML format as a screenshot,
please install webshot or webshot2 R package for knitr to do the screenshot.
Alternatively, you can allow HTML output in non-HTML formats
by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: true
Note however that the HTML output will not be visible in non-HTML formats.
https://bookdown.org/yihui/rmarkdown-cookbook/diagrams.html#diagrams
{r}
library(DiagrammeR)
mermaid("
graph LR
A-->B
",
width = 100
)
10.2.6.2 multiple images / figures in the same line
https://cosname.github.io/rmarkdown-guide/rmarkdown-base.html#element-figure
{r, fig.show = "hold", out.width = "50%"}
plot(cars)
plot(nhtemp)
cf.
{r}
plot(cars)
plot(nhtemp)
10.2.6.3 figure size
https://sebastiansauer.github.io/figure_sizing_knitr/
YAML in index.Rmd
first R-chunk in your RMD document
knitr::opts_chunk$set(fig.width=12, fig.height=8)
width, height and options
```{r fig.height = 3, fig.width = 5
plot(pressure)
```
{r fig.height = 3, fig.width = 5
{r fig.height = 3, fig.width = 3, fig.align = "center"
{r fig.width = 5, fig.asp = .62
![](https://bookdown.org/yihui/rmarkdown-cookbook/images/cover.png)
10.2.6.3.1 knitr
https://yihui.org/knitr/options/
https://bookdown.org/yihui/rmarkdown/tufte-figures.html
We know from _the first fundamental theorem of calculus_ that
for $x$ in $[a, b]$:
$$\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x).$$
10.2.6.3.2 out.width
vs. fig.width
when chunk option cache=FALSE
is set, then out.width
has no effect because no PDF output is created. Hence one has to specify exact measures in inches for fig.width
and fig.height
for each chunk
https://stackoverflow.com/questions/59567235/a-ggmap-too-small-when-rendered-within-a-rmd-file
problem: out.width='100%'
causing LaTeX Error: Not in outer par mode.
solution: out.width=if (knitr:::is_html_output()) '100%'
fig.width=10, fig.height=2
out.width=if (knitr:::is_html_output()) '100%'
10.2.6.4 dynamic knitr plot width and height
https://stackoverflow.com/questions/15365829/dynamic-height-and-width-for-knitr-plots
10.2.6.5 web image in PDF
cover_url = 'https://bookdown.org/yihui/bookdown/images/cover.jpg'
if (!file.exists(cover_file <- xfun::url_filename(cover_url)))
xfun::download_file(cover_url)
knitr::include_graphics(if (knitr::pandoc_to('html')) cover_url else cover_file)
Fig. 10.1: conic sections
![conic sections](202401280001-test_files/figure-html/unnamed-chunk-24-1.png)
Fig. 10.2: conic sections
10.2.9 hyperlink
PDF pandoc internal link will lose focus
equivalence relation [14] equivalence relation4 equivalence relation[14]
equivalence class [13] equivalence class5 equivalence class[13]
10.2.10 code chunk
10.2.10.1 code folding
https://cosname.github.io/rmarkdown-guide/rmarkdown-document.html#html-code-folding
10.2.11 xaringan
slide realtime preview with RStudio addin Infinite Moon Reader in RStudio viewer
10.2.12 embed HTML or web page
10.2.12.2 include URL
https://bookdown.org/yihui/rmarkdown-cookbook/include-url.html
knitr::include_url("https://yihui.org")
10.2.12.3 htmltools
https://stackoverflow.com/questions/36524238/include-html-files-in-r-markdown-file
however out.height
etc. not works
10.3 Bookdown
10.3.1 system locale
https://bookdown.org/tpemartin/ntpu-programming-for-data-science/appendix-d-.html
Sys.getlocale()
Windows
Sys.setlocale(category = "LC_ALL", locale = "UTF-8")
MacOS
Sys.setlocale(category = "LC_ALL", locale = "en_US.UTF-8")
https://bookdown.org/yihui/rmarkdown-cookbook/multi-column.html
10.3.2 render_book()
https://bookdown.org/yihui/bookdown/build-the-book.html
render_book(input = ".", output_format = NULL, ..., clean = TRUE,
envir = parent.frame(), clean_envir = !interactive(),
output_dir = NULL, new_session = NA, preview = FALSE,
config_file = "_bookdown.yml")
10.3.3 serve_book()
https://bookdown.org/yihui/bookdown/serve-the-book.html
serve_book(dir = ".", output_dir = "_book", preview = TRUE,
in_session = TRUE, quiet = FALSE, ...)
10.3.4 LaTeX
10.3.4.2 ugly mathptmx \(\sum\)
PDF LaTeX \usepackage{fdsymbol}
to have \overrightharpoon
vector; however, there are too many side effects, including ugly mathptmx \(\sum\), …
\usepackage{fdsymbol} % vector over accent, but will use mathptmx
% replace the rather ugly mathptmx \sum operator with the equivalent Computer Modern one
\let\sum\relax
\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}
\DeclareMathSymbol{\sum}{\mathop}{CMlargesymbols}{"50}
https://tex.stackexchange.com/questions/315102/different-sum-signs
https://tex.stackexchange.com/questions/275038/how-to-replace-mathptmx-sum-with-cm-sum
https://blog.csdn.net/kongtaoxing/article/details/131005044
In preamble.tex
, add
% replace the rather ugly mathptmx \sum operator with the equivalent Computer Modern one
\let\sum\relax
\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}
\DeclareMathSymbol{\sum}{\mathop}{CMlargesymbols}{"50}
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
\DeclareSymbolFont{largesymbols}{OMX}{cmex}{m}{n}
10.3.4.3 LaTeX package in HTML document
https://github.com/rstudio/rmarkdown/issues/1829
---
title: "assignment"
author: "author"
output: html_document
---
$$
\require{cancel}
\cancel{x}
$$
\[ \require{cancel} \cancel{x} \]
https://stackoverflow.com/questions/18189175/how-to-use-textup-with-mathjax
\textup
is not available in MathJax. You can replace it with\mathrm
, but\mathrm
does not interpret spaces.
10.3.5 depth of table of contents toc_depth
https://stackoverflow.com/questions/49009212/how-to-change-toc-depth-in-r-bookdown-gitbook
10.3.6 multi-column layout / two columns
https://bookdown.org/yihui/rmarkdown-cookbook/multi-column.html
10.3.6.1 for both HTML and PDF
Below is a Div containing three child Divs side by side. The Div in the middle is empty, just to add more space between the left and right Divs.
:::::: {.cols data-latex=""}
::: {.col data-latex="{0.55\textwidth}"}
<img src="202401280001-test_files/figure-html/unnamed-chunk-35-1.png" width="480" />
:::
::: {.col data-latex="{0.05\textwidth}"}
\
<!-- an empty Div (with a white space), serving as
a column separator -->
:::
::: {.col data-latex="{0.4\textwidth}"}
The figure on the left-hand side shows the `cars` data.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur.
:::
::::::
{r, echo=FALSE, fig.width=5, fig.height=4}
The figure on the left-hand side shows the cars
data.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
{r, echo=FALSE, fig.width=10, fig.height=8, out.width = "100%"}
The figure on the left-hand side shows the cars
data.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
{r, echo=FALSE, fig.width=10, fig.height=8}
The figure on the left-hand side shows the cars
data.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
10.3.6.2 multi-column fig.cap
must use fig.pos="H"
https://bookdown.org/yihui/rmarkdown-cookbook/figure-placement.html
to avoid LaTeX Error: Not in outer par mode
for caption in multi-column LaTeX PDF
in output.yml
add extra_dependencies: ["float"]
under bookdown::pdf_book:
include first chunk knitr::opts_chunk$set(fig.pos = "H", out.extra = "")
in .Rmd
add out.width=if (knitr:::is_html_output()) '50%'
for TikZ chunk
thus complete chunk beginning with {r, echo=FALSE, cache=TRUE, engine='tikz', fig.ext=if (knitr:::is_latex_output()) 'pdf' else 'png', fig.width=10, fig.height=2, out.width=if (knitr:::is_html_output()) '100%', fig.cap=''}
LaTeX package caption
What is the different between using \captionof{table}{ABC}
and \caption{ABC}
?
side-by-side table
R ternary operator
https://stackoverflow.com/questions/8790143/does-the-ternary-operator-exist-in-r
10.3.6.3 caption above figure
https://stackoverflow.com/questions/56979022/caption-above-figure-in-html-rmarkdown
fig.topcaption=TRUE
10.3.6.4 for only HTML
10.3.6.4.1 CSS flex
Here is the first Div.
## 'data.frame': 150 obs. of 5 variables:
## $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
## $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
## $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
## $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
## $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
10.4 conditional block/chunk for either HTML or PDF, and Chinese issue
等價關係 equivalence relation
等價關係 equivalence relation
等價關係 equivalence relation
等價關係 equivalence relation
等價關係 equivalence relation
\[ a+b \]
\[\begin{align*} & R\text{ is an equivalence relation over }A\times B\\ \Leftrightarrow & \begin{cases} R=\sim=\left\{ \left\langle x,y\right\rangle \middle|x\sim y\right\} \subseteq A\times B & \left(\text{e}\right)\text{equivalence 等價}\\ \vdots & \vdots \end{cases}\\ \Leftrightarrow & \begin{cases} R=\left\{ \left\langle x,y\right\rangle \middle|xRy\right\} \subseteq A\times B & \left(R\right)\text{relation}\\ \forall\left\langle x,y\right\rangle \in R\left(xRx\right) & \left(r\right)\text{reflexive}\\ \forall\left\langle x,y\right\rangle \in R\left(xRy\Rightarrow yRx\right) & \left(s\right)\text{symmetric}\\ \forall\left\langle x,y\right\rangle ,\left\langle y,z\right\rangle \in R\left(\begin{cases} xRy\\ yRz \end{cases}\Rightarrow xRz\right) & \left(t\right)\text{transitive} \end{cases}\Leftrightarrow\begin{cases} R=\left\{ \left\langle x,y\right\rangle \middle|xRy\right\} \subseteq A\times B & \text{關係}\\ \forall\left\langle x,y\right\rangle \in R\left(\left\langle x,x\right\rangle \in R\right) & \text{自反}\\ \forall\left\langle x,y\right\rangle \in R\left(\left\langle y,x\right\rangle \in R\right) & \text{對稱}\\ \forall\left\langle x,y\right\rangle ,\left\langle y,z\right\rangle \in R\left(\left\langle x,z\right\rangle \in R\right) & \text{遞移} \end{cases} \end{align*}\]
\[\begin{align*} & R\text{ is an equivalence relation over }A\times B\\ \Leftrightarrow & \begin{cases} R=\sim=\left\{ \left\langle x,y\right\rangle \middle|x\sim y\right\} \subseteq A\times B & \left(\text{e}\right)\text{equivalence 等價}\\ \vdots & \vdots \end{cases}\\ \Leftrightarrow & \begin{cases} R=\left\{ \left\langle x,y\right\rangle \middle|xRy\right\} \subseteq A\times B & \left(R\right)\text{relation}\\ \forall\left\langle x,y\right\rangle \in R\left(xRx\right) & \left(r\right)\text{reflexive}\\ \forall\left\langle x,y\right\rangle \in R\left(xRy\Rightarrow yRx\right) & \left(s\right)\text{symmetric}\\ \forall\left\langle x,y\right\rangle ,\left\langle y,z\right\rangle \in R\left(\begin{cases} xRy\\ yRz \end{cases}\Rightarrow xRz\right) & \left(t\right)\text{transitive} \end{cases}\Leftrightarrow\begin{cases} R=\left\{ \left\langle x,y\right\rangle \middle|xRy\right\} \subseteq A\times B & \text{關係}\\ \forall\left\langle x,y\right\rangle \in R\left(\left\langle x,x\right\rangle \in R\right) & \text{自反}\\ \forall\left\langle x,y\right\rangle \in R\left(\left\langle y,x\right\rangle \in R\right) & \text{對稱}\\ \forall\left\langle x,y\right\rangle ,\left\langle y,z\right\rangle \in R\left(\left\langle x,z\right\rangle \in R\right) & \text{遞移} \end{cases} \end{align*}\]
10.5 video embedding
https://stackoverflow.com/questions/42543206/r-markdown-compile-error
always_allow_html: true
however webshot not work
https://cran.r-project.org/web/packages/vembedr/vignettes/embed.html
## Warning: package 'vembedr' was built under R version 4.2.3
Error: cannot find bilibili.com
https://cran.r-project.org/web/packages/vembedr/vignettes/embed.html
## embed_youtube("0LFg5dvPOoc")
10.6 equation term coloring
10.6.1 font color
RegEx replacement in RStudio for {\\color{(\w+)}
in LyX to be replaced with \\color{$1}{
in HTML document, and remain the same for PDF document
In HTML document, if no {}
for text range, only the first following term will take effect
\color{orange}x=y
\[\color{orange}x=y\]
\color{orange}
and \color{cyan}
are better color for HTML GitBook White
and Night
themes and PDF
\color{cyan}{x=y}
\[\color{orange}{x=y}\]
\color{cyan}{x=y}
\[\color{cyan}{x=y}\]
::: {show-in="html"}
$$
\dfrac{\colorbox{#FFD1DC}{$\epsilon^{2}\left(y_{{\scriptscriptstyle F}}-y_{{\scriptscriptstyle L}}\right)^{2}$}}{1-\epsilon^{2}}
$$
:::
::: {show-in="pdf"}
$$
\dfrac{\colorbox{red!50}{\text{\ensuremath{\epsilon^{2}\left(y_{{\scriptscriptstyle F}}-y_{{\scriptscriptstyle L}}\right)^{2}}}}}{1-\epsilon^{2}}
$$
:::
10.6.2 background color
https://bookdown.org/yihui/rmarkdown-cookbook/font-color.html
LaTex color
https://www.overleaf.com/learn/latex/Using_colors_in_LaTeX
https://latex-tutorial.com/color-latex/#:~:text=To%20summarize%2C%20pyellow!50efined%20colors%20in,when%20loading%20the%20xcolor%20package.
LaTex color methods
color frame
https://tex.stackexchange.com/questions/582748/highlight-equation-with-boxes-and-arrows
color box
https://tex.stackexchange.com/questions/567739/how-to-move-and-size-colorbox
color box with round corners
https://tex.stackexchange.com/questions/568880/color-box-with-rounded-corners
highlighting
https://tex.stackexchange.com/questions/318991/highlighting-math
https://forum.remnote.io/t/highlighting-latex-formulas/149
LyX
https://tex.stackexchange.com/questions/250069/create-a-color-box https://latexlyx.blogspot.com/2013/12/lyx.html
https://tex.stackexchange.com/questions/635486/prevent-lyx-from-escaping-math-in-color-box-title
Bookdown - conditional display of text and code blocks (LaTeX/PDF vs. HTML) https://stackoverflow.com/questions/76240244/bookdown-conditional-display-of-text-and-code-blocks-latex-pdf-vs-html
\[ \require{color} \colorbox{#FFD1DC}{$F$}=\colorbox{#FFD1DC}{$ma$} \]
10.7 link and reference
https://stackoverflow.com/questions/57469501/cross-referencing-bookdownhtml-document2-not-working
\[\begin{equation} E=mc^2 \tag{10.1} \end{equation}\]
\@ref(nice-label)
10.8
[link to partition][partition]
link to partition
[partition]
\@ref(partition)
partition [#partition] (12) @ref(#partition)
[equivalence class]
\@ref(equivalence-class)
equivalence class [#equivalence class] (@ref(equivalence class)) @ref(#equivalence class)
[equivalence-class] [#equivalence-class] (13) @ref(#equivalence-class)
X [equivalence-class.html] [equivalence-class.html#equivalence-class] (@ref(equivalence-class.html)) @ref(equivalence-class.html#equivalence-class)
equivalence relation [#equivalence relation] (@ref(equivalence relation)) @ref(#equivalence relation)
[equivalence-relation] [#equivalence-relation] (14) @ref(#equivalence-relation)
X [equivalence-relation.html] [equivalence-relation.html#equivalence-relation] (@ref(equivalence-relation.html)) @ref(equivalence-relation.html#equivalence-relation)
10.8 number and reference equations
https://bookdown.org/yihui/rmarkdown/bookdown-markdown.html#equations
\#eq:emc
\@ref(eq:emc)
\[\begin{equation} \begin{aligned} & C\text{ is an equivalence class of }a\text{ on }A\\ \Leftrightarrow & \left[a\right]_{\sim}=C=\left\{ x\middle|\begin{cases} a\in A\\ x\in A\\ x\sim a\\ \sim\text{ is an equivalence relation over }A\times A=A^{2} \end{cases}\right\} \subseteq A\ne\emptyset\\ \Leftrightarrow & \left[a\right]=\left[a\right]_{\sim}=\left\{ x\middle|\begin{cases} a\in A\\ x\in A\\ x\sim a\\ \sim\text{ is an equivalence relation on }A \end{cases}\right\} \subseteq A\ne\emptyset\\ \Rightarrow & \left[a\right]_{\sim}=\left\{ x\middle|x\sim a\right\} \subseteq A\ne\emptyset \end{aligned} \tag{10.2} \end{equation}\]
https://bookdown.org/yihui/rmarkdown/bookdown-markdown.html#cross-referencing
This cross reference is the Fig. 10.5
https://stackoverflow.com/questions/51595939/bookdown-cross-reference-figure-in-another-file
I ran into the same issue and came up with this solution if you aim at compiling 2 different pdfs. It relies on LaTeX’s xr package for cross references: https://stackoverflow.com/a/52532269/576684
10.9 footnote
noun^[This is a footnote]
noun[^202401260000-test-cross-link-1]
[^202401260000-test-cross-link-1]: This is a footnote.
noun8
10.10 citation
10.10.1 citation in fig.cap
https://tex.stackexchange.com/questions/591882/citation-within-a-latex-figure-caption-in-rmarkdown
(ref:rudolph) *nice* cite: [@Lam94].
(ref:campbell1963) *nice* cite: [@campbell1963].
(ref:campbell1963) ([@campbell1963]
(ref:campbell1963) \ [@campbell1963]
![pre- and true experimental designs ( 5 p.8)](img/pre-and-true-experimental-designs.png)
Fig. 10.4: pre- and true experimental designs ( 5 p.8)
10.11 environment for definition, theorem, proof
https://bookdown.org/yihui/rmarkdown/bookdown-markdown.html
https://github.com/rstudio/rstudio/issues/5264
@howthebodyworks
Ideally, previews of such equations should also work inside a theorem, although I could survive without that.
https://github.com/rstudio/rstudio/issues/8773
Theorem 10.1 (Theorem Name) Here is my theorem.
Proof (Proof Name). Here is my proof.
Theorem 10.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
\[a^2 + \color{cyan}b^2 \overset{\ref{eq:emc}}= \color{red}{c^2} \]
Definition 10.1 (Definition Name) Here is my definition.
number and reference equations
![parabola arc with points](202401280001-test_files/figure-html/parabola-arc-with-points-1.png)
Fig. 10.5: parabola arc with points
10.11.1 collapsible panel or HTML component
https://stackoverflow.com/questions/52576626/rmarkdown-collapsible-panel
Theorem 10.3 This is the description of a theorem
\[ c^2=a^2+b^2 \]
Proof:
\[ c^2=a^2+b^2 \]
\[ \tag*{$\Box$} \]10.12 slide or presentation
10.12.1 Xaringan and Infinite Moon Reader
https://rpubs.com/RW1304/xarigan-zh
https://slides.yihui.org/xaringan/#1
https://slides.yihui.org/xaringan/zh-CN.html#1
10.12.2 ioslides
https://www.youtube.com/watch?v=gkyjTcpCITM
https://bookdown.org/yihui/rmarkdown/ioslides-presentation.html
/* theorem environment _ plain */
/*
.theorem {
display: block;
font-style: italic;
font-size: 24px;
font-family: "Times New Roman";
color: black;
}
.theorem::before {
content: "Theorem. ";
font-weight: bold;
font-style: normal;
}
.theorem[text]::before {
content: "Theorem (" attr(text) ") ";
}
.theorem p {
display: inline;
}
*/
/* theorem environment _ Copenhagen style */
/*
.theorem {
display: block;
font-style: italic;
font-size: 24px;
font-family: "Times New Roman";
color: black;
border-radius: 10px;
background-color: rgb(222,222,231);
box-shadow: 5px 10px 8px #888888;
}
.theorem::before {
content: "Theorem. ";
font-weight: bold;
font-style: normal;
display: inline-block;
width: -webkit-fill-available;
color: white;
border-radius: 10px 10px 0 0;
padding: 10px 5px 5px 15px;
background-color: rgb(38, 38, 134);
}
.theorem p {
padding: 15px 15px 15px 15px;
}
*/
10.12.3 PowerPoint
https://bookdown.org/yihui/rmarkdown/powerpoint-presentation.html