30 lines
1.9 KiB
Markdown
30 lines
1.9 KiB
Markdown
= Acrobat
|
|
|
|
Set of helper functions to deal with acronyms.
|
|
|
|
== Usage
|
|
|
|
The main function of acrobat is to keep track of which acronym to define.
|
|
First, define the acronyms in a file named `acronyms.typ` as a dictionary where the key is the acronym, and the value is an array.
|
|
The first value of the array is the singular version of the definition. If there is a second value, it is the plural version of the definition. Any additional value is useless.
|
|
|
|
Here is a sample of the `acronyms.typ` file:
|
|
```
|
|
#let acronyms = (
|
|
"AMS": "Acronym Management System",
|
|
"ACROBAT": "Acrobat Can Really Optimize Building Acronyms in Typst",
|
|
"BIOS": ("Basic Input/Output System", "Basic Input/Output Systems")
|
|
)
|
|
```
|
|
|
|
Once the acronyms are defined, you can use them in the text with the `#acr(...)` function. The argument is the acronym as a string. On the first call of the function, the acronym is expanded and the acronym added between parenthesis.
|
|
|
|
To get the plural version of the acronym, you can use the `#acrpl(...)` function that adds an 's' after the acronym. If a plural version of the definition is provided, it will be used if the first use of the acronym is plural. Otherwise, the singular version is used and a trailing 's' is added.
|
|
|
|
At any point in the document you can reset and acronym with the functions `#reset-acronym(...)` or `reset-all-acronyms()`. After a reset, the next use of the acronym is expanded.
|
|
|
|
You can also print an index of all acronyms used in the document with the `#print-index()` function. The index is printed in a section for which you can choose the heading level and outline flag (with respectively the `level` and `outlined` parameters). Finally you can also force the index to include all acronyms, even if not used in the document, with the `all` flag.
|
|
|
|
Finally, you can call the `#get-def(...)` function to get the definition of an acronym. Use the `plural` to get the plural version.
|
|
|
|
Have fun acrobating!
|