diff --git a/src/units.typ b/src/units.typ index 38ec908..97ff194 100644 --- a/src/units.typ +++ b/src/units.typ @@ -313,13 +313,14 @@ sym.wj separator if not breakable.unit { sym.wj } - box(show-unit( + show-unit( unit.numerator, unit.denominator, fraction: num-state.unit.fraction, unit-separator: num-state.unit.unit-separator, math: num-state.math, - )) + use-sqrt: num-state.unit.use-sqrt + ) } result diff --git a/tests/zi/sqrt/.gitignore b/tests/zi/sqrt/.gitignore new file mode 100644 index 0000000..2e4c5d8 --- /dev/null +++ b/tests/zi/sqrt/.gitignore @@ -0,0 +1,5 @@ +# generated by tytanic, do not edit + +/diff/ +/out/ +/ref/ diff --git a/tests/zi/sqrt/ref.typ b/tests/zi/sqrt/ref.typ new file mode 100644 index 0000000..fa69d4e --- /dev/null +++ b/tests/zi/sqrt/ref.typ @@ -0,0 +1,37 @@ +#set page(width: auto, height: auto, margin: .5em) + + +#let th = sym.space.thin + +$"K"^(0.5)$ \ +$42th"K"^(0.5)$ \ +$"s"th"K"^(-0.5)$ \ +$42th"s"th"K"^(-0.5)$ + +$"K"^(0.5)$ \ +$42th"K"^(0.5)$ \ +$"s"\/"K"^(0.5)$ \ +$42th"s"\/"K"^(0.5)$ \ + +$"K"^(0.5)$ \ +$42th"K"^(0.5)$ \ +$"s"/"K"^(0.5)$ \ +$42th"s"/"K"^(0.5)$ \ + +#pagebreak() + + +$√"K"$ \ +$42th√"K"$ \ +$"s"th"K"^(-0.5)$ \ +$42th"s"th"K"^(-0.5)$ + +$√"K"$ \ +$42th√"K"$ \ +$"s"\/√"K"$ \ +$42th"s"\/√"K"$ \ + +$√"K"$ \ +$42th√"K"$ \ +$"s"/sqrt("K")$ \ +$42th"s"/sqrt("K")$ \ diff --git a/tests/zi/sqrt/test.typ b/tests/zi/sqrt/test.typ new file mode 100644 index 0000000..663f58d --- /dev/null +++ b/tests/zi/sqrt/test.typ @@ -0,0 +1,43 @@ +#import "/src/zero.typ": * + +#set page(width: auto, height: auto, margin: .5em) + + +#let Kroot = zi.declare("K^0.5") +#let K-root = zi.declare("s/K^0.5") + + +#let sample = [ + #Kroot() \ + #Kroot()[42] \ + #K-root() \ + #K-root()[42] \ +] +#set-unit(use-sqrt: false) +#set-unit(fraction: "power") +#sample + +#set-unit(fraction: "inline") +#sample + +#set-unit(fraction: "fraction") +#sample + +#pagebreak() + + +#set-unit(use-sqrt: true) +#set-unit(fraction: "power") +#sample + +#set-unit(fraction: "inline") +#sample + +#set-unit(fraction: "fraction") +#sample +// $ +// #kg-K1-2(use-sqrt: false) \ +// #kg-K1-2(use-sqrt: false, fraction: "inline") \ +// #kg-K1-2(use-sqrt: false)[42] \ +// #kg-K1-2(use-sqrt: false, fraction: "inline")[42] +// $ \ No newline at end of file