[英]RMarkdown: Space in LaTeX output at place of code for float
當在RMarkdown的兩個段落之間包含圖形的代碼時,該代碼產生的浮點數可能會放置在文檔的其他位置,從而在LaTeX / PDF輸出文件中的段落之間留有空間。
以下最小示例說明了此問題:
---
output: pdf_document
---
This is my first paragraph.
Next in the Rmd file would be the code for the figure.
The figure is correctly treated as a float by LaTeX, meaning that LaTeX will put it to the next suitable position.
```{r pressure, echo=FALSE, fig.cap="Example", out.width='0.5\\textwidth', fig.pos='B'}
plot(pressure)
```
The problem now is, that this leaves space to my second paragraph.
Usually, this should not be the case.
In pure LaTeX, there is a linebreak, of course, but no vertical space in addition.
如果將\\vspace{-\\parsep}
放在以下文本的開頭,則會得到換行符而沒有多余的空間。 那是,
---
output: pdf_document
---
This is my first paragraph.
Next in the Rmd file would be the code for the figure.
The figure is correctly treated as a float by LaTeX, meaning that LaTeX will put it to the next suitable position.
```{r pressure, echo=FALSE, fig.cap="Example", out.width='0.5\\textwidth', fig.pos='B'}
plot(pressure)
```
\vspace{-\parsep}The problem is now fixed.
我沒有其他方法可以這樣做: knitr
在生成LaTeX時在圖形環境周圍放置空白行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.