Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/preview/synkit/0.0.41/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Guilherme D. Garcia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
104 changes: 104 additions & 0 deletions packages/preview/synkit/0.0.41/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://gdgarcia.ca/typst/logo_syn_white.png">
<source media="(prefers-color-scheme: light)" srcset="https://gdgarcia.ca/typst/logo_syn.png">
<img src="https://gdgarcia.ca/typst/logo_syn.png" width="300" alt="synkit logo">
</picture>
</div>

<div align="center">

![Typst Package](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fguilhermegarcia%2Fsynkit%2Fmain%2Ftypst.toml&query=%24.package.version&prefix=v&logo=typst&label=package&color=239DAD)
![MIT license badge](https://img.shields.io/badge/license-MIT-blue)
[![PDF manual badge](https://img.shields.io/badge/manual-.pdf-purple)](https://doi.org/10.5281/zenodo.19405774)

</div>

`synkit` is a Typst package for drawing syntax trees from bracket notation. It focuses on fast authoring, clean output, and the kinds of features syntacticians and semanticists actually need in day-to-day work.

## Philosophy

There are two key design choices for this package. First, the syntax should be minimal, intuitive, and readable. As a result, a tree is separated from its add-ons (arrows, highlights, etc.) inside the `#tree()` function. Second, functions should be smart enough to detect patterns, which helps minimize the amount of code you have to type. These two points are clearly connected to each other.

Here are some examples illustrating this philosophy.

1. Labels are automatically created. Every word or node you add to a tree automatically becomes a label that can later be targeted by an arrow, an annotation, or by an aesthetic adjustment (color, highlight, etc.).
2. Triangles are automatically added to trees. `[XP content]` will trigger a triangle, but `[XP [X' [X content ] ] ]` will not. So, while you _can_ add triangles manually, you will likely never have to do that.
3. Terminal branches aren't displayed by default (e.g., no line/link between a terminal node and its content `[X content]`). You can activate them if you so choose, but by default they won't be there.
4. When you define a tree, spaces don't matter so much: `[NP[Det][N]]` is the same as `[NP [Det ] [N] ]` or any other equivalent string. Thus, you will no longer get syntax errors if you forget a space between two `]]` (cf. `tikz-qtree` in LaTeX).

## Some examples

<table>
<tr>
<td align="center" width="33%">
<a href="gallery/tree_1.typ"><img src="gallery/tree_1.png" width="100%" alt="Syntax tree with movement arrows"></a>
<br><sub>Tree with arrows indicating movement</sub>
</td>
<td align="center" width="33%">
<a href="gallery/tree_2.typ"><img src="gallery/tree_2.png" width="100%" alt="Syntax tree with semantic annotation and multidominance"></a>
<br><sub>Semantic annotation and multidominance</sub>
</td>
<td align="center" width="33%">
<a href="gallery/tree_3.typ"><img src="gallery/tree_3.png" width="100%" alt="Two syntax trees linked by equivalence lines"></a>
<br><sub>Equivalences between two different trees</sub>
</td>
</tr>
<tr>
<td align="center">
<a href="gallery/tree_4.typ"><img src="gallery/tree_4.png" width="100%" alt="Styled syntax tree with color and emoji"></a>
<br><sub>Adjust color, font, and add emojis for less serious trees</sub>
</td>
<td align="center">
<a href="gallery/tree_5.typ"><img src="gallery/tree_5.png" width="100%" alt="Numbered example with inline movement notation"></a>
<br><sub>In-line movement with minimal syntax</sub>
</td>
<td align="center">
<a href="gallery/tree_6.typ"><img src="gallery/tree_6.png" width="100%" alt="Numbered examples and interlinear glosses"></a>
<br><sub>Examples and glosses</sub>
</td>
</tr>
</table>

## Installation

```typst
#import "@preview/synkit:0.0.41": *
```

If you are working from a local clone instead, import `lib.typ` directly:

```typst
#import "synkit/lib.typ": *
```

## Highlights

- Draw syntax trees with flexible bracket notation using `#tree()`
- Add movement arrows, curved paths, delinking, and trace targeting
- Don't worry about creating triangles manually: they are automatically added based on phrase structure
- Add multidominance and cross-tree equivalence lines between two trees using `#garden()`
- Add semantic annotation between node labels and branches
- Create numbered examples with `#eg()` and interlinear glosses with `#gloss()`
- Adjust spacing, direction, scale, highlighting, numbering, and colors with lightweight arguments
- Smart labels ensure that you never have to create labels yourself: every word, node and even emoji is its own label

Literal square brackets inside labels can be written as `\[` and `\]`, which is useful for Adger-style feature bundles such as `DP_i\[wh, ~uOP~: INT\]`.

## Manual

Download the [**manual**](https://doi.org/10.5281/zenodo.19405774) for a comprehensive description of each function available.

## Repository

- GitHub: <https://github.com/guilhermegarcia/synkit>

## Author

**Guilherme D. Garcia**
Email: <guilherme.garcia@lli.ulaval.ca>
Website: <https://gdgarcia.ca>

## License

MIT
83 changes: 83 additions & 0 deletions packages/preview/synkit/0.0.41/_symbols.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Shared symbol map (LaTeX-style shortcuts → Unicode)
// Used by syntax.typ and movement.typ

#let symbol-map = (
// Greek lowercase
"\\alpha": "α",
"\\beta": "β",
"\\gamma": "γ",
"\\delta": "δ",
"\\epsilon": "ε",
"\\zeta": "ζ",
"\\eta": "η",
"\\theta": "θ",
"\\iota": "ι",
"\\kappa": "κ",
"\\lambda": "λ",
"\\mu": "μ",
"\\nu": "ν",
"\\xi": "ξ",
"\\pi": "π",
"\\rho": "ρ",
"\\sigma": "σ",
"\\tau": "τ",
"\\upsilon": "υ",
"\\phi": "φ",
"\\chi": "χ",
"\\psi": "ψ",
"\\omega": "ω",
// Greek uppercase
"\\Alpha": "Α",
"\\Beta": "Β",
"\\Gamma": "Γ",
"\\Delta": "Δ",
"\\Epsilon": "Ε",
"\\Zeta": "Ζ",
"\\Eta": "Η",
"\\Theta": "Θ",
"\\Iota": "Ι",
"\\Kappa": "Κ",
"\\Lambda": "Λ",
"\\Mu": "Μ",
"\\Nu": "Ν",
"\\Xi": "Ξ",
"\\Pi": "Π",
"\\Rho": "Ρ",
"\\Sigma": "Σ",
"\\Tau": "Τ",
"\\Upsilon": "Υ",
"\\Phi": "Φ",
"\\Chi": "Χ",
"\\Psi": "Ψ",
"\\Omega": "Ω",
// Common symbols
"\\emptyset": "∅",
"\\varnothing": "∅",
"\\forall": "∀",
"\\exists": "∃",
"\\rightarrow": "→",
"\\leftarrow": "←",
"\\infty": "∞",
"\\root": "√",
// Logical operators
"\\wedge": "∧",
"\\land": "∧",
"\\vee": "∨",
"\\lor": "∨",
"\\neg": "¬",
"\\to": "→",
"\\iff": "⇔",
"\\models": "⊨",
"\\proves": "⊢",
)

// Apply symbol substitutions to a string
#let apply-symbols(s) = {
let result = s
for (key, val) in symbol-map {
if result.contains(key) {
result = result.replace(key, val)
}
}
result
}
Loading
Loading