# Example: Intersecting lines

Published 2007-03-20 | Author: Kjell Magne Fauske

An example of using the intersection coordinate systems. Both the intersection and perpendicular coordinate system are used. The latter is a special case of the former, but has the shorter and more convenient -| and |- syntax.

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[scale=1.5]
% Draw axes
\draw [<->,thick] (0,2) node (yaxis) [above] {$y$}
|- (3,0) node (xaxis) [right] {$x$};
% Draw two intersecting lines
\draw (0,0) coordinate (a_1) -- (2,1.8) coordinate (a_2);
\draw (0,1.5) coordinate (b_1) -- (2.5,0) coordinate (b_2);
% Calculate the intersection of the lines a_1 -- a_2 and b_1 -- b_2
% and store the coordinate in c.
\coordinate (c) at (intersection of a_1--a_2 and b_1--b_2);
% Draw lines indicating intersection with y and x axis. Here we use
% the perpendicular coordinate system
\draw[dashed] (yaxis |- c) node[left] {$y'$}
-| (xaxis -| c) node[below] {$x'$};
% Draw a dot to indicate intersection point
\fill[red] (c) circle (2pt);
\end{tikzpicture}
\end{document}


• #1 alfC, June 27, 2010 at 8:37 a.m.

does anybody know if it is possible to attach files (with attachfile2 package or other) to tikz objects, more specifically lines. My naive attempt didn't work: \textattachfile[]{example.tex}{

\draw [<->,thick] (0,2) node (yaxis) [above] {$y$}

|- (3,0) node (xaxis) [right] {$x$};


}

• #2 rahul, April 23, 2012 at 2:38 p.m.

I want 10 examples of intersecting lines

• #3 Gilda, March 31, 2013 at 12:44 a.m.

Heya are using Wordpress for your site platform? I'm new to the blog world but I'm trying to get started and create my own. Do you need any html coding knowledge to make your own blog? Any help would be greatly appreciated!

• #4 Ruben, April 6, 2013 at 1:45 p.m.

Good respond in return of this question with solid arguments and explaining everything on the topic of that.

• #5 California Lottery winning numbers, May 21, 2013 at 3:29 a.m.

Hi there fantastic website! Does running a blog like this take a massive amount work? I've very little expertise in computer programming however I had been hoping to start my own blog in the near future. Anyhow, should you have any ideas or tips for new blog owners please share. I know this is off topic but I just had to ask. Cheers!

• #6 http://gcchallenge.com/node/28842, May 21, 2013 at 4:40 p.m.

Hi there, this weekend is good in favor of me, because this point in time i am reading this great educational article here at my house.