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/linguex/README | 6 + macros/latex/contrib/linguex/doc/linguex-doc.pdf | Bin 0 -> 223895 bytes macros/latex/contrib/linguex/doc/linguex-doc.tex | 593 ++++++++++++++++++++++ macros/latex/contrib/linguex/doc/ps-trees-doc.pdf | Bin 0 -> 48240 bytes macros/latex/contrib/linguex/doc/ps-trees-doc.tex | 305 +++++++++++ macros/latex/contrib/linguex/linguex.sty | 436 ++++++++++++++++ macros/latex/contrib/linguex/linguho.sty | 132 +++++ macros/latex/contrib/linguex/ps-trees.sty | 83 +++ 8 files changed, 1555 insertions(+) create mode 100644 macros/latex/contrib/linguex/README create mode 100644 macros/latex/contrib/linguex/doc/linguex-doc.pdf create mode 100644 macros/latex/contrib/linguex/doc/linguex-doc.tex create mode 100644 macros/latex/contrib/linguex/doc/ps-trees-doc.pdf create mode 100644 macros/latex/contrib/linguex/doc/ps-trees-doc.tex create mode 100644 macros/latex/contrib/linguex/linguex.sty create mode 100644 macros/latex/contrib/linguex/linguho.sty create mode 100644 macros/latex/contrib/linguex/ps-trees.sty (limited to 'macros/latex/contrib/linguex') diff --git a/macros/latex/contrib/linguex/README b/macros/latex/contrib/linguex/README new file mode 100644 index 0000000000..70902eeb3e --- /dev/null +++ b/macros/latex/contrib/linguex/README @@ -0,0 +1,6 @@ +This bundle comprises three packages: + + * The linguex package facilitates the formatting of linguist examples, automatically taking care of example numbering, indentations, indexed brackets, and the '*' in grammaticality judgments. + * The linguho package facilitates making handouts from documents that use linguex for examples + * The ps-trees package provides linguistic trees, building on the macros of tree-dvips , but overcoming some of the older package's shortcomings. + diff --git a/macros/latex/contrib/linguex/doc/linguex-doc.pdf b/macros/latex/contrib/linguex/doc/linguex-doc.pdf new file mode 100644 index 0000000000..ec91a582cf Binary files /dev/null and b/macros/latex/contrib/linguex/doc/linguex-doc.pdf differ diff --git a/macros/latex/contrib/linguex/doc/linguex-doc.tex b/macros/latex/contrib/linguex/doc/linguex-doc.tex new file mode 100644 index 0000000000..ce358c6e02 --- /dev/null +++ b/macros/latex/contrib/linguex/doc/linguex-doc.tex @@ -0,0 +1,593 @@ +%% linguex-doc.tex version 2.1 +%% documentation of linguex.sty version 4.3 +%% Author: Wolfgang.Sternefeld@uni-tuebingen.de +%% Version number updated; minor typos fixed +%% filedate 2013/05/28 +\documentclass{article} +\usepackage{linguex} +%\usepackage{linguho} +%\usepackage[*]{linguho} +\sloppy\raggedbottom +%\addtolength{\alignSubExnegindent}{.7em} +%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} +\title{linguex.sty Documentation} +\author{Wolfgang Sternefeld\\ +Version 4.3 --- May 2013} +\date{} +\maketitle + +\subsection*{Abstract}% +{\tt linguex.sty} is a \LaTeX-tool written for the lazy linguist. Its +handling of example numbering, indentations, indexed brackets, and +grammaticality judgments reduces the effort of formatting linguistic +examples to a minimum. It also allows for automatic extraction of a +handout. + +The macro runs with \LaTeXe\ only and requires two additional +style files: {\tt xspace.sty} from +the base of and {\tt cgloss4e.sty} (a modification of the +midnight gloss macro) for glosses. + +\subsection*{The Three Basic Commands} The linguex macro defines three +basic commands: \verb-\ex.-, \verb-\a.-, and \verb-\b.-. The first +two generate list environments. The third functions basically like an +\verb-\item-. Here is an example. Type setting + +%\begin{samepage} +\begin{verbatim} +\ex. This is the first level of embedding + \a. This is the second level + \b. This is still the second level, but: + \a. This is the third level + \b. This is not the end. + \b. This is the end +\end{verbatim} +will print: + +\ex. This is the first level of embedding + \a. This is the second level + \b. This is still the second level, but: + \a. This is the third level + \b. This is not the end. + \b. This is the end + +%\end{samepage} +The list environment created by \verb-\ex.- must be closed by a single +blank line (a \verb-\par-). The text following this list will not be +indented. In order to get a \verb|\parindent|, a \textit{second} +blank line must be added, immediately following the first. + +The commands \verb-\c.-, \verb-\d.-, \verb-\e.-, and \verb-\f.- are +equivalent copies of \verb-\b.-; they were defined to produce a kind +of WYSIWYG-effect. + +The blank line at the end of \Last simultaneously closes the three +lists of \Last (opened by \verb|\ex.|, \verb|\a.|, and the embedded +\verb|\a.|). To close just one of the embedded lists (introduced by +\verb|\a.|) put \verb-\z.- at the point of transition from +level $n$ of the embedding to level $n-1$. This is exemplified by the +following example: + +%\begin{samepage} +\ex.\a. {\it Government:}\\ + A governs B iff + \a. A is a governor; + \b. A m-commands B; + \c. no barrier intervenes between A and B + \z. + \c. Governors are lexical nodes and tensed I. + \z. + (from Haegeman 1991) + +% +\begin{verbatim} +This is exemplified by the following example: +\ex.\a. {\it Government:}\\ + A governs B iff + \a. A is a governor; + \b. A m-commands B; + \c. no barrier intervenes between A and B + \z. + \b. Governors are lexical nodes and tensed I. + \z. + (from Haegeman 1991) +\end{verbatim}%\end{samepage} +% + +\subsection*{Cross References}% +can be handled by \verb-\label{...}- and \verb-\ref{...}- in the usual +manner. For example, a label between \verb-\ex.- and \verb-\a.- +stores the main example number for further reference; the same command +following \verb-\a.- or \verb-\b.- stores the label of a +(sub-)subexample for further reference. + +For cross references in the immediate vicinity of an example, you need +not \verb|\label| the examples. \verb-\Next- refers to the following +example number, and \verb-\NNext- to the next but one. Reference to +the previous example is provided by \verb-\Last-; the penultimate one +is referred to with \verb-\LLast-. + +These shorthands always refer to the first level of embedding. +Reference to subexamples can only be obtained by adding an (optional) argument +to the above Next- and Last-commands. For example, saying +\verb.\NNext[g-ii]. right now yields \NNext[g-ii]. The dash between +\addtocounter{ExNo}{2}\arabic{ExNo}\addtocounter{ExNo}{-2} and g is +defined as \verb|\firstrefdash|. It can be suppressed by +\verb|\renewcommand{\firstrefdash}{}|. + + +\subsection*{Footnotes}% +Inside a footnote, the \verb-\Next--command presupposes that the next +example is still inside the footnote rather than within the main body +of the document. Say \verb-\TextNext- to refer to the next example within the +main text. (When you intend to make endnotes instead of footnotes, +all cross references from footnote to text must be handled by +\verb-\label{...}- and \verb-\ref{...}-.) + +In case an \verb-\ex.--environment contains a footnote that contains a +\verb-\par- (= a blank line --- this will necessarily be the case with a +footnote containing itself an \verb-\ex.-), the \verb-\par- will be +misinterpreted as the end of the main text example. It is therefore +necessary to split the command \verb-\footnote{...}- into +\verb-\footnotemark- and \verb-\footnotetext{...}- (see +\LaTeX-manual). The footnotetext must be placed outside the +\verb-\ex.--environment of the main text. + +Some style files (e.g. {\tt endnote.sty}) modify the definition of +footnotes (as {\tt linguex.sty} itself does so in order to let \verb|\ex.| know +whether or not it is inside a footnote). Such style files must be +accommodated to {\tt linguex.sty} by making sure that \verb-\if@noftnote- is +set false at the beginning of each footnote (by saying +\verb-\@noftnotefalse- in the modified footnote definition); otherwise +you will get the arabic style of example numberings (as being used in +the main text) rather than the roman numbers (being used inside +footnotes). + + +\subsection*{Glosses}% +require {\tt cgloss4e.sty}, which is input by {\tt linguex.sty}. +Instead of writing \verb.\gll. (as would be required by the gloss +macro), one should append a `g' to the last letter of an example +command, as shown below: + +\begin{samepage}\begin{verbatim} +\ex.\a. No gloss + \bg. This is a first gloss\\ + Dies ist eine erste Glosse\\ + +\exg. Dies ist nicht die erste Glosse\\ + This is not the first gloss\\ +\end{verbatim} +% +\ex.\a. No gloss + \bg. This is a first gloss\\ + Dies ist eine erste Glosse\\ + +\exg. *Dies ist nicht die erste Glosse\\ + This is not the first gloss\\ + +\end{samepage} +Using \verb.\gll. still works in principle, but should be avoided, +for reasons explained in the next section. + + +\subsection*{Grammaticality Judgments}% +composed out of *, ?, \#, and \%, are automatically prefixed at the +very beginning of a new list. A standard example like \Next +looks like this (to increase readability I also removed mathmode from +subscripting): + +\catcode`_=\active +\def_#1{\ifmmode\sb{#1}\else$\sb{#1}$\fi} + +\begin{verbatim} +\catcode`_=\active +\def_#1{\ifmmode\sb{#1}\else$\sb{#1}$\fi} +\exg. \%*Wen_i liebt_k seine_i Mutter t_i t_k?\\ + Whom loves his mother\\ + `Who does his mother love?' +\end{verbatim} +\exg. \%*Wen_i liebt_k seine_i Mutter t_i t_k?\\ + Whom loves his mother\\ + `Who does his mother love?' + +Automatic prefixing implies that \textbf{nothing} intervenes between the list +opening command and the judgment. In particular, labels must {\it +follow\/} the grammaticality judgment! Likewise, writing +\verb|\ex.\gll| instead of \verb|\exg.| will have the effect of not +prefixing the grammaticality judgment. + + +\subsection*{Labelled Brackets}% + \verb-\exi.- identifies ``words'' by looking for space characters + between them; it then checks whether the word following a space + starts with one of the brackets ``['' or ``]''. The material between + such a bracket and the next space character will be subscripted. A + standard example would be the following: +\begin{verbatim} +\exi. *[CP Wen_i [C$'$ liebt_j [IP [NP seine_i Mutter ]% + [VP t_i t_j ]]]] +\end{verbatim} +\exi. *[CP Wen_i [C$'$ liebt_j [IP [NP seine_i Mutter ]% + [VP t_i t_j ]]]] + +Note that above a blank space between {\tt [IP} and {\tt [NP} is +crucial, otherwise the bracket of {\tt [NP} would be subscripted as +well. Note also that a space is required before the grammaticality +judgment, otherwise the beginning of subscripting cannot be properly +identified. + +As with the gloss macro, grouping suppresses subscripting. +Consider the effects of spacing and grouping in \Next: +\begin{verbatim} +\exi.\a. [[NP Fritz ][ snores ]]S + \b. [[NP Fritz][snores]]S + \c. [ [NP Fritz ][snores]]S + \d. [[NP Fritz {][}snores ]]S + \e. {[[+N,--V]} Fritz ][VP snores ] \hfill{} [NP Structure] + \f. *[{}[+N,--V] Fritz ][VP snores ] \hfill [NP-Structure] +\end{verbatim} +\exi.\a. [[NP Fritz ][ snores ]]S + \b. [[NP Fritz][snores]]S + \c. [ [NP Fritz ][snores]]S + \d. [[NP Fritz {][}snores ]]S + \e. {[[+N,--V]} Fritz ][VP snores ] \hfill{} [NP Structure] + \f. *[{}[+N,--V] Fritz ][VP snores ] \hfill [NP-Structure] + +Grouping works the same way as in the gloss macro where it protects +from glossing. E.g., a group such as \verb.{][}. in \Last[d] is +ignored for subscripting so that the following material is protected +from automatic subscripting (but note that something like the opposite +happens in \Last[e] after \verb|\hfill|!). + +Note that commands that look ahead and extend over more than one word +might not work properly unless two or more words are put into a group. +Suppose we are inside an \verb-\exi.--environment and we want to say +something like \verb-\b.[Principle C]-. What will happen? The space +between ``\texttt{e}'' and ``\texttt{C}'' will make the subscripting +device read \verb-\b.[Principle- as a ``word.'' This, unfortunately, +prevents the argument of \verb-\b.- from being interpreted correctly. +Solutions are to write \verb-\b.[Principle~C]-, \verb-\b.[{Principle C}]-, +or \verb-{\b.[Principle C]}-. + +Subscripting outside the \verb|\exi.|-environment can be done by using +\verb-\I- as shown below: + +\medskip +\verb|\I[NP Text| $\Longrightarrow$ \I[NP Text, + + \verb.\I($\alpha$ Text. $\Longrightarrow$ \I({$\alpha$} Text, + + \verb.\I{$\alpha$}NP Text. $\Longrightarrow$ \I{$\alpha$}NP Text, + + \verb.\I{Whom}ACC does John\ldots. $\Longrightarrow$ \I{Whom}ACC + does John\ldots + +\medskip\noindent +For combining glosses with labelled brackets, +say \verb-\exig.- or \verb-\exgi.-. Note that although the +list-generating commands \verb-\ex.- and \verb-\a.- can be combined in +any order, all commands that introduce automatic subscripting can be used +only at the top level, i.e. cannot be embedded!!!. Note also that +$n$ nested \verb-\ex.--commands need $n$ consecutive blank lines +(\verb.\par.s) to properly identify the end of all lists. + +\subsection*{Handouts}% +Since the surface implementation of the list environment does not use +the begin-end-format, style files that suppress printing between the +end and the beginning of certain environments (e.g. {\tt +xcomment.sty}) could unfortunately not be adopted to produce a handout +(I didn't see a way of doing so, probably because I didn't understand +what goes on inside {\tt xcomment.sty}). + +This deficiency might be compensated for by using {\tt linguho.sty}, +which removes all examples and headings (of sections and subsections) +from the \LaTeX-document and stores them in a file whose extension is +.han (namely \textit{jobname}.han). Putting \verb.\makehandout. +somewhere at the end of the document (e.g. before the bibliography) will +print out \textit{jobname}.han at the position of \verb-\makehandout-. If +\verb-\section*{...}- and \verb-\subsection*{...}- should also go into +the handout, say \verb-\usepackage[*]{linguho}-. Use +\verb-\maketitle- to get the title into the handout. + +Note that all of \LaTeX's \verb|\setlength| and \verb|\settowidth| +instructions automatically go into \textit{jobname}.han and are +executed only there. (The main body of text before +\verb-\makehandout- is considered irrelevant, but I didn't find a way +to suppress writing it into the dvi-file. Any help to solve this +problem will be appreciated; note that I am not a \TeX-wizard, only a lazy +linguist). + +In case you have defined \verb.\active. characters (e.g. Umlaut in +German) these will most likely turn out troublesome (i.e. these +commands should normally be protected). For a general solution, +inspect the definition of \verb.\MkOthersSpecial. in {\tt linguho.sty}. +Uncommenting any of the lines there will solve the problem for the +active character contained in the respective line (sometimes it might +in addition be necessary to use {\tt t1enc.sty} or {\tt germanb.sty} instead of +{\tt german.sty}). + + +\subsection*{Customizing Lengths and Margins}% +The user may modify any of the lengths displayed in the following +scheme, which also shows their predefined default values: + +\setlength{\Exlabelwidth}{0pt} +\setlength{\Exlabelsep}{0pt} +\ex. \label{diagramm}\footnotesize\arraycolsep2pt +$\begin{array}[t]{@{}l|l|l|l|l@{}} + \multicolumn{5}{c}{\backslash{\rm Extopsep} \updownarrow + 0.66\backslash{\rm baselineskip}} +\\[1ex] + \underbrace{\backslash\rm Exindent}_{{\rm 0pt}}& + \fbox{$\backslash$\rm Exlabelwidth} + \underbrace{\backslash\rm Exlabelsep}_{{\rm 1.3em}} + & {\rm Text ...} &&\\ + && + \rm a. &\rm Text \ldots & \\ + && \underbrace{\backslash\rm SubExleftmargin}_{{\rm 2.4em}} + &\rm (i) & \rm Text \ldots \\ + && & \underbrace{\backslash\rm SubSubExleftmargin}_{{\rm 2em}} + &\rm\ldots text. \\[2ex] + \multicolumn{5}{c}{\backslash{\rm Extopsep}\updownarrow + 0.66\backslash{\rm baselineskip}} + \end{array}$ + \global\alignSubExtrue + +The value of \verb.\Exlabelwidth. is determined by the width of the +current label. Note that for displaying the table as shown in \Last, +the leftmargin of the list must be zero; accordingly, both +\verb|\Exlabelwidth| and \verb|\Exlabelsep| were set to zero. To +restore all default values of the lenghts shown in \Last +simultaneously, say \verb-\resetExdefaults-. The exact behavior of +\verb.\Exlabelwidth. is explained further below. With some non +standard fonts the default spacing can be defined only +\verb.\AtBeginDocument. (for reasons I do not understand), therefore + the default values for the above lengths are declared + \verb.\AtBeginDocument.. Consequently, any +deviation from the default must be specified +after \verb.\begin{document}. + + +Some journals require a different arrangement of margins, e.g.\ one +which aligns the left edges of examples with the left edges of +subexamples, as shown in \Next and \NNext: + +\resetExdefaults +\addtolength{\Exlabelsep}{.5em}% + \addtolength{\alignSubExnegindent}{.5em} +\ex. \label{align}First example: +\a. Subexample1 + \b. Subexample2 + \a. Subsubexample1 \ldots\global\alignSubExfalse + +\addtolength{\Exlabelsep}{-.5em}% +\addtolength{\alignSubExnegindent}{-.5em}% +By saying \verb.\alignSubExtrue. before \verb.\begin{document}., +the sublabels (a. and b. in \Last) +are given a negative indentation. This is controlled by the lengths +\verb.\alignSubExnegindent. and \verb.\Exlabelsep., +which can be customized by \verb-\setlength-. after \verb.\begin{document}.. + +The spacing between two subsequent examples is defined by +\verb.\Exredux., whose default is \verb.-\baselineskip.. Saying +\verb.\resetExdefaults. returns to all defaults as defined below: +\begin{verbatim} +\newcommand{\resetExdefaults}{% + \setlength{\Exlabelsep}{1.3em}% + \setlength{\Extopsep}{.66\baselineskip}% + \setlength{\SubSubExleftmargin}{2.4em}% + \setlength{\SubExleftmargin}{2em}% + \setlength{\Exindent}{0pt}% + \setlength{\Exlabelwidth}{4em}% + \setlength{\alignSubExnegindent}{\Exlabelsep}% + \ifalignSubEx\addtolength{\Exlabelsep}{.7em}% + \addtolength{\alignSubExnegindent}{.7em}\fi + \setlength{\Exredux}{-\baselineskip}% +} +\end{verbatim} + + +\subsection*{Customizing Labels}% +The labels of the examples are created by the counters \verb-ExNo-, +\verb-SubExNo-, and \verb-SubSubExNo- for the three levels of +embedding respectively; \verb-FnExNo- is used for the first level +inside footnotes. These counters are the default labels of the list +items. They can be changed anywhere in the document, by using +\verb.\setcounter. as usual. + +There are a number of further possibilities to generate labels that differ +from the default. One is to +use \verb-\a.- without embedding it into \verb|\ex.|. This will yield the +expected result, namely a list that uses the \verb|SubEx| counter at +the top-level: + +\a. First line +\b. Second line +\c. Third line + +Moreover, any of the list commands can take an optional +argument, whose specification replaces the default label: + +\begin{samepage} +\a.[{\bf Principle C} (Chomsky{[81]}): ] An R-expression is free only + \a.[$\alpha$)] with respect to potential binders + in A-positions, + \b.[$\beta$)] within the domain of its chain. + +\begin{verbatim} +\a.[{\bf Principle C} (Chomsky{[81]}): ] + An R-expression is free only + \a.[$\alpha$)] with respect to potential binders + in A-positions, + \b.[$\beta$)] within the domain of its chain. + \end{verbatim} +\end{samepage} +% +The optional argument must immediately follow ``.'', so don't leave +space between \verb|\ex.| or \verb|\a.| and ``['' !!!. By contrast, +it will often be the case that an example starts with a (labelled) +bracket like \I[NP . If so, it is obligatory to put a space +between ``.'' and ``['' . + +As illustrated above, the topmost \verb#\a.#-command picks up the +\verb|\Exlabelwidth| of the preceding example. By contrast, using +\verb-\ex.[{\it Principle C} ...]- instead of % +\verb-\a.[{\it Principle C} ...]- has the effect of adjusting the +indentation of the following text to the width of the optional +argument, as shown below: + +\ex.[{\bf Principle C} (Chomsky{[81]}): ] An R-expression is free only + \a.[$\alpha$)] with respect to potential binders + in A-positions, + \b.[$\beta$)] within the domain of its chain. + +Assuming that regular example numbers do not exceed (999), this +departure from the default behavior only occurs for optional arguments +whose width exceeds that of (999). + +Optional arguments can also be used to simulate other environments. +E.g., \LaTeX-style itemizing at the top level can be simulated as follows: +\begin{verbatim} +\ex.[\hfill$\bullet$\hfill] Line 1 +\b. Line 2 +\c. Line 3 +\end{verbatim} +\ex.[\hfill$\bullet$\hfill] Line 1 +\b. Line 2 +\c. Line 3\global\let\oldalph=\alph\global\let\alph=\arabic + +Temporarily redefining \verb.\alph., as shown in the following +example, yields an enumeration: +\begin{verbatim} +\let\oldalph=\alph\let\alph=\arabic +\a. Text 1 +\b. Text 2 +\c. Text 3 \global\let\alph=\oldalph +\end{verbatim} + +\a. Text 1 +\b. Text 2 +\c. Text 3 \global\let\alph=\oldalph\global\alignSubExtrue + +The stylesheet of \textit{English Language +and Linguistics} requires examples of the following form: + +\setlength{\Exlabelsep}{2em} +\exi. +[V [V broke_i $\emptyset$ ][VP the vase [V$'$ t_i into +pieces ]]] + +\ex.\def\SubExLBr{(}\def\SubExRBr{)} +\a. It kept warm + \b. She kept it warm\global\alignSubExfalse + + +Apart form +specifying \verb.\alignSubExtrue. before \verb.\begin{document}. +\Last requires to redefine the brackets of sublabels, as shown below: +\resetExdefaults +\begin{verbatim} +\renewcommand{\SubExLBr}{(} +\renewcommand{\SubExRBr}{)} +\setlength{\Exlabelsep}{2em} +\exi. [V [V broke_i $\emptyset$ ][VP the vase [V$'$ t_i into + pieces~]]] + +\ex.\a. It kept warm + \b. She kept it warm +\end{verbatim}% +In addition, \verb|\renewcommand{\firstrefdash}{}| changes cross +references from eg. \Last[b] to \renewcommand{\firstrefdash}{}\Last[b]. + +The following definitions generate the left (=L) and right (=R) +environments of example numberings in ordinary text, in footnotes, +and in cross-references: + +\begin{verbatim} + \newcommand{\ExLBr}{(} + \newcommand{\ExRBr}{)} + \newcommand{\FnExLBr}{(} + \newcommand{\FnExRBr}{)} + \newcommand{\theExLBr}{(} + \newcommand{\theExRBr}{)} + \newcommand{\theFnExLBr}{(} + \newcommand{\theFnExRBr}{)} + \newcommand{\SubExLBr}{} + \newcommand{\SubExRBr}{.} + \newcommand{\SubSubExLBr}{(} + \newcommand{\SubSubExRBr}{)} +\end{verbatim} +For example, one might want to replace \LLast--\Last with +{\def\theExRBr{}\LLast}--{\def\theExLBr{}\Last} by saying + +\begin{verbatim} +{\renewcommand{\theExRBr}{}\LLast}--{\renewcommand{\theExLBr}{}\Last} +\end{verbatim} + + + +\subsection*{$\backslash$\tt Exlabelwidth}% +By default, the value of \verb.\Exlabelwidth. is determined by the +width of the example numbering. More precisely, for labels between +(1) and (9) the labelwidth is by default the width of the narrowest +number with two digits plus brackets; accordingly, the +actual labelwidth is a bit larger than the natural size of the +label. Digits may differ in size depending on the font in use, so +the calculation is done on the fly. +Similarly, \verb.\Exlabelwidth. has the width of three digits for +\verb-\theExNo-'s between (10) and (99). Finally, +\verb,\Exlabelwidth, has the width of four digits for example numbers +between (100) and (999). For even wider labels (usually specified by +an optional argument, cf. above), the label retains its natural +size. I hope that fonts are cooperative by keeping the difference +between the width of digits minimal. Otherwise you might experience +weird behavior of \verb.\Exlabelwidth. + +Since the space between the \verb.\Exlabelwidth. and the text +remains the same, the transition from (9) to (10) and from (99) +to (100) will cause a change of indentation, which might look +ugly, particularly in handouts. In order to +suppress the default behavior of \verb|\Exlabelwidth|, it must be +assigned a particular length. For example, saying +\verb.\settowidth{\Exlabelwidth}{(110)}. will cause the labelwidth of +all examples from (1) to (99) to be identical. + +Since wide labels should still retain their natural size, the user's +specification of \verb|\Exlabelsep| should not be wider than (1100), +otherwise the default mechanism is still active, and the value of +\verb|\Exlabelsep| is ignored. E.g., saying +\verb|\setlength{\Exlabelwidth}{3em}| will most likely cause the list +declaration to take up its default behavior, because ``3em'' is wider +than ``(1100)''. (The default value of +\verb|\Exlabelwidth| is 4em). + + +\subsection*{cgloss4e.sty} +I found two problems with {\tt cgloss4e.sty}. The first relates to AMS-\TeX. +Writing a translation immediately below the glossed material normally +behaves as one would expect, but with AMS-\TeX the translation becomes +indented, for reasons I do not understand. To remedy this, one has to +(re-)define the list indentation, e.g. as shown below (from \LaTeX): + +\begin{verbatim} +\makeatletter +\def\@listi{\leftmargin\leftmargini + \parsep 5\p@ \@plus2.5\p@ \@minus\p@ + \topsep 10\p@ \@plus4\p@ \@minus6\p@ + \itemsep5\p@ \@plus2.5\p@ \@minus\p@} +\let\@listI\@listi +\@listi +\makeatother +\end{verbatim} +The second problem concerns the use of \verb.\gll. at a position +other than the beginning of a list. Then the gloss starts a new +paragraph and puts unwanted vspace above and below the list. One way +to suppress this is to change the flushleft commands used within +{\tt cgloss4e.sty} into raggedright by saying +\verb.\renewenvironment{flushleft}{\raggedright}{}.. + + +%\makehandout +\end{document} diff --git a/macros/latex/contrib/linguex/doc/ps-trees-doc.pdf b/macros/latex/contrib/linguex/doc/ps-trees-doc.pdf new file mode 100644 index 0000000000..95989955e7 Binary files /dev/null and b/macros/latex/contrib/linguex/doc/ps-trees-doc.pdf differ diff --git a/macros/latex/contrib/linguex/doc/ps-trees-doc.tex b/macros/latex/contrib/linguex/doc/ps-trees-doc.tex new file mode 100644 index 0000000000..25377efa56 --- /dev/null +++ b/macros/latex/contrib/linguex/doc/ps-trees-doc.tex @@ -0,0 +1,305 @@ +%% ps-trees-doc.tex version 2 +%% Author: Wolfgang.Sternefeld@uni-tuebingen.de +%% filedate 99/05/04 +\documentclass{article} +\usepackage{ps-trees} +\parindent0pt\sloppy +\parskip\bigskipamount +\raggedbottom +%\overfullrule2pt + +\begin{document} +\title{ps-trees.sty Documentation} +\author{Wolfgang Sternefeld\\ + Version 2 --- May 1998} +\maketitle + +Experimenting with a number of tree-macros I found that complex +real-life examples often lead to problems with controlling the +positioning of nodes in a tree. I therefore decided to use +tree-dvips.sty (by Emma Pease), where the user has full control +over the position of nodes by putting them into a table. The present +macro inputs tree-dvips.sty and presupposes knowledge of its +node-commands. + +One of the shortcomings of tree-dvips.sty is that it does not control +the correct use of the names for nodes. This means that in case of a +user error, no warning will appear and no output will be printed. +The basic idea of the present macro is to regain control +over the use of names by using them as an encoding of the structure of +a tree. More specifically, for a node named $x$ to be connected with +a node named $y$ (i.e. $x$ and $y$ are the first arguments of the +command \verb|\node|) $y$ must have the form $cx$, where $x$ and $y$ +are strings of characters and $c$ is exactly one character. For +ordinary branching trees, this makes the specification of +\verb.\nodeconnect{#1}{#2}. superfluous. Consider the following +example and compare the printed file with the .tex-source of this +file: + +\begin{treetab}{*4c} + &\Node{}{IP} \\[3ex] +\Node{l}{D} & &\Node{r}{VP}\\[3ex] +\Node{ml}{She}&\Node{lr}{V} & &\Node{rr}{D}\\[3ex] + &\Node{mlr}{exonerated}& &\Node{mrr}{him} +\end{treetab} +% +\hspace*{\fill} +\begin{minipage}{.7\textwidth} +\begin{verbatim} +\begin{treetab}{*4c} +&\Node{}{IP}\\[3ex] +\Node{l}{D}&&\Node{r}{VP}\\[3ex] +\Node{ml}{She}&\Node{lr}{V}&&\Node{rr}{D}\\[3ex] +&\Node{mlr}{exonerated}&&\Node{mrr}{him} +\end{treetab} +\end{verbatim} +\end{minipage}\hfill +% + +\verb.\begin{treetab}. is defined in terms of \verb.\begin{tabular}.. +The actual execution of the node connections (based on the node names +as specified by the first argument of \verb|\Node|) is performed as a part of +\verb.\end{treetab}.. In case a node cannot be interpreted as a node +in a tree, a warning will be typed out. + +The remaining problem is to gain control over the width of columns in +a table. This is often tedious, but the effort seems worthwhile as +evidenced by the poor results of macros that calculate the position of +nodes automatically. Being essentially an aesthetic problem, the +present macro offers only limited support towards a uniform solution. +The following, however, might be helpful. + +First of all, the effects of \verb.\tabcolsep. and \verb.\nodemargin. +on a precise positioning of nodes are disturbing, so both values are +set to zero by \verb.\begin{treetab}.. In order to achieve a minimum +of symmetry of branchings, a first idea would be that all rows should +have the same width, implying that the width of each node should be +determined by the widest leave. Since individual nodes that come +later in a table might determine the size of previous nodes, it might +be a good idea to put all relevant nodes (by default: all leaves) into +boxes before starting the table. The minimal size of all nodes (or +columns) can then be determined by the command \verb.\NodeWidthNo{n}., +where $n$ is the number of the box, whose width should become the +minimal width of all other columns. \verb.\NodeWidthNo. is defined +as follows: +\begin{verbatim} +\newcommand{\NodeWidthNo}[1]{\setlength{\MinNodeWidth}{\the\wd#1}} +\end{verbatim} +The length \verb|\MinNodeWidth| will subsequently be used to +determine the minimal width of each node. (In order to give an +individual node the width of a particular prespecified box +$n$, the node command can take an optional argument +\verb|\Node[n]{...}{...}|). + +For example, if we let the word \textit{exonerate} determine the size +of all nodes, the result is the following: + +\begin{verbatim} +\setbox1=\hbox{She} +\setbox2=\hbox{exonerated} +\setbox3=\hbox{him} +\NodeWidthNo2 +% +\begin{treetab}{*4c} +&\Node{}{IP}\\[3ex] +\Node{l} {DP}&&\Node{r}{VP}\\[3ex] +\NodeNo1{ml}&\Node{lr}{V}&&\Node{rr} {DP}\\[3ex] +&\NodeNo2{mlr}&&\NodeNo3{mrr} +\end{treetab} +\end{verbatim} +\setbox1=\hbox{She} +\setbox2=\hbox{exonerated} +\setbox3=\hbox{him} +\NodeWidthNo2 +% +\begin{treetab}{*4c} +&\Node{}{IP}\\[3ex] +\Node{l} {DP}&&\Node{r}{VP}\\[3ex] +\NodeNo1{ml}&\Node{lr}{V}&&\Node{rr} {DP}\\[3ex] +&\NodeNo2{mlr}&&\NodeNo3{mrr} +\end{treetab} + +But now the space between box2 and box3 might strike one as too wide, +being seperated by the box of the VP. One possibility would be to +specify VPs node as \verb|\Node[0]{r}{VP}| which puts VP into a box +whose width is \verb|\wd0|, which is zero because box0 has not yet +been used. A more general way would be to place the VP node right +into the middle between two columns. This saves us one column in the +table; the command \verb.\NodeZ. makes a box of width zero and puts it +at the right edge of a column (i.e. ``between'' two columns): % +\begin{verbatim} +\begin{treetab}{ccc} +&\Node{}{IP}\\[3ex] +\Node{l} {DP}&\NodeZ{r}{VP}\\[3ex] +\NodeNo1{ml}&\Node{lr}{V}&\Node{rr} {DP}\\[3ex] +&\NodeNo2{mlr}&\NodeNo3{mrr} +\end{treetab} +\end{verbatim} +\setbox1=\hbox{She} +\setbox2=\hbox{exonerated} +\setbox3=\hbox{him} +\NodeWidthNo2 +% +\begin{treetab}{ccc} +&\Node{}{IP}\\[3ex] +\Node{l} {DP}&\NodeZ{r}{VP}\\[3ex] +\NodeNo1{ml}&\Node{lr}{V}&\Node{rr} {DP}\\[3ex] +&\NodeNo2{mlr}&\NodeNo3{mrr} +\end{treetab} + +But now we got an asymmetry of the branches at the top level, which +can be fixed by shifting the IP to the left. This can be done by +replacing \verb|\Node{}{IP}| by \verb|\NodeZ{}{IP}\hspace*{0.75\wd2}|: + +\setbox1=\hbox{She} +\setbox2=\hbox{exonerated} +\setbox3=\hbox{him} +\NodeWidthNo2 +\begin{treetab}{ccc} +&\NodeZ{}{IP}\hspace*{0.75\wd2}\\[3ex] +\Node{l} {DP}&\NodeZ{r}{VP}\\[3ex] +\NodeNo1{ml}&\Node{lr}{V}&\Node{rr} {DP}\\[3ex] +&\NodeNo2{mlr}&\NodeNo3{mrr} +\end{treetab} + +For larger trees these asymmetries have to be levelled out +consecutively, as shown in the next tree (an example from real life): + +%%%%%%%%%%%%%%%%%%%%%%%%% +\let\N=\Node +\let\NZ=\NodeZ +\let\NNo=\NodeNo +\let\NTNo=\NodeTNo +\let\MNW=\MinNodeWidth +%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\End}{\\[4ex]} +\newcommand{\trivtab}[2]{\hbox{\begin{tabular}[t]{@{}c@{}}#1\\ + #2\end{tabular}}} +\newcommand{\twotab}[2]{\hbox{\begin{tabular}[t]{@{}ll@{}}#1\\ + #2\end{tabular}}} +% +\tabcolsep2pt +\setbox0=\twotab{mit & wem$_i$}{with & who} +\setbox1=\trivtab{glaubst}{think} +\setbox2=\trivtab{du}{you} +\setbox3=\hbox{t$_j$} +\setbox4=\hbox{t$_i$} +\setbox5=\trivtab{dass}{that} +\setbox6=\trivtab{Maria}{Maria} +\setbox7=\hbox{t$_i$} +\setbox8=\twotab{gesprochen & hat}{spoken & has} + +% +\NodeWidthNo1% +\newcommand{\adjustA}{\hspace*{.75\MNW}} +\newcommand{\adjustB}{\hspace*{.625\MNW}} +\newcommand{\adjustC}{\hspace*{.5625\MNW}} +\newcommand{\adjustD}{\hspace*{.53125\MNW}} +\newcommand{\adjustE}{\hspace*{.515625\MNW}} +% +\begin{treetab}{*9{c}} +\rlap{\hspace*{.25\wd0}\adjustA\makebox[0pt]{\N{}{CP}}}\End +\N{l}{Spec}&&\N{r}{C$'$}\End +\NTNo0{ml}&\N{lr}{C$^0$}&&\N{rr}{IP}\End +&\NNo1[6]{mlr}&\N{lrr}{DP}&&\NZ{rrr}{V}\adjustE\End +&&\NNo2{mlrr}&\N{lrrr}{V}&&\NZ{rrrr}{CP}\adjustD\End +&&&\NNo3{mlrrr}&\N{lrrrr}{Spec}&&\NZ{rrrrr}{C$'$}\adjustC\End +&&&&\NNo4{mlrrrr}&\N{lrrrrr}{C$^0$}&&\NZ{rrrrrr}{IP}\adjustB\End +&&&&&\NNo5{mlrrrrr}&\N{lrrrrrr}{DP}&&\NZ{rrrrrrr}{V}\adjustA\End +&&&&&&\NNo6{mlrrrrrr}&\N{lrrrrrrr}{PP}&\hspace{\wd1}\NZ{rrrrrrrr}{V}\End +&&&&&&&\NNo7{mlrrrrrrr}&\NodeTZNo8{mrrrrrrrr} +\end{treetab} + +We first define a number of shortcuts which will keep the table +managable: +\begin{verbatim} +\let\N=\Node +\let\NZ=\NodeZ +\let\NNo=\NodeNo +\let\NTNo=\NodeTNo +\let\MNW=\MinNodeWidth +\newcommand{\adjustA}{\hspace*{.75\MNW}} +\newcommand{\adjustB}{\hspace*{.625\MNW}} +\newcommand{\adjustC}{\hspace*{.5625\MNW}} +\newcommand{\adjustD}{\hspace*{.53125\MNW}} +\newcommand{\adjustE}{\hspace*{.515625\MNW}} +\newcommand{\End}{\\[4ex]} +\newcommand{\trivtab}[2]{\hbox{\begin{tabular}[t]{@{}c@{}}#1\\ + #2\end{tabular}}} +\newcommand{\twotab}[2]{\hbox{\begin{tabular}[t]{@{}ll@{}}#1\\ + #2\end{tabular}}} +\end{verbatim} +% +Next we put all leaves into boxes: +\begin{verbatim} +\tabcolsep2pt +\setbox0=\twotab{mit & wem$_i$}{with & who} +\setbox1=\trivtab{glaubst}{think} +\setbox2=\trivtab{du}{you} +\setbox3=\hbox{t$_j$} +\setbox4=\hbox{t$_i$} +\setbox5=\trivtab{dass}{that} +\setbox6=\trivtab{Maria}{Maria} +\setbox7=\hbox{t$_i$} +\setbox8=\twotab{gesprochen & hat}{spoken & has} +\end{verbatim} +And finially we specify the minimal node width and construct the table: +\begin{small}\begin{verbatim} +\NodeWidthNo1 +\begin{treetab}{*9{c}} +&\N{}{CP}\End +\N{l}{Spec}&&\N{r}{C$'$}\End +\NTNo0{ml}&\N{lr}{C$^0$}&&\N{rr}{IP}\End +&\NNo1[6]{mlr}&\N{lrr}{DP}&&\NZ{rrr}{V}\adjustE\End +&&\NNo2{mlrr}&\N{lrrr}{V}&&\NZ{rrrr}{CP}\adjustD\End +&&&\NNo3{mlrrr}&\N{lrrrr}{Spec}&&\NZ{rrrrr}{C$'$}\adjustC\End +&&&&\NNo4{mlrrrr}&\N{lrrrrr}{C$^0$}&&\NZ{rrrrrr}{IP}\adjustB\End +&&&&&\NNo5{mlrrrrr}&\N{lrrrrrr}{DP}&&\NZ{rrrrrrr}{V}\adjustA\End +&&&&&&\NNo6{mlrrrrrr}&\N{lrrrrrrr}{PP}&\hspace{\wd1}\NZ{rrrrrrrr}{V}\End +&&&&&&&\NNo7{mlrrrrrrr}&\NodeTZNo8{mrrrrrrrr} +\end{treetab} +\end{verbatim}\end{small} + +Note that box0 is wider than box1, therefore the root should not be in +the middle of box1 but should appear +exactly in the middle between box0 and box2. We therefore have to +replace the first line of the table by +\begin{verbatim} +\rlap{\hspace*{.25\wd0}\adjustA\makebox[0pt]{\N{}{CP}}}\End +\end{verbatim} + + +Here is another real life example from phonology: + +\setbox1=\hbox{mn} +\NodeWidthNo1 +\begin{treetab}[t]{*4c} +\nodeZ{l}{$\sigma$}&&\nodeZ{r}{$\sigma$}\End +\Node{ll}{V}&\Node{rl}{C}\nodeZ{xx}{=}&\Node{gr}{C}&\Node{lr}{V}\End +\Node{mll}{e}&\NodeZ{mrl}{b}&&\Node{mlr}{e} +\end{treetab} +\nodeconnect{gr}{mrl} + +The main point to be observed is that the first line cannot contain +\verb|\Node|'s (but must contain \verb|\node|'s), otherwise the macro +will complain that it cannot find the root of a tree: + +\begin{verbatim} + \setbox1=\hbox{mn} +\NodeWidthNo1 +\begin{treetab}[t]{*4c} +\nodeZ{l}{$\sigma$}&&\nodeZ{r}{$\sigma$}\End +\Node{ll}{V}&\Node{rl}{C}\nodeZ{xx}{=}&\Node{gr}{C}&\Node{lr}{V}\End +\Node{mll}{e}&\NodeZ{mrl}{b}&&\Node{mlr}{e} +\end{treetab} +\nodeconnect{gr}{mrl} + +\end{verbatim} +One final warning: It seems to me that \TeX\ internally uses certain +boxes to construct its tables. This means that the width of a box +might have changed by \TeX\ internally to zero before you come to the +point where you want to use the lenght prespecified by \verb|\setbox|. It +might therefore be necessary to store this lenght as soon as possible; +e.g. by saying \verb|\NodeWidthNo{n}| immediately after having defined +\verb|\setboxn|. +\end{document} \ No newline at end of file diff --git a/macros/latex/contrib/linguex/linguex.sty b/macros/latex/contrib/linguex/linguex.sty new file mode 100644 index 0000000000..18e34222d8 --- /dev/null +++ b/macros/latex/contrib/linguex/linguex.sty @@ -0,0 +1,436 @@ +%% Copyright 1996-2013 by Wolfgang Sternefeld +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%% linguex.sty version 3.3, revised 2000/12/22, compatability with +%% lucida fonts: Defaults defined \AtBeginDocument +%% linguex.sty version 3.4, revised 2001/04/30, corrected vspacing for +%% \ex. embedded in \a. +%% linguex.sty version 3.5, revised 2002/01/26, corrected hspacing for +%% \alignSubEx +%% linguex.sty version 3.6, revised 2008/03/20, \lessthanten, +%% \lessthanhundred, and \lessthanthousand redefined due to problems +%% with kerning in fonts +%% linguex.sty version 3.7, revised 2008/06/30, \lessthanten, +%% \lessthanhundred, and \lessthanthousand redefined due to problems +%% with kerning in fonts +%% linguex.sty version 3.7a, revised 2009/09/02, replaced hard-coded +%% example format with \theExNo +%% linguex.sty version 4.0 replaces hard-coded brackets with +%% predefined commands +%% linguex.sty version 4.1 replaces \refstepcounter by \stepcounter +%% for internal counters +%% linguex.sty version 4.2 replaces \rm by \textrm in definition of +%% \stripoffbr; undoes the change in version 4.0 from .66\baselineskip to +%% \Extopsep; renews definition of \label AtBeginDocument +%% linguex.sty version 4.3 removes code that caused problems with beamer; adds +%% a \ProvidesPackage line to keep track of versions better +%% Author: Wolfgang.Sternefeld@uni-tuebingen.de +%% status: maintained +%% filedate May 28th 2013 + +\ProvidesPackage{linguex}[2013/05/28 Example formatting for linguistics v. 4.3] +\RequirePackage{xspace,cgloss4e} +%%%%%%%%%%%%%%%%%%% FOOTNOTES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% to let \ex. know whether or not it is in a footnote +\newif\if@noftnote\@noftnotetrue +\let\predefinedfootnotetext=\@footnotetext +\long\def\@footnotetext#1{\@noftnotefalse\predefinedfootnotetext{#1}% + \@noftnotetrue} +% +%%%%%%%%%%%%%%% COUNTERS FOR LABELLING %%%%%%%%%%%%%%%%%%%%%%%%%%% +\@ifundefined{chapter}{\newcounter{ExNo}}{\newcounter{ExNo}[chapter]} +\newcounter{SubExNo}[\if@noftnote ExNo\else FnExNo\fi] +\newcounter{SubSubExNo}[SubExNo] +\newcounter{FnExNo}[footnote] +\newcounter{ABC} +\newcommand{\ExLBr}{(}%added in version 4.0 +\newcommand{\ExRBr}{)}%added in version 4.0 +\newcommand{\FnExLBr}{(}%added in version 4.0 +\newcommand{\FnExRBr}{)}%added in version 4.0 +\newcommand{\theExLBr}{(}%added in version 4.0 +\newcommand{\theExRBr}{)}%added in version 4.0 +\newcommand{\theFnExLBr}{(}%added in version 4.0 +\newcommand{\theFnExRBr}{)}%added in version 4.0 +\renewcommand{\theExNo}{\theExLBr\arabic{ExNo}\theExRBr}%modified in version 4.0 +\renewcommand{\theFnExNo}{\theFnExLBr\roman{FnExNo}\theFnExRBr}%removed in version 4.0 +\newcommand{\firstrefdash}{-} +\newcommand{\secondrefdash}{-} +\newcommand{\SubExLBr}{} +\newcommand{\SubExRBr}{.} +\newcommand{\SubSubExLBr}{(} +\newcommand{\SubSubExRBr}{)} +\newcommand{\Exarabic}{\arabic}%added in version 4.0 +\newcommand{\Exalph}{\alph}%added in version 4.0 +\newcommand{\Exroman}{\roman}%added in version 4.0 +% Modification in version 4.0: hard wired brackets replaced by +% commands defined above: +\renewcommand{\theSubExNo}{\hbox{\if@noftnote\theExLBr\Exarabic{ExNo}\firstrefdash + \Exalph{SubExNo}\theExRBr\else +\theFnExLBr\Exroman{FnExNo}\firstrefdash\Exalph{SubExNo}\theFnExRBr\fi}} +\renewcommand{\theSubSubExNo}{% + \hbox{\if@noftnote\theExLBr\Exarabic{ExNo}\firstrefdash\Exalph{SubExNo}\secondrefdash + \Exroman{SubSubExNo}\theExRBr% + \else\theFnExLBr\Exroman{FnExNo}\firstrefdash + \Exalph{SubExNo}\secondrefdash\Exarabic{SubSubExNo}\theFnExRBr\fi}}% +% +%%%%%%%%%%%%%% LENGTHS FOR SPACING %%%%%%%%%%%%%%%%%%%%%%%%%% +\newlength{\currentlabel} +\newlength{\lessthanten} +\newlength{\lessthanhundred} +\newlength{\lessthanthousand} +\newlength{\@Exleftmargin} +\newlength{\Exlabelwidth} +\newlength{\Extopsep} +\newlength{\Exindent} +\newlength{\SubExleftmargin} +\newlength{\SubSubExleftmargin} +\newlength{\Exlabelsep} +\newlength{\alignSubExnegindent} +\newlength{\Exredux} +\newif\ifalignSubEx +\newcommand{\resetExdefaults}{% + \setlength{\Exlabelsep}{1.3em}% + \setlength{\Extopsep}{.66\baselineskip}% + \setlength{\SubSubExleftmargin}{2.4em}% + \setlength{\SubExleftmargin}{2em}% + \setlength{\Exindent}{0pt}% + \setlength{\Exlabelwidth}{4em}% + \setlength{\alignSubExnegindent}{\Exlabelsep}% + \ifalignSubEx\addtolength{\Exlabelsep}{.7em}% + \addtolength{\alignSubExnegindent}{.7em}\fi + \setlength{\Exredux}{-\baselineskip}% + } +\AtBeginDocument{\resetExdefaults} +%%% +\newlength\digitwidth%added-3.7 +\newlength\mindigitwidth%added-3.7 +\newcommand{\minimalwidth}[1]{\settowidth{\digitwidth}{#1}%added-3.7 +\ifdim\digitwidth<\mindigitwidth\mindigitwidth\digitwidth\fi}%added-3.7 +% +%%%%%%%%%%%%%%%%%%% DEFINITION OF \ex. %%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifembedded +\newif\ifExWarning +\newcounter{ExDepth} +\newcounter{TempExDepth}\setcounter{TempExDepth}{0} +\def\trivex.#1\par{\ifdim\lastskip=.66\baselineskip\vspace{\Exredux}\fi + \begin{list}{}{\leftmargin\z@% + \labelwidth\z@\labelsep\z@\partopsep\z@\topsep\Extopsep}% + \item{}#1% + \stepcounter{ExDepth}\ExEnd}%refstepcounter replaced +\def\ex.#1\par{% + \ifnum\theExDepth>0 \setcounter{TempExDepth}{\theExDepth}% + \setcounter{ExDepth}{0} + \embeddedtrue\fi + \ifembedded\else + \ifdim\lastskip=.66\baselineskip\vspace{\Exredux}\fi + \fi + \stepcounter{ExDepth}%%refstepcounter replaced + \my@ifnextchar[{\OptArgEx}{\ifindex\expandafter\lookforwords\fi + \NormalEx\testforgramm}% + #1% + \addtocounter{ExDepth}{\theTempExDepth}\setcounter{TempExDepth}{0}% + \embeddedfalse\global\ExWarningfalse\ExEnd} +\newcommand{\NormalEx}{\ifExWarning + \PackageWarning{linguex}{Check example numbering (screwed up?), + check number of empty lines at end of examples. + Detected}\fi\ExWarningtrue + \if@noftnote\refstepcounter{ExNo}% + \Exformat[\ExLBr\Exarabic{ExNo}\ExRBr]% + \else + \refstepcounter{FnExNo}\Exformat[\FnExLBr\Exroman{FnExNo}\FnExRBr]% + \fi} +\def\OptArgEx[#1]{\Exformat[#1]\expandafter\testforgramm\ifindex\expandafter + \lookforwords\fi} +\def\philarge{4\mindigitwidth} +\def\philmiddle{3\mindigitwidth} +\def\philsmall{2\mindigitwidth} +%%%%%%%%%%%%%%% +\newcommand{\phlabelwidth}[1]{% + \renewcommand{\philarge}{#1}% + \renewcommand{\philmiddle}{#1}% + \renewcommand{\philsmall}{#1}} +\newcommand{\phlabeldefault}{% + \renewcommand{\philarge}{4\mindigitwidth}% + \renewcommand{\philmiddle}{3\mindigitwidth}% + \renewcommand{\philsmall}{2\mindigitwidth}} +\newcommand{\ExEnd}{% + \ifnum\theExDepth=0\global\unembeddedfalse\else% + \end{list}\addtocounter{ExDepth}{-1}\ExEnd\fi} +\newcommand{\listdecl}{\parsep\z@\itemsep\z@\partopsep\z@\labelsep\z@% + \@Exleftmargin\z@% + \settowidth{\digitwidth}{0}\mindigitwidth\digitwidth%modified-3.7 + \minimalwidth{1}%modified-3.7 + \minimalwidth{2}% + \minimalwidth{3}% + \minimalwidth{4}% + \minimalwidth{5}% + \minimalwidth{6}% + \minimalwidth{7}% + \minimalwidth{8}% + \minimalwidth{9}% + \settowidth{\lessthanthousand}{\ExLBr\hbox to \philarge{}\ExRBr}%modified-3.7,4.0 + \ifdim\currentlabel<\lessthanthousand\leftmargin\Exlabelsep + \ifdim\lessthanthousand<\Exlabelwidth\Exlabelwidth\Exlabelsep% + \settowidth{\lessthanten}{\ExLBr\hbox + to \philsmall{}\ExRBr}%modified-3.7 + \settowidth{\lessthanhundred}{\ExLBr\hbox to + \philmiddle{}\ExRBr}%modified-3.7 + \ifdim\currentlabel<\lessthanten\leftmargin\lessthanten% + \else + \ifdim\currentlabel<\lessthanhundred\leftmargin\lessthanhundred% + \else + \ifdim\currentlabel<\lessthanthousand\leftmargin\lessthanthousand% + \fi\fi\fi\fi + \else + \Exlabelwidth\z@ + \fi% + \@Exleftmargin\Exlabelwidth + \labelwidth\leftmargin + \ifembedded\relax\else + \addtolength{\Exlabelwidth}{\Exindent} + \fi + \addtolength{\leftmargin}{\Exlabelwidth}% + \addtolength{\labelwidth}{\@Exleftmargin}% +} +\def\Exformat[#1]{% + \settowidth{\currentlabel}{#1}% + \begin{list}{\makebox[\labelwidth][l]{#1}}{% + \setlength{\leftmargin}{\currentlabel}% + \listdecl% + \if@noftnote\relax\else\addtolength{\topsep}{-.5\topsep}\fi + \ifembedded\topsep=.3\Extopsep\else\topsep=\Extopsep\fi + }% + \ifindex\firstwordtrue\fi\item{}} +% +%%%%%%%% the `[' of OPTIONAL ARGUMENTS must immediately follow \ex. %%%%%% +%%%% redefinition of \@ifnextchar that does NOT ignore spaces %%%%%%%%%%% +\def\my@ifnextchar#1#2#3{\let\reserved@d=#1% + \def\reserved@a{#2}\def\reserved@b{#3}% + \futurelet\@let@token\my@ifnch} +\def\my@ifnch{\ifx\@let@token\@sptoken% + % \let\reserved@c\@xifnch + \let\reserved@c\reserved@b% + \else + \ifx\@let@token\reserved@d% + \let\reserved@c\reserved@a% + \else + \let\reserved@c\reserved@b% + \fi\fi + \reserved@c}% cf. definition of \@ifnextchar in latex2e.ltx %% +% +%%%%%%%%%%%%%% PROCESSING OF GRAMMATICALITY JUDGMENTS %%%%%%%%%%%%% +\newtoks\CollectTokens +\newcommand\AddInfo[1]{\expandafter\expandafter\expandafter + \CollectTokens\expandafter{% + \the\CollectTokens#1}} +\def\testforgramm{\GTest{}{\printGramm}} +\def\printGramm{\makebox[0pt][r]{\normalfont\the\CollectTokens}\ignorespaces} +\def\GTest#1#2{% + \def\TestForGramm{\CollectTokens={}% + \@ifnextchar *{\AddInfo{*}\@firstoftwo\recTestForGramm}{% + \@ifnextchar ?{\AddInfo{\char63}\@firstoftwo\recTestForGramm}{% + \@ifnextchar \#{\AddInfo{\#}\@firstoftwo\recTestForGramm}{% + \@ifnextchar \%{\AddInfo{\%}\@firstoftwo\recTestForGramm}% + {#1}}}}}% + \def\recTestForGramm{\@ifnextchar *{\AddInfo{*}\@firstoftwo% + \recTestForGramm}{% + \@ifnextchar ?{\AddInfo{\char63}\@firstoftwo\recTestForGramm}{% + \@ifnextchar \#{\AddInfo{\#}\@firstoftwo\recTestForGramm}{% + \@ifnextchar \%{\AddInfo{\%}\@firstoftwo\recTestForGramm}% + {#2}}}}}% + \TestForGramm} +% +%%%%%%%%%%%%%%%% SUBLISTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifunembedded +\newcommand{\SubExlabel}{\SubExLBr\Exalph{SubExNo}\SubExRBr} +\def\a.{\ifindex\firstwordtrue\fi + \ifnum\theExDepth=0 \unembeddedtrue + \trivex.\fi + \stepcounter{ExDepth}%refstepcounter replaced + \begin{list}{\makebox[\labelwidth][l]{% + \ifnum\theExDepth=1 \SubExLBr\Exalph{ABC}\SubExRBr% + \else + \ifnum\theExDepth=2 % + \ifdim\currentlabel<\lessthanthousand% + \ifalignSubEx + \llap{\hbox to \alignSubExnegindent{\ifunembedded% + \SubExLBr\Exalph{SubExNo}\SubExRBr + \else\SubExlabel\fi\hss}}% + \else\SubExlabel\fi% + \else\ifunembedded% + \SubSubExLBr\Exroman{SubExNo}\SubSubExRBr + \else\SubExlabel\fi\fi + \else + \ifnum\theExDepth=3 % + \if@noftnote%\ifunembedded\mbox{$\bullet$!}\else + \SubSubExLBr\Exroman{SubSubExNo}\SubSubExRBr + %\fi + \else\Exarabic{SubSubExNo}\SubSubExRBr\fi + \fi\fi\fi}}% + {\labelsep\z@ + \ifnum\theExDepth=2\topsep .3\Extopsep\else\topsep 0pt\fi + \parsep\z@\itemsep\z@ + \ifnum\theExDepth=1 % + \usecounter{ABC}% + \settowidth{\currentlabel}{\ExLBr\Exarabic{ExNo}\ExRBr}% + \listdecl% + \else + \ifnum\theExDepth=2 % + \usecounter{SubExNo}% + \ifalignSubEx\ifdim\currentlabel<\lessthanthousand% + \leftmargin\z@\else\leftmargin=\SubExleftmargin\fi% + \else\leftmargin=\SubExleftmargin\fi% + \else + \ifnum\theExDepth=3 \usecounter{SubSubExNo}\fi + \leftmargin=\SubSubExleftmargin% + \fi + \labelwidth=\leftmargin% + \fi}% + \ifnum\theExDepth=1 \setlength{\Exlabelwidth}{4em}\fi% + %previous line added 2000/12/22 + \b.} +% +%%%%%%%%%%%%%%%%% ITEMS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\newExitem[#1]{\ifnum\theExDepth=2 % + \ifdim\currentlabel<\lessthanthousand% + \ifalignSubEx + \item[\llap{\hbox to \alignSubExnegindent{#1\hfill}}]% + \else + \item[#1\hfill]\fi + \else\item[#1\hfill]% + \fi + \else\item[#1\hfill]% + \fi\testforgramm} +\let\oldb=\b +\DeclareRobustCommand{\b}{\@ifnextchar.{\newb}{\oldb}} +\def\newb.{\ifindex\firstwordtrue\fi + \my@ifnextchar[{\newExitem}{\item\testforgramm}} +\let\oldc=\c +\DeclareRobustCommand{\c}{\@ifnextchar.{\b}{\oldc}} +\let\oldd=\d +\DeclareRobustCommand{\d}{\@ifnextchar.{\b}{\oldd}} +\let\e=\b +\let\f=\b +\def\z.{\end{list}\addtocounter{ExDepth}{-1}} +% +%%%%%%%%%%%%%%%%%%%% INDEXED BRACKETS %%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifindex +\newif\iffirstword +\def\I#1#2 {#1\labelBr#2 } +\def\exi.#1\par{\indextrue\ex.#1 | blabla | \indexfalse\par} +\def\ai.#1 \par{\indextrue + \a.#1 | blabla | + \par + \indexfalse} +\def\finish|#1|{\ExEnd} +\newcommand{\testGrAndBr}{\GTest{}{\printGramm\checkforbr}} +\def\doaword#1 {% + \iffirstword\firstwordfalse\expandafter\testGrAndBr\fi% + #1 + \ifgloss\expandafter\checkforbrorstar\else + \expandafter\lookforwords\fi} +\newcommand{\checkforbrorstar}{\GTest{\checkforbr}{\printGramm\checkforbr}} +\newcommand{\lookforwords}{\@ifnextchar]{\firstwordfalse\@aber}% + {\@ifnextchar[{\firstwordfalse\@aber}% + {\@ifnextchar|{\firstwordfalse\finish}{\doaword}}}} +\def\labelBr#1 {\mbox{$\hspace{.05em}_{\mbox{\scriptsize\rm#1}}$} } +\newcommand{\jetzt}{\my@ifnextchar[{\@aber}{\my@ifnextchar]{\@aber}% + {\@schnell}}} +\def\@aber#1#2 {#1\jetzt#2 } +\def\@schnell#1 {\labelBr#1 \lookforwords} +\newcommand{\checkforbr}{\@ifnextchar[{\recurseonbr}% + {\@ifnextchar]{\recurseonbr}{}}} +\newcommand{\recurseonbr}{\my@ifnextchar[{\stripoffbr}% + {\my@ifnextchar]{\stripoffbr}{\labelBr}}} +\def\stripoffbr#1#2 {\textrm{#1}\recurseonbr#2 }%\rm changed to \textrm +% +%%%%%%%%%%%%%%%%%%%% GLOSSES %%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifgloss +%%% modification of cgloss4e %%%% +\def\getwords(#1,#2)#3 #4\\% #1=linebox, #2=\each, #3=1st word, #4=remainder + {\setbox#1=\vbox{\hbox{#2\strut\ifindex\expandafter\checkforbr\fi#3 }% + \unvbox#1}% + \def\more{#4}% + \ifx\more\empty\let\more=\donewords + \else\let\more=\getwords + \fi + \more(#1,#2)#4\\% + } +\def\gl@stop{{\hskip -\glossglue}\unhbox\gline\end{flushleft}% + \global\glossfalse% + \ifindex\expandafter\lookforwords\fi {} } +%%% +\newcommand{\newgll}{\glosstrue\GTest{\gll}{\gll\printGramm}} +\def\exg.{\my@ifnextchar[{\newglossex}{\ex.\newgll}} +\def\newglossex[#1]{\ex.[#1]\newgll} +\def\ag.{\my@ifnextchar[{\newglossa}{\a.\newgll}} +\def\newglossa[#1]{\a.[#1]\newgll} +\def\newglossitem[#1]{\ifalignSubEx%\ifdim\currentlabel<\lessthanthousand% + \item[\llap{\hbox to \alignSubExnegindent{#1\hfill}}]% + \else + \item[#1\hfill]% + \fi +\newgll} +\def\bg.{\my@ifnextchar[{\newglossitem}{\item\newgll}} +\def\cg.{\bg.} +\def\dg.{\bg.} +\def\eg.{\bg.} +\def\fg.{\bg.} +% +%%%%%%%%%%%%%%%%%%%% GLOSSES WITH INDEXED BRACKETS %%%%%%%%%%%% +\def\exig.{\my@ifnextchar[{\newglossexi}{\exi.\newgll}} +\def\newglossexi[#1]{\exi.[#1]\newgll} +\let\exgi=\exig +\def\aig.{\my@ifnextchar[{\newglossai}{\ai.\newgll}} +\def\newglossai[#1]{\ai.[#1]\newgll} +\let\agi=\aig +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CROSS REFERENCES %%%%%%%%%%%%%% +\newcounter{tmpaEx} +\newif\ifNoFnRef +\newcommand{\Next}{\if@noftnote\NoFnReftrue\else\NoFnReffalse\fi + \copyExNo\stepcounter{tmpaEx}\printExNo}%refstepcounter replaced +\newcommand{\NNext}{\if@noftnote\NoFnReftrue\else\NoFnReffalse\fi + \copyExNo\addtocounter{tmpaEx}{2}\printExNo} +\newcommand{\TextNext}{\NoFnReftrue\copyExNo\stepcounter{tmpaEx}\printExNo}%refstepcounter replaced +\newcommand{\Last}{\if@noftnote\NoFnReftrue\else + \ifnum\Exarabic{FnExNo}=0 \NoFnReftrue\else\NoFnReffalse\fi + \fi + \copyExNo\printExNo} +\newcommand{\LLast}{\if@noftnote\NoFnReftrue\copyExNo% + \addtocounter{tmpaEx}{-1}% + \else + \ifnum\Exarabic{FnExNo}=0 \NoFnReftrue\copyExNo% + \addtocounter{tmpaEx}{-1}% + \else + \ifnum\Exarabic{FnExNo}=1 \NoFnReftrue\copyExNo% + \else + \NoFnReffalse\copyExNo\addtocounter{tmpaEx}{-1}% + \fi\fi\fi + \printExNo} +\newcommand{\copyExNo}{\strut\ifNoFnRef\setcounter{tmpaEx}{\value{ExNo}}% + \def\thetmpaEx{\Exarabic{tmpaEx}}% + \else + \setcounter{tmpaEx}{\value{FnExNo}}\def\thetmpaEx{\Exroman{tmpaEx}}% + \fi} +\def\complexExNo[#1]{\hbox{\if@noftnote\theExLBr\else\theFnExLBr\fi% + \thetmpaEx\firstrefdash#1\if@noftnote\theExRBr + \else\theFnExRBr\fi}}%hard wired bracket changed to \theExBr in version 4.0 +\newcommand{\printExNo}{\@ifnextchar[{\complexExNo}{% + \if@noftnote\theExLBr\else\theFnExLBr\fi\thetmpaEx% + \if@noftnote\theExRBr\else\theFnExRBr\fi\xspace}}%hard + %wired bracket changed to \theExBr in version 4.0 +%%%%%%%%%%%%%%%%%%%%%%%%%%% compatibility with beamer class %%%%%%%%%%%%%%%%%%%%%%%%%% +% This code has now been commented out in v 4.2 since it now causes problems with beamer +% The original problem it solved was probably a beamer issue, not a linguex issue. +% Users with old versions of beamer may need this code so let's leave it in the source for the moment +% +% +%\@ifundefined{usetheme}{}{\AtBeginDocument{\def\label#1{\strut%strut added to definition +%\@bsphack +% \protected@write\@auxout{}% +% {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}% +%\@esphack}}} +%%%%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput \ No newline at end of file diff --git a/macros/latex/contrib/linguex/linguho.sty b/macros/latex/contrib/linguex/linguho.sty new file mode 100644 index 0000000000..6796f0fbd2 --- /dev/null +++ b/macros/latex/contrib/linguex/linguho.sty @@ -0,0 +1,132 @@ +%% Copyright 1999 Wolfgang Sternefeld +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%% linguho.sty for linguex.sty +%% Author: Wolfgang.Sternefeld@uni-tuebingen.de +%% Status: maintained +%% fileversion 2.0 +%% filedate 99/05/04 +%% +\ProvidesPackage{lingo}[1999/04/05 Make linguistics handouts v. 2.0] +\RequirePackage{linguex} +\newif\ifcopytohandout +\DeclareOption{*}{\copytohandouttrue} +\ProcessOptions +\let\copyoflabel=\label +\let\copyofex=\ex +\let\copyofexi=\exi +\let\copyofexg=\exg +\let\copyofexig=\exig +\let\copyofexgi=\exgi +\let\copyofa=\a +\let\copyofag=\ag +\let\copyofai=\ai +\let\copyofaig=\aig +\let\copyofagi=\agi +\let\copyofsection=\section +\let\copyofsubsection=\subsection +\let\copyofsubsubsection=\subsubsection +\let\copyofsetlength=\setlength +\let\copyofsettowidth=\settowidth +\let\copyofresetExdefaults=\resetExdefaults +\let\copyofmaketitle=\maketitle +\let\copyofA=\A +\newwrite\han\immediate\openout\han=\jobname.han +\def\MakeOther #1{\catcode`#1 = 12} +\def\MkOthersSpecial{% + %\MakeOther{\§}%to be copied for all active characters + %\MakeOther{\Š} + %\MakeOther{\š} + %\MakeOther{\€} + %\MakeOther{\…} + %\MakeOther{\†} + %\MakeOther{\Ÿ} + %\MakeOther{\"} + }%This definition must be uncommented if any of\ + %% the characters in the above definition are \active +%\def\MkOthersSpecial{}%This line must be uncommented if any of +%% the characters in the above definition are \active +\def\ChangeCatCodes{\begingroup% + \immediate\write\han{ }% + \MkOthersSpecial% + \def\do##1{\catcode`##1=12}\dospecials% + %\catcode`\%=14 + \catcode`\{=1\catcode`\}=2% + \catcode`\^^M=12\newlinechar=`\^^M}% +{\catcode`\^^M=12% + \gdef\@WriteEx#1#2^^M^^M{\catcode`\^^M=5% + \immediate\write\han{\noexpand#1#2}\endgroup% + \immediate\write\han{\string\par}}% +} +\def\maketitle{\relax} +\def\a.#1\par{\relax} +\def\ag.#1\par{\relax} +\def\ai.#1\par{\relax} +\def\agi.#1\par{\relax} +\def\aig.#1\par{\relax} +\def\exi.#1\par{\relax} +\def\exig.#1\par{\relax} +\def\exgi.#1\par{\relax} +\def\A.#1\par{\relax} +\def\ex{\ChangeCatCodes\@WriteEx{\ex}} +\def\exg{\ChangeCatCodes\@WriteEx{\exg}} +\def\a{\ChangeCatCodes\@WriteEx{\a}} +\def\ag{\ChangeCatCodes\@WriteEx{\ag}} +\def\ai{\ChangeCatCodes\@WriteEx{\ai}} +\def\agi{\ChangeCatCodes\@WriteEx{\agi}} +\def\aig{\ChangeCatCodes\@WriteEx{\aig}} +\def\exi{\ChangeCatCodes\@WriteEx{\exi}} +\def\exig{\ChangeCatCodes\@WriteEx{\exig}} +\def\exgi{\ChangeCatCodes\@WriteEx{\exgi}} +\def\A{\ChangeCatCodes\@WriteEx{\A}} +\def\resetExdefaults{\immediate\write\han{\noexpand\resetExdefaults}} +{\catcode`\^^M=12% + \gdef\@WriteCommand#1#2{\catcode`\^^M=5% + \immediate\write\han{\noexpand#1{#2}}\endgroup}% +} +{\catcode`\^^M=12% + \gdef\@WriteTwoArgCommand#1#2#3{\catcode`\^^M=5% + \immediate\write\han{\noexpand#1{#2}{#3}}\endgroup}% +} +\def\subsubsection{\@ifstar{\subsubsectionstar}% + {\ChangeCatCodes\@WriteCommand{\subsubsection}}} +\def\subsection{\@ifstar{\subsectionstar}% + {\ChangeCatCodes\@WriteCommand{\subsection}}} +\def\section{\@ifstar{\sectionstar}{\ChangeCatCodes\@WriteCommand{\section}}} +\def\setlength{\ChangeCatCodes\@WriteTwoArgCommand{\setlength}} +\def\settowidth{\ChangeCatCodes\@WriteTwoArgCommand{\settowidth}} +\ifcopytohandout + \def\subsubsectionstar{\ChangeCatCodes\@WriteCommand{\subsubsection*}} + \def\subsectionstar{\ChangeCatCodes\@WriteCommand{\subsection*}} + \def\sectionstar{\ChangeCatCodes\@WriteCommand{\section*}} +\else + \def\subsubsectionstar{\relax} + \def\subsectionstar{\relax} + \def\sectionstar{\relax} +\fi +\long\def\footnote#1{\relax} +\def\makehandout{\immediate\closeout\han\newpage% + \setcounter{page}{1}\setcounter{ExNo}{0}% + \def\maketitle{\copyofmaketitle} + \def\a{\copyofa} + \def\ag{\copyofag} + \def\ai{\copyofai} + \def\aig{\copyofaig} + \def\agi{\copyofagi} + \def\ex{\copyofex} + \def\exg{\copyofexg} + \def\exi{\copyofexi} + \def\exig{\copyofexig} + \def\exgi{\copyofexgi} + \def\resetExdefaults{\copyofresetExdefaults} + \def\subsubsection{\copyofsubsubsection} + \def\subsection{\copyofsubsection} + \def\section{\copyofsection} + \def\setlength{\copyofsetlength} + \def\settowidth{\copyofsettowidth} + \def\A{\copyofA} + \maketitle% + \input \jobname.han} +\endinput diff --git a/macros/latex/contrib/linguex/ps-trees.sty b/macros/latex/contrib/linguex/ps-trees.sty new file mode 100644 index 0000000000..6f31dffcf9 --- /dev/null +++ b/macros/latex/contrib/linguex/ps-trees.sty @@ -0,0 +1,83 @@ +%% Copyright 1999 Wolfgang Sternefeld +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%% ps-trees.sty version 2.0 +%% Author: Wolfgang.Sternefeld@uni-tuebingen.de +%% filedate 99/27/04 +\ProvidesPackage{ps-trees}[1999/04/27 Linguistic trees in tabular form v. 2.0] +\RequirePackage{tree-dvips} +\newtoks\AllNodes +\newtoks\CollectedNodes +\newtoks\CollectedTNodes +\newif\ifIsElement +\newlength{\MinNodeWidth} +\newlength{\NodeWidth} +\newcommand{\NodeWidthNo}[1]{\setlength{\MinNodeWidth}{\the\wd#1}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifTNode +\newcommand{\AddToToks}[2]{% + \expandafter\expandafter\expandafter% + \global#1\expandafter{% + \the#1#2}} +\def\TestAndAdd#1{\def\yy{#1}% + \ifx\yy\empty\relax\else% + \ifTNode\AddToToks{\CollectedTNodes}{\\{#1}}% + \else\AddToToks{\CollectedNodes}{\\{#1}}\fi\fi + \IfIsNodeName{#1}% + \typeout{*** Warning: Node Name `#1' already exists ***}\fi + } +\let\oldnode=\node +\newenvironment{psTree}{\tabcolsep0pt\nodemargin0pt% + \def\node##1##2{\AddToToks{\AllNodes}{\\{##1}}\oldnode{##1}{##2\strut}}% + }% + {\let\\=\EveryNode\the\CollectedNodes% + \let\\=\EveryTNode\the\CollectedTNodes% + \global\AllNodes={}\global\CollectedNodes={}\global\CollectedTNodes={}% + \global\setlength{\MinNodeWidth}{0pt}%\hspace{\fill} + } +\newcommand{\EveryNode}[1]{\ConnectNode#1 } +\newcommand{\EveryTNode}[1]{\ConnectTNode#1 } +\def\ConnectNode#1#2 {\IfIsNodeName{#2}\nodeconnect{#2}{#1#2}% + \else\NoNodeWarning{#2}\fi} +\def\ConnectTNode#1#2 {\IfIsNodeName{#2}\nodeconnect{#2}[tl]{#1#2}% + \nodeconnect{#2}[tr]{#1#2}\nodeconnect[tl]{#1#2}[tr]{#1#2}% + \else\NoNodeWarning{#2}\fi} +\newcommand{\IsElementOf}[2]{\IsElementfalse\def\xx{#1}\bgroup + \let\\=\Compare\the#2\egroup} +\newcommand{\IfIsNodeName}[1]{\IsElementOf{#1}{\AllNodes}\ifIsElement} +\newcommand{\Compare}[1]{\def\yy{#1}\ifx\yy\xx\global\IsElementtrue\fi} +\newcommand{\NoNodeWarning}[1]{\typeout{*** Fatal Error. Node Name `#1' + does'nt exist ***}} +\newenvironment{treetab}{\begin{psTree}\begin{tabular}}{\end{tabular}% + \end{psTree}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\Node}{\@ifnextchar[{\OptionNode}{\@Node}} +\newcommand{\@Node}[2]{\TestAndAdd{#1}\settowidth{\NodeWidth}{#2}% + \ifdim\NodeWidth<\MinNodeWidth% + \makebox[\MinNodeWidth]{\hfill\node{#1}{#2}\hfill}% + \else\node{#1}{#2}% + \fi} +\def\OptionNode[#1]#2#3{\TestAndAdd{#2}\makebox[\the\wd#1]{\hfill + \node{#2}{#3}\hfill}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\NodeNo}[1]{\@ifnextchar[{\OptionNodeNo{#1}}{\@NodeNo{#1}}} +\newcommand{\@NodeNo}[2]{\@Node{#2}{\unhcopy#1}} +\def\OptionNodeNo#1[#2]#3{\TestAndAdd{#3}% + \makebox[\the\wd#2]{\hfill\node{#3}{\unhcopy#1}\hfill}} +\newcommand{\NodeZ}[2]{\TestAndAdd{#1}% + \hfill\node{#1}{\makebox[0pt]{#2\strut}}} +\newcommand{\NodeT}[2]{\TNodetrue + \Node{#1}{#2}\TNodefalse} +\newcommand{\NodeZT}[2]{\TNodetrue\TestAndAdd{#1}% + \hfill\makebox[0pt]{\node{#1}{#2\strut}}\TNodefalse} +\let\NodeTZ=\NodeZT +\newcommand{\NodeTNo}[2]{\TNodetrue\NodeNo{#1}{#2}\TNodefalse} +\newcommand{\NodeZTNo}[2]{\hfill\makebox[0pt]{\NodeTNo{#1}{#2}}} +\let\NodeTZNo=\NodeZTNo +\newcommand{\nodeZ}[2]{\IfIsNodeName{#1}% + \typeout{*** Warning: Node Name `#1' already exists ***}\fi + \hfill\node{#1}{\makebox[0pt]{#2}}} +%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + -- cgit v1.2.3