You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for a way to add custom units (e.g., "hours") while importing unify from @preview.
According to the Readme:
The possible values of the three latter parts are loaded at runtime from prefixes.csv, units.csv, and postfixes.csv (in the library directory). There, you can also add your own units.
However, when importing from @preview, these CSVs aren't available to me.
Would it make sense to either
maintain the corresponding dictionaries like units, units-short, etc., as state and add a function for easily adding a new unit, prefix, or postfix; or
add parameters of the same names as those dictionaries to _format-unit defaulting to the existing dictionaries, which should allow users to use set rules to specify the extended dictionaries?
The text was updated successfully, but these errors were encountered:
You're right, the current unit storage is not as flexible as I'd like.
Storing the units in a CSV instead of in the code was not a choice I felt was the most usable, but rather the one lying in my abilities. Keeping track of global variables in Typst is really hard because you have multiple passes over the file. I am always to pull requests, though.
Would the second idea work? I'd assume that the path is relative to the main file where the library is imported, such that you can't easily find the bundled CSVs.
I'm looking for a way to add custom units (e.g., "hours") while importing unify from
@preview
.According to the Readme:
However, when importing from
@preview
, these CSVs aren't available to me.Would it make sense to either
units
,units-short
, etc., asstate
and add a function for easily adding a new unit, prefix, or postfix; or_format-unit
defaulting to the existing dictionaries, which should allow users to useset
rules to specify the extended dictionaries?The text was updated successfully, but these errors were encountered: