Compare commits

...

13 Commits

Author SHA1 Message Date
Greg Shuflin 320f1ad0e5 Redefine fmnt custom abbreviation 2023-07-11 01:41:37 -07:00
Greg Shuflin 6592ebd444 Use snake-case 2023-07-11 01:40:00 -07:00
Greg Shuflin 2b5cad038d Use-order and alphabetical used symbols 2023-07-11 01:33:29 -07:00
Greg Shuflin 6fee9d6e4c More misc work 2023-07-11 01:17:41 -07:00
Greg Shuflin 3c87ec58c8 Hide helper function in closure 2023-07-11 00:42:45 -07:00
Greg Shuflin 4519b8da22 WIP tryign out ways to define custom abbreviations 2023-07-10 03:20:42 -07:00
Greg Shuflin ae47d30fef Handle N- (non-) ? 2023-07-10 03:00:53 -07:00
Greg Shuflin ff20fc0c76 More code simplifications 2023-07-10 02:51:34 -07:00
Greg Shuflin fe6de041a5 Ensure ordering of used abbrevs is correct 2023-07-10 02:49:04 -07:00
Greg Shuflin 26e0bbdab6 Flesh out full linguistics abbreviation chart 2023-07-10 02:44:03 -07:00
Greg Shuflin ffec36460d Simplify how tracking abbreviations works 2023-07-10 02:23:15 -07:00
Greg Shuflin c45e645b1a Concision 2023-07-10 02:19:57 -07:00
Greg Shuflin e837580f68 Playing around with how a used abbreviations table might work 2023-07-05 21:12:52 -07:00
5 changed files with 278 additions and 128 deletions

View File

@ -0,0 +1,58 @@
#import "linguistic-abbreviations.typ": *
#let custom-abbreviations = (
"FMNT": "Present/Future stem formant",
)
#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
#print_usage_chart
== The main body 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:
- Nominative (#nom)
- Genitive (#gen)
- Dative (#dat)
- Accusative (#acc)
- Ablative (#abl)
- Vocative (#voc)
The Present/Future stem formant (#fmnt) in Georgian disappears in perfective screeves.

View File

@ -4,3 +4,7 @@ default:
build-example:
typst compile leipzig-gloss-examples.typ
build-abbreviations-example:
typst compile abbreviations-used-example.typ

Binary file not shown.

View File

@ -6,6 +6,8 @@
#let codeblock(contents) = block(fill: luma(230), inset: 8pt, radius: 4pt, breakable: false, contents)
#let fmnt = emit-abbreviation("FMNT")
= Introduction
@ -65,7 +67,7 @@ for common glossing abbreviations:
#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: ([1#sg.#sbj\=to.be], [eat-#prog], [2#sg.#poss], [head]),
morphemes_style: text.with(fill: blue),
translation: text(weight: "semibold")[I'm eating your head!],
)
@ -174,7 +176,7 @@ way will override any contradictory line-level formatting.
header_text_style: text.with(weight: "bold", fill: green),
source_text: (text(fill:black)[I'm], [eat-ing], [your], [head]),
source_text_style: text.with(style: "italic", fill: red),
morphemes: ([1#sg.#sbj\=to.be], text(fill:black)[eat-#prog], [2#sg.#pos], [head]),
morphemes: ([1#sg.#sbj\=to.be], text(fill:black)[eat-#prog], [2#sg.#poss], [head]),
morphemes_style: text.with(fill: blue),
translation: text(weight: "bold")[I'm eating your head!],
)
@ -185,7 +187,7 @@ way will override any contradictory line-level formatting.
header_text_style: text.with(weight: "bold", fill: green),
source_text: (text(fill:black)[I'm], [eat-ing], [your], [head]),
source_text_style: text.with(style: "italic", fill: red),
morphemes: ([1#sg.#sbj\=to.be], text(fill:black)[eat-#prog], [2#sg.#pos], [head]),
morphemes: ([1#sg.#sbj\=to.be], text(fill:black)[eat-#prog], [2#sg.#poss], [head]),
morphemes_style: text.with(fill: blue),
translation: text(weight: "bold")[I'm eating your head!],
)

View File

@ -1,128 +1,214 @@
#let fmnt = smallcaps([fmnt])
// See https://www.eva.mpg.de/lingua/resources/glossing-rules.php
#let standard-abbreviations = (
"1": "first person",
"2": "second person",
"3": "third person",
"A": "agent-like argument of canonical transitive verb",
"ABL": "ablative",
"ABS": "absolutive",
"ACC": "accusative",
"ADJ": "adjective",
"ADV": "adverb(ial)",
"AGR": "agreement",
"ALL": "allative",
"ANTIP": "antipassive",
"APPL": "applicative",
"ART": "article",
"AUX": "auxiliary",
"BEN": "benefactive",
"CAUS": "causative",
"CLF": "classifier",
"COM": "comitative",
"COMP": "complementizer",
"COMPL": "completive",
"COND": "conditional",
"COP": "copula",
"CVB": "converb",
"DAT": "dative",
"DECL": "declarative",
"DEF": "definite",
"DEM": "demonstrative",
"DET": "determiner",
"DIST": "distal",
"DISTR": "distributive",
"DU": "dual",
"DUR": "durative",
"ERG": "ergative",
"EXCL": "exclusive",
"F": "feminine",
"FOC": "focus",
"FUT": "future",
"GEN": "genitive",
"IMP": "imperative",
"INCL": "inclusive",
"IND": "indicative",
"INDF": "indefinite",
"INF": "infinitive",
"INS": "instrumental",
"INTR": "intransitive",
"IPFV": "imperfective",
"IRR": "irrealis",
"LOC": "locative",
"M": "masculine",
"N": "neuter",
"N-": [non- (e.g. #smallcaps[nsg] nonsingular, #smallcaps[npst] nonpast)],
"NEG": "negation, negative",
"NMLZ": "nominalizer/nominalization",
"NOM": "nominative",
"OBJ": "object",
"OBL": "oblique",
"P": "patient-like argument of canonical transitive verb",
"PASS": "passive",
"PFV": "perfective",
"PL": "plural",
"POSS": "possessive",
"PRED": "predicative",
"PRF": "perfect",
"PRS": "present",
"PROG": "progressive",
"PROH": "prohibitive",
"PROX": "proximal/proximate",
"PST": "past",
"PTCP": "participle",
"PURP": "purposive",
"Q": "question particle/marker",
"QUOT": "quotative",
"RECP": "reciprocal",
"REFL": "reflexive",
"REL": "relative",
"RES": "resultative",
"S": "single argument of canonical intransitive verb",
"SBJ": "subject",
"SBJV": "subjunctive",
"SG": "singular",
"TOP": "topic",
"TR": "transitive",
"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`
// dictionary at the end of the document. Also an additional debug parameter
#let with-used-abbreviations(callback, debug: false) = {
locate(loc => {
let final_used-abbreviations = used-abbreviations.final(loc)
if debug {
for (key, value) in final_used-abbreviations {
[#key was used: #value]
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
// its use to the `used-abbreviations` table
#let emit-abbreviation(symbol) = {
let mark_used(symbol) = {
used-abbreviations.update(cur => {
cur.insert(symbol, true)
cur
})
}
mark_used(symbol)
smallcaps(lower(symbol))
}
/*
Appendix: List of Standard Abbreviations
#let p1 = emit-abbreviation("1")
#let p2 = emit-abbreviation("2")
#let p3 = emit-abbreviation("3")
#let A = emit-abbreviation("A")
#let abl = emit-abbreviation("ABL")
#let abs = emit-abbreviation("ABS")
#let acc = emit-abbreviation("ACC")
#let adj = emit-abbreviation("ADJ")
#let adv = emit-abbreviation("ADV")
#let agr = emit-abbreviation("AGR")
#let all = emit-abbreviation("ALL")
#let antip = emit-abbreviation("ANTIP")
#let appl = emit-abbreviation("APPL")
#let art = emit-abbreviation("ART")
#let aux = emit-abbreviation("AUX")
#let ben = emit-abbreviation("BEN")
#let caus = emit-abbreviation("CAUS")
#let clf = emit-abbreviation("CLF")
#let com = emit-abbreviation("COM")
#let comp = emit-abbreviation("COMP")
#let compl = emit-abbreviation("COMPL")
#let cond = emit-abbreviation("COND")
#let cop = emit-abbreviation("COP")
#let cvb = emit-abbreviation("CVB")
#let dat = emit-abbreviation("DAT")
#let decl = emit-abbreviation("DECL")
#let def = emit-abbreviation("DEF")
#let dem = emit-abbreviation("DEM")
#let det = emit-abbreviation("DET")
#let dist = emit-abbreviation("DIST")
#let distr = emit-abbreviation("DISTR")
#let du = emit-abbreviation("DU")
#let dur = emit-abbreviation("DUR")
#let erg = emit-abbreviation("ERG")
#let excl = emit-abbreviation("EXCL")
#let F = emit-abbreviation("F")
#let foc = emit-abbreviation("FOC")
#let fut = emit-abbreviation("FUT")
#let gen = emit-abbreviation("GEN")
#let imp = emit-abbreviation("IMP")
#let incl = emit-abbreviation("INCL")
#let ind = emit-abbreviation("IND")
#let indf = emit-abbreviation("INDF")
#let inf = emit-abbreviation("INF")
#let ins = emit-abbreviation("INS")
#let intr = emit-abbreviation("INTR")
#let ipfv = emit-abbreviation("IPFV")
#let irr = emit-abbreviation("IRR")
#let loc = emit-abbreviation("LOC")
#let M = emit-abbreviation("M")
#let N = emit-abbreviation("N")
#let non = emit-abbreviation("N-")
#let neg = emit-abbreviation("NEG")
#let nmlz = emit-abbreviation("NMLZ")
#let nom = emit-abbreviation("NOM")
#let obj = emit-abbreviation("OBJ")
#let obl = emit-abbreviation("OBL")
#let P = emit-abbreviation("P")
#let pass = emit-abbreviation("PASS")
#let pfv = emit-abbreviation("PFV")
#let pl = emit-abbreviation("PL")
#let poss = emit-abbreviation("POSS")
#let pred = emit-abbreviation("PRED")
#let prf = emit-abbreviation("PRF")
#let prs = emit-abbreviation("PRS")
#let prog = emit-abbreviation("PROG")
#let proh = emit-abbreviation("PROH")
#let prox = emit-abbreviation("PROX")
#let pst = emit-abbreviation("PST")
#let ptcp = emit-abbreviation("PTCP")
#let purp = emit-abbreviation("PURP")
#let Q = emit-abbreviation("Q")
#let quot = emit-abbreviation("QUOT")
#let recp = emit-abbreviation("RECP")
#let refl = emit-abbreviation("REFL")
#let rel = emit-abbreviation("REL")
#let res = emit-abbreviation("RES")
#let S = emit-abbreviation("S")
#let sbj = emit-abbreviation("SBJ")
#let sbjv = emit-abbreviation("SBJV")
#let sg = emit-abbreviation("SG")
#let top = emit-abbreviation("TOP")
#let tr = emit-abbreviation("TR")
#let voc = emit-abbreviation("VOC")
1 first person
2 second person
3 third person
A agent-like argument of canonical transitive verb
ABL ablative
ABS absolutive
ACC accusative
ADJ adjective
ADV adverb(ial)
AGR agreement
ALL allative
ANTIP antipassive
APPL applicative
ART article
AUX auxiliary
BEN benefactive
*/
#let A = smallcaps([a])
#let all = smallcaps([all])
#let art = smallcaps([art])
/*
CAUS causative
CLF classifier
COM comitative
COMP complementizer
COMPL completive
COND conditional
COP copula
CVB converb
DAT dative
DECL declarative
DEF definite
DEM demonstrative
DET determiner
DIST distal
*/
#let com = smallcaps([com])
#let dat = smallcaps([dat])
/*
DISTR distributive
DU dual
DUR durative
ERG ergative
EXCL exclusive
F feminine
FOC focus
FUT future
GEN genitive
IMP imperative
INCL inclusive
IND indicative
INDF indefinite
INF infinitive
INS instrumental
INTR intransitive
IPFV imperfective
*/
#let du = smallcaps([du])
#let fut = smallcaps([fut])
#let gen = smallcaps([gen])
#let inf = smallcaps([inf])
#let ins = smallcaps([ins])
/*
IRR irrealis
LOC locative
M masculine
N neuter
N- non- (e.g. NSG nonsingular, NPST nonpast)
NEG negation, negative
NMLZ nominalizer/nominalization
NOM nominative
OBJ object
OBL oblique
P patient-like argument of canonical transitive verb
PASS passive
PFV perfective
PL plural
*/
#let obl = smallcaps([obl])
#let neg = smallcaps([neg])
#let obj = smallcaps([obj])
#let pl = smallcaps([pl])
/*
POSS possessive
PRED predicative
PRF perfect
PRS present
PROG progressive
PROH prohibitive
PROX proximal/proximate
PST past
PTCP participle
PURP purposive
Q question particle/marker
QUOT quotative
RECP reciprocal
REFL reflexive
*/
#let P = smallcaps([p])
#let pos = smallcaps([pos])
#let prog = smallcaps([prog])
#let pst = smallcaps([pst])
/*
REL relative
RES resultative
S single argument of canonical intransitive verb
SBJ subject
SBJV subjunctive
SG singular
TOP topic
TR transitive
VOC vocative
*/
#let sg = smallcaps([sg])
#let sbj = smallcaps([sbj])