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.sty84
1 files changed, 64 insertions, 20 deletions
diff --git a/macros/latex/contrib/covington/covington.sty b/macros/latex/contrib/covington/covington.sty
index 687e496155..fd1921f182 100644
--- a/macros/latex/contrib/covington/covington.sty
+++ b/macros/latex/contrib/covington/covington.sty
@@ -42,8 +42,8 @@
%%% Metadata
%%%
-\def\filedate{2021/09/01}
-\def\fileversion{2.7}
+\def\filedate{2022/08/30}
+\def\fileversion{2.8}
\def\filename{covington.sty}
% Force redefinition of environments?
@@ -54,6 +54,10 @@
\newif\ifnoglossbreaks\noglossbreaksfalse
% Use own example counter
\newif\ifownexcounter\ownexcounterfalse
+% Use separate counter in footnote
+\newif\ifownfnexcounter\ownfnexcounterfalse
+% Reset separate counter in footnote
+\newif\ifresetownfnexcounter\resetownfnexcounterfalse
\@ifundefined{ProvidesPackage}{%
\typeout{* covington.sty : Covington's linguistic macros, \fileversion\ \filedate *}
@@ -64,6 +68,8 @@
\DeclareOption{keeplayout}{\tweaklayoutfalse}
\DeclareOption{noglossbreaks}{\noglossbreakstrue}
\DeclareOption{owncounter}{\ownexcountertrue}
+\DeclareOption{ownfncounter}{\ownfnexcountertrue}
+\DeclareOption{ownfncounter*}{\ownfnexcountertrue\resetownfnexcountertrue}
\ProcessOptions
}
@@ -166,6 +172,19 @@
\newcommand*\@@exampleno{\ifownexcounter\thecovex\else\theequation\fi}
\newcommand*\exampleno{\@ifstar{\@@exampleno}{\@exampleno}}
+\newif\ifcov@infootnote\cov@infootnotefalse
+\ifownfnexcounter
+ % Check whether we are in a footnote
+ \AddToHook{cmd/@footnotetext/before}{\cov@infootnotetrue}
+ \AddToHook{cmd/@footnotetext/after}{\cov@infootnotefalse}
+ \ifresetownfnexcounter
+ \newcounter{covfnex}[footnote]
+ \else
+ \newcounter{covfnex}
+ \fi
+ \renewcommand{\thecovfnex}{\roman{covfnex}}
+\fi
+
%%%
%%% The 'example' environment
%%%
@@ -200,10 +219,18 @@
% with packages/classes that roll their own example environment
% (such as beamer).
-\newenvironment{covexample}{\begin{covexamples}\item}{\end{covexamples}}
+% 2022-08-20 (v. 2.8): optional preceding example text
+\define@key{cov@ex}{preamble}{\def\cov@xp{#1}}
+\newcommand*\expreamblefs{\normalfont}
+
+\newenvironment{covexample}[1][]{%
+ \ifx#1\empty\else\setkeys{cov@ex}{#1}\fi%
+ \begin{covexamples}
+ \item\@ifundefined{cov@xp}{}{\bgroup\expreamblefs\cov@xp\egroup\par}% insert preamble if given
+}{\end{covexamples}}
\@ifundefined{example}{%
- \newenvironment{example}{\begin{covexample}}{\end{covexample}}
+ \newenvironment{example}[1][]{\begin{covexample}[#1]}{\end{covexample}}
}{%
\ifforceredef
\renewenvironment{example}{\begin{covexample}}{\end{covexample}}
@@ -249,27 +276,44 @@
\setlength\exampleind{0pt}
\newcommand*\covexnumber[1]{(#1)}
+\newcommand*\covexnumberfn[1]{\covexnumber{#1}}
\newenvironment{covexamples}% % define "example" environment
{%
-\begin{list}{\covexamplenofs\covexnumber{\@@exampleno}}%
+\begin{list}%
{%
-\addtolength{\labelwidth}{\examplenumbersep}%
-\addtolength{\leftmargin}{\examplenumbersep}%
-\addtolength{\leftmargin}{\exampleind}%
-\ifownexcounter
- \setcounter{covexsave}{\arabic{covex}}%
- \usecounter{covex}% % sets it to zero, unwantedly
- \setcounter{covex}{\arabic{covexsave}}% % restores previous value
-\else
- \setcounter{covexsave}{\arabic{equation}}%
- \usecounter{equation}% % sets it to zero, unwantedly
- \setcounter{equation}{\arabic{covexsave}}% % restores previous value
-\fi
-\setlength{\listparindent}{0pt}%
-\def\makelabel##1{##1\hfil}% % put labels flushleft in space available
+ \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
+ \else
+ \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%
}%
-\raggedright\covexamplefs}% % text is flushleft, not justified
{\end{list}}
\@ifundefined{examples}{%