How to draw tangent to a bezier curve in CeTZ?

I am trying to draw tangent from an outside point to a bezier curve (which is a parabola here) but it gives me error: “Dictionary does not contain key “start” and no default value was specified”. The code is given below.

#import "@preview/cetz:0.2.2"


#cetz.canvas(
length: 1.2cm,
{
import cetz.draw: *
set-style(    
stroke: (thickness: 1pt, cap: "round"),
line: (stroke: 1pt+ blue),
content: (padding: 5pt))
line((-3,0), (4,0),name:"x", mark:(symbol:"stealth"), stroke: black+0.5pt)
line((0,-4), (0,4),name:"y", mark:(symbol:"stealth"), stroke: black+0.5pt)
bezier-through((4,-2),(0,0), (4,2),name:"p")
//circle((-2,0), radius: 1, name:"t")
line((-1,0), (element:"p", point:(-1,0), solution:1))
})

I have no idea what is wrong here. Any suggestion? I am able to find tangent to a circle though as given in the cetz-manual.

1 Like

The tangent coordinate system only works for circles right now.