3

Following Problem with tikz: I want to Position my nodes as seen in the attached Picture. So "east" of my node "a" is my "west" of node "b"; (in short: a.east=b.west). in Addition i would love to add a optional space sometimes between a; (a.east=b.west+x).

Additionally i want for other nodes that some nodes to have the same x0,y0-Position.

In the MWE i provided i want the bigger Ellipse's east to match at the rectanlges west. And the smaller Ellipse should have the same x0,y0 as the bigger one.

\documentclass{scrartcl} 
\usepackage{tikz}
\usetikzlibrary{shapes, positioning}
\begin{document}
 \begin{figure}
 \centering 
  \begin{tikzpicture}
  \node (outer) [rectangle, draw=black, thick, minimum height=4cm,minimum width=3cm]{};
  \node (inin)[ellipse, draw=black, thick, minimum height=2cm, minimum width=0.3cm, right of = outer] {};
  \node (inout)[ellipse, draw=black, thick, minimum height=2.5cm, minimum width=0.5cm, right of =outer] {};
 \end{tikzpicture}
\caption{Arch}
\label{fig:Arch}
\end{figure}
\end{document}

Any suggestions?

Edit: i added a second Picture, to make clearer what i want. enter image description here

enter image description here

  • Note that code should be formatted as code (indent by four spaces or highlight and hit the {} key) rather than as a quotation. Some line breaks would be good. Perhaps you could edit your question to include them? – cfr Dec 29 '14 at 19:13
4

To place a node x distance to the right of node a, use:

right=x of a

x might, for example, be 0pt or 5mm or whatever.

To place the inner line of the ellipse, it is easiest to draw the outer line first and then place the inner line using inout.center to centre the ellipse. This seems simpler, to me, than figuring out the appropriate amount to move to the right.

positioning things

\documentclass[tikz, border=5pt]{standalone}
\usetikzlibrary{shapes, positioning}
\begin{document}
  \begin{tikzpicture}
    \node (outer) [rectangle, draw=black, thick, minimum height=4cm,minimum width=3cm]{};
    \node (inout)[ellipse, draw=black, thick, minimum height=2.5cm, minimum width=0.5cm, right=0pt of outer] {};
    \node (inin)[ellipse, draw=black, thick, minimum height=2cm, minimum width=0.3cm] at (inout.center) {};
  \end{tikzpicture}
\end{document}

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.