# How to draw a line passing through a point and parallel to another?

How to draw a line passing through a point and parallel to another?

\draw (0,0) -- (1,0);
\node (A) at (1,1);


I need \draw (0,1) -- (1,1); parallel to first line.

-

You can use the calc library to calculate the vector between the first two points. By using the + path operator, you can draw a line from a third point in the direction of this vector:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[dot/.style={circle,inner sep=1pt,fill,label={#1},name=#1},
extended line/.style={shorten >=-#1,shorten <=-#1},
extended line/.default=1cm]

\node [dot=A] at (2,1) {};
\node [dot=B] at (3,2) {};
\node [dot=P] at (2,2) {};

\draw [extended line=0.5cm] (A) -- (B);
\draw [extended line=0.5cm] (P) -- +($(B)-(A)$);

\end{tikzpicture}
\end{document}


-
thanks Jake.... –  Regis da Silva May 29 '11 at 21:17