diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/expex/expex.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/expex/expex.tex | 876 |
1 files changed, 507 insertions, 369 deletions
diff --git a/Master/texmf-dist/tex/generic/expex/expex.tex b/Master/texmf-dist/tex/generic/expex/expex.tex index 8174cdff4b9..ebe66a15254 100644 --- a/Master/texmf-dist/tex/generic/expex/expex.tex +++ b/Master/texmf-dist/tex/generic/expex/expex.tex @@ -1,5 +1,5 @@ \def\ExPexMessage - {2013/07/29 v4.1d ExPex linguistics example formatter (JF)} + {2014/01/27 v5.0 ExPex linguistics example formatter (JF)} % ------------------------------------------------------- % jf 2011/12/09 (v4.0a) % 1) fixed bug in how exceptional gla items are detected @@ -19,16 +19,25 @@ % 1) added \let\pageno=\c@page to LaTex specializations % jf 2013/06/27 (v4.1b) % 1) fixed bug in skip over \glft entries -% jf 2013/07/27 (v4.1c) -% 1) LaTex \includeonly mechanism support -% jf 2013/07/29 (v4.1d) -% 1) made \includeonly mechanism compatible with hyperref, etc. +% jf 2013/07/27 +% 1) LaTex \include/\includeonly mechanism now works for \excnt +% jf 2013/10/08 +% 1) revise the definition of \glw@printcol (now named +% \glw@printglword) to use token lists rather than edefs, and to build +% glwords as \vtop{\halign{#\hfil\cr...} structures +% rather than stacked hboxes. This allows items like {\hfil +% word}, which results in center alignment. +% 2) removed w from the prefix in \glw@append, \glw@lop, and +% \glw@lopff since these will be used in other gloss styles +% jf 2013/10/10 fixed belowpreambleskip bug +% jf 2014/01/27 MAJOR REVISIONS: vertical spacing in glosses, +% introduction of nlevel style glosses (see User's Manual, also +% revised at this time) for more detail about the changes % -------------------------------------------------------- \edef\resetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax} \catcode`\@=11\relax \ifx\XKeyValLoaded\endinput \else \input xkeyval \fi -\newcount\excnt \ifx\ProvidesFile\@undefined \message{\ExPexMessage} \else @@ -36,9 +45,9 @@ \@addtofilelist{expex.tex} \let\it=\itshape \let\pageno=\c@page -% 2013/07/29 - \let\c@excnt=\excnt - \g@addto@macro\cl@@ckpt{\@elt{excnt}} +% 2013/07/27 + \g@addto@macro\cl@@ckpt + {\immediate\write\@partaux{\string\excnt=\the\excnt}} \fi %! define eplain primitives, if necessary \ifx\eplain\@undefined % eplain stuff @@ -59,12 +68,10 @@ \else \let\@optionalarg = \empty \expandafter\@optionaltemp - \fi -} -\def\@@getoptionalarg[#1]{% - \def\@optionalarg{#1}% - \@optionaltemp -} + \fi } + \def\@@getoptionalarg[#1]{% + \def\@optionalarg{#1}% + \@optionaltemp} \fi %----- end of eplain inclusions \def\ep@identity#1{#1} @@ -137,11 +144,15 @@ \else \let\Lingset=\lingset \fi -%------ scratch dimensions ----- -\newdimen\epd@a -% \newdimen\epd@b not yet needed +%------ scratch dimensions and counts ----- +\newdimen\ep@dima +\newdimen\ep@dimb +\newdimen\ep@dimc +\newcount\ep@cnta +\newcount\epc@b %------ \ex ----- -\excnt=1 % \excnt created early, before LaTex specializations +\newcount\excnt +\excnt=1 \newbox\numbox \newdimen\epd@numright \newif\if@specialexno @@ -184,21 +195,17 @@ \fi\fi }} \define@choicekey{ling}{exnotype}[\ling@exnotype\@N]% - {arabic,roman}{% + {arabic,chapter.arabic,roman}{% \ifcase\@N -% \let\exnoprint=\ep@arabicexnoprint \def\ep@rawexnoprint{\number\excnt}% \or -% \let\exnoprint=\ep@romanexnoprint + \def\ep@rawexnoprint{\thechapter.\number\excnt}% + \or \def\ep@rawexnoprint{\romannumeral\the\excnt}% \fi } -\def\exnoprint{\ep@exnoformat{\ep@rawexnoprint}} -%\def\ep@arabicexnoprint{\ep@exnoformat{\the\excnt}} -%\def\ep@romanexnoprint{\ep@exnoformat{\romannumeral\the\excnt}} \lingset{exnotype=arabic} -%\def\romanexnumbers{\let\exnoprint=\ep@romanexnoprint} -%\def\ep@specialexnoprint{(\ep@specialexno)} +\def\exnoprint{\ep@exnoformat{\ep@rawexnoprint}} \def\ep@specialexnoprint{\ep@exnoformat{\ep@specialexno}} % unformatted \def\ep@globalstepexcnt{\global\advance\excnt by 1 } \def\ep@localstepexcnt{\advance\excnt by 1 } @@ -215,7 +222,7 @@ \if@specialexno \def\@actualexno{\ep@specialexno}% \else - \edef\@actualexno{\the\excnt}% + \edef\@actualexno{\ep@rawexnoprint}% \fi \ifx\@optionaltag\empty \let\@localextag=\empty @@ -271,7 +278,7 @@ \def\ling@sampleexno{#1}% } \lingset{sampleexno=} -\define@lingcmdkeys{splitexpenalty} +%\define@lingcmdkeys{splitexpenalty} %\define@lingcmdkeys{belowpreambleskip,interpartskip,splitexpenalty} \define@choicekey{ling}{labelalign}[\ling@labelalign\nr]% {left,center,right}{% @@ -461,9 +468,9 @@ \def\ep@omitlabel{\omit\hskip\linglabeloffset\hfil} %\def\endpextable{\egroup\egroup \par \prevdepth=\dp\strutbox} \def\hwit#1{\hidewidth \it #1\hidewidth} -\define@ling@cmdkeys{crskip} +\define@lingcmdkeys{crskip} \lingset{crskip=.6em} -\def\crs{\cr\noalign{\vskip\ling@crskip}} +\def\crs{\cr\noalign{\vskip\lingcrskip}} \def\crnb{\cr\noalign{\par\nobreak}} % LL is "label list" \define@lingkey{labellist}{% @@ -482,20 +489,7 @@ \def\ep@popLL@a#1,#2\@nil{% \def\ep@label{\the\ep@everylabel #1}\def\@currLL{#2}} \define@choicekey{ling}{labelgen}[\ling@labelgen\ep@labelgen]% - {char,number,list,romannumeral}{} -\define@choicekey{ling}{labeltype}[\ling@labeltype\@N]% - {alpha,caps,numeric}{% - \ifcase\@N - \lingset{labelgen=char,pexcnt=97,labelformat=A., - fullrefformat=XA,labelalign=left}% - \or - \lingset{labelgen=char,pexcnt=65,labelformat=A., - fullrefformat=XA,labeloffset=!.3em,labelalign=left}% - \or - \lingset{labelgen=number,pexcnt=1,labelformat=A., - fullrefformat=X.A,labelalign=right}% - \fi -} + {char,number,list,romannumber}{} \def\definelabeltype#1#2{% \expandafter\def\csname ling@#1labeltype\endcsname{#2}} \define@lingkey{labeltype}{% @@ -526,7 +520,7 @@ fullrefformat=XA,labelalign=left,labelwidth=.92em} \definelabeltype{numeric}{labelgen=number,pexcnt=1,labelformat=A., fullrefformat=X.A,labelalign=right,labelwidth=.75em} -\definelabeltype{roman}{labelgen=romannumeral,pexcnt=1,labelformat=(A), +\definelabeltype{roman}{labelgen=romannumber,pexcnt=1,labelformat=(A), fullrefformat=XA,labelalign=left,labelwidth=1.5em} %-- tags and reference ----- %----- local reference to example numbers ----- @@ -565,9 +559,9 @@ \ignorespaces } \def\deftagex#1{\edef\@localextag{#1}% - \expandafter\xdef\csname lingtag@#1\endcsname{{\the\excnt}}% + \expandafter\xdef\csname lingtag@#1\endcsname{{\ep@rawexnoprint}}% \if@g@thertags - \immediate\write@tags{\noexpand\@fd@f {#1} {{\the\excnt}}}% + \immediate\write@tags{\noexpand\@fd@f {#1} {{\ep@rawexnoprint}}}% \fi \ignorespaces } @@ -658,60 +652,32 @@ % }% % \ignorespaces %} -% Uncomment and use the following for debugging if needed -%\def\reporttag#1% -% {\writeln{\expandafter\meaning\csname lingtag@#1\endcsname}} \def\getref@aa#1#2{#1}% \def\getref@ab#1#2{#2}% \def\getref#1{\getref@a{#1}\getref@aa} -\def\getfullref#1{\getref@a{#1}\getref@ab} -\def\getref@a#1#2{% - \if@readtags \@setupreadtags \fi - \expandafter \ifcsname lingtag@#1\endcsname - \edef\temp{\ep@expandtwice\csname lingtag@#1\endcsname}% - \ifx\temp\empty - \@expexwarn{+++tag #1 has no full reference}% - \@printref{Missing!}% - \else - {\@printref{\temp}}% - \fi - \else - \@expexwarn{tag #1 is called but not defined}% - {\@printref{\tt [#1]}}% - \fi -} -\newif\ifpartlabel -\newif\iffullref -\def\ep@ispartlabelcheck#1{\ep@ispart@a#1.\@nil} -\def\ep@ispart@a#1.#2\@nil{\def\temp{#2}% - \ifx\temp\empty \partlabelfalse \else \partlabeltrue\fi} -\def\getref{\fullreffalse \getref@a} -\def\getfullref{\fullreftrue \getref@a} -%\def\getref@a#1{% +%\def\getfullref#1{\getref@a{#1}\getref@ab} +%\def\getref@a#1#2{% % \if@readtags \@setupreadtags \fi -% \ep@ispartlabelcheck{#1}% -% \ifpartlabel -% \iffullref -% \let\@chooseref\chooseref@a +% \expandafter \ifcsname lingtag@#1\endcsname +% \edef\temp{\ep@expandtwice\csname lingtag@#1\endcsname}% +% \ifx\temp\empty +% \@expexwarn{+++tag #1 has no full reference}% +% \@printref{Missing!}% % \else -% \let\@chooseref\chooseref@g +% {\@printref{\temp}}% % \fi % \else -% \let\@chooseref\relax -% \fi -% \expandafter \ifcsname lingtag@#1\endcsname -% \edef\temp{\ep@expandtwice\csname lingtag@#1\endcsname}% -% \ifx\temp\empty -% \@expexwarn{+++tag #1 has no full reference}% -% \@printref{Missing!}% -% \else -% {\@printref{\expandafter\@chooseref\temp}}% -% \fi -% \else % \@expexwarn{tag #1 is called but not defined}% % {\@printref{\tt [#1]}}% % \fi %} +\newif\ifpartlabel +\newif\iffullref +\def\ep@ispartlabelcheck#1{\ep@ispart@a#1.\@nil} +\def\ep@ispart@a#1.#2\@nil{\def\temp{#2}% + \ifx\temp\empty \partlabelfalse \else \partlabeltrue\fi} +\def\getref{\fullreffalse \getref@a} +\def\getfullref{\fullreftrue \getref@a} \def\getref@a#1{% \if@readtags \@setupreadtags \fi \ep@ispartlabelcheck{#1}% @@ -735,41 +701,76 @@ } \def\chooseref@a#1#2{#2} \def\chooseref@g#1#2{#1} -%------ glosses -% Presently, the glstyle key is a dummy and can only be set to the -% value wrap. It is anticipated that in the future there will be -% other glstyles. It must set \gl@beginstyle, which is inserted -% immediately after \begingl is called, the various level macros -% (\gla,\glb,\glft,etc.) and \endgl. -\define@choicekey{ling}{glstyle}[\ling@glstyle\gl@stylenum]{wrap}{% +% ----- glosses ----- +\define@choicekey{ling}{glstyle}[\ling@glstyle\gl@stylenum]{wrap,nlevel}{% \ifcase\gl@stylenum \let\gl@beginglstyle\glw@begingl \let\endgl\glw@endgl \glw@assignlevels + \let\glpreamble=\glw@preamble \let\glft=\glw@glft + \else + \let\gl@beginglstyle\gln@begingl + \let\endgl\gln@endgl + \let\glpreamble=\gln@preamble + \let\glft=\gln@ft \fi } -% \def\begingl{\bgroup\@getoptionalarg\gl@begingl} \def\gl@begingl{% - \ling@everygl \ling@usearg + \ling@everygl \gl@beginglstyle } -\define@ling@cmdkeys{everygl,everyglpreamble,everygla,everyglb, - everyglc,everygl,everyglft,everyglword,glrightskip} -\define@ling@cmdkeys{glhangindent,glwidth} -\define@lingincskipkeys{glspace,aboveglftskip,belowglpreambleskip} -\define@lingincdimenkeys{extraglskip,gllineskip} -\define@lingkey{abovemoreglskip}{\lingset{gllineskip=#1}} % obsolete -\define@boolkey{ling}[ling@]{autoglskip}{} -\define@boolkey{ling}[ling@]{glstruts}{% - \ifling@glstruts \let\glstrut=\strut - \else \let\glstrut=\relax \fi} +% parameters which are used in both gloss styles +\define@ling@cmdkeys{everygl,everyglpreamble,everyglilg,everyglft} +\define@ling@cmdkeys{everyglword,glrightskip,glhangindent,glwidth} +\define@lingincskipkeys{glspace,aboveglftskip,belowglpreambleskip,extraglskip} +\newbox\glstrutbox +\def\glstrut{\unhcopy\glstrutbox} +\define@boolkey{ling}[ling@]{glstruts}{}% +\newdimen\ep@cascadeindent +\newdimen\ep@hangindentamount +\newcount\ep@cascadecount \define@choicekey{ling}{glhangstyle}[\temp\ep@glhangstyle]% - {none,normal,cascade}{} + {none,normal,cascade}% + {\ifnum\ep@glhangstyle=2 + \ep@cascadecount=10 + \ep@cascadeindent=0pt + \ep@hangindentamount=\ling@glhangindent + \fi } \lingset{glhangstyle=normal,glrightskip=0pt plus .1\hsize} -%----- wrap style (the only style for the present) ----- +% dimensions +% switches +\newif\if@glpreamble +\newif\if@glft +% +% list manipulation macros (ala Knuth) that are used in both gloss styles +\newtoks\gltoks@a +\newtoks\gltoks@b +\def\gl@push #1\to #2{% + \gltoks@a={\\{#1}}% + \gltoks@b=\expandafter{#2}% + \edef#2{\the\gltoks@a\the\gltoks@b}% +} +\def\gl@append #1\to #2{% + \gltoks@a={\\{#1}}% + \gltoks@b=\expandafter{#2}% + \xdef#2{\the\gltoks@b\the\gltoks@a}% +} +\def\gl@lop#1\to#2{\ifx#1\empty + \let#2\empty \else\expandafter\gl@lopoff#1\gl@lopoff#1#2\fi} +\long\def\gl@lopoff\\#1#2\gl@lopoff#3#4{\def#4{#1}\def#3{#2}} +\def\gl@eappend{\expandafter\gl@append} +\newif\ifgl@loopmore +\def\gl@lopTL#1\to#2{% + \ifx#1\empty #2={}\else + \expandafter\gl@lopoffTL#1\gl@lopoffTL#1#2\fi} +\long\def\gl@lopoffTL\\#1#2\gl@lopoffTL#3#4{#4={#1}\def#3{#2}} +%%%%%%%%%%%%%%%%%%%% wrap style glosses %%%%%%%%%%%%%%%%%%%% +% \glw@begingl sets up the environment +% \gla, \glb, etc. fill in the various lists which are initialized in +% the environment % The input (something like the following) % \gla x1 x2 x3 // % \glb y1 y2 y3 // @@ -777,65 +778,56 @@ % gets converted into a list of lists (using Knuth's list macros) % {{x1,y1,z1},{x2,y2,z2},{x3,y3,z3}} % auxiliary lists are also made at the same time -% list of struts, list of "everygl?" +% list of struts, list of "everygl<name>" % Then these lists are popped, one position at a time, and vboxes % are built. The vboxes are fed into Tex's regular paragraph % building machinary. -\newtoks\gltoks@a -\newtoks\gltoks@b -\def\glw@append #1\to #2{% - \gltoks@a={\\{#1}}% - \gltoks@b=\expandafter{#2}% - \xdef#2{\the\gltoks@b\the\gltoks@a}% -} -\def\glw@lop#1\to#2{\ifx#1\empty - \let#2\empty \else\expandafter\glw@lopoff#1\glw@lopoff#1#2\fi} -\long\def\glw@lopoff\\#1#2\glw@lopoff#3#4{\def#4{#1}\def#3{#2}} -\newif\ifgl@loopmore -\def\glw@mergerow#1\to #2{% - \let\alist=#1% - \let\blist=#2% - \let\clist=\empty - \gl@loopmoretrue - \loop \ifgl@loopmore\glw@mergerow@a \repeat - \global\let#2=\clist -} -\def\glw@mergerow@a{% - \glw@lop\blist\to\tempb - \ifx\tempb\ep@Linebreak - \expandafter\glw@append\ep@Linebreak\to\clist - \else\ifx\tempb\ep@Closeup - \expandafter\glw@append\ep@Closeup\to\clist - \else\ifx\tempb\ep@Lbrack - \expandafter\glw@append\ep@Lbrack\to\clist - \else\ifx\tempb\ep@Rbrack - \expandafter\glw@append\ep@Rbrack\to\clist - \else - \glw@lop\alist\to\tempa - \expandafter\glw@append \tempa \to \tempb - \expandafter\glw@append \tempb \to \clist - \fi\fi\fi\fi - \ifx\alist\empty \ifx\blist\empty \gl@loopmorefalse \fi\fi +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\def\glw@begingl{\@getoptionalarg\glw@begingl@a} +\def\glw@begingl{\glw@begingl@a} +\def\glw@begingl@a{% + \bgroup + \parindent0pt + \ep@setglstrut + \ifdim\ling@glwidth=0pt + \bgroup + \else + \vtop\bgroup + \hsize=\ling@glwidth + \leftskip=0pt + \fi + \bgroup + \parindent=0pt + \@glpreamblefalse + \@glftfalse + \let\mainlist=\empty + \let\itemtypelist=\empty + \let\aboveskiplist=\empty + \let\strutlist=\empty + \let\everylist=\empty } -%\def\\{\par} % As the list of lists is assembled, heights and depths of each % item are computed and maximum row heights and maximum row depths % are computed in each row. These are used to make struts which % are used to assemble the vboxes. +% \newdimen\glw@maxht \newdimen\glw@maxdp -% exceptional items -\def\ep@Closeup{@}\@onelevel@sanitize\ep@Closeup -\def\ep@Linebreak{+}\@onelevel@sanitize\ep@Linebreak -\def\ep@Lbrack{[}\@onelevel@sanitize\ep@Lbrack -\def\ep@Rbrack{]}\@onelevel@sanitize\ep@Rbrack +\def\glw@initializemaxhtdp{% + \ifling@glstruts + \glw@maxht=\ht\glstrutbox \glw@maxdp=\dp\glstrutbox + \else + \glw@maxht=0pt \glw@maxdp=0pt + \fi +} +\define@ling@cmdkeys{everygla,everyglb,everyglc} \def\@alinelabel{a} \def\glw@gla{% - \if@glpreamble \vskip\lingbelowglpreambleskip \fi + \bgroup + \ling@everyglilg \def\lingaboveglaskip{0pt}% \def\gl@linelabel{a}% - \glw@maxht=0pt - \glw@maxdp=0pt + \glw@initializemaxhtdp \@getoptionalarg \glw@gla@a } @@ -843,77 +835,55 @@ \glw@gla@b #1 \@nil } \def\glw@gla@b{\@ifnextchar\@nil\glw@gla@c\glw@gla@d} \def\glw@gla@c#1{\glw@updatelists \egroup \ignorespaces} +\def\ep@samecharcode#1#2{\ep@expandonce#1\ep@expandonce#2\ignorespaces} +\newcount\@itemtype \newif\ifglw@word -% 2011-12-09 fixed bug in the way that exceptional gla items were detected -% 2011-12-09 (later) fixed bug when #1 is empty (i.e gla item is {}) +% \@setitemtype sets the count \@itemtype, the macro \@mainlistappend, and +% the switch \glw@word +% 1=+, 2=@, 3=[, 4=], 5=\nogloss, 0=other +\def\@setitemtype #1#2\@nil{% + \glw@wordfalse + \def\temp{#2}% + \ifx\temp\empty + \if\ep@samecharcode #1+\@itemtype=1 + \else\if\ep@samecharcode #1@\@itemtype=2 + \else\if\ep@samecharcode #1[\@itemtype=3 + \else\if\ep@samecharcode #1]\@itemtype=4 + \else \@itemtype=0 + \fi\fi\fi\fi + \else + \glw@wordtrue + \ifx#1\nogloss\@itemtype=5 \def\@itembody{#2}% + \else \@itemtype=0 \fi + \fi +} \def\glw@gla@d #1 {% - \glw@wordtrue \def\temp{#1}% - \ifx\temp\empty \else \glw@gla@e #1\@nil \fi + \ifx\temp\empty + \else + \@setitemtype #1\@nil + \ifnum\@itemtype=0 \gl@append \\{\glstrut #1}\to\mainlist + \else \ifnum\@itemtype=5 \gl@eappend\@itembody\to\mainlist + \else \gl@append \\{}\to\mainlist + \fi\fi + \gl@eappend \the\@itemtype \to\itemtypelist + \fi \ifglw@word - \gltoks@a={#1}% - \gltoks@b=\expandafter{\ling@everygla}% - \glw@append \\{\glstrut #1}\to\mainlist -% \glw@append \\{#1}\to\mainlist \setbox0=\hbox{\ling@everygla #1}% \ifdim\glw@maxht<\ht0 \glw@maxht=\ht0 \fi \ifdim\glw@maxdp<\dp0 \glw@maxdp=\dp0 \fi \fi \glw@gla@b } -\def\glw@gla@e #1#2\@nil{% - \def\temp{#1}% - \def\tempa{#2}% - \ifx\tempa\empty - \glw@wordfalse - \@onelevel@sanitize\temp - \ifx\temp\ep@Linebreak - \expandafter\glw@append\ep@Linebreak\to\mainlist - \else\ifx\temp\ep@Closeup - \expandafter\glw@append\ep@Closeup\to\mainlist - \else\ifx\temp\ep@Lbrack - \expandafter\glw@append\ep@Lbrack\to\mainlist - \else\ifx\temp\ep@Rbrack - \expandafter\glw@append\ep@Rbrack\to\mainlist - \else \glw@wordtrue - \fi\fi\fi\fi\fi -} -%\def\glw@gla@d #1#2 {% -% \glw@wordtrue -% \def\temp{#2}% -% \ifx\temp\empty -% \glw@wordfalse -% \def\tempa{#1}% -% \@onelevel@sanitize\tempa -% \ifx\tempa\ep@Linebreak -% \expandafter\glw@append\ep@Linebreak\to\mainlist -% \else\ifx\tempa\ep@Closeup -% \expandafter\glw@append\ep@Closeup\to\mainlist -% \else\ifx\tempa\ep@Lbrack -% \expandafter\glw@append\ep@Lbrack\to\mainlist -% \else\ifx\tempa\ep@Rbrack -% \expandafter\glw@append\ep@Rbrack\to\mainlist -% \else \glw@wordtrue -% \fi\fi\fi\fi\fi -% \ifglw@word -% \gltoks@a={#1#2}% -% \gltoks@b=\expandafter{\ling@everygla}% -% \glw@append \\{#1#2}\to\mainlist -% \setbox0=\hbox{\ling@everygla #1#2}% -% \ifdim\glw@maxht<\ht0 \glw@maxht=\ht0 \fi -% \ifdim\glw@maxdp<\dp0 \glw@maxdp=\dp0 \fi -% \fi -% \glw@gla@b -%} \newdimen\gl@maxdplast \def\glw@updatelists{% \edef\temp{\csname lingabovegl\gl@linelabel skip\endcsname}% - \expandafter\glw@append\temp \to\aboveskiplist + \gl@eappend\temp \to\aboveskiplist \edef\temp{\vrule width0pt height\the\glw@maxht\space depth\the\glw@maxdp\space }% \global\gl@maxdplast=\glw@maxdp - \expandafter\glw@append\temp\to\strutlist + \gl@eappend\temp\to\strutlist \expandafter\expandafter\expandafter - \glw@append\csname ling@everygl\gl@linelabel\endcsname + \gl@append\csname ling@everygl\gl@linelabel\endcsname \to\everylist \gltoks@a=\expandafter{\everylist}% } @@ -928,7 +898,7 @@ \temp } % \glw@gla and \glw@glft get their definitions directly -% \glw@glx gets defined via \defineglwlevels, which adds x to the +% \glw@gl<name> gets defined via \defineglwlevels, which adds <name> to the % list \glw@levels of defined glw levels \def\glw@levels{a,ft} \def\define@glw@level#1{% @@ -944,15 +914,12 @@ \@expexwarn{Level #1 is already defined} \fi } -% It is anticipated that \definegl?levels will be defined in the -% future. \def\defineglwlevels#1{\XKV@for@n{#1}\thislevel {\expandafter\define@glw@level\expandafter{\thislevel}}% } \def\glw@glx#1{% x suggests any label (as argument to \glw@glx) \def\worklist{}% - \glw@maxht=0pt - \glw@maxdp=0pt + \glw@initializemaxhtdp \def\gl@linelabel{#1}% \@getoptionalarg\glw@glx@a } @@ -962,142 +929,322 @@ \csname ling@everygl\gl@linelabel\endcsname \glw@glx@b #1 \@nil } \def\glw@glx@b{\@ifnextchar\@nil\glw@glx@c\glw@glx@d} -\def\glw@glx@c#1{\glw@updatelists \glw@mergerow\worklist\to\mainlist\egroup} +\def\glw@glx@c#1{\glw@updatelists \glw@mergerow\worklist\to\mainlist \egroup} +\def\glw@mergerow#1\to #2{% + \let\itlist=\itemtypelist + \let\alist=#1% + \let\blist=#2% + \let\clist=\empty + \gl@loopmoretrue + \loop + \ifx\itlist\empty \gl@loopmorefalse \fi + \ifgl@loopmore + \gl@lop\itlist\to\@@itlist + \@itemtype=\@@itlist + \gl@lop\blist\to\currb + \ifnum\@itemtype=0 + \gl@lop\alist\to\curra + \gl@eappend\curra\to\currb + \gl@eappend\currb\to\clist + \else \ifnum\@itemtype=5 + \gl@eappend\currb\to\clist + \else + \gl@append\\{}\to\clist + \fi\fi + \repeat + \global\let#2=\clist +} \def\glw@glx@d #1 {% \setbox0=\hbox{\@every #1}% \ifdim\glw@maxht<\ht0 \glw@maxht=\ht0 \fi \ifdim\glw@maxdp<\dp0 \glw@maxdp=\dp0 \fi - \glw@append {\glstrut #1}\to\worklist -% \glw@append #1\to\worklist + \gl@append {\glstrut #1}\to\worklist \glw@glx@b } \defineglwlevels{b,c} \newif\ifglw@spacebefore -\def\glw@begingl{% - \parindent=0pt - \glw@begingl@a -} -\newdimen\epd@gllineskip - -\def\glw@begingl@a{% - \vtop\bgroup - \@glpreamblefalse - \ifdim\ling@glwidth=0pt - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \else - \hsize=\ling@glwidth - \fi - \leftskip=0pt - \rightskip=\ling@glrightskip - \lineskiplimit=0pt - \ifling@autoglskip - \let\glstrut=\strut - \epd@gllineskip=\baselineskip - \advance\epd@gllineskip by -\dp\strutbox - \advance\epd@gllineskip by -\ht\strutbox - \advance\epd@gllineskip by \lingextraglskip - \else - \epd@gllineskip=\linggllineskip - \fi - \edef\gl@lineskipsave{\noexpand\lineskip=\the\lineskip}% - \ifcase\ep@glhangstyle - \or - \hangindent=\ling@glhangindent - \hangafter=1 - \or - \glwcascade@makeshape - \parshape 9 - \glwcascade@parshapetarget - \fi - \let\mainlist=\empty - \let\aboveskiplist=\empty - \let\strutlist=\empty - \let\everylist=\empty -} -\newif\if@glpreamble -\def\glpreamble #1// {% +\long\def\glw@preamble #1// {% \@glpreambletrue - {\hangindent=0pt \ling@everyglpreamble #1\par}% + {\hangindent=0pt \hangafter=0 \ling@everyglpreamble #1\strut + \par + \vskip\lingbelowglpreambleskip }% } \def\glw@glft{\@getoptionalarg\glw@glft@a} -% 2011-12-09 make \glw@glft@a a long definition to allow \par's -\long\def\glw@glft@a#1//{% - \lineskip=\epd@gllineskip - \glw@print \par -% 2013-06-27 bug fix -% \prevdepth=\gl@maxdplast -\ifx\glstrut\strut +\long\def\glw@glft@a #1//{% + \glw@printilgsetup + \glw@printilg@a + \vskip\lingaboveglftskip + \nointerlineskip + \egroup + \@glfttrue + \ifx\glstrut\strut \ifdim\gl@maxdplast>\dp\strutbox \prevdepth=\gl@maxdplast \fi \fi \ling@usearg - \vskip\lingaboveglftskip + \@ilgborderadjustment \ling@everyglft - \hangindent=0pt - \let\endgl=\glw@endglB - #1\par -} -\def\glw@endgl{\glw@endglA \glw@endglB} -\def\glw@endglA{\lineskip=\epd@gllineskip - \ifx\mainlist\empty \else \glw@print \par \fi } -\def\glw@endglB{\egroup\egroup} -\def\glw@print{% + \strut #1\par +} +\def\glw@endgl{% + \if@glft \else \glw@printilg\egroup \fi + \egroup\egroup\egroup +} +\def\glw@printilg{\glw@printilgsetup \glw@printilg@a} +\def\glw@printilgsetup{% + \@glspacefalse + \rightskip=\ling@glrightskip + \lineskiplimit=0pt + \lineskip=\lingextraglskip + \ifdim\lingextraglskip=0pt \global\let\@ilgborderadjustment=\relax + \else \xdef\@ilgborderadjustment{\vskip\the\lineskip}\fi + \if@glpreamble \@ilgborderadjustment \fi + \ifcase\ep@glhangstyle + \or + \hangindent=\ling@glhangindent + \hangafter=1 + \or + \ep@glmkcascade + \fi +} + +\def\glw@closegroups{\egroup\egroup\egroup} +\def\glw@printilg@a{\glw@printilg@b \par } +\def\glw@printilg@b{% \glw@spacebeforefalse \@glpostbrackfalse \leavevmode \gl@loopmoretrue \@glaparsestate=1 \loop\ifgl@loopmore - \glw@lop\mainlist\to\tempa\relax % \tempa is one column - \ifx\tempa\ep@Linebreak - \vskip\epd@gllineskip - \@glaparsestate=1 + \gl@lop\mainlist\to\@currentitem\relax % \@currentitem is one column + \gl@lop\itemtypelist\to\@currentitemtype\relax + \ifcase\@currentitemtype + \glw@printilgspace + \glw@printglword + \or + \vskip\lingextraglskip + \ifcase\ep@glhangstyle + \or + \hangafter=0 + \hangindent=\ling@glhangindent + \or + \glhangcarry \leavevmode - \else\ifx\tempa\ep@Closeup - \@glaparsestate=1 - \else\ifx\tempa\ep@Lbrack - \ifnum\@glaparsestate=0 \hskip\lingglspace - \else\ifnum\@glaparsestate=2 \hskip\lingglbrackbracksep - \else\ifnum\@glaparsestate=3 \hskip\lingglspace - \fi\fi\fi - \printlbrack\nobreak - \@glaparsestate=2 - \else\ifx\tempa\ep@Rbrack - \nobreak - \ifnum\@glaparsestate=0 \hskip\lingglbrackwordsep - \else\ifnum\@glaparsestate=2 \hskip\lingglspace - \else\ifnum\@glaparsestate=3 \hskip\lingglbrackbracksep - \fi\fi\fi - \printrbrack - \@glaparsestate=3 - \else - \ifnum\@glaparsestate=0 \hskip\lingglspace - \else\ifnum\@glaparsestate=2 \hskip\lingglbrackwordsep - \else\ifnum\@glaparsestate=3 \hskip\lingglspace - \fi\fi\fi - \@glaparsestate=0 - \glw@printcol - \fi\fi\fi\fi - \ifx\mainlist\empty \gl@loopmorefalse \fi + \fi + \@glaparsestate=1 + \leavevmode + \or + \@glaparsestate=1 + \or + \ifnum\@glaparsestate=0 \hskip\lingglspace + \else\ifnum\@glaparsestate=2 \hskip\lingglbrackbracksep + \else\ifnum\@glaparsestate=3 \hskip\lingglspace + \fi\fi\fi + \printlbrack\nobreak + \@glaparsestate=2 + \or + \nobreak + \ifnum\@glaparsestate=0 \hskip\lingglbrackwordsep + \else\ifnum\@glaparsestate=2 \hskip\lingglspace + \else\ifnum\@glaparsestate=3 \hskip\lingglbrackbracksep + \fi\fi\fi + \printrbrack + \@glaparsestate=3 + \or + \ifnum\@glaparsestate=0 \hskip\lingglspace \fi + \@glaparsestate=0 + {\@currentitem}% grouping to prevent font change contagion + \leavevmode + \fi + \ifx\itemtypelist\empty \gl@loopmorefalse \fi + \repeat + \par \egroup +} +\def\glw@printilgspace{% + \ifcase\@glaparsestate + \hskip\lingglspace + \or + \or \hskip\lingglbrackwordsep + \or \hskip\lingglspace + \fi + \@glaparsestate=0 +} +\def\glw@print@i{% + \glw@printilgspace + \glw@printglword +} +\newtoks\gltoks@sofar +\newtoks\gltoks@every +\newtoks\gltoks@next +\newbox\debug@glword +\def\glw@printglword{% + \begingroup + \gltoks@sofar={}% + \gl@loopmoretrue + \loop\ifgl@loopmore + \gl@lop\aboveskiplist\to\@aboveskip + \expandafter\ifdim\@aboveskip=0pt \def\@above{}\else + \edef\@above{\noalign{\vskip\@aboveskip}}\fi + \gl@lop\strutlist\to\@strut + \gl@lopTL\everylist\to\gltoks@every + \gl@lopTL\@currentitem\to\gltoks@next + \edef\temp{\the\gltoks@sofar \@above\@strut\the\gltoks@every\the\gltoks@next \cr}% + \gltoks@sofar=\expandafter{\temp}% + \ifx\@currentitem\empty \gl@loopmorefalse \fi \repeat + \setbox0\vtop{% + \ling@everyglword + \halign{\glwordalign{##}\cr \the\gltoks@sofar}}% + \box0 + \endgroup +} + +\def\gl@wordalignleft#1{#1\hfil} +\def\gl@wordaligncenter#1{\hfil#1\hfil} +\define@choicekey{ling}{glwordalign}[\ling@glwordalign\ep@glwordalign] + {left,center}{% + \ifcase\ep@glwordalign + \let\glwordalign=\gl@wordalignleft + \or + \let\glwordalign=\gl@wordaligncenter + \fi +} +%%%%%%%%%%%%%%%%%%%% nlevel style glosses %%%%%%%%%%%%%%%%%%%% +\def\ep@setglstrut{% + \ifling@glstruts \setbox\glstrutbox=\copy\strutbox + \else \setbox\glstrutbox=\hbox{}% + \fi } -\def\glw@printcol{% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\gln@begingl{\gln@begingl@a} +\def\gln@begingl@a{% + \bgroup + \parindent0pt + \bgroup + \@glspacefalse + \ep@setglstrut + \ifdim\ling@glwidth=0pt + \bgroup + \else + \vtop\bgroup + \hsize=\ling@glwidth + \leftskip=0pt + \fi + \futurelet\temp\gln@begingl@b +} +\def\gln@begingl@b{% + \ifx\temp\glpreamble \let\next=\relax + \else \let\next=\gln@ilg \fi \next} +\def\gln@preamble #1\endpreamble{% + \ling@everyglpreamble + #1\strut + \vskip\lingbelowglpreambleskip + \vskip\lingextraglskip + \egroup\bgroup + \gln@ilg +} +\def\gln@ilg{% + \ling@everyglilg + \lineskip=\lingextraglskip + \rightskip=\ling@glrightskip + \ifcase\ep@glhangstyle + \or + \hangindent=\ling@glhangindent + \hangafter=1 + \or + \ep@glmkcascade + \fi + \leavevmode + \gln@ilg@a +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\if@glspace +\def\gln@ilg@a{\futurelet\temp\gln@ilg@b} +\def\gln@ilg@b{\ifx\temp\endgl \let\next=\relax + \else \ifx\temp\nogloss \let\next=\gln@noglossword + \else \ifx\temp\glft \let\next=\relax + \else \let\next=\gln@word \fi\fi\fi \next } +\def\gln@noglossword{\expandafter\gln@word} +\def\gln@word #1[#2]#3 {% + \def\@currentitem{\\{#1}}% + \def\@diacritic{#3}% + \gln@ilg@f #2/\@nil + \gln@ilg@a +} +\def\nogloss#1{{#1}[]}% +\def\gln@ilg@f{\@ifnextchar\@space\gln@ilg@fi\gln@ilg@fii} +\def\gln@ilg@fi #1#2/{\gl@append #2\to\@currentitem \gln@ilg@g} +\def\gln@ilg@fii#1/{\gl@append #1\to\@currentitem \gln@ilg@g} +\def\gln@ilg@g{\@ifnextchar\@nil\gln@ilg@h\gln@ilg@f} +\def\gln@ilg@h #1{% + \gln@printglword + \ifx\@diacritic\empty + \else \expandafter\gln@diacritic\@diacritic\@nil \fi +} +\def\gln@printglword{% + \if@glspace \hskip\lingglspace \else \@glspacetrue \fi + \begingroup + \gltoks@sofar={}% + \lineskip=0pt + \ling@everyglword + \gl@loopmoretrue + \loop\ifgl@loopmore + \gl@lop\gln@abovelineskip\to\@aboveskip + \ifx\@aboveskip\empty \let\@above=\empty + \else \edef\@above{\noalign{\vskip\@aboveskip}}\fi + \gl@lopTL\gln@everyline\to\gltoks@every + \gl@lopTL\@currentitem\to\gltoks@next + \edef\temp{\the\gltoks@sofar \@above + \glstrut \the\gltoks@every \the\gltoks@next \cr}% + \gltoks@sofar=\expandafter{\temp}% + \ifx\@currentitem\empty \gl@loopmorefalse \fi + \repeat \vtop{% - \gl@lineskipsave + \lineskip=0pt \ling@everyglword - \gl@loopmoretrue - \loop\ifgl@loopmore - \glw@lop\tempa\to\@tempa - \glw@lop\aboveskiplist\to\@aboveskip - \glw@lop\strutlist\to\@strut - \glw@lop\everylist\to\@every - \expandafter\ifdim\@aboveskip=0pt \else - \vskip\@aboveskip \fi - \hbox{\@strut\@every\@tempa}% - \ifx\tempa\empty \gl@loopmorefalse \fi - \repeat - }% + \halign{\glwordalign{##}\cr \the\gltoks@sofar}}% + \endgroup +} +\def\gln@diacritic#1#2\@nil{% + \def\temp{#2}\ifx\temp\empty \else \ep@diacriticerror{#1#2}\fi + \if\noexpand #1\noexpand @\let\next\@glspacefalse + \else \if\noexpand #1\noexpand +\let\next\gln@after@c + \else \ep@diacriticerror{#1}\fi\fi + \next +} +\def\gln@after@c{% + \par + \ifcase\ep@glhangstyle + \or + \hangindent=\ling@glhangindent \hangafter=0 + \or + \glhangcarry + \fi + \leavevmode + \@glspacefalse +} +\def\ep@diacriticerror#1{% + \@expexerror{bad gloss diacritic: #1 (only @ and + permitted)}\end} +\def\gln@ft{% + \vskip\lingaboveglftskip + \vskip\lingextraglskip + \egroup\bgroup + \nointerlineskip + \strut + \ling@everyglft } +\def\gln@endgl{\par\egroup\egroup\egroup\egroup} +\define@lingkey{glneveryline}{\setlist\gln@everyline{#1}} +\define@lingkey{glnabovelineskip}{\setlist\gln@abovelineskip{#1}% + \gl@lop\gln@abovelineskip\to\temp + \gl@push{}\to\gln@abovelineskip + } +\def\setlist#1#2{\def#1{}\XKV@for@n{#2}\@this{\gl@eappend\@this\to#1}} +%\def\ep@setlist#1#2{\def#1{}\XKV@for@n{#2}\@this{\expandafter\ep@append\@this\to#1}} +%\def\setlist#1#2{\def#1{}\XKV@for@n{#2}\@this{\expandafter\gl@normalappend\@this\to#1}} +\lingset{glneveryline={\it},glnabovelineskip={}} +%%%%%%%%%%%%%%%% end nlevel %%%%%%%%%%%%%%%%%%%% + % ----- brackets ----- \newif\if@glpostbrack \newcount\@glaparsestate % 0 normal, 1 post @, 2 post [, 3 post ] @@ -1105,11 +1252,9 @@ \lingset{glbrackbracksep=.05em,glbrackwordsep=.1em} % 2011-12-09 introduce hook into \printlback and \printrbrack to allow font selection \define@ling@cmdkeys{everybrack} +\lingset{everybrack=\rm} \def\printlbrack{{\ling@everybrack [}} \def\printrbrack{{\ling@everybrack ]}} -\lingset{everybrack=\rm} -%\def\printrbrack{$]$} -%\def\printlbrack{$[$} % ----- cascading hanging indentation ----- \newdimen\glwcascade@pshapeindent \newdimen\glwcascade@pshapelinewd @@ -1121,18 +1266,27 @@ \advance\glwcascade@pshapeindent by \ling@glhangindent \advance\glwcascade@pshapelinewd by -\ling@glhangindent } -\def\glwcascade@mkshapeauxaux{\glwcascade@mkshapeaux\glwcascade@mkshapeaux - \glwcascade@mkshapeaux} -\def\glwcascade@makeshape{% - \glwcascade@pshapeindent=0pt - \glwcascade@pshapelinewd=\hsize - \glwcascade@mkshapeaux\glwcascade@mkshapeaux - \glwcascade@mkshapeaux\glwcascade@mkshapeaux +\def\ep@glmkcascade{{% + \ep@cnta=\ep@cascadecount + \ep@dima=\hsize + \advance\ep@dima by -\ep@cascadeindent + \edef\cascadeshape{} + \loop\ifnum\ep@cnta >0 + \edef\cascadeshape{\cascadeshape \the\ep@cascadeindent\space\the\ep@dima\space}% + \advance\ep@cascadeindent by \ling@glhangindent + \advance\ep@dima by -\ling@glhangindent + \advance\ep@cnta by -1 + \repeat + \xdef\cascadeshape{\noexpand\parshape\the\ep@cascadecount\space\cascadeshape}}% + \cascadeshape + \ignorespaces } -\def\glwcascade@makeshape{% - \glwcascade@pshapeindent=0pt - \glwcascade@pshapelinewd=\hsize - \glwcascade@mkshapeauxaux\glwcascade@mkshapeauxaux\glwcascade@mkshapeauxaux +\def\glhangcarry{% + \edef\next{\the\prevgraf}% + \advance\ep@cascadecount by -\next + \ep@dimc=\ling@glhangindent + \advance\ep@cascadeindent by \next\ep@dimc + \ep@glmkcascade } % ----- side by side (ss) gloss style ----- \define@choicekey{ling}{glftpos}[\temp\ep@glftpos]% @@ -1225,9 +1379,8 @@ \hbox{\ling@everytrailingcitation #1}% } \lingset{everytrailingcitation=} -\resetatcatcode %! ----- initial settings ----- -\definelingstyle{factorysettings}{% +\lingset{% aboveexskip=2.7ex plus .8ex minus .8ex, belowexskip=2.7ex plus .8ex minus .8ex, Everyex=, @@ -1247,10 +1400,15 @@ labelalign=left, belowpreambleskip=1ex, interpartskip=1ex, - splitexpenalty=200, +% splitexpenalty=200, exbreakfil=0pt plus 4ex, exbreakpenalty=-50, splitpartspenalty=200, +% auxiliary parameters used for building tables + dima=2.4em, + crskip=.6em +} +\lingset{% % parameters used in glosses glspace=.5em plus.4em minus.15em, glrightskip=0pt plus .1\hsize, @@ -1264,37 +1422,17 @@ everyglc=, everyglft=, everygl=, + everyglilg=, everyglword=, - autoglskip=true, + glwordalign=left, glwidth=0pt, glufcloseup=.4ex, everygluf=, -% everybracket=\rm, +% everybrack=\rm, % glbracketsep=.15em, glstyle=wrap, -% moregloffset=0pt, - gllineskip=1ex, - extraglskip=0pt, + extraglskip=.5ex, mincitesep=1.5em, -% auxiliary parameters used for building tables - dima=2.4em, - crskip=.6em + glstruts=true } -\lingset{lingstyle=factorysettings} -% restores version 4.0 gloss behaviour -\def\gloldstyle{% - \lingset{abovemoreglskip=1ex,autoglskip=false, - glstruts=false,glspace=.6em}} -% -%! -%! addons can be put in expex-add.tex -%! can be used to override factory settings and make -%! definitions and redefinitions that the user wants to alway be available -%! expex-add.tex can be put in the main Tex tree, or in the local -%! directory, depending on where the user wants it to have force -%! -%\newread\expexadd -%\openin\expexadd = expex-add.tex -%\ifeof\expexadd \else -% \closein\expexadd \input expex-add \fi - +\resetatcatcode |