#Typst equivalent hfill and vfill?
88 messages · Page 1 of 1 (latest)
Yes. Fill horizontal space, so that "bob" is left-aligned and "tom" is right-aligned.
awesome! thanks! i didn't realize the fractions worked like that.
they basically divide the remaining space
among themselves
but
for h, box, v, it's just one element, only one "column"
so in practice 1fr just divides the remaining space by 1
ok, how would this work in a grid with 2 columns and 2 rows?
hm. is there a proper way to format code on discord?
well, in that case you're better off using #align(left) and #align(right) on the individual cells
the same as in typst
```
stuff
```
ah, code fences
ok
grid(
columns: 2,
rows: 2,
column-gutter: 0.3cm,
row-gutter: 0.2cm,
text(size: 10pt)[
text-cell-1,
align(right, text-cell2),
text-cell-3,
text-cell-4
]
)
i don't think the grid recognizes these as separate cells
yeah
in fact the align etc you wrote has no effect
cuz [ ] is content
so it's like writing literally into the document
{ } is for code
so that's a step
but also
you're still wrapping everything in a single text
yeah, i thought so, is there a way to use "set" in a grid context?
you can do this:
#[
#set text(10pt)
#grid(...)
]```
that will restrict the set to that scope
ok, that makes sense! thanks for being so helpful!
what's the preferred way to pass each "text-cell-1" separately to grid?
arguments
just to be clear, i did check the docs for grid(), but it wasn't obvious to me
?render
#grid(columns: 2,
[hey],
[bye],
[ok]
)
interesting, so square brackets signal arguments in grid
no
they signal content
that's their only purpose
note that it's not loading the value from the variable hey
it's writing "hey"
it's like using "hey" to indicate a string
except that [hey] has markup
e.g. [*hey*] produces bold
and [#grid(...)] produces a grid
the thing here is that they are arguments to the grid function
separated by commas
when you wrote the text()[ ... ] there, only the text() was passed to the grid
that makes sense
because the other things you wrote were arguments to text
right
well , in the way they were written, they were literal text(due to being in [ ... ]), but even if fixed it still wouldnt have worked cuz of that
so, the square brackets are keeping the text grouped, so grid knows to send each group to each grid cell
well
ha
don't kill me, i just learned about this language like 2 hours ago
ha, ok, thanks for your help!
no prob 👍
this is such a breath of fresh air compared to latex!
yeah lol I assure you the syntax would have been much uglier
I went looking for exactly this (\hfill) and didn't know about the fr fraction unit type. Would be nice if searching for \hfill yielded this page: https://typst.app/docs/reference/types/fraction
Maybe could be added to the LaTeX guide too
I thought about opening a PR but I'm not sure where exactly this information should go. The guide seems pretty top-level and this is arguably a niche thing. https://typst.app/docs/guides/guide-for-latex-users/
I think there could be some sort of “other commands” section
With things like this
Good idea. Is there anything else that comes to mind? (i.e. other misc commands)
oh
i just realized \vfill shows up
at the very end of the guide
but yeah it's a bit hidden in a larger paragraph
lol
definitely could use some table for that
it also shows up with pagebreak so maybe pagebreak could be one such command
maybe linebreaks too ( \\ -> \)
stuff like that
I was just thinking about \\ and linebreak(). The guide still lists "no package manager available" so maybe I'll draft a micro-PR and we can fix also the other issues with the current doc page.
yeah sure, although i guess the guide is technically still correct about that :p
so let's see, maybe they will update it when v0.6.0 releases
uhh, that didn't age well