xaringan:添加带有宏的自定义 Latex 文件
xaringan: add custom Latex file with macros
是否可以导入 Latex 宏文件,例如
\newcommand{\Xcal}{\mathcal{X}
这样我就可以在 $...$
之间使用它作为 $\Xcal$
?
是的,这似乎有效:
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
Macros: {
Xcal: "{\mathcal{X}}",
water: "{H_2O}"
}
}
});
</script>
$\water$
$\Xcal$
在脚本标签上使用 type=text/x-mathjax-config
很重要,这样 mathjax 才能找到块。有关在中定义宏的详细信息
可以找到 MathJax here.
另一种方法是使用 before_body
YAML 选项包含定义:
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
includes:
before_body: local.html
---
MathJax 允许您定义宏。在 Xaringan 中,您只需将宏放在双美元符号中。
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
$$\newcommand{\Xcal}{\mathcal{X}}$$
# Math Macros
You can define your own macros by putting them in double dollars signs.
```
$$\newcommand{\Xcal}{\mathcal{X}}$$
```
This symbol $\Xcal$ is a calligraphic X.
是否可以导入 Latex 宏文件,例如
\newcommand{\Xcal}{\mathcal{X}
这样我就可以在 $...$
之间使用它作为 $\Xcal$
?
是的,这似乎有效:
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
Macros: {
Xcal: "{\mathcal{X}}",
water: "{H_2O}"
}
}
});
</script>
$\water$
$\Xcal$
在脚本标签上使用 type=text/x-mathjax-config
很重要,这样 mathjax 才能找到块。有关在中定义宏的详细信息
可以找到 MathJax here.
另一种方法是使用 before_body
YAML 选项包含定义:
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
includes:
before_body: local.html
---
MathJax 允许您定义宏。在 Xaringan 中,您只需将宏放在双美元符号中。
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
$$\newcommand{\Xcal}{\mathcal{X}}$$
# Math Macros
You can define your own macros by putting them in double dollars signs.
```
$$\newcommand{\Xcal}{\mathcal{X}}$$
```
This symbol $\Xcal$ is a calligraphic X.