RStudio 中快速从代码片段插入 YAML 代码的键盘快捷键是什么?

问题描述 投票:0回答:1

我正在 RStudio 中创建四开文档。我经常使用一些 YAML 设置。因此,我在 RStudio 的代码片段中添加了这些设置。快速将此代码从代码片段插入到四开文档的键盘快捷键是什么?

YAML 设置如下:

snippet pdfyaml
  format:
    pdf:
      documentclass: scrbook
      toc: true
      toc-title: "Table of Contents"
      lot: true
      lof: true
      number-sections: true
      fig-cap-location: bottom
      tbl-cap-location: top
      code-line-numbers: true

我也愿意接受任何其他方式,而不是将此代码保留在代码片段中,这样我就不必每次创建新的四开文档时都键入此代码。

yaml rstudio quarto
1个回答
0
投票

首先,这里是创建片段的绝佳指南。重要的是,您必须在代码中使用

tab
而不是使用空格。如果您没有,您的代码片段无效并且不会被识别。如果您只需输入代码片段的名称,它就会自动弹出,如下所示:

然后只需按 Enter 键,它就会返回您的代码,如下所示:

format:
  pdf:
    documentclass: scrbook
    toc: true
    toc-title: "Table of Contents"
    lot: true
    lof: true
    number-sections: true
    fig-cap-location: bottom
    tbl-cap-location: top
    code-line-numbers: true
© www.soinside.com 2019 - 2024. All rights reserved.