Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options to filter acronyms that are used only a single time #45

Closed
indicatelovelace opened this issue Jun 26, 2024 · 2 comments · Fixed by #76
Closed

options to filter acronyms that are used only a single time #45

indicatelovelace opened this issue Jun 26, 2024 · 2 comments · Fixed by #76
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@indicatelovelace
Copy link

Sometimes you need more control over when the first entry is printed.
For example, you use an acronym in a figure in short form, but still want the next appearance to be the long form. The Latex package solves this by providing a macro. I think something similar to that by adding another optional argument ignore-use could be useful.

I think an option for make-glossary to make the long form print for the first appearance optional would be great, too.

And last, I think options should be provided to filter acronyms that are used only a single time. I'm not sure on the details of this one yet though.

I can try to implement these myself, but I first wanted to hear your thoughts.

@quachpas
Copy link
Collaborator

quachpas commented Jul 2, 2024

Hello @indicatelovelace,
thanks for sharing your thoughts!

For example, you use an acronym in a figure in short form, but still want the next appearance to be the long form.
if you want to force the short-form you should be able to use

#gls(key, long: false) // short+suffix

I think an option for make-glossary to make the long form print for the first appearance optional would be great, too.

I actually have a working version of this in my fork, but I haven't had the time to discuss this (I'll create an issue).

And last, I think options should be provided to filter acronyms that are used only a single time.

If by that, you mean counting the back-references to each acronym, then it is already possible using the internal API. Something like this maybe:

#import "@preview/glossarium:0.4.0": count-refs, __glossary_entries
#context {
    // All entries counts
    let entries = __glossary_entries.get()
    for (key, e) in entries {
      str(e.key) + " " + str(count-refs(e))
      linebreak()
    }
    linebreak()
    
    // Single-use
    let single_use_entries = entries.values().filter(e => count-refs(e) == 1)
    for e in single_use_entries {
      str(e.key) + " " + str(count-refs(e))
      linebreak()
    }
 }

If you have time, I think @slashformotion wouldn't refuse any contribution to the documentation or the user API!

@quachpas quachpas self-assigned this Oct 1, 2024
@quachpas quachpas added enhancement New feature or request good first issue Good for newcomers labels Oct 1, 2024
@quachpas quachpas modified the milestones: 0.4.2, 0.5.0 Oct 1, 2024
@quachpas quachpas changed the title More control over single usage and first print in long form options to filter acronyms that are used only a single time Oct 1, 2024
@quachpas
Copy link
Collaborator

quachpas commented Oct 1, 2024

@indicatelovelace I will divert the issue of user control over first time usage or single usage to #57

@quachpas quachpas removed this from the 0.5.0 milestone Oct 8, 2024
@quachpas quachpas added this to the 0.5.1 milestone Oct 24, 2024
@quachpas quachpas linked a pull request Oct 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants