Skip to content

A small package providing over- and underset functions for math mode in typst.

License

Notifications You must be signed in to change notification settings

ludwig-austermann/typst-ouset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ouset Package

GitHub Repository including Examples and Changelog

This is a small package providing over- and underset functions for math mode in typst.

Usage

To use this package simply #import "@preview/ouset:{{PACKAGE VERSION}}". To import all functions use : * and for specific ones, use either the module or as described in the typst docs.

The main function provided in this package is ouset for math environments. This function can take arbitrary many arguments, but with the following rules:

  • if the first argument is &, a 'alignpoint' is inserted immediately before the symbol
  • next follows the symbol, then the content to put on top, and then the content to put at the bottom
  • if the last argument is &, a 'alignpoint' is inserted immediately after the symbol

There is a named argument insert-and, which if false, does not insert an 'alignpoint' in the above cases, but only clips at these points.

This package provides furthermore 3 other functions:

  • overset(s, t, c: 0, insert-and: true): output the symbol s with t on top of it
  • underset(s, b, c: 0 insert-and: true): output the symbol s with b on below of it
  • overunderset(s, t, b, c: 0, insert-and: true): output the symbol s with t on top of it and b below it

All functions put enough spacing around the operator, such that other content does not interfere with it. However, this spacing can be disabled, by setting c to 1, 2 or 3. This is a flag system with

  • c=0: normal spacing on the left and right
  • c=1: left spacing is according to the operator / symbol s and right spacing is normal
  • c=2: left spacing is normal and right spacing according to the operator / symbol s
  • c=3: both spacings are according to the operator / symbol s

Hence: clip param c ∈ {0,1,2,3} ≜ {no clip, left clip, right clip, both clip}

Example usage

Try something like:

  • $ouset(-->,, n->oo)$
  • $ouset(-,1,2)$
  • #import "@preview/ouset:{{PACKAGE VERSION}}": ouset
    
    $ M &= sum_(k=0)^oo q^k = 1 + q + q^2 + q^3 + q^4 + dots\
        &= 1 + q (1 + q + q^2 + q^3 + dots)\
        ouset(&, =, "Def.", "of" M) 1 + q dot M $

About

A small package providing over- and underset functions for math mode in typst.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages