summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stex/doc
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/stex/doc')
-rw-r--r--macros/latex/contrib/stex/doc/Makefile5
-rw-r--r--macros/latex/contrib/stex/doc/img/vsc1.pngbin25993 -> 0 bytes
-rw-r--r--macros/latex/contrib/stex/doc/img/vsc2.pngbin54764 -> 0 bytes
-rw-r--r--macros/latex/contrib/stex/doc/img/vsc3.pngbin49418 -> 0 bytes
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-basics.tex41
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-document-structure.tex167
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-features.tex246
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-hwexam.tex20
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-idesetup.tex61
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-inheritance.tex131
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-mathhub.tex203
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-mathhubsetup.tex25
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-metatheory.tex30
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-modules.tex73
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-notesslides.tex75
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-problem.tex13
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-proofs.tex387
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-references.tex92
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-setup.tex34
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-statements.tex145
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-symbols.tex587
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-terms.tex177
-rw-r--r--macros/latex/contrib/stex/doc/packages/stex-tikzinput.tex10
-rw-r--r--macros/latex/contrib/stex/doc/stex-abstract.tex26
-rw-r--r--macros/latex/contrib/stex/doc/stex-devel.tex1799
-rw-r--r--macros/latex/contrib/stex/doc/stex-doc.pdfbin1802605 -> 4835495 bytes
-rw-r--r--macros/latex/contrib/stex/doc/stex-doc.tex265
-rw-r--r--macros/latex/contrib/stex/doc/stex-docheader.tex531
-rw-r--r--macros/latex/contrib/stex/doc/stex-ide.pdfbin378968 -> 0 bytes
-rw-r--r--macros/latex/contrib/stex/doc/stex-ide.tex155
-rw-r--r--macros/latex/contrib/stex/doc/stex-manual.pdfbin1121031 -> 745718 bytes
-rw-r--r--macros/latex/contrib/stex/doc/stex-manual.tex563
-rw-r--r--macros/latex/contrib/stex/doc/stex-tutorial.pdfbin0 -> 3432339 bytes
-rw-r--r--macros/latex/contrib/stex/doc/stex-tutorial.tex354
34 files changed, 2224 insertions, 3991 deletions
diff --git a/macros/latex/contrib/stex/doc/Makefile b/macros/latex/contrib/stex/doc/Makefile
index 7544a3c2fd..6b1efc4862 100644
--- a/macros/latex/contrib/stex/doc/Makefile
+++ b/macros/latex/contrib/stex/doc/Makefile
@@ -1,8 +1,8 @@
-STY = stex extensions
+STY = .
SPATH = $(STY:%=../source/%)
DTX = $(shell ls $(SPATH:%=%/*.dtx))
INS = $(shell ls $(SPATH:%=%/*.ins))
-DOC = stex-doc.pdf stex-manual.pdf stex-ide.pdf
+DOC = stex-doc.pdf
TEXDIR = ../tex
TEXINPUTS = $(TEXDIR)//:
@@ -20,6 +20,7 @@ pack: $(DTX) $(INS)
$(DOC): %.pdf: %.tex pack
$(PDFLATEX) $<
biber -q $(basename $<)
+ makeindex -s gind.ist -o $(basename $<).ind $(basename $<).idx
$(PDFLATEX) $<
echo:
diff --git a/macros/latex/contrib/stex/doc/img/vsc1.png b/macros/latex/contrib/stex/doc/img/vsc1.png
deleted file mode 100644
index c6c3847f69..0000000000
--- a/macros/latex/contrib/stex/doc/img/vsc1.png
+++ /dev/null
Binary files differ
diff --git a/macros/latex/contrib/stex/doc/img/vsc2.png b/macros/latex/contrib/stex/doc/img/vsc2.png
deleted file mode 100644
index e6365ad802..0000000000
--- a/macros/latex/contrib/stex/doc/img/vsc2.png
+++ /dev/null
Binary files differ
diff --git a/macros/latex/contrib/stex/doc/img/vsc3.png b/macros/latex/contrib/stex/doc/img/vsc3.png
deleted file mode 100644
index d7b67ae278..0000000000
--- a/macros/latex/contrib/stex/doc/img/vsc3.png
+++ /dev/null
Binary files differ
diff --git a/macros/latex/contrib/stex/doc/packages/stex-basics.tex b/macros/latex/contrib/stex/doc/packages/stex-basics.tex
deleted file mode 100644
index f766b9b22f..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-basics.tex
+++ /dev/null
@@ -1,41 +0,0 @@
-We can use \sTeX by simply including the package with |\usepackage{stex}|,
-or -- primarily for individual fragments to be included in other
-documents -- by using the \sTeX document class with |\documentclass{stex}|
-which combines the \pkg{standalone} document class with the \pkg{stex}
-package.
-
-Both the \pkg{stex} package and document class offer the following
-options:
-
-\begin{description}
- \item[\texttt{lang}] (\meta{language}$\ast$) Languages
- to load with the \pkg{babel} package.
- \item[\texttt{mathhub}] (\meta{directory}) MathHub folder
- to search for repositories -- this is not necessary if the
- |MATHHUB| system variable is set.
- \item[\texttt{writesms}] (\meta{boolean}) with this package
- option, \sTeX will write the contents of all external
- modules imported via \stexcode"\importmodule" or \stexcode"\usemodule"
- into a file \stexcode"\jobname.sms" (analogously to
- the table of contents \stexcode".toc"-file).
- \item[\texttt{usems}] (\meta{boolean}) subsequently tells
- \sTeX to read the generated sms-file at the beginning of the
- document. This allows for e.g. collaborating on documents
- without all authors having to have all used archives and
- modules available -- one author can load the modules
- with \texttt{writesms}, and the rest can use the
- the modules with \texttt{usesms}. Furthermore, the sms
- file can be submitted alongside a \texttt{tex}-file,
- effectively making it ``standalone''.
- \item[\texttt{image}] (\meta{boolean}) passed on to
- \pkg{tikzinput}.
- \item[\texttt{debug}] (\meta{log-prefix}$\ast$) Logs debugging
- information with the given prefixes to the terminal,
- or all if |all| is given. Largely irrelevant for the
- majority of users.
-\end{description}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
diff --git a/macros/latex/contrib/stex/doc/packages/stex-document-structure.tex b/macros/latex/contrib/stex/doc/packages/stex-document-structure.tex
deleted file mode 100644
index f2cabec6c0..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-document-structure.tex
+++ /dev/null
@@ -1,167 +0,0 @@
-\begin{sfragment}[id=sec:ds:intro]{Introduction}
-The \pkg{document-structure} package supplies an infrastructure for writing {\omdoc} documents in {\LaTeX}.
-This includes a simple structure sharing mechanism for \sTeX that allows to to move from
-a copy-and-paste document development model to a copy-and-reference model, which
-conserves space and simplifies document management. The augmented structure can be used
-by MKM systems for added-value services, either directly from the \sTeX sources, or
-after translation.
-
-
- The \pkg{document-structure} package supplies macros and environments that allow to label document
- fragments and to reference them later in the same document or in other documents. In
- essence, this enhances the document-as-trees model to
- documents-as-directed-acyclic-graphs (DAG) model. This structure can be used by MKM
- systems for added-value services, either directly from the \sTeX sources, or after
- translation. Currently, trans-document referencing provided by this package can only be
- used in the \sTeX collection.
-
- DAG models of documents allow to replace the ``Copy and Paste'' in the source document
- with a label-and-reference model where document are shared in the document source and the
- formatter does the copying during document formatting/presentation.
-\end{sfragment}
-
-\begin{sfragment}{Package Options}
-The \pkg{document-structure} package accepts the following options:
-\begin{center}
- \begin{tabular}{|l|p{10cm}|}\hline
- \texttt{class=\meta{name}} & load \meta{name}|.cls| instead of |article.cls|\\\hline
- \texttt{topsect=\meta{sect}} & The top-level sectioning level; the default for
- \meta{sect} is \texttt{section}\\\hline
- \end{tabular}
-\end{center}
-\end{sfragment}
-
-\begin{sfragment}{Document Fragments}
-\begin{environment}{sfragment}
- The structure of the document is given by nested |sfragment| environments. In the
- {\LaTeX} route, the |sfragment| environment is flexibly mapped to sectioning commands,
- inducing the proper sectioning level from the nesting of |sfragment|
- environments. Correspondingly, the |sfragment| environment takes an optional key/value
- argument for metadata followed by a regular argument for the (section) title of the
- sfragment. The optional metadata argument has the keys |id| for an identifier,
- |creators| and |contributors| for the Dublin Core metadata~\cite{DCMI:dmt03}. The option
- |short| allows to give a short title for the generated section. If the title contains
- semantic macros, we need to give the |loadmodules| key (it needs no value). For instance
- we would have
-\begin{latexcode}
-\begin{smodule}{foo}
- \symdef{bar}{B^a_r}
- ...
- \begin{sfragment}[id=sec.barderiv,loadmodules]
- {Introducing $\protect\bar$ Derivations}
-\end{latexcode}
-
-\sTeX automatically computes the sectioning level, from the nesting of |sfragment|
-environments.
-\end{environment}
-
-But sometimes, we want to skip levels (e.g. to use a |\subsection*| as an introduction for
-a chapter).
-
-\begin{environment}{blindfragment}
- Therefore the \pkg{document-structure} package provides a variant |blindfragment| that
- does not produce markup, but increments the sectioning level and logically groups
- document parts that belong together, but where traditional document markup relies on
- convention rather than explicit markup. The |blindfragment| environment is useful
- e.g. for creating frontmatter at the correct level. The example below shows a typical
- setup for the outer document structure of a book with parts and chapters.
-
-\begin{latexcode}
-\begin{document}
-\begin{blindfragment}
-\begin{blindfragment}
-\begin{frontmatter}
-\maketitle\newpage
-\begin{sfragment}{Preface}
-... <<preface>> ...
-\end{sfragment}
-\clearpage\setcounter{tocdepth}{4}\tableofcontents\clearpage
-\end{frontmatter}
-\end{blindfragment}
-... <<introductory remarks>> ...
-\end{blindfragment}
-\begin{sfragment}{Introduction}
-... <<intro>> ...
-\end{sfragment}
-... <<more chapters>> ...
-\bibliographystyle{alpha}\bibliography{kwarc}
-\end{document}
-\end{latexcode}
-
-Here we use two levels of |blindfragment|:
-\begin{itemize}
-\item The outer one groups the introductory parts of the book (which we assume to have a
- sectioning hierarchy topping at the part level). This |blindfragment| makes sure that
- the introductory remarks become a ``chapter'' instead of a ``part''.
-\item The inner one groups the frontmatter\footnote{We shied away from redefining the
- |frontmatter| to induce a blindfragment, but this may be the ``right'' way to go in
- the future.} and makes the preface of the book a section-level construct. The
- |frontmatter| environment also suppresses numbering as is traditional for prefaces.
-\end{itemize}
-\end{environment}
-
-\begin{function}{\skipfragment}
- The |\skipfragment| ``skips an |sfragment|'', i.e. it just steps the respective sectioning
- counter. This macro is useful, when we want to keep two documents in sync structurally,
- so that section numbers match up: Any section that is left out in one becomes a
- |\skipfragment|.
-\end{function}
-
-\begin{function}{\currentsectionlevel,\CurrentSectionLevel}
- The |\currentsectionlevel| macro supplies the name of the current sectioning level,
- e.g. ``chapter'', or ``subsection''. |\CurrentSectionLevel| is the capitalized
- variant. They are useful to write something like ``In this |\currentsectionlevel|, we
- will\ldots'' in an |sfragment| environment, where we do not know which sectioning level we
- will end up.
-\end{function}
-\end{sfragment}
-
-\begin{sfragment}{Ending Documents Prematurely}
-\begin{function}{\prematurestop,\afterprematurestop}
- For prematurely stopping the formatting of a document, \sTeX provides the
- |\prematurestop| macro. It can be used everywhere in a document and ignores all input
- after that -- backing out of the |sfragment| environments as needed. After that -- and
- before the implicit |\end{document}| it calls the internal |\afterprematurestop|, which
- can be customized to do additional cleanup or e.g. print the bibliography.
-
- |\prematurestop| is useful when one has a driver file, e.g. for a course taught multiple
- years and wants to generate course notes up to the current point in the lecture. Instead
- of commenting out the remaining parts, one can just move the |\prematurestop| macro.
- This is especially useful, if we need the rest of the file for processing, e.g. to
- generate a theory graph of the whole course with the already-covered parts marked up as
- an overview over the progress; see |import_graph.py| from the |lmhtools|
- utilities~\cite{lmhtools:github:on}.
-\end{function}
-
-Text fragments and modules can be made more re-usable by the use of global variables. For
-instance, the admin section of a course can be made course-independent (and therefore
-re-usable) by using variables (actually token registers) |courseAcronym| and |courseTitle|
-instead of the text itself. The variables can then be set in the \sTeX preamble of the
-course notes file.
-\end{sfragment}
-
-\begin{sfragment}{Global Document Variables}
- To make document fragments more reusable, we sometimes want to make the content depend
- on the context. We use \defemph{document variables} for that.
-
-\begin{function}{\setSGvar,\useSGvar}
- |\setSGvar{|\meta{vname}|}{|\meta{text}|}| to set the global variable \meta{vname} to
- \meta{text} and |\useSGvar{|\meta{vname}|}| to reference it.
-\end{function}
-
-\begin{function}{\ifSGvar}
- With|\ifSGvar| we can test for the contents of a global variable: the macro call
- |\ifSGvar{|\meta{vname}|}{|\meta{val}|}{|\meta{ctext}|}| tests the content of the global
- variable \meta{vname}, only if (after expansion) it is equal to \meta{val}, the
- conditional text \meta{ctext} is formatted.
-\end{function}
-\end{sfragment}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-% LocalWords: article.cls topsect DCMI:dmt03 loadmodules lmhtools
-% LocalWords: prematurestop afterprematurestop import_graph.py STRlabel STRcopy vname
-% LocalWords: STRsemantics setSGvar ifSGvar ctext
diff --git a/macros/latex/contrib/stex/doc/packages/stex-features.tex b/macros/latex/contrib/stex/doc/packages/stex-features.tex
deleted file mode 100644
index 4e0cd21457..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-features.tex
+++ /dev/null
@@ -1,246 +0,0 @@
-\begin{sfragment}{The \texttt{mathstructure} Environment}
-\begin{smodule}[ns=https://github.com/slatex/sTeX/doc]{MathStructures}
- A common occurence in mathematics is bundling several
- interrelated ``declarations'' together into \emph{structures}.
- For example:
- \begin{itemize}
- \item A \emph{monoid} is a structure $\mathstruct{M,\circ,e}$
- with $\circ:M\times M\to M$ and $e\in M$ such that...
- \item A \emph{topological space} is a structure
- $\mathstruct{X,\mathcal T}$ where $X$ is a set and
- $\mathcal T$ is a topology on $X$
- \item A \emph{partial order} is a structure $\mathstruct{S,\leq}$
- where $\leq$ is a binary relation on $S$ such that...
- \end{itemize}
-
- This phenomenon is important and common enough to warrant special
- support, in particular because it requires being able
- to \emph{instantiate} such structures (or, rather,
- structure \emph{signatures}) in order to talk about (concrete
- or variable) \emph{particular} monoids, topological spaces,
- partial orders etc.
-
- \begin{environment}{mathstructure}
- The \stexcode"mathstructure" environment allows us to do
- exactly that. It behaves exactly like the
- \stexcode"smodule" environment, but is itself only allowed
- inside an \stexcode"smodule" environment, and allows
- for instantiation later on.
- \end{environment}
-
- How this works is again best demonstrated by example:
- \symdef{funtype}[args=ai]{#1 \comp\to #2}{##1 \comp\times ##2}
- \symdef{fun}[args=bi]{#1 \comp\mapsto #2}
- \symdef{set}{\comp{\texttt{Set}}}
-
- \stexexample{%
-\begin{mathstructure}{monoid}
- \symdef{universe}[type=\set]{\comp{U}}
- \symdef{op}[
- args=2,
- type=\funtype{\universe,\universe}{\universe},
- op=\circ
- ]{#1 \comp{\circ} #2}
- \symdef{unit}[type=\universe]{\comp{e}}
-\end{mathstructure}
-
-A \symname{monoid} is...
- }
- Note that the \stexcode"\symname{monoid}" is appropriately
- highlighted and (depending on your pdf viewer)
- shows a URI on hovering -- implying that the \stexcode"mathstructure"
- environment has generated a \emph{symbol} |monoid| for us.
- It has not generated a semantic macro though, since
- we can not use the |monoid|-symbol \emph{directly}. Instead,
- we can instantiate it, for example for integers:
-
- \stexexample{%
-\symdef{Int}[type=\set]{\comp{\mathbb Z}}
-\symdef{addition}[
- type=\funtype{\Int,\Int}{\Int},
- args=2,
- op=+
-]{##1 \comp{+} ##2}
-\symdef{zero}[type=\Int]{\comp{0}}
-
-$\mathstruct{\Int,\addition!,\zero}$ is a \symname{monoid}.
- }
-
- So far, we have not actually instantiated |monoid|, but now
- that we have all the symbols to do so, we can:
-
- \stexexample{%
-\instantiate{intmonoid}{monoid}{\mathbb{Z}_{+,0}}[
- universe = Int ,
- op = addition ,
- unit = zero
-]
-
-$\intmonoid{universe}$, $\intmonoid{unit}$ and $\intmonoid{op}{a}{b}$.
-
-Also: $\intmonoid!$
- }
- \begin{function}{\instantiate}
- So summarizing:
- \stexcode"\instantiate" takes four arguments: The
- (macro-)name of the instance, a key-value pair assigning
- declarations in the corresponding \stexcode"mathstructure"
- to symbols currently in scope, the name of the \stexcode"mathstructure"
- to instantiate, and lastly a notation for the instance itself.
-
- It then generates a semantic macro that takes as argument
- the name of a declaration in the instantiated \stexcode"mathstructure"
- and resolves it to the corresponding instance of that particular declaration.
- \end{function}
-
- \begin{mmtbox}
- \stexcode"\instantiate" and \stexcode"mathstructure" make use of the
- \emph{Theories-as-Types} paradigm (see \cite{MueRabKoh:tat18}):
-
- \stexcode"mathstructure{<name>}" simply creates a nested theory with name
- |<name>-structure|. The \emph{constant} |<name>| is defined as
- |Mod(<name>-structure)| -- a \emph{dependent record type with manifest fields},
- the fields of which are generated from (and correspond to) the constants in
- |<name>-structure|.
-
- \stexcode"\instantiate" generates a constant whose definiens is a record term of
- type |Mod(<name>-structure)|, with the fields assigned based on the respective
- key-value-list.
- \end{mmtbox}
-
- Notably, \stexcode"\instantiate" throws an error if not \emph{every}
- declaration in the instantiated \stexcode"mathstructure" is being assigned.
-
- You might consequently ask what the usefulness of \stexcode"mathstructure"
- even is.
-
- \begin{function}{\varinstantiate}
- The answer is that we can also instantiate a
- \stexcode"mathstructure" with a \emph{variable}.
- The syntax of \stexcode"\varianstantiate" is equivalent
- to that of \stexcode"\instantiate", but all of the key-value-pairs
- are optional, and if not explicitly assigned (to a symbol \emph{or}
- a variable declared with \stexcode"\vardef") inherit their notation
- from the one in the \stexcode"mathstructure" environment.
- \end{function}
-
- This allows us to do things like:
-
- \stexexample{%
-\varinstantiate{varM}{monoid}{M}
-
-A \symname{monoid} is a structure
-$\varM!:=\mathstruct{\varM{universe},\varM{op}!,\varM{unit}}$
-such that
-$\varM{op}!:\funtype{\varM{universe},\varM{universe}}{\varM{universe}}$ ...
-}
-
-and
-
-\stexexample{%
- \varinstantiate{varMb}{monoid}{M_2}[universe = Int]
-
- Let $\varMb!:=\mathstruct{\varMb{universe},\varMb{op}!,\varMb{unit}}$
-be a \symname{monoid} on $\Int$ ...
- }
-
-
-We will return to these two example later, when we also know how to handle the
-\emph{axioms} of a monoid.
-
-\begin{environment}{usestructure}
- The |usestructure{<struct>}| environment is used in multilingual settings as a parallel
- to the |mathstructure|. It opens a group and then issues a
- |\usemodule{.../<struct>-structure}| that gives the body access to all the semantic
- macros in the referenced structure.
-\end{environment}
-\end{smodule}
-\end{sfragment}
-
-\begin{sfragment}{The \texttt{copymodule} Environment}
-
- \textcolor{red}{TODO: explain}
-
-Given modules:
-
-\stexexample{%
-\begin{smodule}{magma}
- \symdef{universe}{\comp{\mathcal U}}
- \symdef{operation}[args=2,op=\circ]{#1 \comp\circ #2}
-\end{smodule}
-\begin{smodule}{monoid}
- \importmodule{magma}
- \symdef{unit}{\comp e}
-\end{smodule}
-\begin{smodule}{group}
- \importmodule{monoid}
- \symdef{inverse}[args=1]{{#1}^{\comp{-1}}}
-\end{smodule}
-}
-
-We can form a module for \emph{rings} by ``cloning''
-an instance of |group| (for addition) and |monoid| (for multiplication),
-respectively, and ``glueing them together'' to ensure they share the
-same universe:
-
-\stexexample{%
-\begin{smodule}{ring}
- \begin{copymodule}{group}{addition}
- \renamedecl[name=universe]{universe}{runiverse}
- \renamedecl[name=plus]{operation}{rplus}
- \renamedecl[name=zero]{unit}{rzero}
- \renamedecl[name=uminus]{inverse}{ruminus}
- \end{copymodule}
- \notation*{rplus}[plus,op=+,prec=60]{#1 \comp+ #2}
-%\setnotation{rplus}{plus}
- \notation*{rzero}[zero]{\comp0}
-%\setnotation{rzero}{zero}
- \notation*{ruminus}[uminus,op=-]{\comp- #1}
-%\setnotation{ruminus}{uminus}
- \begin{copymodule}{monoid}{multiplication}
- \assign{universe}{\runiverse}
- \renamedecl[name=times]{operation}{rtimes}
- \renamedecl[name=one]{unit}{rone}
- \end{copymodule}
- \notation*{rtimes}[cdot,op=\cdot,prec=50]{#1 \comp\cdot #2}
-%\setnotation{rtimes}{cdot}
- \notation*{rone}[one]{\comp1}
-%\setnotation{rone}{one}
- Test: $\rtimes a{\rplus c{\rtimes de}}$
-\end{smodule}
-}
-
-\textcolor{red}{TODO: explain donotclone}
-
-\end{sfragment}
-
-\begin{sfragment}{The \texttt{interpretmodule} Environment}
-
- \textcolor{red}{TODO: explain}
-
-\stexexample{%
-\begin{smodule}{int}
- \symdef{Integers}{\comp{\mathbb Z}}
- \symdef{plus}[args=2,op=+]{#1 \comp+ #2}
- \symdef{zero}{\comp0}
- \symdef{uminus}[args=1,op=-]{\comp-#1}
-
- \begin{interpretmodule}{group}{intisgroup}
- \assign{universe}{\Integers}
- \assign{operation}{\plus!}
- \assign{unit}{\zero}
- \assign{inverse}{\uminus!}
- \end{interpretmodule}
-\end{smodule}
-}
-
-\end{sfragment}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-% LocalWords: circ,e intmonoid MueRabKoh:tat18 varinstantiate 2,op runiverse rplus prec
-% LocalWords: rzero uminus ruminus plus,op uminus,op rtimes cdot,op cdot,prec 1,op
-% LocalWords: donotclone intisgroup
diff --git a/macros/latex/contrib/stex/doc/packages/stex-hwexam.tex b/macros/latex/contrib/stex/doc/packages/stex-hwexam.tex
index a3679d0d94..1d95d35f7b 100644
--- a/macros/latex/contrib/stex/doc/packages/stex-hwexam.tex
+++ b/macros/latex/contrib/stex/doc/packages/stex-hwexam.tex
@@ -54,24 +54,24 @@ duration of the test, \DescribeMacro{min}|min| specifies the equivalent in numbe
minutes, and \DescribeMacro{reqpts}|reqpts| the points that are required for a perfect
grade.
-\begin{latexcode}
+\begin{stexcode}
\title{320101 General Computer Science (Fall 2010)}
\begin{testheading}[duration=one hour,min=60,reqpts=27]
Good luck to all students!
\end{testheading}
-\end{latexcode}
+\end{stexcode}
Will result in
\begin{center}
\begin{minipage}{.9\textwidth}
\makeatletter
-\@problem{1.1}{4}{10}
-\@problem{2.1}{4}{8}
-\@problem{2.2}{6}{10}
-\@problem{2.3}{6}{10}
-\@problem{3.1}{4}{8}
-\@problem{3.2}{4}{8}
-\@problem{3.3}{2}{4}
+%^^A\@problem{1.1}{4}{10}
+%^^A\@problem{2.1}{4}{8}
+%^^A\@problem{2.2}{6}{10}
+%^^A\@problem{2.3}{6}{10}
+%^^A\@problem{3.1}{4}{8}
+%^^A\@problem{3.2}{4}{8}
+%^^A\@problem{3.3}{2}{4}
\makeatother
\title{320101 General Computer Science (Fall 2010)}
\begin{testheading}[duration=one hour,min=60,reqpts=27]
@@ -79,7 +79,7 @@ Will result in
\end{testheading}
\end{minipage}
\end{center}
-\ednote{MK: The first three ``problems'' come from the stex examples above, how do we get rid
+\footnote{MK: The first three ``problems'' come from the stex examples above, how do we get rid
of this?}
\end{sfragment}
diff --git a/macros/latex/contrib/stex/doc/packages/stex-idesetup.tex b/macros/latex/contrib/stex/doc/packages/stex-idesetup.tex
deleted file mode 100644
index b4d495b628..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-idesetup.tex
+++ /dev/null
@@ -1,61 +0,0 @@
-\begin{sfragment}{Setting up the \sTeX IDE}
-
- The \sTeX IDE consists of two components using the
- \emph{Language Server Protocol (LSP)}: A \emph{client}
- in the form of a VSCode extension, and a \emph{server}
- included in the \mmt system. Installing the extension will
- open up a setup routine that will guide you through the rest.
-
- \begin{sfragment}{The \sTeX VSCode Extension}
-
- If you have not already, you should first install the VSCode editor
- available at \url{https://code.visualstudio.com/}.
-
- Next, open VSCode and install the \sTeX extension by clicking on
- the \emph{extensions} menu on the very left of the VSCode window
- and searching for ``sTeX'' in the
- \emph{``Search Extensions in Marketplace''} field, as in
- \autoref{fig:install}, and clicking the \emph{Install}-button
- of the \sTeX extension by KWARC.
-
- \begin{figure}
- \begin{center}
- \includegraphics[width=0.6\textwidth]{img/vsc1.png}
- \end{center}
- \caption{Installing the \sTeX extension for VSCode}\label{fig:install}
- \end{figure}
-
- \end{sfragment}
-
- \begin{sfragment}{Setting up \mmt}
-
- Next, open any directory (\texttt{File $\to$ Open Folder...}) that contains
- a \verb|.tex|-file, and a setup window as in \autoref{fig:setup}
- will pop up. Clik on the highlighted link `\emph{here}' and download
- the latest version of the \texttt{MMT.jar} file (at least version 23.0.0)
- anywhere you like. Then click the \emph{``Browse...''}-button
- and select your freshly downloaded \texttt{MMT.jar}.
-
- If you have already set a system variable for your MathHub-directory,
- you are now done and can click \emph{``Finish''}. If you have not,
- you can now also enter a directory path in the lower text field,
- and the VSCode extension will attempt to globally set one up
- for you, depending on your operating system.
-
- \begin{figure}
- \begin{center}
- \includegraphics[width=\textwidth]{img/vsc2.png}
- \end{center}
- \caption{\sTeX Setup Routine}\label{fig:setup}
- \end{figure}
-
- Once you click \emph{``Finish''}, the client will connect
- to \url{https://stexmmt.mathhub.info/:sTeX}, query for
- available archives, download the core libraries required
- for all (or most) semantic services (\texttt{MMT/urtheories}
- and \texttt{sTeX/meta-inf}) and set up \RusTeX for you
- automatically.
-
- \end{sfragment}
-
- \end{sfragment} \ No newline at end of file
diff --git a/macros/latex/contrib/stex/doc/packages/stex-inheritance.tex b/macros/latex/contrib/stex/doc/packages/stex-inheritance.tex
deleted file mode 100644
index be7c4e68ec..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-inheritance.tex
+++ /dev/null
@@ -1,131 +0,0 @@
-\begin{sfragment}{Simple Inheritance and Namespaces}
-
- \begin{function}{\importmodule,\usemodule}
- \stexcode"\importmodule[Some/Archive]{path?ModuleName}" is only allowed within an
- \stexcode"smodule"-environment and makes the symbols declared in |ModuleName|
- available therein. Additionally the symbols of |ModuleName| will be exported if the
- current module is imported somewhere else via \stexcode"\importmodule".
-
- \stexcode"\usemodule" behaves the same way, but without exporting the content of the
- used module.
- \end{function}
-
- It is worth going into some detail how exactly \stexcode"\importmodule"
- and \stexcode"\usemodule" resolve their arguments to find
- the desired module -- which is closely related to the
- \emph{namespace} generated for a module, that is used to generate
- its URI.
-
- \begin{dangerbox}
- Ideally, \sTeX would use arbitrary URIs for modules, with no
- forced relationships between the \emph{logical} namespace
- of a module and the \emph{physical} location of the file
- declaring the module -- like \mmt does things.
-
- Unfortunately, \TeX\ only provides very restricted access to
- the file system, so we are forced to generate namespaces
- systematically in such a way that they reflect the physical
- location of the associated files, so that \sTeX can resolve
- them accordingly. Largely, users need not concern themselves
- with namespaces at all, but for completenesses sake, we describe
- how they are constructed:
-
- \begin{itemize}
- \item If \stexcode"\begin{smodule}{Foo}"
- \iffalse\end{smodule}\fi occurs in a file
- |/path/to/file/Foo[.|\meta{lang}|].tex| which does not belong
- to an archive, the namespace is |file://path/to/file|.
- \item If the same statement occurs in a file
- |/path/to/file/bar[.|\meta{lang}|].tex|, the namespace is
- |file://path/to/file/bar|.
- \end{itemize}
-
- In other words: outside of archives, the namespace corresponds to
- the file URI with the filename dropped iff it is equal to the
- module name, and ignoring the (optional) language suffix.
-
- If the current file is in an archive, the procedure is the same
- except that the initial segment of the file path up to the archive's
- |source|-folder is replaced by the archive's namespace URI.
-\end{dangerbox}
-
-\begin{dangerbox}
- Conversely, here is how namespaces/URIs and file paths are computed
- in import statements, examplary \stexcode"\importmodule":
-
- \begin{itemize}
- \item \stexcode"\importmodule{Foo}" outside of an archive refers
- to module |Foo| in the current namespace. Consequently, |Foo|
- must have been declared earlier in the same document or, if not,
- in a file |Foo[.|\meta{lang}|].tex| in the same directory.
- \item The same statement \emph{within} an archive refers to either
- the module |Foo| declared earlier in the same document, or
- otherwise to the module |Foo| in the archive's top-level namespace.
- In the latter case, is has to be declared in a file |Foo[.|\meta{lang}|].tex|
- directly in the archive's |source|-folder.
- \item Similarly, in \stexcode"\importmodule{some/path?Foo}" the path
- |some/path| refers to either the sub-directory and relative
- namespace path of the current directory and namespace outside of an archive,
- or relative to the current archive's top-level namespace and |source|-folder,
- respectively.
-
- The module |Foo| must either be declared in the file
- \meta{top-directory}|/some/path/Foo[.|\meta{lang}|].tex|, or in
- \meta{top-directory}|/some/path[.|\meta{lang}|].tex| (which are
- checked in that order).
- \item Similarly, \stexcode"\importmodule[Some/Archive]{some/path?Foo}"
- is resolved like the previous cases, but relative to the archive
- |Some/Archive| in the mathhub-directory.
- \item Finally, \stexcode"\importmodule{full://uri?Foo}" naturally refers to the
- module |Foo| in the namespace |full://uri|. Since the file this module
- is declared in can not be determined directly from the URI, the module
- must be in memory already, e.g. by being referenced earlier in the
- same document.
-
- Since this is less compatible with a modular development, using full
- URIs directly is strongly discouraged, unless the module is delared in
- the current file directly.
- \end{itemize}
-
- \end{dangerbox}
-
- \begin{function}{\STEXexport}
- \stexcode"\importmodule" and \stexcode"\usemodule" import all symbols, notations,
- semantic macros and (recursively) \stexcode"\importmodule"s. If you want to
- additionally export e.g. convenience macros and other (\sTeX) code from a module, you
- can use the command \stexcode"\STEXexport{<code>}" in your module. Then |<code>| is
- executed (both immediately and) every time the current module is opened via
- \stexcode"\importmodule" or \stexcode"\usemodule".
- \end{function}
-
- \begin{dangerbox}
- For persistency reasons, everything in an \stexcode"\STEXexport"
- is digested by \TeX in the \LaTeX3-category code scheme.
- This means that the characters \stexcode"_" and \stexcode":"
- are considered \emph{letters} and valid parts of
- control sequence names, and space characters are ignored entirely.
- For spaces, use the character \stexcode"~" instead, and
- keep in mind, that if you want to use subscripts, you
- should use \stexcode"\c_math_subscript_token" instead
- of \stexcode"_"!
-
-
- Also note, that \stexcode"\newcommand" defines macros \emph{globally}
- and throws an error if the macro already exists,
- potentially leading to low-level \LaTeX\xspace errors if
- we put a \stexcode"\newcommand" in an \stexcode"\STEXexport"
- and the |<code>| is executed more than once in a document
- -- which can happen easily.
-
- A safer alternative is to use macro definition principles,
- that are safe to use even if the macro being defined already
- exists, and ideally are local to the current \TeX\xspace group,
- such as \stexcode"\def" or \stexcode"\let".
- \end{dangerbox}
-
-\end{sfragment}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
diff --git a/macros/latex/contrib/stex/doc/packages/stex-mathhub.tex b/macros/latex/contrib/stex/doc/packages/stex-mathhub.tex
deleted file mode 100644
index eb09414ac7..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-mathhub.tex
+++ /dev/null
@@ -1,203 +0,0 @@
-\begin{sfragment}[id=sec:localmh]{The Local MathHub-Directory}
- \stexcode"\usemodule", \stexcode"\importmodule",
- \stexcode"\inputref" etc. allow for
- including content modularly without having to specify absolute
- paths, which would differ between users and machines. Instead,
- \sTeX uses \emph{archives} that determine the global
- namespaces for symbols and statements and make it possible
- for \sTeX to find content referenced via such URIs.
-
- All \sTeX archives need to exist in the local |MathHub|-directory.
- \sTeX knows where this folder is via one of four means:
-
- \begin{enumerate}
- \item If the \sTeX package is loaded with the option |mathhub=/path/to/mathhub|, then
- \sTeX will consider |/path/to/mathhub| as the local |MathHub|-directory.
- \item If the |mathhub| package option is \emph{not} set, but the macro |\mathhub|
- exists when the \sTeX-package is loaded, then this macro is assumed to point to the
- local |MathHub|-directory; i.e.
- \stexcode"\def\mathhub{/path/to/mathhub}\usepackage{stex}" will set the
- |MathHub|-directory as |path/to/mathhub|.
- \item Otherwise, \sTeX will attempt to retrieve the system variable |MATHHUB|,
- assuming it will point to the local |MathHub|-directory. Since this variant needs
- setting up only \emph{once} and is machine-specific (rather than defined in tex
- code), it is compatible with collaborating and sharing tex content, and hence
- recommended.
- \item Finally, if all else fails, \sTeX will look for a file
- |~/.stex/mathhub.path|. If this file exists, \sTeX will assume that it contains the
- path to the local |MathHub|-directory. This method is recommended on systems where
- it is difficult to set environment variables.
- \end{enumerate}
-\end{sfragment}
-
-\begin{sfragment}{The Structure of \sTeX Archives}
- An \sTeX archive |group/name| is stored in the
- directory |/path/to/mathhub/group/name|; e.g. assuming your
- local |MathHub|-directory is set as |/user/foo/MathHub|, then
- in order for the |smglom/calculus|-archive to be found by the
- \sTeX system, it needs to be in |/user/foo/MathHub/smglom/calculus|.
-
- Each such archive needs two subdirectories:
- \begin{itemize}
- \item |/source| -- this is where all your tex files go.
- \item |/META-INF| -- a directory containing a single file
- |MANIFEST.MF|, the content of which we will consider shortly
- \end{itemize}
- An additional |lib|-directory is optional, and is where \sTeX will
- look for files included via \stexcode"\libinput".
-
- Additionally a \emph{group} of archives |group/name| may have
- an additional archive |group/meta-inf|. If this |meta-inf|-archive
- has a |/lib|-subdirectory, it too will be searched by \stexcode"\libinput"
- from all tex files in any archive in the |group/*|-group.
-
- \paragraph{} We recommend the following additional directory structure in the
- |source|-folder of an \sTeX archive:
- \begin{itemize}
- \item |/source/mod/| -- individual \sTeX modules, containing
- symbol declarations, notations, and
- \stexcode"\begin{sparagraph}[type=symdoc,for=...]"
- environments for ``encyclopaedic'' symbol documentations
- \iffalse\end{sparagraph}\fi
- \item |/source/def/| -- definitions
- \item |/source/ex/| -- examples
- \item |/source/thm/| -- theorems, lemmata and proofs; preferably
- proofs in separate files to allow for multiple proofs for the
- same statement
- \item |/source/snip/| -- individual text snippets such as remarks,
- explanations etc.
- \item |/source/frag/| -- individual document fragments,
- ideally only \stexcode"\inputref"ing snippets, definitions,
- examples etc. in some desirable order
- \item |/source/tikz/| -- tikz images, as individual |.tex|-files
- \item |/source/PIC/| -- image files.
- \end{itemize}
-
-\end{sfragment}
-
-\begin{sfragment}{MANIFEST.MF-Files}
- The |MANIFEST.MF| in the |META-INF|-directory consists of key-value-pairs, informing
- \sTeX (and associated software) of various properties of an archive. For example, the
- |MANIFEST.MF| of the |smglom/calculus|-archive looks like this:
-
- \begin{framed}
- \begin{verbatim}
- id: smglom/calculus
- source-base: http://mathhub.info/smglom/calculus
- narration-base: http://mathhub.info/smglom/calculus
- dependencies: smglom/arithmetics,smglom/sets,smglom/topology,
- smglom/mv,smglom/linear-algebra,smglom/algebra
- responsible: Michael.Kohlhase@FAU.de
- title: Elementary Calculus
- teaser: Terminology for the mathematical study of change.
- description: desc.html
- \end{verbatim}
- \end{framed}
-
- Many of these are in fact ignored by \sTeX, but some are important:
- \begin{itemize}
- \item[|id|:] The name of the archive, including its group (e.g. |smglom/calculus|),
- \item[|source-base|] or
- \item[|ns|:] The namespace from which all symbol and module URIs
- in this repository are formed, see (\textcolor{red}{TODO}),
- \item[|narration-base:|] The namespace from which all document
- URIs in this repository are formed, see (\textcolor{red}{TODO}),
- \item[|url-base|:] The URL that is formed as a basis for \emph{external references},
- see (\textcolor{red}{TODO}),
- \item[|dependencies|:] All archives that this archive depends on. \sTeX ignores
- this field, but \mmt can pick up on them to resolve dependencies,
- e.g. for |lmh install|.
- \end{itemize}
-
-\end{sfragment}
-
-\begin{sfragment}{Using Files in \sTeX Archives Directly}
- Several macros provided by \sTeX allow for directly including
- files in repositories. These are:
- \begin{function}{\mhinput}
- \stexcode"\mhinput[Some/Archive]{some/file}" directly
- inputs the file |some/file| in the |source|-folder of
- |Some/Archive|.
- \end{function}
- \begin{function}{\inputref}
- \stexcode"\inputref[Some/Archive]{some/file}" behaves like \stexcode"\mhinput", but
- wraps the input in a |\begingroup ... \endgroup|. When converting to |xhtml|, the
- file is not input at all, and instead an |html|-annotation is inserted that
- references the file, e.g. for lazy loading.
-
- In the majority of practical cases \stexcode"\inputref" is likely to be preferred
- over \stexcode"\mhinput" because it leads to less duplication in the generated
- |xhtml|.
- \end{function}
- \begin{function}{\ifinput}
- Both \stexcode"\mhinput" and \stexcode"\inputref"
- set \stexcode"\ifinput" to ``true'' during input. This allows
- for selectively including e.g. bibliographies only if the
- current file is not being currently included in a larger document.
- \end{function}
- \begin{function}{\addmhbibresource}
- \stexcode"\addmhbibresource[Some/Archive]{some/file}" searches for a file like
- \stexcode"\mhinput" does, but calls |\addbibresource| to the result and looks for
- the file in the archive root directory directly, rather than the |source|
- directory. Typical invocations are
- \begin{itemize}
- \item |\addmhbibresource{lib/refs.bib}|, which specifies a bibliography in the |lib|
- folder in the local archive or
- \item |\addmhbibresource[HW/meta-inf]{lib/refs.bib}| in another.
- \end{itemize}
- \end{function}
- \begin{function}{\libinput}
- \stexcode"\libinput{some/file}"
- searches for a file |some/file| in
- \begin{itemize}
- \item the |lib|-directory of the current archive, and
- \item the |lib|-directory of a |meta-inf|-archive in
- (any of) the archive groups containing the current archive
- \end{itemize}
- and include all found files in reverse order;
- e.g. \stexcode"\libinput{preamble}" in a |.tex|-file in
- |smglom/calculus| will \emph{first} input |.../smglom/meta-inf/lib/preamble.tex|
- and then |../smglom/calculus/lib/preamble.tex|.
-
- \stexcode|\libinput| will throw an error if \emph{no} candidate for |some/file|
- is found.
- \end{function}
- \begin{function}{\libusepackage}
- \stexcode"\libusepackage[package-options]{some/file}" searches for a file
- |some/file.sty| in the same way that \stexcode"\libinput" does, but will
- call\\
- |\usepackage[package-options]{path/to/some/file}| instead of |\input|.
-
- \stexcode|\libusepackage| throws an error if not \emph{exactly one} candidate for
- |some/file| is found.
- \end{function}
-
- \begin{remark}
- A good practice is to have individual \sTeX fragments
- follow basically this document frame:
- \begin{latexcode}[gobble=12]
- \documentclass{stex}
- \libinput{preamble}
- \begin{document}
- ...
- \ifinputref \else \libinput{postamble} \fi
- \end{document}
- \end{latexcode}
- Then the |preamble.tex| files can take care of loading the generally required
- packages, setting presentation customizations etc. (per archive or archive group
- or both), and |postamble.tex| can e.g. print the bibliography, index etc.
-
- \stexcode|\libusepackage| is particularly useful in |preamble.tex| when we want to
- use custom packages that are not part of {\TeX}Live. In this case we commit the
- respective packages in one of the |lib| folders and use \stexcode|\libusepackage|
- to load them.
- \end{remark}
-\end{sfragment}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-%%% LocalWords: mathhub symdoc,for lmh subdirs arithmetics,smglom sets,smglom mv,smglom
-%%% LocalWords: linear-algebra,smglom
diff --git a/macros/latex/contrib/stex/doc/packages/stex-mathhubsetup.tex b/macros/latex/contrib/stex/doc/packages/stex-mathhubsetup.tex
deleted file mode 100644
index 7a653186b3..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-mathhubsetup.tex
+++ /dev/null
@@ -1,25 +0,0 @@
- \begin{sfragment}{Setting your MathHub Directory}
- One of \sTeX's features is a proper \emph{module system}
- of interconnected document snippets for mathematical
- content. Analogously to \emph{object-oriented programming},
- it allows for ``object-oriented mathematics'' via individual
- combinable and, importantly, \emph{reusable} modules, developed
- collaboratively.
-
- To make use of such modules, the \sTeX system needs to be told
- where to find them. There are several ways to do so (see
- \sref[file=stex-mathhub]{sec:localmh}[in=../stex-manual,
- title={\href{\basedocurl/stex-manual.pdf}{the \sTeX{}3 Manual}}]),
- but the most convenient way to do so is via a system variable.
-
- To do so, create a directory \texttt{MathHub} somewhere on
- your local file system and set the environment
- variable \texttt{MATHHUB} to the file path to that directory.
-
- In linux, you can do so by writing
- \begin{lstlisting}[language=bash]
- export MATHHUB="/path/to/your/MathHub"
- \end{lstlisting}
- in your \verb|~/.profile| (for all shells) or \verb|~/.bashrc|
- (for the bash terminal only) file.
- \end{sfragment} \ No newline at end of file
diff --git a/macros/latex/contrib/stex/doc/packages/stex-metatheory.tex b/macros/latex/contrib/stex/doc/packages/stex-metatheory.tex
deleted file mode 100644
index 4feb646eb9..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-metatheory.tex
+++ /dev/null
@@ -1,30 +0,0 @@
-The \pkg{stex-metatheory} package contains \sTeX symbols so ubiquitous, that it is
-virtually impossible to describe any flexiformal content without them, or that are
-required to annotate even the most primitive symbols with meaningful
-(foundation-independent) ``type''-annotations, or required for basic structuring
-principles (theorems, definitions). As such, it serves as the default meta theory for any
-\sTeX module.
-
-We can also see the \pkg{stex-metatheory} as a foundation of mathematics in the sense of
-\cite{rabe:future:15}, albeit an informal one (the ones discussed there are all formal
-foundations). The state of the \pkg{stex-metatheory} is necessarily incomplete, and will
-stay so for a long while: It arises as a collection of empirically useful symbols that are
-collected as more and more mathematics are encoded in \sTeX and are classified as
-foundational.
-
-Formal foundations should ideally instantiate these symbols with their formal counterparts,
-e.g. |isa| corresponds to a typing operation in typed setting, or the $\in$-operator in
-set-theoretic contexts; |bind| corresponds to a universal quantifier in ($n$th-order)
-logic, or a $\Pi$ in dependent type theories.
-
-We make this theory part of the \sTeX collection due to the obiquity
-of the symbols involved. Note however, that the metatheory is
-for all practical purposes a ``normal'' \sTeX module, and the
-symbols contained ``normal'' \sTeX symbols.
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-% LocalWords: stex-metatheory th-order
diff --git a/macros/latex/contrib/stex/doc/packages/stex-modules.tex b/macros/latex/contrib/stex/doc/packages/stex-modules.tex
deleted file mode 100644
index 424c2200e8..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-modules.tex
+++ /dev/null
@@ -1,73 +0,0 @@
-\begin{sfragment}{The \texttt{smodule}-Environment}
- \begin{environment}{smodule}
- A new module is declared using the basic syntax
- \begin{center}
- \stexcode"\begin{smodule}[options]{ModuleName}...\end{smodule}".
- \end{center}
- A module is required to declare any new formal content such as symbols or
- notations (but not variables, which may be introduced anywhere).
-
- The |smodule|-environment takes several keyword arguments, all of which are
- optional:
-
- \begin{itemize}
- \item[|title|] (\meta{token list}) to display in customizations.
- \item[|type|] (\meta{string}$\ast$) for use in customizations.
- \item[|deprecate|] (\meta{module}) if set, will throw a warning
- when loaded, urging to use \meta{module} instead.
- \item[|id|] (\meta{string}) for cross-referencing.
- \item[|ns|] (\meta{URI}) the namespace to use. \emph{Should not be used,
- unless you know precisely what you're doing}. If not explicitly set, is
- computed using \cs{stex_modules_current_namespace:}.
- \item[|lang|] (\meta{language}) if not set, computed from the current file name (e.g. |foo.en.tex|).
- \item[|sig|] (\meta{language}) if the current file is a translation of a file with the same base name
- but a different language suffix, setting |sig=<lang>| will preload the module
- from that language file. This helps ensuring that the (formal) content of both modules
- is (almost) identical across languages and avoids duplication.
- \item[|creators|] (\meta{string}$\ast$) names of the creators.
- \item[|contributors|] (\meta{string}$\ast$) names of contributors.
- \item[|srccite|] (\meta{string}) a source citation for the content of this module.
- \end{itemize}
- \end{environment}
-
- \begin{mmtbox}
- An \sTeX module corresponds to an \mmt/\omdoc \emph{theory}.
- As such it gets assigned a module URI (\emph{universal resource identifier})
- of the form |<namespace>?<module-name>|.
- \end{mmtbox}
-
- By default, opening a module will produce no output whatsoever,
- e.g.:
- \stexexample{%
-\begin{smodule}[title={This is Some Module}]{SomeModule}
- Hello World
-\end{smodule}
- }
-
- \begin{function}{\stexpatchmodule}
- We can customize this behavior either for all modules or
- only for modules with a specific |type| using the command
- \stexcode"\stexpatchmodule[optional-type]{begin-code}{end-code}".
- Some optional parameters are then available in |\smodule*|-macros,
- specifically |\smoduletitle|, |\smoduletype| and |\smoduleid|.
- \end{function}
- For example:
-
- \stexexample{%
-\stexpatchmodule[display]
- {\textbf{Module (\smoduletitle)}\par}
- {\par\noindent\textbf{End of Module (\smoduletitle)}}
-
-\begin{smodule}[type=display,title={Some New Module}]{SomeModule2}
- Hello World
-\end{smodule}
- }
-\end{sfragment}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-% LocalWords: srccite mmtbox stexexample stexpatchmodule smoduletitle smoduleid
-% LocalWords: display,title
diff --git a/macros/latex/contrib/stex/doc/packages/stex-notesslides.tex b/macros/latex/contrib/stex/doc/packages/stex-notesslides.tex
index 75fd9ee9e8..f7738938a1 100644
--- a/macros/latex/contrib/stex/doc/packages/stex-notesslides.tex
+++ b/macros/latex/contrib/stex/doc/packages/stex-notesslides.tex
@@ -4,7 +4,7 @@ it adds a ``notes version'' for course notes that is more suited to printing tha
supplied by |beamer.cls|.
The \pkg{notesslides} class takes the notion of a slide frame from Till Tantau's excellent
-\pkg{beamer} class and adapts its notion of frames for use in the \sTeX and \omdoc. To
+\pkg{beamer} class and adapts its notion of frames for use in the \sTeX and \OMDoc. To
support semantic course notes, it extends the notion of mixing frames and explanatory
text, but rather than treating the frames as images (or integrating their contents into
the flowing text), the \pkg{notesslides} package displays the slides as such in the course
@@ -56,7 +56,7 @@ study. To achieve this, the \pkg{notesslides} class has two modes: \emph{slides
By interleaving the |frame| and |note| environments, we can build course notes as shown
here:
-\begin{latexcode}
+\begin{stexcode}
\ifnotes\maketitle\else
\frame[noframenumbering]\maketitle\fi
@@ -77,7 +77,7 @@ here:
...
\end{frame}
...
-\end{latexcode}
+\end{stexcode}
\begin{function}{\ifnotes}
Note the use of the |\ifnotes| conditional, which allows different treatment between
@@ -119,7 +119,7 @@ here:
The result in |notes| mode (which is like the |slides| version except that the slide
hight is variable) is
- \includegraphics[width=.95\textwidth]{\libfolder{img/notes-frame}}
+ \includegraphics[width=.95\textwidth]{\stexdocpath/../lib/img/notes-frame}
The footer line can be customized. In particular the logos.
@@ -156,13 +156,13 @@ have a PowerPoint presentation, to which we want to add \sTeX notes.
The |\mhframeimage| macro is a variant of |\frameimage| with repository support. Instead
of writing
-\begin{latexcode}
+\begin{stexcode}
\frameimage{\MathHub{fooMH/bar/source/baz/foobar}}
-\end{latexcode}
+\end{stexcode}
we can simply write (assuming that |\MathHub| is defined as above)
-\begin{latexcode}
+\begin{stexcode}
\mhframeimage[fooMH/bar]{baz/foobar}
-\end{latexcode}
+\end{stexcode}
Note that the |\mhframeimage| form is more semantic, which allows more advanced document
management features in \textsf{MathHub}.
\end{function}
@@ -170,26 +170,69 @@ management features in \textsf{MathHub}.
If |baz/foobar| is the ``current module'', i.e. if we are on the \textsf{MathHub} path
\ldots|MathHub/fooMH/bar|\ldots, then stating the repository in the first optional
argument is redundant, so we can just use
-\begin{latexcode}
+\begin{stexcode}
\mhframeimage{baz/foobar}
-\end{latexcode}
+\end{stexcode}
\end{sfragment}
\begin{function}{\textwarning}
The |\textwarning| macro generates a warning sign: \textwarning
\end{function}
+
+\begin{sfragment}{Ending Documents Prematurely}
+ \begin{function}{\prematurestop,\afterprematurestop}
+ For prematurely stopping the formatting of a document, \sTeX provides the
+ |\prematurestop| macro. It can be used everywhere in a document and ignores all input
+ after that -- backing out of the |sfragment| environments as needed. After that -- and
+ before the implicit |\end{document}| it calls the internal |\afterprematurestop|, which
+ can be customized to do additional cleanup or e.g. print the bibliography.
+
+ |\prematurestop| is useful when one has a driver file, e.g. for a course taught multiple
+ years and wants to generate course notes up to the current point in the lecture. Instead
+ of commenting out the remaining parts, one can just move the |\prematurestop| macro.
+ This is especially useful, if we need the rest of the file for processing, e.g. to
+ generate a theory graph of the whole course with the already-covered parts marked up as
+ an overview over the progress; see |import_graph.py| from the |lmhtools|
+ utilities~\cite{lmhtools:github:on}.
+ \end{function}
+
+ Text fragments and modules can be made more re-usable by the use of global variables. For
+ instance, the admin section of a course can be made course-independent (and therefore
+ re-usable) by using variables (actually token registers) |courseAcronym| and |courseTitle|
+ instead of the text itself. The variables can then be set in the \sTeX preamble of the
+ course notes file.
+\end{sfragment}
+
+
+\begin{sfragment}{Global Document Variables}
+ To make document fragments more reusable, we sometimes want to make the content depend
+ on the context. We use \defemph{document variables} for that.
+
+\begin{function}{\setSGvar,\useSGvar}
+ |\setSGvar{|\meta{vname}|}{|\meta{text}|}| to set the global variable \meta{vname} to
+ \meta{text} and |\useSGvar{|\meta{vname}|}| to reference it.
+\end{function}
+
+\begin{function}{\ifSGvar}
+ With|\ifSGvar| we can test for the contents of a global variable: the macro call
+ |\ifSGvar{|\meta{vname}|}{|\meta{val}|}{|\meta{ctext}|}| tests the content of the global
+ variable \meta{vname}, only if (after expansion) it is equal to \meta{val}, the
+ conditional text \meta{ctext} is formatted.
+\end{function}
+\end{sfragment}
+
\begin{sfragment}[id=sec:user:excursions]{Excursions}
In course notes, we sometimes want to point to an ``excursion'' -- material that is either
presupposed or tangential to the course at the moment -- e.g. in an appendix. The typical
setup is the following:
-\begin{latexcode}
+\begin{stexcode}
\excursion{founif}{../fragments/founif.en}
{We will cover first-order unification in}
...
\begin{appendix}\printexcursions\end{appendix}
-\end{latexcode}
+\end{stexcode}
It generates a paragraph that references the excursion whose source is in the file
|../fragments/founif.en.tex| and automatically books the file for the |\printexcursions|
@@ -198,12 +241,12 @@ command that is used here to put it into the appendix. We will look at the mecha
\begin{function}{\excursion}
The |\excursion{|\meta{ref}|}{|\meta{path}|}{|\meta{text}|}| is syntactic sugar for
-\begin{latexcode}
+\begin{stexcode}
\begin{nparagraph}[title=Excursion]
\activateexcursion{founif}{../ex/founif}
We will cover first-order unification in \sref{founif}.
\end{nparagraph}
-\end{latexcode}
+\end{stexcode}
\end{function}
\begin{function}{\activateexcursion,\printexcursion,\excursionref}
@@ -219,14 +262,14 @@ command that is used here to put it into the appendix. We will look at the mecha
Finally, we usually want to put the excursions into an |sfragment| environment and add
an introduction, therefore we provide the a variant of the |\printexcursions| macro:
|\excursiongroup[id=|\meta{id}|,intro=|\meta{path}|]| is equivalent to
-\begin{latexcode}
+\begin{stexcode}
\begin{note}
\begin{sfragment}[id=<id>]{Excursions}
\inputref{<path>}
\printexcursions
\end{sfragment}
\end{note}
-\end{latexcode}
+\end{stexcode}
\end{function}
\end{sfragment}
diff --git a/macros/latex/contrib/stex/doc/packages/stex-problem.tex b/macros/latex/contrib/stex/doc/packages/stex-problem.tex
index 53316b28bc..81315415a4 100644
--- a/macros/latex/contrib/stex/doc/packages/stex-problem.tex
+++ b/macros/latex/contrib/stex/doc/packages/stex-problem.tex
@@ -154,12 +154,11 @@ The next simplest situation, where we can implement auto-grading is the case whe
have fill-in-the-blanks
\begin{function}{\fillinsol}
- The |\fillinsol| macro takes\Ednote{for now; more to come} an a single argument, which
- contains a concrete solution (i.e. a number, a string, \ldots), which generates a
- fill-in-box in test mode:
-\stexexample{%
- \stopsolutions
- \begin{sproblem}[id=elefants.fillin,title=Fitting Elefants]
+ The |\fillinsol| macro takes a single argument, which contains a concrete solution
+ (i.e. a number, a string, \ldots), which generates a fill-in-box in test mode:
+ \stexexample{%
+ \stopsolutions
+ \begin{sproblem}[id=elefants.fillin,title=Fitting Elefants]
How many Elefants can you fit into a Volkswagen beetle? \fillinsol{4}
\end{sproblem}}
and the actual solution in solutions mode:
@@ -174,7 +173,7 @@ also give |\fillinsol| an optional argument with a size: |\fillinsol[3cm]{12}| m
Obviously, the required argument of |\fillinsol| can be used for auto-grading. For
concrete data like numbers, this is immediate, for more complex data like strings ``soft
- comparisons'' might be in order. \ednote{For the moment we only assume a single concrete
+ comparisons'' might be in order. \footnote{For the moment we only assume a single concrete
value as correct. In the future we will almost certainly want to extend the
functionality to multiple answer classes that allow different feedback like im
MCQ. This still needs a bit of design. Also we want to make the formatting of the
diff --git a/macros/latex/contrib/stex/doc/packages/stex-proofs.tex b/macros/latex/contrib/stex/doc/packages/stex-proofs.tex
deleted file mode 100644
index 9e6e44f5ca..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-proofs.tex
+++ /dev/null
@@ -1,387 +0,0 @@
-\begin{sfragment}{Proofs}
-
-The \pkg{stex-proof} package supplies macros and environment that allow to annotate the
-structure of mathematical proofs in \sTeX document. This structure can be used by MKM
-systems for added-value services, either directly from the \sTeX sources, or after
-translation.
-
-Its central component is the |sproof|-environment, whose body consists
-of:
-\begin{itemize}
- \item \emph{subproofs} via the |subproof|-environment,
- \item \emph{proof steps} via the |\spfstep|, |\eqstep|
- |\assumption|, and |\conclude| macros, and
- \item \emph{comments}, via normal text without special markup.
-\end{itemize}
-
-|sproof|, |subproof| and the various proof step macros take the following
-optional arguments:
-\begin{itemize}
- \item[|id|] (\meta{string}) for referencing,
- \item[|method|] (\meta{string}) the proof method (e.g. contradiction, induction,...)
- \item[|term|] (\meta{token list}) the (ideally semantically-marked up)
- proposition that is derived/proven by this proof/subproof/proof step.
-\end{itemize}
-Additionally, they take one mandatory argument for the document text
-to be annotated, or (in the case of the environments)
-as an introductory description of the proof itself. Since
-the latter often contains the |term| to be derived
-as text, alternatively to providing it as
-an optional argument, the mandatory argument can use the
-|\yield|-macro to mark it up in the text.
-
-The |sproof| and |subproof| environments additionally take
-two optional arguments:
-\begin{itemize}
- \item[|for|] the symbol identifier/name corresponding to the |sassertion|
- to be proven. This too subsumes |\yield| and the |term|-argument.
- \item[|hide|] In the pdf, this only shows the mandatory argument text
- and hides the body of the environment. In the HTML (as served by \mmt),
- the bodies of all |proof| and |subproof| environments are \emph{collapsible},
- and |hide| collapses the body by default.
-\end{itemize}
-
-\begin{smodule}{sproofs}
- \symdef{coprime}[args=2]{#1 \comp\bot #2}
- \symdef{realroot}[args=1]{\sqrt{#1}}
- \symdecl{irrational}[args=1]
- \symdecl{rational}[args=1]
- \symdef{eq}[args=2]{#1 \comp= #2}
- \symdef{ratfrac}[args=2,prec=1]{\frac{#1}{#2}}
- \symdef{intpow}[args=2,prec=-1]{{#1}^{#2}}
- \symdef{ratpow}[args=2]{{#1}^{#2}}
- \symdef{inset}[args=ai]{#1\comp\in#2}{##1\comp,##2}
- \symdef{Int}{\comp{\mathbb Z}}
- \symdef{PosInt}{\comp{{\mathbb Z}^+}}
- \symdef{inttimes}[args=2]{#1 #2}
- \symdef{divides}[args=2]{#1\comp\|#2}
-
- \vardef{vara}{\comp a}
- \vardef{varb}{\comp b}
- \vardef{varc}{\comp c}
-
- \def\contradiction{}
-
-\begin{latexcode}
- \begin{sassertion}[type=theorem,name=sqrt2irr]
- \conclusion{\irrational{$\arg{\realroot{2}}$ is \comp{irrational}}}.
-\end{sassertion}
-
-\begin{sproof}[for=sqrt2irr,method=contradiction]{By contradiction}
- \assumption{Assume \yield{\rational{$\arg{\realroot{2}}$ is
- \comp{rational}}}}
- \begin{subproof}[method=straightforward]{Then
- \yield{$\eq{\ratfrac{\intpow{\vara}{2}}{\intpow{\varb}2}}{2}$
- for some $\inset{\vara,\varb}\PosInt$ with
- \coprime{$\arg{\vara},\arg{\varb}$ \comp{coprime}}}}
- \assumption{By assumption, \yield{there are
- $\inset{\vara,\varb}\PosInt $ with
- $\realroot{2}=\ratfrac{\vara}{\varb}$}}
- \spfstep{wlog, we can assume \coprime{$\arg{\vara},\arg{\varb}$
- to be \comp{coprime}}}
- % a comment:
- If not, reduce the fraction until numerator and denominator
- are coprime, and let the resulting components be
- $\vara $ and $\varb $
- \spfstep{Then \yield{$\eq{\intpow{\ratfrac{\vara}{\varb}}2}2$}}
- \eqstep{\ratfrac{\intpow{\vara}2}{\intpow{\varb}2}}
- \end{subproof}
- \begin{subproof}[term=\divides{2}{\vara},method=straightforward]{
- Then $\vara $ is even}
- \spfstep{Multiplying the equation by $\intpow{\varb}2$ yields
- $\yield{\eq{\intpow{\vara}2}{\inttimes{2}{\intpow{\varb}2}}}$}
- \spfstep[term=\divides{2}{\intpow{\vara}2}]{Hence
- $\intpow{\vara}2$ is even}
- \conclude[term=\divides{2}{\vara}]{Hence $\vara $ is even as well}
- % another comment:
- Hint: Think about the prime factorizations of $\vara $ and
- $\intpow{\vara}2$
- \end{subproof}
- \begin{subproof}[term=\divides{2}{\varb},method=straightforward,]{
- Then $\varb $ is also even}
- \spfstep{Since $\vara $ is even, we have \yield{some $\varc $
- such that $\eq{\inttimes{2}{\varc}}{\vara}$}}
- \spfstep{Plugging into the above, we get
- \yield{$\eq{\intpow{\inttimes{2}{\vara}}2}
- {\inttimes{2}{\intpow{\varb}2}}$}}
- \eqstep{\inttimes{4}{\intpow{\vara}2}}
- \spfstep{Dividing both sides by $2$ yields
- \yield{$\eq{\intpow{\varb}2}{\inttimes{2}{\intpow{\vara}2}}$}}
- \spfstep[term=\divides{2}{\intpow{\varb}2}]{Hence
- $\intpow{\varb}2$ is even}
- \conclude[term=\divides{2}{\varb}]{Hence $\varb $ is even}
- % one more comment:
- By the same argument as above
- \end{subproof}
- \conclude[term=\contradiction]{Contradiction to $\vara,\varb $ being
- \symname{coprime}.}
-\end{sproof}
-\end{latexcode}
-
-which will produce:
-
-\begin{mdframed}
-\begin{sassertion}[type=theorem,name=sqrt2irr]
- \conclusion{\irrational{$\arg{\realroot2}$ is \comp{irrational}}}.
-\end{sassertion}
-
-\begin{sproof}[for=sqrt2irr,method=contradiction]{By contradiction}
- \assumption{Assume \yield{\rational{$\arg{\realroot2}$ is \comp{rational}}}}
- \begin{subproof}[method=straightforward]%
- {Then \yield{$\eq{\ratfrac{\intpow \vara2}{\intpow \varb2}}{2}$ for some $\inset{\vara,\varb}\PosInt$ with \coprime{$\arg \vara,\arg \varb$ \comp{coprime}}}}
- \assumption{By assumption, \yield{there are $\inset{\vara,\varb}\PosInt$ with $\realroot2=\ratfrac\vara\varb$}}
- \spfstep{wlog, we can assume \coprime{$\arg{\vara},\arg{\varb}$ to be \comp{coprime}}}
- If not, reduce the fraction until numerator and denominator are
- coprime, and let the resulting components be $\vara$ and $\varb$
- \spfstep{Then \yield{$\eq{\intpow{\ratfrac\vara\varb}2}2$}}
- \eqstep{\ratfrac{\intpow\vara2}{\intpow\varb2}}
- \end{subproof}
- \begin{subproof}[term=\divides{2}{\vara},method=straightforward]{Then $\vara$ is even}
- \spfstep{Multiplying the equation by $\intpow\varb2$ yields $\yield{\eq{\intpow\vara2}{\inttimes2{\intpow\varb2}}}$}
- \spfstep[term=\divides{2}{\intpow\vara2}]{Hence $\intpow\vara2$ is even}
- \conclude[term=\divides{2}{\vara}]{Hence $\vara$ is even as well}
- Hint: Think about the prime factorizations of $\vara$ and $\intpow\vara2$
- \end{subproof}
- \begin{subproof}[term=\divides{2}{\varb},method=straightforward]{Then $\varb$ is also even}
- \spfstep{Since $\vara$ is even, we have \yield{some $\varc$ such that $\eq{\inttimes2\varc}{\vara}$}}
- \spfstep{Plugging into the above, we get \yield{$\eq{\intpow{\inttimes2\vara}2}{\inttimes2{\intpow\varb2}}$}}
- \eqstep{\inttimes4{\intpow\vara2}}
- \spfstep{Dividing both sides by $2$ yields \yield{$\eq{\intpow\varb2}{\inttimes2{\intpow\vara2}}$}}
- \spfstep[term=\divides{2}{\intpow\varb2}]{Hence $\intpow\varb2$ is even}
- \conclude[term=\divides{2}{\varb}]{Hence $\varb$ is even}
- By the same argument as above
- \end{subproof}
- \conclude[term=\contradiction]{Contradiction to $\vara,\varb$ being \symname{coprime}.}
-\end{sproof}
-\end{mdframed}
-
-If we mark all subproofs with |hide|, we will obtain the following
-instead:
-
-\begin{mdframed}
- \begin{sassertion}[type=theorem,name=sqrt2irr]
- \conclusion{\irrational{$\arg{\realroot2}$ is \comp{irrational}}}.
- \end{sassertion}
-
- \begin{sproof}[for=sqrt2irr,method=contradiction]{By contradiction}
- \assumption{Assume \yield{\rational{$\arg{\realroot2}$ is \comp{rational}}}}
- \begin{subproof}[hide,method=straightforward]%
- {Then \yield{$\eq{\ratfrac{\intpow \vara2}{\intpow \varb2}}{2}$ for some $\inset{\vara,\varb}\PosInt$ with \coprime{$\arg \vara,\arg \varb$ \comp{coprime}}}}
- \assumption{By assumption, \yield{there are $\inset{\vara,\varb}\PosInt$ with $\realroot2=\ratfrac\vara\varb$}}
- \spfstep{wlog, we can assume \coprime{$\arg{\vara},\arg{\varb}$ to be \comp{coprime}}}
- If not, reduce the fraction until numerator and denominator are
- coprime, and let the resulting components be $\vara$ and $\varb$
- \spfstep{Then \yield{$\eq{\intpow{\ratfrac\vara\varb}2}2$}}
- \eqstep{\ratfrac{\intpow\vara2}{\intpow\varb2}}
- \end{subproof}
- \begin{subproof}[hide,term=\divides{2}{\vara},method=straightforward]{Then $\vara$ is even}
- \spfstep{Multiplying the equation by $\intpow\varb2$ yields $\yield{\eq{\intpow\vara2}{\inttimes2{\intpow\varb2}}}$}
- \spfstep[term=\divides{2}{\intpow\vara2}]{Hence $\intpow\vara2$ is even}
- \conclude[term=\divides{2}{\vara}]{Hence $\vara$ is even as well}
- Hint: Think about the prime factorizations of $\vara$ and $\intpow\vara2$
- \end{subproof}
- \begin{subproof}[hide,term=\divides{2}{\varb},method=straightforward,]{Then $\varb$ is also even}
- \spfstep{Since $\vara$ is even, we have \yield{some $\varc$ such that $\eq{\inttimes2\varc}{\vara}$}}
- \spfstep{Plugging into the above, we get \yield{$\eq{\intpow{\inttimes2\vara}2}{\inttimes2{\intpow\varb2}}$}}
- \eqstep{\inttimes4{\intpow\vara2}}
- \spfstep{Dividing both sides by $2$ yields \yield{$\eq{\intpow\varb2}{\inttimes2{\intpow\vara2}}$}}
- \spfstep[term=\divides{2}{\intpow\varb2}]{Hence $\intpow\varb2$ is even}
- \conclude[term=\divides{2}{\varb}]{Hence $\varb$ is even}
- By the same argument as above
- \end{subproof}
- \conclude[term=\contradiction]{Contradiction to $\vara,\varb$ being \symname{coprime}.}
- \end{sproof}
- \end{mdframed}
-
- However, the hidden subproofs will still be shown in the HTML,
- only in an expandable section which is collapsed by default.
-
-
-The above style of writing proofs is usually called \emph{structured proofs}.
-They have a huge advantage over the traditional purely prosaic style,
-in that (as the name suggests) the actual \emph{structure} of the proof
-is made explicit, which almost always makes it considerably more
-comprehensible. We, among many others, encourage the general use of
-structured proofs.
-
-Alas, most proofs are not written in this style, and we would
-do users a disservice by insisting on this style. For that reason,
-the |spfblock| environment turns all subproofs and proof step
-macros into presentationally neutral \emph{inline} annotations,
-as in the induction step of the following example:
-
-\begin{latexcode}
-\begin{sproof}[id=simple-proof,method=induction]
- {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$}
- For the induction we have to consider three cases: % <- a comment
- \begin{subproof}{$n=1$}
- \spfstep*{then we compute $1=1^2$}
- \end{subproof}
- \begin{subproof}{$n=2$}
- This case is not really necessary, but we do it for the
- fun of it (and to get more intuition).
- \spfstep*{We compute $1+3=2^{2}=4$.}
- \end{subproof}
- \begin{subproof}{$n>1$}\begin{spfblock}
- \assumption[id=ind-hyp]{
- Now, we assume that the assertion is true for a certain $k\geq 1$,
- i.e. \yield{$\sum_{i=1}^k{(2i-1)}=k^{2}$}.
- }
-
- We have to show that we can derive the assertion for $n=k+1$ from
- this assumption, i.e. $\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$.
-
- \spfstep{
- We obtain $\yield{\sum_{i=1}^{k+1}{2i-1}=
- \sum_{i=1}^k{2i-1}+2(k+1)-1}$
- \spfjust{by \splitsum{\comp{splitting the sum}
- \arg*{$\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$}}}.
- }
- \spfstep{
- Thus we have $\yield{\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1}$
- \spfjust{by \symname{induction-hypothesis}}.
- }
- \conclude{
- We can \spfjust{\simplification{\comp{simplify} the right-hand side
- \arg*{k^2+2k+1}}} to
- ${k+1}^2$, which proves the assertion.
- }
- \end{spfblock}\end{subproof}
- \conclude{
- We have considered all the cases, so we have proven the assertion.
- }
-\end{sproof}
-\end{latexcode}
-
-
-\symdecl{splitsum}[args=1]
-\symdecl{inducthypothesis}[name=induction-hypothesis]
-\symdecl{simplification}[args=1]
-
-This yields the following result:
-
-\begin{mdframed}
- \begin{sproof}[id=simple-proof,method=induction]
- {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$}
- For the induction we have to consider three cases: % <- a comment
- \begin{subproof}{$n=1$}
- \spfstep*{then we compute $1=1^2$}
- \end{subproof}
- \begin{subproof}{$n=2$}
- This case is not really necessary, but we do it for the
- fun of it (and to get more intuition).
- \spfstep*{We compute $1+3=2^{2}=4$.}
- \end{subproof}
- \begin{subproof}{$n>1$}\begin{spfblock}
- \assumption[id=ind-hyp]{
- Now, we assume that the assertion is true for a certain $k\geq 1$,
- i.e. \yield{$\sum_{i=1}^k{(2i-1)}=k^{2}$}.
- }
-
- We have to show that we can derive the assertion for $n=k+1$ from
- this assumption, i.e. $\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$.
-
- \spfstep{
- We obtain $\yield{\sum_{i=1}^{k+1}{2i-1}=\sum_{i=1}^k{2i-1}+2(k+1)-1}$
- \spfjust{by \splitsum{\comp{splitting the sum}\arg*{$\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$}}}.
- }
- \spfstep{
- Thus we have $\yield{\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1}$
- \spfjust{by \symname{induction-hypothesis}}.
- }
- \conclude{
- We can \spfjust{\simplification{\comp{simplify} the right-hand side
- \arg*{k^2+2k+1}}} to
- ${k+1}^2$, which proves the assertion.
- }
- \end{spfblock}\end{subproof}
- \conclude{
- We have considered all the cases, so we have proven the assertion.
- }
- \end{sproof}
-\end{mdframed}
-
-\end{smodule}
-
-\begin{environment}{sproof}
- The |sproof| environment is the main container for proofs. It takes an optional |KeyVal|
- argument that allows to specify the |id| (identifier) and |for| (for which assertion is
- this a proof) keys. The regular argument of the |proof| environment contains an
- introductory comment, that may be used to announce the proof style. The |proof|
- environment contains a sequence of |spfstep|, |spfcomment|, and |spfcases| environments
- that are used to markup the proof steps.
-\end{environment}
-
-\begin{function}{\spfidea}
- The |\spfidea| macro allows to give a one-paragraph description of the proof idea.
-\end{function}
-
-\begin{function}{\spfsketch}
- For one-line proof sketches, we use the |\spfsketch| macro, which takes the same
- optional argument as |sproof| and another one: a natural language text that sketches
- the proof.
-\end{function}
-
-\begin{function}{\spfstep}
- Regular proof steps are marked up with the |\spfstep| macro, which takes an optional
- |KeyVal| argument for annotations. A proof step usually contains a local assertion
- (the text of the step) together with some kind of evidence that this can be derived
- from already established assertions.
-\end{function}
-
-\begin{function}{\yield}
- See above
-\end{function}
-
-\begin{function}{\spfjust}
- This evidence is marked up with the |\spfjust| macro in the \pkg{stex-proofs}
- package. This environment totally invisible to the formatted result; it wraps the text
- in the proof step that corresponds to the evidence (ideally, a
- semantically marked-up term).
-\end{function}
-
-\begin{function}{\assumption}
- The |\assumption| macro allows to mark up a (justified) assumption.
-\end{function}
-
-\begin{function}{\justarg}
-\end{function}
-
-\begin{environment}{subproof}
- The |subproof| environment is used to mark up a subproof. This environment takes an
- optional |KeyVal| argument for semantic annotations and a second argument that allows
- to specify an introductory comment (just like in the |proof| environment). The
- |method| key can be used to give the name of the proof method
- executed to make this subproof.
-\end{environment}
-
-\begin{function}{\sproofend}
- Traditionally, the end of a mathematical proof is marked with a little box at the end of
- the last line of the proof (if there is space and on the end of the next line if there
- isn't), like so:\sproofend
-
- The \pkg{stex-proofs} package provides the |\sproofend| macro for this.
-\end{function}
-
-\begin{variable}{\sProofEndSymbol}
- If a different symbol for the proof end is to be used (e.g. {\sl{q.e.d}}), then this can
- be obtained by specifying it using the |\sProofEndSymbol| configuration macro (e.g. by
- specifying |\sProofEndSymbol{q.e.d}|).
-\end{variable}
-
-Some of the proof structuring macros above will insert proof end symbols for sub-proofs,
-in most cases, this is desirable to make the proof structure explicit, but sometimes this
-wastes space (especially, if a proof ends in a case analysis which will supply its own
-proof end marker). To suppress it locally, just set |proofend={}| in them or use use
-|\sProofEndSymbol{}|.
-\end{sfragment}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-% LocalWords: hypothesis,id geq splitit arith:split-sum byindhyp rhs proofend eqstep
-% LocalWords: sproofs coprime ratfrac 2,prec intpow ratpow inttimes varb varc sqrt2irr
-% LocalWords: theorem,name sqrt2irr,method wlog hide,method hide,term spfblock splitsum
-% LocalWords: simple-proof,method inducthypothesis
diff --git a/macros/latex/contrib/stex/doc/packages/stex-references.tex b/macros/latex/contrib/stex/doc/packages/stex-references.tex
deleted file mode 100644
index 3850d644ee..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-references.tex
+++ /dev/null
@@ -1,92 +0,0 @@
-If we take features like \stexcode"\inputref" and \stexcode"\mhinput"
-(and the \stexcode"sfragment"-environment, see
-\sref[file=stex-document-structure]{sec:ds:intro}[in=../stex-manual,title={the \sTeX{}3 manual}]) seriously,
-and build large documents modularly from individually compiling documents for sections, chapters
-and so on, cross-referencing becomes an interesting problem.
-
-Say, we have a document |main.tex|, which \stexcode"\inputref"s a section
-|section1.tex|, which references a definition with label |some_definition| in
-|section2.tex| (subsequently also inputted in |main.tex|).
-Then the numbering of the definition will depend on the \emph{document context}
-in which the document fragment |section2.tex| occurs - in |section2.tex| itself
-(as a standalone document), it might be \emph{Definition 1}, in |main.tex| it might
-be \emph{Definition 3.1}, and in |section1.tex|, the definition \emph{does not even occur}, so
-it needs to be referenced by some other text.
-
-What we would want in that instance is an equivalent of \stexcode"\autoref", that takes
-the document context into account to yield something like \emph{Definition 1}, \emph{Definition 3.1}
-or ``\emph{Definition 1 in the section on Foo}'' respectively.
-
-The \stexcode"\sref" command attempts to do precisely that. Unlike plain \stexcode"\ref", \stexcode"\autoref"
-etc., \stexcode"\sref" refers to not just a \emph{label}, but instead a pair consisting of a \emph{label}
-and the \emph{document} in whose context we want to refer to it. Conversely, every \emph{document}
-(i.e. standalone compilable |.tex|-file) keeps track of the ``names'' (\emph{Definition 3.1} etc.) for every
-label as determined in the context of the document, and stores them in a dedicated file |\jobname.sref|.
-Additionally, every document has a ``\emph{reference name}'' (e.g. ``\emph{the section on Foo}'').
-This allows us to refer to ``label $x$ in document $D$'' to yield ``\emph{Definition 1 in the section on Foo}''.
-And of course, \sTeX can decide based on the current document to either refer to the label by its
-``full name'' or directly as e.g. \emph{Definition 3.1} depending on whether the label occurs in
-the current document anyway (and link to it accordingly).
-
-\paragraph{} For that to work, we need to supply (up to) three pieces
-of information:
-\begin{itemize}
- \item The \emph{label} of the reference target (e.g. |some_definition|),
- \item (optionally) the \emph{file}/document containing the reference target
- (e.g. |section2|).
- This is not strictly necessary, but allows for additional disambiguation
- between possibly duplicate labels across files, and
- \item (optionally) the document context, in which we want to
- refer to the reference target (e.g. |main|).
-\end{itemize}
-Additionally, the document in which we want to reference a label needs
-a title for external references.
-
-
-\begin{function}{\sref}
- \begin{syntax} \cs{sref}|[archive=|\meta{archive1}|,file=|\meta{file}|]|%
- \Arg{label}|[archive=|\meta{archive2}|,in=|\meta{document-context}|,title=|\meta{title}|]| \end{syntax}
- This command references \meta{label} (declared in \meta{file} in \meta{archive1}).
- If the object (section, figure, etc.) with that label occurs ultimately
- in the same document, \cs{sref} will ignore the second set of optional arguments
- and simply defer to \cs{autoref} if that command exists, or \cs{ref} if the \pkg{hyperref}
- package is not included.
-
- If the referenced object does \emph{not} occur in the current document however,
- \cs{sref} will refer to it by the object's name as it occurs in
- the file \meta{document-context} in \meta{archive2}.
-
-For example, the reference to the \stexcode"sfragment"-environment above
-will appear as ``subsection 7.2.1 (Introduction) in the \sTeX{}3 manual''
-if you are reading this in the package documentation for |stex-references|
-directly, but as a linked ``subsection 7.2.1'' in the full documentation
-or manual. This is achieved using
-
-\stexcode"\sref[file=stex-document-structure]{sec:ds:intro}[in=../stex-manual,title={the \sTeX{}3 manual}]".
-
-\end{function}
-
-For a further example, the following:
-\begin{center}
- \sref[file=../stex-doc]{part:extends}[in=../stex-doc,title={the full \sTeX{}3 documentation}]
-\end{center}
-will say ``Part III'' (and link accordingly) in the full documentation,
-and ``Part III (Extensions) in the full \sTeX{}3 documentation''
-everywhere else. This is achieved using
-
-\stexcode"\sref[file=../stex-doc]{part:extends}[in=../stex-doc,title={the full \sTeX{}3 documentation}]".
-
-\begin{function}{\extref}
- \begin{syntax} \cs{sref}|[archive=|\meta{archive1}|,file=|\meta{file}|]|%
- \Arg{label}|{archive=|\meta{archive2}|,in=|\meta{document-context}|,title=|\meta{title}|}| \end{syntax}
- The \cs{extref}-command behaves exactly like \cs{sref}, but takes
- \emph{required} the document context argument and will always use it
- for generating the document text, regardless of whether the label
- occurs in the current document.
-\end{function}
-
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
diff --git a/macros/latex/contrib/stex/doc/packages/stex-setup.tex b/macros/latex/contrib/stex/doc/packages/stex-setup.tex
deleted file mode 100644
index 7e0e1fe4a4..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-setup.tex
+++ /dev/null
@@ -1,34 +0,0 @@
-\begin{sfragment}{Setting up the \sTeX Package}
-
- \begin{sfragment}[id=sec.minimal-setup]{Minimal Setup for the \sTeX Package}
- In the best of all worlds, there is no setup, as you already have a new version of
- {\TeX}Live on your system as a {\LaTeX} enthusiast. If not now is the time to
- install it; see \cite{TeXLive:on}. You can usually update {\TeX}Live via a package
- manager or the {\TeX}Live manager \textbf{tlmgr}.
- \sTeX requires a \TeX{} kernel newer than February 2022.
-
- Alternatively, you can install \sTeX from CTAN, the Comprehensive {\TeX} Archive
- Network; see \cite{stexCTAN:on} for details. We
- assume you have the \sTeX package in at least version 3.2 (September 2022).
- \end{sfragment}
-
- \begin{sfragment}[id=sec.git-setup]{GIT-based Setup for the \sTeX Development Version}
- If you want use the latest and greatest \sTeX packages
- that have not even been released to CTAN,
- then you can directly clone them from the \sTeX development
- repository \cite{sTeX:github:on} by the following command-line instructions:
- \begin{lstlisting}[language=bash]
- cd <stexdir>
- git clone https://github.com/slatex/sTeX.git
- \end{lstlisting}
- and keep it updated by pulling updates via \lstinline|git pull| in the cloned \sTeX
- directory.
- Make sure to either clone the \sTeX repository into a local texmf-tree or to update your \lstinline|TEXINPUTS| environment variable, e.g. by placing the following line in your \lstinline|.bashrc|:
- \begin{lstlisting}[language=bash]
- export TEXINPUTS="$(TEXINPUTS):<sTeXDIR>//:"
- \end{lstlisting}
- \end{sfragment}
-
- \input{packages/stex-mathhubsetup}
-
-\end{sfragment} \ No newline at end of file
diff --git a/macros/latex/contrib/stex/doc/packages/stex-statements.tex b/macros/latex/contrib/stex/doc/packages/stex-statements.tex
deleted file mode 100644
index 6a2478fa7d..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-statements.tex
+++ /dev/null
@@ -1,145 +0,0 @@
-\begin{sfragment}{Definitions, Theorems, Examples, Paragraphs}
-\begin{smodule}{Statements}
- As mentioned earlier, we can semantically mark-up
- \emph{statements} such as definitions, theorems, lemmata, examples, etc.
-
- The corresponding environments for that are:
- \begin{itemize}
- \item \stexcode"sdefinition" for definitions,
- \item \stexcode"sassertion" for assertions, i.e.
- propositions that are declared to be \emph{true},
- such as theorems, lemmata, axioms,
- \item \stexcode"sexample" for examples and counterexamples, and
- \item \stexcode"sparagraph" for ``other'' semantic paragraphs,
- such as comments, remarks, conjectures, etc.
- \end{itemize}
-
- The \emph{presentation} of these environments can be customized
- to use e.g. predefined |theorem|-environments, see \sref{sec.customhighlight}
- for details.
-
- All of these environments take optional arguments in the form of
- |key=value|-pairs. Common to all of them are the keys |id=| (for cross-referencing,
- see \sref{sec.references}), |type=| for customization (see \sref{sec.customhighlight})
- and additional information (e.g. definition principles, ``difficulty'' etc), as well
- as |title=| (for giving the paragraph a title), and finally |for=|.
-
- The |for=| key expects a comma-separated list of existing
- symbols, allowing for e.g. things like
- \symdef{addition}[args=a,prec=100]{#1}{##1 \comp+ ##2}
- \symdef{multiplication}[args=a,prec=50]{#1}{##1 \comp\cdot ##2}
- \stexexample{%
-\begin{sexample}[
- id=additionandmultiplication.ex,
- for={addition,multiplication},
- type={trivial,boring},
- title={An Example}
-]
- $\addition{2,3}$ is $5$, $\multiplication{2,3}$ is $6$.
-\end{sexample}
- }
-
- \begin{function}{\definiendum,\definame,\Definame}
- \stexcode"sdefinition" (and \stexcode"sparagraph" with
- |type=symdoc|) introduce three new macros:
- \stexcode"definiendum" behaves like \stexcode"symref"
- (and \stexcode"definame"/\stexcode"Definame"
- like \stexcode"symname"/\stexcode"Symname", respectively),
- but highlights the referenced symbol as \emph{being defined}
- in the current definition.
- \end{function}
-
- \begin{mmtbox}
- The special |type=symdoc| for \stexcode"sparagraph" is intended to be used for
- ``informal definitions'', or encyclopedia-style descriptions for symbols.
-
- The \mmt system can use those (in lieu of an actual \stexcode"sdefinition" in scope)
- to present to users, e.g. when hovering over symbols.
- \end{mmtbox}
-
- \begin{function}{\definiens}
- Additionally, \stexcode"sdefinition" (and \stexcode"sparagraph" with
- |type=symdoc|) introduces \stexcode"\definiens[<optional symbolname>]{<code>}"
- which marks up |<code>| as being the explicit \emph{definiens}
- of |<optional symbolname>| (in case |for=| has multiple symbols).
- \end{function}
-
- All four statement environments -- i.e. \stexcode|sdefinition|,
- \stexcode|sassertion|, \stexcode|sexample|, and \stexcode|sparagraph| -- also take an
- optional parameter |name=| -- if this one is given a value, the environment will
- generate a \emph{symbol} by that name (but with no semantic macro). Not only does this
- allow for \stexcode"\symref" et al, it allows us to resume our earlier example for
- monoids much more nicely:\ednote{MK: we should reference the example explicitly here.}
-
- \symdef{set}{\comp{\texttt{Set}}}
- \symdef{equal}[args=2]{#1 \comp= #2}
- \symdef{inset}[args=2]{#1 \comp\in #2}
- \symdef{funtype}[args=ai]{#1 \comp\to #2}{##1 \comp\times ##2}
-
- \stexexample{%
-\begin{mathstructure}{monoid}
- \symdef{universe}[type=\set]{\comp{U}}
- \symdef{op}[
- args=2,
- type=\funtype{\universe,\universe}{\universe},
- op=\circ
- ]{#1 \comp{\circ} #2}
- \symdef{unit}[type=\universe]{\comp{e}}
-
- \begin{sparagraph}[type=symdoc,for=monoid]
- A \definame{monoid} is a structure
- $\mathstruct{\universe,\op!,\unit}$
- where $\op!:\funtype{\universe}{\universe}$ and
- $\inset{\unit}{\universe}$ such that
-
- \begin{sassertion}[name=associative,
- type=axiom,
- title=Associativity]
- $\op!$ is associative
- \end{sassertion}
- \begin{sassertion}[name=isunit,
- type=axiom,
- title=Unit]
- $\equal{\op{\svar{x}}{\unit}}{\svar{x}}$
- for all $\inset{\svar{x}}{\universe}$
- \end{sassertion}
- \end{sparagraph}
-\end{mathstructure}
-
-An example for a \symname{monoid} is...
- }
-
- The main difference to before\ednote{MK: reference} is that the two
- \stexcode|sassertion|s now have |name=| attributes. Thus the \stexcode"mathstructure"
- \symname{monoid} now contains two additional symbols, namely the axioms for
- associativity and that $e$ is a unit. Note that both symbols do not represent the mere
- \emph{propositions} that e.g. $\circ$ is associative, but \emph{the assertion that it
- is actually true} that $\circ$ is associative.
-
- If we now want to instantiate |monoid| (unless with a variable,
- of course), we also need to assign |associative| and |neutral|
- to analogous assertions. So the earlier example
- \begin{latexcode}[gobble=8]
- \instantiate{intmonoid}{monoid}{\mathbb{Z}_{+,0}}[
- universe = Int ,
- op = addition ,
- unit = zero
- ]
- \end{latexcode}
- ...will not work anymore. We now need to give assertions that
- |addition| is associative and that |zero| is a unit with respect
- to addition.\footnote{Of course, \sTeX can not check that
- the assertions are the ``correct'' ones -- but if
- the assertions (both in |monoid| as well as those for addition and
- zero) are properly marked up, \mmt can. \textcolor{red}{TODO: should}}
-
-\end{smodule}
-\end{sfragment}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-% LocalWords: sec.customhighlight a,prec additionandmultiplication.ex trivial,boring
-% LocalWords: addition,multiplication symdoc symdoc,for isunit
diff --git a/macros/latex/contrib/stex/doc/packages/stex-symbols.tex b/macros/latex/contrib/stex/doc/packages/stex-symbols.tex
deleted file mode 100644
index 67e9a32e70..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-symbols.tex
+++ /dev/null
@@ -1,587 +0,0 @@
-\begin{smodule}[ns=https://github.com/slatex/sTeX/doc]{SymbolsAndNotations}
-\begin{sfragment}{Declaring New Symbols and Notations}
- Inside an \stexcode"smodule" environment, we can declare new \sTeX symbols.
-
-\begin{function}{\symdecl}
- The most basic command for doing so is using \stexcode"\symdecl{symbolname}". This
- introduces a new symbol with name |symbolname|, arity $0$ and semantic macro
- \stexcode"\symbolname".
-
- The starred variant \stexcode"\symdecl*{symbolname}" will declare a symbol, but not
- introduce a semantic macro. If we don't want to supply a notation (for example to
- introduce concepts like ``abelian'', which is not something that has a notation), the
- starred variant is likely to be what we want.
-\end{function}
-\begin{mmtbox}
- \stexcode"\symdecl" introduces a new \omdoc/\mmt constant in the current module
- (=\omdoc/\mmt theory). Correspondingly, they get assigned the URI
- |<module-URI>?<constant-name>|.
-\end{mmtbox}
-
-Without a semantic macro or a notation, the only meaningful way to reference a symbol is
-via \stexcode"\symref",\stexcode"\symname" etc.
-
-\stexexample{%
-\symdecl*{foo}
-Given a \symname{foo}, we can...
-}
-
-Obviously, most semantic macros should take actual \emph{arguments}, implying that the
-symbol we introduce is an \emph{operator} or \emph{function}. We can let
-\stexcode"\symdecl" know the \emph{arity} (i.e. number of arguments) of a symbol like
-this:
-
-\stexexample{%
-\symdecl{binarysymbol}[args=2]
-\symref{binarysymbol}{this} is a symbol taking two arguments.
-}
-
-So far we have gained exactly \ldots nothing by adding the arity information: we cannot do
-anything with the arguments in the text.
-
-We will now see what we can gain with more machinery.
-
-\begin{function}{\notation}
- We probably want to supply a notation as well, in which case we can finally actually use
- the semantic macro in math mode. We can do so using the \stexcode"\notation" command,
- like this:
-
-\stexexample{%
-\notation{binarysymbol}{\text{First: }#1\text{; Second: }#2}
-$\binarysymbol{a}{b}$ }
-\end{function}
-
-\begin{mmtbox}
- Applications of semantic macros, such as \stexcode"\binarysymbol{a}{b}" are translated
- to \mmt/\omdoc as |OMA|-terms with head |<OMS name="...?binarysymbol"/>|.
-
- Semantic macros with no arguments correspond to |OMS| directly.
-\end{mmtbox}
-
-\begin{function}{\comp}
- For many semantic services e.g. semantic highlighting or \defemph{wikification} (linking
- user-visible notation components to the definition of the respective symbol they come
- from), we need to specify the notation components. Unfortunately, there is currently no
- way the \sTeX engine can infer this by itself, so we have to specify it manually in the
- notation specification. We can do so with the \stexcode"\comp" command.
-\end{function}
-
-We can introduce a new notation |highlight| for \stexcode"\binarysymbol" that fixes this
-flaw, which we can subsequently use with \stexcode"\binarysymbol[highlight]":
-
-\stexexample{%
-\notation{binarysymbol}[highlight]
- {\comp{\text{First: }}#1\comp{\text{; Second: }}#2}
-$\binarysymbol[highlight]{a}{b}$
-}
-
-\begin{dangerbox}
- Ideally, \stexcode"\comp" would not be necessary: Everything in a notation that is
- \emph{not} an argument should be a notation component. Unfortunately, it is
- computationally expensive to determine where an argument begins and ends, and the
- argument markers |#n| may themselves be nested in other macro applications or
- \TeX\xspace groups, making it ultimately almost impossible to determine them
- automatically while also remaining compatible with arbitrary highlighting customizations
- (such as tooltips, hyperlinks, colors) that users might employ, and that are ultimately
- invoked by \stexcode"\comp".
-\end{dangerbox}
-
-\begin{dangerbox}
- Note that it is required that
- \begin{enumerate}
- \item the argument markers |#n| never occur inside a \stexcode"\comp", and
- \item no semantic arguments may ever occur inside a notation.
- \end{enumerate}
- Both criteria are not just required for technical reasons, but conceptionally
- meaningful:
-
- The underlying principle is that the arguments to a semantic macro represent
- \emph{arguments to the mathematical operation} represented by a symbol. For example, a
- semantic macro \stexcode"\addition{a}{b}" taking two arguments would represent \emph{the
- actual addition of (mathematical objects) $a$ and $b$}. It should therefore be
- impossible for $a$ or $b$ to be part of a notation component of \stexcode"\addition".
-
- Similarly, a semantic macro can not conceptually be part of the notation of
- \stexcode"\addition", since a semantic macro represents a \emph{distinct mathematical
- concept} with \emph{its own semantics}, whereas notations are syntactic
- representations of the very symbol to which the notation belongs.
-
- If you want an argument to a semantic macro to be a purely syntactic parameter, then you
- are likely somewhat confused with respect to the distinction between the precise
- \emph{syntax} and \emph{semantics} of the symbol you are trying to declare (which
- happens quite often even to experienced \sTeX users), and might want to give those
- another thought - quite likely, the macro you aim to implement does not actually
- represent a semantically meaningful mathematical concept, and you will want to use
- \stexcode"\def" and similar native \LaTeX\xspace macro definitions rather than semantic
- macros.
-\end{dangerbox}
-
-\begin{function}{\symdef}
- In the vast majority of cases where a symbol declaration should come with a semantic
- macro, we will want to supply a notation immediately. For that reason, the
- \stexcode"\symdef" command combines the functionality of both \stexcode"\symdecl" and
- \stexcode"\notation" with the optional arguments of both:
-\end{function}
-
-\stexexample{%
-\symdef{newbinarysymbol}[hl,args=2]
- {\comp{\text{1.: }}#1\comp{\text{; 2.: }}#2}
-$\newbinarysymbol{a}{b}$
-}
-
-We just declared a new symbol |newbinarysymbol| with |args=2| and immediately provided it
-with a notation with identifier |hl|. Since |hl| is the \emph{first} (and so far, only)
-notation supplied for |newbinarysymbol|, using \stexcode"\newbinarysymbol" without
-optional argument defaults to this notation.\bigskip
-
-But one man's meat is another man's poison: it is very subjective what the ``default
-notation'' of an operator should be. Different communities have different practices. For
-instance, the complex unit is written as $i$ in Mathematics and as $j$ in electrical
-engineering. So to allow modular specification and facilitate re-use of document fragments
-\sTeX allows to re-set notation defaults.
-
-\begin{function}{\setnotation}
- The first notation provided will stay the default notation unless explicitly changed --
- this is enabled by the \stexcode"\setnotation" command:
- \stexcode"\setnotation{symbolname}{notation-id}" sets the default notation of
- \stexcode"\symbolname" to |notation-id|, i.e. henceforth, \stexcode"\symbolname" behaves
- like \stexcode"\symbolname[notation-id]" from now on.
-\end{function}
-
-Often, a default notation is set right after the corresponding notation is introduced --
-the starred version \stexcode"\notation*" for that reason introduces a new notation and
-immediately sets it to be the new default notation. So expressed differently, the
-\emph{first} \stexcode"\notation" for a symbol behaves exactly like \stexcode"\notation*",
-and \stexcode"\notation*{foo}[bar]{...}" behaves exactly like
-\stexcode"\notation{foo}[bar]{...}\setnotation{foo}{bar}".
-
-\begin{function}{\textsymdecl}
- In the less mathematical settings where we want a symbol and
- semantic macro for some concept with a notation \emph{beyond}
- its mere name, but which should also be available in \TeX's text
- mode, the command \stexcode"\textsymdecl" is useful.
- For example, we can declare a symbol \stexcode"openmath"
- with the notation \stexcode"\textsc{OpenMath}" using
- \textsymdecl{openmath}[name=OpenMath]{\textsc{OpenMath}}
- \stexcode"\textsymdecl{openmath}[name=OpenMath]{\textsc{OpenMath}}".
- The \stexcode"\openmath" yields \openmath both in text and math
- mode.
-\end{function}
-
-\begin{sfragment}{Operator Notations}
- Once we have a semantic macro with arguments, such as \stexcode"\newbinarysymbol", the
- semantic macro represents the \emph{application} of the symbol to a list of
- arguments. What if we want to refer to the operator \emph{itself}, though?
-
- We can do so by supplying the \stexcode"\notation" (or \stexcode"\symdef") with an
- \emph{operator notation}, indicated with the optional argument |op=|. We can then
- invoke the operator notation using \stexcode"\symbolname![notation-identifier]". Since
- operator notations never take arguments, we do not need to use \stexcode"\comp" in it,
- the whole notation is wrapped in a \stexcode"\comp" automatically:
-
- \stexexample{%
- \notation{newbinarysymbol}[ab, op={\text{a:}\cdot\text{; b:}\cdot}]
- {\comp{\text{a:}}#1\comp{\text{; b:}}#2} \symname{newbinarysymbol} is also
- occasionally written $\newbinarysymbol![ab]$
- }
-
- \begin{mmtbox}
- \stexcode"\symbolname!" is translated to \omdoc/\mmt as |<OMS name="...?symbolname"/>|
- directly.
- \end{mmtbox}
-
-\end{sfragment}
-\end{sfragment}
-
-\begin{sfragment}{Argument Modes}
- The notations so far used \emph{simple} arguments which we call \emph{mode}-|i|
- arguments. Declaring a new symbol with \stexcode"\symdecl{foo}[args=3]" is equivalent to
- writing \stexcode"\symdecl{foo}[args=iii]", indicating that the semantic macro takes
- three mode-|i| arguments. However, there are three more argument modes which we will
- investigate now, namely mode-|b|, mode-|a| and mode-|B| arguments.
-
-\begin{sfragment}{Mode-\texttt b Arguments}
-
-A mode-|b| argument represents a \emph{variable} that is \emph{bound} by the symbol in
-its application, making the symbol a \emph{binding operator}. Typical examples of
-binding operators are e.g. sums $\sum$, products $\prod$, integrals $\int$, quantifiers
-like $\forall$ and $\exists$, that $\lambda$-operator, etc.
-
-\begin{mmtbox}
- Mode-|b| arguments behave exactly like mode-|i| arguments within \TeX, but applications
- of binding operators, i.e. symbols with mode-|b| arguments, are translated to
- |OMBIND|-terms in \omdoc/\mmt, rather than |OMA|.
-\end{mmtbox}
-
-For example, we can implement a summation operator binding an index variable and taking
-lower and upper index bounds and the expression to sum over like this:
-
-\stexexample{%
-\symdef{summation}[args=biii]
- {\mathop{\comp{\sum}}_{#1\comp{=}#2}^{#3}#4}
- $\summation{\svar{x}}{1}{\svar{n}}{\svar{x}}^2$
-}
-
-where the variable $\svar{x}$ is now \emph{bound} by the \stexcode"\summation"-symbol in
-the expression.
-\end{sfragment}
-
-\begin{sfragment}{Mode-\texttt a Arguments}
- Mode-|a| arguments represent a \emph{flexary argument sequence}, i.e. a sequence of
- arguments of arbitrary length. Formally, operators that take arbitrarily many arguments
- don't ``exist'', but in informal mathematics, they are ubiquitous. Mode-|a| arguments
- allow us to write e.g. \stexcode"\addition{a,b,c,d,e}" rather than having to write
- something like \stexcode"\addition{a}{\addition{b}{\addition{c}{\addition{d}{e}}}}"!
-
- \stexcode"\notation" (and consequently \stexcode"\symdef", too) take one additional
- argument for each mode-|a| argument that indicates how to ``accumulate'' a
- comma-separated sequence of arguments. This is best demonstrated on an example.
-
- Let's say we want an operator representing quantification over an ascending chain of
- elements in some set, i.e. \stexcode"\ascendingchain{S}{a,b,c,d,e}{t}" should yield
- $\forall a{<_S}b{<_S}c{<_S}d{<_S}e.\,t$. The ``base''-notation for this operator is
- simply\\ \stexcode"{\comp{\forall} #2\comp{.\,}#3}", where |#2| represents the full
- notation fragment \emph{accumulated} from |{a,b,c,d,e}|.
-
- The \emph{additional} argument to \stexcode"\notation" (or \stexcode"\symdef") takes the
- same arguments as the base notation and two \emph{additional} arguments |##1| and |##2|
- representing successive pairs in the mode-|a| argument, and accumulates them into |#2|,
- i.e. to produce $a<_Sb<_Sc<_Sd<_Se$, we do \stexcode"{##1 \comp{<}_{#1} ##2}":
-
- \stexexample{%
-\symdef{ascendingchain}[args=iai]
- {\comp{\forall} #2\comp{.\,}#3}
- {##1 \comp{<}_{#1} ##2}
-
-Tadaa: $\ascendingchain{S}{a,b,c,d,e}{t}$
-}
-
-If this seems overkill, keep in mind that you will rarely need the single-hash arguments
-|#1|,|#2| etc. in the |a|-notation-argument. For a much more representative and simpler
-example, we can introduce flexary addition via:
-\stexexample{%
- \symdef{addition}[args=a]{#1}{##1 \comp{+} ##2}
-
-Tadaa: $\addition{a,b,c,d,e}$
-}
-
-\begin{sfragment}{The \texttt{assoc}-key}
- We mentioned earlier that ``formally'', flexary arguments don't really
- ``exist''. Indeed, formally, addition is usually defined as a binary operation,
- quantifiers bind a single variable etc.
-
- Consequently, we can tell \sTeX (or, rather, \mmt/\omdoc) how to ``resolve'' flexary
- arguments by providing \stexcode"\symdecl" or \stexcode"\symdef" with an optional
- |assoc|-argument, as in \stexcode"\symdecl{addition}[args=a,assoc=bin]". The possible
- values for the |assoc|-key are:
- \begin{itemize}
- \item[|bin|:] A binary, associative argument, e.g. as in \stexcode"\addition"
- \item[|binl|:] A binary, left-associative argument, e.g.
- $a^{\scriptstyle b^{\scriptstyle c^d}}$, which stands for $((a^b)^c)^d$
- \item[|binr|:] A binary, right-associative argument, e.g. as in $A\to B\to C\to D$,
- which stands for $A \to (B \to (C \to D))$
- \item[|pre|:] Successively prefixed, e.g. as in $\forall x,y,z.\,P$, which stands for
- $\forall x.\, \forall y.\, \forall z.\,P$
- \item[|conj|:] Conjunctive, e.g. as in $a=b=c=d$ or $a,b,c,d\in A$, which stand for
- $a=d\wedge b=d\wedge c=d$ and $a\in A\wedge b\in A \wedge c\in A\wedge d\in A$,
- respectively
- \item[|pwconj|:] Pairwise conjunctive, e.g. as in $a\neq b\neq c\neq d$, which stands
- for $a\neq b\wedge a\neq c\wedge a\neq d\wedge b\neq c\wedge b\neq d\wedge c\neq d$
- \end{itemize}
- As before, at the PDF level, this annotation is invisible (and without effect), but at
- the level of the generated OMDoc/MMT this leads to more semantical expressions.
-\end{sfragment}
-\end{sfragment}
-
-\begin{sfragment}{Mode-\texttt B Arguments}
- Finally, mode-|B| arguments simply combine the functionality of both |a| and |b| -
- i.e. they represent an arbitrarily long sequence of variables to be bound, e.g. for
- implementing quantifiers:
-
- \stexexample{%
-\symdef{quantforall}[args=Bi]
- {\comp{\forall}#1\comp{.}#2}
- {##1\comp,##2}
-
-$\quantforall{\svar{x},\svar{y},\svar{z}}{P}$
-}
-\end{sfragment}
-\end{sfragment}
-
-\begin{sfragment}{Type and Definiens Components}
- \stexcode"\symdecl" and \stexcode"\symdef" take two more optional arguments. \TeX\xspace
- largely ignores them (except for special situations we will talk about later), but \mmt
- can pick up on them for additional services. These are the |type| and |def| keys, which
- expect expressions in math-mode (ideally using semantic macros, of course!)
-
- \begin{mmtbox}
- The |type| and |def| keys correspond to the |type| and |definiens| components of
- \omdoc/\mmt constants.
-
- Correspondingly, the name ``type'' should be taken with a grain of salt, since
- \omdoc/\mmt -- being foundation-independent -- does not a priori implement a fixed
- typing system.
- \end{mmtbox}
-
- \symdef{funtype}[args=ai]{#1 \comp\to #2}{##1 \comp\times ##2}
- \symdef{fun}[args=bi]{#1 \comp\mapsto #2}
- \symdef{set}{\comp{\texttt{Set}}}
-
- The |type|-key allows us to provide additional information
- (given the necessary \sTeX symbols), e.g. for
- addition on natural numbers:
-
- \stexexample{%
-\symdef{Nat}[type=\set]{\comp{\mathbb N}}
-\symdef{addition}[
- type=\funtype{\Nat,\Nat}{\Nat},
- op=+,
- args=a
-]{#1}{##1 \comp+ ##2}
-
-\symname{addition} is an operation $\funtype{\Nat,\Nat}{\Nat}$
-}
-
-The |def|-key allows for declaring symbols as abbreviations:
-\stexexample{%
-\symdef{successor}[
- type=\funtype{\Nat}{\Nat},
- def=\fun{\svar{x}}{\addition{\svar{x},1}},
- op=\mathtt{succ},
- args=1
-]{\comp{\mathtt{succ(}#1\comp{)}}}
-
-The \symname{successor} operation $\funtype{\Nat}{\Nat}$
-is defined as $\fun{\svar{x}}{\addition{\svar{x},1}}$
-}
-\end{sfragment}
-
-\begin{sfragment}{Precedences and Automated Bracketing}
- Having done \stexcode"\addition", the obvious next thing to implement is
- \stexcode"\multiplication". This is straight-forward in theory:
-
- \stexexample{%
-\symdef{multiplication}[
- type=\funtype{\Nat,\Nat}{\Nat},
- op=\cdot,
- args=a
-]{#1}{##1 \comp\cdot ##2}
-
-\symname{multiplication} is an operation $\funtype{\Nat,\Nat}{\Nat}$
-}
-
-However, if we \emph{combine} \stexcode"\addition" and \stexcode"\multiplication", we
-notice a problem:
-
-\stexexample{%
-$\addition{a,\multiplication{b,\addition{c,\multiplication{d,e}}}}$
-}
-
-We all know that $\multiplication!$ binds stronger than $\addition!$, so the output
-$\addition{a,\multiplication{b,\addition{c,\multiplication{d,e}}}}$ does not actually
-reflect the term we wrote. We can of course insert parentheses manually
-
-\stexexample{%
-$\addition{a,\multiplication{b,(\addition{c,\multiplication{d,e}})}}$
-}
-but we can also do better by supplying \emph{precedences} and
-have \sTeX insert parentheses automatically.
-
-For that purpose, \stexcode"\notation" (and hence \stexcode"\symdef") take an optional
-argument |prec=<opprec>;<argprec1>x...x<argprec n>|.
-
-We will investigate the precise meaning of |<opprec>| and the |<argprec>|s shortly -- in
-the vast majority of cases, it is perfectly sufficient to think of |prec=| taking a single
-number and having that be \emph{the} precedence of the notation, where lower precedences
-(somewhat counterintuitively) bind stronger than higher precedences. So fixing our
-notations for \stexcode"\addition" and \stexcode"\multiplication", we get:
-
-\stexexample{%
-\notation{multiplication}[
- op=\cdot,
- prec=50
-]{#1}{##1 \comp\cdot ##2}
-\notation{addition}[
- op=+,
- prec=100
-]{#1}{##1 \comp+ ##2}
-
-$\addition{a,\multiplication{b,\addition{c,\multiplication{d,e}}}}$
-}
-
-Note that the precise numbers used for precedences are pretty arbitrary - what matters is
-which precedences are higher than which other precedences when used in conjunction.
-\begin{variable}{\infprec,\neginfprec}
- It is occasionally useful to have ``infinitely'' high or low precedences to enforce or
- forbid automated bracketing entirely, e.g. for bracket-like notations such as intervals
- -- for those purposes, \stexcode"\infprec" and \stexcode"\neginfprec" exist (which are
- implemented as the maximal and minimal integer values accordingly).g
-\end{variable}
-
-\begin{dangerbox}
- More precisely, each notation takes
- \begin{enumerate}
- \item One \emph{operator precedence} and
- \item one \emph{argument precedence} for each argument.
- \end{enumerate}
- By default, all precedences are $0$, unless the symbol takes no argument, in which case
- the operator precedence is \stexcode"\neginfprec" (negative infinity). If we only
- provide a single number, this is taken as both the operator precedence and all argument
- precedences.
-
- \sTeX decides whether to insert parentheses by comparing operator precedences to a
- \emph{downward precedence} $p_d$ with initial value \stexcode"\infprec". When
- encountering a semantic macro, \sTeX takes the operator precedence $p_{op}$ of the
- notation used and checks whether $p_{op}>p_d$. If so, \sTeX insert parentheses.
-
- When \sTeX steps into an argument of a semantic macro, it sets $p_d$ to the respective
- argument precedence of the notation used.
-
- In the example above:
- \begin{enumerate}
- \item \sTeX starts out with $p_d=$\stexcode"\infprec".
- \item \sTeX encounters \stexcode"\addition" with $p_{op}=100$. Since
- $100\not>$\stexcode"\infprec", it inserts no parentheses.
- \item Next, \sTeX encounters the two arguments for \stexcode"\addition". Both have no
- specifically provided argument precedence, so \sTeX uses $p_d=p_{op}=100$ for both and
- recurses.
- \item Next, \sTeX encounters \stexcode"\multiplication{b,...}", whose notation has
- $p_{op}=50$.
- \item We compare to the current downward precedence $p_d$ set by \stexcode"\addition",
- arriving at $p_{op}=50\not>100=p_d$, so \sTeX again inserts no parentheses.
- \item Since the notation of \stexcode"\multiplication" has no explicitly set argument
- precedences, \sTeX uses the operator precedence for all arguments of
- \stexcode"\multiplication", hence sets $p_d=p_{op}=50$ and recurses.
- \item Next, \sTeX encounters the inner \stexcode"\addition{c,...}" whose notation has
- $p_{op}=100$.
- \item We compare to the current downward precedence $p_d$ set by
- \stexcode"\multiplication", arriving at $p_{op}=100>50=p_d$ -- which finally prompts
- \sTeX to insert parentheses, and we proceed as before.
- \end{enumerate}
-\end{dangerbox}
-\end{sfragment}
-
-\begin{sfragment}{Variables}
- All symbol and notation declarations require a module with which they are associated,
- hence the commands \stexcode"\symdecl", \stexcode"\notation", \stexcode"\symdef"
- etc. are disabled outside of |smodule|-environments.
-
- Variables are different -- variables are allowed everywhere, are not exported when the
- current module (if one exists) is imported (via \stexcode"\importmodule" or
- \stexcode"\usemodule") and (also unlike symbol declarations) ``disappear'' at the end of
- the current \TeX\xspace group.
-
- \begin{function}{\svar}
- So far, we have always used variables using \stexcode"\svar{n}", which marks-up $n$ as
- a variable with name |n|. More generally, \stexcode"\svar[foo]{<texcode>}" marks-up
- the arbitrary |<texcode>| as representing a variable with name |foo|.
- \end{function}
-
- Of course, this makes it difficult to reuse variables, or introduce ``functional''
- variables with arities $>0$, or provide them with a type or definiens.
-
- \begin{function}{\vardef}
- For that, we can use the \stexcode"\vardef" command. Its syntax is largely the same as
- that of \stexcode"\symdef", but unlike symbols, variables have only one notation
- (\textcolor{red}{TODO: so far?}), hence there is only \stexcode"\vardef" and no
- \stexcode"\vardecl".
- \end{function}
-
-\stexexample{%
-\vardef{varf}[
- name=f,
- type=\funtype{\Nat}{\Nat},
- op=f,
- args=1,
- prec=0;\neginfprec
-]{\comp{f}#1}
-\vardef{varn}[name=n,type=\Nat]{\comp{n}}
-\vardef{varx}[name=x,type=\Nat]{\comp{x}}
-
-Given a function $\varf!:\funtype{\Nat}{\Nat}$,
-by $\addition{\varf!,\varn}$ we mean the function\rustexBREAK
-$\fun{\varx}{\varf{\addition{\varx,\varn}}}$
-}
-
-(of course, ``lifting'' addition in the way described in the previous example is an
-operation that deserves its own symbol rather than abusing \stexcode"\addition",
-but... well.)
-
-\textcolor{red}{TODO: bind=forall/exists}
-\end{sfragment}
-
-\begin{sfragment}{Variable Sequences}
- Variable \emph{sequences} occur quite frequently in informal mathematics, hence they
- deserve special support. Variable sequences behave like variables in that they disappear
- at the end of the current \TeX\xspace group and are not exported from modules, but their
- declaration is quite different.
-
- \begin{function}{\varseq}
- A variable sequence is introduced via the command \stexcode"\varseq", which takes the
- usual optional arguments |name| and |type|. It then takes a starting index, an end
- index and a \emph{notation} for the individual elements of the sequence parametric in
- an index. Note that both the starting as well as the ending index may be variables.
- \end{function}
-
- This is best shown by example:
- \stexexample{%
-\vardef{varn}[name=n,type=\Nat]{\comp{n}}
-\varseq{seqa}[name=a,type=\Nat]{1}{\varn}{\comp{a}_{#1}}
-
-The $i$th index of $\seqa!$ is $\seqa{i}$.
-}
-
-Note that the syntax |\seqa!| now automatically generates a presentation based on the
-starting and ending index.
-
-\textcolor{red}{TODO: more notations for invoking sequences}.
-
-\vardef{varn}[name=n,type=\Nat]{\comp{n}}
-\varseq{seqa}[name=a]{1}{\varn}{\comp{a}_{#1}}
-
-Notably, variable sequences are nicely compatible with |a|-type arguments, so we can do
-the following:
-
-\stexexample{%
-$\addition{\seqa}$
-}
-
-Sequences can be \emph{multidimensional} using the |args|-key, in which case the
-notation's arity increases and starting and ending indices have to be provided as a
-comma-separated list:
-
-\stexexample{%
-\vardef{varm}[name=m,type=\Nat]{\comp{m}}
-\varseq{seqa}[
- name=a,
- args=2,
- type=\Nat,
-]{1,1}{\varn,\varm}{\comp{a}_{#1}^{#2}}
-
-$\seqa!$ and $\addition{\seqa}$
-}
-\vardef{varm}[name=m,type=\Nat]{\comp{m}}
-
-We can also explicitly provide a ``middle'' segment to be used, like such:
-
-\stexexample{%
-\varseq{seqa}[
- name=a,
- type=\Nat,
- args=2,
- mid={\comp{a}_{\varn}^1,\comp{a}_1^2,\ellipses,\comp{a}_{1}^{\varm}}
-]{1,1}{\varn,\varm}{\comp{a}_{#1}^{#2}}
-
-$\seqa!$ and $\addition{\seqa}$
-}
-\end{sfragment}
-\end{smodule}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-% LocalWords: binarysymbol newbinarysymbol hl,args a,b,c,d,e ascendingchain assoc binl
-% LocalWords: a,assoc binr x,y,z conj a,b,c,d pwconj funtype succ prec opprec argprec1
-% LocalWords: argprec texcode varf varn n,type varx x,type varseq seqa a,type th m,type
diff --git a/macros/latex/contrib/stex/doc/packages/stex-terms.tex b/macros/latex/contrib/stex/doc/packages/stex-terms.tex
deleted file mode 100644
index 759b3f5fdd..0000000000
--- a/macros/latex/contrib/stex/doc/packages/stex-terms.tex
+++ /dev/null
@@ -1,177 +0,0 @@
-\begin{smodule}{SymbolsInText}
- \symdef{set}{\comp{\texttt{Set}}}
-
- Given a symbol declaration \stexcode"\symdecl{symbolname}",
- we obtain a semantic macro \stexcode"\symbolname".
- We can use this semantic macro in math mode to use its notation(s),
- and we can use \stexcode"\symbolname!"
- in math mode to use its operator notation(s).
- What else can we do?
-
-\begin{sfragment}{\texttt{\textbackslash symref} and its variants}
-
- \begin{function}{\symref,\symname}
- We have already seen \stexcode"\symname" and
- \stexcode"\symref", the latter being the more general.
-
- \stexcode"\symref{<symbolname>}{<code>}" marks-up |<code>|
- as referencing |<symbolname>|. Since quite often, the |<code>|
- should be (a variant of) the name of the symbol anyway,
- we also have \stexcode"\symname{<symbolname>}".
- \end{function}
-
- Note that \stexcode"\symname" uses the \emph{name}
- of a symbol, not its macroname. More precisely,
- \stexcode"\symname" will insert the name of the symbol
- with ``|-|'' replaced by spaces.
- If a symbol does not have
- an explicit |name=| given, the two are equal -- but
- for \stexcode"\symname" it often makes sense to make the
- two explicitly distinct. For example:
- \stexexample{%
-\symdef{Nat}[
- name=natural-number,
- type=\set
-]{\comp{\mathbb{N}}}
-
-A \symname{Nat} is...
- }
-
- \stexcode"\symname" takes two additional optional
- arguments, |pre=| and |post=| that get prepended or appended
- respectively to the symbol name.
-
- \begin{function}{\Symname}
- Additionally, \stexcode"\Symname" behaves exactly
- like \stexcode"\symname", but will capitalize the first
- letter of the name:
- \end{function}
- \stexexample{%
-\Symname[post=s]{Nat} are...
- }
-
- \begin{dangerbox}
- This is as good a place as any other to explain how
- \sTeX resolves a string |symbolname| to an actual symbol.
-
- If \stexcode"\symbolname" is a semantic macro, then
- \sTeX has no trouble resolving |symbolname| to the full
- URI of the symbol that is being invoked.
-
- However, especially in \stexcode"\symname" (or if a symbol
- was introduced using \stexcode"\symdecl*" without
- generating a semantic macro), we might
- prefer to use the \emph{name} of a symbol directly for
- readability -- e.g. we would want to write
- \stexcode"A \symname{natural-number} is..." rather than
- \stexcode"A \symname{Nat} is...". \sTeX attempts to handle
- this case thusly:
-
- If |string| does \emph{not} correspond to a semantic
- macro \stexcode"\string" and does \emph{not}
- contain a |?|, then \sTeX checks
- all symbols currently in scope until it finds one,
- whose name is |string|. If |string| is of the
- form |pre?name|, \sTeX first looks through all modules
- currently in scope, whose full URI ends with |pre|,
- and then looks for a symbol with name |name| in those.
- This allows
- for disambiguating more precisely, e.g. by
- saying \stexcode"\symname{Integers?addition}"
- or \stexcode"\symname{RealNumbers?addition}" in the
- case where several |addition|s are in scope.
- \end{dangerbox}
-\end{sfragment}
-
-\symdef{addition}[op=+,prec=100,args=2]{#1 \comp+ #2}
-\symdef{multiplication}[op=\cdot,prec=50,args=a]{#1}{##1 \comp\cdot ##2}
-
-\begin{sfragment}{Marking Up Text and On-the-Fly Notations}
- We can also use semantic macros outside of text mode though,
- which allows us to annotate arbitrary text fragments.
-
- Let us assume again, that we have
- \stexcode"\symdef{addition}[args=2]{#1 \comp+ #2}". Then we
- can do
- \stexexample{%
-\addition{\comp{The sum of} \arg{$\svar{n}$} \comp{ and }\arg{$\svar{m}$}}
-is...
- }
- ...which marks up the text fragment as representing
- an \emph{application} of the |addition|-symbol to two
- argument $\svar{n}$ and $\svar{m}$.
-
- \begin{mmtbox}
- As expected, the above example is translated to \omdoc/\mmt
- as an |OMA| with |<OMS name="...?addition"/>| as head and
- |<OMV name="n"/>| and |<OMV name="m"/>| as arguments.
- \end{mmtbox}
-
- \begin{dangerbox}
- Note the difference in treating ``arguments'' between math mode and text mode. In
- math mode the (in this case two) tokens/groups following the \stexcode|\addition|
- macro are treated as arguments to the addition function, whereas in text mode the
- group following \stexcode|\addition| is taken to be the ad-hoc presentation. We
- drill in on this now.
- \end{dangerbox}
-
- \begin{function}{\arg}
- In text mode, every semantic macro takes exactly one
- argument, namely the text-fragment to be annotated.
- The \stexcode"\arg" command is only valid within the
- argument to a semantic macro and marks up the
- \emph{individual arguments} for the symbol.
- \end{function}
-
- We can also use semantic macros in text mode to invoke
- an operator itself instead of its application, with the
- usual syntax using |!|:
- \stexexample{%
-\addition!{Addition} is...
- }
-
- Indeed, \stexcode"\symbolname!{<code>}" is exactly equivalent to
- \stexcode"\symref{symbolname}{<code>}" (the latter is in fact implemented in terms of
- the former).
-
- \stexcode"\arg" also allows us to switch the order of arguments
- around and ``hide'' arguments: For example, \stexcode"\arg[3]{<code>}"
- signifies that |<code>| represents the \emph{third}
- argument to the current operator, and \stexcode"\arg*[i]{<code>}"
- signifies that |<code>| represents the $i$th argument, but it
- should not produce any output (it is exported in the |xhtml|
- however, so that \mmt and other systems can pick up on it).\ednote{MK: I do not
- understand why we have to/want to give the second arg*; I think this must be
- elaborated on.}
- \stexexample{%
-\addition{\comp{adding}
- \arg[2]{$\svar{k}$}
- \arg*{$\addition{\svar{n}}{\svar{m}}$}} yields...
- }
- Note that since the second \stexcode"\arg" has no explicit argument
- number, it automatically represents the first not-yet-given
- argument -- i.e. in this case the first one.\ednote{MK: I do not understand this at
- all. }
-
- \paragraph{} The same syntax can be used in math mod as well. This allows us to
- spontaneously introduce new notations on the fly. We can activate it using the starred
- variants of semantic macros:
-
- \stexexample{%
-Given $\addition{\svar{n}}{\svar{m}}$, then
-$\addition*{
- \arg*{\addition{\svar{n}}{\svar{m}}}
- \comp{+}
- \arg{\svar{k}}
-}$ yields...
- }
-
-\end{sfragment}
-\end{smodule}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "../stex-manual"
-%%% End:
-
-% LocalWords: prec cdot,prec 50,args th
diff --git a/macros/latex/contrib/stex/doc/packages/stex-tikzinput.tex b/macros/latex/contrib/stex/doc/packages/stex-tikzinput.tex
index ac321f129c..8539ab4e5d 100644
--- a/macros/latex/contrib/stex/doc/packages/stex-tikzinput.tex
+++ b/macros/latex/contrib/stex/doc/packages/stex-tikzinput.tex
@@ -9,7 +9,7 @@
The selective input functionality of the \pkg{tikzinput} package assumes that the TIKZ
pictures are externalized into a standalone picture file, such as the following one
-\begin{latexcode}
+\begin{stexcode}
\documentclass{standalone}
\usepackage{tikz}
\usetikzpackage{...}
@@ -18,7 +18,7 @@ pictures are externalized into a standalone picture file, such as the following
...
\end{tikzpicture}
\end{document}
-\end{latexcode}
+\end{stexcode}
The \pkg{standalone} class is a minimal {\LaTeX} class that when loaded in a document
that uses the \pkg{standalone} package: the preamble and the |documenat| environment
@@ -43,7 +43,7 @@ pictures are externalized into a standalone picture file, such as the following
\begin{function}{\mhtikzinput,\cmhtikzinput}
|\mhtizkinput| is a variant of |\tikzinput| that treats its file path argument as a
- relative path in a math archive in analogy to \stexcode|\inputref|. To give the archive
+ relative path in a math archive in analogy to \stexcodeinline|\inputref|. To give the archive
path, we use the |mhrepos=| key. Again, |\cmhtizkinput| is a version of |\mhtikzinput|
that is centered.
\end{function}
@@ -51,8 +51,8 @@ pictures are externalized into a standalone picture file, such as the following
\begin{function}{\libusetikzlibrary}
Sometimes, we want to supply archive-specific TIKZ libraries in the |lib| folder of the
archive or the |meta-inf/lib| of the archive group. Then we need an analogon to
- \stexcode|\libinput| for \stexcode|\usetikzlibrary|. The \pkg{stex-tikzinput} package
- provides the \stexcode|libusetikzlibrary| for this purpose.
+ \stexcodeinline|\libinput| for \stexcodeinline|\usetikzlibrary|. The \pkg{stex-tikzinput} package
+ provides the \stexcodeinline|libusetikzlibrary| for this purpose.
\end{function}
%%% Local Variables:
diff --git a/macros/latex/contrib/stex/doc/stex-abstract.tex b/macros/latex/contrib/stex/doc/stex-abstract.tex
deleted file mode 100644
index f342bbf907..0000000000
--- a/macros/latex/contrib/stex/doc/stex-abstract.tex
+++ /dev/null
@@ -1,26 +0,0 @@
-\begin{abstract}
- \sTeX is a collection of {\LaTeX} packages that allow to markup documents semantically
- without leaving the document format.
-
- Running `pdflatex` over sTeX-annotated documents formats them into normal-looking
- PDF. But sTeX also comes with a conversion pipeline into semantically annotated HTML5,
- which can host semantic added-value services that make the documents active
- (i.e. interactive and user-adaptive) and essentially turning {\LaTeX} into a document
- format for (mathematical) knowledge management (MKM).
-
- \sTeX augments {\LaTeX} with
- \begin{itemize}
- \item \emph{semantic macros} that denote and distinguish between mathematical concepts,
- operators, etc. independent of their notational presentation,
- \item a powerful \emph{module system} that allows for authoring and importing individual
- fragments containing document text and/or semantic macros, independent of -- and
- without hard coding -- directory paths relative to the current document, and
- \item a mechanism for exporting \sTeX documents to (modular) XHTML, preserving all the
- semantic information for semantically informed knowledge management services.
- \end{itemize}
-\end{abstract}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "stex-manual"
-%%% End:
diff --git a/macros/latex/contrib/stex/doc/stex-devel.tex b/macros/latex/contrib/stex/doc/stex-devel.tex
new file mode 100644
index 0000000000..972775ad12
--- /dev/null
+++ b/macros/latex/contrib/stex/doc/stex-devel.tex
@@ -0,0 +1,1799 @@
+\begin{smodule}{Aux Macros}
+
+ \begin{dangerbox}
+ Keeping the implementation properly up-to-date is pretty much
+ incompatible with the kinds of workflows systemically enforced
+ in academia. Any of the following may be out of date.
+ \end{dangerbox}
+
+ \STEXexport{
+ \stex_sms_allow_escape:N \stexmacro
+ \protected\def\stexmacro#1{
+ \stex_execute_in_module:x{\tl_set:cn{l_stex_stexmacro_\tl_to_str:n{#1}_path}{\l_stex_current_module_str?\tl_to_str:n{#1}}}
+ \exp_args:NNx\symdecl*{\tl_to_str:n{#1}}
+ \exp_args:Nx\notation{\tl_to_str:n{#1}}{\comp{\texttt{\textbackslash\detokenize{#1}}}}
+ }
+ \protected\def\stexvarmacro#1{
+ \tl_set:cx{l_stex_stexvarmacro_\tl_to_str:n{#1}_var}{\tl_to_str:n{#1}}
+ \exp_args:Nnx\use:nn{\vardef}{
+ {\tl_to_str:n{varmacro_#1}}[name={\tl_to_str:n{#1}}]{
+ \noexpand\comp{\hbox{\noexpand\texttt{\noexpand\textbackslash\noexpand\detokenize{#1}}}}
+ }
+ }
+ }
+ \stex_sms_allow_escape:N \stexenv
+ \protected\def\stexenv#1{
+ \stex_execute_in_module:x{\tl_set:cn{l_stex_stexenv_\tl_to_str:n{#1}_path}{\l_stex_current_module_str?\tl_to_str:n{#1}}}
+ \exp_args:NNx\symdecl*{\tl_to_str:n{#1}}
+ \exp_args:Nx\notation{\tl_to_str:n{#1}}{\noexpand\texttt{\noexpand\detokenize{#1}}}
+ }
+
+ \cs_set_nopar:Nn \_stexdoc_do_cs:nn {
+ \tl_if_exist:cTF{l_stex_stexvarmacro_\tl_to_str:n{#1}_var}{
+ \exp_args:Nx \varref{\use:c{l_stex_stexvarmacro_\tl_to_str:n{#1}_var}}{#2}
+ }{
+ \tl_if_exist:cTF{l_stex_stexmacro_\tl_to_str:n{#1}_path}{
+ \exp_args:Nx \symref{\use:c{l_stex_stexmacro_\tl_to_str:n{#1}_path}}{#2}
+ }{#2}
+ }
+ }
+
+ \RenewDocumentCommand\cmd { O{} m }
+ { \_stexdoc_do_cs:nn{#2}{\__codedoc_cmd:no {#1} { \token_to_str:N #2 }} }
+ \RenewDocumentCommand \cs { O{} m }
+ { \_stexdoc_do_cs:nn{#2}{\__codedoc_cmd:no {#1} { \c_backslash_str #2 }} }
+ \RenewDocumentCommand \tn { O{} m }
+ { \_stexdoc_do_cs:nn{#2}{
+ \@@_cmd:no
+ { module = TeX , replace = false , #1 }
+ { \c_backslash_str #2 }
+ }}
+ \protected\def\env#1{
+ \tl_if_exist:cTF{l_stex_stexenv_\tl_to_str:n{#1}_path}{
+ \exp_args:Nx \symref{\use:c{l_stex_stexenv_\tl_to_str:n{#1}_path}}{\texttt{\tl_to_str:n{#1}}}
+ }{\texttt{\tl_to_str:n{#1}}}
+ }
+
+ \cs_set_protected:Nn \_stexdoc_dcs: {
+ \peek_charcode:NTF [ {
+ \_stexdoc_dcs:w
+ }{
+ \exp_args:NNe \use:nn \_stexdoc_dcs:w {[\seq_item:Nn \_stexdoc_sfunction_seq 1]}
+ }
+ }
+
+ \cs_set_protected:Npn \_stexdoc_dcs:w [#1] {
+ \exp_args:Ne \definiendum{\tl_to_str:n{#1}}{\exp_args:Nne \__codedoc_cmd:nn {} { \c_backslash_str \tl_to_str:n{ #1 } }}
+ \xspace
+ }
+
+ \ProvideDocumentEnvironment {sfunction}{m O{} +v}{
+ \seq_set_split:Nnn \_stexdoc_sfunction_seq , {#1}
+ \seq_map_inline:Nn \_stexdoc_sfunction_seq {
+ \stex_pseudogroup_with:nn{\stex_smsmode_do:}{\def\stex_smsmode_do:{}\stexmacro{##1}}
+ }
+ \cs_set_eq:NN \dcs \_stexdoc_dcs:
+ \ifstexhtml
+ \def\box_move_up:nn##1##2{\tex_raise:D\__box_dim_eval:n{0pt}##2}
+ \renewenvironment{syntax}{\noindent}{\par}
+ \fi
+ \begin{sparagraph}[style=symdoc,for={#1}]
+ \__codedoc_function:nnw{#2}{#3}
+ }{
+ \stex_if_smsmode:F{\__codedoc_function_end:}
+ \end{sparagraph}
+ }
+ \stex_sms_allow_env:n{sfunction}
+
+ \ProvideDocumentEnvironment { svariable } { m +v }
+ {
+ \seq_set_split:Nnn \_stexdoc_sfunction_seq , {#1}
+ \seq_map_inline:Nn \_stexdoc_sfunction_seq {
+ \stex_pseudogroup_with:nn{\stex_smsmode_do:}{\def\stex_smsmode_do:{}\stexmacro{##1}}
+ }
+ \cs_set_eq:NN \dcs \_stexdoc_dcs:
+ \ifstexhtml
+ \def\box_move_up:nn##1##2{\tex_raise:D\__box_dim_eval:n{0pt}##2}
+ \renewenvironment{syntax}{\noindent}{\par}
+ \fi
+ \begin{sparagraph}[style=symdoc,for={#1}]
+ \bool_if:NTF \l__codedoc_in_implementation_bool
+ { \__codedoc_macro:nnw { var , } {#2} }
+ { \__codedoc_function:nnw {} {#2} }
+ }
+ {
+ \bool_if:NTF \l__codedoc_in_implementation_bool
+ { \__codedoc_macro_end: }
+ { \__codedoc_function_end: }
+ \end{sparagraph}
+ }
+ \stex_sms_allow_env:n{svariable}
+
+ \ProvideDocumentEnvironment {senv} {m} {
+ \def\denv{\exp_args:Ne\definiendum{\tl_to_str:n{#1}}{\texttt{\tl_to_str:n{#1}}}}
+ \stex_pseudogroup_with:nn{\stex_smsmode_do:}{\def\stex_smsmode_do:{}\stexenv{#1}}
+ \begin{sparagraph}[style=symdoc,for={#1}]
+ \exp_args:Ne\DescribeEnv{\tl_to_str:n{#1}}
+ }{
+ \end{sparagraph}\par\smallskip
+ }
+ \stex_sms_allow_env:n{senv}
+ }
+
+ \CodedocExplain
+
+ %^^A\CodedocExplainEXP
+ %^^A\CodedocExplainREXP
+ %^^A\CodedocExplainTF
+
+ \begin{sfunction}{stex_debug:nn}{\stex_debug:nn}
+ \begin{syntax}
+ \dcs \marg{prefix} \marg{msg}
+ \end{syntax}
+ Logs the debug message \marg{msg} under the prefix
+ \marg{prefix}. A message is shown if its prefix
+ is in a list of prefixes given either via the
+ package option |debug=|\meta{prefixes} or
+ the environment variable |STEX_DEBUG=|\meta{prefixes},
+ where the latter overrides the former.
+ \end{sfunction}
+
+ \begin{sfunction}{_stex_do_deprecation:n}{\_stex_do_deprecation:n}
+ TODO \dcs
+ \end{sfunction}
+
+\begin{sfragment}{Documents}
+
+ \begin{svariable}{l_stex_docheader_sect}{\l_stex_docheader_sect}
+ integer register keeping track of the current sectioning level:
+ \begin{itemize}
+ \item[0] part
+ \item[1] chapter
+ \item[2] section
+ \item[3] subsection
+ \item[4] subsubsection
+ \item[5] paragraph
+ \item[$>5$] subparagraph
+ \end{itemize}
+ \cs{setsectionlevel} sets \cs{l_stex_docheader_sect} to the corresponding
+ integer value.
+ \end{svariable}
+
+ \begin{sfunction}{stex_ref_new_doc_target:n}{\stex_ref_new_doc_target:n}
+ internal variant of \cs{sreflabel}. If the argument is empty,
+ the label is determined to be |REF|\meta{counter}
+ and \meta{counter} is increased.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_ref_new_symbol:n}{\stex_ref_new_symbol:n}
+ registers a new link target for the symbol with the given full uri
+ (as string), using the |url-base|-field of the current
+ archive's manifest file to link the symbol to
+ \meta{url-base}|/symbol?|\meta{uri}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_ref_new_sym_target:n}{\stex_ref_new_sym_target:n}
+ sets a new label for the symbol with the given full uri (as string).
+ If called in sms-mode, defers to \cs{stex_ref_new_symbol:n},
+ if not already registered.
+ Otherwise, sets a \cs{label} for the symbol.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_ref_new_sym_target:nn}{\stex_ref_new_sym_target:nn}
+ \begin{syntax}\dcs\marg{symbol}\marg{target}
+ \end{syntax}
+ redirects links for \meta{symbol} to the one for the symbol
+ \meta{target}. Useful for e.g. symbols elaborated from
+ structural features. Note that this acts as a \emph{default},
+ in that previous or subsequent
+ calls of \cs{stex_ref_new_sym_target:n}\marg{symbol}
+ are prioritized.
+
+ Requires that either \cs{stex_ref_new_sym_target:n}\marg{target}
+ or
+ \cs{stex_ref_new_sym_target:nn}\marg{target}\marg{other-target}
+ have been called previously.
+ \end{sfunction}
+
+\end{sfragment}
+
+\begin{sfragment}{Modules}
+
+ \stexmacro{stex_module_add_symbol:nnnnnnN}
+ \stexmacro{stex_add_module_notation:nnnnn}
+ \stexmacro{stex_module_add_morphism:nnn}
+
+ The contents of a module with full URI
+ \meta{uri} are represented as four macros:
+ \begin{itemize}
+ \item |\c_stex_module_|\meta{uri}|_code|: code to be executed
+ every time the module is \emph{activated}; e.g. the contents
+ of \cs{STEXexport}, defines semantic macros and macros for
+ notations, activates dependency modules, etc.
+ \item |\c_stex_module_|\meta{uri}|_morphisms_prop|: property list
+ containing all module dependencies of this module
+ (see \cs{stex_module_add_morphism:nnn}).
+ \item |\c_stex_module_|\meta{uri}|symbols_prop|: property list
+ containing all declarations in this module (see \cs{stex_module_add_symbol:nnnnnnN}).
+ \item |\c_stex_module_|\meta{uri}|_notations_prop|: property list
+ containing all notations introduced in this module
+ (see \cs{stex_add_module_notation:nnnnn}).
+ \end{itemize}
+
+ \begin{svariable}{l_stex_current_module_str}{\l_stex_current_module_str}
+ contains the full URI of the current module.
+ \end{svariable}
+
+ \begin{svariable}{l_stex_all_modules_seq}{\l_stex_all_modules_seq}
+ contains the full URIs of all modules currently in scope.
+ \end{svariable}
+
+ \stexvarmacro{l_stex_key_sig_str}
+ \begin{sfunction}{stex_module_setup:n}{\stex_module_setup:n}
+ \begin{syntax} \dcs\marg{name} \end{syntax}
+ Computes the full URI of a new module with name \meta{name}
+ in the current namespace, initializes the
+ four macros above and sets \cs{l_stex_current_module_str}
+ accordingly. Also takes care of correct naming for nested
+ modules, activates the meta theory and loads the signature module
+ if |sig=| was provided (according to \cs{l_stex_key_sig_str}).
+ \end{sfunction}
+
+ \stexmacro{stex_persist:n}
+ \begin{sfunction}{stex_close_module:}{\stex_close_module:}
+ closes the current module; checks whether we are currently in
+ sms mode, and if so, calls \cs{stex_persist:n}
+ to write the module contents to the sms-file.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_every_module:n}{\stex_every_module:n}
+ \begin{syntax}\dcs\marg{code}\end{syntax}
+ executes \meta{code} every time a new module is opened.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_if_in_module:}[pTF]{\stex_if_in_module:}
+ tests whether we are currently in a module.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_if_module_exists:n}[pTF]{\stex_if_module_exists:n}
+ tests whether a module with the given full URI exists, in the sense
+ of \emph{has been parsed at some point in the current document}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_activate_module:n}{\stex_activate_module:n,\stex_activate_module:o,\stex_activate_module:x}
+ activates the module with the given full URI \emph{if and only if}
+ it has not already been activated in the current scope.
+ \end{sfunction}
+
+ \stexmacro{stex_metagroup_do_in:nn}
+
+ \begin{sfunction}{stex_execute_in_module:n}{\stex_execute_in_module:n,\stex_execute_in_module:x}
+ executes the provided code, adds it to the current module
+ activation code, and makes
+ sure the macros defined in it are valid in the current module
+ \TeX\ group level.
+ \end{sfunction}
+
+ This macro is a combination of the following two macros:
+
+ \begin{sfunction}{stex_do_up_to_module:n}{\stex_do_up_to_module:n,\stex_do_up_to_module:x}
+ executes the provided code such that all definitions in it
+ are valid in the current module regardless of \TeX\ group level
+ (using \cs{stex_metagroup_do_in:nn}).
+ \end{sfunction}
+
+ \begin{sfunction}{stex_module_add_code:n}{\stex_module_add_code:n,\stex_module_add_code:x}
+ adds the provided code to the module's
+ |\c_stex_module_|\meta{uri}|_code|-macro.
+ \end{sfunction}
+
+\end{sfragment}
+
+\begin{sfragment}{Symbols}
+
+ A symbol in \stex is represented as a tuple of several components:
+
+ \stexvarmacro{id}
+ \stexvarmacro{invokation_macro}
+ \stexmacro{_stex_invoke_symbol:nnnnnnnN}
+
+ \begin{sfunction}{stex_module_add_symbol:nnnnnnnN}{\stex_module_add_symbol:nnnnnnnN}
+ \begin{arguments}
+ \item \meta{id}: An \emph{identifier} (possibly empty) that determines its
+ semantic macro name, or e.g. in \env{mathstructure} its
+ accessor-identifier (if empty, the name is used for that),
+ \item \meta{name} a unique \emph{name}, which in combination with the
+ containing module determines its URI as \meta{module-URI}|?|\meta{name},
+ \item \meta{arity} a numeric string in the range |0..9|,
+ \item \meta{args} a list of argument specifiers of the form
+ \meta{i}\meta{mode}|{|\meta{argname}|}| (the length of \meta{args}
+ must be $3\cdot$\meta{arity}),
+ \item \meta{definiens} (or empty),
+ \item \meta{type} (or empty),
+ \item \meta{return code} (or empty), and
+ \item \meta{\cs{invokation_macro}}.
+ \end{arguments}
+
+ the arguments are stored in the property list
+ \cs{c_stex_module_}\meta{\cs{l_stex_current_module}}|_symbols_prop|
+ under key \meta{name}.
+
+ If the identifier \meta{id} is non-empty, the macro
+ \cs{id} is defined as |{|\cs{_stex_invoke_symbol:nnnnnnnN}|}|
+ with the arguments described there.
+
+ \begin{texnote} \cs{invokation_macro} must be \cs{protected}.
+ \end{texnote}
+ \end{sfunction}
+
+ \begin{sfunction}{stex_iterate_symbols:n,stex_iterate_break:,stex_iterate_break:n}{\stex_iterate_symbols:n,\stex_iterate_break:,\stex_iterate_break:n}
+ \begin{syntax}\dcs\marg{code}\end{syntax}
+ iterates over all symbols currently in scope and calls
+ \meta{code} for all of them with arguments
+ \marg{module}\marg{name}\marg{arity}\meta{args}\marg{definiens}
+ \marg{type}\marg{return code}\marg{\cs{invokation_macro}}.
+
+ Iteration can be stopped prematurely with
+ \dcs[stex_iterate_break:] and can stop and return code
+ with \dcs[stex_iterate_break:n].
+ \end{sfunction}
+
+ \begin{sfunction}{stex_iterate_symbols:nn}{\stex_iterate_symbols:nn}
+ \begin{syntax}\dcs\marg{csl}\marg{code}\end{syntax}
+ iterates over all symbols in the provided \meta{csl}
+ of full module URIs. \meta{code}
+ receives the same arguments as \cs{stex_iterate_symbols:n},
+ but iteration can not be stopped early.
+ \end{sfunction}
+
+ \begin{sfunction}{
+ stex_get_symbol:n,
+ l_stex_get_symbol_mod_str,
+ l_stex_get_symbol_name_str,
+ l_stex_get_symbol_arity_int,
+ l_stex_get_symbol_args_tl,
+ l_stex_get_symbol_def_tl,
+ l_stex_get_symbol_type_tl,
+ l_stex_get_symbol_return_tl,
+ l_stex_get_symbol_invoke_cs
+ }{\stex_get_symbol:n,
+ \l_stex_get_symbol_mod_str,
+ \l_stex_get_symbol_name_str,
+ \l_stex_get_symbol_arity_int,
+ \l_stex_get_symbol_args_tl,
+ \l_stex_get_symbol_def_tl,
+ \l_stex_get_symbol_type_tl,
+ \l_stex_get_symbol_return_tl,
+ \l_stex_get_symbol_invoke_cs
+ }
+ \dcs attemps to find a symbol with the given name or id
+ that is currently in scope.
+ A name may be prefixed with a module name/path separated by |?|.
+
+ Throws an error if no such symbol is found; otherwise, sets the
+ listed |\l_stex_get_symbol_...|-macros to the components of the
+ found symbol.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_if_check_terms:}[pTF]{\stex_if_check_terms:}
+ whether to typeset declaration components (notations, types,
+ definientia etc.) in a throwaway box. Is true iff
+ the backend is |pdflatex| and
+ either the |STEX_CHECKTERMS| environment variable
+ or |checkterms| package option is set.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_check_term:n}{\stex_check_term:n}
+ typesets the argument in a throwaway box in math mode
+ iff \cs{stex_if_check_terms:} is true.
+
+ Is deactivated in sms-mode.
+ \end{sfunction}
+
+ \begin{sfunction}{
+ stex_symdecl_do:,
+ l_stex_key_name_str,
+ l_stex_key_args_str,
+ l_stex_key_argnames_clist,
+ l_stex_assoc_args_count,
+ l_stex_argnames_seq
+ }{\stex_symdecl_do:,
+ \l_stex_key_name_str,
+ \l_stex_key_args_str,
+ \l_stex_key_argnames_clist,
+ \l_stex_assoc_args_count,
+ \l_stex_argnames_seq
+ }
+ \dcs processes the shared (mandatory and optional) arguments
+ of e.g. \cs{symdecl}, \cs{symdef}, \cs{vardef} etc.
+
+ Requires the following macros to be set
+ \begin{itemize}
+ \item \dcs[l_stex_key_name_str]: the name of the symbol,
+ \item \dcs[l_stex_key_args_str]: the |args|-string (e.g.
+ |3| or |ai|)
+ \item \dcs[l_stex_key_argnames_clist]: a list of \emph{names}
+ for the arguments, the length of which should be $\leq$ the
+ arity of the symbol
+ \end{itemize}
+
+ and will generate the following macros:
+ \begin{itemize}
+ \item \cs{l_stex_get_symbol_arity_int}: the arity of the symbol,
+ \item \dcs[l_stex_key_args_str]: the args string as a
+ definite sequence of argument-mode characters, whose
+ length is the arity of the symbol; e.g.
+ |3| is turned into |iii|,
+ \item \dcs[l_stex_assoc_args_count]: the number of
+ sequence arguments (i.e. |a| or |B| mode),
+ \item \dcs[l_stex_argnames_seq]: the full sequence of
+ argument names; those not provided by
+ \cs{l_stex_key_argnames_clist} are set to be
+ |$j|\iffalse$\fi, where |j| is the index of the
+ argument,
+ \item \cs{l_stex_get_symbol_args_tl}: a token list of
+ triples |jm{|\meta{argname}|}|, where |j| is the index and
+ |m| the respective argument mode character (i.e. |i|, |a|,
+ |b| or |B|).
+ \end{itemize}
+ \end{sfunction}
+
+ \begin{sfunction}{_stex_symdecl_check_terms:,
+ l_stex_key_type_tl,l_stex_key_def_tl}{\_stex_symdecl_check_terms:}
+ calls \cs{stex_check_term:n} for
+ the type and definiens stored in \cs{l_stex_key_type_tl} and
+ \cs{l_stex_key_def_tl}
+ \end{sfunction}
+
+ \stexmacro{stex_invoke_symbol:}
+ \begin{sfunction}{stex_symdecl_top:n,l_stex_macroname_str}{\stex_symdecl_top:n}
+ \begin{syntax}\dcs\marg{maybename}\end{syntax}
+ checks whether \cs{l_stex_key_name_str} is empty,
+ and if so, sets it to be \meta{maybename}.
+ Then calls \cs{stex_symdecl_do:} and
+ \cs{_stex_symdecl_check_terms:}, writes the components to the HTML
+ (if applicable) and adds the symbol to the current module
+ with invokation macro \cs{stex_invoke_symbol:} and id/macroname
+ \cs{l_stex_macroname_str}.
+ \end{sfunction}\bigskip
+
+ Variables work very similar to symbols, except that their declarations
+ are local to the current \TeX-group rather than the
+ current module, and they are not exported in modules.
+
+ \begin{svariable}{l_stex_variables_prop}{\l_stex_variables_prop}
+ stores all variables currently in scope as a property list
+ with key \meta{name} and value
+ \marg{id}\marg{name}\marg{arity}\meta{args}\marg{definiens}
+ \marg{type}\marg{return code}\marg{\cs{invokation_macro}}.
+
+ The invokation macro for ``normal'' variables declared with
+ \cs{vardef} is \cs{stex_invoke_symbol:}.
+ \end{svariable}
+
+ \begin{sfunction}{_stex_vardecl_notation_macro:}{\_stex_vardecl_notation_macro:}
+ generates the notation macro for a variable, based on the
+ values of the |\l_stex_key|-macros und \cs{l_stex_notation_macrocode_cs}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_get_var:n}{\stex_get_var:n}
+ like \cs{stex_get_symbol:n}, but attempts to retrieve a
+ variables and throws an error if none is found.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_get_symbol_or_var:n}{\stex_get_symbol_or_var:n}
+ like \cs{stex_get_symbol:n}, but first attempts
+ to find a \emph{variable}, and if none is found,
+ defers to \cs{stex_get_symbol:n}.
+ \end{sfunction}
+
+\end{sfragment}
+
+
+\begin{sfragment}{Notations}
+
+ \stexmacro{stex_set_notation_macro:nnnnn}
+ \begin{sfunction}{stex_module_add_notation:nnnnn}{\stex_module_add_notation:nnnnn, \stex_module_add_notation:eoexo}
+ \begin{syntax}\dcs
+ \marg{symboluri}\marg{id}\marg{arity}\meta{code}\meta{op code}
+ \end{syntax}
+ stores the arguments in the property list
+ \cs{c_stex_module_}\meta{\cs{l_stex_current_module}}|_notations_prop|
+ under key \meta{symboluri}|!|\meta{id} and calls
+ \cs{stex_set_notation_macro:nnnnn}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_set_notation_macro:nnnnn}{\stex_set_notation_macro:nnnnn,\stex_set_notation_macro:eoexo}
+ \begin{syntax}\dcs
+ \marg{symboluri}\marg{id}\marg{arity}\meta{code}\meta{op code}
+ \end{syntax}
+ Declares the following macros:
+
+ An active notation for a symbol with uri \meta{symboluri} and id
+ \meta{id} is represented as
+ a macro \cs{l_stex_notation_}\meta{symboluri}|_|\meta{id}|_cs|,
+ that takes \meta{arity} many argument
+ and expands to \meta{code},
+ and (if nonempty) an \emph{operator} notation as
+ a macro \cs{l_stex_notation_}\meta{symboluri}|_op_|\meta{id}|_cs|
+ that expands to \meta{op code}.
+
+ The default notation is represented as the \emph{empty} id.
+ If the correponding macros
+ \cs{l_stex_notation_}\meta{symboluri}|__cs|,
+ and \cs{l_stex_notation_}\meta{symboluri}|_op__cs| do not yet exist,
+ they are now defined as \meta{id}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_iterate_notations:nn}{\stex_iterate_notations:nn}
+ \begin{syntax}\dcs\marg{csl}\marg{code}\end{syntax}
+ iterates over all notations in the provided \meta{csl}
+ of full module URIs and calls \meta{code} on each of them with
+ arguments
+ \marg{symboluri}\marg{id}\marg{arity}\meta{code}\meta{op code}.
+ \end{sfunction}
+
+ \begin{sfunction}{
+ stex_notation_parse_and_then:nw,
+ l_stex_key_prec_str,
+ l_stex_key_variant_str,
+ l_stex_notation_macrocode_cs
+ }{\stex_notation_parse_and_then:nw,
+ \l_stex_key_prec_str,
+ \l_stex_key_variant_str,
+ \l_stex_notation_macrocode_cs
+ }
+ \begin{syntax}\dcs\marg{code}\meta{notations}
+ \end{syntax}
+
+ parses a notation (which may consist of multiple
+ braced components, depending on the argument modes)
+ and subsequently calls \meta{code}.
+
+ Requires the following macros to be set:
+ \begin{itemize}
+ \item \cs{l_stex_get_symbol_arity_int},
+ \item \cs{l_stex_get_symbol_args_tl},
+ \item \dcs[l_stex_key_prec_str]: The precedence string
+ as provided by a user in the optional |precs|-argument,
+ \item \dcs[l_stex_key_variant_str]: the id of the
+ notation variant.
+ \end{itemize}
+
+ Stores the final notation in the macro
+ \dcs[l_stex_notation_macrocode_cs] taking
+ \cs{l_stex_get_symbol_arity_int} many arguments.
+ \end{sfunction}\bigskip
+
+
+ Some thing to consider when we generate a notation macro:
+ \begin{itemize}
+ \item The notation macro generated by the \cs{notation}-command
+ should contain the variant identifier and the precedences,
+ as these are intrinsic parts of the notation.
+ \item It should
+ \emph{not} contain the symbol itself however, so that
+ notations can be copied between symbols.
+ \item Notations as provided by users will largely adhere
+ to the standard \LaTeX\ category code scheme, and
+ \item notations need to be ``persistable'' in |.deps|-files.
+ \end{itemize}
+
+ We therefore want to augment the simple code provided by
+ a user by various ``annotations'' that contain the
+ relevant information (such as precedences) and to mark
+ the argument positions for semantic extractions, but we should
+ adhere to the default \LaTeX\ category code scheme in doing
+ so.
+
+ \begin{sfunction}{
+ STEXInternalTermMathArgiii,
+ STEXInternalTermMathOMSOrOMViii,
+ STEXInternalTermMathAssocArgiiiii,
+ STEXInternalAssocArgMarkerI,
+ STEXInternalAssocArgMarkerII,
+ STEXInternalTermMathOMAiii,
+ STEXInternalTermMathOMBiii,
+ STEXInternalSymbolAfterInvokationTL
+ }{
+ \STEXInternalTermMathArgiii,
+ \STEXInternalTermMathAssocArgiiiii,
+ \STEXInternalAssocArgMarkerI,
+ \STEXInternalAssocArgMarkerII,
+ \STEXInternalTermMathOMSOrOMViii,
+ \STEXInternalTermMathOMAiii,
+ \STEXInternalTermMathOMBiii,
+ \STEXInternalSymbolAfterInvokationTL
+ }
+
+ In \openmath/\OMDoc, there are (for our purposes)
+ three kinds of expressions that an application of a semantic macro
+ -- and hence a notation macro -- can represent, each of which
+ corresponds to a macro taking care of the semantic annotations:
+ \begin{itemize}
+ \item |OMS/OMV|: a simple symbol (arity 0) (\dcs[STEXInternalTermMathOMSOrOMViii])
+ \item |OMA|: an application of a symbol to argument (arity $>0$,
+ \dcs[STEXInternalTermMathOMAiii])
+ \item |OMB|: a binding application of a symbol that
+ binds/declares one or more variables (argument string contains
+ |b| or |B|, \dcs[STEXInternalTermMathOMBiii]).
+ \end{itemize}
+
+ The arguments are marked with \dcs[STEXInternalTermMathArgiii]
+ (|i| or |b|) or \dcs[STEXInternalTermMathAssocArgiiiii] (|a|
+ or |B|). Finally, the notation is closed with
+ \dcs[STEXInternalSymbolAfterInvokationTL].
+
+ How this works is best explained by example.
+ \end{sfunction}
+
+
+ \begin{sexample}
+ Assume we have a symbol and notation:
+ \begin{stexcode}
+\symdecl{somesymbol}[args=iai]
+\notation{somesymbol}[prec=10;20x30x40,variant=foo]
+{First: #1; Second: #2; Third: #3; End}
+{(#1 -- ##1 split ##2 -- #3)}
+ \end{stexcode}
+
+ Since the symbol corresponds to an |OMA|, the whole notation
+ is wrapped in \cs{STEXInternalTermMathOMAiii}, taking as
+ arguments the variant identifier (|foo|),
+ the operator precedence (|10|) and the body of the notation.
+
+ The second argument in the notation, being associative,
+ is wrapped in a \cs{STEXInternalTermMathAssocArgiiiii},
+ taking as arguments the argument number (|2|), the
+ precedence (|30|), the \TeX\ parameter token (|#2|)
+ the notation body (|(#1 -- ##1 split ##2 -- #3)|), and finally
+ the argument mode (|a|). Additionally, the markers |##1|
+ and |##2| are replaced by \cs{STEXInternalAssocArgMarkerI}
+ and \cs{STEXInternalAssocArgMarkerII}, respectively.
+
+ Subsequently, the non-sequence parameter tokens
+ are wrapped in \cs{STEXInternalTermMathArgiii} with
+ arguments |mj| (where |m| is the mode und |j| the index),
+ the precedence (|20| or |40| respectively), and the
+ parameter token.
+
+ Finally, a \cs{STEXInternalSymbolAfterInvokationTL}
+ is inserted.
+
+ The final expansion of \cs{l_stex_notation_macrocode_cs}
+ is thus:
+ \begin{stexcode}
+\STEXInternalTermMathOMAiii{foo}{10}{
+ First: \STEXInternalTermMathArgiii{i1}{20}{#1};
+ Second: \STEXInternalTermMathAssocArgiiiii{2}{30}{#2}{
+ (\STEXInternalTermMathArgiii{i1}{20}{##1} --
+ \STEXInternalAssocArgMarkerI split
+ \STEXInternalAssocArgMarkerII --
+ \STEXInternalTermMathArgiii{i3}{40}{##3})
+ }{a};
+ Third: \STEXInternalTermMathArgiii {i3}{40}{#3}; End
+}\STEXInternalSymbolAfterInvokationTL
+ \end{stexcode}
+ \end{sexample}
+
+ \begin{sfunction}{stex_notation_top:nnw}{\stex_notation_top:nnw}
+ \begin{syntax}\dcs\marg{symboluri}\marg{code}\end{syntax}
+ calls \cs{stex_notation_parse_and_then:nw}\marg{code}
+ and, adds the notation for the symbol with
+ URI \meta{symboluri} to the current module and
+ exports it to the HTML (if applicable).
+ \end{sfunction}
+
+\end{sfragment}
+
+\begin{sfragment}{Structural Features}
+
+ \begin{sfunction}{stex_structural_feature_module:nn,
+ stex_structural_feature_module_end:,
+ g_stex_last_feature_str
+ }{\stex_structural_feature_module:nn,
+ \stex_structural_feature_module_end:,
+ \g_stex_last_feature_str
+ }
+ \begin{syntax}\dcs\marg{name}\marg{typeid}\end{syntax}
+ opens a new module-like structural feature of type \meta{typeid}
+ with name \meta{name}, which needs to be closed with
+ \dcs[stex_structural_feature_module_end:].
+
+ Its body behaves like a nested module with name
+ \meta{modulename}|/|\meta{name}, the full URI of which is
+ stored in \dcs[g_stex_last_feature_str] for
+ subsequent elaboration.
+ \end{sfunction}
+
+ \begin{sfunction}{
+ stex_structural_feature_morphism:nnnnn,
+ stex_structural_feature_morphism_end:,
+ l_stex_current_domain_str,
+ l_stex_feature_name_str,
+ l_stex_morphism_symbols_prop,
+ l_stex_morphism_renames_prop,
+ l_stex_morphism_morphisms_seq
+ }{
+ \stex_structural_feature_morphism:nnnnn,
+ \stex_structural_feature_morphism_end:,
+ \l_stex_current_domain_str,
+ \l_stex_feature_name_str,
+ \l_stex_morphism_symbols_prop,
+ \l_stex_morphism_renames_prop,
+ \l_stex_morphism_morphisms_seq
+ }
+ \begin{syntax}\dcs\marg{moprhismname}\marg{typeid}\marg{archive}\marg{domain}\marg{annotations}\end{syntax}
+ opens a new morphism-like structural feature of type \meta{typeid}
+ with name \meta{morphismname} and the module
+ |[|\meta{archive}|]|\marg{domain} as domain, which needs to be closed with
+ \dcs[stex_structural_feature_morphism_end:].
+
+ Deactivates \cs{symdecl}, \cs{textsymdecl},
+ \cs{symdef}, \cs{notation} and \env{smodule}, and activates
+ \cs{assign}, \cs{assignMorphism} and \cs{renamedecl}.
+
+ Defines the following macros:
+ \begin{itemize}
+ \item \dcs[l_stex_feature_name_str]|=|\marg{name}.
+ \item \dcs[l_stex_current_domain_str]|=| the full uri of \meta{domain}.
+ \item \dcs[l_stex_morphism_symbols_prop]: This property list is
+ initialized as follows: For every symbol
+ transitively included in \meta{domain} with data
+ \meta{module}, \meta{name}, \meta{id}, \meta{arity}, \meta{args},
+ \meta{definiens}, \meta{type}, and \meta{return code},
+ the property list contains an entry with key
+ |[|\meta{module}|]/[|\meta{name}|]|
+ and value \marg{id}\marg{arity}\marg{args}\marg{definiens}
+ \marg{type}\marg{return code}.
+ \item \dcs[l_stex_morphism_renames_prop]: An initially empty
+ property list.
+ \item \dcs[l_stex_morphism_morphisms_seq]: TODO
+ \end{itemize}
+
+ At \dcs[stex_structural_feature_morphism_end:], the elaboration
+ is computed from the above data thusly:
+
+ For every entry in \dcs[l_stex_morphism_symbols_prop],
+ a new symbol is created with the values \meta{arity}, \meta{args},
+ \meta{definiens}, \meta{type} and \meta{return code} from that
+ property list, and either:
+ \begin{itemize}
+ \item if \dcs[l_stex_morphism_renames_prop] does \emph{not}
+ contain an entry with key \meta{module}|?|\meta{name},
+ then the elaborated name is \meta{morphismname}|/|\meta{name}
+ and its \meta{id} is empty (no semantic macro is generated), or
+ \item if \dcs[l_stex_morphism_renames_prop] contains an
+ entry with key \meta{module}|?|\meta{name}, then its value
+ needs to be of the form \marg{id}\marg{name}, which are
+ used for the elaborated symbol.
+ \end{itemize}
+ All notations of the symbols transitively included in the domain
+ are copied over to their elaborations.
+ \end{sfunction}
+
+\end{sfragment}
+
+\begin{sfragment}{Imports and Morphisms}
+
+ \begin{sfunction}{stex_module_add_morphism:nnnn}{\stex_module_add_morphism:nnnn, \stex_module_add_morphism:nonn, \stex_module_add_morphism:ooox}
+ adds a new module morphism (i.e. inheritance, possibly with
+ modification) to the current module
+ \begin{arguments}
+ \item The name of the morphism (may be empty for e.g. \cs{importmodule},
+ but may be named for e.g. \env{copymodule}),
+ \item the URI of the module being ``imported'',
+ \item the ``type'' of the morphism (e.g. |import| or |copymodule|),
+ \item a list of assignments as pairs
+ |{|\meta{source}|}{|\meta{target}|}| that signify that
+ the symbol with full URI \meta{source} is being mapped or elaborated to
+ the new symbol with name \meta{target} in the current module.
+ May be empty for e.g. \cs{importmodule}.
+ \end{arguments}
+ The provided arguments are stored in
+ |\c_stex_module_|\meta{uri}|_morphisms_prop|
+ with key |#1| (if non-empty) or |[#2]| (if |#1| is empty)
+ and value |{#1}{#2}{#3}{#4}|
+ \end{sfunction}\bigskip
+
+ Import-like statements in \sTeX are usually given
+ as pairs |[|\meta{archive}|]{|\meta{path}|?|\meta{module}|}|,
+ which be relative to the current archive and/or
+ file path. For persistence and sms-mode, these
+ pairs first need to be resolved into an \emph{absolute}
+ specification:
+
+ \begin{sfunction}{
+ stex_import_module_uri:nn,
+ l_stex_import_archive_str,
+ l_stex_import_name_str,
+ l_stex_import_uri_str,
+ l_stex_import_path_str
+ }{
+ \stex_import_module_uri:nn,
+ \l_stex_import_archive_str,
+ \l_stex_import_name_str,
+ \l_stex_import_uri_str,
+ \l_stex_import_path_str
+ }
+ \begin{syntax}\dcs\marg{archive}\marg{pathstring}\end{syntax}
+ (where \meta{archive} may be empty) resolves the given arguments
+ into:
+ \begin{itemize}
+ \item \dcs[l_stex_import_archive_str] the given archive id
+ (in which case \cs{stex_require_archive:n} is called),
+ or the id of the current archive (if existent and \meta{archive}
+ empty), or empty,
+ \item \dcs[l_stex_import_uri_str] if an archive id is given,
+ or we currently are in an archive, its corresponding
+ namespace; otherwise |{file:}|,
+ \item \dcs[l_stex_import_path_str] the path of the URI
+ relative to the given (or current) archive, or (if not existent)
+ the absolute path of \meta{pathstring} (without a module name)
+ resolved relative to the current file's parent directory, and
+ \item \dcs[l_stex_import_name_str] the name of the module.
+ \end{itemize}
+ If \meta{pathstring} does not contain the character |?|,
+ the whole pathstring is assumed to be the name of the module
+ and the path is empty (or the current file's parent directory,
+ depending on the above).
+ \end{sfunction}
+
+ \begin{sfunction}{stex_import_require_module:nnn}{\stex_import_require_module:nnn}
+ takes as arguments values
+ \cs{l_stex_import_archive_str}, \cs{l_stex_import_path_str}
+ and \cs{l_stex_import_name_str} as computed by
+ \cs{stex_import_module_uri:nn} and
+ (optionally loads and) activates the corresponding
+ module (or throws an error if it does not exist).
+ \end{sfunction}\bigskip
+
+ Most complex morphisms (\env{copymodule} et al) are implemented
+ as structural features
+ using \cs{stex_structural_feature_morphism:nnnn}.
+
+ \begin{sfunction}{stex_get_in_morphism:n,
+ l_stex_get_symbol_macro_str}{\stex_get_in_morphism:n,
+ \l_stex_get_symbol_macro_str}
+ finds a symbol with the provided name or id in the domain
+ of the current morphism. Sets the same macros as
+ \cs{stex_get_symbol:n}, and additionaly
+ \dcs[l_stex_get_symbol_macro_str] to the \meta{id}
+ of the symbol. Throws an error if no such symbol is found.
+ \end{sfunction}
+
+\end{sfragment}
+
+\begin{sfragment}{Expressions and Semantic Macros}
+
+ \begin{sfunction}{_stex_invoke_symbol:nnnnnnnN,
+ l_stex_current_symbol_str,
+ l_stex_current_arity_str,
+ l_stex_current_args_tl,
+ l_stex_current_return_tl,
+ l_stex_current_type_tl
+ }{\_stex_invoke_symbol:nnnnnnnN
+ \l_stex_current_symbol_str,
+ \l_stex_current_arity_str,
+ \l_stex_current_args_tl,
+ \l_stex_current_return_tl,
+ \l_stex_current_type_tl
+ }
+ \begin{syntax}\dcs
+ \marg{module}\marg{name}\marg{arity}\marg{args}\marg{definiens}
+ \marg{type}
+ \marg{return code}
+ \marg{\cs{invokation_macro}}
+ \end{syntax}
+ is how a semantic macro is/should be defined.
+ \dcs first checks whether semantic macros are currently allowed,
+ and throws an error if not. Otherwise, it
+ sets the \cs{comp}-controlled highlighting to \cs{compemph@uri},
+ initializes \cs{STEXInternalSymbolAfterInvokationTL},
+ defines the following macros for all of its arguments, and subsequently
+ calls the \cs{invokation_macro}:
+ \begin{itemize}
+ \item \dcs[l_stex_current_symbol_str]|={|\meta{module}|?|\meta{name}|}|
+ \item \dcs[l_stex_current_arity_str]|=|\marg{arity}
+ \item \dcs[l_stex_current_args_tl]|=|\marg{args}
+ \item \dcs[l_stex_current_type_tl]|=|\marg{type}
+ \item \dcs[l_stex_current_return_tl]|=|\marg{return code}
+ \end{itemize}
+
+ The simplest example for an \cs{invokation_macro} is
+ \cs{stex_invoke_symbol:}.
+ \end{sfunction}
+
+ \begin{sfunction}{_stex_invoke_variable:nnnnnnN}{\_stex_invoke_variable:nnnnnnN}
+ analogous to \cs{_stex_invoke_symbol:nnnnnnnN}, but for variables;
+ sets the \cs{comp}-controlled highlighting to \cs{varemph@uri}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_invoke_symbol:}{\stex_invoke_symbol:}
+ branches based on the mode and following characters:
+ \begin{itemize}
+ \item If math, check next character:
+ \begin{itemize}
+ \item[!] operator; defer to operator notation
+ \item[else] defer to notation and check the value of
+ \cs{l_stex_current_return_tl}=\meta{return}.
+ \begin{itemize}
+ \item If \meta{return} is empty, call the notation macro,
+ \item otherwise, call \meta{return}|{|\cs{stex_invoke_symbol}|!}|.
+ \end{itemize}
+ \end{itemize}
+ \item If text:
+ \end{itemize}
+ \end{sfunction}
+
+ \begin{sfunction}{stex_invoke_sequence_range:,
+ stex_invoke_sequence_in:
+ }{
+ \stex_invoke_sequence_range:,
+ \stex_invoke_sequence_in:
+ }
+ TODO
+ \end{sfunction}
+
+\end{sfragment}
+
+
+\begin{sfragment}{Optional (Key-Value) Argument Handling}
+ \LaTeX3 is surprisingly weak when it comes to handling
+ optional (key-val) arguments in such a manner that
+ \emph{only} the freshly set macros are defined, and to modularly
+ build up sets of argument keys. The following macros attempt
+ to fix that:
+
+ \begin{sfunction}{stex_keys_define:nnnn,stex_keys_set:nn}{\stex_keys_define:nnnn,\stex_keys_set:nn}
+ \begin{syntax}
+ \dcs\marg{id}\marg{setup code}
+ \marg{keyval setup code}\marg{parents}
+ \end{syntax}
+ Defines a set of keys and their allowed values with
+ identifier |stex/|\meta{id}, that inherits from
+ the sets with identifiers in \meta{parents}.
+
+ \dcs[stex_keys_set:nn]\marg{id}\marg{CSL} first executes
+ \meta{setup code} (e.g. to empty the macros holding the values)
+ and then sets the keys in
+ set \meta{id} with the values provided in \meta{CSL}.
+ \end{sfunction}
+
+ \stexvarmacro{l_stex_key_id_str}
+
+ \begin{sfunction}{_stex_do_id:}{\_stex_do_id:}
+ should be called whenever a macro or environment has a label id,
+ i.e. calls \cs{stex_keys_set:nn}|{id}{...}|, after
+ the title has been typeset. Sets a \cs{label} by calling
+ \cs{stex_ref_new_doc_target:n}\marg{id}.
+ \end{sfunction}
+
+ \begin{sexample}
+ If we define a set of keys with:
+ \stexvarmacro{l_stex_key_archive_str}
+ \stexvarmacro{l_stex_key_file_str}
+ \begin{stexcode}[gobble=6]
+ |\cs{stex_keys_define:nnnn}|{archive file}{
+ \str_clear:N |\cs{l_stex_key_archive_str}|
+ \str_clear:N |\cs{l_stex_key_file_str}|
+ }{
+ archive .str_set_x:N = |\cs{l_stex_key_archive_str}| ,
+ file .str_set_x:N = |\cs{l_stex_key_file_str}|
+ }{id}
+ \end{stexcode}
+ then calling \cs{stex_keys_set:nn}|{archive file}{id=foo,file=bar}|
+ sets \cs{l_stex_key_file_str}|={bar}|, assures that
+ \cs{l_stex_key_archive_str} is empty, and executes the
+ code associated with |id|, i.e. it sets
+ \cs{l_stex_key_id_str}|={foo}|.
+ \end{sexample}
+
+\end{sfragment}
+
+\begin{sfragment}{Stylable Commands and Environments}
+
+ \stexmacro{stex_style_apply:}
+
+ \begin{sfunction}{stex_new_stylable_cmd:nnnn,l_stex_key_style_clist}{\stex_new_stylable_cmd:nnnn}
+ \begin{syntax}
+ \dcs\marg{name}\marg{arity}\marg{code}
+ \marg{default}
+ \end{syntax}
+ Creates a new macro \cs{}\meta{name} with expansion \meta{code} taking
+ \meta{arity} many arguments, that is customizable in presentation
+ by a user by calling \cs{stexstyle}\meta{name}.
+ On calling
+ \cs{stex_style_apply:} executes the presentation code provided
+ by a user.
+
+ \meta{code} should:
+ \begin{itemize}
+ \item Call \cs{stex_keys_set:nn}|{style}{...}| (or a keyset inheriting
+ from |style|),
+ \item set macros with prefix |\this...| that a user might want
+ to use for presentation (e.g. \cs{thistitle}),
+ \item call \cs{stex_style_apply:} at some point.
+ \end{itemize}
+ \end{sfunction}
+
+ \begin{sfunction}{stex_new_stylable_env:nnnnnnn}{\stex_new_stylable_env:nnnnnnn}
+ \begin{syntax}
+ \dcs\marg{name}\marg{arity}\marg{begincode}
+ \marg{endcode}\marg{default begin}\marg{default end}\marg{prefix}
+ \end{syntax}
+
+ Like \cs{stex_new_stylable_cmd:nnnn}, but defines a new environment
+ |{|\meta{prefix}\meta{name}|}| stylable via
+ \cs{stexstyle}\meta{name}. Should call \cs{stex_style_apply:} twice;
+ once in the \meta{begincode} and once in \meta{endcode}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_style_apply:}{\stex_style_apply:}
+ Sets \cs{thisstyle} to be the head of the CSL
+ \cs{l_stex_key_style_clist} and checks whether a style
+ for the current stylable macro/environment has been defined;
+ if not, executes the code for the default style.
+ \end{sfunction}
+
+ \begin{sexample}
+ \cs{importmodule} is defined something like the following:
+ \begin{stexcode}[gobble=6]
+ |\cs{stex_new_stylable_cmd:nnnn}|{importmodule}{O{} m}{
+ ...
+ \def|\cs{thismoduleuri}|{...}
+ \def|\cs{thismodulename}|{...}
+ |\cs{stex_style_apply:}|
+ ...
+ }{}
+ \end{stexcode}
+ A user can then customize the output generated by \cs{importmodule}
+ (by default none) via
+ \cs{stexstyleimportmodule}|{...|\cs{thismodulename}|...}|.
+ \end{sexample}
+
+ \begin{sexample}
+ \env{smodule} does something like
+ \begin{stexcode}[gobble=6]
+ |\cs{stex_new_stylable_env:nnnnnnn}|{module}{O{} m}{
+ ...
+ \def|\cs{thismoduleuri}|{...}
+ \def|\cs{thismodulename}|{...}
+ |\cs{stex_style_apply:}|
+ ...
+ }{
+ ...
+ |\cs{stex_style_apply:}|
+ ...
+ }{}{}{s}
+ \end{stexcode}
+ which defines the environment name to be \env{smodule} and
+ generates \cs{stexstylemodule}.
+ \end{sexample}
+
+\end{sfragment}
+
+\begin{sfragment}{Math Archives}
+ Math archives are represented as \LaTeX3 property lists,
+ the keys/values of which correspond to the entries in the
+ archive's manifest file. The most important fields are
+ \begin{itemize}
+ \item |id|,
+ \item |narr| the document namespace,
+ \item |ns| the content namespace, and
+ \item |docurl| the document URL base.
+ \end{itemize}
+
+ \stexvarmacro{target}
+ \begin{sfunction}{stex_resolve_path_pair:Nnn}{\stex_resolve_path_pair:Nnn,\stex_resolve_path_pair:Nxx}
+ \begin{syntax}\dcs\marg{\cs{target}}\marg{archive-id}\marg{pathstring}
+ \end{syntax}
+ computes the absolute file path of
+ \meta{pathstring} relative
+ to the |source|-folder of \meta{archive-id} (if non-empty),
+ or the current archive (if existent) or the parent working
+ directory (otherwise), and stores the result in \cs{target}.
+ \end{sfunction}
+
+ \begin{svariable}{l_stex_current_archive_prop}{\l_stex_current_archive_prop}
+ \dcs always points to the current math archive or is \cs{undefined},
+ if the current file is not part of a math archive.
+ \end{svariable}
+
+ \begin{svariable}{c_stex_main_archive_prop}{\c_stex_main_archive_prop}
+ \dcs represents the math archive in which the main file
+ resides (if existent).
+ \end{svariable}
+
+ \begin{sfunction}{stex_require_archive:n}{\stex_require_archive:n,\stex_require_archive:o}
+ \begin{syntax}\dcs\marg{id}
+ \end{syntax}
+ looks for a math archive \meta{id} in the MathHub directory,
+ parses its manifest file, creates the corresponding property
+ list |\c_stex_mathhub_|\meta{id}|_manifest_prop|,
+ and throws a fatal error if the archive is not found.
+
+ If the archive has been found and parsed before, does nothing,
+ so it is cheap and safe to call repeatedly for the same id.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_set_current_archive:n}{\stex_set_current_archive:n}
+ \begin{syntax}\dcs\marg{id}
+ \end{syntax}
+ Calls \cs{stex_require_archive:n}\marg{id} and sets
+ \cs{l_stex_current_archive_prop}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_in_archive:nn}{\stex_in_archive:nn}
+ \begin{syntax}\dcs\marg{opt-id}\marg{code}
+ \end{syntax}
+ Executes \meta{code} in the context of math archive \meta{opt-id}
+ (using \cs{stex_require_archive:n}), i.e.
+ iff \meta{opt-id} is non-empty, changes the current archive
+ to the one with id \meta{opt-id},
+ call \meta{code} with \meta{opt-id} as argument (in |#1|) and changes
+ it back afterwards.
+
+ If \meta{opt-id} is empty, \meta{code} is called with the id
+ of the \emph{current} math archive as |#1|, or with |#1| empty
+ if there is no current math archive.
+ \end{sfunction}
+
+\end{sfragment}
+
+\begin{sfragment}{SMS-Mode}
+ \stex has to extract formal content (i.e. modules and their symbols)
+ from \LaTeX-files, that may otherwise contain arbitrary
+ code, including macros that may not be defined unless
+ the file is fully processed by \TeX. Those
+ modules and symbols also may depend on other modules that have not yet
+ been loaded. The naive way to achieve this, which would
+ be to just suppress output (e.g. by storing it in a box register)
+ and then \cs{input} the required file, does not work thanks to
+ \TeX's limited \emph{file stack}, which would overflow quickly
+ for modules that have a deeply nested list of dependencies.
+
+ To solve those problems, \sTeX reads dependencies in what we call
+ \emph{sms mode}, which can be summarized thusly:
+ \begin{itemize}
+ \item In a first pass, we parse the file token by token, ignoring everything
+ other than a select list of macros and environments that
+ introduce dependencies (such as \cs{importmodule} and
+ \cs{begin}|{|\env{smodule}|}[sig=...]|). Instead of loading
+ those, we remember them for later.
+ \item After the file as been fully parsed thusly, the
+ dependencies found are loaded, again in sms-mode.
+ \item In a second pass, we parse the file \emph{again} in the same way, but
+ this time execute all macros that are explicitly allowed
+ in sms mode, such as \cs{importmodule}, \cs{symdecl},
+ \cs{notation}, \cs{symdef}, etc.
+ \item all this parsing happens additionally in a
+ \cs{setbox}\cs{throwaway}\cs{vbox}|{...}|-block to
+ suppress any accidental output.
+ \end{itemize}
+ This means that \TeX's input stack never grows by more
+ than $+1$, but still behaves \emph{as if} the dependencies
+ were loaded recursively, at the detriment of being somewhat slow.
+
+ \begin{sfunction}{stex_if_smsmode:}[pTF]{\stex_if_smsmode:}
+ tests for whether we are currently in sms-mode.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_file_in_smsmode:nn}{\stex_file_in_smsmode:nn,\stex_file_in_smsmode:on}
+ \begin{syntax}\dcs\marg{filestring}\marg{setup-code}\end{syntax}
+ sets up sms-mode and internal grouping, calls
+ \meta{setup-code} and subsequently processes the file
+ \meta{filestring} in sms-mode as described above.
+ \end{sfunction}
+
+ \begin{sfragment}{Second Pass}
+
+ \stexvarmacro{macro}
+
+ \begin{sfunction}{stex_sms_allow:N}{\stex_sms_allow:N}
+ \begin{syntax}\dcs\marg{\cs{macro}}\end{syntax}
+ registers the \cs{macro}-command to be allowed in sms mode.
+
+ This only works, if \cs{macro} takes no arguments and/or
+ does not touch the subsequent tokens.
+ \end{sfunction}
+
+ For macros taking arguments, we can use
+
+ \stexmacro{stex_smsmode_do:}
+
+ \begin{sfunction}{stex_sms_allow_escape:N}{\stex_sms_allow_escape:N}
+ \begin{syntax}\dcs\marg{\cs{macro}}\end{syntax}
+ registers the \cs{macro}-command to be allowed in sms mode.
+
+ If \cs{macro} is subsequently encountered in sms-mode,
+ parsing is halted and \cs{macro} can process arguments as desired.
+ It then needs to continue parsing manually though, by calling
+ \cs{stex_smsmode_do:} as (usually) its last token.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_sms_allow_env:n}{\stex_sms_allow_env:n}
+ \begin{syntax}\dcs\marg{envname}\end{syntax}
+ registers the environment \meta{envname} to be allowed in sms mode.
+
+ As with \cs{stex_sms_allow_escape:N}, the \cs{begin}|{|\meta{envname}|}|
+ is escaped, hence the begin-code of the environment needs to call
+ \cs{stex_smsmode_do:}. Since
+ \cs{end}|{|\meta{envname}|}| never takes arguments, it does not
+ need to be escaped.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_smsmode_do:}{\stex_smsmode_do:}
+ continues with sms-mode-style parsing. Does nothing if not in
+ sms-mode, and is therefore safe to be called ``just in case''.
+ \end{sfunction}
+
+ \end{sfragment}
+ \begin{sfragment}{First Pass}
+
+ \stexmacro{g_stex_sms_import_code}
+ \begin{sfunction}{stex_sms_allow_import:Nn,stex_sms_allow_import_env:nn}{\stex_sms_allow_import:Nn,\stex_sms_allow_import_env:nn}
+ behave like \cs{stex_sms_allow_escape:N} and
+ \cs{stex_sms_allow_env:n} respectively, but the macro or environment
+ provided is now allowed in the \emph{first} pass of sms-mode.
+
+ This macro should process arguments, add content to
+ \cs{g_stex_sms_import_code}, and finally call \cs{stex_smsmode_do:}.
+
+ The code provided in the \emph{second} argument is called
+ before the first pass of sms-mode, as to set up functionality
+ for these macros. For example, \cs{importmodule}
+ provides code that redefines \cs{importmodule} to
+ store the identified dependency in
+ \cs{g_stex_sms_import_code} instead of activating it directly.
+ \end{sfunction}
+
+ \begin{svariable}{g_stex_sms_import_code}{\g_stex_sms_import_code}
+ is built up in the first pass of sms mode and called subsequently;
+ before the second pass.
+
+ Code in this token list should load and activate dependencies
+ found in the first pass.
+ \end{svariable}
+
+ \end{sfragment}
+
+\end{sfragment}
+
+\begin{sfragment}{Strings, File Paths, URIs}
+
+ \begin{sfunction}{stex_str_if_starts_with:nn}[pTF]{\stex_str_if_starts_with:nn}
+ \begin{syntax}\dcs\marg{first}\marg{second}
+ \end{syntax}
+ Checks whether the string \meta{first} starts with the string
+ \meta{second} (i.e. \meta{second} is a prefix of \meta{first}).
+ \end{sfunction}
+
+ \begin{sfunction}{stex_str_if_ends_with:nn}[pTF]{\stex_str_if_ends_with:nn}
+ \begin{syntax}\dcs\marg{first}\marg{second}
+ \end{syntax}
+ Checks whether the string \meta{first} ends with the string
+ \meta{second} (i.e. \meta{second} is a suffix of \meta{first}).
+ \end{sfunction}
+
+ \begin{sfragment}{File Paths}
+
+ \emph{File paths} are represented as \LaTeX3 sequences. The following
+ methods make sure to
+ \begin{itemize}
+ \item canonicalize paths, i.e. resolve |..| and |.| segments,
+ \item set all category codes to 12 (other), and
+ \item tranform windows file paths containing |\| uniformly to |/|.
+ \end{itemize}
+
+ \stexvarmacro{macro}
+ \begin{sfunction}{stex_file_resolve:Nn}{\stex_file_resolve:Nn, \stex_file_resolve:No, \stex_file_resolve:Nx}
+ \begin{syntax}\dcs\marg{\cs{macro}}\marg{string}
+ \end{syntax}
+ resolves and canonicalizes the file path string \meta{string} and
+ stores the result in \cs{macro}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_file_set:Nn}{\stex_file_set:Nn, \stex_file_set:No, \stex_file_set:Nx}
+ \begin{syntax}\dcs\marg{\cs{macro}}\marg{string}
+ \end{syntax}
+ represents an already canonicalized file path string as a
+ \LaTeX3 sequence and stores it in \cs{macro}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_if_file_absolute:N}[pTF]{\stex_if_file_absolute:N}
+ \dcs tests whether the given file path (represented as a canonicalized
+ \LaTeX3 sequence) is an absolute file path.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_file_use:N}[EXP]{\stex_file_use:N}
+ \dcs expands to a string representation of the given file path.
+ \end{sfunction}
+
+ \stexvarmacro{first}
+ \stexvarmacro{second}
+ \begin{sfunction}{stex_if_file_starts_with:NN}[TF]{\stex_if_file_starts_with:NN}
+ \begin{syntax}\dcs\marg{\cs{first}}\marg{\cs{second}}
+ \end{syntax}
+ tests whether the file path \cs{first} is a child of \cs{second}.
+ \emph{(Not expandable)}
+ \end{sfunction}
+
+ \stexvarmacro{source}
+ \stexvarmacro{target}
+ \begin{sfunction}{stex_file_split_off_ext:NN}{\stex_file_split_off_ext:NN}
+ \begin{syntax}\dcs\marg{\cs{target}}\marg{\cs{source}}
+ \end{syntax}
+ splits off the file extension of \cs{source} and stores the resulting
+ file path in \cs{target}
+ \end{sfunction}
+
+ \begin{sfunction}{stex_file_split_off_lang:NN}{\stex_file_split_off_lang:NN}
+ \begin{syntax}\dcs\marg{\cs{target}}\marg{\cs{source}}
+ \end{syntax}
+ checks whether the file path \cs{source} ends with a language
+ abbreviation (e.g. |.en|), if so removes it, and stores the result
+ in \cs{target}.
+ \end{sfunction}
+
+ The following are primarily used in file hooks,
+ but might occasionally be useful to call manually:
+
+ \stexmacro{g_stex_current_file}
+ \stexmacro{c_stex_main_file}
+
+ \begin{sfunction}{stex_filestack_push:n}{\stex_filestack_push:n}
+ pushes the given file to the file stack, recomputing
+ \cs{g_stex_current_file}, the current language,
+ document URI and namespace.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_filestack_pop:}{\stex_filestack_pop:}
+ pops the current top entry of the file stack. If the file stack
+ is empty, resets to \cs{c_stex_main_file}.
+ \end{sfunction}
+
+ \begin{sfragment}{File Path Constants and Variables}
+
+ \begin{svariable}{c_stex_pwd_file,c_stex_main_file}{\c_stex_pwd_file,\c_stex_main_file}
+ store the parent working directory and
+ the absolute path of the main file being processed
+ (with guessed file extension |.tex|).
+ \end{svariable}
+
+ \begin{svariable}{c_stex_home_file}{\c_stex_home_file}
+ stores the user's home directory.
+ \end{svariable}
+
+ \begin{svariable}{c_stex_mathhub_file}{\c_stex_mathhub_file}
+ stores the user's MathHub directory;
+ its string representation is stored in \cs{mathhub}.
+ \end{svariable}
+
+ \begin{svariable}{g_stex_current_file}{\g_stex_current_file}
+ always points to the \emph{current} file.
+ \end{svariable}
+
+ \end{sfragment}
+
+ \end{sfragment}
+
+ \begin{sfragment}{URIs}
+
+ \stexmacro{__stex_path_auth:n}
+ \stexmacro{__stex_path_path:n}
+ \stexmacro{__stex_path_module:n}
+ \stexmacro{__stex_path_name:n}
+ \stexmacro{stex_uri_resolve:Nn}
+ \begin{sparagraph}[style=symdoc,for={__stex_path_auth:n,%
+ __stex_path_path:n,__stex_path_module:n,__stex_path_name:n}]
+ \mmt URIs are represented
+ as token lists of the form
+
+ |{|\cs{__stex_path_auth:n}\marg{authority}
+ \cs{__stex_path_path:n}\marg{path}
+ \cs{__stex_path_module:n}\marg{modulename}
+ \cs{__stex_path_name:n}\marg{declname}|}|,
+
+ all of which may be empty. Largely, URIs are used as strings only,
+ but the above representation is used in \cs{stex_uri_resolve:Nn}
+ to canonicalize URIs when they are computed the first time.
+
+ \end{sparagraph}
+
+ \stexvarmacro{uri}
+ \begin{sfunction}{stex_map_uri:Nnnnn}{\stex_map_uri:Nnnnn}
+ \begin{syntax}
+ \dcs\marg{\cs{uri}}\marg{authority code}
+ \marg{path code}\marg{modulename code}\marg{declname code}
+ \end{syntax}
+ executes the provided \meta{code}s with the components
+ of the \cs{uri} as arguments.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_uri_resolve:Nn}{\stex_uri_resolve:Nn, \stex_uri_resolve:No, \stex_uri_resolve:Nx}
+ behaves analogously to \cs{stex_file_resolve:Nn}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_uri_set:Nn}{\stex_uri_set:Nn, \stex_uri_set:No, \stex_uri_set:Nx}
+ behaves analogously to \cs{stex_file_set:Nn}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_uri_use:N}[EXP]{\stex_uri_use:N}
+ behaves analogously to \cs{stex_file_use:N}.
+ \end{sfunction}
+
+ A common usage of URIs is computing the namespace of content
+ elements (modules or documents) from the namespace of a math
+ archive and some relative file path within that archive.
+
+ \stexvarmacro{target}
+ \stexvarmacro{repo_prop}
+ \stexvarmacro{filepath}
+ \begin{sfunction}{stex_uri_from_repo_file:NNNn}{\stex_uri_from_repo_file:NNNn}
+ \begin{syntax}
+ \dcs\marg{\cs{target}}\marg{\cs{repo_prop}}\marg{\cs{filepath}}
+ \marg{ns\_field}
+ \end{syntax}
+ computes the namespace URI from the property list
+ \cs{repo_prop} of some math archive, the file path
+ \cs{filepath} and the archive field \marg{ns\_field}
+ (|narr| or |ns|), and stores the result in \cs{target}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_uri_from_repo_file_nolang:NNNn}{\stex_uri_from_repo_file_nolang:NNNn}
+ behaves like \cs{stex_uri_from_repo_file:NNNn}, but makes
+ sure
+ to split off language abbreviations from the file name
+ (e.g. |.en|).
+ \end{sfunction}
+
+ \begin{sfunction}{stex_uri_from_current_file:Nn, stex_uri_from_current_file_nolang:Nn}{\stex_uri_from_current_file:Nn, \stex_uri_from_current_file_nolang:Nn}
+ Special cases for \cs{stex_uri_from_repo_file}|[_nolang]:NNNn|,
+ for \cs{repo_prop}|=|\cs{l_stex_current_archive_prop} and
+ \cs{filepath}|=|\cs{g_stex_current_file}.
+ \end{sfunction}
+
+ \stexmacro{l_stex_current_doc_uri}
+ \begin{sfunction}{stex_set_document_uri:}{\stex_set_document_uri:}
+ sets the current value of \cs{l_stex_current_doc_uri} based
+ on the current file and archive.
+ \end{sfunction}
+
+ \stexmacro{l_stex_current_ns_uri}
+ \begin{sfunction}{stex_set_current_namespace:}{\stex_set_current_namespace:}
+ sets the current value of \cs{l_stex_current_ns_uri} based
+ on the current file and archive.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_uri_add_module:NNn}{\stex_uri_add_module:NNn, \stex_uri_add_module:NNo}
+ \begin{syntax}
+ \dcs\marg{\cs{target}}\marg{\cs{uri}}
+ \marg{name}
+ \end{syntax}
+ Checks that URI \cs{uri} has no module name, adds the provided
+ \meta{name} and stores the result in \cs{target}.
+ \end{sfunction}
+
+ \begin{sfragment}{URI Constants and Variables}
+
+ \begin{svariable}{l_stex_current_doc_uri}{\l_stex_current_doc_uri}
+ always points to the current document URI.
+ \end{svariable}
+
+ \begin{svariable}{l_stex_current_ns_uri}{\l_stex_current_ns_uri}
+ always points to the current content namespace.
+ \end{svariable}
+
+ \end{sfragment}
+
+ \end{sfragment}
+
+\end{sfragment}
+
+\begin{sfragment}{Language Handling}
+ \begin{svariable}{c_stex_languages_prop,c_stex_language_abbrevs_prop}{\c_stex_languages_prop,\c_stex_language_abbrevs_prop}
+ Property lists converting babel languages to/from their abreviations;
+ e.g.
+ \begin{itemize}
+ \item |\prop_item:Nn |\cs{c_stex_languages_prop}| {de}| yields |ngerman|, and
+ \item \cs{c_stex_language_abbrevs_prop}| {ngerman}| yields |de|.
+ \end{itemize}
+ \end{svariable}
+
+ \begin{svariable}{l_stex_current_language_str}{\l_stex_current_language_str}
+ always stores the current language.
+ \end{svariable}
+
+ \begin{sfunction}{stex_set_language:n}{\stex_set_language:n, \stex_set_language:x, \stex_set_language:o}
+ \begin{syntax}\dcs\marg{abbrev}\end{syntax}
+ Sets \cs{l_stex_current_language_str}, and, if the \pkg{babel}
+ package is loaded, calls \cs{selectlanguage} on the
+ language corresponding to \marg{abbrev}.
+
+ Note that the package option |lang=| automatically loads the
+ \pkg{babel} package.
+
+ If \meta{abbrev}|=tr|, additionally call \cs{selectlanguage}
+ with the option |shorthands=:!|.
+
+ Throws |error/unknownlanguage| if no language with abbreviation
+ \marg{abbrev} is known.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_language_from_file:}{\stex_language_from_file:}
+ infers the current language from file ending (e.g. |.en.tex|)
+ and sets it appropriately.
+
+ Is called in a file hook, i.e. always switches language when inputting
+ a file |.<lang>.<ext>|.
+ \end{sfunction}
+
+\end{sfragment}
+
+\begin{sfragment}{Inserting Annotations}
+ \stex can be used to produce either \HTML or \PDF. In \HTML-mode,
+ multiple macros exist to insert annotations. The same macros
+ are also valid in \PDF mode but implemented as null operations.
+
+ \begin{sfunction}{stex_suppress_html:n}{\stex_suppress_html:n}
+ \begin{syntax}\dcs\marg{code}\end{syntax}
+ turns annotations off temporarily in \meta{code} (e.g. as to not
+ generate additional annotations for elaborated declarations,
+ or in sms-mode).
+ \end{sfunction}
+
+ For that to work, code that inserts annotations should use
+ \begin{sfunction}{stex_if_do_html:}[pTF]{\stex_if_do_html:}
+ tests whether to generate \HTML annotations.
+ \end{sfunction}
+
+ \begin{sfunction}{stex@backend}{\stex@backend}
+ should be set by a backend engine, such that a file
+ |stex-backend-|\dcs{}|.cfg| exists.
+ \end{sfunction}
+
+ \begin{sfragment}{Backend macros}
+
+ Such a backend config file should provide the following:
+
+ \begin{sfunction}{stex_if_html_backend:}[pTF]{\stex_if_html_backend:}
+ can be used to determine whether the backend produces \HTML (e.g.
+ \rustex or \LaTeXML) or not (e.g. |pdflatex|).
+
+ \cs{ifstexhtml} is set accordingly.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_annotate:nnn}{\stex_annotate:nnn}
+ \begin{syntax} \dcs\marg{attr}\marg{value}\marg{code}
+ \end{syntax}
+ In \HTML mode, annotates the output of \meta{code} with the
+ \XML-attribute \meta{attr}|="|\meta{value}|"|. In \PDF mode, just
+ calls \meta{code}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_annotate_invisible:nnn,stex_annotate_invisible:n}{\stex_annotate_invisible:nnn,\stex_annotate_invisible:n}
+ \begin{syntax} \dcs[stex_annotate_invisible:n]\marg{code}
+ \end{syntax}
+
+ Should annotate \meta{code} with
+ |shtml:visible="false" style="display:none;"|. In \PDF mode, does
+ nothing.
+
+ \dcs combines \cs{stex_annotate_invisible:n}
+ and \cs{stex_annotate:nnn}.
+ \end{sfunction}
+
+
+ \begin{senv}{stex_annotate_env}
+ \cs{begin}|{|\denv|}|\marg{attr}\marg{value}
+ \meta{code}
+ \cs{end}|{|\denv|}| should behave
+ like \cs{stex_annotate:nnn}\marg{attr}\marg{value}\marg{code}
+ \end{senv}
+
+ \begin{sfunction}{stex_mathml_intent:nn,stex_mathml_arg:nn}{\stex_mathml_intent:nn,\stex_mathml_arg:nn}
+ MathML Intent (TODO)
+ \end{sfunction}
+
+ \end{sfragment}
+
+\end{sfragment}
+
+\begin{sfragment}{Persisting Content from Math Archives in sms-Files}
+
+ \begin{sfunction}{stex_persist:n}{\stex_persist:n,\stex_persist:e}
+ \begin{syntax}\dcs\marg{code}\end{syntax}
+ writes \meta{code} to the \cs{jobname}|.sms|-file, if
+ |writesms| is active.
+
+ \begin{texnote}
+ \meta{code} is being read with \pkg{expl3} category
+ codes (except for spaces having catcode 10),
+ but not pretokenized; i.e. \meta{code} can safely
+ change the current catcode scheme.
+ \end{texnote}
+ \end{sfunction}
+
+
+ \begin{svariable}{c_stex_persist_mode_bool,c_stex_persist_write_mode_bool}{
+ \c_stex_persist_mode_bool,\c_stex_persist_write_mode_bool
+ }
+ whether |usesms| or |writesms| are active.
+ \end{svariable}
+
+\end{sfragment}
+
+
+\begin{sfragment}{Utility Methods}
+
+ \stexvarmacro{foo}
+ \begin{sfunction}{stex_macro_body:N}[EXP]{\stex_macro_body:N}
+ expands to the \emph{expansion} of the provided macro,
+ including parameter tokens, with the original category codes intact;
+ e.g. if \cs{def}\cs{foo}|#1{First #1}|,
+ then \dcs\cs{foo} expands to
+ |First #1|.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_macro_definition:N}[EXP]{\stex_macro_definition:N}
+ expands to the token list \emph{defining} the provided macro,
+ including parameters, command attributes (i.e. \cs{long},
+ \cs{protected}), with the original category codes intact;
+ e.g. if \cs{protected}\cs{def}\cs{foo}|#1{First #1}|,
+ then \dcs\cs{foo} expands to
+ \cs{protected}\cs{def}\cs{foo}|#1{First #1}|.
+
+ \begin{texnote} Does not work with ``higher'' parameter
+ tokens, i.e. |##1|, |####1| etc.\end{texnote}
+ \end{sfunction}
+
+ \stexvarmacro{macro}
+ \begin{sfunction}{stex_deactivate_macro:Nn, stex_reactivate_macro:N}{\stex_deactivate_macro:Nn, \stex_reactivate_macro:N}
+ \begin{syntax}\dcs \marg{\cs{macro}} \marg{msg}
+ \end{syntax}
+ Makes \cs{macro} throw an error message |error/deactivated-macro|\marg{msg},
+ notifying an author that the macro is only allowed in certain environments.
+
+ \dcs[stex_reactivate_macro:N] restores the functionality of the macro.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_kpsewhich:Nn}{\stex_kpsewhich:Nn}
+ \begin{syntax}
+ \dcs \marg{\cs{macro}} \marg{args}
+ \end{syntax}
+ Calls ``|kpsewhich| \meta{args}'' and stores the result
+ in \cs{macro},
+%^^A Foo
+ \begin{texnote}
+ Does not require |shell-escape|
+ \end{texnote}
+%^^A
+%^^A
+%^^A \begin{arguments}
+%^^A \item Narf?
+%^^A \end{arguments}
+%^^A
+ \end{sfunction}
+
+ \begin{sfunction}{stex_get_env:Nn}{\stex_get_env:Nn}
+ \begin{syntax}
+ \dcs \marg{\cs{macro}} \marg{envvar}
+ \end{syntax}
+ Stores the value of the environment variable \meta{envvar}
+ in \cs{macro}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_fatal_error:n}{\stex_fatal_error:n,\stex_fatal_error:nnn,\stex_fatal_error:nxx}
+ Mimic the \cs{msg_error:}-macros, but make sure that \TeX\ stops
+ processing.
+ \begin{texnote}
+ Calls |\input{non-existent file}|.
+ \end{texnote}
+ \end{sfunction}
+
+ \begin{sfunction}{stex_ignore_spaces_and_pars:}{\stex_ignore_spaces_and_pars:}
+ As the name suggests, ignores all subsequent spaces and \cs{par}s
+ until the first non-expandable macro is encountered.
+
+ Useful for e.g. ending \cs{symdecl} and related macros with,
+ so that formatting sources with empty lines does not cause
+ paragraph breaks.
+ \end{sfunction}
+
+ \begin{sfragment}{Group-like Behaviours}
+
+ \begin{sfunction}{stex_pseudogroup_with:nn}{\stex_pseudogroup_with:nn}
+ \begin{syntax}\dcs\marg{macros}\marg{code}
+ \end{syntax}
+ Calls \meta{code} and subsequently restores the values of the
+ \meta{macros} given.
+ \begin{texnote}
+ Does \emph{not} work recursively!
+ \end{texnote}
+ \end{sfunction}
+
+ \stexmacro{stex_pseudogroup_restore:N}
+
+ \begin{sfunction}{stex_pseudogroup:nn}{\stex_pseudogroup:nn}
+ \begin{syntax}\dcs\marg{code1}\marg{code2}
+ \end{syntax}
+ Expands \meta{code2}, and inserts the result after \meta{code1}.
+ Works recursively and
+ allows for restoring the values of macros in combination with
+ \cs{stex_pseudogroup_restore:N}, but \emph{only for macros
+ that take no arguments}:
+ \end{sfunction}
+
+ \begin{sfunction}{stex_pseudogroup_restore:N}[EXP]{\stex_pseudogroup_restore:N}
+ \begin{syntax}\dcs\marg{\cs{macro}}
+ \end{syntax}
+ \end{sfunction}
+
+ \begin{sexample}
+ \stexvarmacro{foo}
+ \stexvarmacro{num}
+ \begin{stexcode}[gobble=8]
+ |\cs{stex_pseudogroup:nn}|{
+ something changing |\cs{foo}|
+ something changing |\cs{num}|
+ }{
+ |\cs{stex_pseudogroup_restore:N}\cs{foo}|
+ \int_set:Nn |\cs{num}| {\int_use:N |\cs{num}|}
+ }
+ \end{stexcode}
+ restores the values of macro \cs{foo} and register \cs{num}
+ after calling the first block.
+ \end{sexample}
+
+ Commands like \cs{symdecl} and \cs{importmodule} that generate
+ (semantic) macros should be local \emph{to the current module},
+ e.g. \env{smodule}. For that purpose, we open a new ``metagroup''
+ with some identifier (e.g. \cs{l_stex_current_module_str})
+ and then execute the relevant code \emph{in the metagroup with that
+ identifier}:
+
+ \begin{sfunction}{stex_metagroup_new:n}{\stex_metagroup_new:n, \stex_metagroup_new:o}
+ \begin{syntax}\dcs \marg{id}\end{syntax}
+ Opens a new metagroup at the current \TeX\ group level with
+ identifier \meta{id}.
+ \end{sfunction}
+
+ \begin{sfunction}{stex_metagroup_do_in:nn}{\stex_metagroup_do_in:nn, \stex_metagroup_do_in:nx}
+ \begin{syntax}\dcs \marg{id}\marg{code}\end{syntax}
+ Executes \meta{code} and adds its content to \cs{aftergroup} up
+ until the \TeX\ group level of the metagroup with identifier
+ \meta{id}.
+ \end{sfunction}
+
+ \end{sfragment}
+
+\end{sfragment}
+
+\end{smodule}
+
+%^^A^^A \begin{TemplateInterfaceDescription}{foo}
+%^^A^^A \TemplateArgument{1}{Something Here}
+%^^A^^A \TemplateSemantics{Some Narf Here}
+%^^A^^A \end{TemplateInterfaceDescription}
+%^^A^^A \begin{TemplateDescription}{foo}{bar}
+%^^A^^A \TemplateKey{narf}{Something Here}
+%^^A^^A \TemplateSemantics{Some Narf Here}
+%^^A^^A \end{TemplateDescription}
+%^^A^^A \begin{InstanceDescription}{foo}{newinst}{bar}
+%^^A^^A \InstanceKey{narf}{Something Here}
+%^^A^^A \InstanceSemantics{Some Narf Here}
+%^^A^^A \end{InstanceDescription}
+%^^A^^A \cs{stex_kpsewhich:Nn}
+%^^A \begin{function}{\stex_kpsewhich:Nn}
+%^^A Foo
+%^^A \begin{texnote} Foo! \end{texnote}
+%^^A
+%^^A \begin{syntax} \cs{stex_kpsewhich:Nn} \meta{something} \Arg{argh}
+%^^A \end{syntax}
+%^^A
+%^^A \begin{arguments}
+%^^A \item Narf?
+%^^A \end{arguments}
+%^^A
+%^^A \end{function} \ No newline at end of file
diff --git a/macros/latex/contrib/stex/doc/stex-doc.pdf b/macros/latex/contrib/stex/doc/stex-doc.pdf
index e53c98213a..a978cbb2e7 100644
--- a/macros/latex/contrib/stex/doc/stex-doc.pdf
+++ b/macros/latex/contrib/stex/doc/stex-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/stex/doc/stex-doc.tex b/macros/latex/contrib/stex/doc/stex-doc.tex
index d2ff005554..6dbf566c2c 100644
--- a/macros/latex/contrib/stex/doc/stex-doc.tex
+++ b/macros/latex/contrib/stex/doc/stex-doc.tex
@@ -1,218 +1,85 @@
-\def\libfolder#1{../lib/#1}
-\newif\ifinidedoc\inidedocfalse
-\newif\ifinfulldoc\inidedocfalse
-
\input{stex-docheader}
-\infulldoctrue
-\ExplSyntaxOn
-\def\OmitDocInput#1{
-\clist_gput_right:Nn \g_docinput_clist
- { #1 }
-}
-\ExplSyntaxOff
+\stextoptitle{The {\protect\stex{3}} Package Collection}{}
\begin{document}
- \title{
- The {\stex{3}} Package Collection
- \thanks{Version {\fileversion} (last revised {\filedate})}
- }
- \author{Michael Kohlhase, Dennis Müller\\
- FAU Erlangen-Nürnberg\\
- \url{http://kwarc.info/}
- }
- \pagenumbering{roman}
- \maketitle
-
- \input{stex-abstract}\bigskip
-
- This is the full documentation of \sTeX. It
- consists of four parts:
- \begin{itemize}
- \item \autoref{part:manual} is a general manual
- for the \sTeX package and associated software.
- It is primarily directed at end-users who
- want to use \sTeX to author semantically
- enriched documents.
- \item \autoref{part:documentation}
- documents the macros provided
- by the \sTeX package. It is primarily directed
- at package authors who want to build on
- \sTeX, but can also serve as a reference manual
- for end-users.
- \item \autoref{part:extensions} documents additional
- packages that build on \sTeX, primarily its
- module system. These are not part of the
- \sTeX package itself, but useful additions
- enabled by \sTeX package functionality.
- \item \autoref{part:implementation} is the
- detailled documentation of the \sTeX package
- implementation.
- \end{itemize}
-
- \makeatletter
- \renewcommand\part{%
- \clearpage
- \thispagestyle{plain}%
- \@tempswafalse
- \null\vfil
- \secdef\@part\@spart%
- }
- \newcounter{chapter}
- \numberwithin{section}{chapter}
- \renewcommand\thechapter{\@arabic\c@chapter}
- \renewcommand\thesection{\thechapter.\@arabic\c@section}
- \newcommand*\chaptermark[1]{}
- \setcounter{secnumdepth}{2}
- \newcommand\@chapapp{\chaptername}
- %\newcommand\chaptername{Chapter}
- \def\ps@headings{%
- \let\@oddfoot\@empty
- \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
- \let\@mkboth\markboth
- \def\chaptermark##1{%
- \markright{\MakeUppercase{%
- \ifnum \c@secnumdepth >\m@ne
- \@chapapp\ \thechapter. \ %
- \fi
- ##1}}%
- }%
- }
- \newcommand\chapter{\clearpage
- \thispagestyle{plain}%
- \global\@topnum\z@
- \@afterindentfalse
- \secdef\@chapter\@schapter%
- }
- \def\@chapter[#1]#2{\refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}#1}%
- \chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
- \@makechapterhead{#2}%
- \@afterheading%
- }
- \def\@makechapterhead#1{%
- \vspace*{50\p@}%
- {\parindent \z@ \raggedright \normalfont
- \huge\bfseries \@chapapp\space \thechapter
- \par\nobreak
- \vskip 20\p@
- \interlinepenalty\@M
- \Huge \bfseries #1\par\nobreak
- \vskip 40\p@
- }%
- }
-\newcommand*\l@chapter[2]{%
- \ifnum \c@tocdepth >\m@ne
- \addpenalty{-\@highpenalty}%
- \vskip 1.0em \@plus\p@
- \setlength\@tempdima{1.5em}%
- \begingroup
- \parindent \z@ \rightskip \@pnumwidth
- \parfillskip -\@pnumwidth
- \leavevmode \bfseries
- \advance\leftskip\@tempdima
- \hskip -\leftskip
- #1\nobreak\hfil
- \nobreak\hb@xt@\@pnumwidth{\hss #2%
- \kern-\p@\kern\p@}\par
- \penalty\@highpenalty
- \endgroup
- \fi}
-\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.8em}}
-\renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
-\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
-\def\partname{Part}
-\def\toclevel@part{-1}
-\def\maketitle{\chapter{\@title}}
-\let\thanks\@gobble
-\let\DelayPrintIndex\PrintIndex
-\let\PrintIndex\@empty
-\providecommand*{\hexnum}[1]{\text{\texttt{\char`\"}#1}}
-\makeatother
-
-\ExplSyntaxOn
-\int_set:Nn \l_document_structure_section_level_int {1}
-\ExplSyntaxOff
-
-\clearpage
-
-{%
- \def\\{:}% fix "newlines" in the ToC
- \tableofcontents
-}
-
-\clearpage
-\pagenumbering{arabic}
-
-\part{Manual}\label{part:manual}
-
-%\let\oldsubsubsection\subsubsection
-%\let\subsubsection\section
-%\let\subsection\section
-%\let\section\chapter
-
-\input{stex-manual}
-
-%\let\section\subsection
-%\let\subsection\subsubsection
-%\let\subsubsection\oldsubsubsection
-
-\part{Documentation}\label{part:documentation}
-
-\ExplSyntaxOn
-\int_set:Nn \l_document_structure_section_level_int {2}
-\ExplSyntaxOff
-
-
-%\errmessage{\expandafter\meaning\csname comment \endcsname}
+\usemodule[sTeX/Documentation]{common}
+\maketitle
+
+\libinput[sTeX/Documentation]{docparts}
+
+\tableofcontents
+
+\begin{experimental}
+ \stex is -- by now -- relatively stable and ready to use for the
+ general public. However, it is also actively being developed further
+ and subject to ongoing research. Some of the features described in
+ here might not fully work as expected,
+ some are still experimental, there might occasionally be cryptic
+ error messages, and in general bugs are expected.
+
+ We welcome all kinds of issues you might encounter at
+ \url{https://github.com/slatex/sTeX}.
+\end{experimental}
+\edef\stexmatrixlink{\noexpand\url{https://matrix.to/\#/\#stex:fau.de}}
+\begin{center}\emph{
+ If you have questions or problems with \stex, you can talk to us
+ directly at \stexmatrixlink.
+}\end{center}
+
+\EnableManual
+\DisableDocumentation
\DisableImplementation
+\begin{blindfragment}
+ \inputref[sTeX/Documentation]{setup}
+\end{blindfragment}
-\DocInput{../source/stex/stex-basics.dtx}
-\DocInput{../source/stex/stex-mathhub.dtx}
-\DocInput{../source/stex/stex-references.dtx}
-\DocInput{../source/stex/stex-modules.dtx}
-\DocInput{../source/stex/stex-inheritance.dtx}
-\DocInput{../source/stex/stex-symbols.dtx}
-\DocInput{../source/stex/stex-terms.dtx}
-\DocInput{../source/stex/stex-features.dtx}
-\DocInput{../source/stex/stex-statements.dtx}
-\DocInput{../source/stex/stex-proofs.dtx}
-
-\OmitDocInput{../source/stex/stex-others.dtx}
-\DocInput{../source/stex/stex-metatheory.dtx}
+\begin{sfragment}{Tutorial}
+ \inputref[sTeX/Documentation]{tutorial.en}
+\end{sfragment}
-\part{Extensions}\label{part:extensions}\slabel{part:extends}
+\begin{sfragment}{User Manual}
+ \inputref[sTeX/Documentation]{manual}
-\DocInput{../source/extensions/tikzinput.dtx}
-\DocInput{../source/extensions/document-structure.dtx}
-\DocInput{../source/extensions/notesslides.dtx}
-\DocInput{../source/extensions/problem.dtx}
-\DocInput{../source/extensions/hwexam.dtx}
+ \begin{sfragment}{Additional Packages}
+ \DocInput{../source/notesslides.dtx}
+ \DocInput{../source/problem.dtx}
+ \DocInput{../source/hwexam.dtx}
+ \DocInput{../source/tikzinput.dtx}
+ \end{sfragment}
+\end{sfragment}
+\DisableManual
+\EnableDocumentation
+\DisableImplementation
-\part{Implementation}\label{part:implementation}
+\begin{sfragment}{Documentation}
+ \DocInput{../source/stex.dtx}
-\def\maketitle{}
-\let\subsubsection\section
-\let\subsection\section
-\let\section\chapter
+ \begin{sfragment}{Additional Packages}
+ \DocInput{../source/notesslides.dtx}
+ \DocInput{../source/problem.dtx}
+ \DocInput{../source/hwexam.dtx}
+ \DocInput{../source/tikzinput.dtx}
+ \end{sfragment}
+\end{sfragment}
\EnableImplementation
\DisableDocumentation
-\DocInputAgain
+\begin{sfragment}{Implementation}
+ %\DocInputAgain
+ \DocInput{../source/stex.dtx}
-\begin{sfragment}{References}\ednote{we need an un-numbered version {sfragment*}}
- \printbibliography[heading=none]
+ \begin{sfragment}{Additional Packages}
+ \DocInput{../source/notesslides.dtx}
+ \DocInput{../source/problem.dtx}
+ \DocInput{../source/hwexam.dtx}
+ \DocInput{../source/tikzinput.dtx}
+ \end{sfragment}
\end{sfragment}
-\end{document}
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: t
-%%% End:
+\DelayPrintIndex
+
+\end{document}
diff --git a/macros/latex/contrib/stex/doc/stex-docheader.tex b/macros/latex/contrib/stex/doc/stex-docheader.tex
index c6bea9b3da..b8b6313be8 100644
--- a/macros/latex/contrib/stex/doc/stex-docheader.tex
+++ b/macros/latex/contrib/stex/doc/stex-docheader.tex
@@ -1,164 +1,168 @@
\RequirePackage{paralist}
-\ifcsname libfolder\endcsname\else\def\libfolder#1{../lib/#1}\fi
-\documentclass[full,kernel]{l3doc}
-\usepackage[dvipsnames]{xcolor}
-\usepackage[utf8]{inputenc}
-\usepackage[T1]{fontenc}
-\RequirePackage{morewrites}
-\RequirePackage{tikzinput}
-\usetikzlibrary{fit}
-
-\usepackage[lang=en, mathhub=./tests,debug=sref]{stex}
-\usepackage{url,array,float}
-\usepackage[show]{ed}
+\ifcsname stexdocpath\endcsname\else\def\stexdocpath{.}\fi
+\documentclass[full]{l3doc}
+%\RequirePackage{document-structure}
\usepackage[hyperref=auto,style=alphabetic]{biblatex}
-\addbibresource{\libfolder{bib/kwarcpubs.bib}}
-\addbibresource{\libfolder{bib/extpubs.bib}}
-\addbibresource{\libfolder{bib/kwarccrossrefs.bib}}
-\addbibresource{\libfolder{bib/extcrossrefs.bib}}
-\usepackage{amssymb}
-\usepackage{amsfonts}
-\usepackage{xspace}
-\usepackage{hyperref}
-
-\makeindex
-\floatstyle{boxed}
-\newfloat{exfig}{thp}{lop}
-\floatname{exfig}{Example}
-
-\usepackage{listings}
-\usepackage{lststex}
-
-\lstdefinelanguage{sTeX}{
- sensitive=true,
- numbers=left,
- numbersep=3pt,
- xleftmargin=3pt,
- alsodigit={\$},
- %gobble=4,
- alsoletter={\\},
- %moredelim = [s][\itshape]{$}{$},
- %moredelim = [s][\itshape\bfseries]{\\[}{\\]},
- classoffset=0,keywordstyle=\bfseries,morekeywords={
- \\begin,\\end,\\ExplSyntaxOn,\\ExplSyntaxOff,\\documentclass,
- \\usepackage,\\def,\\[,\\],\\else,\\fi,$\iffalse$\fi,
- \\newcommand, \\renewcommand, \\let
- },
- classoffset=1,keywordstyle=\itshape\color{OliveGreen},morekeywords={
- \\defeq,\\geometricSeries,\\infinitesum,\\realdivide,
- \\realpower,
- \\symbolname,\\binarysymbol,\\newbinarysymbol,\\addition,
- \\summation,\\ascendingchain,\\quantforall,\\set,\\funtype,
- \\Nat,\\successor,\\multiplication,\\Int,\\zero,\\uminus,
- \\intmonoid,\\divides,\\intpow,\\ratfrac,\\ratpow,\\inttimes,
- \\inset,\\eq,\\rational,\\irrational,\\coprime,\\PosInt,
- \\realroot
- },
- classoffset=2,keywordstyle=\color{blue},morekeywords={
- \\symdecl,\\symdef,\\notation,\\vardef,\\varseq,\\instantiate,
- \\varinstantiate, \\renamedecl, \\assign, \\setnotation,
- \\STEXexport
- },
- classoffset=3,keywordstyle=\color{BurntOrange},morekeywords={
- \\importmodule,\\usemodule,\\libinput,\\inputref,\\mhinput,
- \\libusepackage,\\addmhbibresource,\\ifinputref
- },
- classoffset=4,keywordstyle=\color{Purple},morekeywords={
- \\definiendum,\\definame,\\symref,\\symname,\\comp,
- \\compemph,\\definiens,\\svar,\\infprec,\\neginfprec,\\ellipses,
- \\Symname,\\arg,\\yield,\\assumption,\\spfstep,\\eqstep,\\conclude
- },
- classoffset=5,keywordstyle=\color{magenta},morekeywords={
- smodule,sdefinition,sassertion,sparagraph,sexample,
- sproof,subproof,spfcases,spfcase,spfstep,spfcomment,spfblock,
- \\spfidea,\\spfsketch,\\spfcasesketch,\\sproofend,
- \\spfjust,\\premise,\\justarg,
- copymodule,interpretmodule,mathstructure,sexample
- },
- classoffset=6,keywordstyle=\color{cyan},morekeywords={
- sfragment,blindfragment,\\skipfragment,
- \\currentsectionlevel,\\Currentsectionlevel
- \\prematurestop,\\afterprematurestop,
- \\setSGvar,\\useSGvar,\\ifSGvar
- },
- classoffset=7,keywordstyle=\color{brown},morekeywords={
- frame,note,\\ifnotes,\\setslidelogo,\\setsource,\\setlicensing
- slides,notes,sectocframes,frameimages,fiboxed,
- nparagraph, nparagraph, ndefinition, nexample, nsproof, nassertion,
- \\frameimage,\\mhframeimage,\\textwarning,
- \\activateexcursion,\\printexcursion,\\excursionref,\\excursiongroup
- },
- classoffset=8,keywordstyle=\color{red},morekeywords={
- frame,note
- },
- classoffset=9,keywordstyle=\color{gray},morekeywords={
- \\vara,\\varb,\\varc
- }
-}
+%\usepackage[mathhub=\stexdocpath/mh,usedeps]{stex}
+\usepackage[lang={en,de}]{stex}
-\lstnewenvironment{latexcode}[1][]{\lstset{language=sTeX,#1}}{}
+\usepackage{rustex}
+\usepackage{stex-highlighting,stexthm}
-\def\stexcode{\lstinline[language=sTeX]}
+\srefsetin[sTeX/Documentation]{documentation}{the \stex Documentation}
-\usepackage{mdframed,realboxes}
-\usepackage[most]{tcolorbox}
-\usepackage{caption}
+\makeatletter
+\providecommand{\HTML}{\textsc{html}\xspace}%
+\providecommand{\XML}{\textsc{xml}\xspace}%
+\providecommand{\PDF}{\textsc{pdf}\xspace}%
+\providecommand\openmath{\textsc{OpenMath}\xspace}
+\providecommand\OMDoc{\textsc{OMDoc}\xspace}
+\DeclareRobustCommand\LaTeXML{L\kern-.36em%
+ {\sbox\z@ T%
+ \vbox to\ht\z@{\hbox{\check@mathfonts
+ \fontsize\sf@size\z@
+ \math@fontsfalse\selectfont
+ A}%
+ \vss}%
+ }%
+ \kern-.15em%
+% T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em\relax
+% {\tt XML}}
+ T\kern-.1667em\lower.4ex\hbox{E}\kern-0.05em\relax
+ {\scshape xml}\xspace}%
+\def\mmt{\textsc{Mmt}\xspace}
+\makeatother
-\newenvironment{framed}{\begin{mdframed}\begin{center}}{\end{center}\end{mdframed}}
-\newcommand{\scaled}[2][0.9\hsize]{\begin{center}\resizebox{#1}{!}{\begin{minipage}{\textwidth} #2 \end{minipage}}\end{center}}
-\newenvironment{stextest@output}
-{
- \begin{mdframed}[linewidth=1pt,backgroundcolor=white]\small
-}
-{\end{mdframed}}
+\newif\ifhadtitle\hadtitlefalse
-\newenvironment{stextest@input}
-{
- \begin{mdframed}[linewidth=1pt,backgroundcolor=white]\small
+\def\stexversion{3.3.0}
+\def\changedate{\today}
+\def\stextoptitle#1#2{\title{#1\thanks{Version {\stexversion} (last revised {\changedate})} }\def\thispkg{#2}}
+
+\author{Michael Kohlhase, Dennis Müller\\
+ FAU Erlangen-Nürnberg\\
+ \url{http://kwarc.info/}
}
-{\end{mdframed}}
-\makeatletter
+\def\stexmaketitle{\ifhadtitle\else\hadtitletrue\maketitle\fi}
-\newcount\test@counter\test@counter=0
-\newcount\example@counter\example@counter=0
+\ExplSyntaxOn
-\newtcolorbox{exampleborderbox}{
- empty,
- title={Example \the\example@counter},
- attach boxed title to top left,
- minipage boxed title,
- boxed title style={empty,size=minimal,toprule=0pt,top=1pt,left=3mm,overlay={}},
- coltitle=blue,fonttitle=\bfseries,
- parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm,
- before upper=\csname @totalleftmargin\endcsname0pt,
- overlay unbroken={\draw[blue,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
- overlay first={\draw[blue,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
- overlay middle={\draw[blue,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
- overlay last={\draw[blue,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
- outer arc=4pt
+ \def\docmodule{
+ \begin{document}
+ \EnableManual
+ \EnableDocumentation
+ \EnableImplementation
+ \stexmaketitle
+ \tableofcontents
+ \int_gincr:N \l_stex_docheader_sect
+ \exp_args:Ne \__stex_mathhub_find_manifest:n {\stex_file_use:N \c_stex_mathhub_file / sTeX / Documentation}
+ \str_if_empty:NF \l__stex_mathhub_manifest_str {
+ \usemodule[sTeX/Documentation]{macros?AllMacros}
+ }
+ \DocInput{\jobname.dtx}
+ \clearpage
+ \PrintIndex
+ \printbibliography
+ \end{document}
+ }
+
+ \bool_new:N \g_stexdoc_typeset_manual_bool
+ \NewDocumentCommand \EnableManual {}{
+ \bool_gset_true:N \g_stexdoc_typeset_manual_bool
+ }
+ \NewDocumentCommand \DisableManual {}{
+ \bool_gset_false:N \g_stexdoc_typeset_manual_bool
+ }
+ \NewDocumentEnvironment {stexmanual} {} {
+ \bool_if:NTF \g_stexdoc_typeset_manual_bool
+ {\bool_set_false:N \l__codedoc_in_implementation_bool}
+ {\comment}
+ }{
+ \bool_if:NF \g_stexdoc_typeset_manual_bool {\endcomment}
+ }
+\ExplSyntaxOff
+
+%\usepackage{makeidx}
+%\makeindex
+
+%\usepackage{document-structure}
+
+
+\usepackage{lststex,mdframed}
+\usepackage[most]{tcolorbox}
+
+\lstset{literate=%
+ {Ö}{{\"O}}1
+ {Ä}{{\"A}}1
+ {Ü}{{\"U}}1
+ {ß}{{\ss}}1
+ {ü}{{\"u}}1
+ {ä}{{\"a}}1
+ {ö}{{\"o}}1
+ {~}{{\textasciitilde}}1
}
-\newenvironment{example@border}
-{
- \global\advance\example@counter by 1
-%^^A\refstepcounter{remark}
-\begin{exampleborderbox}
+\newenvironment{framed}[1][]{
+ \ifstexhtml\par\vbox\bgroup
+ \csname exp_args:Nne\endcsname\begin{stex_annotate_env}{%
+ style:border=solid 1px black,%
+ style:width=var(--this-width),%
+ style:min-width=var(--this-width),%
+ style:--this-width=calc(var(--current-width) - 6px),%
+ style:padding=3px,%
+ style:margin-top=5px,%
+ style:margin-bottom=5px%
+ }
+ \csname stex_annotate_invisible:n\endcsname{ }%
+ \begin{stex_annotate_env}{%
+ style:--current-width=var(--this-width);%
+ }\csname stex_annotate_invisible:n\endcsname{ }
+ \else\begin{mdframed}[#1]\fi
+ %\begin{center}%
+}{%
+ %\end{center}%
+ \ifstexhtml
+ \end{stex_annotate_env}\end{stex_annotate_env}\egroup\par
+ \else\end{mdframed}\fi
}
-{\end{exampleborderbox}}
+\newcommand{\scaled}[2][0.9\hsize]{\begin{center}\resizebox{#1}{!}{\begin{minipage}{\textwidth} #2 \end{minipage}}\end{center}}
- \makeatother
-
-\def\present#1{\texttt{>>\meaning#1<<}}
-\def\printltx#1{\texttt{\detokenize{#1}}}
+\makeatletter
+\ExplSyntaxOn
-\newwrite\testoutfile
-\def\testfile{0}
+\def\doc_exbox:nnn#1#2#3{
+ \begin{sexample}[#3]
+ Input:
+ \begin{framed}[linewidth=1pt,backgroundcolor=white]\small
+ #1
+ \end{framed}
+ Output:
+ \begin{framed}[linewidth=1pt,backgroundcolor=white]\small
+ #2
+ \end{framed}
+ \end{sexample}
+}
-\ExplSyntaxOn
-\def\stexexample{
+\NewDocumentCommand\stexexamplefile{O{} m O{} O{}}{
+ \stex_resolve_path_pair:Nxx \l_@@_filepath_str {\tl_to_str:n{#1}} {\tl_to_str:n{#2}}
+ \doc_exbox:nnn{
+ \hfill File~\str_if_empty:nTF{#1}{
+ \prop_if_exist:NT \l_stex_current_archive_prop {
+ [\texttt{\prop_item:Nn \l_stex_current_archive_prop {id}}]
+ }
+ }{[#1]}\texttt{\tl_to_str:n{#2}}
+ \_lststex_parse_args:n{#3}
+ \exp_args:Nno \use:nn{\lstinputlisting[} \l_lststex_return_tl ]{\l_@@_filepath_str}
+ }{
+ \inputref[#1]{#2}
+ }{#4}
+}
+
+\newwrite\testoutfile
+\NewDocumentCommand\stexexample{O{} O{}}{
\begingroup
\catcode`\\=12\relax
\catcode`\#=12\relax
@@ -171,38 +175,65 @@
\endlinechar=`^^J
\newlinechar=-1
%^^A \everyeof{\noexpand}
- \example_a:n
+ \example_a:nnn{#1}{#2}
}
-\long\def\example_a:n #1 {
+\long\def\example_a:nnn #1 #2 #3 {
\endgroup
- \begin{example@border}
- \immediate\openout\testoutfile=stextest.tex
- \immediate\write\testoutfile{
- \c_backslash_str begin{latexcode}
- \detokenize{^^J}#1
- \c_backslash_str end{latexcode}
- }
+ \immediate\openout\testoutfile=\jobname.exmpl
+ \immediate\write\testoutfile{
+ \c_backslash_str begin{stexcode}[#1]
+ \detokenize{^^J}#3
+ \c_backslash_str end{stexcode}
+ }
+ \immediate\closeout\testoutfile
+ \doc_exbox:nnn{
+ \catcode`\#=12\relax
+ \csname @ @ input\endcsname{\jobname.exmpl}
+ }{
+ \immediate\openout\testoutfile=\jobname.exmpl
+ \immediate\write\testoutfile{#3}
\immediate\closeout\testoutfile
+ \csname @ @ input\endcsname \jobname.exmpl\relax
+ }{#2}
+ \peek_charcode_remove:NT ^^J
+}
- Input:
+\ExplSyntaxOff
+\makeatother
- \begin{stextest@input}
- \catcode`\#=12\relax
- \input{stextest.tex}
- \end{stextest@input}
- \immediate\openout\testoutfile=stextest.tex
- \immediate\write\testoutfile{#1}
- \immediate\closeout\testoutfile
+\makeatletter
+\newcount\example@counter\example@counter=0
+\newtcolorbox{exampleborderbox}[1][]{
+ empty,
+ title={Example \the\example@counter #1},
+ attach boxed title to top left,
+ minipage boxed title,
+ boxed title style={empty,size=minimal,toprule=0pt,top=1pt,left=3mm,overlay={}},
+ coltitle=blue,fonttitle=\bfseries,
+ parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm,
+ before upper=\csname @totalleftmargin\endcsname0pt,
+ overlay unbroken={\draw[blue,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
+ overlay first={\draw[blue,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
+ overlay middle={\draw[blue,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
+ overlay last={\draw[blue,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
+ outer arc=4pt%
+}
- Output:
-
- \begin{stextest@output}
- \csname @ @ input\endcsname{stextest.tex}
- \end{stextest@output}
- \end{example@border}
+\ExplSyntaxOn
+\stexstyleexample{
+ \global\advance\example@counter by 1
+ \tl_if_empty:NTF\thistitle{
+ \begin{exampleborderbox}
+ }{
+ \begin{exampleborderbox}[ (\thistitle)]
+ }
+}{
+ \end{exampleborderbox}
}
-\ExplSyntaxOff
+\ExplSyntaxOff\makeatother
+
+\usetikzlibrary{calc}
\def\textwarning{\includegraphics[width=1.2em]{stex-dangerous-bend}\xspace}
\newtcolorbox{dangerbox}{
@@ -226,6 +257,62 @@
{\includegraphics[width=1cm,height=1cm]{stex-dangerous-bend}};}
}
+\protected\def\TODO#1{\textcolor{red}{TODO}\footnote{\textcolor{red}{TODO: #1}}}
+
+\definecolor{darkgreen}{rgb}{0.0, 0.5, 0.0}
+
+\usepackage[solutions]{problem}
+\usepackage{hwexam}
+\newtcolorbox{problemborderbox}[1][]{
+ empty,
+ title={Exercise #1},
+ attach boxed title to top left,
+ minipage boxed title,
+ boxed title style={empty,size=minimal,toprule=0pt,top=1pt,left=3mm,overlay={}},
+ coltitle=darkgreen,fonttitle=\bfseries,
+ parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm,
+ before upper=\csname @totalleftmargin\endcsname0pt,
+ overlay unbroken={\draw[darkgreen,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
+ overlay first={\draw[darkgreen,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
+ overlay middle={\draw[darkgreen,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
+ overlay last={\draw[darkgreen,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
+ outer arc=4pt%
+}
+
+\ExplSyntaxOn
+\stexstyleproblem{
+ \tl_if_empty:NTF\thistitle{
+ \begin{problemborderbox}
+ }{
+ \begin{problemborderbox}[ (\thistitle)]
+ }
+}{
+ \end{problemborderbox}
+}
+\ExplSyntaxOff
+
+\newtcolorbox{experimental}{
+ breakable,
+ enhanced,
+ left=0pt,
+ right=0pt,
+ top=8pt,
+ bottom=8pt,
+ colback=white,
+ colframe=gray,
+ width=\textwidth,
+ enlarge left by=0mm,
+ boxsep=5pt,
+ fontupper=\small,
+ arc=4pt,
+ outer arc=4pt,
+ leftupper=1.5cm,
+ overlay={
+ \node[anchor=west] at ([xshift=10pt]$(frame.north west)!0.5!(frame.south west)$)
+ {\includegraphics[height=1cm]{stex-experimental}};}
+}
+
+
\usetikzlibrary{decorations.pathmorphing,shapes,arrows,calc}
% Taken from pgflibrarytikzmmt.code.tex
\newcommand{\mmtarrowtip}{angle 45}
@@ -239,6 +326,7 @@
post=lineto,post length=5pt}, thick]
\tikzstyle{view}=[preview,-\mmtarrowtip]
+
% TIKZ RULES
\def\mmtlogo{
\begin{tikzpicture}
@@ -287,98 +375,31 @@
{\mmtlogo};}
}
-
-\MakeShortVerb{\|}
-
-\def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}\xspace}
-\def\mmt{\textsc{Mmt}\xspace}
-\def\xml{\scsys{Xml}}
-\def\mathml{\scsys{MathML}}
-\def\omdoc{\scsys{OMDoc}}
-\def\openmath{\scsys{OpenMath}}
-\def\latexml{\scsys{LaTeXML}}
-\def\perl{\scsys{Perl}}
-\def\cmathml{Content-{\sc MathML}\index{Content {\sc MathML}}\index{MathML@{\sc MathML}!content}}
-\def\activemath{\scsys{ActiveMath}}
-\def\twin#1#2{\index{#1!#2}\index{#2!#1}}
-\def\twintoo#1#2{{#1 #2}\twin{#1}{#2}}
-\def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}}
-\def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}}
-\def\cT{\mathcal{T}}\def\cD{\mathcal{D}}
-
-\def\fileversion{3.2}
-\def\filedate{\today}
-
-\RequirePackage{pdfcomment}
-
-\ExplSyntaxOn\makeatletter
-\cs_set_protected:Npn \@comp #1 #2 {
- \pdftooltip {
- \textcolor{blue}{#1}
- } { #2 }
-}
-
-\cs_set_protected:Npn \@defemph #1 #2 {
- \pdftooltip {
- \textbf{\textcolor{magenta}{#1}}
- } { #2 }
-}
-
-\def\__omtext_lec#1{#1}
-\cs_new_protected:Npn \lec #1 {
- \strut\hfil\strut\null\hfill\__omtext_lec{#1}
+\newtcolorbox{defibox}{
+ breakable,
+ enhanced,
+ left=0pt,
+ right=0pt,
+ top=8pt,
+ bottom=8pt,
+ colback=white,
+ colframe=orange,
+ width=\textwidth,
+ enlarge left by=0mm,
+ boxsep=5pt,
+ fontupper=\small,
+ leftupper=1.5cm,
+ arc=4pt,
+ outer arc=4pt,
+ overlay={\node[anchor=west] at ([xshift=10pt]$(frame.north west)!0.5!(frame.south west)$)
+ {\textcolor{orange}{\Large\sTeX}};}
}
-\makeatother\ExplSyntaxOff
-
-\makeatletter
-\let\@stex@oldcomment\comment
-\let\@stex@oldendcomment\endcomment
-
-%\RequirePackage{comment}
-\RequirePackage{document-structure}
-\RequirePackage[hints,solutions,notes]{problem}
-\RequirePackage{hwexam}
-
-\let\comment\@stex@oldcomment
-\let\endcomment\@stex@oldendcomment
-
-\newif\ifinfulldoc\infulldocfalse
-\makeatother
-
-\def\basedocurl{https://github.com/slatex/sTeX/blob/main/doc}
-\newcounter{module}
-\NewDocumentEnvironment {module}{}{
- \stepcounter{module}
- \textbf{Module \themodule: \smoduletitle}
+\stexstyleparagraph[defibox]{
+ \begin{defibox}
}{
-
+ \end{defibox}
}
-\stexpatchmodule[visible]{\begin{module}}{\end{module}}
-
-\usepackage{stexthm}
-
-\newtcolorbox{remarkbox}[1][]{
- empty,
- title={Remark \theremark: #1},
- attach boxed title to top left,
- minipage boxed title,
- boxed title style={empty,size=minimal,toprule=0pt,top=4pt,left=3mm,overlay={}},
- fonttitle=\bfseries,coltitle=black,
- before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm,
- before upper=\csname @totalleftmargin\endcsname0pt,
- overlay unbroken={\draw[black,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
- overlay first={\draw[black,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
- overlay middle={\draw[black,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
- overlay last={\draw[black,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
-}
-
-\renewenvironment{remark}[1][]{
- \refstepcounter{remark}\begin{remarkbox}[#1]
- \begin{mdframed}[linewidth=1pt,backgroundcolor=lightgray!33!white]
-}{
-\end{mdframed}\end{remarkbox}\endlist
-}
-\usepackage{rustex} \ No newline at end of file
+\AtBeginDocument{\catcode`_=8} \ No newline at end of file
diff --git a/macros/latex/contrib/stex/doc/stex-ide.pdf b/macros/latex/contrib/stex/doc/stex-ide.pdf
deleted file mode 100644
index a04d7ddd60..0000000000
--- a/macros/latex/contrib/stex/doc/stex-ide.pdf
+++ /dev/null
Binary files differ
diff --git a/macros/latex/contrib/stex/doc/stex-ide.tex b/macros/latex/contrib/stex/doc/stex-ide.tex
deleted file mode 100644
index a563d277fb..0000000000
--- a/macros/latex/contrib/stex/doc/stex-ide.tex
+++ /dev/null
@@ -1,155 +0,0 @@
-\ifcsname ifinfulldoc\endcsname\else
- \expandafter\newif\csname ifinfulldoc\endcsname\infulldocfalse
-\fi
-\ifcsname ifinidedoc\endcsname\else
- \expandafter\newif\csname ifinidedoc\endcsname\inidedoctrue
-\fi
-
-\ifinidedoc
-\input{stex-docheader}
-
-
-\begin{document}
-
- \title{
- The {\stex} VSCode IDE
- \thanks{Version {\fileversion} (last revised {\filedate})}
- }
- \author{Michael Kohlhase, Dennis Müller\\
- FAU Erlangen-Nürnberg\\
- \url{http://kwarc.info/}
- }
- \pagenumbering{roman}
- \maketitle
-
- This is the user manual for the \sTeX Plugin for VSCode, available at
- \url{https://marketplace.visualstudio.com/items?itemName=kwarc.stexide}.
- For the manual for the \sTeX package itself, see \href{\basedocurl/stex-manual.pdf}{the \sTeX{}3 Manual}.
-
- \makeatletter
- \renewcommand\part{%
- \clearpage
- \thispagestyle{plain}%
- \@tempswafalse
- \null\vfil
- \secdef\@part\@spart%
- }
- \newcounter{chapter}
- \numberwithin{section}{chapter}
- \renewcommand\thechapter{\@arabic\c@chapter}
- \renewcommand\thesection{\thechapter.\@arabic\c@section}
- \newcommand*\chaptermark[1]{}
- \setcounter{secnumdepth}{2}
- \newcommand\@chapapp{\chaptername}
- %\newcommand\chaptername{Chapter}
- \def\ps@headings{%
- \let\@oddfoot\@empty
- \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
- \let\@mkboth\markboth
- \def\chaptermark##1{%
- \markright{\MakeUppercase{%
- \ifnum \c@secnumdepth >\m@ne
- \@chapapp\ \thechapter. \ %
- \fi
- ##1}}%
- }%
- }
- \newcommand\chapter{\clearpage
- \thispagestyle{plain}%
- \global\@topnum\z@
- \@afterindentfalse
- \secdef\@chapter\@schapter%
- }
- \def\@chapter[#1]#2{\refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}#1}%
- \chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
- \@makechapterhead{#2}%
- \@afterheading%
- }
- \def\@makechapterhead#1{%
- \vspace*{50\p@}%
- {\parindent \z@ \raggedright \normalfont
- \huge\bfseries \@chapapp\space \thechapter
- \par\nobreak
- \vskip 20\p@
- \interlinepenalty\@M
- \Huge \bfseries #1\par\nobreak
- \vskip 40\p@
- }%
- }
-\newcommand*\l@chapter[2]{%
- \ifnum \c@tocdepth >\m@ne
- \addpenalty{-\@highpenalty}%
- \vskip 1.0em \@plus\p@
- \setlength\@tempdima{1.5em}%
- \begingroup
- \parindent \z@ \rightskip \@pnumwidth
- \parfillskip -\@pnumwidth
- \leavevmode \bfseries
- \advance\leftskip\@tempdima
- \hskip -\leftskip
- #1\nobreak\hfil
- \nobreak\hb@xt@\@pnumwidth{\hss #2%
- \kern-\p@\kern\p@}\par
- \penalty\@highpenalty
- \endgroup
- \fi}
-\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.8em}}
-\renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
-\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
-\def\partname{Part}
-\def\toclevel@part{-1}
-\def\maketitle{\chapter{\@title}}
-\let\thanks\@gobble
-\let\DelayPrintIndex\PrintIndex
-\let\PrintIndex\@empty
-\providecommand*{\hexnum}[1]{\text{\texttt{\char`\"}#1}}
-\makeatother
-
-\ExplSyntaxOn
-\int_set:Nn \l_document_structure_section_level_int {1}
-\ExplSyntaxOff
-
-\clearpage
-
-{%
- \def\\{:}% fix "newlines" in the ToC
- \tableofcontents
-}
-
-\clearpage
-\pagenumbering{arabic}
-
-\long\def\ignore#1{}
-
-\input{packages/stex-setup}
-\input{packages/stex-idesetup}
-
-\fi
-
-
-
-
-\ifinidedoc
-\newpage
-\printbibliography
-\end{document}
-\fi
-
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: t
-%%% End:
-
-% LocalWords: stex-docheader infulldoctrue l@subsubsection toclevel@part ExplSyntaxOff
-% LocalWords: l_document_structure_section_level_int dangerbox mmtbox omdoc OBJref lmh
-% LocalWords: own:fifom MueRabRot:rslffml20 sec.stexarchives stex-mathhub ngerman a,b
-% LocalWords: Metatheory sec.customhighlight sproof stexthm xspace stexpatchmodule
-% LocalWords: stexpatchexample stexpatchparagraph sexampleid amsthm sassertiontitle
-% LocalWords: sdefinitiontitle compemph varemph srefsymuri stex-hwexam TeXLive:on tlmgr
-% LocalWords: stexls:on,stexls-vscode-plugin:on
diff --git a/macros/latex/contrib/stex/doc/stex-manual.pdf b/macros/latex/contrib/stex/doc/stex-manual.pdf
index 2facc41ad1..dcc5371fad 100644
--- a/macros/latex/contrib/stex/doc/stex-manual.pdf
+++ b/macros/latex/contrib/stex/doc/stex-manual.pdf
Binary files differ
diff --git a/macros/latex/contrib/stex/doc/stex-manual.tex b/macros/latex/contrib/stex/doc/stex-manual.tex
deleted file mode 100644
index 547e238f54..0000000000
--- a/macros/latex/contrib/stex/doc/stex-manual.tex
+++ /dev/null
@@ -1,563 +0,0 @@
-
-\ifcsname ifinfulldoc\endcsname\else
- \expandafter\newif\csname ifinfulldoc\endcsname\infulldocfalse
-\fi
-\ifcsname ifinidedoc\endcsname\else
- \expandafter\newif\csname ifinidedoc\endcsname\inidedocfalse
-\fi
-
-\ifinfulldoc\else
- \input{stex-docheader}
-
-\begin{document}
- \title{
- The {\stex{3}} Manual
- \thanks{Version {\fileversion} (last revised {\filedate})}
- }
- \author{Michael Kohlhase, Dennis Müller\\
- FAU Erlangen-Nürnberg\\
- \url{http://kwarc.info/}
- }
- \pagenumbering{roman}
- \maketitle
-
- \input{stex-abstract}\bigskip
-
- This is the user manual for the \sTeX package and
- associated software. It is primarily directed at end-users
- who want to use \sTeX to author semantically
- enriched documents. For the full documentation, see
- \href{\basedocurl/stex-doc.pdf}{the \sTeX documentation}.
-
- \makeatletter
- \renewcommand\part{%
- \clearpage
- \thispagestyle{plain}%
- \@tempswafalse
- \null\vfil
- \secdef\@part\@spart%
- }
- \newcounter{chapter}
- \numberwithin{section}{chapter}
- \renewcommand\thechapter{\@arabic\c@chapter}
- \renewcommand\thesection{\thechapter.\@arabic\c@section}
- \newcommand*\chaptermark[1]{}
- \setcounter{secnumdepth}{2}
- \newcommand\@chapapp{\chaptername}
- %\newcommand\chaptername{Chapter}
- \def\ps@headings{%
- \let\@oddfoot\@empty
- \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
- \let\@mkboth\markboth
- \def\chaptermark##1{%
- \markright{\MakeUppercase{%
- \ifnum \c@secnumdepth >\m@ne
- \@chapapp\ \thechapter. \ %
- \fi
- ##1}}%
- }%
- }
- \newcommand\chapter{\clearpage
- \thispagestyle{plain}%
- \global\@topnum\z@
- \@afterindentfalse
- \secdef\@chapter\@schapter%
- }
- \def\@chapter[#1]#2{\refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}#1}%
- \chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
- \@makechapterhead{#2}%
- \@afterheading%
- }
- \def\@makechapterhead#1{%
- \vspace*{50\p@}%
- {\parindent \z@ \raggedright \normalfont
- \huge\bfseries \@chapapp\space \thechapter
- \par\nobreak
- \vskip 20\p@
- \interlinepenalty\@M
- \Huge \bfseries #1\par\nobreak
- \vskip 40\p@
- }%
- }
-\newcommand*\l@chapter[2]{%
- \ifnum \c@tocdepth >\m@ne
- \addpenalty{-\@highpenalty}%
- \vskip 1.0em \@plus\p@
- \setlength\@tempdima{1.5em}%
- \begingroup
- \parindent \z@ \rightskip \@pnumwidth
- \parfillskip -\@pnumwidth
- \leavevmode \bfseries
- \advance\leftskip\@tempdima
- \hskip -\leftskip
- #1\nobreak\hfil
- \nobreak\hb@xt@\@pnumwidth{\hss #2%
- \kern-\p@\kern\p@}\par
- \penalty\@highpenalty
- \endgroup
- \fi}
-\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.8em}}
-\renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
-\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
-\def\partname{Part}
-\def\toclevel@part{-1}
-\def\maketitle{\chapter{\@title}}
-\let\thanks\@gobble
-\let\DelayPrintIndex\PrintIndex
-\let\PrintIndex\@empty
-\providecommand*{\hexnum}[1]{\text{\texttt{\char`\"}#1}}
-\makeatother
-
-\ExplSyntaxOn
-\int_set:Nn \l_document_structure_section_level_int {1}
-\ExplSyntaxOff
-
-\clearpage
-
-{%
- \def\\{:}% fix "newlines" in the ToC
- \tableofcontents
-}
-
-\clearpage
-\pagenumbering{arabic}
-
-\fi
-
-\long\def\ignore#1{}
-
-\begin{dangerbox}
- Boxes like this one contain implementation details that are
- mostly relevant for more advanced use cases, might be useful
- to know when debugging, or might be good to know to better understand
- how something works. They can easily be skipped on a first read.
-\end{dangerbox}
-
-\begin{mmtbox}
- Boxes like this one explain how some \sTeX concept relates to the \mmt/\omdoc system,
- philosophy or language; see \cite{uniformal:on,Kohlhase:OMDoc1.2} for introductions.
-\end{mmtbox}
-
-
-\begin{sfragment}{What is \sTeX?}
-
-Formal systems for mathematics (such as interactive theorem provers)
-have the potential to significantly increase both the accessibility
-of published knowledge, as well as the confidence in its veracity,
-by rendering the precise semantics of statements machine actionable.
-This allows for a plurality of added-value services, from semantic
-search up to verification and automated theorem proving.
-Unfortunately, their usefulness is hidden behind severe barriers
-to accessibility; primarily related to their surface languages
-reminiscent of programming languages and very unlike informal
-standards of presentation.
-
-\sTeX minimizes this gap between informal and formal
-mathematics by integrating formal methods into established
-and widespread authoring workflows, primarily \LaTeX, via
-non-intrusive semantic
-annotations of arbitrary informal document fragments. That way
-formal knowledge management services become available for informal
-documents, accessible via an IDE for authors and via generated
-\emph{active} documents for readers, while remaining fully compatible
-with existing authoring workflows and publishing systems.
-
-Additionally, an extensible library of reusable
-document fragments is being developed, that serve as reference targets
-for global disambiguation, intermediaries for content exchange
-between systems and other services.
-
-Every component of the system is designed modularly and extensibly,
-and thus lay the groundwork for a potential full integration of
-interactive theorem proving systems into established informal document
-authoring workflows.
-
-\paragraph{} The general \sTeX workflow combines functionalities
-provided by several pieces of software:
-\begin{itemize}
-\item The \sTeX package collection to use semantic annotations in {\LaTeX} documents,
-\item \RusTeX \cite{RusTeX:on} to convert |tex| sources to (semantically enriched) |xhtml|,
-\item The \mmt system~\cite{uniformal:on}, that extracts semantic information from the
- thus generated |xhtml| and provides semantically informed added value services.
- Notably, \mmt integrates the \RusTeX system already.
-\end{itemize}
-
-\end{sfragment}
-
-\begin{sfragment}{Setup}
- There are two ways of using \sTeX: as a
- \begin{enumerate}
- \item way of writing {\LaTeX} more modularly (object-oriented Math) for creating PDF
- documents or
- \item foundation for authoring active documents in HTML5 instrumented with knowledge
- management services.
- \end{enumerate}
- Both are legitimate and useful. The first requires a significantly smaller
- tool-chain, so we describe it first. The second requires a much more substantial
- toolchain of knowledge management systems.
-
- Luckily, the \sTeX-IDE will take care of much of the setup required
- for the full toolchain, if you are willing to use it.
-
- \input{packages/stex-setup}
-
- \input{packages/stex-idesetup}
-
- \begin{sfragment}{Manual Setup}
-
- In lieu of using the \sTeX IDE, we can do the following:
-
- \begin{sfragment}[id=sec.stex-archives]{\sTeX Archives (Manual Setup)}
- Writing semantically annotated \sTeX becomes much easier, if we can use
- well-designed libraries of already annotated content. \sTeX provides such
- libraries as \sTeX archives -- i.e. GIT repositories at
- \url{https://gl.mathhub.info} -- most prominently the SMGLoM libraries at
- \url{https://gl.mathhub.info/smglom}.
-
- To do so, we set up a \textbf{local MathHub} by creating a MathHub directory
- \lstinline|<mhdir>|. Every \sTeX archive as an \textbf{archive path}
- \lstinline|<apath>| and a name \lstinline|<archive>|. We can clone the \sTeX
- archive by the following command-line instructions:
-\begin{lstlisting}[language=bash]
-cd <mhdir>/<apath>
-git clone https://gl.mathhub.info/smglom/<archive>.git
-\end{lstlisting}
- Note that \sTeX archives often depend on other archives, thus you should be
- prepared to clone these as well -- e.g. if \texttt{pdflatex} reports missing
- files.
- To make sure that \sTeX too knows where to find its archives, we need to set a global
- system variable |MATHHUB|, that points to your local |MathHub|-directory (see
- \sref{sec.stexarchives}).
-\begin{lstlisting}[language=bash]
-export MATHHUB="<mhdir>"
-\end{lstlisting}
- \end{sfragment}
-
- \begin{sfragment}{Manual Setup for Active Documents and Knowledge Management Services}
- Foregoing on the \sTeX IDE, we will need several additional (on top of the minimal
- setup above) pieces of software; namely:
- \begin{itemize}
- \item \textbf{The \mmt System} available
- \href{https://github.com/uniformal/MMT/tree/sTeX}{here}.
- We recommend following
- the setup routine documented
- \href{https://uniformal.github.io//doc/setup/}{here}.
-
- Following the setup routine (Step 3) will entail designating
- a |MathHub|-directory on your local file system, where
- the \mmt system will look for \sTeX/\mmt content archives.
-
- \item \textbf{\sTeX Archives} If we only care about {\LaTeX} and generating
- |pdf|s, we do not technically need \mmt at all; however, we still need the
- |MATHHUB| system variable to be set. Furthermore, \mmt can make downloading
- content archives we might want to use significantly easier, since it makes sure
- that all dependencies of (often highly interrelated) \sTeX archives are cloned
- as well.
-
- Once set up, we can run |mmt| in a shell and download an archive along with all
- of its dependencies like this: |lmh install <name-of-repository>|, or a whole
- \emph{group} of archives; for example, |lmh install smglom| will download all
- smglom archives.
- \item \textbf{\RusTeX} The \mmt system will also set up \RusTeX for you, which is
- used to generate (semantically annotated) |xhtml| from tex sources. In lieu of
- using \mmt, you can also download and use \RusTeX directly
- \href{https://github.com/slatex/RusTeX}{here}.
- \end{itemize}
- \end{sfragment}
- \end{sfragment}
-\end{sfragment}
-
-\begin{sfragment}[id=sec.sTeX-IDE]{The \sTeX IDE}
- \input{stex-ide}
-\end{sfragment}
-
-\input{stex-tutorial}
-
-
-\begin{sfragment}{Creating \sTeX Content}
-
- \input{packages/stex-basics}
-
- \begin{sfragment}{How Knowledge is Organized in \sTeX}
-
- \sTeX content is organized on multiple levels:
- \begin{enumerate}
- \item \sTeX \textbf{archives} (see \sref{sec.stexarchives})
- contain individual |.tex|-files.
- \item These may contain \sTeX \textbf{modules}, introduced via
- \stexcode"\begin{smodule}{ModuleName}".\iffalse\end{smodule}\fi
- \item Modules contain \sTeX \textbf{symbol declarations}, introduced via
- \stexcode"\symdecl{symbolname}", \stexcode"\symdef{symbolname}" and some other
- constructions. Most symbols have a \emph{notation} that can
- be used via a \emph{semantic macro} \stexcode"\symbolname" generated
- by symbol declarations.
- \item \sTeX \textbf{expressions} finally are built up from
- usages of semantic macros.
- \end{enumerate}
-
- \begin{mmtbox}
- \begin{itemize}
- \item \sTeX archives are simultaneously \mmt archives, and the same directory
- structure is consequently used.
- \item \sTeX modules correspond to \omdoc/\mmt \emph{theories}.
- \stexcode"\importmodule"s (and similar constructions) induce \mmt |include|s and
- other \emph{theory morphisms}, thus giving rise to a \emph{theory graph} in the
- \omdoc sense~\cite{RabKoh:WSMSML13}.
- \item Symbol declarations induce \omdoc/\mmt \emph{constants}, with optional
- (formal) \emph{type} and \emph{definiens} components.
- \item Finally, \sTeX expressions are converted to \omdoc/\mmt terms, which use the
- abstract syntax (and XML encoding) of \openmath \cite{BusCapCar:2oms04}.
- \end{itemize}
- \end{mmtbox}
- \end{sfragment}
-
- \begin{sfragment}[id=sec.stexarchives]{\sTeX Archives}
- \input{packages/stex-mathhub}
- \end{sfragment}
-
- \begin{sfragment}[id=sec.decls]{Module, Symbol and Notation Declarations}
- \input{packages/stex-modules}
- \input{packages/stex-symbols}
- \end{sfragment}
-
- \begin{sfragment}{Module Inheritance and Structures}
- The \sTeX features for modular document management are inherited from the OMDoc/MMT
- model that organizes knowledge into a graph, where the nodes are theories (called
- modules in \sTeX) and the edges are truth-preserving mappings (called theory
- morphismes in MMT). We have already seen modules/theories above.
-
- Before we get into theory morphisms in \sTeX we will see a very simple application of
- modules: managing multilinguality modularly.
-
- \begin{sfragment}{Multilinguality and Translations}
-
- If we load the \sTeX document class or package with the option |lang=<lang>|, \sTeX
- will load the appropriate \pkg{babel} language for you -- e.g. |lang=de| will load
- the babel language |ngerman|. Additionally, it makes \sTeX aware of the current
- document being set in (in this example) \emph{german}. This matters for reasons
- other than mere \pkg{babel}-purposes, though:
-
- Every \emph{module} is assigned a language. If no \sTeX
- package option is set that allows for inferring a language,
- \sTeX will check whether the current file name ends in
- e.g. |.en.tex| (or |.de.tex| or |.fr.tex|, or...) and
- set the language accordingly. Alternatively, a language
- can be explicitly assigned via
- \stexcode"\begin{smodule}[lang=<language>]{Foo}".
- \iffalse\end{smodule}\fi
-
- \begin{mmtbox}
- Technically, each |smodule|-environment induces \emph{two}
- \omdoc/\mmt theories:
- \stexcode"\begin{smodule}[lang=<lang>]{Foo}"
- \iffalse\end{smodule}\fi
- generates a theory |some/namespace?Foo| that only contains
- the ``formal'' part of the module -- i.e. exactly the
- content that is exported when using \stexcode"\importmodule".
-
- Additionally, \mmt generates a \emph{language theory}
- |some/namespace/Foo?<lang>| that includes |some/namespace?Foo|
- and contains all the other document content -- variable
- declarations, includes for each \stexcode"\usemodule", etc.
- \end{mmtbox}
-
- Notably, the language suffix in a filename is ignored
- for \stexcode"\usemodule", \stexcode"\importmodule"
- and in generating/computing URIs for modules. This however
- allows for providing \emph{translations} for modules
- between languages without needing to duplicate content:
-
- If a module |Foo| exists in e.g. english in a file |Foo.en.tex|,
- we can provide a file |Foo.de.tex| right next to it, and write
- \stexcode"\begin{smodule}[sig=en]{Foo}".
- \iffalse\end{smodule}\fi
- The |sig|-key then signifies, that the ``signature'' of the
- module is contained in the \emph{english} version of the module,
- which is immediately imported from there, just like
- \stexcode"\importmodule" would.
-
- Additionally to translating the informal content of a module
- file to different languages, it also allows for customizing
- notations between languages. For example,
- the \emph{least common multiple} of two numbers is often
- denoted as $\mathtt{lcm}(a,b)$ in english, but is
- called \emph{kleinstes gemeinsames Vielfaches} in german
- and consequently denoted as $\mathtt{kgV}(a,b)$ there.
-
- We can therefore imagine a german version of an lcm-module
- looking something like this:
-
- \begin{latexcode}[gobble=8]
- \begin{smodule}[sig=en]{lcm}
- \notation*{lcm}[de]{\comp{\mathtt{kgV}}(#1,#2)}
-
- Das \symref{lcm}{kleinste gemeinsame Vielfache}
- $\lcm{a,b}$ von zwei Zahlen $a,b$ ist...
- \end{smodule}
- \end{latexcode}
-
- If we now do \stexcode"\importmodule{lcm}"
- (or \stexcode"\usemodule{lcm}") within a \emph{german} document,
- it will also load the content of the german translation,
- including the |de|-notation for \stexcode"\lcm".
-
- \end{sfragment}
-
- \input{packages/stex-inheritance}
- \input{packages/stex-features}
- \end{sfragment}
-
- \begin{sfragment}{Primitive Symbols (The \sTeX Metatheory)}
- \input{packages/stex-metatheory}
- \end{sfragment}
-
-\end{sfragment}
-
-\begin{sfragment}[id=sec.textsymbols]{Using \sTeX Symbols}
- \input{packages/stex-terms}
- \input{packages/stex-references}
-\end{sfragment}
-
-\begin{sfragment}{\sTeX Statements}
- \input{packages/stex-statements}
- \input{packages/stex-proofs}
-
-\begin{sfragment}[id=sec.customhighlight]{Highlighting and Presentation Customizations}
-
- The environments starting with |s| (i.e. \stexcode"smodule", \stexcode"sassertion",
- \stexcode"sexample", \stexcode"sdefinition", \stexcode"sparagraph" and
- \stexcode"sproof") by default produce no additional output whatsoever (except for the
- environment content of course). Instead, the document that uses them (whether directly
- or e.g. via \stexcode"\inputref") can decide how these environments are supposed to look
- like.
-
- The \pkg{stexthm} package defines some default customizations that can be used, but of
- course many existing \LaTeX\xspace templates come with their own |definition|, |theorem|
- and similar environments that authors are supposed (or even required) to use. Their
- concrete syntax however is usually not compatible with all the additional arguments that
- \sTeX allows for semantic information.
-
- Therefore we introduced the separate environments \stexcode"sdefinition" etc. instead of
- using \stexcode"definition" directly. We allow authors to specify how these environments
- should be styled via the commands \stexcode"stexpatch*".
-
- \begin{function}{\stexpatchmodule,\stexpatchdefinition,
- \stexpatchassertion,\stexpatchexample,\stexpatchparagraph,
- \stexpatchproof}
- All of these commands take one optional and two proper arguments, i.e.\\
- \stexcode"\stexpatch*[<type>]{<begin-code>}{<end-code>}".
-
- After \stex reads and processes the optional arguments for these environments, (some
- of) their values are stored in the macros \stexcode"\s*<field>"
- (i.e. \stexcode"sexampleid", \stexcode"\sassertionname", etc.). It then checks for all
- the values |<type>| in the |type=|-list, whether an \stexcode"\stexpatch*[<type>]" for
- the current environment has been called. If it finds one, it uses the patches
- |<begin-code>| and |<end-code>| to mark up the current environment. If no patch for
- (any of) the type(s) is found, it checks whether and \stexcode"\stexpatch*" was called
- without optional argument.
- \end{function}
-
- For example, if we want to use a predefined |theorem| environment for
- \stexcode"sassertion"s with |type=theorem|, we can do
-\begin{latexcode}
-\stexpatchassertion[theorem]{\begin{theorem}}{\end{theorem}}
-\end{latexcode}
- ...or, rather, since e.g. |theorem|-like environments defined using \pkg{amsthm} take an
- optional title as argument, we can do:
-\begin{latexcode}
-\stexpatchassertion[theorem]
- {\ifx\sassertiontitle\@empty
- \begin{theorem}
- \else
- \begin{theorem}[\sassertiontitle]
- \fi}
- {\end{theorem}}
-\end{latexcode}
-
- Or, if we want \emph{all kinds of} \stexcode"sdefinition"s to use a predefined
- |definition|-environment irrespective of their |type=|, then we can issue the following
- customization patch:
-\begin{latexcode}
-\stexpatchdefinition
- {\ifx\sdefinitiontitle\@empty
- \begin{definition}
- \else
- \begin{definition}[\sdefinitiontitle]
- \fi}
- {\end{definition}}
-\end{latexcode}
-
- \begin{function}{\compemph,\varemph,\symrefemph,\defemph}
- Apart from the environments, we can control how \sTeX highlights variables, notation
- components, \stexcode"\symref"s and \stexcode"\definiendum"s, respectively.
-
- To do so, we simply redefine these four macros. For example, to highlight notation
- components (i.e. everything in a \stexcode"\comp") in blue, as in this document, we
- can do \stexcode"\def\compemph#1{\textcolor{blue}{#1}}". By default, |\compemph| et
- al do nothing.
- \end{function}
-
- \begin{function}{\compemph@uri,\varemph@uri,\symrefemph@uri,\defemph@uri}
- For each of the four macros, there exists an additional macro that takes the full URI
- of the relevant symbol currently being highlighted as a second argument. That allows
- us to e.g. use pdf tooltips and links. For example, this document uses\Ednote{MK: why
- |protected|, ... if we show that, then we should explain.}
-\begin{latexcode}
-\protected\def\symrefemph@uri#1#2{
- \pdftooltip{
- \symrefemph{#1}
- }{
- URI:~\detokenize{#2}
- }
-}
-\end{latexcode}
- By default, |\compemph@uri| is simply defined as |\compemph{#1}| (analogously for the
- other three commands).
-\end{function}
-\end{sfragment}
-\end{sfragment}
-\begin{sfragment}[id=sec.references]{Cross References}
- \input{packages/stex-references}
-\end{sfragment}
-
-\begin{sfragment}{Additional Packages}
- \begin{sfragment}{Tikzinput: Treating TIKZ code as images}
- \input{packages/stex-tikzinput}
- \end{sfragment}
- \begin{sfragment}{Modular Document Structuring}
- \input{packages/stex-document-structure}
- \end{sfragment}
- \begin{sfragment}{Slides and Course Notes}
- \input{packages/stex-notesslides}
- \end{sfragment}
- \begin{sfragment}{Representing Problems and Solutions}
- \input{packages/stex-problem}
- \end{sfragment}
- \begin{sfragment}{Homeworks, Quizzes and Exams}
- \input{packages/stex-hwexam}
- \end{sfragment}
-\end{sfragment}
-
-\ifinfulldoc\else
-\newpage
-\printbibliography
-\end{document}
-\fi
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: t
-%%% End:
-
-% LocalWords: stex-docheader infulldoctrue l@subsubsection toclevel@part ExplSyntaxOff
-% LocalWords: l_document_structure_section_level_int dangerbox mmtbox omdoc OBJref lmh
-% LocalWords: own:fifom MueRabRot:rslffml20 sec.stexarchives stex-mathhub ngerman a,b
-% LocalWords: Metatheory sec.customhighlight sproof stexthm xspace stexpatchmodule
-% LocalWords: stexpatchexample stexpatchparagraph sexampleid amsthm sassertiontitle
-% LocalWords: sdefinitiontitle compemph varemph srefsymuri stex-hwexam TeXLive:on tlmgr
-% LocalWords: stexls:on,stexls-vscode-plugin:on
diff --git a/macros/latex/contrib/stex/doc/stex-tutorial.pdf b/macros/latex/contrib/stex/doc/stex-tutorial.pdf
new file mode 100644
index 0000000000..1c380fadde
--- /dev/null
+++ b/macros/latex/contrib/stex/doc/stex-tutorial.pdf
Binary files differ
diff --git a/macros/latex/contrib/stex/doc/stex-tutorial.tex b/macros/latex/contrib/stex/doc/stex-tutorial.tex
deleted file mode 100644
index 7b3b723826..0000000000
--- a/macros/latex/contrib/stex/doc/stex-tutorial.tex
+++ /dev/null
@@ -1,354 +0,0 @@
- \begin{sfragment}{A First \sTeX Document}
- Having set everything up, we can write a first
- \sTeX document. As an example, we will use the
- |smglom/calculus| and |smglom/arithmetics| archives,
- which should be present in the designated |MathHub|-folder,
- and write a small fragment defining the \emph{geometric series}:
-
- % \textcolor{red}{TODO: use some sTeX-archive instead of smglom,
- % use a convergence-notion that includes the limit,
- % mark-up the theorem properly}
-
- \begin{framed}\begin{latexcode}[gobble=8]
- \documentclass{article}
- \usepackage{stex,xcolor,stexthm}
-
- \begin{document}
- \begin{smodule}{GeometricSeries}
- \importmodule[smglom/calculus]{series}
- \importmodule[smglom/arithmetics]{realarith}
-
- \symdef{geometricSeries}[name=geometric-series]{\comp{S}}
-
- \begin{sdefinition}[for=geometricSeries]
- The \definame{geometricSeries} is the \symname{series}
- \[\defeq{\geometricSeries}{\definiens{
- \infinitesum{\svar{n}}{1}{
- \realdivide[frac]{1}{
- \realpower{2}{\svar{n}}
- }}
- }}.\]
- \end{sdefinition}
-
- \begin{sassertion}[name=geometricSeriesConverges,type=theorem]
- The \symname{geometricSeries} \symname{converges} towards $1$.
- \end{sassertion}
- \end{smodule}
- \end{document}
- \end{latexcode}\end{framed}
-
- Compiling this document with |pdflatex| should yield
- the output
-
- \begin{mdframed}
- \noindent\textbf{Definition 0.1. }\ The
- \pdftooltip{\textcolor{blue}{\textbf{geometric series}}}{URI: file://your/file/name/here?GeometricSeries?geometric-series}
- is the
- \pdftooltip{\textcolor{blue}{series}}{URI: http://mathhub.info/smglom/calculus?series?series}
- \[
- \pdftooltip{\textcolor{blue}S}{URI: file://your/file/name/here?GeometricSeries?geometric-series}
- \pdftooltip{\textcolor{blue}{:=}}{URI: http://mathhub.info/smglom/mv?defeq?definitional-equation}
- \mathop{\pdftooltip{\textcolor{blue}{\sum}}{URI: http://mathhub.info/smglom/calculus?series?infinitesum}
- }_{
- \pdftooltip{\textcolor{gray}{n}}{Variable var://n}=1
- }^{
- \pdftooltip{\textcolor{blue}\infty}{URI: http://mathhub.info/smglom/calculus?series?infinitesum}
- } \frac{1}{2^{\pdftooltip{\textcolor{gray}{n}}{Variable var://n}}}
- .\]
- \noindent\textbf{Theorem 0.2. }\ The
- \pdftooltip{\textcolor{blue}{geometric series}}{URI: file://your/file/name/here?GeometricSeries?geometric-series}
- \pdftooltip{\textcolor{blue}{converges}}{URI: http://mathhub.info/smglom/calculus?sequenceConvergence?converges} towards $1$.
- \end{mdframed}
-
- Move your cursor over the various highlighted parts of the document -- depending on
- your pdf viewer, this should yield some interesting (but possibly for now cryptic)
- information.
-
- \begin{sparagraph}[type=remark]
- Note that all of the highlighting, tooltips, coloring and the environment headers
- come from \pkg{stexthm} -- by default, the amount of additional packages loaded
- is kept to a minimum and all the presentations can be customized,
- see \sref{sec.customhighlight}.
- \end{sparagraph}
-
- Let's investigate this document in detail to understand the respective parts of the
- \sTeX markup infrastructure:\bigskip
-
- \begin{environment}{smodule}
- \begin{latexcode}[numbers=none,aboveskip=0pt,belowskip=0pt,gobble=8]
- \begin{smodule}{GeometricSeries}
- ...
- \end{smodule}
- \end{latexcode}
- First, we open a new \emph{module} called |GeometricSeries|. The main purpose of
- the |smodule| environment is to group the contents and associate it with a
- \emph{globally unique} identifier (URI), which is computed from the name
- |GeometricSeries| and the document context.
-
- (Depending on your pdf viewer), the URI should pop up in a tooltip if you hover over
- the word \pdftooltip{\textcolor{blue}{\textbf{geometric series}}}{URI:
- file://your/file/name/here?GeometricSeries?geometric-series}.
- \end{environment}\bigskip
-
- \begin{function}{\importmodule}
- \begin{latexcode}[numbers=none,aboveskip=0pt,belowskip=0pt,gobble=8]
- \importmodule[smglom/calculus]{series}
- \importmodule[smglom/arithmetics]{realarith}
- \end{latexcode}
- Next, we \emph{import} two modules -- |series| from the \sTeX archive
- |smglom/calculus|, and |realarith| from the \sTeX archive |smglom/arithmetics|. If
- we investigate these archives, we find the files |series.en.tex| and
- |realarith.en.tex| (respectively) in their respective |source|-folders, which
- contain the statements \stexcode"\begin{smodule}{series}" and
- \stexcode"\begin{smodule}{realarith}" (respectively).
- \iffalse\end{smodule}\end{smodule}\fi
-
- The \stexcode"\importmodule"-statements make all \stex symbols and associated
- semantic macros (e.g. \stexcode"\infinitesum", \stexcode"\realdivide",
- \stexcode"\realpower") in the imported module available to the current module
- |GeometricSeries|. The module |GeometricSeries| ``exports'' all of these symbols to
- all modules imports it via an \stexcode"\importmodule{GeometricSeries}"
- instruction. Additionally it exports the local symbol \stexcode"\geometricSeries".
- \end{function}
-
- \begin{function}{\usemodule}
- If we only want to \emph{use} the content of some module |Foo|,
- e.g. in remarks or examples, but none
- of the symbols in our current module actually \emph{depend} on
- the content of |Foo|, we can use \stexcode"\usemodule" instead -- like
- \stexcode"\importmodule", this will make the module content available,
- but will \emph{not} export it to other modules.
- \end{function}\bigskip
-
- \begin{function}{\symdef}
- \begin{latexcode}[numbers=none,aboveskip=0pt,belowskip=0pt,gobble=6]
- \symdef{GeometricSeries}[name=geometric-series]{\comp{S}}
- \end{latexcode}
- Next, we introduce a new \emph{symbol} with name
- |geometric-series| and assign it the semantic macro
- \stexcode"\geometricSeries".
- \stexcode"\symdef" also immediately assigns this symbol a \emph{notation},
- namely $S$.
- \end{function}
-
- \begin{function}{\comp}
- The macro \stexcode"\comp" marks the $S$ in the notation as a
- \emph{notational component}, as opposed to e.g. arguments
- to \stexcode"\geometricSeries".
- It is the notational components that get highlighted
- and associated with the corresponding symbol (i.e. in this
- case |geometricSeries|). Since \stexcode"\geometricSeries" takes
- no arguments, we can wrap the whole notation in a \stexcode"\comp".
- \end{function}\bigskip
-
- \begin{latexcode}[numbers=none,aboveskip=0pt,belowskip=0pt,gobble=8]
- \begin{sdefinition}[for=geometricSeries]
- ...
- \end{sdefinition}
- \begin{sassertion}[name=geometricSeriesConverges,type=theorem]
- ...
- \end{sassertion}
- \end{latexcode}
- What follows are two \sTeX-\emph{statements} (e.g. definitions,
- theorems, examples, proofs, ...). These are semantically marked-up
- variants of the usual environments, which take additional optional
- arguments (e.g. |for=|, |type=|, |name=|). Since many \LaTeX\xspace templates
- predefine environments like |definition| or |theorem| with
- different syntax, we use \stexcode"sdefinition",
- \stexcode"sassertion", \stexcode"sexample"
- etc. instead. You can customize these environments to e.g.
- simply wrap around some predefined |theorem|-environment.
- That way, we can still use \stexcode"sassertion" to provide semantic
- information, while being fully compatible with (and using
- the document presentation of) predefined environments.
-
- In our case, the \pkg{stexthm}-package patches
- e.g. \stexcode"\begin{sassertion}[type=theorem]" to use
- a |theorem|-environment defined (as usual) using the \pkg{amsthm} package.
- \bigskip \iffalse \end{sassertion}\fi
-
- \begin{function}{\symname}
- \begin{latexcode}[numbers=none,aboveskip=0pt,belowskip=0pt,gobble=6]
- ... is the \symname{?series}
- \end{latexcode}
- The \stexcode"\symname"-command prints the name of a symbol,
- highlights it (based on customizable settings)
- and associates the text printed with the corresponding
- symbol.
-
- Note that the argument of \stexcode"\symref" can be
- an imported symbol
- (here the |series| symbol is imported from the |series| module). \sTeX tries to
- determine the full symbol URI from the argument. If there are name clashes in or
- with the imported symbols, the name of the exporting module can be prepended to the
- symbol name before the |?| character.
-
- If you hover over the word
- \pdftooltip{\textcolor{blue}{series}}{URI: http://mathhub.info/smglom/calculus?series?series}
- in the pdf output, you should see a tooltip showing the full URI
- of the symbol used.
- \end{function}
- \begin{function}{\symref}
- The \stexcode"\symname"-command is a special case of the more general
- \stexcode"\symref"-command, which allows customizing the precise text associated
- with a symbol. \stexcode"\symref" takes two arguments: the first ist the symbol
- name (or macro name), and the second a variant verbalization of the symbol, e.g. an inflection
- variant, a different language or a synonym. In our example
- \stexcode"\symname{?series}" abbreviates \stexcode|\symref{?series}{series}|.
-
- \end{function}
- \begin{function}{\definame,\definiendum}
- \begin{latexcode}[numbers=none,aboveskip=0pt,belowskip=0pt,gobble=6]
- The \definame{geometricSeries} ...
- \end{latexcode}
- The \stexcode"sdefinition"-environment provides two additional
- macros, \stexcode"\definame" and \stexcode"\definiendum" which behave
- similarly to \stexcode"\symname" and \stexcode"\symref", but explicitly mark
- the symbols as \emph{being defined} in this environment,
- to allow for special highlighting.
- \end{function}\bigskip
-
- \begin{latexcode}[numbers=none,aboveskip=0pt,belowskip=0pt,gobble=8]
- \[\defeq{\geometricSeries}{\definiens{
- \infinitesum{\svar{n}}{1}{
- \realdivide[frac]{1}{
- \realpower{2}{\svar{n}}
- }}
- }}.\]
- \end{latexcode}
- The next snippet -- set in a math environment -- uses
- several semantic macros imported from (or recursively via)
- |series| and |realarithmetics|, such as \stexcode"\defeq",
- \stexcode"\infinitesum",
- etc. In math mode, using a semantic macro inserts its (default)
- definition. A semantic macro can have several notations -- in
- that case, we can explicitly choose a specific notation by
- providing its identifier as an optional argument; e.g.
- \stexcode"\realdivide[frac]{a}{b}" will use the explicit notation named |frac|
- of the semantic macro \stexcode"\realdivide", which yields $\frac ab$
- instead of $a/b$.
- \begin{function}{\svar}
- The \stexcode"\svar{n}" command marks up the |n| as a variable
- with name |n| and notation |n|.
- \end{function}
- \begin{function}{\definiens}
- The \stexcode"sdefinition"-environment additionally provides the
- \stexcode"\definiens"-command, which allows for explicitly
- marking up its argument as the \emph{definiens} of the
- symbol currently being defined.
- \end{function}
-
- \begin{sfragment}{\omdoc/xhtml Conversion}
- So, if we run |pdflatex| on our document, then \sTeX yields pretty colors and
- tooltips\footnote{...and hyperlinks for symbols, and indices, and allows reusing
- document fragments modularly, and...}. But \sTeX becomes a lot more powerful if
- we additionally convert our document to |xhtml| while preserving all the \sTeX
- markup in the result.
-
- \textcolor{red}{TODO VSCode Plugin}
-
- Using \rustex \cite{RusTeX:on}, we can convert the document to |xhtml|
- using the command |rustex -i /path/to/file.tex -o /path/to/outfile.xhtml|.
- Investigating the resulting file, we notice additional semantic
- information resulting from our usage of semantic macros,
- \stexcode"\symref" etc. Below is the (abbreviated) snippet inside
- our \stexcode"\definiens" block:
-
-\begin{lstlisting}[escapechar=!,
-morekeywords={property,resource,stex:comp,stex:arg,stex:OMA,stex:OMV}]
-<mrow resource="" property="stex:definiens">
- <mrow resource="...?series?infinitesum" property="stex:OMBIND">
- <munderover displaystyle="true">
- <mo resource="...?series?infinitesum" property="stex:comp">!$\Sigma$!</mo>
- <mrow>
- <mrow resource="1" property="stex:arg">
- <mi resource="var://n" property="stex:OMV">n</mi>
- </mrow>
- <mo resource="...?series?infinitesum" property="stex:comp">=</mo>
- <mi resource="2" property="stex:arg">1</mi>
- </mrow>
- <mi resource="...?series?infinitesum" property="stex:comp">!$\infty$!</mi>
- </munderover>
- <mrow resource="3" property="stex:arg">
- <mfrac resource="...?realarith?division#frac#" property="stex:OMA">
- <mi resource="1" property="stex:arg">1</mi>
- <mrow resource="2" property="stex:arg">
- <msup resource="...realarith?exponentiation" property="stex:OMA">
- <mi resource="1" property="stex:arg">2</mi>
- <mrow resource="2" property="stex:arg">
- <mi resource="var://n" property="stex:OMV">n</mi>
- </mrow>
- </msup>
- </mrow>
- </mfrac>
- </mrow>
- </mrow>
-</mrow>
- \end{lstlisting}
- ...containing all the semantic information. The \mmt system
- can extract from this the following \openmath snippet:
-
- \begin{lstlisting}[escapechar=!]
-<OMBIND>
- <OMID name="...?series?infinitesum"/>
- <OMV name="n"/>
- <OMLIT name="1"/>
- <OMA>
- <OMS name="...?realarith?division"/>
- <OMLIT name="1"/>
- <OMA>
- <OMS name="...realarith?exponentiation"/>
- <OMLIT name="2"/>
- <OMV name="n"/>
- </OMA>
- </OMA>
-</OMBIND>
- \end{lstlisting}
- ...giving us the full semantics of the snippet, allowing for
- a plurality of knowledge management services -- in particular
- when serving the |xhtml|.
-
- \begin{remark}
- Note that the |html| when opened in a browser will
- look slightly different than the |pdf| when it comes
- to highlighting semantic content -- that is because
- naturally |html| allows for much more powerful
- features than |pdf| does. Consequently, the |html|
- is intended to be served by a system like \mmt,
- which can pick up on the semantic information and
- offer much more powerful highlighting, linking
- and similar features, and being customizable by
- \emph{readers} rather than being prescribed by an author.
-
- Additionally, not all browsers (most notably Chrome)
- support \mathml natively, and might require
- additional external JavaScript libraries such as
- MathJax to render mathematical formulas properly.
- \end{remark}
- \end{sfragment}
-
-
- \begin{sfragment}{\mmt/\omdoc Conversion}
- Another way to convert our document to \emph{actual}
- \mmt/\omdoc is to put it in an \sTeX \textbf{archive}
- (see \sref{sec.stexarchives}) and have \mmt take care of
- everything.
-
- Assuming the above file is |source/demo.tex| in
- an \sTeX archive |MyTest|, you can run \mmt and
- do
- |build MyTest stex-omdoc demo.tex| to convert the
- document to both |xhtml| (which you will find in
- |xhtml/demo.xhtml| in the archive) and formal
- \mmt/\omdoc, which you can subsequently view in
- the \mmt browser (see \url{https://uniformal.github.io//doc/applications/server.html#the-mmt-web-site}
- for details).
- \end{sfragment}
-\end{sfragment}
-
-%%% Local Variables:
-%%% mode: latex
-%%% TeX-master: "stex-manual"
-%%% End:
-
-% LocalWords: coloring sec.customhighlight realarith infinitesum realarithmetics