#cest exported svg extra whitespace

22 messages ยท Page 1 of 1 (latest)

tame rock
#

@scarlet spear Hejhej, I just tried your code and it's the same. There is quite a lot of added whitespace at the bottom.
It does seem to work here though, which is really confusing.
I'm on Ubuntu and no other file is loaded nor pinned.

scarlet spear
#

the whitespace is just the rest of the page. are you using any sort of styling in your document?

#

and if you copy your original code (just the trees), does it also work in a fresh document

tame rock
#

Nope, this time I just copied and pasted your code.

I will try a fresh document! ๐Ÿ™‚

scarlet spear
#

Nope, this time I just copied and pasted your code.
i meant in the file which ends up looking broken ๐Ÿ˜…
styling can affect stuff like this

#

to get rid of the whitespace, we'd just do set page(height: auto, width: auto) at the top. just like height and width we can also set the margin, i.e. to 1cm or 0pt

tame rock
scarlet spear
#

no the boxes where just to show the outline

#

not needed to just export the trees c:

tame rock
scarlet spear
#

?r t=l ```ts
#set page(height: auto, width: auto, margin: 0pt)

#import "@preview/cetz:0.4.2"
#let trees = (
(
[0],
([1], [2], [3]),
([4], [5])
),
(
[6],
([7], [8]),
[9]
),
)

#{
let little_tree = ()
for (i,data) in trees.enumerate() {
let foo = {
cetz.canvas({
import cetz.draw: *
cetz.tree.tree(
data,
direction: "down",
draw-node: (node, ..) => {
circle((), radius: .35, fill: none , stroke: 0.5pt)
content((), text(black, [#node.content]))
},
draw-edge: (from, to, ..) => {
let (a, b) = (from + ".center", to + ".center")
line((a, .4, b), (b, .4, a))
}
)
})
}
little_tree.push(foo)
}
grid(
columns: little_tree.len(),
gutter: 1em,
little_tree.at(0), little_tree.at(1),
)
}

scarlet spear
#

here it is with the page settings

#

I assumed you bringing it up as an issue with grid meant that it was doing something weird beyond that ๐Ÿ˜…

tame rock
#

whyyy is there so much more whitespace on my machine?! ๐Ÿ˜ฎ

scarlet spear
#

look at the very first line of the code I sent

#

it should look the same on your machine with that

else your viewer is adding extra margins but those are not really in the file itself. you can try a different viewer as well

sterile frigate
#

like pink alluded to, Typst by default draws its document content on a4 pages

#

(if you don't change that, you have a4 size pages)

tame rock
#

Oh the last one worked fine.
Thank you so much! I'm dumb ๐Ÿ˜…

scarlet spear
#

no problem at all, im glad we figured it out! have a good time with your trees excited