Closed schmic41 closed 6 months ago
Hi, thanks for your pull request!
It seems @SergeyGorchakov and yourself created two conflicting pull requests at the same time. That means I have to prioritize one of them. Since the idea of this package is to be similar to LaTeX's siunitx, I'd generally prioritize metrics units over imperial (for now). Sorry.
If you want to adapt your PR to @SergeyGorchakov's mechanism after I merged it, we could talk about unifying the way of switching languages and units.
No problem, I understand! I'll take a look at Sergey's changes and see what I can do. Thanks for taking a look at this.
This PR has two parts: a .csv file containing common imperial measurements for length, weight, and volume; and changes to the
unit
andqty
functions to accommodate switching between units.SI and imperial units are automatically loaded from their appropriate .csv files. The
unit
andqty
functions now have an optionalunits
parameter. Theunits
parameter takes a string equal to either"SI"
,"Imperial"
, or the name of a local .csv file containing custom units.Since the default
units
parameter is"SI"
, this should not affect any existing code.Possible problems with this implementation:
unify
repository, not the directory the main.typ
file is in. While this solution means that users no longer have to manually edit thelib.typ
file, I need to do more research to find out how to load files from the working directory.