如何从 R markdown 到 Latex 转换中删除紧凑标题?

Jas*_*bel 4 latex r pandoc r-markdown

我写了自己的标题页,它是通过 R-markdown 文件中的包含加载的。但是,这与 pandoc 标题冲突。我试图在 R markdown yaml 标头中找到设置,以便 pandoc 不会将以下代码插入到 tex 文件中。

% Create subtitle command for use in maketitle
\newcommand{\subtitle}[1]{
  \posttitle{
    \begin{center}\large#1\end{center}
    }
}

\setlength{\droptitle}{-2em}
  \title{}
  \pretitle{\vspace{\droptitle}}
  \posttitle{}
  \author{}
  \preauthor{}\postauthor{}
  \date{}
  \predate{}\postdate{}
Run Code Online (Sandbox Code Playgroud)

pandoc 文档或 r markdown 指南中没有明确指示如何禁用标题生成。任何帮助,将不胜感激。

更新:特别是,我正在寻找允许我继续使用\maketitle命令创建我的标题页的解决方案。这就是为什么我专注于我想要摆脱的这段特定代码。

Séb*_*tte 6

我还使用我自己的标题页和 rmarkdown 文档进行乳胶/pdf 输出。要删除标题,您可以在名为 with 的文本文件中添加以下命令in_header

\AtBeginDocument{\let\maketitle\relax}
Run Code Online (Sandbox Code Playgroud)

header.tex直接在 Rmd 文档中构建文件的可复制示例:

---
title: "RMarkdown No title Test"
author: "StatnMap"
date: "July 30, 2017"
output:
  pdf_document:
    includes:
      in_header: header.tex
--- 

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r rm_title_page, echo=FALSE}
head <- cat('
\\AtBeginDocument{\\let\\maketitle\\relax}
', file = "header.tex")

```

# Title 1
**Some text**

# Title 2
**Some text**
Run Code Online (Sandbox Code Playgroud)