# 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.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

\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!