Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!sun-barr!newstop!texsun!smunews!txsil!steve From: steve@txsil.lonestar.org (Steve McConnel) Newsgroups: comp.text.tex Subject: Re: Glossed examples in TeX Message-ID: <373@txsil.lonestar.org> Date: 3 Nov 90 20:44:36 GMT References: <43647@eerie.acsu.Buffalo.EDU> Reply-To: steve@txsil.lonestar.org (Steve McConnel) Organization: Summer Institute of Linguistics, Dallas TX Lines: 105 In article <43647@eerie.acsu.Buffalo.EDU> malouf@acsu.buffalo.edu (Robert Malouf) writes: >Does anyone know of a macro for formatting glossed examples in TeX? I want to >include examples like (1) or (2) in a paper. > >(1) Mosimane o- bed- its-w- e ke monna. > boy SUBJ-beat-PRV-PASS-MOOD by man > `The/*a boy was beaten by a/the man.' > >(2) Mosimane o-bed-its-w-e ke monna. > boy SUBJ-beat-PRV-PASS-MOOD by man > `The/*a boy was beaten by a/the man.' > >Thanks in advance for any advice. We've been working on TeX macros for typesetting interlinear text for a couple of years, and are almost ready to publish a book describing how to use them. (``Almost ready'' as in ``goes to press next week''.) I'll try to make the macros and programs available on the net sometime in December when the books are available. Before that, "beta-test" versions are available on request. The primary focus of our work has been on a set of macros for plain TeX to format books of annotated text, but a LaTeX style has also been developed. An environment named `interlinear' is the focal point of the LaTeX macros. This environment creates a box containing aligned text. (Because it's all in a box, each interlinear example must fit on a page, and examples will never split across pages.) If the examples are short enough to fit on one line, it is possible to include the freeform annotation in the interlinear environment. Before using the interlinear environment, each annotation field must be defined by an \aligning command to establish font selection, leading, and so on. For the examples given by Robert Malouf, the following commands would set things up appropriately: \aligning{text}{cmr10}{}{}{}{} \aligning{gloss}{cmr10}{}{}{}{} \aligning{free}{cmr10}{}{}{}{} (Optional parameters are perhaps not handled in true LaTeX style, as the macro definition was copied verbatim from the plain TeX package.) Within the interlinear environment, \[ and \] delimit a \vbox containing stacked annotations. \< and \> delimit a \hbox, allowing nesting, for example, to align morphemes rather than words. \+ causes the nested \vbox's to butt up against each other rather than being separated by a modest amount of space. { and } at the innermost level delimit the actual data, handling the setup (font switches and such) established by \aligning commands earlier. With that background, here's the encoding of Robert Malouf's first example: \begin{interlinear} \[ \< \[ {Mosimane} {boy} \] \[ \< \[ {o--} {SUBJ--} \]\+ \[ {bed} {beat} \]\+ \[ {--its} {--PRV} \]\+ \[ {--w} {--PASS} \]\+ \[ {--e} {--MOOD} \] \> \] \[ {ke} {by} \] \[ {monna.} {man} \] \> {`The/*a boy was beaten by a/the man.'} \] \end{interlinear} Of course, if you want to use word-aligned examples, that's also possible. Here is how it would be encoded: \begin{interlinear} \[ \< \[ {Mosimane} {boy} \] \[ {o--bed--its--w--e} {SUBJ--beat--PRV--PASS--MOOD} \] \[ {ke} {by} \] \[ {monna.} {man} \] \> {`The/*a boy was beaten by a/the man.'} \] \end{interlinear} Note that the whitespace in these examples is purely to make the nesting and alignment easier to decipher. Within the interlinear environment, newlines are given the same \catcode as spaces, so that empty lines will not trigger paragraphing. Also, within a \[...\] pair, spaces are thrown away except for the actual data inside the {...} pairs. In addition to the commands described above, there are parameters for adjusting margins and spacing, and a couple of commands for accessing multiple fonts within a single annotation field. An `interlinear*' environment is also provided for unnumbered examples. For those who are working with multiple languages, the \itfreset command erases the information stored by prior \aligning commands. The TeX macros and associated software will be free, but we'll have to charge for the book and floppies. :-( (but probably less than $20) :-) Since we aren't on the Internet, I can't put things up on `anonymous FTP' directly. Posting to USENET is the obvious alternative. What newsgroup would it be appropriate to post the TeX macros to? Currently, ITF.TEX (the plain TeX macro file) is 79K, ITFL.STY (the LaTeX style file) is 15K, and a pair of auxiliary TeX/LaTeX macro files add another 10K to the total. Then, adding the C source code to a couple of programs for translating data into ITF/TeX format... It adds up to a fair amount of data. -- Stephen McConnel Summer Institute of Linguistics PHONE: 214-709-2418 7500 W. Camp Wisdom Road UUCP: ...!{convex|utafll}!txsil!steve Dallas, TX 75236 Internet: steve@txsil.lonestar.org