How to show the coordinates of a point and the equation of a line dynamically? [duplicate]

I am constructing a diagram that consists of a sine curve and its tangent line at a given argument. However, I want to show the coordinates of the point of tangency and the equation of the tangent line dynamically.

My work so far:

f[x_] := Sin@x;
l[x_, a_] := f[a] + f'[a] (x - a);
Manipulate[
Show[
Plot[Sin@x, {x, 0, 2 \[Pi]},
PlotRange -> {-2, 2}, AxesStyle -> Arrowheads[0.03],
AxesLabel -> {"x", "Sin[x]"}, AspectRatio -> Automatic,
PlotLabel -> f[a] <> "+" <> f'[a] ("x-" <> a)],
Plot[l[x, a], {x, a - 2, a + 2}, PlotStyle -> Pink],
Graphics[{PointSize[Medium], Red, Point[{a, Sin@a}]}]],
{a, 0, 2 \[Pi]}]


Unfortunately, what I've done doesn't work.

So my question is: how do I get the information I need to make it work.

-

marked as duplicate by Artes, Sjoerd C. de Vries, Yves Klett, Michael E2, Dr. belisariusOct 19 '13 at 2:51

Inset/Text? – Kuba Oct 18 '13 at 5:02
Dear Tang, your Mma skills seem improved a lot :-) – mm.Jang Oct 18 '13 at 7:09
@mm.Jang,Thanks,can I know your QQ number? – Shutao TANG Oct 18 '13 at 9:15
@Tangshutao evaluate Uncompress@"1:eJxTTMoPyvSrvqUDAA/NA30=" in mathematica, then you get my qq. – mm.Jang Oct 18 '13 at 12:52

Like that?

f[x_] := Sin@x;
l[x_, a_] := f[a] + f'[a] (x - a);
Manipulate[
Show[Plot[Sin@x, {x, 0, 2 \[Pi]}, PlotRange -> {-2, 2}, AxesStyle ->Arrowheads[0.03],
AspectRatio -> Automatic],
Plot[l[x, a], {x, a - 2, a + 2}, PlotStyle -> Pink],
Graphics[{PointSize[Medium], Red, Point[{a, Sin@a}]}],
Epilog -> {Text[StringForm["A = (,)", a, Sin@a], Scaled[{.7, .7}]],
Text[StringForm["y = ", Expand@l[x, a]], Scaled[{.7, .6}]]}]
, {a, 0, 2 \[Pi]}]


Of course you can add Round or NumberForm etc. to reduce the precision of displaying. Also PolynomialForm[#, TraditionalOrder->True]& can help if one want to display line equation in form y = ax+b.

-
,Dear Kuba,I use your method of Inset,it works.However,the answer you give is perfect.Thanks sincerely! – Shutao TANG Oct 18 '13 at 5:14
@Tangshutao That's great you like it :) Good luck. – Kuba Oct 18 '13 at 6:04

This is more of a graphics design problem than a coding problem, which means it is open to an unlimited number of answers. Further, many of the layout decisions will be more a matter of taste than anything else. My own taste runs to showing the textual information inside a panel placed at the at the top-right corner of the plot. I use a panel along Column and Row because doing so puts a lot of formatting tools at my disposal.

Manipulate[
Plot[{Sin[u], tangent[u, x]}, {u, 0, 2 π},
AspectRatio -> Automatic,
Epilog -> {
{Red, PointSize[Large], Point[{x, Sin[x]}]},
Inset[
Panel[
Column[{