2

I wish to add the circle inside the diamond, and star inside the circle like in the photo.

enter image description here

However, using my code,

\node[draw, diamond, above=of aux] (diamond) {};
\node[draw,circle,above=of aux,minimum size=2mm,inner sep=0pt]{};
\node[draw, star,above=of aux,minimum size=0.01mm](star){};

centers of the circle, diamond and star are not the same as shown in the following picture.

enter image description here

What's the problem with the code?

  • You've already asked tex.stackexchange.com/questions/98160/…: could you elaborate on the difference between the questions? – Joseph Wright Feb 14 '13 at 14:13
  • @JosephWright thanks, actually, the older question I have no idea how to do, now I have an idea, but don't know what's wrong. – sweetyBaby Feb 14 '13 at 14:15
  • 1
    @sweetyBaby May I ask you what's the problem with my comment? – Claudio Fiandrino Feb 14 '13 at 14:21
  • @ClaudioFiandrino actually your comment helps me a lot, however, I don't wish to use (0,0) to locate the center :( Thanks a lot. – sweetyBaby Feb 15 '13 at 0:52
7

You don't have to use the above key, just put all the node at the same point.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\node[draw, fill, star, star points=6, minimum size=5mm] at (0,0){};
\node[draw, circle, minimum size=8mm] at (0,0){};
\node[draw, diamond, minimum size=1.5cm] at (0,0){};
\end{tikzpicture}
\end{document}

result

Edit: To make the picture smaller, you may either change all minimum size keys, or put the whole in a \resizebox like this:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\resizebox{1cm}{!}{%
    \begin{tikzpicture}
    \node[draw, fill, star, star points=6, minimum size=5mm] at (0,0){};
    \node[draw, circle, minimum size=8mm] at (0,0){};
    \node[draw, diamond, minimum size=1.5cm] at (0,0){};
    \end{tikzpicture}
}
\end{document}

To put all above an (aux) node, you may use:

\node[above=of aux,anchor=center] { \resizebox{ ... tikz construction ... } };

where \resizebox{ ... } is the above construction

  • 1
    If the above refers to another node (aux) that is not only auxiliary as the name suggests, than he can’t omit it but add anchor=center to align the three nodes at the top of (aux) but with their centers. Maybe you like to add this to your answer. An image of the output would be nice too. – Tobi Feb 14 '13 at 15:33
  • 1
    @Tobi It would be nice to show the output, but that would be much easier if the POP provided an MWE. – yo' Feb 14 '13 at 15:37
  • @Tobi I've updated my answer by providing a MWE and an output – Lionel MANSUY Feb 14 '13 at 15:44
  • @Jake: But doesn’t above change the default anchor to south as it does in \path (0,0) node [above] {xx}? – Tobi Feb 14 '13 at 15:50
  • @LionelMANSUY: +1 for adding the MWE although it’s not your job as Jake said … – Tobi Feb 14 '13 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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