#cest exported svg extra whitespace
22 messages ยท Page 1 of 1 (latest)
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
Nope, this time I just copied and pasted your code.
I will try a fresh document! ๐
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
But the code where you added the black boxes was the complete file.
So I actually needed to add this styling? I will try, thank you for your patience ๐
no the boxes where just to show the outline
not needed to just export the trees c:
Yes, I know ๐ I just meant that there was nothing hidden and I tried to specify which code I used without any changes ๐
?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),
)
}
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 ๐
whyyy is there so much more whitespace on my machine?! ๐ฎ
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
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)
Oh the last one worked fine.
Thank you so much! I'm dumb ๐
no problem at all, im glad we figured it out! have a good time with your trees 