好的Cloud2016 在具体测试过程中, \usepackage{amsmath}
的确不需要, 但如果少了\usepackage{graphicx}
, 我测试的例子会报错, 形如
! Undefined control sequence.
l.99 {\centering \includegraphics
[width=0.8\linewidth]{coss6_files/figure-la...
事实上, 我提的问题在全英文状态下根本不是问题, 相当简单, 甚至都不需要用latex_engine: xelatex
(用了反而变慢报错, 但要弄中文不用不行啊), 英文简单示例如下
---
title: "xxx"
author: "xxx"
date: "xxx"
documentclass: article
output:
bookdown::pdf_document2:
number_sections: no
toc: no
header-includes:
\usepackage{bm}
---
# test bold greek letters
$\bm{\alpha}$ and $\bm{\beta}$
$\boldsymbol{\alpha}$ and $\boldsymbol{\beta}$
<code class="katex-escape">$$T^{2}=\left[\overline{\mathbf{X}}_{1}-\overline{\mathbf{X}}_{2}-\left(\boldsymbol{\mu}_{1}-\boldsymbol{\mu}_{2}\right)\right]^{\prime}\left[\left(\frac{1}{n_{1}}+\frac{1}{n_{2}}\right) \mathbf{S}_{\text {pooled }}\right]^{-1}\left[\overline{\mathbf{X}}_{1}-\overline{\mathbf{X}}_{2}-\left(\boldsymbol{\mu}_{1}-\boldsymbol{\mu}_{2}\right)\right]$$</code>
# test equation crossref
\begin{equation}
E = mc^2
(\#eq:mc2)
\end{equation}
Hello, Equation \@ref(eq:mc2) !
# test figure crossref
```{r fig1, fig.cap='caption', out.width='80%', fig.align='center', echo=FALSE}
plot(1:10)
```
Hello, Figure \@ref(fig:fig1) !
# test table crossref
```{r tab1, tidy=FALSE, echo=FALSE}
knitr::kable(
head(iris, 20), caption = 'Here is a nice table!',
booktabs = TRUE
)
```
Hello, Table \@ref(tab:tab1) !