#import "@preview/cetz:0.5.2"
#import calc:*
#cetz.canvas(length:1cm,{
import cetz.draw: *
set-style(line: (stroke: (paint: rgb("#55aaaa"), thickness: 1pt),
mark: (end: (symbol: "stealth", fill: rgb("#55aaaa"), scale: 0.8))))
line((-3, 0), (3, 0))
line((0, -3), (0, 3))
grid((-3, -3), (3, 3), step:0.5, stroke: (paint: rgb("#55aaaae8"), thickness: 0.1pt))
// draw an arc
arc((0, 0), start:45deg,stop:135deg, radius: sqrt(2) * 1.5)
// how can I use the circle element to draw the same arc?
// why does cetz not allow to draw the arc with the circle element?
})
I’m not 100% sure, but I guess it’s because circles and arcs are implemented differently.
A circle in CeTZ turns into low-level directives for drawing circles, but an arc in CeTZ is approximated by directives for drawing Bézier curves, because the directive for drawing arcs does not exist.
Check Visualize - Typst Documentation and you’ll notice that Typst provides circle and curve, but not arc. Perhaps that’s limited by the SVG or PDF standard?
See also:
- Add a `curve.arc` function for circular and elliptical arcs · Issue #5915 · typst/typst · GitHub
- Is there a nice way of drawing an arc without cetz?
Further details on CeTZ.
Here’s the source of the approximation in CeTZ:
Calculation of control points is based on the method described here:
A Primer on Bézier Curves
You can observe the approximation by drawing a red arc on top a green circle. The difference is noticeable when the radius r is 5000.
Code
#import "@preview/cetz:0.5.1"
#let r = 5000 // Change this number
#cetz.canvas(padding: (left: -2 * r, y: -r), {
import cetz.draw: *
circle((0, 0), radius: r, stroke: black + 0.5pt)
circle((0, 0), radius: r, stroke: green + 0.5pt)
arc((r, 0), radius: r, start: 0deg, stop: 90deg, stroke: red + 0.5pt)
})
$r = #r$
You can use `arc(position, …, anchor: “origin”)` to use `position` as the circle center. Cetz uses up to 4 beziers for both circles and arcs, so the Typst primitive is not the reason both are different elements.
I guess adding a start/stop argument to circle would be fine, but I am not sure it is really needed.
Circles cannot have marks for instance, while arcs can, so `arc` is the more flexible element.



