summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/statements/statements.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/statements/statements.dtx')
-rw-r--r--Master/texmf-dist/source/latex/stex/statements/statements.dtx160
1 files changed, 112 insertions, 48 deletions
diff --git a/Master/texmf-dist/source/latex/stex/statements/statements.dtx b/Master/texmf-dist/source/latex/stex/statements/statements.dtx
index 6619bc73714..062ee52c0a9 100644
--- a/Master/texmf-dist/source/latex/stex/statements/statements.dtx
+++ b/Master/texmf-dist/source/latex/stex/statements/statements.dtx
@@ -24,17 +24,18 @@
\usepackage{stex-logo}
\usepackage{../ctansvn}
\usepackage{hyperref}
-\svnInfo $Id: statements.dtx 1502 2010-07-20 08:17:00Z kohlhase $
+\svnInfo $Id: statements.dtx 1671 2010-11-06 07:05:15Z kohlhase $
\svnKeyword $HeadURL: https://svn.kwarc.info/repos/stex/trunk/sty/statements/statements.dtx $
\makeindex
\floatstyle{boxed}
\newfloat{exfig}{thp}{lop}
\floatname{exfig}{Example}
+\def\tracissue#1{\cite{sTeX:online}, \hyperlink{http://trac.kwarc.info/sTeX/ticket/#1}{issue #1}}
\begin{document}\DocInput{statements.dtx}\end{document}
%</driver>
% \fi
%
-% \CheckSum{433}
+% \iffalse\CheckSum{433}\fi
%
% \changes{v0.9}{2005/06/14}{First Version with Documentation}
% \changes{v0.9a}{2005/07/01}{Completed Documentation}
@@ -50,6 +51,7 @@
% \changes{v0.9g}{2010/01/19}{Added support for localization}
% \changes{v0.9g}{2010/02/23}{added {\texttt{\textbackslash symref}}}
% \changes{v1.0}{2010/06/18}{now based on {\texttt{omtext}} package instead of {\texttt{omdoc}}}
+% \changes{v1.0}{2010/07/13}{adding {\texttt{\textbackslash inlineex}}}
%
% \GetFileInfo{statements.sty}
%
@@ -110,6 +112,12 @@
% the {\omdoc} transformation and uses the |ntheorem| package~\cite{MaySch:eltte09} for
% formatting (i.e. transformation to PDF).
%
+% \subsection{Package Options}\label{sec:user:options}
+%
+% The |statements| package takes a single option: \DescribeMacro{showmeta}|showmeta|. If
+% this is set, then the metadata keys are shown (see~\cite{Kohlhase:metakeys:ctan} for details
+% and customization options).
+%
% \subsection{Statements}\label{sec:statements}
%
% All the statements are marked up as environments, that take a |KeyVal| argument that
@@ -141,7 +149,7 @@
% environment |assertion| is used for all of them, and the particular subtype of
% assertion is given in the \DescribeMacro{type=}|type| key. So instead of
% |\begin{Lemma}|\iffalse\end{Lemma}\fi we have to write
-% |\begin{assertion}[type=Lemma]|\iffalse\end{assertion}\fi (see
+% |\begin{assertion}[type=lemma]|\iffalse\end{assertion}\fi (see
% Example~\ref{fig:assertion} for an example).
% \begin{exfig}
% \begin{verbatim}
@@ -247,7 +255,7 @@
% \end{symboldec}
%
% \symdef{NaturalNumbers}{\mathbb{N}}
-% \begin{symboldec}[name=succ,title=The Natural Numbers,type=Constants]
+% \begin{symboldec}[name=succ,title=The Natural Numbers,type=constant]
% The natural numbers inductively defined via the Peano Axioms.
% \end{symboldec}
%
@@ -296,14 +304,12 @@
% \DescribeEnv{definition} The |definition| environment is used for marking up
% mathematical definitions. Its peculiarity is that it defines (i.e. gives a meaning to)
% new mathematical concepts or objects. These\DescribeMacro{\definiendum} are identified
-% by the |definiendum| macro, which takes two arguments. The first one is the system name
-% of the symbol defined (for reference via |\term|), the second one is the text that is to
-% be emphasized in the presentation. Note that the |\definiendum| macro can only be used
-% inside the |definition| environment. If you find yourself in a situation where you want
-% to use it outside, you will most likely want to wrap the appropriate text fragment in a
-% |\begin{definition}[display=flow]| ... and |\end{definition}|. For instance, we could
-% continue the example in Figure~\ref{fig:axioms} with the |definition| environment in
-% Figure~\ref{fig:definition}.
+% by the |\definiendum| macro, which is used as
+% |\definiendum[|\meta{sysname}|]{|\meta{text}|}|. Here, \meta{text} is the text that is
+% to be emphasized in the presentation and the optional \meta{sysname} is a system name of
+% the symbol defined (for reference via |\term|, see Section~\ref{sec:user:crossref}). If
+% \meta{sysname} is not given, then \meta{text} is used as a system name instead, which is
+% usually sufficient for most situations.
%
%\begin{exfig}
% \begin{verbatim}
@@ -355,6 +361,14 @@
% \caption{Some definienda with Index}\label{fig:defin}
% \end{exfig}
%
+% Note that the |\definiendum|, |\defin|, |\twindef|, and |\atwindef| macros can only be
+% used inside the definitional situation, i.e. in a |definition| or |symboldec|
+% environment or a |\inlinedef| macro. If you find yourself in a situation where you want
+% to use it outside, you will most likely want to wrap the appropriate text fragment in a
+% |\begin{definition}[display=flow]| ... and |\end{definition}|. For instance, we could
+% continue the example in Figure~\ref{fig:axioms} with the |definition| environment in
+% Figure~\ref{fig:definition}.
+%
% \DescribeMacro{\inlinedef} Sometimes we define mathematical concepts in passing, e.g. in
% a phrase like ``\ldots $s(o)$ which we call {\textbf{one}}.''. For this we cannot use
% the |definition| environment, which presupposes that its content gives all that is
@@ -363,7 +377,11 @@
% in an |\inlinedef| macro that makes them available. The |\inlinedef| macro accepts the
% same |id| and |for| keys in its optional argument, and additionally the |verbalizes| key
% which can be used to point to a full definition of the concept somewhere else.
-%
+%
+% Note that definienda can only be referenced via a |\term| element, if they are only
+% allowed inside a named module, i.e. a |module| environment with a name given by the
+% |id=| key or the |theory=| key on is specified on the definitional environment.
+%
% \subsubsection{Examples}\label{sec:user:example}
%
% \DescribeEnv{example} The |example| environment is a generic statement environment,
@@ -371,6 +389,10 @@
% example for. The |example| environment also expects a |type| key to be specified, so
% that we know whether this is an example or a counterexample.
%
+% \DescribeMacro{\inlineex} The |\inlineex| is analogous to |\inlinedef|, only that it is
+% used for inline examples, e.g. ``\ldots mammals, e.g. goats''. Note that we have used an
+% inline example for an inline example.
+%
% \subsection{Cross-Referencing Symbols and Concepts}\label{sec:user:crossref}
%
% If we have defined a concept with the |\definiendum| macro, then we can mark up other
@@ -419,7 +441,7 @@
% a hyperlink to the relevant definition (i.e. the one that has the declaration
% |for=|\meta{cseq} in the metadata argument.)
%
-% \section{Configuration}\label{sec:user:rest}
+% \section{Configuration of the Presentation}\label{sec:conf}
%
% \DescribeMacro{\defemph} The |\defemph| macro is a configuration hook that allows to
% specify the style of presentation of the {\index*{definiendum}}. By default, it is set to
@@ -469,6 +491,15 @@
% \end{tabular}
% \caption{Configuration Hooks for statement types}\label{fig:hooks}
% \end{exfig}
+%
+% \section{Limitations}\label{sec:limitations}
+%
+% In this section we document known limitations. If you want to help alleviate them,
+% please feel free to contact the package author. Some of them are currently discussed in
+% the \sTeX TRAC~\cite{sTeX:online}.
+% \begin{compactenum}
+% \item none reported yet
+% \end{compactenum}
%
% \StopEventually{\newpage\PrintIndex\newpage\PrintChanges\printbibliography}
%
@@ -481,11 +512,14 @@
% since the documentation applies to both of them and to prevent them from getting out of
% sync.
%
+% \subsection{Package Options}\label{sec:impl:options}
+%
% We declare some switches which will modify the behavior according to the package
% options. Generally, an option |xxx| will just set the appropriate switches to true
% (otherwise they stay false). First we have the general options
% \begin{macrocode}
%<*package>
+\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{omdoc}}
% \end{macrocode}
% Finally, we need to declare the end of the option declaration section to {\LaTeX}.
@@ -542,17 +576,31 @@ sub makeNCName {
% \begin{macrocode}
%<*ltxml>
sub simple_wrapper {
- my @input = @_;
+ #Deref if array reference
+ my @input;
+ foreach (@_) {
+ if (ref $_ && $_ =~ /ARRAY/ && $_ !~ /LaTeXML/) {
+ @input=(@input,@$_);
+ } else
+ { push (@input,$_); }
+ }
return '' if (!@input);
- @input = map(split(/\s*,\s*/,$_->toString),@input);
+ @input = map(split(/\s*,\s*/,ToString($_)),@input);
my $output=join(" ",@input);
$output=~s/(^ )|[{}]//g; #remove leading space and list separator brackets
$output||'';
}
sub hash_wrapper{
- my @input = @_;
+ #Deref if array reference
+ my @input;
+ foreach (@_) {
+ if (ref $_ && $_ =~ /ARRAY/ && $_ !~ /LaTeXML/) {
+ @input=(@input,@$_);
+ } else
+ { push (@input,$_); }
+ }
return '' if (!@input);
- @input = map(split(/\s*,\s*/,$_->toString),@input);
+ @input = map(split(/\s*,\s*/,ToString($_)),@input);
my $output=join(".sym #",@input);
$output=~s/(^\.sym )|[{}]//g; #remove leading space and list separator brackets
"#$output"||'';
@@ -565,7 +613,7 @@ sub hash_wrapper{
% \begin{macro}{\STpresent}
% \begin{macrocode}
%<*package>
-\def\STpresent#1{#1}
+\providecommand\STpresent[1]{#1}
%</package>
% \end{macrocode}
% \end{macro}
@@ -580,7 +628,7 @@ sub hash_wrapper{
% \begin{macrocode}
%<*package>
\def\define@statement@env#1{%
-\newenvironment{#1}[1][]{\omdsetkeys{omtext}{##1}\sref@target%
+\newenvironment{#1}[1][]{\metasetkeys{omtext}{##1}\sref@target%
\ifx\omtext@display\st@flow\else%
\ifx\omtext@title\@empty\begin{ST#1Env}\else\begin{ST#1Env}[\omtext@title]\fi%
\ifx\sref@id\@empty\else\label{#1.\sref@id}\fi
@@ -595,7 +643,7 @@ sub hash_wrapper{
% \begin{environment}{assertion}
% \begin{macrocode}
%<*package>
-\newenvironment{assertion}[1][]{\omdsetkeys{omtext}{#1}\sref@target%
+\newenvironment{assertion}[1][]{\metasetkeys{omtext}{#1}\sref@target%
\ifx\omtext@display\st@flow\else%
\ifx\omtext@title\@empty\begin{ST\omtext@type AssEnv}%
\else\begin{ST\omtext@type AssEnv}[\omtext@title]\fi\fi%
@@ -669,6 +717,7 @@ DefCMPEnvironment('{example} OptionalKeyVals:omtext',
"<omdoc:example "
. "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() "
. "?&KeyVal(#1,'for')(for='&hash_wrapper(&KeyVal(#1,'for'))')()>"
+ . "?&KeyVal(#1,'title')(<dc:title>&KeyVal(#1,'title')</dc:title>)()"
. "<omdoc:CMP><omdoc:p>#body"
. "</omdoc:example>\n");
%</ltxml>
@@ -699,13 +748,13 @@ DefCMPEnvironment('{axiom} OptionalKeyVals:omtext',
% \begin{macrocode}
%<*package>
\srefaddidkey{symboldec}
-\omdaddkey{symboldec}{functions}
-\omdaddkey{symboldec}{role}
-\omdaddkey{symboldec}{title}
-\omdaddkey{symboldec}{name}
-\omdaddkey{symboldec}{display}
+\addmetakey{symboldec}{functions}
+\addmetakey{symboldec}{role}
+\addmetakey*{symboldec}{title}
+\addmetakey{symboldec}{name}
+\addmetakey*{symboldec}{display}
\def\symboldec@type{Symbol}
-\newenvironment{symboldec}[1][]{\omdsetkeys{symboldec}{#1}\sref@target
+\newenvironment{symboldec}[1][]{\metasetkeys{symboldec}{#1}\sref@target\st@indeftrue%
\ifx\symboldec@display\st@flow\else{\stDMemph{\symboldec@type} \symboldec@name:}\fi%
\ifx\symboldec@title\@empty~\else~(\stDMemph{\symboldec@title})\par\fi}{}
%</package>
@@ -739,7 +788,7 @@ DefConstructor('\symtype{}{}',
% \begin{macrocode}
%<*package>
\newif\ifst@indef\st@indeffalse
-\newenvironment{definition}[1][]{\omdsetkeys{omtext}{#1}\sref@target\st@indeftrue%
+\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%
@@ -826,7 +875,7 @@ DefConstructor('\notatiendum OptionalKeyVals:notation {}',
% \end{environment}
%
% \begin{macro}{\st@def@target}
-% The next macro is a variant of the |\sref@target| macro provided by the |sref| package
+% the next macro is a variant of the |\sref@target| macro provided by the |sref| package
% specialized for the use in the |\definiendum|, |\defin|, |\twindef|, and |\atwindef|
% macros. |\st@def@target{|\meta{opt}|}{|\meta{name}|}| makes a target with label
% |sref@|\meta{opt}|@|\meta{modulename}|@target|, if \meta{opt} is non-empty, else with
@@ -835,20 +884,24 @@ DefConstructor('\notatiendum OptionalKeyVals:notation {}',
% \begin{macrocode}
%<*package>
\def\st@def@target#1#2{\def\@test{#1}%
-\@ifundefined{mod@id}%
-{\PackageError{statements}{definiendum in unidentified module}%
-{\protect\definiendum, \protect\defin,
+\ifst@indef% if we are in a definition or such
+\ifx\omtext@theory\@empty% if there is no theory attribute
+\@ifundefined{mod@id}% if we are not in a module
+{\PackageWarning{statements}{definiendum in unidentified module\MessageBreak
+\protect\definiendum, \protect\defin,
\protect\twindef, \protect\atwindef\MessageBreak
-may only be called in a module with id key}}%
-{\ifst@indef\else\PackageWarning{statements}
- {definiendum outside definition context\MessageBreak
+can only be referenced when called in a module with id key}}%
+{\ifx\@test\@empty%
+\expandafter\sref@target@ifh{sref@#2@\mod@id @target}{}\else%
+\expandafter\sref@target@ifh{sref@#1@\mod@id @target}{}\fi}%
+\else\expandafter\sref@target@ifh{sref@#1@\omtext@theory @target}{}\fi%
+\else\PackageError{statements}%
+{definiendum outside definition context\MessageBreak
\protect\definiendum, \protect\defin,
\protect\twindef, \protect\atwindef\MessageBreak
do not make sense semantically outside a definition.\MessageBreak
-Consider wrapping the defining phrase in a \protect\inlinedef}\fi
-\ifx\@test\@empty%
-\expandafter\sref@target@ifh{sref@#2@\mod@id @target}{}\else%
-\expandafter\sref@target@ifh{sref@#1@\mod@id @target}{}\fi}}
+Consider wrapping the defining phrase in a \protect\inlinedef}%
+\fi}
%</package>
% \end{macrocode}
% \end{macro}
@@ -1068,10 +1121,21 @@ DefConstructor('\atwindefalt[]{}{}{}{}',
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\inlineex}
+% \begin{macrocode}
+%<*package>
+\newcommand{\inlineex}[2][]{\metasetkeys{omtext}{#1}\sref@target\sref@label@id{here}#2}
+%</package>
+%<*ltxml>
+DefConstructor('\inlineex OptionalKeyVals:omtext {}',
+ "<omdoc:phrase type='example'>#2</omdoc:phrase>");
+%</ltxml>
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\inlinedef}
% \begin{macrocode}
%<*package>
-\newcommand{\inlinedef}[2][]{\omdsetkeys{omtext}{#1}\sref@target\sref@label@id{here}\st@indeftrue #2}
+\newcommand{\inlinedef}[2][]{\metasetkeys{omtext}{#1}\sref@target\sref@label@id{here}\st@indeftrue #2}
%</package>
%<*ltxml>
DefConstructor('\inlinedef OptionalKeyVals:omtext {}', sub {
@@ -1133,17 +1197,17 @@ DefConstructor('\inlinedef OptionalKeyVals:omtext {}', sub {
% define it as the local module identifier.
% \begin{macrocode}
%<*package>
-\omdaddkey[\mod@id]{termref}{cd}
-\omdaddkey{termref}{cdbase}
-\omdaddkey{termref}{name}
-\omdaddkey{termref}{role}
-\def\termref@set#1#2{\def\termref@name{#2}\omdsetkeys{termref}{#1}}
+\addmetakey[\mod@id]{termref}{cd}
+\addmetakey{termref}{cdbase}
+\addmetakey{termref}{name}
+\addmetakey{termref}{role}
+\def\termref@set#1#2{\def\termref@name{#2}\metasetkeys{termref}{#1}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\termref}
% \begin{macrocode}
-\newcommand{\termref}[2][]{\omdsetkeys{termref}{#1}\st@termref{#2}}
+\newcommand{\termref}[2][]{\metasetkeys{termref}{#1}\st@termref{#2}}
%</package>
%<*ltxml>
DefConstructor('\termref OptionalKeyVals:termref {}',
@@ -1297,9 +1361,9 @@ Tag('omdoc:term',afterOpen=>\&numberIt,afterClose=>\&locateIt);
% LocalWords: STfalseconjectureAssEnv STpostulateAssEnv STobligationAssEnv foo
% LocalWords: STassumptionAssEnv STobservationAssEnv STexampleEnv textsf ltxml
% LocalWords: STdefinitionEnv STnotationEnv printbibliography langle ncname
-% LocalWords: theoremstyle sym newenvironment omdsetkeys ifx csname endcsname
+% LocalWords: theoremstyle sym newenvironment ifx csname endcsname
% LocalWords: currentlabel theorembodyfont itshape theoremheaderfont bfseries
-% LocalWords: normalfont newtheorem upshape srefaddidkey omdaddkey symtype
+% LocalWords: normalfont newtheorem upshape srefaddidkey
% LocalWords: newcommand indef newif ifst indeffalse indeftrue attr whatsit
% LocalWords: STdefinitionEnvKeyword notemph modulename ifundefined atwin
% LocalWords: expandafter providecommand nameuse doctex ctancite funval