【发布时间】:2010-07-01 14:21:20
【问题描述】:
我想使用 LaTeX beamer 创建一个演示文稿,它有两种不同类型的幻灯片模板/布局:一种用于带有背景图像的幻灯片,另一种用于没有指定背景图像的幻灯片的布局/模板。
使用投影仪有什么技巧吗?
【问题讨论】:
-
你有没有试过在这里问:tex.stackexchange.com?
我想使用 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
这是您实际必须在其上运行 Latex 的唯一文件,您使用 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 和PresentationWithoutBG.pdf。
注意Presentation.tex 中的%&pdftex 确保无论哪个版本的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}
【讨论】: