I use the acrostiche package to define some acronyms.
Using the following code:
#import "@preview/acrostiche:0.5.2": *
#init-acronyms((
"OA": ("osteoarthritis")
))
#print-index(title: none, used-only: true)
In diseases like #acr("OA").
I get this output:

With an upper case “O” in osteoarthritis:
#import "@preview/acrostiche:0.5.2": *
#init-acronyms((
"OA": ("Osteoarthritis")
))
#print-index(title: none, used-only: true)
In diseases like #acr("OA").
I get this output:

Is it possible to have the upper case in the list of acronyms and at the same time have the lower case when it appears in the text?
Hello @Lukas_Gschossmann ,
Ideally, there would be a titlecase
function in Typst and abbreviations packages like Abbr, Acrostatic and Acrostiche would be able to make use of it. It is not the case yet (see issue #1707).
Some Typst packages are implementing titlecase
, such as titleize and decasify. I have not tested them. In some languages (like French) the rules for title casing are quite complex.
The cleanliest way to implement such a use case would be to either modify the package you are using locally or to request changes through the package’s owner to make use of a titlecase
function. I could see some value, especially for the French users.
However, you could carefully use the following function to achieve the desired result, which is very limited in its application to the case you have asked about, using the package acrostiche:
#import "@preview/acrostiche:0.5.2": *
#init-acronyms(
("OA": "Osteoarthritis"),
)
#print-index(title: none, used-only: true)
// Acronym definition in lowercase with short version unaltered.
// Makrks the acronym as used.
#let acrlc(acro) = [#lower(display-def(acro)) \(#acs(acro))#acused(acro)]
In diseases like #acrlc("OA"), the abbreviation is #ac("OA") but sometimes we mention #lower(display-def("OA")) again.
I would use acrlc()
only once per acronym as the next time, the short version will be appended again.
1 Like
Hi,
thanks that does exactly what I was looking for!
I actually made two versions of your function for singular and plural cases:
// Singular
#let acrlc(acro) = [#lower(display-def(acro)) \(#acs(acro))#acused(acro)]
// Plural
#let acrpllc(acro) = [#lower(display-def(acro, plural: true)) \(#acsp(acro))#acused(acro)]
1 Like
Fantastic! Glad to help. If you think this should be added to the abbreviation package, make sure to post a feature request to the package owner @grizzly as other users may well be in need of that as well.
Tip: You can do with a single function… (Edit:) but that makes more characters to type so your second function could de defined as a shortcut, calling the first one:
// Acronym definition in lowercase with short version unaltered.
// Makrks the acronym as used.
#let acrlc(acro, plural: false) = [#lower(display-def(acro, plural:plural)) \(#acs(acro))#acused(acro)]
// Plural version
#let acrpllc(acro) = acrlc(acro, plural:true)
In diseases like #acrlc("OA", plural:true), the abbreviation is #ac("OA") but sometimes we mention #lower(display-def("OA")) again.
#acrlc("OA") \
#acrpllc("OA") \
Interesting usecase. I never thought of providing case-defining functions but that should be easy enough to implement. However, @vmartel08 , I am not sure I understand your suggestion about using titlecase. Your solution does not use titlecase so I am confused as why you suggest using it. Would you want to have a function that forces the definition to be printed with upper, lower, or titlecase?