[英]Add line break after caption title in R Markdown
我想在R Markdown輸出中更改字幕的樣式,並有兩個請求:
這是一個例子:
caption <-
" April is the cruellest month, breeding
Lilacs out of the dead land, mixing
Memory and desire, stirring
Dull roots with spring rain.
Winter kept us warm, covering
Earth in forgetful snow, feeding
A little life with dried tubers.
Summer surprised us, coming over the Starnbergersee
With a shower of rain; we stopped in the colonnade,
And went on in sunlight, into the Hofgarten,
And drank coffee, and talked for an hour.
Bin gar keine Russin, stamm’ aus Litauen, echt deutsch.
And when we were children, staying at the arch-duke’s,
My cousin’s, he took me out on a sled,
And I was frightened. He said, Marie,
Marie, hold on tight. And down we went.
In the mountains, there you feel free.
I read, much of the night, and go south in the winter."
kable(mtcars, format = 'latex', caption = caption)
您可以使用LaTeX的caption
包來控制輸出到PDF。 我們需要更改此文件的某些設置以完成您的更改,但是這些可以作為單獨的.tex
文件包含,或者在這種情況下只需進行少量更改,我們可以將它們插入到直接問題。 這是一個最小的示例:
---
output: pdf_document
header-includes:
- \usepackage{caption}
- \captionsetup{labelfont=bf, labelsep = newline}
---
```{r table1}
caption <- "your long long long caption"
knitr::kable(mtcars, caption = caption)
```
此方法僅適用於LaTeX輸出(即PDF)。
如果要對樣式進行更多更改,請在此處查看包裝文檔: http : //anorien.csc.warwick.ac.uk/mirrors/CTAN/macros/latex/contrib/caption/caption-eng.pdf
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.