5

This question already has an answer here:

I am trying to draw a very simple network diagram. My code:

    \begin{tikzpicture}
    \node[draw, shape=circle] (v0) at (0,0) {$v_0$};
    \node[draw, shape=circle] (v1) at (1,0) {$v_1$};
    \node[rectangle,minimum width=6em,draw] (v3) at (0.5,-1) {$v_3$};
    \draw [thick] (v0) -- (v1)
    (v0) -- (v3)
    (v1) -- (v3);
    \end{tikzpicture}

This produces the following figure:
enter image description here

I want the lines from the upper two nodes to go straight down towards the edge of the rectangle. Is there a simple way to do this?

marked as duplicate by Ignasi tikz-pgf Oct 12 '16 at 21:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4

yes, it is :-):

\documentclass[tikz,
               border=3mm]{standalone}

\begin{document}
\begin{tikzpicture}
    \node[draw, shape=circle] (v0) at (0,0) {$v_0$};
    \node[draw, shape=circle] (v1) at (1,0) {$v_1$};
    \node[rectangle,minimum width=6em,draw] (v3) at (0.5,-1) {$v_3$};
    \draw [thick] (v0) -- (v1)
    (v0) -- (v0 |-  v3.north) % <-- changed coordinates
    (v1) -- (v1 |- v3.north); % <-- changed coordinates
    \end{tikzpicture}
\end{document}   

enter image description here

|- means that lines go first "verticaly" and than "horzontaly" .... (v0 |- v3.north) determine coordinate in intersection of vertical lines through v0.center and horizontal line through v3.north.

  • Wow, that IS easy! Thank you very much for the quick and thorough help!! – Grim Reaper Oct 12 '16 at 19:47
  • Your are welcome! Happy TeXing! – Zarko Oct 12 '16 at 20:00

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