在knitr/rmarkdown中添加光束器帧选项

在knitr/rmarkdown中添加光束器帧选项,r,latex,knitr,r-markdown,beamer,R,Latex,Knitr,R Markdown,Beamer,我正试图在我用rmarkdown编写的Beamer演示文稿中添加帧数。但是,我想使用\begin{frame}[plain]选项(从这里的第二个答案:)抑制标题页上的数字。但是,当从rmarkdown编译到tex时,\titlepage已经创建了一个框架环境,因此实际上我得到了一个双框架,因此出现了一个错误 因此,在编写此文件时: --- output: beamer_presentation: includes: in_header: header.tex --- \

我正试图在我用rmarkdown编写的Beamer演示文稿中添加帧数。但是,我想使用\begin{frame}[plain]选项(从这里的第二个答案:)抑制标题页上的数字。但是,当从rmarkdown编译到tex时,\titlepage已经创建了一个框架环境,因此实际上我得到了一个双框架,因此出现了一个错误

因此,在编写此文件时:

---
output:
  beamer_presentation:
    includes:
      in_header: header.tex
---

\begin{frame}[plain]
\titlepage
\end{frame}
我用乳胶做的:

\begin{frame{

  \begin{frame}
     \titlepage
  \end{frame}

\end{frame}
在header.tex中,我有以下内容:

\let\otp\titlepage
\renewcommand{\titlepage}{\otp\addtocounter{framenumber}{-1}}

所以我现在的解决方法是在rmarkdown中使用一个plain\maketitle,然后编译成.tex,添加[plain]选项,然后编译成pdf。然而,我希望避免这一中间步骤。这在rmarkdown中可能吗?

rmarkdown
使用
pandoc
通过beamer/latex将Rmd文件转换为pdf
pandoc
用于控制转换过程

解决问题的一种方法是:

  • r标记
    使用并打开它

  • 将第137行更改为:

    \frame{\titlepage}
    
    为此:

    \frame[plain]{\titlepage} 
    
  • Rmd
    文件中添加修改模板的路径:

    ---
    output:
      beamer_presentation:
        includes:
          in_header: header.tex
        template:/path/to/new/template.tex
    ---
    

  • 请注意,您需要指定整个路径,或者将模板存储在
    pandoc
    可以找到它的位置(
    ~/.pandoc/templates
    在linux机器上)

    在标题后添加
    {.plain}
    ,如所示:

    ----
    
    # I'm the title {.plain}
    
    资料来源: