helper utilities for choosing between a and an
Installation
#import "@preview/aoran:0.1.0": article
API
article(word, capitalized: false)– returns"a","an", ornone. Setcapitalizedtotrueto receive"A"/"An"for sentence starts.
#let word = "umbrella"
#assert(article(word) == "an")
#assert(article(word, capitalized: true) == "An")
Examples
examples/basic.typshows how to join the returned article with words and headings.examples/thumbnail.typis the snippet rendered for the package gallery preview.
Run just examples (or typst compile --root . examples/basic.typ) to render them.
Origin
The logic is extracted from the Glossy package so standalone documents can reuse the same heuristics without pulling in glossary machinery.
License
Licensed under the MIT License.
The heuristic mirrors the original implementation used in the
Glossy package. It covers
vowel starts, silent leading h, u words that sound like “yoo”, eu
prefixes, and acronym detection (e.g. "an RFC" but "a CPU"). When the input
is none or empty, the helper returns none so callers can decide how to
recover.