# TikZ : Intersection of two lines without breaking the line

Sorry for the bad title. I am trying to intersect two lines AB and DE such that DE should bend at the intersection of two. Why it is getting disconnected at the intersection point I? What is the way to bend it without breaking the line. MWE is attached.

\documentclass{standalone}
\usepackage{tikz,circuitikz}
\usetikzlibrary{calc,intersections}

\begin{document}
\begin{tikzpicture}
\draw (0,0) node {A} coordinate (A)--(2,2) node {B} coordinate (B);
\path[name=disperpath] (0,1) coordinate (D) node {D}--++(0:5) coordinate (E);
\node (I) at (intersection of D--E and A--B) {};
\draw  (D)--(I) --++ (1,-.5) node {E} ;
\end{tikzpicture}

\end{document}


You get the break because a \node has a size, and when you draw a path via a node, the line stops and starts at the border of the node. Use a \coordinate for I instead of \node.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\draw (0,0) node {A} coordinate (A)--(2,2) node {B} coordinate (B);
\path[name=disperpath] (0,1) coordinate (D) node {D}--++(0:5) coordinate (E);
\coordinate (I) at (intersection of D--E and A--B) {};
\draw  (D)--(I) --++ (1,-.5) node {E} ;
\end{tikzpicture}
\end{document}


Note also that you're not actually using the syntax defined by the intersections library, you're using an older syntax that is not documented in the manual of the current version of TikZ. And further note that the disperpath path causes a lot of additional whitespace in the right side of the diagram.

Here is a version of the code that uses intersections as intended. Note the use of name path to give the paths names, that are used in intersecions of.

There are various other changes in the code as well.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\node (A) {A};
\node (B) at (2,2) {B};
\draw [name path=abpath] (A) -- (B);
\path[name path=disperpath] (0,1) coordinate[label=left:D] (D) -- (0,1 -| B);
\path[name intersections={of={abpath and disperpath}}] coordinate (I) at (intersection-1);
\draw  (D)--(I) --++ (1,-.5) node[below right] {E};
\end{tikzpicture}
\end{document}

• Thanks for a super quick answer. I was amazed to see that one can get an answer within two minutes after posting the question! Thanks @Torbjorn T. – praveen pathak Dec 27 '16 at 10:51
• @praveenpathak No worries. I just updated my answer by the way. – Torbjørn T. Dec 27 '16 at 10:59
• What does \node (A) {A}; do? Can I define node without defining coordinate points? – praveen pathak Dec 31 '16 at 15:22
• @praveenpathak If you don't specify the coordinates with at (x,y) the default value of (0,0) will be used. – Torbjørn T. Dec 31 '16 at 16:50