Created
April 22, 2024 13:08
-
-
Save zr-tex8r/f539816a336e97a846878f08343ee02e to your computer and use it in GitHub Desktop.
Linguistics example sentence in Typst🙃
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#let use-examples(body) = { | |
show figure.where(kind: "example"): it => { | |
assert(it.body.func() == metadata) | |
// here implicit context is given by show rule | |
let number = numbering(it.numbering, ..it.counter.get()) | |
grid( | |
columns: (auto, 1fr), | |
rows: (auto, auto), | |
column-gutter: 1em, | |
row-gutter: 1em, | |
grid.cell( | |
rowspan: 2, | |
number, | |
), | |
it.body.value.text, | |
it.body.value.tran, | |
) | |
} | |
body | |
} | |
#let ex(text, tran, numbering: "1)", asterisk: false) = { | |
figure( | |
kind: "example", | |
supplement: "Example", | |
numbering: numbering, | |
outlined: false, | |
metadata(( // tentatively placed as metadata | |
text: { | |
if asterisk { "*" } | |
text | |
}, | |
tran: tran, | |
)) | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "examplezr.typ": ex, use-examples | |
#show: use-examples | |
#ex( | |
[こんにちは], | |
[Hello] | |
) <hello> | |
@hello | |
#ex( | |
[ありがとう], | |
[Thanks] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment