andreasKroepelin / lovelace

A Typst package for typesetting pseudocode
MIT License
46 stars 4 forks source link

Merge `booktabs` and `booktabs-stroke` #14

Open tingerrr opened 3 months ago

tingerrr commented 3 months ago

I suggest removing booktabs-stroke in favor of a single booktabs argument which either takes a stroke (or something convertible to it) or none to disable them, because currently not passing booktabs: true means that booktabs-stroke is simply ignored.

#import "@preview/lovelace:0.3.0": pseudocode-list
#pseudocode-list(title: [My Algorithm], booktabs-stroke: 2pt + blue)[
  + AAA
  + AAA
  + AAA
]

image

Having this extra boolean argument and the much longer argument the user actually cares about is not very idiomatic. booktabs: 1pt + black should enable them and booktabs: none should disable them.

andreasKroepelin commented 3 months ago

I would prefer it that way as well and it's also how I originally had it. The reason for splitting it into two arguments is that you can do this:

#let pseudocode-list = pseudocode-list.with(booktabs-stroke: 1pt + black)

#pseudocode-list[
  - a
  - b
]

#pseudocode-list(booktabs: true)[
  - a
  - b
]

If there is a better way to decouple config and usage, I'd love to know it!

tingerrr commented 3 months ago

Well, it would be inverted (see below), or require two distinct aliases. But I wonder how often one chose to use both versions in the same document. It's more likely that a user will use one or the other, which makes it the prime use case to optimize for, I think.


#let pseudocode-list = pseudocode-list.with(booktabs: 1pt + black)

#pseudocode-list(booktabs: none)[
  - a
  - b
]

#pseudocode-list[
  - a
  - b
]
andreasKroepelin commented 3 months ago

Okay yes, that's a convincing argument.