Source
%% auteur : Gilles Mora

400 setwidth
-3 9 setxrange
-2 9 setyrange
.8 .8 scale

%quadrillage

/A {2 1} def
/B {7 4} def
2 setlinewidth
A B droite
1 setlinewidth

/C{7 1} def
B dashpoint
A dashpoint
tracerepere

pointilles
[A C] ligne
[B C] ligne
A C B angledroit

setTimes
(A) A [1.5 1.5] ultext
(B) B [1.5 1.5] drtext

#tex# $\vec \imath $
.3 0 [1.5 dup] dctexlabel
#tex# $\vec \jmath $
0 .1 [1.5 dup] ultexlabel

#tex# $x_B-x_A$
A C milieu [1.5 dup] dctexlabel
#tex# $y_B-y_A$
B C milieu [1.5 dup] drtexlabel
#tex# $x_A$
2 0 [1.5 dup] dctexlabel
#tex# $x_B$
7 0 [1.5 dup] dctexlabel

#tex# $y_A$
0 1 [1.5 dup] cltexlabel
#tex# $y_B$
0 4 [1.5 dup] cltexlabel

continu
/fillstyle {blanc fill} def
<tex>
$$
   a = {y_B - y_A\over x_B - x_A} 
   = {\hbox {déplacement vertical}\over 
      \hbox {déplacement horizontal}}
$$
</tex>
0 setlinewidth
boxit
2 7 [1.5 dup] dctexlabel

#tex# $y=ax+b$
-2 -1.5 {A B angle}  uctexlabel