Zero: Specifying num formatting using quan

I know I’m on the cutting edge here (zero 0.7.0 was only released a couple of days ago introducing the quanfunction) and maybe I’m missing the trivial thing here, but how do I specify number formatting in a quan call in the zero package?

I can do

#zero.num(digits: 6, exponent: "sci")[0.0009869604401089359]

to get

image

How can I turn this into a quantity 9.869604e-4 cm^2 using quan specifying the number formatting? Should I append manually the unit quan[cm^2]? Should I apply a ‘private’ set-num call?

#{
set-num(digits: 6) 
quan[0.0009869604401089359 cm^2]
}

I think you looking for this GitHub - Mc-Zen/zero: Precise scientific number and unit formatting for Typst. · GitHub

I think quan function can be used if this unit used only few times, annd zi.declare for unit what used a lot.

Hi @Gert , this is in principle correct. Currently, quan does not take additional arguments to forward them to num and unit − yet! This is an oversight on my part.

With that it will just be

#zero.quan(digits: 6)[0.0009869604401089359 cm^2]

Edit: i pushed this addition to main and it will be part of an upcoming patch release.

1 Like