Compare commits

..

2 Commits

Author SHA1 Message Date
Greg Shuflin
226dfe75f8 Update contributors 2024-08-18 22:41:08 -07:00
Greg Shuflin
c3acc895d7 Some tweaks to the label-ing functionality 2024-08-18 22:41:01 -07:00
4 changed files with 17 additions and 5 deletions

View File

@ -30,3 +30,6 @@ This library uses the MIT license; see `LICENSE.txt`.
Thanks to [Bethany E. Toma](https://github.com/betoma) for a number of Thanks to [Bethany E. Toma](https://github.com/betoma) for a number of
suggestions and improvements. suggestions and improvements.
Thanks to [Maja Abramski-Kronenberg](https://github.com/rwmpelstilzchen) for
the labeling functionality.

BIN
documentation.pdf Normal file

Binary file not shown.

View File

@ -190,10 +190,15 @@ References to individual examples can be achieved using the `label` argument and
morphemes: ([and], [#neg], [be_able.#smallcaps[pret].3#sg], [#smallcaps[def]], [sorcerer.#pl], [answer.#smallcaps[inf]], [to.3#sg.#smallcaps[m]]), morphemes: ([and], [#neg], [be_able.#smallcaps[pret].3#sg], [#smallcaps[def]], [sorcerer.#pl], [answer.#smallcaps[inf]], [to.3#sg.#smallcaps[m]]),
translation: [and the sorcerers could not answer him], translation: [and the sorcerers could not answer him],
label: \"sorcerers\", label: \"sorcerers\",
label-supplement: [Example]
) )
As we have seen in @sorcerers, […].", addl-bindings: (neg: neg, sg: sg, pl: pl)) As we have seen in @sorcerers, […].", addl-bindings: (neg: neg, sg: sg, pl: pl))
Labeling uses the Typst #link("https://typst.app/docs/reference/model/figure/")[figure] document element. The `label-supplement`
parameter fills in the `suppliment` parameter of a `figure`, which is `[example]` by default.
== Styling lines of a gloss == Styling lines of a gloss
Each of the aforementioned text parameters has a corresponding style parameter, Each of the aforementioned text parameters has a corresponding style parameter,

View File

@ -1,7 +1,6 @@
#import "abbreviations.typ" #import "abbreviations.typ"
#let gloss-count = counter("gloss_count") #let gloss-count = counter("gloss_count")
#let cmdlabel = label // a workround so we can use `label` as a variable name
#let build_gloss(item-spacing, formatters, gloss_line_lists) = { #let build_gloss(item-spacing, formatters, gloss_line_lists) = {
assert(gloss_line_lists.len() > 0, message: "Gloss line lists cannot be empty") assert(gloss_line_lists.len() > 0, message: "Gloss line lists cannot be empty")
@ -35,6 +34,10 @@
} }
} }
// a workround so we can use `label` as a variable name where it is shadowed by the function param `label`
// Once typst version 0.12 with https://github.com/typst/typst/pull/4038 is released we should be able
// to replace this workaround with `std.label`
#let cmdlabel = label
#let gloss( #let gloss(
header: none, header: none,
@ -49,6 +52,7 @@
translation: none, translation: none,
translation-style: none, translation-style: none,
label: none, label: none,
label-supplement: [example],
item-spacing: 1em, item-spacing: 1em,
gloss-padding: 2.0em, //TODO document these gloss-padding: 2.0em, //TODO document these
@ -124,8 +128,8 @@
style(styles => { style(styles => {
block(breakable: breakable)[ block(breakable: breakable)[
#figure( #figure(
kind: "lingexample", kind: "ling-example",
supplement: [Example], supplement: label-supplement,
numbering: it => [#gloss-count.display()], numbering: it => [#gloss-count.display()],
stack( stack(
dir: ltr, //TODO this needs to be more flexible dir: ltr, //TODO this needs to be more flexible