First step is to draw the nodes and give them name. Lets start with the top node located at the origin and name it (top)
:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node (top) at (0,0) {$\{x,y\}$};
\end{tikzpicture}
\end{document}
So now you have:
which is not too exciting.
Note: I included the full code here, but subsequent steps I show only the additions to the above to make it easier to follow.
Next, add the left and right nodes. These should be located relative to the (top)
node so that in case we decide to move the position of the top node, these two will move along with it:
\node [below left of=top] (left) {$x$};
\node [below right of=top] (right) {$y$};
So, now things a looking a bit more useful:
If these are not far enough apart, you could move them, again relatively, by using something like xshift=<length>
, or xshift=<length>
.
Next step is to draw the lines connecting these nodes via their node names (color used here to see the correspondence between the code and the output):
\draw [red, thick] (top) -- (left);
\draw [blue, thick] (top) -- (right);
to get:
If the lines are not long enough you can shorten then via a negative amount. For the top we use shorten <=-2pt
, and for the bottom shorten >=-2pt
to get:
Using the to
syntax as opposed to the --
allows you to get fancier and control the angle at the out point via out=<angle>
, and the angle of the line coming in via in=<angle>
:
\draw [red, thick, shorten <=-2pt, shorten >=-2pt, out=-120, in=90] (top) to (left);
\draw [blue, thick, shorten <=-2pt, shorten >=-2pt, out=-60, in=90] (top) to (right);
which if it had been used below would have produced:
As pointed out by Paul Gaborit, the out
and in
options are really only for the to
directive so some might prefer a syntax that more explicitly places those options for the to
as in:
\draw [red, thick, shorten <=-2pt, shorten >=-2pt] (top) to [out=-120, in=90] (left);
\draw [blue, thick, shorten <=-2pt, shorten >=-2pt] (top) to [out=-60, in=90] (right);
Best Answer
I think TikZ can do that without problem and without library. It's possible to add some parameters if you want to change something automatically. You can with the next method to scale without problem.
If you want to modify the position with parameters: