# How to draw the tangent vector at one endpoint of a curve

I would like to draw with the package tikz a smooth curve (not closed) and I would like to draw the tangent vector at one of the endpoints.

I haven't had nice results so far. I used the library hobby to draw the curve but somehow I felt I didn't have much control. I have mainly two problems:

1. Every curve I draw with hobby it's somehow too "round".

2. The second problem is that I have no idea how to draw a tangent point at a precise point (in my case the first or last point) of the curve. I toyed a bit with some code I found here, but with no luck. In that link the curve is drawn as an arc, while I would like to have a more "generic" curve, and moreover I need an arrow, not a segment.

Any help or reference would be very much appreciated! I'm very new to tikz. I used it a bit some years ago for my master thesis, but I haven't used since then.

• Could you please provide an MWE? And here is a nice way of drawing the tangent on a curve. – user121799 Jul 5 '18 at 13:15

## 1 Answer

As for the first point of your question, I cannot say too much since you do not provide any concrete example. The only thing I can say is that you can draw the curve with plot[smooth] and use the tension parameter to control the "roundness". As for your second point, you can cheat and draw the tangent at the end point using an "arrow". This might be recommended anyway because the alternative, decorations, may have problems at the end of the path. Here's an example in which I draw the plot twice to show how accurate the tangent is.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\draw[-{Rectangle[width=0.4pt,length=1cm]}]
plot[smooth,tension=0.6] coordinates {(-3.5,0) (-3,1) (-2,1.5) (-2,3) (-1,2.5)
(1,4.5) (2.5,3) (3,3.5) (3.5,3) (3,2) (4.5,2)};
\draw[blue]
plot[smooth,tension=0.6] coordinates {(-3.5,0) (-3,1) (-2,1.5) (-2,3) (-1,2.5)
(1,4.5) (2.5,3) (3,3.5) (3.5,3) (3,2) (4.5,2)};
\end{tikzpicture}
\end{document}