6

I am Basilio, I've been using stackexchange for a while and it's of course really useful. Here's my first question: in the thread Alternatives to the horizontal line in fancyhdr the user Gonzalo Medina introduces the "torn page" decoration developed by JLDiaz. Is it possible to use it for the title of a slide in beamer as well?

Thank you very much, Basilio

user54427
  • 61
  • 2

1 Answers1

7

This is a possible solution embedding in the background template the relevant code:

\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}

The result:

enter image description here