I'm currently creating lecture notes for "Geometry and Topology". As we now arrived at part about euclidean geometry, I quite often have the situation that I need to visualize lines (not line segments, but lines).
For example, I have the following image (the code is at the end)

But PQ should be a line, so I need to "enlarge" the line segment PQ.
Usually, I would calculate the equation of PQ like this
m = (P.y - Q.y)/(P.x - Q.x) -- mind the special case of P.x = Q.x
P.y = m * P.x + t
<=> t = P.y - m*P.x
Then I would add two helping points A and B:
(enlarge by 0.5)
A.x := P.x - 0.5
B.x := Q.x + 0.5
A.y = m*A.x + t
B.y = m*B.x + t
And finally I would draw the line A - P - Q - B which is my "enlarged line 'PQ'".
But this seems to be quite complicated to me for a task that could be done automatically. So is there a way in TikZ to enlarge lines?
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzstyle{point}=[circle,thick,draw=black,fill=black,inner sep=0pt,minimum width=4pt,minimum height=4pt]
\node (P)[point,label={[label distance=0cm]-90:$P$}] at (0,0) {};
\node (Q)[point,label={[label distance=0cm]-90:$Q$}] at (5,1) {};
\node (A)[point,label={[label distance=0cm]180:$\varphi_1(R)$}] at (2,2) {};
\node (B)[point,label={[label distance=0cm]190:$\varphi_2(R)$}] at (1,3) {};
\draw[very thick, enlarge] (P) edge node {} (Q);
\draw[very thick, red] (P) edge node {} (A);
\draw[very thick, red] (P) edge node {} (B);
\draw[very thick, green] (Q) edge node {} (A);
\draw[very thick, green] (Q) edge node {} (B);
\end{tikzpicture}
\end{document}



tkz-euclidepackage for drawings like this. The syntax takes a bit of getting used to, but once you've got the hang of it, it makes drawing diagrams like this much easier. – Jake Jan 14 '14 at 12:36\draw ($(P)!-1cm!(Q)$) -- ($(Q)!-1cm!(P)$);:-) – Martin Thoma Jan 14 '14 at 12:49tikzdecide how long the line PQ should be?) – Martin Thoma Jan 14 '14 at 12:59\tkzDrawLineextends over the points by 20 % of the distance between the two points. You can adjust that amount using\tkzDrawLine[add=0.1 and 0.4](P,Q)to make the line extend by 10 % and 40 % of the distance, for example. – Jake Jan 14 '14 at 13:04