Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify grid.column-gutter docs #3959

Open
1 task done
tingerrr opened this issue Apr 19, 2024 · 5 comments
Open
1 task done

Clarify grid.column-gutter docs #3959

tingerrr opened this issue Apr 19, 2024 · 5 comments
Labels
docs Improvements or additions to documentation layout Related to layout, positioning, etc.

Comments

@tingerrr
Copy link
Contributor

Description

The documentation for grid states that the default value for grid.column-gutter is (), yet when setting it explicitly, it changes the behavior of grid.

#grid(
  columns: 2,
  gutter: 1em,
  box(stroke: red)[A],
  box(stroke: red)[B],
)

#grid(
  columns: 2,
  gutter: 1em,
  column-gutter: (),
  box(stroke: red)[A],
  box(stroke: red)[B],
)

My understanding is that, passing the default value myself should not change how the gird behaves.

Reproduction URL

No response

Operating system

No response

Typst version

  • I am using the latest version of Typst
@tingerrr tingerrr added the bug Something isn't working label Apr 19, 2024
@laurmaedje
Copy link
Member

The gutter variable overrides the column-gutter. Basically gutter: X is equivalent to passing column-gutter: X, row-gutter: X. So a desugared version of your example is

#grid(
  columns: 2,
  column-gutter: 1em,
  row-gutter: 1em,
  box(stroke: red)[A],
  box(stroke: red)[B],
)

#grid(
  columns: 2,
  column-gutter: (),
  row-gutter: 1em,
  box(stroke: red)[A],
  box(stroke: red)[B],
)

And if you now remove column-gutter: () in the second example, nothing happens, as expected.

@laurmaedje laurmaedje closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
@tingerrr
Copy link
Contributor Author

The docs ought to be clear about that then. When providing wrapper functions that don't use argument sinks, this is surprising.

@laurmaedje
Copy link
Member

The docs ought to be clear about that then.

How do you think we should word it? Right now it says "Takes precedence over gutter." for column-gutter.

When providing wrapper functions that don't use argument sinks, this is surprising.

Can you provide an example?

@tingerrr
Copy link
Contributor Author

How do you think we should word it? Right now it says "Takes precedence over gutter." for column-gutter.

I think it should be noted on gutter and {column,row}-gutter that gutter is a shorthand passing the specific ones both, such that auto is not a fallback to gutter, maybe. At least that's what I initially assumed.

Can you provide an example?

Simplified, because this is a for a library, it is important for both tidy and argument validation to not use a sink here:

#let subfigure-grid(
  // figure arguments with defaults
  // ...

  // grid arguments with defaults
  // ...

  // figures
  // ...
) = {
  // arg validation with explicit arguments
  // passing all arguments straight through with their default values
}

@laurmaedje
Copy link
Member

We can reword the docs. I'll reopen to track this.

@laurmaedje laurmaedje reopened this Apr 29, 2024
@laurmaedje laurmaedje changed the title Explicitly passing default value of grid.column-gutter changes appearance Clarify grid.column-gutter docs Apr 29, 2024
@laurmaedje laurmaedje added docs Improvements or additions to documentation and removed bug Something isn't working labels Apr 29, 2024
@Enivex Enivex added the layout Related to layout, positioning, etc. label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation layout Related to layout, positioning, etc.
Projects
None yet
Development

No branches or pull requests

3 participants