Thanks to visit codestin.com
Credit goes to github.com

Skip to content

retroflexivity/typst-eggs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typeset linguistic examples with the Simplest Syntax possible

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.

Usage

Below is an example of how to typeset an example.

#import "@preview/eggs:0.5.1": *
#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>)
]

an example with subexamples and glosses

Basic

Start with applying the global show rule. The central function is example, which typesets an example. Inside it, numbered lists are treated as subexamples, and bullet lists — as glosses. Separate words in glosses with 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 typesets a subexample and gloss typesets glosses.

Labels and refs

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.

For cool smart references, use ex-ref (ref and @-refs work too, though).

#ex-ref(<gl>, <pex:b>) // (1a-b)
#ex-ref(left: "e.g. ", <pex>, right: " etc.") // (e.g. 1 etc.)
#ex-ref(1) // (2) --- relative numbering like expex's nextx

Misc stuff

Common 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.

Installing locally

On Linux, run just in the directory to install the package to ~/.local/typst/packages/local.

Contributing

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.

License

MIT License.

Special thanks

  • Thumus, bluss, and especially Laurenz for an important discussion on row splitting functionality.
  • Greg Shuflin and contributors for creating the original leipzig-glossing.
  • JJ for various improvements.

About

Typst linguistic examples with minimalist syntax

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors