我正在使用 beamer 模板。我使用以下代码设置了一个常用幻灯片模板,其背景中有一条紫线:
%set purple line
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations}
\addtobeamertemplate{frametitle}{}{ %purple line
\begin{textblock*}{15mm}(-45,155)
\begin{tikzpicture}
\draw (-8.5,1.5) .. controls (-3,0) and (3, 0) .. (8.5,1.5);
\end{tikzpicture}
\end{textblock*}
}
我的演示文稿中的一些标准颜色是紫色,所以它确实看起来是紫色的。
现在,我正在尝试使用以下代码为同一个投影仪演示文稿中的不同类型的幻灯片制作一些模板:
\defbeamertemplate{background canvas}{picture background}
{
\begin{textblock*}{15mm}(0,0)
\begin{tikzpicture}
\draw[TIGblauw,fill=TIGblauw] (-8.5,1.5) .. controls (-3,0) and (3, 0) .. (8.5,1.5);
\end{tikzpicture}
\end{textblock*}
}
如您所见,我使用了相同的舍入方法。但是,我希望它为蓝色(这不起作用),并且我希望它填充到顶部。它应该看起来像这样:
不过,它只适用于我使用此背景模板的幻灯片。
目前,该线仍为紫色,没有任何变化。
我觉得这里有多个问题,但我的主要问题是如何从非线性线开始用蓝色填充背景。其他信息是排除一些会干扰我演示其余部分的解决方案。
这是一个最小的可重现示例,尽管我觉得它可能不是最小的。不知道是什么干扰
\documentclass[aspectratio=169]{beamer} %Most screens have 16:9 display
%-------------------------- PACKAGES --------------------------
\usepackage{textpos} %absolute text positioning on slide
\usepackage{caption, subcaption} %Captions for figures and tables
\usepackage{graphicx} %Figures
\usepackage[export]{adjustbox} %Great if graphicx is not enough
\usepackage[dutch]{babel} %To make some things Dutch, such as month in date
\usepackage{datetime} %To be able to work with dates
%-------------------------- OVERALL THEME --------------------------
\useoutertheme[subsection=false]{miniframes} %great for navigation <3
\AtBeginSection{} % hides section page
%-------------------------- COLORS --------------------------
\definecolor{TIGpaars}{RGB}{117,21,88}
\definecolor{TIGgroen}{RGB}{180,220,0}
\definecolor{TIGblauw}{RGB}{81,199,253}
\setbeamercolor{frametitle}{fg=TIGpaars}
\setbeamercolor{framesubtitle}{fg=TIGblauw}
\setbeamercolor{palette primary}{fg=TIGpaars, bg=white}
\setbeamercolor{normal text}{fg=black, bg=white}
\setbeamercolor{section in head/foot}{fg=white, bg=TIGpaars}
\setbeamercolor{alerted text}{fg=TIGblauw}
\setbeamercolor{item}{fg=TIGpaars}
%-------------------------- TITLE PAGE --------------------------
\newcommand{\titlem}{Default title}
\newcommand{\subtitlem}{} %default is no subtitle
\newdateformat{dutchformat}{\twodigit{\THEDAY}{\THEMONTH}{\THEYEAR}}
\newcommand{\datem}{\today} %default date is today
\setbeamertemplate{title page}{
\begin{picture}(0pt,0pt)
%\centering
\put(-35pt,-147pt){ %background picture
\includegraphics[width=1.01\paperwidth]{Include/Overige afbeeldingen/Front page.png}
}
\put(0pt,-78pt){ %titles
\begin{minipage}[b][45mm][t]{226mm}
\usebeamerfont{title}{\textcolor{white}{\titlem} \par}
\usebeamerfont{subtitle}{\textcolor{TIGgroen}{\subtitlem}}
\end{minipage}
}
\put(330pt,-243pt){ %text right bottom
\begin{minipage}[b][45mm][t]{226mm}
{\tiny \textcolor{TIGpaars}{Deventer, \datem}}
\end{minipage}
}
\end{picture}
}
%----------------------- ALL SLIDES DEFAULT -----------------------
\setbeamertemplate{frame numbering}[none]{} %no page numbering
%set purple line
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations}
\addtobeamertemplate{frametitle}{}{ %purple line
\begin{textblock*}{15mm}(-45pt,155pt)
\begin{tikzpicture}
\draw (-8.5,1.5) .. controls (-3,0) and (3, 0) .. (8.5,1.5);
\end{tikzpicture}
\end{textblock*}
}
%set TIG text: www.tignl.eu
\addtobeamertemplate{frametitle}{}{
\begin{textblock*}{110mm}(0.83\textwidth,67mm) % absolute positioning right lower corner
{example}
\end{textblock*}
}
\addtobeamertemplate{frametitle}{}{
\begin{textblock*}{115mm}(0mm,67mm)
{\tiny \textcolor{TIGpaars}{\titlem | © 2023 Ex}}
\end{textblock*}
}
\defbeamertemplate{background canvas}{picture background}
{
\begin{textblock*}{15mm}(0,0)
\begin{tikzpicture}
\draw[TIGblauw,fill=TIGblauw] (-8.5,1.5) .. controls (-3,0) and (3, 0) .. (8.5,1.5);
\end{tikzpicture}
\end{textblock*}
}
\begin{document}
\begin{frame}
\titlepage %title page is defined above
\end{frame}
\section{example slides - More nice stuff}
\begin{frame}{Example slide \hyperlink{Appendix}{\beamerbutton{Appendix}}}{lorem}
Mus mauris vitae ultricies leo integer malesuada nunc vel. Maecenas volutpat blandit aliquam etiam erat.
\begin{itemize}
\item Pretium nibh ipsum consequat nisl. \alert{hello} Pretium nibh ipsum consequat nisl.
\item Etiam erat velit scelerisque in dictum non.
\end{itemize}
\end{frame}
\section{example slides - final stuff}
\begin{frame}{Appendix}{lorem}\label{Appendix}
Odio tempor orci dapibus ultrices in iaculis. Lorem sed risus ultricies tristique nulla aliquet enim. Arcu vitae elementum curabitur vitae nunc sed velit dignissim. Nunc vel risus commodo viverra maecenas accumsan. Sit amet tellus cras adipiscing enim.
\end{frame}
\setbeamertemplate{background canvas}[vertical color]{
\begin{frame}{test}
\end{frame}
}
\end{document}
答案1
我不会使用该
textpos
包来定位你的 tikz 图片。TikZ 完全能够使用overlay
并记住图片选项自行完成此操作为了用蓝色填充幻灯片的整个上部,我只需画一个很大的圆圈并将其向上移动。
您在最后一帧上应用的语法是错误的。1) 您的模板未被调用
vertical color
,2) 您的自定义模板没有参数。帧超出范围。然后还有一个额外的麻烦,那就是框架标题会在蓝色背景上画一条线。我建议为弧线使用单独的颜色,并将其设置为蓝色以用于特殊框架。
您应该使用页脚模板作为页脚,而不是将信息添加到框架标题,因为框架标题可以有不同的位置。
\documentclass[aspectratio=169]{beamer} %Most screens have 16:9 display
%-------------------------- PACKAGES --------------------------
\usepackage{textpos} %absolute text positioning on slide
\usepackage{caption, subcaption} %Captions for figures and tables
\usepackage{graphicx} %Figures
\usepackage[export]{adjustbox} %Great if graphicx is not enough
\usepackage[dutch]{babel} %To make some things Dutch, such as month in date
\usepackage{datetime} %To be able to work with dates
%-------------------------- OVERALL THEME --------------------------
\useoutertheme[subsection=false]{miniframes} %great for navigation <3
\AtBeginSection{} % hides section page
%-------------------------- COLORS --------------------------
\definecolor{TIGpaars}{RGB}{117,21,88}
\definecolor{TIGgroen}{RGB}{180,220,0}
\definecolor{TIGblauw}{RGB}{81,199,253}
\setbeamercolor{frametitle}{fg=TIGpaars}
\setbeamercolor{framesubtitle}{fg=TIGblauw}
\setbeamercolor{palette primary}{fg=TIGpaars, bg=white}
\setbeamercolor{normal text}{fg=black, bg=white}
\setbeamercolor{section in head/foot}{fg=white, bg=TIGpaars}
\setbeamercolor{alerted text}{fg=TIGblauw}
\setbeamercolor{item}{fg=TIGpaars}
\colorlet{arccolor}{TIGpaars}
%-------------------------- TITLE PAGE --------------------------
\newcommand{\titlem}{Default title}
\newcommand{\subtitlem}{} %default is no subtitle
\newdateformat{dutchformat}{\twodigit{\THEDAY}{\THEMONTH}{\THEYEAR}}
\newcommand{\datem}{\today} %default date is today
\setbeamertemplate{title page}{
\begin{picture}(0pt,0pt)
%\centering
\put(-35pt,-147pt){ %background picture
\includegraphics[width=1.01\paperwidth]{example-image-duck}
}
\put(0pt,-78pt){ %titles
\begin{minipage}[b][45mm][t]{226mm}
\usebeamerfont{title}{\textcolor{white}{\titlem} \par}
\usebeamerfont{subtitle}{\textcolor{TIGgroen}{\subtitlem}}
\end{minipage}
}
\put(330pt,-243pt){ %text right bottom
\begin{minipage}[b][45mm][t]{226mm}
{\tiny \textcolor{TIGpaars}{Deventer, \datem}}
\end{minipage}
}
\end{picture}
}
%----------------------- ALL SLIDES DEFAULT -----------------------
\setbeamertemplate{frame numbering}[none]{} %no page numbering
%set purple line
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations}
\addtobeamertemplate{frametitle}{}{ %purple line
\begin{tikzpicture}[remember picture,overlay]
\draw[arccolor] ([yshift=21.6cm]current page.north) circle [radius=30cm];
\end{tikzpicture}
}
%set TIG text: www.tignl.eu
\addtobeamertemplate{frametitle}{}{
\begin{textblock*}{110mm}(0.83\textwidth,67mm) % absolute positioning right lower corner
{example}
\end{textblock*}
}
\addtobeamertemplate{frametitle}{}{
\begin{textblock*}{115mm}(0mm,67mm)
{\tiny \textcolor{TIGpaars}{\titlem | © 2023 Ex}}
\end{textblock*}
}
\defbeamertemplate{background canvas}{picture background}
{
\begin{tikzpicture}[remember picture,overlay]
\fill[TIGblauw] ([yshift=21.6cm]current page.north) circle [radius=30cm];
\end{tikzpicture}
}
\begin{document}
\begin{frame}
\titlepage %title page is defined above
\end{frame}
\section{example slides - More nice stuff}
\begin{frame}{Example slide \hyperlink{Appendix}{\beamerbutton{Appendix}}}{lorem}
Mus mauris vitae ultricies leo integer malesuada nunc vel. Maecenas volutpat blandit aliquam etiam erat.
\begin{itemize}
\item Pretium nibh ipsum consequat nisl. \alert{hello} Pretium nibh ipsum consequat nisl.
\item Etiam erat velit scelerisque in dictum non.
\end{itemize}
\end{frame}
\section{example slides - final stuff}
\begin{frame}{Appendix}{lorem}\label{Appendix}
Odio tempor orci dapibus ultrices in iaculis. Lorem sed risus ultricies tristique nulla aliquet enim. Arcu vitae elementum curabitur vitae nunc sed velit dignissim. Nunc vel risus commodo viverra maecenas accumsan. Sit amet tellus cras adipiscing enim.
\end{frame}
{
\setbeamertemplate{background canvas}[picture background]
\colorlet{arccolor}{TIGblauw}
\begin{frame}{test}
\end{frame}
}
\end{document}