R Markdown中的LaTeX {itemize}

问题描述 投票:0回答:1

如何在我的R Markdown中包含以下LaTeX {itemize}?当我尝试编织HTML时,它根本不起作用。

---
title: "Untitled"
author: "March 2019"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

\[x = R + E\]
where:
\begin{itemize}
\item[R=] is Racoon
\item[E=] is Elephant
\end{itemize}
r latex r-markdown
1个回答
1
投票

R Markdown在生成HTML时不使用LaTeX。如果输出到pdf_document,你使用的代码将起作用,但对html_document则不起作用。

如果您真的想要HTML格式的标签列表,那么您将不得不插入HTML代码,而不是LaTeX代码。我不知道是否有任何视觉上等同于LaTeX的\item[R=],但你可以这样做,这在逻辑上是等价的:

---
title: "Untitled"
author: "March 2019"
output: html_document

---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

\[x = R + E\]
where:

<dl>
<dt>R=</dt>
<dd>is Racoon</dd>
<dt>E=</dt> 
<dd>is Elephant</dd>
</dl>

显示为

screenshot

也许可以制作CSS以使其在视觉上等效。

编辑补充说:当然这是可能的,并且已经完成。由于R Markdown使用Bootstrap框架,因此很容易关注https://stackoverflow.com/a/13371522/2554330。只需在第一个标记中添加一个类:

<dl class="dl-horizontal">
<dt>R=</dt>
<dd>is Racoon</dd>
<dt>E=</dt> 
<dd>is Elephant</dd>
</dl>

它产生了

another screenshot

如果样式仍不令人满意,请查看与https://stackoverflow.com/a/13371522/2554330相关的其他一些讨论。

© www.soinside.com 2019 - 2024. All rights reserved.