在 R markdown 文档中插入节符号

Insert section symbol in R markdown document

如何在 R markdown 文档中插入节符号?

因为我不知道如何在这个问题中插入符号,所以我会推荐你​​到这个页面,https://en.wikipedia.org/wiki/Section_sign

我可以使用 Latex 合并其他符号,例如 $\dag$ 给我一把匕首,$\ddag$ 给我一把双匕首。 (匕首和双匕首都可以在上面的link页面查看。)但是如果我使用$\s$$\S$(我在互联网上搜索到的)作为部分符号, 我只是在我的文档中得到 $\s$ in $\S$.

节符号不是数学符号,因此它不需要处于数学模式(在美元符号内)。直接用\S就可以了

最小示例:

---
title: "Section Symbol"
author: "Gregor"
date: "November 16, 2015"
output: pdf_document
---

\S this is the section symbol.

如果你需要在数学模式中使用它,你可以将它括在 \text{} 中,例如这将产生一个显示方程,Gamma = Section Symbol(请随意使用 $$ \[):

\[
    \Gamma = \text{\S}
\]

当然,markdown 中的特殊代码取决于您的目标格式。如果您通过 LaTeX 编译为 PDF,以上内容将起作用。如果您的目标格式是 HTML,那么根据问题中的维基百科 link,代码是 §,这对我有用:

---
title: "Section Symbol"
author: "Gregor"
date: "November 16, 2015"
output: html_document
---

§ this is the section symbol.

注意输出现在是 html_document这也适用于 Word。

虽然不太容易记住/需要更多手动操作,但您也可以将 Unicode 节符号字符直接插入到您的 Rmd 文档中。您可能 copy/paste 维基百科 link 中的符号,或者遵循维基百科 link 中的 "Typing Character" 说明,例如 Windows 上的 Alt+0167。