summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/covington/covington.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/covington/covington.sty')
-rw-r--r--macros/latex/contrib/covington/covington.sty577
1 files changed, 519 insertions, 58 deletions
diff --git a/macros/latex/contrib/covington/covington.sty b/macros/latex/contrib/covington/covington.sty
index 06792446c4..b676c7e836 100644
--- a/macros/latex/contrib/covington/covington.sty
+++ b/macros/latex/contrib/covington/covington.sty
@@ -42,8 +42,8 @@
%%% Metadata
%%%
-\def\filedate{2023/06/02}
-\def\fileversion{2.10}
+\def\filedate{2023/06/17}
+\def\fileversion{2.11}
\def\filename{covington.sty}
% Macro to issue warnings
@@ -186,11 +186,14 @@
% This is a sentence. \hfill (\exampleno)
% \end{flushleft}
+% Counter to generate unique example ID
+\newcounter{explid}
+
\ifownexcounter
\newcounter{covex}
- \newcommand{\@exampleno}{\refstepcounter{covex}\thecovex}
+ \newcommand{\@exampleno}{\stepcounter{explid}\refstepcounter{covex}\thecovex}
\else
- \newcommand{\@exampleno}{\refstepcounter{equation}\theequation}
+ \newcommand{\@exampleno}{\stepcounter{explid}\refstepcounter{equation}\theequation}
\fi
\newcommand*\@@exampleno{\ifownexcounter\thecovex\else\theequation\fi}
\newcommand*\exampleno{\@ifstar{\@@exampleno}{\@exampleno}}
@@ -308,14 +311,37 @@
\newif\if@cov@expst@star\@cov@expst@starfalse
+% Commands to register and check preamble in (sub-)examples
+% Adapted from etoolbox
+\DeclareRobustCommand*{\RegisterExPreamble}[1]{%
+ \expandafter\gdef\csname cov@havepreamble:#1\endcsname{}%
+}
+
+\newcommand*{\IfExPreamble}[1]{%
+ \ifcsname cov@havepreamble:#1\endcsname
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi%
+}
+
% 2022-08-20 (v. 2.8): optional preceding example text
\newcommand*\expreamblefs{\normalfont}
-\newcommand\expreamble[1]{\bgroup\expreamblefs#1\egroup\par}
+\newcommand\expreamble[1]{%
+ \bgroup\expreamblefs#1\egroup\par\cov@judge@marker%
+ \if@filesw%
+ \protected@write\@auxout{}{\protect\RegisterExPreamble{\theexplid}}%
+ \fi%
+ \ignorespaces%
+}
% 2023.05.26 (v. 2.9): optional trailung subexample text
\newcommand*\expostamblefs{\normalfont}
\newcommand*\expostamble[1]{\bgroup\expostamblefs#1\egroup}
+% 2023.06.04 (v. 2.11): judge marks
+\newcommand*\cov@judge@fs{\normalfont\upshape}
+
\DeclareKeys[covexpl]
{
% font settings
@@ -339,16 +365,36 @@
% numberformat={template}
numberformat.code = { \cov@parse@number@template{#1}{exfmt}{covexnumber} },
% fnnumberformat={template}
- fnumberformat.code = { \cov@parse@number@template{#1}{fnexfmt}{covexnumberfn} }
+ fnumberformat.code = { \cov@parse@number@template{#1}{fnexfmt}{covexnumberfn} },
+ % judge=text
+ judge.code = { \def\cov@judge@ex@text{#1} \settowidth\cov@judge@width{\cov@judge@fs#1} },
+ % judgement shorthands: *, ?, *?, ??, #
+ *.code = { \def\cov@judge@ex@text{*} \settowidth\cov@judge@width{\cov@judge@fs*} },
+ ?.code = { \def\cov@judge@ex@text{?} \settowidth\cov@judge@width{\cov@judge@fs?} },
+ *?.code = { \def\cov@judge@ex@text{*?} \settowidth\cov@judge@width{\cov@judge@fs*?} },
+ ??.code = { \def\cov@judge@ex@text{??} \settowidth\cov@judge@width{\cov@judge@fs??} },
+ #.code = { \def\cov@judge@ex@text{\#} \settowidth\cov@judge@width{\cov@judge@fs\#} },
+ % judgement font settings
+ fsjudge.store = \cov@judge@fs,
+ % judgewith=<text>
+ judgewidth.code = { \settowidth\cov@judge@width{\cov@judge@fs#1} },
+ % addjudgesep=length
+ addjudgesep.code = { \addtolength\cov@judge@sep{#1} }
}
+\newif\if@cov@insingleex\@cov@insingleexfalse
+
\newenvironment{covexample}[1][]{%
- \ifx#1\empty\else\SetKeys[covexpl]{#1}\fi%
+ \@cov@insingleextrue%
+ \let\cov@judge@ex@text\cov@judge@ex@text@global%
+ \SetKeys[covexpl]{#1}%
\begin{covexamples}
- \item\@ifundefined{cov@xp}{}{\expreamble{\cov@xp}}% insert preamble if given
+ \@ifundefined{cov@judge@ex@text}{\item}{\item<\cov@judge@ex@text>}%
+ \ifx\cov@xp\empty\cov@judge@marker\else\expreamble{\cov@xp}\fi% insert preamble if given
}{%
\@ifundefined{cov@xpst}{}{\if@cov@expst@star\unskip\fi\expostamble{\cov@xpst}}%
\end{covexamples}%
+ \@cov@insingleexfalse%
}
\@ifundefined{example}{%
@@ -402,21 +448,71 @@
\let\exfmt\arabic
+% Allow for \item<judgment>[label]
+\def\cov@judge@item<#1>{%
+ \global\def\cov@judge{#1}%
+ \@ifnextchar[%
+ {\@item}%
+ {\cov@item}%
+}%
+
+\newlength\cov@judge@width
+\settowidth\cov@judge@width{?}
+\newlength\cov@subjudge@width
+\settowidth\cov@subjudge@width{?}
+\newlength\cov@judge@sep
+\setlength\cov@judge@sep{.1em}
+\newlength\cov@judge@extra
+\setlength\cov@judge@extra{0pt}
+
+\newif\if@cov@insubex\@cov@insubexfalse
+
+\def\cov@judge@marker{}
+
\newenvironment{covexamples}[1][]{% % define "examples" environment
- \ifx#1\empty\else\SetKeys[covexpl]{#1}\fi%
+ \if@cov@insubex%
+ \let\cov@judge@ex@text\relax%
+ \else%
+ \if@cov@insingleex\else%
+ \let\cov@judge@ex@text\cov@judge@ex@text@global%
+ \fi%
+ \fi%
+ \ifx{#1}{\empty}\else\SetKeys[covexpl]{#1}\fi%
+ \addtolength\cov@judge@extra{\cov@judge@width}%
+ \addtolength\cov@judge@extra{\cov@judge@sep}%
+ % parse <...> item argument
+ \let\cov@item\item%
+ \let\cov@@item\@item%
+ \def\@item[##1]{%
+ \cov@@item[##1] \@ifundefined{cov@judge}{}{%
+ \def\cov@judge@marker{\hspace*{-\cov@judge@extra}%
+ \makebox[\cov@judge@width][r]{\cov@judge@fs\cov@judge}%
+ \hspace{\cov@judge@sep}\ignorespaces}%
+ \IfExPreamble{\theexplid}{}{\cov@judge@marker\ignorespaces}%
+ }%
+ }
+ \def\item{%
+ \@inmatherr\item
+ \@ifnextchar<{\cov@judge@item}%
+ {\@ifundefined{cov@judge@ex@text}%
+ {\global\let\cov@judge\relax}%
+ {\global\let\cov@judge\cov@judge@ex@text}%
+ \cov@item}%
+ }%
\begin{list}%
{%
\covexamplenofs% font
- \ifcov@infootnote
+ \ifcov@infootnote%
\covexnumberfn{\thecovfnex}%
- \else
+ \else%
\covexnumber{\@@exampleno}%
- \fi
+ \fi%
}%
{%
\addtolength{\labelwidth}{\examplenumbersep}%
\addtolength{\leftmargin}{\examplenumbersep}%
\addtolength{\leftmargin}{\exampleind}%
+ \stepcounter{explid}%
\ifcov@infootnote
\setcounter{covexsave}{\arabic{covfnex}}%
\usecounter{covfnex}%
@@ -473,12 +569,20 @@
% 2019-06-21 (v. 2.3): optional preceding subexample text
\newcommand*\subexpreamblefs{\normalfont}
-\newcommand\subexpreamble[1]{\bgroup\subexpreamblefs#1\egroup\par}
+\newcommand\subexpreamble[1]{%
+ \bgroup\subexpreamblefs#1\egroup\par\cov@judge@marker%
+ \if@filesw%
+ \protected@write\@auxout{}{\protect\RegisterExPreamble{\theexplid}}%
+ \fi%
+ \ignorespaces%
+}
% 2023.05.26 (v. 2.9): optional trailung subexample text
\newcommand*\subexpostamblefs{\normalfont}
\newcommand*\subexpostamble[1]{\bgroup\subexpostamblefs#1\egroup}
+\newcommand*\cov@closscomments@fs{\normalfont\upshape}
+
\DeclareKeys[covsubexpl]
{
% font settings
@@ -508,7 +612,23 @@
% fnnumberformat={template}
fnumberformat.code = { \cov@parse@number@template{#1}{fnexfmt}{covexnumberfn} },
% subnumberformat={template}
- subnumberformat.code = { \cov@parse@number@template{#1}{subexfmt}{covsubexnumber} }
+ subnumberformat.code = { \cov@parse@number@template{#1}{subexfmt}{covsubexnumber} },
+ % judge=text
+ judge.code = { \def\cov@subjudge@ex@text{#1} \settowidth\cov@subjudge@width{\cov@judge@fs#1} },
+ % subjudge=text
+ subjudge.code = { \def\cov@subjudge@ex@text{#1} \settowidth\cov@judge@width{#1} },
+ % judgement shorthands: *, ?, *?, ??, #
+ *.code = { \def\cov@subjudge@ex@text{*} \settowidth\cov@subjudge@width{\cov@judge@fs*} },
+ ?.code = { \def\cov@subjudge@ex@text{?} \settowidth\cov@subjudge@width{\cov@judge@fs?} },
+ *?.code = { \def\cov@subjudge@ex@text{*?} \settowidth\cov@subjudge@width{\cov@judge@fs*?} },
+ ??.code = { \def\cov@subjudge@ex@text{??} \settowidth\cov@subjudge@width{\cov@judge@fs??} },
+ #.code = { \def\cov@subjudge@ex@text{\#} \settowidth\cov@subjudge@width{\cov@judge@fs\#} },
+ % judgement font settings
+ fsjudge.store = \cov@judge@fs,
+ % judgewith=<text>
+ judgewidth.code = { \settowidth\cov@subjudge@width{\cov@judge@fs#1} },
+ % addjudgesep=length
+ addjudgesep.code = { \addtolength\cov@judge@sep{#1} }
}
\newlength\subexamplenumbersep
@@ -518,14 +638,58 @@
\let\subexfmt\alph
+% Allow for \item<judgment>[label]
+\def\cov@judge@subitem<#1>{%
+ \global\def\cov@subjudge{#1}%
+ \@ifnextchar[%
+ {\@item}%
+ {\cov@subitem}%
+}%
+
+% Copied from the kernel (enumerate) and adapted
+% to accept <...> item arguments
+\def\covsubexs{%
+ \setlength\cov@judge@extra{\cov@subjudge@width}%
+ \addtolength\cov@judge@extra{\cov@judge@sep}%
+ \let\cov@subitem\item%
+ \let\cov@@subitem\@item%
+ \def\@item[##1]{%
+ \cov@@subitem[##1] \@ifundefined{cov@subjudge}{}{%
+ \def\cov@judge@marker{\hspace*{-\cov@judge@extra}%
+ \makebox[\cov@subjudge@width][r]{\cov@judge@fs\cov@subjudge}%
+ \hspace{\cov@judge@sep}\ignorespaces}%
+ \IfExPreamble{\theexplid}{}{\cov@judge@marker\ignorespaces}%
+ }%
+ }%
+ \def\item{%
+ \@inmatherr\item
+ \@ifnextchar<{\cov@judge@subitem}%
+ {\@ifundefined{cov@subjudge@ex@text}%
+ {\global\let\cov@subjudge\relax}%
+ {\global\let\cov@subjudge\cov@subjudge@ex@text}%
+ \cov@subitem}%
+ }%
+ \ifnum \@enumdepth >\thr@@\@toodeep\else
+ \advance\@enumdepth\@ne
+ \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
+ \expandafter
+ \list
+ \csname label\@enumctr\endcsname
+ {\stepcounter{explid}\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
+ \fi}
+\let\endcovsubexs =\endlist
+
+
\newenvironment{covsubexamples}[1][]% % define "subexamples" environment
{%
+ \@cov@insubextrue%
\let\cov@xp\relax%
\let\cov@xpst\relax%
- \ifx#1\empty\else\SetKeys[covsubexpl]{#1}\fi%
+ \let\cov@judge@ex@text\relax%
+ \ifx{#1}{\empty}\else\SetKeys[covsubexpl]{#1}\fi%
\begin{covexample}%
\@ifundefined{cov@sxp}{}{\bgroup\subexpreamblefs\cov@sxp\egroup}% insert preamble if given
- \begin{enumerate}
+ \begin{covsubexs}
\addtolength{\labelsep}{\subexamplenumbersep}%
\renewcommand\theenumi{\subexfmt{enumi}}
\renewcommand\labelenumi{\covexamplenofs\covsubexnumber{\theenumi}}
@@ -535,10 +699,11 @@
}%
{%
\let\cov@sxp\relax
- \end{enumerate}
+ \end{covsubexs}
\@ifundefined{cov@sxpst}{}{\subexpostamble{\cov@sxpst}}% insert postamble if given
\let\cov@sxpst\relax
\end{covexample}
+ \@cov@insubexfalse%
}
\@ifundefined{subexamples}{%
@@ -590,7 +755,43 @@
% fnnumberformat={template}
fnumberformat.code = { \cov@parse@number@template{#1}{fnexfmt}{covexnumberfn} },
% subnumberformat={template}
- subnumberformat.code = { \cov@parse@number@template{#1}{subexfmt}{covsubexnumber} }
+ subnumberformat.code = { \cov@parse@number@template{#1}{subexfmt}{covsubexnumber} },
+ % judge=text
+ judge.code = { \def\cov@judge@ex@text@global{#1} \settowidth\cov@judge@width{#1} },
+ % subjudge=text
+ subjudge.code = { \def\cov@subjudge@ex@text{#1} \settowidth\cov@judge@width{#1} },
+ % judgement shorthands: *, ?, *?, ??, #
+ *.code =
+ { \def\cov@judge@ex@text@global{*}
+ \def\cov@subjudge@ex@text{*}
+ \settowidth\cov@judge@width{\cov@judge@fs*}
+ },
+ ?.code =
+ { \def\cov@judge@ex@text@global{?}
+ \def\cov@subjudge@ex@text{?}
+ \settowidth\cov@judge@width{\cov@judge@fs?}
+ },
+ *?.code =
+ { \def\cov@judge@ex@text@global{*?}
+ \def\cov@subjudge@ex@text{*?}
+ \settowidth\cov@judge@width{\cov@judge@fs*?}
+ },
+ ??.code =
+ { \def\cov@judge@ex@text@global{??}
+ \def\cov@subjudge@ex@text{??}
+ \settowidth\cov@judge@width{\cov@judge@fs??}
+ },
+ #.code =
+ { \def\cov@judge@ex@text@global{\#}
+ \def\cov@subjudge@ex@text{\#}
+ \settowidth\cov@judge@width{\cov@judge@fs\#}
+ },
+ % judgement font settings
+ fsjudge.store = \cov@judge@fs,
+ % judgewith=<text>
+ judgewidth.code = { \settowidth\cov@judge@width{#1} },
+ % addjudgesep=length
+ addjudgesep.code = { \addtolength\cov@judge@sep{#1} }
}
% General setting option
@@ -679,6 +880,27 @@
\newcommand*\glosslinepostamble[1]{\bgroup\fsglpostamble{}#1\egroup}
\def\cov@gl@postamble@text{}
+% Optional extra space between gloss lines
+\newlength\cov@glossline@sepi
+\setlength\cov@glossline@sepi{0pt}
+\newlength\cov@glossline@sepii
+\setlength\cov@glossline@sepii{0pt}
+\newlength\cov@glossline@sepiii
+\setlength\cov@glossline@sepiii{0pt}
+\newlength\cov@glossline@sepi@local
+\setlength\cov@glossline@sepi@local{0pt}
+\newlength\cov@glossline@sepii@local
+\setlength\cov@glossline@sepii@local{0pt}
+\newlength\cov@glossline@sepiii@local
+\setlength\cov@glossline@sepiii@local{0pt}
+
+\newlength\cov@glosswidth@local
+\newlength\cov@glosssep@local
+\newlength\cov@glosspwidth@local
+\setlength\cov@glosswidth@local{0pt}
+\setlength\cov@glosssep@local{0pt}
+\setlength\cov@glosspwidth@local{0pt}
+
\def\gll{% % Introduces 2-line text-and-gloss.
\begin{flushleft}
\vskip\baselineskip% % Added 1992 Nov 8 to force single spacing
@@ -728,10 +950,48 @@
\ignorespaces\xthreesent
}
-\def\glt{{\hskip -\glossglue}\cov@nopagebreak\unhbox\gline\smallskip\cov@nopagebreak\newline} % \newline was \\
+\newsavebox{\pline} % the constructed preamble line (hbox)
+
+\RequirePackage{varwidth}
+
+\newlength\glosswidth
+\newlength\glosssep
+\setlength\glosssep{1em}
+\newlength\glosspwidth
+
+\AtBeginDocument{\setlength\glosswidth{.6\textwidth}}%
+
+\def\glt{%
+ \setlength\glosswidth{.6\linewidth}%
+ \if@cov@glosspline%
+ %
+ \begin{varwidth}[t]{\cov@glosswidth@local}
+ {\hskip -\glossglue}\unhbox\gline%
+ \end{varwidth}%
+ \hspace{\cov@glosssep@local}%
+ \usebox{\pline}%
+ \else%
+ {\hskip -\glossglue}\cov@nopagebreak\unhbox\gline%
+ \fi%
+ \smallskip\cov@nopagebreak\newline% % \newline was \\
+}
% Introduces translation.
% Required even if no translation follows.
+\def\glnx{%
+ \setlength\glosswidth{.6\linewidth}%
+ \if@cov@glosspline%
+ %
+ \begin{varwidth}[t]{\cov@glosswidth@local}
+ {\hskip -\glossglue}\unhbox\gline%
+ \end{varwidth}%
+ \hspace{\cov@glosssep@local}%
+ \usebox{\pline}%
+ \else%
+ {\hskip -\glossglue}\cov@nopagebreak\unhbox\gline%
+ \fi%
+}
+
\def\gln{{\hskip -\glossglue}\unhbox\gline\hfill}
% Alternative to glt, when one wants to
% put a number but no translation.
@@ -881,12 +1141,18 @@
\else%
\glosslinepreamble{\cov@gl@preamble@text}\cov@nopagebreak\newline%
\fi%
+ \ifx\cov@judge@gloss@text\empty%
+ \else
+ \bgroup\cov@judge@fs\cov@judge@gloss@text\egroup%
+ \hspace{\cov@judge@sep}\ignorespaces%
+ \fi
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
\global\setbox\gline=\hbox{\unhbox\gline%
\hskip\glossglue%
\vtop{% vtop was vbox
\box\wordone
+ \vspace{\cov@glossline@sepi@local}
\nointerlineskip
\box\wordtwo
}%
@@ -899,12 +1165,18 @@
\gdef\xthreesent#1\xgle#2\xgle#3\xgle% #1 = first line, #2 = second line, #3 = third
{\xgetwords(\lineone,\eachwordone)#1 \xgle%
+ \vspace{\cov@glossline@sepi}%
\xgetwords(\linetwo,\eachwordtwo)#2 \xgle%
\xgetwords(\linethree,\eachwordthree)#3 \xgle%
\ifx\cov@gl@preamble@text\empty%
\else%
\glosslinepreamble{\cov@gl@preamble@text}\cov@nopagebreak\newline%
\fi%
+ \ifx\cov@judge@gloss@text\empty%
+ \else
+ \bgroup\cov@judge@fs\cov@judge@gloss@text\egroup%
+ \hspace{\cov@judge@sep}\ignorespaces%
+ \fi
\loop\lastword{\eachwordone}{\lineone}{\wordone}%
\lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
\lastword{\eachwordthree}{\linethree}{\wordthree}%
@@ -912,8 +1184,10 @@
\hskip\glossglue
\vtop{% vtop was vbox
\box\wordone
+ \vspace{\cov@glossline@sepi@local}
\nointerlineskip
\box\wordtwo
+ \vspace{\cov@glossline@sepii@local}
\nointerlineskip
\box\wordthree
}%
@@ -928,10 +1202,22 @@
\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
- \else\glt\glosslinetrans{#1}\fi%
+\newcommand*\glot[2][]{%
+ \def\tempx{#2}%
+ \ifx\tempx\empty%
+ \ifcov@tlr@star%
+ \glnx
+ \else%
+ \gln
+ \fi%
+ \else%
+ \glt%
+ \ifx#1\empty\else%
+ \hphantom{\cov@judge@fs#1}%
+ \hspace{\cov@judge@sep}\ignorespaces%
+ \fi%
+ \glosslinetrans{#2}%
+ \fi%
}
% V. 2.0: More convenient gloss macros
@@ -942,32 +1228,62 @@
\newif\ifcov@ex@gloss@global\cov@ex@gloss@globalfalse
\newif\ifcov@tlr\cov@tlrfalse
\newif\ifcov@tlr@global\cov@tlr@globalfalse
+\newif\ifcov@tlr@star\cov@tlr@starfalse
+\newif\ifcov@tlr@star@global\cov@tlr@star@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=<true|false>
ex.if = cov@ex@gloss,
- % 2. tlr=<true|false>
+ % tlr=<true|false>
tlr.if = cov@tlr,
- % 3. font settings for gloss line i, ii, iii
+ % tlr*=<true|false>
+ tlr*.if = cov@tlr@star,
+ % font settings for gloss line i, ii, iii
fsi.store = \lglosslineone,
fsii.store = \lglosslinetwo,
fsiii.store = \lglosslinethree,
- % 4. Gloss preamble text
+ % Gloss preamble text
preamble.code = { \edef\cov@gl@preamble{#1} },
- % 5. Gloss postamble text
+ % Gloss postamble text
postamble.store = \cov@gl@postamble,
- % 6. Gloss preamble font settings
+ % Gloss preamble font settings
fspreamble.store = \cov@fsglpreamble@local,
- % 7. Gloss postamble font settings
+ % Gloss postamble font settings
fspostamble.store = \cov@fsglpostamble@local,
- % 8. Enquote translation line
+ % Enquote translation line
enquotetl.if = cov@enquote@tl,
- % 9. translation line font settings
- fstl.store = \cov@fstl@local
+ % translation line font settings
+ fstl.store = \cov@fstl@local,
+ % judge=text
+ judge.code = { \def\cov@judge@gloss@text{#1} },
+ % judgement shorthands: *, ?, *?, ??, #
+ *.code = { \def\cov@judge@gloss@text{*} },
+ ?.code = { \def\cov@judge@gloss@text{?} },
+ *?.code = { \def\cov@judge@gloss@text{*?} },
+ ??.code = { \def\cov@judge@gloss@text{??} },
+ #.code = { \def\cov@judge@gloss@text{\#} },
+ % judgement font settings
+ fsjudge.store = \cov@judge@fs,
+ % addjudgesep=length
+ addjudgesep.code = { \addtolength\cov@judge@sep{#1} },
+ % addlinesepi=length
+ addlinesepi.code = { \addtolength\cov@glossline@sepi@local{#1} },
+ % addlinesepii=length
+ addlinesepii.code = { \addtolength\cov@glossline@sepii@local{#1} },
+ % addlinesepiii=length
+ addlinesepiii.code = { \addtolength\cov@glossline@sepiii@local{#1} },
+ % glosswidth=length
+ glosswidth.code = { \setlength\cov@glosswidth@local{#1} },
+ % glosssep=length
+ glosssep.code = { \setlength\cov@glosssep@local{#1} },
+ % glosscommentwidth=length
+ glosscommentwidth.code = { \setlength\cov@glosspwidth@local{#1} },
+ % comment font settings
+ fscomments.store = \cov@closscomments@fs
}
\DeclareKeys[gcovgloss]
@@ -976,6 +1292,8 @@
ex.if = cov@ex@gloss@global,
% 2. tlr=<true|false>
tlr.if = cov@tlr@global,
+ % 2. tlr*=<true|false>
+ tlr*.if = cov@tlr@star@global,
% 3. font settings for gloss line i, ii, iii
fsi.code = { \global\def\glosslineone@global{#1} },
fsii.code = { \global\def\glosslinetwo@global{#1} },
@@ -991,7 +1309,35 @@
% 8. Enquote translation line
enquotetl.if = cov@enquote@tl@global,
% 9. translation line font settings
- fstl.code = { \global\def\cov@fstl@global{#1} }
+ fstl.code = { \global\def\cov@fstl@global{#1} },
+ % judge=text
+ judge.code = { \def\cov@judge@gloss@text@global{#1} },
+ % judgement shorthands: *, ?, *?, ??, #
+ *.code = { \def\cov@judge@gloss@text@global{*} },
+ ?.code = { \def\cov@judge@gloss@text@global{?} },
+ *?.code = { \def\cov@judge@gloss@text@global{*?} },
+ ??.code = { \def\cov@judge@gloss@text@global{??} },
+ #.code = { \def\cov@judge@gloss@text@global{\#} },
+ % judgement font settings
+ fsjudge.store = \cov@judge@fs,
+ % addjudgesep=length
+ addjudgesep.code = { \addtolength\cov@judge@sep{#1} },
+ % addjudgesep=length
+ addjudgesep.code = { \addtolength\cov@judge@sep{#1} },
+ % addlinesepi=length
+ addlinesepi.code = { \addtolength\cov@glossline@sepi{#1} },
+ % addlinesepii=length
+ addlinesepii.code = { \addtolength\cov@glossline@sepii{#1} },
+ % addlinesepiii=length
+ addlinesepiii.code = { \addtolength\cov@glossline@sepiii{#1} },
+ % glosswidth=length
+ glosswidth.code = { \setlength\glosswidth{#1} },
+ % glosssep=length
+ glosssep.code = { \setlength\glosssep{#1} },
+ % glosscommentwidth=length
+ glosscommentwidth.code = { \setlength\glosspwidth{#1} },
+ % judgement font settings
+ fscomments.store = \cov@closscomments@fs
}
@@ -999,18 +1345,37 @@
\let\cov@fsglpostamble@local\relax%
\let\cov@fstl@local\relax%
+\newif\if@cov@glosspline
+
%
% General setting option
\newcommand*\setglossoptions[1]{\SetKeys[gcovgloss]{#1}}
%
-% 1. \digloss[<opts>]{<line 1>}{<line 2>}{<translation>}
-\newcommand*\digloss[4][\empty]{%
+% 1. \digloss[<opts>]{<line 1>}[linepostamble1]
+% {<line 2>}[linepostamble2]
+% {<translation>}
+\NewDocumentCommand\digloss{ o m o m o m }
+{
+ \@cov@glossplinefalse%
+ \@cov@insubextrue%
+ \@ifundefined{cov@judge@gloss@text@global}%
+ {\let\cov@judge@gloss@text\relax}%
+ {\let\cov@judge@gloss@text\cov@judge@gloss@text@global}%
\let\lglosslineone\relax%
\let\lglosslinetwo\relax%
\let\lglosslinethree\relax%
\let\glosslineone\glosslineone@global%
\let\glosslinetwo\glosslinetwo@global%
\let\glosslinethree\glosslinethree@global%
+ \setlength\cov@glossline@sepi@local{\cov@glossline@sepi}%
+ \setlength\cov@glossline@sepii@local{\cov@glossline@sepii}%
+ \setlength\cov@glossline@sepiii@local{\cov@glossline@sepiii}%
+ \setlength\cov@glosswidth@local{\glosswidth}%
+ \setlength\cov@glosssep@local{\glosssep}%
+ \setlength\glosspwidth{\textwidth}%
+ \addtolength\glosspwidth{-\glosswidth}%
+ \addtolength\glosspwidth{-\glosssep}%
+ \setlength\cov@glosspwidth@local{\glosspwidth}%
\ifcov@ex@gloss@global
\SetKeys[covgloss]{ex=true}
\else
@@ -1021,6 +1386,11 @@
\else
\SetKeys[covgloss]{tlr=false}
\fi%
+ \ifcov@tlr@star@global
+ \SetKeys[covgloss]{tlr*=true}
+ \else
+ \SetKeys[covgloss]{tlr*=false}
+ \fi%
\ifcov@enquote@tl@global
\SetKeys[covgloss]{enquotetl=true}
\else
@@ -1028,7 +1398,7 @@
\fi%
\def\cov@gl@preamble{\cov@gl@preamble@global}%
\def\cov@gl@postamble{\cov@gl@postamble@global}%
- \ifx#1\empty\else\SetKeys[covgloss]{#1}\fi%
+ \IfNoValueF{#1}{\SetKeys[covgloss]{#1}}%
\ifcov@ex@gloss
\begin{covexample}
\fi%
@@ -1046,16 +1416,47 @@
\@ifundefined{cov@fstl@local}%
{\let\cov@fstl\cov@fstl@global}%
{\let\cov@fstl\cov@fstl@local}%
- \xgll #2\xgle
- #3\xgle
- \ifcov@tlr
- \gln #4%
- \else
- \glot{#4}%
- \fi
- \ifx\cov@gl@postamble@text\empty%
+ \ifcov@tlr@star%
+ \@cov@glossplinetrue\def\lineonepa{%
+ \glosslinetrans{#6}%
+ \ifx\cov@gl@postamble@text\empty%
+ \else%
+ \glosslinepostamble{\cov@gl@postamble@text}\cov@nopagebreak%
+ \fi%
+ }%
+ \def\linetwopa{\strut}%
\else%
- \glosslinepostamble{\cov@gl@postamble@text}\cov@nopagebreak%
+ \IfNoValueTF{#3}{\def\lineonepa{\strut}}{\@cov@glossplinetrue\def\lineonepa{\cov@closscomments@fs#3}}%
+ \IfNoValueTF{#5}{\def\linetwopa{\strut}}{\@cov@glossplinetrue\def\linetwopa{\cov@closscomments@fs#5}}%
+ \fi%
+ \if@cov@glosspline%
+ \savebox{\pline}{%
+ \begin{varwidth}[t]{\cov@glosspwidth@local}
+ \lineonepa\par
+ \vspace{\cov@glossline@sepi@local}
+ \linetwopa
+ \end{varwidth}
+ }%
+ \fi
+ \xgll #2\xgle
+ #4\xgle
+ \ifcov@tlr@star\glot{}\else%
+ \ifcov@tlr
+ \gln #6%
+ \else
+ \IfBlankF{#6}{%
+ \vspace{\cov@glossline@sepii@local}%
+ }%
+ \ifx\cov@judge@gloss@text\empty%
+ \glot{#6}%
+ \else%
+ \glot[\cov@judge@gloss@text]{#6}%
+ \fi%
+ \fi%
+ \ifx\cov@gl@postamble@text\empty%
+ \else%
+ \glosslinepostamble{\cov@gl@postamble@text}\cov@nopagebreak%
+ \fi%
\fi%
\glend
\ifcov@ex@gloss
@@ -1067,16 +1468,35 @@
\let\cov@fsglpreamble@local\relax%
\let\cov@fsglpostamble@local\relax%
\let\cov@fstl@local\relax%
+ \let\cov@judge@gloss@text\relax%
+ \@cov@insubexfalse%
}
-% 2. \trigloss[<opts>]{<line 1>}{<line 2>}{<line 3>}{<translation>}
-\newcommand\trigloss[5][\empty]{%
+% 2. \trigloss[<opts>]{<line 1>}[linepostamble1]
+% {<line 2>}[linepostamble2]
+% {<line 3>}[linepostamble3]
+% {<translation>}
+\NewDocumentCommand\trigloss{ o m o m o m o m }
+{%
+ \@cov@insubextrue%
+ \@ifundefined{cov@judge@gloss@text@global}%
+ {\let\cov@judge@gloss@text\relax}%
+ {\let\cov@judge@gloss@text\cov@judge@gloss@text@global}%
\let\lglosslineone\relax%
\let\lglosslinetwo\relax%
\let\lglosslinethree\relax%
\let\glosslineone\glosslineone@global%
\let\glosslinetwo\glosslinetwo@global%
\let\glosslinethree\glosslinethree@global%
+ \setlength\cov@glossline@sepi@local{\cov@glossline@sepi}%
+ \setlength\cov@glossline@sepii@local{\cov@glossline@sepii}%
+ \setlength\cov@glossline@sepiii@local{\cov@glossline@sepiii}%
+ \setlength\cov@glosswidth@local{\glosswidth}%
+ \setlength\cov@glosssep@local{\glosssep}%
+ \setlength\glosspwidth{\textwidth}%
+ \addtolength\glosspwidth{-\glosswidth}%
+ \addtolength\glosspwidth{-\glosssep}%
+ \setlength\cov@glosspwidth@local{\glosspwidth}%
\ifcov@ex@gloss@global
\SetKeys[covgloss]{ex=true}
\else
@@ -1087,6 +1507,11 @@
\else
\SetKeys[covgloss]{tlr=false}
\fi%
+ \ifcov@tlr@star@global
+ \SetKeys[covgloss]{tlr*=true}
+ \else
+ \SetKeys[covgloss]{tlr*=false}
+ \fi%
\ifcov@enquote@tl@global
\SetKeys[covgloss]{enquotetl=true}
\else
@@ -1094,7 +1519,7 @@
\fi%
\def\cov@gl@preamble{\cov@gl@preamble@global}%
\def\cov@gl@postamble{\cov@gl@postamble@global}%
- \ifx#1\empty\else\SetKeys[covgloss]{#1}\fi%
+ \IfNoValueF{#1}{\SetKeys[covgloss]{#1}}%
\ifcov@ex@gloss
\begin{covexample}
\fi%
@@ -1112,17 +1537,51 @@
\@ifundefined{cov@fstl@local}%
{\let\cov@fstl\cov@fstl@global}%
{\let\cov@fstl\cov@fstl@local}%
+ \ifcov@tlr@star%
+ \@cov@glossplinetrue\def\lineonepa{%
+ \glosslinetrans{#8}%
+ \ifx\cov@gl@postamble@text\empty%
+ \else%
+ \glosslinepostamble{\cov@gl@postamble@text}\cov@nopagebreak%
+ \fi%
+ }%
+ \def\linetwopa{\strut}%
+ \else%
+ \IfNoValueTF{#3}{\def\lineonepa{\strut}}{\@cov@glossplinetrue\def\lineonepa{\cov@closscomments@fs#3}}%
+ \IfNoValueTF{#5}{\def\linetwopa{\strut}}{\@cov@glossplinetrue\def\linetwopa{\cov@closscomments@fs#5}}%
+ \IfNoValueTF{#7}{\def\linethreepa{\strut}}{\@cov@glossplinetrue\def\linethreepa{\cov@closscomments@fs#7}}%
+ \fi%
+ \if@cov@glosspline%
+ \savebox{\pline}{%
+ \begin{varwidth}[t]{\cov@glosspwidth@local}
+ \lineonepa\par
+ \vspace{\cov@glossline@sepi@local}
+ \linetwopa\par
+ \vspace{\cov@glossline@sepii@local}
+ \linethreepa
+ \end{varwidth}
+ }%
+ \fi
\xglll #2\xgle
- #3\xgle
#4\xgle
- \ifcov@tlr
- \gln #5%
- \else
- \glot{#5}%
- \fi
- \ifx\cov@gl@postamble@text\empty%
- \else%
- \glosslinepostamble{\cov@gl@postamble@text}\cov@nopagebreak%
+ #6\xgle
+ \ifcov@tlr@star\glot{}\else%
+ \ifcov@tlr
+ \gln #8%
+ \else
+ \IfBlankF{#8}{%
+ \vspace{\cov@glossline@sepiii@local}%
+ }%
+ \ifx\cov@judge@gloss@text\empty%
+ \glot{#8}%
+ \else%
+ \glot[\cov@judge@gloss@text]{#8}%
+ \fi%
+ \fi
+ \ifx\cov@gl@postamble@text\empty%
+ \else%
+ \glosslinepostamble{\cov@gl@postamble@text}\cov@nopagebreak%
+ \fi%
\fi%
\glend
\ifcov@ex@gloss
@@ -1134,6 +1593,8 @@
\let\cov@fsglpreamble@local\relax%
\let\cov@fsglpostamble@local\relax%
\let\cov@fstl@local\relax%
+ \let\cov@judge@gloss@text\relax%
+ \@cov@insubexfalse%
}