More documentation improvements

This commit is contained in:
Greg Shuflin 2023-07-04 01:15:00 -07:00
parent ea57c70300
commit 1257b79520
2 changed files with 80 additions and 50 deletions

Binary file not shown.

View File

@ -1,7 +1,10 @@
#import "leipzig-gloss.typ": gloss, numbered_gloss #import "leipzig-gloss.typ": gloss, numbered_gloss, gloss_count
#import "linguistic-abbreviations.typ": * #import "linguistic-abbreviations.typ": *
#let codeblock(contents) = block(fill: luma(230), inset: 8pt, radius: 4pt, contents) #show link: x => underline[*#x*]
//#show raw: x => text(fill: rgb("#43464b"))[#x]
#let codeblock(contents) = block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, contents)
= Introduction = Introduction
@ -11,7 +14,7 @@ information about the meanings of individual words and morphemes in the
language being studied. A set of conventions called the *Leipzig Glossing Rules* language being studied. A set of conventions called the *Leipzig Glossing Rules*
was developed to give linguists a general set of standards and principles for was developed to give linguists a general set of standards and principles for
how to format these glosses. The most recent version of these rules can be how to format these glosses. The most recent version of these rules can be
found in pdf form at found in PDF form at
#link("https://www.eva.mpg.de/lingua/pdf/Glossing-Rules.pdf")[this link], #link("https://www.eva.mpg.de/lingua/pdf/Glossing-Rules.pdf")[this link],
provided by the Department of Linguistics at the Max Planck Institute for provided by the Department of Linguistics at the Max Planck Institute for
Evolutionary Anthropology. Evolutionary Anthropology.
@ -25,7 +28,7 @@ creating aligned Leipzig-style glosses in Typst, while keeping the syntax as
intuitive as possible and allowing users as much control over how their glosses intuitive as possible and allowing users as much control over how their glosses
look as is feasible. look as is feasible.
This pdf will show examples of the module's functionality and detail relevant This PDF will show examples of the module's functionality and detail relevant
parameters. For more information or to inform devs of a bug or other issue, parameters. For more information or to inform devs of a bug or other issue,
visit the module's Github repository visit the module's Github repository
#link("https://github.com/neunenak/typst-leipzig-glossing")[neunenak/typst-leipzig-glossing]. #link("https://github.com/neunenak/typst-leipzig-glossing")[neunenak/typst-leipzig-glossing].
@ -56,8 +59,71 @@ As a first example, here is a gloss of a text in Georgian, along with the Typst
``` ```
] ]
/* And an example for English which exhibits some additional styling, and uses imports from another file
for common glossing abbreviations:
#gloss( #gloss(
source_text: ([I'm], [eat-ing], [your], [head]),
source_text_style: (item) => text(fill: red)[#item],
morphemes: ([1#sg.#sbj\=to.be], [eat-#prog], [2#sg.#pos], [head]),
morphemes_style: text.with(fill: blue),
translation: text(weight: "semibold")[I'm eating your head!],
)
#codeblock(
[```typst
#import "linguistic-abbreviations.typ": *
#gloss(
source_text: ([I'm], [eat-ing], [your], [head]),
source_text_style: (item) => text(fill: red)[#item],
morphemes: ([1#sg.#subj\=to.be], [eat-#prog], [2#sg.#pos], [head]),
morphemes_style: text.with(fill: blue),
translation: text(weight: "semibold")[I'm eating your head!],
)
```])
The `#gloss` function has three pre-defined parameters for glossing levels:
`source_text`, `transliteration`, and `morphemes`. It also has two parameters
for unaligned text: `header_text` for text that precedes the gloss, and
`translation` for text that follows the gloss.
If one wishes to add more than three glossing lines, there is an additional
parameter `additional_gloss_lines` that can take a list of arbitrarily many more glossing
lines, which will appear below those specified in the aforementioned
parameters:
#gloss(
header_text: [Hunzib (van den Berg 1995:46)],
source_text: ([ождиг],[хо#super[н]хе],[мукъер]),
transliteration: ([oʒdig],[χõχe],[muqʼer]),
morphemes: ([ož-di-g],[xõxe],[m-uq'e-r]),
additional_gloss_lines: (
([boy-#smallcaps[obl]-#smallcaps[ad]], [tree(#smallcaps[g4])], [#smallcaps[g4]-bend-#smallcaps[pret]]),
([at boy], [tree], [bent]),
),
translation: ["Because of the boy, the tree bent."]
)
#codeblock(
[```typst
#gloss(
header_text: [Hunzib (van den Berg 1995:46)],
source_text: ([ождиг],[хо#super[н]хе],[мукъер]),
transliteration: ([oʒdig],[χõχe],[muqʼer]),
morphemes: ([ož-di-g],[xõxe],[m-uq'e-r]),
additional_gloss_lines: (
([boy-#smallcaps[obl]-#smallcaps[ad]], [tree(#smallcaps[g4])], [#smallcaps[g4]-bend-#smallcaps[pret]]),
([at boy], [tree], [bent]),
),
translation: ["Because of the boy, the tree bent."]
)
```])
To number gloss examples, use `#numbered_gloss` in place of `gloss`. All other parameters remain the same.
#numbered_gloss(
source_text: ([გვ-ფრცქვნ-ი],), source_text: ([გვ-ფრცქვნ-ი],),
source_text_style: none, source_text_style: none,
transliteration: ([gv-prtskvn-i],), transliteration: ([gv-prtskvn-i],),
@ -76,53 +142,14 @@ As a first example, here is a gloss of a text in Georgian, along with the Typst
morphemes: ([1#pl.#obj\-peel-#fmnt],), morphemes: ([1#pl.#obj\-peel-#fmnt],),
translation: "You peeled us", translation: "You peeled us",
```)] ```)]
*/
And an example for English that exhibits some additional styling: The displayed number for numbered glosses is iterated for each numbered gloss
that appears throughout the document. Unnumbered glosses do not increment the
counter for the numbered glosses.
#gloss( The gloss count is controlled by the Typst counter variable `gloss_count`. This
source_text: ([I'm], [eat-ing], [your], [head]), variable can be imported from the `leipzig-gloss` package and reset using the
source_text_style: (item) => text(fill: red)[#item], standard Typst counter functions to control gloss numbering.
morphemes: ([1#sg.#sbj\=to.be], [eat-#prog], [2#sg.#pos], [head]),
morphemes_style: text.with(fill: blue),
translation: text(weight: "semibold")[I'm eating your head!],
)
#codeblock(
[```typst
#gloss(
source_text: ([I'm], [eat-ing], [your], [head]),
source_text_style: (item) => text(fill: red)[#item],
morphemes: ([1#sg.#subj\=to.be], [eat-#prog], [2#sg.#pos], [head]),
morphemes_style: text.with(fill: blue),
translation: text(weight: "semibold")[I'm eating your head!],
)
```])
The `#gloss` function has three pre-defined parameters for glossing levels:
`source_text`, `transliteration`, and `morphemes`. It also has two parameters
for unaligned text: `header_text` for text that precedes the gloss, and
`translation` for text that follows the gloss.
If one wishes to add more than three glossing lines, there is an additional
parameter `gloss_lines` that can take a list of arbitrarily many more glossing
lines, which will appear below those specified in the aforementioned
parameters:
/*
#gloss(
header_text: [Hunzib (van den Berg 1995:46)],
source_text: ([ождиг],[хо#super[н]хе],[мукъер]),
transliteration: ([oʒdig],[χõχe],[muqʼer]),
morphemes: ([ož-di-g],[xõxe],[m-uq'e-r]),
gloss_lines: (
([boy-#smallcaps[obl]-#smallcaps[ad]], [tree(#smallcaps[g4])], [#smallcaps[g4]-bend-#smallcaps[pret]]),
([at boy], [tree], [bent]),
),
translation: ["Because of the boy, the tree bent."]
)
*/
@ -131,6 +158,9 @@ parameters:
These example glosses replicate the ones given in These example glosses replicate the ones given in
#link("https://www.eva.mpg.de/lingua/pdf/Glossing-Rules.pdf"). #link("https://www.eva.mpg.de/lingua/pdf/Glossing-Rules.pdf").
#{
gloss_count.update(0)
}
#numbered_gloss( #numbered_gloss(
header_text: [Indonesian (Sneddon 1996:237)], header_text: [Indonesian (Sneddon 1996:237)],