From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/gb4e/README | 11 + macros/latex/contrib/gb4e/cgloss4e.sty | 168 ++++++++++++ macros/latex/contrib/gb4e/gb4e-doc.pdf | Bin 0 -> 166149 bytes macros/latex/contrib/gb4e/gb4e-doc.tex | 449 +++++++++++++++++++++++++++++++++ macros/latex/contrib/gb4e/gb4e.sty | 385 ++++++++++++++++++++++++++++ 5 files changed, 1013 insertions(+) create mode 100644 macros/latex/contrib/gb4e/README create mode 100644 macros/latex/contrib/gb4e/cgloss4e.sty create mode 100644 macros/latex/contrib/gb4e/gb4e-doc.pdf create mode 100644 macros/latex/contrib/gb4e/gb4e-doc.tex create mode 100644 macros/latex/contrib/gb4e/gb4e.sty (limited to 'macros/latex/contrib/gb4e') diff --git a/macros/latex/contrib/gb4e/README b/macros/latex/contrib/gb4e/README new file mode 100644 index 0000000000..f3061b1691 --- /dev/null +++ b/macros/latex/contrib/gb4e/README @@ -0,0 +1,11 @@ +The style file gb4e provides an environment for linguistic examples, a command +for glossed sentences, and a grab-bag of various other goodies. + +Authors: Hans-Peter Kolb and Craig Thiersch (c_thiersch@alum.mit.edu) + +The code was developed from the midnight and covington packages. It may be +distributed and/or modified unter the conditions of the LaTeX Project Public +License, either version 1.2 of this license or (at your option) any later version. + +The latest version of the LaTeX Project Public License can be found at this URL: +http://www.latex-project.org/lppl.txt diff --git a/macros/latex/contrib/gb4e/cgloss4e.sty b/macros/latex/contrib/gb4e/cgloss4e.sty new file mode 100644 index 0000000000..b066dbd993 --- /dev/null +++ b/macros/latex/contrib/gb4e/cgloss4e.sty @@ -0,0 +1,168 @@ +% -*- LaTeX -*- +% Following borrows from Covington's style files inspired by Midnight by M. +% van der Goot, adapted to be used with gb4e.sty: examples beginning with \ex can +% contain glosses directly. Default is +% Linguistic Inquiry style with all lines in \rm; to change a line (eg. to +% \it for a particular journal, change the appropriate line: e.g., +% \let\eachwordone=\rm in a copy of this file. Note that it will NOT work +% to put \it before the line as the words are parsed separately. + +% Use \singlegloss to force single-spaced glosses even in double-space +% environments. Works also in footnotes (^M as delimiter replaced by +% \\)---hpk +% +%%% +%%% Sentences with word-by-word glosses +%%% + +% See covingtn.tex for full documentation. Some examples: +% +% Displayed sentence with gloss and translation: +% +% \gll Dit is een Nederlands voorbeeld.\\ +% This is a Dutch example.\\ +% \glt `This is an example in Dutch.' +% +% Same, using bracketing where words do not correspond one-to-one: +% +% \gll Dit is een voorbeeldje in het Nederlands.\\ +% This is a {little example} in {} Dutch.\\ +% \glt `This is a little example in Dutch.' +% +% If you want to align 3 lines rather than two, use \glll instead of \gll. +% +% Layout is critical between \gll (or \glll) and \glt (or \gln). +% +% Thanks to Marcel R. van der Goot for permission to reproduce code. +\let\@gsingle=1 +\def\singlegloss{\let\@gsingle=1} +\def\nosinglegloss{\let\@gsingle=0} +\@ifundefined{new@fontshape}% + {\def\@selfnt{\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi}} + {\def\@selfnt{\selectfont}} + +\def\gll% % Introduces 2-line text-and-gloss. + {\begin{flushleft} + \ifx\@gsingle1% conditionally force single spacing (hpk/MC) + \vskip\baselineskip\def\baselinestretch{1}% + \@selfnt\vskip-\baselineskip\fi% + \bgroup + \twosent + } + +\def\glll% % Introduces 3-line text-and-gloss. + {\begin{flushleft} + \ifx\@gsingle1% conditionally force single spacing (hpk/MC) + \vskip\baselineskip\def\baselinestretch{1}% + \@selfnt\vskip-\baselineskip\fi% + \bgroup + \threesent + } + +\def\glt{\vskip.17\baselineskip} +% Introduces a translation +\let\trans\glt + +\def\glend{} % obsolete + % Ends the gloss environment. + +% The following TeX code is adapted, with permission, from: +% gloss.tex: Macros for vertically aligning words in consecutive sentences. +% Version: 1.0 release: 26 November 1990 +% Copyright (c) 1991 Marcel R. van der Goot (marcel@cs.caltech.edu). +% Original Midnight/gloss.tex and Midnight/gloss.doc are available from +% csvax.cs.caltech.edu [131.215.131.131] in pub/tex +% and many other anonymous ftp archives. + +\newbox\lineone% boxes with words from first line +\newbox\linetwo% +\newbox\linethree% +\newbox\wordone% a word from the first line (hbox) +\newbox\wordtwo% +\newbox\wordthree% +\newbox\gline% the constructed double line (hbox) +\newskip\glossglue% extra glue between glossed pairs or triples +\glossglue = 0pt plus 2pt minus 1pt % allow stretch/shrink between words +%\glossglue = 5pt plus 2pt minus 1pt % allow stretch/shrink between words +\newif\ifnotdone + +% For any REALLY old distributions without \rmfamily +\@ifundefined{rmfamily}{\let\rmfamily=\rm} + +\@ifundefined{eachwordone}{\let\eachwordone=\rmfamily}{\relax} +\@ifundefined{eachwordtwo}{\let\eachwordtwo=\rmfamily}{\relax} +\@ifundefined{eachwordthree}{\let\eachwordthree=\rmfamily}{\relax} + +\def\lastword#1#2#3% #1 = \each, #2 = line box, #3 = word box + {\setbox#2=\vbox{\unvbox#2% + \global\setbox#3=\lastbox% + }% + \ifvoid#3\global\setbox#3=\hbox{#1\strut{} }\fi + % extra space following \strut in case #1 needs a space + } + +\def\testdone + {\ifdim\ht\lineone=0pt + \ifdim\ht\linetwo=0pt \notdonefalse % tricky space after pt + \else\notdonetrue + \fi + \else\notdonetrue + \fi + } + +\gdef\getwords(#1,#2)#3 #4\\% #1=linebox, #2=\each, #3=1st word, #4=remainder + {\setbox#1=\vbox{\hbox{#2{\strut#3} }% adds space + \unvbox#1% + }% + \def\more{#4}% + \ifx\more\empty\let\more=\donewords + \else\let\more=\getwords + \fi + \more(#1,#2)#4\\% + } + +\gdef\donewords(#1,#2)\\{}% + +\gdef\twosent#1\\ #2\\{% #1 = first line, #2 = second line + \getwords(\lineone,\eachwordone)#1 \\% + \getwords(\linetwo,\eachwordtwo)#2 \\% + \loop\lastword{\eachwordone}{\lineone}{\wordone}% + \lastword{\eachwordtwo}{\linetwo}{\wordtwo}% + \global\setbox\gline=\hbox{\unhbox\gline + \hskip\glossglue + \vtop{\box\wordone % vtop was vbox + \nointerlineskip + \box\wordtwo + }% + }% + \testdone + \ifnotdone + \repeat + \egroup % matches \bgroup in \gloss + \gl@stop} + +\gdef\threesent#1\\ #2\\ #3\\{% #1 = first line, #2 = second line, #3 = third + \getwords(\lineone,\eachwordone)#1 \\% + \getwords(\linetwo,\eachwordtwo)#2 \\% + \getwords(\linethree,\eachwordthree)#3 \\% + \loop\lastword{\eachwordone}{\lineone}{\wordone}% + \lastword{\eachwordtwo}{\linetwo}{\wordtwo}% + \lastword{\eachwordthree}{\linethree}{\wordthree}% + \global\setbox\gline=\hbox{\unhbox\gline + \hskip\glossglue + \vtop{\box\wordone % vtop was vbox + \nointerlineskip + \box\wordtwo + \nointerlineskip + \box\wordthree + }% + }% + \testdone + \ifnotdone + \repeat + \egroup % matches \bgroup in \gloss + \gl@stop} + +\def\gl@stop{{\hskip -\glossglue}\unhbox\gline\end{flushleft}} + +\endinput diff --git a/macros/latex/contrib/gb4e/gb4e-doc.pdf b/macros/latex/contrib/gb4e/gb4e-doc.pdf new file mode 100644 index 0000000000..40583fa164 Binary files /dev/null and b/macros/latex/contrib/gb4e/gb4e-doc.pdf differ diff --git a/macros/latex/contrib/gb4e/gb4e-doc.tex b/macros/latex/contrib/gb4e/gb4e-doc.tex new file mode 100644 index 0000000000..0b505a0198 --- /dev/null +++ b/macros/latex/contrib/gb4e/gb4e-doc.tex @@ -0,0 +1,449 @@ +% -*- LaTeX -*- +%%%% Latex2e: +\documentclass[11pt,a4paper]{article} +\usepackage{gb4e} +%%%% LaTeX209: +%\documentstyle[a4,11pt,gb4e]{article} +%% +\def\bs{$\backslash$} +\frenchspacing\parskip1.2ex +\parindent0pt +\def\bit{\vskip.05\baselineskip\hspace*{1em}\hangindent4em\hangafter1} +\title{Preliminary documentation for {\tt gb\gbVersion.sty}\thanks{% + Parts of ``Government-Binding style'' {\tt gb\gbVersion.sty} are + loosely based on ideas and code by M.~Covington, M.~van der Goot, + J.~Frampton and L.~Holt. In particular it automatically includes {\tt + cgloss\gbVersion.sty}, a (heavily adapted) version of M.~Covington's + \LaTeX-adaptation of M.~van der Goot's plain\TeX{} Midnight gloss + macros.} and {\tt cgloss\gbVersion.sty}} +\author{Hans-Peter Kolb \\[2pt] +Craig Thiersch $<${\sf c\_thiersch@alum.mit.edu}$>$} +\date{} +\begin{document} +\maketitle +\tableofcontents +\vspace*{1cm} +\vfill +\subsection*{Important note:} +The file {\tt gb\gbVersion.sty}\footnote{% + This version of {\tt gb{\em x}.sty} + redesigns the entire series of {\tt \bs ex} + commands. It also contains changes to the gloss-macros to make them + work in footnotes etc. {\bf NB: The {\em {\tt e}xport\/} version does + not provide a + soft-landing system of command-compatibility with earlier + versions}. + + NB: Make sure to get {\tt cgloss\gbVersion.sty} together with {\tt + gb\gbVersion.sty}. + + This version of gb4e includes some \emph{minimal} bug-fixes and enhancements by + Alexis Dimitriadis, with emphasis on backward compatibility. +} + allows \verb"_" (subscript) and +\verb"^" (superscript) to be used in ordinary text, which is handy, +but because it changes their definitions it must be loaded {\bf after} +any file that uses them in their \TeX\ meaning. +\pagebreak +\section{Linguistic examples in \LaTeX} +{\tt gb\gbVersion.sty} is a style option to be used + with \LaTeX's major document styles. To make its commands available, + add it to your document's preamble like this: +\bit (in LaTex2e:)~~~~~~\verb,\usepackage{gb4e}, +\bit (in LaTex 2.09:)~~{\tt \bs documentstyle[\ldots gb\gbVersion]\{\ldots\}} + + +Its core is an environment for the formatting of +linguistic examples. + +The format is simple:\\ +(Batches of) examples are introduced by +\verb,\begin{exe}, which sets up the top level example environment. +Obviously, this environment has to be closed after the example(s) by +\verb,\end{exe},. You can create sub- and subsubexamples by +embedding several {\tt xlist}-environments (up to three levels deep). + +Here is an elaborate example: +\begin{verbatim} +\begin{exe} % sets up the top-level example environment +\ex\label{here} Here is one. % example with running number +\ex[*]{Here another is.} % judged ex. with running number +\ex Here are some with judgements. + \begin{xlist} % first embedding (alphabetical numbering) + \ex[]{A grammatical sentence am I.} + \ex[*]{An ungrammatical sentence is you.} + \ex[??]{A dubious sentence is she.} + \ex % just the number + \begin{xlist} % second embedding (roman numbering) + \ex[**]{Need one a second embedding?} + \ex[\%]{sometime.} + \end{xlist} % end second embedding + \ex Dare to judge me! + \end{xlist} % end first embedding +\ex This concludes our demonstration. +\end{exe} % end example environment +\end{verbatim} +This produces: +\begin{exe} % sets up the top-level example environment +\ex\label{here} Here is one. % example with running number +\ex[*]{Here another is.} % judged ex. with running number +\ex Here are some with judgements. + \begin{xlist} % first embedding (alphabetical numbering) + \ex[]{A grammatical sentence am I.} + \ex[*]{An ungrammatical sentence is you.} + \ex[??]{A dubious sentence is she.} + \ex % just the number + \begin{xlist} % second embedding (roman numbering) + \ex[**]{Need one a second embedding?} + \ex[\%]{sometime.} + \end{xlist} % end second embedding + \ex Dare to judge me! + \end{xlist} % end first embedding +\ex This concludes our demonstration. +\end{exe} % end example environment + +All example-list commands have an optional argument which allows you to +set the labelwidth to, e.g., the widest label to come (in the style of +\verb,\begin{bibliography},). So, +\verb,\begin{exe}[(234)], will set the labelwidth to the width + of ``{\tt (234)}''---which is also the default. The other defaults + are ``{\tt m.}'' for {\tt xlist}, and ``{\tt iii.}'' for {\tt xlisti}. +The default labelwidth for the {\tt exe}-environment can also be changed +globally by issuing a \verb,\exewidth{}, command in the +preamble of your document (i.e.\ between +\verb'\documentclass' and \verb'\begin{document}'). + +\subsection{Examples with running numbers} +As just shown, every example with a running number +is introduced by \verb'\ex'. +Obviously, \verb,\ex, is {\em context-sensitive\/}: at the top +level the number produced is {\em arabic} and accumulative +throughout the document; in embedded {\tt xlist}-environments it is +{\em alphabetic\/} on the first level, {\em roman\/} on the second, and +{\em arabic\/} on the third, starting with $a.$, $i.$, and $1.$, +repectively. For total control over the shape +of your subexample-numbering there are some special forms listed +below:\footnote{% +Note that for all +{\tt \bs begin\{\}} \ldots {\tt \bs end\{\}} pairs the forms +{\tt \bs} \ldots {\tt \bs end} are also permissible in \LaTeX. +So if you like you can go on using {\tt\bs xlist} \ldots +{\tt\bs endxlist} for {\tt \bs begin\{xlist\}} \ldots {\tt \bs end\{xlist\}} + etc., but \LaTeX-syntaxcheckers and utilities like AUC-\TeX\ won't +recognize them as necessarily paired and won't report unmatched + expressions. (Have you ever tried {\tt -C -C} + (= LaTeX-environment) or {\tt -C -F} + (= LaTeX-close-environment) in EMACS' AUC-\TeX\ mode? You should---it +saves a lot of typing.)} +\begin{center} +\begin{tabular}{|l|l|}\hline +{\em Environment}& {\em Default numbering}\\ \hline\hline +\verb,\begin{exe}, \ldots \verb,\end{exe},& (1) arabic +(Toplevel)\\ \hline\hline +\verb,\begin{xlist}, \ldots \verb,\end{xlist},& depends on level of +embedding\\ \hline +\verb,\begin{xlista}, \ldots \verb,\end{xlista},& a. alphabetical\\ +\verb,\begin{xlisti}, \ldots \verb,\end{xlisti},& ii. roman\\ +\verb,\begin{xlistn}, \ldots \verb,\end{xlistn},& 3. arabic\\ +\verb,\begin{xlistI}, \ldots \verb,\end{xlistI},& IV. Roman\\ +\verb,\begin{xlistA}, \ldots \verb,\end{xlistA},& E. Alphabetical\\ \hline +\end{tabular} +\end{center} +In all cases, \verb,\label,/\verb,\ref, commands will do The Right +Thing. + +The syntax of \verb,\ex, is as follows: +\bit\verb'\ex' $\Longrightarrow$ a label with running number (e.g., if a +sublist of examples follows). +\bit\verb'\ex ' $\Longrightarrow$ a numbered example. +\bit\verb'\ex[]{}' $\Longrightarrow$ a numbered example + with judgement. + +The space reserved for judgements can be controlled by the command\break +\verb,\judgewidth{},, which sets it to the width of +\verb,, (Default: ``{\tt ??}''). It can be issued in the +preamble to change the +default globally, or within an {\tt exe}-environment for a +local change. + +\paragraph*{In short:} Use \verb"\ex" for all numbered +examples; if they have no optional argument (judgement) + they will be flush left; +if they have {\tt [ ] }'s then there will be a space reserved for +judgements. (NB: In this case you have to +indicate the scope of the example itself with \{\ldots\}'s.) + + +\subsection{Examples with other identifiers} +Sometimes it is necessary not to use running numbers but to specify +the identifier of an example manually as in: +\begin{quote} +\ldots let us now contemplate Chomsky (1981:264, ex.29f): +\begin{exe} +\exi{(29)} \al\lb{INFL} AGR]\lb{VP} V\ldots] +\exi{(30)} + \begin{xlist}[(ii)] + \exi{(i)} \be\lb{VP} V-AGR\ldots] + \exi{(ii)} \be\lb{VP}\lb{VP} V-AGR\ldots] NP] + \end{xlist} +\end{exe} +\end{quote} +For cases like this there is the command \verb'\exi{}' +which works exactly like \verb'\ex': +\bit\verb'\exi{}' $\Longrightarrow$ the identifier as label +\bit\verb'\exi{} ' $\Longrightarrow$ the example + labelled with identifier +\bit\verb'\exi{}[]{}' + $\Longrightarrow$ the judged example,\\ labelled with identifier.\\ + + +So the example above is produced by: + +\pagebreak[2] +\begin{verbatim} +\ldots let us now contemplate Chomsky (1981:264, ex.29f): +\begin{exe} +\exi{(29)} \al\lb{INFL} AGR]\lb{VP} V\ldots] +\exi{(30)} + \begin{xlist}[(ii)] + \exi{(i)} \be\lb{VP} V-AGR\ldots] + \exi{(ii)} \be\lb{VP}\lb{VP} V-AGR\ldots] NP] + \end{xlist} +\end{exe} +\end{verbatim} + +\verb'\exi' can be used to deal with many labelling problems. The +three most commons ones are predefined: +\begin{itemize} +\item Crossreferences (\verb'\exr{