From 2b006ec0e0cafe12255f874f9c44786ab6f38901 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 20 Mar 2019 22:31:24 +0000 Subject: stex (20mar19) git-svn-id: svn://tug.org/texlive/trunk@50489 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/stex/statements/statements.sty | 199 ++++++++++++++------- 1 file changed, 139 insertions(+), 60 deletions(-) (limited to 'Master/texmf-dist/tex/latex/stex/statements') diff --git a/Master/texmf-dist/tex/latex/stex/statements/statements.sty b/Master/texmf-dist/tex/latex/stex/statements/statements.sty index d3c0e44382a..c62654e24b9 100644 --- a/Master/texmf-dist/tex/latex/stex/statements/statements.sty +++ b/Master/texmf-dist/tex/latex/stex/statements/statements.sty @@ -7,18 +7,29 @@ %% statements.dtx (with options: `package') %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{statements}[2016/04/06 v1.2 Semantic Markup for Statements] +\ProvidesPackage{statements}[2019/03/20 v1.4 Semantic Markup for Statements] \newif\ifdef@index\def@indexfalse \DeclareOption{defindex}{\def@indextrue} +\newif\if@nthm\@nthmtrue +\DeclareOption{nontheorem}{\@nthmfalse} +\newif\if@msection\@msectionfalse +\DeclareOption{msection}{\@msectiontrue} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{omtext}} \ProcessOptions \RequirePackage{omtext} \RequirePackage[base]{babel} +\ifcsdef{proof}{\cslet{proof}{\relax}\cslet{endproof}{\relax}}{}% to redefine if necessary +\if@nthm \RequirePackage[hyperref]{ntheorem} \theoremstyle{plain} +\else +\RequirePackage{amsthm} +\fi \AfterBabelLanguage{ngerman}{\input{statements-ngerman.ldf}} +\AfterBabelLanguage{arabic}{\input{statements-arabic.ldf}} \providecommand\STpresent[1]{#1} \def\define@statement@env#1{% +\ifcsdef{#1}{\cslet{#1}{\relax}\cslet{end#1}{\relax}}{}% to redefine if necessary \newenvironment{#1}[1][]{\metasetkeys{omtext}{##1}\sref@target% \@in@omtexttrue% \ifx\omtext@display\st@flow\else% @@ -26,20 +37,24 @@ \ifx\sref@id\@empty\else\label{#1.\sref@id}\fi \csname st@#1@initialize\endcsname\fi% display \ifx\sref@id\@empty\sref@label@id{here}\else% -\sref@label@id{\STpresent{\csname ST#1EnvKeyword\endcsname}~\@currentlabel}\fi% -\ignorespaces} +\sref@label@id{\STpresent{\csname st@#1@kw\endcsname}~\@currentlabel}\fi% +\strut\ignorespaces} {\csname st@#1@terminate\endcsname\ifx\omtext@display\st@flow\else\end{ST#1Env}\fi% \omtext@post@skip\@in@omtextfalse}} \newenvironment{assertion}[1][]{\metasetkeys{omtext}{#1}\sref@target% \@in@omtexttrue% -\ifx\omtext@display\st@flow\itshape\noindent\ignorespaces% +\ifx\omtext@display\st@flow + \itshape\noindent\ignorespaces% \else% display!=flow -\ifx\omtext@title\@empty\begin{ST\omtext@type AssEnv}% -\else\begin{ST\omtext@type AssEnv}[\omtext@title]\fi\fi% -\ifx\omtext@type\@empty\sref@label@id{here}\else% -\sref@label@id{\STpresent{\csname ST\omtext@type AssEnvKeyword\endcsname}~\@currentlabel} -\fi}%display=flow -{\ifx\omtext@display\st@flow\else\end{ST\omtext@type AssEnv}\@in@omtextfalse\fi} + \xdef\@@@type{\omtext@type}% to keep it safe from \inlinedef + \ifx\omtext@title\@empty\begin{ST\@@@type AssEnv}% + \else\begin{ST\@@@type AssEnv}[\omtext@title]% + \fi% +\fi %display=flow +\ifx\omtext@type\@empty\else% +\sref@label@id{\STpresent{\csname st@\@@@type @kw\endcsname}~\@currentlabel} +\fi} +{\ifx\omtext@display\st@flow\else\end{ST\@@@type AssEnv}\@in@omtextfalse\fi} \def\st@theorem@kw{Theorem} \def\st@lemma@kw{Lemma} \def\st@proposition@kw{Proposition} @@ -52,9 +67,19 @@ \def\st@rule@kw{Rule} \def\st@observation@kw{Observation} \def\st@remark@kw{Remark} +\if@nthm \theorembodyfont{\itshape} \theoremheaderfont{\normalfont\bfseries} -\newtheorem{STtheoremAssEnv}{\st@theorem@kw}[section] +\else +\theoremstyle{plain} +\fi +\if@msection +\newtheorem{STtheoremAssEnv}{\st@theorem@kw}[msection] +\else +\ifdef{\thesection} +{\newtheorem{STtheoremAssEnv}{\st@theorem@kw}[section]} +{\newtheorem{STtheoremAssEnv}{\st@theorem@kw}} +\fi \newtheorem{STlemmaAssEnv}[STtheoremAssEnv]{\st@lemma@kw} \newtheorem{STpropositionAssEnv}[STtheoremAssEnv]{\st@proposition@kw} \newtheorem{STcorollaryAssEnv}[STtheoremAssEnv]{\st@corollary@kw} @@ -64,18 +89,16 @@ \newtheorem{STobligationAssEnv}[STtheoremAssEnv]{\st@obligation@kw} \newtheorem{STassumptionAssEnv}[STtheoremAssEnv]{\st@assumption@kw} \newtheorem{STobservationAssEnv}[STtheoremAssEnv]{\st@observation@kw} -\theorembodyfont{\rm} +\if@nthm\theorembodyfont{\rmfamily}\else\theoremstyle{definition}\fi \newtheorem{STremarkAssEnv}[STtheoremAssEnv]{\st@remark@kw} \newtheorem{STruleAssEnv}[STtheoremAssEnv]{\st@rule@kw} \def\st@example@initialize{}\def\st@example@terminate{} \define@statement@env{example} \def\st@example@kw{Example} -\theorembodyfont{\upshape} \newtheorem{STexampleEnv}[STtheoremAssEnv]{\st@example@kw} \def\st@axiom@initialize{}\def\st@axiom@terminate{} \define@statement@env{axiom} \def\st@axiom@kw{Axiom} -\theorembodyfont{\upshape} \newtheorem{STaxiomEnv}[STtheoremAssEnv]{\st@axiom@kw} \srefaddidkey{symboldec} \addmetakey{symboldec}{functions} @@ -95,7 +118,6 @@ \noindent\type@type \ifx\symtype@\@empty\else (\symtype@system)\fi #2: $#3$} \newcommand\inlinetypedec[3][]{\metasetkeys{symtype}{#1}\sref@target{\def\thedectype{#2}#3}} \def\st@typedec@kw{Type Declaration} -\theorembodyfont{\upshape} \newtheorem{STtypedecEnv}[STtheoremAssEnv]{\st@typedec@kw} \newenvironment{typedec}[2][]{\metasetkeys{omtext}{#1}\sref@target% \def\thedectype{#2}% @@ -103,33 +125,32 @@ \ifx\omtext@title\@empty\begin{STtypedecEnv}\else\begin{STtypedecEnv}[\omtext@title]\fi% \ifx\sref@id\@empty\else\label{typedec.\sref@id}\fi \ifx\sref@id\@empty\sref@label@id{here}\else% -\sref@label@id{\STpresent{\csname STtypedecEnvKeyword\endcsname}~\@currentlabel}\fi% +\sref@label@id{\STpresent{\csname st@typedec@kw\endcsname}~\@currentlabel}\fi% \ignorespaces} {\ifx\omtext@display\st@flow\else\end{STtypedecEnv}\fi\omtext@post@skip} \newif\ifst@indef\st@indeffalse +\ifcsdef{definition}{\cslet{definition}{\relax}\cslet{enddefinition}{\relax}}{}% to redefine if necessary \newenvironment{definition}[1][]{\metasetkeys{omtext}{#1}\sref@target\st@indeftrue% \ifx\omtext@display\st@flow\else% \ifx\omtext@title\@empty\begin{STdefinitionEnv}\else\begin{STdefinitionEnv}[\omtext@title]\fi\fi% \ifx\sref@id\@empty\sref@label@id{here}\else% -\sref@label@id{\STpresent{\csname STdefinitionEnvKeyword\endcsname}~\@currentlabel}\fi% +\sref@label@id{\STpresent{\csname st@definition@kw\endcsname}~\@currentlabel}\fi% \ignorespaces} {\ifx\omtext@display\st@flow\else\end{STdefinitionEnv}\fi} \def\st@definition@kw{Definition} -\theorembodyfont{\upshape} \newtheorem{STdefinitionEnv}[STtheoremAssEnv]{\st@definition@kw} \def\notemph#1{#1} \def\st@notation@terminate{} \def\st@notation@initialize{} \define@statement@env{notation} \def\st@notation@kw{Notation} -\theorembodyfont{\upshape} \newtheorem{STnotationEnv}[STtheoremAssEnv]{\st@notation@kw} -\newcommand\st@def@target[3]{\def\@symname{#1}\def\@verbname{#2}% +\newcommand\st@def@target[3]{\edef\@symname{#1}\def\@verbname{#2}% \ifst@indef% if we are in a definition or such \@ifundefined{mod@id}% if we are not in a module {\PackageWarning{statements}{definiendum in unidentified module\MessageBreak -\protect\definiendum, \protect\defi, -\protect\defii, \protect\defiii\MessageBreak +\protect\definiendum, \protect\defi*, +\protect\Defi*, \protect\defi*s, \protect\Defi*s\MessageBreak can only be referenced when called in a module with id key}}% {% now we are in a module \edef\@@cd{\ifx\omtext@theory\@empty\mod@id\else\omtext@theory\fi}% @@ -139,52 +160,98 @@ can only be referenced when called in a module with id key}}% {#3}}% \expandafter\gdef\csname sref@\@@name @\@@cd @defined\endcsname{yes}% \ifmetakeys@showmeta\metakeys@show@keys{\@@cd}{name:\@@name}\fi}% -\else% st@indef +\else% st@indef: we are not in a definition or such \PackageError{statements}% {definiendum outside definition context\MessageBreak \protect\definiendum, \protect\defi, -\protect\defii, \protect\defiii\MessageBreak -do not make sense semantically outside a definition.\MessageBreak -Consider wrapping the defining phrase in a \protect\inlinedef}% +\protect\Defi, \protect\defi*s, \protect\Defi*s\MessageBreak +do not make sense semantically outside a definition.} +{Consider wrapping the defining phrase in a \protect\inlinedef}% \fi}% st@indef \newcommand\@termdef[2][]{\def\@test{#1}% \@ifundefined{mod@id}{}{\ifx\@test\@empty\def\@@name{#2}\else\def\@@name{#1}\fi% \termdef{\mod@id @\@@name}{#2}}} -\newcommand\definiendum[2][]{\st@def@target{#1}{#2}{#2}} +\addmetakey{definiendum}{name} +\addmetakey{definiendum}{lemma} +\newcommand\definiendum[2][]{\setkeys{definiendum}{#1}% +\st@def@target{\definiendum@name}{\definiendum@name}{#2}} \newcommand\notatiendum[2][]{\notemph{#2}} -\newcommand\defi[2][]{\st@def@target{#1}{#2}{#2}\def\@phrase{#2}\@defi} \newcommand\@defi[1][]{\ifdef@index\omdoc@indexi[#1]{\@phrase}\fi\xspace} -\newcommand\defis[2][]{\st@def@target{#1}{#2}{#2s}\def\@phrase{#2}\@defi} -\newcommand\adefi[3][]{\def\@name{#1}\def\@verb{#3}% -\st@def@target{#1}{#3}{#2}\@adefi} +\newcommand\defi[2][]{\metasetkeys{definiendum}{#1}% +\st@def@target{\definiendum@name}{#2}{#2}\def\@phrase{#2}\@defi} +\newcommand\defis[2][]{\metasetkeys{definiendum}{#1}% +\st@def@target{\definiendum@name}{#2}{#2s}\def\@phrase{#2}\@defi} +\newcommand\Defi[2][]{\metasetkeys{definiendum}{#1}% +\st@def@target{\definiendum@name}{#2}{\capitalize{#2}}\def\@phrase{#2}\@defi} +\newcommand\Defis[2][]{\metasetkeys{definiendum}{#1}% +\st@def@target{\definiendum@name}{#2}{\capitalize{#2s}}\def\@phrase{#2}\@defi} +\newcommand\adefi[3][]{\metasetkeys{definiendum}{#1}\def\@verb{#3}% +\st@def@target{\definiendum@name}{#3}{#2}\@adefi} \newcommand\@adefi[1][]{% \ifdef@index% -\ifx\@name\@empty\omdoc@indexi[#1]{\@verb}% -\else\omdoc@indexi[at=\@name,#1]{\@verb}\fi% +\ifx\definiendum@name\@empty\omdoc@indexi[#1]{\@verb}% +\else\omdoc@indexi[at=\definiendum@name,#1]{\@verb}\fi% \fi\xspace} -\newcommand\@defii[1][]{\ifdef@index\@twin[#1]{\@pone}{\@ptwo}\fi\xspace} -\newcommand\defii[3][]{\def\@pone{#2}\def\@ptwo{#3}% -\st@def@target{#1}{#2-#3}{#2 #3}\@defii} -\newcommand\defiis[3][]{\def\@pone{#2}\def\@ptwo{#3}% -\st@def@target{#1}{#2-#3}{#2 #3s}\@defii} -\newcommand\adefii[4][]{\def\@name{#1}\def\@pone{#3}\def\@ptwo{#4}% -\st@def@target{#1}{#3-#4}{#2}\@adefii} +\newcommand\@defii[1][]{\ifdef@index\omdoc@indexii[#1]{\@pone}{\@ptwo}\fi\xspace} +\newcommand\defii[3][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}% +\st@def@target{\definiendum@name}{#2-#3}{#2 #3}\@defii} +\newcommand\defiis[3][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}% +\st@def@target{\definiendum@name}{#2-#3}{#2 #3s}\@defii} +\newcommand\Defii[3][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}% +\st@def@target{\definiendum@name}{#2-#3}{\capitalize{#2 #3}}\@defii} +\newcommand\Defiis[3][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}% +\st@def@target{\definiendum@name}{#2-#3}{\capitalize{#2 #3s}}\@defii} +\newcommand\adefii[4][]{\metasetkeys{definiendum}{#1}\def\@pone{#3}\def\@ptwo{#4}% +\st@def@target{\definiendum@name}{#3-#4}{#2}\@adefii} \newcommand\@adefii[1][]{% \ifdef@index% -\ifx\@name\@empty\@twin[#1]{\@pone}{\@ptwo}% -\else\@twin[at=\@name,#1]{\@pone}{\@ptwo}\fi% +\ifx\definiendum@name\@empty\omdoc@indexii[#1]{\@pone}{\@ptwo}% +\else\omdoc@indexii[at=\definiendum@name,#1]{\@pone}{\@ptwo}\fi% \fi\xspace} -\newcommand\defiii[4][]{\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}% -\st@def@target{#1}{#2-#3-#4}{#2 #3 #4}\@defiii} -\newcommand\@defiii[1][]{\ifdef@index\@atwin[#1]{\@pone}{\@ptwo}{\@pthree}\fi\xspace} -\newcommand\defiiis[4][]{\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}% -\st@def@target{#1}{#2-#3-#4}{#2 #3 #4s}\@defiii} -\newcommand\adefiii[5][]{\def\@name{#1}\def\@pone{#3}\def\@ptwo{#4}\def\@pthree{#3}% -\st@def@target{#1}{#3-#4-#5}{#2}\@adefiii} +\newcommand\@defiii[1][]{\ifdef@index\omdoc@indexiii[#1]{\@pone}{\@ptwo}{\@pthree}\fi\xspace} +\newcommand\defiii[4][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}% +\st@def@target{\definiendum@name}{#2-#3-#4}{#2 #3 #4}\@defiii} +\newcommand\defiiis[4][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}% +\st@def@target{\definiendum@name}{#2-#3-#4}{#2 #3 #4s}\@defiii} +\newcommand\Defiii[4][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}% +\st@def@target{\definiendum@name}{#2-#3-#4}{\capitalize{#2 #3 #4}}\@defiii} +\newcommand\Defiiis[4][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}% +\st@def@target{\definiendum@name}{#2-#3-#4}{\capitalize{#2 #3 #4s}}\@defiii} +\newcommand\adefiii[5][]{\metasetkeys{definiendum}{#1}\def\@pone{#3}\def\@ptwo{#4}\def\@pthree{#5}% +\st@def@target{\definiendum@name}{#3-#4-#5}{#2}\@adefiii} \newcommand\@adefiii[1][]{% \ifdef@index% -\ifx\@name\@empty\@atwin[#1]{\@pone}{\@ptwo}{\@pthree}% -\else\@atwin[at=\@name,#1]{\@pone}{\@ptwo}{\@pthree}\fi% +\ifx\definiendum@name\@empty\omdoc@indexiii[#1]{\@pone}{\@ptwo}{\@pthree}% +\else\omdoc@indexiii[at=\definiendum@name,#1]{\@pone}{\@ptwo}{\@pthree}\fi% +\fi\xspace} +\newcommand\@defiv[1][]{\ifdef@index\omdoc@indexiv[#1]{\@pone}{\@ptwo}{\@pthree}{\@ptfour}\fi\xspace} +\newcommand\defiv[5][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}\def\@ptfour{#5}% +\st@def@target{\definiendum@name}{#2-#3-#4-#5}{#2 #3 #4 #5}\@defiv} +\newcommand\defivs[5][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}\def\@ptfour{#5}% +\st@def@target{\definiendum@name}{#2-#3-#4-#5}{#2 #3 #4 #5s}\@defiv} +\newcommand\Defiv[5][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}\def\@ptfour{#5}% +\st@def@target{\definiendum@name}{#2-#3-#4-#5}{\capitalize{#2 #3 #4 #5}}\@defiv} +\newcommand\Defivs[5][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#2}\def\@ptwo{#3}\def\@pthree{#4}\def\@ptfour{#5}% +\st@def@target{\definiendum@name}{#2-#3-#4-#5}{\capitalize{#2 #3 #4 #5s}}\@defiv} +\newcommand\adefiv[6][]{\metasetkeys{definiendum}{#1}% +\def\@pone{#3}\def\@ptwo{#4}\def\@pthree{#5}\def\@ptfour{#6}% +\st@def@target{\definiendum@name}{#3-#4-#5-#6}{#2}\@adefiv} +\newcommand\@adefiv[1][]{% +\ifdef@index% +\ifx\definiendum@name\@empty\@indiv[#1]{\@pone}{\@ptwo}{\@pthree}{\@ptfour}% +\else\@indiv[at=\definiendum@name,#1]{\@pone}{\@ptwo}{\@pthree}{\@ptfour}\fi% \fi\xspace} \newcommand\inlineex[2][]{\metasetkeys{omtext}{#1}% \sref@target\sref@label@id{here}#2} @@ -202,25 +269,37 @@ whatever is suitable semantically}\fi% \addmetakey*{termref}{name} \addmetakey*{termref}{role} \newcommand\termref[2][]{\metasetkeys{termref}{#1}% - \ifx\termref@cd\@empty\def\termref@cd{\mod@id}\fi% - \ifx\termref@name\@empty\def\termref@name{#2}\fi% - \@ifundefined{sref@\termref@name @\termref@cd @defined} - {\ifx\termref@cdbase\@empty% external reference - \mod@termref\termref@cd\termref@name{#2}% - \else\sref@href@ifh\termref@cdbase{#2}% - \fi}% - {\sref@hlink@ifh{sref@\termref@name @\termref@cd @target}{#2}}% -} +\ifx\termref@cd\@empty\def\termref@cd{\mod@id}\fi% +\ifx\termref@name\@empty\def\termref@name{#2}\fi% +\@ifundefined{sref@\termref@name @\termref@cd @defined}% +{\ifx\termref@cdbase\@empty% external reference +\mod@termref\termref@cd\termref@name{#2}% +\else\sref@href@ifh\termref@cdbase{#2}% +\fi}% +{\def\@label{sref@\termref@name @\termref@cd @target}% +\sref@hlink@ifh\@label{#2}%\footnote{termref: internal reference to \@label} +}} \newcommand\atrefi[3][]{\def\@test{#1}% \ifx\@test\@empty\termref[name=#3]{#2}\else\termref[cd=#1,name=#3]{#2}\fi} \newcommand\atrefii[4][]{\atrefi[#1]{#2}{#3-#4}} \newcommand\atrefiii[5][]{\atrefi[#1]{#2}{#3-#4-#5}} +\newcommand\atrefiv[6][]{\atrefi[#1]{#2}{#3-#4-#5-#6}} \newcommand\trefi[2][]{\atrefi[#1]{#2}{#2}} \newcommand\trefii[3][]{\atrefi[#1]{#2 #3}{#2-#3}} \newcommand\trefiii[4][]{\atrefi[#1]{#2 #3 #4}{#2-#3-#4}} +\newcommand\trefiv[5][]{\atrefi[#1]{#2 #3 #4 #5}{#2-#3-#4-#5}} \newcommand\trefis[2][]{\atrefi[#1]{#2s}{#2}} \newcommand\trefiis[3][]{\atrefi[#1]{#2 #3s}{#2-#3}} \newcommand\trefiiis[4][]{\atrefi[#1]{#2 #3 #4s}{#2-#3-#4}} +\newcommand\trefivs[5][]{\atrefi[#1]{#2 #3 #4 #5s}{#2-#3-#4-#5}} +\newcommand\Trefi[2][]{\atrefi[#1]{\capitalize{#2}}{#2}} +\newcommand\Trefii[3][]{\atrefi[#1]{\capitalize{#2 #3}}{#2-#3}} +\newcommand\Trefiii[4][]{\atrefi[#1]{\capitalize{#2 #3 #4}}{#2-#3-#4}} +\newcommand\Trefiv[5][]{\atrefi[#1]{\capitalize{#2 #3 #4 #5}}{#2-#3-#4-#5}} +\newcommand\Trefis[2][]{\atrefi[#1]{\capitalize{#2s}}{#2}} +\newcommand\Trefiis[3][]{\atrefi[#1]{\capitalize{#2 #3s}}{#2-#3}} +\newcommand\Trefiiis[4][]{\atrefi[#1]{\capitalize{#2 #3 #4s}}{#2-#3-#4}} +\newcommand\Trefivs[5][]{\atrefi[#1]{\capitalize{#2 #3 #4 #5s}}{#2-#3-#4-#5}} \providecommand{\termemph}[1]{#1} \providecommand{\defemph}[1]{{\textbf{#1}}} \providecommand{\stDMemph}[1]{{\textbf{#1}}} -- cgit v1.2.3