summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/covington/covington.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-06-03 03:01:14 +0000
committerNorbert Preining <norbert@preining.info>2023-06-03 03:01:14 +0000
commit644a486a866b7bcbf8fccb37cf6f88a36897deb0 (patch)
treeb8593330c0b54d298644dacf70e3b79918acf6b2 /macros/latex/contrib/covington/covington.sty
parentde88ff1738cd9e29da5d2ce94b53d9035d9be6a4 (diff)
CTAN sync 202306030301
Diffstat (limited to 'macros/latex/contrib/covington/covington.sty')
-rw-r--r--macros/latex/contrib/covington/covington.sty723
1 files changed, 494 insertions, 229 deletions
diff --git a/macros/latex/contrib/covington/covington.sty b/macros/latex/contrib/covington/covington.sty
index 5218249db1..06792446c4 100644
--- a/macros/latex/contrib/covington/covington.sty
+++ b/macros/latex/contrib/covington/covington.sty
@@ -42,10 +42,15 @@
%%% Metadata
%%%
-\def\filedate{2023/05/26}
-\def\fileversion{2.9}
+\def\filedate{2023/06/02}
+\def\fileversion{2.10}
\def\filename{covington.sty}
+% Macro to issue warnings
+\newcommand\cov@warning[1]{%
+ \PackageWarning{covington}{#1}%
+}
+
% Force redefinition of environments?
\newif\ifforceredef\forceredeffalse
% Tweak text layout?
@@ -59,43 +64,61 @@
% Reset separate counter in footnote
\newif\ifresetownfnexcounter\resetownfnexcounterfalse
-\@ifundefined{ProvidesPackage}{%
-\typeout{* covington.sty -- Macros for Linguistics, \fileversion\ \filedate *}
-}{%
\ProvidesPackage{covington}
[\filedate\space v\fileversion\space Macros for Linguistics]
-\DeclareOption{force}{\forceredeftrue}
-\DeclareOption{keeplayout}{\tweaklayoutfalse}
-\DeclareOption{noglossbreaks}{\noglossbreakstrue}
-\DeclareOption{owncounter}{\ownexcountertrue}
-\DeclareOption{ownfncounter}{\ownfnexcountertrue}
-\DeclareOption{ownfncounter*}{\ownfnexcountertrue\resetownfnexcountertrue}
-\ProcessOptions
+
+\DeclareKeys[covington]
+{
+ % 1. force=<true|false>
+ force.if = forceredef,
+ % 2. keeplayout=<true|false>
+ keeplayout.ifnot = tweaklayout,
+ % 3. noglossbreaks=<true|false>
+ noglossbreaks.if = noglossbreaks,
+ % 4. owncounter=<true|false>
+ owncounter.if = ownexcounter,
+ % 5. fnexamplecounter=<main|own|own-reset>
+ fnexamplecounter.choice:,
+ % a. main
+ fnexamplecounter / main.code:n = { \ownfnexcounterfalse\resetownfnexcounterfalse },
+ % b. own
+ fnexamplecounter / own.code:n = { \ownfnexcountertrue\resetownfnexcounterfalse },
+ % c. own-reset
+ fnexamplecounter / own-reset.code:n = { \ownfnexcountertrue\resetownfnexcountertrue },
+ fnexamplecounter.default:n = { main },
+ % DEPRECATED OPTONS
+ % force=<true|false>
+ ownfncounter.code:n =
+ { \ownfnexcountertrue
+ \resetownfnexcounterfalse
+ \cov@warning{Option 'ownfncounter' is deprecated!\MessageBreak
+ Please use fnexamplecounter=own instead.}
+ },
+ % force=<true|false>
+ ownfncounter*.code =
+ { \ownfnexcountertrue
+ \resetownfnexcountertrue
+ \cov@warning{Option 'ownfncounter*' is deprecated!\MessageBreak
+ Please use fnexamplecounter=own-reset instead.}
+ }
}
+% Process package options
+\ProcessKeyOptions[covington]
+
%
% Required packages
%
-\RequirePackage{xkeyval}
\RequirePackage{iftex}
-% Macro to issue warnings
-\newcommand\cov@warning[1]{%
- \@ifundefined{PackageWarning}{%
- \typeout{* covington warning : #1 *}
- }{%
- \PackageWarning{covington}{#1}%
- }
-}
-
%%%
%%% Preferences about how text is laid out
%%%
% New 2018-08-24: Option to opt-out these layout tweaks
\iftweaklayout
-\setlength{\textfloatsep}{0.7in}
-\raggedbottom
+ \setlength{\textfloatsep}{0.7in}
+ \raggedbottom
\fi
%%%
@@ -172,6 +195,8 @@
\newcommand*\@@exampleno{\ifownexcounter\thecovex\else\theequation\fi}
\newcommand*\exampleno{\@ifstar{\@@exampleno}{\@exampleno}}
+\let\fnexfmt\roman
+
\newif\ifcov@infootnote\cov@infootnotefalse
\ifownfnexcounter
% Check whether we are in a footnote
@@ -182,7 +207,7 @@
\else
\newcounter{covfnex}
\fi
- \renewcommand{\thecovfnex}{\roman{covfnex}}
+ \renewcommand{\thecovfnex}{\fnexfmt{covfnex}}
\fi
%%%
@@ -190,8 +215,8 @@
%%%
% Font setting possibility for example sentences
-\newcommand*\covexamplefs{}
-\newcommand*\covexamplenofs{\normalfont}
+\newcommand*\covexamplefs{\normalfont\upshape}
+\newcommand*\covexamplenofs{\normalfont\upshape}
% example is an environment for displaying a single numbered
% example, preceded by its number. Example of use:
@@ -219,20 +244,106 @@
% with packages/classes that roll their own example environment
% (such as beamer).
+% Helper function for numbering templates
+\newif\ifcov@have@exno\cov@have@exnofalse
+
+\def\cov@parse@number@loop#1{%
+ \ifx\relax#1\else%
+ \cov@parse@number@loop@body{#1}\expandafter\cov@parse@number@loop%
+ \fi%
+}
+
+\newcommand\cov@parse@number@loop@body[1]{%
+ \ifcov@have@exno%
+ \let\cov@@tmpfmtright\cov@tmpfmtright%
+ \edef\cov@tmpfmtright{\cov@@tmpfmtright#1}%
+ \else%
+ \ifx 1#1%
+ \cov@have@exnotrue%
+ \let\cov@tmpfmt\arabic%
+ \else%
+ \ifx i#1%
+ \cov@have@exnotrue%
+ \let\cov@tmpfmt\roman%
+ \else%
+ \ifx I#1%
+ \cov@have@exnotrue%
+ \let\cov@tmpfmt\Roman%
+ \else%
+ \ifx a#1%
+ \cov@have@exnotrue%
+ \let\cov@tmpfmt\alph%
+ \else%
+ \ifx A#1%
+ \cov@have@exnotrue%
+ \let\cov@tmpfmt\Alph%
+ \else%
+ \let\cov@@tmpfmtleft\cov@tmpfmtleft%
+ \edef\cov@tmpfmtleft{\cov@@tmpfmtleft#1}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+}%
+
+\newcommand\cov@parse@number@template[3]{%
+ \cov@have@exnofalse%
+ \let\cov@tmpfmt\roman%
+ \def\cov@tmpfmtleft{}%
+ \def\cov@tmpfmtright{}%
+ \cov@parse@number@loop#1\relax%
+ \expandafter\let\csname#2\endcsname\cov@tmpfmt%
+ \expandafter\let\csname cov@tmpfmtleft#3\endcsname\cov@tmpfmtleft%
+ \expandafter\let\csname cov@tmpfmtright#3\endcsname\cov@tmpfmtright%
+ \ifcov@have@exno%
+ \expandafter\renewcommand\csname#3\endcsname[1]{%
+ \csname cov@tmpfmtleft#3\endcsname##1\csname cov@tmpfmtright#3\endcsname}%
+ \else%
+ \expandafter\renewcommand\csname#3\endcsname[1]{%
+ \csname cov@tmpfmtleft#3\endcsname\csname cov@tmpfmtright#3\endcsname}%
+ \fi%
+}
+
+\newif\if@cov@expst@star\@cov@expst@starfalse
+
% 2022-08-20 (v. 2.8): optional preceding example text
-\define@key{cov@ex}{preamble}{\def\cov@xp{#1}}
\newcommand*\expreamblefs{\normalfont}
\newcommand\expreamble[1]{\bgroup\expreamblefs#1\egroup\par}
-\newif\if@cov@expst@star\@cov@expst@starfalse
-\define@key{cov@ex}{postamble}{\def\cov@xpst{#1}\@cov@expst@starfalse}
-\define@key{cov@ex}{postamble*}{\def\cov@xpst{#1}\@cov@expst@startrue}
% 2023.05.26 (v. 2.9): optional trailung subexample text
\newcommand*\expostamblefs{\normalfont}
\newcommand*\expostamble[1]{\bgroup\expostamblefs#1\egroup}
+\DeclareKeys[covexpl]
+{
+ % font settings
+ fs.store = \covexamplefs,
+ % font settings of the ex. number
+ fsno.store = \covexamplenofs,
+ % preamble
+ preamble.store = \cov@xp,
+ % postamble
+ postamble.code = { \def\cov@xpst{#1}\@cov@expst@starfalse },
+ % postamble* (no space)
+ postamble*.code = { \def\cov@xpst{#1}\@cov@expst@startrue },
+ % preamble font settings
+ fspreamble.store = \expreamblefs,
+ % postamble font settings
+ fspostamble.store = \expostamblefs,
+ % leftmargin
+ leftmargin.code = { \setlength{\exampleind}{#1} },
+ % addnumbersep
+ addnumbersep.code = { \setlength{\examplenumbersep}{#1} },
+ % numberformat={template}
+ numberformat.code = { \cov@parse@number@template{#1}{exfmt}{covexnumber} },
+ % fnnumberformat={template}
+ fnumberformat.code = { \cov@parse@number@template{#1}{fnexfmt}{covexnumberfn} }
+}
+
\newenvironment{covexample}[1][]{%
- \ifx#1\empty\else\setkeys{cov@ex}{#1}\fi%
+ \ifx#1\empty\else\SetKeys[covexpl]{#1}\fi%
\begin{covexamples}
\item\@ifundefined{cov@xp}{}{\expreamble{\cov@xp}}% insert preamble if given
}{%
@@ -289,39 +400,43 @@
\newcommand*\covexnumber[1]{(#1)}
\newcommand*\covexnumberfn[1]{\covexnumber{#1}}
-\newenvironment{covexamples}% % define "example" environment
-{%
-\begin{list}%
-{%
- \covexamplenofs% font
- \ifcov@infootnote
- \covexnumberfn{\thecovfnex}%
- \else
- \covexnumber{\@@exampleno}%
- \fi
-}%
-{%
- \addtolength{\labelwidth}{\examplenumbersep}%
- \addtolength{\leftmargin}{\examplenumbersep}%
- \addtolength{\leftmargin}{\exampleind}%
- \ifcov@infootnote
- \setcounter{covexsave}{\arabic{covfnex}}%
- \usecounter{covfnex}%
- \setcounter{covfnex}{\arabic{covexsave}}%
- \else
- \ifownexcounter
- \setcounter{covexsave}{\arabic{covex}}%
- \usecounter{covex}% % sets it to zero, unwantedly
- \setcounter{covex}{\arabic{covexsave}}% % restores previous value
+\let\exfmt\arabic
+
+\newenvironment{covexamples}[1][]{% % define "examples" environment
+ \ifx#1\empty\else\SetKeys[covexpl]{#1}\fi%
+ \begin{list}%
+ {%
+ \covexamplenofs% font
+ \ifcov@infootnote
+ \covexnumberfn{\thecovfnex}%
\else
- \setcounter{covexsave}{\arabic{equation}}%
- \usecounter{equation}% % sets it to zero, unwantedly
- \setcounter{equation}{\arabic{covexsave}}% % restores previous value
+ \covexnumber{\@@exampleno}%
\fi
- \fi
- \setlength{\listparindent}{0pt}%
- \def\makelabel##1{##1\hfil}% % put labels flushleft in space available
-}%
+ }%
+ {%
+ \addtolength{\labelwidth}{\examplenumbersep}%
+ \addtolength{\leftmargin}{\examplenumbersep}%
+ \addtolength{\leftmargin}{\exampleind}%
+ \ifcov@infootnote
+ \setcounter{covexsave}{\arabic{covfnex}}%
+ \usecounter{covfnex}%
+ \setcounter{covfnex}{\arabic{covexsave}}%
+ \else
+ \ifownexcounter
+ \renewcommand{\thecovex}{\exfmt{covex}}%
+ \setcounter{covexsave}{\arabic{covex}}%
+ \usecounter{covex}% % sets it to zero, unwantedly
+ \setcounter{covex}{\arabic{covexsave}}% % restores previous value
+ \else
+ \renewcommand{\theequation}{\exfmt{equation}}%
+ \setcounter{covexsave}{\arabic{equation}}%
+ \usecounter{equation}% % sets it to zero, unwantedly
+ \setcounter{equation}{\arabic{covexsave}}% % restores previous value
+ \fi
+ \fi
+ \setlength{\listparindent}{0pt}%
+ \def\makelabel##1{##1\hfil}% % put labels flushleft in space available
+ }%
\raggedright% text is flushleft, not justified
\covexamplefs%
}%
@@ -356,29 +471,63 @@
% \item This is the second subexample.
% \end{subexamples}
-\newlength\subexamplenumbersep
-\setlength\subexamplenumbersep{0pt}
-
-\newcommand*\covsubexnumber[1]{(#1)}
-
% 2019-06-21 (v. 2.3): optional preceding subexample text
-\define@key{cov@subex}{preamble}{\def\cov@sxp{#1}}
\newcommand*\subexpreamblefs{\normalfont}
\newcommand\subexpreamble[1]{\bgroup\subexpreamblefs#1\egroup\par}
% 2023.05.26 (v. 2.9): optional trailung subexample text
-\define@key{cov@subex}{postamble}{\def\cov@sxpst{#1}}
\newcommand*\subexpostamblefs{\normalfont}
-\newcommand*\subexpostamble[1]{\bgroup\expostamblefs#1\egroup}
+\newcommand*\subexpostamble[1]{\bgroup\subexpostamblefs#1\egroup}
+
+\DeclareKeys[covsubexpl]
+{
+ % font settings
+ fs.store = \covexamplefs,
+ % font settings
+ fsno.store = \covexamplenofs,
+ % preamble text
+ preamble.store = \cov@sxp,
+ % postamble text
+ postamble.store = \cov@sxpst,
+ % preamble font settings
+ fspreamble.store = \subexpreamblefs,
+ % postamble font settings
+ fspostamble.store = \subexpostamblefs,
+ % preamble font settings (alias)
+ fssubpreamble.store = \subexpreamblefs,
+ % postamble font settings (alias)
+ fssubpostamble.store = \subexpostamblefs,
+ % leftmargin
+ leftmargin.code = { \setlength{\exampleind}{#1} },
+ % addnumbersep
+ addnumbersep.code = { \setlength{\examplenumbersep}{#1} },
+ % addnumbersep
+ addsubnumbersep.code = { \setlength{\subexamplenumbersep}{#1} },
+ % numberformat={template}
+ numberformat.code = { \cov@parse@number@template{#1}{exfmt}{covexnumber} },
+ % fnnumberformat={template}
+ fnumberformat.code = { \cov@parse@number@template{#1}{fnexfmt}{covexnumberfn} },
+ % subnumberformat={template}
+ subnumberformat.code = { \cov@parse@number@template{#1}{subexfmt}{covsubexnumber} }
+}
+
+\newlength\subexamplenumbersep
+\setlength\subexamplenumbersep{0pt}
+
+\newcommand*\covsubexnumber[1]{(#1)}
+
+\let\subexfmt\alph
\newenvironment{covsubexamples}[1][]% % define "subexamples" environment
{%
- \ifx#1\empty\else\setkeys{cov@subex}{#1}\fi%
+ \let\cov@xp\relax%
+ \let\cov@xpst\relax%
+ \ifx#1\empty\else\SetKeys[covsubexpl]{#1}\fi%
\begin{covexample}%
- \@ifundefined{cov@sxp}{}{\subexpreamblefs\cov@sxp}% insert preamble if given
+ \@ifundefined{cov@sxp}{}{\bgroup\subexpreamblefs\cov@sxp\egroup}% insert preamble if given
\begin{enumerate}
\addtolength{\labelsep}{\subexamplenumbersep}%
- \renewcommand\theenumi{\alph{enumi}}
+ \renewcommand\theenumi{\subexfmt{enumi}}
\renewcommand\labelenumi{\covexamplenofs\covsubexnumber{\theenumi}}
\renewcommand\p@enumi{\@@exampleno\,}%
\setlength{\listparindent}{0pt}%
@@ -395,17 +544,58 @@
\@ifundefined{subexamples}{%
\newenvironment{subexamples}[1][]{\begin{covsubexamples}[#1]}{\end{covsubexamples}}
}{%
-\ifforceredef
- \renewenvironment{subexamples}[1][]{\begin{covsubexamples}[#1]}{\end{covsubexamples}}
- \cov@warning{The subexamples environment was already defined. Redefining it.}
-\else
- \cov@warning{The subexamples environment was already defined.^^J
- Covington does not touch it.^^J
- Use covsubexamples if you want to access covington's^^J
- version, or use the force package option.}
-\fi
+ \ifforceredef
+ \renewenvironment{subexamples}[1][]{\begin{covsubexamples}[#1]}{\end{covsubexamples}}
+ \cov@warning{The subexamples environment was already defined. Redefining it.}
+ \else
+ \cov@warning{The subexamples environment was already defined.^^J
+ Covington does not touch it.^^J
+ Use covsubexamples if you want to access covington's^^J
+ version, or use the force package option.}
+ \fi
+}
+
+\DeclareKeys[gcovexamples]
+{
+ % font settings
+ fs.store = \covexamplefs,
+ % font settings
+ fsno.store = \covexamplenofs,
+ % preamble
+ preamble.store = \cov@xp,
+ % postamble
+ postamble.code = { \def\cov@xpst{#1}\@cov@expst@starfalse },
+ % postamble* (no space)
+ postamble*.code = { \def\cov@xpst{#1}\@cov@expst@startrue },
+ % preamble text
+ subpreamble.store = \cov@sxp,
+ % postamble text
+ subpostamble.store = \cov@sxpst,
+ % preamble font settings
+ fspreamble.store = \expreamblefs,
+ % postamble font settings
+ fspostamble.store = \expostamblefs,
+ % preamble font settings
+ fssubpreamble.store = \subexpreamblefs,
+ % postamble font settings
+ fssubpostamble.store = \subexpostamblefs,
+ % leftmargin
+ leftmargin.code = { \setlength{\exampleind}{#1} },
+ % addnumbersep
+ addnumbersep.code = { \setlength{\examplenumbersep}{#1} },
+ % addsubnumbersep
+ addsubnumbersep.code = { \setlength{\subexamplenumbersep}{#1} },
+ % numberformat={template}
+ numberformat.code = { \cov@parse@number@template{#1}{exfmt}{covexnumber} },
+ % fnnumberformat={template}
+ fnumberformat.code = { \cov@parse@number@template{#1}{fnexfmt}{covexnumberfn} },
+ % subnumberformat={template}
+ subnumberformat.code = { \cov@parse@number@template{#1}{subexfmt}{covsubexnumber} }
}
+% General setting option
+\newcommand*\setexampleoptions[1]{\SetKeys[gcovexamples]{#1}}
+
%%%
@@ -468,17 +658,26 @@
% 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}
+ \def\cov@nopagebreak{\let\reserved@e\vadjust\let\reserved@f\nobreak}
\fi
+\def\cov@emphasized{\normalfont\itshape}%
+\def\cov@normalfont{\normalfont\upshape}%
+
+\def\cov@fsglpreamble@global{\cov@normalfont}
+\def\cov@fsglpostamble@global{\cov@normalfont}
+\def\cov@fstl@global{\cov@normalfont}
+
% 2019-05-07: optional preceding gloss text (non-interlinearized)
-\newcommand*\glosslinepreamble[1]{#1}
-\def\cov@glp{}
-\newcommand*\glosspreamble[1]{\def\cov@glp{#1}}
+\def\fsglpreamble{\cov@fsglpreamble@global}
+\newcommand*\glosslinepreamble[1]{\bgroup\fsglpreamble{}#1\egroup}
+\def\cov@gl@preamble@text{}
+\newcommand*\glosspreamble[1]{\def\cov@gl@preamble@text{#1}}
% 2021-09-01: optional trailing gloss text (non-interlinearized)
-\newcommand*\glosslinepostamble[1]{#1}
-\def\cov@glpst{}
+\def\fsglpostamble{\cov@fsglpostamble@global}
+\newcommand*\glosslinepostamble[1]{\bgroup\fsglpostamble{}#1\egroup}
+\def\cov@gl@postamble@text{}
\def\gll{% % Introduces 2-line text-and-gloss.
\begin{flushleft}
@@ -539,8 +738,8 @@
\def\glend{%
\end{flushleft}%
- \def\cov@glp{}%
- \def\cov@glpst{}%
+ \def\cov@gl@preamble@text{}%
+ \def\cov@gl@postamble@text{}%
} % Ends the gloss environment.
% The following TeX code is adapted, with permission, from:
@@ -563,19 +762,14 @@
\glossglue = 5pt plus 2pt minus 1pt % allow stretch/shrink between words
\newif\ifnotdone
-% Add semantic markup (with latex 2.09 backwards support)
-\@ifundefined{selectfont}{%
- \def\cov@emphasized{\it}%
- \def\cov@normalfont{\rm}%
-}{%
- \def\cov@emphasized{\normalfont\itshape}%
- \def\cov@normalfont{\normalfont\upshape}%
-}
-
% Font settings for gloss lines
-\newcommand*\glosslineone{\cov@emphasized}
-\newcommand*\glosslinetwo{\cov@normalfont}
-\newcommand*\glosslinethree{\cov@normalfont}
+\newcommand*\glosslineone@global{\cov@emphasized}
+\newcommand*\glosslinetwo@global{\cov@normalfont}
+\newcommand*\glosslinethree@global{\cov@normalfont}
+
+\let\glosslineone\glosslineone@global
+\let\glosslinetwo\glosslinetwo@global
+\let\glosslinethree\glosslinethree@global
\def\eachwordone{\glosslineone}
\def\eachwordtwo{\glosslinetwo}
@@ -615,7 +809,10 @@
\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%
+ \ifx\cov@gl@preamble@text\empty%
+ \else%
+ \glosslinepreamble{\cov@gl@preamble@text}\cov@nopagebreak\newline%
+ \fi%
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
\global\setbox\gline=\hbox{\unhbox\gline
@@ -636,7 +833,10 @@
{\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%
+ \ifx\cov@gl@preamble@text\empty%
+ \else%
+ \glosslinepreamble{\cov@gl@preamble@text}\cov@nopagebreak\newline%
+ \fi%
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
\lastword{\eachwordthree}{\linethree}{\wordthree}%
@@ -677,7 +877,10 @@
\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%
+ \ifx\cov@gl@preamble@text\empty%
+ \else%
+ \glosslinepreamble{\cov@gl@preamble@text}\cov@nopagebreak\newline%
+ \fi%
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
\global\setbox\gline=\hbox{\unhbox\gline%
@@ -698,7 +901,10 @@
{\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%
+ \ifx\cov@gl@preamble@text\empty%
+ \else%
+ \glosslinepreamble{\cov@gl@preamble@text}\cov@nopagebreak\newline%
+ \fi%
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
\lastword{\eachwordthree}{\linethree}{\wordthree}%
@@ -718,8 +924,10 @@
\egroup % matches \bgroup in \gloss
}
-% V. 2.0: enquotable translation line
-\newcommand*\glosslinetrans[1]{\covenquote{#1}}
+% V. 2.0: enquotable translation line
+\newif\ifcov@enquote@tl\cov@enquote@tltrue
+\def\cov@fstl{\cov@fstl@global}
+\newcommand*\glosslinetrans[1]{\bgroup\cov@fstl\ifcov@enquote@tl\covenquote{#1}\else#1\fi\egroup}
\newcommand*\glot[1]{%
\def\tempx{#1}%
\ifx\tempx\empty\gln
@@ -730,151 +938,202 @@
%
% Key-val options for the macros
%
-% 1. ex=<true|false>
-\newif\ifgexample\gexamplefalse
-\newif\ifggexample\ggexamplefalse
-\define@boolkey+{covington}{ex}[true]{%
- \ifKV@covington@ex
- \gexampletrue
- \else
- \gexamplefalse
- \fi
-}{%
- \cov@warning{unknown env value '#1' in gloss macro}%
-}
-\define@boolkey+{gcovington}{ex}[true]{%
- \ifKV@gcovington@ex
- \ggexampletrue
- \else
- \ggexamplefalse
- \fi
-}{%
- \cov@warning{unknown env value '#1' in setglossoptions}%
-}
-\newif\ifgtright\gtrightfalse
-\newif\ifggtright\ggtrightfalse
-%
-% 2. tlb=<true|false>
-\define@boolkey+{covington}{tlr}[true]{%
- \ifKV@covington@tlr
- \gtrighttrue
- \else
- \gtrightfalse
- \fi
-}{%
- \cov@warning{unknown tlr value '#1' in gloss macro}%
+\newif\ifcov@ex@gloss\cov@ex@glossfalse
+\newif\ifcov@ex@gloss@global\cov@ex@gloss@globalfalse
+\newif\ifcov@tlr\cov@tlrfalse
+\newif\ifcov@tlr@global\cov@tlr@globalfalse
+\newif\ifcov@enquote@tl@global\cov@enquote@tl@globaltrue
+\def\cov@gl@preamble@global{}
+\def\cov@gl@postamble@global{}
+
+\DeclareKeys[covgloss]
+{
+ % 1. ex=<true|false>
+ ex.if = cov@ex@gloss,
+ % 2. tlr=<true|false>
+ tlr.if = cov@tlr,
+ % 3. font settings for gloss line i, ii, iii
+ fsi.store = \lglosslineone,
+ fsii.store = \lglosslinetwo,
+ fsiii.store = \lglosslinethree,
+ % 4. Gloss preamble text
+ preamble.code = { \edef\cov@gl@preamble{#1} },
+ % 5. Gloss postamble text
+ postamble.store = \cov@gl@postamble,
+ % 6. Gloss preamble font settings
+ fspreamble.store = \cov@fsglpreamble@local,
+ % 7. Gloss postamble font settings
+ fspostamble.store = \cov@fsglpostamble@local,
+ % 8. Enquote translation line
+ enquotetl.if = cov@enquote@tl,
+ % 9. translation line font settings
+ fstl.store = \cov@fstl@local
}
-\define@boolkey+{gcovington}{tlr}[true]{%
- \ifKV@gcovington@tlr
- \ggtrighttrue
- \else
- \ggtrightfalse
- \fi
-}{%
- \cov@warning{unknown tlr value '#1' in setglossoptions}%
+
+\DeclareKeys[gcovgloss]
+{
+ % 1. ex=<true|false>
+ ex.if = cov@ex@gloss@global,
+ % 2. tlr=<true|false>
+ tlr.if = cov@tlr@global,
+ % 3. font settings for gloss line i, ii, iii
+ fsi.code = { \global\def\glosslineone@global{#1} },
+ fsii.code = { \global\def\glosslinetwo@global{#1} },
+ fsiii.code = { \global\def\glosslinethree@global{#1} },
+ % 4. Gloss preamble text
+ preamble.code = { \global\def\cov@gl@preamble@global{#1} },
+ % 5. Gloss postamble text
+ postamble.code = { \global\def\cov@gl@postamble@global{#1} },
+ % 6. Gloss preamble font settings
+ fspreamble.code = { \global\def\cov@fsglpreamble@global{#1} },
+ % 7. Gloss postamble font settings
+ fspostamble.code = { \global\def\cov@fsglpostamble@global{#1} },
+ % 8. Enquote translation line
+ enquotetl.if = cov@enquote@tl@global,
+ % 9. translation line font settings
+ fstl.code = { \global\def\cov@fstl@global{#1} }
}
-%
-% 3. font settings for gloss line i, ii, iii
-\define@key{covington}{fsi}{\def\lglosslineone{#1}}
-\define@key{covington}{fsii}{\def\lglosslinetwo{#1}}
-\define@key{covington}{fsiii}{\def\lglosslinethree{#1}}
-\define@key{gcovington}{fsi}{\def\glosslineone{#1}}
-\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}}
-%
-% 5. Gloss postamble text
-\def\cov@gglpst{}
-\define@key{covington}{postamble}{\def\cov@lglpst{#1}}
-\define@key{gcovington}{postamble}{\def\cov@gglpst{#1}}
+
+
+\let\cov@fsglpreamble@local\relax%
+\let\cov@fsglpostamble@local\relax%
+\let\cov@fstl@local\relax%
+
%
% General setting option
-\newcommand*\setglossoptions[1]{\setkeys{gcovington}{#1}}
+\newcommand*\setglossoptions[1]{\SetKeys[gcovgloss]{#1}}
%
% 1. \digloss[<opts>]{<line 1>}{<line 2>}{<translation>}
\newcommand*\digloss[4][\empty]{%
- \ifggexample
- \setkeys{covington}{ex=true}
+ \let\lglosslineone\relax%
+ \let\lglosslinetwo\relax%
+ \let\lglosslinethree\relax%
+ \let\glosslineone\glosslineone@global%
+ \let\glosslinetwo\glosslinetwo@global%
+ \let\glosslinethree\glosslinethree@global%
+ \ifcov@ex@gloss@global
+ \SetKeys[covgloss]{ex=true}
+ \else
+ \SetKeys[covgloss]{ex=false}
+ \fi%
+ \ifcov@tlr@global
+ \SetKeys[covgloss]{tlr=true}
\else
- \setkeys{covington}{ex=false}
+ \SetKeys[covgloss]{tlr=false}
\fi%
- \ifggtright
- \setkeys{covington}{tlr=true}
+ \ifcov@enquote@tl@global
+ \SetKeys[covgloss]{enquotetl=true}
\else
- \setkeys{covington}{tlr=false}
+ \SetKeys[covgloss]{enquotetl=false}
\fi%
- \ifx#1\empty\else\setkeys{covington}{#1}\fi%
- \ifgexample
- \begin{covexample}
+ \def\cov@gl@preamble{\cov@gl@preamble@global}%
+ \def\cov@gl@postamble{\cov@gl@postamble@global}%
+ \ifx#1\empty\else\SetKeys[covgloss]{#1}\fi%
+ \ifcov@ex@gloss
+ \begin{covexample}
\fi%
\@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%
- \@ifundefined{cov@lglpst}{}{\def\cov@gglpst{\cov@lglpst}}%
- \ifx\cov@gglpst\empty\else\def\cov@glpst{\cov@gglpst}\fi%
+ \edef\cov@gl@preamble@text{\cov@gl@preamble}%
+ \def\cov@gl@postamble@text{\cov@gl@postamble}%
+ \@ifundefined{cov@fsglpreamble@local}%
+ {\let\fsglpreamble\cov@fsglpreamble@global}%
+ {\let\fsglpreamble\cov@fsglpreamble@local}%
+ \@ifundefined{cov@fsglpostamble@local}%
+ {\let\fsglpostamble\cov@fsglpostamble@global}%
+ {\let\fsglpostamble\cov@fsglpostamble@local}%
+ \@ifundefined{cov@fstl@local}%
+ {\let\cov@fstl\cov@fstl@global}%
+ {\let\cov@fstl\cov@fstl@local}%
\xgll #2\xgle
#3\xgle
- \ifgtright
+ \ifcov@tlr
\gln #4%
\else
\glot{#4}%
\fi
- \ifx\cov@glpst\empty\else\glosslinepostamble{\cov@glpst}\cov@nopagebreak\fi%
+ \ifx\cov@gl@postamble@text\empty%
+ \else%
+ \glosslinepostamble{\cov@gl@postamble@text}\cov@nopagebreak%
+ \fi%
\glend
- \ifgexample
- \end{covexample}
+ \ifcov@ex@gloss
+ \end{covexample}
\fi%
\let\lglosslineone\relax%
\let\lglosslinetwo\relax%
\let\lglosslinethree\relax%
- \let\cov@lglp\relax%
+ \let\cov@fsglpreamble@local\relax%
+ \let\cov@fsglpostamble@local\relax%
+ \let\cov@fstl@local\relax%
}
% 2. \trigloss[<opts>]{<line 1>}{<line 2>}{<line 3>}{<translation>}
\newcommand\trigloss[5][\empty]{%
- \ifggexample
- \setkeys{covington}{ex=true}
+ \let\lglosslineone\relax%
+ \let\lglosslinetwo\relax%
+ \let\lglosslinethree\relax%
+ \let\glosslineone\glosslineone@global%
+ \let\glosslinetwo\glosslinetwo@global%
+ \let\glosslinethree\glosslinethree@global%
+ \ifcov@ex@gloss@global
+ \SetKeys[covgloss]{ex=true}
+ \else
+ \SetKeys[covgloss]{ex=false}
+ \fi%
+ \ifcov@tlr@global
+ \SetKeys[covgloss]{tlr=true}
\else
- \setkeys{covington}{ex=false}
+ \SetKeys[covgloss]{tlr=false}
\fi%
- \ifggtright
- \setkeys{covington}{tlr=true}
+ \ifcov@enquote@tl@global
+ \SetKeys[covgloss]{enquotetl=true}
\else
- \setkeys{covington}{tlr=false}
+ \SetKeys[covgloss]{enquotetl=false}
\fi%
- \ifx#1\empty\else\setkeys{covington}{#1}\fi%
- \ifgexample
- \begin{covexample}
+ \def\cov@gl@preamble{\cov@gl@preamble@global}%
+ \def\cov@gl@postamble{\cov@gl@postamble@global}%
+ \ifx#1\empty\else\SetKeys[covgloss]{#1}\fi%
+ \ifcov@ex@gloss
+ \begin{covexample}
\fi%
\@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%
- \@ifundefined{cov@lglpst}{}{\def\cov@gglpst{\cov@lglpst}}%
- \ifx\cov@gglpst\empty\else\def\cov@glpst{\cov@gglpst}\fi%
+ \edef\cov@gl@preamble@text{\cov@gl@preamble}%
+ \def\cov@gl@postamble@text{\cov@gl@postamble}%
+ \@ifundefined{cov@fsglpreamble@local}%
+ {\let\fsglpreamble\cov@fsglpreamble@global}%
+ {\let\fsglpreamble\cov@fsglpreamble@local}%
+ \@ifundefined{cov@fsglpostamble@local}%
+ {\let\fsglpostamble\cov@fsglpostamble@global}%
+ {\let\fsglpostamble\cov@fsglpostamble@local}%
+ \@ifundefined{cov@fstl@local}%
+ {\let\cov@fstl\cov@fstl@global}%
+ {\let\cov@fstl\cov@fstl@local}%
\xglll #2\xgle
#3\xgle
#4\xgle
- \ifgtright
+ \ifcov@tlr
\gln #5%
\else
\glot{#5}%
\fi
- \ifx\cov@glpst\empty\else\glosslinepostamble{\cov@glpst}\cov@nopagebreak\fi%
+ \ifx\cov@gl@postamble@text\empty%
+ \else%
+ \glosslinepostamble{\cov@gl@postamble@text}\cov@nopagebreak%
+ \fi%
\glend
- \ifgexample
- \end{covexample}
+ \ifcov@ex@gloss
+ \end{covexample}
\fi%
\let\lglosslineone\relax%
\let\lglosslinetwo\relax%
\let\lglosslinethree\relax%
+ \let\cov@fsglpreamble@local\relax%
+ \let\cov@fsglpostamble@local\relax%
+ \let\cov@fstl@local\relax%
}
@@ -1009,12 +1268,13 @@
}
}
-\providecommand{\sdrs}[3]
-{\begin{tabular}{l}
-\mbox{\cov@emphasized #1} \\
-~ \\
-\drs{#2}{#3}
-\end{tabular}}
+\providecommand{\sdrs}[3]{%
+ \begin{tabular}{l}
+ \mbox{\cov@emphasized #1} \\
+ ~ \\
+ \drs{#2}{#3}
+ \end{tabular}%
+}
\providecommand{\ifdrs}[4]
{
@@ -1077,15 +1337,15 @@
\@ifundefined{exercise}{%
\newenvironment{exercise}{\begin{covexercise}}{\end{covexercise}}
}{%
-\ifforceredef
- \renewenvironment{exercise}{\begin{covexercise}}{\end{covexercise}}
- \cov@warning{The exercise environment was already defined. Redefining it.}
-\else
- \cov@warning{The exercise environment was already defined.^^J
- Covington does not touch it.^^J
- Use covexercise if you want to access covington's^^J
- version, or use the force package option.}
-\fi
+ \ifforceredef
+ \renewenvironment{exercise}{\begin{covexercise}}{\end{covexercise}}
+ \cov@warning{The exercise environment was already defined. Redefining it.}
+ \else
+ \cov@warning{The exercise environment was already defined.^^J
+ Covington does not touch it.^^J
+ Use covexercise if you want to access covington's^^J
+ version, or use the force package option.}
+ \fi
}
\newlength\reflistindent
@@ -1095,14 +1355,16 @@
\newlength\reflistparsep
\setlength\reflistparsep{\parsep}
\@ifundefined{reflist}{
-\newenvironment{reflist}{\begin{list}{}%
-{\setlength{\labelwidth}{0pt}%
- \setlength{\labelsep}{0pt}%
- \setlength{\leftmargin}{\reflistindent}%
- \setlength{\itemindent}{-\reflistindent}%
- \setlength{\listparindent}{-\reflistindent}%
- \setlength{\itemsep}{\reflistitemsep}%
- \setlength{\parsep}{\reflistparsep}}\item}{\end{list}}
+ \newenvironment{reflist}{%
+ \begin{list}{}{%
+ \setlength{\labelwidth}{0pt}%
+ \setlength{\labelsep}{0pt}%
+ \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.
@@ -1110,8 +1372,11 @@
% V. 2.0: Add macro for font settings customization
\newcommand*\sentencefs{\cov@emphasized}
-\newcommand{\sentence}[1]
- {\begin{flushleft}{\sentencefs #1}\end{flushleft}}
+\newcommand{\sentence}[1]{%
+ \begin{flushleft}%
+ {\sentencefs #1}%
+ \end{flushleft}%
+}
% V. 2.0: Further semantic markup
\providecommand*\lexp[1]{\textit{#1}}