| 1 |
% gloss.doc --- version 1.0 (26 November 1990) |
| 2 |
% This is the documentation for gloss.tex. |
| 3 |
% To read this file, process it with (plain) TeX: tex gloss.doc |
| 4 |
% (To do that, you need both gloss.tex and manmac.tex. The latter has |
| 5 |
% the macros for typesetting the TeXbook, as explained in appendix E. |
| 6 |
% It comes free with the standard distribution of TeX.) |
| 7 |
% |
| 8 |
% NOTE: Processing this file with TeX will create empty files |
| 9 |
% index.tex and answers.tex in your directory. And if you |
| 10 |
% have a file pages.tex in your directory, TeX will probably |
| 11 |
% get very confused. |
| 12 |
% The manmac format will try to load a font called cmman; if |
| 13 |
% TeX complains that it cannot find that font you can savely |
| 14 |
% ignore that, since the font is not actually used. |
| 15 |
% |
| 16 |
% This file: copyright (c) 1990 Marcel van der Goot. |
| 17 |
% You may redistribute this file and printed versions of it. |
| 18 |
% |
| 19 |
% original: csvax.cs.caltech.edu [131.215.131.131] in pub/tex |
| 20 |
% (use anonymous ftp). Also in various archives. |
| 21 |
% |
| 22 |
% Marcel van der Goot |
| 23 |
% [email protected] |
| 24 |
% Caltech 256--80 |
| 25 |
% Pasadena, CA 91125 |
| 26 |
% (818) 356--4603 |
| 27 |
|
| 28 |
% ------ definitions for manual pages: |
| 29 |
% The documentation is typeset using Knuth's ``manmac'' macros, with a |
| 30 |
% few additional things defined here. You are free to use or adapt these |
| 31 |
% extra definitions. |
| 32 |
|
| 33 |
\input manmac % the macros used for typesetting The TeXbook (appendix E) |
| 34 |
\catcode`^=7 % manmac makes ^ active for creating an index |
| 35 |
% we don't make an index, and we need ^ to be non-active |
| 36 |
|
| 37 |
{\catcode`\^^M=12 \endlinechar=-1 % 12 = other |
| 38 |
\long\gdef\manpagehead#1^^M#2^^M#3^^M^^M% tex-file, description, version |
| 39 |
{\egroup % matches \bgroup in \manpage |
| 40 |
\par\vfill\eject |
| 41 |
\edef\rhead{\manualname: #1\unskip}% |
| 42 |
\setbox1=\hbox{\titlefont #1\quad}% |
| 43 |
\setbox3=\vtop{\advance\hsize by-\wd1 \parindent=0pt \raggedright |
| 44 |
#2\par |
| 45 |
#3\par |
| 46 |
\cnotice |
| 47 |
}% |
| 48 |
\line{\box1\box3}% |
| 49 |
\bigskip\bigskip\bigskip\noindent |
| 50 |
}% |
| 51 |
} % restore \catcode`\^^M |
| 52 |
|
| 53 |
\outer\def\manpage |
| 54 |
{\bgroup\catcode`\^^M=12 |
| 55 |
\manpagehead |
| 56 |
} |
| 57 |
|
| 58 |
\hsize=6.5in\vsize=8.9in % default plain TeX values |
| 59 |
\pagewidth=\hsize \pageheight=\vsize |
| 60 |
|
| 61 |
\def\cnotice{Copyright \copyright\ 1991 Marcel R. van der Goot} |
| 62 |
\def\manualname{Midnight Macros} |
| 63 |
|
| 64 |
% LaTeX logo, from latex.tex (except for the capital `A': manmac |
| 65 |
% doesn't have a real smallcaps font) |
| 66 |
\def\LaTeX{{\rm L\kern-.36em\raise.3ex\hbox{\sc A}\kern-.15em |
| 67 |
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}} |
| 68 |
|
| 69 |
\tenpoint |
| 70 |
|
| 71 |
% (end of extra definitions) |
| 72 |
|
| 73 |
% -------------------- gloss.doc: |
| 74 |
|
| 75 |
\input Midnight/gloss % change this to refer to gloss.tex on your system |
| 76 |
|
| 77 |
\pageno=5 % follows quire.doc |
| 78 |
|
| 79 |
\manpage gloss.tex |
| 80 |
Macros for vertically aligning words in consecutive sentences. |
| 81 |
Version: 1.0 (26 November 1990) (doc: 10 November 1990) |
| 82 |
|
| 83 |
To gloss means to insert explanations or translations of words |
| 84 |
between the lines of a text. For ease of reading, one generally |
| 85 |
wants the explained word and the explanation to line up, as in |
| 86 |
\gloss Dit is een Nederlands voorbeeld. |
| 87 |
This is a Dutch example. |
| 88 |
\begindisplay |
| 89 |
\box\gline |
| 90 |
\enddisplay |
| 91 |
The macros defined in gloss.tex make it convenient to typeset |
| 92 |
such glossed sentences. To use the macros, you first have to |
| 93 |
|\input gloss|\footnote*{We have made no attempt to \LaTeX ify gloss.tex, |
| 94 |
but you can use the macros in \LaTeX\ just as in plain \TeX.}. |
| 95 |
The main macro for typesetting glossed sentences |
| 96 |
is |\gloss|. It should be followed by the two sentences, each |
| 97 |
terminated by a \<return>. The previous example was typeset with |
| 98 |
\begintt |
| 99 |
\gloss Dit is een Nederlands voorbeeld. |
| 100 |
This is a Dutch example. |
| 101 |
\endtt |
| 102 |
But instead of printing the glossed sentence, |\gloss| puts the |
| 103 |
whole construction in an hbox, called |\gline|. To actually insert |
| 104 |
that box in your text, you use |\box\gline| or |\unhbox\gline|. |
| 105 |
The text is put in a box to make it easier to handle. For instance, |
| 106 |
it makes it easy to put extra indentation or an example number |
| 107 |
in front of the sentence. (The baseline of the hbox is the baseline |
| 108 |
of the second line in the box.) The difference between |\box\gline| |
| 109 |
and |\unhbox\gline| is that the latter allows line breaks in the |
| 110 |
glossed sentence. That is obviously only useful if the glossed |
| 111 |
sentence is quite long; we will see an example later on. |
| 112 |
|
| 113 |
The |\gloss| macro splits each sentence into words, and then aligns |
| 114 |
the words. In this context, a word is a sequence of characters separated |
| 115 |
by spaces. The number of spaces between words is irrelevant, so that |
| 116 |
you can line up the words in your input as well. Using |
| 117 |
\begintt |
| 118 |
\gloss Dit is een Nederlands voorbeeld. |
| 119 |
This is a Dutch example. |
| 120 |
\endtt |
| 121 |
gives exactly the same output as the input given before. However, |
| 122 |
you should not insert extra \<return> symbols. The sentences |
| 123 |
can have a different number of words. |
| 124 |
Sometimes one of the two sentences has a word without equivalent |
| 125 |
in the other sentence. In such cases you can insert an empty word |
| 126 |
with |{}|. You can also combine several words into a single word, |
| 127 |
by using grouping. The following example illustrates both. |
| 128 |
\begintt |
| 129 |
\gloss Dit is een voorbeeldje in het Nederlands. |
| 130 |
This is a {little example} in {} Dutch. |
| 131 |
\endtt |
| 132 |
gives |
| 133 |
\gloss Dit is een voorbeeldje in het Nederlands. |
| 134 |
This is a {little example} in {} Dutch. |
| 135 |
\begindisplay |
| 136 |
\box\gline |
| 137 |
\enddisplay |
| 138 |
Without the grouping ``example'' would have been lined up |
| 139 |
with ``{\it in\/}.'' |
| 140 |
|
| 141 |
By default the first sentence of a glossed pair is set in italic font |
| 142 |
(|\it|), the second in roman font (|\rm|). You can change this by, |
| 143 |
for instance, setting |\let\eachwordone=\rm|, which will set |
| 144 |
each word in the first sentence in roman font. The font of the second |
| 145 |
sentence is governed by |\eachwordtwo|. This use of the |\eachword| |
| 146 |
macros is an instance of a more general mechanism that is explained |
| 147 |
later. You can insert font changes in the middle |
| 148 |
of a sentence, but they only apply to the next word. |
| 149 |
\begintt |
| 150 |
\gloss Dit is een Nederlands voorbeeld. |
| 151 |
This is a \sl Dutch example. |
| 152 |
\endtt |
| 153 |
will set ``Dutch'' in slanted font, but ``example'' in the default |
| 154 |
font. The |\gloss| macro considers |\sl Dutch| to be a single word, |
| 155 |
and sets this word in an hbox so that the effect of the font change |
| 156 |
is limited. |\sl| is not considered a word by itself, because |
| 157 |
spaces following a macro are always skipped. |
| 158 |
|
| 159 |
{ |
| 160 |
\let\eachwordone=\rm |
| 161 |
\def\sixstrut{\vrule height5pt depth1.5pt width0pt } |
| 162 |
\def\eachwordtwo{\let\strut=\sixstrut\sixrm} |
| 163 |
\baselineskip=22.5pt |
| 164 |
\setbox0=\hbox{ }\advance\rightskip by-\wd0 |
| 165 |
\let\s=\string |
| 166 |
|
| 167 |
\gloss You may want to gloss more than a single sentence, maybe |
| 168 |
{} verb verb {} verb {} {} {} {} noun |
| 169 |
\gloss a whole paragraph. |
| 170 |
{} {} noun |
| 171 |
\gloss It would however be quite inconvenient if you had to |
| 172 |
{} verb {} verb |
| 173 |
\gloss follow |\s\gloss| by a whole paragraph on a single line (by |
| 174 |
verb macro {} {} {} noun {} {} {} noun |
| 175 |
\gloss terminating each line with a {|\%|-sign}), followed by a line |
| 176 |
verb {} noun {} {} noun verb {} {} noun |
| 177 |
\gloss containing all the glosses. Especially if there are a lot of |
| 178 |
verb {} {} noun {} {} {} verb {} noun |
| 179 |
\gloss unglossed (empty) words, it would be hard to get the sentences |
| 180 |
verb? {} noun {} verb verb {} {} verb {} noun |
| 181 |
\gloss lined up properly. Fortunately, a paragraph like the current |
| 182 |
verb {} {} {} {} noun |
| 183 |
\gloss one can be set quite easily. |\s\gloss| puts the created sentence |
| 184 |
noun verb verb verb {} {} macro verb {} verb noun |
| 185 |
\gloss in |\s\gline|, and |\s\gline| is emptied by using |\s\box| or |
| 186 |
{} box {} box verb verb {} verb |
| 187 |
\gloss |\s\unhbox|. But if you don't empty |\s\gline|, the next |
| 188 |
{} {} {} {} verb verb box |
| 189 |
\gloss usage of |\s\gloss| will append the new sentence to the older |
| 190 |
noun {} macro verb verb {} {} noun |
| 191 |
\gloss one. Hence, this paragraph was typeset with |
| 192 |
noun {} {} noun verb verb |
| 193 |
\unhbox\gline |
| 194 |
|
| 195 |
} |
| 196 |
\beginlines |
| 197 |
|\gloss You may want to gloss more than a single sentence, maybe| |
| 198 |
\nobreak |
| 199 |
| {} verb verb {} verb {} {} {} {} noun| |
| 200 |
|\gloss a whole paragraph.| |
| 201 |
\nobreak |
| 202 |
| {} {} noun| |
| 203 |
\quad\vdots\ {\sevenrm(10 more)}\smallskip |
| 204 |
|\gloss one. Hence, this paragraph was typeset with| |
| 205 |
\nobreak |
| 206 |
| noun {} {} noun verb verb| |
| 207 |
\nobreak\smallskip\nobreak |
| 208 |
|\unhbox\gline| |
| 209 |
\endlines |
| 210 |
Of course, a few more things, like the fonts, had to be changed. We |
| 211 |
discuss that next. Also notice that it takes \TeX\ quite some time |
| 212 |
to typeset such a paragraph. |
| 213 |
|
| 214 |
\medskip |
| 215 |
\def\word{{\rm\<word>}} |
| 216 |
\danger Each word from the first line following |\gloss| is set in |
| 217 |
an hbox as follows |
| 218 |
\begintt |
| 219 |
\hbox{\eachwordone\strut|word|]} |
| 220 |
\endtt |
| 221 |
The macro |\eachwordone| is by default |\let| equal to |\it|, but |
| 222 |
can be redefined. The previous paragraph was made with |
| 223 |
\begintt |
| 224 |
\let\eachwordone=\rm |
| 225 |
\def\sixstrut{\vrule height5pt depth1.5pt width0pt } |
| 226 |
\def\eachwordtwo{\let\strut=\sixstrut\sixrm} |
| 227 |
\endtt |
| 228 |
(If |\strut| were not redefined, there would be too much space between |
| 229 |
the first and the second line.) Furthermore, to obtain a larger separation |
| 230 |
between the pairs of lines, the |\baselineskip| was set to 22.5 pt |
| 231 |
(|\baselineskip| governs the spacing between the glossed pairs, the |
| 232 |
spacing within the pair is governed by the |\strut|s.) Since a word |
| 233 |
does not contain spaces, and each word is followed by a space, |
| 234 |
the |\eachword| macros can easily be made to take the word (and the |
| 235 |
|\strut|) as argument. For instance, the following definition will |
| 236 |
underline every word in the first line. |
| 237 |
\begintt |
| 238 |
\def\eachwordone#1|]{\rm\underbar{#1}|]} |
| 239 |
\endtt |
| 240 |
The space following the word does not disappear at a line break, because |
| 241 |
it is hidden within an hbox. To hide this extra space between the last |
| 242 |
word and the right margin, the final thing needed to typeset the |
| 243 |
previous paragraph was |
| 244 |
\begintt |
| 245 |
\setbox0=\hbox{|]}\advance\rightskip by-\wd0 |
| 246 |
\endtt |
| 247 |
This is not perfect, because the size of the space depends on the font: |
| 248 |
there is a {\sixrm verb} sticking out slightly. |
| 249 |
|
| 250 |
\danger The word boxes are paired together in a single vbox, and |
| 251 |
|\gline| consists of a sequence of these vboxes. The vboxes are separated |
| 252 |
by some glue, equal to |\glossglue|. Without this glue no line breaks |
| 253 |
would be possible, nor would the spaces between the words be stretchable. |
| 254 |
|gloss.tex| says |\glossglue=0pt plus2pt minus1pt|. The stretch and |
| 255 |
shrink components are only relevant if |\unhbox\gline| is used. |
| 256 |
|
| 257 |
Sometimes you would rather not have extra space following a word, |
| 258 |
for instance when parts of a word are glossed separately: In |
| 259 |
\gloss Dit is een voorbeeld- je in het Nederlands. |
| 260 |
This is an example (``little'') in {} Dutch. |
| 261 |
\begindisplay |
| 262 |
\box\gline |
| 263 |
\enddisplay |
| 264 |
it is preferable to have no space following ``{\it voorbeeld-}'' if it |
| 265 |
is not necessary. This can easily be achieved with a macro like |
| 266 |
\begintt |
| 267 |
\def\+#1|]{#1} |
| 268 |
\endtt |
| 269 |
which is inserted just before the word that should not have a space: |
| 270 |
|\+voorbeeld- je|. |
| 271 |
It can also be done by making the hyphen gobble up the space, as in |
| 272 |
\begintt |
| 273 |
\let\hyphen=- |
| 274 |
\catcode`-=\active |
| 275 |
\def-#1|]{\hyphen#1} |
| 276 |
\endtt |
| 277 |
However, this does not work if there is a word with a hyphen in the |
| 278 |
middle. To handle that situation, a more sophisticated definition |
| 279 |
of |-| can check what the next character is, using |
| 280 |
|\futurelet|. We will not do that here, as it has little to do with |
| 281 |
glossed sentences. |
| 282 |
|
| 283 |
\bye |