From 6440a25141e789128a11f2475f4de3c19f4ca847 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 6 Apr 2017 00:29:09 +0000 Subject: covington (6Apr) git-svn-id: svn://tug.org/texlive/trunk@43704 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/covington/covington.sty | 105 +++++++++++++++++++-- 1 file changed, 98 insertions(+), 7 deletions(-) (limited to 'Master/texmf-dist/tex/latex/covington') diff --git a/Master/texmf-dist/tex/latex/covington/covington.sty b/Master/texmf-dist/tex/latex/covington/covington.sty index a9993405f84..9baf62e69f9 100644 --- a/Master/texmf-dist/tex/latex/covington/covington.sty +++ b/Master/texmf-dist/tex/latex/covington/covington.sty @@ -42,8 +42,8 @@ %%% Metadata %%% -\def\filedate{2016/08/26} -\def\fileversion{1.2} +\def\filedate{2017/04/05} +\def\fileversion{1.3} \def\filename{covington.sty} % Force redefinition of environments? @@ -227,7 +227,7 @@ %%% Sentences with word-by-word glosses %%% -% See covingtn.tex for full documentation. Some examples: +% See covington.tex for full documentation. Some examples: % % Displayed sentence with gloss and translation: % @@ -294,6 +294,33 @@ \threesent } + +% The following two \x.. versions introduce special forms of glossing +% macros that do not activate the newline char. The latter does not +% work inside arguments (see http://tex.stackexchange.com/questions/169740) +% Inspired by this post of David Carlisle to the mentioned stackexchange thread: +% http://tex.stackexchange.com/a/169744/19291 +% These macros require the gloss lines to be ended explicitly with \xgle +\def\xgll % Introduces 2-line text-and-gloss. + {\begin{flushleft} +\vskip\baselineskip% % Added 1992 Nov 8 to force single spacing +\def\baselinestretch{1}% +\cov@selfnt% +\vskip-\baselineskip% + \bgroup + \ignorespaces\xtwosent + } + +\def\xglll % Introduces 3-line text-and-gloss. + {\begin{flushleft} +\vskip\baselineskip% % Added 1992 Nov 8 to force single spacing +\def\baselinestretch{1}% +\cov@selfnt% +\vskip-\baselineskip% + \bgroup + \ignorespaces\xthreesent + } + \def\glt{{\hskip -\glossglue}\unhbox\gline\smallskip\newline} % \newline was \\ % Introduces translation. % Required even if no translation follows. @@ -409,6 +436,63 @@ } } % restore \catcode`\^^M +% An explicit gloss line ending (for \xgll and \xglll variants= +\gdef\xgle{} +% Special versions of \getwords, \donewords, \twosent and \threesent for the \x.. +% variants of gloss introducers (using \xgle as separator instead of active newline) +\gdef\xgetwords(#1,#2)#3 #4\xgle% #1=linebox, #2=\each, #3=1st word, #4=remainder + {\setbox#1=\vbox{\hbox{#2\strut#3 }% adds space + \unvbox#1% + }% + \def\more{#4}% + \ifx\more\empty\let\more=\xdonewords + \else\let\more=\xgetwords + \fi + \more(#1,#2)#4\xgle% + } + +\gdef\xdonewords(#1,#2)\xgle{}% + +\gdef\xtwosent#1\xgle#2\xgle% #1 = first line, #2 = second line + {\xgetwords(\lineone,\eachwordone)#1 \xgle% + \xgetwords(\linetwo,\eachwordtwo)#2 \xgle% + \loop\lastword{\eachwordone}{\lineone}{\wordone}% + \lastword{\eachwordtwo}{\linetwo}{\wordtwo}% + \global\setbox\gline=\hbox{\unhbox\gline + \hskip\glossglue + \vtop{\box\wordone % vtop was vbox + \nointerlineskip + \box\wordtwo + }% + }% + \testdone + \ifnotdone + \repeat + \egroup % matches \bgroup in \gloss + } + +\gdef\xthreesent#1\xgle#2\xgle#3\xgle% #1 = first line, #2 = second line, #3 = third + {\xgetwords(\lineone,\eachwordone)#1 \xgle% + \xgetwords(\linetwo,\eachwordtwo)#2 \xgle% + \xgetwords(\linethree,\eachwordthree)#3 \xgle% + \loop\lastword{\eachwordone}{\lineone}{\wordone}% + \lastword{\eachwordtwo}{\linetwo}{\wordtwo}% + \lastword{\eachwordthree}{\linethree}{\wordthree}% + \global\setbox\gline=\hbox{\unhbox\gline + \hskip\glossglue + \vtop{\box\wordone % vtop was vbox + \nointerlineskip + \box\wordtwo + \nointerlineskip + \box\wordthree + }% + }% + \testdone + \ifnotdone + \repeat + \egroup % matches \bgroup in \gloss + } + %\def\gloss % raw TeX macro for 2 aligned lines % {\bgroup % \catcode`\^^M=12 @@ -612,14 +696,21 @@ \fi } +\newlength\reflistindent +\setlength\reflistindent{3em} +\newlength\reflistitemsep +\setlength\reflistitemsep{6pt} +\newlength\reflistparsep +\setlength\reflistparsep{\parsep} \@ifundefined{reflist}{ \newenvironment{reflist}{\begin{list}{}% {\setlength{\labelwidth}{0pt} \setlength{\labelsep}{0pt} - \setlength{\leftmargin}{3em} - \setlength{\itemindent}{-3em} - \setlength{\listparindent}{-3em} - \setlength{\itemsep}{6pt}}\item}{\end{list}} + \setlength{\leftmargin}{\reflistindent} + \setlength{\itemindent}{-\reflistindent} + \setlength{\listparindent}{-\reflistindent} + \setlength{\itemsep}{\reflistitemsep} + \setlength{\parsep}{\reflistparsep}}\item}{\end{list}} } % Modified 1992 Nov 8 to skip defining reflist if reflist is already % defined. Permits using uga.sty with covingtn.sty. -- cgit v1.2.3