【问题标题】:LaTeX {itemize} in R MarkdownR Markdown 中的 LaTeX {itemize}
【发布时间】:2021-02-24 19:21:28
【问题描述】:

如何在我的 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】:

只需在要逐项列出的句子开头使用 + 或 - 即可,它适用于 Rmarkdown 的 html 和 pdf 输出 例如
在“$”符号之间使用语句
$+ 此语句将在 rmd$ 中逐项列出

【讨论】:

    【解决方案2】:

    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>
    

    这显示为

    也许可以精心设计 CSS 使其在视觉上等效。

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

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

    它会产生

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-14
      • 2019-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-07
      • 1970-01-01
      相关资源
      最近更新 更多