Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
2  
Take a look at why-should-the-minimal-class-be-avoided –  Ignasi Jul 23 at 17:41

2 Answers 2

up vote 6 down vote accepted

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

share|improve this answer
    
the pic feature was SO missing from previous versions...it makes so much sense...TikZ is awesome! –  Bordaigorl Jul 23 at 17:42
    
This is definitely what I needed! Thank you! –  Jay Jul 23 at 21:34

The quick answer: you can just nest a tikzpicture environment into the contents of your node:

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

However this is discouraged for various reasons but it will work for simple designs.

Another option is using the new pic feature of PGF 3.0.

To answer to the last question: you can simply put an \includegraphics command into your nodes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.