Compare commits

..

No commits in common. "2b5cad038da01ca6ddf731eac8ade265aff90f19" and "4519b8da22977273e23bd005bea893726e9fd750" have entirely different histories.

2 changed files with 51 additions and 76 deletions

View File

@ -1,58 +1,31 @@
#import "linguistic-abbreviations.typ": * #import "linguistic-abbreviations.typ": *
#let custom_abbreviations = ( = A linguistics paper
"FMNT": "Present/Future stem formant",
)
#{
standard_abbreviations.insert("FMNT", [formant])
}
#let fmnt = emit_abbreviation("FMNT") #let fmnt = emit_abbreviation("FMNT")
// An example function that uses `with_used_abbreviations`
#let print_usage_chart = with_used_abbreviations.with(debug: false)(final_used_abbreviations => {
show terms: t => {
for t in t.children [
#t.term #h(2cm) #t.description\
]
}
let print_abbrevs(abbrv_list) = {
for abbrv in abbrv_list {
let explanation = if abbrv in standard_abbreviations {
standard_abbreviations.at(abbrv)
} else {
custom_abbreviations.at(abbrv)
}
terms((smallcaps(lower(abbrv)), explanation))
}
}
heading(level: 3)[Abbreviations in order of use]
print_abbrevs(final_used_abbreviations.keys())
heading(level: 3)[Abbreviations in alphabetical order]
let sorted_abbreviations = final_used_abbreviations.keys().sorted()
print_abbrevs(sorted_abbreviations)
})
= Some linguistics paper
== Abbreviations used in this document == Abbreviations used in this document
#print_usage_chart #print_usage_chart
== The main body of the paper == The meat of the paper
The #p1#sg pronoun in Spanish is _yo_. The #p2#sg pronoun in Spanish is _tu_.
The six cases of Latin are: The #p1#sg pronoun in Spanish is "yo"
- Nominative (#nom)
- Genitive (#gen)
- Dative (#dat)
- Accusative (#acc)
- Ablative (#abl)
- Vocative (#voc)
The Present/Future stem formant (#fmnt) in Georgian disappears in perfective screeves. The #p2#sg pronoun in Spanish is "tu"
The #abl case exists in Latin.
#non#abl is cool
I use #acc for breakfast
#all case best casea
#voc best case
Present/future stem #fmnt

View File

@ -86,42 +86,44 @@
"VOC": "vocative", "VOC": "vocative",
) )
// A dictionary used as a set to mark which abbreviations have been used by a call to
// `emit_abbreviation`. Each key in the dictionary is the string symbol of that abbreviation,
// and the value is always `true`.
#let used_abbreviations = state("leipzig-gloss-used-abbreviations", (:))
// Accepts a callback that accepts the state of the `used_abbreviations` #let used_abbreviations = state("used-abbreviations", (:))
// dictionary at the end of the document. Also an additional debug parameter
#let with_used_abbreviations(callback, debug: false) = { #let print_usage_chart = {
locate(loc => { locate(loc => {
let final_used_abbreviations = used_abbreviations.final(loc) let final_used_abbreviations = used_abbreviations.final(loc)
if debug { //TODO this is debugging get rid of soon
for (key, value) in final_used_abbreviations { for (key, value) in final_used_abbreviations {
[#key was used: #value] [#key was used: #value]
linebreak() linebreak()
} }
linebreak()
//TODO requires standard_abbreviations to be sorted alphabetically, can this be enforced?
for (abbrv, explanation) in standard_abbreviations {
if abbrv in final_used_abbreviations {
[#smallcaps(lower(abbrv)) #h(2em) #explanation]
linebreak() linebreak()
} }
}
callback(final_used_abbreviations)
}) })
} }
// Public function. Given a symbol that is a string, emits
// the lowercase version of that string in smallcaps format, and adds #let fmnt = smallcaps([fmnt])
// its use to the `used_abbreviations` table
#let emit_abbreviation(symbol) = {
let mark_used(symbol) = { //Appendix: List of Standard Abbreviations
#let mark_used(symbol) = {
used_abbreviations.update(cur => { used_abbreviations.update(cur => {
cur.insert(symbol, true) cur.insert(symbol, true)
cur cur
}) })
} }
#let emit_abbreviation(symbol) = {
mark_used(symbol) mark_used(symbol)
smallcaps(lower(symbol)) smallcaps(lower(symbol))
} }
@ -162,7 +164,7 @@ locate(loc => {
#let dur = emit_abbreviation("DUR") #let dur = emit_abbreviation("DUR")
#let erg = emit_abbreviation("ERG") #let erg = emit_abbreviation("ERG")
#let excl = emit_abbreviation("EXCL") #let excl = emit_abbreviation("EXCL")
#let F = emit_abbreviation("F") #let f = emit_abbreviation("F")
#let foc = emit_abbreviation("FOC") #let foc = emit_abbreviation("FOC")
#let fut = emit_abbreviation("FUT") #let fut = emit_abbreviation("FUT")
#let gen = emit_abbreviation("GEN") #let gen = emit_abbreviation("GEN")
@ -176,8 +178,8 @@ locate(loc => {
#let ipfv = emit_abbreviation("IPFV") #let ipfv = emit_abbreviation("IPFV")
#let irr = emit_abbreviation("IRR") #let irr = emit_abbreviation("IRR")
#let loc = emit_abbreviation("LOC") #let loc = emit_abbreviation("LOC")
#let M = emit_abbreviation("M") #let m = emit_abbreviation("M")
#let N = emit_abbreviation("N") #let n = emit_abbreviation("N")
#let non = emit_abbreviation("N-") #let non = emit_abbreviation("N-")
#let neg = emit_abbreviation("NEG") #let neg = emit_abbreviation("NEG")
#let nmlz = emit_abbreviation("NMLZ") #let nmlz = emit_abbreviation("NMLZ")
@ -198,13 +200,13 @@ locate(loc => {
#let pst = emit_abbreviation("PST") #let pst = emit_abbreviation("PST")
#let ptcp = emit_abbreviation("PTCP") #let ptcp = emit_abbreviation("PTCP")
#let purp = emit_abbreviation("PURP") #let purp = emit_abbreviation("PURP")
#let Q = emit_abbreviation("Q") #let q = emit_abbreviation("Q")
#let quot = emit_abbreviation("QUOT") #let quot = emit_abbreviation("QUOT")
#let recp = emit_abbreviation("RECP") #let recp = emit_abbreviation("RECP")
#let refl = emit_abbreviation("REFL") #let refl = emit_abbreviation("REFL")
#let rel = emit_abbreviation("REL") #let rel = emit_abbreviation("REL")
#let res = emit_abbreviation("RES") #let res = emit_abbreviation("RES")
#let S = emit_abbreviation("S") #let s = emit_abbreviation("S")
#let sbj = emit_abbreviation("SBJ") #let sbj = emit_abbreviation("SBJ")
#let sbjv = emit_abbreviation("SBJV") #let sbjv = emit_abbreviation("SBJV")
#let sg = emit_abbreviation("SG") #let sg = emit_abbreviation("SG")