[Tex/LaTex] crossing out whole slide with LaTeX beamer

beamer

Is there a way to draw a huge red cross (x) on top of a slide in LaTeX beamer? I want to discuss a position and then say that it is definitely wrong and mark this by crossing out the whole page. It would be great if this cross looked like drawn by hand.

Best Answer

Initially I misread the question and thought that the cross should be below the text; now I see that it has to go on top of the text; in this case, there's no need to use the background canvas template:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathmorphing,patterns}

\makeatletter

\pgfdeclaredecoration{penciline}{initial}{
    \state{initial}[width=+\pgfdecoratedinputsegmentremainingdistance,auto corner on length=1mm,]{
        \pgfpathcurveto%
        {% From
            \pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}
                            {\pgfdecorationsegmentamplitude}
        }
        {%  Control 1
        \pgfmathrand
        \pgfpointadd{\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}{10pt}}
                        {\pgfqpoint{-\pgfdecorationsegmentaspect\pgfdecoratedinputsegmentremainingdistance}%
                                        {\pgfmathresult\pgfdecorationsegmentamplitude}
                        }
        }
        {%TO 
        \pgfpointadd{\pgfpointdecoratedinputsegmentlast}{\pgfpoint{8pt}{5pt}}
        }
    }
    \state{final}{}
}

\begin{document}


\begin{frame}

{\Huge\centering This is wrong.\par}
\onslide<2->{\begin{tikzpicture}[remember picture,overlay,decoration=penciline]
\draw[decorate,line width=30pt,red!60!black] 
  (current page.north west) -- (current page.south east);
\draw[decorate,line width=30pt,red!60!black] 
  (current page.north east) -- (current page.center) -- (current page.south west);
\end{tikzpicture}}
\end{frame}

\end{document}

enter image description here

You can use TikZ to draw the cross in the background canvas template:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begingroup
\setbeamertemplate{background canvas}{%
\begin{tikzpicture}[remember picture,overlay]
\draw[line width=20pt,red!60!black] 
  (current page.north west) -- (current page.south east);
\draw[line width=20pt,red!60!black] 
  (current page.south west) -- (current page.north east);
\end{tikzpicture}}

\begin{frame}
This is wrong.
\end{frame}
\endgroup

\end{document}

enter image description here

Using percusses's answer to Simulating hand-drawn lines you can get the handwritten effect:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathmorphing,patterns}

\makeatletter

\pgfdeclaredecoration{penciline}{initial}{
    \state{initial}[width=+\pgfdecoratedinputsegmentremainingdistance,auto corner on length=1mm,]{
        \pgfpathcurveto%
        {% From
            \pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}
                            {\pgfdecorationsegmentamplitude}
        }
        {%  Control 1
        \pgfmathrand
        \pgfpointadd{\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}{10pt}}
                        {\pgfqpoint{-\pgfdecorationsegmentaspect\pgfdecoratedinputsegmentremainingdistance}%
                                        {\pgfmathresult\pgfdecorationsegmentamplitude}
                        }
        }
        {%TO 
        \pgfpointadd{\pgfpointdecoratedinputsegmentlast}{\pgfpoint{8pt}{5pt}}
        }
    }
    \state{final}{}
}

\begin{document}

\begingroup
\setbeamertemplate{background canvas}{%
\begin{tikzpicture}[remember picture,overlay,decoration=penciline]
\draw[decorate,line width=30pt,red!60!black] 
  (current page.north west) -- (current page.south east);
\draw[decorate,line width=30pt,red!60!black] 
  (current page.north east) -- (current page.center) -- (current page.south west);
\end{tikzpicture}}

\begin{frame}
This is wrong.
\end{frame}
\endgroup

\end{document}

enter image description here