Cut bottom of tabular by Zig-Zag pattern (in latex beamer)
The extra padding you are getting is due to the value for node sep
for the node containg the tabular
; to get the desired result, you can simply set this to 0pt
:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{frame}
\centering
\begin{tikzpicture}[ampersand replacement=\&]
\node[inner sep=0pt] (elenore)
{%
\begin{tabular}{| c | c c | l |}
\cline{2-3}
\multicolumn{1}{c}{} & \multicolumn{2}{|c|}{Header} \\
\hline
A & B & C & D \\
E & F & G & H \\
I & J & K & L
\end{tabular}%
};
\draw[decoration={zigzag, mirror,segment length=6mm,amplitude=1.1pt}, decorate]
(elenore.south west) -- (elenore.south east);
\end{tikzpicture}
\end{frame}
\end{document}
Another option would be to draw everything (including the matrix itself) using TikZ:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,decorations.pathmorphing}
\tikzset{
table/.style={
matrix of nodes,
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
nodes={rectangle,text width=3em,align=center},
text depth=0.25ex,
text height=1.5ex,
nodes in empty cells
}
}
\begin{document}
\begin{frame}
\centering
\begin{tikzpicture}[ampersand replacement=\&]
\matrix (elenore) [table]
{
\& \& \& \\
A \& B \& C \& D \\
E \& F \& G \& H \\
I \& J \& K \& L \\
};
\node at ( $ (elenore-1-2)!0.5!(elenore-1-3) $ ) {Header};
\draw
(elenore-1-2.south west) |- (elenore-1-3.north east) -- (elenore-1-3.south east);
\draw
(elenore-4-1.south west) |- (elenore-2-4.north east) -- (elenore-4-4.south east);
\draw[decoration={zigzag, mirror,segment length=6.25mm}, decorate]
(elenore-4-1.south west) -- (elenore-4-4.south east);
\end{tikzpicture}
\end{frame}
\end{document}
Just for the fun of it, here's another possibility using the pencildraw
style designed by Ipsen in his answer
to Torn page effect:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,decorations.pathmorphing}
\tikzset{
table/.style={
matrix of nodes,
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
nodes={rectangle,text width=3em,align=center},
text depth=0.25ex,
text height=1.5ex,
nodes in empty cells,
column 4/.style={nodes={align=left}}
},
pencildraw/.style={
decorate,
decoration={random steps,segment length=3pt,amplitude=1.5pt}
}
}
\begin{document}
\begin{frame}
\centering
\begin{tikzpicture}[ampersand replacement=\&]
\matrix (elenore) [table]
{
\& \& \& \\
A \& B \& C \& D \\
E \& F \& G \& H \\
I \& J \& K \& L \\
};
\node at ( $ (elenore-1-2)!0.5!(elenore-1-3) $ ) {Header};
\draw
(elenore-4-2.south west) |- (elenore-1-3.north east) -- (elenore-4-3.south east);
\draw
(elenore-4-1.south west) |- (elenore-2-4.north east) -- (elenore-4-4.south east);
\draw[pencildraw]
(elenore-4-1.south west) -- (elenore-4-4.south east);
\end{tikzpicture}
\end{frame}
\end{document}
Using
column <number>/.style={nodes={<options>}}
you can change the attributes for nodes in a column; for example, in the code above I used
column 4/.style={nodes={align=left}}
to have text aligned left in the fourth column.
You don't have to use tikz
Your tabular example markup generated a lot of errors so I had to make a few guesses as to the intended cells, but something like
\documentclass{beamer}
\begin{document}
\begin{frame}
\sbox0{\begin{tabular}[b]{c| c c | l }
\cline{2-3}
& \multicolumn{2}{c|}{comparison} & \\
\cline{1-4}
\multicolumn{1}{|c|}{A} & B & C & \multicolumn{1}{l|} {value} \\
\cline{1-4}
\multicolumn{1}{|c|}{(1,\texttt{X},\texttt{\$},U,11)} & & (\texttt{a},\texttt{\$},1) & \multicolumn{1}{l|}{C} \\
\multicolumn{1}{|c|}{(2,\texttt{r},1,10)} & (\texttt{O},1) & &
\multicolumn{1}{l|}{$H_{1} = [\texttt{aa}]$} \\
\multicolumn{1}{|c|}{(3,\texttt{a},\texttt{a},3,2)} & & (\texttt{a},\texttt{a},6) & \multicolumn{1}{l|}{$H_5 = [\texttt{yyyyyy}]$} \\
\multicolumn{1}{|c|}{(4,\texttt{a},5,1)} & (\texttt{a},5) & &
\multicolumn{1}{l|}{$H = [\texttt{text}]$}\\
\multicolumn{1}{c}{}
\end{tabular}}%
\usebox0\llap{\resizebox{\wd0}{\height}{\fboxsep0pt\colorbox{white}{\strut${\sim}\!{\sim}\!{\sim}$}}}
\end{frame}
\end{document}