summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/covington
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-12 20:17:53 +0000
committerKarl Berry <karl@freefriends.org>2019-05-12 20:17:53 +0000
commit6896186577e9edaddc27b28d3e51e8457b422c3a (patch)
treea5e890b6ba3eac02f8e54d4ddfec9f32ffa2a60e /Master/texmf-dist/tex/latex/covington
parenta9c3cb196735c7a45172b3c36740cd3c00ff7d59 (diff)
covington (12may19)
git-svn-id: svn://tug.org/texlive/trunk@51104 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/covington')
-rw-r--r--Master/texmf-dist/tex/latex/covington/covington.sty131
1 files changed, 83 insertions, 48 deletions
diff --git a/Master/texmf-dist/tex/latex/covington/covington.sty b/Master/texmf-dist/tex/latex/covington/covington.sty
index 437fb55395c..5925f74eb08 100644
--- a/Master/texmf-dist/tex/latex/covington/covington.sty
+++ b/Master/texmf-dist/tex/latex/covington/covington.sty
@@ -42,14 +42,16 @@
%%% Metadata
%%%
-\def\filedate{2018/12/10}
-\def\fileversion{2.0}
+\def\filedate{2019/05/12}
+\def\fileversion{2.1}
\def\filename{covington.sty}
% Force redefinition of environments?
\newif\ifforceredef\forceredeffalse
% Tweak text layout?
\newif\iftweaklayout\tweaklayouttrue
+% Prevent page breaks in glosses
+\newif\ifnoglossbreaks\noglossbreaksfalse
\@ifundefined{ProvidesPackage}{%
\typeout{* covington.sty : Covington's linguistic macros, \fileversion\ \filedate *}
@@ -58,6 +60,7 @@
[\filedate\space v\fileversion\space Covington's linguistic macros]
\DeclareOption{force}{\forceredeftrue}
\DeclareOption{keeplayout}{\tweaklayoutfalse}
+\DeclareOption{noglossbreaks}{\noglossbreakstrue}
\ProcessOptions
}
@@ -357,27 +360,38 @@
{\def\cov@selfnt{\selectfont}}
% Thanks to Hans-Peter Kolb for this macro.
-\def\gll % 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
- \catcode`\^^M=12
- \twosent
- }
+% Try to prevent page breaks in glosses if noglossbreaks option is set
+\def\cov@nopagebreak{}
+\ifnoglossbreaks
+\def\cov@nopagebreak{\let\reserved@e\vadjust\let\reserved@f\nobreak}
+\fi
-\def\glll % 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
- \catcode`\^^M=12
- \threesent
- }
+% 2019-05.07: optional preceding gloss text (non-interlinearized)
+\newcommand*\glosslinepreamble[1]{#1}
+\def\cov@glp{}
+\newcommand*\glosspreamble[1]{\def\cov@glp{#1}}
+
+\def\gll{% % 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
+ \catcode`\^^M=12
+ \twosent
+}
+
+\def\glll{% % 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
+ \catcode`\^^M=12
+ \threesent
+}
% The following two \x.. versions introduce special forms of glossing
@@ -386,27 +400,27 @@
% 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\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\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 \\
+\def\glt{{\hskip -\glossglue}\cov@nopagebreak\unhbox\gline\smallskip\cov@nopagebreak\newline} % \newline was \\
% Introduces translation.
% Required even if no translation follows.
@@ -414,7 +428,10 @@
% Alternative to glt, when one wants to
% put a number but no translation.
-\def\glend{\end{flushleft}} % Ends the gloss environment.
+\def\glend{%
+ \end{flushleft}%
+ \def\cov@glp{}%
+} % Ends the gloss environment.
% The following TeX code is adapted, with permission, from:
% gloss.tex: Macros for vertically aligning words in consecutive sentences.
@@ -488,11 +505,13 @@
\gdef\twosent#1^^M#2^^M% #1 = first line, #2 = second line
{\getwords(\lineone,\eachwordone)#1 ^^M%
\getwords(\linetwo,\eachwordtwo)#2 ^^M%
+ \ifx\cov@glp\empty\else\glosslinepreamble{\cov@glp}\cov@nopagebreak\newline\fi%
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
\global\setbox\gline=\hbox{\unhbox\gline
\hskip\glossglue
- \vtop{\box\wordone % vtop was vbox
+ \vtop{% vtop was vbox
+ \box\wordone
\nointerlineskip
\box\wordtwo
}%
@@ -507,12 +526,14 @@
{\getwords(\lineone,\eachwordone)#1 ^^M%
\getwords(\linetwo,\eachwordtwo)#2 ^^M%
\getwords(\linethree,\eachwordthree)#3 ^^M%
+ \ifx\cov@glp\empty\else\glosslinepreamble{\cov@glp}\cov@nopagebreak\newline\fi%
\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
+ \vtop{% vtop was vbox
+ \box\wordone
\nointerlineskip
\box\wordtwo
\nointerlineskip
@@ -546,11 +567,13 @@
\gdef\xtwosent#1\xgle#2\xgle% #1 = first line, #2 = second line
{\xgetwords(\lineone,\eachwordone)#1 \xgle%
\xgetwords(\linetwo,\eachwordtwo)#2 \xgle%
+ \ifx\cov@glp\empty\else\glosslinepreamble{\cov@glp}\cov@nopagebreak\newline\fi%
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
- \global\setbox\gline=\hbox{\unhbox\gline
- \hskip\glossglue
- \vtop{\box\wordone % vtop was vbox
+ \global\setbox\gline=\hbox{\unhbox\gline%
+ \hskip\glossglue%
+ \vtop{% vtop was vbox
+ \box\wordone
\nointerlineskip
\box\wordtwo
}%
@@ -565,12 +588,14 @@
{\xgetwords(\lineone,\eachwordone)#1 \xgle%
\xgetwords(\linetwo,\eachwordtwo)#2 \xgle%
\xgetwords(\linethree,\eachwordthree)#3 \xgle%
+ \ifx\cov@glp\empty\else\glosslinepreamble{\cov@glp}\cov@nopagebreak\newline\fi%
\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
+ \vtop{% vtop was vbox
+ \box\wordone
\nointerlineskip
\box\wordtwo
\nointerlineskip
@@ -647,6 +672,11 @@
\define@key{gcovington}{fsii}{\def\glosslinetwo{#1}}
\define@key{gcovington}{fsiii}{\def\glosslinethree{#1}}
%
+% 4. Gloss preamble text
+\def\cov@gglp{}
+\define@key{covington}{preamble}{\def\cov@lglp{#1}}
+\define@key{gcovington}{preamble}{\def\cov@gglp{#1}}
+%
% General setting option
\newcommand*\setglossoptions[1]{\setkeys{gcovington}{#1}}
%
@@ -669,6 +699,8 @@
\@ifundefined{lglosslineone}{}{\def\glosslineone{\lglosslineone}}%
\@ifundefined{lglosslinetwo}{}{\def\glosslinetwo{\lglosslinetwo}}%
\@ifundefined{lglosslinethree}{}{\def\glosslinethree{\lglosslinethree}}%
+ \@ifundefined{cov@lglp}{}{\def\cov@gglp{\cov@lglp}}%
+ \ifx\cov@gglp\empty\else\def\cov@glp{\cov@gglp}\fi%
\xgll #2\xgle
#3\xgle
\ifgtright
@@ -683,6 +715,7 @@
\let\lglosslineone\relax%
\let\lglosslinetwo\relax%
\let\lglosslinethree\relax%
+ \let\cov@lglp\relax%
}
% 2. \trigloss[<opts>]{<line 1>}{<line 2>}{<line 3>}{<translation>}
@@ -704,6 +737,8 @@
\@ifundefined{lglosslineone}{}{\def\glosslineone{\lglosslineone}}%
\@ifundefined{lglosslinetwo}{}{\def\glosslinetwo{\lglosslinetwo}}%
\@ifundefined{lglosslinethree}{}{\def\glosslinethree{\lglosslinethree}}%
+ \@ifundefined{cov@lglp}{}{\def\cov@gglp{\cov@lglp}}%
+ \ifx\cov@gglp\empty\else\def\cov@glp{\cov@gglp}\fi%
\xglll #2\xgle
#3\xgle
#4\xgle