Skip to content

Commit 4aeedea

Browse files
authored
Update to Tablex 0.0.9 (#137)
1 parent a842b2d commit 4aeedea

File tree

3 files changed

+45
-25
lines changed

3 files changed

+45
-25
lines changed

README.md

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# typst-tablex (v0.0.8)
1+
# typst-tablex (v0.0.9)
22
**More powerful and customizable tables in Typst.**
33

4-
**NOTE: Please open an issue if you find a bug with tablex** and I'll get to it as soon as I can. **(PRs are also welcome!)**
5-
64
## Sponsors ❤️
75

86
If you'd like to appear here, [consider sponsoring the project!](https://github.com/sponsors/PgBiel)
@@ -16,10 +14,18 @@ If you'd like to appear here, [consider sponsoring the project!](https://github.
1614
<!-- sponsors -->
1715
<!-- sponsors -->
1816

19-
## Important note regarding Typst 0.11.0 and Tablex
17+
## Important notice regarding Tablex usage
18+
19+
**Summary: Please use built-in Typst tables instead of tablex.** Most of tablex's features were implemented in Typst 0.11.0, see the [docs](https://typst.app/docs/reference/model/table/).
20+
21+
However, **keep an eye for future tablex updates** as there might be some interesting goodies ahead, including CeTZ support!
22+
23+
**Details:**
2024

2125
A large amount of tablex's features have successfully been upstreamed by this package's author to Typst's built-in `table` and `grid` elements (see the new Tables Guide, at https://typst.app/docs/guides/table-guide/, and the `table` element's reference, at https://typst.app/docs/reference/model/table/, for more information).
2226

27+
This effort was tracked in the following Typst issue: https://github.com/typst/typst/issues/3001
28+
2329
This means that, starting with Typst 0.11.0, **many advanced table features can now be used with Typst grids and tables without tablex!** This includes:
2430

2531
- Per-cell customization (through `table.cell(inset: ..., align: ..., fill: ...)[body]`, and `#show table.cell: it => ...` instead of `map-cells`);
@@ -30,14 +36,16 @@ This means that, starting with Typst 0.11.0, **many advanced table features can
3036

3137
Additionally, built-in Typst tables have support for features which weren't previously available within tablex, such as **repeatable table footers** (through `table.footer` and `grid.footer`).
3238

33-
Therefore, **for the vast majority of use cases, you will no longer need to use this library.** However:
39+
Therefore, **for the vast majority of use cases, you will no longer need to use this library.**
3440

35-
1. **Tablex will still receive updates over time** with extra features. In the next version (tablex 0.1.0), there will be **support for CeTZ integration**, which will allow you to easily annotate your tables using CeTZ (e.g. draw arrows between cells). If you're interested in such features, then tablex might still be useful for you!
36-
2. **Not _all_ tablex features are present in built-in tables, at least yet.** Therefore, you might still have to use tablex depending on your use case. It is expected, however, that built-in tables will eventually have support for most of the missing features in future Typst releases. Here's a non-exhaustive list of them:
41+
There are a few observations:
42+
43+
1. **Tablex will still receive updates over time** with extra features. In the next version (tablex 0.1.0), there will be **support for CeTZ integration**, which will allow you to easily **annotate your tables** using CeTZ (e.g. draw arrows between cells). If you're interested in such features, then tablex might still be useful for you in the future!
44+
2. **Not _all_ tablex features are present in built-in tables, at least yet.** Therefore, **if you happen to use the features listed below, you might still have to use tablex** depending on your use case. It is expected, however, that built-in tables will eventually have support for most of the missing features in future Typst releases. Here's a non-exhaustive list of them:
3745
1. Built-in tables do not yet have the ability to expand table lines by some arbitrary length.
3846
2. The tablex `fit-spans` option, through which colspans and rowspans don't cause `auto`-sized columns and/or rows to expand, is not yet supported in built-in tables.
3947
3. Built-in repeatable table headers currently always repeat in all pages, whereas you can define in which pages a tablex header should be repeated.
40-
3. **Regarding sponsorships:** The tablex author, [@PgBiel](https://github.com/PgBiel), has also been responsible for upstreaming the various tablex features to built-in tables. Therefore, any future sponsorships will go not only towards extended maintenance of tablex, but also towards future work on built-in tables and other general contributions to the Typst ecosystem! More information here: https://github.com/sponsors/PgBiel/
48+
3. **Regarding sponsorships:** Any future sponsorships to the tablex author, [@PgBiel](https://github.com/PgBiel), who was also responsible for upstreaming the various tablex features to built-in tables, will go not only towards extended maintenance of tablex, but also towards other general contributions to the Typst ecosystem and his other open-source contributions! More information here: https://github.com/sponsors/PgBiel/
4149

4250
If there any questions, feel free to open a thread in the `Discussions` page of this repository, or ping the author on Discord. Thanks to everyone who supported me throughout tablex's development and the upstreaming process. I hope you enjoy the new update, and have fun with tables! 😄
4351

@@ -57,6 +65,7 @@ And make sure to keep an eye for future tablex updates. 😉
5765
* [Basic types and functions](#basic-types-and-functions)
5866
* [Gridx and Tablex](#gridx-and-tablex)
5967
* [Changelog](#changelog)
68+
* [v0.0.9](#v009)
6069
* [v0.0.8](#v008)
6170
* [v0.0.7](#v007)
6271
* [v0.0.6](#v006)
@@ -70,11 +79,13 @@ And make sure to keep an eye for future tablex updates. 😉
7079

7180
## Usage
7281

73-
To use this library through the Typst package manager **(for Typst v0.6.0+)**, write for example `#import "@preview/tablex:0.0.8": tablex, cellx` at the top of your Typst file (you may also add whichever other functions you use from the library to that import list!).
82+
**NOTE: Please use built-in tables instead of this library** (see notice above). **The rest of the README is kept for reference purposes only.**
83+
84+
To use this library through the Typst package manager **(for Typst v0.6.0+)**, write for example `#import "@preview/tablex:0.0.9": tablex, cellx` at the top of your Typst file (you may also add whichever other functions you use from the library to that import list!).
7485

7586
For older Typst versions, download the file `tablex.typ` from the latest release (or directly from the main branch, for the 'bleeding edge') at the tablex repository (https://github.com/PgBiel/typst-tablex) and place it on the same folder as your own Typst file. Then, at the top of your file, write for example `#import "tablex.typ": tablex, cellx` (plus whichever other functions you use from the library).
7687

77-
This library should be compatible with Typst v0.2.0, v0.3.0, v0.4.0, v0.5.0, v0.6.0, v0.7.0, v0.8.0, v0.9.0 and v0.10.0.
88+
This library should be compatible with Typst versions between v0.2.0 and v0.12.0 (inclusive).
7889
**Using the latest Typst version is always recommended** in order to make use of the latest optimizations and features available.
7990

8091
Here's an example of what `tablex` can do:
@@ -83,7 +94,7 @@ Here's an example of what `tablex` can do:
8394

8495
Here's the code for that table:
8596
```typ
86-
#import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx
97+
#import "@preview/tablex:0.0.9": tablex, rowspanx, colspanx
8798
8899
#tablex(
89100
columns: 4,
@@ -137,7 +148,7 @@ Here's the code for that table:
137148
In most cases, you should be able to replace `#table` with `#tablex` and be good to go for a start - it should look _very_ similar (if not identical). Indeed, the syntax is very similar for the basics:
138149

139150
```typ
140-
#import "@preview/tablex:0.0.8": tablex
151+
#import "@preview/tablex:0.0.9": tablex
141152
142153
#tablex(
143154
columns: (auto, 1em, 1fr, 1fr), // 4 columns
@@ -164,7 +175,7 @@ This is mostly a word of caution in case anything I haven't anticipated happens,
164175
Your cells can now span more than one column and/or row at once, with `colspanx` / `rowspanx`:
165176

166177
```typ
167-
#import "@preview/tablex:0.0.8": tablex, colspanx, rowspanx
178+
#import "@preview/tablex:0.0.9": tablex, colspanx, rowspanx
168179
169180
#tablex(
170181
columns: 3,
@@ -195,7 +206,7 @@ Also, note that, by default, the horizontal lines below the header are transport
195206
Example:
196207

197208
```typ
198-
#import "@preview/tablex:0.0.8": tablex, hlinex, vlinex, colspanx, rowspanx
209+
#import "@preview/tablex:0.0.9": tablex, hlinex, vlinex, colspanx, rowspanx
199210
200211
#pagebreak()
201212
#v(80%)
@@ -242,7 +253,7 @@ Something similar occurs for `vlinex()`, which has `start`, `end` (first row and
242253
Here's some sample usage:
243254

244255
```typ
245-
#import "@preview/tablex:0.0.8": tablex, gridx, hlinex, vlinex, colspanx, rowspanx
256+
#import "@preview/tablex:0.0.9": tablex, gridx, hlinex, vlinex, colspanx, rowspanx
246257
247258
#tablex(
248259
columns: 4,
@@ -286,7 +297,7 @@ Here's some sample usage:
286297
You can also *bulk-customize lines* by specifying `map-hlines: h => new_hline` and `map-vlines: v => new_vline`. This includes any automatically generated lines. For example:
287298

288299
```typ
289-
#import "@preview/tablex:0.0.8": tablex, colspanx, rowspanx
300+
#import "@preview/tablex:0.0.9": tablex, colspanx, rowspanx
290301
291302
#tablex(
292303
columns: 3,
@@ -318,7 +329,7 @@ Additionally, instead of specifying content to the cell, you can specify a funct
318329
For example:
319330

320331
```typ
321-
#import "@preview/tablex:0.0.8": tablex, cellx, colspanx, rowspanx
332+
#import "@preview/tablex:0.0.9": tablex, cellx, colspanx, rowspanx
322333
323334
#tablex(
324335
columns: 3,
@@ -350,7 +361,7 @@ To customize multiple cells at once, you have a few options:
350361
Example:
351362

352363
```typ
353-
#import "@preview/tablex:0.0.8": tablex, colspanx, rowspanx
364+
#import "@preview/tablex:0.0.9": tablex, colspanx, rowspanx
354365
355366
#tablex(
356367
columns: 4,
@@ -617,7 +628,7 @@ Another example (summing columns):
617628
- `rows`: The sizes (heights) of each row. They follow the exact same format as `columns`, except that the "available space" is infinite (auto rows can expand as much as is needed, as the table can add rows over multiple pages).
618629
- **Note:** For rows, percentages (such as `49%`) are fixed width lengths, like in `columns`; however, here, they are **multiplied by the page's full height** (minus margins), and not width.
619630
- **Note:** If more rows than specified are added, the height for the **last row** will be the one assigned to all extra rows. (If the last row is `auto`, the extra ones will also be `auto`, for example.)
620-
- Your table can have more rows than expected by simply having more cells than `(# columns)` multipled by `(# rows)`. In this case, you will have an extra row for each `(# columns)` cells after the limit. In other words, **the amount of columns is always fixed** (determined by the amount of widths in the array given to `columns`), but the amount of rows can vary depending on your input of cells to the table.
631+
- Your table can have more rows than expected by simply having more cells than `(# columns)` multiplied by `(# rows)`. In this case, you will have an extra row for each `(# columns)` cells after the limit. In other words, **the amount of columns is always fixed** (determined by the amount of widths in the array given to `columns`), but the amount of rows can vary depending on your input of cells to the table.
621632
- Adding a cell at an arbitrary `y` coordinate can also cause your table to have extra rows (enough rows to reach the cell at that coordinate).
622633
- **Warning:** support for fractional sizes for rows is still rudimentary - they only work properly on the table's first page; on the second page and onwards, they will not behave properly, differently from the default `#table`.
623634
- `inset`: Inset/internal padding to give to each cell. Can be either a length (same inset from the top, bottom, left and right of the cell), or a dictionary (e.g. `(left: 5pt, right: 10pt, bottom: 2pt, top: 4pt)`, or even `(left: 5pt, rest: 10pt)` to apply the same value to the remaining sides). Defaults to `5pt` (the `#table` default).
@@ -682,6 +693,15 @@ Another example (summing columns):
682693
683694
## Changelog
684695
696+
### v0.0.9
697+
698+
**NOTE:** Please use Typst's built-in tables instead of tablex (starting with Typst 0.11.0).
699+
Most of tablex's features were implemented in Typst's tables by the author of tablex.
700+
701+
- Added compatibility with Typst v0.12.0 (https://github.com/PgBiel/typst-tablex/issues/135)
702+
- Added library usage notice to README
703+
- Tablex is now dual-licensed under MIT/Apache-2.0 (https://github.com/PgBiel/typst-tablex/issues/134)
704+
685705
### v0.0.8
686706
687707
- Added `fit-spans` option to `tablex` and `cellx` (https://github.com/PgBiel/typst-tablex/pull/111)
@@ -855,4 +875,4 @@ Initial release.
855875
856876
## License
857877
858-
MIT license (see the `LICENSE` file).
878+
Tablex is licensed under MIT or Apache-2.0, at your option (see the files `LICENSE-MIT` and `LICENSE-APACHE`).

tablex.typ

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Welcome to tablex!
22
// Feel free to contribute with any features you think are missing.
3-
// Version: v0.0.8
3+
// Version: v0.0.9
44

55
// -- table counter --
66

@@ -42,10 +42,10 @@
4242
#let _locate = if using-typst-v0110 { func => context(func(here())) } else { locate }
4343

4444
// Polyfill for locate() when there is already context
45-
#let _locate_inherit = if using-typst-v0110 { func => func(here()) } else { locate }
45+
#let _locate-inherit = if using-typst-v0110 { func => func(here()) } else { locate }
4646

4747
// Polyfill for style() when there is already context
48-
#let _style_inherit = if using-typst-v0110 { func => func((:)) } else { style }
48+
#let _style-inherit = if using-typst-v0110 { func => func((:)) } else { style }
4949

5050
// Polyfill for measure(_, styles)
5151
#let _measure = if using-typst-v0110 { (value, _) => measure(value) } else { measure }
@@ -2839,7 +2839,7 @@
28392839
let map-cols = validate-map-func(map-cols)
28402840
let fit-spans = validate-fit-spans(fit-spans, default: (x: false, y: false))
28412841

2842-
layout(size => _locate_inherit(t_loc => _style_inherit(styles => {
2842+
layout(size => _locate-inherit(t_loc => _style-inherit(styles => {
28432843
let table_id = _tablex-table-counter.at(t_loc)
28442844
let page_dimensions = get-page-dim-state(table_id)
28452845
let page_dim_at = if using-typst-v0110 { page_dimensions.final() } else { page_dimensions.final(t_loc) }

typst.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tablex"
3-
version = "0.0.8"
3+
version = "0.0.9"
44
authors = ["PgBiel <https://github.com/PgBiel>"]
55
license = "MIT OR Apache-2.0"
66
description = "More powerful and customizable tables in Typst."

0 commit comments

Comments
 (0)