之前有人问过如何在没有项目符号的情况下缩进文本
RMarkdown 中的点,但这是针对 HTML 输出的:在 RMarkdown 中缩进而不添加项目符号点或数字 https://stackoverflow.com/questions/47087557/indent-without-adding-a-bullet-point-or-number-in-rmarkdown
如何为 PDF 输出完成类似的操作?
Update::
线路块 https://pandoc.org/MANUAL.html#line-blocks可用于强制 R Markdown 尊重缩进。这适用于多输出格式。
---
output:
pdf_document
---
This is normal text.
| Item 1
| Item 2
| Item 3
More Text
原答案:
如果我们要写入 PDF 文件,可以在 .Rmd 文件中使用 LaTeX 代码来扩展 Markdown 的功能。将文件转换为 LaTeX 文件时,Pandoc 将同时考虑 LaTeX 和 RMarkdown 格式。
以下是一些示例,说明如何在无需安装额外的 LaTeX 包的情况下完成此操作:
---
title: "Untitled"
output:
pdf_document
---
This is normal text. If we want to indent a paragraph we could change the size of the left margin:
\setlength{\leftskip}{2cm}
Items 1
Item 2
Item 3
\setlength{\leftskip}{0pt}
Or we can make a list and suppress the items.
\begin{itemize}
\item[] First.
\item[] Second.
\end{itemize}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)