diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-07 20:49:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-07 20:49:10 +0000 |
commit | ddfe3a4eaf95167482e923d4da3de2917a7dbfbb (patch) | |
tree | 0acc1bb60b37392451f5e79e00c33c487c19abcf /Master/texmf-dist/tex/latex/stex/sproof/sproof.sty | |
parent | a04ae5a947a6b06bc717719f6ad63e6de5cb5af6 (diff) |
stex (7apr16)
git-svn-id: svn://tug.org/texlive/trunk@40320 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/sproof/sproof.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/sproof/sproof.sty | 211 |
1 files changed, 161 insertions, 50 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty b/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty index 35d2470cd02..58bdc22d022 100644 --- a/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty +++ b/Master/texmf-dist/tex/latex/stex/sproof/sproof.sty @@ -7,10 +7,12 @@ %% sproof.dtx (with options: `package') %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{sproof}[2012/01/28 v1.0 Semantic Markup for Proofs] -\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}} +\ProvidesPackage{sproof}[2016/04/06 v1.1 Semantic Markup for Proofs] +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{sref}} \ProcessOptions \RequirePackage{sref} +\RequirePackage{etoolbox} +\RequirePackage[base]{babel} \srefaddidkey{spf} \addmetakey*{spf}{display} \addmetakey{spf}{for} @@ -20,65 +22,174 @@ \addmetakey*{spf}{title} \addmetakey{spf}{continues} \addmetakey{spf}{functions} +\addmetakey{spf}{method} \def\spf@flow{flow} -\newenvironment{pst@with@label}[1]% -{\edef\pst@label{#1}\advance\count10 by 1\count\count10=1} -{\advance\count10 by -1} -\def\the@pst@label{\pst@make@label\pst@label{\number\count\count10}} -\def\pst@make@label@long#1#2{\@for\@I:=#1\do{\@I.}#2} +\newenvironment{pst@with@label}[1]{% + \edef\pst@label{#1}% + \advance\count10 by 1% + \count\count10=1% +}{% + \advance\count10 by -1% +}% +\def\the@pst@label{% + \pst@make@label\pst@label{\number\count\count10}\pstlabel@postfix% +}% +\addmetakey[P]{pstlabel}{prefix}[] +\addmetakey[.]{pstlabel}{delimiter}[] +\addmetakey[]{pstlabel}{postfix}[] +\metasetkeys{pstlabel}{}% initialization +\newrobustcmd\setpstlabelstyle[1]{% + \metasetkeys{pstlabel}{#1}% +}% +\newrobustcmd\setpstlabelstyledefault{% + \metasetkeys{pstlabel}{prefix=P,delimiter=.,postfix=}% +}% +\def\pst@make@label@long#1#2{\@for\@I:=#1\do{\expandafter\@I\pstlabel@delimiter}#2} \def\pst@make@label@angles#1#2{\ensuremath{\@for\@I:=#1\do{\rangle}}#2} \def\pst@make@label@short#1#2{#2} \def\pst@make@label@empty#1#2{} -\def\pstlabelstyle#1{\def\pst@make@label{\@nameuse{pst@make@label@#1}}} -\pstlabelstyle{long} -\def\next@pst@label{\global\advance\count\count10 by 1} -\def\sproof@box{\hbox{\vrule\vbox{\hrule width 6 pt\vskip 6pt\hrule}\vrule}} -\def\spf@proofend{\sproof@box} -\def\sproofend{\ifx\spf@proofend\@empty\else\hfil\null\nobreak\hfill\spf@proofend\par\smallskip\fi} -\def\sProofEndSymbol#1{\def\sproof@box{#1}} +\def\pstlabelstyle#1{% + \def\pst@make@label{\@nameuse{pst@make@label@#1}}% +}% +\pstlabelstyle{long}% +\def\next@pst@label{% + \global\advance\count\count10 by 1% +}% +\def\sproof@box{% + \hbox{\vrule\vbox{\hrule width 6 pt\vskip 6pt\hrule}\vrule}% +}% +\def\spf@proofend{\sproof@box}% +\def\sproofend{% + \ifx\spf@proofend\@empty% + \else% + \hfil\null\nobreak\hfill\spf@proofend\par\smallskip% + \fi% +}% +\def\sProofEndSymbol#1{\def\sproof@box{#1}}% \def\spf@proofsketch@kw{Proof Sketch} \def\spf@proof@kw{Proof} -\newcommand{\spfsketch}[2][]{\metasetkeys{spf}{#1}\sref@target -\ifx\spf@display\spf@flow\else{\stDMemph{\ifx\spf@type\@empty\spf@proofsketch@kw\else\spf@type\fi}:}\fi{ #2}% -\sref@label@id{this \ifx\spf@type\@empty\spf@proofsketch@kw\else\spf@type\fi}} -\newenvironment{spf@proof}[2][]{\metasetkeys{spf}{#1}\sref@target -\count10=10 -\ifx\spf@display\spf@flow\else{\stDMemph{\ifx\spf@type\@empty\spf@proof@kw\else\spf@type\fi}:}\fi{ #2}% -\sref@label@id{this \ifx\spf@type\@empty\spf@proof@kw\else\spf@type\fi} -\def\pst@label{}\newcount\pst@count% initialize the labeling mechanism -\begin{description}\begin{pst@with@label}{P}} -{\end{pst@with@label}\end{description}} -\newenvironment{sproof}[2][]{\begin{spf@proof}[#1]{#2}}{\sproofend\end{spf@proof}} -\newenvironment{sProof}[2][]{\begin{spf@proof}[#1]{#2}}{\end{spf@proof}} -\newcommand{\spfidea}[2][]{\metasetkeys{spf}{#1}% -\stDMemph{\ifx\spf@type\@empty{Proof Idea}\else\spf@type\fi:} #2\sproofend} -\newenvironment{spfstep}[1][]{\metasetkeys{spf}{#1} -\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi -\ifx\spf@title\@empty\else{(\stDMemph{\spf@title})}\fi} -{\next@pst@label} -\newenvironment{sproofcomment}[1][]{\metasetkeys{spf}{#1} -\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi} -{\next@pst@label} -\newenvironment{spfcases}[2][]{\metasetkeys{spf}{#1} -\def\@test{#2}\ifx\@test\empty\else -\ifx\spf@display\spf@flow {#2}\else\item[\the@pst@label]{#2} \fi\fi -\begin{pst@with@label}{\pst@label,\number\count\count10}} -{\end{pst@with@label}\next@pst@label} -\newenvironment{spfcase}[2][]{\metasetkeys{spf}{#1} -\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi -\def\@test{#2}\ifx\@test\@empty\else{\stDMemph{#2}:}\fi -\begin{pst@with@label}{\pst@label,\number\count\count10}} -{\ifx\spf@display\spf@flow\else\sproofend\fi\end{pst@with@label}\next@pst@label} -\newenvironment{subproof}[1][]% -{\begin{pst@with@label}{\pst@label,\number\count\count10}} -{\ifx\spf@display\spf@flow\else\sproofend\fi\end{pst@with@label}} +\def\spf@step@kw{Step} +\AfterBabelLanguage{ngerman}{\input{sproof-ngerman.ldf}} +\newrobustcmd\spfsketch[2][]{% + \metasetkeys{spf}{#1}% + \sref@target% + \ifx\spf@display\spf@flow% + \else% + {\stDMemph{\ifx\spf@type\@empty\spf@proofsketch@kw\else\spf@type\fi}:} + \fi{ #2}% + \sref@label@id{this \ifx\spf@type\@empty\spf@proofsketch@kw\else\spf@type\fi}\sproofend% +}% +\newenvironment{spfeq}[2][]{% + \metasetkeys{spf}{#1}\sref@target% + \ifx\spf@display\spf@flow% + \else% + {\stDMemph{\ifx\spf@type\@empty\spf@proof@kw\else\spf@type\fi}:} #2% + \fi% display=flow + \begin{displaymath}\begin{array}{rcll}% +}{% + \end{array}\end{displaymath}% +}% +\newenvironment{spf@proof}[2][]{% + \metasetkeys{spf}{#1}% + \sref@target% + \count10=10% + \par\noindent% + \ifx\spf@display\spf@flow% + \else% + \stDMemph{\ifx\spf@type\@empty\spf@proof@kw\else\spf@type\fi}:% + \fi{ #2}% + \sref@label@id{this \ifx\spf@type\@empty\spf@proof@kw\else\spf@type\fi}% + \def\pst@label{}% + \newcount\pst@count% initialize the labeling mechanism + \begin{description}\begin{pst@with@label}{\pstlabel@prefix}% +}{% + \end{pst@with@label}\end{description}% +}% +\newenvironment{sproof}[2][]{\begin{spf@proof}[#1]{#2}}{\sproofend\end{spf@proof}}% +\newenvironment{sProof}[2][]{\begin{spf@proof}[#1]{#2}}{\end{spf@proof}}% +\newrobustcmd\spfidea[2][]{% + \metasetkeys{spf}{#1}% + \stDMemph{\ifx\spf@type\@empty{Proof Idea}\else\spf@type\fi:} #2\sproofend% +}% +\newenvironment{spfstep}[1][]{% + \metasetkeys{spf}{#1}% + \@in@omtexttrue% + \ifx\spf@display\spf@flow% + \else% + \item[\the@pst@label]% + \fi% + \ifx\spf@title\@empty\else{(\stDMemph{\spf@title})}\fi% + \sref@label@id{\pst@label}\ignorespaces% +}{% + \next@pst@label\@in@omtextfalse\ignorespaces% +}% +\newenvironment{sproofcomment}[1][]{% + \metasetkeys{spf}{#1}% + \ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi% +}{% + \next@pst@label% +}% +\newenvironment{subproof}[2][]{% + \metasetkeys{spf}{#1}% + \def\@test{#2}% + \ifx\@test\empty% + \else% + \ifx\spf@display\spf@flow {#2}% + \else% + \item[\the@pst@label]{#2} % + \fi% + \fi% + \begin{pst@with@label}{\pst@label,\number\count\count10}% +}{% + \end{pst@with@label}\next@pst@label% +}% +\newenvironment{spfcases}[2][]{% + \def\@test{#1}% + \ifx\@test\empty% + \begin{subproof}[method=by-cases]{#2}% + \else% + \begin{subproof}[#1,method=by-cases]{#2}% + \fi% +}{% + \end{subproof}% +}% +\newenvironment{spfcase}[2][]{% + \metasetkeys{spf}{#1}% + \ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi% + \def\@test{#2}% + \ifx\@test\@empty% + \else% + {\stDMemph{#2}: }% need blank here + \fi% + \begin{pst@with@label}{\pst@label,\number\count\count10} +}{% + \ifx\spf@display\spf@flow% + \else% + \sproofend% + \fi% + \end{pst@with@label}% + \next@pst@label% +}% +\newrobustcmd\spfcasesketch[3][]{% + \metasetkeys{spf}{#1}% + \ifx\spf@display\spf@flow% + \else% + \item[\the@pst@label]% + \fi% + \def\@test{#2}% + \ifx\@test\@empty% + \else% + {\stDMemph{#2}: }% + \fi#3% + \next@pst@label% +}% \srefaddidkey{just} \addmetakey{just}{method} \addmetakey{just}{premises} \addmetakey{just}{args} \newenvironment{justification}[1][]{}{} -\newcommand{\premise}[2][]{#2} -\newcommand{\justarg}[2][]{#2} +\newrobustcmd\premise[2][]{#2} +\newrobustcmd\justarg[2][]{#2} \endinput %% %% End of file `sproof.sty'. |