Beamer制作演⽰⽂档-5:设置⽬录页样式
latex B eamer⽬录tikz
经验丰富的⽼专家说,你这怎么只有⽂字?这不⾏,你得加⽂本框,加阴影,你得有效果!
那就试试吧。使⽤了如下的代码
\RequirePackage{tikz}%⽤tikz包来画背景和阴影
\usetikzlibrary{calc}%,ric,shapes.callouts}%需要⽤到的tikz库,calc⽤于坐标的计算
\newlength{\boxw}%盒⼦的宽度
\newlength{\boxh}%盒⼦的⾼度
\newlength{\boxroundness}%盒⼦的圆⾓⼤⼩
\newlength{\boxshadowsize}%阴影到盒⼦之间的距离
\newlength{\tmpa}%临时长度
\setlength{\boxshadowsize}{6pt}%设置阴影到盒⼦之间的距离
\setlength{\boxroundness}{3pt}%设置盒⼦的圆⾓⼤⼩
\newsavebox{\shadowblockbox}%新建⼀个盒⼦环境
\newenvironment{shadowblock}[1]%这个是⾃定义的⼀个阴影盒⼦,在这⾥⽤来放⽬录的内容。当然,在其它的地⽅就可以⽤来放其它的东西。这个盒⼦会接收⼀个参数来指定盒⼦的宽度
box shadow怎么设置{%
\begin{lrbox}{\shadowblockbox}%%
\begin{minipage}{#1}%%
}%
{%
\end{minipage}%
\end{lrbox}%
\settowidth{\boxw}{\usebox{\shadowblockbox}}%
\settodepth{\tmpa}{\usebox{\shadowblockbox}}%
\settoheight{\boxh}{\usebox{\shadowblockbox}}%
\addtolength{\boxh}{\tmpa}%
\addtolength{\boxh}{2\boxroundness}%
\addtolength{\boxw}{2\boxroundness}%
\setlength{\boxw}{1.2\boxw}%
\setlength{\boxh}{1.2\boxh}%
\setlength{\tmpa}{1.2\tmpa}%
\begin{tikzpicture}%画背景
\usebeamercolor{section number projected}
\foreach \x in {0,.05,...,1}%画阴影,每次改变画的范围,从⽽实现浓淡的渐变
{%
\fill[xshift=\boxshadowsize -1pt,yshift=-\boxshadowsize + 1pt,black,opacity=.04,rounded corners=\boxroundness]
(\x*\boxshadowsize,\x*\boxshadowsize) rectangle (\boxw -\x*\boxshadowsize,\boxh-\x*\boxshadowsize);
};%
\filldraw[inner color=fg,outer color=Grey0,draw=black!50,rounded corners=\boxroundness](0,0) rectangle (\boxw,\boxh);%画出位于阴影前⾯的盒⼦
\node[xshift=3\boxroundness ,yshift=2\boxroundness,inner sep=0pt,outer sep=0pt,anchor=south west](contents) at (0,0)
{\usebox{\shadowblockbox}};%放上⽬录的内容
\CTEXnumber{\cna}{\inserttocsectionnumber}%把⽬录编号改为中⽂形式
\node[circle,inner color=fg,outer color=Grey0,minimum size=\boxh,inner sep=0pt,anchor=center,left of= contents,node distance = 0.7\boxw] {\cna};%放上⽬录的编号
\end{tikzpicture}
}%
\defbeamertemplate{section in toc}{NGEGTOC}{
\begin{center}
\begin{shadowblock}{4cm}%
\inserttocsection%
\end{shadowblock}%
\end{center}
}
\setbeamertemplate{section in toc}[NGEGTOC]
出现的是下⾯的效果
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论