How to span tables or images across two-column layout in Typst-PDF output #13065
produnis
started this conversation in
Show and Tell
Replies: 1 comment
-
Thanks for sharing, this is great! Relatedly, I really think we should consider adding https://github.com/christopherkenny/typst-function to the core of Quarto's typst functionality, together with a corresponding Lua API. Writing the function Div(div)
if div.classes:includes("multicolumn") then
return quarto.typst.function_call("place", "top+center", div, { scope = "parent", float = true })
end
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I'm using Quarto to write and typeset academic articles. For PDF output, I use Typst, and my layout is typically two-column, which I activate via the following line in my Typst template:
Sometimes, though, I want to place a wide table or image that spans both columns.
In Typst, this is easy using the place function:
In Quarto, I can achieve this by manually opening and closing typst chunks around the content. Here's an example that uses a Markdown table:
While this works, it's not exactly the “Quarto way” of doing things.
To improve this, I wrote a small Lua filter called
multicolumn.lua
, which wraps any.multicolumn
div in the proper#place(...)
Typst code:Then, in the YAML front matter, I just enable the filter:
Now I can write clean Quarto content like this:
The table is now automatically placed across both columns. This approach also works well for images and R code chunks.
Hope this is helpful to somebody.. :-)
Beta Was this translation helpful? Give feedback.
All reactions