我可以将正文与边注对齐吗?

Can I align body text with margin note?

我正在使用 tufte R 包创建一个带有边注的 html 文档。我的一些边注是相当高的数字。例如:


    ---
    title: Big sidenote
    output:
      tufte::tufte_html: default
    ---

    ```{r setup, include=FALSE}
    library(tufte)
    # invalidate cache when the tufte version changes
    knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
    options(htmltools.dir.version = FALSE)
    ```


    ```{r fig.margin = TRUE, fig.cap="Fig1. My margin figure is kind of tall.", echo=FALSE}

    plot(mtcars)

    ```

    Here is paragraph 1. It's pretty short and it's associated with Fig 1.

    ```{r fig.margin = TRUE, fig.cap="Fig 2. Related to the second paragraph.", echo=FALSE}

    plot(subset(mtcars, cyl==6))

    ```

    I'd like this paragraph to start in line with Fig 2.
    ```

     I would like the paragraph in the main body to begin below the bottom of the figure in the margin.

降价内可以吗?我的 CSS skills/understanding 是有限的。

我明白了。对于了解 CSS 的人来说很简单,但对于那些不了解的人来说这里很简单。边注是用浮点数 属性 创建的。您可以使用浮动 属性 来禁止浮动元素出现在文本的一侧。

我创建了一个新的 "cleared" class 来清除右边的元素:

<style>
  .cleared {clear: right;}
</style>

然后,每当我希望文本跳到下一个数字时,我创建了一个 div 已清除的 class:

<div class = "cleared"></div>

完整示例如下:

---
title: Big sidenote
output:
  tufte::tufte_html: default
---

<style>
  .cleared {clear: right;}
</style>

```{r setup, include=FALSE}
library(tufte)
# invalidate cache when the tufte version changes
knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
options(htmltools.dir.version = FALSE)
```


```{r fig.margin = TRUE, fig.cap="Fig1. My margin figure is kind of tall.", echo=FALSE}
plot(mtcars)
```

Here is paragraph 1. It's pretty short and it's associated with Fig 1.

<div class = "cleared"></div>

```{r fig.margin = TRUE, fig.cap="Fig 2. Related to the second paragraph.", echo=FALSE}
plot(subset(mtcars, cyl==6))
```

I'd like this paragraph to start in line with Fig 2.

结果: