例如,是否可以导入 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
---
关于r - xaringan:添加带有宏的自定义 Latex 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55277391/