I used the following code to draw tangent lines from points a and o (on 2 curves starting from a certain point) to x and y axes.
The node at point strt is used to draw other curves and lines; so I need the 2 curves to start from it.
Is there a code that automates this drawing, without trying drawing lines from different points on the x and y axes till they pass through the designated points on the curves.
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{tangent lines to x and y axes}
\begin{tikzpicture}[scale=1., transform shape]
\draw [thick] (0,0) -- (7,0);
\draw [thick] (0,0) -- (0,6);
\node at (2.5,2.) (strt){};
\draw [very thick, blue, looseness=.8] (strt.center) to [out=140,in=-80] node [pos=.3] (x){x} +(120.:3.cm) (strt.center) to [out=-40,in=170] node [pos=.25] (o){o} +(-20.:3.cm);
\draw [thick, red] (3.8,0) -- (0,5.2);
\draw [thick, red] (6.2,0) -- (0,3.2);
\end{tikzpicture}
\end{frame}
\end{document}
Best Answer
The answer is updated in accordance with Hany's remark, "I want the tangent at point 1 to end at y axis with a node containing some text".
There are two decorations
tanget at
andtangent vector at
. The main one is the former and is used for the points 1 and 2. The later, used for 3, is simpler and indicates the sens in which TikZ goes along the curve.Some comments concerning
tanget at
#1
is a sub-unitary float which determines the point on the curve;#2
and#3
are multiplicative constants.#1
. Think about#1
as being a value of the time coordinate describing the curve with constant speed.#2
represents the length (in length units,cm
by default) of the tangent semi-line in the negative direction. The same for#3
, but in the positive one.tangent at
sets the following names to points involved in the construction:(point-k)
the point on the curve defined by#1
(tpoint-k)
the point on the tangent line such that(tpoint-k) - (point-k)
is the unit tangent vector in the positive direction (see alsotangent vector at
)(A-k)
and(B-k)
the extremities of the tangent line.The integer
k
stands for the index of the point in the sequence of invocations oftangent at
. In the above drawingk
is 1 or 2.Remark You can play with the arguemnts
#2
and#3
to have the tangent line you want at the point#1
. Then use(A-k)
and/or(B-k)
to insert the text you need. It might be easier to draw the point(A-k)
before looking for the perfect value of#2
.The code