在 markdown beamer 中切换背景
Switching background in markdown beamer
我正在尝试将 LaTeX/LyX 演示文稿传输到 Beamer 降价文档中。
在某些幻灯片上,我暂停了背景图像(上面有资助机构的徽标),以便为代码输出提供更多 space。
我之前使用以下命令执行此操作:
\bgroup
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{background.png}}
\begin{frame}[plain]
Some text here!}
\end{frame}
\egroup
我试过类似这样的方法(无效):
\bgroup
\pgfdeclareimage[width=\paperwidth]{empty}{Template_blank.png}
\usebackgroundtemplate{\pgfuseimage{empty}}
## New Slide
some text
\egroup
有什么想法吗?
通常在 beamer 中切换不同的背景模板是小菜一碟,基于 https://tex.stackexchange.com/questions/173201/beamer-template-with-different-style-options-for-frames 可以简单地创建一个新的框架选项。
不幸的是,rmarkdown 只是忽略了用户创建的框架选项,只传递了一小部分预定义选项。要欺骗 rmarkdown,可以重新调整 beamer 通常不使用的框架选项的用途,即 standout
框架选项(仅由 metropolis 主题使用)
---
output:
beamer_presentation:
keep_tex: true
includes:
header-includes: |
\usepackage{etoolbox}
\defbeamertemplate{background canvas}{mydefault}{%
\includegraphics[width=\paperwidth,height=\paperheight]{example-image-duck}
}
\defbeamertemplate{background canvas}{standout}{%
\includegraphics[width=\paperwidth,height=\paperheight,page=2]{example-image-duck}
}
\BeforeBeginEnvironment{frame}{%
\setbeamertemplate{background canvas}[mydefault]%
}
\makeatletter
\define@key{beamerframe}{standout}[true]{%
\setbeamertemplate{background canvas}[standout]%
}
\makeatother
---
# frametitle
test
# frametitle with different background {.standout}
test
# frametitle
test
我正在尝试将 LaTeX/LyX 演示文稿传输到 Beamer 降价文档中。
在某些幻灯片上,我暂停了背景图像(上面有资助机构的徽标),以便为代码输出提供更多 space。
我之前使用以下命令执行此操作:
\bgroup
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{background.png}}
\begin{frame}[plain]
Some text here!}
\end{frame}
\egroup
我试过类似这样的方法(无效):
\bgroup
\pgfdeclareimage[width=\paperwidth]{empty}{Template_blank.png}
\usebackgroundtemplate{\pgfuseimage{empty}}
## New Slide
some text
\egroup
有什么想法吗?
通常在 beamer 中切换不同的背景模板是小菜一碟,基于 https://tex.stackexchange.com/questions/173201/beamer-template-with-different-style-options-for-frames 可以简单地创建一个新的框架选项。
不幸的是,rmarkdown 只是忽略了用户创建的框架选项,只传递了一小部分预定义选项。要欺骗 rmarkdown,可以重新调整 beamer 通常不使用的框架选项的用途,即 standout
框架选项(仅由 metropolis 主题使用)
---
output:
beamer_presentation:
keep_tex: true
includes:
header-includes: |
\usepackage{etoolbox}
\defbeamertemplate{background canvas}{mydefault}{%
\includegraphics[width=\paperwidth,height=\paperheight]{example-image-duck}
}
\defbeamertemplate{background canvas}{standout}{%
\includegraphics[width=\paperwidth,height=\paperheight,page=2]{example-image-duck}
}
\BeforeBeginEnvironment{frame}{%
\setbeamertemplate{background canvas}[mydefault]%
}
\makeatletter
\define@key{beamerframe}{standout}[true]{%
\setbeamertemplate{background canvas}[standout]%
}
\makeatother
---
# frametitle
test
# frametitle with different background {.standout}
test
# frametitle
test