# Automatically clipping undrawn objects in TikZ

I have used the trees package to construct my drawing, but I don't actually need the edges. So I have set the following to suppress them:

\tikzstyle{edge from parent}=[]


This works, but TikZ still allocates space in the drawing to these edges, even when they aren't visible.

Is is possible to tell TikZ to ignore these when it performs its automatic clipping?

Here is my current code:

\newcommand{\tc}[1]{\includegraphics[clip,trim=1.15cm 1.15cm 1.15cm 1.15cm]{EPSCards/#1.pdf}}

\begin{tikzpicture}[grow cyclic,sibling angle=-12,level distance=8cm,scale=0.9] %scale just to fit on page easier
\node{} child[rotate=90]
foreach \card in {KS,KH,KD,KC,AS} {node[transform shape,rotate=-90] {\tc{\card}}};
\end{tikzpicture}


The graphics are available from: http://code.google.com/p/vectorized-playing-cards/ (You'll need to run epstopdf on the .eps files).

And the output:

As you can see, there is extra space allocated at the bottom of the image for the tree edges. If I set these to not draw, the extra space doesn't go away. Is there a way to suppress the edges entirely?

I realise this isn't the best (ab)use of the trees package, but it was the fastest way to do what I wanted :)

-
Hi Porges, welcome to TeX.sx! Could you provide a complete minimal example that demonstrates the behaviour you describe? –  Jake Dec 1 '11 at 5:07
@Jake: I have updated with my actual code. –  Porges Dec 1 '11 at 20:15

Can I suggest an alternative way of doing this?

\documentclass{standalone}
\usepackage{tikz}
\newcommand{\tc}[1]{\includegraphics[clip,trim=1.15cm 1.15cm 1.15cm 1.15cm,scale=0.5]{card/#1}}
\begin{document}
\begin{tikzpicture}
\foreach \i/\j in {-24/KS,-12/KH,0/KD,12/KC,24/AS}
{
\pgfmathsetmacro{\Angle}{90-\i}
\node at (\Angle:4cm) [rotate=-\i] {\tc{\j}};
};
\draw (current bounding box.south east) rectangle (current bounding box.north west);
\end{tikzpicture}
\end{document}


-
Yes, you can :) Thanks! –  Porges Dec 1 '11 at 23:24
Absolutely brilliant! :) –  Paulo Cereda Dec 2 '11 at 9:54
If I simply want to draw two cards, for example, the ACE of one suit any and the King of diamonds, how to make? –  benedito Oct 17 '14 at 11:54
@benedito The cards aren't drawn, they're EPS-files added with \includegraphics. You can download them from the link in the question, and include them as any other image, i.e. \includegraphics{AS} for the Ace of Spades. If you need to arrange them in a particular way, and you're unable to figure out how, ask a new question about that. –  Torbjørn T. Oct 17 '14 at 12:39