Skip to content

Conversation

mcanouil
Copy link
Collaborator

@mcanouil mcanouil commented Nov 29, 2024

Switch from using percentage to fraction type for column widths to avoid overflow issues in Typst.

Fixes #11578

Input1.6.39This PR
---
title: "Quarto Playground"
format: typst
---

::: {layout="[1, 2, 2, 1, 3, 1, 1]"}

![]({{< placeholder format=svg >}})

![]({{< placeholder format=svg >}})

![]({{< placeholder format=svg >}})

![]({{< placeholder format=svg >}})

![]({{< placeholder format=svg >}})

![]({{< placeholder format=svg >}})

![]({{< placeholder format=svg >}})
:::
image image

@mcanouil mcanouil self-assigned this Nov 29, 2024
@gordonwoodhull
Copy link
Contributor

Thanks @mcanouil!

Please add a test e.g. under

tests/docs/smoke-all/typst

@gordonwoodhull
Copy link
Contributor

As illustrated by the test, it would be nicer to convey the existing fractional numbers rather than converting to percent and using percentages as fractions.

layout="[1, 2, 2, 1, 3, 1, 1]

If that information is still available.

(On the principal that it’s nice if users can recognize their input in the Typst output, where possible.)

@mcanouil
Copy link
Collaborator Author

The issue is that the width is computed in what seems to be a generic code path.
It should be possible to add a Typst exception in it and avoid the first conversion to percentages: https://github.com/quarto-dev/quarto-cli/blob/2a2ddd67afc9a0d6ae211fb0d48443bf0db52bb9/src/resources/filters/layout/layout.lua

@gordonwoodhull
Copy link
Contributor

Thanks @mcanouil, I took this approach in #11658:

The issue is that the width is computed in what seems to be a generic code path.
It should be possible to add a Typst exception in it and avoid the first conversion to percentages

It makes that code less generic (but the code wasn't really generic if it generates the wrong output in Typst).

@mcanouil
Copy link
Collaborator Author

I agree that it is best to have output as close as possible from the the input.
Feel free to close this PR.

@gordonwoodhull
Copy link
Contributor

Closed in favor of #11658

@mcanouil mcanouil deleted the fix/issue11578 branch December 11, 2024 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charts in Callout Boxes Overflow Their Boundaries in Typst Format

2 participants