我对Rmarkdown很陌生,并计划使用ioslides/slidy/xaringan来做我的演示。
我以前经常用电子束做演示。在光束中,我有一个设计成数学定理的定理环境。我希望能够在ioslides/slidy/xaringan中使用这种格式。我知道我可以用$$...$$来包含乳胶码,也可以显示方程式。然而,这还不足以满足我的需要。
我也知道在书中会有定理环境。但我不知道如何在ioslides/slidy/xaringan输出格式中这样做。
发布于 2020-09-05 15:24:04
对于评论中的讨论来说,这将是太长的时间,所以这里有一个答案。以下定义了受上述博客帖子中的想法启发的一些样式。
styles.css
.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;
}要在重标记演示文稿中使用这些样式,可以通过YAML头将它们包括在内。对于ioslides,它的工作方式是这样的(类似于粘滑和xaringan):
ioslides.Rmd (请注意,这要求styles.css与ioslides.Rmd位于同一个文件夹中)
---
title: "Theorem demo"
output:
ioslides_presentation:
css: styles.css
---现在,您可以使用类<div>元素theorem创建一个定理。
## CLT
<div class="theorem" text='CLT'>
The CLT states that, as $n$ goes to infinity, the sample average $\bar{X}$
converges in distribution to $\mathcal{N}(\mu,\sigma^2/n)$.
</div>

编辑:哥本哈根风格
精确地重新创建光束样式是很麻烦的,但是使用一些CSS技巧,您可以得到接近。下面是一个类似于theme: copenhagen的示例。
.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;
}

https://stackoverflow.com/questions/63749683
复制相似问题