[Tex/LaTex] How to draw shapes inside a tikz node

nodestikz-pgf

I know how to draw different shapes using tikz, like this:

\documentclass{minimal}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\draw (0,0) ellipse (1 and 1.5)
      (0,2.5) circle (1)
      (2.5,0) circle (1.5);
\end{tikzpicture}

\end{document}

enter image description here

However, I would like to put a number of different shapes together inside a node, and I couldn't yet find a simple way to do that. I will make a little figure to include in a large diagram which is already made of several nodes.

If this is not possible, or not easy, then how do I include a JPG or EPS file in a node?

Thank you!

Best Answer

TiKZ 3.0 introduced pics. They are not exactly nodes but they allow to draw complex figures and manage them as a single one.

Search for them in TeX.SX and you'll find some more examples. Two of them:

A simple example with your code.

\documentclass[tikz]{standalone}

\begin{document}

\begin{tikzpicture}[%
    complexnode/.pic={
\draw (0,0) ellipse (1 and 1.5)
      (0,2.5) circle (1)
      (2.5,0) circle (1.5);}]

\draw (0,0) pic {complexnode} (3,3) pic[blue, rotate=30] {complexnode};
\end{tikzpicture}

\end{document}

enter image description here