我是 Basilio,我使用 stackexchange 已经有一段时间了,它当然非常有用。这是我的第一个问题:在主题中 fancyhdr 中水平线的替代品 用户 Gonzalo Medina 介绍了 JLDiaz 开发的“撕页”装饰。是否也可以将其用作投影仪中幻灯片的标题?
非常感谢,Basilio
答案1
这是一个可能的解决方案,在background
模板中嵌入相关代码:
\documentclass{beamer}
\usepackage{lmodern,tikz,tikzpagenodes}
\usetikzlibrary{decorations.pathmorphing,calc,shadows.blur,shadings}
\pgfmathsetseed{1}% do not change this value
% if you change it, please set random offsets accordingly
% http://tex.stackexchange.com/a/113963/13304
\pgfdeclaredecoration{irregular fractal line}{init}
{
\state{init}[width=\pgfdecoratedinputsegmentremainingdistance]
{
\pgfpathlineto{\pgfpoint{random*\pgfdecoratedinputsegmentremainingdistance}{(random*\pgfdecorationsegmentamplitude-0.02)*\pgfdecoratedinputsegmentremainingdistance}}
\pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}
}
}
\tikzset{
paper/.style={draw=black!10, blur shadow, shade=bilinear interpolation,
lower left=black!20, upper left=black!15, upper right=white, lower right=black!10},
irregular border/.style={decoration={irregular fractal line, amplitude=0.2},
decorate,
},
ragged border/.style={ decoration={random steps, segment length=7mm, amplitude=2mm},
decorate,
}
}
% we have to use the background template
\setbeamertemplate{background}{%
% test to avoid having the effect in title page
\ifnum\thepage>1%
\begin{tikzpicture}
\fill[orange!30]
decorate[irregular border]{decorate{decorate{decorate{decorate[ragged border]{
($(current page header area.south east-|current page.east) - (0, random*90mm)$) -- ($(current page header area.south west-|current page.west) - (0, random*52mm)$)
}}}}}
-- (current page.north west) -- (current page.north east) -- cycle;
\end{tikzpicture}%
\fi%
}%
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{Title}
hello
\end{frame}
\end{document}
结果: