This is a Typst package that provides linguistic examples and interlinear glossing. It is a heavily modified fork of neunenak's typst-leipzig-glossing.
See it on Typst Universe.
Below is an example of how to typeset an example.
#import "@preview/eggs:0.7.0": *
#import abbreviations: pl, ins
#show: eggs
#example[
+ - primer s gloss-ami
- example with gloss-#pl.#ins
'an/the example with glosses' #ex-label(<gl>)
+ \*example without glosses
#ex-label(<pex>)
]Start with applying the global show rule. The central function is example, which typesets an example. Inside it, auto-numbered lists (+) are treated as subexamples, and bullet lists (-) as interlinear gloss lines. Words in glosses must be separated by two or more spaces.
This automatic conversion can be toggled off by passing auto-subexamples: false and auto-glosses: false to example, like this:
#example(auto-subexamples: false, auto-glosses: false)[
+ This is a proper numbered item
- And this is a proper bullet item
]Additionally, subexample explicitly typesets a subexample and gloss explicitly typesets glosses.
Examples are numbered following a counter counter("eggsample"). Individual exceptions to the numbering can be made by passing number: to example or subexample.
Examples (and subexamples) can be labeled by putting #ex-label(<label-name>) somewhere inside them or passing a label: <label-name> argument. Automatic codly-style labels are added to subexamples, too.
References are clever, bracketed and with support for two-example references via supplements. ex-ref is even more powerful.
@gl[@pex:b] // (1a-b)
#ex-ref(<gl>, <pex:b>) // same
#ex-ref(left: "e.g. ", <pex>, right: " etc.") // (e.g. 1 etc.)
#ex-ref(1) // (2) --- relative numbering like expex's nextxCommon judges are recognized automatically. judge typesets text without taking up space.
The abbreviations submodule provides leipzig-style abbreviation commands. They are kept track of and can be printed with print-abbreviations.
Customization is done via the global show rule: #show eggs.with().
See documentation.pdf for more info.
On Linux, run just in the directory to install the package to ~/.local/typst/packages/local.
Please submit an issue for any bug you find and any suggestion you have.
Contributions are much welcome, too.
TODO:
- Smarter gloss line styling;
- Figure out how to modify spacing between examples specifically;
\trailingcitation.
MIT License.