# Problem multiple intersections

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\draw[dotted](-10,-5) grid (5,5);
\path(0,0) node{0};
\draw(-10,0)--(5,0);
\coordinate(I')at(-2,2);
\coordinate(F'1)at(4,0);
\coordinate(F2)at(-3,0);
\draw[name path=D2](0,-5)--(0,5);
\draw(-9,2)--(I') node {};
\draw[name path=1'](I')--(F'1) node {};
\fill[red,name intersections={of=1' and D2,by={U'}}](intersection-1) circle(2pt);
\draw[shorten <=-5.5cm,name path=2'](F2)--+($(I')-(F'1)$) node {Y};
%so far so good, the intersection is at the right location (0,1.3)
\fill[green,name intersections={of=2' and D2,by={X}}](intersection-1) circle (1pt);
%here is the problem : the green circle is also located where the red circle (first intersection) is instead of (0,-1)
\end{tikzpicture}
\end{document}

• Welcome to TeX.SX! Please add a further description of your problem. – TeXnician Feb 10 '17 at 9:35

The extension of 2' by shorten <-5.5cm is not part of the named path. So there is no intersection between 2' and D2.

You have to change your path 2' to something like

\draw[name path=2']($(F2)+(I')-(F'1)$) node{Y}--(F2)--([turn=0]0:5.5cm);


or

\draw[name path=2']($(F2)+(I')-(F'1)$) node(Y) {Y}--($(F2)!-5.5cm!(Y)$);


Code:

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\draw[dotted](-10,-5) grid (5,5);
\path(0,0) node{0};
\draw(-10,0)--(5,0);
\coordinate(I')at(-2,2);
\coordinate(F'1)at(4,0);
\coordinate(F2)at(-3,0);
\draw[name path=D2](0,-5)--(0,5);
\draw(-9,2)--(I') node {};
\draw[name path=1'](I')--(F'1) node {};
\draw[name path=2']($(F2)+(I')-(F'1)$) node{Y}--(F2)--([turn=0]0:5.5cm);
%so far so good, the intersection is at the right location (0,1.3)
\fill[green,name intersections={of=2' and D2,by={X}}](X) circle [radius=1pt];
%here is the problem : the green circle is also located where the red circle (first intersection) is instead of (0,-1)
\end{tikzpicture}
\end{document}


Note that I have used your explicitly defined names U' and X instead intersection-1.

• why you use intersection name as intersection-1 if you for it define name U'? – Zarko Feb 10 '17 at 10:42
• @Zarko This was copied from the MWE in the question. So you have to ask the OP ;-) But I have changed it my example now. – esdd Feb 10 '17 at 12:35
• I suspect this :-). Hopefully OP will notice this (tiny) improvement of your nice answer. – Zarko Feb 10 '17 at 12:50
• Great esdd. Thanks for this usefull help. Now i still have to draw a line horizontal from X (the green spot) to the right. I guess I need to get the y-coordinate of X and then draw the line with it ? – Marc VR Feb 11 '17 at 13:15
• Something like \draw(X)--+(4,0); or \draw(X)--(X-|F'1);? – esdd Feb 11 '17 at 19:20