【问题标题】:Indent without adding a bullet point or number in RMarkdown output to PDF缩进而不在 RMarkdown 输出到 PDF 中添加项目符号点或编号
【发布时间】:2018-04-18 00:18:36
【问题描述】:

之前有人问过一个关于如何在没有项目符号的情况下缩进文本的问题 指向 RMarkdown,但这是用于 HTML 输出:Indent without adding a bullet point or number in RMarkdown

如何为 PDF 输出做类似的事情?

【问题讨论】:

    标签: r pdf markdown indentation


    【解决方案1】:

    更新:

    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}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-12
      • 1970-01-01
      • 2021-08-06
      相关资源
      最近更新 更多