如何将 beamer 框架标题更改为如下形式
到目前为止我所做的(我想要像我的代码中的背景颜色):
\documentclass{beamer}
\usepackage{tikz}
\usetheme{CambridgeUS}
\begin{document}
\setbeamertemplate{background canvas}[vertical shading][top=red!5,bottom=blue!15]{
\begin{frame}{}
\begin{tikzpicture}[remember picture,overlay]
\node[anchor= north east,xshift=0cm,yshift=-0.8cm] at (current page.north){
\begin{tikzpicture}[remember picture,overlay]%\tikz[overlay]
\draw[fill=blue!15,line width=2pt] (-2,-1.3) rectangle (2,0.3);
\draw[fill=blue!15,line width=2pt] (-1.8,-1.1) rectangle (1.8,0.1);
\node[] at (1,-0.2) {\Large Conclusions};
\fill[color=red!5] (2.1,0.4) circle (0.6cm);
\fill[color=red!5] (-2.1,-1.4) circle (0.6cm);
\fill[color=red!5] (2.1,-1.3) circle (0.6cm);
\fill[color=red!5] (-2.1,-0.1) circle (0.6cm);
% \draw[step=.1cm,gray,very thin] (-2.5,-2.5) grid (2.5,2.5);
\end{tikzpicture}
};
\end{tikzpicture}
\end{frame}
}
\end{document}
答案1
这样可以避免嵌套tikzpicture
并\setbeamertemplate
正确使用。它还为所需的设计提供了基础。调整和增强留给读者练习。
特别要注意的是,可变宽度的线条实际上并不是 TikZ 的拿手好戏。如果认为这些是必不可少的,请考虑另一种方法。(有几个答案迫使 TikZ 近似于此,但价格很高,结果永远不会完全令人满意。最好为工作选择合适的工具,并按照 TikZ 的设计用途使用它。)
\documentclass{beamer}
\usepackage{tikz}
\usetheme{CambridgeUS}
\usetikzlibrary{calc}
\usepackage[T1]{fontenc}
\DeclareRobustCommand{\zapfstyle}{%
\fontencoding{T1}%
\fontseries{mb}%
\fontshape{it}%
\fontfamily{pzc}%
\selectfont}
\begin{document}
\setbeamertemplate{background canvas}[vertical shading][top=red!5,bottom=blue!15]
\begin{frame}{}
\begin{tikzpicture}
[
remember picture,
overlay,
ribbon width/.store in=\ribbonwidth,
edging width/.store in=\edgingwidth,
edging colour/.store in=\edgingcolour,
ribbon colour/.store in=\ribboncolour,
ribbon width=5mm,
edging width=1pt,
edging colour=red!5!gray!75!blue!25,
ribbon colour=gray!25!red!5!white,
]
\node (c) [anchor=north, font=\zapfstyle\Large, inner sep=\ribbonwidth+1mm] at ([yshift=-8mm]current page.north) {Conclusions};
\begin{scope}
\clip ([xshift=-\ribbonwidth]c.north east) coordinate (a1) arc (180:270:\ribbonwidth) coordinate (a2) -- ([yshift=\ribbonwidth]c.south east) coordinate (a3) arc (90:180:\ribbonwidth) coordinate (a4) -- ([xshift=\ribbonwidth]c.south west) coordinate (a5) arc (0:90:\ribbonwidth) coordinate (a6) -- ([yshift=-\ribbonwidth]c.north west) coordinate (a7) arc (270:360:\ribbonwidth) coordinate (a8) -- cycle;
\path [fill=\ribboncolour, even odd rule] (c.north east) rectangle (c.south west) ($(c.north east)+(-135:\ribbonwidth)$) coordinate (c1) rectangle ($(c.south west)+(45:\ribbonwidth)$) coordinate (c2);
\draw [draw=\edgingcolour, opacity=.5] (c1) rectangle (c2);
\end{scope}
\begin{scope}
\clip ([xshift=2.5*\edgingwidth,yshift=2.5*\edgingwidth]c.north east) rectangle ([xshift=-2.5*\edgingwidth,yshift=-2.5*\edgingwidth]c.south west);
\draw [draw=\edgingcolour, opacity=.75, line width=\edgingwidth] (a1) -- (a8) (a2) -- (a3) (a4) -- (a5) (a6) -- (a7) \foreach \i [count=\j, evaluate=\j as \k using 90*\j-45] in {north east, north west, south west, south east} {($(c.\i)+(\k:.5\edgingwidth)$) circle (\ribbonwidth)} ;
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}