我想使用 LaTeX beamer 创建一个演示文稿,它有两种不同类型的幻灯片模板/布局:一种用于带有背景图像的幻灯片,另一种用于没有指定背景图像的幻灯片的布局/模板。
使用投影仪有什么技巧吗?
基本上我归结为\usebackgroundtemplate
在每个\begin{frame}...\end{frame}
.
如果您想要一张幻灯片的特定背景图像,只需放置一个
{\usebackgroundtemplate{\includegraphics[width=\paperwidth]{background.jpg}}
直接在你的\begin{frame}
.
如果我理解正确,问题是如何同时生成两个演示文稿副本。为此,您需要使用一些低级 tex 命令和几个文件。
在Presentation.tex
你可能有
%&pdftex
\relax
\immediate\write18{pdflatex -synctex=1 PresentationWithBG.tex}
\relax
\immediate\write18{pdflatex -synctex=1 PresentationWithoutBG.tex}
\end
这是您实际上必须在其上运行乳胶的唯一文件,您可以使用pdftex --shell-escape Presentation.tex
. 但是您还需要以下内容。
在PresentationWithBG.tex
(请注意,您实际上并不需要\usebackgroundtemplate
在每一帧之前):
\documentclass{beamer}
\setbeamercolor{background canvas}{bg=}
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{<your_background_fig>}}
\input{PresentationContent}
在PresentationWithoutBG.tex
:
\documentclass{beamer}
\input{PresentationContent}
在PresentationContent.tex
:
\begin{document}
[All your actual presentation goes here...]
\end{document}
当你运行时pdftex --shell-escape Presentation.tex
,你会得到PresentationWithBG.pdf
and PresentationWithoutBG.pdf
。
请注意,%&pdftex
inPresentation.tex
确保正在运行的任何版本的 TeX 都切换到正确的模式。您实际上可以使用pdflatex
.
这可以通过新的框架选项轻松完成:
\documentclass{beamer}
\defbeamertemplate{background canvas}{mydefault}{%
\includegraphics[width=1cm]{example-image-duck}
}
\defbeamertemplate{background canvas}{fullimage}{%
\includegraphics[width=\paperwidth]{example-image-duck}
}
\BeforeBeginEnvironment{frame}{%
\setbeamertemplate{background canvas}[mydefault]%
}
\makeatletter
\define@key{beamerframe}{fullimage}[true]{%
\setbeamertemplate{background canvas}[fullimage]%
}
\makeatother
\begin{document}
\begin{frame}
left
\end{frame}
\begin{frame}[fullimage]
right
\end{frame}
\begin{frame}
is left again
\end{frame}
\end{document}