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

Single-cell negative line expansion does not work #74

Closed
dixslyf opened this issue Nov 16, 2023 · 4 comments · Fixed by #84
Closed

Single-cell negative line expansion does not work #74

dixslyf opened this issue Nov 16, 2023 · 4 comments · Fixed by #84
Labels
bug Something isn't working renderer Related to the final rendering (drawing) step of the table.
Milestone

Comments

@dixslyf
Copy link
Contributor

dixslyf commented Nov 16, 2023

It would be great if expand can be set to a negative value for hlinex and vlinex to shorten the line. As of now, setting expand to a negative value does not seem to do anything (v0.0.6).

#tablex(
  columns: (100%,),
  auto-lines: false,
  hlinex(expand: 1em),
  [],
  hlinex(),
  [],
  hlinex(expand: -1em),
)

image

@PgBiel PgBiel added the enhancement New feature or request label Nov 17, 2023
@PgBiel PgBiel added this to the v0.2.0 or later milestone Nov 17, 2023
@PgBiel
Copy link
Owner

PgBiel commented Nov 17, 2023

Indeed, when this feature was added I intended to add negative expand, but it turned out to be more complicated than I thought. The problem is mostly that the line can span multiple cells, and currently lines are broken down to each cell they span, so we'd need to reduce the line across cell boundaries. This will probably be done at some point, but will take a while. Thanks for the request!

@PgBiel PgBiel added the renderer Related to the final rendering (drawing) step of the table. label Nov 17, 2023
@PgBiel PgBiel added bug Something isn't working and removed enhancement New feature or request labels Dec 2, 2023
@PgBiel
Copy link
Owner

PgBiel commented Dec 2, 2023

Marking this issue as a bug - single cell negative expansion is supposed to work (and apparently doesn't work, as described in #84); it's negative expansion across cells which isn't expected to work.

@dixslyf dixslyf changed the title Negative line expansion Single-cell negative line expansion does not work Dec 2, 2023
@dixslyf
Copy link
Contributor Author

dixslyf commented Dec 2, 2023

To summarize, some negative lengths do not work:

#import "@preview/tablex:0.0.6": tablex, hlinex

#tablex(
  columns: (100%,),
  auto-lines: false,
  hlinex(),
  [],
  hlinex(expand: -10pt),
  [],
  hlinex(expand: -1em),  // Does not work
  [],
  hlinex(expand: -5%),
  [],
  hlinex(expand: -5% - 10pt - 5em),  // Does not work
)

image

Using fr causes a panic, which is expected, but the error message isn't very clear:

#tablex(
  columns: (100%,),
  auto-lines: false,
  hlinex(),
  [],
  hlinex(expand: -0.5fr),
)
[16:21:28] compiled with errors

error: panicked with: "'expand' argument to lines must be a pair (length, length)."
     ┌─ @preview/tablex:0.0.6/tablex.typ:2213:29
     │
2213 │                         panic("'expand' argument to lines must be a pair (length, length).")
     │                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

help: error occurred in this call of function `map`
     ┌─ @preview/tablex:0.0.6/tablex.typ:2224:16
     │
2224 │         hlines: hlines.map(parse-func.with(page-size: page-width)),
     │                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

help: error occurred in this call of function `_parse-lines`
     ┌─ @preview/tablex:0.0.6/tablex.typ:2632:27
     │
2632 │         let parsed_lines = _parse-lines(hlines, vlines, styles: styles, page-width: page_width, page-height: page_height)
     │                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@dixslyf
Copy link
Contributor Author

dixslyf commented Dec 2, 2023

I'll create a separate issue for negative line expansion across cells since this issue is more about single-cell negative expansion, which will probably be resolved by #84.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working renderer Related to the final rendering (drawing) step of the table.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants