summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/covington/covington.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-06-05 21:43:03 +0000
committerKarl Berry <karl@freefriends.org>2019-06-05 21:43:03 +0000
commit4a7fdd8af3211f8144b2286e1a0b19bc0c754b6c (patch)
tree7e551a88d76aa5ca370c7b26ae49126dadb5e12b /Master/texmf-dist/tex/latex/covington/covington.sty
parent624e7c8cbd7ac030cd4955065c5f2724fcf40d57 (diff)
covington (5jun19)
git-svn-id: svn://tug.org/texlive/trunk@51324 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/covington/covington.sty')
-rw-r--r--Master/texmf-dist/tex/latex/covington/covington.sty47
1 files changed, 35 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/latex/covington/covington.sty b/Master/texmf-dist/tex/latex/covington/covington.sty
index 5925f74eb08..b4bc83b3188 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{2019/05/12}
-\def\fileversion{2.1}
+\def\filedate{2019/06/04}
+\def\fileversion{2.2}
\def\filename{covington.sty}
% Force redefinition of environments?
@@ -52,6 +52,8 @@
\newif\iftweaklayout\tweaklayouttrue
% Prevent page breaks in glosses
\newif\ifnoglossbreaks\noglossbreaksfalse
+% Use own example counter
+\newif\ifownexcounter\ownexcounterfalse
\@ifundefined{ProvidesPackage}{%
\typeout{* covington.sty : Covington's linguistic macros, \fileversion\ \filedate *}
@@ -61,6 +63,7 @@
\DeclareOption{force}{\forceredeftrue}
\DeclareOption{keeplayout}{\tweaklayoutfalse}
\DeclareOption{noglossbreaks}{\noglossbreakstrue}
+\DeclareOption{owncounter}{\ownexcountertrue}
\ProcessOptions
}
@@ -129,9 +132,12 @@
%%% Example numbering
%%%
-% Example numbering uses the same counter as LaTeX's equation numbering.
+% Example numbering uses the same counter as LaTeX's equation numbering
+% by default.
% Thus, you can use \label and \ref to refer to numbered examples in
% exactly the same way as with equations.
+% As of v. 2.2, it is also possible to use an own counter and thus separate
+% equations from linguistic examples.
% \exampleno increments the counter and gives you its current value.
% You can use it anywhere to generate an example number.
@@ -143,12 +149,23 @@
% This is a sentence. \hfill (\exampleno)
% \end{flushleft}
-\newcommand{\exampleno}{\refstepcounter{equation}\theequation}
+\ifownexcounter
+ \newcounter{covex}
+ \newcommand{\@exampleno}{\refstepcounter{covex}\thecovex}
+\else
+ \newcommand{\@exampleno}{\refstepcounter{equation}\theequation}
+\fi
+\newcommand*\@@exampleno{\ifownexcounter\thecovex\else\theequation\fi}
+\newcommand*\exampleno{\@ifstar{\@@exampleno}{\@exampleno}}
%%%
%%% The 'example' environment
%%%
+% Font setting possibility for example sentences
+\newcommand*\covexamplefs{}
+\newcommand*\covexamplenofs{\normalfont}
+
% example is an environment for displaying a single numbered
% example, preceded by its number. Example of use:
%
@@ -215,7 +232,7 @@
%
% New in 1.8 (2018-12-07): Allow to redefine label (\covexnumber)
-\newcounter{equationsave} % used in trick with equation number
+\newcounter{covexsave} % used in trick with example number
\newlength\examplenumbersep
\setlength\examplenumbersep{0pt}
@@ -224,17 +241,23 @@
\newenvironment{covexamples}% % define "example" environment
{%
-\begin{list}{\covexnumber{\theequation}}%
+\begin{list}{\covexamplenofs\covexnumber{\@@exampleno}}%
{%
\addtolength{\labelwidth}{\examplenumbersep}%
\addtolength{\leftmargin}{\examplenumbersep}%
-\setcounter{equationsave}{\arabic{equation}}%
-\usecounter{equation}% % sets it to zero, unwantedly
-\setcounter{equation}{\arabic{equationsave}}% % restores previous value
+\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
}%
-\raggedright}% % text is flushleft, not justified
+\raggedright\covexamplefs}% % text is flushleft, not justified
{\end{list}}
\@ifundefined{examples}{%
@@ -277,8 +300,8 @@
\begin{enumerate}
\addtolength{\labelsep}{\subexamplenumbersep}%
\renewcommand\theenumi{\alph{enumi}}
- \renewcommand\labelenumi{\covsubexnumber{\theenumi}}
- \renewcommand\p@enumi{\theequation\,}%
+ \renewcommand\labelenumi{\covexamplenofs\covsubexnumber{\theenumi}}
+ \renewcommand\p@enumi{\@@exampleno\,}%
\setlength{\listparindent}{0pt}%
\def\makelabel##1{##1\hfil}% % put labels flushleft in space available
}%