diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/stex/example |
Initial commit
Diffstat (limited to 'macros/latex/contrib/stex/example')
20 files changed, 567 insertions, 0 deletions
diff --git a/macros/latex/contrib/stex/example/Makefile b/macros/latex/contrib/stex/example/Makefile new file mode 100644 index 0000000000..47c6188266 --- /dev/null +++ b/macros/latex/contrib/stex/example/Makefile @@ -0,0 +1,4 @@ +STEXDIR = .. +MAKEDIRS = background paper +CLEANDIRS = $(MAKEDIRS) +include $(STEXDIR)/lib/make/Makefile.subdirs diff --git a/macros/latex/contrib/stex/example/README b/macros/latex/contrib/stex/example/README new file mode 100644 index 0000000000..fdba0ac819 --- /dev/null +++ b/macros/latex/contrib/stex/example/README @@ -0,0 +1,16 @@ +This directory contains a typical (if minimal) example of a sTeX +collection, and a Makefile-based conversion workflow. It is intended +to test the sTeX distribution and serve as an example for sTeX users +to set up their system. It contains + +README: this file +Makefile: this contains rules to automate the PDF formatting and + XML conversion process. +background: a directory with background modules, this is assumed to + exist before starting work on the paper, in real life this + would probably be a subversion external. +paper: a directory with a paper based on two modules and the + background modules. + +For an explanation of the design of the example see paper/example.pdf or +https://trac.kwarc.info/sTeX/wiki/sTeXCollections diff --git a/macros/latex/contrib/stex/example/background/Makefile b/macros/latex/contrib/stex/example/background/Makefile new file mode 100644 index 0000000000..67b4dc3d18 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/Makefile @@ -0,0 +1,9 @@ +STEXDIR = ../.. +TARGET = all.tex +BUTFILES = pre.tex post.tex +MODSLIBDIR = . +BIBINPUTS = $(PREFIX)/lib/bib: + +include $(STEXDIR)/lib/make/Makefile.vars +all: pdf mpdf +include $(STEXDIR)/lib/make/Makefile.in diff --git a/macros/latex/contrib/stex/example/background/all.pdf b/macros/latex/contrib/stex/example/background/all.pdf Binary files differnew file mode 100644 index 0000000000..debf135663 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/all.pdf diff --git a/macros/latex/contrib/stex/example/background/all.tex b/macros/latex/contrib/stex/example/background/all.tex new file mode 100644 index 0000000000..27df61d1e6 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/all.tex @@ -0,0 +1,12 @@ +\documentclass{omdoc} +\usepackage{stex} +\usepackage{hyperref,amssymb} +\defpath{backmods}{../background} +\begin{document} +\input{functions} +\input{reals} +\end{document} +%%% Local Variables: +%%% mode: LaTeX +%%% TeX-master: t +%%% End: diff --git a/macros/latex/contrib/stex/example/background/functions.omdoc b/macros/latex/contrib/stex/example/background/functions.omdoc new file mode 100644 index 0000000000..72adb2e3b2 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/functions.omdoc @@ -0,0 +1,187 @@ +<?xml version="1.0"?> +<!--This OMDoc document is generated from an sTeX-encoded one via LaTeXML, you + may want to reconsider editing it.--> +<omdoc xmlns:omdoc="http://omdoc.org/ns" xmlns="http://omdoc.org/ns" xmlns:stex="http://kwarc.info/ns/sTeX" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:om="http://www.openmath.org/OpenMath" xmlns:m="http://www.w3.org/1998/Math/MathML" xml:id="omdoc1" about="#omdoc1" stex:srcref="Literal String \documentc#textrange(from=1;0,to=0;0)"> + <omdoc:omgroup layout="sectioning" xml:id="sec.functions" about="#sec.functions" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=1;0,to=18;13)"> + <omdoc:metadata xml:id="sec.functions.metadata1" about="#sec.functions.metadata1" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=1;0,to=18;13)"> + <dc:title xml:id="sec.functions.metadata1.title1" about="#sec.functions.metadata1.title1" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=1;0,to=18;13)">Functions</dc:title> + </omdoc:metadata> + <omdoc:theory xml:id="functions" about="#functions" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=2;0,to=17;12)"> + <omdoc:symbol name="cart" xml:id="functions.symbol1" about="#functions.symbol1" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=3;0,to=3;55)"/> + <omdoc:notation cd="functions" name="cart" stex:macro_name="cart" stex:nargs="1" xml:id="functions.notation2" about="#functions.notation2" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=3;0,to=3;55)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="cart"/> + <omdoc:exprlist name="args"> + <omdoc:expr name="arg"/> + </omdoc:exprlist> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering precedence="500"> + <omdoc:iterate name="args"> + <omdoc:separator> + <m:mo cr="fun">×</m:mo> + </omdoc:separator> + <omdoc:render name="arg"/> + </omdoc:iterate> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="fun" xml:id="functions.symbol3" about="#functions.symbol3" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=4;0,to=4;71)"/> + <omdoc:notation cd="functions" name="fun" stex:macro_name="fun" stex:nargs="3" xml:id="functions.notation4" about="#functions.notation4" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=4;0,to=4;71)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="fun"/> + <omdoc:expr name="arg1"/> + <omdoc:expr name="arg2"/> + <omdoc:expr name="arg3"/> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering precedence="200"> + <omdoc:render name="arg1" precedence="200"/> + <m:mo cr="fun">:</m:mo> + <omdoc:render name="arg2" precedence="200"/> + <m:mo cr="fun">→</m:mo> + <omdoc:render name="arg3" precedence="200"/> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="inset" xml:id="functions.symbol5" about="#functions.symbol5" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=5;0,to=5;45)"/> + <omdoc:notation cd="functions" name="inset" stex:macro_name="inset" stex:nargs="2" xml:id="functions.notation6" about="#functions.notation6" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=5;0,to=5;45)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="inset"/> + <omdoc:expr name="arg1"/> + <omdoc:expr name="arg2"/> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering precedence="650"> + <omdoc:render name="arg1" precedence="650"/> + <m:mo cr="fun">∈</m:mo> + <omdoc:render name="arg2" precedence="650"/> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="sseteq" xml:id="functions.symbol7" about="#functions.symbol7" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=6;0,to=6;41)"/> + <omdoc:notation cd="functions" name="sseteq" stex:macro_name="sseteqOp" stex:nargs="0" xml:id="functions.notation8" about="#functions.notation8" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=6;0,to=6;41)"> + <omdoc:prototype> + <om:OMS cd="functions" name="sseteq"/> + </omdoc:prototype> + <omdoc:rendering> + <m:mo>⊆</m:mo> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="sseteq" xml:id="functions.symbol9" about="#functions.symbol9" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=7;0,to=7;50)"/> + <omdoc:notation cd="functions" name="sseteq" stex:macro_name="sseteq" stex:nargs="2" xml:id="functions.notation10" about="#functions.notation10" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=7;0,to=7;50)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="sseteq"/> + <omdoc:expr name="arg1"/> + <omdoc:expr name="arg2"/> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering precedence="300"> + <omdoc:render name="arg1" precedence="300"/> + <m:mo cr="fun">⊆</m:mo> + <omdoc:render name="arg2" precedence="300"/> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="tup" xml:id="functions.symbol11" about="#functions.symbol11" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=8;0,to=8;33)"/> + <omdoc:notation cd="functions" name="tup" stex:macro_name="tup" stex:nargs="1" xml:id="functions.notation12" about="#functions.notation12" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=8;0,to=8;33)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="tup"/> + <omdoc:expr name="arg1"/> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering> + <m:mrow> + <m:mo stretchy="false">⟨</m:mo> + <omdoc:render name="arg1"/> + <m:mo stretchy="false">⟩</m:mo> + </m:mrow> + </omdoc:rendering> + </omdoc:notation> + <omdoc:notation cd="functions" name="cart" stex:macro_name="cart" stex:nargs="1" xml:id="functions.notation13" about="#functions.notation13" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=9;0,to=9;34)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="cart"/> + <omdoc:expr name="arg1"/> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering> + <omdoc:iterate name="args"> + <omdoc:separator> + <m:mo cr="fun">×</m:mo> + </omdoc:separator> + <omdoc:render name="arg"/> + </omdoc:iterate> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="setdiff" xml:id="functions.symbol14" about="#functions.symbol14" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=10;0,to=10;44)"/> + <omdoc:notation cd="functions" name="setdiff" stex:macro_name="setdiffOp" stex:nargs="0" xml:id="functions.notation15" about="#functions.notation15" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=10;0,to=10;44)"> + <omdoc:prototype> + <om:OMS cd="functions" name="setdiff"/> + </omdoc:prototype> + <omdoc:rendering> + <m:mo>\</m:mo> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="setdiff" xml:id="functions.symbol16" about="#functions.symbol16" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=11;0,to=11;59)"/> + <omdoc:notation cd="functions" name="setdiff" stex:macro_name="setdiff" stex:nargs="2" xml:id="functions.notation17" about="#functions.notation17" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=11;0,to=11;59)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="setdiff"/> + <omdoc:expr name="arg1"/> + <omdoc:expr name="arg2"/> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering precedence="600"> + <omdoc:render name="arg1" precedence="600"/> + <m:mo cr="fun">\</m:mo> + <omdoc:render name="arg2" precedence="600"/> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="set" xml:id="functions.symbol18" about="#functions.symbol18" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=12;0,to=12;62)"/> + <omdoc:notation cd="functions" name="set" stex:macro_name="set" stex:nargs="1" xml:id="functions.notation19" about="#functions.notation19" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=12;0,to=12;62)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="set"/> + <omdoc:exprlist name="args"> + <omdoc:expr name="arg"/> + </omdoc:exprlist> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering> + <m:mo cr="fun">{</m:mo> + <omdoc:iterate name="args" precedence="neginfty"> + <omdoc:separator> + <m:mo cr="fun">,</m:mo> + </omdoc:separator> + <omdoc:render name="arg" precedence="neginfty"/> + </omdoc:iterate> + <m:mo cr="fun">}</m:mo> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="setst" xml:id="functions.symbol20" about="#functions.symbol20" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=13;0,to=13;66)"/> + <omdoc:notation cd="functions" name="setst" stex:macro_name="setst" stex:nargs="2" xml:id="functions.notation21" about="#functions.notation21" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=13;0,to=13;66)"> + <omdoc:prototype> + <om:OMA> + <om:OMS cd="functions" cr="fun" name="setst"/> + <omdoc:expr name="arg1"/> + <omdoc:expr name="arg2"/> + </om:OMA> + </omdoc:prototype> + <omdoc:rendering> + <m:mo cr="fun">{</m:mo> + <omdoc:render name="arg1" precedence="neginfty"/> + <m:mo cr="fun">∣</m:mo> + <omdoc:render name="arg2" precedence="neginfty"/> + <m:mo cr="fun">}</m:mo> + </omdoc:rendering> + </omdoc:notation> + <omdoc:symbol name="function" xml:id="function.def.sym" about="#function.def.sym" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=14;0,to=16;16)"/> + <omdoc:definition for="function" xml:id="functions.def" about="#functions.def" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=14;0,to=16;16)"> + <omdoc:CMP xml:id="functions.def.CMP1" about="#functions.def.CMP1" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=14;0,to=14;36)"> +<p xmlns="http://www.w3.org/1999/xhtml" id="functions.def.CMP1.p1" class="ltx_p" about="#functions.def.CMP1.p1" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=14;0,to=14;36)">A <omdoc:term cd="functions" name="function" role="definiendum" xml:id="functions.def.CMP1.p1.term1" about="#functions.def.CMP1.p1.term1" stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=14;67,to=15;20)">function</omdoc:term> <om:OMOBJ stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=14;61,to=15;32)"><om:OMA><om:OMS cd="functions" name="fun"/><om:OMV name="𝑓"/><om:OMV name="𝐴"/><om:OMV name="𝐵"/></om:OMA></om:OMOBJ> is a left-total, right-unique relation in <om:OMOBJ stex:srcref="/Users/kohlhase/localmh/ext/sTeX/example/background/functions.tex#textrange(from=14;6,to=15;87)"><om:OMA><om:OMS cd="functions" name="cart"/><om:OMV name="𝐴"/><om:OMV name="𝐵"/></om:OMA></om:OMOBJ></p></omdoc:CMP> + </omdoc:definition> + </omdoc:theory> + </omdoc:omgroup> +</omdoc> diff --git a/macros/latex/contrib/stex/example/background/functions.pdf b/macros/latex/contrib/stex/example/background/functions.pdf Binary files differnew file mode 100644 index 0000000000..50567084b3 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/functions.pdf diff --git a/macros/latex/contrib/stex/example/background/functions.tex b/macros/latex/contrib/stex/example/background/functions.tex new file mode 100644 index 0000000000..d4ac497685 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/functions.tex @@ -0,0 +1,22 @@ +\begin{omgroup}[id=sec.functions,creators=miko]{Functions} +\begin{module}[id=functions] +\symdef[assocarg=1]{cart}[1]{\assoc[p=500]{\times}{#1}} +\symdef{fun}[3]{\mixfixiii[p=200]{}{#1}{\colon}{#2}{\rightarrow}{#3}{}} +\symdef{inset}[2]{\infix[p=650]{\in}{#1}{#2}} +\symdef[name=sseteq]{sseteqOp}{\subseteq} +\symdef{sseteq}[2]{\infix[p=300]\sseteqOp{#1}{#2}} +\symdef{tup}[1]{\langle#1\rangle} +\symdef{cart}[1]{\assoc\times{#1}} +\symdef[name=setdiff]{setdiffOp}{\backslash} +\symdef{setdiff}[2]{\mixfixii[p=600]{}{#1}\setdiffOp{#2}{}} +\symdef[assocarg=1]{set}[1]{\mixfixa[nobrackets]{\{}{#1}{\}},} +\symdef{setst}[2]{\mixfixii[nobrackets]{\{}{#1}{\,\mid\,}{#2}{\}}} +\begin{definition}[id=functions.def] + A {\defi{function}} $\fun{f}AB$ is a left-total, right-unique relation in $\cart{A,B}$ +\end{definition} +\end{module} +\end{omgroup} +%%% Local Variables: +%%% mode: LaTeX +%%% TeX-master: "all" +%%% End: diff --git a/macros/latex/contrib/stex/example/background/post.tex b/macros/latex/contrib/stex/example/background/post.tex new file mode 100644 index 0000000000..6b47932f52 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/post.tex @@ -0,0 +1 @@ +\end{document} diff --git a/macros/latex/contrib/stex/example/background/pre.tex b/macros/latex/contrib/stex/example/background/pre.tex new file mode 100644 index 0000000000..59f9473ea4 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/pre.tex @@ -0,0 +1,8 @@ +\documentclass{omdoc} +\usepackage{stex,amssymb,lststex} +\usepackage{hyperref} +\def\omdoc{OMDoc} +\def\latexml{LaTeXML} +\defpath{backmods}{../background} +% \baseURI[\backmods{}]{http://linkeddata.tntbase.org/stex} +% \coolurion diff --git a/macros/latex/contrib/stex/example/background/reals.pdf b/macros/latex/contrib/stex/example/background/reals.pdf Binary files differnew file mode 100644 index 0000000000..4201a59ce1 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/reals.pdf diff --git a/macros/latex/contrib/stex/example/background/reals.tex b/macros/latex/contrib/stex/example/background/reals.tex new file mode 100644 index 0000000000..9bcba08ab8 --- /dev/null +++ b/macros/latex/contrib/stex/example/background/reals.tex @@ -0,0 +1,20 @@ +\begin{omgroup}[id=sec.reals]{Real Numbers} +\begin{module}[id=reals] +\symdef{RealNumbers}{\mathbb{R}} +\symdef{absval}[1]{\mixfixi[p=2000]|{#1}|} +\symdef{rfrac}[2]{\frac{#1}{#2}} + +\begin{definition}[id=reals.def] + We denote the set of {\defii{real}{numbers}} we all know and love with + $\RealNumbers$. +\end{definition} + +\begin{definition}[id=absval.def] + The absolute value $\absval{r}$ of a real number $r$. +\end{definition} +\end{module} +\end{omgroup} +%%% Local Variables: +%%% mode: LaTeX +%%% TeX-master: "all" +%%% End: diff --git a/macros/latex/contrib/stex/example/paper/Makefile b/macros/latex/contrib/stex/example/paper/Makefile new file mode 100644 index 0000000000..de8ce0872d --- /dev/null +++ b/macros/latex/contrib/stex/example/paper/Makefile @@ -0,0 +1,8 @@ +STEXDIR = ../.. +TARGET = paper.tex +MODSLIBDIR = ../background +BIBINPUTS = $(PREFIX)/lib/bib: + +include $(STEXDIR)/lib/make/Makefile.vars +all: pdf mpdf +include $(STEXDIR)/lib/make/Makefile.in diff --git a/macros/latex/contrib/stex/example/paper/continuous.pdf b/macros/latex/contrib/stex/example/paper/continuous.pdf Binary files differnew file mode 100644 index 0000000000..7d97a99a0b --- /dev/null +++ b/macros/latex/contrib/stex/example/paper/continuous.pdf diff --git a/macros/latex/contrib/stex/example/paper/continuous.tex b/macros/latex/contrib/stex/example/paper/continuous.tex new file mode 100644 index 0000000000..dc90911f54 --- /dev/null +++ b/macros/latex/contrib/stex/example/paper/continuous.tex @@ -0,0 +1,20 @@ +\begin{omgroup}[id=sec.contfuncs]{Continuous Functions} +\begin{module}[id=continuous] +\importmodule[load=\backmods{functions}]{functions} +\importmodule[load=\backmods{reals}]{reals} +\symdef{continuousfunctions}[2]{\mathcal{C}^0(#1,#2)} +\abbrdef{ContRR}[2]{\continuousfunctions\RealNumbers\RealNumbers} +\begin{definition}[for=continuousfunctions] + A function $\fun{f}\RealNumbers\RealNumbers$ is called {\defi{continuous}} at + $\inset{x}\RealNumbers$, iff for all $\epsilon>0$ there is a $\delta>0$, such that + $\absval{f(x)-f(y)}<\epsilon$ for all $\absval{x-y}<\delta$. It is called + {\defii{continuous}{on}} a set $\sseteq{S}\RealNumbers$, iff is is continous at all + $\inset{x}S$, the set of all such functions is denoted with $\continuousfunctions{S}T$, + if $\sseteq{f(S)}T$. +\end{definition} +\end{module} +\end{omgroup} +%%% Local Variables: +%%% mode: LaTeX +%%% TeX-master: "paper" +%%% End: diff --git a/macros/latex/contrib/stex/example/paper/differentiable.pdf b/macros/latex/contrib/stex/example/paper/differentiable.pdf Binary files differnew file mode 100644 index 0000000000..06c3f5b945 --- /dev/null +++ b/macros/latex/contrib/stex/example/paper/differentiable.pdf diff --git a/macros/latex/contrib/stex/example/paper/differentiable.tex b/macros/latex/contrib/stex/example/paper/differentiable.tex new file mode 100644 index 0000000000..da999f014d --- /dev/null +++ b/macros/latex/contrib/stex/example/paper/differentiable.tex @@ -0,0 +1,16 @@ +\begin{omgroup}[id=sec.differentiable]{Differentiable Functions} +\begin{module}[id=differentiable] +\importmodule[load=continuous]{continuous} +\symdef{difffunctions}[2]{\mathcal{C}^1(#1,#2)} +\abbrdef{DiffRR}[2]{\difffunctions\RealNumbers\RealNumbers} +\begin{definition} + A function $\fun{f}\RealNumbers\RealNumbers$ is called {\defi{differentiable}} at + $\inset{x}\RealNumbers$, iff for all $\epsilon>0$ there is a $\delta>0$, such that + $\rfrac{\absval{f(x)-f(y)}}{\absval{x-y}}<\epsilon$ for all $\absval{x-y}<\delta$. +\end{definition} +\end{module} +\end{omgroup} +%%% Local Variables: +%%% mode: LaTeX +%%% TeX-master: "paper" +%%% End: diff --git a/macros/latex/contrib/stex/example/paper/intro.pdf b/macros/latex/contrib/stex/example/paper/intro.pdf Binary files differnew file mode 100644 index 0000000000..d3a5eaba7c --- /dev/null +++ b/macros/latex/contrib/stex/example/paper/intro.pdf diff --git a/macros/latex/contrib/stex/example/paper/intro.tex b/macros/latex/contrib/stex/example/paper/intro.tex new file mode 100644 index 0000000000..8faed56d13 --- /dev/null +++ b/macros/latex/contrib/stex/example/paper/intro.tex @@ -0,0 +1,96 @@ +\begin{omgroup}[id=intro]{Introduction} + We will show how to semantically mark up mathematics in the {\sTeX} + format~\cite{Kohlhase:ulsmf08} and how to convert it into + {\omdoc}~\cite{Kohlhase:OMDoc1.3}. + + We have some mathematical material in {\sref{sec.math}} which will serve as example + content. In the rest of this section we will explain the setup of the example and + present an approach to automation of the {\omdoc} conversion via Unix Makefiles. + \begin{omgroup}{The Setup} + \begin{module}[id=setup] + \begin{definition}[display=flow] + The source of this note is contained in the file {\texttt{paper.tex}}. We call it + the {\defi{target}}, since formatting it with {\LaTeX} will generate the main + document. The content in {\sref{sec.contfuncs}} and {\sref{sec.differentiable}} + comes from included files {\texttt{continuous.tex}} and + {\texttt{differentiable.tex}}, we will call them {\defi{module}s}, since they may + be used (i.e. included) by other target documents as well. + \end{definition} + + \begin{omtext} + As the modules are built for inclusion into other documents, they are not + self-contained: + \begin{enumerate} + \item they do not contain a {\LaTeX} preamble and + \verb|\begin|/\verb|\end{document}|, and + \item they may depend on other modules, whose semantic macros they need to include, + \item to facilitate this a module file {\texttt{modf.tex}} comes with a ``semantic + macro short form'' {\texttt{modf.sms}} that can be included without generating + output in the PDF. + \end{enumerate} + \end{omtext} + + \begin{omtext} + This will have consequences for the automation. Concretely, the module on + differentiable functions in {\sref{sec.differentiable}} depends on that for continuous + functions in {\sref{sec.contfuncs}}. Both of them depend on modules for real numbers, + sets and functions that we do not want to cover in this note. \inlinedef{We assume + that they have already been marked up with the same methods as we describe here and + are accessible to us and call them {\defii{background}{module}s}}. In our setup we + keep them in the subdirectory {\texttt{background}}. + \end{omtext} +\end{module} +\end{omgroup} + +\begin{omgroup}{Formatting and {\omdoc} conversion} + To format an {\sTeX} document --- i.e. to produce a PDF file from the {\sTeX} marked-up + sources --- we only need to run the {\texttt{pdflatex}} program over the target document + --- assuming that all modules (regular or background) have semantic macro short forms. + + To convert an {\sTeX} document to {\omdoc}, we need to run {\texttt{latexml}} over it, + post-process the result by {\texttt{latexmlpost}}, and finally massage away all remaining + {\latexml} islands with a stylesheet, see ~\cite{Kohlhase:ssmtl*} for details. +\end{omgroup} + +\begin{omgroup}{Makefile-based Automation} + As the conversion to {\omdoc} is rather complex (the programs in the three steps take a + variety of options), we support an automation by Unix Makefiles. There are three main + {\texttt{make}} targets. + + \begin{description} + \item[{\texttt{make omdoc}}] will trigger the {\omdoc} transformation of the target + document. + \item[{\texttt{make mods}}] will trigger the {\omdoc} transformation of the modules. + \item[{\texttt{make pdf}}] will trigger the {\LaTeX} formatting the target + \item[{\texttt{make mpdf}}] will trigger the {\LaTeX} formatting the modules + \item[{\texttt{make sms}}] will trigger the re-generation of all semantic macro short + forms of modules (this is implicitly called in all the other {\texttt{make}} targets) + \end{description} + To use this, we need to set up a {\texttt{{Makefile}}} of the following form: + +\lstset{columns=flexible,frame=lines,numbers=left,stepnumber=2,numberstyle=\tiny,basicstyle=\small} +\lstinputlisting[language=make]{Makefile} + + The variable {\lstinline{STEXDIR}} has to be set to the main directory of the {\sTeX} + distribution. The variable {\lstinline{TARGET}} specifies the target document (all other + {\texttt{*.tex}} files that are not excluded in the {\lstinline{BUTFILES}} variables are + considered as modules). Here, the {\texttt{background}} directory for convenience. The + {\lstinline{MODSLIBDIR}} specifies the location of the prefix and postfix files + {\texttt{pre.tex}} and {\texttt{post.tex}} that will be prepended and appended to the + modules to make them into complete files {\TeX} files that can be converted. The last + three lines just include the Makefiles from the {\sTeX} distribution and configure the + default make target (\texttt{make all}) to be produce the pdf version + + Note that in the directory {\texttt{background}} we have a very similar Makefile as + above. The only differences are that the variable {\lstinline{STEXDIR}} is adapted and + that the {\lstinline{BUTFILE}} variable is set to {\texttt{pre.tex}} and + {\texttt{post.tex}}, so that they are not converted. In the directory + {\texttt{background}} we have followed good practice by establishing a phony +\end{omgroup} + +\end{omgroup} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "paper" +%%% End: diff --git a/macros/latex/contrib/stex/example/paper/paper.tex b/macros/latex/contrib/stex/example/paper/paper.tex new file mode 100644 index 0000000000..61d4aa7f17 --- /dev/null +++ b/macros/latex/contrib/stex/example/paper/paper.tex @@ -0,0 +1,148 @@ +\documentclass{omdoc} +\usepackage{amssymb} +\usepackage{alltt} +\usepackage{hyperref} +\usepackage{listings} +\def\omdoc{OMDoc} +\def\latexml{LaTeXML} +\defpath{backmods}{../background} +%% defining the author metadata +\WAperson[id=miko, + affiliation=JUB, + url=http://kwarc.info/kohlhase] + {Michael Kohlhase} +\WAinstitution[id=JUB, + url=http://jacobs-university.de, + streetaddress={Campus Ring 1}, + townzip={28759 Bremen}, + countryshort=D, + country=Germany, + type=University, + acronym=JACU, + shortname=Jacobs Univ.] + {Jacobs University Bremen} + +\begin{document} + +% metadata and title page +% \begin{DCmetadata}[maketitle] +% \DCMcreators{miko} +% \DCMrights{Copyright (c) 2009 Michael Kohlhase} +% \DCMtitle{An example of semantic Markup in {\sTeX}} +% \DCMabstract{In this note we give an example of semantic markup in {\sTeX}: +% Continuous and differentiable functions are introduced using real numbers, sets and +% functions as an assumed background.} +% \end{DCmetadata} + +\inputref{intro} + +\begin{omgroup}[id=sec.math]{Mathematical Content} + \begin{omgroup}{Calculus} + We present some standard mathematical definitions, here from calculus. + \inputref{continuous} + \inputref{differentiable} +\end{omgroup} + +\begin{omgroup}[id=sec.math]{A Theory Graph for Elementary Algebra} + Here we show an example for more advanced theory graph manipulations, in particular + imports via morphisms. + +\begin{module}[id=magma] + \importmodule[load=\backmods{functions}]{functions} + \symdef{magbase}{G} + \symdef[name=magmaop]{magmaopOp}{\circ} + \symdef{magmaop}[2]{\infix\magmaopOp{#1}{#2}} + \begin{definition}[id=magma.def] + A \defi{magma} is a structure $\tup{\magbase,\magmaopOp}$, such that $\magbase$ is + closed under the operation $\fun\magmaopOp{\cart{\magbase,\magbase}}\magbase$. + \end{definition} +\end{module} + +\begin{module}[id=semigroup] + \importmodule{magma} + \begin{definition}[id=semigroup.def] + A \trefi[magma]{magma} $\tup{\magbase,\magmaopOp}$, is called a \defi{semigroup}, iff + $\magmaopOp$ is associative. + \end{definition} +\end{module} + +\begin{module}[id=monoid] + \importmodule{semigroup} + \symdef{monneut}{e} + \symdef{noneut}[1]{#1^*} + \begin{definition}[id=monoid.def] + A \defi{monoid} is a structure $\tup{\magbase,\magmaopOp,\monneut}$, such that + $\tup{\magbase,\magmaopOp}$ is a \trefi[semigroup]{semigroup} and $\monneut$ is a + \defii{neutral}{element}, i.e. that $\magmaop{x}\monneut=x$ for all $\inset{x}\magbase$. + \end{definition} + + \begin{definition}[id=noneut.def] + In a monoid $\tup{\magbase,\magmaopOp,\monneut}$, we use denote the set + $\setst{\inset{x}S}{x\ne\monneut}$ with $\noneut{S}$. + \end{definition} +\end{module} + +\begin{module}[id=group] + \importmodule{monoid} + \symdef{ginvOp}{i} + \symdef{ginv}[1]{\prefix\ginvOp{#1}} + \begin{definition}[id=group.def] + A \defi{group} is a structure $\tup{\magbase,\magmaopOp,\monneut,\ginvOp}$, such that + $\tup{\magbase,\magmaopOp,\monneut}$ is a \trefi[monoid]{monoid} and $\ginvOp$ acts as + a \defi{inverse}, i.e. that $\magmaop{x}{\ginv{x}}=\monneut$ for all + $\inset{x}\magbase$. + \end{definition} +\end{module} + +\begin{module}[id=cgroup] +\importmodule{group} +\begin{definition}[id=cgroup.def] + We call a \trefi[group]{group} $\tup{\magbase,\magmaopOp,\monneut,\ginvOp}$ a + \defii{commutative}{group}, iff $\magmaopOp$ is commutative. +\end{definition} +\end{module} + +\begin{module}[id=ring] +\symdef{rbase}{R} +\symdef[name=rtimes]{rtimesOp}{\cdot} +\symdef{rtimes}[2]{\infix\rtimesOp{#1}{#2}} +\symdef{rone}{1} +\begin{importmodulevia}{monoid} + \vassign{rbase}\magbase + \vassign{rtimesOp}\magmaopOp + \vassign{rone}\monneut +\end{importmodulevia} +\symdef[name=rplus]{rplusOp}{+} +\symdef{rplus}[2]{\infix\rplusOp{#1}{#2}} +\symdef{rzero}{0} +\symdef[name=rminus]{rminusOp}{-} +\symdef{rminus}[1]{\prefix\rminusOp{#1}} +\begin{importmodulevia}{cgroup} + \vassign{rplus}\magmaopOp + \vassign{rzero}\monneut + \vassign{rminusOp}\ginvOp +\end{importmodulevia} +\begin{definition} + A \defi{ring} is a structure $\tup{\rbase,\rplusOp,\rzero,\rtimesOp,\rone,\rminusOp}$, + such that $\tup{\noneut\rbase,\rtimesOp,\rone}$ is a monoid and + $\tup{\rbase,\rplusOp,\rzero,\rminusOp}$ is a commutative group. +\end{definition} +\end{module} +\end{omgroup} +\end{omgroup} + +\begin{omgroup}[id=concl]{Conclusion} + In this note we have given an example of standard mathematical markup and shown how a a + {\sTeX} collection can be set up for automation. +\end{omgroup} +\bibliographystyle{alpha} +\bibliography{kwarc} +\end{document} + +%%% Local Variables: +%%% mode: LaTeX +%%% TeX-master: t +%%% End: + +% LocalWords: miko Makefiles tex contfuncs modf sms pdflatex latexml Makefile +% LocalWords: latexmlpost omdoc STEXDIR BUTFILES DIRS |