typst-community / glossarium

Glossarium is a simple typst glossary.
MIT License
41 stars 11 forks source link

Select "a" or "an" automatically #23

Closed JuliDi closed 6 months ago

JuliDi commented 9 months ago

Depending on whether it's the first use or not, either only the abbreviation or the full text is shown. When #11 is fixed, this will become an issue with "a" and "an" before the abbrevation when using the "Long Form (LF)" option. I have made the modification suggested in #11 in my local instance already and that is causing issues in the following constellation:

An @fir filter can translate into "An FIR filter" (correct) or, on first use, to "An Finite Impulse Response (FIR) filter" (which is wrong).

What would be good here is a way to add the correct choice of "a" or "an" automatically. I'm not quite sure how this can be implemented, though. What I imagine ist that it might look something like @[a]fir and then this is done automatically. Though there might be cases where you need to explicitly specifiy whether to use "a" or "an" for the long and short form...

slashformotion commented 9 months ago

Hello, I have seen your request, I don't know how to implement that at the moment.

slashformotion commented 9 months ago

Unless I am mistaken the syntax @[a]fir do not exist.

image

slashformotion commented 9 months ago

Here's my considered opinion on the matter: I have no idea how "a"/"an" management could be implemented without it being non-ergonomic. If, by any chance, we can find a way of implementing this simply, then I'd be open to the idea. We also have to consider that this functionality potentially only makes sense in a few languages and/or that it would have to be adapted to correspond to different syntactic forms in others.

As it is, I'm not going to work on it. I want glossarium to remain a library with simple, concise code. As I said before, I'm still open to suggestions.

PS (some of my loose thoughts on glossarium and the Typst ecosystem): I think that as the Typst user base grows, there will be more and more people who will need a glossary with complex features. Glossarium may not be the library for them. Personally, I used Typst (and glossarium) to write my master's thesis and today I have an extremely limited use for it. For the moment, I'm interested in developing features and solving bugs in glossarium, but who knows, in a few months or a few years, I could very well have changed my life and become a goat farmer (anything can happen). So it's quite unlikely that I'll be interested in maintaining glossarium in that case. It would be quite healthy for other Typst glossaries to be written and have different APIs from glossarium. I don't think I'm at all an expert on Typst and its syntax, so it's probably possible to do much better than what I've done based on the great work of Sébastien d'Herbais de Thun. The Typst ecosystem is a long way from the maturity of the Latex ecosystem.

JuliDi commented 9 months ago

I see, then that is somewhat limited by Typst. One could abuse the supplement if wanted: https://github.com/ENIB-Community/glossarium/blob/37621b284c073c174e0c47259862e1baf238c09b/glossarium.typ#L66 but I guess this will end up being a total disaster at some point.

slashformotion commented 9 months ago

yeah that is not something i would like to have in glossarium code

slashformotion commented 9 months ago

I am going to try to make #11 and #10 work for now

JuliDi commented 9 months ago

Sure, I agree. There will be other, more sophisticated packages and also probably more support from within Typst itself. I am myself using it for my master's thesis and ended up having a couple of "a"/"an" mistakes every now and then due to the abbreviations. But I am also nowhere near a solution.

There probably is an elegant solution to it with something like a show rule etc, but that's something I might ask the Typst folks directly. Thanks for your input, though!

slashformotion commented 9 months ago

I haven't used Latex a lot unfortunatly so i don't have a lot of experience with Latex's Glossary package. Does it handle the "a"/"an" issue ?

JuliDi commented 9 months ago

There is a bunch of glossary packages and I have not tried solving the issue there. From a quick search, it seems that there is just another command to do it: https://tex.stackexchange.com/questions/391297/how-can-glossaries-handle-the-article-a-or-an-before-abbreviations