summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/stex/README.md52
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-basics.tex35
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-document-structure.tex156
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-features.tex277
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-hwexam.tex85
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-inheritance.tex132
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-mathhub.tex166
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-metatheory.tex31
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-modules.tex74
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-problem.tex152
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-proofs.tex215
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-references.tex9
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-slides.tex213
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-statements.tex146
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-symbols.tex588
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-terms.tex178
-rw-r--r--Master/texmf-dist/doc/latex/stex/packages/stex-tikzinput.tex62
-rw-r--r--Master/texmf-dist/doc/latex/stex/stex-abstract.tex24
-rw-r--r--Master/texmf-dist/doc/latex/stex/stex-doc.pdfbin1467004 -> 1645539 bytes
-rw-r--r--Master/texmf-dist/doc/latex/stex/stex-doc.tex13
-rw-r--r--Master/texmf-dist/doc/latex/stex/stex-docheader.tex520
-rw-r--r--Master/texmf-dist/doc/latex/stex/stex-manual.pdfbin670569 -> 983933 bytes
-rw-r--r--Master/texmf-dist/doc/latex/stex/stex-manual.tex972
-rw-r--r--Master/texmf-dist/doc/latex/stex/stex-tutorial.tex354
-rw-r--r--Master/texmf-dist/source/latex/stex/extensions/document-structure.dtx589
-rw-r--r--Master/texmf-dist/source/latex/stex/extensions/hwexam.dtx188
-rw-r--r--Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx379
-rw-r--r--Master/texmf-dist/source/latex/stex/extensions/problem.dtx429
-rw-r--r--Master/texmf-dist/source/latex/stex/extensions/stex-extensions.ins2
-rw-r--r--Master/texmf-dist/source/latex/stex/extensions/tikzinput.dtx83
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-basics.dtx416
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-features.dtx1040
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-inheritance.dtx212
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-mathhub.dtx110
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-metatheory.dtx70
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-modules.dtx167
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-others.dtx27
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-proofs.dtx403
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-references.dtx11
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-statements.dtx225
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-symbols.dtx745
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex-terms.dtx691
-rw-r--r--Master/texmf-dist/source/latex/stex/stex/stex.ins2
-rw-r--r--Master/texmf-dist/tex/latex/stex/document-structure.cls53
-rw-r--r--Master/texmf-dist/tex/latex/stex/document-structure.sty121
-rw-r--r--Master/texmf-dist/tex/latex/stex/etc/beamerthemesTeX.sty9
-rw-r--r--Master/texmf-dist/tex/latex/stex/etc/lststex.sty14
-rw-r--r--Master/texmf-dist/tex/latex/stex/etc/stex-backend-latexml.cfg56
-rw-r--r--Master/texmf-dist/tex/latex/stex/etc/stex-backend-pdflatex.cfg10
-rw-r--r--Master/texmf-dist/tex/latex/stex/etc/stex-backend-rustex.cfg59
-rw-r--r--Master/texmf-dist/tex/latex/stex/etc/stex-logo.sty7
-rw-r--r--Master/texmf-dist/tex/latex/stex/etc/stexthm.sty45
-rw-r--r--Master/texmf-dist/tex/latex/stex/hwexam.cls35
-rw-r--r--Master/texmf-dist/tex/latex/stex/hwexam.sty145
-rw-r--r--Master/texmf-dist/tex/latex/stex/notesslides.cls43
-rw-r--r--Master/texmf-dist/tex/latex/stex/notesslides.sty85
-rw-r--r--Master/texmf-dist/tex/latex/stex/problem.sty199
-rw-r--r--Master/texmf-dist/tex/latex/stex/stex-tikzinput.sty56
-rw-r--r--Master/texmf-dist/tex/latex/stex/stex.cls34
-rw-r--r--Master/texmf-dist/tex/latex/stex/stex.sty3495
-rw-r--r--Master/texmf-dist/tex/latex/stex/tikzinput.sty2
61 files changed, 9304 insertions, 5407 deletions
diff --git a/Master/texmf-dist/doc/latex/stex/README.md b/Master/texmf-dist/doc/latex/stex/README.md
index 13caa1f7342..b5eed1a41fa 100644
--- a/Master/texmf-dist/doc/latex/stex/README.md
+++ b/Master/texmf-dist/doc/latex/stex/README.md
@@ -3,8 +3,13 @@ sTeX: An Infrastructure for Semantic Preloading of LaTeX Documents
![CI Status](https://github.com/slatex/sTeX/workflows/CI/badge.svg)
This repository contains the sTeX package collection, a version of TeX/LaTeX that allows
-to markup TeX/LaTeX documents semantically without leaving the document format,
-essentially turning it into a document format for mathematical knowledge management (MKM).
+to markup TeX/LaTeX 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](https://github.com/slatex/RusTeX) 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).
## Copyright & License
@@ -12,12 +17,41 @@ Copyright (c) 2022 Michael Kohlhase
The package is distributed under the terms of the LaTeX Project Public License (LPPL)
## Maintainers
-Michael Kohlhase, Dennis Müller, FAU Erlangen-Nürnberg.
+[Michael Kohlhase](https://kwarc.info/kohlhase), [Dennis Müller](https://kwarc.info/people/dmueller), FAU Erlangen-Nürnberg.
## Documentation
-See the
-[documentation of the sTeX package](https://github.com/slatex/sTeX/blob/main/doc/stex-doc.pdf)
-for details.
+The [sTeX manual ](https://github.com/slatex/sTeX/blob/main/doc/stex-manual.pdf) gives a
+general introduction and motivation. The
+[sTeX package documentation](https://github.com/slatex/sTeX/blob/main/doc/stex-doc.pdf)
+gives the details of the implementation. A complete list of sTeX-related publications can
+be found [here](https://kwarc.github.io/bibs/sTeX/).
+
+## sTeX Corpus & Best Practices
+
+sTeX comes with a large corpus of pre-annotated materials that act as evaluation grounds
+and regression tests for the sTeX functionality and best practices that are publicly
+available.
+* [HelloWorld](https://gl.mathhub.info/HelloWorld) a collection of simple hello world
+ examples the show off the best practices of sTeX annotation.
+* [SMGLoM](https://gl.mathhub.info/smglom), the Semantic, Multilingual Glossary of
+ Mathematics (and similar disciplines). SMGloM provides a large set of definitions and
+ well-designed semantic macros for core mathematical (and computation) concepts and
+ objects. This resource greatly facilitates "getting off the ground" in semantic
+ annotation.
+* [MiKoMH](https://gl.mathhub.info/MiKoMH) a set of semantically annotated courses in
+ computer science and (symbolic) AI (ca. 5000 pages of slides and notes). Ca. 3000
+ problem/solutions exist are only available upon request.
+* [sTeX3 Labs](https://gl.mathhub.info/sTeX) a set of experimental re-formalizations of
+ (mostly) [SMGLoM](https://gl.mathhub.info/smglom) material to fully take advantage of
+ the sTeX3 functionality and the
+ [rusTeX](https://github.com/slatex/RusTeX)/[MMT](https://uniformal.github.io) pipeline
+ and knowledge managemen facilities.
+
+All of these are hosted on [MathHub](https://mathhub.info), an experimental portal for the
+management of active mathematical documents and flexiformal mathematics. The organization
+of the material into "mathematical archives" (GIT repositories with a particular
+standardized structure on [a GitLab repository management server](https://gl.mathhub.info)
+greatly enhances modularization and the provision of added value services.
## Setup
@@ -31,10 +65,10 @@ Then update your `TEXINPUTS` environment variable, e.g. by placing the followin
export TEXINPUTS="$(TEXINPUTS):<sTeXDIR>//:
```
-Similarly, set your `MATHHUB` environment variable to where you intend to keep your sTeX archives. For details, see the documentation linked above.
+Similarly, set your `MATHHUB` environment variable to where you intend to keep your sTeX
+archives. For details, see the documentation linked above. For a LaTeX IDE, update the directory path where `pdflatex` looks for paths.
-For a LaTeX IDE, update the directory path where `pdflatex` looks for paths.
-For larger documents it may be necessary to enlarge the internal memory allocation of the TEX/LATEX executables. This can be done by adding the following configurations in `texmf.cnf` (or changing them, if they already exist).
+For larger documents it may (rarely) be necessary to enlarge the internal memory allocation of the TEX/LATEX executables. This can be done by adding the following configurations in `texmf.cnf` (or changing them, if they already exist).
```
param_size = 20000 % simultaneous macro parameters, also applies to MP
nest_size = 1000 % simultaneous semantic levels (e.g., groups)
diff --git a/Master/texmf-dist/doc/latex/stex/packages/stex-basics.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-basics.tex
index daa6d6418d2..f766b9b22f1 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-basics.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-basics.tex
@@ -1,3 +1,9 @@
+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:
@@ -5,12 +11,31 @@ options:
\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.
- \item[\texttt{sms}] (\meta{boolean}) use \emph{persisted}
- mode (not yet implemented).
+ 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.
-\end{description} \ No newline at end of file
+ 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/Master/texmf-dist/doc/latex/stex/packages/stex-document-structure.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-document-structure.tex
index 1c8fe97dac2..f8d570ea5e0 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-document-structure.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-document-structure.tex
@@ -1 +1,155 @@
-\textcolor{red}{TODO: document-structure documentation} \ No newline at end of file
+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.
+
+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}
+
+\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, they need to be protected by |\protect|\ednote{MK: still?}, and 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.\ednote{MK:
+ We need a substitute for the ``Note that here the |display=flow| on the |sfragment|
+ environment prevents 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}
+
+\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| environment 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.
+
+\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}
+
+%%% 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/Master/texmf-dist/doc/latex/stex/packages/stex-features.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-features.tex
index e70bbaa0e84..b5ce5906d15 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-features.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-features.tex
@@ -1,18 +1,173 @@
+\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.
+\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}
+\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''
@@ -20,48 +175,64 @@ 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}
+\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:
-\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}
-} \ No newline at end of file
+% 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/Master/texmf-dist/doc/latex/stex/packages/stex-hwexam.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-hwexam.tex
index 5f1758b0150..5aced96e664 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-hwexam.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-hwexam.tex
@@ -1 +1,84 @@
-\textcolor{red}{TODO: hwexam documentation} \ No newline at end of file
+
+The \pkg{hwexam} package and class supplies an infrastructure that allows to format
+nice-looking assignment sheets by simply including problems from problem files marked up
+with the \pkg{roblem} package. It is designed to be compatible with |problems.sty|, and
+inherits some of the functionality.
+
+\begin{variable}{solutions,notes,hints,gnotes,pts,min}
+ The \pkg{wexam} package and class take the options |solutions|, |notes|, |hints|,
+ |gnotes|, |pts|, |min|, and |boxed| that are just passed on to the \pkg{problems}
+ package (cf. its documentation for a description of the intended behavior).
+\end{variable}
+
+This package supplies the \DescribeEnv{assignment}|assignment| environment that groups
+problems into assignment sheets. It takes an optional KeyVal argument with the keys
+\DescribeMacro{number}|number| (for the assignment number; if none is given, 1 is
+assumed as the default or --- in multi-assignment documents --- the ordinal of the
+|assignment| environment), \DescribeMacro{title}|title| (for the assignment title; this
+is referenced in the title of the assignment sheet), \DescribeMacro{type}|type| (for the
+assignment type; e.g. ``quiz'', or ``homework''), \DescribeMacro{given}|given| (for the
+date the assignment was given), and \DescribeMacro{due}|due| (for the date the
+assignment is due).
+
+Furthermore, the \pkg{hwexam} package takes the option
+\DescribeMacro{multiple}|multiple| that allows to combine multiple assignment sheets
+into a compound document (the assignment sheets are treated as section, there is a table
+of contents, etc.).
+
+Finally, there is the option \DescribeMacro{test}|test| that modifies the behavior to
+facilitate formatting tests. Only in |test| mode, the macros |\testspace|,
+|\testnewpage|, and |\testemptypage| have an effect: they generate space for the
+students to solve the given problems. Thus they can be left in the {\LaTeX} source.
+
+\DescribeMacro{\testspace}|\testspace| takes an argument that expands to a dimension,
+and leaves vertical space accordingly. \DescribeMacro{\testnewpage}|\testnewpage| makes
+a new page in |test| mode, and \DescribeMacro{\testemptypage}|\testemptypage| generates
+an empty page with the cautionary message that this page was intentionally left empty.
+
+Finally, the \DescribeEnv{testheading}|\testheading| takes an optional keyword argument
+where the keys \DescribeMacro{duration}|duration| specifies a string that specifies the
+duration of the test, \DescribeMacro{min}|min| specifies the equivalent in number of
+minutes, and \DescribeMacro{reqpts}|reqpts| the points that are required for a perfect
+grade.
+
+\begin{latexcode}
+\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}
+
+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}
+\makeatother
+\title{320101 General Computer Science (Fall 2010)}
+\begin{testheading}[duration=one hour,min=60,reqpts=27]
+ good luck
+\end{testheading}
+\end{minipage}
+\end{center}
+\ednote{MK: The first three ``problems'' come from the stex examples above, how do we get rid
+ of this?}
+
+\begin{function}{\inputassignment}
+ The |\inputassignment| macro can be used to input an assignment from another file. It
+ takes an optional KeyVal argument and a second argument which is a path to the file
+ containing the problem (the macro assumes that there is only one |assignment|
+ environment in the included file). The keys |number|, |title|, |type|, |given|, and
+ |due| are just as for the |assignment| environment and (if given) overwrite the ones
+ specified in the |assignment| environment in the included file.
+\end{function}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "../stex-manual"
+%%% End:
diff --git a/Master/texmf-dist/doc/latex/stex/packages/stex-inheritance.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-inheritance.tex
index 41631f94d27..be7c4e68ec0 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-inheritance.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-inheritance.tex
@@ -1 +1,131 @@
-\textcolor{red}{TODO: inheritance documentation} \ No newline at end of file
+\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/Master/texmf-dist/doc/latex/stex/packages/stex-mathhub.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-mathhub.tex
index 4b05134e70d..fb872acfbad 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-mathhub.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-mathhub.tex
@@ -1,5 +1,6 @@
\begin{sfragment}{The Local MathHub-Directory}
- |\usemodule|, |\importmodule|, |\inputref| etc. allow for
+ \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
@@ -7,30 +8,30 @@
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 three means:
+ \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.
- |\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 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| needs to be stored in the
+ 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
@@ -43,19 +44,41 @@
|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 |\libinput|.
+ 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 |\libinput|
+ 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, instructing \sTeX (and associated software)
- of various properties of an archive. For example,
- the |MANIFEST.MF| of the |smglom/calculus|-archive looks like this:
+ 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}
@@ -86,4 +109,95 @@
e.g. for |lmh install|.
\end{itemize}
-\end{sfragment} \ No newline at end of file
+\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/Master/texmf-dist/doc/latex/stex/packages/stex-metatheory.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-metatheory.tex
index 1585ba504c8..4feb646eb9f 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-metatheory.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-metatheory.tex
@@ -1 +1,30 @@
-\textcolor{red}{TODO: metatheory documentation} \ No newline at end of file
+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/Master/texmf-dist/doc/latex/stex/packages/stex-modules.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-modules.tex
index c067f28a1c3..424c2200e85 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-modules.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-modules.tex
@@ -1 +1,73 @@
-\textcolor{red}{TODO: modules documentation} \ No newline at end of file
+\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/Master/texmf-dist/doc/latex/stex/packages/stex-problem.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-problem.tex
index 1ce5aaa3a23..a90c36412d0 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-problem.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-problem.tex
@@ -1 +1,151 @@
-\textcolor{red}{TODO: problem documentation} \ No newline at end of file
+The \pkg{problem} package supplies an infrastructure that allows specify problem. Problems
+are text fragments that come with auxiliary functions: hints, notes, and
+solutions\footnote{for the moment multiple choice problems are not supported, but may
+ well be in a future version}. Furthermore, we can specify how long the solution to a
+given problem is estimated to take and how many points will be awarded for a perfect
+solution.
+
+Finally, the \pkg{problem} package facilitates the management of problems in small files,
+so that problems can be re-used in multiple environment.
+
+\begin{function}{solutions,notes,hints,gnotes,pts,min,boxed,test}
+ The \pkg{problem} package takes the options |solutions| (should solutions be output?),
+ |notes| (should the problem notes be presented?), |hints| (do we give the hints?),
+ |gnotes| (do we show grading notes?), |pts| (do we display the points awarded for
+ solving the problem?), |min| (do we display the estimated minutes for problem
+ soling). If theses are specified, then the corresponding auxiliary parts of the problems
+ are output, otherwise, they remain invisible.
+
+ The |boxed| option specifies that problems should be formatted in framed boxes so that
+ they are more visible in the text. Finally, the |test| option signifies that we are in a
+ test situation, so this option does not show the solutions (of course), but leaves space
+ for the students to solve them.
+\end{function}
+
+\begin{environment}{problem}
+ The main environment provided by the \pkg{problem}package is (surprise surprise) the
+ |problem| environment. It is used to mark up problems and exercises. The environment
+ takes an optional KeyVal argument with the keys |id| as an identifier that can be
+ reference later, |pts| for the points to be gained from this exercise in homework or
+ quiz situations, |min| for the estimated minutes needed to solve the problem, and
+ finally |title| for an informative title of the problem.
+\end{environment}
+
+\stexexample{%
+\documentclass{article}
+\usepackage[solutions,hints,pts,min]{problem}
+\begin{document}
+ \begin{sproblem}[id=elefants,pts=10,min=2,title=Fitting Elefants]
+ How many Elefants can you fit into a Volkswagen beetle?
+ \begin{hint}
+ Think positively, this is simple!
+ \end{hint}
+ \begin{exnote}
+ Justify your answer
+ \end{exnote}
+\begin{solution}[for=elefants,height=3cm]
+ Four, two in the front seats, and two in the back.
+ \begin{gnote}
+ if they do not give the justification deduct 5 pts
+ \end{gnote}
+\end{solution}
+\end{sproblem}
+\end{document}
+}
+
+\begin{environment}{solution}
+ The |solution| environment can be to specify a solution to a problem. If the package
+ option |solutions| is set or |\solutionstrue| is set in the text, then the solution will
+ be presented in the output. The |solution| environment takes an optional KeyVal argument
+ with the keys |id| for an identifier that can be reference |for| to specify which
+ problem this is a solution for, and |height| that allows to specify the amount of space
+ to be left in test situations (i.e. if the |test| option is set in the |\usepackage|
+ statement).
+\end{environment}
+
+\begin{environment}{hint,exnote,gnote}
+ The |hint| and |exnote| environments can be used in a |problem| environment to give
+ hints and to make notes that elaborate certain aspects of the problem. The |gnote|
+ (grading notes) environment can be used to document situtations that may arise in
+ grading.
+\end{environment}
+
+\begin{function}{\startsolutions,\stopsolutions}
+ Sometimes we would like to locally override the |solutions| option we have given to the
+ package. To turn on solutions we use the |\startsolutions|, to turn them off,
+ |\stopsolutions|. These two can be used at any point in the documents.
+\end{function}
+
+\begin{function}{\ifsolutions}
+ Also, sometimes, we want content (e.g. in an exam with master solutions) conditional on
+ whether solutions are shown. This can be done with the |\ifsolutions| conditional.
+\end{function}
+
+\begin{environment}{mcb}
+ Multiple choice blocks can be formatted using the |mcb| environment, in which single
+ choices are marked up with |\mcc| macro.
+\end{environment}
+
+\begin{function}{\mcc}
+ |\mcc[|\meta{keyvals}|]{|\meta{text}|}| takes an optional key/value argument
+ \meta{keyvals} for choice metadata and a required argument \meta{text} for the proposed
+ answer text. The following keys are supported
+ \begin{itemize}
+ \item |T| for true answers, |F| for false ones,
+ \item |Ttext| the verdict for true answers, |Ftext| for false ones, and
+ \item |feedback| for a short feedback text given to the student.
+ \end{itemize}
+\end{function}
+
+If we start the solutions, then we get
+
+\stexexample{%
+\startsolutions
+\begin{sproblem}[title=Functions,name=functions1]
+ What is the keyword to introduce a function definition in python?
+ \begin{mcb}
+ \mcc[T]{def}
+ \mcc[F,feedback=that is for C and C++]{function}
+ \mcc[F,feedback=that is for Standard ML]{fun}
+ \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
+ \end{mcb}
+\end{sproblem}
+}
+without solutions (that is what the students see during the exam/quiz)\ednote{MK: that did
+not work!}
+\stexexample{%
+\stopsolutions
+\begin{sproblem}[title=Functions,name=functions1]
+ What is the keyword to introduce a function definition in python?
+ \begin{mcb}
+ \mcc[T]{def}
+ \mcc[F,feedback=that is for C and C++]{function}
+ \mcc[F,feedback=that is for Standard ML]{fun}
+ \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
+ \end{mcb}
+\end{sproblem}
+}
+
+\begin{function}{\includeproblem}
+ The |\includeproblem| macro can be used to include a problem from another file. It takes
+ an optional KeyVal argument and a second argument which is a path to the file containing
+ the problem (the macro assumes that there is only one problem in the include file). The
+ keys |title|, |min|, and |pts| specify the problem title, the estimated minutes for
+ solving the problem and the points to be gained, and their values (if given) overwrite
+ the ones specified in the |problem| environment in the included file.
+\end{function}
+
+The sum of the points and estimated minutes (that we specified in the |pts| and |min| keys
+to the |problem| environment or the |\includeproblem| macro) to the log file and the
+screen after each run. This is useful in preparing exams, where we want to make sure that
+the students can indeed solve the problems in an allotted time period.
+
+The |\min| and |\pts| macros allow to specify (i.e. to print to the margin) the
+distribution of time and reward to parts of a problem, if the |pts| and |pts| options are
+set. This allows to give students hints about the estimated time and the points to be
+awarded.
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "../stex-manual"
+%%% End:
diff --git a/Master/texmf-dist/doc/latex/stex/packages/stex-proofs.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-proofs.tex
index 0523c65948d..d06db1282f5 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-proofs.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-proofs.tex
@@ -1 +1,214 @@
-\textcolor{red}{TODO: sproofs documentation} \ No newline at end of file
+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.
+
+We will go over the general intuition by way of a running example:
+
+\begin{latexcode}
+\begin{sproof}[id=simple-proof]
+ {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$}
+ \begin{spfcases}{For the induction we have to consider three cases:}
+ \begin{spfcase}{$n=1$}
+ \begin{spfstep}[type=inline] then we compute $1=1^2$\end{spfstep}
+ \end{spfcase}
+ \begin{spfcase}{$n=2$}
+ \begin{spfcomment}[type=inline]
+ This case is not really necessary, but we do it for the
+ fun of it (and to get more intuition).
+ \end{spfcomment}
+ \begin{spfstep}[type=inline] We compute $1+3=2^{2}=4$.\end{spfstep}
+ \end{spfcase}
+ \begin{spfcase}{$n>1$}
+ \begin{spfstep}[type=assumption,id=ind-hyp]
+ Now, we assume that the assertion is true for a certain $k\geq 1$,
+ i.e. $\sum_{i=1}^k{(2i-1)}=k^{2}$.
+ \end{spfstep}
+ \begin{spfcomment}
+ 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}$.
+ \end{spfcomment}
+ \begin{spfstep}
+ We obtain $\sum_{i=1}^{k+1}{2i-1}=\sum_{i=1}^k{2i-1}+2(k+1)-1$
+ \spfjust[method=arith:split-sum]{by splitting the sum}.
+ \end{spfstep}
+ \begin{spfstep}
+ Thus we have $\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1$
+ \spfjust[method=fertilize]{by inductive hypothesis}.
+ \end{spfstep}
+ \begin{spfstep}[type=conclusion]
+ We can \spfjust[method=simplify]{simplify} the right-hand side to
+ ${k+1}^2$, which proves the assertion.
+ \end{spfstep}
+ \end{spfcase}
+ \begin{spfstep}[type=conclusion]
+ We have considered all the cases, so we have proven the assertion.
+ \end{spfstep}
+ \end{spfcases}
+\end{sproof}
+\end{latexcode}
+
+This yields the following result:
+
+\begin{mdframed}
+ \begin{sproof}[id=simple-proof]
+ {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$}
+ \begin{spfcases}{For the induction we have to consider the following cases:}
+ \begin{spfcase}{$n=1$}
+ \begin{spfstep}[type=inline] then we compute $1=1^2$\end{spfstep}
+ \end{spfcase}
+ \begin{spfcase}{$n=2$}
+ \begin{spfcomment}[type=inline]
+ This case is not really necessary, but we do it for the fun
+ of it (and to get more intuition).
+ \end{spfcomment}
+ \begin{spfstep}[type=inline]
+ We compute $1+3=2^{2}=4$
+ \end{spfstep}
+ \end{spfcase}
+ \begin{spfcase}{$n>1$}
+ \begin{spfstep}[type=hypothesis,id=ind-hyp]
+ Now, we assume that the assertion is true for a certain $k\geq 1$, i.e.
+ $\sum_{i=1}^k{(2i-1)}=k^{2}$.
+ \end{spfstep}
+ \begin{spfcomment}
+ 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}$.
+ \end{spfcomment}
+ \begin{spfstep}[id=splitit]
+ We obtain $\sum_{i=1}^{k+1}{(2i-1)}=\sum_{i=1}^k{(2i-1)}+2(k+1)-1$
+ \spfjust[method=arith:split-sum]{by splitting the sum}.
+ \end{spfstep}
+ \begin{spfstep}[id=byindhyp]
+ Thus we have $\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1$
+ \spfjust[method=fertilize]{by \premise[ind-hyp]{inductive hypothesis}}.
+ \end{spfstep}
+ \begin{spfstep}[type=conclusion]
+ We can \spfjust[method=simplify-eq]{simplify the \justarg[rhs]{right-hand side}} to
+ $(k+1)^2$, which proves the assertion.
+ \end{spfstep}
+ \end{spfcase}
+ \begin{spfstep}[type=conclusion]
+ We have considered all the cases, so we have proven the assertion.
+ \end{spfstep}
+ \end{spfcases}
+\end{sproof}
+\end{mdframed}
+
+\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{environment}{spfstep}
+ Regular proof steps are marked up with the |step| environment, 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{environment}
+
+\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. The environment takes an optional
+ |KeyVal| argument, which can have the |method| key, whose value is the name of a proof
+ method (this will only need to mean something to the application that consumes the
+ semantic annotations). Furthermore, the justification can contain ``premises''
+ (specifications to assertions that were used justify the step) and ``arguments''
+ (other information taken into account by the proof method).
+\end{function}
+
+\begin{function}{\premise}
+ The |\premise| macro allows to mark up part of the text as reference to an assertion
+ that is used in the argumentation. In the running example we have used the |\premise|
+ macro to identify the inductive hypothesis.
+\end{function}
+
+\begin{function}{\justarg}
+ The |\justarg| macro is very similar to |\premise| with the difference that it is used
+ to mark up arguments to the proof method. Therefore the content of the first argument
+ is interpreted as a mathematical object rather than as an identifier as in the case of
+ |\premise|. In our example, we specified that the simplification should take place on
+ the right hand side of the equation. Other examples include proof methods that
+ instantiate. Here we would indicate the substituted object in a |\justarg| macro.
+\end{function}
+
+Note that both |\premise| and |\justarg| can be used with an empty second argument to
+mark up premises and arguments that are not explicitly mentioned in the text.
+
+\begin{environment}{subproof}
+ The |spfcases| 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{environment}{spfcases}
+ The |spfcases| environment is used to mark up a proof by cases. Technically it is a
+ variant of the |subproof| where the |method| is |by-cases|. Its contents are |spfcase|
+ environments that mark up the cases one by one.
+\end{environment}
+
+\begin{environment}{spfcase}
+ The content of a |spfcases| environment are a sequence of case proofs marked up in the
+ |spfcase| environment, which takes an optional |KeyVal| argument for semantic
+ annotations. The second argument is used to specify the the description of the case
+ under consideration. The content of a |spfcase| environment is the same as that of a
+ |sproof|, i.e. |spfstep|s, |spfcomment|s, and |spfcases| environments.
+\end{environment}
+
+\begin{function}{\spfcasesketch}
+ |\spfcasesketch| is a variant of the |spfcase| environment that takes the same
+ arguments, but instead of the |spfstep|s in the body uses a third argument for a proof
+ sketch.
+\end{function}
+
+\begin{environment}{spfcomment}
+ The |spfcomment| environment is much like a |step|, only that it does not have an
+ object-level assertion of its own. Rather than asserting some fact that is relevant
+ for the proof, it is used to explain where the proof is going, what we are attempting
+ to to, or what we have achieved so far. As such, it cannot be the target of a
+ |\premise|.
+\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{}|.
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "../stex-manual"
+%%% End:
+
+% LocalWords: hypothesis,id geq splitit arith:split-sum byindhyp rhs proofend
diff --git a/Master/texmf-dist/doc/latex/stex/packages/stex-references.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-references.tex
index bf8a8ed66c0..11de003e9be 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-references.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-references.tex
@@ -1 +1,8 @@
-\textcolor{red}{TODO: references documentation} \ No newline at end of file
+\begin{sfragment}[id=sec.references]{Referencing Symbols and Statements}
+\textcolor{red}{TODO: references documentation}
+\end{sfragment}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "../stex-manual"
+%%% End:
diff --git a/Master/texmf-dist/doc/latex/stex/packages/stex-slides.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-slides.tex
index 1f9d0c989d6..a900c1fcbb8 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-slides.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-slides.tex
@@ -1 +1,212 @@
-\textcolor{red}{TODO: notesslides documentation} \ No newline at end of file
+The \pkg{notesslides} document class is derived from |beamer.cls|~\cite{beamerclass:on},
+it adds a ``notes version'' for course notes that is more suited to printing than the one
+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
+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
+notes to give students a visual anchor into the slide presentation in the course (and to
+distinguish the different writing styles in slides and course notes).
+
+In practice we want to generate two documents from the same source: the slides for
+presentation in the lecture and the course notes as a narrative document for home
+study. To achieve this, the \pkg{notesslides} class has two modes: \emph{slides mode} and
+\emph{notes mode} which are determined by the package option.
+
+
+\begin{variable}{slides,notes,sectocframes,frameimages,fiboxed}
+ The \pkg{notesslides} class takes a variety of class options:
+ \begin{itemize}
+ \item The options |slides| and |notes| switch between slides mode and notes mode (see
+ Section~\ref{sec:user:notesslides}).
+ \item If the option |sectocframes| is given, then for the |sfragment|s, special frames
+ with the |sfragment| title (and number) are generated.
+ \item If the option |frameimages| is set, then slide mode also shows the
+ |\frameimage|-generated frames (see section~\ref{sec:user:frameimage}). If also the
+ |fiboxed| option is given, the slides are surrounded by a box.
+ \end{itemize}
+\end{variable}
+
+\begin{environment}{frame,note}
+ Slides are represented with the |frame| environment just like in the \pkg{beamer} class,
+ see~\cite{Tantau:ugbc} for details. The \pkg{notesslides} class adds the |note|
+ environment for encapsulating the course note fragments.\footnote{MK: it would be very
+ nice, if we did not need this environment, and this should be possible in principle,
+ but not without intensive LaTeX trickery. Hints to the author are welcome.}
+\end{environment}
+
+\begin{dangerbox}
+ Note that it is essential to start and end the |notes| environment at the start of the
+ line -- in particular, there may not be leading blanks -- else {\LaTeX} becomes confused
+ and throws error messages that are difficult to decipher.
+\end{dangerbox}
+
+By interleaving the |frame| and |note| environments, we can build course notes as shown
+here:
+
+\begin{latexcode}
+\ifnotes\maketitle\else
+\frame[noframenumbering]\maketitle\fi
+
+\begin{note}
+ We start this course with ...
+\end{note}
+
+\begin{frame}
+ \frametitle{The first slide}
+ ...
+\end{frame}
+\begin{note}
+ ... and more explanatory text
+\end{note}
+
+\begin{frame}
+ \frametitle{The second slide}
+ ...
+\end{frame}
+...
+\end{latexcode}
+
+\begin{function}{\ifnotes}
+ Note the use of the |\ifnotes| conditional, which allows different treatment between
+ |notes| and |slides| mode -- manually setting |\notestrue| or |\notesfalse| is strongly
+ discouraged however.
+\end{function}
+
+\begin{dangerbox}
+ We need to give the title frame the |noframenumbering| option so that the frame
+ numbering is kept in sync between the slides and the course notes.
+\end{dangerbox}
+
+\begin{dangerbox}
+ The \pkg{beamer} class recommends not to use the |allowframebreaks| option on frames
+ (even though it is very convenient). This holds even more in the |notesslides| case: At
+ least in conjunction with |\newpage|, frame numbering behaves funnily (we have tried to
+ fix this, but who knows).
+\end{dangerbox}
+
+\begin{function}{\inputref*}
+ If we want to transclude a the contents of a file as a note, we can use a new variant
+ |\inputref*| of the |\inputref| macro: |\inputref*{foo}| is equivalent to
+ |\begin{note}\inputref{foo}\end{note}|.
+\end{function}
+
+\begin{environment}{nparagraph, nparagraph, ndefinition, nexample, nsproof, nassertion}
+ There are some environments that tend to occur at the top-level of |note|
+ environments. We make convenience versions of these: e.g. the |nparagraph| environment
+ is just an |sparagraph| inside a |note| environment (but looks nicer in the source,
+ since it avoids one level of source indenting). Similarly, we have the |nfragment|,
+ |ndefinition|, |nexample|, |nsproof|, and |nassertion| environments.
+\end{environment}
+
+\begin{function} {\setslidelogo}
+ The default logo provided by the \pkg{notesslides} package is the {\sTeX} logo it can be
+ customized using |\setslidelogo{|\meta{logo name}|}|.
+\end{function}
+
+\begin{function}{\setsource}
+ The default footer line of the \pkg{notesslides} package mentions copyright and
+ licensing. In the \pkg{beamer} class, |\source| stores the author's name as the
+ copyright holder . By default it is \emph{Michael Kohlhase} in the \pkg{notesslides}
+ package since he is the main user and designer of this
+ package. |\setsource{|\meta{name}|}| can change the writer's name.
+\end{function}
+
+\begin{function}{\setlicensing}
+ For licensing, we use the Creative Commons Attribuition-ShareAlike license by default to
+ strengthen the public domain. If package |hyperref| is loaded, then we can attach a
+ hyperlink to the license logo. |\setlicensing[|\meta{url}|]{|\meta{logo name}|}| is used
+ for customization, where \meta{url} is optional.
+\end{function}
+
+Sometimes, we want to integrate slides as images after all -- e.g. because we already
+have a PowerPoint presentation, to which we want to add \sTeX notes.
+
+\begin{function}{\frameimage,\mhframeimage}
+ In this case we can use |\frameimage[|\meta{opt}|]{|\meta{path}|}|, where \meta{opt} are
+ the options of |\includegraphics| from the \pkg{graphicx} package~\cite{CarRah:tpp99}
+ and \meta{path} is the file path (extension can be left off like in
+ |\includegraphics|). We have added the |label| key that allows to give a frame label
+ that can be referenced like a regular |beamer| frame.
+
+The |\mhframeimage| macro is a variant of |\frameimage| with repository support. Instead
+of writing
+\begin{latexcode}
+\frameimage{\MathHub{fooMH/bar/source/baz/foobar}}
+\end{latexcode}
+ we can simply write (assuming that |\MathHub| is defined as above)
+\begin{latexcode}
+\mhframeimage[fooMH/bar]{baz/foobar}
+\end{latexcode}
+ Note that the |\mhframeimage| form is more semantic, which allows more advanced document
+management features in \textsf{MathHub}.
+\end{function}
+
+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}
+\mhframeimage{baz/foobar}
+\end{latexcode}
+
+\begin{function}{\textwarning}
+ The |\textwarning| macro generates a warning sign: \textwarning
+\end{function}
+
+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}
+\excursion{founif}{../ex/founif}{We will cover first-order unification in}
+...
+\begin{appendix}\printexcursions\end{appendix}
+\end{latexcode}
+
+\begin{function}{\excursion}
+ The |\excursion{|\meta{ref}|}{|\meta{path}|}{|\meta{text}|}| is syntactic sugar for
+
+\begin{latexcode}
+\begin{nparagraph}[title=Excursion]
+ \activateexcursion{founif}{../ex/founif}
+ We will cover first-order unification in \sref{founif}.
+\end{nparagraph}
+\end{latexcode}
+\end{function}
+
+\begin{function}{\activateexcursion,\printexcursion,\excursionref}
+ Here |\activateexcursion{|\meta{path}|}| augments the |\printexcursions| macro by a call
+ |\inputref{|\meta{path}|}|. In this way, the |\printexcursions| macro (usually in the
+ appendix) will collect up all excursions that are specified in the main text.
+
+ Sometimes, we want to reference -- in an excursion -- part of another. We can use
+ |\excursionref{|\meta{label}|}| for that.
+\end{function}
+
+\begin{function}{\excursiongroup}
+ 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{note}
+\begin{sfragment}[id=<id>]{Excursions}
+ \inputref{<path>}
+ \printexcursions
+\end{sfragment}
+\end{note}
+\end{latexcode}
+\end{function}
+
+\begin{dangerbox}
+ When option |book| which uses |\pagestyle{headings}| is given and semantic macros are
+ given in the |sfragment| titles, then they sometimes are not defined by the time the
+ heading is formatted. Need to look into how the headings are made. This is a problem of
+ the underlying \pkg{document-structure} package.
+\end{dangerbox}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "../stex-manual"
+%%% End:
diff --git a/Master/texmf-dist/doc/latex/stex/packages/stex-statements.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-statements.tex
index aa9f5f76abf..6a2478fa7d1 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-statements.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-statements.tex
@@ -1 +1,145 @@
-\textcolor{red}{TODO: statements documentation} \ No newline at end of file
+\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/Master/texmf-dist/doc/latex/stex/packages/stex-symbols.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-symbols.tex
index 50b450a248f..e7bafeda6b6 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-symbols.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-symbols.tex
@@ -1 +1,587 @@
-\textcolor{red}{TODO: symbols documentation} \ No newline at end of file
+\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 -- for those purposes, \stexcode"\infprec" and
+ \stexcode"\neginfprec" exist (which are implemented as the maximal and minimal integer
+ values accordingly).
+\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
+$\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/Master/texmf-dist/doc/latex/stex/packages/stex-terms.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-terms.tex
index cc67ce0c7fc..759b3f5fdd8 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-terms.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-terms.tex
@@ -1 +1,177 @@
-\textcolor{red}{TODO: terms documentation} \ No newline at end of file
+\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/Master/texmf-dist/doc/latex/stex/packages/stex-tikzinput.tex b/Master/texmf-dist/doc/latex/stex/packages/stex-tikzinput.tex
index fb7d0c1e5b2..ac321f129cd 100644
--- a/Master/texmf-dist/doc/latex/stex/packages/stex-tikzinput.tex
+++ b/Master/texmf-dist/doc/latex/stex/packages/stex-tikzinput.tex
@@ -1 +1,61 @@
-\textcolor{red}{TODO: tikzinput documentation} \ No newline at end of file
+\begin{function}{image}
+ The behavior of the \pkg{ikzinput} package is determined by whether the |image| option
+ is given. If it is not, then the \pkg{tikz} package is loaded, all other options are
+ passed on to it and |\tikzinput{|\meta{file}|}| inputs the TIKZ file \meta{file}|.tex|;
+ if not, only the \pkg{graphicx} package is loaded and |\tikzinput{|\meta{file}|}| loads
+ an image file \meta{file}|.|\meta{ext} generated from \meta{file}|.tex|.
+\end{function}
+
+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}
+\documentclass{standalone}
+\usepackage{tikz}
+\usetikzpackage{...}
+\begin{document}
+ \begin{tikzpicture}
+ ...
+ \end{tikzpicture}
+\end{document}
+\end{latexcode}
+
+ 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
+ are disregarded during loading, so they do not pose any problems. In effect, an
+ |\input| of the file above only sees the |tikzpicture| environment, but the file itself
+ is standalone in the sense that we can run {\LaTeX} over it separately, e.g. for
+ generating an image file from it.
+
+\begin{function}{\tikzinput,\ctikzinput}
+ This is exactly where the \pkg{tikzinput} package comes in: it supplies the |\tikzinput|
+ macro, which -- depending on the |image| option -- either directly inputs the TIKZ
+ picture (source) or tries to load an image file generated from it.
+
+ Concretely, if the |image| option is not set for the \pkg{tikzinput} package, then
+ |\tikzinput[|\meta{opt}|]{|\meta{file}|}| disregards the optional argument \meta{opt}
+ and inputs \meta{file}|.tex| via |\input| and resizes it to as specified in the |width|
+ and |height| keys. If it is, |\tikzinput[|\meta{opt}|]{|\meta{file}|}| expands to
+ |\includegraphics[|\meta{opt}|]{|\meta{file}|}|.
+
+ |\ctizkinput| is a version of |\tikzinput| that is centered.
+\end{function}
+
+\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
+ path, we use the |mhrepos=| key. Again, |\cmhtizkinput| is a version of |\mhtikzinput|
+ that is centered.
+\end{function}
+
+\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.
+\end{function}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "../stex-manual"
+%%% End:
diff --git a/Master/texmf-dist/doc/latex/stex/stex-abstract.tex b/Master/texmf-dist/doc/latex/stex/stex-abstract.tex
index 445bbf064aa..f342bbf9075 100644
--- a/Master/texmf-dist/doc/latex/stex/stex-abstract.tex
+++ b/Master/texmf-dist/doc/latex/stex/stex-abstract.tex
@@ -1,10 +1,26 @@
\begin{abstract}
- \sTeX is a collection of {\LaTeX} package that allow to markup documents semantically without leaving the document format, essentially turning {\LaTeX} into a document format for mathematical knowledge management (MKM).
+ \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,
- \item A mechanism for exporting \sTeX documents to (modular) XHTML, preserving all the semantic information for semantically informed knowledge management services.
+ \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/Master/texmf-dist/doc/latex/stex/stex-doc.pdf b/Master/texmf-dist/doc/latex/stex/stex-doc.pdf
index 7499111fa86..0d0a36720cb 100644
--- a/Master/texmf-dist/doc/latex/stex/stex-doc.pdf
+++ b/Master/texmf-dist/doc/latex/stex/stex-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/stex/stex-doc.tex b/Master/texmf-dist/doc/latex/stex/stex-doc.tex
index d2e82390837..7a98ff49c2b 100644
--- a/Master/texmf-dist/doc/latex/stex/stex-doc.tex
+++ b/Master/texmf-dist/doc/latex/stex/stex-doc.tex
@@ -1,4 +1,4 @@
-\def\bibfolder{../lib/bib}
+\def\bibfolder#1{../lib/bib/#1}
\input{stex-docheader}
\infulldoctrue
@@ -7,14 +7,13 @@
\clist_gput_right:Nn \g_docinput_clist
{ #1 }
}
-\bool_set_true:N \stex_dtx_tests_bool
\ExplSyntaxOff
\expandafter\newif\csname if@infulldoc\expandafter\endcsname\csname @infulldoctrue\endcsname
\begin{document}
\title{
- The {\stex{3}} Package
+ The {\stex{3}} Package Collection
\thanks{Version {\fileversion} (last revised {\filedate})}
}
\author{Michael Kohlhase, Dennis Müller\\
@@ -207,4 +206,12 @@
\DocInputAgain
+\begin{sfragment}{References}\ednote{we need an un-numbered version {sfragment*}}
+ \printbibliography[heading=none]
+\end{sfragment}
\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:
diff --git a/Master/texmf-dist/doc/latex/stex/stex-docheader.tex b/Master/texmf-dist/doc/latex/stex/stex-docheader.tex
index d0f13e90b33..d16b19703bd 100644
--- a/Master/texmf-dist/doc/latex/stex/stex-docheader.tex
+++ b/Master/texmf-dist/doc/latex/stex/stex-docheader.tex
@@ -7,14 +7,15 @@
\RequirePackage{tikzinput}
\usetikzlibrary{fit}
-\usepackage[debug=all,lang=en, mathhub=./tests]{stex}
+% \usepackage[debug=all,lang=en, mathhub=./tests]{stex}
+\usepackage[lang=en, mathhub=./tests]{stex}
\usepackage{url,array,float,textcomp}
\usepackage[show]{ed}
\usepackage[hyperref=auto,style=alphabetic]{biblatex}
-\addbibresource{\bibfolder/kwarcpubs.bib}
-\addbibresource{\bibfolder/extpubs.bib}
-\addbibresource{\bibfolder/kwarccrossrefs.bib}
-\addbibresource{\bibfolder/extcrossrefs.bib}
+\addbibresource{\bibfolder{kwarcpubs.bib}}
+\addbibresource{\bibfolder{extpubs.bib}}
+\addbibresource{\bibfolder{kwarccrossrefs.bib}}
+\addbibresource{\bibfolder{extcrossrefs.bib}}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{xspace}
@@ -26,73 +27,121 @@
\floatname{exfig}{Example}
\usepackage{listings}
-
-\ExplSyntaxOn
-
-\keys_define:nn { stex-tests } {
- do .bool_set:N = \stex_dtx_tests_bool
-}
-
-\ProcessKeysOptions { stex-tests }
-
-\prg_new_conditional:Nnn \stex_indtx: { T } {
- \bool_if:NTF \stex_dtx_tests_bool
- \prg_return_true: \prg_return_false:
+\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
+ },
+ 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
+ },
+ classoffset=5,keywordstyle=\color{magenta},morekeywords={
+ smodule,sdefinition,sassertion,sparagraph,sexample,
+ sproof,subproof,spfcases,spfcase,spfstep,spfcomment,
+ \\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
+ }
}
-\ExplSyntaxOff
-
-\lstdefinestyle{mylatex}{
- keywordstyle=\color{BurntOrange}
-}
-\lstdefinelanguage{mylatex}{
- emphstyle=\underbar,
- alsodigit={:},
- %alsoletter={_},
- alsoletter={\\}
- sensitive=true,
- classoffset=0,keywordstyle=\bfseries,
- morekeywords={\\begin,\\end,\\ExplSyntaxOn,\\ExplSyntaxOff},
- classoffset=1,keywordstyle=\color{blue},
- morekeywords={
- \\symdecl,
- \\symdef,
- \\notation,
- \\abbrdef,
- \\importmodule,
- \\usemodule,
- \\STEXwithbrackets,
- \\symref
- },
- classoffset=2,keywordstyle=\color{Purple},
- morekeywords={
- \\stex_path_from_string:Nn,
- \\stex_path_to_string:NN,
- \\stex_path_to_string:N,
- \\stex_require_repository:n,
- \\stex_modules_current_namespace:,
- \\stex_debug:n,
- \\stex_set_current_repository:n,
- \\stex_file_in_smsmode:nn,
- \\stex_get_symbol:n,
- },
- classoffset=3,keywordstyle=\color{SkyBlue},
- morekeywords={
- \\l_stex_modules_ns_str,
- \\g_stex_currentfile_seq,
- \\l_stex_current_module_prop,
- \\l_stex_get_symbol_uri_str,
- }
- classoffset=0,
-%^^A morecomment=[l][\color{Gray}]{//},
-%^^A morecomment=[s][\color{Gray}]{/*}{*/},
- morecomment=[s][\color{Green}]{$}{$},,
- morecomment=[s][\color{OliveGreen}]{\\[}{\\]},
+%\lstdefinestyle{mylatex}{
+% keywordstyle=\color{BurntOrange}
+%}
+%\lstdefinelanguage{mylatex}{
+% emphstyle=\underbar,
+% alsodigit={:},
+% %alsoletter={_},
+% alsoletter={\\}
+% sensitive=true,
+% classoffset=0,keywordstyle=\bfseries,
+% morekeywords={\\begin,\\end,\\ExplSyntaxOn,\\ExplSyntaxOff},
+% classoffset=1,keywordstyle=\color{blue},
+% morekeywords={
+% \\symdecl,
+% \\symdef,
+% \\notation,
+% \\abbrdef,
+% \\importmodule,
+% \\usemodule,
+% \\STEXwithbrackets,
+% \\symref
+% },
+% classoffset=2,keywordstyle=\color{Purple},
+% morekeywords={
+% \\stex_path_from_string:Nn,
+% \\stex_path_to_string:NN,
+% \\stex_path_to_string:N,
+% \\stex_require_repository:n,
+% \\stex_modules_current_namespace:,
+% \\stex_debug:n,
+% \\stex_set_current_repository:n,
+% \\stex_file_in_smsmode:nn,
+% \\stex_get_symbol:n,
+% },
+% classoffset=3,keywordstyle=\color{SkyBlue},
+% morekeywords={
+% \\l_stex_module_ns_str,
+% \\g_stex_currentfile_seq,
+% \\l_stex_current_module_prop,
+% \\l_stex_get_symbol_uri_str,
+% }
+% classoffset=0,
+%%^^A morecomment=[l][\color{Gray}]{//},
+%%^^A morecomment=[s][\color{Gray}]{/*}{*/},
+% morecomment=[s][\color{Green}]{$}{$},,
+% morecomment=[s][\color{OliveGreen}]{\\[}{\\]},
%^^A morestring=[b][\color{Purple}]\$,
-}
-\lstnewenvironment{latexcode}[1][language=mylatex]{\lstset{language=mylatex,basicstyle=\tiny,inputencoding=utf8,#1,alsoletter={\\,*},alsoother={\$}}}{}
-
+%}
+\lstnewenvironment{latexcode}[1][]{\lstset{language=sTeX,#1}}{}
+\def\stexcode{\lstinline[language=sTeX]}
\usepackage{mdframed,realboxes}
\usepackage[most]{tcolorbox}
@@ -103,13 +152,13 @@
\newenvironment{stextest@output}
{
- \begin{mdframed}[linewidth=1pt,backgroundcolor=white]\tiny
+ \begin{mdframed}[linewidth=1pt,backgroundcolor=white]\small
}
{\end{mdframed}}
\newenvironment{stextest@input}
{
- \begin{mdframed}[linewidth=1pt,backgroundcolor=lightgray]\tiny
+ \begin{mdframed}[linewidth=1pt,backgroundcolor=white]\small
}
{\end{mdframed}}
@@ -118,47 +167,49 @@
\newcount\test@counter\test@counter=0
\newcount\example@counter\example@counter=0
-\newenvironment{stextest@border}
-{
- \global\advance\test@counter by 1
- \newtcolorbox{stextestborderbox}{
- empty,
- title={Test \the\test@counter},
- attach boxed title to top left,
- minipage boxed title,
- boxed title style={empty,size=minimal,toprule=0pt,top=4pt,left=3mm,overlay={}},
- coltitle=red,fonttitle=\bfseries,
- 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[red,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
- overlay first={\draw[red,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); },
- overlay middle={\draw[red,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
- overlay last={\draw[red,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); },
- }
-%^^A\refstepcounter{remark}
-\begin{stextestborderbox}\small
+\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
}
-{\end{stextestborderbox}}
+
+
+%\newtcolorbox{exampleborderbox}{
+% enhanced,
+% left=0pt,
+% title={Example \the\example@counter},
+% right=0pt,
+% top=8pt,
+% bottom=8pt,
+% colback=white,
+% colframe=blue,
+% width=\textwidth,
+% enlarge left by=0mm,
+% boxsep=5pt,
+% fontupper=\small,
+% arc=4pt,
+% outer arc=4pt,
+% leftupper=1.5cm,
+% fonttitle=\bfseries,
+% coltitle=blue,
+% boxed title style={empty,size=minimal,toprule=0pt,top=1pt,left=3mm,overlay={}},
+%}
\newenvironment{example@border}
{
\global\advance\example@counter by 1
- \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); },
- }
%^^A\refstepcounter{remark}
-\begin{exampleborderbox}\small
+\begin{exampleborderbox}
}
{\end{exampleborderbox}}
@@ -172,97 +223,134 @@
\ExplSyntaxOn
-\AddToHook{begindocument}{
- \stex_indtx:T {
- \newwrite\alltestsoutfile
- \immediate\openout\alltestsoutfile=alltests.tst
- }
-}
-
- \def\stextest{
- \begingroup
- \catcode`\\=12\relax
- \catcode`\#=12\relax
- \catcode`\&=12\relax
- \catcode`\$=12\relax
- \catcode`\^=12\relax
- \catcode`\_=12\relax
- \catcode`^^J=12\relax
- \endlinechar=`^^J
- \newlinechar=-1
+\def\stexexample{
+ \begingroup
+ \catcode`\\=12\relax
+ \catcode`\#=12\relax
+ \catcode`\&=12\relax
+ \catcode`\$=12\relax
+ \catcode`\^=12\relax
+ \catcode`\_=12\relax
+ \catcode`\ =12\relax
+ \catcode`^^J=12\relax
+ \endlinechar=`^^J
+ \newlinechar=-1
%^^A \everyeof{\noexpand}
- \test_a:n
- }
- \long\def \test_a:n #1 {
- \endgroup
- \stex_indtx:T {
- \immediate\write\alltestsoutfile{%
- ^^J\c_backslash_str stextest{\detokenize{^^J^^J#1^^J}}^^J
- }
+ \example_a:n
+}
+\long\def\example_a:n #1 {
+ \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}
}
- \begin{stextest@border}
- \immediate\openout\testoutfile=stextest.tst
- \immediate\write\testoutfile{
- \c_backslash_str begin{latexcode}
- \detokenize{^^J^^J#1^^J}
- \c_backslash_str end{latexcode}
- }
- \immediate\closeout\testoutfile
- \begin{stextest@input}
- \catcode`\#=12\relax
- \input{stextest.tst}
- \end{stextest@input}
- \immediate\openout\testoutfile=stextest.tst
- \immediate\write\testoutfile{\detokenize{#1}}
- \immediate\closeout\testoutfile
- \stex_indtx:T {
- \begin{stextest@output}
- \input{stextest.tst}
- \end{stextest@output}
- }
- \end{stextest@border}
- }
+ \immediate\closeout\testoutfile
+
+ Input:
+
+ \begin{stextest@input}
+ \catcode`\#=12\relax
+ \input{stextest.tex}
+ \end{stextest@input}
+ \immediate\openout\testoutfile=stextest.tex
+ \immediate\write\testoutfile{#1}
+ \immediate\closeout\testoutfile
+
+ Output:
+
+ \begin{stextest@output}
+ \input{stextest.tex}
+ \end{stextest@output}
+ \end{example@border}
+}
- \def\stexexample{
- \begingroup
- \catcode`\\=12\relax
- \catcode`\#=12\relax
- \catcode`\&=12\relax
- \catcode`\$=12\relax
- \catcode`\^=12\relax
- \catcode`\_=12\relax
- \catcode`^^J=12\relax
- \endlinechar=`^^J
- \newlinechar=-1
-%^^A \everyeof{\noexpand}
- \example_a:n
- }
- \long\def \example_a:n #1 {
- \endgroup
- \begin{example@border}
- \immediate\openout\testoutfile=stextest.tst
- \immediate\write\testoutfile{
- \c_backslash_str begin{latexcode}
- \detokenize{^^J}#1
- \c_backslash_str end{latexcode}
- }
- \immediate\closeout\testoutfile
- \begin{stextest@input}
- \catcode`\#=12\relax
- \input{stextest.tst}
- \end{stextest@input}
- \immediate\openout\testoutfile=stextest.tst
- \immediate\write\testoutfile{#1}
- \immediate\closeout\testoutfile
- \begin{stextest@output}
- \input{stextest.tst}
- \end{stextest@output}
- \end{example@border}
- }
+\ExplSyntaxOff
- \long\def\test#1{}
+\def\textwarning{\includegraphics[width=1.2em]{stex-dangerous-bend}\xspace}
+\newtcolorbox{dangerbox}{
+ breakable,
+ enhanced,
+ left=0pt,
+ right=0pt,
+ top=8pt,
+ bottom=8pt,
+ colback=white,
+ colframe=red,
+ 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[width=1cm,height=1cm]{stex-dangerous-bend}};}
+}
-\ExplSyntaxOff
+\usetikzlibrary{decorations.pathmorphing,shapes,arrows,calc}
+% Taken from pgflibrarytikzmmt.code.tex
+\newcommand{\mmtarrowtip}{angle 45}
+\newcommand{\mmtarrowtipmonoright}{right hook}
+
+\tikzstyle{include}=[\mmtarrowtipmonoright-\mmtarrowtip,thick]
+\tikzstyle{morph}=[-\mmtarrowtip,thick]
+\tikzstyle{preview}=[decorate, decoration={coil,aspect=0,amplitude=1pt,
+ segment length=6pt,
+ pre=lineto,pre length=3pt,
+ post=lineto,post length=5pt}, thick]
+\tikzstyle{view}=[preview,-\mmtarrowtip]
+
+% TIKZ RULES
+\def\mmtlogo{
+\begin{tikzpicture}
+
+ % White Background (Margins are eyeballed)
+ % This is necessary because we paste white over arrows later.
+ % If somebody want's to do the full song and dance with
+ % interrupted arrows to get transparent background, be my guest.
+
+ \fill[white!] (-0.01,0.15) rectangle (1.11,-0.95);
+
+ % Arrows
+ \draw [blue, include] (0,0) -- (1.1,0);
+ \draw [green, morph] (0,-0.4) -- (1.1,-0.4);
+ \draw [red, view] (-0,-0.8) -- (1.1,-0.8);
+
+ % Cutout for letters
+ \fill[white] (0.33,0.1) rectangle (0.66,-0.9);
+
+ % Letters
+ \node at (0.18,0) (nodeM1) {\large M};
+ \node at (0.18,-0.4) (nodeM2) {\large M};
+ \node at (0.21,-0.8) (nodeT) {\large T};
+
+\end{tikzpicture}
+}
+
+\newtcolorbox{mmtbox}{
+ breakable,
+ enhanced,
+ left=0pt,
+ right=0pt,
+ top=8pt,
+ bottom=8pt,
+ colback=white,
+ colframe=green,
+ 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)$)
+ {\mmtlogo};}
+}
\MakeShortVerb{\|}
@@ -283,7 +371,7 @@
\def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}}
\def\cT{\mathcal{T}}\def\cD{\mathcal{D}}
-\def\fileversion{3.0}
+\def\fileversion{3.1}
\def\filedate{\today}
\RequirePackage{pdfcomment}
@@ -322,7 +410,7 @@
\newif\ifinfulldoc\infulldocfalse
\makeatother
-\def\basedocurl{https://github.com/slatex/sTeX/blob/latex3/doc}
+\def\basedocurl{https://github.com/slatex/sTeX/blob/main/doc}
\newcounter{module}
\NewDocumentEnvironment {module}{}{
@@ -331,25 +419,31 @@
}{
}
-\stexpatchmodule{\begin{module}}{\end{module}}
-
-\def\compemph#1{\textcolor{blue}{#1}}
-\def\symrefemph#1{\textcolor{green}{#1}}
-
-\RequirePackage{pdfcomment}
-\makeatletter
-\protected\def\compemph@uri#1#2{%
- \pdftooltip{%
- \srefsymuri{#2}{\compemph{#1}}%
- }{%
- URI: \detokenize{#2}%
- }%
+\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); },
}
-\protected\def\symrefemph@uri#1#2{%
- \pdftooltip{%
- \srefsymuri{#2}{\symrefemph{#1}}%
- }{%
- URI: \detokenize{#2}%
- }%
+
+\renewenvironment{remark}[1][]{
+ \refstepcounter{remark}\begin{remarkbox}[#1]
+ \begin{mdframed}[linewidth=1pt,backgroundcolor=lightgray!33!white]
+}{
+\end{mdframed}\end{remarkbox}\endlist
}
-\makeatother \ No newline at end of file
+
+\usepackage{rustex}
diff --git a/Master/texmf-dist/doc/latex/stex/stex-manual.pdf b/Master/texmf-dist/doc/latex/stex/stex-manual.pdf
index 80b4154b9af..32c1e047ca5 100644
--- a/Master/texmf-dist/doc/latex/stex/stex-manual.pdf
+++ b/Master/texmf-dist/doc/latex/stex/stex-manual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/stex/stex-manual.tex b/Master/texmf-dist/doc/latex/stex/stex-manual.tex
index 92834af1c5e..31b9c4eaeb2 100644
--- a/Master/texmf-dist/doc/latex/stex/stex-manual.tex
+++ b/Master/texmf-dist/doc/latex/stex/stex-manual.tex
@@ -6,14 +6,12 @@
\csname if@infulldoc\endcsname\else
-\def\bibfolder{../lib/bib}
+\def\bibfolder#1{../lib/bib/#1}
\input{stex-docheader}
\infulldoctrue
-\csname bool_set_true:N\expandafter\endcsname\csname stex_dtx_tests_bool\endcsname
-
\begin{document}
\csname if@infulldoc\endcsname\else
\title{
@@ -33,7 +31,7 @@
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.pdf}{the \sTeX documentation}
+ \href{\basedocurl/stex-doc.pdf}{the \sTeX documentation}.
\makeatletter
\renewcommand\part{%
@@ -137,6 +135,19 @@
\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)
@@ -173,143 +184,98 @@ authoring workflows.
\paragraph{} The general \sTeX workflow combines functionalities
provided by several pieces of software:
\begin{itemize}
- \item The \sTeX package to use semantic annotations in
- {\LaTeX} documents,
- \item \RusTeX to convert |tex| sources to (semantically enriched)
- |xhtml|,
- \item The \mmt software, that extracts semantic information
- from the thus generated |xhtml| and provides semantically informed
- added value services.
+\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}
-
-% ----------------------------
-
-\ignore{The objectives of this project will be achieved by developing a
-language and system
-that uses non-intrusive annotations
-to augment informal documents with semantic information
-(ranging from \textbf{fully formal} to \textbf{purely informal})
- without
-impacting linguistic presentation or document layout.
-That way, the system
-remains compatible with established publishing
-pipelines and practices, while additionally providing flexiformal
-information that
-enables formal knowledge management services, and hence produces
-\emph{rich active documents}, satisfying \textbf{R3}, \textbf{R4} and
-\textbf{R5}.
-In particular, it will avoid commitment to a fixed logical foundation.
-Instead, it will be designed as a modular pipeline of consecutive
-and compositional
-annotations, semantics extraction and translation steps, extensible
-via new structuring mechanisms (\textbf{R1}), library content
-(\textbf{R2}),
-NLP techniques, foundations, translation methods and
-end-user services.
-
-Naturally, the benefits of formal knowledge management services scale
-with the amount of mathematics involved. Consequently I will primarily
-focus on those
-STEM fields in which mathematical methods are most prominently
-used (e.g. mathematics, physics, computer science). Since in those fields
-\LaTeX~is the most commonly used scientific writing tool, I will also
-primarily focus on \LaTeX~as a development and evaluation target, but
-the system will be designed such that all components apart from
-the surface language will be integrable with other writing tools
-(e.g. WYSIWYG word processors).
-
-\paragraph{} The basic architecture of the proposed system is sketched in
-\autoref{fig:architecture}.
-\begin{figure}\centering
- \resizebox{0.95\textwidth}{!}{\tikzinput[]{diagram}}
- {\small (Note, that the syntax used
- in the box on the top right is prototypical and subject to change during the project.
- Details and open questions regarding the syntax are discussed here:
- \url{https://github.com/KWARC/FoMID/issues/1})}
- \caption{Basic Architecture of the Proposed System}\label{fig:architecture}
-\end{figure}
-A user can write their content using standard \LaTeX\ in an IDE;
-ideally using semantic annotations provided by \sTeX
-%and the library developed in \OBJref{smglom}
-(as in the upper right of
-\autoref{fig:architecture}), but not necessarily so.
-
-The document is converted to xhtml with \omdoc annotations
-using \LaTeX ML in the background,
-thus becoming actionable by the \mmt system. Both the source document
-as well as the generated xhtml/\omdoc are accessible to a natural language
-processing pripeline that can supply additional inferred semantic
-information or suggest annotations to the user, in the latter case
-augmenting the source document directly. This pipeline can use both
-classical NLP techniques using the GLIF system, as well as machine
-learning models such as \cite{own:fifom}.
-
-A semiformal fragment is converted
-into an appropriate syntax tree (possibly containing opaque
-informal nodes),
-thus becoming amenable
-to flexiformal knowledge management services. In a consecutive step
--- if sufficiently annotated --, these are
-additionally translated
-to a fully formal foundation, e.g. using the techniques from
-\cite{DMueller:phd:19,own:translations}, allowing
-more powerful services and conversion to established formal
-systems. All three representations
-are thus available from within the \mmt system for various
-knowledge management services, interfaces for which can be
-implemented in the IDE.
-
-Importantly, every non-trivial arrow in the figure is
-composable and extensible --
-translations to a foundation can be provided
-by supplying an appropriate formalization and alignment-based
-translations (or entirely new methods),
-services can be implemented generically using the \mmt API,
-NLP techniques can be implemented both inside and alongside of
-GLIF, and the concrete syntax within \sTeX can be extended
-by convenience macros in \LaTeX\ (enabling new
-structuring mechanisms as in \textbf{R1} via
-\mmt extensions, see
-\cite{MueRabRot:rslffml20}) as well as via additions to
-the library, which will be extensible both from within the IDE
-as well as on MathHub,
-remaining backwards compatible with existing content in a surface
-language. Additionally, sufficiently disambiguated
-statements can be translated to the syntax of
-external systems (such as interactive theorem prover systems
-or computer algebra systems),
-which can thus be integrated as additional services into the system.
-}
-
\end{sfragment}
\begin{sfragment}{Quickstart}
-
- \begin{sfragment}{Setup}
- \begin{sfragment}{The \sTeX IDE}
- TODO: VSCode Plugin
- \end{sfragment}
- \begin{sfragment}{Manual Setup}
- Foregoing on the \sTeX IDE, we will need several
- pieces of software; namely:
+
+ \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
+ (and experimental) toolchain of knowledge management systems. Both workflows profit
+ from an integrated development environment (IDE), which (also) automates setup as
+ far as possible (see \sref{sec.sTeX-IDE}).
+
+ \begin{sfragment}[id=sec.minimal-setup]{Minimal Setup for the PDF-only Workflow}
+ 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}.
+
+ Alternatively, you can install \sTeX from CTAN, the Comprehensive {\TeX} Archive
+ Network; see \cite{stexCTAN:on} for details.
+ \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.
+ Then 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}
+
+ \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}[id=sec.sTeX-IDE]{The \sTeX IDE}
+ We are currently working on an \sTeX IDE as an \sTeX plugin for |VScode|;
+ see~\cite{sTeX-IDE:on}. It will feature a setup procedure that automates the setup
+ described above (and below). For additional functionality see the (now obsolete)
+ plugin for \sTeX1 \cite{stexls:on,stexls-vscode-plugin:on}.
+ \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 \sTeX-Package} available
- \href{https://github.com/slatex/sTeX/blob/latex3/doc/stex.pdf}{here}%
- \ednote{For now, we require the \texttt{latex3}-branch}.
- Note, that the CTAN repository for \LaTeX{} packages
- may contain outdated versions of the \sTeX package, so
- make sure, that your |TEXMF| system variable is configured such
- that the packages available in the linked repository are prioritized
- over potential default packages that come with your \TeX{} distribution.
-
- %If you are only interested in using semantic macros in (ultimately)
- %|pdf|s generated by |pdflatex|, this is all you need.
-
\item \textbf{The \mmt System} available
- \href{https://github.com/uniformal/MMT/tree/sTeX}{here}%
- \ednote{For now, we require the \texttt{sTeX}-branch, requiring manually
- compiling the MMT sources}. We recommend following
+ \href{https://github.com/uniformal/MMT/tree/sTeX}{here}.
+ We recommend following
the setup routine documented
\href{https://uniformal.github.io//doc/setup/}{here}.
@@ -317,513 +283,305 @@ which can thus be integrated as additional services into the system.
a |MathHub|-directory on your local file system, where
the \mmt system will look for \sTeX/\mmt content archives.
- \item 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}).
- \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
+ \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}
- \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.
-
- The document we will consider is the following:
- \begin{framed}\begin{latexcode}
-\documentclass{article}
-\usepackage{stex}
-\usepackage{xcolor}
-\def\compemph#1{\textcolor{blue}{#1}}
+ \end{sfragment}
+
+ \input{stex-tutorial}
-\begin{document}
- \usemodule[smglom/calculus]{series}
- \usemodule[smglom/arithmetics]{realarith}
-
- The \symref{series}{series} $\infinitesum{n}{1}{
- \realdivide[frac]{1}{
- \realpower{2}{n}
- }
- }$ \symref{converges}{converges} towards $1$.
-
-\end{document}
- \end{latexcode}\end{framed}
-
- Compiling this document with |pdflatex| should yield
- the output
-
- \begin{framed}
- The \textbf{series}
- $\textcolor{blue}{\sum}_{n=1}^{\textcolor{blue}\infty} \frac{1}{2^n}$
- \textbf{converges} towards $1$.
- \end{framed}
-
- Note that the $\sum$ and $\infty$-symbols are highlighted in blue,
- and the words ``series'' and ``converges'' in bold.
- This signifies that these words and symbols
- reference \sTeX \emph{symbols}
- formally declared somewhere; associating their
- \emph{presentation} in the document with their (formal)
- definition - i.e. their semantics. The precise way
- in which they are highlighted (if at all) can of course
- be customized (see \ednote{somewhere later}).
-
- \begin{function}{\usemodule}
- The command |\usemodule[some/archive]{modulename}|
- finds some module in the appropriate archive -- in the first
- case (|\usemodule[smglom/calculus]{series}|), \sTeX
- looks for the archive |smglom/calculus| in our local
- MathHub-directory (see \sref{sec.stexarchives}), and
- in its source-folder for a file |series.tex|. Since no such
- file exists, and by default the document is assumed to be
- in \emph{english}, it picks the file |series.en.tex|, and
- indeed, in here we find a statement |\begin{smodule}{series}|.
- \iffalse\end{smodule}\fi
-
- \sTeX now reads this file and makes all semantic macros therein
- available to use, along with all its dependencies.
- This enables the usage of |\infinitesum| later on.
-
- Analogously, |\usemodule[smglom/arithmetics]{realarith}|
- opens the file |realarith.en.tex| in the |.../smglom/arithmetics/source|-folder
- and makes its contents available, e.g. |\realdivide| and |\realpower|.
- \end{function}
-
- \begin{function}{\symref,\symname}
- The command |\symref{symbolname}{text}| marks the |text|
- in the second argument as representing the |symbolname|
- in the first argument -- which is why the word ``series''
- is set in boldface. In the pdf, this is all that happens.
- In the |xhtml| (which we will investigate shortly) however,
- we will note that the word ``series'' is now annotated with the
- full URI of the symbol denoting the \emph{mathematical concept of
- a series}. In other words, the word is associated with an unambiguous
- semantics.
-
- Notably, in both cases above (\emph{series} and \emph{converges})
- the text that \emph{references} the symbol and the name of the symbol
- are identical. Since this occurs quite often, the shorthand
- |\symname{converges}| would have worked as well, where
- |\symname{foo-bar}| behaves exactly like |\symref{foo-bar}{foo bar}|
- - i.e. the text is simply the name of the symbol with ``|-|'' replaced by
- a space.
- \end{function}
-
- \begin{function}{\importmodule}
- If you investigated the contents of the imported modules
- (|realarith| and |series|) more closely, you'll note that
- none of them contain a symbol ``|converges|''. Yet, we
- can use |\symref| to refer to ``converges''. That is because
- the symbol |converges| is found in
- |smglom/calculus/source/sequenceConvergence.en.tex|, and
- |series.en.tex| contains the line
- |\importmodule{sequenceConvergence}|. The |\importmodule|-statement
- makes the module referenced available to all documents
- that include the current module. As such, a ``current module''
- has to exist for |\importmodule| to work, which is why the command
- is only allowed within a |module|-environment.
- \end{function}
-
- \textcolor{red}{TODO} explain |xhtml| conversion, MMT compilation
- (requires an archive...?).
-
- \end{sfragment}
\end{sfragment}
-\begin{sfragment}{Using \sTeX}
+\begin{sfragment}{Creating \sTeX Content}
+
\input{packages/stex-basics}
-
- \input{packages/stex-terms}
- \input{packages/stex-references}
-\end{sfragment}
+ \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.stexarchives]{\sTeX Archives}
+ \input{packages/stex-mathhub}
+ \end{sfragment}
-\begin{sfragment}{Creating New Modules and Symbols}
- \textcolor{red}{TODO}
+ \begin{sfragment}[id=sec.decls]{Module, Symbol and Notation Declarations}
+ \input{packages/stex-modules}
+ \input{packages/stex-symbols}
+ \end{sfragment}
- \stexexample{
- \begin{smodule}{assoctest}
- \symdef{foo}[args=iia]{\comp{a:}#1\comp{;b:}#2\comp{;c:}#3}{\comp[#1\comp{;}##1\comp+##2\comp;#2\comp]}
- $\foo {w_1}{w_2}{x,y,z}$
- \end{smodule}
- }
-
- \input{packages/stex-modules}
+ \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
- \input{packages/stex-symbols}
+ \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".
- \input{packages/stex-inheritance}
+ \end{sfragment}
- \begin{sfragment}{Advanced Structuring Mechanisms}
+ \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}{\sTeX Statements (Definitions, Theorems, Examples, ...)}
- \input{packages/stex-statements}
+\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}
\end{sfragment}
+\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{
+ \srefsymuri{#2}{\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}
+
\begin{sfragment}{Additional Packages}
- \input{packages/stex-tikzinput}
+ \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-slides}
\end{sfragment}
- \begin{sfragment}{Homework, Problems and Exams}
+ \begin{sfragment}{Representing Problems and Solutions}
\input{packages/stex-problem}
-
- \input{packages/stex-hwexam}
\end{sfragment}
-
+ \begin{sfragment}{Homeworks, Quizzes and Exams}
+ \input{packages/stex-hwexam}
+ \end{sfragment}
\end{sfragment}
-\chapter{Stuff}
-
-\section{Modules}
-
-
-\begin{function}{\sTeX , \stex}
- Both print this \stex logo.
-\end{function}
-
- \subsection{Semantic Macros and Notations}
-
- Semantic macros invoke a formally declared symbol.
-
- To declare a symbol (in a module), we use \cs{symdecl},
- which takes as argument the name of the corresponding
- semantic macro, e.g. |\symdecl{foo}| introduces the macro
- \cs{foo}. Additionally, \cs{symdecl} takes several options,
- the most important one being its arity. |foo| as declared above
- yields a \emph{constant} symbol. To introduce an \emph{operator}
- which takes arguments, we have to specify which arguments it takes.
-
- \begin{smodule}{SemanticMacrosExample}
- For example, to introduce binary multiplication,
- we can do |\symdecl{mult}[args=2]|. We can then supply
- the semantic macro with arbitrarily many notations, such as
- |\notation{mult}{#1 #2}|.
-
- \stexexample{
- \symdecl{mult}[args=2]
- \notation{mult}{#1 #2}
- $\mult{a}{b}$
-}
-
- Since usually, a freshly introduced symbol also comes with a
- notation from the start, the \cs{symdef} command combines
- \cs{symdecl} and \cs{notation}. So instead of the above,
- we could have also written
- \begin{center} |\symdef{mult}[args=2]{#1 #2}| \end{center}
-
- \symdecl{mult}[args=2]
- \notation{mult}{#1 #2}
-
- \notation{mult}[cdot]{#1 \comp{\cdot} #2}
- \notation{mult}[times]{#1 \comp{\times} #2}
- Adding more notations like
- |\notation{mult}[cdot]{#1 \comp{\cdot} #2}| or
- |\notation{mult}[times]{#1 \comp{\times} #2}|
- allows us to write |$\mult[cdot]{a}{b}$| and
- |$\mult[times]{a}{b}$|:
- \stexexample{
- \notation{mult}[cdot]{#1 \comp{\cdot} #2}
- \notation{mult}[times]{#1 \comp{\times} #2}
- $\mult[cdot]{a}{b}$ and $\mult[times]{a}{b}$
-}
- \notation{mult}[cdot]{#1 \comp{\cdot} #2}
- \notation{mult}[times]{#1 \comp{\times} #2}
-
- Not using an explicit option with a semantic macro yields
- the first declared notation, unless changed\ednote{TODO}.
-
- Outside of math mode, or by using the starred variant
- |\foo*|, allows to provide a custom notation, where
- notational (or textual) components can be given
- explicitly in square brackets.
- \stexexample{
- $\mult*{\arg{a}\comp{\ast}\arg{b}}$ is the
- \mult{\comp{product of} \arg{$a$} \comp{and} \arg{$b$}}
-}
-
- In custom mode, prefixing an argument with a star will not
- print that argument, but still export it to \omdoc:
- \stexexample{
- \mult{\comp{Multiplying} \arg*{$\mult{a}{b}$} again by \arg{$b$}} yields...
-}
- The syntax |*[|\meta{int}|]| allows switching
- the order of arguments. For example, given a 2-ary semantic
- macro |\forevery| with exemplary notation
- |\forall #1. #2|, we can write
- \stexexample{
- \symdecl{forevery}[args=2]
- \forevery{\arg[2]{The proposition $P$} \comp{holds for every} \arg[1]{$x\in A$}}
-}
-
- When using |*[|$n$|]|, after reading the provided ($n$th) argument,
- the ``argument counter'' automatically
- continues where we left off, so the |*[1]| in the above example
- can be omitted.
-
- For a macro with arity $>0$, we can refer to the operator
- \emph{itself} semantically by suffixing the semantic macro
- with an exclamation point |!| in either text or math mode.
- For that reason \cs{notation} (and thus \cs{symdef}) take an
- additional optional argument |op=|, which allows to assign
- a notation for the operator itself. e.g.
- \stexexample{
- \symdef{add}[args=2,op={+}]{#1 \comp+ #2}
- The operator $\add!$ adds two elements, as in $\add ab$.
- }
-
- |*| is composable with |!| for custom notations, as in:
-
- \stexexample{
- \mult!{\comp{Multiplication}} (denoted by $\mult!*{\comp\cdot}$) is defined by...
-}
-
- The macro \cs{comp} as used everywhere above is responsible
- for highlighting, linking, and tooltips, and should be wrapped
- around the notation (or text) components that should be treated
- accordingly. While it is attractive to just wrap a whole notation,
- this would also wrap around e.g. the arguments themselves, so
- instead, the user is tasked with marking the notation components
- themself.
-
- The precise behaviour of \cs{comp} is governed by
- the macro \cs{@comp}, which takes two arguments: The tex code
- of the text
- (unexpanded) to highlight, and the URI of the current symbol.
- \cs{@comp} can be safely redefined to customize the behaviour.
-
-
- The starred variant |\symdecl*{foo}| does not introduce a semantic
- macro, but still declares a corresponding symbol. |foo| (like
- any other symbol, for that matter) can
- then be accessed via \cs{STEXsymbol}|{foo}| or (if |foo| was declared
- in a module |Foo|) via \cs{STEXModule}|{Foo}?{foo}|.
-
- both \cs{STEXsymbol} and \cs{STEXModule} take any
- arbitrary ending segment of a full URI to determine
- which symbol or module is meant. e.g.
- \cs{STEXsymbol}|{Foo?foo}| is also valid, as are e.g.
- \cs{STEXModule}|{path?Foo}?{foo}| or
- \cs{STEXsymbol}|{path?Foo?foo}|
-
- There's also a convient shortcut \cs{symref}|{?foo}{some text}| for
- \cs{STEXsymbol}|{?foo}![some text]|.
-
- \end{smodule}
-
- \subsubsection{Other Argument Types}
-
- So far, we have stated the arity of a semantic macro directly.
- This works if we only have ``normal'' (or more precisely: |i|-type) arguments.
- To make use of other argument types, instead of providing the arity
- numerically, we can provide it as a sequence of characters representing
- the argument types -- e.g. instead of writing |args=2|, we
- can equivalently write |args=ii|, indicating that the macro
- takes two |i|-type arguments.
-
- Besides |i|-type arguments, \sTeX has two other types, which we will
- discuss now.
-
- The first are \emph{binding} (|b|-type) arguments, representing
- variables that are \emph{bound} by the operator. This is the
- case for example in the above \cs{forevery}-macro:
- The first argument is not actually an argument that the
- |forevery| ``function'' is ``applied'' to; rather, the first argument
- is a new variable (e.g. $x$) that is \emph{bound} in the subsequent
- argument. More accurately, the macro should therefore have been
- implemented thusly:
- \begin{center}|\symdef{forevery}[args=bi]{\forall #1.\; #2}|\end{center}
-
- \begin{smodule}{OtherArgs}
- |b|-type arguments are indistinguishable from |i|-type arguments
- within \sTeX, but are treated very differently in \omdoc and by \mmt.
- More interesting \emph{within} \sTeX are |a|-type arguments,
- which represent (associative) arguments of flexible arity, which are
- provided as comma-separated lists.
- This allows e.g. better representing the \cs{mult}-macro above:
-
- \stexexample{
- \symdef{mult}[args=a]{#1}{##1 \comp\cdot ##2}
- $\mult{a,b,c,{d^e},f}$
-}
- As the example above shows, notations get a little more complicated
- for associative arguments. For every |a|-type argument, the
- \cs{notation}-macro takes an additional argument that declares
- how individual entries in an |a|-type argument list are aggregated.
- The first notation argument then describes how the aggregated
- expression is combined into the full representation.
-
- For a more interesting example, consider a flexary operator
- for ordered sequences in ordered set, that taking
- arguments |{a,b,c}| and |\mathbb{R}| prints
- $a \leq b \leq c\in \mathbb R$. This operator takes
- two arguments (an |a|-type argument and an |i|-type argument),
- aggregates the individuals of the associative argument using |\leq|,
- and combines the result with |\in| and the second argument thusly:
-
- \stexexample{
- \symdef{numseq}[args=ai]{#1 \comp\in #2}{##1 \comp\leq ##2}
- $\numseq{a,b,c}{\mathbb R}$
-}
-
- Finally, |B|-type arguments combine the functionalities of |a|
- and |b|, i.e. they represent flexary binding operator arguments.
-
-\ednote{what about e.g. \detokenize{\int_x\int_y\int_z f dx dy dz}?}
-\ednote{``decompose'' a-type arguments into fixed-arity operators?}
-
- \end{smodule}
-
- \subsubsection{Precedences}
-
- Every notation has an (upwards) \emph{operator precedence} and
- for each argument a (downwards) \emph{argument precedence}
- used for automated bracketing. For example, a notation
- for a binary operator \cs{foo} could be declared like this:
- \begin{center} |\notation{foo}[prec=200;500x600]{#1 \comp{+} #2}| \end{center}
- assigning an operator precedence of 200, an argument precedence
- of 500 for the first argument, and an argument precedence of 600
- for the second argument.
-
- \sTeX insert brackets thusly: Upon encountering a semantic
- macro (such as \cs{foo}), its operator precedence (e.g. 200)
- is compared to the current downwards precedence (initially
- \cs{neginfprec}). If the operator precedence is \emph{larger}
- than the current downwards precedence, parentheses are inserted
- around the semantic macro.
-
- Notations for symbols of arity 0 have a default precedence of \cs{infprec},
- i.e. by default, parentheses are never inserted around constants.
- Notations for symbols with arity $>0$ have a default operator
- precedence of $0$.
- If no argument precedences are explicitly provided, then by
- default they are equal to the operator precedence.
-
- Consequently, if some operator $A$ should bind stronger than
- some operator $B$, then $A$s operator precedence should be
- smaller than $B$s argument precedences.
-
- For example:
- \begin{smodule}{NotationsEx}
- \symdecl{plus}[args=2]
- \symdecl{times}[args=2]
- \stexexample{
-\notation{plus}[prec=100]{#1 \comp{+} #2}
-\notation{times}[prec=50]{#1 \comp{\cdot} #2}
-$\plus{a}{\times{b}{c}}$ and $\times{a}{\plus{b}{c}}$
-}
-
-
- \end{smodule}
-
- \subsection{Archives and Imports}
-
- \subsubsection{Namespaces}
- 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 \cs{begin}|{module}{Foo}| 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^^A
- \footnote{which is internally attached to the module name instead,
- but a user need not worry about that.}.
-
- 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.
-
- \subsubsection{Paths in Import-Statements}
-
- Conversely, here is how namespaces/URIs and file paths are computed
- in import statements, examplary \cs{importmodule}:
-
- \begin{itemize}
- \item \cs{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 \cs{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, \cs{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, \cs{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 discouraged.
-
- \end{itemize}
-
+\csname if@infulldoc\endcsname\else
+\newpage
+\printbibliography
+\end{document}
+\fi
-
-
-\csname if@infulldoc\endcsname\else\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/Master/texmf-dist/doc/latex/stex/stex-tutorial.tex b/Master/texmf-dist/doc/latex/stex/stex-tutorial.tex
new file mode 100644
index 00000000000..dcd4c442e00
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/stex/stex-tutorial.tex
@@ -0,0 +1,354 @@
+ \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
diff --git a/Master/texmf-dist/source/latex/stex/extensions/document-structure.dtx b/Master/texmf-dist/source/latex/stex/extensions/document-structure.dtx
index 6db3bf4d7c9..b05e4d464c7 100644
--- a/Master/texmf-dist/source/latex/stex/extensions/document-structure.dtx
+++ b/Master/texmf-dist/source/latex/stex/extensions/document-structure.dtx
@@ -9,7 +9,7 @@
%
%
%<*driver>
-\def\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -17,7 +17,6 @@
\end{document}
%</driver>
% \fi
-% %^^A \changes{v0.1}{2006/1/17}{First Version}
%
% \title{document-structure: Semantic Markup for Open Mathematical Documents in {\LaTeX}
% \thanks{Version {\fileversion} (last revised {\filedate})}
@@ -30,354 +29,35 @@
%
% \maketitle
%
-%\ifinfulldoc\else
-% This is the documentation for the \pkg{document-structure} package.
-% For a more high-level introduction,
-% see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
-% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+% \ifinfulldoc\else
+% \begin{abstract}
+% This is the documentation for the \pkg{document-structure} package from \sTeX
+% collection, a version of {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents
+% semantically without leaving the document format, essentially turning {\TeX/\LaTeX}
+% into a document format for mathematical knowledge management (MKM).
%
+% For a more high-level introduction, see \href{\basedocurl/manual.pdf}{the \sTeX
+% Manual} or the \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+% \end{abstract}
+%
+% \tableofcontents
+%
% \input{../../doc/packages/stex-document-structure}
% \fi
%
%
% \begin{documentation}\label{pkg:documentstructure:doc}
%
-% The |document-structure| package is part of the \sTeX collection, a version of {\TeX/\LaTeX} that
-% allows to markup {\TeX/\LaTeX} documents semantically without leaving the document
-% format, essentially turning {\TeX/\LaTeX} into a document format for mathematical
-% knowledge management (MKM).
-%
-% This 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.
-% \begin{sfragment}[id=sec:STR]{Introduction}
-%
-% \sTeX is a version of {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents
-% semantically without leaving the document format, essentially turning {\TeX/\LaTeX}
-% into a document format for mathematical knowledge management (MKM). The package
-% supports direct translation to the {\omdoc} format~\cite{Kohlhase:OMDoc1.2}
-%
-% The |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.\ednote{integrate with latexml's XMRef in the Math mode.}
-% \end{sfragment}
-%
-% \begin{sfragment}[id=sec:user]{The User Interface}
-%
-% The |document-structure| package generates two files: |document-structure.cls|, and |document-structure.sty|. The {\omdoc}
-% class is a minimally changed variant of the standard |article| class that includes the
-% functionality provided by |document-structure.sty|. The rest of the documentation pertains to the
-% functionality introduced by |document-structure.sty|.
-%
-% \begin{sfragment}[id=sec:user:options]{Package and Class Options}
-%
-% The |document-strcture| class accept 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
-% \texttt{showignores} & show the the contents of the |ignore| environment after all \\\hline
-% \texttt{showmeta} & show the metadata; see |metakeys.sty|\\\hline
-% \texttt{showmods} & show modules; see |modules.sty|\\\hline
-% \texttt{extrefs} & allow external references; see |sref.sty|\\\hline
-% \texttt{defindex} & index definienda; see |statements.sty|\\\hline
-% \texttt{minimal} & for testing; do not load any \sTeX packages\\\hline
-% \end{tabular}
-% \end{center}
-% The |document-structure| package accepts the same except the first two.
-% \end{sfragment}
-%
-% \begin{sfragment}[id=sec:user:struct]{Document Structure}
-%
-% The top-level \DescribeEnv{document}|document| environment can be given key/value
-% information by the \DescribeMacro{\documentkeys}|\documentkeys| macro in the
-% preamble\footnote{We cannot patch the document environment to accept an optional
-% argument, since other packages we load already do; pity.}. This can be used to give
-% metadata about the document. For the moment only the \DescribeMacro{id}|id| key is
-% used to give an identifier to the \texttt{omdoc} element resulting from the {\latexml}
-% transformation.
-%
-% The structure of the document is given by the \DescribeEnv{sfragment}|omgroup|
-% environment just like in {\omdoc}. In the {\LaTeX} route, the |omgroup| environment is
-% flexibly mapped to sectioning commands, inducing the proper sectioning level from the
-% nesting of |omgroup| environments. Correspondingly, the |omgroup| environment takes an
-% optional key/value argument for metadata followed by a regular argument for the
-% (section) title of the omgroup. The optional metadata argument has the keys
-% \DescribeMacro{id}|id| for an identifier, \DescribeMacro{creators}|creators| and
-% \DescribeMacro{contributors}|contributors| for the Dublin Core
-% metadata~\cite{DCMI:dmt03}; see~\cite{Kohlhase:dcm:git} for details of the format. The
-% \DescribeMacro{short}|short| allows to give a short title for the generated
-% section. If the title contains semantic macros, they need to be protected by
-% |\protect|, and we need to give the \DescribeMacro{loadmodules}|loadmodules| key it
-% needs no value. For instance we would have
-% \begin{verbatim}
-% \begin{smodule}{foo}
-% \symdef{bar}{B^a_r}
-% ...
-% \begin{sfragment}[id=sec.barderiv,loadmodules]{Introducing $\protect\bar$ Derivations}
-% \end{verbatim}
-%
-% \sTeX automatically computes the sectioning level, from the nesting of |omgroup|
-% environments. But sometimes, we want to skip levels (e.g. to use a subsection* as an
-% introduction for a chapter). Therefore the |document-structure| package provides a variant
-% \DescribeEnv{blindfragment}|blindomgroup| 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 |blindomgroup| environment is useful e.g. for creating frontmatter at the
-% correct level. Example~\ref{fig:docstruct} shows a typical setup for the outer
-% document structure of a book with parts and chapters. We use two levels of
-% |blindomgroup|:
-% \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 |blindomgroup| makes sure
-% that the introductory remarks become a ``chapter'' instead of a ``part''.
-% \item Th inner one groups the frontmatter\footnote{We shied away from redefining the
-% |frontmatter| to induce a blindomgroup, but this may be the ``right'' way to go in
-% the future.} and makes the preface of the book a section-level construct. Note that
-% here the |display=flow| on the |omgroup| environment prevents numbering as is
-% traditional for prefaces.
-% \end{itemize}
-% \begin{exfig}
-% \begin{verbatim}
-% \begin{document}
-% \begin{blindfragment}
-% \begin{blindfragment}
-% \begin{frontmatter}
-% \maketitle\newpage
-% \begin{sfragment}[display=flow]{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{verbatim}
-% \vspace*{-2em}
-% \caption{A typical Document Structure of a Book}\label{fig:docstruct}
-% \end{exfig}
-%
-% The \DescribeMacro{\skipomgroup}|\skipomgroup| ``skips an |omgroup|'', 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 |\skipomgroup|.
-%
-% The \DescribeMacro{\currentsectionlevel}|\currentsectionlevel| macro supplies the name
-% of the current sectioning level, e.g. ``chapter'', or
-% ``subsection''. \DescribeMacro{\CurrentSectionLevel}|\CurrentSectionLevel| is the
-% capitalized variant. They are useful to write something like ``In this
-% |\currentsectionlevel|, we will\ldots'' in an |omgroup| environment, where we do not
-% know which sectioning level we will end up.
-% \end{sfragment}
-%
-% \begin{sfragment}[id=sec:user:ignore]{Ignoring Inputs}
-%
-% The \DescribeEnv{ignore}|ignore| environment can be used for hiding text parts from the
-% document structure. The body of the environment is not PDF or DVI output unless the
-% \DescribeMacro{showignores}|showignores| option is given to the |document-structure| class or
-% |package|. But in the generated {\omdoc} result, the body is marked up with a |ignore|
-% element. This is useful in two situations. For
-% \begin{description}
-% \item[editing] One may want to hide unfinished or obsolete parts of a document
-% \item[narrative/content markup] In {\stex} we mark up narrative-structured documents. In
-% the generated {\omdoc} documents we want to be able to cache content objects that are
-% not directly visible. For instance in the |statements|
-% package~\cite{Kohlhase:smms:git} we use the |\inlinedef| macro to mark up phrase-level
-% definitions, which verbalize more formal definitions. The latter can be hidden by an
-% ignore and referenced by the |verbalizes| key in |\inlinedef|.
-% \end{description}
-%
-% For prematurely stopping the formatting of a document, \sTeX provides the
-% \DescribeMacro{\prematurestop}|\prematurestop| macro. It can be used everywhere in a
-% document and ignores all input after that -- backing out of the omgroup environment as
-% needed. After that -- and before the implicit |\end{document}| it calls the internal
-% \DescribeMacro{\afterprematurestop}|\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{sfragment}
-%
-% \begin{sfragment}[id=sec:user:sharing]{Structure Sharing}
-%
-% The \DescribeMacro{\STRlabel}|\STRlabel| macro takes two arguments: a label and the
-% content and stores the the content for later use by
-% \DescribeMacro{\STRcopy}|\STRcopy[|\meta{URL}|]{|\meta{label}|}|, which expands to the
-% previously stored content. If the |\STRlabel| macro was in a different file, then we
-% can give a URL \meta{URL} that lets {\latexml} generate the correct reference.
-%
-% \DescribeMacro{\STRsemantics} The |\STRlabel| macro has a variant |\STRsemantics|,
-% where the label argument is optional, and which takes a third argument, which is
-% ignored in {\LaTeX}. This allows to specify the meaning of the content (whatever that
-% may mean) in cases, where the source document is not formatted for presentation, but
-% is transformed into some content markup format.\ednote{document LMID und LMXREf here
-% if we decide to keep them.}
-% \end{sfragment}
-%
-% \begin{sfragment}[id=sec:user:gvars]{Global Variables}
-%
-% 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.
-% \DescribeMacro{\setSGvar}|\setSGvar{|\meta{vname}|}{|\meta{text}|}| to set the global
-% variable \meta{vname} to \meta{text} and
-% \DescribeMacro{\useSGvar}|\useSGvar{|\meta{vname}|}| to reference it.
-%
-% With \DescribeMacro{\ifSGvar}|\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{sfragment}
-%
-% \begin{sfragment}[id=sec:user:colors]{Colors}
-%
-% For convenience, the |document-structure| package defines a couple of color macros for the |color|
-% package: For instance \DescribeMacro{\blue}|\blue| abbreviates |\textcolor{blue}|, so
-% that |\blue{|\meta{something}|}| writes \meta{something} in blue. The macros
-% \DescribeMacro{\red}|\red| \DescribeMacro{...}|\green|, |\cyan|, |\magenta|, |\brown|,
-% |\yellow|, |\orange|, |\gray|, and finally \DescribeMacro{\black}|\black| are
-% analogous.
-% \end{sfragment}
-% \end{sfragment}
-%
-% \begin{sfragment}[id=sec:limitations]{Limitations}
-%
-% In this section we document known limitations. If you want to help alleviate them,
-% please feel free to contact the package author. Some of them are currently discussed in
-% the \sTeX GitHub repository~\cite{sTeX:github:on}.
-% \begin{enumerate}
-% \item when option |book| which uses |\pagestyle{headings}| is given and semantic macros
-% are given in the |omgroup| titles, then they sometimes are not defined by the time the
-% heading is formatted. Need to look into how the headings are made.
-% \end{enumerate}
-% \end{sfragment}
-%
% \end{documentation}
%
% \begin{implementation}\label{pkg:documentstructure:impl}
%
% \begin{sfragment}{document-structure.sty Implementation}
%
-% \begin{sfragment}[id=sec:impl:cls]{The document-structure Class}
-%
-% The functionality is spread over the |document-structure| class and package. The class provides the
-% |document| environment and the |document-structure| element corresponds to it, whereas the
-% package provides the concrete functionality.
-%
-% \begin{macrocode}
-%<*cls>
-%<@@=document_structure>
-\ProvidesExplClass{document-structure}{2022/02/26}{3.0.1}{Modular Document Structure Class}
-\RequirePackage{l3keys2e}
-% \end{macrocode}
-%
-% \begin{sfragment}[id=sec:impl:cls:options]{Class Options}
-% To initialize the |document-structure| class, we declare and process the necessary options using
-% the |kvoptions| package for key/value options handling. For
-% |omdoc.cls| this is quite simple. We have options |report| and |book|, which set the
-% \DescribeMacro{\omdoc@cls@class}|\omdoc@cls@class| macro and pass on the macro to |omdoc.sty|
-% for further processing.
-%
-% \begin{macrocode}
-\keys_define:nn{ document-structure / pkg }{
- class .str_set_x:N = \c_document_structure_class_str,
- minimal .bool_set:N = \c_document_structure_minimal_bool,
- report .code:n = {
- \ClassWarning{document-structure}{the option 'report' is deprecated, use 'class=report', instead}
- \str_set:Nn \c_document_structure_class_str {report}
- },
- book .code:n = {
- \ClassWarning{document-structure}{the option 'book' is deprecated, use 'class=book', instead}
- \str_set:Nn \c_document_structure_class_str {book}
- },
- bookpart .code:n = {
- \ClassWarning{document-structure}{the option 'bookpart' is deprecated, use 'class=book,topsect=chapter', instead}
- \str_set:Nn \c_document_structure_class_str {book}
- \str_set:Nn \c_document_structure_topsect_str {chapter}
- },
- docopt .str_set_x:N = \c_document_structure_docopt_str,
- unknown .code:n = {
- \PassOptionsToPackage{ \CurrentOption }{ document-structure }
- }
-}
-\ProcessKeysOptions{ document-structure / pkg }
-\str_if_empty:NT \c_document_structure_class_str {
- \str_set:Nn \c_document_structure_class_str {article}
-}
-\exp_after:wN\LoadClass\exp_after:wN[\c_document_structure_docopt_str]
- {\c_document_structure_class_str}
-
-% \end{macrocode}
-% \end{sfragment}
-%
-% \begin{sfragment}[id=sec:impl:cls:document]{Beefing up the \texttt{document} environment}
-%
-% Now, -- unless the option |minimal| is defined -- we include the |stex| package
-%
-% \begin{macrocode}
-\RequirePackage{document-structure}
-\bool_if:NF \c_document_structure_minimal_bool {
-% \end{macrocode}
-%
-% And define the environments we need. The top-level one is the |document| environment,
-% which we redefined so that we can provide keyval arguments.
-%
-% \begin{environment}{document}
-% For the moment we do not use them on the {\LaTeX} level, but the document identifier
-% is picked up by {\latexml}.\ednote{faking documentkeys for now. @HANG, please implement}
-% \begin{macrocode}
-\keys_define:nn { document-structure / document }{
- id .str_set_x:N = \c_document_structure_document_id_str
-}
-\let\_@@_orig_document=\document
-\renewcommand{\document}[1][]{
- \keys_set:nn{ document-structure / document }{ #1 }
- \stex_ref_new_doc_target:n { \c_document_structure_document_id_str }
- \_@@_orig_document
-}
-% \end{macrocode}
-% \end{environment}
-%
-% Finally, we end the test for the |minimal| option.
-%
-% \begin{macrocode}
-}
-%</cls>
-% \end{macrocode}
-% \end{sfragment}
-% \end{sfragment}
-%
-% \begin{sfragment}[id=sec:impl:sty]{Implementation: document-structure Package}
-%
% \begin{macrocode}
%<*package>
-\ProvidesExplPackage{document-structure}{2022/02/26}{3.0.1}{Modular Document Structure}
+%<@@=document_structure>
+\ProvidesExplPackage{document-structure}{2022/05/24}{3.1.0}{Modular Document Structure}
\RequirePackage{l3keys2e}
% \end{macrocode}
%
@@ -390,12 +70,16 @@
%
% \begin{macrocode}
-\keys_define:nn{ document-structure / pkg }{
+\keys_define:nn{ document-structure }{
class .str_set_x:N = \c_document_structure_class_str,
- topsect .str_set_x:N = \c_document_structure_topsect_str,
+ topsect .str_set_x:N = \c_document_structure_topsect_str,,
+ unknown .code:n = {
+ \PassOptionsToClass{\CurrentOption}{stex}
+ \PassOptionsToClass{\CurrentOption}{tikzinput}
+ }
% showignores .bool_set:N = \c_document_structure_showignores_bool,
}
-\ProcessKeysOptions{ document-structure / pkg }
+\ProcessKeysOptions{ document-structure }
\str_if_empty:NT \c_document_structure_class_str {
\str_set:Nn \c_document_structure_class_str {article}
}
@@ -410,6 +94,7 @@
% \begin{macrocode}
\RequirePackage{xspace}
\RequirePackage{comment}
+\RequirePackage{stex}
\AddToHook{begindocument}{
\ltx@ifpackageloaded{babel}{
\clist_set:Nx \l_tmpa_clist {\bbl@loaded}
@@ -452,9 +137,8 @@
%
% \begin{sfragment}[id=sec:impl:struct]{Document Structure}
%
-% The structure of the document is given by the |omgroup| environment just like in
-% OMDoc. The hierarchy is adjusted automatically according to the {\LaTeX} class in
-% effect.
+% The structure of the document is given by the |sfragment| environment. The hierarchy
+% is adjusted automatically according to the {\LaTeX} class in effect.
% \begin{macro}{\currentsectionlevel}
% For the |\currentsectionlevel| and |\Currentsectionlevel| macros we use an internal
% macro |\current@section@level| that only contains the keyword (no markup). We
@@ -469,9 +153,9 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\skipomgroup}
+% \begin{macro}{\skipfragment}
% \begin{macrocode}
-\cs_new_protected:Npn \skipomgroup {
+\cs_new_protected:Npn \skipfragment {
\ifcase\l_document_structure_section_level_int
\or\stepcounter{part}
\or\stepcounter{chapter}
@@ -487,82 +171,84 @@
%
% \begin{environment}{blindfragment}
% \begin{macrocode}
-\newcommand\at@begin@blindomgroup[1]{}
+\newcommand\at@begin@blindsfragment[1]{}
\newenvironment{blindfragment}
{
\int_incr:N\l_document_structure_section_level_int
- \at@begin@blindomgroup\l_document_structure_section_level_int
+ \at@begin@blindsfragment\l_document_structure_section_level_int
}{}
% \end{macrocode}
% \end{environment}
%
-% \begin{macro}{\omgroup@nonum}
-% convenience macro: |\omgroup@nonum{|\meta{level}|}{|\meta{title}|}| makes an unnumbered
+% \begin{macro}{\sfragment@nonum}
+% convenience macro: |\sfragment@nonum{|\meta{level}|}{|\meta{title}|}| makes an unnumbered
% sectioning with title \meta{title} at level \meta{level}.
% \begin{macrocode}
-\newcommand\omgroup@nonum[2]{
+\newcommand\sfragment@nonum[2]{
\ifx\hyper@anchor\@undefined\else\phantomsection\fi
\addcontentsline{toc}{#1}{#2}\@nameuse{#1}*{#2}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\omgroup@num}
-% convenience macro: |\omgroup@nonum{|\meta{level}|}{|\meta{title}|}| makes numbered
+% \begin{macro}{\sfragment@num}
+% convenience macro: |\sfragment@nonum{|\meta{level}|}{|\meta{title}|}| makes numbered
% sectioning with title \meta{title} at level \meta{level}. We have to check the |short|
-% key was given in the |omgroup| environment and -- if it is use it. But how to do that
+% key was given in the |sfragment| environment and -- if it is use it. But how to do that
% depends on whether the |rdfmeta| package has been loaded. In the end we call
% |\sref@label@id| to enable crossreferencing.
% \begin{macrocode}
-\newcommand\omgroup@num[2]{
- \tl_if_empty:NTF \l_@@_omgroup_short_tl {
+\newcommand\sfragment@num[2]{
+ \tl_if_empty:NTF \l_@@_sfragment_short_tl {
\@nameuse{#1}{#2}
}{
\cs_if_exist:NTF\rdfmeta@sectioning{
- \@nameuse{rdfmeta@#1@old}[\l_@@_omgroup_short_tl]{#2}
+ \@nameuse{rdfmeta@#1@old}[\l_@@_sfragment_short_tl]{#2}
}{
- \@nameuse{#1}[\l_@@_omgroup_short_tl]{#2}
+ \@nameuse{#1}[\l_@@_sfragment_short_tl]{#2}
}
}
-%\sref@label@id@arg{\omdoc@sect@name~\@nameuse{the#1}}\omgroup@id
+%\sref@label@id@arg{\omdoc@sect@name~\@nameuse{the#1}}\sfragment@id
}
% \end{macrocode}
% \end{macro}
%
% \begin{environment}{sfragment}
% \begin{macrocode}
-\keys_define:nn { document-structure / omgroup }{
- id .str_set_x:N = \l_@@_omgroup_id_str,
- date .str_set_x:N = \l_@@_omgroup_date_str,
- creators .clist_set:N = \l_@@_omgroup_creators_clist,
- contributors .clist_set:N = \l_@@_omgroup_contributors_clist,
- srccite .tl_set:N = \l_@@_omgroup_srccite_tl,
- type .tl_set:N = \l_@@_omgroup_type_tl,
- short .tl_set:N = \l_@@_omgroup_short_tl,
- display .tl_set:N = \l_@@_omgroup_display_tl,
- intro .tl_set:N = \l_@@_omgroup_intro_tl,
- loadmodules .bool_set:N = \l_@@_omgroup_loadmodules_bool
+\keys_define:nn { document-structure / sfragment }{
+ id .str_set_x:N = \l_@@_sfragment_id_str,
+ date .str_set_x:N = \l_@@_sfragment_date_str,
+ creators .clist_set:N = \l_@@_sfragment_creators_clist,
+ contributors .clist_set:N = \l_@@_sfragment_contributors_clist,
+ srccite .tl_set:N = \l_@@_sfragment_srccite_tl,
+ type .tl_set:N = \l_@@_sfragment_type_tl,
+ short .tl_set:N = \l_@@_sfragment_short_tl,
+ display .tl_set:N = \l_@@_sfragment_display_tl,
+ intro .tl_set:N = \l_@@_sfragment_intro_tl,
+ imports .tl_set:N = \l_@@_sfragment_imports_tl,
+ loadmodules .bool_set:N = \l_@@_sfragment_loadmodules_bool
}
-\cs_new_protected:Nn \_@@_omgroup_args:n {
- \str_clear:N \l_@@_omgroup_id_str
- \str_clear:N \l_@@_omgroup_date_str
- \clist_clear:N \l_@@_omgroup_creators_clist
- \clist_clear:N \l_@@_omgroup_contributors_clist
- \tl_clear:N \l_@@_omgroup_srccite_tl
- \tl_clear:N \l_@@_omgroup_type_tl
- \tl_clear:N \l_@@_omgroup_short_tl
- \tl_clear:N \l_@@_omgroup_display_tl
- \tl_clear:N \l_@@_omgroup_intro_tl
- \bool_set_false:N \l_@@_omgroup_loadmodules_bool
- \keys_set:nn { document-structure / omgroup } { #1 }
+\cs_new_protected:Nn \_@@_sfragment_args:n {
+ \str_clear:N \l_@@_sfragment_id_str
+ \str_clear:N \l_@@_sfragment_date_str
+ \clist_clear:N \l_@@_sfragment_creators_clist
+ \clist_clear:N \l_@@_sfragment_contributors_clist
+ \tl_clear:N \l_@@_sfragment_srccite_tl
+ \tl_clear:N \l_@@_sfragment_type_tl
+ \tl_clear:N \l_@@_sfragment_short_tl
+ \tl_clear:N \l_@@_sfragment_display_tl
+ \tl_clear:N \l_@@_sfragment_imports_tl
+ \tl_clear:N \l_@@_sfragment_intro_tl
+ \bool_set_false:N \l_@@_sfragment_loadmodules_bool
+ \keys_set:nn { document-structure / sfragment } { #1 }
}
% \end{macrocode}
% we define a switch for numbering lines and a hook for the beginning of groups: The
-% \DescribeMacro{\at@begin@omgroup}|\at@begin@omgroup| macro allows customization. It is
-% run at the beginning of the |omgroup|, i.e. after the section heading.
+% \DescribeMacro{\at@begin@sfragment}|\at@begin@sfragment| macro allows customization. It is
+% run at the beginning of the |sfragment|, i.e. after the section heading.
% \begin{macrocode}
\newif\if@mainmatter\@mainmattertrue
-\newcommand\at@begin@omgroup[3][]{}
+\newcommand\at@begin@sfragment[3][]{}
% \end{macrocode}
%
% Then we define a helper macro that takes care of the sectioning magic. It comes with its
@@ -590,20 +276,20 @@
\bool_if:NT \l_@@_sect_clear_bool { \cleardoublepage }
\if@mainmatter% numbering not overridden by frontmatter, etc.
\bool_if:NTF \l_@@_sect_num_bool {
- \omgroup@num{#2}{#3}
+ \sfragment@num{#2}{#3}
}{
- \omgroup@nonum{#2}{#3}
+ \sfragment@nonum{#2}{#3}
}
\def\current@section@level{\omdoc@sect@name}
\else
- \omgroup@nonum{#2}{#3}
+ \sfragment@nonum{#2}{#3}
\fi
}% if@mainmatter
% \end{macrocode}
% and another one, if redefines the |\addtocontentsline| macro of {\LaTeX} to import the
% respective macros. It takes as an argument a list of module names.
% \begin{macrocode}
-\newcommand\omgroup@redefine@addtocontents[1]{%
+\newcommand\sfragment@redefine@addtocontents[1]{%
%\edef\@@import{#1}%
%\@for\@I:=\@@import\do{%
%\edef\@path{\csname module@\@I @path\endcsname}%
@@ -618,21 +304,23 @@
%\fi
}% hypreref.sty loaded?
% \end{macrocode}
-% now the |omgroup| environment itself. This takes care of the table of contents via the
+% now the |sfragment| environment itself. This takes care of the table of contents via the
% helper macro above and then selects the appropriate sectioning command from
-% |article.cls|. It also registeres the current level of omgroups in the |\omgroup@level|
+% |article.cls|. It also registeres the current level of sfragments in the |\sfragment@level|
% counter.
% \begin{macrocode}
\newenvironment{sfragment}[2][]% keys, title
{
- \_@@_omgroup_args:n { #1 }%\sref@target%
+ \_@@_sfragment_args:n { #1 }%\sref@target%
% \end{macrocode}
% If the |loadmodules| key is set on |\begin{sfragment}|, we redefine the |\addcontetsline|
% macro that determines how the sectioning commands below construct the entries for the
% table of contents.
% \begin{macrocode}
- \bool_if:NT \l_@@_omgroup_loadmodules_bool {
- \omgroup@redefine@addtocontents{
+ \stex_csl_to_imports:No \usemodule \l_@@_sfragment_imports_tl
+
+ \bool_if:NT \l_@@_sfragment_loadmodules_bool {
+ \sfragment@redefine@addtocontents{
%\@ifundefined{module@id}\used@modules%
%{\@ifundefined{module@\module@id @path}{\used@modules}\module@id}
}
@@ -641,6 +329,9 @@
% now we only need to construct the right sectioning depending on the value of
% |\section@level|.
% \begin{macrocode}
+
+ \stex_document_title:n { #2 }
+
\int_incr:N\l_document_structure_section_level_int
\ifcase\l_document_structure_section_level_int
\or\omdoc@sectioning[name=\omdoc@part@kw,clear,num]{part}{#2}
@@ -651,9 +342,9 @@
\or\omdoc@sectioning[name=\omdoc@paragraph@kw,ref=this \omdoc@paragraph@kw]{paragraph}{#2}
\or\omdoc@sectioning[name=\omdoc@subparagraph@kw,ref=this \omdoc@subparagraph@kw]{paragraph}{#2}
\fi
- \at@begin@omgroup[#1]\l_document_structure_section_level_int{#2}
- \str_if_empty:NF \l_@@_omgroup_id_str {
- \stex_ref_new_doc_target:n\l_@@_omgroup_id_str
+ \at@begin@sfragment[#1]\l_document_structure_section_level_int{#2}
+ \str_if_empty:NF \l_@@_sfragment_id_str {
+ \stex_ref_new_doc_target:n\l_@@_sfragment_id_str
}
}% for customization
{}
@@ -757,73 +448,26 @@
%
% \begin{macro}{\prematurestop}
% We initialize |\afterprematurestop|, and provide
-% |\prematurestop@endomgroup| which looks up |\omgroup@level| and recursively ends
+% |\prematurestop@endsfragment| which looks up |\sfragment@level| and recursively ends
% enough |{sfragment}|s.
% \begin{macrocode}
\def \c_@@_document_str{document}
\newcommand\afterprematurestop{}
-\def\prematurestop@endomgroup{
+\def\prematurestop@endsfragment{
\unless\ifx\@currenvir\c_@@_document_str
\expandafter\expandafter\expandafter\end\expandafter\expandafter\expandafter{\expandafter\@currenvir\expandafter}
- \expandafter\prematurestop@endomgroup
+ \expandafter\prematurestop@endsfragment
\fi
}
\providecommand\prematurestop{
\message{Stopping~sTeX~processing~prematurely}
- \prematurestop@endomgroup
+ \prematurestop@endsfragment
\afterprematurestop
\end{document}
}
% \end{macrocode}
% \end{macro}
%
-% \iffalse
-% \begin{sfragment}[id=sec:impl:share]{Structure Sharing}
-% \ednote{The following is simply copied over from the |latexml| package, which we
-% eliminated, we should integrate better.}
-% \begin{macrocode}
-\iffalse
-\providecommand{\lxDocumentID}[1]{}%
-\def\LXMID#1#2{\expandafter\gdef\csname xmarg#1\endcsname{#2}\csname xmarg#1\endcsname}
-\def\LXMRef#1{\csname xmarg#1\endcsname}
-% \end{macrocode}
-%
-% \begin{macro}{\STRlabel}
-% The main macro, it it used to attach a label to some text expansion. Later on, using the
-% |\STRcopy| macro, the author can use this label to get the expansion originally assigned.
-% \begin{macrocode}
-\long\def\STRlabel#1#2{\STRlabeldef{#1}{#2}{#2}}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\STRcopy}
-% The |\STRcopy| macro is used to call the expansion of a given label. In case the label
-% is not defined it will issue a warning.\ednote{MK: we need to do something about the
-% ref!}
-% \begin{macrocode}
-\newcommand\STRcopy[2][]{\expandafter\ifx\csname STR@#2\endcsname\relax
-\message{STR warning: reference #2 undefined!}
-\else\csname STR@#2\endcsname\fi}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\STRsemantics}
-% if we have a presentation form and a semantic form, then we can use
-% \begin{macrocode}
-\newcommand\STRsemantics[3][]{#2\def\@test{#1}\ifx\@test\@empty\STRlabeldef{#1}{#2}\fi}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\STRlabeldef}
-% This is the macro that does the actual labeling. Is it called inside |\STRlabel|
-% \begin{macrocode}
-\def\STRlabeldef#1{\expandafter\gdef\csname STR@#1\endcsname}
-\fi
-% \end{macrocode}
-% \end{macro}
-% \end{sfragment}
-%\fi
-%
% \begin{sfragment}[id=sec:impl:gvars]{Global Variables}
%
% \begin{macro}{\setSGvar}
@@ -860,63 +504,12 @@
%
% \end{sfragment}
% \end{sfragment}
-% \end{sfragment}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
\endinput
-% \iffalse
+
%%% Local Variables:
%%% mode: doctex
%%% TeX-master: t
%%% End:
-% \fi
-% LocalWords: GPL structuresharing STR omdoc dtx stex CPERL LoadClass url dc filedate om
-% LocalWords: RequirePackage RegisterNamespace namespace xsl DocType ltxml dtd DAG hline
-% LocalWords: ltx DefEnvironment beforeDigest AssignValue inPreamble getGullet rangle
-% LocalWords: afterDigest keyval omgroup DefKeyVal Semiverbatim KeyVal srcf frontmatter
-% LocalWords: OptionalKeyVals DefParameterType IfBeginFollows skipSpaces CMP rangle xdef
-% LocalWords: ifNext DefMacro needwrapper unlist DefConstructor omtext bgroup showmods
-% LocalWords: useCMPItemizations RefStepItemCounter egroup beginItemize li di pathsuris
-% LocalWords: beforeDigestEnd dt autoclose ul ol dl env showignores srcref Cwd rdfmeta
-% LocalWords: afterOpen LastSeenCMP autoClose DefCMPEnvironment proto ToString st@flow
-% LocalWords: addAttribute nlex nlcex omdocColorMacro args tok MergeFont qw setion@level
-% LocalWords: TokenizeInternal toString isMath foreach maybeCloseElement id'd Backmatter
-% LocalWords: autoOpen minipage footnotesize scriptsize numberIt whatsit href endinput
-% LocalWords: getAttribute setAttribute OMDoc RelaxNGSchema noindex xml lec KeyVals
-% LocalWords: Subsubsection useDefaultItemizations refundefinedtrue sblockquote defindex
-% LocalWords: DefCMPConstructor sinlinequote idx idt ide idp emph extrefs sref Tokenize
-% LocalWords: flushleft flushright DeclareOption PassOptions undef cls iffalse noauxreq
-% LocalWords: ProcessOptions subparagraph ignoresfalse ignorestrue texttt ttin behavior
-% LocalWords: texttt latexml fileversion maketitle newpage tableofcontents cwd srccite
-% LocalWords: newpage ednote ctancite dmt03 smms inlinedef STRlabel STRcopy loadmodules
-% LocalWords: STRlabel STRsemantics STRsemantics textcolor printbibliography loadmodules
-% LocalWords: textsf langle textsf langle respetively orig renewcommand cdir capitalized
-% LocalWords: baseuri baseuri baselocal baselocal SOURCEFILE cooluri newif ifx tf@toc
-% LocalWords: SOURCEBASE chapterfalse partfalse newcount ifshow chaptertrue initialize
-% LocalWords: parttrue srefaddidkey newenvironment textbf compactenum showmeta tf@toc
-% LocalWords: noindent noindent ignorespaces ifnum thepart thechapter regexp color.sty
-% LocalWords: thesection thesubsection thesubsubsection needswrapper itshape xmarg xmarg
-% LocalWords: textgreater renewenvironment excludecomment STRlabeldef csname Section,num
-% LocalWords: expandafter endcsname xref newcommand gdef doctex metakeys Hacky arabic
-% LocalWords: metasetkeys addmetakey printindex providecommand jobname.ind importmodules
-% LocalWords: jobname.ind tocdepth hateq ensuremath xspace hatequiv equiv NeedsTeXFormat
-% LocalWords: textleadsto leadsto etoolbox blindomgroup blindomgroup docstruct setSGvar
-% LocalWords: compactitem exfig vspace currentsectionlevel currentsectionlevel setSGvar
-% LocalWords: ldots URLBASE ifclass bookfalse booktrue currentsetionlevel thedocument@ID
-% LocalWords: nonum phantomsection nameuse numtrue numfalse contentsline unnum vname
-% LocalWords: thepage hypreref.sty ifcase cleardoublepage frontmatterfalse customization
-% LocalWords: frontmattertrue pagenumbering setcounter hyperref.sty addcontetsline ctext
-% LocalWords: mfirstuc.sty internationalize documentkeys withusedmodules Part,clear,num
-% \endinput
-% Local Variables:
-% mode: doctex
-% TeX-master: t
-% End:
-% LocalWords: crossreferencing Chapter,clear,num Subsection,num Subsubsection,num cslet
-% LocalWords: Paragraph,ref Subparagraph,ref useSGvar useSGvar ifSGvar ifSGvar topsect
-% LocalWords: sTeX@Gvar kvoptions omdoc@cls,prefix book,topsect xappto omdoc@sty,prefix
-% LocalWords: ifdefstring ifcsdef cslet localization ngerman omdoc-ngerman.ldf omgroups
-% LocalWords: Kohlhase:smmtf endbackmatter prematurestop prematurestop clear,num
-% LocalWords: prematurestop@endomgroup textbackslash import_graph.py lmhtools bibfolder
-% LocalWords: stepcounter jobname.dtx clist_set:Nx l_tmpa_clist clist_if_in:NnT
-% LocalWords: ExplSyntaxOff stex_ref_new_doc_target:n
diff --git a/Master/texmf-dist/source/latex/stex/extensions/hwexam.dtx b/Master/texmf-dist/source/latex/stex/extensions/hwexam.dtx
index 2cc3a1bd5b9..e166fd0397d 100644
--- a/Master/texmf-dist/source/latex/stex/extensions/hwexam.dtx
+++ b/Master/texmf-dist/source/latex/stex/extensions/hwexam.dtx
@@ -10,7 +10,7 @@
% \iffalse
%
%<*driver>
-\def\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -18,10 +18,7 @@
\end{document}
%</driver>
% \fi
-%\iffalse\CheckSum{464}\fi
-%
-% ^^A\changes{v0.9}{2006/09/18}{First Version with Documentation}
-%
+%
% \GetFileInfo{hwexam.sty}
%
% \MakeShortVerb{\|}
@@ -36,177 +33,25 @@
% \maketitle
%
%\ifinfulldoc\else
-% This is the documentation for the \pkg{hwexam} package.
-% For a more high-level introduction,
-% see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
-% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+%\begin{abstract}
+% The |hwexam| package and class allows individual course assignment sheets and compound
+% assignment documents using problem files marked up with the |problem| package.
+%
+% This is the documentation for the \pkg{hwexam} package. For a more high-level
+% introduction, see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
+% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+% \end{abstract}
%
+% \tableofcontents
+%
% \input{../../doc/packages/stex-hwexam}
% \fi
%
% \begin{documentation}
%
-% The |hwexam| package and class allows individual course assignment sheets and
-% compound assignment documents using problem files marked up with the |problem| package.
-% \setcounter{tocdepth}{2}\tableofcontents\newpage
-%
-%\section{Introduction}\label{sec:intro}
-%
-% The |hwexam| package and class supplies an infrastructure that allows to format
-% nice-looking assignment sheets by simply including problems from problem files marked up
-% with the |problem| package~\cite{Kohlhase:problem}. It is designed to be
-% compatible with |problems.sty|, and inherits some of the functionality.
-%
-% \section{The User Interface}
-%
-% \subsection{Package and Class Options}\label{sec:user:options}
-%
-% The |hwexam| package and class take the options |solutions|, |notes|, |hints|, |gnotes|,
-% |pts|, |min|, and |boxed| that are just passed on to the |problems| package (cf. its
-% documentation for a description of the intended behavior).
-%
-% If the \DescribeMacro{showmeta}|showmeta| option is set, then the metadata keys are
-% shown (see~\cite{Kohlhase:metakeys} for details and customization options).
-%
-% The |hwexam| class additionally accepts the options |report|, |book|, |chapter|, |part|,
-% and |showignores|, of the |omdoc| package~\cite{Kohlhase:smomdl} on which it is
-% based and passes them on to that. For the |extrefs| option
-% see~\cite{Kohlhase:sref}.
-%
-% \subsection{Assignments}
-%
-% This package supplies the \DescribeEnv{assignment}|assignment| environment that groups
-% problems into assignment sheets. It takes an optional KeyVal argument with the keys
-% \DescribeMacro{number}|number| (for the assignment number; if none is given, 1 is
-% assumed as the default or --- in multi-assignment documents --- the ordinal of the
-% |assignment| environment), \DescribeMacro{title}|title| (for the assignment title; this
-% is referenced in the title of the assignment sheet), \DescribeMacro{type}|type| (for the
-% assignment type; e.g. ``quiz'', or ``homework''), \DescribeMacro{given}|given| (for the
-% date the assignment was given), and \DescribeMacro{due}|due| (for the date the
-% assignment is due).
-%
-% \subsection{Typesetting Exams}
-%
-% Furthermore, the |hwexam| package takes the option
-% \DescribeMacro{multiple}|multiple| that allows to combine multiple assignment sheets into
-% a compound document (the assignment sheets are treated as section, there is a table of
-% contents, etc.).
-%
-% Finally, there is the option \DescribeMacro{test}|test| that modifies the behavior to
-% facilitate formatting tests. Only in |test| mode, the macros |\testspace|,
-% |\testnewpage|, and |\testemptypage| have an effect: they generate space for the
-% students to solve the given problems. Thus they can be left in the {\LaTeX} source.
-%
-% \DescribeMacro{\testspace}|\testspace| takes an argument that expands to a dimension,
-% and leaves vertical space accordingly. \DescribeMacro{\testnewpage}|\testnewpage| makes
-% a new page in |test| mode, and \DescribeMacro{\testemptypage}|\testemptypage| generates
-% an empty page with the cautionary message that this page was intentionally left empty.
-%
-% Finally, the \DescribeEnv{testheading}|\testheading| takes an optional keyword argument
-% where the keys \DescribeMacro{duration}|duration| specifies a string that specifies the
-% duration of the test, \DescribeMacro{min}|min| specifies the equivalent in number of
-% minutes, and \DescribeMacro{reqpts}|reqpts| the points that are required for a perfect
-% grade.
-% \begin{exfig}[ht]
-% \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}
-% \makeatother
-% \begin{verbatim}
-% \title{320101 General Computer Science (Fall 2010)}
-% \begin{testheading}[duration=one hour,min=60,reqpts=27]
-% Good luck to all students!
-% \end{testheading}
-% \end{verbatim}
-% \vspace*{-3ex}\hrule\vspace*{.5ex} formats to\vspace*{1ex}
-% \hrule\par\noindent\vspace*{2ex}
-% \title{320101 General Computer Science (Fall 2010)}
-% \begin{testheading}[duration=one hour,min=60,reqpts=27]
-% good luck
-% \end{testheading}
-% \caption{A generated test heading.}\label{fig:testheading}
-% \end{exfig}
-%
-% \subsection{Including Assignments}
-%
-% The \DescribeMacro{\inputassignment}|\inputassignment| macro can be used to input
-% an assignment from another file. It takes an optional KeyVal argument and a second
-% argument which is a path to the file containing the problem (the macro assumes that
-% there is only one |assignment| environment in the included file). The keys
-% \DescribeMacro{number}|number|, \DescribeMacro{title}|title|,
-% \DescribeMacro{type}|type|, \DescribeMacro{given}|given|, and \DescribeMacro{due}|due|
-% are just as for the |assignment| environment and (if given) overwrite the ones specified
-% in the |assignment| environment in the included file.
-%
-% \section{Limitations}\label{sec:limitations}
-%
-% In this section we document known limitations. If you want to help alleviate them,
-% please feel free to contact the package author. Some of them are currently discussed in
-% the \sTeX GitHub repository~\cite{sTeX:github:on}.
-% \begin{enumerate}
-% \item none reported yet.
-% \end{enumerate}
-%
% \end{documentation}
%
%\begin{implementation}
-% \section{Implementation: The hwexam Class}\label{sec:impl:cls}
-%
-% The functionality is spread over the |hwexam| class and package. The class provides
-% the |document| environment and pre-loads some convenience packages, whereas the package
-% provides the concrete functionality.
-%
-% \subsection{Class Options}\label{sec:impl:cls:options}
-%
-% To initialize the |hwexam| class, we declare and process the necessary options by
-% passing them to the respective packages and classes they come from.
-%
-% \begin{macrocode}
-%<@@=hwexam>
-%<*cls>
-\ProvidesExplClass{hwexam}{2022/02/26}{3.0.1}{homework assignments and exams}
-\RequirePackage{l3keys2e}
-\DeclareOption*{
- \PassOptionsToClass{\CurrentOption}{document-structure}
- \PassOptionsToPackage{\CurrentOption}{stex}
- \PassOptionsToPackage{\CurrentOption}{hwexam}
- \PassOptionsToPackage{\CurrentOption}{tikzinput}
-}
-\ProcessOptions
-% \end{macrocode}
-%
-% We load |omdoc.cls|, and the desired packages. For the {\latexml} bindings, we make
-% sure the right packages are loaded.
-%
-% \begin{macrocode}
-\LoadClass{document-structure}
-\RequirePackage{stex}
-\RequirePackage{hwexam}
-\RequirePackage{tikzinput}
-\RequirePackage{graphicx}
-\RequirePackage{a4wide}
-\RequirePackage{amssymb}
-\RequirePackage{amstext}
-\RequirePackage{amsmath}
-% \end{macrocode}
-% Finally, we register another keyword for the |document| environment. We give a default
-% assignment type to prevent errors
-% \begin{macrocode}
-\newcommand\assig@default@type{\hwexam@assignment@kw}
-\def\document@hwexamtype{\assig@default@type}
-%<@@=document_structure>
-\keys_define:nn { document-structure / document }{
- id .str_set_x:N = \c_document_structure_document_id_str,
- hwexamtype .tl_set:N = \document@hwexamtype
-}
-%<@@=hwexam>
-%</cls>
-% \end{macrocode}
%
% \section{Implementation: The hwexam Package}
%
@@ -218,7 +63,7 @@
%
% \begin{macrocode}
%<*package>
-\ProvidesExplPackage{hwexam}{2022/02/26}{3.0.1}{homework assignments and exams}
+\ProvidesExplPackage{hwexam}{2022/05/24}{3.1.0}{homework assignments and exams}
\RequirePackage{l3keys2e}
\newif\iftest\testfalse
@@ -283,8 +128,7 @@
% the assignment counter into account.
% \begin{macrocode}
\newcounter{assignment}
-\numberproblemsin{assignment}
-\renewcommand\prob@label[1]{\assignment@number.#1}
+%\numberproblemsin{assignment}
% \end{macrocode}
%
% We will prepare the keyval support for the |assignment| environment.
@@ -422,6 +266,7 @@
\global\setcounter{assignment}{\int_use:N\l_@@_assign_number_int}
}
\setcounter{problem}{0}
+ \renewcommand\prob@label[1]{\assignment@number.##1}
\def\current@section@level{\document@hwexamtype}
%\sref@label@id{\document@hwexamtype \thesection}
\begin{@assignment}
@@ -433,7 +278,7 @@
% sectioning.
% \begin{macrocode}
\def\ass@title{
- \protect\document@hwexamtype~\arabic{assignment}
+ {\protect\document@hwexamtype}~\arabic{assignment}
\assignment@title{}{\;(}{)\;} -- \given@due{}{}
}
\ifmultiple
@@ -652,6 +497,7 @@
% \newcommand\discussA{\bierglas}
% \end{verbatim}
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
\endinput
% \iffalse
diff --git a/Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx b/Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx
index d99109ee228..ff06827660f 100644
--- a/Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx
+++ b/Master/texmf-dist/source/latex/stex/extensions/notesslides.dtx
@@ -11,7 +11,7 @@
% \iffalse
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -19,7 +19,6 @@
\end{document}
%</driver>
% \fi
-% ^^A\changes{v0.1}{2005/12/06}{Initial Version}
%
% \GetFileInfo{notesslides.cls}
% \MakeShortVerb{\|}
@@ -59,227 +58,8 @@
% \fi
%
% \begin{documentation}\label{pkg:notesslides:doc}
+% \changes{3.1.0}{2022/02/28}{Added \detokenize{\libusetheme}}
%
-% We present a document class from which we can generate both course slides and course
-% notes in a transparent way.
-%
-%\section{Introduction}
-%
-% The |notesslides| document class is derived from |beamer.cls|~\cite{beamerclass:on}, it
-% adds a ``notes version'' for course notes derived from the |omdoc|
-% class~\cite{Kohlhase:smomdl} that is more suited to printing than the one supplied by
-% |beamer.cls|.
-%
-%
-%\section{The User Interface}\label{sec:user}
-%
-% The |notesslides| class takes the notion of a slide frame from Till Tantau's excellent
-% |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 |notesslides| package displays the slides as such in the course
-% notes to give students a visual anchor into the slide presentation in the course (and to
-% distinguish the different writing styles in slides and course notes).
-%
-% In practice we want to generate two documents from the same source: the slides for
-% presentation in the lecture and the course notes as a narrative document for home
-% study. To achieve this, the |notesslides| class has two modes: \emph{slides mode} and
-% \emph{notes mode} which are determined by the package option.
-%
-% \subsection{Package Options}\label{sec:user:options}
-%
-% The |notesslides| class takes a variety of class options:\ednote{leaving out noproblems
-% for the moment until we decide what to do with it.}
-% \begin{itemize}
-% \item The options \DescribeMacro{slides}|slides| and \DescribeMacro{notes}|notes| switch
-% between slides mode and notes mode (see Section~\ref{sec:user:notesslides}).
-% \item If the option \DescribeMacro{sectocframes}|sectocframes| is given, then for the
-% |omgroup|s, special frames with the |omgroup| title (and number) are generated.
-% \item \DescribeMacro{showmeta}|showmeta|. If this is set, then the metadata keys are
-% shown (see~\cite{Kohlhase:metakeys:git} for details and customization options).
-% \item If the option \DescribeMacro{frameimages}|frameimages| is set, then slide mode
-% also shows the |\frameimage|-generated frames (see
-% section~\ref{sec:user:frameimage}). If also the \DescribeMacro{fiboxed}|fiboxed|
-% option is given, the slides are surrounded by a box.
-% \item \DescribeMacro{topsect}|topsect=|\meta{sect} can be used to specify the
-% top-level sectioning level; the default for \meta{sect} is |section|.
-% \end{itemize}
-%
-% \subsection{Notes and Slides}\label{sec:user:notesslides}
-%
-% Slides are represented with the \DescribeEnv{frame}|frame| just like in the |beamer|
-% class, see~\cite{Tantau:ugbc} for details. The |notesslides| class adds the
-% \DescribeEnv{note}|note| environment for encapsulating the course note
-% fragments.\footnote{MK: it would be very nice, if we did not need this environment, and
-% this should be possible in principle, but not without intensive LaTeX trickery. Hints to
-% the author are welcome.}
-%
-% \textwarning Note that it is essential to start and end the |notes| environment at the
-% start of the line -- in particular, there may not be leading blanks -- else {\LaTeX}
-% becomes confused and throws error messages that are difficult to decipher.
-%
-% \begin{exfig}
-% \begin{verbatim}
-% \ifnotes\maketitle\else
-% \frame[noframenumbering]\maketitle\fi
-%
-% \begin{note}
-% We start this course with ...
-% \end{note}
-%
-% \begin{frame}
-% \frametitle{The first slide}
-% ...
-% \end{frame}
-% \begin{note}
-% ... and more explanatory text
-% \end{note}
-%
-% \begin{frame}
-% \frametitle{The second slide}
-% ...
-% \end{frame}
-% ...
-% \end{verbatim}
-% \caption{A typical Course Notes File}\label{fig:notesfile}
-% \end{exfig}
-%
-% By interleaving the |frame| and |note| environments, we can build course notes as shown
-% in Figure~\ref{fig:notesfile}.
-%
-% Note the use of the \DescribeMacro{\ifnotes}|\ifnotes| conditional, which allows
-% different treatment between |notes| and |slides| mode -- manually setting |\notestrue|
-% or |\notesfalse| is strongly discouraged however.
-%
-% \textwarning: We need to give the title frame the |noframenumbering| option so that the
-% frame numbering is kept in sync between the slides and the course notes.
-%
-% \textwarning: The |beamer| class recommends not to use the |allowframebreaks| option on
-% frames (even though it is very convenient). This holds even more in the |notesslides|
-% case: At least in conjunction with |\newpage|, frame numbering behaves funnily (we have
-% tried to fix this, but who knows).
-%
-% If we want to transclude a the contents of a file as a note, we can use a new variant
-% \DescribeMacro{\inputref*}|\inputref*| of the |\inputref| macro from
-% \cite{KohAmb:smmssl:git}: |\inputref*{foo}| is equivalent to
-% |\begin{note}\inputref{foo}\end{note}|.
-%
-% There are some environments that tend to occur at the top-level of |note|
-% environments. We make convenience versions of these: e.g. the
-% \DescribeEnv{nparagraph}|nparagraph| environment is just an |sparagraph| inside a |note|
-% environment (but looks nicer in the source, since it avoids one level of source
-% indenting). Similarly, we have the \DescribeEnv{nfragment}|nomgroup|,
-% \DescribeEnv{ndefinition}|ndefinition|, \DescribeEnv{nexample}|nexample|,
-% \DescribeEnv{nsproof}|nsproof|, and \DescribeEnv{nassertion}|nassertion| environments.
-%
-% \subsection{Header and Footer Lines of the Slides}\label{sec:user:headfootlines}
-%
-% The default logo provided by the |notesslides| package is the {\sTeX} logo it can be
-% customized using \DescribeMacro{\setslidelogo}|\setslidelogo{|\meta{logo name}|}|.
-%
-% The default footer line of the |notesslides| package mentions copyright and licensing. In
-% the |beamer| class, |\source| stores the author's name as the copyright holder . By
-% default it is {\it Michael Kohlhase} in the |notesslides| package since he is the main
-% user and designer of this package. \DescribeMacro{\setsource}|\setsource{|\meta{name}|}|
-% can change the writer's name. For licensing, we use the Creative Commons
-% Attribuition-ShareAlike license by default to strengthen the public domain. If package
-% |hyperref| is loaded, then we can attach a hyperlink to the license
-% logo. \DescribeMacro{\setlicensing}|\setlicensing[|\meta{url}|]{|\meta{logo name}|}| is
-% used for customization, where \meta{url} is optional.
-%
-% \subsection{Frame Images}\label{sec:user:frameimage}
-%
-% Sometimes, we want to integrate slides as images after all -- e.g. because we already
-% have a PowerPoint presentation, to which we want to add \sTeX notes. In this case we can
-% use \DescribeMacro{\frameimage}|\frameimage[|\meta{opt}|]{|\meta{path}|}|, where
-% \meta{opt} are the options of |\includegraphics| from the |graphicx|
-% package~\cite{CarRah:tpp99} and \meta{path} is the file path (extension can be left off
-% like in |\includegraphics|). We have added the |label| key that allows to give a frame
-% label that can be referenced like a regular |beamer| frame.\ednote{MK: the hyperref link
-% does not seem to work yet. I wonder why but do not have the time to fix it.}
-%
-% The \DescribeMacro{\mhframeimage}|\mhframeimage| macro is a variant of |\frameimage|
-% with repository support. Instead of writing
-% \begin{verbatim}
-% \frameimage{\MathHub{fooMH/bar/source/baz/foobar}}
-% \end{verbatim}
-% we can simply write (assuming that |\MathHub| is defined as above)
-% \begin{verbatim}
-% \mhframeimage[fooMH/bar]{baz/foobar}
-% \end{verbatim}
-% Note that the |\mhframeimage| form is more semantic, which allows more advanced document
-% 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{verbatim}
-% \mhframeimage{baz/foobar}
-% \end{verbatim}
-%
-% \subsection{Colors and Highlighting}\label{sec:user:highlighting}
-% The \DescribeMacro{\textwarning}|\textwarning| macro generates a warning
-% sign: \textwarning
-%
-% \subsection{Front Matter, Titles, etc.}\label{sec:user:matter}
-%
-% \subsection{Excursions}\label{sec:user: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{verbatim}
-% \excursion{founif}{../ex/founif}{We will cover first-order unification in}
-% ...
-% \begin{appendix}\printexcursions\end{appendix}
-% \end{verbatim}
-%
-% The \DescribeMacro{\excursion}|\excursion{|\meta{ref}|}{|\meta{path}|}{|\meta{text}|}| is
-% syntactic sugar for \DescribeMacro{\activateexcursion}
-%
-% \begin{verbatim}
-% \begin{nparagraph}[title=Excursion]
-% \activateexcursion{founif}{../ex/founif}
-% We will cover first-order unification in \sref{founif}.
-% \end{nparagraph}
-% \end{verbatim}
-%
-% where \DescribeMacro{\activateexcursion}|\activateexcursion{|\meta{path}|}| augments the
-% |\printexcursions| macro by a call |\inputref{|\meta{path}|}|. In this way, the3
-% \DescribeMacro{\printexcursions}|\printexcursions| macro (usually in the appendix) will
-% collect up all excursions that are specified in the main text.
-%
-% Sometimes, we want to reference -- in an excursion -- part of another. We can use
-% \DescribeMacro{\excursionref}|\excursionref{|\meta{label}|}| for that.
-%
-% Finally, we usually want to put the excursions into an |omgroup| environment and add an
-% introduction, therefore we provide the a variant of the |\printexcursions| macro:
-% \DescribeMacro{\excursiongroup}|\excursiongroup[id=|\meta{id}|,intro=|\meta{path}|]| is
-% equivalent to
-% \begin{verbatim}
-% \begin{note}
-% \begin{sfragment}[id=<id>]{Excursions}
-% \inputref{<path>}
-% \printexcursions
-% \end{sfragment}
-% \end{note}
-% \end{verbatim}
-%
-% \subsection{Miscellaneous}\label{sec:user:misc}
-%
-% \section{Limitations}\label{sec:limitations}
-%
-% In this section we document known limitations. If you want to help alleviate them,
-% please feel free to contact the package author. Some of them are currently discussed in
-% the \sTeX GitHub repository~\cite{sTeX:github:on}.
-% \begin{enumerate}
-% \item when option |book| which uses |\pagestyle{headings}| is given and semantic macros
-% are given in the |omgroup| titles, then they sometimes are not defined by the time the
-% heading is formatted. Need to look into how the headings are made. This is a problem
-% of the underlying |omdoc| package.
-% \end{enumerate}
-%
% \end{documentation}
%
% \begin{implementation}\label{pkg:notesslides:impl}
@@ -296,39 +76,52 @@
% \begin{macrocode}
%<*cls>
%<@@=notesslides>
-\ProvidesExplClass{notesslides}{2022/02/26}{3.0.1}{notesslides Class}
+\ProvidesExplClass{notesslides}{2022/05/24}{3.1.0}{notesslides Class}
\RequirePackage{l3keys2e}
\keys_define:nn{notesslides / cls}{
- class .code:n = {
- \PassOptionsToClass{\CurrentOption}{document-structure}
- \str_if_eq:nnT{#1}{book}{
- \PassOptionsToPackage{defaulttopsec=part}{notesslides}
- }
- \str_if_eq:nnT{#1}{report}{
- \PassOptionsToPackage{defaulttopsec=part}{notesslides}
- }
- },
+ class .str_set_x:N = \c_@@_class_str,
notes .bool_set:N = \c_@@_notes_bool ,
slides .code:n = { \bool_set_false:N \c_@@_notes_bool },
+ docopt .str_set_x:N = \c_@@_docopt_str,
unknown .code:n = {
- \PassOptionsToClass{\CurrentOption}{document-structure}
+ \PassOptionsToPackage{\CurrentOption}{document-structure}
\PassOptionsToClass{\CurrentOption}{beamer}
\PassOptionsToPackage{\CurrentOption}{notesslides}
+ \PassOptionsToPackage{\CurrentOption}{stex}
}
}
\ProcessKeysOptions{ notesslides / cls }
+
+\str_if_empty:NF \c_@@_class_str {
+ \PassOptionsToPackage{class=\c_@@_class_str}{document-structure}
+}
+
+\exp_args:No \str_if_eq:nnT\c_@@_class_str{book}{
+ \PassOptionsToPackage{defaulttopsect=part}{notesslides}
+}
+\exp_args:No \str_if_eq:nnT\c_@@_class_str{report}{
+ \PassOptionsToPackage{defaulttopsect=part}{notesslides}
+}
+
+\RequirePackage{stex}
+\stex_html_backend:T {
+ \bool_set_true:N\c_@@_notes_bool
+}
+
\bool_if:NTF \c_@@_notes_bool {
\PassOptionsToPackage{notes=true}{notesslides}
+ \message{notesslides.cls:~Formatting~course~materials~in~notes~mode}
}{
\PassOptionsToPackage{notes=false}{notesslides}
+ \message{notesslides.cls:~Formatting~course~materials~in~slides~mode}
}
%</cls>
% \end{macrocode}
% now we do the same for the |notesslides| package.
% \begin{macrocode}
%<*package>
-\ProvidesExplPackage{notesslides}{2022/02/26}{3.0.1}{notesslides Package}
+\ProvidesExplPackage{notesslides}{2022/05/24}{3.1.0}{notesslides Package}
\RequirePackage{l3keys2e}
\keys_define:nn{notesslides / pkg}{
@@ -346,6 +139,12 @@
}
}
\ProcessKeysOptions{ notesslides / pkg }
+
+\RequirePackage{stex}
+\stex_html_backend:T {
+ \bool_set_true:N\c_@@_notes_bool
+}
+
\newif\ifnotes
\bool_if:NTF \c_@@_notes_bool {
\notestrue
@@ -362,6 +161,7 @@
}{
\str_set_eq:NN \@@topsect \c_@@_topsect_str
}
+\PassOptionsToPackage{topsect=\@@topsect}{document-structure}
%</package>
% \end{macrocode}
%
@@ -370,15 +170,19 @@
% \begin{macrocode}
%<*cls>
\bool_if:NTF \c_@@_notes_bool {
- \LoadClass{document-structure}
+ \str_if_empty:NT \c_@@_class_str {
+ \str_set:Nn \c_@@_class_str {article}
+ }
+ \exp_after:wN\LoadClass\exp_after:wN[\c_@@_docopt_str]
+ {\c_@@_class_str}
}{
\LoadClass[10pt,notheorems,xcolor={dvipsnames,svgnames}]{beamer}
\newcounter{Item}
\newcounter{paragraph}
\newcounter{subparagraph}
\newcounter{Hfootnote}
- \RequirePackage{document-structure}
}
+\RequirePackage{document-structure}
% \end{macrocode}
% now it only remains to load the |notesslides| package that does all the rest.
% \begin{macrocode}
@@ -425,6 +229,16 @@
\bool_if:NT \c_@@_notes_bool {
\renewcommand\usetheme[2][]{\usepackage[#1]{beamernotestheme#2}}
}
+
+
+\NewDocumentCommand \libusetheme {O{} m} {
+ \bool_if:NTF \c_@@_notes_bool {
+ \libusepackage[#1]{beamernotestheme#2}
+ }{
+ \libusepackage[#1]{beamertheme#2}
+ }
+}
+
% \end{macrocode}
% We define the sizes of slides in the notes. Somehow, we cannot get by with the same
% here.
@@ -488,6 +302,7 @@
t .code:n = {
\_@@_do_yes_param:Nn \l_@@_frame_t_bool { #1 }
},
+ unknown .code:n = {}
}
\cs_new_protected:Nn \_@@_frame_args:n {
\str_clear:N \l_@@_frame_label_str
@@ -517,7 +332,7 @@
\def\itemize@outer{outer}
\def\itemize@inner{inner}
\renewcommand\newpage{\addtocounter{framenumber}{1}}
- \newcommand\metakeys@show@keys[2]{\marginnote{{\scriptsize ##2}}}
+ %\newcommand\metakeys@show@keys[2]{\marginnote{{\scriptsize ##2}}}
\renewenvironment{itemize}{
\ifx\itemize@level\itemize@outer
\def\itemize@label{$\rhd$}
@@ -538,9 +353,16 @@
% \end{macrocode}
% We create the box with the |mdframed| environment from the equinymous package.
% \begin{macrocode}
- \begin{mdframed}[linewidth=\slideframewidth,skipabove=1ex,skipbelow=1ex,userdefinedwidth=\slidewidth,align=center]\sf
+ \stex_html_backend:TF {
+ \begin{stex_annotate_env}{frame}{}\vbox\bgroup
+ \mdf@patchamsthm
+ }{
+ \begin{mdframed}[linewidth=\slideframewidth,skipabove=1ex,skipbelow=1ex,userdefinedwidth=\slidewidth,align=center]\sf
+ }
}{
- \medskip\miko@slidelabel\end{mdframed}
+ \stex_html_backend:TF {
+ \miko@slidelabel\egroup\end{stex_annotate_env}
+ }{\medskip\miko@slidelabel\end{mdframed}}
}
% \end{macrocode}
% \end{environment}
@@ -548,7 +370,10 @@
% Now, we need to redefine the frametitle (we are still in course notes mode).
% \begin{macro}{\frametitle}
% \begin{macrocode}
- \renewcommand{\frametitle}[1]{{\Large\bf\sf\color{blue}{#1}}\medskip}
+ \renewcommand{\frametitle}[1]{
+ \stex_document_title:n { #1 }
+ {\Large\bf\sf\color{blue}{#1}}\medskip
+ }
}
% \end{macrocode}
% \end{macro}
@@ -652,15 +477,31 @@
% \begin{macrocode}
\newlength{\slidelogoheight}
+\RequirePackage{graphicx}
+
+\define@key{Gin}{mhrepos}{\def\Gin@mhrepos{#1}}
+\providecommand\mhgraphics[2][]{
+ \def\Gin@mhrepos{}\setkeys{Gin}{#1}
+ \includegraphics[#1]{\mhpath\Gin@mhrepos{#2}}
+}
+
+
+
\bool_if:NTF \c_@@_notes_bool {
\setlength{\slidelogoheight}{.4cm}
}{
- \setlength{\slidelogoheight}{1cm}
-}
-\newsavebox{\slidelogo}
-\sbox{\slidelogo}{\sTeX}
-\newrobustcmd{\setslidelogo}[1]{
- \sbox{\slidelogo}{\includegraphics[height=\slidelogoheight]{#1}}
+ \setlength{\slidelogoheight}{.25cm}
+}
+\ifcsname slidelogo\endcsname\else
+ \newsavebox{\slidelogo}
+ \sbox{\slidelogo}{\sTeX}
+\fi
+\newrobustcmd{\setslidelogo}[2][]{
+ \tl_if_empty:nTF{#1}{
+ \sbox{\slidelogo}{\includegraphics[height=\slidelogoheight]{#2}}
+ }{
+ \sbox{\slidelogo}{\mhgraphics[height=\slidelogoheight,mhrepos=#1]{#2}}
+ }
}
% \end{macrocode}
% \end{macro}
@@ -845,12 +686,14 @@
% counters for |part| and |chapter|, which |beamer.cls| does not have and we make the
% |section| counter which it does dependent on |chapter|.
% \begin{macrocode}
-\bool_if:NT \c_@@_sectocframes_bool {
- \str_if_eq:VnTF \@@topsect{part}{
- \newcounter{chapter}\counterwithin*{section}{chapter}
- }{
- \str_if_eq:VnT\@@topsect{chapter}{
+\stex_html_backend:F {
+ \bool_if:NT \c_@@_sectocframes_bool {
+ \str_if_eq:VnTF \@@topsect{part}{
\newcounter{chapter}\counterwithin*{section}{chapter}
+ }{
+ \str_if_eq:VnT\@@topsect{chapter}{
+ \newcounter{chapter}\counterwithin*{section}{chapter}
+ }
}
}
}
@@ -885,13 +728,13 @@
% \end{macrocode}
% \end{macro}
%
-% The new counters are used in the |omgroup| environment that choses the {\LaTeX}
+% The new counters are used in the |sfragment| environment that choses the {\LaTeX}
% sectioning macros according to |\section@level|.
%
% \begin{environment}{sfragment}
% \begin{macrocode}
\renewenvironment{sfragment}[2][]{
- \__document_structure_omgroup_args:n { #1 }
+ \__document_structure_sfragment_args:n { #1 }
\int_incr:N \l_document_structure_section_level_int
\bool_if:NT \c_@@_sectocframes_bool {
\stepcounter{slide}
@@ -900,11 +743,11 @@
\red{
\ifcase\l_document_structure_section_level_int\or
\stepcounter{part}
- \def\@@label{\omdoc@part@kw~\Roman{part}}
+ \def\@@label{{\omdoc@part@kw}~\Roman{part}}
\def\currentsectionlevel{\omdoc@part@kw}
\or
\stepcounter{chapter}
- \def\@@label{\omdoc@chapter@kw~\arabic{chapter}}
+ \def\@@label{{\omdoc@chapter@kw}~\arabic{chapter}}
\def\currentsectionlevel{\omdoc@chapter@kw}
\or
\stepcounter{section}
@@ -932,8 +775,8 @@
\vfill%
\end{frame}%
}
- \str_if_empty:NF \l__document_structure_omgroup_id_str {
- \stex_ref_new_doc_target:n\l__document_structure_omgroup_id_str
+ \str_if_empty:NF \l__document_structure_sfragment_id_str {
+ \stex_ref_new_doc_target:n\l__document_structure_sfragment_id_str
}
}{}
}
@@ -1048,6 +891,7 @@
% \end{macro}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
\endinput
% \endinput
% Local Variables:
@@ -1055,24 +899,3 @@
% TeX-master: t
% End:
-% LocalWords: bibfolder jobname.dtx omdoc.dtx mytwocolumns beamer.cls sectocframes rhd
-% LocalWords: frameimage twintoo atwin atwintoo scsys scshape ttfamily cnxlatex xspace
-% LocalWords: mathml omdoc beamerclass:on Kohlhase:smomdl noproblems frameimages exfig
-% LocalWords: frameimages fiboxed fiboxed topsect topsect Tantau:ugbc ifnotes ifnotes
-% LocalWords: noframenumbering allowframebreaks newpage inputref inputref inputref sref
-% LocalWords: setsource setsource setlicensing setlicensing CarRah:tpp99 mhframeimage
-% LocalWords: mhframeimage printexcursions excursionref excursionref excursiongroup
-% LocalWords: excursiongroup sec:impl nontheorem mks@cls,prefix mks@cls mks@sty,prefix
-% LocalWords: mks@sty 10pt,notheorems,xcolor dvipsnames,svgnames Hfootnote mdframed
-% LocalWords: beamerarticle noxcolor,noamsthm metakeys addmetakey usetheme beamertheme
-% LocalWords: bookmarks,bookmarksopen,bookmarksnumbered,breaklinks,hidelinks sproof
-% LocalWords: beamernotestheme slideframewidth allowdisplaybreaks framenumber sproof
-% LocalWords: miko@slidelabel inputref@preskip smallskip ninputref slidelogoheight
-% LocalWords: copyrightnotice cclogo cc_somerights ifcchref cchreffalse cchreftrue
-% LocalWords: Gin@ewidth mh@currentrepos mhrepos if@iswindows defemph notemph STpresent
-% LocalWords: smalltextwarning miko@dbend bigtextwarning counterwithin ifsectocframes
-% LocalWords: subsubsection mparagraph csname stex_ref_new_doc_target:n columnbox
-% LocalWords: inserttheorembodyfont defbeamertemplate inserttheoremheadfont mhexcursion
-% LocalWords: inserttheoremname inserttheoremnumber inserttheoremaddition srefaddidkey
-% LocalWords: inserttheoremaddition inserttheorempunctuation setbeamertemplate
-% LocalWords: mhexcursiongroup
diff --git a/Master/texmf-dist/source/latex/stex/extensions/problem.dtx b/Master/texmf-dist/source/latex/stex/extensions/problem.dtx
index ee7d116fcb0..75a34eaf8ef 100644
--- a/Master/texmf-dist/source/latex/stex/extensions/problem.dtx
+++ b/Master/texmf-dist/source/latex/stex/extensions/problem.dtx
@@ -10,7 +10,7 @@
% \iffalse
%
%<*driver>
-\def\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\RequirePackage[hints,solutions,notes]{problem}
@@ -20,10 +20,6 @@
%</driver>
% \fi
%
-% \iffalse\CheckSum{318}\fi
-%
-% ^^A\changes{v0.9}{2006/09/18}{First Version with Documentation}
-%
% \GetFileInfo{problem.sty}
%
% \MakeShortVerb{\|}
@@ -35,215 +31,24 @@
% \url{http://kwarc.info/kohlhase}}
% \maketitle
%
-%\ifinfulldoc\else
+% \ifinfulldoc\else
+% \begin{abstract}
% This is the documentation for the \pkg{problem} package.
% For a more high-level introduction,
% see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
-% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+%
+% The |problem| package supplies an infrastructure that allows specify problems (for
+% homework assignments, exams, or quizzes) and to reuse them efficiently in multiple
+% environments.
+% \end{abstract}
+%
+% \tableofcontents
%
% \input{../../doc/packages/stex-problem}
% \fi
%
% \begin{documentation}
-% The |problem| package supplies an infrastructure that allows specify problems and to
-% reuse them efficiently in multiple environments.
-%
-%\section{Introduction}\label{sec:intro}
-%
-% The |problem| package supplies an infrastructure that allows specify problem. Problems
-% are text fragments that come with auxiliary functions: hints, notes, and
-% solutions\footnote{for the moment multiple choice problems are not supported, but may
-% well be in a future version}. Furthermore, we can specify how long the solution to a
-% given problem is estimated to take and how many points will be awarded for a perfect
-% solution.
-%
-% Finally, the |problem| package facilitates the management of problems in small files,
-% so that problems can be re-used in multiple environment.
-%
-% \section{The User Interface}\label{sec:ui}
-%
-% \subsection{Package Options}
-% The |problem| package takes the options \DescribeMacro{solutions}|solutions| (should
-% solutions be output?), \DescribeMacro{notes}|notes| (should the problem notes be
-% presented?), \DescribeMacro{hints}|hints| (do we give the hints?),
-% \DescribeMacro{gnotes}|gnotes| (do we show grading notes?), \DescribeMacro{pts}|pts| (do
-% we display the points awarded for solving the problem?), \DescribeMacro{min}|min| (do we
-% display the estimated minutes for problem soling). If theses are specified, then the
-% corresponding auxiliary parts of the problems are output, otherwise, they remain
-% invisible.
-%
-% The \DescribeMacro{boxed}|boxed| option specifies that problems should be formatted in
-% framed boxes so that they are more visible in the text. Finally, the
-% \DescribeMacro{test}|test| option signifies that we are in a test situation, so this
-% option does not show the solutions (of course), but leaves space for the students to
-% solve them.
-%
-% The \DescribeMacro{mh}|mh| option turns on MathHub support; see \cite{Kohlhase:mss}.
-%
-% Finally, if the \DescribeMacro{showmeta}|showmeta| is set, then the metadata keys are
-% shown (see~\cite{Kohlhase:metakeys} for details and customization options).
-%
-% \subsection{Problems and Solutions}\label{sec:user:probsols}
-%
-% \DescribeEnv{problem} The main environment provided by the |problem| package is
-% (surprise surprise) the |problem| environment. It is used to mark up problems and
-% exercises. The environment takes an optional KeyVal argument with the keys
-% \DescribeMacro{id}|id| as an identifier that can be reference later,
-% \DescribeMacro{pts}|pts| for the points to be gained from this exercise in homework or
-% quiz situations, \DescribeMacro{min}|min| for the estimated minutes needed to solve the
-% problem, and finally \DescribeMacro{title}|title| for an informative title of the
-% problem. For an example of a marked up problem see Figure~\ref{fig:problem} and the
-% resulting markup see Figure~\ref{fig:result}.
-%
-%\begin{exfig}
-% \begin{verbatim}
-% \usepackage[solutions,hints,pts,min]{problem}
-% \begin{document}
-% \begin{sproblem}[id=elefants,pts=10,min=2,title=Fitting Elefants]
-% How many Elefants can you fit into a Volkswagen beetle?
-% \begin{hint}
-% Think positively, this is simple!
-% \end{hint}
-% \begin{exnote}
-% Justify your answer
-% \end{exnote}
-% \begin{solution}[for=elefants,height=3cm]
-% Four, two in the front seats, and two in the back.
-% \begin{gnote}
-% if they do not give the justification deduct 5 pts
-% \end{gnote}
-% \end{solution}
-% \end{sproblem}
-% \end{document}
-% \end{verbatim}
-% \caption{A marked up Problem}\label{fig:problem}
-% \end{exfig}
-%
-% \DescribeEnv{solution} The |solution| environment can be to specify a solution to a
-% problem. If the \DescribeMacro{solutions}|solutions| option is set or |\solutionstrue|
-% is set in the text, then the solution will be presented in the output. The |solution|
-% environment takes an optional KeyVal argument with the keys \DescribeMacro{id}|id| for
-% an identifier that can be reference \DescribeMacro{for}|for| to specify which problem
-% this is a solution for, and \DescribeMacro{height}|height| that allows to specify the
-% amount of space to be left in test situations (i.e. if the \DescribeMacro{test}|test|
-% option is set in the |\usepackage| statement).
-%
-%\begin{exfig}
-% \begin{minipage}{.9\linewidth}
-% \begin{sproblem}[id=elefants.prob,title=Fitting Elefants]
-% How many Elefants can you fit into a Volkswagen beetle?
-% \begin{hint}
-% Think positively, this is simple!
-% \end{hint}
-% \begin{exnote}
-% Justify your answer
-% \end{exnote}
-% \smallskip\noindent\hrule\textbf{Solution:}
-% Four, two in the front seats, and two in the back.
-% \hrule
-% \end{sproblem}
-% \end{minipage}
-% \caption{The Formatted Problem from Figure~\ref{fig:problem}}\label{fig:result}
-% \end{exfig}
-%
-% \DescribeEnv{hint}\DescribeEnv{exnote} The |hint| and |exnote| environments can be used
-% in a |problem| environment to give hints and to make notes that elaborate certain
-% aspects of the problem.
-%
-% \DescribeEnv{gnote} The |gnote| (grading notes) environment can be used to document
-% situtations that may arise in grading.
-%
-% Sometimes we would like to locally override the |solutions| option we have given to the
-% package. To turn on solutions we use the
-% \DescribeMacro{\startsolutions}|\startsolutions|, to turn them off,
-% \DescribeMacro{\stopsolutions}|\stopsolutions|. These two can be used at any point in
-% the documents.
-%
-% Also, sometimes, we want content (e.g. in an exam with master solutions) conditional on
-% whether solutions are shown. This can be done with the
-% \DescribeMacro{\ifsolutions}|\ifsolutions| conditional.
-%
-% \subsection{Multiple Choice Blocks}\label{sec:user:mcq}
-%
-% Multiple choice blocks can be formatted using the \DescribeMacro{mcb}|mcb| environment,
-% in which single choices are marked up with
-% \DescribeMacro{\mcc}|\mcc[|\meta{keyvals}|]{|\meta{text}|}| macro, which takes an
-% optional key/value argument \meta{keyvals} for choice metadata and a required argument
-% \meta{text} for the proposed answer text. The following keys are supported
-% \begin{itemize}
-% \item \DescribeMacro{T}|T| for true answers, \DescribeMacro{F}|F| for false ones,
-% \item \DescribeMacro{Ttext}|Ttext| the verdict for true answers,
-% \DescribeMacro{Ftext}|Ftext| for false ones, and
-% \item \DescribeMacro{feedback}|feedback| for a short feedback text given to the student.
-% \end{itemize}
-% See Figure~\ref{fig: mcq} for an example
-%\begin{exfig}
-% \begin{verbatim}
-% \begin{sproblem}[title=Functions]
-% What is the keyword to introduce a function definition in python?
-% \begin{mcb}
-% \mcc[T]{def}
-% \mcc[F,feedback=that is for C and C++]{function}
-% \mcc[F,feedback=that is for Standard ML]{fun}
-% \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
-% \end{mcb}
-% \end{sproblem}
-% \end{verbatim}
-% \solutionsfalse\hrule
-% \begin{sproblem}[title=Functions]
-% What is the keyword to introduce a function definition in python?
-% \begin{mcb}
-% \mcc[T]{def}
-% \mcc[F,feedback=that is for C and C++]{function}
-% \mcc[F,feedback=that is for Standard ML]{fun}
-% \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
-% \end{mcb}
-% \end{sproblem}
-% \solutionstrue\hrule
-% \begin{sproblem}[title=Functions]
-% What is the keyword to introduce a function definition in python?
-% \begin{mcb}
-% \mcc[T]{def}
-% \mcc[F,feedback=that is for C and C++]{function}
-% \mcc[F,feedback=that is for Standard ML]{fun}
-% \mcc[F,Ftext=Nooooooooo,feedback=that is for Java]{public static void}
-% \end{mcb}
-% \end{sproblem}
-% \caption{A Problem with a multiple choice block}\label{fig:mcq}
-% \end{exfig}
-%
-% \subsection{Including Problems}\label{sec:user:includeproblem}
-%
-% The \DescribeMacro{\includeproblem}|\includeproblem| macro can be used to include a
-% problem from another file. It takes an optional KeyVal argument and a second argument
-% which is a path to the file containing the problem (the macro assumes that there is only
-% one problem in the include file). The keys \DescribeMacro{title}|title|,
-% \DescribeMacro{min}|min|, and \DescribeMacro{pts}|pts| specify the problem title, the
-% estimated minutes for solving the problem and the points to be gained, and their values
-% (if given) overwrite the ones specified in the |problem| environment in the included
-% file.
-%
-% \subsection{Reporting Metadata}\label{sec:user:reporting}
-%
-% The sum of the points and estimated minutes (that we specified in the |pts| and |min|
-% keys to the |problem| environment or the |\includeproblem| macro) to the log file and
-% the screen after each run. This is useful in preparing exams, where we want to make sure
-% that the students can indeed solve the problems in an allotted time period.
-%
-% The |\min| and |\pts| macros allow to specify (i.e. to print to the margin) the
-% distribution of time and reward to parts of a problem, if the |pts| and |pts| package
-% options are set. This allows to give students hints about the estimated time and the
-% points to be awarded.
-%
-% \section{Limitations}\label{sec:limitations}
-%
-% In this section we document known limitations. If you want to help alleviate them,
-% please feel free to contact the package author. Some of them are currently discussed in
-% the \sTeX GitHub repository~\cite{sTeX:github:on}.
-% \begin{enumerate}
-% \item none reported yet
-% \end{enumerate}
-%
% \end{documentation}
% \begin{implementation}
%
@@ -258,7 +63,7 @@
% \begin{macrocode}
%<*package>
%<@@=problems>
-\ProvidesExplPackage{problem}{2022/02/26}{3.0.1}{Semantic Markup for Problems}
+\ProvidesExplPackage{problem}{2022/05/24}{3.1.0}{Semantic Markup for Problems}
\RequirePackage{l3keys2e,stex}
\keys_define:nn { problem / pkg }{
@@ -350,14 +155,18 @@
min .tl_set:N = \l_@@_prob_min_tl,
title .tl_set:N = \l_@@_prob_title_tl,
type .tl_set:N = \l_@@_prob_type_tl,
+ imports .tl_set:N = \l_@@_prob_imports_tl,
+ name .str_set_x:N = \l_@@_prob_name_str,
refnum .int_set:N = \l_@@_prob_refnum_int
}
\cs_new_protected:Nn \_@@_prob_args:n {
\str_clear:N \l_@@_prob_id_str
+ \str_clear:N \l_@@_prob_name_str
\tl_clear:N \l_@@_prob_pts_tl
\tl_clear:N \l_@@_prob_min_tl
\tl_clear:N \l_@@_prob_title_tl
\tl_clear:N \l_@@_prob_type_tl
+ \tl_clear:N \l_@@_prob_imports_tl
\int_zero_new:N \l_@@_prob_refnum_int
\keys_set:nn { problem / problem }{ #1 }
\int_compare:nNnT \l_@@_prob_refnum_int = 0 {
@@ -369,7 +178,7 @@
% Then we set up a counter for problems.
% \begin{macro}{\numberproblemsin}
% \begin{macrocode}
-\newcounter{problem}
+\newcounter{problem}[section]
\newcommand\numberproblemsin[1]{\@addtoreset{problem}{#1}}
% \end{macrocode}
% \end{macro}
@@ -377,7 +186,7 @@
% \begin{macro}{\prob@label}
% We provide the macro |\prob@label| to redefine later to get context involved.
% \begin{macrocode}
-\newcommand\prob@label[1]{#1}
+\newcommand\prob@label[1]{\thesection.#1}
% \end{macrocode}
% \end{macro}
%
@@ -441,6 +250,44 @@
\@in@omtexttrue% we are in a statement (for inline definitions)
\stepcounter{problem}\record@problem
\def\current@section@level{\prob@problem@kw}
+
+ \str_if_empty:NT \l_@@_prob_name_str {
+ \seq_get_right:NN \g_stex_currentfile_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpa_seq . \l_tmpa_str
+ \seq_get_left:NN \l_tmpa_seq \l_@@_prob_name_str
+ }
+
+ \stex_if_do_html:T{
+ \tl_if_empty:NF \l_@@_prob_title_tl {
+ \exp_args:No \stex_document_title:n \l_@@_prob_title_tl
+ }
+ }
+
+ \exp_args:Nno\stex_module_setup:nn{type=problem}\l_@@_prob_name_str
+
+ \stex_reactivate_macro:N \STEXexport
+ \stex_reactivate_macro:N \importmodule
+ \stex_reactivate_macro:N \symdecl
+ \stex_reactivate_macro:N \notation
+ \stex_reactivate_macro:N \symdef
+
+ \stex_if_do_html:T{
+ \begin{stex_annotate_env} {problem} {
+ \l_stex_module_ns_str ? \l_stex_module_name_str
+ }
+
+ \stex_annotate_invisible:nnn{header}{} {
+ \stex_annotate:nnn{language}{ \l_stex_module_lang_str }{}
+ \stex_annotate:nnn{signature}{ \l_stex_module_sig_str }{}
+ \str_if_eq:VnF \l_stex_module_meta_str {NONE} {
+ \stex_annotate:nnn{metatheory}{ \l_stex_module_meta_str }{}
+ }
+ }
+ }
+
+ \stex_csl_to_imports:No \importmodule \l_@@_prob_imports_tl
+
+
\tl_if_exist:NTF \l_@@_inclprob_type_tl {
\tl_set_eq:NN \sproblemtype \l_@@_inclprob_type_tl
}{
@@ -453,37 +300,48 @@
}
- \clist_set:No \l_tmpa_clist \sproblemtype
- \tl_clear:N \l_tmpa_tl
- \clist_map_inline:Nn \l_tmpa_clist {
- \tl_if_exist:cT {_@@_sproblem_##1_start:}{
- \tl_set:Nn \l_tmpa_tl {\use:c{_@@_sproblem_##1_start:}}
+ \stex_if_smsmode:F {
+ \clist_set:No \l_tmpa_clist \sproblemtype
+ \tl_clear:N \l_tmpa_tl
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \tl_if_exist:cT {_@@_sproblem_##1_start:}{
+ \tl_set:Nn \l_tmpa_tl {\use:c{_@@_sproblem_##1_start:}}
+ }
+ }
+ \tl_if_empty:NTF \l_tmpa_tl {
+ \_@@_sproblem_start:
+ }{
+ \l_tmpa_tl
}
- }
- \tl_if_empty:NTF \l_tmpa_tl {
- \_@@_sproblem_start:
- }{
- \l_tmpa_tl
}
\stex_ref_new_doc_target:n \sproblemid
+ \stex_smsmode_do:
}{
- \clist_set:No \l_tmpa_clist \sproblemtype
- \tl_clear:N \l_tmpa_tl
- \clist_map_inline:Nn \l_tmpa_clist {
- \tl_if_exist:cT {_@@_sproblem_##1_end:}{
- \tl_set:Nn \l_tmpa_tl {\use:c{_@@_sproblem_##1_end:}}
+ \__stex_modules_end_module:
+ \stex_if_smsmode:F{
+ \clist_set:No \l_tmpa_clist \sproblemtype
+ \tl_clear:N \l_tmpa_tl
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \tl_if_exist:cT {_@@_sproblem_##1_end:}{
+ \tl_set:Nn \l_tmpa_tl {\use:c{_@@_sproblem_##1_end:}}
+ }
+ }
+ \tl_if_empty:NTF \l_tmpa_tl {
+ \_@@_sproblem_end:
+ }{
+ \l_tmpa_tl
}
}
- \tl_if_empty:NTF \l_tmpa_tl {
- \_@@_sproblem_end:
- }{
- \l_tmpa_tl
+ \stex_if_do_html:T{
+ \end{stex_annotate_env}
}
-
\smallskip
}
+\seq_put_right:Nx\g_stex_smsmode_allowedenvs_seq{\tl_to_str:n{sproblem}}
+
+
\cs_new_protected:Nn \_@@_sproblem_start: {
\par\noindent\textbf\prob@heading\show@pts\show@min\\\ignorespacesandpars
@@ -585,23 +443,49 @@
% package. Note that we use the |\@startsolution| macro in the start codes, that parses
% the optional argument.
% \begin{macrocode}
-\newcommand\startsolutions{
- \specialcomment{solution}{\@startsolution}{
- \bool_if:NF \c_@@_boxed_bool {
- \hrule\medskip
+\box_new:N \l_@@_solution_box
+\newenvironment{solution}[1][]{
+ \stex_html_backend:TF{
+ \stex_if_do_html:T{
+ \begin{stex_annotate_env}{solution}{}
}
- \end{small}%
+ }{
+ \setbox\l_@@_solution_box\vbox\bgroup
+ \par\smallskip\hrule\smallskip
+ \noindent\textbf{Solution:}~
}
- \bool_if:NT \c_@@_boxed_bool {
- \surroundwithmdframed{solution}
+}{
+ \stex_html_backend:TF{
+ \stex_if_do_html:T{
+ \end{stex_annotate_env}
+ }
+ }{
+ \smallskip\hrule
+ \egroup
+ \bool_if:NT \c_@@_solutions_bool {
+ \box\l_@@_solution_box
+ }
}
}
+
+\newcommand\startsolutions{
+ \bool_set_true:N \c_@@_solutions_bool
+% \specialcomment{solution}{\@startsolution}{
+% \bool_if:NF \c_@@_boxed_bool {
+% \hrule\medskip
+% }
+% \end{small}%
+% }
+% \bool_if:NT \c_@@_boxed_bool {
+% \surroundwithmdframed{solution}
+% }
+}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\stopsolutions}
% \begin{macrocode}
-\newcommand\stopsolutions{\excludecomment{solution}}
+\newcommand\stopsolutions{\bool_set_false:N \c_@@_solutions_bool}%\excludecomment{solution}}
% \end{macrocode}
% \end{macro}
%
@@ -620,7 +504,7 @@
\bool_if:NTF \c_@@_notes_bool {
\newenvironment{exnote}[1][]{
\par\smallskip\hrule\smallskip
- \noindent\textbf{\prob@note@kw : }\small
+ \noindent\textbf{\prob@note@kw :~ }\small
}{
\smallskip\hrule
}
@@ -657,7 +541,7 @@
\bool_if:NTF \c_@@_notes_bool {
\newenvironment{gnote}[1][]{
\par\smallskip\hrule\smallskip
- \noindent\textbf{\prob@gnote@kw : }\small
+ \noindent\textbf{\prob@gnote@kw :~ }\small
}{
\smallskip\hrule
}
@@ -691,47 +575,42 @@
\keys_define:nn { problem / mcc }{
id .str_set_x:N = \l_@@_mcc_id_str ,
feedback .tl_set:N = \l_@@_mcc_feedback_tl ,
- T .default:n = { true } ,
+ T .default:n = { false } ,
T .bool_set:N = \l_@@_mcc_t_bool ,
- F .default:n = { true } ,
+ F .default:n = { false } ,
F .bool_set:N = \l_@@_mcc_f_bool ,
- Ttext .code:n = {
- \_@@_do_yes_param:Nn \l_@@_mcc_Ttext_bool { #1 }
- } ,
- Ftext .code:n = {
- \_@@_do_yes_param:Nn \l_@@_mcc_Ftext_bool { #1 }
- }
+ Ttext .tl_set:N = \l_@@_mcc_Ttext_str ,
+ Ftext .tl_set:N = \l_@@_mcc_Ftext_str
}
\cs_new_protected:Nn \l_@@_mcc_args:n {
\str_clear:N \l_@@_mcc_id_str
\tl_clear:N \l_@@_mcc_feedback_tl
- \bool_set_true:N \l_@@_mcc_t_bool
- \bool_set_true:N \l_@@_mcc_f_bool
- \bool_set_true:N \l_@@_mcc_Ttext_bool
- \bool_set_false:N \l_@@_mcc_Ftext_bool
+ \bool_set_false:N \l_@@_mcc_t_bool
+ \bool_set_false:N \l_@@_mcc_f_bool
+ \tl_clear:N \l_@@_mcc_Ttext_tl
+ \tl_clear:N \l_@@_mcc_Ftext_tl
+ \str_clear:N \l_@@_mcc_id_str
\keys_set:nn { problem / mcc }{ #1 }
}
% \end{macrocode}
%
% \begin{macro}{\mcc}
% \begin{macrocode}
+\def\mccTrueText{\textbf{(true)~}}
+\def\mccFalseText{\textbf{(false)~}}
\newcommand\mcc[2][]{
\l_@@_mcc_args:n{ #1 }
- \item #2
+ \item[$\Box$] #2
\ifsolutions
\\
\bool_if:NT \l_@@_mcc_t_bool {
- % TODO!
- % \ifcsstring{mcc@T}{T}{}{\mcc@Ttext}%
+ \tl_if_empty:NTF\l_@@_mcc_Ttext_tl\mccTrueText\l_@@_mcc_Ttext_tl
}
\bool_if:NT \l_@@_mcc_f_bool {
- % TODO!
- % \ifcsstring{mcc@F}{F}{}{\mcc@Ftext}%
+ \tl_if_empty:NTF\l_@@_mcc_Ttext_tl\mccFalseText\l_@@_mcc_Ftext_tl
}
- \tl_if_empty:NTF \l_@@_mcc_feedback_tl {
- !
- }{
- \l_@@_mcc_feedback_tl
+ \tl_if_empty:NF \l_@@_mcc_feedback_tl {
+ \emph{(\l_@@_mcc_feedback_tl)}
}
\fi
} %solutions
@@ -794,11 +673,24 @@
\newcommand\includeproblem[2][]{
\_@@_inclprob_args:n{ #1 }
- \str_if_empty:NTF \l_@@_inclprob_mhrepos_str {
- \input{#2}
- }{
- \stex_in_repository:nn{\l_@@_inclprob_mhrepos_str}{
- \input{\mhpath{\l_@@_inclprob_mhrepos_str}{#2}}
+ \exp_args:No \stex_in_repository:nn\l_@@_inclprob_mhrepos_str{
+ \stex_html_backend:TF {
+ \str_clear:N \l_tmpa_str
+ \prop_get:NnNF \l_stex_current_repository_prop { narr } \l_tmpa_str {
+ \prop_get:NnNF \l_stex_current_repository_prop { ns } \l_tmpa_str {}
+ }
+ \stex_annotate_invisible:nnn{includeproblem}{
+ \l_tmpa_str / #2
+ }{}
+ }{
+ \begingroup
+ \inputreftrue
+ \tl_if_empty:nTF{ ##1 }{
+ \input{#2}
+ }{
+ \input{ \c_stex_mathhub_str / ##1 / source / #2 }
+ }
+ \endgroup
}
}
\_@@_inclprob_clear:
@@ -852,6 +744,9 @@
}{
\tl_if_exist:NT \l_@@_prob_pts_tl {
\bool_if:NT \c_@@_pts_bool {
+ \tl_if_empty:NT\l_@@_prob_pts_tl{
+ \tl_set:Nn \l_@@_prob_pts_tl {0}
+ }
\marginpar{\l_@@_prob_pts_tl\ \prob@pt@kw\smallskip}
\addtocounter{pts}{\l_@@_prob_pts_tl}
}
@@ -873,6 +768,9 @@
}{
\tl_if_exist:NT \l_@@_prob_min_tl {
\bool_if:NT \c_@@_min_bool {
+ \tl_if_empty:NT\l_@@_prob_min_tl{
+ \tl_set:Nn \l_@@_prob_min_tl {0}
+ }
\marginpar{\l_@@_prob_min_tl\ min}
\addtocounter{min}{\l_@@_prob_min_tl}
}
@@ -883,6 +781,7 @@
% \end{macrocode}
% \end{macro}
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
\endinput
% LocalWords: GPL structuresharing STR dtx pts keyval xcomment CPERL DefKeyVal iffalse
%%% Local Variables:
diff --git a/Master/texmf-dist/source/latex/stex/extensions/stex-extensions.ins b/Master/texmf-dist/source/latex/stex/extensions/stex-extensions.ins
index e3594e88cfe..e6fe5099f05 100644
--- a/Master/texmf-dist/source/latex/stex/extensions/stex-extensions.ins
+++ b/Master/texmf-dist/source/latex/stex/extensions/stex-extensions.ins
@@ -18,7 +18,6 @@
\askforoverwritefalse
\generate{
- \file{document-structure.cls}{\from{document-structure.dtx}{cls}}
\file{document-structure.sty}{\from{document-structure.dtx}{package}}
\file{notesslides.cls}{\from{notesslides.dtx}{cls}}
\file{notesslides.sty}{\from{notesslides.dtx}{package}}
@@ -26,7 +25,6 @@
\file{stex-tikzinput.sty}{\from{tikzinput.dtx}{stex}}
\file{problem.sty}{\from{problem.dtx}{package}}
\file{hwexam.sty}{\from{hwexam.dtx}{package}}
- \file{hwexam.cls}{\from{hwexam.dtx}{cls}}
}
\Msg{*}
diff --git a/Master/texmf-dist/source/latex/stex/extensions/tikzinput.dtx b/Master/texmf-dist/source/latex/stex/extensions/tikzinput.dtx
index f183a6e4fad..fb7bbf76c97 100644
--- a/Master/texmf-dist/source/latex/stex/extensions/tikzinput.dtx
+++ b/Master/texmf-dist/source/latex/stex/extensions/tikzinput.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -19,7 +19,7 @@
%</driver>
% \fi
%
-% \title{Tikzinput
+% \title{Tikzinput: Treating TIKZ code as images
% \thanks{Version {\fileversion} (last revised {\filedate})}
% }
%
@@ -30,12 +30,20 @@
%
% \maketitle
%
-%\ifinfulldoc\else
-% This is the documentation for the \pkg{tikzinput} package.
-% For a more high-level introduction,
-% see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
-% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+% \ifinfulldoc\else
+% \begin{abstract}
+% This is the documentation for the \pkg{tikzinput} package. For a more high-level
+% introduction, see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
+% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+%
+% In some situations it is more efficient externalize the TIKZ pictures into separate
+% (standalone) files, to let {\LaTeX} handle the TIKZ pictures to generate an image, and
+% just load it via the usual {\LaTeX} graphics packages. The |tikzinput| package
+% supports this workflow, and allows to switch back to native TIKZ via a package option.
+% \end{abstract}
%
+% \tableofcontents
+%
% \input{../../doc/packages/stex-tikzinput}
% \fi
%
@@ -51,6 +59,7 @@
% \section{Tikzinput Implementation}
%
% \begin{macrocode}
+%<@@=tikzinput>
%<*package>
%%%%%%%%%%%%% tikzinput.dtx %%%%%%%%%%%%%
@@ -58,7 +67,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesExplPackage{tikzinput}{2022/02/26}{3.0.1}{tikzinput package}
+\ProvidesExplPackage{tikzinput}{2022/05/24}{3.1.0}{tikzinput package}
\RequirePackage{l3keys2e}
\keys_define:nn { tikzinput } {
@@ -121,7 +130,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesExplPackage{stex-tikzinput}{2022/02/26}{3.0.1}{stex-tikzinput}
+\ProvidesExplPackage{stex-tikzinput}{2022/05/24}{3.1.0}{stex-tikzinput}
\RequirePackage{stex}
\RequirePackage{tikzinput}
@@ -132,6 +141,61 @@
}
}
\newcommand\cmhtikzinput[2][]{\begin{center}\mhtikzinput[#1]{#2}\end{center}}
+
+\cs_new_protected:Nn \_@@_usetikzlibrary:nn {
+ \pgfkeys@spdef\pgf@temp{#1}
+ \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax%
+ \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
+ \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@}
+ \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|}
+ \expandafter\edef\csname tikz@library@#1@dollarcode\endcsname{\the\catcode`\$}
+ \catcode`\@=11
+ \catcode`\|=12
+ \catcode`\$=3
+ \pgfutil@InputIfFileExists{#2}{}{}
+ \catcode`\@=\csname tikz@library@#1@atcode\endcsname
+ \catcode`\|=\csname tikz@library@#1@barcode\endcsname
+ \catcode`\$=\csname tikz@library@#1@dollarcode\endcsname
+}
+
+
+\newcommand\libusetikzlibrary[1]{
+ \prop_if_exist:NF \l_stex_current_repository_prop {
+ \msg_error:nnn{stex}{error/notinarchive}\libusetikzlibrary
+ }
+ \prop_get:NnNF \l_stex_current_repository_prop {id} \l_tmpa_str {
+ \msg_error:nnn{stex}{error/notinarchive}\libusetikzlibrary
+ }
+ \seq_clear:N \l_@@_libinput_files_seq
+ \seq_set_eq:NN \l_tmpa_seq \c_stex_mathhub_seq
+ \seq_set_split:NnV \l_tmpb_seq / \l_tmpa_str
+
+ \bool_while_do:nn { ! \seq_if_empty_p:N \l_tmpb_seq }{
+ \str_set:Nx \l_tmpa_str {\stex_path_to_string:N \l_tmpa_seq / meta-inf / lib / tikzlibrary #1 .code.tex}
+ \IfFileExists{ \l_tmpa_str }{
+ \seq_put_right:No \l_@@_libinput_files_seq \l_tmpa_str
+ }{}
+ \seq_pop_left:NN \l_tmpb_seq \l_tmpa_str
+ \seq_put_right:No \l_tmpa_seq \l_tmpa_str
+ }
+
+ \str_set:Nx \l_tmpa_str {\stex_path_to_string:N \l_tmpa_seq / lib / tikzlibrary #1 .code.tex}
+ \IfFileExists{ \l_tmpa_str }{
+ \seq_put_right:No \l_@@_libinput_files_seq \l_tmpa_str
+ }{}
+
+ \seq_if_empty:NTF \l_@@_libinput_files_seq {
+ \msg_error:nnxx{stex}{error/nofile}{\exp_not:N\libusetikzlibrary}{tikzlibrary #1 .code.tex}
+ }{
+ \int_compare:nNnTF {\seq_count:N \l_@@_libinput_files_seq} = 1 {
+ \seq_map_inline:Nn \l_@@_libinput_files_seq {
+ \_@@_usetikzlibrary:nn{#1}{ ##1 }
+ }
+ }{
+ \msg_error:nnxx{stex}{error/twofiles}{\exp_not:N\libusetikzlibrary}{tikzlibrary #1 .code.tex}
+ }
+ }
+}
% \end{macrocode}
%
% \begin{macrocode}
@@ -139,6 +203,7 @@
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-basics.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-basics.dtx
index 37c55822d82..d58f56a49c0 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-basics.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-basics.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -150,14 +150,43 @@
%%%%%%%%%%%%% basics.dtx %%%%%%%%%%%%%
\RequirePackage{expl3,l3keys2e}
-\ProvidesExplClass{stex}{2022/02/26}{3.0.1}{sTeX document class}
-\LoadClass[border=1px,varwidth]{standalone}
-\setlength\textwidth{15cm}
+\ProvidesExplClass{stex}{2022/05/24}{3.1.0}{sTeX document class}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{stex}}
\ProcessOptions
+\bool_set_true:N \c_stex_document_class_bool
+
\RequirePackage{stex}
+
+\stex_html_backend:TF {
+ \LoadClass{article}
+}{
+ \LoadClass[border=1px,varwidth,crop=false]{standalone}
+ \setlength\textwidth{15cm}
+}
+\RequirePackage{standalone}
+
+
+\clist_if_empty:NT \c_stex_languages_clist {
+ \seq_get_right:NN \g_stex_currentfile_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpa_seq . \l_tmpa_str
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str % .tex
+ \exp_args:No \str_if_eq:nnF \l_tmpa_str {tex} {
+ \exp_args:No \str_if_eq:nnF \l_tmpa_str {dtx} {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq \l_tmpa_str
+ }
+ }
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_str % <filename>
+ \seq_if_empty:NF \l_tmpa_seq { %remaining element should be [<something>.]language
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \prop_if_in:NoT \c_stex_languages_prop \l_tmpa_str {
+ \stex_debug:nn{language} {Language~\l_tmpa_str~
+ inferred~from~file~name}
+ \exp_args:NNo \stex_set_language:Nn \l_tmpa_str \l_tmpa_str
+ }
+ }
+}
%</cls>
% \end{macrocode}
%
@@ -169,7 +198,14 @@
%%%%%%%%%%%%% basics.dtx %%%%%%%%%%%%%
\RequirePackage{expl3,l3keys2e,ltxcmds}
-\ProvidesExplPackage{stex}{2022/02/26}{3.0.1}{sTeX package}
+\ProvidesExplPackage{stex}{2022/05/24}{3.1.0}{sTeX package}
+
+\bool_if_exist:NF \c_stex_document_class_bool {
+ \bool_set_false:N \c_stex_document_class_bool
+ \RequirePackage{standalone}
+}
+
+\message{^^J*~This~is~sTeX~version~3.1.0~*^^J}
%\RequirePackage{morewrites}
%\RequirePackage{amsmath}
@@ -183,7 +219,8 @@
debug .clist_set:N = \c_stex_debug_clist ,
lang .clist_set:N = \c_stex_languages_clist ,
mathhub .tl_set_x:N = \mathhub ,
- sms .bool_set:N = \c_stex_persist_mode_bool ,
+ usesms .bool_set:N = \c_stex_persist_mode_bool ,
+ writesms .bool_set:N = \c_stex_persist_write_mode_bool ,
image .bool_set:N = \c_tikzinput_image_bool,
unknown .code:n = {}
}
@@ -194,13 +231,7 @@
% The \sTeX logo:
%
% \begin{macrocode}
-\protected\def\stex{%
- \@ifundefined{texorpdfstring}%
- {\let\texorpdfstring\@firstoftwo}%
- {}%
- \texorpdfstring{\raisebox{-.5ex}S\kern-.5ex\TeX}{sTeX}\xspace%
-}
-\def\sTeX{\stex}
+\RequirePackage{stex-logo} % externalized for backwards-compatibility reasons
% \end{macrocode}
% \end{macro}
%
@@ -233,13 +264,13 @@
% \begin{macrocode}
\cs_new_protected:Nn \stex_debug:nn {
\clist_if_in:NnTF \c_stex_debug_clist { all } {
- \exp_args:Nnnx\msg_set:nnn{stex}{debug / #1}{
+ \msg_set:nnn{stex}{debug / #1}{
\\Debug~#1:~#2\\
}
\msg_none:nn{stex}{debug / #1}
}{
\clist_if_in:NnT \c_stex_debug_clist { #1 } {
- \exp_args:Nnnx\msg_set:nnn{stex}{debug / #1}{
+ \msg_set:nnn{stex}{debug / #1}{
\\Debug~#1:~#2\\
}
\msg_none:nn{stex}{debug / #1}
@@ -267,58 +298,27 @@
% \subsection{HTML Annotations}
% \begin{macrocode}
%<@@=stex_annotate>
-\RequirePackage{rustex}
% \end{macrocode}
%
-% We add the namespace abbreviation |ns:stex="http://kwarc.info/ns/sTeX"| to \rustex:
-%
% \begin{macrocode}
-\rustex_add_Namespace:nn{stex}{http://kwarc.info/ns/sTeX}
% \end{macrocode}
%
-% Conditionals for \latexml:
-%
-% \begin{macro}{\if@latexml}
-% \begin{macrocode}
-\ifcsname if@latexml\endcsname\else
- \expandafter\newif\csname if@latexml\endcsname\@latexmlfalse
-\fi
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[pTF]{\latexml_if:}
-% \begin{macrocode}
-\prg_new_conditional:Nnn \latexml_if: {p, T, F, TF} {
- \if@latexml
- \prg_return_true:
- \else:
- \prg_return_false:
- \fi:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{variable}{\l_@@_arg_tl, \c_@@_emptyarg_tl}
+% \begin{variable}{\l_stex_html_arg_tl, \c_stex_html_emptyarg_tl}
%
% Used by annotation macros to ensure that the HTML output to annotate
% is not empty.
%
% \begin{macrocode}
-\tl_new:N \l_@@_arg_tl
-\tl_const:Nx \c_@@_emptyarg_tl {
- \rustex_if:TF {
- \rustex_direct_HTML:n { \c_ampersand_str lrm; }
- }{~}
-}
+\tl_new:N \l_stex_html_arg_tl
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\_@@_checkempty:n}
+% \begin{macro}{\_stex_html_checkempty:n}
% \begin{macrocode}
-\cs_new_protected:Nn \_@@_checkempty:n {
- \tl_set:Nn \l_@@_arg_tl { #1 }
- \tl_if_empty:NT \l_@@_arg_tl {
- \tl_set_eq:NN \l_@@_arg_tl \c_@@_emptyarg_tl
+\cs_new_protected:Nn \_stex_html_checkempty:n {
+ \tl_set:Nn \l_stex_html_arg_tl { #1 }
+ \tl_if_empty:NT \l_stex_html_arg_tl {
+ \tl_set_eq:NN \l_stex_html_arg_tl \c_stex_html_emptyarg_tl
}
}
% \end{macrocode}
@@ -367,101 +367,22 @@
% the \latexml-implementations resort to perl bindings.
%
% \begin{macrocode}
-\rustex_if:TF{
- \cs_new_protected:Nn \stex_annotate:nnn {
- \_@@_checkempty:n { #3 }
- \rustex_annotate_HTML:nn {
- property="stex:#1" ~
- resource="#2"
- } {
- \mode_if_vertical:TF{
- \tl_use:N \l_@@_arg_tl\par
- }{
- \tl_use:N \l_@@_arg_tl
- }
- }
- }
- \cs_new_protected:Nn \stex_annotate_invisible:n {
- \_@@_checkempty:n { #1 }
- \rustex_annotate_HTML:nn {
- stex:visible="false" ~
- style:display="none"
- } {
- \mode_if_vertical:TF{
- \tl_use:N \l_@@_arg_tl\par
- }{
- \tl_use:N \l_@@_arg_tl
- }
- }
- }
- \cs_new_protected:Nn \stex_annotate_invisible:nnn {
- \_@@_checkempty:n { #3 }
- \rustex_annotate_HTML:nn {
- property="stex:#1" ~
- resource="#2" ~
- stex:visible="false" ~
- style:display="none"
- } {
- \mode_if_vertical:TF{
- \tl_use:N \l_@@_arg_tl\par
- }{
- \tl_use:N \l_@@_arg_tl
- }
- }
- }
- \NewDocumentEnvironment{stex_annotate_env} { m m } {
- \par
- \rustex_annotate_HTML_begin:n {
- property="stex:#1" ~
- resource="#2"
- }
- }{
- \par\rustex_annotate_HTML_end:
- }
-}{
- \latexml_if:TF {
- \cs_new_protected:Nn \stex_annotate:nnn {
- \_@@_checkempty:n { #3 }
- \mode_if_math:TF {
- \cs:w latexml@annotate@math\cs_end:{#1}{#2}{
- \tl_use:N \l_@@_arg_tl
- }
- }{
- \cs:w latexml@annotate@text\cs_end:{#1}{#2}{
- \tl_use:N \l_@@_arg_tl
- }
- }
- }
- \cs_new_protected:Nn \stex_annotate_invisible:n {
- \_@@_checkempty:n { #1 }
- \mode_if_math:TF {
- \cs:w latexml@invisible@math\cs_end:{
- \tl_use:N \l_@@_arg_tl
- }
- } {
- \cs:w latexml@invisible@text\cs_end:{
- \tl_use:N \l_@@_arg_tl
- }
- }
- }
- \cs_new_protected:Nn \stex_annotate_invisible:nnn {
- \_@@_checkempty:n { #3 }
- \cs:w latexml@annotate@invisible\cs_end:{#1}{#2}{
- \tl_use:N \l_@@_arg_tl
- }
- }
- \NewDocumentEnvironment{stex_annotate_env} { m m } {
- \par\begin{latexml@annotateenv}{#1}{#2}
- }{
- \par\end{latexml@annotateenv}
- }
- }{
- \cs_new_protected:Nn \stex_annotate:nnn {#3}
- \cs_new_protected:Nn \stex_annotate_invisible:n {}
- \cs_new_protected:Nn \stex_annotate_invisible:nnn {}
- \NewDocumentEnvironment{stex_annotate_env} { m m } {}{}
- }
+\tl_if_exist:NF\stex@backend{
+ \ifcsname if@rustex\endcsname
+ \def\stex@backend{rustex}
+ \else
+ \ifcsname if@latexml\endcsname
+ \def\stex@backend{latexml}
+ \else
+ \def\stex@backend{pdflatex}
+ \fi
+ \fi
}
+\input{stex-backend-\stex@backend.cfg}
+
+\newif\ifstexhtml
+\stex_html_backend:TF\stexhtmltrue\stexhtmlfalse
+
% \end{macrocode}
% \end{macro}
% \end{environment}
@@ -476,7 +397,7 @@
% We store language abbreviations in two (mutually inverse)
% property lists:
% \begin{macrocode}
-\prop_const_from_keyval:Nn \c_stex_languages_prop {
+\exp_args:NNx \prop_const_from_keyval:Nn \c_stex_languages_prop { \tl_to_str:n {
en = english ,
de = ngerman ,
ar = arabic ,
@@ -486,9 +407,9 @@
ro = romanian ,
tr = turkish ,
fr = french
-}
+}}
-\prop_const_from_keyval:Nn \c_stex_language_abbrevs_prop {
+\exp_args:NNx \prop_const_from_keyval:Nn \c_stex_language_abbrevs_prop { \tl_to_str:n {
english = en ,
ngerman = de ,
arabic = ar ,
@@ -498,7 +419,7 @@
romanian = ro ,
turkish = tr ,
french = fr
-}
+}}
% todo: chinese simplified (zhs)
% chinese traditional (zht)
% \end{macrocode}
@@ -508,17 +429,86 @@
% babel languages:
%
% \begin{macrocode}
+\cs_new_protected:Nn \stex_set_language:Nn {
+ \str_set:Nx \l_tmpa_str {#2}
+ \prop_get:NoNT \c_stex_languages_prop \l_tmpa_str #1 {
+ \ifx\@onlypreamble\@notprerr
+ \ltx@ifpackageloaded{babel}{
+ \exp_args:No \selectlanguage #1
+ }{}
+ \else
+ \exp_args:No \str_if_eq:nnTF #1 {turkish} {
+ \RequirePackage[#1,shorthands=:!]{babel}
+ }{
+ \RequirePackage[#1]{babel}
+ }
+ \fi
+ }
+}
+
\clist_if_empty:NF \c_stex_languages_clist {
+ \bool_set_false:N \l_tmpa_bool
\clist_clear:N \l_tmpa_clist
\clist_map_inline:Nn \c_stex_languages_clist {
- \prop_get:NnNTF \c_stex_languages_prop { #1 } \l_tmpa_str {
+ \str_set:Nx \l_tmpa_str {#1}
+ \str_if_eq:nnT {#1}{tr}{
+ \bool_set_true:N \l_tmpa_bool
+ }
+ \prop_get:NoNTF \c_stex_languages_prop \l_tmpa_str \l_tmpa_str {
\clist_put_right:No \l_tmpa_clist \l_tmpa_str
} {
\msg_error:nnx{stex}{error/unknownlanguage}{\l_tmpa_str}
}
}
\stex_debug:nn{lang} {Languages:~\clist_use:Nn \l_tmpa_clist {,~} }
- \RequirePackage[\clist_use:Nn \l_tmpa_clist,]{babel}
+ \bool_if:NTF \l_tmpa_bool {
+ \RequirePackage[\clist_use:Nn \l_tmpa_clist,,shorthands=:!]{babel}
+ }{
+ \RequirePackage[\clist_use:Nn \l_tmpa_clist,]{babel}
+ }
+}
+
+\AtBeginDocument{
+ \stex_html_backend:T {
+ \seq_get_right:NN \g_stex_currentfile_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpa_seq . \l_tmpa_str
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str % .tex
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_str % <filename>
+ \seq_if_empty:NF \l_tmpa_seq { %remaining element should be language
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \stex_debug:nn{basics} {Language~\l_tmpa_str~
+ inferred~from~file~name}
+ \stex_annotate_invisible:nnn{language}{ \l_tmpa_str }{}
+ }
+ }
+}
+% \end{macrocode}
+%
+% \subsection{Persistence}
+%
+% \begin{macrocode}
+%<@@=stex_persist>
+\bool_if:NTF \c_stex_persist_mode_bool {
+ \def \stex_persist:n #1 {}
+ \def \stex_persist:x #1 {}
+}{
+ \bool_if:NTF \c_stex_persist_write_mode_bool {
+ \iow_new:N \c_@@_iow
+ \iow_open:Nn \c_@@_iow{\jobname.sms}
+ \AtEndDocument{
+ \iow_close:N \c_@@_iow
+ }
+ \cs_new_protected:Nn \stex_persist:n {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \regex_replace_all:nnN { \cP\# } { \cO\# } \l_tmpa_tl
+ \regex_replace_all:nnN { \ } { \~ } \l_tmpa_tl
+ \exp_args:NNo \iow_now:Nn \c_@@_iow \l_tmpa_tl
+ }
+ \cs_generate_variant:Nn \stex_persist:n {x}
+ }{
+ \def \stex_persist:n #1 {}
+ \def \stex_persist:x #1 {}
+ }
}
% \end{macrocode}
%
@@ -529,7 +519,7 @@
\cs_new_protected:Nn \stex_deactivate_macro:Nn {
\exp_after:wN\let\csname \detokenize{#1} - orig\endcsname#1
\def#1{
- \msg_error:nnnn{stex}{error/deactivated-macro}{#1}{#2}
+ \msg_error:nnnn{stex}{error/deactivated-macro}{\detokenize{#1}}{#2}
}
}
% \end{macrocode}
@@ -553,10 +543,128 @@
\endgroup
}
}
+
+\cs_new_protected:Nn \stex_copy_control_sequence:NNN {
+ \tl_set:Nx \_tmp_args_tl {\cs_argument_spec:N #2}
+ \exp_args:NNo \tl_remove_all:Nn \_tmp_args_tl \c_hash_str
+ \int_set:Nn \l_tmpa_int {\tl_count:N \_tmp_args_tl}
+
+ \tl_clear:N \_tmp_args_tl
+ \int_step_inline:nn \l_tmpa_int {
+ \tl_put_right:Nx \_tmp_args_tl {{\exp_not:n{####}\exp_not:n{##1}}}
+ }
+
+ \tl_set:Nn #3 {\cs_generate_from_arg_count:NNnn #1 \cs_set:Npn}
+ \tl_put_right:Nx #3 { {\int_use:N \l_tmpa_int}{
+ \exp_after:wN\exp_after:wN\exp_after:wN \exp_not:n
+ \exp_after:wN\exp_after:wN\exp_after:wN {
+ \exp_after:wN #2 \_tmp_args_tl
+ }
+ }}
+}
+\cs_generate_variant:Nn \stex_copy_control_sequence:NNN {cNN}
+\cs_generate_variant:Nn \stex_copy_control_sequence:NNN {NcN}
+\cs_generate_variant:Nn \stex_copy_control_sequence:NNN {ccN}
+
+\cs_new_protected:Nn \stex_copy_control_sequence_ii:NNN {
+ \tl_set:Nx \_tmp_args_tl {\cs_argument_spec:N #2}
+ \exp_args:NNo \tl_remove_all:Nn \_tmp_args_tl \c_hash_str
+ \int_set:Nn \l_tmpa_int {\tl_count:N \_tmp_args_tl}
+
+ \tl_clear:N \_tmp_args_tl
+ \int_step_inline:nn \l_tmpa_int {
+ \tl_put_right:Nx \_tmp_args_tl {{\exp_not:n{########}\exp_not:n{##1}}}
+ }
+
+ \edef \_tmp_args_tl {
+ \exp_after:wN\exp_after:wN\exp_after:wN \exp_not:n
+ \exp_after:wN\exp_after:wN\exp_after:wN {
+ \exp_after:wN #2 \_tmp_args_tl
+ }
+ }
+
+ \exp_after:wN \def \exp_after:wN \_tmp_args_tl
+ \exp_after:wN ##\exp_after:wN 1 \exp_after:wN ##\exp_after:wN 2
+ \exp_after:wN { \_tmp_args_tl }
+
+ \edef \_tmp_args_tl {
+ \exp_after:wN \exp_not:n \exp_after:wN {
+ \_tmp_args_tl {####1}{####2}
+ }
+ }
+
+ \tl_set:Nn #3 {\cs_generate_from_arg_count:NNnn #1 \cs_set:Npn}
+ \tl_put_right:Nx #3 { {\int_use:N \l_tmpa_int}{
+ \exp_after:wN\exp_not:n\exp_after:wN{\_tmp_args_tl}
+ }}
+}
+
+\cs_generate_variant:Nn \stex_copy_control_sequence_ii:NNN {cNN}
+\cs_generate_variant:Nn \stex_copy_control_sequence_ii:NNN {NcN}
+\cs_generate_variant:Nn \stex_copy_control_sequence_ii:NNN {ccN}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MMTrule}
+% \begin{macrocode}
+\NewDocumentCommand \MMTrule {m m}{
+ \seq_set_split:Nnn \l_tmpa_seq , {#2}
+ \int_zero:N \l_tmpa_int
+ \stex_annotate_invisible:nnn{mmtrule}{scala://#1}{
+ \seq_if_empty:NF \l_tmpa_seq {
+ $\seq_map_inline:Nn \l_tmpa_seq {
+ \int_incr:N \l_tmpa_int
+ \stex_annotate:nnn{arg}{i\int_use:N \l_tmpa_int}{##1}
+ }$
+ }
+ }
+}
+
+\NewDocumentCommand \MMTinclude {m}{
+ \stex_annotate_invisible:nnn{import}{#1}{}
+}
+
+\tl_new:N \g_stex_document_title
+\cs_new_protected:Npn \STEXtitle #1 {
+ \tl_if_empty:NT \g_stex_document_title {
+ \tl_gset:Nn \g_stex_document_title { #1 }
+ }
+}
+\cs_new_protected:Nn \stex_document_title:n {
+ \tl_if_empty:NT \g_stex_document_title {
+ \tl_gset:Nn \g_stex_document_title { #1 }
+ \stex_annotate_invisible:n{\noindent
+ \stex_annotate:nnn{doctitle}{}{ #1 }
+ \par}
+ }
+}
+\AtBeginDocument {
+ \let \STEXtitle \stex_document_title:n
+ \tl_if_empty:NF \g_stex_document_title {
+ \stex_annotate_invisible:n{\noindent
+ \stex_annotate:nnn{doctitle}{}{ \g_stex_document_title }
+ \par}
+ }
+ \let\_stex_maketitle:\maketitle
+ \def\maketitle{
+ \tl_if_empty:NF \@title {
+ \exp_args:No \stex_document_title:n \@title
+ }
+ \_stex_maketitle:
+ }
+}
+
+\cs_new_protected:Nn \stex_par: {
+ \mode_if_vertical:F{
+ \if@minipage\else\if@nobreak\else\par\fi\fi
+ }
+}
+
%</package>
% \end{macrocode}
% \end{macro}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-features.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-features.dtx
index 27d8f88f950..3a5c8064b7d 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-features.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-features.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -40,6 +40,7 @@
% \fi
%
% \begin{documentation}\label{pkg:features:doc}
+% \changes{3.1.0}{2022/03/03}{Implemented mathstructures and instantiations}
%
% Code related to structural features
%
@@ -62,7 +63,6 @@
%%%%%%%%%%%%% features.dtx %%%%%%%%%%%%%
-%<@@=stex_features>
% \end{macrocode}
%
% Warnings and error messages
@@ -75,14 +75,34 @@
Symbol~#1~not~assigned~in~interpretmodule~#2
}
+\msg_new:nnn{stex}{error/unknownstructure}{
+ No~structure~#1~found!
+}
+
+\msg_new:nnn{stex}{error/unknownfield}{
+ No~field~#1~in~instance~#2~found!\\#3
+}
+
+\msg_new:nnn{stex}{error/keyval}{
+ Invalid~key=value~pair:#1
+}
+\msg_new:nnn{stex}{error/instantiate/missing}{
+ Assignments~missing~in~instantiate:~#1
+}
+\msg_new:nnn{stex}{error/incompatible}{
+ Incompatible~signature:~#1~(#2)~and~#3~(#4)
+}
+
% \end{macrocode}
%
% \subsection{Imports with modification}
%
% \begin{macrocode}
-\cs_new_protected:Nn \stex_get_symbol_in_copymodule:n {
+%<@@=stex_copymodule>
+\cs_new_protected:Nn \stex_get_symbol_in_seq:nn {
\tl_if_head_eq_catcode:nNTF { #1 } \relax {
- \_@@_get_symbol_from_cs:n { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \_@@_get_symbol_from_cs:
}{
% argument is a string
% is it a command name?
@@ -93,34 +113,31 @@
\exp_args:Nx \cs_if_eq:NNTF {
\tl_head:N \l_tmpa_tl
} \stex_invoke_symbol:n {
- \exp_args:No \_@@_get_symbol_from_cs:n { \use:c { #1 } }
+ \_@@_get_symbol_from_cs:n{ #2 }
}{
- \_@@_get_symbol_from_string:n { #1 }
+ \_@@_get_symbol_from_string:nn { #1 }{ #2 }
}
} {
- \_@@_get_symbol_from_string:n { #1 }
+ \_@@_get_symbol_from_string:nn { #1 }{ #2 }
}
}{
% argument is not a command name
- \_@@_get_symbol_from_string:n { #1 }
+ \_@@_get_symbol_from_string:nn { #1 }{ #2 }
% \l_stex_all_symbols_seq
}
}
}
-\cs_new_protected:Nn \_@@_get_symbol_from_string:n {
+\cs_new_protected:Nn \_@@_get_symbol_from_string:nn {
\str_set:Nn \l_tmpa_str { #1 }
\bool_set_false:N \l_tmpa_bool
\bool_if:NF \l_tmpa_bool {
\tl_set:Nn \l_tmpa_tl {
- \msg_set:nnn{stex}{error/unknownsymbol}{
- No~symbol~#1~found!
- }
- \msg_error:nn{stex}{error/unknownsymbol}
+ \msg_error:nnn{stex}{error/unknownsymbol}{#1}
}
\str_set:Nn \l_tmpa_str { #1 }
\int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
- \seq_map_inline:Nn \l_@@_copymodule_fields_seq {
+ \seq_map_inline:Nn #2 {
\str_set:Nn \l_tmpb_str { ##1 }
\str_if_eq:eeT { \l_tmpa_str } {
\str_range:Nnn \l_tmpb_str { -\l_tmpa_int } { -1 }
@@ -130,7 +147,6 @@
\str_set:Nn \l_stex_get_symbol_uri_str {
##1
}
- \_@@_get_symbol_check:
}
}
}
@@ -146,7 +162,7 @@
\exp_args:No \tl_if_head_is_group:nTF \l_tmpa_tl {
\exp_after:wN \str_set:Nn \exp_after:wN
\l_stex_get_symbol_uri_str \l_tmpa_tl
- \_@@_get_symbol_check:
+ \_@@_get_symbol_check:n { #1 }
}{
% TODO
% tail is not a single group
@@ -157,31 +173,26 @@
}
}
-\cs_new_protected:Nn \_@@_get_symbol_check: {
- \exp_args:NNno \seq_set_split:Nnn \l_tmpa_seq {?} \l_stex_get_symbol_uri_str
- \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} = 3 {
- \seq_pop_right:NN \l_tmpa_seq \l_tmpb_str
- \str_set:Nx \l_tmpa_str {\seq_use:Nn \l_tmpa_seq ?}
- \seq_if_in:NoF \l_@@_copymodule_modules_seq \l_tmpa_str {
- \msg_error:nnxx{stex}{error/copymodule/notallowed}{\l_stex_get_symbol_uri_str}{
- \l_stex_current_copymodule_name_str\\Allowed:~\seq_use:Nn \l_@@_copymodule_modules_seq {,~}
- }
- }
- }{
+\cs_new_protected:Nn \_@@_get_symbol_check:n {
+ \exp_args:NNx \seq_if_in:NnF #1 \l_stex_get_symbol_uri_str {
\msg_error:nnxx{stex}{error/copymodule/notallowed}{\l_stex_get_symbol_uri_str}{
- \l_stex_current_copymodule_name_str~(inexplicably)
+ :~\seq_use:Nn #1 {,~}
}
}
}
\cs_new_protected:Nn \stex_copymodule_start:nnnn {
+ % import module
\stex_import_module_uri:nn { #1 } { #2 }
\str_set:Nx \l_stex_current_copymodule_name_str {#3}
\stex_import_require_module:nnnn
{ \l_stex_import_ns_str } { \l_stex_import_archive_str }
{ \l_stex_import_path_str } { \l_stex_import_name_str }
+
\stex_collect_imports:n {\l_stex_import_ns_str ?\l_stex_import_name_str }
\seq_set_eq:NN \l_@@_copymodule_modules_seq \l_stex_collect_imports_seq
+
+ % fields
\seq_clear:N \l_@@_copymodule_fields_seq
\seq_map_inline:Nn \l_@@_copymodule_modules_seq {
\seq_map_inline:cn {c_stex_module_##1_constants}{
@@ -190,133 +201,136 @@
}
}
}
+
+ % setup prop
\seq_clear:N \l_tmpa_seq
\exp_args:NNx \prop_set_from_keyval:Nn \l_stex_current_copymodule_prop {
name = \l_stex_current_copymodule_name_str ,
module = \l_stex_current_module_str ,
from = \l_stex_import_ns_str ?\l_stex_import_name_str ,
- includes = \l_tmpa_seq ,
- fields = \l_tmpa_seq
+ includes = \l_tmpa_seq %,
+ % fields = \l_tmpa_seq
}
\stex_debug:nn{copymodule}{#4~for~module~{\l_stex_import_ns_str ?\l_stex_import_name_str}
as~\l_stex_current_module_str?\l_stex_current_copymodule_name_str}
\stex_debug:nn{copymodule}{modules:\seq_use:Nn \l_@@_copymodule_modules_seq {,~}}
\stex_debug:nn{copymodule}{fields:\seq_use:Nn \l_@@_copymodule_fields_seq {,~}}
- \stex_if_smsmode:F {
+
+ \stex_if_do_html:T {
\begin{stex_annotate_env} {#4} {
\l_stex_current_module_str?\l_stex_current_copymodule_name_str
}
- \stex_annotate_invisible:nnn{from}{\l_stex_import_ns_str ?\l_stex_import_name_str}{}
+ \stex_annotate_invisible:nnn{domain}{\l_stex_import_ns_str ?\l_stex_import_name_str}{}
}
- \bool_set_eq:NN \l_@@_oldhtml_bool \_stex_html_do_output_bool
- \bool_set_false:N \_stex_html_do_output_bool
}
+
\cs_new_protected:Nn \stex_copymodule_end:n {
+ % apply to every field
\def \l_tmpa_cs ##1 ##2 {#1}
- \bool_set_eq:NN \_stex_html_do_output_bool \l_@@_oldhtml_bool
- \tl_clear:N \l_tmpa_tl
- \tl_clear:N \l_tmpb_tl
- \prop_get:NnN \l_stex_current_copymodule_prop {fields} \l_tmpa_seq
+
+ \tl_clear:N \_@@_module_tl
+ \tl_clear:N \_@@_exec_tl
+
+ %\prop_get:NnN \l_stex_current_copymodule_prop {fields} \l_tmpa_seq
+ \seq_clear:N \_@@_fields_seq
+
\seq_map_inline:Nn \l_@@_copymodule_modules_seq {
\seq_map_inline:cn {c_stex_module_##1_constants}{
- \tl_clear:N \l_tmpc_tl
+
+ \tl_clear:N \_@@_curr_symbol_tl % <- wrap in current symbol html
\l_tmpa_cs{##1}{####1}
+
\str_if_exist:cTF {l_@@_copymodule_##1?####1_name_str} {
- \tl_put_right:Nx \l_tmpa_tl {
- \prop_set_from_keyval:cn {
- l_stex_symdecl_\l_stex_current_module_str ? \use:c{l_@@_copymodule_##1?####1_name_str}_prop
- }{
- \exp_after:wN \prop_to_keyval:N \csname
- l_stex_symdecl_\l_stex_current_module_str ? \use:c{l_@@_copymodule_##1?####1_name_str}_prop
- \endcsname
- }
- \seq_clear:c {
- l_stex_symdecl_
- \l_stex_current_module_str ? \use:c{l_@@_copymodule_##1?####1_name_str}
- _notations
- }
- }
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_copy_notations:nn {\l_stex_current_module_str ? \use:c{l_@@_copymodule_##1?####1_name_str}}{##1?####1}
- \stex_annotate_invisible:nnn{alias}{\use:c{l_@@_copymodule_##1?####1_name_str}}{}
- }
- \seq_put_right:Nx \l_tmpa_seq {\l_stex_current_module_str ? \use:c{l_@@_copymodule_##1?####1_name_str}}
- \str_if_exist:cT {l_@@_copymodule_##1?####1_macroname_str} {
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_annotate_invisible:nnn{macroname}{\use:c{l_@@_copymodule_##1?####1_macroname_str}}{}
- }
- \tl_put_right:Nx \l_tmpa_tl {
- \tl_set:cx {\use:c{l_@@_copymodule_##1?####1_macroname_str}}{
- \stex_invoke_symbol:n {
- \l_stex_current_module_str ? \use:c{l_@@_copymodule_##1?####1_name_str}
- }
- }
+ \str_set_eq:Nc \_@@_curr_name_str {l_@@_copymodule_##1?####1_name_str}
+ \stex_if_do_html:T {
+ \tl_put_right:Nx \_@@_curr_symbol_tl {
+ \stex_annotate_invisible:nnn{alias}{\use:c{l_@@_copymodule_##1?####1_name_str}}{}
}
}
}{
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_copy_notations:nn {\l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1 }{##1?####1}
- }
- \prop_set_eq:Nc \l_tmpa_prop {l_stex_symdecl_ ##1?####1 _prop}
- \prop_put:Nnx \l_tmpa_prop { name }{ \l_stex_current_copymodule_name_str / ####1 }
- \prop_put:Nnx \l_tmpa_prop { module }{ \l_stex_current_module_str }
- \tl_put_right:Nx \l_tmpa_tl {
- \prop_set_from_keyval:cn {
- l_stex_symdecl_\l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1_prop
- }{
- \prop_to_keyval:N \l_tmpa_prop
- }
- \seq_clear:c {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1
- _notations
+ \str_set:Nx \_@@_curr_name_str { \l_stex_current_copymodule_name_str / ####1 }
+ }
+
+ \prop_set_eq:Nc \l_tmpa_prop {l_stex_symdecl_ ##1?####1 _prop}
+ \prop_put:Nnx \l_tmpa_prop { name } \_@@_curr_name_str
+ \prop_put:Nnx \l_tmpa_prop { module } \l_stex_current_module_str
+
+ \tl_if_exist:cT {l_@@_copymodule_##1?####1_def_tl}{
+ \stex_if_do_html:T {
+ \tl_put_right:Nx \_@@_curr_symbol_tl {
+ $\stex_annotate_invisible:nnn{definiens}{}{\exp_after:wN \exp_not:N\csname l_@@_copymodule_##1?####1_def_tl\endcsname}$
}
}
- \seq_put_right:Nx \l_tmpa_seq {\l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1 }
- \str_if_exist:cT {l_@@_copymodule_##1?####1_macroname_str} {
- \tl_put_right:Nx \l_tmpc_tl {
+ \prop_put:Nnn \l_tmpa_prop { defined } { true }
+ }
+
+ \stex_add_constant_to_current_module:n \_@@_curr_name_str
+ \tl_put_right:Nx \_@@_module_tl {
+ \seq_clear:c {l_stex_symdecl_ \l_stex_current_module_str ? \_@@_curr_name_str _notations}
+ \prop_set_from_keyval:cn {
+ l_stex_symdecl_\l_stex_current_module_str ? \_@@_curr_name_str _prop
+ }{
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ }
+
+ \str_if_exist:cT {l_@@_copymodule_##1?####1_macroname_str} {
+ \stex_if_do_html:T {
+ \tl_put_right:Nx \_@@_curr_symbol_tl {
\stex_annotate_invisible:nnn{macroname}{\use:c{l_@@_copymodule_##1?####1_macroname_str}}{}
}
- \tl_put_right:Nx \l_tmpa_tl {
- \tl_set:cx {\use:c{l_@@_copymodule_##1?####1_macroname_str}}{
- \stex_invoke_symbol:n {
- \l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1
- }
+ }
+ \tl_put_right:Nx \_@@_module_tl {
+ \tl_set:cx {\use:c{l_@@_copymodule_##1?####1_macroname_str}}{
+ \stex_invoke_symbol:n {
+ \l_stex_current_module_str ? \_@@_curr_name_str
}
}
}
}
- \tl_if_exist:cT {l_@@_copymodule_##1?####1_def_tl}{
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_annotate_invisible:nnn{definiens}{}{$\use:c{l_@@_copymodule_##1?####1_def_tl}$}
- }
+
+ \seq_put_right:Nx \_@@_fields_seq {\l_stex_current_module_str ? \_@@_curr_name_str }
+
+ \tl_put_right:Nx \_@@_exec_tl {
+ \stex_copy_notations:nn {\l_stex_current_module_str ? \_@@_curr_name_str} { ##1 ? ####1 }
}
- \tl_put_right:Nx \l_tmpb_tl {
- \stex_annotate:nnn{assignment} {##1?####1} { \l_tmpc_tl }
+
+ \tl_put_right:Nx \_@@_exec_tl {
+ \stex_if_do_html:TF{
+ \stex_annotate_invisible:nnn{assignment} {##1?####1} { \exp_after:wN \exp_not:n \exp_after:wN {\_@@_curr_symbol_tl} }
+ }{
+ \exp_after:wN \exp_not:n \exp_after:wN {\_@@_curr_symbol_tl}
+ }
}
}
}
- \prop_put:Nno \l_stex_current_copymodule_prop {fields} \l_tmpa_seq
- \tl_put_left:Nx \l_tmpa_tl {
+
+
+ \prop_put:Nno \l_stex_current_copymodule_prop {fields} \_@@_fields_seq
+ \tl_put_left:Nx \_@@_module_tl {
\prop_set_from_keyval:cn {
l_stex_copymodule_ \l_stex_current_module_str?\l_stex_current_copymodule_name_str _prop
}{
\prop_to_keyval:N \l_stex_current_copymodule_prop
}
}
- \exp_args:No \stex_add_to_current_module:n \l_tmpa_tl
- \stex_debug:nn{copymodule}{result:\meaning \l_tmpa_tl}
- \exp_args:Nx \stex_do_up_to_module:n {
- \exp_args:No \exp_not:n \l_tmpa_tl
+
+ \seq_gput_right:cx{c_stex_module_\l_stex_current_module_str _copymodules}{
+ \l_stex_current_module_str?\l_stex_current_copymodule_name_str
}
- \l_tmpb_tl
- \stex_if_smsmode:F {
+
+ \exp_args:No \stex_execute_in_module:n \_@@_module_tl
+ \stex_debug:nn{copymodule}{result:\meaning \_@@_module_tl}
+ \stex_debug:nn{copymodule}{output:\meaning \_@@_exec_tl}
+
+ \_@@_exec_tl
+ \stex_if_do_html:T {
\end{stex_annotate_env}
}
}
\NewDocumentEnvironment {copymodule} { O{} m m}{
- \stex_copymodule_start:nnnn { #1 }{ #2 }{ #3 }{ structure }
+ \stex_copymodule_start:nnnn { #1 }{ #2 }{ #3 }{ copymodule }
\stex_deactivate_macro:Nn \symdecl {module~environments}
\stex_deactivate_macro:Nn \symdef {module~environments}
\stex_deactivate_macro:Nn \notation {module~environments}
@@ -329,7 +343,7 @@
}
\NewDocumentEnvironment {interpretmodule} { O{} m m}{
- \stex_copymodule_start:nnnn { #1 }{ #2 }{ #3 }{ realization }
+ \stex_copymodule_start:nnnn { #1 }{ #2 }{ #3 }{ interpretmodule }
\stex_deactivate_macro:Nn \symdecl {module~environments}
\stex_deactivate_macro:Nn \symdef {module~environments}
\stex_deactivate_macro:Nn \notation {module~environments}
@@ -342,39 +356,130 @@
\tl_if_exist:cF {
l_@@_copymodule_##1?##2_def_tl
}{
- \msg_error:nnxx{stex}{error/interpretmodule/nodefiniens}{
- ##1?##2
- }{\l_stex_current_copymodule_name_str}
+ \str_if_eq:eeF {
+ \prop_item:cn{
+ l_stex_symdecl_ ##1 ? ##2 _prop }{ defined }
+ }{ true }{
+ \msg_error:nnxx{stex}{error/interpretmodule/nodefiniens}{
+ ##1?##2
+ }{\l_stex_current_copymodule_name_str}
+ }
}
}
}
-\NewDocumentCommand \donotcopy { O{} m}{
+\iffalse \begin{stex_annotate_env} \fi
+\NewDocumentEnvironment {realization} { O{} m}{
+ \stex_copymodule_start:nnnn { #1 }{ #2 }{ #2 }{ realize }
+ \stex_deactivate_macro:Nn \symdecl {module~environments}
+ \stex_deactivate_macro:Nn \symdef {module~environments}
+ \stex_deactivate_macro:Nn \notation {module~environments}
+ \stex_reactivate_macro:N \donotcopy
+ \stex_reactivate_macro:N \assign
+ \stex_smsmode_do:
+}{
\stex_import_module_uri:nn { #1 } { #2 }
- \stex_collect_imports:n {\l_stex_import_ns_str ?\l_stex_import_name_str }
- \seq_map_inline:Nn \l_stex_collect_imports_seq {
- \seq_remove_all:Nn \l_@@_copymodule_modules_seq { ##1 }
+ \tl_clear:N \_@@_exec_tl
+ \tl_set:Nx \_@@_module_tl {
+ \stex_import_require_module:nnnn
+ { \l_stex_import_ns_str } { \l_stex_import_archive_str }
+ { \l_stex_import_path_str } { \l_stex_import_name_str }
+ }
+
+ \seq_map_inline:Nn \l_@@_copymodule_modules_seq {
\seq_map_inline:cn {c_stex_module_##1_constants}{
- \seq_remove_all:Nn \l_@@_copymodule_fields_seq { ##1 ? ####1 }
- \bool_lazy_any_p:nT {
- { \cs_if_exist_p:c {l_@@_copymodule_##1?####1_name_str}}
- { \cs_if_exist_p:c {l_@@_copymodule_##1?####1_macroname_str}}
- { \cs_if_exist_p:c {l_@@_copymodule_##1?####1_def_tl}}
- }{
- % TODO throw error
+ \str_set:Nx \_@@_curr_name_str { \l_stex_current_copymodule_name_str / ####1 }
+ \tl_if_exist:cT {l_@@_copymodule_##1?####1_def_tl}{
+ \stex_if_do_html:T {
+ \tl_put_right:Nx \_@@_exec_tl {
+ \stex_annotate_invisible:nnn{assignment} {##1?####1} {
+ $\stex_annotate_invisible:nnn{definiens}{}{\exp_after:wN \exp_not:N\csname l_@@_copymodule_##1?####1_def_tl\endcsname}$
+ }
+ }
+ }
+ \tl_put_right:Nx \_@@_module_tl {
+ \prop_put:cnn {l_stex_symdecl_##1?####1_prop}{ defined }{ true }
+ }
+ }
+ }}
+
+ \exp_args:No \stex_execute_in_module:n \_@@_module_tl
+
+ \_@@_exec_tl
+ \stex_if_do_html:T {\end{stex_annotate_env}}
+}
+
+\NewDocumentCommand \donotcopy { m }{
+ \str_clear:N \l_stex_import_name_str
+ \str_set:Nn \l_tmpa_str { #1 }
+ \int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
+ \seq_map_inline:Nn \l_stex_all_modules_seq {
+ \str_set:Nn \l_tmpb_str { ##1 }
+ \str_if_eq:eeT { \l_tmpa_str } {
+ \str_range:Nnn \l_tmpb_str { -\l_tmpa_int } { -1 }
+ } {
+ \seq_map_break:n {
+ \stex_if_do_html:T {
+ \stex_if_smsmode:F {
+ \stex_annotate_invisible:nnn{donotcopy}{##1}{
+ \stex_annotate:nnn{domain}{##1}{}
+ }
+ }
+ }
+ \str_set_eq:NN \l_stex_import_name_str \l_tmpb_str
+ }
+ }
+ \seq_map_inline:cn {c_stex_module_##1_copymodules}{
+ \str_set:Nn \l_tmpb_str { ####1 }
+ \str_if_eq:eeT { \l_tmpa_str } {
+ \str_range:Nnn \l_tmpb_str { -\l_tmpa_int } { -1 }
+ } {
+ \seq_map_break:n {\seq_map_break:n {
+ \stex_if_do_html:T {
+ \stex_if_smsmode:F {
+ \stex_annotate_invisible:nnn{donotcopy}{####1}{
+ \stex_annotate:nnn{domain}{
+ \prop_item:cn {l_stex_copymodule_ ####1 _prop}{module}
+ }{}
+ }
+ }
+ }
+ \str_set:Nx \l_stex_import_name_str {
+ \prop_item:cn {l_stex_copymodule_ ####1 _prop}{module}
+ }
+ }}
}
}
}
-
- \prop_get:NnN \l_stex_current_copymodule_prop { includes } \l_tmpa_seq
- \seq_put_right:Nx \l_tmpa_seq {\l_stex_import_ns_str ?\l_stex_import_name_str }
- \prop_put:Nnx \l_stex_current_copymodule_prop {includes} \l_tmpa_seq
+ \str_if_empty:NTF \l_stex_import_name_str {
+ % TODO throw error
+ }{
+ \stex_collect_imports:n {\l_stex_import_name_str }
+ \seq_map_inline:Nn \l_stex_collect_imports_seq {
+ \seq_remove_all:Nn \l_@@_copymodule_modules_seq { ##1 }
+ \seq_map_inline:cn {c_stex_module_##1_constants}{
+ \seq_remove_all:Nn \l_@@_copymodule_fields_seq { ##1 ? ####1 }
+ \bool_lazy_any:nT {
+ { \cs_if_exist_p:c {l_@@_copymodule_##1?####1_name_str}}
+ { \cs_if_exist_p:c {l_@@_copymodule_##1?####1_macroname_str}}
+ { \cs_if_exist_p:c {l_@@_copymodule_##1?####1_def_tl}}
+ }{
+ % TODO throw error
+ }
+ }
+ }
+ \prop_get:NnN \l_stex_current_copymodule_prop { includes } \l_tmpa_seq
+ \seq_put_right:Nx \l_tmpa_seq {\l_stex_import_name_str }
+ \prop_put:Nno \l_stex_current_copymodule_prop {includes} \l_tmpa_seq
+ }
+ \stex_smsmode_do:
}
\NewDocumentCommand \assign { m m }{
- \stex_get_symbol_in_copymodule:n {#1}
+ \stex_get_symbol_in_seq:nn {#1} \l_@@_copymodule_fields_seq
\stex_debug:nn{assign}{defining~{\l_stex_get_symbol_uri_str}~as~\detokenize{#2}}
\tl_set:cn {l_@@_copymodule_\l_stex_get_symbol_uri_str _def_tl}{#2}
+ \stex_smsmode_do:
}
\keys_define:nn { stex / renamedecl } {
@@ -382,13 +487,12 @@
}
\cs_new_protected:Nn \_@@_renamedecl_args:n {
\str_clear:N \l_stex_renamedecl_name_str
-
\keys_set:nn { stex / renamedecl } { #1 }
}
\NewDocumentCommand \renamedecl { O{} m m}{
\_@@_renamedecl_args:n { #1 }
- \stex_get_symbol_in_copymodule:n {#2}
+ \stex_get_symbol_in_seq:nn {#2} \l_@@_copymodule_fields_seq
\stex_debug:nn{renamedecl}{renaming~{\l_stex_get_symbol_uri_str}~to~#3}
\str_set:cx {l_@@_copymodule_\l_stex_get_symbol_uri_str _macroname_str}{#3}
\str_if_empty:NTF \l_stex_renamedecl_name_str {
@@ -421,6 +525,7 @@
\l_stex_current_module_str ? \l_stex_renamedecl_name_str
} }
}
+ \stex_smsmode_do:
}
\stex_deactivate_macro:Nn \assign {copymodules}
@@ -431,41 +536,13 @@
% \end{macrocode}
%
%
-%
-% \begin{macrocode}
-\seq_new:N \l_stex_implicit_morphisms_seq
-\NewDocumentCommand \implicitmorphism { O{} m m}{
- \stex_import_module_uri:nn { #1 } { #2 }
- \stex_debug:nn{implicits}{
- Implicit~morphism:~
- \l_stex_module_ns_str ? \l_@@_name_str
- }
- \exp_args:NNx \seq_if_in:NnT \l_stex_all_modules_seq {
- \l_stex_module_ns_str ? \l_@@_name_str
- }{
- \msg_error:nnn{stex}{error/conflictingmodules}{
- \l_stex_module_ns_str ? \l_@@_name_str
- }
- }
-
- % TODO
-
-
-
- \seq_put_right:Nx \l_stex_implicit_morphisms_seq {
- \l_stex_module_ns_str ? \l_@@_name_str
- }
-}
-
-% \end{macrocode}
-%
-%
% \subsection{The feature environment}
%
% \begin{environment}{structural@feature}
% \begin{macrocode}
+%<@@=stex_features>
-\NewDocumentEnvironment{structural@feature}{ m m m }{
+\NewDocumentEnvironment{structural_feature_module}{ m m m }{
\stex_if_in_module:F {
\msg_set:nnn{stex}{error/nomodule}{
Structural~Feature~has~to~occur~in~a~module:\\
@@ -475,119 +552,162 @@
\msg_error:nn{stex}{error/nomodule}
}
- \str_set:Nx \l_stex_module_name_str {
- \prop_item:Nn \l_stex_current_module_prop
- { name } / #2 - feature
- }
-
- \str_set:Nx \l_stex_module_ns_str {
- \prop_item:Nn \l_stex_current_module_prop
- { ns }
- }
+ \str_set_eq:NN \l_stex_feature_parent_str \l_stex_current_module_str
-
- \str_clear:N \l_tmpa_str
- \seq_clear:N \l_tmpa_seq
- \tl_clear:N \l_tmpa_tl
- \exp_args:NNx \prop_set_from_keyval:Nn \l_stex_current_module_prop {
- origname = #2,
- name = \l_stex_module_name_str ,
- ns = \l_stex_module_ns_str ,
- imports = \exp_not:o { \l_tmpa_seq } ,
- constants = \exp_not:o { \l_tmpa_seq } ,
- content = \exp_not:o { \l_tmpa_tl } ,
- file = \exp_not:o { \g_stex_currentfile_seq } ,
- lang = \l_stex_module_lang_str ,
- sig = \l_tmpa_str ,
- meta = \l_tmpa_str ,
- feature = #1 ,
- }
-
- \stex_if_smsmode:F {
- \begin{stex_annotate_env}{ feature:#1 }{}
+ \stex_module_setup:nn{meta=NONE}{#2 - #1}
+
+ \stex_if_do_html:T {
+ \begin{stex_annotate_env}{ feature:#1 }{\l_stex_feature_parent_str ? #2 - #1}
\stex_annotate_invisible:nnn{header}{}{ #3 }
}
-}{
- \str_set:Nx \l_tmpa_str {
- c_stex_feature_
- \prop_item:Nn \l_stex_current_module_prop { ns } ?
- \prop_item:Nn \l_stex_current_module_prop { name }
- _prop
- }
- \prop_gset_eq:cN { \l_tmpa_str } \l_stex_current_module_prop
- \prop_gset_eq:NN \g_stex_last_feature_prop \l_stex_current_module_prop
- \stex_if_smsmode:F {
+}{
+ \str_gset_eq:NN \l_stex_last_feature_str \l_stex_current_module_str
+ \prop_gput:cnn {c_stex_module_ \l_stex_current_module_str _prop}{feature}{#1}
+ \stex_debug:nn{features}{
+ Feature: \l_stex_last_feature_str
+ }
+ \stex_if_do_html:T {
\end{stex_annotate_env}
}
}
-
% \end{macrocode}
% \end{environment}
%
-%
-% \subsection{Features}
+% \subsection{Structure}
%
% \begin{environment}{structure}
% \begin{macrocode}
-
-\prop_new:N \l_stex_all_structures_prop
+%<@@=stex_structures>
+\cs_new_protected:Nn \stex_add_structure_to_current_module:nn {
+ \prop_if_exist:cF {c_stex_module_\l_stex_current_module_str _structures}{
+ \prop_new:c {c_stex_module_\l_stex_current_module_str _structures}
+ }
+ \prop_gput:cxx{c_stex_module_\l_stex_current_module_str _structures}
+ {#1}{#2}
+}
\keys_define:nn { stex / features / structure } {
- name .str_set_x:N = \l_@@_structure_name_str ,
+ name .str_set_x:N = \l_@@_name_str ,
}
\cs_new_protected:Nn \_@@_structure_args:n {
- \str_clear:N \l_@@_structure_name_str
+ \str_clear:N \l_@@_name_str
\keys_set:nn { stex / features / structure } { #1 }
}
-\NewDocumentEnvironment{mathstructure}{ O{} m }{
- \_@@_structure_args:n { #1 }
- \str_if_empty:NT \l_@@_structure_name_str {
- \str_set:Nx \l_@@_structure_name_str { #2 }
+\NewDocumentEnvironment{mathstructure}{m O{}}{
+ \_@@_structure_args:n { #2 }
+ \str_if_empty:NT \l_@@_name_str {
+ \str_set:Nx \l_@@_name_str { #1 }
+ }
+ \stex_suppress_html:n {
+ \bool_set_true:N \l_stex_symdecl_make_macro_bool
+ \exp_args:Nx \stex_symdecl_do:nn {
+ name = \l_@@_name_str ,
+ def = {\STEXsymbol{module-type}{
+ \STEXInternalTermMathOMSiiii {
+ \prop_item:cn {c_stex_module_\l_stex_current_module_str _prop}
+ { ns } ?
+ \prop_item:cn {c_stex_module_\l_stex_current_module_str _prop}
+ { name } / \l_@@_name_str - structure
+ }{}{0}{}
+ }}
+ }{ #1 }
}
\exp_args:Nnnx
- \begin{structural@feature}{ structure }
- { \l_@@_structure_name_str }{}
- \seq_clear:N \l_tmpa_seq
- \prop_put:Nno \l_stex_current_module_prop { fields } \l_tmpa_seq
- \stex_smsmode_do:
+ \begin{structural_feature_module}{ structure }
+ { \l_@@_name_str }{}
+ \stex_smsmode_do:
}{
- \prop_get:NnN \l_stex_current_module_prop { constants } \l_tmpa_seq
- \prop_get:NnN \l_stex_current_module_prop { fields } \l_tmpb_seq
- \str_set:Nx \l_tmpa_str {
- \prop_item:Nn \l_stex_current_module_prop { ns } ?
- \prop_item:Nn \l_stex_current_module_prop { name }
+ \end{structural_feature_module}
+ \_stex_reset_up_to_module:n \l_stex_last_feature_str
+ \exp_args:No \stex_collect_imports:n \l_stex_last_feature_str
+ \seq_clear:N \l_tmpa_seq
+ \seq_map_inline:Nn \l_stex_collect_imports_seq {
+ \seq_map_inline:cn{c_stex_module_##1_constants}{
+ \seq_put_right:Nn \l_tmpa_seq { ##1 ? ####1 }
}
- \seq_map_inline:Nn \l_tmpa_seq {
- \exp_args:NNx \seq_put_right:Nn \l_tmpb_seq { \l_tmpa_str ? ##1 }
- }
- \prop_put:Nno \l_stex_current_module_prop { fields } { \l_tmpb_seq }
- \exp_args:Nnx
- \AddToHookNext { env / mathstructure / after }{
- \symdecl{ #2 }[type = \exp_not:N\collection,def={\STEXsymbol{module-type}{
- \_stex_term_math_oms:nnnn { \l_tmpa_str }{}{0}{}
- }}, name = \prop_item:Nn \l_stex_current_module_prop { origname }]
- \STEXexport {
- \prop_put:Nno \exp_not:N \l_stex_all_structures_prop
- {\prop_item:Nn \l_stex_current_module_prop { origname }}
- {\l_tmpa_str}
- \prop_put:Nno \exp_not:N \l_stex_all_structures_prop
- {#2}{\l_tmpa_str}
-% \seq_put_right:Nn \exp_not:N \l_stex_all_structures_seq {
-% \prop_item:Nn \l_stex_current_module_prop { origname },
-% \l_tmpa_str
-% }
-% \seq_put_right:Nn \exp_not:N \l_stex_all_structures_seq {
-% #2,\l_tmpa_str
-% }
-% \tl_set:cx { #2 } {
-% \stex_invoke_structure:n { \l_tmpa_str }
+ }
+ \exp_args:Nnno
+ \prop_gput:cnn {c_stex_module_ \l_stex_last_feature_str _prop}{fields}\l_tmpa_seq
+ \stex_debug:nn{structure}{Fields:~\seq_use:Nn \l_tmpa_seq ,}
+ \stex_add_structure_to_current_module:nn
+ \l_@@_name_str
+ \l_stex_last_feature_str
+
+ \stex_execute_in_module:x {
+ \tl_set:cn { #1 }{
+ \exp_not:N \stex_invoke_structure:nn {\l_stex_current_module_str }{ \l_@@_name_str}
+ }
+ }
+}
+
+\cs_new:Nn \stex_invoke_structure:nn {
+ \stex_invoke_symbol:n { #1?#2 }
+}
+
+\cs_new_protected:Nn \stex_get_structure:n {
+ \tl_if_head_eq_catcode:nNTF { #1 } \relax {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \_@@_get_from_cs:
+ }{
+ \cs_if_exist:cTF { #1 }{
+ \cs_set_eq:Nc \l_tmpa_cs { #1 }
+ \str_set:Nx \l_tmpa_str {\cs_argument_spec:N \l_tmpa_cs }
+ \str_if_empty:NTF \l_tmpa_str {
+ \cs_if_eq:NNTF { \tl_head:N \l_tmpa_cs} \stex_invoke_structure:nn {
+ \_@@_get_from_cs:
+ }{
+ \_@@_get_from_string:n { #1 }
+ }
+ }{
+ \_@@_get_from_string:n { #1 }
}
+ }{
+ \_@@_get_from_string:n { #1 }
}
-
- \end{structural@feature}
- % \g_stex_last_feature_prop
+ }
+}
+
+\cs_new_protected:Nn \_@@_get_from_cs: {
+ \exp_args:NNx \tl_set:Nn \l_tmpa_tl
+ { \tl_tail:N \l_tmpa_tl }
+ \str_set:Nx \l_tmpa_str {
+ \exp_after:wN \use_i:nn \l_tmpa_tl
+ }
+ \str_set:Nx \l_tmpb_str {
+ \exp_after:wN \use_ii:nn \l_tmpa_tl
+ }
+ \str_set:Nx \l_stex_get_structure_str {
+ \l_tmpa_str ? \l_tmpb_str
+ }
+ \str_set:Nx \l_stex_get_structure_module_str {
+ \exp_args:Nno \prop_item:cn {c_stex_module_\l_tmpa_str _structures}{\l_tmpb_str}
+ }
+}
+
+\cs_new_protected:Nn \_@@_get_from_string:n {
+ \tl_set:Nn \l_tmpa_tl {
+ \msg_error:nnn{stex}{error/unknownstructure}{#1}
+ }
+ \str_set:Nn \l_tmpa_str { #1 }
+ \int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
+
+ \seq_map_inline:Nn \l_stex_all_modules_seq {
+ \prop_if_exist:cT {c_stex_module_##1_structures} {
+ \prop_map_inline:cn {c_stex_module_##1_structures} {
+ \str_if_eq:eeT { \l_tmpa_str }{ \str_range:nnn {##1?####1}{-\l_tmpa_int}{-1}}{
+ \prop_map_break:n{\seq_map_break:n{
+ \tl_set:Nn \l_tmpa_tl {
+ \str_set:Nn \l_stex_get_structure_str {##1?####1}
+ \str_set:Nn \l_stex_get_structure_module_str {####2}
+ }
+ }}
+ }
+ }
+ }
+ }
+ \l_tmpa_tl
}
% \end{macrocode}
% \end{environment}
@@ -595,147 +715,344 @@
%
% \begin{macro}{\instantiate}
% \begin{macrocode}
-\seq_new:N \l_@@_structure_field_seq
-\str_new:N \l_@@_structure_field_str
-\str_new:N \l_@@_structure_def_tl
-\prop_new:N \l_@@_structure_prop
-\NewDocumentCommand \instantiate { m O{} m }{
- \prop_get:NnN \l_stex_all_structures_prop {#1} \l_tmpa_str
- \prop_set_eq:Nc \l_@@_structure_prop {
- c_stex_feature_\l_tmpa_str _prop
- }
- \seq_set_from_clist:Nn \l_@@_structure_field_seq { #2 }
- \seq_map_inline:Nn \l_@@_structure_field_seq {
- \seq_set_split:Nnn \l_tmpa_seq{=}{ ##1 }
- \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} > 1 {
- \seq_get_left:NN \l_tmpa_seq \l_tmpa_tl
- \exp_args:NNno \seq_set_split:Nnn \l_tmpb_seq
- {!} \l_tmpa_tl
- \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} > 1 {
- \str_set:Nx \l_@@_structure_field_str {\seq_item:Nn \l_tmpb_seq 1}
- \seq_get_right:NN \l_tmpb_seq \l_tmpb_tl
- \seq_get_right:NN \l_tmpa_seq \l_tmpa_tl
- }{
- \str_set:Nx \l_@@_structure_field_str \l_tmpa_tl
- \seq_get_right:NN \l_tmpa_seq \l_tmpa_tl
- \exp_args:NNno \seq_set_split:Nnn \l_tmpb_seq{!}
- \l_tmpa_tl
- \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} > 1 {
- \seq_get_left:NN \l_tmpb_seq \l_tmpa_tl
- \seq_get_right:NN \l_tmpb_seq \l_tmpb_tl
- }{
- \tl_clear:N \l_tmpb_tl
- }
- }
- }{
- \seq_set_split:Nnn \l_tmpa_seq{!}{ ##1 }
- \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} > 1 {
- \str_set:Nx \l_@@_structure_field_str {\seq_item:Nn \l_tmpa_seq 1}
- \seq_get_right:NN \l_tmpa_seq \l_tmpb_tl
- \tl_clear:N \l_tmpa_tl
- }{
- % TODO throw error
- }
+
+\keys_define:nn { stex / instantiate } {
+ name .str_set_x:N = \l_@@_name_str
+}
+\cs_new_protected:Nn \_@@_instantiate_args:n {
+ \str_clear:N \l_@@_name_str
+ \keys_set:nn { stex / instantiate } { #1 }
+}
+
+\NewDocumentCommand \instantiate {m O{} m m O{}}{
+ \begingroup
+ \stex_get_structure:n {#3}
+ \_@@_instantiate_args:n { #2 }
+ \str_if_empty:NT \l_@@_name_str {
+ \str_set:Nn \l_@@_name_str { #1 }
}
- % \l_tmpa_str: name
- % \l_tmpa_tl: definiens
- % \l_tmpb_tl: notation
- \tl_if_empty:NT \l_@@_structure_field_str {
- % TODO throw error
+ \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str
+ \seq_clear:N \l_@@_fields_seq
+ \exp_args:Nx \stex_collect_imports:n \l_stex_get_structure_module_str
+ \seq_map_inline:Nn \l_stex_collect_imports_seq {
+ \seq_map_inline:cn {c_stex_module_##1_constants}{
+ \seq_put_right:Nx \l_@@_fields_seq { ##1 ? ####1 }
+ }
}
- \str_clear:N \l_tmpb_str
-
- \prop_get:NnN \l_@@_structure_prop { fields } \l_tmpa_seq
- \seq_map_inline:Nn \l_tmpa_seq {
- \seq_set_split:Nnn \l_tmpb_seq ? { ####1 }
- \seq_get_right:NN \l_tmpb_seq \l_tmpb_str
- \str_if_eq:NNT \l_@@_structure_field_str \l_tmpb_str {
- \seq_map_break:n {
- \str_set:Nn \l_tmpb_str { ####1 }
+
+ \tl_if_empty:nF{#5}{
+ \seq_set_split:Nnn \l_tmpa_seq , {#5}
+ \prop_clear:N \l_tmpa_prop
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \seq_set_split:Nnn \l_tmpb_seq = { ##1 }
+ \int_compare:nNnF { \seq_count:N \l_tmpb_seq } = 2 {
+ \msg_error:nnn{stex}{error/keyval}{##1}
}
+ \exp_args:Nx \stex_get_symbol_in_seq:nn {\seq_item:Nn \l_tmpb_seq 1} \l_@@_fields_seq
+ \str_set_eq:NN \l_@@_dom_str \l_stex_get_symbol_uri_str
+ \exp_args:NNx \seq_remove_all:Nn \l_@@_fields_seq \l_stex_get_symbol_uri_str
+ \exp_args:Nx \stex_get_symbol:n {\seq_item:Nn \l_tmpb_seq 2}
+ \exp_args:Nxx \str_if_eq:nnF
+ {\prop_item:cn{l_stex_symdecl_\l_@@_dom_str _prop}{args}}
+ {\prop_item:cn{l_stex_symdecl_\l_stex_get_symbol_uri_str _prop}{args}}{
+ \msg_error:nnxxxx{stex}{error/incompatible}
+ {\l_@@_dom_str}
+ {\prop_item:cn{l_stex_symdecl_\l_@@_dom_str _prop}{args}}
+ {\l_stex_get_symbol_uri_str}
+ {\prop_item:cn{l_stex_symdecl_\l_stex_get_symbol_uri_str _prop}{args}}
+ }
+ \prop_put:Nxx \l_tmpa_prop {\seq_item:Nn \l_tmpb_seq 1} \l_stex_get_symbol_uri_str
}
}
- \prop_get:cnN { l_stex_symdecl_ \l_tmpb_str _prop } {args}
- \l_tmpb_str
- \tl_if_empty:NTF \l_tmpb_tl {
- \tl_if_empty:NF \l_tmpa_tl {
- \exp_args:Nx \use:n {
- \symdecl{#3/\l_@@_structure_field_str}[args=\l_tmpb_str,def={\exp_args:No\exp_not:n{\l_tmpa_tl}}]
+ \seq_map_inline:Nn \l_@@_fields_seq {
+ \str_set:Nx \l_tmpa_str {field:\l_@@_name_str . \prop_item:cn {l_stex_symdecl_##1_prop}{name} }
+ \stex_debug:nn{instantiate}{Field~\l_tmpa_str :~##1}
+
+ \stex_add_constant_to_current_module:n {\l_tmpa_str}
+ \stex_execute_in_module:x {
+ \prop_set_from_keyval:cn { l_stex_symdecl_ \l_stex_current_module_str?\l_tmpa_str _prop}{
+ name = \l_tmpa_str ,
+ args = \prop_item:cn {l_stex_symdecl_##1_prop}{args} ,
+ arity = \prop_item:cn {l_stex_symdecl_##1_prop}{arity} ,
+ assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs}
}
+ \seq_clear:c {l_stex_symdecl_\l_stex_current_module_str?\l_tmpa_str _notations}
}
- }{
- \tl_if_empty:NTF \l_tmpa_tl {
- \exp_args:Nx \use:n {
- \symdef{#3/\l_@@_structure_field_str}[args=\l_tmpb_str]\exp_after:wN\exp_not:n\exp_after:wN{\l_tmpb_tl}
+
+ \seq_if_empty:cF{l_stex_symdecl_##1_notations}{
+ \stex_find_notation:nn{##1}{}
+ \stex_execute_in_module:x {
+ \seq_put_right:cn {l_stex_symdecl_\l_stex_current_module_str?\l_tmpa_str _notations}{\l_stex_notation_variant_str}
}
- }{
- \exp_args:Nx \use:n {
- \symdef{#3/\l_@@_structure_field_str}[args=\l_tmpb_str,def={\exp_args:No\exp_not:n{\l_tmpa_tl}}]
- \exp_after:wN\exp_not:n\exp_after:wN{\l_tmpb_tl}
+ \stex_copy_control_sequence_ii:ccN
+ {stex_notation_\l_stex_current_module_str?\l_tmpa_str\c_hash_str \l_stex_notation_variant_str _cs}
+ {stex_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}
+ \l_tmpa_tl
+ \exp_args:No \stex_execute_in_module:n \l_tmpa_tl
+
+
+ \cs_if_exist:cT{stex_op_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}{
+ \tl_set_eq:Nc \l_tmpa_cs {stex_op_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}
+ \stex_execute_in_module:x {
+ \tl_set:cn
+ {stex_op_notation_\l_stex_current_module_str?\l_tmpa_str\c_hash_str \l_stex_notation_variant_str _cs}
+ { \exp_args:No \exp_not:n \l_tmpa_cs}
+ }
}
+
}
+
+ \prop_put:Nxx \l_tmpa_prop {\prop_item:cn {l_stex_symdecl_##1_prop}{name}}{\l_stex_current_module_str?\l_tmpa_str}
}
-% \par \prop_item:Nn \l_stex_current_module_prop {ns} ?
-% \prop_item:Nn \l_stex_current_module_prop {name} ?
-% #3/\l_@@_structure_field_str
-% \par
-% \expandafter\present\csname
-% l_stex_symdecl_
-% \prop_item:Nn \l_stex_current_module_prop {ns} ?
-% \prop_item:Nn \l_stex_current_module_prop {name} ?
-% #3/\l_@@_structure_field_str
-% _prop
-% \endcsname
+
+ \stex_execute_in_module:x {
+ \prop_set_from_keyval:cn {l_stex_instance_\l_stex_current_module_str?\l_@@_name_str _prop}{
+ domain = \l_stex_get_structure_module_str ,
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ \tl_set:cn{ #1 }{\stex_invoke_instance:n{ \l_stex_current_module_str?\l_@@_name_str} }
+ }
+ \stex_debug:nn{instantiate}{
+ Instance~\l_stex_current_module_str?\l_@@_name_str \\
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ \exp_args:Nxx \stex_symdecl_do:nn {
+ type={\STEXsymbol{module-type}{
+ \STEXInternalTermMathOMSiiii {
+ \l_stex_get_structure_module_str
+ }{}{0}{}
+ }}
+ }{\l_@@_name_str}
+% {
+ \str_set:Nx \l_stex_get_symbol_uri_str {\l_stex_current_module_str?\l_@@_name_str}
+ \tl_set:Nn \l_stex_notation_after_do_tl {\__stex_notation_final:}
+ \stex_notation_do:nnnnn{}{0}{}{}{\comp{#4}}
+ % }
+ %\exp_args:Nx \notation{\l_@@_name_str}{\comp{#5}}
+ \endgroup
+ \stex_smsmode_do:\ignorespacesandpars
+}
+
+\cs_new_protected:Nn \stex_symbol_or_var:n {
+ \cs_if_exist:cTF{#1}{
+ \cs_set_eq:Nc \l_tmpa_tl { #1 }
+ \str_set:Nx \l_tmpa_str { \cs_argument_spec:N \l_tmpa_tl }
+ \str_if_empty:NTF \l_tmpa_str {
+ \exp_args:Nx \cs_if_eq:NNTF { \tl_head:N \l_tmpa_tl }
+ \stex_invoke_variable:n {
+ \bool_set_true:N \l_stex_symbol_or_var_bool
+ \bool_set_false:N \l_stex_instance_or_symbol_bool
+ \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl}
+ \tl_set:Nx \l_tmpa_tl {\exp_after:wN \use:n \l_tmpa_tl}
+ \str_set:Nx \l_stex_get_symbol_uri_str {
+ \exp_after:wN \use:n \l_tmpa_tl
+ }
+ }{ % TODO \stex_invoke_varinstance:n
+ \exp_args:Nx \cs_if_eq:NNTF { \tl_head:N \l_tmpa_tl } \stex_invoke_varinstance:n {
+ \bool_set_true:N \l_stex_symbol_or_var_bool
+ \bool_set_true:N \l_stex_instance_or_symbol_bool
+ \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl}
+ \tl_set:Nx \l_tmpa_tl {\exp_after:wN \use:n \l_tmpa_tl}
+ \str_set:Nx \l_stex_get_symbol_uri_str {
+ \exp_after:wN \use:n \l_tmpa_tl
+ }
+ }{
+ \bool_set_false:N \l_stex_symbol_or_var_bool
+ \stex_get_symbol:n{#1}
+ }
+ }
+ }{
+ \_@@_symbolorvar_from_string:n{ #1 }
+ }
+ }{
+ \_@@_symbolorvar_from_string:n{ #1 }
}
+}
- \tl_clear:N \l_@@_structure_def_tl
+\cs_new_protected:Nn \_@@_symbolorvar_from_string:n {
+ \prop_if_exist:cTF {l_stex_variable_#1 _prop}{
+ \bool_set_true:N \l_stex_symbol_or_var_bool
+ \str_set:Nn \l_stex_get_symbol_uri_str { #1 }
+ }{
+ \bool_set_false:N \l_stex_symbol_or_var_bool
+ \stex_get_symbol:n{#1}
+ }
+}
- \prop_get:NnN \l_@@_structure_prop { fields } \l_tmpa_seq
- \seq_map_inline:Nn \l_tmpa_seq {
- \seq_set_split:Nnn \l_tmpb_seq ? { ##1 }
- \seq_get_right:NN \l_tmpb_seq \l_tmpa_str
- \exp_args:Nx \use:n {
- \tl_put_right:Nn \exp_not:N \l_@@_structure_def_tl {
+\keys_define:nn { stex / varinstantiate } {
+ name .str_set_x:N = \l_@@_name_str,
+ bind .choices:nn =
+ {forall,exists}
+ {\str_set:Nx \l_@@_bind_str {\l_keys_choice_tl}}
- }
+}
+\cs_new_protected:Nn \_@@_varinstantiate_args:n {
+ \str_clear:N \l_@@_name_str
+ \str_clear:N \l_@@_bind_str
+ \keys_set:nn { stex / varinstantiate } { #1 }
+}
+
+\NewDocumentCommand \varinstantiate {m O{} m m O{}}{
+ \begingroup
+ \stex_get_structure:n {#3}
+ \_@@_varinstantiate_args:n { #2 }
+ \str_if_empty:NT \l_@@_name_str {
+ \str_set:Nn \l_@@_name_str { #1 }
}
+ \stex_if_do_html:TF{
+ \stex_annotate:nnn{varinstance}{\l_@@_name_str}
+ }{\use:n}
+ {
+ \stex_if_do_html:T{
+ \stex_annotate_invisible:nnn{domain}{\l_stex_get_structure_module_str}{}
+ }
+ \seq_clear:N \l_@@_fields_seq
+ \exp_args:Nx \stex_collect_imports:n \l_stex_get_structure_module_str
+ \seq_map_inline:Nn \l_stex_collect_imports_seq {
+ \seq_map_inline:cn {c_stex_module_##1_constants}{
+ \seq_put_right:Nx \l_@@_fields_seq { ##1 ? ####1 }
+ }
+ }
+ \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str
+ \prop_clear:N \l_tmpa_prop
+ \tl_if_empty:nF {#5} {
+ \seq_set_split:Nnn \l_tmpa_seq , {#5}
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \seq_set_split:Nnn \l_tmpb_seq = { ##1 }
+ \int_compare:nNnF { \seq_count:N \l_tmpb_seq } = 2 {
+ \msg_error:nnn{stex}{error/keyval}{##1}
+ }
+ \exp_args:Nx \stex_get_symbol_in_seq:nn {\seq_item:Nn \l_tmpb_seq 1} \l_@@_fields_seq
+ \str_set_eq:NN \l_@@_dom_str \l_stex_get_symbol_uri_str
+ \exp_args:NNx \seq_remove_all:Nn \l_@@_fields_seq \l_stex_get_symbol_uri_str
+ \exp_args:Nx \stex_symbol_or_var:n {\seq_item:Nn \l_tmpb_seq 2}
+ \stex_if_do_html:T{
+ \stex_annotate:nnn{assign}{\l_@@_dom_str,
+ \bool_if:NTF\l_stex_symbol_or_var_bool{var://}{}\l_stex_get_symbol_uri_str}{}
+ }
+ \bool_if:NTF \l_stex_symbol_or_var_bool {
+ \exp_args:Nxx \str_if_eq:nnF
+ {\prop_item:cn{l_stex_symdecl_\l_@@_dom_str _prop}{args}}
+ {\prop_item:cn{l_stex_variable_\l_stex_get_symbol_uri_str _prop}{args}}{
+ \msg_error:nnxxxx{stex}{error/incompatible}
+ {\l_@@_dom_str}
+ {\prop_item:cn{l_stex_symdecl_\l_@@_dom_str _prop}{args}}
+ {\l_stex_get_symbol_uri_str}
+ {\prop_item:cn{l_stex_variable_\l_stex_get_symbol_uri_str _prop}{args}}
+ }
+ \prop_put:Nxx \l_tmpa_prop {\seq_item:Nn \l_tmpb_seq 1} {\stex_invoke_variable:n {\l_stex_get_symbol_uri_str}}
+ }{
+ \exp_args:Nxx \str_if_eq:nnF
+ {\prop_item:cn{l_stex_symdecl_\l_@@_dom_str _prop}{args}}
+ {\prop_item:cn{l_stex_symdecl_\l_stex_get_symbol_uri_str _prop}{args}}{
+ \msg_error:nnxxxx{stex}{error/incompatible}
+ {\l_@@_dom_str}
+ {\prop_item:cn{l_stex_symdecl_\l_@@_dom_str _prop}{args}}
+ {\l_stex_get_symbol_uri_str}
+ {\prop_item:cn{l_stex_symdecl_\l_stex_get_symbol_uri_str _prop}{args}}
+ }
+ \prop_put:Nxx \l_tmpa_prop {\seq_item:Nn \l_tmpb_seq 1} {\stex_invoke_symbol:n {\l_stex_get_symbol_uri_str}}
+ }
+ }
+ }
+ \tl_gclear:N \g_@@_aftergroup_tl
+ \seq_map_inline:Nn \l_@@_fields_seq {
+ \str_set:Nx \l_tmpa_str {\l_@@_name_str . \prop_item:cn {l_stex_symdecl_##1_prop}{name} }
+ \stex_debug:nn{varinstantiate}{Field~\l_tmpa_str :~##1}
+ \seq_if_empty:cF{l_stex_symdecl_##1_notations}{
+ \stex_find_notation:nn{##1}{}
+ \cs_gset_eq:cc{g_@@_tmpa_\l_tmpa_str _cs}
+ {stex_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}
+ \stex_debug:nn{varinstantiate}{Notation:~\cs_meaning:c{g_@@_tmpa_\l_tmpa_str _cs}}
+ \cs_if_exist:cT{stex_op_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}{
+ \cs_gset_eq:cc {g_@@_tmpa_op_\l_tmpa_str _cs}
+ {stex_op_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}
+ \stex_debug:nn{varinstantiate}{Operator~Notation:~\cs_meaning:c{g_@@_tmpa_op_\l_tmpa_str _cs}}
+ }
+ }
- \prop_if_exist:cF {
- l_stex_symdecl_
- \prop_item:Nn \l_stex_current_module_prop {ns} ?
- \prop_item:Nn \l_stex_current_module_prop {name} ?
- #3/\l_tmpa_str
- _prop
- }{
- \prop_get:cnN { l_stex_symdecl_ ##1 _prop } {args}
- \l_tmpb_str
- \exp_args:Nx \use:n {
- \symdecl{#3/\l_tmpa_str}[args=\l_tmpb_str]
+ \exp_args:NNx \tl_gput_right:Nn \g_@@_aftergroup_tl {
+ \prop_set_from_keyval:cn { l_stex_variable_ \l_tmpa_str _prop}{
+ name = \l_tmpa_str ,
+ args = \prop_item:cn {l_stex_symdecl_##1_prop}{args} ,
+ arity = \prop_item:cn {l_stex_symdecl_##1_prop}{arity} ,
+ assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs}
+ }
+ \cs_set_eq:cc {stex_var_notation_\l_tmpa_str _cs}
+ {g_@@_tmpa_\l_tmpa_str _cs}
+ \cs_set_eq:cc {stex_var_op_notation_\l_tmpa_str _cs}
+ {g_@@_tmpa_op_\l_tmpa_str _cs}
+ }
+ \prop_put:Nxx \l_tmpa_prop {\prop_item:cn {l_stex_symdecl_##1_prop}{name}}{\stex_invoke_variable:n {\l_tmpa_str}}
+ }
+ \exp_args:NNx \tl_gput_right:Nn \g_@@_aftergroup_tl {
+ \prop_set_from_keyval:cn {l_stex_varinstance_\l_@@_name_str _prop }{
+ domain = \l_stex_get_structure_module_str ,
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ \tl_set:cn { #1 }{\stex_invoke_varinstance:n {\l_@@_name_str}}
+ \tl_set:cn {l_stex_varinstance_\l_@@_name_str _op_tl}{
+ \exp_args:Nnx \exp_not:N \use:nn {
+ \str_set:Nn \exp_not:N \STEXInternalCurrentSymbolStr {var://\l_@@_name_str}
+ \_stex_term_omv:nn {var://\l_@@_name_str}{
+ \exp_not:n{
+ \_varcomp{#4}
+ }
+ }
+ }{
+ \exp_not:n{\_stex_reset:N \STEXInternalCurrentSymbolStr}
+ }
+ }
}
}
+ \stex_debug:nn{varinstantiate}{\expandafter\detokenize\expandafter{\g_@@_aftergroup_tl}}
+ \aftergroup\g_@@_aftergroup_tl
+ \endgroup
+ \stex_smsmode_do:\ignorespacesandpars
+}
+
+\cs_new_protected:Nn \stex_invoke_instance:n {
+ \peek_charcode_remove:NTF ! {
+ \stex_invoke_symbol:n{#1}
+ }{
+ \_stex_invoke_instance:nn {#1}
}
+}
- \symdecl*{#3}[type={\STEXsymbol{module-type}{
- \_stex_term_math_oms:nnnn {
- \prop_item:Nn \l_@@_structure_prop {ns} ?
- \prop_item:Nn \l_@@_structure_prop {name}
- }{}{0}{}
- }}]
-
- % TODO: -> sms file
- \tl_set:cx{ #3 }{
- \stex_invoke_structure:nnn {
- \prop_item:Nn \l_stex_current_module_prop {ns} ?
- \prop_item:Nn \l_stex_current_module_prop {name} ? #3
- } {
- \prop_item:Nn \l_@@_structure_prop {ns} ?
- \prop_item:Nn \l_@@_structure_prop {name}
+\cs_new_protected:Nn \stex_invoke_varinstance:n {
+ \peek_charcode_remove:NTF ! {
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \use:c{l_stex_varinstance_#1_op_tl}
+ }{
+ \_stex_reset:N \comp
}
+ }{
+ \_stex_invoke_varinstance:nn {#1}
+ }
+}
+
+\cs_new_protected:Nn \_stex_invoke_instance:nn {
+ \prop_if_in:cnTF {l_stex_instance_ #1 _prop}{#2}{
+ \exp_args:Nx \stex_invoke_symbol:n {\prop_item:cn{l_stex_instance_ #1 _prop}{#2}}
+ }{
+ \prop_set_eq:Nc \l_tmpa_prop{l_stex_instance_ #1 _prop}
+ \msg_error:nnxxx{stex}{error/unknownfield}{#2}{#1}{
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ }
+}
+
+\cs_new_protected:Nn \_stex_invoke_varinstance:nn {
+ \prop_if_in:cnTF {l_stex_varinstance_ #1 _prop}{#2}{
+ \prop_get:cnN{l_stex_varinstance_ #1 _prop}{#2}\l_tmpa_tl
+ \l_tmpa_tl
+ }{
+ \msg_error:nnnnn{stex}{error/unknownfield}{#2}{#1}{}
}
- \stex_smsmode_do:
}
% \end{macrocode}
% \end{macro}
@@ -780,5 +1097,6 @@
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-inheritance.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-inheritance.dtx
index 33c536c3a5c..cde0cfa5c3a 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-inheritance.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-inheritance.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -38,6 +38,7 @@
% \fi
%
% \begin{documentation}\label{pkg:inheritance:doc}
+% \changes{3.1.0}{2022/03/10}{SMS mode now loads recursive dependencies \emph{first}}
%
% Code related to Module Inheritance, in particular \emph{sms mode}.
%
@@ -222,6 +223,11 @@
\endinput
\setnotation
\copynotation
+ \assign
+ \renamedecl
+ \donotcopy
+ \instantiate
+ \textsymdecl
}
\exp_args:NNx \seq_set_from_clist:Nn \g_stex_smsmode_allowedenvs_seq {
@@ -229,10 +235,12 @@
smodule,
copymodule,
interpretmodule,
+ realization,
sdefinition,
sexample,
sassertion,
- sparagraph
+ sparagraph,
+ mathstructure
}
}
% \end{macrocode}
@@ -250,7 +258,7 @@
%
% \begin{macro}{\_@@_in_smsmode:nn}
% \begin{macrocode}
-\cs_new_protected:Nn \_@@_in_smsmode:nn {
+\cs_new_protected:Nn \_@@_in_smsmode:nn { \stex_suppress_html:n {
\vbox_set:Nn \l_tmpa_box {
\bool_set_eq:cN { l_@@_#1_bool } \g_@@_bool
\bool_gset_true:N \g_@@_bool
@@ -258,7 +266,7 @@
\bool_gset_eq:Nc \g_@@_bool { l_@@_#1_bool }
}
\box_clear:N \l_tmpa_box
-}
+} }
% \end{macrocode}
% \end{macro}
%
@@ -266,10 +274,104 @@
% \begin{macrocode}
\quark_new:N \q_@@_break
+\NewDocumentCommand \_@@_importmodule: { O{} m} {
+ \seq_gput_right:Nn \l_@@_importmodules_seq {{#1}{#2}}
+ \stex_smsmode_do:
+}
+
+\cs_new_protected:Nn \_@@_module:nn {
+ \__stex_modules_args:n{#1}
+ \stex_if_in_module:F {
+ \str_if_empty:NF \l_stex_module_sig_str {
+ \stex_modules_current_namespace:
+ \str_set:Nx \l_stex_module_name_str { #2 }
+ \stex_if_module_exists:nF{\l_stex_module_ns_str?\l_stex_module_name_str}{
+ \seq_set_eq:NN \l_tmpa_seq \g_stex_currentfile_seq
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpb_seq . \l_tmpa_str
+ \seq_pop_right:NN \l_tmpb_seq \l_tmpa_str % .tex
+ \seq_pop_left:NN \l_tmpb_seq \l_tmpa_str % <filename>
+ \str_set:Nx \l_tmpa_str {
+ \stex_path_to_string:N \l_tmpa_seq /
+ \l_tmpa_str . \l_stex_module_sig_str .tex
+ }
+ \IfFileExists \l_tmpa_str {
+ \exp_args:NNx \seq_gput_right:Nn \l_@@_sigmodules_seq \l_tmpa_str
+ }{
+ \msg_error:nnx{stex}{error/unknownmodule}{for~signature~\l_tmpa_str}
+ }
+ }
+ }
+ }
+}
+
+\prg_new_conditional:Nnn \_@@_check_import_pair:nn {T,F,TF} {
+ %\stex_debug:nn{import-pair}{\detokenize{{#1}~{#2}}}
+ \tl_if_empty:nTF{#1}{
+ \prop_if_exist:NTF \l_stex_current_repository_prop
+ {
+ %\stex_debug:nn{import-pair}{in repository \prop_item:Nn \l_stex_current_repository_prop {id}}
+ \prg_return_true:
+ } {
+ \seq_set_split:Nnn \l_tmpa_seq ? {#2}
+ \seq_get_left:NN \l_tmpa_seq \l_tmpa_tl
+ \tl_if_empty:NT \l_tmpa_tl {
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
+ }
+ %\stex_debug:nn{import-pair}{\seq_use:Nn \l_tmpa_seq,~of~length~\seq_count:N \l_tmpa_seq}
+ \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} > 1
+ \prg_return_true: \prg_return_false:
+ }
+ }\prg_return_true:
+}
+
\cs_new_protected:Nn \stex_file_in_smsmode:nn {
\stex_filestack_push:n{#1}
+ \seq_gclear:N \l_@@_importmodules_seq
+ \seq_gclear:N \l_@@_sigmodules_seq
+ % ----- new -----------------------------
+ \_@@_in_smsmode:nn{#1}{
+ \let\importmodule\_@@_importmodule:
+ \let\stex_module_setup:nn\_@@_module:nn
+ \let\__stex_modules_begin_module:\relax
+ \let\__stex_modules_end_module:\relax
+ \seq_clear:N \g_stex_smsmode_allowedenvs_seq
+ \exp_args:NNx \seq_put_right:Nn \g_stex_smsmode_allowedenvs_seq {\tl_to_str:n{smodule}}
+ \tl_clear:N \g_stex_smsmode_allowedmacros_tl
+ \tl_clear:N \g_stex_smsmode_allowedmacros_escape_tl
+ \tl_put_right:Nn \g_stex_smsmode_allowedmacros_escape_tl {\importmodule}
+ \everyeof{\q_@@_break\noexpand}
+ \expandafter\expandafter\expandafter
+ \stex_smsmode_do:
+ \csname @ @ input\endcsname "#1"\relax
+
+ \seq_map_inline:Nn \l_@@_sigmodules_seq {
+ \stex_filestack_push:n{##1}
+ \expandafter\expandafter\expandafter
+ \stex_smsmode_do:
+ \csname @ @ input\endcsname "##1"\relax
+ \stex_filestack_pop:
+ }
+ }
+ % ----- new -----------------------------
\_@@_in_smsmode:nn{#1} {
#2
+ % ----- new -----------------------------
+ \begingroup
+ %\stex_debug:nn{smsmode}{Here:~\seq_use:Nn\l_@@_importmodules_seq, }
+ \seq_map_inline:Nn \l_@@_importmodules_seq {
+ \_@@_check_import_pair:nnT ##1 { \begingroup
+ \stex_import_module_uri:nn ##1
+ \stex_import_require_module:nnnn
+ \l_stex_import_ns_str
+ \l_stex_import_archive_str
+ \l_stex_import_path_str
+ \l_stex_import_name_str \endgroup
+ }
+ }
+ \endgroup
+ \stex_debug:nn{smsmode}{Actually~loading~file~#1}
+ % ----- new -----------------------------
\everyeof{\q_@@_break\noexpand}
\expandafter\expandafter\expandafter
\stex_smsmode_do:
@@ -360,7 +462,7 @@
{\str_if_empty_p:N \l_stex_import_path_str}
{\stex_if_module_exists_p:n { \l_stex_module_ns_str ? \l_stex_import_name_str } }
}{
- \str_set_eq:NN \l_stex_import_path_str \l_stex_modules_subpath_str
+ \str_set_eq:NN \l_stex_import_path_str \l_stex_module_subpath_str
\str_set_eq:NN \l_stex_import_ns_str \l_stex_module_ns_str
}{
\str_if_empty:NT \l_stex_import_archive_str {
@@ -370,9 +472,11 @@
}
\str_if_empty:NTF \l_stex_import_archive_str {
\str_if_empty:NF \l_stex_import_path_str {
- \str_set:Nx \l_stex_import_ns_str {
- \l_stex_module_ns_str / \l_stex_import_path_str
+ \stex_path_from_string:Nn \l_tmpb_seq {
+ \l_stex_module_ns_str / .. / \l_stex_import_path_str
}
+ \str_set:Nx \l_stex_import_ns_str {\stex_path_to_string:N \l_tmpb_seq}
+ \str_replace_once:Nnn \l_stex_import_ns_str {file:/} {file://}
}
}{
\stex_require_repository:n \l_stex_import_archive_str
@@ -407,10 +511,18 @@
\cs_new_protected:Nn \stex_import_require_module:nnnn {
\exp_args:Nx \stex_if_module_exists:nF { #1 ? #4 } {
+ \stex_debug:nn{requiremodule}{Here:\\~~1:~#1\\~~2:~#2\\~~3:~#3\\~~4:~#4}
+
+ \exp_args:NNxx \seq_set_split:Nnn \l_tmpa_seq {\tl_to_str:n{/}} {#4}
+ \seq_get_left:NN \l_tmpa_seq \l_tmpc_str
+
+ %\stex_debug:nn{requiremodule}{Top~module:\l_tmpc_str}
+
% archive
\str_set:Nx \l_tmpa_str { #2 }
\str_if_empty:NTF \l_tmpa_str {
\seq_set_eq:NN \l_tmpa_seq \g_stex_currentfile_seq
+ \seq_put_right:Nn \l_tmpa_seq {..}
} {
\stex_path_from_string:Nn \l_tmpb_seq { \l_tmpa_str }
\seq_concat:NNN \l_tmpa_seq \c_stex_mathhub_seq \l_tmpb_seq
@@ -420,7 +532,7 @@
% path
\str_set:Nx \l_tmpb_str { #3 }
\str_if_empty:NTF \l_tmpb_str {
- \str_set:Nx \l_tmpa_str { \stex_path_to_string:N \l_tmpa_seq / #4 }
+ \str_set:Nx \l_tmpa_str { \stex_path_to_string:N \l_tmpa_seq / \l_tmpc_str }
\ltx@ifpackageloaded{babel} {
\exp_args:NNx \prop_get:NnNF \c_stex_language_abbrevs_prop
@@ -431,16 +543,16 @@
\str_clear:N \l_tmpb_str
}
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.\l_tmpb_str.tex}
+ \stex_debug:nn{modules}{Checking~a1~\l_tmpa_str.\l_tmpb_str.tex}
\IfFileExists{ \l_tmpa_str.\l_tmpb_str.tex }{
\str_gset:Nx \g_@@_file_str { \l_tmpa_str.\l_tmpb_str.tex }
}{
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.tex}
+ \stex_debug:nn{modules}{Checking~a2~\l_tmpa_str.tex}
\IfFileExists{ \l_tmpa_str.tex }{
\str_gset:Nx \g_@@_file_str { \l_tmpa_str.tex }
}{
% try english as default
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.en.tex}
+ \stex_debug:nn{modules}{Checking~a3~\l_tmpa_str.en.tex}
\IfFileExists{ \l_tmpa_str.en.tex }{
\str_gset:Nx \g_@@_file_str { \l_tmpa_str.en.tex }
}{
@@ -451,7 +563,7 @@
} {
\seq_set_split:NnV \l_tmpb_seq / \l_tmpb_str
- \seq_concat:NNN \l_tmpa_seq \l_tmpa_seq \l_tmpb_seq
+ \seq_concat:NNN \l_tmpb_seq \l_tmpa_seq \l_tmpb_seq
\ltx@ifpackageloaded{babel} {
\exp_args:NNx \prop_get:NnNF \c_stex_language_abbrevs_prop
@@ -462,31 +574,32 @@
\str_clear:N \l_tmpb_str
}
- \stex_path_to_string:NN \l_tmpa_seq \l_tmpa_str
+ \stex_path_canonicalize:N \l_tmpb_seq
+ \stex_path_to_string:NN \l_tmpb_seq \l_tmpa_str
- \stex_debug:nn{modules}{Checking~\l_tmpa_str/#4.\l_tmpb_str.tex}
- \IfFileExists{ \l_tmpa_str/#4.\l_tmpb_str.tex }{
- \str_gset:Nx \g_@@_file_str { \l_tmpa_str/#4.\l_tmpb_str.tex }
+ \stex_debug:nn{modules}{Checking~b1~\l_tmpa_str/\l_tmpc_str.\l_tmpb_str.tex}
+ \IfFileExists{ \l_tmpa_str/\l_tmpc_str.\l_tmpb_str.tex }{
+ \str_gset:Nx \g_@@_file_str { \l_tmpa_str/\l_tmpc_str.\l_tmpb_str.tex }
}{
- \stex_debug:nn{modules}{Checking~\l_tmpa_str/#4.tex}
- \IfFileExists{ \l_tmpa_str/#4.tex }{
- \str_gset:Nx \g_@@_file_str { \l_tmpa_str/#4.tex }
+ \stex_debug:nn{modules}{Checking~b2~\l_tmpa_str/\l_tmpc_str.tex}
+ \IfFileExists{ \l_tmpa_str/\l_tmpc_str.tex }{
+ \str_gset:Nx \g_@@_file_str { \l_tmpa_str/\l_tmpc_str.tex }
}{
% try english as default
- \stex_debug:nn{modules}{Checking~\l_tmpa_str/#4.en.tex}
- \IfFileExists{ \l_tmpa_str/#4.en.tex }{
- \str_gset:Nx \g_@@_file_str { \l_tmpa_str/#4.en.tex }
+ \stex_debug:nn{modules}{Checking~b3~\l_tmpa_str/\l_tmpc_str.en.tex}
+ \IfFileExists{ \l_tmpa_str/\l_tmpc_str.en.tex }{
+ \str_gset:Nx \g_@@_file_str { \l_tmpa_str/\l_tmpc_str.en.tex }
}{
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.\l_tmpb_str.tex}
+ \stex_debug:nn{modules}{Checking~b4~\l_tmpa_str.\l_tmpb_str.tex}
\IfFileExists{ \l_tmpa_str.\l_tmpb_str.tex }{
\str_gset:Nx \g_@@_file_str { \l_tmpa_str.\l_tmpb_str.tex }
}{
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.tex}
+ \stex_debug:nn{modules}{Checking~b4~\l_tmpa_str.tex}
\IfFileExists{ \l_tmpa_str.tex }{
\str_gset:Nx \g_@@_file_str { \l_tmpa_str.tex }
}{
% try english as default
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.en.tex}
+ \stex_debug:nn{modules}{Checking~b5~\l_tmpa_str.en.tex}
\IfFileExists{ \l_tmpa_str.en.tex }{
\str_gset:Nx \g_@@_file_str { \l_tmpa_str.en.tex }
}{
@@ -499,21 +612,24 @@
}
}
- \exp_args:No \stex_file_in_smsmode:nn { \g_@@_file_str } {
- \seq_clear:N \l_stex_all_modules_seq
- \str_clear:N \l_stex_current_module_str
- \str_set:Nx \l_tmpb_str { #2 }
- \str_if_empty:NF \l_tmpb_str {
- \stex_set_current_repository:n { #2 }
+ \str_if_eq:eeF{\g_@@_file_str}{\seq_use:Nn \g_stex_currentfile_seq /}{
+ \exp_args:No \stex_file_in_smsmode:nn { \g_@@_file_str } {
+ \seq_clear:N \l_stex_all_modules_seq
+ \str_clear:N \l_stex_current_module_str
+ \str_set:Nx \l_tmpb_str { #2 }
+ \str_if_empty:NF \l_tmpb_str {
+ \stex_set_current_repository:n { #2 }
+ }
+ \stex_debug:nn{modules}{Loading~\g_@@_file_str}
}
- \stex_debug:nn{modules}{Loading~\g_@@_file_str}
- }
-
- \stex_if_module_exists:nF { #1 ? #4 } {
- \msg_error:nnx{stex}{error/unknownmodule}{
- #1?#4~(in~file~\g_@@_file_str)
+
+ \stex_if_module_exists:nF { #1 ? #4 } {
+ \msg_error:nnx{stex}{error/unknownmodule}{
+ #1?#4~(in~file~\g_@@_file_str)
+ }
}
}
+
}
\stex_activate_module:n { #1 ? #4 }
}
@@ -527,10 +643,10 @@
\stex_debug:nn{modules}{Importing~module:~
\l_stex_import_ns_str ? \l_stex_import_name_str
}
+ \stex_import_require_module:nnnn
+ { \l_stex_import_ns_str } { \l_stex_import_archive_str }
+ { \l_stex_import_path_str } { \l_stex_import_name_str }
\stex_if_smsmode:F {
- \stex_import_require_module:nnnn
- { \l_stex_import_ns_str } { \l_stex_import_archive_str }
- { \l_stex_import_path_str } { \l_stex_import_name_str }
\stex_annotate_invisible:nnn
{import} {\l_stex_import_ns_str ? \l_stex_import_name_str} {}
}
@@ -567,9 +683,25 @@
% \end{macro}
%
% \begin{macrocode}
+\cs_new_protected:Nn \stex_csl_to_imports:Nn {
+ \tl_if_empty:nF{#2}{
+ \clist_set:Nn \l_tmpa_clist {#2}
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \tl_if_head_eq_charcode:nNTF {##1}[{
+ #1 ##1
+ }{
+ #1{##1}
+ }
+ }
+ }
+}
+\cs_generate_variant:Nn \stex_csl_to_imports:Nn {No}
+
+
%</package>
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-mathhub.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-mathhub.dtx
index 20288212e35..89da6af2fb0 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-mathhub.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-mathhub.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -39,6 +39,7 @@
%
%
% \begin{documentation}\label{pkg:mathhub:doc}
+% \changes{3.1.0}{2022/03/09}{Fixed a bug with \textbackslash inputref outside of archives}
%
% This sub package provides code for handling \sTeX archives,
% files, file paths and related methods.
@@ -100,14 +101,15 @@
%
% \begin{variable}{\mathhub, \c_stex_mathhub_seq, \c_stex_mathhub_str}
% We determine the path to the local MathHub folder via one of
-% three means, in order of precedence:
+% four means, in order of precedence:
% \begin{enumerate}
% \item The |mathhub| package option, or
% \item the |\mathhub|-macro, if it has been defined before
% the |\usepackage{stex}|-statement, or
-% \item the |MATHHUB| system variable.
+% \item the |MATHHUB| system variable, or
+% \item a path specified in |~/.stex/mathhub.path|.
% \end{enumerate}
-% In all three cases, \cs{c_stex_mathhub_seq} and
+% In all four cases, \cs{c_stex_mathhub_seq} and
% \cs{c_stex_mathhub_str} are set accordingly.
% \end{variable}
%
@@ -359,8 +361,11 @@
% \begin{macro}{\stex_kpsewhich:n}
% \begin{macrocode}
\str_new:N\l_stex_kpsewhich_return_str
-\cs_new_protected:Nn \stex_kpsewhich:n {
+\cs_new_protected:Nn \stex_kpsewhich:n {\begingroup
+ \catcode`\ =12
\sys_get_shell:nnN { kpsewhich ~ #1 } { } \l_tmpa_tl
+ \tl_gset_eq:NN \l_tmpa_tl \l_tmpa_tl
+ \endgroup
\exp_args:NNo\str_set:Nn\l_stex_kpsewhich_return_str{\l_tmpa_tl}
\tl_trim_spaces:N \l_stex_kpsewhich_return_str
}
@@ -483,7 +488,27 @@
\stex_kpsewhich:n{-var-value~MATHHUB}
}
\str_set_eq:NN\c_stex_mathhub_str\l_stex_kpsewhich_return_str
-
+
+ \str_if_empty:NT \c_stex_mathhub_str {
+ \sys_if_platform_windows:TF{
+ \begingroup\escapechar=-1\catcode`\\=12
+ \exp_args:Nx\stex_kpsewhich:n{-var-value~HOME}
+ \exp_args:NNx\str_replace_all:Nnn\l_stex_kpsewhich_return_str{\c_backslash_str}/
+ \exp_args:Nnx\use:nn{\endgroup}{\str_set:Nn\exp_not:N\l_stex_kpsewhich_return_str{\l_stex_kpsewhich_return_str}}
+ }{
+ \stex_kpsewhich:n{-var-value~HOME}
+ }
+ \ior_open:NnT \l_tmpa_ior{\l_stex_kpsewhich_return_str / .stex / mathhub.path}{
+ \begingroup\escapechar=-1\catcode`\\=12
+ \ior_str_get:NN \l_tmpa_ior \l_tmpa_str
+ \sys_if_platform_windows:T{
+ \exp_args:NNx\str_replace_all:Nnn\l_tmpa_str{\c_backslash_str}/
+ }
+ \str_gset_eq:NN \c_stex_mathhub_str\l_tmpa_str
+ \endgroup
+ \ior_close:N \l_tmpa_ior
+ }
+ }
\str_if_empty:NTF\c_stex_mathhub_str{
\msg_warning:nn{stex}{warning/nomathhub}
}{
@@ -518,6 +543,7 @@
\msg_error:nnxx{stex}{error/norepository}{#1}{
\stex_path_to_string:N \c_stex_mathhub_str
}
+ \input{Fatal~Error!}
} {
\exp_args:No \_@@_parse_manifest:n { \l_tmpa_str }
}
@@ -631,6 +657,11 @@
}{}
}
\ior_close:N \c_@@_manifest_ior
+ \stex_persist:x {
+ \prop_set_from_keyval:cn{ c_stex_mathhub_#1_manifest_prop }{
+ \exp_after:wN \prop_to_keyval:N \csname c_stex_mathhub_#1_manifest_prop\endcsname
+ }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -664,19 +695,20 @@
%
% \begin{macrocode}
%\prop_new:N \l_stex_current_repository_prop
-
-\_@@_find_manifest:N \c_stex_pwd_seq
-\seq_if_empty:NTF \l_@@_manifest_file_seq {
- \stex_debug:nn{mathhub}{Not~currently~in~a~MathHub~repository}
-} {
- \_@@_parse_manifest:n { main }
- \prop_get:NnN \c_stex_mathhub_main_manifest_prop {id}
- \l_tmpa_str
- \prop_set_eq:cN { c_stex_mathhub_\l_tmpa_str _manifest_prop }
- \c_stex_mathhub_main_manifest_prop
- \exp_args:Nx \stex_set_current_repository:n { \l_tmpa_str }
- \stex_debug:nn{mathhub}{Current~repository:~
- \prop_item:Nn \l_stex_current_repository_prop {id}
+\bool_if:NF \c_stex_persist_mode_bool {
+ \_@@_find_manifest:N \c_stex_pwd_seq
+ \seq_if_empty:NTF \l_@@_manifest_file_seq {
+ \stex_debug:nn{mathhub}{Not~currently~in~a~MathHub~repository}
+ } {
+ \_@@_parse_manifest:n { main }
+ \prop_get:NnN \c_stex_mathhub_main_manifest_prop {id}
+ \l_tmpa_str
+ \prop_set_eq:cN { c_stex_mathhub_\l_tmpa_str _manifest_prop }
+ \c_stex_mathhub_main_manifest_prop
+ \exp_args:Nx \stex_set_current_repository:n { \l_tmpa_str }
+ \stex_debug:nn{mathhub}{Current~repository:~
+ \prop_item:Nn \l_stex_current_repository_prop {id}
+ }
}
}
% \end{macrocode}
@@ -759,26 +791,43 @@
}
}
\NewDocumentCommand \mhinput { O{} m}{
- \stex_mhinput:nn{ #1 }{ #2 }
+ \_@@_mhinput:nn{ #1 }{ #2 }
}
\cs_new_protected:Nn \_@@_inputref:nn {
\stex_in_repository:nn {#1} {
- \bool_lazy_any:nTF {
- {\rustex_if_p:}
- {\latexml_if_p:}
- } {
+ \stex_html_backend:TF {
\str_clear:N \l_tmpa_str
\prop_get:NnNF \l_stex_current_repository_prop { narr } \l_tmpa_str {
\prop_get:NnNF \l_stex_current_repository_prop { ns } \l_tmpa_str {}
}
- \stex_annotate_invisible:nnn{inputref}{
- \l_tmpa_str / #2
- }{}
+
+ \tl_if_empty:nTF{ ##1 }{
+ \IfFileExists{#2}{
+ \stex_annotate_invisible:nnn{inputref}{
+ \l_tmpa_str / #2
+ }{}
+ }{
+ \input{#2}
+ }
+ }{
+ \IfFileExists{ \c_stex_mathhub_str / ##1 / source / #2 }{
+ \stex_annotate_invisible:nnn{inputref}{
+ \l_tmpa_str / #2
+ }{}
+ }{
+ \input{ \c_stex_mathhub_str / ##1 / source / #2 }
+ }
+ }
+
}{
\begingroup
\inputreftrue
- \input{ \c_stex_mathhub_str / ##1 / source / #2 }
+ \tl_if_empty:nTF{ ##1 }{
+ \input{#2}
+ }{
+ \input{ \c_stex_mathhub_str / ##1 / source / #2 }
+ }
\endgroup
}
}
@@ -888,10 +937,10 @@
\AddToHook{begindocument}{
\ltx@ifpackageloaded{graphicx}{
\define@key{Gin}{mhrepos}{\def\Gin@mhrepos{#1}}
- \newcommand\mhgraphics[2][]{%
+ \providecommand\mhgraphics[2][]{%
\def\Gin@mhrepos{}\setkeys{Gin}{#1}%
\includegraphics[#1]{\mhpath\Gin@mhrepos{#2}}}
- \newcommand\cmhgraphics[2][]{\begin{center}\mhgraphics[#1]{#2}\end{center}}
+ \providecommand\cmhgraphics[2][]{\begin{center}\mhgraphics[#1]{#2}\end{center}}
}{}
% \end{macrocode}
% \end{macro}
@@ -912,5 +961,6 @@
% \end{macro}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-metatheory.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-metatheory.dtx
index b7e32c23e98..8570531d175 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-metatheory.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-metatheory.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -41,20 +41,6 @@
%
% \begin{documentation}\label{pkg:metatheory:doc}
%
-% The default meta theory for an \sTeX module. Contains
-% 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).
-%
-% 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.
-%
% \section{Symbols}\label{pkg:metatheory:symbols}
%
% \end{documentation}
@@ -69,7 +55,7 @@
%%%%%%%%%%%%% metatheory.dtx %%%%%%%%%%%%%
-\str_const:Nn \c_stex_metatheory_ns_str {http://mathhub.info/sTeX}
+\str_const:Nn \c_stex_metatheory_ns_str {http://mathhub.info/sTeX/meta}
\begingroup
\stex_module_setup:nn{
ns=\c_stex_metatheory_ns_str,
@@ -82,15 +68,21 @@
\csname stex_suppress_html:n\endcsname{
% is-a (a:A, a \in A, a is an A, etc.)
\symdecl{isa}[args=ai]
- \notation{isa}[typed]{#1 \comp{:} #2}{##1 \comp, ##2}
+ \notation{isa}[typed,op=:]{#1 \comp{:} #2}{##1 \comp, ##2}
\notation{isa}[in]{#1 \comp\in #2}{##1 \comp, ##2}
\notation{isa}[pred]{#2\comp(#1 \comp)}{##1 \comp, ##2}
% bind (\forall, \Pi, \lambda etc.)
- \symdecl{bind}[args=Bi]
+ \symdecl{bind}[args=Bi,assoc=pre]
+ \notation{bind}[depfun,prec=nobrackets,op={(\cdot)\;\to\;\cdot}]{\comp( #1 \comp{)\;\to\;} #2}{##1 \comp, ##2}
\notation{bind}[forall]{\comp\forall #1.\;#2}{##1 \comp, ##2}
\notation{bind}[Pi]{\comp\prod_{#1}#2}{##1 \comp, ##2}
- \notation{bind}[depfun]{\comp( #1 \comp{)\;\to\;} #2}{##1 \comp, ##2}
+
+ % implicit bind
+ \symdecl{implicitbind}[args=Bi,assoc=pre]
+ \notation{implicitbind}[braces,prec=nobrackets,op={\{\cdot\}_I\;\cdot}]{\comp\{ #1 \comp{\}_I\;} #2}{##1 \comp, ##2}
+ \notation{implicitbind}[depfun,prec=nobrackets]{\comp( #1 \comp{)\;\to_I\;} #2}{##1 \comp, ##2}
+ \notation{implicitbind}[Pi]{\comp\prod^I_{#1}#2}{##1\comp,##2}
% dummy variable
\symdecl{dummyvar}
@@ -111,23 +103,34 @@
% function/operator application
\symdecl{apply}[args=ia]
- \notation{apply}[prec=0;0x\infprec,parens]{#1 \comp( #2 \comp)}{##1 \comp, ##2}
+ \notation{apply}[prec=0;0x\infprec,parens,op=\cdot(\cdot)]{#1 \comp( #2 \comp)}{##1 \comp, ##2}
\notation{apply}[prec=0;0x\infprec,lambda]{#1 \; #2 }{##1 \; ##2}
- % ``type'' of all collections (sets,classes,types,kinds)
- \symdecl{collection}
- \notation{collection}[U]{\comp{\mathcal{U}}}
- \notation{collection}[set]{\comp{\textsf{Set}}}
-
% collection of propositions/booleans/truth values
\symdecl{prop}[name=proposition]
\notation{prop}[prop]{\comp{{\rm prop}}}
\notation{prop}[BOOL]{\comp{{\rm BOOL}}}
+ \symdecl{judgmentholds}[args=1]
+ \notation{judgmentholds}[vdash,op=\vdash]{\comp\vdash\; #1}
+
% sequences
\symdecl{seqtype}[args=1]
\notation{seqtype}[kleene]{#1^{\comp\ast}}
+ \symdecl{seqexpr}[args=a]
+ \notation{seqexpr}[angle,prec=nobrackets]{\comp\langle #1\comp\rangle}{##1\comp,##2}
+
+ \symdef{seqmap}[args=abi,setlike]{\comp\{#3 \comp| #2\comp\in \dobrackets{#1} \comp\}}{##1 \comp, ##2}
+ \symdef{seqprepend}[args=ia]{#1 \comp{::} #2}{##1 \comp, ##2}
+ \symdef{seqappend}[args=ai]{#1 \comp{::} #2}{##1 \comp, ##2}
+ \symdef{seqfoldleft}[args=iabbi]{ \comp{foldl}\dobrackets{#1,#2}\dobrackets{#3\comp,#4\comp\mapsto#5}}{##1 \comp, ##2}
+ \symdef{seqfoldright}[args=iabbi,op=foldr]{ \comp{foldr}\dobrackets{#1,#2}\dobrackets{#3\comp,#4\comp\mapsto#5}}{##1 \comp, ##2}
+ \symdef{seqhead}[args=a]{\comp{head}\dobrackets{#1}}{##1 \comp, ##2}
+ \symdef{seqtail}[args=a]{\comp{tail}\dobrackets{#1}}{##1 \comp, ##2}
+ \symdef{seqlast}[args=a]{\comp{last}\dobrackets{#1}}{##1 \comp, ##2}
+ \symdef{seqinit}[args=a]{\comp{tail}\dobrackets{#1}}{##1 \comp, ##2}
+
\symdef{sequence-index}[args=2,li,prec=nobrackets]{{#1}_{#2}}
\notation{sequence-index}[ui,prec=nobrackets]{{#1}^{#2}}
@@ -135,6 +138,9 @@
\symdef{aseqfromto}[args=ai,prec=nobrackets]{#1\comp{,\ellipses,}#2}{##1\comp,##2}
\symdef{aseqfromtovia}[args=aii,prec=nobrackets]{#1\comp{,\ellipses,}#2\comp{,\ellipses,}#3}{##1\comp,##2}
+ % nat literals
+ \symdef{natliteral}{\comp{\mathtt{Ord}}}
+
% letin (``let'', local definitions, variable substitution)
\symdecl{letin}[args=bii]
\notation{letin}[let]{\comp{{\rm let}}\;#1\comp{=}#2\;\comp{{\rm in}}\;#3}
@@ -143,21 +149,27 @@
% structures
\symdecl*{module-type}[args=1]
- \notation{module-type}{\mathtt{MOD} #1}
+ \notation{module-type}{\comp{\mathtt{MOD}} #1}
\symdecl{mathstruct}[name=mathematical-structure,args=a] % TODO
\notation{mathstruct}[angle,prec=nobrackets]{\comp\langle #1 \comp\rangle}{##1 \comp, ##2}
+ % objects
+ \symdecl{object}
+ \notation{object}{\comp{\mathtt{OBJECT}}}
+
}
+
+% The following are abbreviations in the sTeX corpus that are left over from earlier
+% developments. They will eventually be phased out.
+
\ExplSyntaxOn
\stex_add_to_current_module:n{
- \let\nappa\apply
\def\nappli#1#2#3#4{\apply{#1}{\naseqli{#2}{#3}{#4}}}
\def\nappui#1#2#3#4{\apply{#1}{\nasequi{#2}{#3}{#4}}}
\def\livar{\csname sequence-index\endcsname[li]}
\def\uivar{\csname sequence-index\endcsname[ui]}
\def\naseqli#1#2#3{\aseqfromto{\livar{#1}{#2}}{\livar{#1}{#3}}}
\def\nasequi#1#2#3{\aseqfromto{\uivar{#1}{#2}}{\uivar{#1}{#3}}}
- \def\nappe#1#2#3{\apply{#1}{\aseqfromto{#2}{#3}}}
}
\_@@_end_module:
\endgroup
@@ -171,7 +183,7 @@
% \end{implementation}
%
% \PrintIndex
-
+% \ifinfulldoc\else\printbibliography\fi
% \endinput
% Local Variables:
% mode: doctex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-modules.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-modules.dtx
index d5c10964ded..5430bd153ad 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-modules.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-modules.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -140,8 +140,8 @@
% is |http://some.namespace/foo/sub/file|. Otherwise, the namespace
% is the absolute file path of the current file (i.e. starting with |file:///|).
%
-% The result is stored in |\l_stex_modules_ns_str|. Additionally, the sub path
-% relative to the current repository is stored in |\l_stex_modules_subpath_str|.
+% The result is stored in |\l_stex_module_ns_str|. Additionally, the sub path
+% relative to the current repository is stored in |\l_stex_module_subpath_str|.
% \end{function}
%
% \subsection{The \texttt{smodule} environment}
@@ -280,21 +280,26 @@
% Only allowed within modules:
%
% \begin{macrocode}
+\cs_new_protected:Nn \stex_execute_in_module:n { \stex_if_in_module:T {
+ \stex_add_to_current_module:n { #1 }
+ \stex_do_up_to_module:n { #1 }
+}}
+\cs_generate_variant:Nn \stex_execute_in_module:n {x}
+
\cs_new_protected:Nn \stex_add_to_current_module:n {
\tl_gput_right:cn {c_stex_module_\l_stex_current_module_str _code} { #1 }
}
+\cs_generate_variant:Nn \stex_add_to_current_module:n {x}
\cs_new_protected:Npn \STEXexport {
- \begingroup
- \newlinechar=-1\relax
- \endlinechar=-1\relax
- %\catcode`\ = 9\relax
- \expandafter\endgroup\_@@_export:n
+ \ExplSyntaxOn
+ \_@@_export:n
}
\cs_new_protected:Nn \_@@_export:n {
- \ignorespaces #1
- \stex_add_to_current_module:n { \ignorespaces #1 }
+ \ignorespacesandpars#1\ExplSyntaxOff
+ \stex_add_to_current_module:n { \ignorespacesandpars#1}
\stex_smsmode_do:
}
+\let \stex_module_export_helper:n \use:n
\stex_deactivate_macro:Nn \STEXexport {module~environments}
% \end{macrocode}
% \end{macro}
@@ -342,25 +347,35 @@
% \begin{macro}{\stex_do_up_to_module:n}
% \begin{macrocode}
\int_new:N \l_@@_group_depth_int
-\tl_new:N \l_@@_aftergroup_tl
\cs_new_protected:Nn \stex_do_up_to_module:n {
\int_compare:nNnTF \l_@@_group_depth_int = \currentgrouplevel {
#1
}{
#1
- \expandafter \tl_gset:Nn \expandafter \l_@@_aftergroup_tl \expandafter { \l_@@_aftergroup_tl #1 }
+ \expandafter \tl_gset:Nn
+ \csname l_@@_aftergroup_\l_stex_current_module_str _tl
+ \expandafter\expandafter\expandafter\endcsname
+ \expandafter\expandafter\expandafter { \csname
+ l_@@_aftergroup_\l_stex_current_module_str _tl\endcsname #1 }
\aftergroup\_@@_aftergroup_do:
}
}
+\cs_generate_variant:Nn \stex_do_up_to_module:n {x}
\cs_new_protected:Nn \_@@_aftergroup_do: {
+ \stex_debug:nn{aftergroup}{\cs_meaning:c{
+ l_@@_aftergroup_\l_stex_current_module_str _tl
+ }}
\int_compare:nNnTF \l_@@_group_depth_int = \currentgrouplevel {
- \l_@@_aftergroup_tl
- \tl_clear:N \l_@@_aftergroup_tl
+ \use:c{l_@@_aftergroup_\l_stex_current_module_str _tl}
+ \tl_gclear:c{l_@@_aftergroup_\l_stex_current_module_str _tl}
}{
- \l_@@_aftergroup_tl
+ \use:c{l_@@_aftergroup_\l_stex_current_module_str _tl}
\aftergroup\_@@_aftergroup_do:
}
}
+\cs_new_protected:Nn \_stex_reset_up_to_module:n {
+ \expandafter\let\csname l_@@_aftergroup_#1_tl\endcsname\undefined
+}
% \end{macrocode}
% \end{macro}
%
@@ -381,16 +396,15 @@
% MathHub repository (if existent) and the current file.
%
% \begin{macrocode}
-\str_new:N \l_stex_modules_ns_str
-\str_new:N \l_stex_modules_subpath_str
+\str_new:N \l_stex_module_ns_str
+\str_new:N \l_stex_module_subpath_str
\cs_new_protected:Nn \_@@_compute_namespace:nN {
- \str_set:Nx \l_tmpa_str { #1 }
\seq_set_eq:NN \l_tmpa_seq #2
% split off file extension
- \seq_pop_right:NN \l_tmpa_seq \l_tmpb_str
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpb_str % <- filename
\exp_args:NNno \seq_set_split:Nnn \l_tmpb_seq . \l_tmpb_str
- \seq_get_left:NN \l_tmpb_seq \l_tmpb_str
- \seq_put_right:No \l_tmpa_seq \l_tmpb_str
+ \seq_get_left:NN \l_tmpb_seq \l_tmpb_str % <- filename without suffixes
+ \seq_put_right:No \l_tmpa_seq \l_tmpb_str % <- file path including name without suffixes
\bool_set_true:N \l_tmpa_bool
\bool_while_do:Nn \l_tmpa_bool {
@@ -404,18 +418,19 @@
}
}
- \stex_path_to_string:NN \l_tmpa_seq \l_stex_modules_subpath_str
- \str_if_empty:NTF \l_stex_modules_subpath_str {
- \str_set_eq:NN \l_stex_modules_ns_str \l_tmpa_str
+ \stex_path_to_string:NN \l_tmpa_seq \l_stex_module_subpath_str
+ % \l_tmpa_seq <- sub-path relative to archive
+ \str_if_empty:NTF \l_stex_module_subpath_str {
+ \str_set:Nx \l_stex_module_ns_str {#1}
}{
- \str_set:Nx \l_stex_modules_ns_str {
- \l_tmpa_str/\l_stex_modules_subpath_str
+ \str_set:Nx \l_stex_module_ns_str {
+ #1/\l_stex_module_subpath_str
}
}
}
\cs_new_protected:Nn \stex_modules_current_namespace: {
- \str_clear:N \l_stex_modules_subpath_str
+ \str_clear:N \l_stex_module_subpath_str
\prop_if_exist:NTF \l_stex_current_repository_prop {
\prop_get:NnN \l_stex_current_repository_prop { ns } \l_tmpa_str
\_@@_compute_namespace:nN \l_tmpa_str \g_stex_currentfile_seq
@@ -426,7 +441,7 @@
\exp_args:NNno \seq_set_split:Nnn \l_tmpb_seq . \l_tmpb_str
\seq_get_left:NN \l_tmpb_seq \l_tmpb_str
\seq_put_right:No \l_tmpa_seq \l_tmpb_str
- \str_set:Nx \l_stex_modules_ns_str {
+ \str_set:Nx \l_stex_module_ns_str {
file:/\stex_path_to_string:N \l_tmpa_seq
}
}
@@ -476,6 +491,7 @@
% Sets up a new module property list:
% \begin{macrocode}
\cs_new_protected:Nn \stex_module_setup:nn {
+ \int_set:Nn \l_@@_group_depth_int {\currentgrouplevel}
\str_set:Nx \l_stex_module_name_str { #2 }
\_@@_args:n { #1 }
% \end{macrocode}
@@ -493,11 +509,16 @@
\prop_item:cn {c_stex_module_\l_stex_current_module_str _prop}
{ name } / \l_stex_module_name_str
}
+ \str_if_empty:NT \l_stex_module_lang_str {
+ \str_set:Nx \l_stex_module_lang_str {
+ \prop_item:cn {c_stex_module_\l_stex_current_module_str _prop}
+ { lang }
+ }
+ }
}{
% not nested:
\str_if_empty:NT \l_stex_module_ns_str {
\stex_modules_current_namespace:
- \str_set_eq:NN \l_stex_module_ns_str \l_stex_modules_ns_str
\exp_args:NNNo \seq_set_split:Nnn \l_tmpa_seq
/ {\l_stex_module_ns_str}
\seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
@@ -517,23 +538,21 @@
\seq_get_right:NN \g_stex_currentfile_seq \l_tmpa_str
\seq_set_split:NnV \l_tmpa_seq . \l_tmpa_str
\seq_pop_right:NN \l_tmpa_seq \l_tmpa_str % .tex
+ \exp_args:No \str_if_eq:nnF \l_tmpa_str {tex} {
+ \exp_args:No \str_if_eq:nnF \l_tmpa_str {dtx} {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq \l_tmpa_str
+ }
+ }
\seq_pop_left:NN \l_tmpa_seq \l_tmpa_str % <filename>
- \seq_if_empty:NF \l_tmpa_seq { %remaining element should be language
+ \seq_if_empty:NF \l_tmpa_seq { %remaining element should be [<something>.]language
+ \seq_pop_right:NN \l_tmpa_seq \l_stex_module_lang_str
\stex_debug:nn{modules} {Language~\l_stex_module_lang_str~
inferred~from~file~name}
- \seq_pop_left:NN \l_tmpa_seq \l_stex_module_lang_str
}
}
\stex_if_smsmode:F { \str_if_empty:NF \l_stex_module_lang_str {
- \prop_get:NVNTF \c_stex_languages_prop \l_stex_module_lang_str
- \l_tmpa_str {
- \ltx@ifpackageloaded{babel}{
- \exp_args:Nx \selectlanguage { \l_tmpa_str }
- }{}
- } {
- \msg_error:nnx{stex}{error/unknownlanguage}{\l_tmpa_str}
- }
+ \exp_args:NNo \stex_set_language:Nn \l_tmpa_str \l_stex_module_lang_str
}}
% \end{macrocode}
%
@@ -555,6 +574,7 @@
}
\seq_clear:c {c_stex_module_\l_stex_module_ns_str?\l_stex_module_name_str _imports}
\seq_clear:c {c_stex_module_\l_stex_module_ns_str?\l_stex_module_name_str _constants}
+ \seq_clear:c {c_stex_module_\l_stex_module_ns_str?\l_stex_module_name_str _copymodules}
\tl_clear:c {c_stex_module_\l_stex_module_ns_str?\l_stex_module_name_str _code}
\str_set:Nx\l_stex_current_module_str{\l_stex_module_ns_str?\l_stex_module_name_str}
% \end{macrocode}
@@ -583,24 +603,29 @@
\l_stex_module_ns_str?\l_stex_module_name_str
}{\l_stex_module_sig_str}
}
-
- \seq_set_eq:NN \l_tmpa_seq \g_stex_currentfile_seq
- \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
- \seq_set_split:NnV \l_tmpb_seq . \l_tmpa_str
- \seq_pop_right:NN \l_tmpb_seq \l_tmpa_str % .tex
- \seq_pop_left:NN \l_tmpb_seq \l_tmpa_str % <filename>
- \str_set:Nx \l_tmpa_str {
- \stex_path_to_string:N \l_tmpa_seq /
- \l_tmpa_str . \l_stex_module_sig_str .tex
- }
- \IfFileExists \l_tmpa_str {
- \exp_args:No \stex_file_in_smsmode:nn { \l_tmpa_str } {
- \str_clear:N \l_stex_current_module_str
- \seq_clear:N \l_stex_all_modules_seq
- \stex_debug:nn{modules}{Loading~signature~\l_tmpa_str}
- }
+ \stex_debug:nn{modules}{Signature~\l_stex_module_sig_str~for~\l_stex_module_ns_str?\l_stex_module_name_str}
+ \stex_if_module_exists:nTF{\l_stex_module_ns_str?\l_stex_module_name_str}{
+ \stex_debug:nn{modules}{(already exists)}
}{
- \msg_error:nnx{stex}{error/unknownmodule}{for~signature~\l_tmpa_str}
+ \stex_debug:nn{modules}{(needs loading)}
+ \seq_set_eq:NN \l_tmpa_seq \g_stex_currentfile_seq
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpb_seq . \l_tmpa_str
+ \seq_pop_right:NN \l_tmpb_seq \l_tmpa_str % .tex
+ \seq_pop_left:NN \l_tmpb_seq \l_tmpa_str % <filename>
+ \str_set:Nx \l_tmpa_str {
+ \stex_path_to_string:N \l_tmpa_seq /
+ \l_tmpa_str . \l_stex_module_sig_str .tex
+ }
+ \IfFileExists \l_tmpa_str {
+ \exp_args:No \stex_file_in_smsmode:nn { \l_tmpa_str } {
+ \str_clear:N \l_stex_current_module_str
+ \seq_clear:N \l_stex_all_modules_seq
+ \stex_debug:nn{modules}{Loading~signature}
+ }
+ }{
+ \msg_error:nnx{stex}{error/unknownmodule}{for~signature~\l_tmpa_str}
+ }
}
\stex_if_smsmode:F {
\stex_activate_module:n {
@@ -619,6 +644,7 @@
\seq_put_right:Nx \l_stex_all_modules_seq {
\l_stex_module_ns_str ? \l_stex_module_name_str
}
+ \tl_clear:c{l_@@_aftergroup_\l_stex_module_ns_str ? \l_stex_module_name_str _tl}
}
% \end{macrocode}
% \end{macro}
@@ -649,7 +675,7 @@
File:~\stex_path_to_string:N \g_stex_currentfile_seq
}
- \stex_if_smsmode:F{
+ \stex_if_do_html:T{
\begin{stex_annotate_env} {theory} {
\l_stex_module_ns_str ? \l_stex_module_name_str
}
@@ -665,7 +691,6 @@
}
}
}
- \int_set:Nn \l_@@_group_depth_int {\currentgrouplevel}
% TODO: Inherit metatheory for nested modules?
}
\iffalse \end{stex_annotate_env} \fi %^^A make syntax highlighting work again
@@ -679,6 +704,23 @@
% \begin{macrocode}
\cs_new_protected:Nn \_@@_end_module: {
\stex_debug:nn{modules}{Closing~module~\prop_item:cn {c_stex_module_\l_stex_current_module_str _prop} { name }}
+ \_stex_reset_up_to_module:n \l_stex_current_module_str
+ \stex_if_smsmode:T {
+ \stex_persist:x {
+ \prop_set_from_keyval:cn{c_stex_module_\l_stex_current_module_str _prop}{
+ \exp_after:wN \prop_to_keyval:N \csname c_stex_module_\l_stex_current_module_str _prop\endcsname
+ }
+ \seq_set_from_clist:cn{c_stex_module_\l_stex_current_module_str _constants}{
+ \seq_use:cn{c_stex_module_\l_stex_current_module_str _constants},
+ }
+ \seq_set_from_clist:cn{c_stex_module_\l_stex_current_module_str _imports}{
+ \seq_use:cn{c_stex_module_\l_stex_current_module_str _imports},
+ }
+ \tl_set:cn {c_stex_module_\l_stex_current_module_str _code}
+ }
+ \exp_after:wN \let \exp_after:wN \l_tmpa_tl \csname c_stex_module_\l_stex_current_module_str _code\endcsname
+ \exp_after:wN \stex_persist:n \exp_after:wN { \exp_after:wN { \l_tmpa_tl } }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -689,8 +731,11 @@
\iffalse \begin{stex_annotate_env} \fi %^^A make syntax highlighting work again
\NewDocumentEnvironment { smodule } { O{} m } {
\stex_module_setup:nn{#1}{#2}
- \par
+ %\par
\stex_if_smsmode:F{
+ \tl_if_empty:NF \smoduletitle {
+ \exp_args:No \stex_document_title:n \smoduletitle
+ }
\tl_clear:N \l_tmpa_tl
\clist_map_inline:Nn \smoduletype {
\tl_if_exist:cT {_@@_smodule_##1_start:}{
@@ -804,9 +849,6 @@
\bool_set_false:N \l_stex_in_meta_bool
\cs_new_protected:Nn \stex_activate_module:n {
\stex_debug:nn{modules}{Activating~module~#1}
- \seq_if_in:NnT \l_stex_implicit_morphisms_seq { #1 }{
- \msg_error:nnn{stex}{error/conflictingmodules}{ #1 }
- }
\exp_args:NNx \seq_if_in:NnF \l_stex_all_modules_seq { #1 } {
\seq_put_right:Nx \l_stex_all_modules_seq { #1 }
\use:c{ c_stex_module_#1_code }
@@ -820,5 +862,6 @@
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-others.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-others.dtx
index 96d79939af7..e22aa885905 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-others.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-others.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -73,6 +73,30 @@
\@ifpackageloaded{tikzinput}{
\RequirePackage{stex-tikzinput}
}{}
+
+\bool_if:NT \c_stex_persist_mode_bool {
+ \let\__stex_notation_restore_notation_old:nnnnn
+ \__stex_notation_restore_notation:nnnnn
+ \def\__stex_notation_restore_notation_new:nnnnn#1#2#3#4#5{
+ \__stex_notation_restore_notation_old:nnnnn{#1}{#2}{#3}{#4}{#5}
+ \ExplSyntaxOn
+ }
+ \def\__stex_notation_restore_notation:nnnnn{
+ \ExplSyntaxOff
+ \catcode`~10
+ \__stex_notation_restore_notation_new:nnnnn
+ }
+ \input{\jobname.sms}
+ \let\__stex_notation_restore_notation:nnnnn
+ \__stex_notation_restore_notation_old:nnnnn
+ \prop_if_exist:NT\c_stex_mathhub_main_manifest_prop{
+ \prop_get:NnN \c_stex_mathhub_main_manifest_prop {id}
+ \l_tmpa_str
+ \prop_set_eq:cN { c_stex_mathhub_\l_tmpa_str _manifest_prop }
+ \c_stex_mathhub_main_manifest_prop
+ \exp_args:Nx \stex_set_current_repository:n { \l_tmpa_str }
+ }
+}
% \end{macrocode}
%
%
@@ -82,5 +106,6 @@
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-proofs.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-proofs.dtx
index c4bf4e48fb3..c2cdb3b54e1 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-proofs.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-proofs.dtx
@@ -1,16 +1,16 @@
% \iffalse meta-comment
% An Infrastructure for Structural Markup for Proofs
% Copyright (c) 2019 Michael Kohlhase, all rights reserved
-% this file is released under the
-% LaTeX Project Public License (LPPL)
-%
+% this file is released under the
+% LaTeX Project Public License (LPPL)
+%
% The original of this file is in the public repository at
% http://github.com/sLaTeX/sTeX/
-% \fi
-%
-% \iffalse
+%
+% TODO update copyright
+%
%<*driver>
-\def\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -18,305 +18,46 @@
\end{document}
%</driver>
% \fi
-%
-% \iffalse\CheckSum{341}\fi
%
-% ^^A \changes{v0.9}{2005/06/14}{First Version with Documentation}
-%
% \GetFileInfo{sproof.sty}
%
-% \title{\sTeX-Proofs: Structural Markup for Proofs\thanks{Version {\fileversion} (last revised
-% {\filedate})}}
-% \author{Michael Kohlhase, Dennis Müller\\
-% FAU Erlangen-N\"urnberg\\
-% \url{http://kwarc.info/kohlhase}}
+% \title{\sTeX-Proofs: Structural Markup for Proofs\thanks{Version {\fileversion} (last revised {\filedate})}
+% }
+%
+% \author{Michael Kohlhase, Dennis Müller\\
+% FAU Erlangen-Nürnberg\\
+% \url{http://kwarc.info/}
+%c }
+%
% \maketitle
%
%\ifinfulldoc\else
-% This is the documentation for the \pkg{stex-proofs} package.
-% For a more high-level introduction,
-% see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
-% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+% \begin{abstract}
+% This is the documentation for the \pkg{stex-proofs} package.
+%
+% The |sproof| package is part of the {\stex} collection, a version of {\TeX/\LaTeX} that
+% allows to markup {\TeX/\LaTeX} documents semantically without leaving the document
+% format, essentially turning {\TeX/\LaTeX} into a document format for mathematical
+% knowledge management (MKM).
+%
+% The \pkg{stex-proofs} package supplies macros and environment that allow to annotate the
+% structure of mathematical proofs in {\stex} files. This structure can be used by MKM
+% systems for added-value services, either directly from the \sTeX sources, or after
+% translation.
+%
+% For a more high-level introduction, see \href{\basedocurl/manual.pdf}{the \sTeX Manual}
+% or the \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+% \end{abstract}
+%
+% \tableofcontents
%
% \input{../../doc/packages/stex-proofs}
% \fi
%
% \begin{documentation}
-%
-% The |sproof| package is part of the {\stex} collection, a version of {\TeX/\LaTeX} that
-% allows to markup {\TeX/\LaTeX} documents semantically without leaving the document
-% format, essentially turning {\TeX/\LaTeX} into a document format for mathematical
-% knowledge management (MKM).
-%
-% This package supplies macros and environment that allow to annotate the structure of
-% mathematical proofs in {\stex} files. This structure can be used by MKM systems for
-% added-value services, either directly from the \sTeX sources, or after translation.
-%
-% \newpage\tableofcontents\newpage
-%
-%\section{Introduction}\label{sec:sproof}
-%
-% The |sproof| ({\twintoo{semantic}{proofs}}) package supplies macros and environment that
-% allow to annotate the structure of mathematical proofs in {\stex} files. This structure
-% can be used by MKM systems for added-value services, either directly from the \sTeX
-% sources, or after translation. Even though it is part of the {\stex} collection, it can
-% be used independently, like it's sister package |statements|.
-%
-% {\stex} is a version of {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents
-% semantically without leaving the document format, essentially turning {\TeX/\LaTeX} into
-% a document format for mathematical knowledge management (MKM).
-%
-% \begin{exfig}\scriptsize
-% \begin{verbatim}
-% \begin{sproof}[id=simple-proof]
-% {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$}
-% \begin{spfcases}{For the induction we have to consider the following cases:}
-% \begin{spfcase}{$n=1$}
-% \begin{spfstep}[type=inline] then we compute $1=1^2$\end{spfstep}
-% \end{spfcase}
-% \begin{spfcase}{$n=2$}
-% \begin{sproofcomment}[type=inline]
-% This case is not really necessary, but we do it for the
-% fun of it (and to get more intuition).
-% \end{sproofcomment}
-% \begin{spfstep}[type=inline] We compute $1+3=2^{2}=4$.\end{spfstep}
-% \end{spfcase}
-% \begin{spfcase}{$n>1$}
-% \begin{spfstep}[type=assumption,id=ind-hyp]
-% Now, we assume that the assertion is true for a certain $k\geq 1$,
-% i.e. $\sum_{i=1}^k{(2i-1)}=k^{2}$.
-% \end{spfstep}
-% \begin{sproofcomment}
-% 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}$.
-% \end{sproofcomment}
-% \begin{spfstep}
-% We obtain $\sum_{i=1}^{k+1}{2i-1}=\sum_{i=1}^k{2i-1}+2(k+1)-1$
-% \begin{justification}[method=arith:split-sum]
-% by splitting the sum.
-% \end{justification}
-% \end{spfstep}
-% \begin{spfstep}
-% Thus we have $\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1$
-% \begin{justification}[method=fertilize]
-% by inductive hypothesis.
-% \end{justification}
-% \end{spfstep}
-% \begin{spfstep}[type=conclusion]
-% We can \begin{justification}[method=simplify]simplify\end{justification}
-% the right-hand side to ${k+1}^2$, which proves the assertion.
-% \end{spfstep}
-% \end{spfcase}
-% \begin{spfstep}[type=conclusion]
-% We have considered all the cases, so we have proven the assertion.
-% \end{spfstep}
-% \end{spfcases}
-% \end{sproof}
-% \end{verbatim}
-% \vspace*{-.5cm}
-% \caption{A very explicit proof, marked up semantically}\label{fig:proof:src}
-% \end{exfig}
-%
-% We will go over the general intuition by way of our running example (see
-% Figure~\ref{fig:proof:src} for the source and Figure~\ref{fig:proof:result} for the
-% formatted result).\ednote{talk a bit more about proofs and their structure,... maybe
-% copy from OMDoc spec. }
-%
-% \section{The User Interface}
-%
-% \subsection{Package Options}\label{sec:user:options}
-%
-% The |sproof| package takes a single option: \DescribeMacro{showmeta}|showmeta|. If
-% this is set, then the metadata keys are shown (see~\cite{Kohlhase:metakeys} for details
-% and customization options).
-%
-% \subsection{Proofs and Proof steps}
-%
-% \DescribeEnv{sproof} The |proof| 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 |\step|, |proofcomment|, and
-% |pfcases| environments that are used to markup the proof steps. The |proof| environment
-% has a variant |Proof|, which does not use the proof end marker. This is convenient, if a
-% proof ends in a case distinction, which brings it's own proof end marker with it.
-% \DescribeEnv{sProof} The |Proof| environment is a variant of |proof| that does not mark
-% the end of a proof with a little box; presumably, since one of the subproofs already has
-% one and then a box supplied by the outer proof would generate an otherwise empty line.
-% \DescribeMacro{\spfidea} The |\spfidea| macro allows to give a one-paragraph
-% description of the proof idea.
-%
-% For one-line proof sketches, we use the \DescribeMacro{spfsketch}|\spfsketch| macro,
-% which takes the |KeyVal| argument as |sproof| and another one: a natural language text
-% that sketches the proof.
-%
-% \DescribeEnv{spfstep} Regular proof steps are marked up with the |step| environment, 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.
-%
-% Note that both |\premise| and |\justarg| can be used with an empty second argument to
-% mark up premises and arguments that are not explicitly mentioned in the text.
-%
-% \begin{exfig}
-% \begin{sproof}[id=simple-proof]
-% {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$}
-% \begin{spfcases}{For the induction we have to consider the following cases:}
-% \begin{spfcase}{$n=1$}
-% \begin{spfstep}[type=inline] then we compute $1=1^2$\end{spfstep}
-% \end{spfcase}
-% \begin{spfcase}{$n=2$}
-% \begin{sproofcomment}[type=inline]
-% This case is not really necessary, but we do it for the fun
-% of it (and to get more intuition).
-% \end{sproofcomment}
-% \begin{spfstep}[type=inline]
-% We compute $1+3=2^{2}=4$
-% \end{spfstep}
-% \end{spfcase}
-% \begin{spfcase}{$n>1$}
-% \begin{spfstep}[type=hypothesis,id=ind-hyp]
-% Now, we assume that the assertion is true for a certain $k\geq 1$, i.e.
-% $\sum_{i=1}^k{(2i-1)}=k^{2}$.
-% \end{spfstep}
-% \begin{sproofcomment}
-% 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}$.
-% \end{sproofcomment}
-% \begin{spfstep}[id=splitit]
-% We obtain $\sum_{i=1}^{k+1}{(2i-1)}=\sum_{i=1}^k{(2i-1)}+2(k+1)-1$
-% \begin{justification}[method=arith:split-sum]
-% by splitting the sum
-% \end{justification}
-% \end{spfstep}
-% \begin{spfstep}[id=byindhyp]
-% Thus we have $\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1$
-% \begin{justification}[method=fertilize]
-% by \premise[ind-hyp]{inductive hypothesis}.
-% \end{justification}
-% \end{spfstep}
-% \begin{spfstep}[type=conclusion]
-% We can \begin{justification}[method=simplify-eq]
-% simplify the {\justarg[rhs]{right-hand side}}
-% \end{justification} to $(k+1)^2$, which proves the assertion.
-% \end{spfstep}
-% \end{spfcase}
-% \begin{spfstep}[type=conclusion]
-% We have considered all the cases, so we have proven the assertion.
-% \end{spfstep}
-% \end{spfcases}
-% \end{sproof}
-% \caption{The formatted result of the proof in Figure~\ref{fig:proof:src}}\label{fig:proof:result}
-% \end{exfig}
-%
-% \subsection{Justifications}
+% \changes{v0.9}{2022/02/14}{Moved over from the \pkg{sproofs} package}
%
-% \DescribeEnv{justification} This evidence is marked up with the |justification|
-% environment in the |sproof| package. This environment totally invisible to the formatted
-% result; it wraps the text in the proof step that corresponds to the evidence. The
-% environment takes an optional |KeyVal| argument, which can have the |method| key, whose
-% value is the name of a proof method (this will only need to mean something to the
-% application that consumes the semantic annotations). Furthermore, the justification can
-% contain ``premises'' (specifications to assertions that were used justify the step) and
-% ``arguments'' (other information taken into account by the proof method).
-%
-% \DescribeMacro{\premise} The |\premise| macro allows to mark up part of the text as
-% reference to an assertion that is used in the argumentation. In the example in
-% Figure~\ref{fig:proof:src} we have used the |\premise| macro to identify the inductive
-% hypothesis.
%
-% \DescribeMacro{\justarg} The |\justarg| macro is very similar to |\premise| with the
-% difference that it is used to mark up arguments to the proof method. Therefore the
-% content of the first argument is interpreted as a mathematical object rather than as an
-% identifier as in the case of |\premise|. In our example, we specified that the
-% simplification should take place on the right hand side of the equation. Other examples
-% include proof methods that instantiate. Here we would indicate the substituted object in
-% a |\justarg| macro.
-%
-% \subsection{Proof Structure}
-%
-% \DescribeEnv{subproof} The |pfcases| 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 \DescribeMacro{method}|method| key can be used to give the name of the
-% proof method executed to make this subproof.
-%
-% \DescribeEnv{spfcases} The |pfcases| environment is used to mark up a proof by
-% cases. Technically it is a variant of the |subproof| where the |method| is
-% |by-cases|. Its contents are |spfcase| environments that mark up the cases one by one.
-%
-% \DescribeEnv{spfcase} The content of a |pfcases| environment are a sequence of case
-% proofs marked up in the |pfcase| environment, which takes an optional |KeyVal| argument
-% for semantic annotations. The second argument is used to specify the the description of
-% the case under consideration. The content of a |pfcase| environment is the same as that
-% of a |proof|, i.e. |step|s, |proofcomment|s, and |pfcases|
-% environments. \DescribeMacro{\spfcasesketch}|\spfcasesketch| is a variant of the |spfcase|
-% environment that takes the same arguments, but instead of the |spfstep|s in the body
-% uses a third argument for a proof sketch.
-%
-% \DescribeEnv{sproofcomment} The |proofcomment| environment is much like a |step|, only
-% that it does not have an object-level assertion of its own. Rather than asserting some
-% fact that is relevant for the proof, it is used to explain where the proof is going,
-% what we are attempting to to, or what we have achieved so far. As such, it cannot be the
-% target of a |\premise|.
-%
-% \subsection{Proof End Markers}
-%
-% 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 |sproof| package provides the \DescribeMacro{\sproofend}|\sproofend| macro for
-% this. 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
-% \DescribeMacro{\sProofEndSymbol}|\sProofEndSymbol| configuration macro (e.g. by specifying
-% |\sProofEndSymbol{q.e.d}|).
-%
-% 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{}|.
-%
-% \subsection{Configuration of the Presentation}\label{sec:user:conf}
-%
-% Finally, we provide configuration hooks in Figure~\ref{fig:hooks} for the keywords in
-% proofs. These are mainly intended for package authors building on |statements|, e.g. for
-% multi-language support.\ednote{we might want to develop an extension
-% \texttt{sproof-babel} in the future.}.
-%\begin{figure}[ht]\centering
-% \begin{tabular}{|lll|}\hline
-% Environment & configuration macro & value\\\hline\hline
-% \texttt{sproof} & \texttt{\textbackslash spf@proof@kw} & \makeatletter\spf@proof@kw\\\hline
-% \texttt{sketchproof} & \texttt{\textbackslash spf@sketchproof@kw} & \makeatletter\spf@proofsketch@kw\\\hline
-% \end{tabular}
-% \caption{Configuration Hooks for Semantic Proof Markup}\label{fig:hooks}
-% \end{figure}
-% The proof step labels can be customized via the
-% \DescribeMacro{\pstlabelstyle}|\pstlabelstyle| macro: |\pstlabelstyle{|\meta{style}|}|
-% sets the style; see Figure~\ref{fig:pstlabel} for an overview of styles. Package writers
-% can add additional styles by adding a macro |\pst@make@label@|\meta{style} that takes
-% two arguments: a comma-separated list of ordinals that make up the prefix and the current
-% ordinal. Note that comma-separated lists can be conveniently iterated over by the
-% {\LaTeX} |\@for|\ldots|:=|\ldots|\do{|\ldots|}| macro; see Figure~\ref{fig:pstlabel} for
-% examples.
-%
-% \section{Limitations}\label{sec:limitations}
-%
-% In this section we document known limitations. If you want to help alleviate them,
-% please feel free to contact the package author. Some of them are currently discussed in
-% the \sTeX issue tracker at \cite{sTeX:github:on}.
-% \begin{enumerate}
-% \item The numbering scheme of proofs cannot be changed. It is more geared for teaching
-% proof structures (the author's main use case) and not for writing papers.\lec{reported
-% by Tobias Pfeiffer (fixed)}
-% \item currently proof steps are formatted by the {\LaTeX} |description| environment. We
-% would like to configure this, e.g. to use the |inparaenum| environment for more
-% condensed proofs. I am just not sure what the best user interface would be I can
-% imagine redefining an internal environment |spf@proofstep@list| or adding a key
-% |prooflistenv| to the |proof| environment that allows to specify the environment
-% directly. Maybe we should do both.
-% \end{enumerate}
%
% \end{documentation}
%
@@ -324,12 +65,6 @@
%
% \section{The Implementation}
%
-% \subsection{Package Options}\label{sec:impl:options}
-%
-% We declare some switches which will modify the behavior according to the package
-% options. Generally, an option |xxx| will just set the appropriate switches to true
-% (otherwise they stay false).\ednote{need an implementation for {\latexml}}
-%
% \begin{macrocode}
%<*package>
%<@@=stex_sproof>
@@ -385,15 +120,6 @@
% not do automatic numbering, and we have to add keyword arguments all over the place, to
% accomodate semantic information.
%
-% \begin{environment}{pst@with@label}
-% This environment manages\footnote{This gets the labeling right but only works 8 levels
-% deep} the path labeling of the proof steps in the description environment of the
-% outermost |proof| environment. The argument is the label prefix up to now; which we
-% cache in |\pst@label| (we need evaluate it first, since are in the right place
-% now!). Then we increment the proof depth which is stored in |\count10| (lower counters
-% are used by {\TeX} for page numbering) and initialize the next level counter
-% |\count\count10| with 1. In the end call for this environment, we just decrease the
-% proof depth counter by 1 again.
% \begin{macrocode}
\intarray_new:Nn\l_@@_counter_intarray{50}
\cs_new_protected:Npn \sproofnumber {
@@ -449,8 +175,6 @@
\intarray_gset:Nnn \l_@@_counter_intarray \l_tmpa_int { 0 }
}
% \end{macrocode}
-% \end{environment}
-%
%
%\begin{macro}{\sproofend}
% This macro places a little box at the end of the line if there is space, or at the
@@ -725,7 +449,7 @@
}
\cs_new_protected:Nn \_@@_sproof_end: {\sproofend}
-\newcommand\stexpatchsproof[3][] {
+\newcommand\stexpatchproof[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
\str_if_empty:NTF \l_tmpa_str {
\tl_set:Nn \_@@_sproof_start: { #2 }
@@ -767,6 +491,17 @@
}
}{
\@in@omtexttrue
+ \clist_set:No \l_tmpa_clist \spftype
+ \tl_set:Nn \l_tmpa_tl {
+ \item[\sproofnumber]
+ \bool_set_true:N \l_@@_inc_counter_bool
+ }
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \exp_args:No \str_if_eq:nnT \c_@@_flow_str {##1} {
+ \tl_clear:N \l_tmpa_tl
+ }
+ }
+ \l_tmpa_tl
\seq_clear:N \l_tmpa_seq
\clist_map_inline:Nn \l_@@_spf_for_clist {
\tl_if_empty:nF{ ##1 }{
@@ -781,17 +516,6 @@
\str_if_empty:NF \spftype {
\stex_annotate_invisible:nnn{type}{\spftype}{}
}
- \clist_set:No \l_tmpa_clist \spftype
- \tl_set:Nn \l_tmpa_tl {
- \item[\sproofnumber]
- \bool_set_true:N \l_@@_inc_counter_bool
- }
- \clist_map_inline:Nn \l_tmpa_clist {
- \exp_args:No \str_if_eq:nnT \c_@@_flow_str {##1} {
- \tl_clear:N \l_tmpa_tl
- }
- }
- \l_tmpa_tl
\tl_if_empty:NF \spftitle {
{(\titleemph{\spftitle})\enspace}
}
@@ -812,9 +536,9 @@
% \end{macrocode}
% \end{environment}
%
-% \begin{environment}{sproofcomment}
+% \begin{environment}{spfcomment}
% \begin{macrocode}
-\newenvironment{sproofcomment}[1][]{
+\newenvironment{spfcomment}[1][]{
\_@@_spf_args:n{#1}
\clist_set:No \l_tmpa_clist \spftype
\tl_set:Nn \l_tmpa_tl {
@@ -1001,11 +725,11 @@
% arguments for now and only display the content.\ednote{need to do something about the
% premise in draft mode.}
%
-% \begin{environment}{justification}
+% \begin{macro}{\spfjust}
% \begin{macrocode}
-\newenvironment{justification}[1][]{}{}
+\newcommand\spfjust[1][]{}
% \end{macrocode}
-% \end{environment}
+% \end{macro}
%
% \begin{macro}{\premise}
% \begin{macrocode}
@@ -1023,31 +747,10 @@
% \end{macro}
% \end{implementation}
% \Finale
+% \ifinfulldoc\else\printbibliography\fi
\endinput
+
%%% Local Variables:
%%% mode: doctex
%%% TeX-master: t
%%% End:
-% LocalWords: GPL structuresharing STR sproof dtx CPERL keyval methodfalse env
-% LocalWords: methodtrue envtrue medhodtrue DefKeyVal Semiverbatim omdoc args
-% LocalWords: DefEnvironment OptionalKeyVals KeyVal omtext DefConstructor str
-% LocalWords: proofidea KeyVal pfstep DefCMPEnvironment KeyVal proofcomment eq
-% LocalWords: KeyVal pfcases KeyVal pfcase KeyVal extractBodyText unlist elsif
-% LocalWords: foreach getBody toString str str str LookupValue LastSeenCMP Thu
-% LocalWords: appendText getValue undef openElement closeElement DefMacro omd
-% LocalWords: afterClose nodeType childNodes firstCMP localname hasChildNodes
-% LocalWords: firstChild textContent removeChild iffalse kohlhase sref scsys
-% LocalWords: sproofs.sty sc sc mathml openmath latexml cmathml activemath geq
-% LocalWords: twintoo atwin atwintoo texttt fileversion maketitle stex newpage
-% LocalWords: tableofcontents newpage exfig scriptsize vspace ednote spfidea
-% LocalWords: spfidea spfsketch spfsketch spfstep justarg spfcases spfcase rhs
-% LocalWords: sproofcomment ind-hyp splitit arith byindhyp sproofend proofend
-% LocalWords: printbibliography textsf langle textsf langle ltxml ctancite spf
-% LocalWords: srefaddidkey pf.sty newenvironment hbox vrule vbox ifx showmeta
-% LocalWords: hrule vskip hrule vrule hfil nobreak hfill smallskip newcommand
-% LocalWords: stDMemph newcount endsproof xref doctex showmeta hline lec ldots
-% LocalWords: textbackslash makeatletter sketchproof compactenum tracissue
-% LocalWords: metakeys addmetakey metasetkeys stylable pstlabelstyle pstlabel
-% LocalWords: pstlabelstyle pstlabelstyle ldots ldots ensuremath inparaenum
-% LocalWords: nameuse prooflistenv spfcasesketch spfcasesketch spfeq rcll
-% LocalWords: displaymath noindent ignorespaces
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-references.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-references.dtx
index ad94bbedb3b..96506e71f1c 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-references.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-references.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -100,7 +100,7 @@
% \begin{function}{\sref}
% \begin{syntax} \cs{sref}|[|\meta{opt-args}|]|\Arg{id} \end{syntax}
% References the label with if \meta{id}.
-% Optional arguments: TODO
+% Optional arguments: \textcolor{red}{TODO}
% \end{function}
%
% \begin{function}{\srefsym}
@@ -148,10 +148,10 @@
%
% \begin{macrocode}
%\iow_new:N \c_@@_refs_iow
-\AddToHook{begindocument}{
+\AtBeginDocument{
% \iow_open:Nn \c_@@_refs_iow {\jobname.sref}
}
-\AddToHook{enddocument}{
+\AtEndDocument{
% \iow_close:N \c_@@_refs_iow
}
% \end{macrocode}
@@ -356,7 +356,7 @@
\str_if_empty:NF \l_@@_curr_label_str {
\str_gset_eq:cN {sref_sym_#1_label_str}\l_@@_curr_label_str
\immediate\write\@auxout{
- \exp_not:N\expandafter\def\exp_not:N\csname sref_sym_#1_label_str\exp_not:N\endcsname{
+ \exp_not:N\expandafter\def\exp_not:N\csname \exp_not:N\detokenize{sref_sym_#1_label_str}\exp_not:N\endcsname{
\l_@@_curr_label_str
}
}
@@ -521,5 +521,6 @@
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-statements.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-statements.dtx
index 83e2fbf92b5..6a66eb80e76 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-statements.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-statements.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -40,6 +40,8 @@
% \fi
%
% \begin{documentation}\label{pkg:statements:doc}
+% \changes{3.1.0}{2022/02/28}{Added \detokenize{\definiendum} and related macros to \detokenize{sparagraph},
+% if \detokenize{type=symdoc}}
%
% Code related to statements, e.g. definitions, theorems
%
@@ -110,7 +112,7 @@
}
% TODO root
- \rustex_if:TF {
+ \stex_html_backend:TF {
\stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } { \l_tmpa_tl }
} {
\exp_args:Nnx \defemph@uri { \l_tmpa_tl } { \l_stex_get_symbol_uri_str }
@@ -131,13 +133,15 @@
\str_set:Nx \l_tmpa_str {
\prop_item:cn { l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop } { name }
}
- \exp_args:NNno \str_replace_all:Nnn \l_tmpa_str {-} {~}
- \rustex_if:TF {
- \stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } {
- \l_tmpa_str\l_@@_definiendum_post_tl
+ \str_replace_all:Nnn \l_tmpa_str {-} {~}
+ \stex_html_backend:TF {
+ \stex_if_do_html:T {
+ \stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } {
+ \l_tmpa_str\l_@@_definiendum_post_tl
}
+ }
} {
- \defemph@uri {
+ \exp_args:Nnx \defemph@uri {
\l_tmpa_str\l_@@_definiendum_post_tl
} { \l_stex_get_symbol_uri_str }
}
@@ -152,12 +156,14 @@
}
\exp_args:NNno \str_replace_all:Nnn \l_tmpa_str {-} {~}
\stex_ref_new_sym_target:n \l_stex_get_symbol_uri_str
- \rustex_if:TF {
- \stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } {
- \l_tmpa_str\l__stex_statements_definiendum_post_tl
- }
+ \stex_html_backend:TF {
+ \stex_if_do_html:T {
+ \stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } {
+ \exp_after:wN \stex_capitalize:n \l_tmpa_str\l__stex_statements_definiendum_post_tl
+ }
+ }
} {
- \defemph@uri {
+ \exp_args:Nnx \defemph@uri {
\exp_after:wN \stex_capitalize:n \l_tmpa_str\l__stex_statements_definiendum_post_tl
} { \l_stex_get_symbol_uri_str }
}
@@ -165,18 +171,51 @@
\stex_deactivate_macro:Nn \Definame {definition~environments}
\NewDocumentCommand \premise { m }{
- \stex_annotate:nnn{ premise }{}{ #1 }
+ \noindent\stex_annotate:nnn{ premise }{}{\ignorespaces #1 }
}
\NewDocumentCommand \conclusion { m }{
- \stex_annotate:nnn{ conclusion }{}{ #1 }
+ \noindent\stex_annotate:nnn{ conclusion }{}{\ignorespaces #1 }
}
-\NewDocumentCommand \definiens { m }{
- \stex_annotate:nnn{ definiens }{}{ #1 }
+\NewDocumentCommand \definiens { O{} m }{
+ \str_clear:N \l_stex_get_symbol_uri_str
+ \tl_if_empty:nF {#1} {
+ \stex_get_symbol:n { #1 }
+ }
+ \str_if_empty:NT \l_stex_get_symbol_uri_str {
+ \int_compare:nNnTF {\clist_count:N \l_@@_sdefinition_for_clist} = 1 {
+ \str_set:Nx \l_stex_get_symbol_uri_str {\clist_item:Nn \l_@@_sdefinition_for_clist 1}
+ }{
+ % TODO throw error
+ }
+ }
+ \str_if_eq:eeT {\prop_item:cn {l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop}{module}}
+ {\l_stex_current_module_str}{
+ \str_if_eq:eeF {\prop_item:cn {l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop}{defined}}
+ {true}{
+ \prop_put:cnn{l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop}{defined}{true}
+ \exp_args:Nx \stex_add_to_current_module:n {
+ \prop_put:cnn{l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop}{defined}{true}
+ }
+ }
+ }
+ \stex_annotate:nnn{ definiens }{\l_stex_get_symbol_uri_str}{ #2 }
+}
+
+\NewDocumentCommand \varbindforall {m}{
+ \stex_symbol_or_var:n {#1}
+ \bool_if:NTF\l_stex_symbol_or_var_bool{
+ \stex_if_do_html:T {
+ \stex_annotate_invisible:nnn {bindtype}{forall,\l_stex_get_symbol_uri_str}{}
+ }
+ }{
+ % todo throw error
+ }
}
\stex_deactivate_macro:Nn \premise {definition,~example~or~assertion~environments}
\stex_deactivate_macro:Nn \conclusion {example~or~assertion~environments}
\stex_deactivate_macro:Nn \definiens {definition~environments}
+\stex_deactivate_macro:Nn \varbindforall {definition~or~assertion~environments}
% \end{macrocode}
% \end{macro}
@@ -207,20 +246,25 @@
\stex_reactivate_macro:N \Definame
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \definiens
+ \stex_reactivate_macro:N \varbindforall
\stex_if_smsmode:F{
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l_@@_sdefinition_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
+ \clist_set_from_seq:NN \l_@@_sdefinition_for_clist \l_tmpb_seq
\exp_args:Nnnx
- \begin{stex_annotate_env}{definition}{\seq_use:Nn \l_tmpa_seq {,}}
+ \begin{stex_annotate_env}{definition}{\seq_use:Nn \l_tmpb_seq {,}}
\str_if_empty:NF \sdefinitiontype {
- \stex_annotate_invisible:nnn{type}{\sdefinitiontype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sdefinitiontype}{}
+ }
+ \str_if_empty:NF \sdefinitionname {
+ \stex_annotate_invisible:nnn{statementname}{\sdefinitionname}{}
}
\clist_set:No \l_tmpa_clist \sdefinitiontype
\tl_clear:N \l_tmpa_tl
@@ -238,7 +282,9 @@
\stex_ref_new_doc_target:n \sdefinitionid
\stex_smsmode_do:
}{
- \str_if_empty:NF \sdefinitionname { \stex_symdecl_do:nn{}{\sdefinitionname} }
+ \stex_suppress_html:n {
+ \str_if_empty:NF \sdefinitionname { \stex_symdecl_do:nn{}{\sdefinitionname} }
+ }
\stex_if_smsmode:F {
\clist_set:No \l_tmpa_clist \sdefinitiontype
\tl_clear:N \l_tmpa_tl
@@ -261,11 +307,11 @@
% \begin{macro}{\stexpatchdefinition}
% \begin{macrocode}
\cs_new_protected:Nn \_@@_sdefinition_start: {
- \par\noindent\titleemph{Definition\tl_if_empty:NF \sdefinitiontitle {
+ \stex_par:\noindent\titleemph{Definition\tl_if_empty:NF \sdefinitiontitle {
~(\sdefinitiontitle)
}~}
}
-\cs_new_protected:Nn \_@@_sdefinition_end: {\par\medskip}
+\cs_new_protected:Nn \_@@_sdefinition_end: {\stex_par:\medskip}
\newcommand\stexpatchdefinition[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
@@ -304,26 +350,31 @@
\stex_reactivate_macro:N \Definame
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \definiens
+ \stex_reactivate_macro:N \varbindforall
\stex_ref_new_doc_target:n \sdefinitionid
- \stex_if_smsmode:TF{
+ \stex_if_smsmode:TF{\stex_suppress_html:n {
\str_if_empty:NF \sdefinitionname { \stex_symdecl_do:nn{}{\sdefinitionname} }
- }{
- \seq_clear:N \l_tmpa_seq
+ }}{
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l_@@_sdefinition_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
+ \clist_set_from_seq:NN \l_@@_sdefinition_for_clist \l_tmpb_seq
\exp_args:Nnx
- \stex_annotate:nnn{definition}{\seq_use:Nn \l_tmpa_seq {,}}{
+ \stex_annotate:nnn{definition}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sdefinitiontype {
- \stex_annotate_invisible:nnn{type}{\sdefinitiontype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sdefinitiontype}{}
}
#2
- \str_if_empty:NF \sdefinitionname { \stex_symdecl_do:nn{}{\sdefinitionname} }
+ \str_if_empty:NF \sdefinitionname {
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sdefinitionname}}
+ \stex_annotate_invisible:nnn{statementname}{\sdefinitionname}{}
+ }
}
}
\endgroup
@@ -359,21 +410,25 @@
\_@@_sassertion_args:n{ #1 }
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \conclusion
+ \stex_reactivate_macro:N \varbindforall
\stex_if_smsmode:F {
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l_@@_sassertion_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnnx
- \begin{stex_annotate_env}{assertion}{\seq_use:Nn \l_tmpa_seq {,}}
+ \begin{stex_annotate_env}{assertion}{\seq_use:Nn \l_tmpb_seq {,}}
\str_if_empty:NF \sassertiontype {
\stex_annotate_invisible:nnn{type}{\sassertiontype}{}
}
+ \str_if_empty:NF \sassertionname {
+ \stex_annotate_invisible:nnn{statementname}{\sassertionname}{}
+ }
\clist_set:No \l_tmpa_clist \sassertiontype
\tl_clear:N \l_tmpa_tl
\clist_map_inline:Nn \l_tmpa_clist {
@@ -397,7 +452,7 @@
\stex_smsmode_do:
}{
\str_if_empty:NF \sassertionname {
- \stex_symdecl_do:nn{}{\sassertionname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sassertionname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sassertionname}
}
\stex_if_smsmode:F {
@@ -423,11 +478,11 @@
% \begin{macrocode}
\cs_new_protected:Nn \_@@_sassertion_start: {
- \par\noindent\titleemph{Assertion~\tl_if_empty:NF \sassertiontitle {
+ \stex_par:\noindent\titleemph{Assertion~\tl_if_empty:NF \sassertiontitle {
(\sassertiontitle)
}~}
}
-\cs_new_protected:Nn \_@@_sassertion_end: {\par\medskip}
+\cs_new_protected:Nn \_@@_sassertion_end: {\stex_par:\medskip}
\newcommand\stexpatchassertion[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
@@ -462,6 +517,7 @@
\begingroup
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \conclusion
+ \stex_reactivate_macro:N \varbindforall
\_@@_inlineass_args:n{ #1 }
\str_if_empty:NTF \sassertionid {
\str_if_empty:NF \sassertionname {
@@ -473,28 +529,29 @@
\stex_if_smsmode:TF{
\str_if_empty:NF \sassertionname {
- \stex_symdecl_do:nn{}{\sassertionname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sassertionname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sassertionname}
}
}{
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l_@@_sassertion_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnx
- \stex_annotate:nnn{assertion}{\seq_use:Nn \l_tmpa_seq {,}}{
+ \stex_annotate:nnn{assertion}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sassertiontype {
- \stex_annotate_invisible:nnn{type}{\sassertiontype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sassertiontype}{}
}
#2
\str_if_empty:NF \sassertionname {
- \stex_symdecl_do:nn{}{\sassertionname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sassertionname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sassertionname}
+ \stex_annotate_invisible:nnn{statementname}{\sassertionname}{}
}
}
}
@@ -513,11 +570,13 @@
type .str_set_x:N = \exampletype,
id .str_set_x:N = \sexampleid,
title .tl_set:N = \sexampletitle,
+ name .str_set_x:N = \sexamplename ,
for .clist_set:N = \l_@@_sexample_for_clist,
}
\cs_new_protected:Nn \_@@_sexample_args:n {
\str_clear:N \sexampletype
\str_clear:N \sexampleid
+ \str_clear:N \sexamplename
\tl_clear:N \sexampletitle
\clist_clear:N \l_@@_sexample_for_clist
\keys_set:nn { stex / sexample }{ #1 }
@@ -528,19 +587,22 @@
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \conclusion
\stex_if_smsmode:F {
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l_@@_sexample_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnnx
- \begin{stex_annotate_env}{example}{\seq_use:Nn \l_tmpa_seq {,}}
+ \begin{stex_annotate_env}{example}{\seq_use:Nn \l_tmpb_seq {,}}
\str_if_empty:NF \sexampletype {
- \stex_annotate_invisible:nnn{type}{\sexampletype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sexampletype}{}
+ }
+ \str_if_empty:NF \sexamplename {
+ \stex_annotate_invisible:nnn{statementname}{\sexamplename}{}
}
\clist_set:No \l_tmpa_clist \sexampletype
\tl_clear:N \l_tmpa_tl
@@ -560,7 +622,9 @@
}
\stex_smsmode_do:
}{
- \str_if_empty:NF \sexamplename { \stex_symdecl_do:nn{}{\sexamplename} }
+ \str_if_empty:NF \sexamplename {
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sexamplename}}
+ }
\stex_if_smsmode:F {
\clist_set:No \l_tmpa_clist \sexampletype
\tl_clear:N \l_tmpa_tl
@@ -584,11 +648,11 @@
% \begin{macrocode}
\cs_new_protected:Nn \_@@_sexample_start: {
- \par\noindent\titleemph{Example~\tl_if_empty:NF \sexampletitle {
+ \stex_par:\noindent\titleemph{Example~\tl_if_empty:NF \sexampletitle {
(\sexampletitle)
}~}
}
-\cs_new_protected:Nn \_@@_sexample_end: {\par\medskip}
+\cs_new_protected:Nn \_@@_sexample_end: {\stex_par:\medskip}
\newcommand\stexpatchexample[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
@@ -628,24 +692,29 @@
\stex_ref_new_doc_target:n \sexampleid
}
\stex_if_smsmode:TF{
- \str_if_empty:NF \sexamplename { \stex_symdecl_do:nn{}{\examplename} }
+ \str_if_empty:NF \sexamplename {
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\examplename}}
+ }
}{
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l_@@_sexample_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnx
- \stex_annotate:nnn{example}{\seq_use:Nn \l_tmpa_seq {,}}{
+ \stex_annotate:nnn{example}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sexampletype {
- \stex_annotate_invisible:nnn{type}{\sexampletype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sexampletype}{}
}
#2
- \str_if_empty:NF \sexamplename { \stex_symdecl_do:nn{}{\sexamplename} }
+ \str_if_empty:NF \sexamplename {
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sexamplename}}
+ \stex_annotate_invisible:nnn{statementname}{\sexamplename}{}
+ }
}
}
\endgroup
@@ -666,7 +735,8 @@
from .tl_set:N = \sparagraphfrom ,
to .tl_set:N = \sparagraphto ,
start .tl_set:N = \l_stex_sparagraph_start_tl ,
- name .str_set:N = \sparagraphname
+ name .str_set:N = \sparagraphname ,
+ imports .tl_set:N = \l_@@_sparagraph_imports_tl
}
\cs_new_protected:Nn \stex_sparagraph_args:n {
@@ -674,6 +744,7 @@
\tl_clear:N \sparagraphfrom
\tl_clear:N \sparagraphto
\tl_clear:N \l_stex_sparagraph_start_tl
+ \tl_clear:N \l_@@_sparagraph_imports_tl
\str_clear:N \sparagraphid
\str_clear:N \sparagraphtype
\clist_clear:N \l_@@_sparagraph_for_clist
@@ -691,19 +762,19 @@
}
\@in@omtexttrue
\stex_if_smsmode:F {
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l_@@_sparagraph_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnnx
- \begin{stex_annotate_env}{paragraph}{\seq_use:Nn \l_tmpa_seq {,}}
+ \begin{stex_annotate_env}{paragraph}{\seq_use:Nn \l_tmpb_seq {,}}
\str_if_empty:NF \sparagraphtype {
- \stex_annotate_invisible:nnn{type}{\sparagraphtype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sparagraphtype}{}
}
\str_if_empty:NF \sparagraphfrom {
\stex_annotate_invisible:nnn{from}{\sparagraphfrom}{}
@@ -711,6 +782,9 @@
\str_if_empty:NF \sparagraphto {
\stex_annotate_invisible:nnn{to}{\sparagraphto}{}
}
+ \str_if_empty:NF \sparagraphname {
+ \stex_annotate_invisible:nnn{statementname}{\sparagraphname}{}
+ }
\clist_set:No \l_tmpa_clist \sparagraphtype
\tl_clear:N \l_tmpa_tl
\clist_map_inline:Nn \sparagraphtype {
@@ -718,6 +792,7 @@
\tl_set:Nn \l_tmpa_tl {\use:c{_@@_sparagraph_##1_start:}}
}
}
+ \stex_csl_to_imports:No \usemodule \l_@@_sparagraph_imports_tl
\tl_if_empty:NTF \l_tmpa_tl {
\_@@_sparagraph_start:
}{
@@ -725,6 +800,14 @@
}
}
\clist_set:No \l_tmpa_clist \sparagraphtype
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\tl_to_str:n{symdoc}}
+ {
+ \stex_reactivate_macro:N \definiendum
+ \stex_reactivate_macro:N \definame
+ \stex_reactivate_macro:N \Definame
+ \stex_reactivate_macro:N \premise
+ \stex_reactivate_macro:N \definiens
+ }
\str_if_empty:NTF \sparagraphid {
\str_if_empty:NTF \sparagraphname {
\exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\tl_to_str:n{symdoc}}{
@@ -749,7 +832,7 @@
\ignorespacesandpars
}{
\str_if_empty:NF \sparagraphname {
- \stex_symdecl_do:nn{}{\sparagraphname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sparagraphname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sparagraphname}
}
\stex_if_smsmode:F {
@@ -775,7 +858,7 @@
% \begin{macrocode}
\cs_new_protected:Nn \_@@_sparagraph_start: {
- \par\noindent\tl_if_empty:NTF \l_stex_sparagraph_start_tl {
+ \stex_par:\noindent\tl_if_empty:NTF \l_stex_sparagraph_start_tl {
\tl_if_empty:NF \l_stex_sparagraph_title_tl {
\titleemph{\l_stex_sparagraph_title_tl}:~
}
@@ -783,7 +866,7 @@
\titleemph{\l_stex_sparagraph_start_tl}~
}
}
-\cs_new_protected:Nn \_@@_sparagraph_end: {\par\medskip}
+\cs_new_protected:Nn \_@@_sparagraph_end: {\stex_par:\medskip}
\newcommand\stexpatchparagraph[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
@@ -830,23 +913,23 @@
}
\stex_if_smsmode:TF{
\str_if_empty:NF \sparagraphname {
- \stex_symdecl_do:nn{}{\sparagraphname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sparagraphname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sparagraphname}
}
}{
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l_@@_sparagraph_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnx
- \stex_annotate:nnn{paragraph}{\seq_use:Nn \l_tmpa_seq {,}}{
+ \stex_annotate:nnn{paragraph}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sparagraphtype {
- \stex_annotate_invisible:nnn{type}{\sparagraphtype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sparagraphtype}{}
}
\str_if_empty:NF \sparagraphfrom {
\stex_annotate_invisible:nnn{from}{\sparagraphfrom}{}
@@ -855,11 +938,12 @@
\stex_annotate_invisible:nnn{to}{\sparagraphto}{}
}
\str_if_empty:NF \sparagraphname {
- \stex_symdecl_do:nn{}{\sparagraphname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sparagraphname}}
+ \stex_annotate_invisible:nnn{statementname}{\sparagraphname}{}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sparagraphname}
}
\exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\tl_to_str:n{symdoc}}{
- \clist_map_inline:Nn \l_tmpa_seq {
+ \clist_map_inline:Nn \l_tmpb_seq {
\stex_ref_new_sym_target:n {##1}
}
}
@@ -898,6 +982,7 @@
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-symbols.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-symbols.dtx
index a8b88cfe726..ba9fa5f0973 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-symbols.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-symbols.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -34,12 +34,17 @@
% This is the documentation for the \pkg{stex-symbols} package.
% For a more high-level introduction,
% see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
-% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
+%
+% \tableofcontents
%
% \input{../../doc/packages/stex-symbols}
% \fi
%
% \begin{documentation}\label{pkg:symbols:doc}
+% \changes{3.1.0}{2022/03/03}{Introduced sequence variables}
+% \changes{3.1.0}{2022/03/01}{Fixed bug with precedences in variables}
+% \changes{3.1.0}{2022/03/01}{Introduced \detokenize{\varemph, \varemph@uri}}
%
% Code related to symbol declarations and notations
%
@@ -51,7 +56,9 @@
% arguments are:
% \begin{itemize}
% \item |name|: An (\omdoc) name. By default equal to \meta{macroname}.
-% \item |type|: An (ideally semantic) term. Not used by \sTeX, but
+% \item |type|: An (ideally semantic) term, representing a \emph{type}. Not used by \sTeX, but
+% passed on to \mmt for semantic services.
+% \item |def|: An (ideally semantic) term, representing a \emph{definiens}. Not used by \sTeX, but
% passed on to \mmt for semantic services.
% \item |local|: A boolean (by default false). If set, this declaration
% will not be added to the module content, i.e. importing
@@ -152,6 +159,15 @@
args~value~in~symbol~declaration~for~#1~
needs~to~be~i,~a,~b~or~B,~but~#2~given
}
+\msg_new:nnn{stex}{error/unknownsymbol}{
+ No~symbol~#1~found!
+}
+\msg_new:nnn{stex}{error/seqlength}{
+ Expected~#1~arguments;~got~#2!
+}
+\msg_new:nnn{stex}{error/unknownnotation}{
+ Unknown~notation~#1~for~#2!
+}
% \end{macrocode}
%
% \subsection{Symbol Declarations}
@@ -196,6 +212,7 @@
gfc .str_set:N = \l_stex_symdecl_gfc_str , % TODO(?)
specializes .str_set:N = \l_stex_symdecl_specializes_str , % TODO(?)
def .tl_set:N = \l_stex_symdecl_definiens_tl ,
+ reorder .str_set_x:N = \l_stex_symdecl_reorder_str ,
assoc .choices:nn =
{bin,binl,binr,pre,conj,pwconj}
{\str_set:Nx \l_stex_symdecl_assoctype_str {\l_keys_choice_tl}}
@@ -207,6 +224,7 @@
\str_clear:N \l_stex_symdecl_name_str
\str_clear:N \l_stex_symdecl_args_str
\str_clear:N \l_stex_symdecl_deprecate_str
+ \str_clear:N \l_stex_symdecl_reorder_str
\str_clear:N \l_stex_symdecl_assoctype_str
\bool_set_false:N \l_stex_symdecl_local_bool
\tl_clear:N \l_stex_symdecl_type_tl
@@ -327,6 +345,11 @@
}
\prop_put:Nnx \l_tmpa_prop { assocs } { \int_use:N \l_tmpb_int }
+ \tl_if_empty:NTF \l_stex_symdecl_definiens_tl {
+ \prop_put:Nnx \l_tmpa_prop { defined }{ false }
+ }{
+ \prop_put:Nnx \l_tmpa_prop { defined }{ true }
+ }
% semantic macro
@@ -336,90 +359,116 @@
\l_stex_current_module_str ? \l_stex_symdecl_name_str
}}
}
-
- \bool_if:NF \l_stex_symdecl_local_bool {
- \exp_args:Nx \stex_add_to_current_module:n {
- \tl_set:cn { #1 } { \stex_invoke_symbol:n {
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- } }
- }
- }
}
\stex_debug:nn{symbols}{New~symbol:~
\l_stex_current_module_str ? \l_stex_symdecl_name_str^^J
Type:~\exp_not:o { \l_stex_symdecl_type_tl }^^J
- Args:~\prop_item:Nn \l_tmpa_prop { args }
+ Args:~\prop_item:Nn \l_tmpa_prop { args }^^J
+ Definiens:~\exp_not:o {\l_stex_symdecl_definiens_tl}
}
% circular dependencies require this:
-
+ \stex_if_do_html:T {
+ \stex_annotate_invisible:nnn {symdecl} {
+ \l_stex_current_module_str ? \l_stex_symdecl_name_str
+ } {
+ \tl_if_empty:NF \l_stex_symdecl_type_tl {
+ \stex_annotate_invisible:nnn{type}{}{$\l_stex_symdecl_type_tl$}
+ }
+ \stex_annotate_invisible:nnn{args}{\prop_item:Nn \l_tmpa_prop { args }}{}
+ \stex_annotate_invisible:nnn{macroname}{#1}{}
+ \tl_if_empty:NF \l_stex_symdecl_definiens_tl {
+ \stex_annotate_invisible:nnn{definiens}{}
+ {$\l_stex_symdecl_definiens_tl$}
+ }
+ \str_if_empty:NF \l_stex_symdecl_assoctype_str {
+ \stex_annotate_invisible:nnn{assoctype}{\l_stex_symdecl_assoctype_str}{}
+ }
+ \str_if_empty:NF \l_stex_symdecl_reorder_str {
+ \stex_annotate_invisible:nnn{reorderargs}{\l_stex_symdecl_reorder_str}{}
+ }
+ }
+ }
\prop_if_exist:cF {
l_stex_symdecl_
\l_stex_current_module_str ? \l_stex_symdecl_name_str
_prop
} {
- \prop_set_eq:cN {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- _prop
- } \l_tmpa_prop
+ \bool_if:NTF \l_stex_symdecl_local_bool \stex_do_up_to_module:x \stex_execute_in_module:x {
+ \_@@_restore_symbol:nnnnnnn
+ {\l_stex_symdecl_name_str}
+ { \prop_item:Nn \l_tmpa_prop {args} }
+ { \prop_item:Nn \l_tmpa_prop {arity} }
+ { \prop_item:Nn \l_tmpa_prop {assocs} }
+ { \prop_item:Nn \l_tmpa_prop {defined} }
+ {\bool_if:NT \l_stex_symdecl_make_macro_bool {#1} }
+ {\l_stex_current_module_str}
+ }
}
-
- \seq_clear:c {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- _notations
+}
+\cs_new_protected:Nn \_@@_restore_symbol:nnnnnnn {
+ \prop_clear:N \l_tmpa_prop
+ \prop_put:Nnn \l_tmpa_prop { module } { #7 }
+ \prop_put:Nnn \l_tmpa_prop { name } { #1}
+ \prop_put:Nnn \l_tmpa_prop { args } {#2}
+ \prop_put:Nnn \l_tmpa_prop { arity } { #3 }
+ \prop_put:Nnn \l_tmpa_prop { assocs } { #4 }
+ \prop_put:Nnn \l_tmpa_prop { defined } { #5 }
+ \tl_if_empty:nF{#6}{
+ \tl_set:cx{#6}{\stex_invoke_symbol:n{\detokenize{#7 ? #1}}}
}
+ \prop_set_eq:cN{l_stex_symdecl_ \detokenize{#7 ? #1} _prop}\l_tmpa_prop
+ \seq_clear:c{l_stex_symdecl_ \detokenize{#7 ? #1} _notations}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\textsymdecl}
+% \begin{macrocode}
- \bool_if:NF \l_stex_symdecl_local_bool {
- \exp_args:Nx
- \stex_add_to_current_module:n {
- \seq_clear:c {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- _notations
- }
- \prop_set_from_keyval:cn {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- _prop
- } {
- name = \prop_item:Nn \l_tmpa_prop { name } ,
- module = \prop_item:Nn \l_tmpa_prop { module } ,
- type = \prop_item:Nn \l_tmpa_prop { type } ,
- args = \prop_item:Nn \l_tmpa_prop { args } ,
- arity = \prop_item:Nn \l_tmpa_prop { arity } ,
- assocs = \prop_item:Nn \l_tmpa_prop { assocs }
- }
- }
- }
+\keys_define:nn { stex / textsymdecl } {
+ name .str_set_x:N = \l_@@_name_str ,
+ type .tl_set:N = \l_@@_type_tl
+}
- \stex_if_smsmode:F {
-% \exp_args:Nx \stex_do_up_to_module:n {
-% \seq_put_right:Nn \exp_not:N \l_stex_all_symbols_seq {
-% \l_stex_current_module_str ? \l_stex_symdecl_name_str
-% }
-% }
- \stex_if_do_html:T {
- \stex_annotate_invisible:nnn {symdecl} {
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- } {
- \tl_if_empty:NF \l_stex_symdecl_type_tl {\stex_annotate_invisible:nnn{type}{}{$\l_stex_symdecl_type_tl$}}
- \stex_annotate_invisible:nnn{args}{}{
- \prop_item:Nn \l_tmpa_prop { args }
- }
- \stex_annotate_invisible:nnn{macroname}{#1}{}
- \tl_if_empty:NF \l_stex_symdecl_definiens_tl {
- \stex_annotate_invisible:nnn{definiens}{}
- {$\l_stex_symdecl_definiens_tl$}
- }
- \str_if_empty:NF \l_stex_symdecl_assoctype_str {
- \stex_annotate_invisible:nnn{assoctype}{\l_stex_symdecl_assoctype_str}{}
- }
- }
+\cs_new_protected:Nn \_stex_textsymdecl_args:n {
+ \str_clear:N \l_@@_name_str
+ \tl_clear:N \l_@@_type_tl
+ \keys_set:nn { stex / textsymdecl } { #1 }
+}
+
+\NewDocumentCommand \textsymdecl {m O{} m} {
+ \_stex_textsymdecl_args:n { #2 }
+ \str_if_empty:NTF \l_@@_name_str {
+ \_@@_args:n{name=#1,#2}
+ }{
+ \_@@_args:n{#2}
+ }
+ \bool_set_true:N \l_stex_symdecl_make_macro_bool
+ \stex_symdecl_do:n{#1-sym}
+ \stex_execute_in_module:n{
+ \cs_set_nopar:cpn{#1name}{
+ \ifvmode\hbox_unpack:N\c_empty_box\fi
+ \hbox{#3}\xspace
+ }
+ \cs_set_nopar:cpn{#1}{
+ \ifmmode\csname#1-sym\expandafter\endcsname\else
+ \ifvmode\hbox_unpack:N\c_empty_box\fi
+ \symref{#1-sym}{\hbox{#3}}\expandafter\xspace
+ \fi
}
}
+ \stex_execute_in_module:x{
+ \__stex_notation_restore_notation:nnnnn
+ {\l_stex_current_module_str?\tl_if_empty:NTF\l_@@_name_str{#1}\l_@@_name_str}
+ {}{0}
+ {\exp_not:n{\STEXInternalTermMathOMSiiii{\STEXInternalCurrentSymbolStr}{}{\neginfprec}{
+ \comp{\hbox{#3}}\STEXInternalSymbolAfterInvokationTL
+ }}}
+ {}
+ }
+ \stex_smsmode_do:
}
% \end{macrocode}
% \end{macro}
@@ -431,7 +480,8 @@
\cs_new_protected:Nn \stex_get_symbol:n {
\tl_if_head_eq_catcode:nNTF { #1 } \relax {
- \_@@_get_symbol_from_cs:n { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \_@@_get_symbol_from_cs:
}{
% argument is a string
% is it a command name?
@@ -442,7 +492,7 @@
\exp_args:Nx \cs_if_eq:NNTF {
\tl_head:N \l_tmpa_tl
} \stex_invoke_symbol:n {
- \exp_args:No \_@@_get_symbol_from_cs:n { \use:c { #1 } }
+ \_@@_get_symbol_from_cs:
}{
\_@@_get_symbol_from_string:n { #1 }
}
@@ -470,28 +520,52 @@
\cs_new_protected:Nn \_@@_get_symbol_from_string:n {
\tl_set:Nn \l_tmpa_tl {
- \msg_set:nnn{stex}{error/unknownsymbol}{
- No~symbol~#1~found!
- }
- \msg_error:nn{stex}{error/unknownsymbol}
+ \msg_error:nnn{stex}{error/unknownsymbol}{#1}
}
\str_set:Nn \l_tmpa_str { #1 }
- \int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
- \stex_all_symbols:n {
- \str_if_eq:eeT { \l_tmpa_str }{ \str_range:nnn {##1}{-\l_tmpa_int}{-1}}{
- \seq_map_break:n{\seq_map_break:n{
- \tl_set:Nn \l_tmpa_tl {
- \str_set:Nn \l_stex_get_symbol_uri_str { ##1 }
+ %\int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
+
+ \str_if_in:NnTF \l_tmpa_str ? {
+ \exp_args:NNno \seq_set_split:Nnn \l_tmpa_seq ? \l_tmpa_str
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \str_set:Nx \l_tmpb_str {\seq_use:Nn \l_tmpa_seq ?}
+ }{
+ \str_clear:N \l_tmpb_str
+ }
+ \str_if_empty:NTF \l_tmpb_str {
+ \seq_map_inline:Nn \l_stex_all_modules_seq {
+ \seq_map_inline:cn{c_stex_module_##1_constants}{
+ \exp_args:Nno \str_if_eq:nnT{####1} \l_tmpa_str {
+ \seq_map_break:n{\seq_map_break:n{
+ \tl_set:Nn \l_tmpa_tl {
+ \str_set:Nn \l_stex_get_symbol_uri_str { ##1 ? ####1 }
+ }
+ }}
}
- }}
+ }
+ }
+ }{
+ \int_set:Nn \l_tmpa_int { \str_count:N \l_tmpb_str }
+ \seq_map_inline:Nn \l_stex_all_modules_seq {
+ \str_if_eq:eeT{ \l_tmpb_str }{ \str_range:nnn {##1}{-\l_tmpa_int}{-1}}{
+ \seq_map_inline:cn{c_stex_module_##1_constants}{
+ \exp_args:Nno \str_if_eq:nnT{####1} \l_tmpa_str {
+ \seq_map_break:n{\seq_map_break:n{
+ \tl_set:Nn \l_tmpa_tl {
+ \str_set:Nn \l_stex_get_symbol_uri_str { ##1 ? ####1 }
+ }
+ }}
+ }
+ }
+ }
}
}
\l_tmpa_tl
}
-\cs_new_protected:Nn \_@@_get_symbol_from_cs:n {
+\cs_new_protected:Nn \_@@_get_symbol_from_cs: {
\exp_args:NNx \tl_set:Nn \l_tmpa_tl
{ \tl_tail:N \l_tmpa_tl }
\tl_if_single:NTF \l_tmpa_tl {
@@ -519,7 +593,7 @@
%
% \begin{macrocode}
\keys_define:nn { stex / notation } {
- lang .tl_set_x:N = \l_@@_lang_str ,
+% lang .tl_set_x:N = \l_@@_lang_str ,
variant .tl_set_x:N = \l_@@_variant_str ,
prec .str_set_x:N = \l_@@_prec_str ,
op .tl_set:N = \l_@@_op_tl ,
@@ -530,7 +604,7 @@
}
\cs_new_protected:Nn \_stex_notation_args:n {
- \str_clear:N \l_@@_lang_str
+% \str_clear:N \l_@@_lang_str
\str_clear:N \l_@@_variant_str
\str_clear:N \l_@@_prec_str
\tl_clear:N \l_@@_op_tl
@@ -553,31 +627,33 @@
\IfBooleanTF#1{
\stex_setnotation:n {\l_stex_get_symbol_uri_str}
}{}
- \stex_smsmode_do:
+ \stex_smsmode_do:\ignorespacesandpars
}
- \stex_notation_do:nnnn
+ \stex_notation_do:nnnnn
{ \prop_item:cn {l_stex_symdecl_\l_stex_get_symbol_uri_str _prop } { args } }
{ \prop_item:cn { l_stex_symdecl_\l_stex_get_symbol_uri_str _prop } { arity } }
- { \l_@@_variant_str \c_hash_str \l_@@_lang_str }
+ { \l_@@_variant_str }
+ { \l_@@_prec_str}
}
\stex_deactivate_macro:Nn \notation {module~environments}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\stex_notation_do:nnnn}
+% \begin{macro}{\stex_notation_do:nnnnn}
% \begin{macrocode}
\seq_new:N \l_@@_precedences_seq
\tl_new:N \l_@@_opprec_tl
\int_new:N \l_@@_currarg_int
-\tl_new:N \stex_symbol_after_invocation_tl
+\tl_new:N \STEXInternalSymbolAfterInvokationTL
-\cs_new_protected:Nn \stex_notation_do:nnnn {
- \let\l_stex_current_symbol_str\relax
+\cs_new_protected:Nn \stex_notation_do:nnnnn {
+ \let\STEXInternalCurrentSymbolStr\relax
\seq_clear:N \l_@@_precedences_seq
\tl_clear:N \l_@@_opprec_tl
\str_set:Nx \l_@@_args_str { #1 }
\str_set:Nx \l_@@_arity_str { #2 }
- \str_set:Nx \_@@_suffix_str { #3 }
+ \str_set:Nx \l_@@_suffix_str { #3 }
+ \str_set:Nx \l_@@_prec_str { #4 }
% precedences
\str_if_empty:NTF \l_@@_prec_str {
@@ -628,10 +704,10 @@
\int_compare:nNnTF \l_@@_arity_str = 0 {
\exp_args:NNe
\cs_set:Npn \l_stex_notation_macrocode_cs {
- \_stex_term_math_oms:nnnn { \l_stex_current_symbol_str }
- { \_@@_suffix_str }
+ \STEXInternalTermMathOMSiiii { \STEXInternalCurrentSymbolStr }
+ { \l_@@_suffix_str }
{ \l_@@_opprec_tl }
- { \exp_not:n { #4 } }
+ { \exp_not:n { #5 } }
}
\l_stex_notation_after_do_tl
}{
@@ -640,10 +716,10 @@
{
\cs_generate_from_arg_count:NNnn \l_stex_notation_macrocode_cs
\cs_set:Npn \l_@@_arity_str } { {
- \_stex_term_math_omb:nnnn { \l_stex_current_symbol_str }
- { \_@@_suffix_str }
+ \STEXInternalTermMathOMBiiii { \STEXInternalCurrentSymbolStr }
+ { \l_@@_suffix_str }
{ \l_@@_opprec_tl }
- { \exp_not:n { #4 } }
+ { \exp_not:n { #5 } }
}}
}{
\str_if_in:NnTF \l_@@_args_str B {
@@ -651,20 +727,20 @@
{
\cs_generate_from_arg_count:NNnn \l_stex_notation_macrocode_cs
\cs_set:Npn \l_@@_arity_str } { {
- \_stex_term_math_omb:nnnn { \l_stex_current_symbol_str }
- { \_@@_suffix_str }
+ \STEXInternalTermMathOMBiiii { \STEXInternalCurrentSymbolStr }
+ { \l_@@_suffix_str }
{ \l_@@_opprec_tl }
- { \exp_not:n { #4 } }
+ { \exp_not:n { #5 } }
} }
}{
\exp_args:Nne \use:nn
{
\cs_generate_from_arg_count:NNnn \l_stex_notation_macrocode_cs
\cs_set:Npn \l_@@_arity_str } { {
- \_stex_term_math_oma:nnnn { \l_stex_current_symbol_str }
- { \_@@_suffix_str }
+ \STEXInternalTermMathOMAiiii { \STEXInternalCurrentSymbolStr }
+ { \l_@@_suffix_str }
{ \l_@@_opprec_tl }
- { \exp_not:n { #4 } }
+ { \exp_not:n { #5 } }
} }
}
}
@@ -692,16 +768,16 @@
\str_set:Nx \l_tmpa_str { \str_head:N \l_@@_remaining_args_str }
\str_set:Nx \l_@@_remaining_args_str { \str_tail:N \l_@@_remaining_args_str }
\str_if_eq:VnTF \l_tmpa_str a {
- \_@@_argument_assoc:n
+ \_@@_argument_assoc:nn{a}
}{
\str_if_eq:VnTF \l_tmpa_str B {
- \_@@_argument_assoc:n
+ \_@@_argument_assoc:nn{B}
}{
- \seq_pop_left:NN \l_@@_remaining_precs_seq \l_tmpa_str
+ \seq_pop_left:NN \l_@@_remaining_precs_seq \l_tmpb_str
\tl_put_right:Nx \l_stex_notation_dummyargs_tl {
- { \_stex_term_math_arg:nnn
- { \int_use:N \l_@@_currarg_int }
- { \l_tmpa_str }
+ { \STEXInternalTermMathArgiii
+ { \l_tmpa_str\int_use:N \l_@@_currarg_int }
+ { \l_tmpb_str }
{ ####\int_use:N \l_@@_currarg_int }
}
}
@@ -713,13 +789,13 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\_@@_argument_assoc:n}
+% \begin{macro}{\_@@_argument_assoc:nn}
% \begin{macrocode}
-\cs_new_protected:Nn \_@@_argument_assoc:n {
+\cs_new_protected:Nn \_@@_argument_assoc:nn {
\cs_generate_from_arg_count:NNnn \l_tmpa_cs \cs_set:Npn
{\l_@@_arity_str}{
- #1
+ #2
}
\int_zero:N \l_tmpa_int
\tl_clear:N \l_tmpa_tl
@@ -728,7 +804,7 @@
\tl_put_right:Nx \l_tmpa_tl {
\str_if_eq:nnTF {##1}{a}{ {} }{
\str_if_eq:nnTF {##1}{B}{ {} }{
- {\_stex_term_arg:nn{\int_use:N \l_tmpa_int}{################ \int_use:N \l_tmpa_int}}
+ {\_stex_term_arg:nn{##1\int_use:N \l_tmpa_int}{################ \int_use:N \l_tmpa_int}}
}
}
}
@@ -748,8 +824,8 @@
\seq_pop_left:NN \l_@@_remaining_precs_seq \l_tmpa_str
\tl_put_right:Nx \l_stex_notation_dummyargs_tl { {
- \_stex_term_math_assoc_arg:nnnn
- { \int_use:N \l_@@_currarg_int }
+ \STEXInternalTermMathAssocArgiiii
+ { #1\int_use:N \l_@@_currarg_int }
{ \l_tmpa_str }
{ ####\int_use:N \l_@@_currarg_int }
{ \l_tmpa_cs {####1} {####2} }
@@ -764,132 +840,88 @@
% Called after processing all notation arguments
%
% \begin{macrocode}
-\cs_new_protected:Nn \_@@_final: {
- \exp_args:Nne \use:nn
- {
- \cs_generate_from_arg_count:cNnn {
- stex_notation_ \l_stex_get_symbol_uri_str \c_hash_str
- \_@@_suffix_str
- _cs
- }
- \cs_set:Npn \l_@@_arity_str } { {
- \exp_after:wN \exp_after:wN \exp_after:wN
- \exp_not:n \exp_after:wN \exp_after:wN \exp_after:wN
- { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \stex_symbol_after_invocation_tl}
- } }
-
- \tl_if_empty:NF \l_@@_op_tl {
- \cs_set:cpx {
- stex_op_notation_ \l_stex_get_symbol_uri_str \c_hash_str
- \_@@_suffix_str
- _cs
- } {
- \_stex_term_oms:nnn {
- \l_stex_get_symbol_uri_str \c_hash_str \_@@_suffix_str
- }{
- \l_stex_get_symbol_uri_str
- }{ \comp{ \exp_args:No \exp_not:n { \l_@@_op_tl } } }
- }
+\cs_new_protected:Nn \_@@_restore_notation:nnnnn {
+ \cs_generate_from_arg_count:cNnn{stex_notation_\detokenize{#1} \c_hash_str \detokenize{#2}_cs}
+ \cs_set_nopar:Npn {#3}{#4}
+ \tl_if_empty:nF {#5}{
+ \tl_set:cn{stex_op_notation_\detokenize{#1} \c_hash_str \detokenize{#2}_cs}{ \comp{ #5 } }
+ }
+ \seq_if_exist:cT { l_stex_symdecl_\detokenize{#1} _notations }{
+ \seq_put_right:cx { l_stex_symdecl_\detokenize{#1} _notations } { \detokenize{#2} }
}
+}
- \exp_args:Ne
- \stex_add_to_current_module:n {
- \cs_generate_from_arg_count:cNnn {
- stex_notation_ \l_stex_get_symbol_uri_str \c_hash_str
- \_@@_suffix_str
- _cs
- } \cs_set:Npn {\l_@@_arity_str} {
+\cs_new_protected:Nn \_@@_final: {
+
+ \stex_execute_in_module:x {
+ \_@@_restore_notation:nnnnn
+ {\l_stex_get_symbol_uri_str}
+ {\l_@@_suffix_str}
+ {\l_@@_arity_str}
+ {
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_not:n \exp_after:wN \exp_after:wN \exp_after:wN
- { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \stex_symbol_after_invocation_tl}
- }
- \tl_if_empty:NF \l_@@_op_tl {
- \cs_set:cpn {
- stex_op_notation_\l_stex_get_symbol_uri_str \c_hash_str
- \_@@_suffix_str
- _cs
- } {
- \_stex_term_oms:nnn {
- \l_stex_get_symbol_uri_str\c_hash_str \_@@_suffix_str
- }{
- \l_stex_get_symbol_uri_str
- }{ \comp{ \exp_args:No \exp_not:n { \l_@@_op_tl } } }
+ { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \STEXInternalSymbolAfterInvokationTL}
}
- }
+ {\exp_args:No \exp_not:n \l_@@_op_tl }
}
- %\exp_args:Nx
- % \stex_do_up_to_module:n {
- \seq_put_right:cx {
- l_stex_symdecl_ \l_stex_get_symbol_uri_str
- _notations
- } {
- \_@@_suffix_str
- }
- % }
\stex_debug:nn{symbols}{
- Notation~\_@@_suffix_str
+ Notation~\l_@@_suffix_str
~for~\l_stex_get_symbol_uri_str^^J
Operator~precedence:~\l_@@_opprec_tl^^J
Argument~precedences:~
\seq_use:Nn \l_@@_precedences_seq {,~}^^J
Notation: \cs_meaning:c {
stex_notation_ \l_stex_get_symbol_uri_str \c_hash_str
- \_@@_suffix_str
+ \l_@@_suffix_str
_cs
}
}
-
- \exp_args:Ne
- \stex_add_to_current_module:n {
- \seq_put_right:cn {
- l_stex_symdecl_\l_stex_get_symbol_uri_str
- _notations
- } { \_@@_suffix_str }
- }
-
- \stex_if_smsmode:F {
-
% HTML annotations
- \stex_if_do_html:T {
- \stex_annotate_invisible:nnn { notation }
- { \l_stex_get_symbol_uri_str } {
- \stex_annotate_invisible:nnn { notationfragment }
- { \_@@_suffix_str }{}
- \stex_annotate_invisible:nnn { precedence }
- { \l_@@_prec_str }{}
-
- \int_zero:N \l_tmpa_int
- \str_set_eq:NN \l_@@_remaining_args_str \l_@@_args_str
- \tl_clear:N \l_tmpa_tl
- \int_step_inline:nn { \l_@@_arity_str }{
- \int_incr:N \l_tmpa_int
- \str_set:Nx \l_tmpb_str { \str_head:N \l_@@_remaining_args_str }
- \str_set:Nx \l_@@_remaining_args_str { \str_tail:N \l_@@_remaining_args_str }
- \str_if_eq:VnTF \l_tmpb_str a {
+ \stex_if_do_html:T {
+ \stex_annotate_invisible:nnn { notation }
+ { \l_stex_get_symbol_uri_str } {
+ \stex_annotate_invisible:nnn { notationfragment }
+ { \l_@@_suffix_str }{}
+ \stex_annotate_invisible:nnn { precedence }
+ { \l_@@_prec_str }{}
+
+ \int_zero:N \l_tmpa_int
+ \str_set_eq:NN \l_@@_remaining_args_str \l_@@_args_str
+ \tl_clear:N \l_tmpa_tl
+ \int_step_inline:nn { \l_@@_arity_str }{
+ \int_incr:N \l_tmpa_int
+ \str_set:Nx \l_tmpb_str { \str_head:N \l_@@_remaining_args_str }
+ \str_set:Nx \l_@@_remaining_args_str { \str_tail:N \l_@@_remaining_args_str }
+ \str_if_eq:VnTF \l_tmpb_str a {
+ \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int a}{} ,
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int b}{}
+ } }
+ }{
+ \str_if_eq:VnTF \l_tmpb_str B {
\tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int a ,
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int b
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int a}{} ,
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int b}{}
} }
}{
- \str_if_eq:VnTF \l_tmpb_str B {
- \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int a ,
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int b
- } }
- }{
- \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int
- } }
- }
+ \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int}{}
+ } }
}
}
- \stex_annotate_invisible:nnn { notationcomp }{}{
- \str_set:Nx \l_stex_current_symbol_str {\l_stex_get_symbol_uri_str }
- $ \exp_args:Nno \use:nn { \use:c {
- stex_notation_ \l_stex_current_symbol_str
- \c_hash_str \_@@_suffix_str _cs
- } } { \l_tmpa_tl } $
+ }
+ \stex_annotate_invisible:nnn { notationcomp }{}{
+ \str_set:Nx \STEXInternalCurrentSymbolStr {\l_stex_get_symbol_uri_str }
+ $ \exp_args:Nno \use:nn { \use:c {
+ stex_notation_ \STEXInternalCurrentSymbolStr
+ \c_hash_str \l_@@_suffix_str _cs
+ } } { \l_tmpa_tl } $
+ }
+ \tl_if_empty:NF \l_@@_op_tl {
+ \stex_annotate_invisible:nnn { notationopcomp }{}{
+ $\l_@@_op_tl$
}
}
}
@@ -901,44 +933,38 @@
% \begin{macro}{\setnotation}
% \begin{macrocode}
\keys_define:nn { stex / setnotation } {
- lang .tl_set_x:N = \l_@@_lang_str ,
+% lang .tl_set_x:N = \l_@@_lang_str ,
variant .tl_set_x:N = \l_@@_variant_str ,
unknown .code:n = \str_set:Nx
\l_@@_variant_str \l_keys_key_str
}
\cs_new_protected:Nn \_stex_setnotation_args:n {
- \str_clear:N \l_@@_lang_str
+ % \str_clear:N \l_@@_lang_str
\str_clear:N \l_@@_variant_str
\keys_set:nn { stex / setnotation } { #1 }
}
+\cs_new_protected:Nn \_@@_setnotation:nn {
+ \seq_if_exist:cT{l_stex_symdecl_#1_notations}{
+ \seq_remove_all:cn { l_stex_symdecl_#1 _notations }{ #2 }
+ \seq_put_left:cn { l_stex_symdecl_#1 _notations }{ #2 }
+ }
+}
+
\cs_new_protected:Nn \stex_setnotation:n {
\exp_args:Nnx \seq_if_in:cnTF { l_stex_symdecl_#1 _notations }
- { \l_@@_variant_str \c_hash_str \l_@@_lang_str }{
- \exp_args:Nnx \seq_remove_all:cn { l_stex_symdecl_#1 _notations }
- { \l_@@_variant_str \c_hash_str \l_@@_lang_str }
- \exp_args:Nnx \seq_remove_all:cn { l_stex_symdecl_#1 _notations }
- { \c_hash_str }
- \exp_args:Nnx \seq_put_left:cn { l_stex_symdecl_#1 _notations }
- { \l_@@_variant_str \c_hash_str \l_@@_lang_str }
- \exp_args:Nx \stex_add_to_current_module:n {
- \exp_args:Nnx \seq_remove_all:cn { l_stex_symdecl_#1 _notations }
- { \l_@@_variant_str \c_hash_str \l_@@_lang_str }
- \exp_args:Nnx \seq_put_left:cn { l_stex_symdecl_#1 _notations }
- { \l_@@_variant_str \c_hash_str \l_@@_lang_str }
- \exp_args:Nnx \seq_remove_all:cn { l_stex_symdecl_#1 _notations }
- { \c_hash_str }
- }
+ { \l_@@_variant_str }{
+ \stex_execute_in_module:x{ \_@@_setnotation:nn {#1}{\l_@@_variant_str} }
\stex_debug:nn {notations}{
Setting~default~notation~
- {\l_@@_variant_str \c_hash_str \l_@@_lang_str}~for~
+ {\l_@@_variant_str }~for~
#1 \\
\expandafter\meaning\csname
l_stex_symdecl_#1 _notations\endcsname
}
}{
- % todo throw error
+ \msg_error:nnxx{stex}{unknownnotation}{\l_@@_variant_str}{#1}
}
}
@@ -946,7 +972,7 @@
\stex_get_symbol:n { #1 }
\_stex_setnotation_args:n { #2 }
\stex_setnotation:n{\l_stex_get_symbol_uri_str}
- \stex_smsmode_do:
+ \stex_smsmode_do:\ignorespacesandpars
}
\cs_new_protected:Nn \stex_copy_notations:nn {
@@ -956,9 +982,10 @@
}
\tl_clear:N \l_tmpa_tl
\int_step_inline:nn { \prop_item:cn {l_stex_symdecl_#2_prop}{ arity } } {
- \tl_put_right:Nn \l_tmpa_tl { {## ##1} }
+ \tl_put_right:Nn \l_tmpa_tl { {######## ##1} }
}
- \seq_map_inline:cn {l_stex_symdecl_#2_notations}{
+ \seq_map_inline:cn {l_stex_symdecl_#2_notations}{\begingroup
+ \stex_debug:nn{Here}{Here:~##1}
\cs_set_eq:Nc \l_tmpa_cs { stex_notation_ #2 \c_hash_str ##1 _cs }
\edef \l_tmpa_tl {
\exp_after:wN\exp_after:wN\exp_after:wN \exp_not:n
@@ -966,15 +993,30 @@
\exp_after:wN \l_tmpa_cs \l_tmpa_tl
}
}
- \exp_args:Nx
- \stex_do_up_to_module:n {
- \seq_put_right:cn{l_stex_symdecl_#1_notations}{##1}
- \cs_generate_from_arg_count:cNnn {
- stex_notation_ #1 \c_hash_str ##1 _cs
- } \cs_set:Npn { \prop_item:cn {l_stex_symdecl_#2_prop}{ arity } }{
- \exp_after:wN\exp_not:n\exp_after:wN{\l_tmpa_tl}
+
+ \exp_after:wN \def \exp_after:wN \l_tmpa_tl
+ \exp_after:wN ####\exp_after:wN 1 \exp_after:wN ####\exp_after:wN 2
+ \exp_after:wN { \l_tmpa_tl }
+
+ \edef \l_tmpa_tl {
+ \exp_after:wN \exp_not:n \exp_after:wN {
+ \l_tmpa_tl {######## 1}{######## 2}
}
}
+
+ \stex_debug:nn{Here}{Here:~\expandafter\detokenize\expandafter{\l_tmpa_tl}}
+
+ \stex_execute_in_module:x {
+ \_@@_restore_notation:nnnnn
+ {#1}{##1}
+ { \prop_item:cn {l_stex_symdecl_#2_prop}{ arity } }
+ { \exp_after:wN\exp_not:n\exp_after:wN{\l_tmpa_tl} }
+ {
+ \cs_if_exist:cT{stex_op_notation_ #2\c_hash_str ##1 _cs}{
+ \exp_args:NNo\exp_args:No\exp_not:n{\csname stex_op_notation_ #2\c_hash_str ##1 _cs\endcsname}
+ }
+ }
+ }\endgroup
}
}
@@ -984,10 +1026,7 @@
\stex_get_symbol:n { #2 }
\exp_args:Noo
\stex_copy_notations:nn \l_tmpa_str \l_stex_get_symbol_uri_str
- \exp_args:Nx \stex_add_import_to_current_module:n{
- \stex_copy_notations:nn {\l_tmpa_str} {\l_stex_get_symbol_uri_str}
- }
- \stex_smsmode_do:
+ \stex_smsmode_do:\ignorespacesandpars
}
% \end{macrocode}
@@ -1001,8 +1040,9 @@
args .str_set_x:N = \l_stex_symdecl_args_str ,
type .tl_set:N = \l_stex_symdecl_type_tl ,
def .tl_set:N = \l_stex_symdecl_definiens_tl ,
+ reorder .str_set_x:N = \l_stex_symdecl_reorder_str ,
op .tl_set:N = \l_@@_op_tl ,
- lang .str_set_x:N = \l_@@_lang_str ,
+ % lang .str_set_x:N = \l_@@_lang_str ,
variant .str_set_x:N = \l_@@_variant_str ,
prec .str_set_x:N = \l_@@_prec_str ,
assoc .choices:nn =
@@ -1016,10 +1056,11 @@
\str_clear:N \l_stex_symdecl_name_str
\str_clear:N \l_stex_symdecl_args_str
\str_clear:N \l_stex_symdecl_assoctype_str
+ \str_clear:N \l_stex_symdecl_reorder_str
\bool_set_false:N \l_stex_symdecl_local_bool
\tl_clear:N \l_stex_symdecl_type_tl
\tl_clear:N \l_stex_symdecl_definiens_tl
- \str_clear:N \l_@@_lang_str
+ % \str_clear:N \l_@@_lang_str
\str_clear:N \l_@@_variant_str
\str_clear:N \l_@@_prec_str
\tl_clear:N \l_@@_op_tl
@@ -1033,15 +1074,16 @@
\stex_symdecl_do:n { #1 }
\tl_set:Nn \l_stex_notation_after_do_tl {
\_@@_final:
- \stex_smsmode_do:
+ \stex_smsmode_do:\ignorespacesandpars
}
\str_set:Nx \l_stex_get_symbol_uri_str {
\l_stex_current_module_str ? \l_stex_symdecl_name_str
}
- \exp_args:Nx \stex_notation_do:nnnn
+ \exp_args:Nx \stex_notation_do:nnnnn
{ \prop_item:cn {l_stex_symdecl_\l_stex_get_symbol_uri_str _prop } { args } }
{ \prop_item:cn { l_stex_symdecl_\l_stex_get_symbol_uri_str _prop } { arity } }
- { \l_@@_variant_str \c_hash_str \l_@@_lang_str }
+ { \l_@@_variant_str }
+ { \l_@@_prec_str}
}
\stex_deactivate_macro:Nn \symdef {module~environments}
% \end{macrocode}
@@ -1059,6 +1101,7 @@
def .tl_set:N = \l_@@_def_tl ,
op .tl_set:N = \l_@@_op_tl ,
prec .str_set_x:N = \l_@@_prec_str ,
+ reorder .str_set_x:N = \l_@@_reorder_str ,
assoc .choices:nn =
{bin,binl,binr,pre,conj,pwconj}
{\str_set:Nx \l_@@_assoctype_str {\l_keys_choice_tl}},
@@ -1072,6 +1115,7 @@
\str_clear:N \l_@@_args_str
\str_clear:N \l_@@_prec_str
\str_clear:N \l_@@_assoctype_str
+ \str_clear:N \l_@@_reorder_str
\str_clear:N \l_@@_bind_str
\tl_clear:N \l_@@_type_tl
\tl_clear:N \l_@@_def_tl
@@ -1137,11 +1181,7 @@
\tl_if_empty:NF \l_@@_op_tl {
\cs_set:cpx {
stex_var_op_notation_ \l_@@_name_str _cs
- } {
- \_stex_term_omv:nn {
- var://\l_@@_name_str
- }{ \comp{ \exp_args:No \exp_not:n { \l_@@_op_tl } } }
- }
+ } { \exp_not:N\comp{ \exp_args:No \exp_not:n { \l_@@_op_tl } } }
}
\tl_set:Nn \l_stex_notation_after_do_tl {
@@ -1151,14 +1191,14 @@
} {{
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_not:n \exp_after:wN \exp_after:wN \exp_after:wN
- { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \stex_symbol_after_invocation_tl}
+ { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \STEXInternalSymbolAfterInvokationTL}
}}
\stex_if_do_html:T {
\stex_annotate_invisible:nnn {vardecl}{\l_@@_name_str}{
\stex_annotate_invisible:nnn { precedence }
{ \l_@@_prec_str }{}
\tl_if_empty:NF \l_@@_type_tl {\stex_annotate_invisible:nnn{type}{}{$\l_@@_type_tl$}}
- \stex_annotate_invisible:nnn{args}{}{ \l_@@_args_str }
+ \stex_annotate_invisible:nnn{args}{ \l_@@_args_str }{}
\stex_annotate_invisible:nnn{macroname}{#1}{}
\tl_if_empty:NF \l_@@_def_tl {
\stex_annotate_invisible:nnn{definiens}{}
@@ -1167,6 +1207,9 @@
\str_if_empty:NF \l_@@_assoctype_str {
\stex_annotate_invisible:nnn{assoctype}{\l_@@_assoctype_str}{}
}
+ \str_if_empty:NF \l_@@_reorder_str {
+ \stex_annotate_invisible:nnn{reorderargs}{\l_@@_reorder_str}{}
+ }
\int_zero:N \l_tmpa_int
\str_set_eq:NN \l_@@_remaining_args_str \l_@@_args_str
\tl_clear:N \l_tmpa_tl
@@ -1176,36 +1219,44 @@
\str_set:Nx \l_@@_remaining_args_str { \str_tail:N \l_@@_remaining_args_str }
\str_if_eq:VnTF \l_tmpb_str a {
\tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int a ,
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int b
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int a}{} ,
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int b}{}
} }
}{
\str_if_eq:VnTF \l_tmpb_str B {
\tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int a ,
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int b
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int a}{} ,
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int b}{}
} }
}{
\tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int}{}
} }
}
}
}
\stex_annotate_invisible:nnn { notationcomp }{}{
- \str_set:Nx \l_stex_current_symbol_str {var://\l_@@_name_str }
+ \str_set:Nx \STEXInternalCurrentSymbolStr {var://\l_@@_name_str }
$ \exp_args:Nno \use:nn { \use:c {
stex_var_notation_\l_@@_name_str _cs
} } { \l_tmpa_tl } $
}
+ \tl_if_empty:NF \l_@@_op_tl {
+ \stex_annotate_invisible:nnn { notationopcomp }{}{
+ $\l_@@_op_tl$
+ }
+ }
}
- }
+ \str_if_empty:NF \l_@@_bind_str {
+ \stex_annotate_invisible:nnn {bindtype}{\l_@@_bind_str,\l_@@_name_str}{}
+ }
+ }\ignorespacesandpars
}
- \stex_notation_do:nnnn { \l_@@_args_str } { \prop_item:Nn \l_tmpa_prop { arity } } {}
+ \stex_notation_do:nnnnn { \l_@@_args_str } { \prop_item:Nn \l_tmpa_prop { arity } } {}{ \l_@@_prec_str}
}
-\cs_new:Nn \_@@_reset:N {
+\cs_new:Nn \_stex_reset:N {
\tl_if_exist:NTF #1 {
\def \exp_not:N #1 { \exp_args:No \exp_not:n #1 }
}{
@@ -1217,13 +1268,13 @@
\clist_set:Nx \l_@@_names { \tl_to_str:n {#1} }
\exp_args:Nnx \use:nn {
% TODO
- \stex_annotate_invisible:nnn {vardecls}{\clist_use:Nn\l_@@_names,}{
+ \stex_annotate_invisible:nnn {vardecl}{\clist_use:Nn\l_@@_names,}{
#2
}
}{
- \_@@_reset:N \varnot
- \_@@_reset:N \vartype
- \_@@_reset:N \vardefi
+ \_stex_reset:N \varnot
+ \_stex_reset:N \vartype
+ \_stex_reset:N \vardefi
}
}
@@ -1242,8 +1293,143 @@
\str_set:Nn \l_tmpa_str { #1 }
}
\_stex_term_omv:nn {
- var://\l_tmpa_str
- }{ \comp{ #2 } }
+ var://\l_tmpa_str
+ }{
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nx \STEXInternalCurrentSymbolStr { var://\l_tmpa_str }
+ \comp{ #2 }
+ }{
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ }
+ }
+}
+
+
+
+\keys_define:nn { stex / varseq } {
+ name .str_set_x:N = \l_@@_name_str ,
+ args .int_set:N = \l_@@_args_int ,
+ type .tl_set:N = \l_@@_type_tl ,
+ mid .tl_set:N = \l_@@_mid_tl ,
+ bind .choices:nn =
+ {forall,exists}
+ {\str_set:Nx \l_@@_bind_str {\l_keys_choice_tl}}
+}
+
+\cs_new_protected:Nn \_@@_seq_args:n {
+ \str_clear:N \l_@@_name_str
+ \int_set:Nn \l_@@_args_int 1
+ \tl_clear:N \l_@@_type_tl
+ \str_clear:N \l_@@_bind_str
+
+ \keys_set:nn { stex / varseq } { #1 }
+}
+
+\NewDocumentCommand \varseq {m O{} m m m}{
+ \_@@_seq_args:n { #2 }
+ \str_if_empty:NT \l_@@_name_str {
+ \str_set:Nx \l_@@_name_str { #1 }
+ }
+ \prop_clear:N \l_tmpa_prop
+ \prop_put:Nnx \l_tmpa_prop { arity }{\int_use:N \l_@@_args_int}
+
+ \seq_set_from_clist:Nn \l_tmpa_seq {#3}
+ \int_compare:nNnF {\seq_count:N \l_tmpa_seq} = \l_@@_args_int {
+ \msg_error:nnxx{stex}{error/seqlength}
+ {\int_use:N \l_@@_args_int}
+ {\seq_count:N \l_tmpa_seq}
+ }
+ \seq_set_from_clist:Nn \l_tmpb_seq {#4}
+ \int_compare:nNnF {\seq_count:N \l_tmpb_seq} = \l_@@_args_int {
+ \msg_error:nnxx{stex}{error/seqlength}
+ {\int_use:N \l_@@_args_int}
+ {\seq_count:N \l_tmpb_seq}
+ }
+ \prop_put:Nnn \l_tmpa_prop {starts} {#3}
+ \prop_put:Nnn \l_tmpa_prop {ends} {#4}
+
+ \cs_generate_from_arg_count:cNnn {stex_varseq_\l_@@_name_str _cs}
+ \cs_set:Npn {\int_use:N \l_@@_args_int} { #5 }
+
+ \exp_args:NNo \tl_set:No \l_tmpa_tl {\use:c{stex_varseq_\l_@@_name_str _cs}}
+ \int_step_inline:nn \l_@@_args_int {
+ \tl_put_right:Nx \l_tmpa_tl { {\seq_item:Nn \l_tmpa_seq {##1}} }
+ }
+ \tl_set:Nx \l_tmpa_tl {\exp_args:NNo \exp_args:No \exp_not:n{\l_tmpa_tl}}
+ \tl_put_right:Nn \l_tmpa_tl {,\ellipses,}
+ \tl_if_empty:NF \l_@@_mid_tl {
+ \tl_put_right:No \l_tmpa_tl \l_@@_mid_tl
+ \tl_put_right:Nn \l_tmpa_tl {,\ellipses,}
+ }
+ \exp_args:NNo \tl_set:No \l_tmpb_tl {\use:c{stex_varseq_\l_@@_name_str _cs}}
+ \int_step_inline:nn \l_@@_args_int {
+ \tl_put_right:Nx \l_tmpb_tl { {\seq_item:Nn \l_tmpb_seq {##1}} }
+ }
+ \tl_set:Nx \l_tmpb_tl {\exp_args:NNo \exp_args:No \exp_not:n{\l_tmpb_tl}}
+ \tl_put_right:No \l_tmpa_tl \l_tmpb_tl
+
+
+ \prop_put:Nno \l_tmpa_prop { notation }\l_tmpa_tl
+
+ \tl_set:cx {#1} {\stex_invoke_sequence:n {\l_@@_name_str}}
+
+ \exp_args:NNo \tl_set:No \l_tmpa_tl {\use:c{stex_varseq_\l_@@_name_str _cs}}
+
+ \int_step_inline:nn \l_@@_args_int {
+ \tl_set:Nx \l_tmpa_tl {\exp_args:No \exp_not:n \l_tmpa_tl {
+ \STEXInternalTermMathArgiii{i##1}{0}{\exp_not:n{####}##1}
+ }}
+ }
+
+ \tl_set:Nx \l_tmpa_tl {
+ \STEXInternalTermMathOMAiiii { varseq://\l_@@_name_str}{}{0}{
+ \exp_args:NNo \exp_args:No \exp_not:n {\l_tmpa_tl}
+ }
+ }
+
+ \tl_set:No \l_tmpa_tl { \exp_after:wN { \l_tmpa_tl \STEXInternalSymbolAfterInvokationTL} }
+
+ \exp_args:Nno \use:nn {
+ \cs_generate_from_arg_count:cNnn {stex_varseq_\l_@@_name_str _cs}
+ \cs_set:Npn {\int_use:N \l_@@_args_int}}{\l_tmpa_tl}
+
+ \stex_debug:nn{sequences}{New~Sequence:~
+ \expandafter\meaning\csname stex_varseq_\l_@@_name_str _cs\endcsname\\~\\
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ \stex_if_do_html:T{\stex_annotate_invisible:nnn{varseq}{\l_@@_name_str}{
+ \tl_if_empty:NF \l_@@_type_tl {
+ \stex_annotate:nnn {type}{}{$\l_@@_type_tl$}
+ }
+ \stex_annotate:nnn {args}{\int_use:N \l_@@_args_int}{}
+ \str_if_empty:NF \l_@@_bind_str {
+ \stex_annotate:nnn {bindtype}{\l_@@_bind_str}{}
+ }
+ \stex_annotate:nnn{startindex}{}{$#3$}
+ \stex_annotate:nnn{endindex}{}{$#4$}
+
+ \tl_clear:N \l_tmpa_tl
+ \int_step_inline:nn \l_@@_args_int {
+ \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
+ \stex_annotate:nnn{argmarker}{##1}{}
+ } }
+ }
+ \stex_annotate_invisible:nnn { notationcomp }{}{
+ \str_set:Nx \STEXInternalCurrentSymbolStr {varseq://\l_@@_name_str }
+ $ \exp_args:Nno \use:nn { \use:c {
+ stex_varseq_\l_@@_name_str _cs
+ } } { \l_tmpa_tl } $
+ }
+ \stex_annotate_invisible:nnn { notationopcomp }{}{
+ $ \prop_item:Nn \l_tmpa_prop { notation } $
+ }
+
+ }}
+
+ \prop_set_eq:cN {stex_varseq_\l_@@_name_str _prop}\l_tmpa_prop
+ \ignorespacesandpars
}
% \end{macrocode}
@@ -1253,6 +1439,7 @@
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex-terms.dtx b/Master/texmf-dist/source/latex/stex/stex/stex-terms.dtx
index 9322a2411ad..3827466f14f 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex-terms.dtx
+++ b/Master/texmf-dist/source/latex/stex/stex/stex-terms.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\providecommand\bibfolder{../../lib/bib}
+\def\bibfolder#1{../../lib/bib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -40,6 +40,9 @@
% \fi
%
% \begin{documentation}\label{pkg:terms:doc}
+% \changes{3.1.0}{2022/03/01}{!-Notation now works for symbols with arity=0 without needing an op-notation}
+% \changes{3.1.0}{2022/03/01}{Introduced \detokenize{\varemph, \varemph@uri}}
+% \changes{3.1.0}{2022/02/28}{Fixed bug with \detokenize{\STEXInternalCurrentSymbolStr} in variable annotations}
%
% Code related to symbolic expressions, typesetting notations,
% notation components, etc.
@@ -70,7 +73,7 @@
% |\plus[addition of]{some}{terms}|.
% \end{function}
%
-% \begin{function}{\_stex_term_math_oms:nnnn,\_stex_term_math_oma:nnnn,\_stex_term_math_omb:nnnn}
+% \begin{function}{\STEXInternalTermMathOMSiiii,\STEXInternalTermMathOMAiiii,\STEXInternalTermMathOMBiiii}
% \begin{syntax} \meta{URI}\meta{fragment}\meta{precedence}\meta{body} \end{syntax}
%
% Annotates \meta{body} as an \omdoc-term (|OMID|, |OMA| or |OMBIND|, respectively)
@@ -80,13 +83,13 @@
% the current downwards precedence and operator precedence.
% \end{function}
%
-% \begin{function}{\_stex_term_math_arg:nnn}
+% \begin{function}{\STEXInternalTermMathArgiii}
% \begin{syntax} \cs{stex_term_arg:nnn}\meta{int}\meta{prec}\meta{body} \end{syntax}
% Annotates \meta{body} as the \meta{int}th argument of the current |OMA| or |OMBIND|,
% with (downwards) argument precedence \meta{prec}.
% \end{function}
%
-% \begin{function}{\_stex_term_math_assoc_arg:nnnn}
+% \begin{function}{\STEXInternalTermMathAssocArgiiii}
% \begin{syntax} \cs{stex_term_arg:nnn}\meta{int}\meta{prec}\meta{notation}\meta{body} \end{syntax}
% Annotates \meta{body} as the \meta{int}th (associative) \emph{sequence} argument
% (as comma-separated list of terms) of the current |OMA| or |OMBIND|,
@@ -122,13 +125,7 @@
% followed by |*| in math mode, or whenever followed by |!|.
% \end{function}
%
-% \begin{function}{\stex_highlight_term:nn}
-% \begin{syntax} \cs{stex_highlight_term:nn}\Arg{URI}\Arg{args}\end{syntax}
-% Establishes a context for \cs{comp}. Stores the URI in a variable
-% so that \cs{comp} knows which symbol governs the current notation.
-% \end{function}
-%
-% \begin{function}{\comp, \compemph,\compemph@uri, \defemph, \defemph@uri, \symrefemph,\symrefemph@uri}
+% \begin{function}{\comp, \compemph,\compemph@uri, \defemph, \defemph@uri, \symrefemph,\symrefemph@uri,\varemph,\varemph@uri}
% \begin{syntax} \cs{comp}\Arg{args}\end{syntax}
% Marks \meta{args} as a notation component of the current symbol for
% highlighting, linking, etc.
@@ -180,7 +177,13 @@
Symbol~#1~has~no~operator~notation~for~notation~#2
}
\msg_new:nnn{stex}{error/notallowed}{
- Symbol~invocation~#1~not~allowed~in~notation~component~of~#2
+ Symbol~invokation~#1~not~allowed~in~notation~component~of~#2
+}
+\msg_new:nnn{stex}{error/doubleargument}{
+ Argument~#1~of~symbol~#2~already~assigned
+}
+\msg_new:nnn{stex}{error/overarity}{
+ Argument~#1~invalid~for~symbol~#2~with~arity~#3
}
% \end{macrocode}
@@ -192,33 +195,14 @@
% Invokes a semantic macro
%
% \begin{macrocode}
-\keys_define:nn { stex / terms } {
- lang .tl_set_x:N = \l_@@_lang_str ,
- variant .tl_set_x:N = \l_@@_variant_str ,
- unknown .code:n = \str_set:Nx
- \l_@@_variant_str \l_keys_key_str
-}
-\cs_new_protected:Nn \_@@_args:n {
- \str_clear:N \l_@@_lang_str
- \str_clear:N \l_@@_variant_str
-
- \keys_set:nn { stex / terms } { #1 }
-}
-
-\cs_new:Nn \_@@_reset:N {
- \tl_if_exist:NTF #1 {
- \def \exp_not:N #1 { \exp_args:No \exp_not:n #1 }
- }{
- \let \exp_not:N #1 \exp_not:N \undefined
- }
-}
-\bool_new:N \l_@@_allow_semantic_bool
-\bool_set_true:N \l_@@_allow_semantic_bool
+\bool_new:N \l_stex_allow_semantic_bool
+\bool_set_true:N \l_stex_allow_semantic_bool
\cs_new_protected:Nn \stex_invoke_symbol:n {
- \bool_if:NTF \l_@@_allow_semantic_bool {
+ \ifvmode\indent\fi
+ \bool_if:NTF \l_stex_allow_semantic_bool {
\str_if_eq:eeF {
\prop_item:cn {
l_stex_symdecl_#1_prop
@@ -236,7 +220,7 @@
\exp_after:wN \_@@_invoke_text:n
\fi: { #1 }
}{
- \msg_error:nnxx{stex}{error/notallowed}{#1}{\l_stex_current_symbol_str}
+ \msg_error:nnxx{stex}{error/notallowed}{#1}{\STEXInternalCurrentSymbolStr}
}
}
@@ -280,38 +264,50 @@
\cs_new_protected:Nn \_@@_invoke_op_custom:nn {
\exp_args:Nnx \use:nn {
- \str_set:Nn \l_stex_current_symbol_str { #1 }
- \bool_set_false:N \l_@@_allow_semantic_bool
- \_stex_term_oms:nnn {#1 \c_hash_str\c_hash_str}{#1}{
+ \def\comp{\_comp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \_stex_term_oms:nnn {#1}{#1 \c_hash_str CUSTOM-}{
\comp{ #2 }
}
}{
- \_@@_reset:N \l_stex_current_symbol_str
- \bool_set_true:N \l_@@_allow_semantic_bool
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
}
}
-\cs_new_protected:Nn \_@@_find_notation:nn {
- \str_set:Nn \l_stex_current_symbol_str { #1 }
+\keys_define:nn { stex / terms } {
+% lang .tl_set_x:N = \l_stex_notation_lang_str ,
+ variant .tl_set_x:N = \l_stex_notation_variant_str ,
+ unknown .code:n = \str_set:Nx
+ \l_stex_notation_variant_str \l_keys_key_str
+}
+
+\cs_new_protected:Nn \_@@_args:n {
+ % \str_clear:N \l_stex_notation_lang_str
+ \str_clear:N \l_stex_notation_variant_str
+
+ \keys_set:nn { stex / terms } { #1 }
+}
+
+\cs_new_protected:Nn \stex_find_notation:nn {
\_@@_args:n { #2 }
\seq_if_empty:cTF {
l_stex_symdecl_ #1 _notations
} {
\msg_error:nnxx{stex}{error/nonotation}{#1}{s}
} {
- \bool_lazy_all:nTF {
- {\str_if_empty_p:N \l_@@_variant_str}
- {\str_if_empty_p:N \l_@@_lang_str}
- }{
- \seq_get_left:cN {l_stex_symdecl_#1_notations}\l_@@_variant_str
+ \str_if_empty:NTF \l_stex_notation_variant_str {
+ \seq_get_left:cN {l_stex_symdecl_#1_notations}\l_stex_notation_variant_str
}{
\seq_if_in:cxTF {l_stex_symdecl_#1_notations}{
- \l_@@_variant_str \c_hash_str \l_@@_lang_str
+ \l_stex_notation_variant_str
}{
- \str_set:Nx \l_@@_variant_str { \l_@@_variant_str \c_hash_str \l_@@_lang_str }
+ % \str_set:Nx \l_stex_notation_variant_str { \l_stex_notation_variant_str \c_hash_str \l_stex_notation_lang_str }
}{
\msg_error:nnxx{stex}{error/nonotation}{#1}{
- ~\l_@@_variant_str \c_hash_str \l_@@_lang_str
+ ~\l_stex_notation_variant_str
}
}
}
@@ -319,43 +315,80 @@
}
\cs_new_protected:Npn \_@@_invoke_op_notation:nw #1 [#2] {
- \_@@_find_notation:nn { #1 }{ #2 }
- \bool_set_false:N \l_@@_allow_semantic_bool
- \cs_if_exist:cTF {
- stex_op_notation_ #1 \c_hash_str \l_@@_variant_str _cs
- }{
- \use:c{stex_op_notation_ #1 \c_hash_str \l_@@_variant_str _cs}
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_comp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
+ \stex_find_notation:nn { #1 }{ #2 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \cs_if_exist:cTF {
+ stex_op_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs
+ }{
+ \_stex_term_oms:nnn { #1 }{
+ #1 \c_hash_str \l_stex_notation_variant_str
+ }{
+ \use:c{stex_op_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs}
+ }
+ }{
+ \int_compare:nNnTF {\prop_item:cn {l_stex_symdecl_#1_prop}{arity}} = 0{
+ \cs_if_exist:cTF {
+ stex_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs
+ }{
+ \tl_set:Nx \STEXInternalSymbolAfterInvokationTL {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalSymbolAfterInvokationTL
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+ \def\comp{\_comp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \use:c{stex_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs}
+ }{
+ \msg_error:nnxx{stex}{error/nonotation}{#1}{
+ ~\l_stex_notation_variant_str
+ }
+ }
+ }{
+ \msg_error:nnxx{stex}{error/noop}{#1}{\l_stex_notation_variant_str}
+ }
+ }
}{
- \msg_error:nnxx{stex}{error/noop}{#1}{\l_@@_variant_str}
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
}
- \bool_set_true:N \l_@@_allow_semantic_bool
}
\cs_new_protected:Npn \_@@_invoke_notation:nw #1 [#2] {
- \_@@_find_notation:nn { #1 }{ #2 }
+ \stex_find_notation:nn { #1 }{ #2 }
\cs_if_exist:cTF {
- stex_notation_ #1 \c_hash_str \l_@@_variant_str _cs
+ stex_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs
}{
- \tl_set:Nx \stex_symbol_after_invocation_tl {
- \_@@_reset:N \stex_symbol_after_invocation_tl
- \_@@_reset:N \l_stex_current_symbol_str
- \bool_set_true:N \l_@@_allow_semantic_bool
+ \tl_set:Nx \STEXInternalSymbolAfterInvokationTL {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalSymbolAfterInvokationTL
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
}
- \bool_set_false:N \l_@@_allow_semantic_bool
- \use:c{stex_notation_ #1 \c_hash_str \l_@@_variant_str _cs}
+ \def\comp{\_comp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \use:c{stex_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs}
}{
\msg_error:nnxx{stex}{error/nonotation}{#1}{
- ~\l_@@_variant_str
+ ~\l_stex_notation_variant_str
}
}
}
\prop_new:N \l_@@_custom_args_prop
+\cs_new_protected:Nn\_@@_custom_comp:n{\bool_set_false:N \l_stex_allow_semantic_bool\_comp{#1}\bool_set_true:N \l_stex_allow_semantic_bool}
+
\cs_new_protected:Nn \_@@_invoke_custom:nn {
\exp_args:Nnx \use:nn {
- \bool_set_false:N \l_@@_allow_semantic_bool
- \str_set:Nn \l_stex_current_symbol_str { #1 }
+ \def\comp{\_@@_custom_comp:n}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
\prop_clear:N \l_@@_custom_args_prop
\prop_put:Nnn \l_@@_custom_args_prop {currnum} {1}
\prop_get:cnN {
@@ -364,24 +397,25 @@
\prop_put:Nno \l_@@_custom_args_prop {args} \l_tmpa_str
\tl_set:Nn \arg { \_@@_arg: }
\str_if_empty:NTF \l_tmpa_str {
- \_stex_term_oms:nnn {#1}{#1}{#2}
+ \_stex_term_oms:nnn {#1}{#1\c_hash_str CUSTOM-}{\ignorespaces#2}
}{
\str_if_in:NnTF \l_tmpa_str b {
- \_stex_term_ombind:nnn {#1}{#1}{#2}
+ \_stex_term_ombind:nnn {#1}{#1\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
}{
\str_if_in:NnTF \l_tmpa_str B {
- \_stex_term_ombind:nnn {#1}{#1}{#2}
+ \_stex_term_ombind:nnn {#1}{#1\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
}{
- \_stex_term_oma:nnn {#1}{#1}{#2}
+ \_stex_term_oma:nnn {#1}{#1\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
}
}
}
% TODO check that all arguments exist
}{
- \_@@_reset:N \l_stex_current_symbol_str
- \_@@_reset:N \arg
- \_@@_reset:N \l_@@_custom_args_prop
- \bool_set_true:N \l_@@_allow_semantic_bool
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \_stex_reset:N \arg
+ \_stex_reset:N \comp
+ \_stex_reset:N \l_@@_custom_args_prop
+ %\bool_set_true:N \l_stex_allow_semantic_bool
}
}
@@ -398,42 +432,142 @@
}
}{
\int_set:Nn \l_tmpa_int { #2 }
- \exp_args:NNx \prop_if_in:NnT \l_@@_custom_args_prop {\int_use:N \l_tmpa_int} {
- % TODO throw error
- }
}
\str_set:Nx \l_tmpa_str {\prop_item:Nn \l_@@_custom_args_prop {args} }
\int_compare:nNnT \l_tmpa_int > {\str_count:N \l_tmpa_str} {
- % TODO throw error
+ \msg_error:nnxxx{stex}{error/overarity}
+ {\int_use:N \l_tmpa_int}
+ {\STEXInternalCurrentSymbolStr}
+ {\str_count:N \l_tmpa_str}
+ }
+ \str_set:Nx \l_tmpa_str {\str_item:Nn \l_tmpa_str \l_tmpa_int}
+ \exp_args:NNx \prop_if_in:NnT \l_@@_custom_args_prop {\int_use:N \l_tmpa_int} {
+ \bool_lazy_any:nF {
+ {\str_if_eq_p:Vn \l_tmpa_str {a}}
+ {\str_if_eq_p:Vn \l_tmpa_str {B}}
+ }{
+ \msg_error:nnxx{stex}{error/doubleargument}
+ {\int_use:N \l_tmpa_int}
+ {\STEXInternalCurrentSymbolStr}
+ }
}
+ \exp_args:NNx \prop_put:Nnn \l_@@_custom_args_prop {\int_use:N \l_tmpa_int} {\ignorespaces#3}
+ \bool_set_true:N \l_stex_allow_semantic_bool
\IfBooleanTF#1{
- \stex_annotate_invisible:n {
- \exp_args:No \_stex_term_arg:nn {\l_stex_current_symbol_str}{#3}
+ \stex_annotate_invisible:n { %TODO
+ \exp_args:No \_stex_term_arg:nn {\l_tmpa_str\int_use:N \l_tmpa_int}{\ignorespaces#3}
}
- }{
- \exp_args:No \_stex_term_arg:nn {\l_stex_current_symbol_str}{#3}
+ }{ %TODO
+ \exp_args:No \_stex_term_arg:nn {\l_tmpa_str\int_use:N \l_tmpa_int}{\ignorespaces#3}
}
+ \bool_set_false:N \l_stex_allow_semantic_bool
}
\cs_new_protected:Nn \_stex_term_arg:nn {
- \exp_args:Nnx \use:nn {
- \bool_set_true:N \l_@@_allow_semantic_bool
- \stex_annotate:nnn{ arg }{ #1 }{ #2 }
- }{
- \bool_set_false:N \l_@@_allow_semantic_bool
- }
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ \stex_annotate:nnn{ arg }{ #1 }{ #2 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
}
-\cs_new_protected:Nn \_stex_term_math_arg:nnn {
+\cs_new_protected:Npn \STEXInternalTermMathArgiii #1#2#3 {
\exp_args:Nnx \use:nn
{ \int_set:Nn \l_@@_downprec { #2 }
\_stex_term_arg:nn { #1 }{ #3 }
}
{ \int_set:Nn \exp_not:N \l_@@_downprec { \int_use:N \l_@@_downprec } }
}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\STEXInternalTermMathAssocArgiiii}
+% \begin{macrocode}
+\cs_new_protected:Npn \STEXInternalTermMathAssocArgiiii #1#2#3#4 {
+ \cs_set:Npn \l_tmpa_cs ##1 ##2 { #4 }
+ \tl_set:Nn \l_tmpb_tl {\STEXInternalTermMathArgiii{#1}{#2}}
+ \tl_if_empty:nTF { #3 }{
+ \STEXInternalTermMathArgiii{#1}{#2}{}
+ }{
+ \exp_args:Nx \tl_if_empty:nTF { \tl_tail:n{ #3 }}{
+ \expandafter\if\expandafter\relax\noexpand#3
+ \tl_set:Nn \l_tmpa_tl {\_@@_math_assoc_arg_maybe_sequence:Nn#3{#1}}
+ \else
+ \tl_set:Nn \l_tmpa_tl {\_@@_math_assoc_arg_simple:nn{#1}{#3}}
+ \fi
+ \l_tmpa_tl
+ }{
+ \_@@_math_assoc_arg_simple:nn{#1}{#3}
+ }
+ }
+}
+\cs_new_protected:Nn \_@@_math_assoc_arg_maybe_sequence:Nn {
+ \str_set:Nx \l_tmpa_str { \cs_argument_spec:N #1 }
+ \str_if_empty:NTF \l_tmpa_str {
+ \exp_args:Nx \cs_if_eq:NNTF {
+ \tl_head:N #1
+ } \stex_invoke_sequence:n {
+ \tl_set:Nx \l_tmpa_tl {\tl_tail:N #1}
+ \str_set:Nx \l_tmpa_str {\exp_after:wN \use:n \l_tmpa_tl}
+ \tl_set:Nx \l_tmpa_tl {\prop_item:cn {stex_varseq_\l_tmpa_str _prop}{notation}}
+ \exp_args:NNo \seq_set_from_clist:Nn \l_tmpa_seq \l_tmpa_tl
+ \tl_set:Nx \l_tmpa_tl {{\exp_not:N \exp_not:n{
+ \exp_not:n{\exp_args:Nnx \use:nn} {
+ \exp_not:n {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr
+ } {varseq://\l_tmpa_str}
+ \exp_not:n{ ##1 }
+ }{
+ \exp_not:n {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ }
+ }
+ }}}
+ \exp_args:Nno \use:nn {\seq_set_map:NNn \l_tmpa_seq \l_tmpa_seq} \l_tmpa_tl
+ \seq_reverse:N \l_tmpa_seq
+ \seq_pop:NN \l_tmpa_seq \l_tmpa_tl
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \exp_args:NNNo \exp_args:NNo \tl_set:No \l_tmpa_tl {
+ \exp_args:Nno
+ \l_tmpa_cs { ##1 } \l_tmpa_tl
+ }
+ }
+ \tl_set:Nx \l_tmpa_tl {
+ \_stex_term_omv:nn {varseq://\l_tmpa_str}{
+ \exp_args:No \exp_not:n \l_tmpa_tl
+ }
+ }
+ \exp_args:No\l_tmpb_tl\l_tmpa_tl
+ }{
+ \_@@_math_assoc_arg_simple:nn{#2} { #1 }
+ }
+ } {
+ \_@@_math_assoc_arg_simple:nn{#2} { #1 }
+ }
+}
+
+\cs_new_protected:Nn \_@@_math_assoc_arg_simple:nn {
+ \clist_set:Nn \l_tmpa_clist{ #2 }
+ \int_compare:nNnTF { \clist_count:N \l_tmpa_clist } < 2 {
+ \tl_set:Nn \l_tmpa_tl { \_stex_term_arg:nn{A#1}{ #2 } }
+ }{
+ \clist_reverse:N \l_tmpa_clist
+ \clist_pop:NN \l_tmpa_clist \l_tmpa_tl
+ \tl_set:Nx \l_tmpa_tl { \_stex_term_arg:nn{A#1}{
+ \exp_args:No \exp_not:n \l_tmpa_tl
+ }}
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \exp_args:NNNo \exp_args:NNo \tl_set:No \l_tmpa_tl {
+ \exp_args:Nno
+ \l_tmpa_cs { \_stex_term_arg:nn{A#1}{##1} } \l_tmpa_tl
+ }
+ }
+ }
+ \exp_args:No\l_tmpb_tl\l_tmpa_tl
+}
% \end{macrocode}
% \end{macro}
%
@@ -535,15 +669,15 @@
%
% \omdoc terms:
%
-% \begin{macro}{\_stex_term_math_oms:nnnn}
+% \begin{macro}{\STEXInternalTermMathOMSiiii}
% \begin{macrocode}
\cs_new_protected:Nn \_stex_term_oms:nnn {
\stex_annotate:nnn{ OMID }{ #2 }{
- \stex_highlight_term:nn { #1 } { #3 }
+ #3
}
}
-\cs_new_protected:Nn \_stex_term_math_oms:nnnn {
+\cs_new_protected:Npn \STEXInternalTermMathOMSiiii #1#2#3#4 {
\_@@_maybe_brackets:nn { #3 }{
\_stex_term_oms:nnn { #1 } { #1\c_hash_str#2 } { #4 }
}
@@ -554,22 +688,22 @@
% \begin{macro}{\_stex_term_math_omv:nn}
% \begin{macrocode}
\cs_new_protected:Nn \_stex_term_omv:nn {
- \stex_annotate:nnn{ OMID }{ #1 }{
- \stex_highlight_term:nn { #1 } { #2 }
+ \stex_annotate:nnn{ OMV }{ #1 }{
+ #2
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\_stex_term_math_oma:nnnn}
+% \begin{macro}{\STEXInternalTermMathOMAiiii}
% \begin{macrocode}
\cs_new_protected:Nn \_stex_term_oma:nnn {
\stex_annotate:nnn{ OMA }{ #2 }{
- \stex_highlight_term:nn { #1 } { #3 }
+ #3
}
}
-\cs_new_protected:Nn \_stex_term_math_oma:nnnn {
+\cs_new_protected:Npn \STEXInternalTermMathOMAiiii #1#2#3#4 {
\_@@_maybe_brackets:nn { #3 }{
\_stex_term_oma:nnn { #1 } { #1\c_hash_str#2 } { #4 }
}
@@ -577,15 +711,15 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\_stex_term_math_omb:nnnn}
+% \begin{macro}{\STEXInternalTermMathOMBiiii}
% \begin{macrocode}
\cs_new_protected:Nn \_stex_term_ombind:nnn {
\stex_annotate:nnn{ OMBIND }{ #2 }{
- \stex_highlight_term:nn { #1 } { #3 }
+ #3
}
}
-\cs_new_protected:Nn \_stex_term_math_omb:nnnn {
+\cs_new_protected:Npn \STEXInternalTermMathOMBiiii #1#2#3#4 {
\_@@_maybe_brackets:nn { #3 }{
\_stex_term_ombind:nnn { #1 } { #1\c_hash_str#2 } { #4 }
}
@@ -593,173 +727,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\_stex_term_math_assoc_arg:nnnn}
-% \begin{macrocode}
-\cs_new_protected:Nn \_stex_term_math_assoc_arg:nnnn {
- % TODO sequences
- \clist_set:Nn \l_tmpa_clist{ #3 }
- \int_compare:nNnTF { \clist_count:N \l_tmpa_clist } < 2 {
- \tl_set:Nn \l_tmpa_tl { #3 }
- }{
- \cs_set:Npn \l_tmpa_cs ##1 ##2 { #4 }
- \clist_reverse:N \l_tmpa_clist
- \clist_pop:NN \l_tmpa_clist \l_tmpa_tl
-
- \clist_map_inline:Nn \l_tmpa_clist {
- \exp_args:NNNo \exp_args:NNo \tl_set:No \l_tmpa_tl {
- \exp_args:Nno
- \l_tmpa_cs { ##1 } \l_tmpa_tl
- }
- }
- }
- \exp_args:Nnno
- \_stex_term_math_arg:nnn{#1}{#2}\l_tmpa_tl
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\stex_term_custom:nn}
-% \begin{macrocode}
-\cs_new_protected:Nn \stex_term_custom:nn {
- \str_set:Nn \l_@@_custom_uri { #1 }
- \str_set:Nn \l_tmpa_str { #2 }
- \tl_clear:N \l_tmpa_tl
- \int_zero:N \l_tmpa_int
- \int_set:Nn \l_tmpb_int { \str_count:N \l_tmpa_str }
- \_@@_custom_loop:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\_@@_custom_loop:}
-% \begin{macrocode}
-\cs_new_protected:Nn \_@@_custom_loop: {
- \bool_set_false:N \l_tmpa_bool
- \bool_while_do:nn {
- \str_if_eq_p:ee X {
- \str_item:Nn \l_tmpa_str { \l_tmpa_int + 1 }
- }
- }{
- \int_incr:N \l_tmpa_int
- }
-
- \peek_charcode:NTF [ {
- % notation/text component
- \_@@_custom_component:w
- } {
- \int_compare:nNnTF \l_tmpa_int = \l_tmpb_int {
- % all arguments read => finish
- \_@@_custom_final:
- } {
- % arguments missing
- \peek_charcode_remove:NTF * {
- % invisible, specific argument position or both
- \peek_charcode:NTF [ {
- % visible specific argument position
- \_@@_custom_arg:wn
- } {
- % invisible
- \peek_charcode_remove:NTF * {
- % invisible specific argument position
- \_@@_custom_arg_inv:wn
- } {
- % invisible next argument
- \_@@_custom_arg_inv:wn [ \l_tmpa_int + 1 ]
- }
- }
- } {
- % next normal argument
- \_@@_custom_arg:wn [ \l_tmpa_int + 1 ]
- }
- }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\_@@_custom_arg_inv:wn}
-% \begin{macrocode}
-\cs_new_protected:Npn \_@@_custom_arg_inv:wn [ #1 ] #2 {
- \bool_set_true:N \l_tmpa_bool
- \_@@_custom_arg:wn [ #1 ] { #2 }
-}
-% \end{macrocode}
-% \end{macro}
%
-% \begin{macro}{\_@@_custom_arg:wn}
-% \begin{macrocode}
-\cs_new_protected:Npn \_@@_custom_arg:wn [ #1 ] #2 {
- \str_set:Nx \l_tmpb_str {
- \str_item:Nn \l_tmpa_str { #1 }
- }
- \str_case:VnTF \l_tmpb_str {
- { X } {
- \msg_error:nnx{stex}{error/notationarg}{\l_@@_custom_uri}
- }
- { i } { \_@@_custom_set_X:n { #1 } }
- { b } { \_@@_custom_set_X:n { #1 } }
- { a } { \_@@_custom_set_X:n { #1 } } % TODO ?
- { B } { \_@@_custom_set_X:n { #1 } } % TODO ?
- }{}{
- \msg_error:nnx{stex}{error/notationarg}{\l_@@_custom_uri}
- }
-
- \bool_if:nTF \l_tmpa_bool {
- \tl_put_right:Nx \l_tmpa_tl {
- \stex_annotate_invisible:n {
- \_stex_term_arg:nn { \int_eval:n { #1 } }
- \exp_not:n { { #2 } }
- }
- }
- } {
- \tl_put_right:Nx \l_tmpa_tl {
- \_stex_term_arg:nn { \int_eval:n { #1 } }
- \exp_not:n { { #2 } }
- }
- }
-
- \_@@_custom_loop:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\_@@_custom_set_X:n}
-% \begin{macrocode}
-\cs_new_protected:Nn \_@@_custom_set_X:n {
- \str_set:Nx \l_tmpa_str {
- \str_range:Nnn \l_tmpa_str 1 { #1 - 1 }
- X
- \str_range:Nnn \l_tmpa_str { #1 + 1 } { -1 }
- }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\_@@_custom_component:}
-% \begin{macrocode}
-\cs_new_protected:Npn \_@@_custom_component:w [ #1 ] {
- \tl_put_right:Nn \l_tmpa_tl { \comp{ #1 } }
- \_@@_custom_loop:
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\_@@_custom_final:}
-% \begin{macrocode}
-\cs_new_protected:Nn \_@@_custom_final: {
- \int_compare:nNnTF \l_tmpb_int = 0 {
- \exp_args:Nnno \_stex_term_oms:nnn
- }{
- \str_if_in:NnTF \l_tmpa_str {b} {
- \exp_args:Nnno \_stex_term_ombind:nnn
- } {
- \exp_args:Nnno \_stex_term_oma:nnn
- }
- }
- { \l_@@_custom_uri } { \l_@@_custom_uri } { \l_tmpa_tl }
-}
-% \end{macrocode}
-% \end{macro}
%
% \begin{macro}{\symref,\symname}
% \begin{macrocode}
@@ -805,7 +773,7 @@
\let\compemph_uri_prev:\compemph@uri
\let\compemph@uri\symrefemph@uri
\exp_args:NNx \use:nn
- \stex_invoke_symbol:n { { \l_stex_get_symbol_uri_str }!{
+ \stex_invoke_symbol:n { { \l_stex_get_symbol_uri_str }!\ifmmode*\fi{
\l_@@_pre_tl \l_tmpa_str \l_@@_post_tl
} }
\let\compemph@uri\compemph_uri_prev:
@@ -821,7 +789,7 @@
\let\compemph_uri_prev:\compemph@uri
\let\compemph@uri\symrefemph@uri
\exp_args:NNx \use:nn
- \stex_invoke_symbol:n { { \l_stex_get_symbol_uri_str }!{
+ \stex_invoke_symbol:n { { \l_stex_get_symbol_uri_str }!\ifmmode*\fi{
\exp_after:wN \stex_capitalize:n \l_tmpa_str
\l_@@_post_tl
} }
@@ -836,48 +804,30 @@
%<@@=stex_notationcomps>
% \end{macrocode}
%
-%
-% \begin{macro}{\stex_highlight_term:nn}
+% \begin{macro}{\comp,\compemph@uri,\compemph,\defemph,\defemph@uri,\symrefemph,\symrefemph@uri,\varemph,\varemph@uri}
% \begin{macrocode}
-
-\str_new:N \l_stex_current_symbol_str
-\cs_new_protected:Nn \stex_highlight_term:nn {
- \exp_args:Nnx
- \use:nn {
- \str_set:Nx \l_stex_current_symbol_str { #1 }
- #2
- } {
- \str_set:Nx \exp_not:N \l_stex_current_symbol_str
- { \l_stex_current_symbol_str }
+\cs_new_protected:Npn \_comp #1 {
+ \str_if_empty:NF \STEXInternalCurrentSymbolStr {
+ \stex_html_backend:TF {
+ \stex_annotate:nnn { comp }{ \STEXInternalCurrentSymbolStr }{ #1 }
+ }{
+ \exp_args:Nnx \compemph@uri { #1 } { \STEXInternalCurrentSymbolStr }
+ }
}
}
-\cs_new_protected:Nn \stex_unhighlight_term:n {
-% \latexml_if:TF {
-% #1
-% } {
-% \rustex_if:TF {
-% #1
-% } {
- #1 %\iffalse{{\fi}} #1 {{\iffalse}}\fi
-% }
-% }
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\comp,\compemph@uri,\compemph,\defemph,\defemph@uri,\symrefemph,\symrefemph@uri}
-% \begin{macrocode}
-\cs_new_protected:Npn \comp #1 {
- \str_if_empty:NF \l_stex_current_symbol_str {
- \rustex_if:TF {
- \stex_annotate:nnn { comp }{ \l_stex_current_symbol_str }{ #1 }
+\cs_new_protected:Npn \_varcomp #1 {
+ \str_if_empty:NF \STEXInternalCurrentSymbolStr {
+ \stex_html_backend:TF {
+ \stex_annotate:nnn { varcomp }{ \STEXInternalCurrentSymbolStr }{ #1 }
}{
- \exp_args:Nnx \compemph@uri { #1 } { \l_stex_current_symbol_str }
+ \exp_args:Nnx \varemph@uri { #1 } { \STEXInternalCurrentSymbolStr }
}
}
}
+\def\comp{\_comp}
+
\cs_new_protected:Npn \compemph@uri #1 #2 {
\compemph{ #1 }
}
@@ -900,7 +850,15 @@
}
\cs_new_protected:Npn \symrefemph #1 {
- \textbf{#1}
+ \emph{#1}
+}
+
+\cs_new_protected:Npn \varemph@uri #1 #2 {
+ \varemph{#1}
+}
+
+\cs_new_protected:Npn \varemph #1 {
+ #1
}
% \end{macrocode}
% \end{macro}
@@ -974,7 +932,11 @@
}
\cs_new_protected:Nn \_@@_invoke_text:n {
- %TODO
+ \peek_charcode_remove:NTF ! {
+ \_@@_invoke_op_custom:nn {#1}
+ }{
+ \_@@_invoke_custom:nn {#1}
+ }
}
@@ -982,29 +944,57 @@
\peek_charcode_remove:NTF ! {
\peek_charcode_remove:NTF ! {
\peek_charcode:NTF [ {
- \_@@_invoke_op_custom:nw
- }{
% TODO throw error
+ }{
+ \_@@_invoke_op_custom:nn
}
}{
\_@@_invoke_op:n { #1 }
}
}{
\peek_charcode_remove:NTF * {
- \_@@_invoke_text:n { #1 }
+ \_@@_invoke_custom:nn { #1 }
}{
\_@@_invoke_math_ii:n { #1 }
}
}
}
+\cs_new_protected:Nn \_@@_invoke_op_custom:nn {
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { var://#1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \_stex_term_omv:nn {var://#1}{
+ \comp{ #2 }
+ }
+ }{
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+}
+
\cs_new_protected:Nn \_@@_invoke_op:n {
\cs_if_exist:cTF {
stex_var_op_notation_ #1 _cs
}{
- \use:c{stex_var_op_notation_ #1 _cs }
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { var://#1 }
+ \_stex_term_omv:nn { var://#1 }{
+ \use:c{stex_var_op_notation_ #1 _cs }
+ }
+ }{
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ }
}{
- \msg_error:nnxx{stex}{error/noop}{variable~#1}{}
+ \int_compare:nNnTF {\prop_item:cn {l_stex_variable_#1_prop}{arity}} = 0{
+ \_@@_invoke_math_ii:n {#1}
+ }{
+ \msg_error:nnxx{stex}{error/noop}{variable~#1}{}
+ }
}
}
@@ -1012,21 +1002,94 @@
\cs_if_exist:cTF {
stex_var_notation_#1_cs
}{
- \str_set:Nn \l_stex_current_symbol_str { #1 }
+ \tl_set:Nx \STEXInternalSymbolAfterInvokationTL {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalSymbolAfterInvokationTL
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { var://#1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
\use:c{stex_var_notation_#1_cs}
}{
\msg_error:nnxx{stex}{error/nonotation}{variable~#1}{s}
}
}
+
+\cs_new_protected:Nn \_@@_invoke_custom:nn {
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { var://#1 }
+ \prop_clear:N \l__stex_terms_custom_args_prop
+ \prop_put:Nnn \l__stex_terms_custom_args_prop {currnum} {1}
+ \prop_get:cnN {
+ l_stex_variable_#1 _prop
+ }{ args } \l_tmpa_str
+ \prop_put:Nno \l__stex_terms_custom_args_prop {args} \l_tmpa_str
+ \tl_set:Nn \arg { \__stex_terms_arg: }
+ \str_if_empty:NTF \l_tmpa_str {
+ \_stex_term_omv:nn {var://#1}{\ignorespaces#2}
+ }{
+ \str_if_in:NnTF \l_tmpa_str b {
+ \_stex_term_ombind:nnn {var://#1}{}{\ignorespaces#2}
+ }{
+ \str_if_in:NnTF \l_tmpa_str B {
+ \_stex_term_ombind:nnn {var://#1}{}{\ignorespaces#2}
+ }{
+ \_stex_term_oma:nnn {var://#1}{}{\ignorespaces#2}
+ }
+ }
+ }
+ % TODO check that all arguments exist
+ }{
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \_stex_reset:N \arg
+ \_stex_reset:N \comp
+ \_stex_reset:N \l__stex_terms_custom_args_prop
+ %\bool_set_true:N \l_stex_allow_semantic_bool
+ }
+}
% \end{macrocode}
% \end{macro}
%
-%
+% \subsection{Sequences}
+% \begin{macrocode}
+%<@@=stex_sequences>
+
+\cs_new_protected:Nn \stex_invoke_sequence:n {
+ \peek_charcode_remove:NTF ! {
+ \_stex_term_omv:nn {varseq://#1}{
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr {varseq://#1}
+ \prop_item:cn{stex_varseq_#1_prop}{notation}
+ }{
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ }
+ }
+ }{
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr {varseq://#1}
+ \tl_set:Nx \STEXInternalSymbolAfterInvokationTL {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalSymbolAfterInvokationTL
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+ \use:c { stex_varseq_#1_cs }
+ }
+}
+% \end{macrocode}
+
% \begin{macrocode}
%</package>
% \end{macrocode}
%
% \end{implementation}
+% \ifinfulldoc\else\printbibliography\fi
%
% \PrintIndex
diff --git a/Master/texmf-dist/source/latex/stex/stex/stex.ins b/Master/texmf-dist/source/latex/stex/stex/stex.ins
index 8d645b251b6..0ca62264cb2 100644
--- a/Master/texmf-dist/source/latex/stex/stex/stex.ins
+++ b/Master/texmf-dist/source/latex/stex/stex/stex.ins
@@ -31,8 +31,8 @@
\from{stex-statements.dtx}{package}
\from{stex-proofs.dtx}{package}
% ...
- \from{stex-others.dtx}{package}
\from{stex-metatheory.dtx}{package}
+ \from{stex-others.dtx}{package}
}
}
diff --git a/Master/texmf-dist/tex/latex/stex/document-structure.cls b/Master/texmf-dist/tex/latex/stex/document-structure.cls
deleted file mode 100644
index 1c70de1c5f5..00000000000
--- a/Master/texmf-dist/tex/latex/stex/document-structure.cls
+++ /dev/null
@@ -1,53 +0,0 @@
-%%
-%% This is file `document-structure.cls',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% document-structure.dtx (with options: `cls')
-%%
-\ProvidesExplClass{document-structure}{2022/02/26}{3.0.1}{Modular Document Structure Class}
-\RequirePackage{l3keys2e}
-\keys_define:nn{ document-structure / pkg }{
- class .str_set_x:N = \c_document_structure_class_str,
- minimal .bool_set:N = \c_document_structure_minimal_bool,
- report .code:n = {
- \ClassWarning{document-structure}{the option 'report' is deprecated, use 'class=report', instead}
- \str_set:Nn \c_document_structure_class_str {report}
- },
- book .code:n = {
- \ClassWarning{document-structure}{the option 'book' is deprecated, use 'class=book', instead}
- \str_set:Nn \c_document_structure_class_str {book}
- },
- bookpart .code:n = {
- \ClassWarning{document-structure}{the option 'bookpart' is deprecated, use 'class=book,topsect=chapter', instead}
- \str_set:Nn \c_document_structure_class_str {book}
- \str_set:Nn \c_document_structure_topsect_str {chapter}
- },
- docopt .str_set_x:N = \c_document_structure_docopt_str,
- unknown .code:n = {
- \PassOptionsToPackage{ \CurrentOption }{ document-structure }
- }
-}
-\ProcessKeysOptions{ document-structure / pkg }
-\str_if_empty:NT \c_document_structure_class_str {
- \str_set:Nn \c_document_structure_class_str {article}
-}
-\exp_after:wN\LoadClass\exp_after:wN[\c_document_structure_docopt_str]
- {\c_document_structure_class_str}
-
-\RequirePackage{document-structure}
-\bool_if:NF \c_document_structure_minimal_bool {
-\keys_define:nn { document-structure / document }{
- id .str_set_x:N = \c_document_structure_document_id_str
-}
-\let\__document_structure_orig_document=\document
-\renewcommand{\document}[1][]{
- \keys_set:nn{ document-structure / document }{ #1 }
- \stex_ref_new_doc_target:n { \c_document_structure_document_id_str }
- \__document_structure_orig_document
-}
-}
-\endinput
-%%
-%% End of file `document-structure.cls'.
diff --git a/Master/texmf-dist/tex/latex/stex/document-structure.sty b/Master/texmf-dist/tex/latex/stex/document-structure.sty
index e2d031b4cb9..b747cf4d052 100644
--- a/Master/texmf-dist/tex/latex/stex/document-structure.sty
+++ b/Master/texmf-dist/tex/latex/stex/document-structure.sty
@@ -6,14 +6,18 @@
%%
%% document-structure.dtx (with options: `package')
%%
-\ProvidesExplPackage{document-structure}{2022/02/26}{3.0.1}{Modular Document Structure}
+\ProvidesExplPackage{document-structure}{2022/05/24}{3.1.0}{Modular Document Structure}
\RequirePackage{l3keys2e}
-\keys_define:nn{ document-structure / pkg }{
+\keys_define:nn{ document-structure }{
class .str_set_x:N = \c_document_structure_class_str,
- topsect .str_set_x:N = \c_document_structure_topsect_str,
+ topsect .str_set_x:N = \c_document_structure_topsect_str,,
+ unknown .code:n = {
+ \PassOptionsToClass{\CurrentOption}{stex}
+ \PassOptionsToClass{\CurrentOption}{tikzinput}
+ }
}
-\ProcessKeysOptions{ document-structure / pkg }
+\ProcessKeysOptions{ document-structure }
\str_if_empty:NT \c_document_structure_class_str {
\str_set:Nn \c_document_structure_class_str {article}
}
@@ -22,6 +26,7 @@
}
\RequirePackage{xspace}
\RequirePackage{comment}
+\RequirePackage{stex}
\AddToHook{begindocument}{
\ltx@ifpackageloaded{babel}{
\clist_set:Nx \l_tmpa_clist {\bbl@loaded}
@@ -53,7 +58,7 @@
\def\current@section@level{document}%
\newcommand\currentsectionlevel{\lowercase\expandafter{\current@section@level}\xspace}%
\newcommand\Currentsectionlevel{\expandafter\MakeUppercase\current@section@level\xspace}%
-\cs_new_protected:Npn \skipomgroup {
+\cs_new_protected:Npn \skipfragment {
\ifcase\l_document_structure_section_level_int
\or\stepcounter{part}
\or\stepcounter{chapter}
@@ -64,54 +69,56 @@
\or\stepcounter{subparagraph}
\fi
}
-\newcommand\at@begin@blindomgroup[1]{}
+\newcommand\at@begin@blindsfragment[1]{}
\newenvironment{blindfragment}
{
\int_incr:N\l_document_structure_section_level_int
- \at@begin@blindomgroup\l_document_structure_section_level_int
+ \at@begin@blindsfragment\l_document_structure_section_level_int
}{}
-\newcommand\omgroup@nonum[2]{
+\newcommand\sfragment@nonum[2]{
\ifx\hyper@anchor\@undefined\else\phantomsection\fi
\addcontentsline{toc}{#1}{#2}\@nameuse{#1}*{#2}
}
-\newcommand\omgroup@num[2]{
- \tl_if_empty:NTF \l__document_structure_omgroup_short_tl {
+\newcommand\sfragment@num[2]{
+ \tl_if_empty:NTF \l__document_structure_sfragment_short_tl {
\@nameuse{#1}{#2}
}{
\cs_if_exist:NTF\rdfmeta@sectioning{
- \@nameuse{rdfmeta@#1@old}[\l__document_structure_omgroup_short_tl]{#2}
+ \@nameuse{rdfmeta@#1@old}[\l__document_structure_sfragment_short_tl]{#2}
}{
- \@nameuse{#1}[\l__document_structure_omgroup_short_tl]{#2}
+ \@nameuse{#1}[\l__document_structure_sfragment_short_tl]{#2}
}
}
}
-\keys_define:nn { document-structure / omgroup }{
- id .str_set_x:N = \l__document_structure_omgroup_id_str,
- date .str_set_x:N = \l__document_structure_omgroup_date_str,
- creators .clist_set:N = \l__document_structure_omgroup_creators_clist,
- contributors .clist_set:N = \l__document_structure_omgroup_contributors_clist,
- srccite .tl_set:N = \l__document_structure_omgroup_srccite_tl,
- type .tl_set:N = \l__document_structure_omgroup_type_tl,
- short .tl_set:N = \l__document_structure_omgroup_short_tl,
- display .tl_set:N = \l__document_structure_omgroup_display_tl,
- intro .tl_set:N = \l__document_structure_omgroup_intro_tl,
- loadmodules .bool_set:N = \l__document_structure_omgroup_loadmodules_bool
+\keys_define:nn { document-structure / sfragment }{
+ id .str_set_x:N = \l__document_structure_sfragment_id_str,
+ date .str_set_x:N = \l__document_structure_sfragment_date_str,
+ creators .clist_set:N = \l__document_structure_sfragment_creators_clist,
+ contributors .clist_set:N = \l__document_structure_sfragment_contributors_clist,
+ srccite .tl_set:N = \l__document_structure_sfragment_srccite_tl,
+ type .tl_set:N = \l__document_structure_sfragment_type_tl,
+ short .tl_set:N = \l__document_structure_sfragment_short_tl,
+ display .tl_set:N = \l__document_structure_sfragment_display_tl,
+ intro .tl_set:N = \l__document_structure_sfragment_intro_tl,
+ imports .tl_set:N = \l__document_structure_sfragment_imports_tl,
+ loadmodules .bool_set:N = \l__document_structure_sfragment_loadmodules_bool
}
-\cs_new_protected:Nn \__document_structure_omgroup_args:n {
- \str_clear:N \l__document_structure_omgroup_id_str
- \str_clear:N \l__document_structure_omgroup_date_str
- \clist_clear:N \l__document_structure_omgroup_creators_clist
- \clist_clear:N \l__document_structure_omgroup_contributors_clist
- \tl_clear:N \l__document_structure_omgroup_srccite_tl
- \tl_clear:N \l__document_structure_omgroup_type_tl
- \tl_clear:N \l__document_structure_omgroup_short_tl
- \tl_clear:N \l__document_structure_omgroup_display_tl
- \tl_clear:N \l__document_structure_omgroup_intro_tl
- \bool_set_false:N \l__document_structure_omgroup_loadmodules_bool
- \keys_set:nn { document-structure / omgroup } { #1 }
+\cs_new_protected:Nn \__document_structure_sfragment_args:n {
+ \str_clear:N \l__document_structure_sfragment_id_str
+ \str_clear:N \l__document_structure_sfragment_date_str
+ \clist_clear:N \l__document_structure_sfragment_creators_clist
+ \clist_clear:N \l__document_structure_sfragment_contributors_clist
+ \tl_clear:N \l__document_structure_sfragment_srccite_tl
+ \tl_clear:N \l__document_structure_sfragment_type_tl
+ \tl_clear:N \l__document_structure_sfragment_short_tl
+ \tl_clear:N \l__document_structure_sfragment_display_tl
+ \tl_clear:N \l__document_structure_sfragment_imports_tl
+ \tl_clear:N \l__document_structure_sfragment_intro_tl
+ \bool_set_false:N \l__document_structure_sfragment_loadmodules_bool
+ \keys_set:nn { document-structure / sfragment } { #1 }
}
\newif\if@mainmatter\@mainmattertrue
-\newcommand\at@begin@omgroup[3][]{}
+\newcommand\at@begin@sfragment[3][]{}
\keys_define:nn { document-structure / sectioning }{
name .str_set_x:N = \l__document_structure_sect_name_str ,
ref .str_set_x:N = \l__document_structure_sect_ref_str ,
@@ -133,26 +140,31 @@
\bool_if:NT \l__document_structure_sect_clear_bool { \cleardoublepage }
\if@mainmatter% numbering not overridden by frontmatter, etc.
\bool_if:NTF \l__document_structure_sect_num_bool {
- \omgroup@num{#2}{#3}
+ \sfragment@num{#2}{#3}
}{
- \omgroup@nonum{#2}{#3}
+ \sfragment@nonum{#2}{#3}
}
\def\current@section@level{\omdoc@sect@name}
\else
- \omgroup@nonum{#2}{#3}
+ \sfragment@nonum{#2}{#3}
\fi
}% if@mainmatter
-\newcommand\omgroup@redefine@addtocontents[1]{%
+\newcommand\sfragment@redefine@addtocontents[1]{%
}% hypreref.sty loaded?
\newenvironment{sfragment}[2][]% keys, title
{
- \__document_structure_omgroup_args:n { #1 }%\sref@target%
- \bool_if:NT \l__document_structure_omgroup_loadmodules_bool {
- \omgroup@redefine@addtocontents{
+ \__document_structure_sfragment_args:n { #1 }%\sref@target%
+ \stex_csl_to_imports:No \usemodule \l__document_structure_sfragment_imports_tl
+
+ \bool_if:NT \l__document_structure_sfragment_loadmodules_bool {
+ \sfragment@redefine@addtocontents{
%\@ifundefined{module@id}\used@modules%
%{\@ifundefined{module@\module@id @path}{\used@modules}\module@id}
}
}
+
+ \stex_document_title:n { #2 }
+
\int_incr:N\l_document_structure_section_level_int
\ifcase\l_document_structure_section_level_int
\or\omdoc@sectioning[name=\omdoc@part@kw,clear,num]{part}{#2}
@@ -163,9 +175,9 @@
\or\omdoc@sectioning[name=\omdoc@paragraph@kw,ref=this \omdoc@paragraph@kw]{paragraph}{#2}
\or\omdoc@sectioning[name=\omdoc@subparagraph@kw,ref=this \omdoc@subparagraph@kw]{paragraph}{#2}
\fi
- \at@begin@omgroup[#1]\l_document_structure_section_level_int{#2}
- \str_if_empty:NF \l__document_structure_omgroup_id_str {
- \stex_ref_new_doc_target:n\l__document_structure_omgroup_id_str
+ \at@begin@sfragment[#1]\l_document_structure_section_level_int{#2}
+ \str_if_empty:NF \l__document_structure_sfragment_id_str {
+ \stex_ref_new_doc_target:n\l__document_structure_sfragment_id_str
}
}% for customization
{}
@@ -222,29 +234,18 @@
\@mainmattertrue\pagenumbering{arabic}
\def \c__document_structure_document_str{document}
\newcommand\afterprematurestop{}
-\def\prematurestop@endomgroup{
+\def\prematurestop@endsfragment{
\unless\ifx\@currenvir\c__document_structure_document_str
\expandafter\expandafter\expandafter\end\expandafter\expandafter\expandafter{\expandafter\@currenvir\expandafter}
- \expandafter\prematurestop@endomgroup
+ \expandafter\prematurestop@endsfragment
\fi
}
\providecommand\prematurestop{
\message{Stopping~sTeX~processing~prematurely}
- \prematurestop@endomgroup
+ \prematurestop@endsfragment
\afterprematurestop
\end{document}
}
-\iffalse
-\providecommand{\lxDocumentID}[1]{}%
-\def\LXMID#1#2{\expandafter\gdef\csname xmarg#1\endcsname{#2}\csname xmarg#1\endcsname}
-\def\LXMRef#1{\csname xmarg#1\endcsname}
-\long\def\STRlabel#1#2{\STRlabeldef{#1}{#2}{#2}}
-\newcommand\STRcopy[2][]{\expandafter\ifx\csname STR@#2\endcsname\relax
-\message{STR warning: reference #2 undefined!}
-\else\csname STR@#2\endcsname\fi}
-\newcommand\STRsemantics[3][]{#2\def\@test{#1}\ifx\@test\@empty\STRlabeldef{#1}{#2}\fi}
-\def\STRlabeldef#1{\expandafter\gdef\csname STR@#1\endcsname}
-\fi
\RequirePackage{etoolbox}
\newcommand\setSGvar[1]{\@namedef{sTeX@Gvar@#1}}
\newrobustcmd\useSGvar[1]{%
diff --git a/Master/texmf-dist/tex/latex/stex/etc/beamerthemesTeX.sty b/Master/texmf-dist/tex/latex/stex/etc/beamerthemesTeX.sty
index 5d3a63c630c..d7b861086a4 100644
--- a/Master/texmf-dist/tex/latex/stex/etc/beamerthemesTeX.sty
+++ b/Master/texmf-dist/tex/latex/stex/etc/beamerthemesTeX.sty
@@ -20,9 +20,14 @@
\mode
<presentation>
+\ifcsname slidelogo\endcsname\else
+ \newsavebox\slidelogo
+ \sbox\slidelogo{\sTeX}
+\fi
+
%% Logo images
\pgfdeclareimage[height=2ex]{instlogo}{sTeX-logo}
-\pgfdeclareimage[height=2ex]{cclogo}{cc_somerights}
+\pgfdeclareimage[height=2ex]{cclogo}{stex-cc_somerights}
%% A simple frame title with a long rule under it.
\setbeamertemplate{frametitle}{%
@@ -36,7 +41,7 @@
%% A Footer line with a Institution and CC logos
\setbeamertemplate{footline}[text line]{%
\usebeamercolor[fg]{titlelike}
- \pgfuseimage{instlogo}\hspace*{1cm}\insertshortauthor: \insertshorttitle\hfill{}%
+ \usebox\slidelogo\hspace*{1cm}\insertshortauthor: \insertshorttitle\hfill{}%
\insertframenumber\hfill\insertshortdate\hspace*{1cm}\pgfuseimage{cclogo}%
}
diff --git a/Master/texmf-dist/tex/latex/stex/etc/lststex.sty b/Master/texmf-dist/tex/latex/stex/etc/lststex.sty
index e3865cb464d..2b0f7a9b2e9 100644
--- a/Master/texmf-dist/tex/latex/stex/etc/lststex.sty
+++ b/Master/texmf-dist/tex/latex/stex/etc/lststex.sty
@@ -10,16 +10,10 @@
}
\lstdefinelanguage[sTeX]{TeX}[LaTeX]{TeX}%
- {moretexcs={[2]defin,twindef,atwindef,definalt,twindefalt,atwindefalt,definiendum,
- importmodule,usemodule,importmhmodule,usemhmodule,gimport,guse,
- symdef,symvariant,symtest,
- defi,defii,defiii,adefi,adefii,adefiii,defis,defiis,defiiis,
- trefi,trefii,trefiii,atrefi,atrefii,atrefiii,mtrefi,mtrefii,mtrefiii,
- trefis,trefiis,trefiiis,atrefis,atrefiis,atrefiiis,
- symi,symii,symiii,
- termref,sref},
- morekeywords={module,definition,axiom,assertion,omtext,
- mhmodule,mhmodsig,mhmodnl,modsig,modnl,
+ {moretexcs={[2]definiendum,definame,symref,symname,comp,
+ importmodule,usemodule
+ symdef,symdecl,notation,sref},
+ morekeywords={smodule,sdefinition,sassertion,sparagraph,
inputref,
sproof,spfstep,spfcases,spfcase,justification,premise}}
diff --git a/Master/texmf-dist/tex/latex/stex/etc/stex-backend-latexml.cfg b/Master/texmf-dist/tex/latex/stex/etc/stex-backend-latexml.cfg
new file mode 100644
index 00000000000..1cb4e31d3a8
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/stex/etc/stex-backend-latexml.cfg
@@ -0,0 +1,56 @@
+\ifcsname if@latexml\endcsname\else
+\expandafter\newif\csname if@latexml\endcsname\@latexmlfalse
+\fi
+
+\tl_const:Nx \c_stex_html_emptyarg_tl {~}
+
+\prg_new_conditional:Nnn \latexml_if: {p, T, F, TF} {
+ \if@latexml
+ \expandafter\prg_return_true:
+ \else:
+ \expandafter\prg_return_false:
+ \fi:
+}
+
+\cs_new_protected:Nn \stex_annotate:nnn {
+ \_stex_html_checkempty:n { #3 }
+ \mode_if_math:TF {
+ \cs:w latexml@annotate@math\cs_end:{#1}{#2}{
+ \tl_use:N \l_stex_html_arg_tl
+ }
+ }{
+ \cs:w latexml@annotate@text\cs_end:{#1}{#2}{
+ \tl_use:N \l_stex_html_arg_tl
+ }
+ }
+}
+
+\cs_new_protected:Nn \stex_annotate_invisible:n {
+ \_stex_html_checkempty:n { #1 }
+ \mode_if_math:TF {
+ \cs:w latexml@invisible@math\cs_end:{
+ \tl_use:N \l_stex_html_arg_tl
+ }
+ } {
+ \cs:w latexml@invisible@text\cs_end:{
+ \tl_use:N \l_stex_html_arg_tl
+ }
+ }
+}
+
+\cs_new_protected:Nn \stex_annotate_invisible:nnn {
+ \_stex_html_checkempty:n { #3 }
+ \cs:w latexml@annotate@invisible\cs_end:{#1}{#2}{
+ \tl_use:N \l_stex_html_arg_tl
+ }
+}
+
+\NewDocumentEnvironment{stex_annotate_env} { m m } {
+ \par\begin{latexml@annotateenv}{#1}{#2}
+}{
+ \par\end{latexml@annotateenv}
+}
+
+\prg_new_conditional:Nnn \stex_html_backend: {p, T, F, TF} {
+ \prg_return_true:
+} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/stex/etc/stex-backend-pdflatex.cfg b/Master/texmf-dist/tex/latex/stex/etc/stex-backend-pdflatex.cfg
new file mode 100644
index 00000000000..bdd2810d09d
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/stex/etc/stex-backend-pdflatex.cfg
@@ -0,0 +1,10 @@
+\tl_const:Nx \c_stex_html_emptyarg_tl {~}
+
+\cs_new_protected:Nn \stex_annotate:nnn {#3}
+\cs_new_protected:Nn \stex_annotate_invisible:n {}
+\cs_new_protected:Nn \stex_annotate_invisible:nnn {}
+\NewDocumentEnvironment{stex_annotate_env} { m m } {}{}
+
+\prg_new_conditional:Nnn \stex_html_backend: {p, T, F, TF} {
+ \prg_return_false:
+} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/stex/etc/stex-backend-rustex.cfg b/Master/texmf-dist/tex/latex/stex/etc/stex-backend-rustex.cfg
new file mode 100644
index 00000000000..3f48631e406
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/stex/etc/stex-backend-rustex.cfg
@@ -0,0 +1,59 @@
+\RequirePackage{rustex}
+
+\rustex_add_Namespace:nn{stex}{http://kwarc.info/ns/sTeX}
+\rustex_add_Namespace:nn{mmt}{http://uniformal.github.io/MMT}
+
+\tl_const:Nx \c_stex_html_emptyarg_tl {
+ \rustex_direct_HTML:n { \c_ampersand_str \c_hash_str 8205; }
+}
+
+\cs_new_protected:Nn \stex_annotate:nnn {
+ \_stex_html_checkempty:n { #3 }
+ \rustex_annotate_HTML:nn {
+ property="stex:#1" ~
+ resource="#2"
+ } {
+ \mode_if_vertical:TF{
+ \tl_use:N \l_stex_html_arg_tl\stex_par:
+ }{
+ \tl_use:N \l_stex_html_arg_tl
+ }
+ }
+}
+
+\cs_new_protected:Nn \stex_annotate_invisible:n {
+ \_stex_html_checkempty:n { #1 }
+ \rustex_annotate_HTML:nn {
+ stex:visible="false" ~
+ style:display="none"
+ } {
+ \ifmmode\tl_use:N \l_stex_html_arg_tl\else\hbox{\tl_use:N \l_stex_html_arg_tl}\fi
+ }
+}
+
+\cs_new_protected:Nn \stex_annotate_invisible:nnn {
+ \_stex_html_checkempty:n { #3 }
+ \rustex_annotate_HTML:nn {
+ property="stex:#1" ~
+ resource="#2" ~
+ stex:visible="false" ~
+ style:display="none"
+ } {
+ \ifmmode\tl_use:N \l_stex_html_arg_tl\else\hbox{\tl_use:N \l_stex_html_arg_tl}\fi
+ }
+}
+
+\NewDocumentEnvironment{stex_annotate_env} { m m } {
+ \stex_par:
+ \rustex_annotate_HTML_begin:n {
+ property="stex:#1" ~
+ resource="#2"
+ }
+}{
+ \stex_par:
+ \rustex_annotate_HTML_end:
+}
+
+\prg_new_conditional:Nnn \stex_html_backend: {p, T, F, TF} {
+ \prg_return_true:
+} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/stex/etc/stex-logo.sty b/Master/texmf-dist/tex/latex/stex/etc/stex-logo.sty
new file mode 100644
index 00000000000..1bcb487aba6
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/stex/etc/stex-logo.sty
@@ -0,0 +1,7 @@
+\RequirePackage{xspace}
+\protected\def\stex{%
+ \@ifundefined{texorpdfstring}{\raisebox{-.5ex}S\kern-.5ex\TeX}{%
+ \texorpdfstring{\raisebox{-.5ex}S\kern-.5ex\TeX}{sTeX}\xspace%
+ }%
+}
+\let\sTeX\stex \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/stex/etc/stexthm.sty b/Master/texmf-dist/tex/latex/stex/etc/stexthm.sty
index 5f2071c4fea..16931b514a1 100644
--- a/Master/texmf-dist/tex/latex/stex/etc/stexthm.sty
+++ b/Master/texmf-dist/tex/latex/stex/etc/stexthm.sty
@@ -26,13 +26,16 @@
\declaretheorem[sibling=theorem]{axiom}
\stexpatchassertion[axiom]
-{\ifx\sassertiontitle\@empty\begin{axiom}[type=axiom]\else\begin{axiom}[type=axiom,\sassertiontitle]\fi}
+{\ifx\sassertiontitle\@empty\begin{axiom}\else\begin{axiom}[\sassertiontitle]\fi}
{\end{axiom}}
\declaretheorem[sibling=theorem,style=remark]{remark}
\stexpatchassertion[remark]
{\ifx\sassertiontitle\@empty\begin{remark}\else\begin{remark}[\sassertiontitle]\fi}
{\end{remark}}
+\stexpatchparagraph[remark]
+{\ifx\sparagraphtitle\@empty\begin{remark}\else\begin{remark}[\sparagraphtitle]\fi}
+{\end{remark}}
\declaretheorem[sibling=theorem,style=definition]{example}
\stexpatchexample
@@ -42,4 +45,42 @@
\declaretheorem[sibling=theorem,style=definition]{definition}
\stexpatchdefinition
{\ifx\sdefinitiontitle\@empty\begin{definition}\else\begin{definition}[\sdefinitiontitle]\fi}
- {\end{definition}} \ No newline at end of file
+ {\end{definition}}
+
+
+\RequirePackage{pdfcomment}
+\RequirePackage{xcolor}
+
+\def\compemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{#1}\else#1\fi}
+\def\symrefemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{#1}\else#1\fi}
+\def\defemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{\textbf{#1}}\else\textbf{#1}\fi}
+\def\varemph#1{\ifcsname textcolor\endcsname\textcolor{gray}{#1}\else#1\fi}
+
+\protected\def\compemph@uri#1#2{%
+ \pdftooltip{%
+ \srefsymuri{#2}{\compemph{#1}}%
+ }{%
+ URI:~\detokenize{#2}%
+ }%
+}
+\protected\def\symrefemph@uri#1#2{%
+ \pdftooltip{%
+ \srefsymuri{#2}{\symrefemph{#1}}%
+ }{%
+ URI:~\detokenize{#2}%
+ }%
+}
+\protected\def\defemph@uri#1#2{%
+ \pdftooltip{%
+ \defemph{#1}%
+ }{%
+ URI:~\detokenize{#2}%
+ }%
+}
+\protected\def\varemph@uri#1#2{%
+ \pdftooltip{%
+ \varemph{#1}%
+ }{%
+ Variable~\detokenize{#2}%
+ }%
+} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/stex/hwexam.cls b/Master/texmf-dist/tex/latex/stex/hwexam.cls
deleted file mode 100644
index 3d1427cb2ba..00000000000
--- a/Master/texmf-dist/tex/latex/stex/hwexam.cls
+++ /dev/null
@@ -1,35 +0,0 @@
-%%
-%% This is file `hwexam.cls',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% hwexam.dtx (with options: `cls')
-%%
-\ProvidesExplClass{hwexam}{2022/02/26}{3.0.1}{homework assignments and exams}
-\RequirePackage{l3keys2e}
-\DeclareOption*{
- \PassOptionsToClass{\CurrentOption}{document-structure}
- \PassOptionsToPackage{\CurrentOption}{stex}
- \PassOptionsToPackage{\CurrentOption}{hwexam}
- \PassOptionsToPackage{\CurrentOption}{tikzinput}
-}
-\ProcessOptions
-\LoadClass{document-structure}
-\RequirePackage{stex}
-\RequirePackage{hwexam}
-\RequirePackage{tikzinput}
-\RequirePackage{graphicx}
-\RequirePackage{a4wide}
-\RequirePackage{amssymb}
-\RequirePackage{amstext}
-\RequirePackage{amsmath}
-\newcommand\assig@default@type{\hwexam@assignment@kw}
-\def\document@hwexamtype{\assig@default@type}
-\keys_define:nn { document-structure / document }{
-id .str_set_x:N = \c_document_structure_document_id_str,
-hwexamtype .tl_set:N = \document@hwexamtype
-}
-\endinput
-%%
-%% End of file `hwexam.cls'.
diff --git a/Master/texmf-dist/tex/latex/stex/hwexam.sty b/Master/texmf-dist/tex/latex/stex/hwexam.sty
index b1738e32924..84387461ed3 100644
--- a/Master/texmf-dist/tex/latex/stex/hwexam.sty
+++ b/Master/texmf-dist/tex/latex/stex/hwexam.sty
@@ -6,7 +6,7 @@
%%
%% hwexam.dtx (with options: `package')
%%
-\ProvidesExplPackage{hwexam}{2022/02/26}{3.0.1}{homework assignments and exams}
+\ProvidesExplPackage{hwexam}{2022/05/24}{3.1.0}{homework assignments and exams}
\RequirePackage{l3keys2e}
\newif\iftest\testfalse
@@ -50,116 +50,115 @@ blank~for~extra~space}
}
\newcounter{assignment}
-\numberproblemsin{assignment}
-\renewcommand\prob@label[1]{\assignment@number.#1}
\keys_define:nn { hwexam / assignment } {
-id .str_set_x:N = \l__hwexam_assign_id_str,
-number .int_set:N = \l__hwexam_assign_number_int,
-title .tl_set:N = \l__hwexam_assign_title_tl,
-type .tl_set:N = \l__hwexam_assign_type_tl,
-given .tl_set:N = \l__hwexam_assign_given_tl,
-due .tl_set:N = \l__hwexam_assign_due_tl,
+id .str_set_x:N = \l__problems_assign_id_str,
+number .int_set:N = \l__problems_assign_number_int,
+title .tl_set:N = \l__problems_assign_title_tl,
+type .tl_set:N = \l__problems_assign_type_tl,
+given .tl_set:N = \l__problems_assign_given_tl,
+due .tl_set:N = \l__problems_assign_due_tl,
loadmodules .code:n = {
-\bool_set_true:N \l__hwexam_assign_loadmodules_bool
+\bool_set_true:N \l__problems_assign_loadmodules_bool
}
}
-\cs_new_protected:Nn \__hwexam_assignment_args:n {
-\str_clear:N \l__hwexam_assign_id_str
-\int_set:Nn \l__hwexam_assign_number_int {-1}
-\tl_clear:N \l__hwexam_assign_title_tl
-\tl_clear:N \l__hwexam_assign_type_tl
-\tl_clear:N \l__hwexam_assign_given_tl
-\tl_clear:N \l__hwexam_assign_due_tl
-\bool_set_false:N \l__hwexam_assign_loadmodules_bool
+\cs_new_protected:Nn \__problems_assignment_args:n {
+\str_clear:N \l__problems_assign_id_str
+\int_set:Nn \l__problems_assign_number_int {-1}
+\tl_clear:N \l__problems_assign_title_tl
+\tl_clear:N \l__problems_assign_type_tl
+\tl_clear:N \l__problems_assign_given_tl
+\tl_clear:N \l__problems_assign_due_tl
+\bool_set_false:N \l__problems_assign_loadmodules_bool
\keys_set:nn { hwexam / assignment }{ #1 }
}
\newcommand\given@due[2]{
\bool_lazy_all:nF {
-{\tl_if_empty_p:V \l__hwexam_inclassign_given_tl}
-{\tl_if_empty_p:V \l__hwexam_assign_given_tl}
-{\tl_if_empty_p:V \l__hwexam_inclassign_due_tl}
-{\tl_if_empty_p:V \l__hwexam_assign_due_tl}
+{\tl_if_empty_p:V \l__problems_inclassign_given_tl}
+{\tl_if_empty_p:V \l__problems_assign_given_tl}
+{\tl_if_empty_p:V \l__problems_inclassign_due_tl}
+{\tl_if_empty_p:V \l__problems_assign_due_tl}
}{ #1 }
-\tl_if_empty:NTF \l__hwexam_inclassign_given_tl {
-\tl_if_empty:NF \l__hwexam_assign_given_tl {
-\hwexam@given@kw\xspace\l__hwexam_assign_given_tl
+\tl_if_empty:NTF \l__problems_inclassign_given_tl {
+\tl_if_empty:NF \l__problems_assign_given_tl {
+\hwexam@given@kw\xspace\l__problems_assign_given_tl
}
}{
-\hwexam@given@kw\xspace\l__hwexam_inclassign_given_tl
+\hwexam@given@kw\xspace\l__problems_inclassign_given_tl
}
\bool_lazy_or:nnF {
\bool_lazy_and_p:nn {
-\tl_if_empty_p:V \l__hwexam_inclassign_due_tl
+\tl_if_empty_p:V \l__problems_inclassign_due_tl
}{
-\tl_if_empty_p:V \l__hwexam_assign_due_tl
+\tl_if_empty_p:V \l__problems_assign_due_tl
}
}{
\bool_lazy_and_p:nn {
-\tl_if_empty_p:V \l__hwexam_inclassign_due_tl
+\tl_if_empty_p:V \l__problems_inclassign_due_tl
}{
-\tl_if_empty_p:V \l__hwexam_assign_due_tl
+\tl_if_empty_p:V \l__problems_assign_due_tl
}
}{ ,~ }
-\tl_if_empty:NTF \l__hwexam_inclassign_due_tl {
-\tl_if_empty:NF \l__hwexam_assign_due_tl {
-\hwexam@due@kw\xspace \l__hwexam_assign_due_tl
+\tl_if_empty:NTF \l__problems_inclassign_due_tl {
+\tl_if_empty:NF \l__problems_assign_due_tl {
+\hwexam@due@kw\xspace \l__problems_assign_due_tl
}
}{
-\hwexam@due@kw\xspace \l__hwexam_inclassign_due_tl
+\hwexam@due@kw\xspace \l__problems_inclassign_due_tl
}
\bool_lazy_all:nF {
-{ \tl_if_empty_p:V \l__hwexam_inclassign_given_tl }
-{ \tl_if_empty_p:V \l__hwexam_assign_given_tl }
-{ \tl_if_empty_p:V \l__hwexam_inclassign_due_tl }
-{ \tl_if_empty_p:V \l__hwexam_assign_due_tl }
+{ \tl_if_empty_p:V \l__problems_inclassign_given_tl }
+{ \tl_if_empty_p:V \l__problems_assign_given_tl }
+{ \tl_if_empty_p:V \l__problems_inclassign_due_tl }
+{ \tl_if_empty_p:V \l__problems_assign_due_tl }
}{ #2 }
}
\newcommand\assignment@title[3]{
-\tl_if_empty:NTF \l__hwexam_inclassign_title_tl {
-\tl_if_empty:NTF \l__hwexam_assign_title_tl {
+\tl_if_empty:NTF \l__problems_inclassign_title_tl {
+\tl_if_empty:NTF \l__problems_assign_title_tl {
#1
}{
-#2\l__hwexam_assign_title_tl#3
+#2\l__problems_assign_title_tl#3
}
}{
-#2\l__hwexam_inclassign_title_tl#3
+#2\l__problems_inclassign_title_tl#3
}
}
\newcommand\assignment@number{
-\int_compare:nNnTF \l__hwexam_inclassign_number_int = {-1} {
-\int_compare:nNnTF \l__hwexam_assign_number_int = {-1} {
+\int_compare:nNnTF \l__problems_inclassign_number_int = {-1} {
+\int_compare:nNnTF \l__problems_assign_number_int = {-1} {
\arabic{assignment}
} {
-\int_use:N \l__hwexam_assign_number_int
+\int_use:N \l__problems_assign_number_int
}
}{
-\int_use:N \l__hwexam_inclassign_number_int
+\int_use:N \l__problems_inclassign_number_int
}
}
\newenvironment{assignment}[1][]{
-\__hwexam_assignment_args:n { #1 }
-\int_compare:nNnTF \l__hwexam_assign_number_int = {-1} {
+\__problems_assignment_args:n { #1 }
+\int_compare:nNnTF \l__problems_assign_number_int = {-1} {
\global\stepcounter{assignment}
}{
-\global\setcounter{assignment}{\int_use:N\l__hwexam_assign_number_int}
+\global\setcounter{assignment}{\int_use:N\l__problems_assign_number_int}
}
\setcounter{problem}{0}
+\renewcommand\prob@label[1]{\assignment@number.##1}
\def\current@section@level{\document@hwexamtype}
\begin{@assignment}
}{
\end{@assignment}
}
\def\ass@title{
-\protect\document@hwexamtype~\arabic{assignment}
+{\protect\document@hwexamtype}~\arabic{assignment}
\assignment@title{}{\;(}{)\;} -- \given@due{}{}
}
\ifmultiple
\newenvironment{@assignment}{
-\bool_if:NTF \l__hwexam_assign_loadmodules_bool {
+\bool_if:NTF \l__problems_assign_loadmodules_bool {
\begin{sfragment}[loadmodules]{\ass@title}
}{
\begin{sfragment}{\ass@title}
@@ -177,34 +176,34 @@ loadmodules .code:n = {
}{}
\fi% multiple
\keys_define:nn { hwexam / inclassignment } {
-number .int_set:N = \l__hwexam_inclassign_number_int,
-title .tl_set:N = \l__hwexam_inclassign_title_tl,
-type .tl_set:N = \l__hwexam_inclassign_type_tl,
-given .tl_set:N = \l__hwexam_inclassign_given_tl,
-due .tl_set:N = \l__hwexam_inclassign_due_tl,
-mhrepos .str_set_x:N = \l__hwexam_inclassign_mhrepos_str
-}
-\cs_new_protected:Nn \__hwexam_inclassignment_args:n {
-\int_set:Nn \l__hwexam_inclassign_number_int {-1}
-\tl_clear:N \l__hwexam_inclassign_title_tl
-\tl_clear:N \l__hwexam_inclassign_type_tl
-\tl_clear:N \l__hwexam_inclassign_given_tl
-\tl_clear:N \l__hwexam_inclassign_due_tl
-\str_clear:N \l__hwexam_inclassign_mhrepos_str
+number .int_set:N = \l__problems_inclassign_number_int,
+title .tl_set:N = \l__problems_inclassign_title_tl,
+type .tl_set:N = \l__problems_inclassign_type_tl,
+given .tl_set:N = \l__problems_inclassign_given_tl,
+due .tl_set:N = \l__problems_inclassign_due_tl,
+mhrepos .str_set_x:N = \l__problems_inclassign_mhrepos_str
+}
+\cs_new_protected:Nn \__problems_inclassignment_args:n {
+\int_set:Nn \l__problems_inclassign_number_int {-1}
+\tl_clear:N \l__problems_inclassign_title_tl
+\tl_clear:N \l__problems_inclassign_type_tl
+\tl_clear:N \l__problems_inclassign_given_tl
+\tl_clear:N \l__problems_inclassign_due_tl
+\str_clear:N \l__problems_inclassign_mhrepos_str
\keys_set:nn { hwexam / inclassignment }{ #1 }
}
-\__hwexam_inclassignment_args:n {}
+\__problems_inclassignment_args:n {}
\newcommand\inputassignment[2][]{
-\__hwexam_inclassignment_args:n { #1 }
-\str_if_empty:NTF \l__hwexam_inclassign_mhrepos_str {
+\__problems_inclassignment_args:n { #1 }
+\str_if_empty:NTF \l__problems_inclassign_mhrepos_str {
\input{#2}
}{
-\stex_in_repository:nn{\l__hwexam_inclassign_mhrepos_str}{
-\input{\mhpath{\l__hwexam_inclassign_mhrepos_str}{#2}}
+\stex_in_repository:nn{\l__problems_inclassign_mhrepos_str}{
+\input{\mhpath{\l__problems_inclassign_mhrepos_str}{#2}}
}
}
-\__hwexam_inclassignment_args:n {}
+\__problems_inclassignment_args:n {}
}
\newcommand\includeassignment[2][]{
\newpage
@@ -236,7 +235,7 @@ duration .tl_set:N = \testheading@duration,
reqpts .tl_set:N = \testheading@reqpts,
tools .tl_set:N = \testheading@tools
}
-\cs_new_protected:Nn \__hwexam_testheading_args:n {
+\cs_new_protected:Nn \__problems_testheading_args:n {
\tl_clear:N \testheading@min
\tl_clear:N \testheading@duration
\tl_clear:N \testheading@reqpts
@@ -244,7 +243,7 @@ tools .tl_set:N = \testheading@tools
\keys_set:nn { hwexam / testheading }{ #1 }
}
\newenvironment{testheading}[1][]{
-\__hwexam_testheading_args:n{ #1 }
+\__problems_testheading_args:n{ #1 }
\newcount\check@time\check@time=\testheading@min
\advance\check@time by -\theassignment@totalmin
\newif\if@bonuspoints
diff --git a/Master/texmf-dist/tex/latex/stex/notesslides.cls b/Master/texmf-dist/tex/latex/stex/notesslides.cls
index 267511a95d6..1eb33611a58 100644
--- a/Master/texmf-dist/tex/latex/stex/notesslides.cls
+++ b/Master/texmf-dist/tex/latex/stex/notesslides.cls
@@ -6,43 +6,60 @@
%%
%% notesslides.dtx (with options: `cls')
%%
-\ProvidesExplClass{notesslides}{2022/02/26}{3.0.1}{notesslides Class}
+\ProvidesExplClass{notesslides}{2022/05/24}{3.1.0}{notesslides Class}
\RequirePackage{l3keys2e}
\keys_define:nn{notesslides / cls}{
- class .code:n = {
- \PassOptionsToClass{\CurrentOption}{document-structure}
- \str_if_eq:nnT{#1}{book}{
- \PassOptionsToPackage{defaulttopsec=part}{notesslides}
- }
- \str_if_eq:nnT{#1}{report}{
- \PassOptionsToPackage{defaulttopsec=part}{notesslides}
- }
- },
+ class .str_set_x:N = \c__notesslides_class_str,
notes .bool_set:N = \c__notesslides_notes_bool ,
slides .code:n = { \bool_set_false:N \c__notesslides_notes_bool },
+ docopt .str_set_x:N = \c__notesslides_docopt_str,
unknown .code:n = {
- \PassOptionsToClass{\CurrentOption}{document-structure}
+ \PassOptionsToPackage{\CurrentOption}{document-structure}
\PassOptionsToClass{\CurrentOption}{beamer}
\PassOptionsToPackage{\CurrentOption}{notesslides}
+ \PassOptionsToPackage{\CurrentOption}{stex}
}
}
\ProcessKeysOptions{ notesslides / cls }
+
+\str_if_empty:NF \c__notesslides_class_str {
+ \PassOptionsToPackage{class=\c__notesslides_class_str}{document-structure}
+}
+
+\exp_args:No \str_if_eq:nnT\c__notesslides_class_str{book}{
+ \PassOptionsToPackage{defaulttopsect=part}{notesslides}
+}
+\exp_args:No \str_if_eq:nnT\c__notesslides_class_str{report}{
+ \PassOptionsToPackage{defaulttopsect=part}{notesslides}
+}
+
+\RequirePackage{stex}
+\stex_html_backend:T {
+ \bool_set_true:N\c__notesslides_notes_bool
+}
+
\bool_if:NTF \c__notesslides_notes_bool {
\PassOptionsToPackage{notes=true}{notesslides}
+ \message{notesslides.cls:~Formatting~course~materials~in~notes~mode}
}{
\PassOptionsToPackage{notes=false}{notesslides}
+ \message{notesslides.cls:~Formatting~course~materials~in~slides~mode}
}
\bool_if:NTF \c__notesslides_notes_bool {
- \LoadClass{document-structure}
+ \str_if_empty:NT \c__notesslides_class_str {
+ \str_set:Nn \c__notesslides_class_str {article}
+ }
+ \exp_after:wN\LoadClass\exp_after:wN[\c__notesslides_docopt_str]
+ {\c__notesslides_class_str}
}{
\LoadClass[10pt,notheorems,xcolor={dvipsnames,svgnames}]{beamer}
\newcounter{Item}
\newcounter{paragraph}
\newcounter{subparagraph}
\newcounter{Hfootnote}
- \RequirePackage{document-structure}
}
+\RequirePackage{document-structure}
\RequirePackage{notesslides}
\endinput
%%
diff --git a/Master/texmf-dist/tex/latex/stex/notesslides.sty b/Master/texmf-dist/tex/latex/stex/notesslides.sty
index b315199f709..2d8ba8faa28 100644
--- a/Master/texmf-dist/tex/latex/stex/notesslides.sty
+++ b/Master/texmf-dist/tex/latex/stex/notesslides.sty
@@ -6,7 +6,7 @@
%%
%% notesslides.dtx (with options: `package')
%%
-\ProvidesExplPackage{notesslides}{2022/02/26}{3.0.1}{notesslides Package}
+\ProvidesExplPackage{notesslides}{2022/05/24}{3.1.0}{notesslides Package}
\RequirePackage{l3keys2e}
\keys_define:nn{notesslides / pkg}{
@@ -24,6 +24,12 @@
}
}
\ProcessKeysOptions{ notesslides / pkg }
+
+\RequirePackage{stex}
+\stex_html_backend:T {
+ \bool_set_true:N\c__notesslides_notes_bool
+}
+
\newif\ifnotes
\bool_if:NTF \c__notesslides_notes_bool {
\notestrue
@@ -36,6 +42,7 @@
}{
\str_set_eq:NN \__notesslidestopsect \c__notesslides_topsect_str
}
+\PassOptionsToPackage{topsect=\__notesslidestopsect}{document-structure}
\bool_if:NT \c__notesslides_notes_bool {
\RequirePackage{a4wide}
\RequirePackage{marginnote}
@@ -56,6 +63,15 @@
\bool_if:NT \c__notesslides_notes_bool {
\renewcommand\usetheme[2][]{\usepackage[#1]{beamernotestheme#2}}
}
+
+\NewDocumentCommand \libusetheme {O{} m} {
+ \bool_if:NTF \c__notesslides_notes_bool {
+ \libusepackage[#1]{beamernotestheme#2}
+ }{
+ \libusepackage[#1]{beamertheme#2}
+ }
+}
+
\newcounter{slide}
\newlength{\slidewidth}\setlength{\slidewidth}{13.5cm}
\newlength{\slideheight}\setlength{\slideheight}{9cm}
@@ -94,6 +110,7 @@
t .code:n = {
\__notesslides_do_yes_param:Nn \l__notesslides_frame_t_bool { #1 }
},
+ unknown .code:n = {}
}
\cs_new_protected:Nn \__notesslides_frame_args:n {
\str_clear:N \l__notesslides_frame_label_str
@@ -117,7 +134,7 @@
\def\itemize@outer{outer}
\def\itemize@inner{inner}
\renewcommand\newpage{\addtocounter{framenumber}{1}}
- \newcommand\metakeys@show@keys[2]{\marginnote{{\scriptsize ##2}}}
+ %\newcommand\metakeys@show@keys[2]{\marginnote{{\scriptsize ##2}}}
\renewenvironment{itemize}{
\ifx\itemize@level\itemize@outer
\def\itemize@label{$\rhd$}
@@ -135,11 +152,21 @@
}{
\end{list}
}
- \begin{mdframed}[linewidth=\slideframewidth,skipabove=1ex,skipbelow=1ex,userdefinedwidth=\slidewidth,align=center]\sf
+ \stex_html_backend:TF {
+ \begin{stex_annotate_env}{frame}{}\vbox\bgroup
+ \mdf@patchamsthm
+ }{
+ \begin{mdframed}[linewidth=\slideframewidth,skipabove=1ex,skipbelow=1ex,userdefinedwidth=\slidewidth,align=center]\sf
+ }
}{
- \medskip\miko@slidelabel\end{mdframed}
+ \stex_html_backend:TF {
+ \miko@slidelabel\egroup\end{stex_annotate_env}
+ }{\medskip\miko@slidelabel\end{mdframed}}
+ }
+ \renewcommand{\frametitle}[1]{
+ \stex_document_title:n { #1 }
+ {\Large\bf\sf\color{blue}{#1}}\medskip
}
- \renewcommand{\frametitle}[1]{{\Large\bf\sf\color{blue}{#1}}\medskip}
}
\bool_if:NT \c__notesslides_notes_bool {
\newcommand\pause{}
@@ -185,15 +212,29 @@
}
\newlength{\slidelogoheight}
+\RequirePackage{graphicx}
+
+\define@key{Gin}{mhrepos}{\def\Gin@mhrepos{#1}}
+\providecommand\mhgraphics[2][]{
+ \def\Gin@mhrepos{}\setkeys{Gin}{#1}
+ \includegraphics[#1]{\mhpath\Gin@mhrepos{#2}}
+}
+
\bool_if:NTF \c__notesslides_notes_bool {
\setlength{\slidelogoheight}{.4cm}
}{
- \setlength{\slidelogoheight}{1cm}
-}
-\newsavebox{\slidelogo}
-\sbox{\slidelogo}{\sTeX}
-\newrobustcmd{\setslidelogo}[1]{
- \sbox{\slidelogo}{\includegraphics[height=\slidelogoheight]{#1}}
+ \setlength{\slidelogoheight}{.25cm}
+}
+\ifcsname slidelogo\endcsname\else
+ \newsavebox{\slidelogo}
+ \sbox{\slidelogo}{\sTeX}
+\fi
+\newrobustcmd{\setslidelogo}[2][]{
+ \tl_if_empty:nTF{#1}{
+ \sbox{\slidelogo}{\includegraphics[height=\slidelogoheight]{#2}}
+ }{
+ \sbox{\slidelogo}{\mhgraphics[height=\slidelogoheight,mhrepos=#1]{#2}}
+ }
}
\def\source{Michael Kohlhase}% customize locally
\newrobustcmd{\setsource}[1]{\def\source{#1}}
@@ -307,12 +348,14 @@
\newrobustcmd\putat[2]{
\begin{picture}(0,0)\put(#1){#2}\end{picture}
}
-\bool_if:NT \c__notesslides_sectocframes_bool {
- \str_if_eq:VnTF \__notesslidestopsect{part}{
- \newcounter{chapter}\counterwithin*{section}{chapter}
- }{
- \str_if_eq:VnT\__notesslidestopsect{chapter}{
+\stex_html_backend:F {
+ \bool_if:NT \c__notesslides_sectocframes_bool {
+ \str_if_eq:VnTF \__notesslidestopsect{part}{
\newcounter{chapter}\counterwithin*{section}{chapter}
+ }{
+ \str_if_eq:VnT\__notesslidestopsect{chapter}{
+ \newcounter{chapter}\counterwithin*{section}{chapter}
+ }
}
}
}
@@ -337,7 +380,7 @@
\bool_if:NF \c__notesslides_notes_bool { % only in slides
\renewenvironment{sfragment}[2][]{
- \__document_structure_omgroup_args:n { #1 }
+ \__document_structure_sfragment_args:n { #1 }
\int_incr:N \l_document_structure_section_level_int
\bool_if:NT \c__notesslides_sectocframes_bool {
\stepcounter{slide}
@@ -346,11 +389,11 @@
\red{
\ifcase\l_document_structure_section_level_int\or
\stepcounter{part}
- \def\__notesslideslabel{\omdoc@part@kw~\Roman{part}}
+ \def\__notesslideslabel{{\omdoc@part@kw}~\Roman{part}}
\def\currentsectionlevel{\omdoc@part@kw}
\or
\stepcounter{chapter}
- \def\__notesslideslabel{\omdoc@chapter@kw~\arabic{chapter}}
+ \def\__notesslideslabel{{\omdoc@chapter@kw}~\arabic{chapter}}
\def\currentsectionlevel{\omdoc@chapter@kw}
\or
\stepcounter{section}
@@ -378,8 +421,8 @@
\vfill%
\end{frame}%
}
- \str_if_empty:NF \l__document_structure_omgroup_id_str {
- \stex_ref_new_doc_target:n\l__document_structure_omgroup_id_str
+ \str_if_empty:NF \l__document_structure_sfragment_id_str {
+ \stex_ref_new_doc_target:n\l__document_structure_sfragment_id_str
}
}{}
}
diff --git a/Master/texmf-dist/tex/latex/stex/problem.sty b/Master/texmf-dist/tex/latex/stex/problem.sty
index 2e927431576..091eb3c5b36 100644
--- a/Master/texmf-dist/tex/latex/stex/problem.sty
+++ b/Master/texmf-dist/tex/latex/stex/problem.sty
@@ -6,7 +6,7 @@
%%
%% problem.dtx (with options: `package')
%%
-\ProvidesExplPackage{problem}{2022/02/26}{3.0.1}{Semantic Markup for Problems}
+\ProvidesExplPackage{problem}{2022/05/24}{3.1.0}{Semantic Markup for Problems}
\RequirePackage{l3keys2e,stex}
\keys_define:nn { problem / pkg }{
@@ -68,23 +68,27 @@
min .tl_set:N = \l__problems_prob_min_tl,
title .tl_set:N = \l__problems_prob_title_tl,
type .tl_set:N = \l__problems_prob_type_tl,
+ imports .tl_set:N = \l__problems_prob_imports_tl,
+ name .str_set_x:N = \l__problems_prob_name_str,
refnum .int_set:N = \l__problems_prob_refnum_int
}
\cs_new_protected:Nn \__problems_prob_args:n {
\str_clear:N \l__problems_prob_id_str
+ \str_clear:N \l__problems_prob_name_str
\tl_clear:N \l__problems_prob_pts_tl
\tl_clear:N \l__problems_prob_min_tl
\tl_clear:N \l__problems_prob_title_tl
\tl_clear:N \l__problems_prob_type_tl
+ \tl_clear:N \l__problems_prob_imports_tl
\int_zero_new:N \l__problems_prob_refnum_int
\keys_set:nn { problem / problem }{ #1 }
\int_compare:nNnT \l__problems_prob_refnum_int = 0 {
\let\l__problems_prob_refnum_int\undefined
}
}
-\newcounter{problem}
+\newcounter{problem}[section]
\newcommand\numberproblemsin[1]{\@addtoreset{problem}{#1}}
-\newcommand\prob@label[1]{#1}
+\newcommand\prob@label[1]{\thesection.#1}
\newcommand\prob@number{
\int_if_exist:NTF \l__problems_inclprob_refnum_int {
\prob@label{\int_use:N \l__problems_inclprob_refnum_int }
@@ -116,6 +120,43 @@
\@in@omtexttrue% we are in a statement (for inline definitions)
\stepcounter{problem}\record@problem
\def\current@section@level{\prob@problem@kw}
+
+ \str_if_empty:NT \l__problems_prob_name_str {
+ \seq_get_right:NN \g_stex_currentfile_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpa_seq . \l_tmpa_str
+ \seq_get_left:NN \l_tmpa_seq \l__problems_prob_name_str
+ }
+
+ \stex_if_do_html:T{
+ \tl_if_empty:NF \l__problems_prob_title_tl {
+ \exp_args:No \stex_document_title:n \l__problems_prob_title_tl
+ }
+ }
+
+ \exp_args:Nno\stex_module_setup:nn{type=problem}\l__problems_prob_name_str
+
+ \stex_reactivate_macro:N \STEXexport
+ \stex_reactivate_macro:N \importmodule
+ \stex_reactivate_macro:N \symdecl
+ \stex_reactivate_macro:N \notation
+ \stex_reactivate_macro:N \symdef
+
+ \stex_if_do_html:T{
+ \begin{stex_annotate_env} {problem} {
+ \l_stex_module_ns_str ? \l_stex_module_name_str
+ }
+
+ \stex_annotate_invisible:nnn{header}{} {
+ \stex_annotate:nnn{language}{ \l_stex_module_lang_str }{}
+ \stex_annotate:nnn{signature}{ \l_stex_module_sig_str }{}
+ \str_if_eq:VnF \l_stex_module_meta_str {NONE} {
+ \stex_annotate:nnn{metatheory}{ \l_stex_module_meta_str }{}
+ }
+ }
+ }
+
+ \stex_csl_to_imports:No \importmodule \l__problems_prob_imports_tl
+
\tl_if_exist:NTF \l__problems_inclprob_type_tl {
\tl_set_eq:NN \sproblemtype \l__problems_inclprob_type_tl
}{
@@ -127,36 +168,47 @@
\str_set_eq:NN \sproblemid \l__problems_prob_id_str
}
- \clist_set:No \l_tmpa_clist \sproblemtype
- \tl_clear:N \l_tmpa_tl
- \clist_map_inline:Nn \l_tmpa_clist {
- \tl_if_exist:cT {__problems_sproblem_##1_start:}{
- \tl_set:Nn \l_tmpa_tl {\use:c{__problems_sproblem_##1_start:}}
+ \stex_if_smsmode:F {
+ \clist_set:No \l_tmpa_clist \sproblemtype
+ \tl_clear:N \l_tmpa_tl
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \tl_if_exist:cT {__problems_sproblem_##1_start:}{
+ \tl_set:Nn \l_tmpa_tl {\use:c{__problems_sproblem_##1_start:}}
+ }
+ }
+ \tl_if_empty:NTF \l_tmpa_tl {
+ \__problems_sproblem_start:
+ }{
+ \l_tmpa_tl
}
- }
- \tl_if_empty:NTF \l_tmpa_tl {
- \__problems_sproblem_start:
- }{
- \l_tmpa_tl
}
\stex_ref_new_doc_target:n \sproblemid
+ \stex_smsmode_do:
}{
- \clist_set:No \l_tmpa_clist \sproblemtype
- \tl_clear:N \l_tmpa_tl
- \clist_map_inline:Nn \l_tmpa_clist {
- \tl_if_exist:cT {__problems_sproblem_##1_end:}{
- \tl_set:Nn \l_tmpa_tl {\use:c{__problems_sproblem_##1_end:}}
+ \__stex_modules_end_module:
+ \stex_if_smsmode:F{
+ \clist_set:No \l_tmpa_clist \sproblemtype
+ \tl_clear:N \l_tmpa_tl
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \tl_if_exist:cT {__problems_sproblem_##1_end:}{
+ \tl_set:Nn \l_tmpa_tl {\use:c{__problems_sproblem_##1_end:}}
+ }
+ }
+ \tl_if_empty:NTF \l_tmpa_tl {
+ \__problems_sproblem_end:
+ }{
+ \l_tmpa_tl
}
}
- \tl_if_empty:NTF \l_tmpa_tl {
- \__problems_sproblem_end:
- }{
- \l_tmpa_tl
+ \stex_if_do_html:T{
+ \end{stex_annotate_env}
}
\smallskip
}
+\seq_put_right:Nx\g_stex_smsmode_allowedenvs_seq{\tl_to_str:n{sproblem}}
+
\cs_new_protected:Nn \__problems_sproblem_start: {
\par\noindent\textbf\prob@heading\show@pts\show@min\\\ignorespacesandpars
}
@@ -224,18 +276,35 @@
\def\current@section@level{\prob@solution@kw}
\ignorespacesandpars
}
-\newcommand\startsolutions{
- \specialcomment{solution}{\@startsolution}{
- \bool_if:NF \c__problems_boxed_bool {
- \hrule\medskip
+\box_new:N \l__problems_solution_box
+\newenvironment{solution}[1][]{
+ \stex_html_backend:TF{
+ \stex_if_do_html:T{
+ \begin{stex_annotate_env}{solution}{}
}
- \end{small}%
+ }{
+ \setbox\l__problems_solution_box\vbox\bgroup
+ \par\smallskip\hrule\smallskip
+ \noindent\textbf{Solution:}~
}
- \bool_if:NT \c__problems_boxed_bool {
- \surroundwithmdframed{solution}
+}{
+ \stex_html_backend:TF{
+ \stex_if_do_html:T{
+ \end{stex_annotate_env}
+ }
+ }{
+ \smallskip\hrule
+ \egroup
+ \bool_if:NT \c__problems_solutions_bool {
+ \box\l__problems_solution_box
+ }
}
}
-\newcommand\stopsolutions{\excludecomment{solution}}
+
+\newcommand\startsolutions{
+ \bool_set_true:N \c__problems_solutions_bool
+}
+\newcommand\stopsolutions{\bool_set_false:N \c__problems_solutions_bool}%\excludecomment{solution}}
\ifsolutions
\startsolutions
\else
@@ -244,7 +313,7 @@
\bool_if:NTF \c__problems_notes_bool {
\newenvironment{exnote}[1][]{
\par\smallskip\hrule\smallskip
- \noindent\textbf{\prob@note@kw : }\small
+ \noindent\textbf{\prob@note@kw :~ }\small
}{
\smallskip\hrule
}
@@ -271,7 +340,7 @@
\bool_if:NTF \c__problems_notes_bool {
\newenvironment{gnote}[1][]{
\par\smallskip\hrule\smallskip
- \noindent\textbf{\prob@gnote@kw : }\small
+ \noindent\textbf{\prob@gnote@kw :~ }\small
}{
\smallskip\hrule
}
@@ -293,43 +362,38 @@
\keys_define:nn { problem / mcc }{
id .str_set_x:N = \l__problems_mcc_id_str ,
feedback .tl_set:N = \l__problems_mcc_feedback_tl ,
- T .default:n = { true } ,
+ T .default:n = { false } ,
T .bool_set:N = \l__problems_mcc_t_bool ,
- F .default:n = { true } ,
+ F .default:n = { false } ,
F .bool_set:N = \l__problems_mcc_f_bool ,
- Ttext .code:n = {
- \__problems_do_yes_param:Nn \l__problems_mcc_Ttext_bool { #1 }
- } ,
- Ftext .code:n = {
- \__problems_do_yes_param:Nn \l__problems_mcc_Ftext_bool { #1 }
- }
+ Ttext .tl_set:N = \l__problems_mcc_Ttext_str ,
+ Ftext .tl_set:N = \l__problems_mcc_Ftext_str
}
\cs_new_protected:Nn \l__problems_mcc_args:n {
\str_clear:N \l__problems_mcc_id_str
\tl_clear:N \l__problems_mcc_feedback_tl
- \bool_set_true:N \l__problems_mcc_t_bool
- \bool_set_true:N \l__problems_mcc_f_bool
- \bool_set_true:N \l__problems_mcc_Ttext_bool
- \bool_set_false:N \l__problems_mcc_Ftext_bool
+ \bool_set_false:N \l__problems_mcc_t_bool
+ \bool_set_false:N \l__problems_mcc_f_bool
+ \tl_clear:N \l__problems_mcc_Ttext_tl
+ \tl_clear:N \l__problems_mcc_Ftext_tl
+ \str_clear:N \l__problems_mcc_id_str
\keys_set:nn { problem / mcc }{ #1 }
}
+\def\mccTrueText{\textbf{(true)~}}
+\def\mccFalseText{\textbf{(false)~}}
\newcommand\mcc[2][]{
\l__problems_mcc_args:n{ #1 }
- \item #2
+ \item[$\Box$] #2
\ifsolutions
\\
\bool_if:NT \l__problems_mcc_t_bool {
- % TODO!
- % \ifcsstring{mcc@T}{T}{}{\mcc@Ttext}%
+ \tl_if_empty:NTF\l__problems_mcc_Ttext_tl\mccTrueText\l__problems_mcc_Ttext_tl
}
\bool_if:NT \l__problems_mcc_f_bool {
- % TODO!
- % \ifcsstring{mcc@F}{F}{}{\mcc@Ftext}%
+ \tl_if_empty:NTF\l__problems_mcc_Ttext_tl\mccFalseText\l__problems_mcc_Ftext_tl
}
- \tl_if_empty:NTF \l__problems_mcc_feedback_tl {
- !
- }{
- \l__problems_mcc_feedback_tl
+ \tl_if_empty:NF \l__problems_mcc_feedback_tl {
+ \emph{(\l__problems_mcc_feedback_tl)}
}
\fi
} %solutions
@@ -382,11 +446,24 @@
\newcommand\includeproblem[2][]{
\__problems_inclprob_args:n{ #1 }
- \str_if_empty:NTF \l__problems_inclprob_mhrepos_str {
- \input{#2}
- }{
- \stex_in_repository:nn{\l__problems_inclprob_mhrepos_str}{
- \input{\mhpath{\l__problems_inclprob_mhrepos_str}{#2}}
+ \exp_args:No \stex_in_repository:nn\l__problems_inclprob_mhrepos_str{
+ \stex_html_backend:TF {
+ \str_clear:N \l_tmpa_str
+ \prop_get:NnNF \l_stex_current_repository_prop { narr } \l_tmpa_str {
+ \prop_get:NnNF \l_stex_current_repository_prop { ns } \l_tmpa_str {}
+ }
+ \stex_annotate_invisible:nnn{includeproblem}{
+ \l_tmpa_str / #2
+ }{}
+ }{
+ \begingroup
+ \inputreftrue
+ \tl_if_empty:nTF{ ##1 }{
+ \input{#2}
+ }{
+ \input{ \c_stex_mathhub_str / ##1 / source / #2 }
+ }
+ \endgroup
}
}
\__problems_inclprob_clear:
@@ -419,6 +496,9 @@
}{
\tl_if_exist:NT \l__problems_prob_pts_tl {
\bool_if:NT \c__problems_pts_bool {
+ \tl_if_empty:NT\l__problems_prob_pts_tl{
+ \tl_set:Nn \l__problems_prob_pts_tl {0}
+ }
\marginpar{\l__problems_prob_pts_tl\ \prob@pt@kw\smallskip}
\addtocounter{pts}{\l__problems_prob_pts_tl}
}
@@ -435,6 +515,9 @@
}{
\tl_if_exist:NT \l__problems_prob_min_tl {
\bool_if:NT \c__problems_min_bool {
+ \tl_if_empty:NT\l__problems_prob_min_tl{
+ \tl_set:Nn \l__problems_prob_min_tl {0}
+ }
\marginpar{\l__problems_prob_min_tl\ min}
\addtocounter{min}{\l__problems_prob_min_tl}
}
diff --git a/Master/texmf-dist/tex/latex/stex/stex-tikzinput.sty b/Master/texmf-dist/tex/latex/stex/stex-tikzinput.sty
index e77eb73625e..e148e1ed05f 100644
--- a/Master/texmf-dist/tex/latex/stex/stex-tikzinput.sty
+++ b/Master/texmf-dist/tex/latex/stex/stex-tikzinput.sty
@@ -6,7 +6,7 @@
%%
%% tikzinput.dtx (with options: `stex')
%%
-\ProvidesExplPackage{stex-tikzinput}{2022/02/26}{3.0.1}{stex-tikzinput}
+\ProvidesExplPackage{stex-tikzinput}{2022/05/24}{3.1.0}{stex-tikzinput}
\RequirePackage{stex}
\RequirePackage{tikzinput}
@@ -18,6 +18,60 @@
}
\newcommand\cmhtikzinput[2][]{\begin{center}\mhtikzinput[#1]{#2}\end{center}}
+\cs_new_protected:Nn \__tikzinput_usetikzlibrary:nn {
+ \pgfkeys@spdef\pgf@temp{#1}
+ \expandafter\ifx\csname tikz@library@\pgf@temp @loaded\endcsname\relax%
+ \expandafter\global\expandafter\let\csname tikz@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
+ \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@}
+ \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|}
+ \expandafter\edef\csname tikz@library@#1@dollarcode\endcsname{\the\catcode`\$}
+ \catcode`\@=11
+ \catcode`\|=12
+ \catcode`\$=3
+ \pgfutil@InputIfFileExists{#2}{}{}
+ \catcode`\@=\csname tikz@library@#1@atcode\endcsname
+ \catcode`\|=\csname tikz@library@#1@barcode\endcsname
+ \catcode`\$=\csname tikz@library@#1@dollarcode\endcsname
+}
+
+\newcommand\libusetikzlibrary[1]{
+ \prop_if_exist:NF \l_stex_current_repository_prop {
+ \msg_error:nnn{stex}{error/notinarchive}\libusetikzlibrary
+ }
+ \prop_get:NnNF \l_stex_current_repository_prop {id} \l_tmpa_str {
+ \msg_error:nnn{stex}{error/notinarchive}\libusetikzlibrary
+ }
+ \seq_clear:N \l__tikzinput_libinput_files_seq
+ \seq_set_eq:NN \l_tmpa_seq \c_stex_mathhub_seq
+ \seq_set_split:NnV \l_tmpb_seq / \l_tmpa_str
+
+ \bool_while_do:nn { ! \seq_if_empty_p:N \l_tmpb_seq }{
+ \str_set:Nx \l_tmpa_str {\stex_path_to_string:N \l_tmpa_seq / meta-inf / lib / tikzlibrary #1 .code.tex}
+ \IfFileExists{ \l_tmpa_str }{
+ \seq_put_right:No \l__tikzinput_libinput_files_seq \l_tmpa_str
+ }{}
+ \seq_pop_left:NN \l_tmpb_seq \l_tmpa_str
+ \seq_put_right:No \l_tmpa_seq \l_tmpa_str
+ }
+
+ \str_set:Nx \l_tmpa_str {\stex_path_to_string:N \l_tmpa_seq / lib / tikzlibrary #1 .code.tex}
+ \IfFileExists{ \l_tmpa_str }{
+ \seq_put_right:No \l__tikzinput_libinput_files_seq \l_tmpa_str
+ }{}
+
+ \seq_if_empty:NTF \l__tikzinput_libinput_files_seq {
+ \msg_error:nnxx{stex}{error/nofile}{\exp_not:N\libusetikzlibrary}{tikzlibrary #1 .code.tex}
+ }{
+ \int_compare:nNnTF {\seq_count:N \l__tikzinput_libinput_files_seq} = 1 {
+ \seq_map_inline:Nn \l__tikzinput_libinput_files_seq {
+ \__tikzinput_usetikzlibrary:nn{#1}{ ##1 }
+ }
+ }{
+ \msg_error:nnxx{stex}{error/twofiles}{\exp_not:N\libusetikzlibrary}{tikzlibrary #1 .code.tex}
+ }
+ }
+}
+
\endinput
%%
%% End of file `stex-tikzinput.sty'.
diff --git a/Master/texmf-dist/tex/latex/stex/stex.cls b/Master/texmf-dist/tex/latex/stex/stex.cls
index c698e99a024..5d8d364e07f 100644
--- a/Master/texmf-dist/tex/latex/stex/stex.cls
+++ b/Master/texmf-dist/tex/latex/stex/stex.cls
@@ -10,14 +10,42 @@
%%%%%%%%%%%%% basics.dtx %%%%%%%%%%%%%
\RequirePackage{expl3,l3keys2e}
-\ProvidesExplClass{stex}{2022/02/26}{3.0.1}{sTeX document class}
-\LoadClass[border=1px,varwidth]{standalone}
-\setlength\textwidth{15cm}
+\ProvidesExplClass{stex}{2022/05/24}{3.1.0}{sTeX document class}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{stex}}
\ProcessOptions
+\bool_set_true:N \c_stex_document_class_bool
+
\RequirePackage{stex}
+
+\stex_html_backend:TF {
+ \LoadClass{article}
+}{
+ \LoadClass[border=1px,varwidth,crop=false]{standalone}
+ \setlength\textwidth{15cm}
+}
+\RequirePackage{standalone}
+
+\clist_if_empty:NT \c_stex_languages_clist {
+ \seq_get_right:NN \g_stex_currentfile_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpa_seq . \l_tmpa_str
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str % .tex
+ \exp_args:No \str_if_eq:nnF \l_tmpa_str {tex} {
+ \exp_args:No \str_if_eq:nnF \l_tmpa_str {dtx} {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq \l_tmpa_str
+ }
+ }
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_str % <filename>
+ \seq_if_empty:NF \l_tmpa_seq { %remaining element should be [<something>.]language
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \prop_if_in:NoT \c_stex_languages_prop \l_tmpa_str {
+ \stex_debug:nn{language} {Language~\l_tmpa_str~
+ inferred~from~file~name}
+ \exp_args:NNo \stex_set_language:Nn \l_tmpa_str \l_tmpa_str
+ }
+ }
+}
\endinput
%%
%% End of file `stex.cls'.
diff --git a/Master/texmf-dist/tex/latex/stex/stex.sty b/Master/texmf-dist/tex/latex/stex/stex.sty
index 2c28b1ee36e..c4af84bc87b 100644
--- a/Master/texmf-dist/tex/latex/stex/stex.sty
+++ b/Master/texmf-dist/tex/latex/stex/stex.sty
@@ -14,32 +14,34 @@
%% stex-features.dtx (with options: `package')
%% stex-statements.dtx (with options: `package')
%% stex-proofs.dtx (with options: `package')
-%% stex-others.dtx (with options: `package')
%% stex-metatheory.dtx (with options: `package')
+%% stex-others.dtx (with options: `package')
%%
%%%%%%%%%%%%% basics.dtx %%%%%%%%%%%%%
\RequirePackage{expl3,l3keys2e,ltxcmds}
-\ProvidesExplPackage{stex}{2022/02/26}{3.0.1}{sTeX package}
+\ProvidesExplPackage{stex}{2022/05/24}{3.1.0}{sTeX package}
+
+\bool_if_exist:NF \c_stex_document_class_bool {
+ \bool_set_false:N \c_stex_document_class_bool
+ \RequirePackage{standalone}
+}
+
+\message{^^J*~This~is~sTeX~version~3.1.0~*^^J}
\keys_define:nn { stex } {
debug .clist_set:N = \c_stex_debug_clist ,
lang .clist_set:N = \c_stex_languages_clist ,
mathhub .tl_set_x:N = \mathhub ,
- sms .bool_set:N = \c_stex_persist_mode_bool ,
+ usesms .bool_set:N = \c_stex_persist_mode_bool ,
+ writesms .bool_set:N = \c_stex_persist_write_mode_bool ,
image .bool_set:N = \c_tikzinput_image_bool,
unknown .code:n = {}
}
\ProcessKeysOptions { stex }
-\protected\def\stex{%
- \@ifundefined{texorpdfstring}%
- {\let\texorpdfstring\@firstoftwo}%
- {}%
- \texorpdfstring{\raisebox{-.5ex}S\kern-.5ex\TeX}{sTeX}\xspace%
-}
-\def\sTeX{\stex}
+\RequirePackage{stex-logo} % externalized for backwards-compatibility reasons
\msg_new:nnn{stex}{error/unknownlanguage}{
Unknown~language:~#1
}
@@ -52,13 +54,13 @@
}
\cs_new_protected:Nn \stex_debug:nn {
\clist_if_in:NnTF \c_stex_debug_clist { all } {
- \exp_args:Nnnx\msg_set:nnn{stex}{debug / #1}{
+ \msg_set:nnn{stex}{debug / #1}{
\\Debug~#1:~#2\\
}
\msg_none:nn{stex}{debug / #1}
}{
\clist_if_in:NnT \c_stex_debug_clist { #1 } {
- \exp_args:Nnnx\msg_set:nnn{stex}{debug / #1}{
+ \msg_set:nnn{stex}{debug / #1}{
\\Debug~#1:~#2\\
}
\msg_none:nn{stex}{debug / #1}
@@ -74,28 +76,11 @@
}
\stex_debug:nn{log}{debug~mode~on}
-\RequirePackage{rustex}
-\rustex_add_Namespace:nn{stex}{http://kwarc.info/ns/sTeX}
-\ifcsname if@latexml\endcsname\else
- \expandafter\newif\csname if@latexml\endcsname\@latexmlfalse
-\fi
-\prg_new_conditional:Nnn \latexml_if: {p, T, F, TF} {
- \if@latexml
- \prg_return_true:
- \else:
- \prg_return_false:
- \fi:
-}
-\tl_new:N \l__stex_annotate_arg_tl
-\tl_const:Nx \c__stex_annotate_emptyarg_tl {
- \rustex_if:TF {
- \rustex_direct_HTML:n { \c_ampersand_str lrm; }
- }{~}
-}
-\cs_new_protected:Nn \__stex_annotate_checkempty:n {
- \tl_set:Nn \l__stex_annotate_arg_tl { #1 }
- \tl_if_empty:NT \l__stex_annotate_arg_tl {
- \tl_set_eq:NN \l__stex_annotate_arg_tl \c__stex_annotate_emptyarg_tl
+\tl_new:N \l_stex_html_arg_tl
+\cs_new_protected:Nn \_stex_html_checkempty:n {
+ \tl_set:Nn \l_stex_html_arg_tl { #1 }
+ \tl_if_empty:NT \l_stex_html_arg_tl {
+ \tl_set_eq:NN \l_stex_html_arg_tl \c_stex_html_emptyarg_tl
}
}
\bool_new:N \_stex_html_do_output_bool
@@ -115,102 +100,23 @@
}
}
}
-\rustex_if:TF{
- \cs_new_protected:Nn \stex_annotate:nnn {
- \__stex_annotate_checkempty:n { #3 }
- \rustex_annotate_HTML:nn {
- property="stex:#1" ~
- resource="#2"
- } {
- \mode_if_vertical:TF{
- \tl_use:N \l__stex_annotate_arg_tl\par
- }{
- \tl_use:N \l__stex_annotate_arg_tl
- }
- }
- }
- \cs_new_protected:Nn \stex_annotate_invisible:n {
- \__stex_annotate_checkempty:n { #1 }
- \rustex_annotate_HTML:nn {
- stex:visible="false" ~
- style:display="none"
- } {
- \mode_if_vertical:TF{
- \tl_use:N \l__stex_annotate_arg_tl\par
- }{
- \tl_use:N \l__stex_annotate_arg_tl
- }
- }
- }
- \cs_new_protected:Nn \stex_annotate_invisible:nnn {
- \__stex_annotate_checkempty:n { #3 }
- \rustex_annotate_HTML:nn {
- property="stex:#1" ~
- resource="#2" ~
- stex:visible="false" ~
- style:display="none"
- } {
- \mode_if_vertical:TF{
- \tl_use:N \l__stex_annotate_arg_tl\par
- }{
- \tl_use:N \l__stex_annotate_arg_tl
- }
- }
- }
- \NewDocumentEnvironment{stex_annotate_env} { m m } {
- \par
- \rustex_annotate_HTML_begin:n {
- property="stex:#1" ~
- resource="#2"
- }
- }{
- \par\rustex_annotate_HTML_end:
- }
-}{
- \latexml_if:TF {
- \cs_new_protected:Nn \stex_annotate:nnn {
- \__stex_annotate_checkempty:n { #3 }
- \mode_if_math:TF {
- \cs:w latexml@annotate@math\cs_end:{#1}{#2}{
- \tl_use:N \l__stex_annotate_arg_tl
- }
- }{
- \cs:w latexml@annotate@text\cs_end:{#1}{#2}{
- \tl_use:N \l__stex_annotate_arg_tl
- }
- }
- }
- \cs_new_protected:Nn \stex_annotate_invisible:n {
- \__stex_annotate_checkempty:n { #1 }
- \mode_if_math:TF {
- \cs:w latexml@invisible@math\cs_end:{
- \tl_use:N \l__stex_annotate_arg_tl
- }
- } {
- \cs:w latexml@invisible@text\cs_end:{
- \tl_use:N \l__stex_annotate_arg_tl
- }
- }
- }
- \cs_new_protected:Nn \stex_annotate_invisible:nnn {
- \__stex_annotate_checkempty:n { #3 }
- \cs:w latexml@annotate@invisible\cs_end:{#1}{#2}{
- \tl_use:N \l__stex_annotate_arg_tl
- }
- }
- \NewDocumentEnvironment{stex_annotate_env} { m m } {
- \par\begin{latexml@annotateenv}{#1}{#2}
- }{
- \par\end{latexml@annotateenv}
- }
- }{
- \cs_new_protected:Nn \stex_annotate:nnn {#3}
- \cs_new_protected:Nn \stex_annotate_invisible:n {}
- \cs_new_protected:Nn \stex_annotate_invisible:nnn {}
- \NewDocumentEnvironment{stex_annotate_env} { m m } {}{}
- }
+\tl_if_exist:NF\stex@backend{
+ \ifcsname if@rustex\endcsname
+ \def\stex@backend{rustex}
+ \else
+ \ifcsname if@latexml\endcsname
+ \def\stex@backend{latexml}
+ \else
+ \def\stex@backend{pdflatex}
+ \fi
+ \fi
}
-\prop_const_from_keyval:Nn \c_stex_languages_prop {
+\input{stex-backend-\stex@backend.cfg}
+
+\newif\ifstexhtml
+\stex_html_backend:TF\stexhtmltrue\stexhtmlfalse
+
+\exp_args:NNx \prop_const_from_keyval:Nn \c_stex_languages_prop { \tl_to_str:n {
en = english ,
de = ngerman ,
ar = arabic ,
@@ -220,9 +126,9 @@
ro = romanian ,
tr = turkish ,
fr = french
-}
+}}
-\prop_const_from_keyval:Nn \c_stex_language_abbrevs_prop {
+\exp_args:NNx \prop_const_from_keyval:Nn \c_stex_language_abbrevs_prop { \tl_to_str:n {
english = en ,
ngerman = de ,
arabic = ar ,
@@ -232,23 +138,86 @@
romanian = ro ,
turkish = tr ,
french = fr
+}}
+\cs_new_protected:Nn \stex_set_language:Nn {
+ \str_set:Nx \l_tmpa_str {#2}
+ \prop_get:NoNT \c_stex_languages_prop \l_tmpa_str #1 {
+ \ifx\@onlypreamble\@notprerr
+ \ltx@ifpackageloaded{babel}{
+ \exp_args:No \selectlanguage #1
+ }{}
+ \else
+ \exp_args:No \str_if_eq:nnTF #1 {turkish} {
+ \RequirePackage[#1,shorthands=:!]{babel}
+ }{
+ \RequirePackage[#1]{babel}
+ }
+ \fi
+ }
}
+
\clist_if_empty:NF \c_stex_languages_clist {
+ \bool_set_false:N \l_tmpa_bool
\clist_clear:N \l_tmpa_clist
\clist_map_inline:Nn \c_stex_languages_clist {
- \prop_get:NnNTF \c_stex_languages_prop { #1 } \l_tmpa_str {
+ \str_set:Nx \l_tmpa_str {#1}
+ \str_if_eq:nnT {#1}{tr}{
+ \bool_set_true:N \l_tmpa_bool
+ }
+ \prop_get:NoNTF \c_stex_languages_prop \l_tmpa_str \l_tmpa_str {
\clist_put_right:No \l_tmpa_clist \l_tmpa_str
} {
\msg_error:nnx{stex}{error/unknownlanguage}{\l_tmpa_str}
}
}
\stex_debug:nn{lang} {Languages:~\clist_use:Nn \l_tmpa_clist {,~} }
- \RequirePackage[\clist_use:Nn \l_tmpa_clist,]{babel}
+ \bool_if:NTF \l_tmpa_bool {
+ \RequirePackage[\clist_use:Nn \l_tmpa_clist,,shorthands=:!]{babel}
+ }{
+ \RequirePackage[\clist_use:Nn \l_tmpa_clist,]{babel}
+ }
+}
+
+\AtBeginDocument{
+ \stex_html_backend:T {
+ \seq_get_right:NN \g_stex_currentfile_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpa_seq . \l_tmpa_str
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str % .tex
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_str % <filename>
+ \seq_if_empty:NF \l_tmpa_seq { %remaining element should be language
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \stex_debug:nn{basics} {Language~\l_tmpa_str~
+ inferred~from~file~name}
+ \stex_annotate_invisible:nnn{language}{ \l_tmpa_str }{}
+ }
+ }
+}
+\bool_if:NTF \c_stex_persist_mode_bool {
+ \def \stex_persist:n #1 {}
+ \def \stex_persist:x #1 {}
+}{
+ \bool_if:NTF \c_stex_persist_write_mode_bool {
+ \iow_new:N \c__stex_persist_iow
+ \iow_open:Nn \c__stex_persist_iow{\jobname.sms}
+ \AtEndDocument{
+ \iow_close:N \c__stex_persist_iow
+ }
+ \cs_new_protected:Nn \stex_persist:n {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \regex_replace_all:nnN { \cP\# } { \cO\# } \l_tmpa_tl
+ \regex_replace_all:nnN { \ } { \~ } \l_tmpa_tl
+ \exp_args:NNo \iow_now:Nn \c__stex_persist_iow \l_tmpa_tl
+ }
+ \cs_generate_variant:Nn \stex_persist:n {x}
+ }{
+ \def \stex_persist:n #1 {}
+ \def \stex_persist:x #1 {}
+ }
}
\cs_new_protected:Nn \stex_deactivate_macro:Nn {
\exp_after:wN\let\csname \detokenize{#1} - orig\endcsname#1
\def#1{
- \msg_error:nnnn{stex}{error/deactivated-macro}{#1}{#2}
+ \msg_error:nnnn{stex}{error/deactivated-macro}{\detokenize{#1}}{#2}
}
}
\cs_new_protected:Nn \stex_reactivate_macro:N {
@@ -263,6 +232,118 @@
}
}
+\cs_new_protected:Nn \stex_copy_control_sequence:NNN {
+ \tl_set:Nx \_tmp_args_tl {\cs_argument_spec:N #2}
+ \exp_args:NNo \tl_remove_all:Nn \_tmp_args_tl \c_hash_str
+ \int_set:Nn \l_tmpa_int {\tl_count:N \_tmp_args_tl}
+
+ \tl_clear:N \_tmp_args_tl
+ \int_step_inline:nn \l_tmpa_int {
+ \tl_put_right:Nx \_tmp_args_tl {{\exp_not:n{####}\exp_not:n{##1}}}
+ }
+
+ \tl_set:Nn #3 {\cs_generate_from_arg_count:NNnn #1 \cs_set:Npn}
+ \tl_put_right:Nx #3 { {\int_use:N \l_tmpa_int}{
+ \exp_after:wN\exp_after:wN\exp_after:wN \exp_not:n
+ \exp_after:wN\exp_after:wN\exp_after:wN {
+ \exp_after:wN #2 \_tmp_args_tl
+ }
+ }}
+}
+\cs_generate_variant:Nn \stex_copy_control_sequence:NNN {cNN}
+\cs_generate_variant:Nn \stex_copy_control_sequence:NNN {NcN}
+\cs_generate_variant:Nn \stex_copy_control_sequence:NNN {ccN}
+
+\cs_new_protected:Nn \stex_copy_control_sequence_ii:NNN {
+ \tl_set:Nx \_tmp_args_tl {\cs_argument_spec:N #2}
+ \exp_args:NNo \tl_remove_all:Nn \_tmp_args_tl \c_hash_str
+ \int_set:Nn \l_tmpa_int {\tl_count:N \_tmp_args_tl}
+
+ \tl_clear:N \_tmp_args_tl
+ \int_step_inline:nn \l_tmpa_int {
+ \tl_put_right:Nx \_tmp_args_tl {{\exp_not:n{########}\exp_not:n{##1}}}
+ }
+
+ \edef \_tmp_args_tl {
+ \exp_after:wN\exp_after:wN\exp_after:wN \exp_not:n
+ \exp_after:wN\exp_after:wN\exp_after:wN {
+ \exp_after:wN #2 \_tmp_args_tl
+ }
+ }
+
+ \exp_after:wN \def \exp_after:wN \_tmp_args_tl
+ \exp_after:wN ##\exp_after:wN 1 \exp_after:wN ##\exp_after:wN 2
+ \exp_after:wN { \_tmp_args_tl }
+
+ \edef \_tmp_args_tl {
+ \exp_after:wN \exp_not:n \exp_after:wN {
+ \_tmp_args_tl {####1}{####2}
+ }
+ }
+
+ \tl_set:Nn #3 {\cs_generate_from_arg_count:NNnn #1 \cs_set:Npn}
+ \tl_put_right:Nx #3 { {\int_use:N \l_tmpa_int}{
+ \exp_after:wN\exp_not:n\exp_after:wN{\_tmp_args_tl}
+ }}
+}
+
+\cs_generate_variant:Nn \stex_copy_control_sequence_ii:NNN {cNN}
+\cs_generate_variant:Nn \stex_copy_control_sequence_ii:NNN {NcN}
+\cs_generate_variant:Nn \stex_copy_control_sequence_ii:NNN {ccN}
+\NewDocumentCommand \MMTrule {m m}{
+ \seq_set_split:Nnn \l_tmpa_seq , {#2}
+ \int_zero:N \l_tmpa_int
+ \stex_annotate_invisible:nnn{mmtrule}{scala://#1}{
+ \seq_if_empty:NF \l_tmpa_seq {
+ $\seq_map_inline:Nn \l_tmpa_seq {
+ \int_incr:N \l_tmpa_int
+ \stex_annotate:nnn{arg}{i\int_use:N \l_tmpa_int}{##1}
+ }$
+ }
+ }
+}
+
+\NewDocumentCommand \MMTinclude {m}{
+ \stex_annotate_invisible:nnn{import}{#1}{}
+}
+
+\tl_new:N \g_stex_document_title
+\cs_new_protected:Npn \STEXtitle #1 {
+ \tl_if_empty:NT \g_stex_document_title {
+ \tl_gset:Nn \g_stex_document_title { #1 }
+ }
+}
+\cs_new_protected:Nn \stex_document_title:n {
+ \tl_if_empty:NT \g_stex_document_title {
+ \tl_gset:Nn \g_stex_document_title { #1 }
+ \stex_annotate_invisible:n{\noindent
+ \stex_annotate:nnn{doctitle}{}{ #1 }
+ \par}
+ }
+}
+\AtBeginDocument {
+ \let \STEXtitle \stex_document_title:n
+ \tl_if_empty:NF \g_stex_document_title {
+ \stex_annotate_invisible:n{\noindent
+ \stex_annotate:nnn{doctitle}{}{ \g_stex_document_title }
+ \par}
+ }
+ \let\_stex_maketitle:\maketitle
+ \def\maketitle{
+ \tl_if_empty:NF \@title {
+ \exp_args:No \stex_document_title:n \@title
+ }
+ \_stex_maketitle:
+ }
+}
+
+\cs_new_protected:Nn \stex_par: {
+ \mode_if_vertical:F{
+ \if@minipage\else\if@nobreak\else\par\fi\fi
+ }
+}
+
+
%%%%%%%%%%%%% mathhub.dtx %%%%%%%%%%%%%
\msg_new:nnn{stex}{error/norepository}{
@@ -361,8 +442,11 @@
}
}
\str_new:N\l_stex_kpsewhich_return_str
-\cs_new_protected:Nn \stex_kpsewhich:n {
+\cs_new_protected:Nn \stex_kpsewhich:n {\begingroup
+ \catcode`\ =12
\sys_get_shell:nnN { kpsewhich ~ #1 } { } \l_tmpa_tl
+ \tl_gset_eq:NN \l_tmpa_tl \l_tmpa_tl
+ \endgroup
\exp_args:NNo\str_set:Nn\l_stex_kpsewhich_return_str{\l_tmpa_tl}
\tl_trim_spaces:N \l_stex_kpsewhich_return_str
}
@@ -421,6 +505,26 @@
}
\str_set_eq:NN\c_stex_mathhub_str\l_stex_kpsewhich_return_str
+ \str_if_empty:NT \c_stex_mathhub_str {
+ \sys_if_platform_windows:TF{
+ \begingroup\escapechar=-1\catcode`\\=12
+ \exp_args:Nx\stex_kpsewhich:n{-var-value~HOME}
+ \exp_args:NNx\str_replace_all:Nnn\l_stex_kpsewhich_return_str{\c_backslash_str}/
+ \exp_args:Nnx\use:nn{\endgroup}{\str_set:Nn\exp_not:N\l_stex_kpsewhich_return_str{\l_stex_kpsewhich_return_str}}
+ }{
+ \stex_kpsewhich:n{-var-value~HOME}
+ }
+ \ior_open:NnT \l_tmpa_ior{\l_stex_kpsewhich_return_str / .stex / mathhub.path}{
+ \begingroup\escapechar=-1\catcode`\\=12
+ \ior_str_get:NN \l_tmpa_ior \l_tmpa_str
+ \sys_if_platform_windows:T{
+ \exp_args:NNx\str_replace_all:Nnn\l_tmpa_str{\c_backslash_str}/
+ }
+ \str_gset_eq:NN \c_stex_mathhub_str\l_tmpa_str
+ \endgroup
+ \ior_close:N \l_tmpa_ior
+ }
+ }
\str_if_empty:NTF\c_stex_mathhub_str{
\msg_warning:nn{stex}{warning/nomathhub}
}{
@@ -448,6 +552,7 @@
\msg_error:nnxx{stex}{error/norepository}{#1}{
\stex_path_to_string:N \c_stex_mathhub_str
}
+ \input{Fatal~Error!}
} {
\exp_args:No \__stex_mathhub_parse_manifest:n { \l_tmpa_str }
}
@@ -530,6 +635,11 @@
}{}
}
\ior_close:N \c__stex_mathhub_manifest_ior
+ \stex_persist:x {
+ \prop_set_from_keyval:cn{ c_stex_mathhub_#1_manifest_prop }{
+ \exp_after:wN \prop_to_keyval:N \csname c_stex_mathhub_#1_manifest_prop\endcsname
+ }
+ }
}
\cs_new_protected:Nn \stex_set_current_repository:n {
\stex_require_repository:n { #1 }
@@ -543,19 +653,20 @@
\__stex_mathhub_do_manifest:n { #1 }
}
}
-
-\__stex_mathhub_find_manifest:N \c_stex_pwd_seq
-\seq_if_empty:NTF \l__stex_mathhub_manifest_file_seq {
- \stex_debug:nn{mathhub}{Not~currently~in~a~MathHub~repository}
-} {
- \__stex_mathhub_parse_manifest:n { main }
- \prop_get:NnN \c_stex_mathhub_main_manifest_prop {id}
- \l_tmpa_str
- \prop_set_eq:cN { c_stex_mathhub_\l_tmpa_str _manifest_prop }
- \c_stex_mathhub_main_manifest_prop
- \exp_args:Nx \stex_set_current_repository:n { \l_tmpa_str }
- \stex_debug:nn{mathhub}{Current~repository:~
- \prop_item:Nn \l_stex_current_repository_prop {id}
+\bool_if:NF \c_stex_persist_mode_bool {
+ \__stex_mathhub_find_manifest:N \c_stex_pwd_seq
+ \seq_if_empty:NTF \l__stex_mathhub_manifest_file_seq {
+ \stex_debug:nn{mathhub}{Not~currently~in~a~MathHub~repository}
+ } {
+ \__stex_mathhub_parse_manifest:n { main }
+ \prop_get:NnN \c_stex_mathhub_main_manifest_prop {id}
+ \l_tmpa_str
+ \prop_set_eq:cN { c_stex_mathhub_\l_tmpa_str _manifest_prop }
+ \c_stex_mathhub_main_manifest_prop
+ \exp_args:Nx \stex_set_current_repository:n { \l_tmpa_str }
+ \stex_debug:nn{mathhub}{Current~repository:~
+ \prop_item:Nn \l_stex_current_repository_prop {id}
+ }
}
}
\cs_new_protected:Nn \stex_in_repository:nn {
@@ -619,26 +730,43 @@
}
}
\NewDocumentCommand \mhinput { O{} m}{
- \stex_mhinput:nn{ #1 }{ #2 }
+ \__stex_mathhub_mhinput:nn{ #1 }{ #2 }
}
\cs_new_protected:Nn \__stex_mathhub_inputref:nn {
\stex_in_repository:nn {#1} {
- \bool_lazy_any:nTF {
- {\rustex_if_p:}
- {\latexml_if_p:}
- } {
+ \stex_html_backend:TF {
\str_clear:N \l_tmpa_str
\prop_get:NnNF \l_stex_current_repository_prop { narr } \l_tmpa_str {
\prop_get:NnNF \l_stex_current_repository_prop { ns } \l_tmpa_str {}
}
- \stex_annotate_invisible:nnn{inputref}{
- \l_tmpa_str / #2
- }{}
+
+ \tl_if_empty:nTF{ ##1 }{
+ \IfFileExists{#2}{
+ \stex_annotate_invisible:nnn{inputref}{
+ \l_tmpa_str / #2
+ }{}
+ }{
+ \input{#2}
+ }
+ }{
+ \IfFileExists{ \c_stex_mathhub_str / ##1 / source / #2 }{
+ \stex_annotate_invisible:nnn{inputref}{
+ \l_tmpa_str / #2
+ }{}
+ }{
+ \input{ \c_stex_mathhub_str / ##1 / source / #2 }
+ }
+ }
+
}{
\begingroup
\inputreftrue
- \input{ \c_stex_mathhub_str / ##1 / source / #2 }
+ \tl_if_empty:nTF{ ##1 }{
+ \input{#2}
+ }{
+ \input{ \c_stex_mathhub_str / ##1 / source / #2 }
+ }
\endgroup
}
}
@@ -728,10 +856,10 @@
\AddToHook{begindocument}{
\ltx@ifpackageloaded{graphicx}{
\define@key{Gin}{mhrepos}{\def\Gin@mhrepos{#1}}
- \newcommand\mhgraphics[2][]{%
+ \providecommand\mhgraphics[2][]{%
\def\Gin@mhrepos{}\setkeys{Gin}{#1}%
\includegraphics[#1]{\mhpath\Gin@mhrepos{#2}}}
- \newcommand\cmhgraphics[2][]{\begin{center}\mhgraphics[#1]{#2}\end{center}}
+ \providecommand\cmhgraphics[2][]{\begin{center}\mhgraphics[#1]{#2}\end{center}}
}{}
\ltx@ifpackageloaded{listings}{
\define@key{lst}{mhrepos}{\def\lst@mhrepos{#1}}
@@ -746,9 +874,9 @@
%%%%%%%%%%%%% references.dtx %%%%%%%%%%%%%
-\AddToHook{begindocument}{
+\AtBeginDocument{
}
-\AddToHook{enddocument}{
+\AtEndDocument{
}
\str_set:Nn \g__stex_refs_title_tl {Unnamed~Document}
@@ -895,7 +1023,7 @@
\str_if_empty:NF \l__stex_refs_curr_label_str {
\str_gset_eq:cN {sref_sym_#1_label_str}\l__stex_refs_curr_label_str
\immediate\write\@auxout{
- \exp_not:N\expandafter\def\exp_not:N\csname sref_sym_#1_label_str\exp_not:N\endcsname{
+ \exp_not:N\expandafter\def\exp_not:N\csname \exp_not:N\detokenize{sref_sym_#1_label_str}\exp_not:N\endcsname{
\l__stex_refs_curr_label_str
}
}
@@ -1058,21 +1186,26 @@
\prop_if_exist:cTF { c_stex_module_#1_prop }
\prg_return_true: \prg_return_false:
}
+\cs_new_protected:Nn \stex_execute_in_module:n { \stex_if_in_module:T {
+ \stex_add_to_current_module:n { #1 }
+ \stex_do_up_to_module:n { #1 }
+}}
+\cs_generate_variant:Nn \stex_execute_in_module:n {x}
+
\cs_new_protected:Nn \stex_add_to_current_module:n {
\tl_gput_right:cn {c_stex_module_\l_stex_current_module_str _code} { #1 }
}
+\cs_generate_variant:Nn \stex_add_to_current_module:n {x}
\cs_new_protected:Npn \STEXexport {
- \begingroup
- \newlinechar=-1\relax
- \endlinechar=-1\relax
- %\catcode`\ = 9\relax
- \expandafter\endgroup\__stex_modules_export:n
+ \ExplSyntaxOn
+ \__stex_modules_export:n
}
\cs_new_protected:Nn \__stex_modules_export:n {
- \ignorespaces #1
- \stex_add_to_current_module:n { \ignorespaces #1 }
+ \ignorespacesandpars#1\ExplSyntaxOff
+ \stex_add_to_current_module:n { \ignorespacesandpars#1}
\stex_smsmode_do:
}
+\let \stex_module_export_helper:n \use:n
\stex_deactivate_macro:Nn \STEXexport {module~environments}
\cs_new_protected:Nn \stex_add_constant_to_current_module:n {
\str_set:Nx \l_tmpa_str { #1 }
@@ -1100,36 +1233,45 @@
}
}
\int_new:N \l__stex_modules_group_depth_int
-\tl_new:N \l__stex_modules_aftergroup_tl
\cs_new_protected:Nn \stex_do_up_to_module:n {
\int_compare:nNnTF \l__stex_modules_group_depth_int = \currentgrouplevel {
#1
}{
#1
- \expandafter \tl_gset:Nn \expandafter \l__stex_modules_aftergroup_tl \expandafter { \l__stex_modules_aftergroup_tl #1 }
+ \expandafter \tl_gset:Nn
+ \csname l__stex_modules_aftergroup_\l_stex_current_module_str _tl
+ \expandafter\expandafter\expandafter\endcsname
+ \expandafter\expandafter\expandafter { \csname
+ l__stex_modules_aftergroup_\l_stex_current_module_str _tl\endcsname #1 }
\aftergroup\__stex_modules_aftergroup_do:
}
}
+\cs_generate_variant:Nn \stex_do_up_to_module:n {x}
\cs_new_protected:Nn \__stex_modules_aftergroup_do: {
+ \stex_debug:nn{aftergroup}{\cs_meaning:c{
+ l__stex_modules_aftergroup_\l_stex_current_module_str _tl
+ }}
\int_compare:nNnTF \l__stex_modules_group_depth_int = \currentgrouplevel {
- \l__stex_modules_aftergroup_tl
- \tl_clear:N \l__stex_modules_aftergroup_tl
+ \use:c{l__stex_modules_aftergroup_\l_stex_current_module_str _tl}
+ \tl_gclear:c{l__stex_modules_aftergroup_\l_stex_current_module_str _tl}
}{
- \l__stex_modules_aftergroup_tl
+ \use:c{l__stex_modules_aftergroup_\l_stex_current_module_str _tl}
\aftergroup\__stex_modules_aftergroup_do:
}
}
+\cs_new_protected:Nn \_stex_reset_up_to_module:n {
+ \expandafter\let\csname l__stex_modules_aftergroup_#1_tl\endcsname\undefined
+}
-\str_new:N \l_stex_modules_ns_str
-\str_new:N \l_stex_modules_subpath_str
+\str_new:N \l_stex_module_ns_str
+\str_new:N \l_stex_module_subpath_str
\cs_new_protected:Nn \__stex_modules_compute_namespace:nN {
- \str_set:Nx \l_tmpa_str { #1 }
\seq_set_eq:NN \l_tmpa_seq #2
% split off file extension
- \seq_pop_right:NN \l_tmpa_seq \l_tmpb_str
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpb_str % <- filename
\exp_args:NNno \seq_set_split:Nnn \l_tmpb_seq . \l_tmpb_str
- \seq_get_left:NN \l_tmpb_seq \l_tmpb_str
- \seq_put_right:No \l_tmpa_seq \l_tmpb_str
+ \seq_get_left:NN \l_tmpb_seq \l_tmpb_str % <- filename without suffixes
+ \seq_put_right:No \l_tmpa_seq \l_tmpb_str % <- file path including name without suffixes
\bool_set_true:N \l_tmpa_bool
\bool_while_do:Nn \l_tmpa_bool {
@@ -1143,18 +1285,19 @@
}
}
- \stex_path_to_string:NN \l_tmpa_seq \l_stex_modules_subpath_str
- \str_if_empty:NTF \l_stex_modules_subpath_str {
- \str_set_eq:NN \l_stex_modules_ns_str \l_tmpa_str
+ \stex_path_to_string:NN \l_tmpa_seq \l_stex_module_subpath_str
+ % \l_tmpa_seq <- sub-path relative to archive
+ \str_if_empty:NTF \l_stex_module_subpath_str {
+ \str_set:Nx \l_stex_module_ns_str {#1}
}{
- \str_set:Nx \l_stex_modules_ns_str {
- \l_tmpa_str/\l_stex_modules_subpath_str
+ \str_set:Nx \l_stex_module_ns_str {
+ #1/\l_stex_module_subpath_str
}
}
}
\cs_new_protected:Nn \stex_modules_current_namespace: {
- \str_clear:N \l_stex_modules_subpath_str
+ \str_clear:N \l_stex_module_subpath_str
\prop_if_exist:NTF \l_stex_current_repository_prop {
\prop_get:NnN \l_stex_current_repository_prop { ns } \l_tmpa_str
\__stex_modules_compute_namespace:nN \l_tmpa_str \g_stex_currentfile_seq
@@ -1165,7 +1308,7 @@
\exp_args:NNno \seq_set_split:Nnn \l_tmpb_seq . \l_tmpb_str
\seq_get_left:NN \l_tmpb_seq \l_tmpb_str
\seq_put_right:No \l_tmpa_seq \l_tmpb_str
- \str_set:Nx \l_stex_modules_ns_str {
+ \str_set:Nx \l_stex_module_ns_str {
file:/\stex_path_to_string:N \l_tmpa_seq
}
}
@@ -1201,6 +1344,7 @@
\cs_new_protected:Nn \stex_module_setup:nn {
+ \int_set:Nn \l__stex_modules_group_depth_int {\currentgrouplevel}
\str_set:Nx \l_stex_module_name_str { #2 }
\__stex_modules_args:n { #1 }
\stex_if_in_module:TF {
@@ -1211,11 +1355,16 @@
\prop_item:cn {c_stex_module_\l_stex_current_module_str _prop}
{ name } / \l_stex_module_name_str
}
+ \str_if_empty:NT \l_stex_module_lang_str {
+ \str_set:Nx \l_stex_module_lang_str {
+ \prop_item:cn {c_stex_module_\l_stex_current_module_str _prop}
+ { lang }
+ }
+ }
}{
% not nested:
\str_if_empty:NT \l_stex_module_ns_str {
\stex_modules_current_namespace:
- \str_set_eq:NN \l_stex_module_ns_str \l_stex_modules_ns_str
\exp_args:NNNo \seq_set_split:Nnn \l_tmpa_seq
/ {\l_stex_module_ns_str}
\seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
@@ -1230,23 +1379,21 @@
\seq_get_right:NN \g_stex_currentfile_seq \l_tmpa_str
\seq_set_split:NnV \l_tmpa_seq . \l_tmpa_str
\seq_pop_right:NN \l_tmpa_seq \l_tmpa_str % .tex
+ \exp_args:No \str_if_eq:nnF \l_tmpa_str {tex} {
+ \exp_args:No \str_if_eq:nnF \l_tmpa_str {dtx} {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq \l_tmpa_str
+ }
+ }
\seq_pop_left:NN \l_tmpa_seq \l_tmpa_str % <filename>
- \seq_if_empty:NF \l_tmpa_seq { %remaining element should be language
+ \seq_if_empty:NF \l_tmpa_seq { %remaining element should be [<something>.]language
+ \seq_pop_right:NN \l_tmpa_seq \l_stex_module_lang_str
\stex_debug:nn{modules} {Language~\l_stex_module_lang_str~
inferred~from~file~name}
- \seq_pop_left:NN \l_tmpa_seq \l_stex_module_lang_str
}
}
\stex_if_smsmode:F { \str_if_empty:NF \l_stex_module_lang_str {
- \prop_get:NVNTF \c_stex_languages_prop \l_stex_module_lang_str
- \l_tmpa_str {
- \ltx@ifpackageloaded{babel}{
- \exp_args:Nx \selectlanguage { \l_tmpa_str }
- }{}
- } {
- \msg_error:nnx{stex}{error/unknownlanguage}{\l_tmpa_str}
- }
+ \exp_args:NNo \stex_set_language:Nn \l_tmpa_str \l_stex_module_lang_str
}}
\str_if_empty:NTF \l_stex_module_sig_str {
\exp_args:Nnx \prop_gset_from_keyval:cn {
@@ -1262,6 +1409,7 @@
}
\seq_clear:c {c_stex_module_\l_stex_module_ns_str?\l_stex_module_name_str _imports}
\seq_clear:c {c_stex_module_\l_stex_module_ns_str?\l_stex_module_name_str _constants}
+ \seq_clear:c {c_stex_module_\l_stex_module_ns_str?\l_stex_module_name_str _copymodules}
\tl_clear:c {c_stex_module_\l_stex_module_ns_str?\l_stex_module_name_str _code}
\str_set:Nx\l_stex_current_module_str{\l_stex_module_ns_str?\l_stex_module_name_str}
\str_if_empty:NT \l_stex_module_meta_str {
@@ -1285,24 +1433,29 @@
\l_stex_module_ns_str?\l_stex_module_name_str
}{\l_stex_module_sig_str}
}
-
- \seq_set_eq:NN \l_tmpa_seq \g_stex_currentfile_seq
- \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
- \seq_set_split:NnV \l_tmpb_seq . \l_tmpa_str
- \seq_pop_right:NN \l_tmpb_seq \l_tmpa_str % .tex
- \seq_pop_left:NN \l_tmpb_seq \l_tmpa_str % <filename>
- \str_set:Nx \l_tmpa_str {
- \stex_path_to_string:N \l_tmpa_seq /
- \l_tmpa_str . \l_stex_module_sig_str .tex
- }
- \IfFileExists \l_tmpa_str {
- \exp_args:No \stex_file_in_smsmode:nn { \l_tmpa_str } {
- \str_clear:N \l_stex_current_module_str
- \seq_clear:N \l_stex_all_modules_seq
- \stex_debug:nn{modules}{Loading~signature~\l_tmpa_str}
- }
+ \stex_debug:nn{modules}{Signature~\l_stex_module_sig_str~for~\l_stex_module_ns_str?\l_stex_module_name_str}
+ \stex_if_module_exists:nTF{\l_stex_module_ns_str?\l_stex_module_name_str}{
+ \stex_debug:nn{modules}{(already exists)}
}{
- \msg_error:nnx{stex}{error/unknownmodule}{for~signature~\l_tmpa_str}
+ \stex_debug:nn{modules}{(needs loading)}
+ \seq_set_eq:NN \l_tmpa_seq \g_stex_currentfile_seq
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpb_seq . \l_tmpa_str
+ \seq_pop_right:NN \l_tmpb_seq \l_tmpa_str % .tex
+ \seq_pop_left:NN \l_tmpb_seq \l_tmpa_str % <filename>
+ \str_set:Nx \l_tmpa_str {
+ \stex_path_to_string:N \l_tmpa_seq /
+ \l_tmpa_str . \l_stex_module_sig_str .tex
+ }
+ \IfFileExists \l_tmpa_str {
+ \exp_args:No \stex_file_in_smsmode:nn { \l_tmpa_str } {
+ \str_clear:N \l_stex_current_module_str
+ \seq_clear:N \l_stex_all_modules_seq
+ \stex_debug:nn{modules}{Loading~signature}
+ }
+ }{
+ \msg_error:nnx{stex}{error/unknownmodule}{for~signature~\l_tmpa_str}
+ }
}
\stex_if_smsmode:F {
\stex_activate_module:n {
@@ -1321,6 +1474,7 @@
\seq_put_right:Nx \l_stex_all_modules_seq {
\l_stex_module_ns_str ? \l_stex_module_name_str
}
+ \tl_clear:c{l__stex_modules_aftergroup_\l_stex_module_ns_str ? \l_stex_module_name_str _tl}
}
\cs_new_protected:Nn \__stex_modules_begin_module: {
\stex_reactivate_macro:N \STEXexport
@@ -1339,7 +1493,7 @@
File:~\stex_path_to_string:N \g_stex_currentfile_seq
}
- \stex_if_smsmode:F{
+ \stex_if_do_html:T{
\begin{stex_annotate_env} {theory} {
\l_stex_module_ns_str ? \l_stex_module_name_str
}
@@ -1355,18 +1509,37 @@
}
}
}
- \int_set:Nn \l__stex_modules_group_depth_int {\currentgrouplevel}
% TODO: Inherit metatheory for nested modules?
}
\iffalse \end{stex_annotate_env} \fi %^^A make syntax highlighting work again
\cs_new_protected:Nn \__stex_modules_end_module: {
\stex_debug:nn{modules}{Closing~module~\prop_item:cn {c_stex_module_\l_stex_current_module_str _prop} { name }}
+ \_stex_reset_up_to_module:n \l_stex_current_module_str
+ \stex_if_smsmode:T {
+ \stex_persist:x {
+ \prop_set_from_keyval:cn{c_stex_module_\l_stex_current_module_str _prop}{
+ \exp_after:wN \prop_to_keyval:N \csname c_stex_module_\l_stex_current_module_str _prop\endcsname
+ }
+ \seq_set_from_clist:cn{c_stex_module_\l_stex_current_module_str _constants}{
+ \seq_use:cn{c_stex_module_\l_stex_current_module_str _constants},
+ }
+ \seq_set_from_clist:cn{c_stex_module_\l_stex_current_module_str _imports}{
+ \seq_use:cn{c_stex_module_\l_stex_current_module_str _imports},
+ }
+ \tl_set:cn {c_stex_module_\l_stex_current_module_str _code}
+ }
+ \exp_after:wN \let \exp_after:wN \l_tmpa_tl \csname c_stex_module_\l_stex_current_module_str _code\endcsname
+ \exp_after:wN \stex_persist:n \exp_after:wN { \exp_after:wN { \l_tmpa_tl } }
+ }
}
\iffalse \begin{stex_annotate_env} \fi %^^A make syntax highlighting work again
\NewDocumentEnvironment { smodule } { O{} m } {
\stex_module_setup:nn{#1}{#2}
- \par
+ %\par
\stex_if_smsmode:F{
+ \tl_if_empty:NF \smoduletitle {
+ \exp_args:No \stex_document_title:n \smoduletitle
+ }
\tl_clear:N \l_tmpa_tl
\clist_map_inline:Nn \smoduletype {
\tl_if_exist:cT {__stex_modules_smodule_##1_start:}{
@@ -1463,9 +1636,6 @@
\bool_set_false:N \l_stex_in_meta_bool
\cs_new_protected:Nn \stex_activate_module:n {
\stex_debug:nn{modules}{Activating~module~#1}
- \seq_if_in:NnT \l_stex_implicit_morphisms_seq { #1 }{
- \msg_error:nnn{stex}{error/conflictingmodules}{ #1 }
- }
\exp_args:NNx \seq_if_in:NnF \l_stex_all_modules_seq { #1 } {
\seq_put_right:Nx \l_stex_all_modules_seq { #1 }
\use:c{ c_stex_module_#1_code }
@@ -1498,6 +1668,11 @@
\endinput
\setnotation
\copynotation
+ \assign
+ \renamedecl
+ \donotcopy
+ \instantiate
+ \textsymdecl
}
\exp_args:NNx \seq_set_from_clist:Nn \g_stex_smsmode_allowedenvs_seq {
@@ -1505,10 +1680,12 @@
smodule,
copymodule,
interpretmodule,
+ realization,
sdefinition,
sexample,
sassertion,
- sparagraph
+ sparagraph,
+ mathstructure
}
}
\bool_new:N \g__stex_smsmode_bool
@@ -1516,7 +1693,7 @@
\prg_new_conditional:Nnn \stex_if_smsmode: { p, T, F, TF } {
\bool_if:NTF \g__stex_smsmode_bool \prg_return_true: \prg_return_false:
}
-\cs_new_protected:Nn \__stex_smsmode_in_smsmode:nn {
+\cs_new_protected:Nn \__stex_smsmode_in_smsmode:nn { \stex_suppress_html:n {
\vbox_set:Nn \l_tmpa_box {
\bool_set_eq:cN { l__stex_smsmode_#1_bool } \g__stex_smsmode_bool
\bool_gset_true:N \g__stex_smsmode_bool
@@ -1524,13 +1701,107 @@
\bool_gset_eq:Nc \g__stex_smsmode_bool { l__stex_smsmode_#1_bool }
}
\box_clear:N \l_tmpa_box
-}
+} }
\quark_new:N \q__stex_smsmode_break
+\NewDocumentCommand \__stex_smsmode_importmodule: { O{} m} {
+ \seq_gput_right:Nn \l__stex_smsmode_importmodules_seq {{#1}{#2}}
+ \stex_smsmode_do:
+}
+
+\cs_new_protected:Nn \__stex_smsmode_module:nn {
+ \__stex_modules_args:n{#1}
+ \stex_if_in_module:F {
+ \str_if_empty:NF \l_stex_module_sig_str {
+ \stex_modules_current_namespace:
+ \str_set:Nx \l_stex_module_name_str { #2 }
+ \stex_if_module_exists:nF{\l_stex_module_ns_str?\l_stex_module_name_str}{
+ \seq_set_eq:NN \l_tmpa_seq \g_stex_currentfile_seq
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \seq_set_split:NnV \l_tmpb_seq . \l_tmpa_str
+ \seq_pop_right:NN \l_tmpb_seq \l_tmpa_str % .tex
+ \seq_pop_left:NN \l_tmpb_seq \l_tmpa_str % <filename>
+ \str_set:Nx \l_tmpa_str {
+ \stex_path_to_string:N \l_tmpa_seq /
+ \l_tmpa_str . \l_stex_module_sig_str .tex
+ }
+ \IfFileExists \l_tmpa_str {
+ \exp_args:NNx \seq_gput_right:Nn \l__stex_smsmode_sigmodules_seq \l_tmpa_str
+ }{
+ \msg_error:nnx{stex}{error/unknownmodule}{for~signature~\l_tmpa_str}
+ }
+ }
+ }
+ }
+}
+
+\prg_new_conditional:Nnn \__stex_smsmode_check_import_pair:nn {T,F,TF} {
+ %\stex_debug:nn{import-pair}{\detokenize{{#1}~{#2}}}
+ \tl_if_empty:nTF{#1}{
+ \prop_if_exist:NTF \l_stex_current_repository_prop
+ {
+ %\stex_debug:nn{import-pair}{in repository \prop_item:Nn \l_stex_current_repository_prop {id}}
+ \prg_return_true:
+ } {
+ \seq_set_split:Nnn \l_tmpa_seq ? {#2}
+ \seq_get_left:NN \l_tmpa_seq \l_tmpa_tl
+ \tl_if_empty:NT \l_tmpa_tl {
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
+ }
+ %\stex_debug:nn{import-pair}{\seq_use:Nn \l_tmpa_seq,~of~length~\seq_count:N \l_tmpa_seq}
+ \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} > 1
+ \prg_return_true: \prg_return_false:
+ }
+ }\prg_return_true:
+}
+
\cs_new_protected:Nn \stex_file_in_smsmode:nn {
\stex_filestack_push:n{#1}
+ \seq_gclear:N \l__stex_smsmode_importmodules_seq
+ \seq_gclear:N \l__stex_smsmode_sigmodules_seq
+ % ----- new -----------------------------
+ \__stex_smsmode_in_smsmode:nn{#1}{
+ \let\importmodule\__stex_smsmode_importmodule:
+ \let\stex_module_setup:nn\__stex_smsmode_module:nn
+ \let\__stex_modules_begin_module:\relax
+ \let\__stex_modules_end_module:\relax
+ \seq_clear:N \g_stex_smsmode_allowedenvs_seq
+ \exp_args:NNx \seq_put_right:Nn \g_stex_smsmode_allowedenvs_seq {\tl_to_str:n{smodule}}
+ \tl_clear:N \g_stex_smsmode_allowedmacros_tl
+ \tl_clear:N \g_stex_smsmode_allowedmacros_escape_tl
+ \tl_put_right:Nn \g_stex_smsmode_allowedmacros_escape_tl {\importmodule}
+ \everyeof{\q__stex_smsmode_break\noexpand}
+ \expandafter\expandafter\expandafter
+ \stex_smsmode_do:
+ \csname @ @ input\endcsname "#1"\relax
+
+ \seq_map_inline:Nn \l__stex_smsmode_sigmodules_seq {
+ \stex_filestack_push:n{##1}
+ \expandafter\expandafter\expandafter
+ \stex_smsmode_do:
+ \csname @ @ input\endcsname "##1"\relax
+ \stex_filestack_pop:
+ }
+ }
+ % ----- new -----------------------------
\__stex_smsmode_in_smsmode:nn{#1} {
#2
+ % ----- new -----------------------------
+ \begingroup
+ %\stex_debug:nn{smsmode}{Here:~\seq_use:Nn\l__stex_smsmode_importmodules_seq, }
+ \seq_map_inline:Nn \l__stex_smsmode_importmodules_seq {
+ \__stex_smsmode_check_import_pair:nnT ##1 { \begingroup
+ \stex_import_module_uri:nn ##1
+ \stex_import_require_module:nnnn
+ \l_stex_import_ns_str
+ \l_stex_import_archive_str
+ \l_stex_import_path_str
+ \l_stex_import_name_str \endgroup
+ }
+ }
+ \endgroup
+ \stex_debug:nn{smsmode}{Actually~loading~file~#1}
+ % ----- new -----------------------------
\everyeof{\q__stex_smsmode_break\noexpand}
\expandafter\expandafter\expandafter
\stex_smsmode_do:
@@ -1603,7 +1874,7 @@
{\str_if_empty_p:N \l_stex_import_path_str}
{\stex_if_module_exists_p:n { \l_stex_module_ns_str ? \l_stex_import_name_str } }
}{
- \str_set_eq:NN \l_stex_import_path_str \l_stex_modules_subpath_str
+ \str_set_eq:NN \l_stex_import_path_str \l_stex_module_subpath_str
\str_set_eq:NN \l_stex_import_ns_str \l_stex_module_ns_str
}{
\str_if_empty:NT \l_stex_import_archive_str {
@@ -1613,9 +1884,11 @@
}
\str_if_empty:NTF \l_stex_import_archive_str {
\str_if_empty:NF \l_stex_import_path_str {
- \str_set:Nx \l_stex_import_ns_str {
- \l_stex_module_ns_str / \l_stex_import_path_str
+ \stex_path_from_string:Nn \l_tmpb_seq {
+ \l_stex_module_ns_str / .. / \l_stex_import_path_str
}
+ \str_set:Nx \l_stex_import_ns_str {\stex_path_to_string:N \l_tmpb_seq}
+ \str_replace_once:Nnn \l_stex_import_ns_str {file:/} {file://}
}
}{
\stex_require_repository:n \l_stex_import_archive_str
@@ -1636,10 +1909,18 @@
\cs_new_protected:Nn \stex_import_require_module:nnnn {
\exp_args:Nx \stex_if_module_exists:nF { #1 ? #4 } {
+ \stex_debug:nn{requiremodule}{Here:\\~~1:~#1\\~~2:~#2\\~~3:~#3\\~~4:~#4}
+
+ \exp_args:NNxx \seq_set_split:Nnn \l_tmpa_seq {\tl_to_str:n{/}} {#4}
+ \seq_get_left:NN \l_tmpa_seq \l_tmpc_str
+
+ %\stex_debug:nn{requiremodule}{Top~module:\l_tmpc_str}
+
% archive
\str_set:Nx \l_tmpa_str { #2 }
\str_if_empty:NTF \l_tmpa_str {
\seq_set_eq:NN \l_tmpa_seq \g_stex_currentfile_seq
+ \seq_put_right:Nn \l_tmpa_seq {..}
} {
\stex_path_from_string:Nn \l_tmpb_seq { \l_tmpa_str }
\seq_concat:NNN \l_tmpa_seq \c_stex_mathhub_seq \l_tmpb_seq
@@ -1649,7 +1930,7 @@
% path
\str_set:Nx \l_tmpb_str { #3 }
\str_if_empty:NTF \l_tmpb_str {
- \str_set:Nx \l_tmpa_str { \stex_path_to_string:N \l_tmpa_seq / #4 }
+ \str_set:Nx \l_tmpa_str { \stex_path_to_string:N \l_tmpa_seq / \l_tmpc_str }
\ltx@ifpackageloaded{babel} {
\exp_args:NNx \prop_get:NnNF \c_stex_language_abbrevs_prop
@@ -1660,16 +1941,16 @@
\str_clear:N \l_tmpb_str
}
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.\l_tmpb_str.tex}
+ \stex_debug:nn{modules}{Checking~a1~\l_tmpa_str.\l_tmpb_str.tex}
\IfFileExists{ \l_tmpa_str.\l_tmpb_str.tex }{
\str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str.\l_tmpb_str.tex }
}{
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.tex}
+ \stex_debug:nn{modules}{Checking~a2~\l_tmpa_str.tex}
\IfFileExists{ \l_tmpa_str.tex }{
\str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str.tex }
}{
% try english as default
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.en.tex}
+ \stex_debug:nn{modules}{Checking~a3~\l_tmpa_str.en.tex}
\IfFileExists{ \l_tmpa_str.en.tex }{
\str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str.en.tex }
}{
@@ -1680,7 +1961,7 @@
} {
\seq_set_split:NnV \l_tmpb_seq / \l_tmpb_str
- \seq_concat:NNN \l_tmpa_seq \l_tmpa_seq \l_tmpb_seq
+ \seq_concat:NNN \l_tmpb_seq \l_tmpa_seq \l_tmpb_seq
\ltx@ifpackageloaded{babel} {
\exp_args:NNx \prop_get:NnNF \c_stex_language_abbrevs_prop
@@ -1691,31 +1972,32 @@
\str_clear:N \l_tmpb_str
}
- \stex_path_to_string:NN \l_tmpa_seq \l_tmpa_str
+ \stex_path_canonicalize:N \l_tmpb_seq
+ \stex_path_to_string:NN \l_tmpb_seq \l_tmpa_str
- \stex_debug:nn{modules}{Checking~\l_tmpa_str/#4.\l_tmpb_str.tex}
- \IfFileExists{ \l_tmpa_str/#4.\l_tmpb_str.tex }{
- \str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str/#4.\l_tmpb_str.tex }
+ \stex_debug:nn{modules}{Checking~b1~\l_tmpa_str/\l_tmpc_str.\l_tmpb_str.tex}
+ \IfFileExists{ \l_tmpa_str/\l_tmpc_str.\l_tmpb_str.tex }{
+ \str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str/\l_tmpc_str.\l_tmpb_str.tex }
}{
- \stex_debug:nn{modules}{Checking~\l_tmpa_str/#4.tex}
- \IfFileExists{ \l_tmpa_str/#4.tex }{
- \str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str/#4.tex }
+ \stex_debug:nn{modules}{Checking~b2~\l_tmpa_str/\l_tmpc_str.tex}
+ \IfFileExists{ \l_tmpa_str/\l_tmpc_str.tex }{
+ \str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str/\l_tmpc_str.tex }
}{
% try english as default
- \stex_debug:nn{modules}{Checking~\l_tmpa_str/#4.en.tex}
- \IfFileExists{ \l_tmpa_str/#4.en.tex }{
- \str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str/#4.en.tex }
+ \stex_debug:nn{modules}{Checking~b3~\l_tmpa_str/\l_tmpc_str.en.tex}
+ \IfFileExists{ \l_tmpa_str/\l_tmpc_str.en.tex }{
+ \str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str/\l_tmpc_str.en.tex }
}{
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.\l_tmpb_str.tex}
+ \stex_debug:nn{modules}{Checking~b4~\l_tmpa_str.\l_tmpb_str.tex}
\IfFileExists{ \l_tmpa_str.\l_tmpb_str.tex }{
\str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str.\l_tmpb_str.tex }
}{
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.tex}
+ \stex_debug:nn{modules}{Checking~b4~\l_tmpa_str.tex}
\IfFileExists{ \l_tmpa_str.tex }{
\str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str.tex }
}{
% try english as default
- \stex_debug:nn{modules}{Checking~\l_tmpa_str.en.tex}
+ \stex_debug:nn{modules}{Checking~b5~\l_tmpa_str.en.tex}
\IfFileExists{ \l_tmpa_str.en.tex }{
\str_gset:Nx \g__stex_importmodule_file_str { \l_tmpa_str.en.tex }
}{
@@ -1728,21 +2010,24 @@
}
}
- \exp_args:No \stex_file_in_smsmode:nn { \g__stex_importmodule_file_str } {
- \seq_clear:N \l_stex_all_modules_seq
- \str_clear:N \l_stex_current_module_str
- \str_set:Nx \l_tmpb_str { #2 }
- \str_if_empty:NF \l_tmpb_str {
- \stex_set_current_repository:n { #2 }
+ \str_if_eq:eeF{\g__stex_importmodule_file_str}{\seq_use:Nn \g_stex_currentfile_seq /}{
+ \exp_args:No \stex_file_in_smsmode:nn { \g__stex_importmodule_file_str } {
+ \seq_clear:N \l_stex_all_modules_seq
+ \str_clear:N \l_stex_current_module_str
+ \str_set:Nx \l_tmpb_str { #2 }
+ \str_if_empty:NF \l_tmpb_str {
+ \stex_set_current_repository:n { #2 }
+ }
+ \stex_debug:nn{modules}{Loading~\g__stex_importmodule_file_str}
}
- \stex_debug:nn{modules}{Loading~\g__stex_importmodule_file_str}
- }
- \stex_if_module_exists:nF { #1 ? #4 } {
- \msg_error:nnx{stex}{error/unknownmodule}{
- #1?#4~(in~file~\g__stex_importmodule_file_str)
+ \stex_if_module_exists:nF { #1 ? #4 } {
+ \msg_error:nnx{stex}{error/unknownmodule}{
+ #1?#4~(in~file~\g__stex_importmodule_file_str)
+ }
}
}
+
}
\stex_activate_module:n { #1 ? #4 }
}
@@ -1751,10 +2036,10 @@
\stex_debug:nn{modules}{Importing~module:~
\l_stex_import_ns_str ? \l_stex_import_name_str
}
+ \stex_import_require_module:nnnn
+ { \l_stex_import_ns_str } { \l_stex_import_archive_str }
+ { \l_stex_import_path_str } { \l_stex_import_name_str }
\stex_if_smsmode:F {
- \stex_import_require_module:nnnn
- { \l_stex_import_ns_str } { \l_stex_import_archive_str }
- { \l_stex_import_path_str } { \l_stex_import_name_str }
\stex_annotate_invisible:nnn
{import} {\l_stex_import_ns_str ? \l_stex_import_name_str} {}
}
@@ -1782,6 +2067,20 @@
\stex_smsmode_do:
\ignorespacesandpars
}
+\cs_new_protected:Nn \stex_csl_to_imports:Nn {
+ \tl_if_empty:nF{#2}{
+ \clist_set:Nn \l_tmpa_clist {#2}
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \tl_if_head_eq_charcode:nNTF {##1}[{
+ #1 ##1
+ }{
+ #1{##1}
+ }
+ }
+ }
+}
+\cs_generate_variant:Nn \stex_csl_to_imports:Nn {No}
+
%%%%%%%%%%%%% symbols.dtx %%%%%%%%%%%%%
@@ -1789,6 +2088,15 @@
args~value~in~symbol~declaration~for~#1~
needs~to~be~i,~a,~b~or~B,~but~#2~given
}
+\msg_new:nnn{stex}{error/unknownsymbol}{
+ No~symbol~#1~found!
+}
+\msg_new:nnn{stex}{error/seqlength}{
+ Expected~#1~arguments;~got~#2!
+}
+\msg_new:nnn{stex}{error/unknownnotation}{
+ Unknown~notation~#1~for~#2!
+}
\cs_new_protected:Nn \stex_all_symbols:n {
\def \__stex_symdecl_all_symbols_cs ##1 {#1}
\seq_map_inline:Nn \l_stex_all_modules_seq {
@@ -1812,6 +2120,7 @@
gfc .str_set:N = \l_stex_symdecl_gfc_str , % TODO(?)
specializes .str_set:N = \l_stex_symdecl_specializes_str , % TODO(?)
def .tl_set:N = \l_stex_symdecl_definiens_tl ,
+ reorder .str_set_x:N = \l_stex_symdecl_reorder_str ,
assoc .choices:nn =
{bin,binl,binr,pre,conj,pwconj}
{\str_set:Nx \l_stex_symdecl_assoctype_str {\l_keys_choice_tl}}
@@ -1823,6 +2132,7 @@
\str_clear:N \l_stex_symdecl_name_str
\str_clear:N \l_stex_symdecl_args_str
\str_clear:N \l_stex_symdecl_deprecate_str
+ \str_clear:N \l_stex_symdecl_reorder_str
\str_clear:N \l_stex_symdecl_assoctype_str
\bool_set_false:N \l_stex_symdecl_local_bool
\tl_clear:N \l_stex_symdecl_type_tl
@@ -1928,6 +2238,12 @@
}
\prop_put:Nnx \l_tmpa_prop { assocs } { \int_use:N \l_tmpb_int }
+ \tl_if_empty:NTF \l_stex_symdecl_definiens_tl {
+ \prop_put:Nnx \l_tmpa_prop { defined }{ false }
+ }{
+ \prop_put:Nnx \l_tmpa_prop { defined }{ true }
+ }
+
% semantic macro
\bool_if:NT \l_stex_symdecl_make_macro_bool {
@@ -1936,91 +2252,118 @@
\l_stex_current_module_str ? \l_stex_symdecl_name_str
}}
}
-
- \bool_if:NF \l_stex_symdecl_local_bool {
- \exp_args:Nx \stex_add_to_current_module:n {
- \tl_set:cn { #1 } { \stex_invoke_symbol:n {
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- } }
- }
- }
}
\stex_debug:nn{symbols}{New~symbol:~
\l_stex_current_module_str ? \l_stex_symdecl_name_str^^J
Type:~\exp_not:o { \l_stex_symdecl_type_tl }^^J
- Args:~\prop_item:Nn \l_tmpa_prop { args }
+ Args:~\prop_item:Nn \l_tmpa_prop { args }^^J
+ Definiens:~\exp_not:o {\l_stex_symdecl_definiens_tl}
}
% circular dependencies require this:
-
+ \stex_if_do_html:T {
+ \stex_annotate_invisible:nnn {symdecl} {
+ \l_stex_current_module_str ? \l_stex_symdecl_name_str
+ } {
+ \tl_if_empty:NF \l_stex_symdecl_type_tl {
+ \stex_annotate_invisible:nnn{type}{}{$\l_stex_symdecl_type_tl$}
+ }
+ \stex_annotate_invisible:nnn{args}{\prop_item:Nn \l_tmpa_prop { args }}{}
+ \stex_annotate_invisible:nnn{macroname}{#1}{}
+ \tl_if_empty:NF \l_stex_symdecl_definiens_tl {
+ \stex_annotate_invisible:nnn{definiens}{}
+ {$\l_stex_symdecl_definiens_tl$}
+ }
+ \str_if_empty:NF \l_stex_symdecl_assoctype_str {
+ \stex_annotate_invisible:nnn{assoctype}{\l_stex_symdecl_assoctype_str}{}
+ }
+ \str_if_empty:NF \l_stex_symdecl_reorder_str {
+ \stex_annotate_invisible:nnn{reorderargs}{\l_stex_symdecl_reorder_str}{}
+ }
+ }
+ }
\prop_if_exist:cF {
l_stex_symdecl_
\l_stex_current_module_str ? \l_stex_symdecl_name_str
_prop
} {
- \prop_set_eq:cN {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- _prop
- } \l_tmpa_prop
+ \bool_if:NTF \l_stex_symdecl_local_bool \stex_do_up_to_module:x \stex_execute_in_module:x {
+ \__stex_symdecl_restore_symbol:nnnnnnn
+ {\l_stex_symdecl_name_str}
+ { \prop_item:Nn \l_tmpa_prop {args} }
+ { \prop_item:Nn \l_tmpa_prop {arity} }
+ { \prop_item:Nn \l_tmpa_prop {assocs} }
+ { \prop_item:Nn \l_tmpa_prop {defined} }
+ {\bool_if:NT \l_stex_symdecl_make_macro_bool {#1} }
+ {\l_stex_current_module_str}
+ }
}
-
- \seq_clear:c {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- _notations
+}
+\cs_new_protected:Nn \__stex_symdecl_restore_symbol:nnnnnnn {
+ \prop_clear:N \l_tmpa_prop
+ \prop_put:Nnn \l_tmpa_prop { module } { #7 }
+ \prop_put:Nnn \l_tmpa_prop { name } { #1}
+ \prop_put:Nnn \l_tmpa_prop { args } {#2}
+ \prop_put:Nnn \l_tmpa_prop { arity } { #3 }
+ \prop_put:Nnn \l_tmpa_prop { assocs } { #4 }
+ \prop_put:Nnn \l_tmpa_prop { defined } { #5 }
+ \tl_if_empty:nF{#6}{
+ \tl_set:cx{#6}{\stex_invoke_symbol:n{\detokenize{#7 ? #1}}}
}
+ \prop_set_eq:cN{l_stex_symdecl_ \detokenize{#7 ? #1} _prop}\l_tmpa_prop
+ \seq_clear:c{l_stex_symdecl_ \detokenize{#7 ? #1} _notations}
+}
- \bool_if:NF \l_stex_symdecl_local_bool {
- \exp_args:Nx
- \stex_add_to_current_module:n {
- \seq_clear:c {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- _notations
- }
- \prop_set_from_keyval:cn {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- _prop
- } {
- name = \prop_item:Nn \l_tmpa_prop { name } ,
- module = \prop_item:Nn \l_tmpa_prop { module } ,
- type = \prop_item:Nn \l_tmpa_prop { type } ,
- args = \prop_item:Nn \l_tmpa_prop { args } ,
- arity = \prop_item:Nn \l_tmpa_prop { arity } ,
- assocs = \prop_item:Nn \l_tmpa_prop { assocs }
- }
- }
- }
+\keys_define:nn { stex / textsymdecl } {
+ name .str_set_x:N = \l__stex_symdecl_name_str ,
+ type .tl_set:N = \l__stex_symdecl_type_tl
+}
- \stex_if_smsmode:F {
- \stex_if_do_html:T {
- \stex_annotate_invisible:nnn {symdecl} {
- \l_stex_current_module_str ? \l_stex_symdecl_name_str
- } {
- \tl_if_empty:NF \l_stex_symdecl_type_tl {\stex_annotate_invisible:nnn{type}{}{$\l_stex_symdecl_type_tl$}}
- \stex_annotate_invisible:nnn{args}{}{
- \prop_item:Nn \l_tmpa_prop { args }
- }
- \stex_annotate_invisible:nnn{macroname}{#1}{}
- \tl_if_empty:NF \l_stex_symdecl_definiens_tl {
- \stex_annotate_invisible:nnn{definiens}{}
- {$\l_stex_symdecl_definiens_tl$}
- }
- \str_if_empty:NF \l_stex_symdecl_assoctype_str {
- \stex_annotate_invisible:nnn{assoctype}{\l_stex_symdecl_assoctype_str}{}
- }
- }
- }
+\cs_new_protected:Nn \_stex_textsymdecl_args:n {
+ \str_clear:N \l__stex_symdecl_name_str
+ \tl_clear:N \l__stex_symdecl_type_tl
+ \keys_set:nn { stex / textsymdecl } { #1 }
+}
+
+\NewDocumentCommand \textsymdecl {m O{} m} {
+ \_stex_textsymdecl_args:n { #2 }
+ \str_if_empty:NTF \l__stex_symdecl_name_str {
+ \__stex_symdecl_args:n{name=#1,#2}
+ }{
+ \__stex_symdecl_args:n{#2}
+ }
+ \bool_set_true:N \l_stex_symdecl_make_macro_bool
+ \stex_symdecl_do:n{#1-sym}
+ \stex_execute_in_module:n{
+ \cs_set_nopar:cpn{#1name}{
+ \ifvmode\hbox_unpack:N\c_empty_box\fi
+ \hbox{#3}\xspace
+ }
+ \cs_set_nopar:cpn{#1}{
+ \ifmmode\csname#1-sym\expandafter\endcsname\else
+ \ifvmode\hbox_unpack:N\c_empty_box\fi
+ \symref{#1-sym}{\hbox{#3}}\expandafter\xspace
+ \fi
+ }
+ }
+ \stex_execute_in_module:x{
+ \__stex_notation_restore_notation:nnnnn
+ {\l_stex_current_module_str?\tl_if_empty:NTF\l__stex_symdecl_name_str{#1}\l__stex_symdecl_name_str}
+ {}{0}
+ {\exp_not:n{\STEXInternalTermMathOMSiiii{\STEXInternalCurrentSymbolStr}{}{\neginfprec}{
+ \comp{\hbox{#3}}\STEXInternalSymbolAfterInvokationTL
+ }}}
+ {}
}
+ \stex_smsmode_do:
}
\str_new:N \l_stex_get_symbol_uri_str
\cs_new_protected:Nn \stex_get_symbol:n {
\tl_if_head_eq_catcode:nNTF { #1 } \relax {
- \__stex_symdecl_get_symbol_from_cs:n { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \__stex_symdecl_get_symbol_from_cs:
}{
% argument is a string
% is it a command name?
@@ -2031,7 +2374,7 @@
\exp_args:Nx \cs_if_eq:NNTF {
\tl_head:N \l_tmpa_tl
} \stex_invoke_symbol:n {
- \exp_args:No \__stex_symdecl_get_symbol_from_cs:n { \use:c { #1 } }
+ \__stex_symdecl_get_symbol_from_cs:
}{
\__stex_symdecl_get_symbol_from_string:n { #1 }
}
@@ -2059,28 +2402,52 @@
\cs_new_protected:Nn \__stex_symdecl_get_symbol_from_string:n {
\tl_set:Nn \l_tmpa_tl {
- \msg_set:nnn{stex}{error/unknownsymbol}{
- No~symbol~#1~found!
- }
- \msg_error:nn{stex}{error/unknownsymbol}
+ \msg_error:nnn{stex}{error/unknownsymbol}{#1}
}
\str_set:Nn \l_tmpa_str { #1 }
- \int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
- \stex_all_symbols:n {
- \str_if_eq:eeT { \l_tmpa_str }{ \str_range:nnn {##1}{-\l_tmpa_int}{-1}}{
- \seq_map_break:n{\seq_map_break:n{
- \tl_set:Nn \l_tmpa_tl {
- \str_set:Nn \l_stex_get_symbol_uri_str { ##1 }
+ %\int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
+
+ \str_if_in:NnTF \l_tmpa_str ? {
+ \exp_args:NNno \seq_set_split:Nnn \l_tmpa_seq ? \l_tmpa_str
+ \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ \str_set:Nx \l_tmpb_str {\seq_use:Nn \l_tmpa_seq ?}
+ }{
+ \str_clear:N \l_tmpb_str
+ }
+ \str_if_empty:NTF \l_tmpb_str {
+ \seq_map_inline:Nn \l_stex_all_modules_seq {
+ \seq_map_inline:cn{c_stex_module_##1_constants}{
+ \exp_args:Nno \str_if_eq:nnT{####1} \l_tmpa_str {
+ \seq_map_break:n{\seq_map_break:n{
+ \tl_set:Nn \l_tmpa_tl {
+ \str_set:Nn \l_stex_get_symbol_uri_str { ##1 ? ####1 }
+ }
+ }}
}
- }}
+ }
+ }
+ }{
+ \int_set:Nn \l_tmpa_int { \str_count:N \l_tmpb_str }
+ \seq_map_inline:Nn \l_stex_all_modules_seq {
+ \str_if_eq:eeT{ \l_tmpb_str }{ \str_range:nnn {##1}{-\l_tmpa_int}{-1}}{
+ \seq_map_inline:cn{c_stex_module_##1_constants}{
+ \exp_args:Nno \str_if_eq:nnT{####1} \l_tmpa_str {
+ \seq_map_break:n{\seq_map_break:n{
+ \tl_set:Nn \l_tmpa_tl {
+ \str_set:Nn \l_stex_get_symbol_uri_str { ##1 ? ####1 }
+ }
+ }}
+ }
+ }
+ }
}
}
\l_tmpa_tl
}
-\cs_new_protected:Nn \__stex_symdecl_get_symbol_from_cs:n {
+\cs_new_protected:Nn \__stex_symdecl_get_symbol_from_cs: {
\exp_args:NNx \tl_set:Nn \l_tmpa_tl
{ \tl_tail:N \l_tmpa_tl }
\tl_if_single:NTF \l_tmpa_tl {
@@ -2097,7 +2464,6 @@
}
}
\keys_define:nn { stex / notation } {
- lang .tl_set_x:N = \l__stex_notation_lang_str ,
variant .tl_set_x:N = \l__stex_notation_variant_str ,
prec .str_set_x:N = \l__stex_notation_prec_str ,
op .tl_set:N = \l__stex_notation_op_tl ,
@@ -2108,7 +2474,6 @@
}
\cs_new_protected:Nn \_stex_notation_args:n {
- \str_clear:N \l__stex_notation_lang_str
\str_clear:N \l__stex_notation_variant_str
\str_clear:N \l__stex_notation_prec_str
\tl_clear:N \l__stex_notation_op_tl
@@ -2125,26 +2490,28 @@
\IfBooleanTF#1{
\stex_setnotation:n {\l_stex_get_symbol_uri_str}
}{}
- \stex_smsmode_do:
+ \stex_smsmode_do:\ignorespacesandpars
}
- \stex_notation_do:nnnn
+ \stex_notation_do:nnnnn
{ \prop_item:cn {l_stex_symdecl_\l_stex_get_symbol_uri_str _prop } { args } }
{ \prop_item:cn { l_stex_symdecl_\l_stex_get_symbol_uri_str _prop } { arity } }
- { \l__stex_notation_variant_str \c_hash_str \l__stex_notation_lang_str }
+ { \l__stex_notation_variant_str }
+ { \l__stex_notation_prec_str}
}
\stex_deactivate_macro:Nn \notation {module~environments}
\seq_new:N \l__stex_notation_precedences_seq
\tl_new:N \l__stex_notation_opprec_tl
\int_new:N \l__stex_notation_currarg_int
-\tl_new:N \stex_symbol_after_invocation_tl
+\tl_new:N \STEXInternalSymbolAfterInvokationTL
-\cs_new_protected:Nn \stex_notation_do:nnnn {
- \let\l_stex_current_symbol_str\relax
+\cs_new_protected:Nn \stex_notation_do:nnnnn {
+ \let\STEXInternalCurrentSymbolStr\relax
\seq_clear:N \l__stex_notation_precedences_seq
\tl_clear:N \l__stex_notation_opprec_tl
\str_set:Nx \l__stex_notation_args_str { #1 }
\str_set:Nx \l__stex_notation_arity_str { #2 }
- \str_set:Nx \__stex_notation_suffix_str { #3 }
+ \str_set:Nx \l__stex_notation_suffix_str { #3 }
+ \str_set:Nx \l__stex_notation_prec_str { #4 }
% precedences
\str_if_empty:NTF \l__stex_notation_prec_str {
@@ -2195,10 +2562,10 @@
\int_compare:nNnTF \l__stex_notation_arity_str = 0 {
\exp_args:NNe
\cs_set:Npn \l_stex_notation_macrocode_cs {
- \_stex_term_math_oms:nnnn { \l_stex_current_symbol_str }
- { \__stex_notation_suffix_str }
+ \STEXInternalTermMathOMSiiii { \STEXInternalCurrentSymbolStr }
+ { \l__stex_notation_suffix_str }
{ \l__stex_notation_opprec_tl }
- { \exp_not:n { #4 } }
+ { \exp_not:n { #5 } }
}
\l_stex_notation_after_do_tl
}{
@@ -2207,10 +2574,10 @@
{
\cs_generate_from_arg_count:NNnn \l_stex_notation_macrocode_cs
\cs_set:Npn \l__stex_notation_arity_str } { {
- \_stex_term_math_omb:nnnn { \l_stex_current_symbol_str }
- { \__stex_notation_suffix_str }
+ \STEXInternalTermMathOMBiiii { \STEXInternalCurrentSymbolStr }
+ { \l__stex_notation_suffix_str }
{ \l__stex_notation_opprec_tl }
- { \exp_not:n { #4 } }
+ { \exp_not:n { #5 } }
}}
}{
\str_if_in:NnTF \l__stex_notation_args_str B {
@@ -2218,20 +2585,20 @@
{
\cs_generate_from_arg_count:NNnn \l_stex_notation_macrocode_cs
\cs_set:Npn \l__stex_notation_arity_str } { {
- \_stex_term_math_omb:nnnn { \l_stex_current_symbol_str }
- { \__stex_notation_suffix_str }
+ \STEXInternalTermMathOMBiiii { \STEXInternalCurrentSymbolStr }
+ { \l__stex_notation_suffix_str }
{ \l__stex_notation_opprec_tl }
- { \exp_not:n { #4 } }
+ { \exp_not:n { #5 } }
} }
}{
\exp_args:Nne \use:nn
{
\cs_generate_from_arg_count:NNnn \l_stex_notation_macrocode_cs
\cs_set:Npn \l__stex_notation_arity_str } { {
- \_stex_term_math_oma:nnnn { \l_stex_current_symbol_str }
- { \__stex_notation_suffix_str }
+ \STEXInternalTermMathOMAiiii { \STEXInternalCurrentSymbolStr }
+ { \l__stex_notation_suffix_str }
{ \l__stex_notation_opprec_tl }
- { \exp_not:n { #4 } }
+ { \exp_not:n { #5 } }
} }
}
}
@@ -2250,16 +2617,16 @@
\str_set:Nx \l_tmpa_str { \str_head:N \l__stex_notation_remaining_args_str }
\str_set:Nx \l__stex_notation_remaining_args_str { \str_tail:N \l__stex_notation_remaining_args_str }
\str_if_eq:VnTF \l_tmpa_str a {
- \__stex_notation_argument_assoc:n
+ \__stex_notation_argument_assoc:nn{a}
}{
\str_if_eq:VnTF \l_tmpa_str B {
- \__stex_notation_argument_assoc:n
+ \__stex_notation_argument_assoc:nn{B}
}{
- \seq_pop_left:NN \l__stex_notation_remaining_precs_seq \l_tmpa_str
+ \seq_pop_left:NN \l__stex_notation_remaining_precs_seq \l_tmpb_str
\tl_put_right:Nx \l_stex_notation_dummyargs_tl {
- { \_stex_term_math_arg:nnn
- { \int_use:N \l__stex_notation_currarg_int }
- { \l_tmpa_str }
+ { \STEXInternalTermMathArgiii
+ { \l_tmpa_str\int_use:N \l__stex_notation_currarg_int }
+ { \l_tmpb_str }
{ ####\int_use:N \l__stex_notation_currarg_int }
}
}
@@ -2268,11 +2635,11 @@
}
}
}
-\cs_new_protected:Nn \__stex_notation_argument_assoc:n {
+\cs_new_protected:Nn \__stex_notation_argument_assoc:nn {
\cs_generate_from_arg_count:NNnn \l_tmpa_cs \cs_set:Npn
{\l__stex_notation_arity_str}{
- #1
+ #2
}
\int_zero:N \l_tmpa_int
\tl_clear:N \l_tmpa_tl
@@ -2281,7 +2648,7 @@
\tl_put_right:Nx \l_tmpa_tl {
\str_if_eq:nnTF {##1}{a}{ {} }{
\str_if_eq:nnTF {##1}{B}{ {} }{
- {\_stex_term_arg:nn{\int_use:N \l_tmpa_int}{################ \int_use:N \l_tmpa_int}}
+ {\_stex_term_arg:nn{##1\int_use:N \l_tmpa_int}{################ \int_use:N \l_tmpa_int}}
}
}
}
@@ -2301,184 +2668,133 @@
\seq_pop_left:NN \l__stex_notation_remaining_precs_seq \l_tmpa_str
\tl_put_right:Nx \l_stex_notation_dummyargs_tl { {
- \_stex_term_math_assoc_arg:nnnn
- { \int_use:N \l__stex_notation_currarg_int }
+ \STEXInternalTermMathAssocArgiiii
+ { #1\int_use:N \l__stex_notation_currarg_int }
{ \l_tmpa_str }
{ ####\int_use:N \l__stex_notation_currarg_int }
{ \l_tmpa_cs {####1} {####2} }
} }
\__stex_notation_arguments:
}
-\cs_new_protected:Nn \__stex_notation_final: {
- \exp_args:Nne \use:nn
- {
- \cs_generate_from_arg_count:cNnn {
- stex_notation_ \l_stex_get_symbol_uri_str \c_hash_str
- \__stex_notation_suffix_str
- _cs
- }
- \cs_set:Npn \l__stex_notation_arity_str } { {
- \exp_after:wN \exp_after:wN \exp_after:wN
- \exp_not:n \exp_after:wN \exp_after:wN \exp_after:wN
- { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \stex_symbol_after_invocation_tl}
- } }
-
- \tl_if_empty:NF \l__stex_notation_op_tl {
- \cs_set:cpx {
- stex_op_notation_ \l_stex_get_symbol_uri_str \c_hash_str
- \__stex_notation_suffix_str
- _cs
- } {
- \_stex_term_oms:nnn {
- \l_stex_get_symbol_uri_str \c_hash_str \__stex_notation_suffix_str
- }{
- \l_stex_get_symbol_uri_str
- }{ \comp{ \exp_args:No \exp_not:n { \l__stex_notation_op_tl } } }
- }
+\cs_new_protected:Nn \__stex_notation_restore_notation:nnnnn {
+ \cs_generate_from_arg_count:cNnn{stex_notation_\detokenize{#1} \c_hash_str \detokenize{#2}_cs}
+ \cs_set_nopar:Npn {#3}{#4}
+ \tl_if_empty:nF {#5}{
+ \tl_set:cn{stex_op_notation_\detokenize{#1} \c_hash_str \detokenize{#2}_cs}{ \comp{ #5 } }
}
+ \seq_if_exist:cT { l_stex_symdecl_\detokenize{#1} _notations }{
+ \seq_put_right:cx { l_stex_symdecl_\detokenize{#1} _notations } { \detokenize{#2} }
+ }
+}
- \exp_args:Ne
- \stex_add_to_current_module:n {
- \cs_generate_from_arg_count:cNnn {
- stex_notation_ \l_stex_get_symbol_uri_str \c_hash_str
- \__stex_notation_suffix_str
- _cs
- } \cs_set:Npn {\l__stex_notation_arity_str} {
+\cs_new_protected:Nn \__stex_notation_final: {
+
+ \stex_execute_in_module:x {
+ \__stex_notation_restore_notation:nnnnn
+ {\l_stex_get_symbol_uri_str}
+ {\l__stex_notation_suffix_str}
+ {\l__stex_notation_arity_str}
+ {
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_not:n \exp_after:wN \exp_after:wN \exp_after:wN
- { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \stex_symbol_after_invocation_tl}
- }
- \tl_if_empty:NF \l__stex_notation_op_tl {
- \cs_set:cpn {
- stex_op_notation_\l_stex_get_symbol_uri_str \c_hash_str
- \__stex_notation_suffix_str
- _cs
- } {
- \_stex_term_oms:nnn {
- \l_stex_get_symbol_uri_str\c_hash_str \__stex_notation_suffix_str
- }{
- \l_stex_get_symbol_uri_str
- }{ \comp{ \exp_args:No \exp_not:n { \l__stex_notation_op_tl } } }
+ { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \STEXInternalSymbolAfterInvokationTL}
}
- }
+ {\exp_args:No \exp_not:n \l__stex_notation_op_tl }
}
- %\exp_args:Nx
- % \stex_do_up_to_module:n {
- \seq_put_right:cx {
- l_stex_symdecl_ \l_stex_get_symbol_uri_str
- _notations
- } {
- \__stex_notation_suffix_str
- }
- % }
\stex_debug:nn{symbols}{
- Notation~\__stex_notation_suffix_str
+ Notation~\l__stex_notation_suffix_str
~for~\l_stex_get_symbol_uri_str^^J
Operator~precedence:~\l__stex_notation_opprec_tl^^J
Argument~precedences:~
\seq_use:Nn \l__stex_notation_precedences_seq {,~}^^J
Notation: \cs_meaning:c {
stex_notation_ \l_stex_get_symbol_uri_str \c_hash_str
- \__stex_notation_suffix_str
+ \l__stex_notation_suffix_str
_cs
}
}
-
- \exp_args:Ne
- \stex_add_to_current_module:n {
- \seq_put_right:cn {
- l_stex_symdecl_\l_stex_get_symbol_uri_str
- _notations
- } { \__stex_notation_suffix_str }
- }
-
- \stex_if_smsmode:F {
-
% HTML annotations
- \stex_if_do_html:T {
- \stex_annotate_invisible:nnn { notation }
- { \l_stex_get_symbol_uri_str } {
- \stex_annotate_invisible:nnn { notationfragment }
- { \__stex_notation_suffix_str }{}
- \stex_annotate_invisible:nnn { precedence }
- { \l__stex_notation_prec_str }{}
-
- \int_zero:N \l_tmpa_int
- \str_set_eq:NN \l__stex_notation_remaining_args_str \l__stex_notation_args_str
- \tl_clear:N \l_tmpa_tl
- \int_step_inline:nn { \l__stex_notation_arity_str }{
- \int_incr:N \l_tmpa_int
- \str_set:Nx \l_tmpb_str { \str_head:N \l__stex_notation_remaining_args_str }
- \str_set:Nx \l__stex_notation_remaining_args_str { \str_tail:N \l__stex_notation_remaining_args_str }
- \str_if_eq:VnTF \l_tmpb_str a {
+ \stex_if_do_html:T {
+ \stex_annotate_invisible:nnn { notation }
+ { \l_stex_get_symbol_uri_str } {
+ \stex_annotate_invisible:nnn { notationfragment }
+ { \l__stex_notation_suffix_str }{}
+ \stex_annotate_invisible:nnn { precedence }
+ { \l__stex_notation_prec_str }{}
+
+ \int_zero:N \l_tmpa_int
+ \str_set_eq:NN \l__stex_notation_remaining_args_str \l__stex_notation_args_str
+ \tl_clear:N \l_tmpa_tl
+ \int_step_inline:nn { \l__stex_notation_arity_str }{
+ \int_incr:N \l_tmpa_int
+ \str_set:Nx \l_tmpb_str { \str_head:N \l__stex_notation_remaining_args_str }
+ \str_set:Nx \l__stex_notation_remaining_args_str { \str_tail:N \l__stex_notation_remaining_args_str }
+ \str_if_eq:VnTF \l_tmpb_str a {
+ \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int a}{} ,
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int b}{}
+ } }
+ }{
+ \str_if_eq:VnTF \l_tmpb_str B {
\tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int a ,
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int b
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int a}{} ,
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int b}{}
} }
}{
- \str_if_eq:VnTF \l_tmpb_str B {
- \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int a ,
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int b
- } }
- }{
- \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int
- } }
- }
+ \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int}{}
+ } }
}
}
- \stex_annotate_invisible:nnn { notationcomp }{}{
- \str_set:Nx \l_stex_current_symbol_str {\l_stex_get_symbol_uri_str }
- $ \exp_args:Nno \use:nn { \use:c {
- stex_notation_ \l_stex_current_symbol_str
- \c_hash_str \__stex_notation_suffix_str _cs
- } } { \l_tmpa_tl } $
+ }
+ \stex_annotate_invisible:nnn { notationcomp }{}{
+ \str_set:Nx \STEXInternalCurrentSymbolStr {\l_stex_get_symbol_uri_str }
+ $ \exp_args:Nno \use:nn { \use:c {
+ stex_notation_ \STEXInternalCurrentSymbolStr
+ \c_hash_str \l__stex_notation_suffix_str _cs
+ } } { \l_tmpa_tl } $
+ }
+ \tl_if_empty:NF \l__stex_notation_op_tl {
+ \stex_annotate_invisible:nnn { notationopcomp }{}{
+ $\l__stex_notation_op_tl$
}
}
}
}
}
\keys_define:nn { stex / setnotation } {
- lang .tl_set_x:N = \l__stex_notation_lang_str ,
variant .tl_set_x:N = \l__stex_notation_variant_str ,
unknown .code:n = \str_set:Nx
\l__stex_notation_variant_str \l_keys_key_str
}
\cs_new_protected:Nn \_stex_setnotation_args:n {
- \str_clear:N \l__stex_notation_lang_str
+ % \str_clear:N \l__stex_notation_lang_str
\str_clear:N \l__stex_notation_variant_str
\keys_set:nn { stex / setnotation } { #1 }
}
+\cs_new_protected:Nn \__stex_notation_setnotation:nn {
+ \seq_if_exist:cT{l_stex_symdecl_#1_notations}{
+ \seq_remove_all:cn { l_stex_symdecl_#1 _notations }{ #2 }
+ \seq_put_left:cn { l_stex_symdecl_#1 _notations }{ #2 }
+ }
+}
+
\cs_new_protected:Nn \stex_setnotation:n {
\exp_args:Nnx \seq_if_in:cnTF { l_stex_symdecl_#1 _notations }
- { \l__stex_notation_variant_str \c_hash_str \l__stex_notation_lang_str }{
- \exp_args:Nnx \seq_remove_all:cn { l_stex_symdecl_#1 _notations }
- { \l__stex_notation_variant_str \c_hash_str \l__stex_notation_lang_str }
- \exp_args:Nnx \seq_remove_all:cn { l_stex_symdecl_#1 _notations }
- { \c_hash_str }
- \exp_args:Nnx \seq_put_left:cn { l_stex_symdecl_#1 _notations }
- { \l__stex_notation_variant_str \c_hash_str \l__stex_notation_lang_str }
- \exp_args:Nx \stex_add_to_current_module:n {
- \exp_args:Nnx \seq_remove_all:cn { l_stex_symdecl_#1 _notations }
- { \l__stex_notation_variant_str \c_hash_str \l__stex_notation_lang_str }
- \exp_args:Nnx \seq_put_left:cn { l_stex_symdecl_#1 _notations }
- { \l__stex_notation_variant_str \c_hash_str \l__stex_notation_lang_str }
- \exp_args:Nnx \seq_remove_all:cn { l_stex_symdecl_#1 _notations }
- { \c_hash_str }
- }
+ { \l__stex_notation_variant_str }{
+ \stex_execute_in_module:x{ \__stex_notation_setnotation:nn {#1}{\l__stex_notation_variant_str} }
\stex_debug:nn {notations}{
Setting~default~notation~
- {\l__stex_notation_variant_str \c_hash_str \l__stex_notation_lang_str}~for~
+ {\l__stex_notation_variant_str }~for~
#1 \\
\expandafter\meaning\csname
l_stex_symdecl_#1 _notations\endcsname
}
}{
- % todo throw error
+ \msg_error:nnxx{stex}{unknownnotation}{\l__stex_notation_variant_str}{#1}
}
}
@@ -2486,7 +2802,7 @@
\stex_get_symbol:n { #1 }
\_stex_setnotation_args:n { #2 }
\stex_setnotation:n{\l_stex_get_symbol_uri_str}
- \stex_smsmode_do:
+ \stex_smsmode_do:\ignorespacesandpars
}
\cs_new_protected:Nn \stex_copy_notations:nn {
@@ -2496,9 +2812,10 @@
}
\tl_clear:N \l_tmpa_tl
\int_step_inline:nn { \prop_item:cn {l_stex_symdecl_#2_prop}{ arity } } {
- \tl_put_right:Nn \l_tmpa_tl { {## ##1} }
+ \tl_put_right:Nn \l_tmpa_tl { {######## ##1} }
}
- \seq_map_inline:cn {l_stex_symdecl_#2_notations}{
+ \seq_map_inline:cn {l_stex_symdecl_#2_notations}{\begingroup
+ \stex_debug:nn{Here}{Here:~##1}
\cs_set_eq:Nc \l_tmpa_cs { stex_notation_ #2 \c_hash_str ##1 _cs }
\edef \l_tmpa_tl {
\exp_after:wN\exp_after:wN\exp_after:wN \exp_not:n
@@ -2506,15 +2823,30 @@
\exp_after:wN \l_tmpa_cs \l_tmpa_tl
}
}
- \exp_args:Nx
- \stex_do_up_to_module:n {
- \seq_put_right:cn{l_stex_symdecl_#1_notations}{##1}
- \cs_generate_from_arg_count:cNnn {
- stex_notation_ #1 \c_hash_str ##1 _cs
- } \cs_set:Npn { \prop_item:cn {l_stex_symdecl_#2_prop}{ arity } }{
- \exp_after:wN\exp_not:n\exp_after:wN{\l_tmpa_tl}
+
+ \exp_after:wN \def \exp_after:wN \l_tmpa_tl
+ \exp_after:wN ####\exp_after:wN 1 \exp_after:wN ####\exp_after:wN 2
+ \exp_after:wN { \l_tmpa_tl }
+
+ \edef \l_tmpa_tl {
+ \exp_after:wN \exp_not:n \exp_after:wN {
+ \l_tmpa_tl {######## 1}{######## 2}
}
}
+
+ \stex_debug:nn{Here}{Here:~\expandafter\detokenize\expandafter{\l_tmpa_tl}}
+
+ \stex_execute_in_module:x {
+ \__stex_notation_restore_notation:nnnnn
+ {#1}{##1}
+ { \prop_item:cn {l_stex_symdecl_#2_prop}{ arity } }
+ { \exp_after:wN\exp_not:n\exp_after:wN{\l_tmpa_tl} }
+ {
+ \cs_if_exist:cT{stex_op_notation_ #2\c_hash_str ##1 _cs}{
+ \exp_args:NNo\exp_args:No\exp_not:n{\csname stex_op_notation_ #2\c_hash_str ##1 _cs\endcsname}
+ }
+ }
+ }\endgroup
}
}
@@ -2524,10 +2856,7 @@
\stex_get_symbol:n { #2 }
\exp_args:Noo
\stex_copy_notations:nn \l_tmpa_str \l_stex_get_symbol_uri_str
- \exp_args:Nx \stex_add_import_to_current_module:n{
- \stex_copy_notations:nn {\l_tmpa_str} {\l_stex_get_symbol_uri_str}
- }
- \stex_smsmode_do:
+ \stex_smsmode_do:\ignorespacesandpars
}
\keys_define:nn { stex / symdef } {
@@ -2536,8 +2865,9 @@
args .str_set_x:N = \l_stex_symdecl_args_str ,
type .tl_set:N = \l_stex_symdecl_type_tl ,
def .tl_set:N = \l_stex_symdecl_definiens_tl ,
+ reorder .str_set_x:N = \l_stex_symdecl_reorder_str ,
op .tl_set:N = \l__stex_notation_op_tl ,
- lang .str_set_x:N = \l__stex_notation_lang_str ,
+ % lang .str_set_x:N = \l__stex_notation_lang_str ,
variant .str_set_x:N = \l__stex_notation_variant_str ,
prec .str_set_x:N = \l__stex_notation_prec_str ,
assoc .choices:nn =
@@ -2551,10 +2881,11 @@
\str_clear:N \l_stex_symdecl_name_str
\str_clear:N \l_stex_symdecl_args_str
\str_clear:N \l_stex_symdecl_assoctype_str
+ \str_clear:N \l_stex_symdecl_reorder_str
\bool_set_false:N \l_stex_symdecl_local_bool
\tl_clear:N \l_stex_symdecl_type_tl
\tl_clear:N \l_stex_symdecl_definiens_tl
- \str_clear:N \l__stex_notation_lang_str
+ % \str_clear:N \l__stex_notation_lang_str
\str_clear:N \l__stex_notation_variant_str
\str_clear:N \l__stex_notation_prec_str
\tl_clear:N \l__stex_notation_op_tl
@@ -2568,15 +2899,16 @@
\stex_symdecl_do:n { #1 }
\tl_set:Nn \l_stex_notation_after_do_tl {
\__stex_notation_final:
- \stex_smsmode_do:
+ \stex_smsmode_do:\ignorespacesandpars
}
\str_set:Nx \l_stex_get_symbol_uri_str {
\l_stex_current_module_str ? \l_stex_symdecl_name_str
}
- \exp_args:Nx \stex_notation_do:nnnn
+ \exp_args:Nx \stex_notation_do:nnnnn
{ \prop_item:cn {l_stex_symdecl_\l_stex_get_symbol_uri_str _prop } { args } }
{ \prop_item:cn { l_stex_symdecl_\l_stex_get_symbol_uri_str _prop } { arity } }
- { \l__stex_notation_variant_str \c_hash_str \l__stex_notation_lang_str }
+ { \l__stex_notation_variant_str }
+ { \l__stex_notation_prec_str}
}
\stex_deactivate_macro:Nn \symdef {module~environments}
@@ -2587,6 +2919,7 @@
def .tl_set:N = \l__stex_variables_def_tl ,
op .tl_set:N = \l__stex_variables_op_tl ,
prec .str_set_x:N = \l__stex_variables_prec_str ,
+ reorder .str_set_x:N = \l__stex_variables_reorder_str ,
assoc .choices:nn =
{bin,binl,binr,pre,conj,pwconj}
{\str_set:Nx \l__stex_variables_assoctype_str {\l_keys_choice_tl}},
@@ -2600,6 +2933,7 @@
\str_clear:N \l__stex_variables_args_str
\str_clear:N \l__stex_variables_prec_str
\str_clear:N \l__stex_variables_assoctype_str
+ \str_clear:N \l__stex_variables_reorder_str
\str_clear:N \l__stex_variables_bind_str
\tl_clear:N \l__stex_variables_type_tl
\tl_clear:N \l__stex_variables_def_tl
@@ -2665,11 +2999,7 @@
\tl_if_empty:NF \l__stex_variables_op_tl {
\cs_set:cpx {
stex_var_op_notation_ \l__stex_variables_name_str _cs
- } {
- \_stex_term_omv:nn {
- var://\l__stex_variables_name_str
- }{ \comp{ \exp_args:No \exp_not:n { \l__stex_variables_op_tl } } }
- }
+ } { \exp_not:N\comp{ \exp_args:No \exp_not:n { \l__stex_variables_op_tl } } }
}
\tl_set:Nn \l_stex_notation_after_do_tl {
@@ -2679,14 +3009,14 @@
} {{
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_not:n \exp_after:wN \exp_after:wN \exp_after:wN
- { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \stex_symbol_after_invocation_tl}
+ { \exp_after:wN \l_stex_notation_macrocode_cs \l_stex_notation_dummyargs_tl \STEXInternalSymbolAfterInvokationTL}
}}
\stex_if_do_html:T {
\stex_annotate_invisible:nnn {vardecl}{\l__stex_variables_name_str}{
\stex_annotate_invisible:nnn { precedence }
{ \l__stex_variables_prec_str }{}
\tl_if_empty:NF \l__stex_variables_type_tl {\stex_annotate_invisible:nnn{type}{}{$\l__stex_variables_type_tl$}}
- \stex_annotate_invisible:nnn{args}{}{ \l__stex_variables_args_str }
+ \stex_annotate_invisible:nnn{args}{ \l__stex_variables_args_str }{}
\stex_annotate_invisible:nnn{macroname}{#1}{}
\tl_if_empty:NF \l__stex_variables_def_tl {
\stex_annotate_invisible:nnn{definiens}{}
@@ -2695,6 +3025,9 @@
\str_if_empty:NF \l__stex_variables_assoctype_str {
\stex_annotate_invisible:nnn{assoctype}{\l__stex_variables_assoctype_str}{}
}
+ \str_if_empty:NF \l__stex_variables_reorder_str {
+ \stex_annotate_invisible:nnn{reorderargs}{\l__stex_variables_reorder_str}{}
+ }
\int_zero:N \l_tmpa_int
\str_set_eq:NN \l__stex_variables_remaining_args_str \l__stex_variables_args_str
\tl_clear:N \l_tmpa_tl
@@ -2704,36 +3037,44 @@
\str_set:Nx \l__stex_variables_remaining_args_str { \str_tail:N \l__stex_variables_remaining_args_str }
\str_if_eq:VnTF \l_tmpb_str a {
\tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int a ,
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int b
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int a}{} ,
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int b}{}
} }
}{
\str_if_eq:VnTF \l_tmpb_str B {
\tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int a ,
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int b
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int a}{} ,
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int b}{}
} }
}{
\tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
- \c_hash_str \c_hash_str \int_use:N \l_tmpa_int
+ \stex_annotate:nnn{argmarker}{\int_use:N \l_tmpa_int}{}
} }
}
}
}
\stex_annotate_invisible:nnn { notationcomp }{}{
- \str_set:Nx \l_stex_current_symbol_str {var://\l__stex_variables_name_str }
+ \str_set:Nx \STEXInternalCurrentSymbolStr {var://\l__stex_variables_name_str }
$ \exp_args:Nno \use:nn { \use:c {
stex_var_notation_\l__stex_variables_name_str _cs
} } { \l_tmpa_tl } $
}
+ \tl_if_empty:NF \l__stex_variables_op_tl {
+ \stex_annotate_invisible:nnn { notationopcomp }{}{
+ $\l__stex_variables_op_tl$
+ }
+ }
}
- }
+ \str_if_empty:NF \l__stex_variables_bind_str {
+ \stex_annotate_invisible:nnn {bindtype}{\l__stex_variables_bind_str,\l__stex_variables_name_str}{}
+ }
+ }\ignorespacesandpars
}
- \stex_notation_do:nnnn { \l__stex_variables_args_str } { \prop_item:Nn \l_tmpa_prop { arity } } {}
+ \stex_notation_do:nnnnn { \l__stex_variables_args_str } { \prop_item:Nn \l_tmpa_prop { arity } } {}{ \l__stex_variables_prec_str}
}
-\cs_new:Nn \__stex_variables_reset:N {
+\cs_new:Nn \_stex_reset:N {
\tl_if_exist:NTF #1 {
\def \exp_not:N #1 { \exp_args:No \exp_not:n #1 }
}{
@@ -2745,13 +3086,13 @@
\clist_set:Nx \l__stex_variables_names { \tl_to_str:n {#1} }
\exp_args:Nnx \use:nn {
% TODO
- \stex_annotate_invisible:nnn {vardecls}{\clist_use:Nn\l__stex_variables_names,}{
+ \stex_annotate_invisible:nnn {vardecl}{\clist_use:Nn\l__stex_variables_names,}{
#2
}
}{
- \__stex_variables_reset:N \varnot
- \__stex_variables_reset:N \vartype
- \__stex_variables_reset:N \vardefi
+ \_stex_reset:N \varnot
+ \_stex_reset:N \vartype
+ \_stex_reset:N \vardefi
}
}
@@ -2770,8 +3111,140 @@
\str_set:Nn \l_tmpa_str { #1 }
}
\_stex_term_omv:nn {
- var://\l_tmpa_str
- }{ \comp{ #2 } }
+ var://\l_tmpa_str
+ }{
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nx \STEXInternalCurrentSymbolStr { var://\l_tmpa_str }
+ \comp{ #2 }
+ }{
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ }
+ }
+}
+
+\keys_define:nn { stex / varseq } {
+ name .str_set_x:N = \l__stex_variables_name_str ,
+ args .int_set:N = \l__stex_variables_args_int ,
+ type .tl_set:N = \l__stex_variables_type_tl ,
+ mid .tl_set:N = \l__stex_variables_mid_tl ,
+ bind .choices:nn =
+ {forall,exists}
+ {\str_set:Nx \l__stex_variables_bind_str {\l_keys_choice_tl}}
+}
+
+\cs_new_protected:Nn \__stex_variables_seq_args:n {
+ \str_clear:N \l__stex_variables_name_str
+ \int_set:Nn \l__stex_variables_args_int 1
+ \tl_clear:N \l__stex_variables_type_tl
+ \str_clear:N \l__stex_variables_bind_str
+
+ \keys_set:nn { stex / varseq } { #1 }
+}
+
+\NewDocumentCommand \varseq {m O{} m m m}{
+ \__stex_variables_seq_args:n { #2 }
+ \str_if_empty:NT \l__stex_variables_name_str {
+ \str_set:Nx \l__stex_variables_name_str { #1 }
+ }
+ \prop_clear:N \l_tmpa_prop
+ \prop_put:Nnx \l_tmpa_prop { arity }{\int_use:N \l__stex_variables_args_int}
+
+ \seq_set_from_clist:Nn \l_tmpa_seq {#3}
+ \int_compare:nNnF {\seq_count:N \l_tmpa_seq} = \l__stex_variables_args_int {
+ \msg_error:nnxx{stex}{error/seqlength}
+ {\int_use:N \l__stex_variables_args_int}
+ {\seq_count:N \l_tmpa_seq}
+ }
+ \seq_set_from_clist:Nn \l_tmpb_seq {#4}
+ \int_compare:nNnF {\seq_count:N \l_tmpb_seq} = \l__stex_variables_args_int {
+ \msg_error:nnxx{stex}{error/seqlength}
+ {\int_use:N \l__stex_variables_args_int}
+ {\seq_count:N \l_tmpb_seq}
+ }
+ \prop_put:Nnn \l_tmpa_prop {starts} {#3}
+ \prop_put:Nnn \l_tmpa_prop {ends} {#4}
+
+ \cs_generate_from_arg_count:cNnn {stex_varseq_\l__stex_variables_name_str _cs}
+ \cs_set:Npn {\int_use:N \l__stex_variables_args_int} { #5 }
+
+ \exp_args:NNo \tl_set:No \l_tmpa_tl {\use:c{stex_varseq_\l__stex_variables_name_str _cs}}
+ \int_step_inline:nn \l__stex_variables_args_int {
+ \tl_put_right:Nx \l_tmpa_tl { {\seq_item:Nn \l_tmpa_seq {##1}} }
+ }
+ \tl_set:Nx \l_tmpa_tl {\exp_args:NNo \exp_args:No \exp_not:n{\l_tmpa_tl}}
+ \tl_put_right:Nn \l_tmpa_tl {,\ellipses,}
+ \tl_if_empty:NF \l__stex_variables_mid_tl {
+ \tl_put_right:No \l_tmpa_tl \l__stex_variables_mid_tl
+ \tl_put_right:Nn \l_tmpa_tl {,\ellipses,}
+ }
+ \exp_args:NNo \tl_set:No \l_tmpb_tl {\use:c{stex_varseq_\l__stex_variables_name_str _cs}}
+ \int_step_inline:nn \l__stex_variables_args_int {
+ \tl_put_right:Nx \l_tmpb_tl { {\seq_item:Nn \l_tmpb_seq {##1}} }
+ }
+ \tl_set:Nx \l_tmpb_tl {\exp_args:NNo \exp_args:No \exp_not:n{\l_tmpb_tl}}
+ \tl_put_right:No \l_tmpa_tl \l_tmpb_tl
+
+ \prop_put:Nno \l_tmpa_prop { notation }\l_tmpa_tl
+
+ \tl_set:cx {#1} {\stex_invoke_sequence:n {\l__stex_variables_name_str}}
+
+ \exp_args:NNo \tl_set:No \l_tmpa_tl {\use:c{stex_varseq_\l__stex_variables_name_str _cs}}
+
+ \int_step_inline:nn \l__stex_variables_args_int {
+ \tl_set:Nx \l_tmpa_tl {\exp_args:No \exp_not:n \l_tmpa_tl {
+ \STEXInternalTermMathArgiii{i##1}{0}{\exp_not:n{####}##1}
+ }}
+ }
+
+ \tl_set:Nx \l_tmpa_tl {
+ \STEXInternalTermMathOMAiiii { varseq://\l__stex_variables_name_str}{}{0}{
+ \exp_args:NNo \exp_args:No \exp_not:n {\l_tmpa_tl}
+ }
+ }
+
+ \tl_set:No \l_tmpa_tl { \exp_after:wN { \l_tmpa_tl \STEXInternalSymbolAfterInvokationTL} }
+
+ \exp_args:Nno \use:nn {
+ \cs_generate_from_arg_count:cNnn {stex_varseq_\l__stex_variables_name_str _cs}
+ \cs_set:Npn {\int_use:N \l__stex_variables_args_int}}{\l_tmpa_tl}
+
+ \stex_debug:nn{sequences}{New~Sequence:~
+ \expandafter\meaning\csname stex_varseq_\l__stex_variables_name_str _cs\endcsname\\~\\
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ \stex_if_do_html:T{\stex_annotate_invisible:nnn{varseq}{\l__stex_variables_name_str}{
+ \tl_if_empty:NF \l__stex_variables_type_tl {
+ \stex_annotate:nnn {type}{}{$\l__stex_variables_type_tl$}
+ }
+ \stex_annotate:nnn {args}{\int_use:N \l__stex_variables_args_int}{}
+ \str_if_empty:NF \l__stex_variables_bind_str {
+ \stex_annotate:nnn {bindtype}{\l__stex_variables_bind_str}{}
+ }
+ \stex_annotate:nnn{startindex}{}{$#3$}
+ \stex_annotate:nnn{endindex}{}{$#4$}
+
+ \tl_clear:N \l_tmpa_tl
+ \int_step_inline:nn \l__stex_variables_args_int {
+ \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl {
+ \stex_annotate:nnn{argmarker}{##1}{}
+ } }
+ }
+ \stex_annotate_invisible:nnn { notationcomp }{}{
+ \str_set:Nx \STEXInternalCurrentSymbolStr {varseq://\l__stex_variables_name_str }
+ $ \exp_args:Nno \use:nn { \use:c {
+ stex_varseq_\l__stex_variables_name_str _cs
+ } } { \l_tmpa_tl } $
+ }
+ \stex_annotate_invisible:nnn { notationopcomp }{}{
+ $ \prop_item:Nn \l_tmpa_prop { notation } $
+ }
+
+ }}
+
+ \prop_set_eq:cN {stex_varseq_\l__stex_variables_name_str _prop}\l_tmpa_prop
+ \ignorespacesandpars
}
@@ -2788,36 +3261,22 @@
Symbol~#1~has~no~operator~notation~for~notation~#2
}
\msg_new:nnn{stex}{error/notallowed}{
- Symbol~invocation~#1~not~allowed~in~notation~component~of~#2
+ Symbol~invokation~#1~not~allowed~in~notation~component~of~#2
}
-
-\keys_define:nn { stex / terms } {
- lang .tl_set_x:N = \l__stex_terms_lang_str ,
- variant .tl_set_x:N = \l__stex_terms_variant_str ,
- unknown .code:n = \str_set:Nx
- \l__stex_terms_variant_str \l_keys_key_str
+\msg_new:nnn{stex}{error/doubleargument}{
+ Argument~#1~of~symbol~#2~already~assigned
}
-
-\cs_new_protected:Nn \__stex_terms_args:n {
- \str_clear:N \l__stex_terms_lang_str
- \str_clear:N \l__stex_terms_variant_str
-
- \keys_set:nn { stex / terms } { #1 }
+\msg_new:nnn{stex}{error/overarity}{
+ Argument~#1~invalid~for~symbol~#2~with~arity~#3
}
-\cs_new:Nn \__stex_terms_reset:N {
- \tl_if_exist:NTF #1 {
- \def \exp_not:N #1 { \exp_args:No \exp_not:n #1 }
- }{
- \let \exp_not:N #1 \exp_not:N \undefined
- }
-}
-\bool_new:N \l__stex_terms_allow_semantic_bool
-\bool_set_true:N \l__stex_terms_allow_semantic_bool
+\bool_new:N \l_stex_allow_semantic_bool
+\bool_set_true:N \l_stex_allow_semantic_bool
\cs_new_protected:Nn \stex_invoke_symbol:n {
- \bool_if:NTF \l__stex_terms_allow_semantic_bool {
+ \ifvmode\indent\fi
+ \bool_if:NTF \l_stex_allow_semantic_bool {
\str_if_eq:eeF {
\prop_item:cn {
l_stex_symdecl_#1_prop
@@ -2835,7 +3294,7 @@
\exp_after:wN \__stex_terms_invoke_text:n
\fi: { #1 }
}{
- \msg_error:nnxx{stex}{error/notallowed}{#1}{\l_stex_current_symbol_str}
+ \msg_error:nnxx{stex}{error/notallowed}{#1}{\STEXInternalCurrentSymbolStr}
}
}
@@ -2878,38 +3337,49 @@
\cs_new_protected:Nn \__stex_terms_invoke_op_custom:nn {
\exp_args:Nnx \use:nn {
- \str_set:Nn \l_stex_current_symbol_str { #1 }
- \bool_set_false:N \l__stex_terms_allow_semantic_bool
- \_stex_term_oms:nnn {#1 \c_hash_str\c_hash_str}{#1}{
+ \def\comp{\_comp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \_stex_term_oms:nnn {#1}{#1 \c_hash_str CUSTOM-}{
\comp{ #2 }
}
}{
- \__stex_terms_reset:N \l_stex_current_symbol_str
- \bool_set_true:N \l__stex_terms_allow_semantic_bool
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
}
}
-\cs_new_protected:Nn \__stex_terms_find_notation:nn {
- \str_set:Nn \l_stex_current_symbol_str { #1 }
+\keys_define:nn { stex / terms } {
+ variant .tl_set_x:N = \l_stex_notation_variant_str ,
+ unknown .code:n = \str_set:Nx
+ \l_stex_notation_variant_str \l_keys_key_str
+}
+
+\cs_new_protected:Nn \__stex_terms_args:n {
+ % \str_clear:N \l_stex_notation_lang_str
+ \str_clear:N \l_stex_notation_variant_str
+
+ \keys_set:nn { stex / terms } { #1 }
+}
+
+\cs_new_protected:Nn \stex_find_notation:nn {
\__stex_terms_args:n { #2 }
\seq_if_empty:cTF {
l_stex_symdecl_ #1 _notations
} {
\msg_error:nnxx{stex}{error/nonotation}{#1}{s}
} {
- \bool_lazy_all:nTF {
- {\str_if_empty_p:N \l__stex_terms_variant_str}
- {\str_if_empty_p:N \l__stex_terms_lang_str}
- }{
- \seq_get_left:cN {l_stex_symdecl_#1_notations}\l__stex_terms_variant_str
+ \str_if_empty:NTF \l_stex_notation_variant_str {
+ \seq_get_left:cN {l_stex_symdecl_#1_notations}\l_stex_notation_variant_str
}{
\seq_if_in:cxTF {l_stex_symdecl_#1_notations}{
- \l__stex_terms_variant_str \c_hash_str \l__stex_terms_lang_str
+ \l_stex_notation_variant_str
}{
- \str_set:Nx \l__stex_terms_variant_str { \l__stex_terms_variant_str \c_hash_str \l__stex_terms_lang_str }
+ % \str_set:Nx \l_stex_notation_variant_str { \l_stex_notation_variant_str \c_hash_str \l_stex_notation_lang_str }
}{
\msg_error:nnxx{stex}{error/nonotation}{#1}{
- ~\l__stex_terms_variant_str \c_hash_str \l__stex_terms_lang_str
+ ~\l_stex_notation_variant_str
}
}
}
@@ -2917,43 +3387,80 @@
}
\cs_new_protected:Npn \__stex_terms_invoke_op_notation:nw #1 [#2] {
- \__stex_terms_find_notation:nn { #1 }{ #2 }
- \bool_set_false:N \l__stex_terms_allow_semantic_bool
- \cs_if_exist:cTF {
- stex_op_notation_ #1 \c_hash_str \l__stex_terms_variant_str _cs
- }{
- \use:c{stex_op_notation_ #1 \c_hash_str \l__stex_terms_variant_str _cs}
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_comp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
+ \stex_find_notation:nn { #1 }{ #2 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \cs_if_exist:cTF {
+ stex_op_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs
+ }{
+ \_stex_term_oms:nnn { #1 }{
+ #1 \c_hash_str \l_stex_notation_variant_str
+ }{
+ \use:c{stex_op_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs}
+ }
+ }{
+ \int_compare:nNnTF {\prop_item:cn {l_stex_symdecl_#1_prop}{arity}} = 0{
+ \cs_if_exist:cTF {
+ stex_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs
+ }{
+ \tl_set:Nx \STEXInternalSymbolAfterInvokationTL {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalSymbolAfterInvokationTL
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+ \def\comp{\_comp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \use:c{stex_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs}
+ }{
+ \msg_error:nnxx{stex}{error/nonotation}{#1}{
+ ~\l_stex_notation_variant_str
+ }
+ }
+ }{
+ \msg_error:nnxx{stex}{error/noop}{#1}{\l_stex_notation_variant_str}
+ }
+ }
}{
- \msg_error:nnxx{stex}{error/noop}{#1}{\l__stex_terms_variant_str}
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
}
- \bool_set_true:N \l__stex_terms_allow_semantic_bool
}
\cs_new_protected:Npn \__stex_terms_invoke_notation:nw #1 [#2] {
- \__stex_terms_find_notation:nn { #1 }{ #2 }
+ \stex_find_notation:nn { #1 }{ #2 }
\cs_if_exist:cTF {
- stex_notation_ #1 \c_hash_str \l__stex_terms_variant_str _cs
+ stex_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs
}{
- \tl_set:Nx \stex_symbol_after_invocation_tl {
- \__stex_terms_reset:N \stex_symbol_after_invocation_tl
- \__stex_terms_reset:N \l_stex_current_symbol_str
- \bool_set_true:N \l__stex_terms_allow_semantic_bool
- }
- \bool_set_false:N \l__stex_terms_allow_semantic_bool
- \use:c{stex_notation_ #1 \c_hash_str \l__stex_terms_variant_str _cs}
+ \tl_set:Nx \STEXInternalSymbolAfterInvokationTL {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalSymbolAfterInvokationTL
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+ \def\comp{\_comp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \use:c{stex_notation_ #1 \c_hash_str \l_stex_notation_variant_str _cs}
}{
\msg_error:nnxx{stex}{error/nonotation}{#1}{
- ~\l__stex_terms_variant_str
+ ~\l_stex_notation_variant_str
}
}
}
\prop_new:N \l__stex_terms_custom_args_prop
+\cs_new_protected:Nn\__stex_terms_custom_comp:n{\bool_set_false:N \l_stex_allow_semantic_bool\_comp{#1}\bool_set_true:N \l_stex_allow_semantic_bool}
+
\cs_new_protected:Nn \__stex_terms_invoke_custom:nn {
\exp_args:Nnx \use:nn {
- \bool_set_false:N \l__stex_terms_allow_semantic_bool
- \str_set:Nn \l_stex_current_symbol_str { #1 }
+ \def\comp{\__stex_terms_custom_comp:n}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { #1 }
\prop_clear:N \l__stex_terms_custom_args_prop
\prop_put:Nnn \l__stex_terms_custom_args_prop {currnum} {1}
\prop_get:cnN {
@@ -2962,24 +3469,25 @@
\prop_put:Nno \l__stex_terms_custom_args_prop {args} \l_tmpa_str
\tl_set:Nn \arg { \__stex_terms_arg: }
\str_if_empty:NTF \l_tmpa_str {
- \_stex_term_oms:nnn {#1}{#1}{#2}
+ \_stex_term_oms:nnn {#1}{#1\c_hash_str CUSTOM-}{\ignorespaces#2}
}{
\str_if_in:NnTF \l_tmpa_str b {
- \_stex_term_ombind:nnn {#1}{#1}{#2}
+ \_stex_term_ombind:nnn {#1}{#1\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
}{
\str_if_in:NnTF \l_tmpa_str B {
- \_stex_term_ombind:nnn {#1}{#1}{#2}
+ \_stex_term_ombind:nnn {#1}{#1\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
}{
- \_stex_term_oma:nnn {#1}{#1}{#2}
+ \_stex_term_oma:nnn {#1}{#1\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
}
}
}
% TODO check that all arguments exist
}{
- \__stex_terms_reset:N \l_stex_current_symbol_str
- \__stex_terms_reset:N \arg
- \__stex_terms_reset:N \l__stex_terms_custom_args_prop
- \bool_set_true:N \l__stex_terms_allow_semantic_bool
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \_stex_reset:N \arg
+ \_stex_reset:N \comp
+ \_stex_reset:N \l__stex_terms_custom_args_prop
+ %\bool_set_true:N \l_stex_allow_semantic_bool
}
}
@@ -2996,40 +3504,136 @@
}
}{
\int_set:Nn \l_tmpa_int { #2 }
- \exp_args:NNx \prop_if_in:NnT \l__stex_terms_custom_args_prop {\int_use:N \l_tmpa_int} {
- % TODO throw error
- }
}
\str_set:Nx \l_tmpa_str {\prop_item:Nn \l__stex_terms_custom_args_prop {args} }
\int_compare:nNnT \l_tmpa_int > {\str_count:N \l_tmpa_str} {
- % TODO throw error
+ \msg_error:nnxxx{stex}{error/overarity}
+ {\int_use:N \l_tmpa_int}
+ {\STEXInternalCurrentSymbolStr}
+ {\str_count:N \l_tmpa_str}
+ }
+ \str_set:Nx \l_tmpa_str {\str_item:Nn \l_tmpa_str \l_tmpa_int}
+ \exp_args:NNx \prop_if_in:NnT \l__stex_terms_custom_args_prop {\int_use:N \l_tmpa_int} {
+ \bool_lazy_any:nF {
+ {\str_if_eq_p:Vn \l_tmpa_str {a}}
+ {\str_if_eq_p:Vn \l_tmpa_str {B}}
+ }{
+ \msg_error:nnxx{stex}{error/doubleargument}
+ {\int_use:N \l_tmpa_int}
+ {\STEXInternalCurrentSymbolStr}
+ }
}
+ \exp_args:NNx \prop_put:Nnn \l__stex_terms_custom_args_prop {\int_use:N \l_tmpa_int} {\ignorespaces#3}
+ \bool_set_true:N \l_stex_allow_semantic_bool
\IfBooleanTF#1{
- \stex_annotate_invisible:n {
- \exp_args:No \_stex_term_arg:nn {\l_stex_current_symbol_str}{#3}
+ \stex_annotate_invisible:n { %TODO
+ \exp_args:No \_stex_term_arg:nn {\l_tmpa_str\int_use:N \l_tmpa_int}{\ignorespaces#3}
}
- }{
- \exp_args:No \_stex_term_arg:nn {\l_stex_current_symbol_str}{#3}
+ }{ %TODO
+ \exp_args:No \_stex_term_arg:nn {\l_tmpa_str\int_use:N \l_tmpa_int}{\ignorespaces#3}
}
+ \bool_set_false:N \l_stex_allow_semantic_bool
}
\cs_new_protected:Nn \_stex_term_arg:nn {
- \exp_args:Nnx \use:nn {
- \bool_set_true:N \l__stex_terms_allow_semantic_bool
- \stex_annotate:nnn{ arg }{ #1 }{ #2 }
- }{
- \bool_set_false:N \l__stex_terms_allow_semantic_bool
- }
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ \stex_annotate:nnn{ arg }{ #1 }{ #2 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
}
-\cs_new_protected:Nn \_stex_term_math_arg:nnn {
+\cs_new_protected:Npn \STEXInternalTermMathArgiii #1#2#3 {
\exp_args:Nnx \use:nn
{ \int_set:Nn \l__stex_terms_downprec { #2 }
\_stex_term_arg:nn { #1 }{ #3 }
}
{ \int_set:Nn \exp_not:N \l__stex_terms_downprec { \int_use:N \l__stex_terms_downprec } }
}
+\cs_new_protected:Npn \STEXInternalTermMathAssocArgiiii #1#2#3#4 {
+ \cs_set:Npn \l_tmpa_cs ##1 ##2 { #4 }
+ \tl_set:Nn \l_tmpb_tl {\STEXInternalTermMathArgiii{#1}{#2}}
+ \tl_if_empty:nTF { #3 }{
+ \STEXInternalTermMathArgiii{#1}{#2}{}
+ }{
+ \exp_args:Nx \tl_if_empty:nTF { \tl_tail:n{ #3 }}{
+ \expandafter\if\expandafter\relax\noexpand#3
+ \tl_set:Nn \l_tmpa_tl {\__stex_terms_math_assoc_arg_maybe_sequence:Nn#3{#1}}
+ \else
+ \tl_set:Nn \l_tmpa_tl {\__stex_terms_math_assoc_arg_simple:nn{#1}{#3}}
+ \fi
+ \l_tmpa_tl
+ }{
+ \__stex_terms_math_assoc_arg_simple:nn{#1}{#3}
+ }
+ }
+}
+
+\cs_new_protected:Nn \__stex_terms_math_assoc_arg_maybe_sequence:Nn {
+ \str_set:Nx \l_tmpa_str { \cs_argument_spec:N #1 }
+ \str_if_empty:NTF \l_tmpa_str {
+ \exp_args:Nx \cs_if_eq:NNTF {
+ \tl_head:N #1
+ } \stex_invoke_sequence:n {
+ \tl_set:Nx \l_tmpa_tl {\tl_tail:N #1}
+ \str_set:Nx \l_tmpa_str {\exp_after:wN \use:n \l_tmpa_tl}
+ \tl_set:Nx \l_tmpa_tl {\prop_item:cn {stex_varseq_\l_tmpa_str _prop}{notation}}
+ \exp_args:NNo \seq_set_from_clist:Nn \l_tmpa_seq \l_tmpa_tl
+ \tl_set:Nx \l_tmpa_tl {{\exp_not:N \exp_not:n{
+ \exp_not:n{\exp_args:Nnx \use:nn} {
+ \exp_not:n {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr
+ } {varseq://\l_tmpa_str}
+ \exp_not:n{ ##1 }
+ }{
+ \exp_not:n {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ }
+ }
+ }}}
+ \exp_args:Nno \use:nn {\seq_set_map:NNn \l_tmpa_seq \l_tmpa_seq} \l_tmpa_tl
+ \seq_reverse:N \l_tmpa_seq
+ \seq_pop:NN \l_tmpa_seq \l_tmpa_tl
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \exp_args:NNNo \exp_args:NNo \tl_set:No \l_tmpa_tl {
+ \exp_args:Nno
+ \l_tmpa_cs { ##1 } \l_tmpa_tl
+ }
+ }
+ \tl_set:Nx \l_tmpa_tl {
+ \_stex_term_omv:nn {varseq://\l_tmpa_str}{
+ \exp_args:No \exp_not:n \l_tmpa_tl
+ }
+ }
+ \exp_args:No\l_tmpb_tl\l_tmpa_tl
+ }{
+ \__stex_terms_math_assoc_arg_simple:nn{#2} { #1 }
+ }
+ } {
+ \__stex_terms_math_assoc_arg_simple:nn{#2} { #1 }
+ }
+
+}
+\cs_new_protected:Nn \__stex_terms_math_assoc_arg_simple:nn {
+ \clist_set:Nn \l_tmpa_clist{ #2 }
+ \int_compare:nNnTF { \clist_count:N \l_tmpa_clist } < 2 {
+ \tl_set:Nn \l_tmpa_tl { \_stex_term_arg:nn{A#1}{ #2 } }
+ }{
+ \clist_reverse:N \l_tmpa_clist
+ \clist_pop:NN \l_tmpa_clist \l_tmpa_tl
+ \tl_set:Nx \l_tmpa_tl { \_stex_term_arg:nn{A#1}{
+ \exp_args:No \exp_not:n \l_tmpa_tl
+ }}
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \exp_args:NNNo \exp_args:NNo \tl_set:No \l_tmpa_tl {
+ \exp_args:Nno
+ \l_tmpa_cs { \_stex_term_arg:nn{A#1}{##1} } \l_tmpa_tl
+ }
+ }
+ }
+ \exp_args:No\l_tmpb_tl\l_tmpa_tl
+}
\tl_const:Nx \infprec {\int_use:N \c_max_int}
\tl_const:Nx \neginfprec {-\int_use:N \c_max_int}
\int_new:N \l__stex_terms_downprec
@@ -3089,170 +3693,42 @@
}
\cs_new_protected:Nn \_stex_term_oms:nnn {
\stex_annotate:nnn{ OMID }{ #2 }{
- \stex_highlight_term:nn { #1 } { #3 }
+ #3
}
}
-\cs_new_protected:Nn \_stex_term_math_oms:nnnn {
+\cs_new_protected:Npn \STEXInternalTermMathOMSiiii #1#2#3#4 {
\__stex_terms_maybe_brackets:nn { #3 }{
\_stex_term_oms:nnn { #1 } { #1\c_hash_str#2 } { #4 }
}
}
\cs_new_protected:Nn \_stex_term_omv:nn {
- \stex_annotate:nnn{ OMID }{ #1 }{
- \stex_highlight_term:nn { #1 } { #2 }
+ \stex_annotate:nnn{ OMV }{ #1 }{
+ #2
}
}
\cs_new_protected:Nn \_stex_term_oma:nnn {
\stex_annotate:nnn{ OMA }{ #2 }{
- \stex_highlight_term:nn { #1 } { #3 }
+ #3
}
}
-\cs_new_protected:Nn \_stex_term_math_oma:nnnn {
+\cs_new_protected:Npn \STEXInternalTermMathOMAiiii #1#2#3#4 {
\__stex_terms_maybe_brackets:nn { #3 }{
\_stex_term_oma:nnn { #1 } { #1\c_hash_str#2 } { #4 }
}
}
\cs_new_protected:Nn \_stex_term_ombind:nnn {
\stex_annotate:nnn{ OMBIND }{ #2 }{
- \stex_highlight_term:nn { #1 } { #3 }
+ #3
}
}
-\cs_new_protected:Nn \_stex_term_math_omb:nnnn {
+\cs_new_protected:Npn \STEXInternalTermMathOMBiiii #1#2#3#4 {
\__stex_terms_maybe_brackets:nn { #3 }{
\_stex_term_ombind:nnn { #1 } { #1\c_hash_str#2 } { #4 }
}
}
-\cs_new_protected:Nn \_stex_term_math_assoc_arg:nnnn {
- % TODO sequences
- \clist_set:Nn \l_tmpa_clist{ #3 }
- \int_compare:nNnTF { \clist_count:N \l_tmpa_clist } < 2 {
- \tl_set:Nn \l_tmpa_tl { #3 }
- }{
- \cs_set:Npn \l_tmpa_cs ##1 ##2 { #4 }
- \clist_reverse:N \l_tmpa_clist
- \clist_pop:NN \l_tmpa_clist \l_tmpa_tl
-
- \clist_map_inline:Nn \l_tmpa_clist {
- \exp_args:NNNo \exp_args:NNo \tl_set:No \l_tmpa_tl {
- \exp_args:Nno
- \l_tmpa_cs { ##1 } \l_tmpa_tl
- }
- }
- }
- \exp_args:Nnno
- \_stex_term_math_arg:nnn{#1}{#2}\l_tmpa_tl
-}
-\cs_new_protected:Nn \stex_term_custom:nn {
- \str_set:Nn \l__stex_terms_custom_uri { #1 }
- \str_set:Nn \l_tmpa_str { #2 }
- \tl_clear:N \l_tmpa_tl
- \int_zero:N \l_tmpa_int
- \int_set:Nn \l_tmpb_int { \str_count:N \l_tmpa_str }
- \__stex_terms_custom_loop:
-}
-\cs_new_protected:Nn \__stex_terms_custom_loop: {
- \bool_set_false:N \l_tmpa_bool
- \bool_while_do:nn {
- \str_if_eq_p:ee X {
- \str_item:Nn \l_tmpa_str { \l_tmpa_int + 1 }
- }
- }{
- \int_incr:N \l_tmpa_int
- }
-
- \peek_charcode:NTF [ {
- % notation/text component
- \__stex_terms_custom_component:w
- } {
- \int_compare:nNnTF \l_tmpa_int = \l_tmpb_int {
- % all arguments read => finish
- \__stex_terms_custom_final:
- } {
- % arguments missing
- \peek_charcode_remove:NTF * {
- % invisible, specific argument position or both
- \peek_charcode:NTF [ {
- % visible specific argument position
- \__stex_terms_custom_arg:wn
- } {
- % invisible
- \peek_charcode_remove:NTF * {
- % invisible specific argument position
- \__stex_terms_custom_arg_inv:wn
- } {
- % invisible next argument
- \__stex_terms_custom_arg_inv:wn [ \l_tmpa_int + 1 ]
- }
- }
- } {
- % next normal argument
- \__stex_terms_custom_arg:wn [ \l_tmpa_int + 1 ]
- }
- }
- }
-}
-\cs_new_protected:Npn \__stex_terms_custom_arg_inv:wn [ #1 ] #2 {
- \bool_set_true:N \l_tmpa_bool
- \__stex_terms_custom_arg:wn [ #1 ] { #2 }
-}
-\cs_new_protected:Npn \__stex_terms_custom_arg:wn [ #1 ] #2 {
- \str_set:Nx \l_tmpb_str {
- \str_item:Nn \l_tmpa_str { #1 }
- }
- \str_case:VnTF \l_tmpb_str {
- { X } {
- \msg_error:nnx{stex}{error/notationarg}{\l__stex_terms_custom_uri}
- }
- { i } { \__stex_terms_custom_set_X:n { #1 } }
- { b } { \__stex_terms_custom_set_X:n { #1 } }
- { a } { \__stex_terms_custom_set_X:n { #1 } } % TODO ?
- { B } { \__stex_terms_custom_set_X:n { #1 } } % TODO ?
- }{}{
- \msg_error:nnx{stex}{error/notationarg}{\l__stex_terms_custom_uri}
- }
-
- \bool_if:nTF \l_tmpa_bool {
- \tl_put_right:Nx \l_tmpa_tl {
- \stex_annotate_invisible:n {
- \_stex_term_arg:nn { \int_eval:n { #1 } }
- \exp_not:n { { #2 } }
- }
- }
- } {
- \tl_put_right:Nx \l_tmpa_tl {
- \_stex_term_arg:nn { \int_eval:n { #1 } }
- \exp_not:n { { #2 } }
- }
- }
-
- \__stex_terms_custom_loop:
-}
-\cs_new_protected:Nn \__stex_terms_custom_set_X:n {
- \str_set:Nx \l_tmpa_str {
- \str_range:Nnn \l_tmpa_str 1 { #1 - 1 }
- X
- \str_range:Nnn \l_tmpa_str { #1 + 1 } { -1 }
- }
-}
-\cs_new_protected:Npn \__stex_terms_custom_component:w [ #1 ] {
- \tl_put_right:Nn \l_tmpa_tl { \comp{ #1 } }
- \__stex_terms_custom_loop:
-}
-\cs_new_protected:Nn \__stex_terms_custom_final: {
- \int_compare:nNnTF \l_tmpb_int = 0 {
- \exp_args:Nnno \_stex_term_oms:nnn
- }{
- \str_if_in:NnTF \l_tmpa_str {b} {
- \exp_args:Nnno \_stex_term_ombind:nnn
- } {
- \exp_args:Nnno \_stex_term_oma:nnn
- }
- }
- { \l__stex_terms_custom_uri } { \l__stex_terms_custom_uri } { \l_tmpa_tl }
-}
\cs_new:Nn \stex_capitalize:n { \uppercase{#1} }
\keys_define:nn { stex / symname } {
@@ -3295,7 +3771,7 @@
\let\compemph_uri_prev:\compemph@uri
\let\compemph@uri\symrefemph@uri
\exp_args:NNx \use:nn
- \stex_invoke_symbol:n { { \l_stex_get_symbol_uri_str }!{
+ \stex_invoke_symbol:n { { \l_stex_get_symbol_uri_str }!\ifmmode*\fi{
\l__stex_terms_pre_tl \l_tmpa_str \l__stex_terms_post_tl
} }
\let\compemph@uri\compemph_uri_prev:
@@ -3311,38 +3787,34 @@
\let\compemph_uri_prev:\compemph@uri
\let\compemph@uri\symrefemph@uri
\exp_args:NNx \use:nn
- \stex_invoke_symbol:n { { \l_stex_get_symbol_uri_str }!{
+ \stex_invoke_symbol:n { { \l_stex_get_symbol_uri_str }!\ifmmode*\fi{
\exp_after:wN \stex_capitalize:n \l_tmpa_str
\l__stex_terms_post_tl
} }
\let\compemph@uri\compemph_uri_prev:
}
-
-\str_new:N \l_stex_current_symbol_str
-\cs_new_protected:Nn \stex_highlight_term:nn {
- \exp_args:Nnx
- \use:nn {
- \str_set:Nx \l_stex_current_symbol_str { #1 }
- #2
- } {
- \str_set:Nx \exp_not:N \l_stex_current_symbol_str
- { \l_stex_current_symbol_str }
+\cs_new_protected:Npn \_comp #1 {
+ \str_if_empty:NF \STEXInternalCurrentSymbolStr {
+ \stex_html_backend:TF {
+ \stex_annotate:nnn { comp }{ \STEXInternalCurrentSymbolStr }{ #1 }
+ }{
+ \exp_args:Nnx \compemph@uri { #1 } { \STEXInternalCurrentSymbolStr }
+ }
}
}
-\cs_new_protected:Nn \stex_unhighlight_term:n {
- #1 %\iffalse{{\fi}} #1 {{\iffalse}}\fi
-}
-\cs_new_protected:Npn \comp #1 {
- \str_if_empty:NF \l_stex_current_symbol_str {
- \rustex_if:TF {
- \stex_annotate:nnn { comp }{ \l_stex_current_symbol_str }{ #1 }
+\cs_new_protected:Npn \_varcomp #1 {
+ \str_if_empty:NF \STEXInternalCurrentSymbolStr {
+ \stex_html_backend:TF {
+ \stex_annotate:nnn { varcomp }{ \STEXInternalCurrentSymbolStr }{ #1 }
}{
- \exp_args:Nnx \compemph@uri { #1 } { \l_stex_current_symbol_str }
+ \exp_args:Nnx \varemph@uri { #1 } { \STEXInternalCurrentSymbolStr }
}
}
}
+\def\comp{\_comp}
+
\cs_new_protected:Npn \compemph@uri #1 #2 {
\compemph{ #1 }
}
@@ -3364,7 +3836,15 @@
}
\cs_new_protected:Npn \symrefemph #1 {
- \textbf{#1}
+ \emph{#1}
+}
+
+\cs_new_protected:Npn \varemph@uri #1 #2 {
+ \varemph{#1}
+}
+
+\cs_new_protected:Npn \varemph #1 {
+ #1
}
\NewDocumentCommand \ellipses {} { \ldots }
\bool_new:N \l_stex_inparray_bool
@@ -3413,36 +3893,68 @@
}
\cs_new_protected:Nn \__stex_variables_invoke_text:n {
- %TODO
+ \peek_charcode_remove:NTF ! {
+ \__stex_variables_invoke_op_custom:nn {#1}
+ }{
+ \__stex_variables_invoke_custom:nn {#1}
+ }
}
\cs_new_protected:Nn \__stex_variables_invoke_math:n {
\peek_charcode_remove:NTF ! {
\peek_charcode_remove:NTF ! {
\peek_charcode:NTF [ {
- \__stex_variables_invoke_op_custom:nw
- }{
% TODO throw error
+ }{
+ \__stex_variables_invoke_op_custom:nn
}
}{
\__stex_variables_invoke_op:n { #1 }
}
}{
\peek_charcode_remove:NTF * {
- \__stex_variables_invoke_text:n { #1 }
+ \__stex_variables_invoke_custom:nn { #1 }
}{
\__stex_variables_invoke_math_ii:n { #1 }
}
}
}
+\cs_new_protected:Nn \__stex_variables_invoke_op_custom:nn {
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { var://#1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \_stex_term_omv:nn {var://#1}{
+ \comp{ #2 }
+ }
+ }{
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+}
+
\cs_new_protected:Nn \__stex_variables_invoke_op:n {
\cs_if_exist:cTF {
stex_var_op_notation_ #1 _cs
}{
- \use:c{stex_var_op_notation_ #1 _cs }
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { var://#1 }
+ \_stex_term_omv:nn { var://#1 }{
+ \use:c{stex_var_op_notation_ #1 _cs }
+ }
+ }{
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ }
}{
- \msg_error:nnxx{stex}{error/noop}{variable~#1}{}
+ \int_compare:nNnTF {\prop_item:cn {l_stex_variable_#1_prop}{arity}} = 0{
+ \__stex_variables_invoke_math_ii:n {#1}
+ }{
+ \msg_error:nnxx{stex}{error/noop}{variable~#1}{}
+ }
}
}
@@ -3450,13 +3962,82 @@
\cs_if_exist:cTF {
stex_var_notation_#1_cs
}{
- \str_set:Nn \l_stex_current_symbol_str { #1 }
+ \tl_set:Nx \STEXInternalSymbolAfterInvokationTL {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalSymbolAfterInvokationTL
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { var://#1 }
+ \bool_set_false:N \l_stex_allow_semantic_bool
\use:c{stex_var_notation_#1_cs}
}{
\msg_error:nnxx{stex}{error/nonotation}{variable~#1}{s}
}
}
+\cs_new_protected:Nn \__stex_variables_invoke_custom:nn {
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr { var://#1 }
+ \prop_clear:N \l__stex_terms_custom_args_prop
+ \prop_put:Nnn \l__stex_terms_custom_args_prop {currnum} {1}
+ \prop_get:cnN {
+ l_stex_variable_#1 _prop
+ }{ args } \l_tmpa_str
+ \prop_put:Nno \l__stex_terms_custom_args_prop {args} \l_tmpa_str
+ \tl_set:Nn \arg { \__stex_terms_arg: }
+ \str_if_empty:NTF \l_tmpa_str {
+ \_stex_term_omv:nn {var://#1}{\ignorespaces#2}
+ }{
+ \str_if_in:NnTF \l_tmpa_str b {
+ \_stex_term_ombind:nnn {var://#1}{}{\ignorespaces#2}
+ }{
+ \str_if_in:NnTF \l_tmpa_str B {
+ \_stex_term_ombind:nnn {var://#1}{}{\ignorespaces#2}
+ }{
+ \_stex_term_oma:nnn {var://#1}{}{\ignorespaces#2}
+ }
+ }
+ }
+ % TODO check that all arguments exist
+ }{
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \_stex_reset:N \arg
+ \_stex_reset:N \comp
+ \_stex_reset:N \l__stex_terms_custom_args_prop
+ %\bool_set_true:N \l_stex_allow_semantic_bool
+ }
+}
+
+\cs_new_protected:Nn \stex_invoke_sequence:n {
+ \peek_charcode_remove:NTF ! {
+ \_stex_term_omv:nn {varseq://#1}{
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr {varseq://#1}
+ \prop_item:cn{stex_varseq_#1_prop}{notation}
+ }{
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ }
+ }
+ }{
+ \bool_set_false:N \l_stex_allow_semantic_bool
+ \def\comp{\_varcomp}
+ \str_set:Nn \STEXInternalCurrentSymbolStr {varseq://#1}
+ \tl_set:Nx \STEXInternalSymbolAfterInvokationTL {
+ \_stex_reset:N \comp
+ \_stex_reset:N \STEXInternalSymbolAfterInvokationTL
+ \_stex_reset:N \STEXInternalCurrentSymbolStr
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ }
+ \use:c { stex_varseq_#1_cs }
+ }
+}
+
+
%%%%%%%%%%%%% features.dtx %%%%%%%%%%%%%
@@ -3467,9 +4048,28 @@
Symbol~#1~not~assigned~in~interpretmodule~#2
}
-\cs_new_protected:Nn \stex_get_symbol_in_copymodule:n {
+\msg_new:nnn{stex}{error/unknownstructure}{
+ No~structure~#1~found!
+}
+
+\msg_new:nnn{stex}{error/unknownfield}{
+ No~field~#1~in~instance~#2~found!\\#3
+}
+
+\msg_new:nnn{stex}{error/keyval}{
+ Invalid~key=value~pair:#1
+}
+\msg_new:nnn{stex}{error/instantiate/missing}{
+ Assignments~missing~in~instantiate:~#1
+}
+\msg_new:nnn{stex}{error/incompatible}{
+ Incompatible~signature:~#1~(#2)~and~#3~(#4)
+}
+
+\cs_new_protected:Nn \stex_get_symbol_in_seq:nn {
\tl_if_head_eq_catcode:nNTF { #1 } \relax {
- \__stex_features_get_symbol_from_cs:n { #1 }
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \__stex_copymodule_get_symbol_from_cs:
}{
% argument is a string
% is it a command name?
@@ -3480,34 +4080,31 @@
\exp_args:Nx \cs_if_eq:NNTF {
\tl_head:N \l_tmpa_tl
} \stex_invoke_symbol:n {
- \exp_args:No \__stex_features_get_symbol_from_cs:n { \use:c { #1 } }
+ \__stex_copymodule_get_symbol_from_cs:n{ #2 }
}{
- \__stex_features_get_symbol_from_string:n { #1 }
+ \__stex_copymodule_get_symbol_from_string:nn { #1 }{ #2 }
}
} {
- \__stex_features_get_symbol_from_string:n { #1 }
+ \__stex_copymodule_get_symbol_from_string:nn { #1 }{ #2 }
}
}{
% argument is not a command name
- \__stex_features_get_symbol_from_string:n { #1 }
+ \__stex_copymodule_get_symbol_from_string:nn { #1 }{ #2 }
% \l_stex_all_symbols_seq
}
}
}
-\cs_new_protected:Nn \__stex_features_get_symbol_from_string:n {
+\cs_new_protected:Nn \__stex_copymodule_get_symbol_from_string:nn {
\str_set:Nn \l_tmpa_str { #1 }
\bool_set_false:N \l_tmpa_bool
\bool_if:NF \l_tmpa_bool {
\tl_set:Nn \l_tmpa_tl {
- \msg_set:nnn{stex}{error/unknownsymbol}{
- No~symbol~#1~found!
- }
- \msg_error:nn{stex}{error/unknownsymbol}
+ \msg_error:nnn{stex}{error/unknownsymbol}{#1}
}
\str_set:Nn \l_tmpa_str { #1 }
\int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
- \seq_map_inline:Nn \l__stex_features_copymodule_fields_seq {
+ \seq_map_inline:Nn #2 {
\str_set:Nn \l_tmpb_str { ##1 }
\str_if_eq:eeT { \l_tmpa_str } {
\str_range:Nnn \l_tmpb_str { -\l_tmpa_int } { -1 }
@@ -3517,7 +4114,6 @@
\str_set:Nn \l_stex_get_symbol_uri_str {
##1
}
- \__stex_features_get_symbol_check:
}
}
}
@@ -3526,14 +4122,14 @@
}
}
-\cs_new_protected:Nn \__stex_features_get_symbol_from_cs:n {
+\cs_new_protected:Nn \__stex_copymodule_get_symbol_from_cs:n {
\exp_args:NNx \tl_set:Nn \l_tmpa_tl
{ \tl_tail:N \l_tmpa_tl }
\tl_if_single:NTF \l_tmpa_tl {
\exp_args:No \tl_if_head_is_group:nTF \l_tmpa_tl {
\exp_after:wN \str_set:Nn \exp_after:wN
\l_stex_get_symbol_uri_str \l_tmpa_tl
- \__stex_features_get_symbol_check:
+ \__stex_copymodule_get_symbol_check:n { #1 }
}{
% TODO
% tail is not a single group
@@ -3544,166 +4140,163 @@
}
}
-\cs_new_protected:Nn \__stex_features_get_symbol_check: {
- \exp_args:NNno \seq_set_split:Nnn \l_tmpa_seq {?} \l_stex_get_symbol_uri_str
- \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} = 3 {
- \seq_pop_right:NN \l_tmpa_seq \l_tmpb_str
- \str_set:Nx \l_tmpa_str {\seq_use:Nn \l_tmpa_seq ?}
- \seq_if_in:NoF \l__stex_features_copymodule_modules_seq \l_tmpa_str {
- \msg_error:nnxx{stex}{error/copymodule/notallowed}{\l_stex_get_symbol_uri_str}{
- \l_stex_current_copymodule_name_str\\Allowed:~\seq_use:Nn \l__stex_features_copymodule_modules_seq {,~}
- }
- }
- }{
+\cs_new_protected:Nn \__stex_copymodule_get_symbol_check:n {
+ \exp_args:NNx \seq_if_in:NnF #1 \l_stex_get_symbol_uri_str {
\msg_error:nnxx{stex}{error/copymodule/notallowed}{\l_stex_get_symbol_uri_str}{
- \l_stex_current_copymodule_name_str~(inexplicably)
+ :~\seq_use:Nn #1 {,~}
}
}
}
\cs_new_protected:Nn \stex_copymodule_start:nnnn {
+ % import module
\stex_import_module_uri:nn { #1 } { #2 }
\str_set:Nx \l_stex_current_copymodule_name_str {#3}
\stex_import_require_module:nnnn
{ \l_stex_import_ns_str } { \l_stex_import_archive_str }
{ \l_stex_import_path_str } { \l_stex_import_name_str }
+
\stex_collect_imports:n {\l_stex_import_ns_str ?\l_stex_import_name_str }
- \seq_set_eq:NN \l__stex_features_copymodule_modules_seq \l_stex_collect_imports_seq
- \seq_clear:N \l__stex_features_copymodule_fields_seq
- \seq_map_inline:Nn \l__stex_features_copymodule_modules_seq {
+ \seq_set_eq:NN \l__stex_copymodule_copymodule_modules_seq \l_stex_collect_imports_seq
+
+ % fields
+ \seq_clear:N \l__stex_copymodule_copymodule_fields_seq
+ \seq_map_inline:Nn \l__stex_copymodule_copymodule_modules_seq {
\seq_map_inline:cn {c_stex_module_##1_constants}{
- \exp_args:NNx \seq_put_right:Nn \l__stex_features_copymodule_fields_seq {
+ \exp_args:NNx \seq_put_right:Nn \l__stex_copymodule_copymodule_fields_seq {
##1 ? ####1
}
}
}
+
+ % setup prop
\seq_clear:N \l_tmpa_seq
\exp_args:NNx \prop_set_from_keyval:Nn \l_stex_current_copymodule_prop {
name = \l_stex_current_copymodule_name_str ,
module = \l_stex_current_module_str ,
from = \l_stex_import_ns_str ?\l_stex_import_name_str ,
- includes = \l_tmpa_seq ,
- fields = \l_tmpa_seq
+ includes = \l_tmpa_seq %,
+ % fields = \l_tmpa_seq
}
\stex_debug:nn{copymodule}{#4~for~module~{\l_stex_import_ns_str ?\l_stex_import_name_str}
as~\l_stex_current_module_str?\l_stex_current_copymodule_name_str}
- \stex_debug:nn{copymodule}{modules:\seq_use:Nn \l__stex_features_copymodule_modules_seq {,~}}
- \stex_debug:nn{copymodule}{fields:\seq_use:Nn \l__stex_features_copymodule_fields_seq {,~}}
- \stex_if_smsmode:F {
+ \stex_debug:nn{copymodule}{modules:\seq_use:Nn \l__stex_copymodule_copymodule_modules_seq {,~}}
+ \stex_debug:nn{copymodule}{fields:\seq_use:Nn \l__stex_copymodule_copymodule_fields_seq {,~}}
+
+ \stex_if_do_html:T {
\begin{stex_annotate_env} {#4} {
\l_stex_current_module_str?\l_stex_current_copymodule_name_str
}
- \stex_annotate_invisible:nnn{from}{\l_stex_import_ns_str ?\l_stex_import_name_str}{}
+ \stex_annotate_invisible:nnn{domain}{\l_stex_import_ns_str ?\l_stex_import_name_str}{}
}
- \bool_set_eq:NN \l__stex_features_oldhtml_bool \_stex_html_do_output_bool
- \bool_set_false:N \_stex_html_do_output_bool
}
+
\cs_new_protected:Nn \stex_copymodule_end:n {
+ % apply to every field
\def \l_tmpa_cs ##1 ##2 {#1}
- \bool_set_eq:NN \_stex_html_do_output_bool \l__stex_features_oldhtml_bool
- \tl_clear:N \l_tmpa_tl
- \tl_clear:N \l_tmpb_tl
- \prop_get:NnN \l_stex_current_copymodule_prop {fields} \l_tmpa_seq
- \seq_map_inline:Nn \l__stex_features_copymodule_modules_seq {
+
+ \tl_clear:N \__stex_copymodule_module_tl
+ \tl_clear:N \__stex_copymodule_exec_tl
+
+ %\prop_get:NnN \l_stex_current_copymodule_prop {fields} \l_tmpa_seq
+ \seq_clear:N \__stex_copymodule_fields_seq
+
+ \seq_map_inline:Nn \l__stex_copymodule_copymodule_modules_seq {
\seq_map_inline:cn {c_stex_module_##1_constants}{
- \tl_clear:N \l_tmpc_tl
+
+ \tl_clear:N \__stex_copymodule_curr_symbol_tl % <- wrap in current symbol html
\l_tmpa_cs{##1}{####1}
- \str_if_exist:cTF {l__stex_features_copymodule_##1?####1_name_str} {
- \tl_put_right:Nx \l_tmpa_tl {
- \prop_set_from_keyval:cn {
- l_stex_symdecl_\l_stex_current_module_str ? \use:c{l__stex_features_copymodule_##1?####1_name_str}_prop
- }{
- \exp_after:wN \prop_to_keyval:N \csname
- l_stex_symdecl_\l_stex_current_module_str ? \use:c{l__stex_features_copymodule_##1?####1_name_str}_prop
- \endcsname
- }
- \seq_clear:c {
- l_stex_symdecl_
- \l_stex_current_module_str ? \use:c{l__stex_features_copymodule_##1?####1_name_str}
- _notations
+
+ \str_if_exist:cTF {l__stex_copymodule_copymodule_##1?####1_name_str} {
+ \str_set_eq:Nc \__stex_copymodule_curr_name_str {l__stex_copymodule_copymodule_##1?####1_name_str}
+ \stex_if_do_html:T {
+ \tl_put_right:Nx \__stex_copymodule_curr_symbol_tl {
+ \stex_annotate_invisible:nnn{alias}{\use:c{l__stex_copymodule_copymodule_##1?####1_name_str}}{}
}
}
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_copy_notations:nn {\l_stex_current_module_str ? \use:c{l__stex_features_copymodule_##1?####1_name_str}}{##1?####1}
- \stex_annotate_invisible:nnn{alias}{\use:c{l__stex_features_copymodule_##1?####1_name_str}}{}
- }
- \seq_put_right:Nx \l_tmpa_seq {\l_stex_current_module_str ? \use:c{l__stex_features_copymodule_##1?####1_name_str}}
- \str_if_exist:cT {l__stex_features_copymodule_##1?####1_macroname_str} {
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_annotate_invisible:nnn{macroname}{\use:c{l__stex_features_copymodule_##1?####1_macroname_str}}{}
- }
- \tl_put_right:Nx \l_tmpa_tl {
- \tl_set:cx {\use:c{l__stex_features_copymodule_##1?####1_macroname_str}}{
- \stex_invoke_symbol:n {
- \l_stex_current_module_str ? \use:c{l__stex_features_copymodule_##1?####1_name_str}
- }
- }
+ }{
+ \str_set:Nx \__stex_copymodule_curr_name_str { \l_stex_current_copymodule_name_str / ####1 }
+ }
+
+ \prop_set_eq:Nc \l_tmpa_prop {l_stex_symdecl_ ##1?####1 _prop}
+ \prop_put:Nnx \l_tmpa_prop { name } \__stex_copymodule_curr_name_str
+ \prop_put:Nnx \l_tmpa_prop { module } \l_stex_current_module_str
+
+ \tl_if_exist:cT {l__stex_copymodule_copymodule_##1?####1_def_tl}{
+ \stex_if_do_html:T {
+ \tl_put_right:Nx \__stex_copymodule_curr_symbol_tl {
+ $\stex_annotate_invisible:nnn{definiens}{}{\exp_after:wN \exp_not:N\csname l__stex_copymodule_copymodule_##1?####1_def_tl\endcsname}$
}
}
- }{
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_copy_notations:nn {\l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1 }{##1?####1}
+ \prop_put:Nnn \l_tmpa_prop { defined } { true }
+ }
+
+ \stex_add_constant_to_current_module:n \__stex_copymodule_curr_name_str
+ \tl_put_right:Nx \__stex_copymodule_module_tl {
+ \seq_clear:c {l_stex_symdecl_ \l_stex_current_module_str ? \__stex_copymodule_curr_name_str _notations}
+ \prop_set_from_keyval:cn {
+ l_stex_symdecl_\l_stex_current_module_str ? \__stex_copymodule_curr_name_str _prop
+ }{
+ \prop_to_keyval:N \l_tmpa_prop
}
- \prop_set_eq:Nc \l_tmpa_prop {l_stex_symdecl_ ##1?####1 _prop}
- \prop_put:Nnx \l_tmpa_prop { name }{ \l_stex_current_copymodule_name_str / ####1 }
- \prop_put:Nnx \l_tmpa_prop { module }{ \l_stex_current_module_str }
- \tl_put_right:Nx \l_tmpa_tl {
- \prop_set_from_keyval:cn {
- l_stex_symdecl_\l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1_prop
- }{
- \prop_to_keyval:N \l_tmpa_prop
- }
- \seq_clear:c {
- l_stex_symdecl_
- \l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1
- _notations
+ }
+
+ \str_if_exist:cT {l__stex_copymodule_copymodule_##1?####1_macroname_str} {
+ \stex_if_do_html:T {
+ \tl_put_right:Nx \__stex_copymodule_curr_symbol_tl {
+ \stex_annotate_invisible:nnn{macroname}{\use:c{l__stex_copymodule_copymodule_##1?####1_macroname_str}}{}
}
}
- \seq_put_right:Nx \l_tmpa_seq {\l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1 }
- \str_if_exist:cT {l__stex_features_copymodule_##1?####1_macroname_str} {
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_annotate_invisible:nnn{macroname}{\use:c{l__stex_features_copymodule_##1?####1_macroname_str}}{}
- }
- \tl_put_right:Nx \l_tmpa_tl {
- \tl_set:cx {\use:c{l__stex_features_copymodule_##1?####1_macroname_str}}{
- \stex_invoke_symbol:n {
- \l_stex_current_module_str ? \l_stex_current_copymodule_name_str / ####1
- }
+ \tl_put_right:Nx \__stex_copymodule_module_tl {
+ \tl_set:cx {\use:c{l__stex_copymodule_copymodule_##1?####1_macroname_str}}{
+ \stex_invoke_symbol:n {
+ \l_stex_current_module_str ? \__stex_copymodule_curr_name_str
}
}
}
}
- \tl_if_exist:cT {l__stex_features_copymodule_##1?####1_def_tl}{
- \tl_put_right:Nx \l_tmpc_tl {
- \stex_annotate_invisible:nnn{definiens}{}{$\use:c{l__stex_features_copymodule_##1?####1_def_tl}$}
- }
+
+ \seq_put_right:Nx \__stex_copymodule_fields_seq {\l_stex_current_module_str ? \__stex_copymodule_curr_name_str }
+
+ \tl_put_right:Nx \__stex_copymodule_exec_tl {
+ \stex_copy_notations:nn {\l_stex_current_module_str ? \__stex_copymodule_curr_name_str} { ##1 ? ####1 }
}
- \tl_put_right:Nx \l_tmpb_tl {
- \stex_annotate:nnn{assignment} {##1?####1} { \l_tmpc_tl }
+
+ \tl_put_right:Nx \__stex_copymodule_exec_tl {
+ \stex_if_do_html:TF{
+ \stex_annotate_invisible:nnn{assignment} {##1?####1} { \exp_after:wN \exp_not:n \exp_after:wN {\__stex_copymodule_curr_symbol_tl} }
+ }{
+ \exp_after:wN \exp_not:n \exp_after:wN {\__stex_copymodule_curr_symbol_tl}
+ }
}
}
}
- \prop_put:Nno \l_stex_current_copymodule_prop {fields} \l_tmpa_seq
- \tl_put_left:Nx \l_tmpa_tl {
+
+ \prop_put:Nno \l_stex_current_copymodule_prop {fields} \__stex_copymodule_fields_seq
+ \tl_put_left:Nx \__stex_copymodule_module_tl {
\prop_set_from_keyval:cn {
l_stex_copymodule_ \l_stex_current_module_str?\l_stex_current_copymodule_name_str _prop
}{
\prop_to_keyval:N \l_stex_current_copymodule_prop
}
}
- \exp_args:No \stex_add_to_current_module:n \l_tmpa_tl
- \stex_debug:nn{copymodule}{result:\meaning \l_tmpa_tl}
- \exp_args:Nx \stex_do_up_to_module:n {
- \exp_args:No \exp_not:n \l_tmpa_tl
+
+ \seq_gput_right:cx{c_stex_module_\l_stex_current_module_str _copymodules}{
+ \l_stex_current_module_str?\l_stex_current_copymodule_name_str
}
- \l_tmpb_tl
- \stex_if_smsmode:F {
+
+ \exp_args:No \stex_execute_in_module:n \__stex_copymodule_module_tl
+ \stex_debug:nn{copymodule}{result:\meaning \__stex_copymodule_module_tl}
+ \stex_debug:nn{copymodule}{output:\meaning \__stex_copymodule_exec_tl}
+
+ \__stex_copymodule_exec_tl
+ \stex_if_do_html:T {
\end{stex_annotate_env}
}
}
\NewDocumentEnvironment {copymodule} { O{} m m}{
- \stex_copymodule_start:nnnn { #1 }{ #2 }{ #3 }{ structure }
+ \stex_copymodule_start:nnnn { #1 }{ #2 }{ #3 }{ copymodule }
\stex_deactivate_macro:Nn \symdecl {module~environments}
\stex_deactivate_macro:Nn \symdef {module~environments}
\stex_deactivate_macro:Nn \notation {module~environments}
@@ -3716,7 +4309,7 @@
}
\NewDocumentEnvironment {interpretmodule} { O{} m m}{
- \stex_copymodule_start:nnnn { #1 }{ #2 }{ #3 }{ realization }
+ \stex_copymodule_start:nnnn { #1 }{ #2 }{ #3 }{ interpretmodule }
\stex_deactivate_macro:Nn \symdecl {module~environments}
\stex_deactivate_macro:Nn \symdef {module~environments}
\stex_deactivate_macro:Nn \notation {module~environments}
@@ -3727,63 +4320,153 @@
}{
\stex_copymodule_end:n {
\tl_if_exist:cF {
- l__stex_features_copymodule_##1?##2_def_tl
+ l__stex_copymodule_copymodule_##1?##2_def_tl
}{
- \msg_error:nnxx{stex}{error/interpretmodule/nodefiniens}{
- ##1?##2
- }{\l_stex_current_copymodule_name_str}
+ \str_if_eq:eeF {
+ \prop_item:cn{
+ l_stex_symdecl_ ##1 ? ##2 _prop }{ defined }
+ }{ true }{
+ \msg_error:nnxx{stex}{error/interpretmodule/nodefiniens}{
+ ##1?##2
+ }{\l_stex_current_copymodule_name_str}
+ }
}
}
}
-\NewDocumentCommand \donotcopy { O{} m}{
+\iffalse \begin{stex_annotate_env} \fi
+\NewDocumentEnvironment {realization} { O{} m}{
+ \stex_copymodule_start:nnnn { #1 }{ #2 }{ #2 }{ realize }
+ \stex_deactivate_macro:Nn \symdecl {module~environments}
+ \stex_deactivate_macro:Nn \symdef {module~environments}
+ \stex_deactivate_macro:Nn \notation {module~environments}
+ \stex_reactivate_macro:N \donotcopy
+ \stex_reactivate_macro:N \assign
+ \stex_smsmode_do:
+}{
\stex_import_module_uri:nn { #1 } { #2 }
- \stex_collect_imports:n {\l_stex_import_ns_str ?\l_stex_import_name_str }
- \seq_map_inline:Nn \l_stex_collect_imports_seq {
- \seq_remove_all:Nn \l__stex_features_copymodule_modules_seq { ##1 }
+ \tl_clear:N \__stex_copymodule_exec_tl
+ \tl_set:Nx \__stex_copymodule_module_tl {
+ \stex_import_require_module:nnnn
+ { \l_stex_import_ns_str } { \l_stex_import_archive_str }
+ { \l_stex_import_path_str } { \l_stex_import_name_str }
+ }
+
+ \seq_map_inline:Nn \l__stex_copymodule_copymodule_modules_seq {
\seq_map_inline:cn {c_stex_module_##1_constants}{
- \seq_remove_all:Nn \l__stex_features_copymodule_fields_seq { ##1 ? ####1 }
- \bool_lazy_any_p:nT {
- { \cs_if_exist_p:c {l__stex_features_copymodule_##1?####1_name_str}}
- { \cs_if_exist_p:c {l__stex_features_copymodule_##1?####1_macroname_str}}
- { \cs_if_exist_p:c {l__stex_features_copymodule_##1?####1_def_tl}}
- }{
- % TODO throw error
+ \str_set:Nx \__stex_copymodule_curr_name_str { \l_stex_current_copymodule_name_str / ####1 }
+ \tl_if_exist:cT {l__stex_copymodule_copymodule_##1?####1_def_tl}{
+ \stex_if_do_html:T {
+ \tl_put_right:Nx \__stex_copymodule_exec_tl {
+ \stex_annotate_invisible:nnn{assignment} {##1?####1} {
+ $\stex_annotate_invisible:nnn{definiens}{}{\exp_after:wN \exp_not:N\csname l__stex_copymodule_copymodule_##1?####1_def_tl\endcsname}$
+ }
+ }
+ }
+ \tl_put_right:Nx \__stex_copymodule_module_tl {
+ \prop_put:cnn {l_stex_symdecl_##1?####1_prop}{ defined }{ true }
+ }
+ }
+ }}
+
+ \exp_args:No \stex_execute_in_module:n \__stex_copymodule_module_tl
+
+ \__stex_copymodule_exec_tl
+ \stex_if_do_html:T {\end{stex_annotate_env}}
+}
+
+\NewDocumentCommand \donotcopy { m }{
+ \str_clear:N \l_stex_import_name_str
+ \str_set:Nn \l_tmpa_str { #1 }
+ \int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
+ \seq_map_inline:Nn \l_stex_all_modules_seq {
+ \str_set:Nn \l_tmpb_str { ##1 }
+ \str_if_eq:eeT { \l_tmpa_str } {
+ \str_range:Nnn \l_tmpb_str { -\l_tmpa_int } { -1 }
+ } {
+ \seq_map_break:n {
+ \stex_if_do_html:T {
+ \stex_if_smsmode:F {
+ \stex_annotate_invisible:nnn{donotcopy}{##1}{
+ \stex_annotate:nnn{domain}{##1}{}
+ }
+ }
+ }
+ \str_set_eq:NN \l_stex_import_name_str \l_tmpb_str
+ }
+ }
+ \seq_map_inline:cn {c_stex_module_##1_copymodules}{
+ \str_set:Nn \l_tmpb_str { ####1 }
+ \str_if_eq:eeT { \l_tmpa_str } {
+ \str_range:Nnn \l_tmpb_str { -\l_tmpa_int } { -1 }
+ } {
+ \seq_map_break:n {\seq_map_break:n {
+ \stex_if_do_html:T {
+ \stex_if_smsmode:F {
+ \stex_annotate_invisible:nnn{donotcopy}{####1}{
+ \stex_annotate:nnn{domain}{
+ \prop_item:cn {l_stex_copymodule_ ####1 _prop}{module}
+ }{}
+ }
+ }
+ }
+ \str_set:Nx \l_stex_import_name_str {
+ \prop_item:cn {l_stex_copymodule_ ####1 _prop}{module}
+ }
+ }}
}
}
}
-
- \prop_get:NnN \l_stex_current_copymodule_prop { includes } \l_tmpa_seq
- \seq_put_right:Nx \l_tmpa_seq {\l_stex_import_ns_str ?\l_stex_import_name_str }
- \prop_put:Nnx \l_stex_current_copymodule_prop {includes} \l_tmpa_seq
+ \str_if_empty:NTF \l_stex_import_name_str {
+ % TODO throw error
+ }{
+ \stex_collect_imports:n {\l_stex_import_name_str }
+ \seq_map_inline:Nn \l_stex_collect_imports_seq {
+ \seq_remove_all:Nn \l__stex_copymodule_copymodule_modules_seq { ##1 }
+ \seq_map_inline:cn {c_stex_module_##1_constants}{
+ \seq_remove_all:Nn \l__stex_copymodule_copymodule_fields_seq { ##1 ? ####1 }
+ \bool_lazy_any:nT {
+ { \cs_if_exist_p:c {l__stex_copymodule_copymodule_##1?####1_name_str}}
+ { \cs_if_exist_p:c {l__stex_copymodule_copymodule_##1?####1_macroname_str}}
+ { \cs_if_exist_p:c {l__stex_copymodule_copymodule_##1?####1_def_tl}}
+ }{
+ % TODO throw error
+ }
+ }
+ }
+ \prop_get:NnN \l_stex_current_copymodule_prop { includes } \l_tmpa_seq
+ \seq_put_right:Nx \l_tmpa_seq {\l_stex_import_name_str }
+ \prop_put:Nno \l_stex_current_copymodule_prop {includes} \l_tmpa_seq
+ }
+ \stex_smsmode_do:
}
\NewDocumentCommand \assign { m m }{
- \stex_get_symbol_in_copymodule:n {#1}
+ \stex_get_symbol_in_seq:nn {#1} \l__stex_copymodule_copymodule_fields_seq
\stex_debug:nn{assign}{defining~{\l_stex_get_symbol_uri_str}~as~\detokenize{#2}}
- \tl_set:cn {l__stex_features_copymodule_\l_stex_get_symbol_uri_str _def_tl}{#2}
+ \tl_set:cn {l__stex_copymodule_copymodule_\l_stex_get_symbol_uri_str _def_tl}{#2}
+ \stex_smsmode_do:
}
\keys_define:nn { stex / renamedecl } {
name .str_set_x:N = \l_stex_renamedecl_name_str
}
-\cs_new_protected:Nn \__stex_features_renamedecl_args:n {
+\cs_new_protected:Nn \__stex_copymodule_renamedecl_args:n {
\str_clear:N \l_stex_renamedecl_name_str
-
\keys_set:nn { stex / renamedecl } { #1 }
}
\NewDocumentCommand \renamedecl { O{} m m}{
- \__stex_features_renamedecl_args:n { #1 }
- \stex_get_symbol_in_copymodule:n {#2}
+ \__stex_copymodule_renamedecl_args:n { #1 }
+ \stex_get_symbol_in_seq:nn {#2} \l__stex_copymodule_copymodule_fields_seq
\stex_debug:nn{renamedecl}{renaming~{\l_stex_get_symbol_uri_str}~to~#3}
- \str_set:cx {l__stex_features_copymodule_\l_stex_get_symbol_uri_str _macroname_str}{#3}
+ \str_set:cx {l__stex_copymodule_copymodule_\l_stex_get_symbol_uri_str _macroname_str}{#3}
\str_if_empty:NTF \l_stex_renamedecl_name_str {
\tl_set:cx { #3 }{ \stex_invoke_symbol:n {
\l_stex_get_symbol_uri_str
} }
} {
- \str_set:cx {l__stex_features_copymodule_\l_stex_get_symbol_uri_str _name_str}{\l_stex_renamedecl_name_str}
+ \str_set:cx {l__stex_copymodule_copymodule_\l_stex_get_symbol_uri_str _name_str}{\l_stex_renamedecl_name_str}
\stex_debug:nn{renamedecl}{@~\l_stex_current_module_str ? \l_stex_renamedecl_name_str}
\prop_set_eq:cc {l_stex_symdecl_
\l_stex_current_module_str ? \l_stex_renamedecl_name_str
@@ -3801,43 +4484,22 @@
\l_stex_current_module_str ? \l_stex_renamedecl_name_str
_prop
}{ module }{ \l_stex_current_module_str }
- \exp_args:NNx \seq_put_left:Nn \l__stex_features_copymodule_fields_seq {
+ \exp_args:NNx \seq_put_left:Nn \l__stex_copymodule_copymodule_fields_seq {
\l_stex_current_module_str ? \l_stex_renamedecl_name_str
}
\tl_set:cx { #3 }{ \stex_invoke_symbol:n {
\l_stex_current_module_str ? \l_stex_renamedecl_name_str
} }
}
+ \stex_smsmode_do:
}
\stex_deactivate_macro:Nn \assign {copymodules}
\stex_deactivate_macro:Nn \renamedecl {copymodules}
\stex_deactivate_macro:Nn \donotcopy {copymodules}
-\seq_new:N \l_stex_implicit_morphisms_seq
-\NewDocumentCommand \implicitmorphism { O{} m m}{
- \stex_import_module_uri:nn { #1 } { #2 }
- \stex_debug:nn{implicits}{
- Implicit~morphism:~
- \l_stex_module_ns_str ? \l__stex_features_name_str
- }
- \exp_args:NNx \seq_if_in:NnT \l_stex_all_modules_seq {
- \l_stex_module_ns_str ? \l__stex_features_name_str
- }{
- \msg_error:nnn{stex}{error/conflictingmodules}{
- \l_stex_module_ns_str ? \l__stex_features_name_str
- }
- }
-
- % TODO
-
- \seq_put_right:Nx \l_stex_implicit_morphisms_seq {
- \l_stex_module_ns_str ? \l__stex_features_name_str
- }
-}
-
-\NewDocumentEnvironment{structural@feature}{ m m m }{
+\NewDocumentEnvironment{structural_feature_module}{ m m m }{
\stex_if_in_module:F {
\msg_set:nnn{stex}{error/nomodule}{
Structural~Feature~has~to~occur~in~a~module:\\
@@ -3847,240 +4509,498 @@
\msg_error:nn{stex}{error/nomodule}
}
- \str_set:Nx \l_stex_module_name_str {
- \prop_item:Nn \l_stex_current_module_prop
- { name } / #2 - feature
- }
-
- \str_set:Nx \l_stex_module_ns_str {
- \prop_item:Nn \l_stex_current_module_prop
- { ns }
- }
+ \str_set_eq:NN \l_stex_feature_parent_str \l_stex_current_module_str
- \str_clear:N \l_tmpa_str
- \seq_clear:N \l_tmpa_seq
- \tl_clear:N \l_tmpa_tl
- \exp_args:NNx \prop_set_from_keyval:Nn \l_stex_current_module_prop {
- origname = #2,
- name = \l_stex_module_name_str ,
- ns = \l_stex_module_ns_str ,
- imports = \exp_not:o { \l_tmpa_seq } ,
- constants = \exp_not:o { \l_tmpa_seq } ,
- content = \exp_not:o { \l_tmpa_tl } ,
- file = \exp_not:o { \g_stex_currentfile_seq } ,
- lang = \l_stex_module_lang_str ,
- sig = \l_tmpa_str ,
- meta = \l_tmpa_str ,
- feature = #1 ,
- }
+ \stex_module_setup:nn{meta=NONE}{#2 - #1}
- \stex_if_smsmode:F {
- \begin{stex_annotate_env}{ feature:#1 }{}
+ \stex_if_do_html:T {
+ \begin{stex_annotate_env}{ feature:#1 }{\l_stex_feature_parent_str ? #2 - #1}
\stex_annotate_invisible:nnn{header}{}{ #3 }
}
}{
- \str_set:Nx \l_tmpa_str {
- c_stex_feature_
- \prop_item:Nn \l_stex_current_module_prop { ns } ?
- \prop_item:Nn \l_stex_current_module_prop { name }
- _prop
+ \str_gset_eq:NN \l_stex_last_feature_str \l_stex_current_module_str
+ \prop_gput:cnn {c_stex_module_ \l_stex_current_module_str _prop}{feature}{#1}
+ \stex_debug:nn{features}{
+ Feature: \l_stex_last_feature_str
}
- \prop_gset_eq:cN { \l_tmpa_str } \l_stex_current_module_prop
- \prop_gset_eq:NN \g_stex_last_feature_prop \l_stex_current_module_prop
- \stex_if_smsmode:F {
+ \stex_if_do_html:T {
\end{stex_annotate_env}
}
}
-
-
-\prop_new:N \l_stex_all_structures_prop
+\cs_new_protected:Nn \stex_add_structure_to_current_module:nn {
+ \prop_if_exist:cF {c_stex_module_\l_stex_current_module_str _structures}{
+ \prop_new:c {c_stex_module_\l_stex_current_module_str _structures}
+ }
+ \prop_gput:cxx{c_stex_module_\l_stex_current_module_str _structures}
+ {#1}{#2}
+}
\keys_define:nn { stex / features / structure } {
- name .str_set_x:N = \l__stex_features_structure_name_str ,
+ name .str_set_x:N = \l__stex_structures_name_str ,
}
-\cs_new_protected:Nn \__stex_features_structure_args:n {
- \str_clear:N \l__stex_features_structure_name_str
+\cs_new_protected:Nn \__stex_structures_structure_args:n {
+ \str_clear:N \l__stex_structures_name_str
\keys_set:nn { stex / features / structure } { #1 }
}
-\NewDocumentEnvironment{mathstructure}{ O{} m }{
- \__stex_features_structure_args:n { #1 }
- \str_if_empty:NT \l__stex_features_structure_name_str {
- \str_set:Nx \l__stex_features_structure_name_str { #2 }
+\NewDocumentEnvironment{mathstructure}{m O{}}{
+ \__stex_structures_structure_args:n { #2 }
+ \str_if_empty:NT \l__stex_structures_name_str {
+ \str_set:Nx \l__stex_structures_name_str { #1 }
+ }
+ \stex_suppress_html:n {
+ \bool_set_true:N \l_stex_symdecl_make_macro_bool
+ \exp_args:Nx \stex_symdecl_do:nn {
+ name = \l__stex_structures_name_str ,
+ def = {\STEXsymbol{module-type}{
+ \STEXInternalTermMathOMSiiii {
+ \prop_item:cn {c_stex_module_\l_stex_current_module_str _prop}
+ { ns } ?
+ \prop_item:cn {c_stex_module_\l_stex_current_module_str _prop}
+ { name } / \l__stex_structures_name_str - structure
+ }{}{0}{}
+ }}
+ }{ #1 }
}
\exp_args:Nnnx
- \begin{structural@feature}{ structure }
- { \l__stex_features_structure_name_str }{}
- \seq_clear:N \l_tmpa_seq
- \prop_put:Nno \l_stex_current_module_prop { fields } \l_tmpa_seq
- \stex_smsmode_do:
+ \begin{structural_feature_module}{ structure }
+ { \l__stex_structures_name_str }{}
+ \stex_smsmode_do:
}{
- \prop_get:NnN \l_stex_current_module_prop { constants } \l_tmpa_seq
- \prop_get:NnN \l_stex_current_module_prop { fields } \l_tmpb_seq
- \str_set:Nx \l_tmpa_str {
- \prop_item:Nn \l_stex_current_module_prop { ns } ?
- \prop_item:Nn \l_stex_current_module_prop { name }
+ \end{structural_feature_module}
+ \_stex_reset_up_to_module:n \l_stex_last_feature_str
+ \exp_args:No \stex_collect_imports:n \l_stex_last_feature_str
+ \seq_clear:N \l_tmpa_seq
+ \seq_map_inline:Nn \l_stex_collect_imports_seq {
+ \seq_map_inline:cn{c_stex_module_##1_constants}{
+ \seq_put_right:Nn \l_tmpa_seq { ##1 ? ####1 }
}
- \seq_map_inline:Nn \l_tmpa_seq {
- \exp_args:NNx \seq_put_right:Nn \l_tmpb_seq { \l_tmpa_str ? ##1 }
+ }
+ \exp_args:Nnno
+ \prop_gput:cnn {c_stex_module_ \l_stex_last_feature_str _prop}{fields}\l_tmpa_seq
+ \stex_debug:nn{structure}{Fields:~\seq_use:Nn \l_tmpa_seq ,}
+ \stex_add_structure_to_current_module:nn
+ \l__stex_structures_name_str
+ \l_stex_last_feature_str
+
+ \stex_execute_in_module:x {
+ \tl_set:cn { #1 }{
+ \exp_not:N \stex_invoke_structure:nn {\l_stex_current_module_str }{ \l__stex_structures_name_str}
}
- \prop_put:Nno \l_stex_current_module_prop { fields } { \l_tmpb_seq }
- \exp_args:Nnx
- \AddToHookNext { env / mathstructure / after }{
- \symdecl{ #2 }[type = \exp_not:N\collection,def={\STEXsymbol{module-type}{
- \_stex_term_math_oms:nnnn { \l_tmpa_str }{}{0}{}
- }}, name = \prop_item:Nn \l_stex_current_module_prop { origname }]
- \STEXexport {
- \prop_put:Nno \exp_not:N \l_stex_all_structures_prop
- {\prop_item:Nn \l_stex_current_module_prop { origname }}
- {\l_tmpa_str}
- \prop_put:Nno \exp_not:N \l_stex_all_structures_prop
- {#2}{\l_tmpa_str}
- }
- }
-
- \end{structural@feature}
- % \g_stex_last_feature_prop
-}
-\seq_new:N \l__stex_features_structure_field_seq
-\str_new:N \l__stex_features_structure_field_str
-\str_new:N \l__stex_features_structure_def_tl
-\prop_new:N \l__stex_features_structure_prop
-\NewDocumentCommand \instantiate { m O{} m }{
- \prop_get:NnN \l_stex_all_structures_prop {#1} \l_tmpa_str
- \prop_set_eq:Nc \l__stex_features_structure_prop {
- c_stex_feature_\l_tmpa_str _prop
- }
- \seq_set_from_clist:Nn \l__stex_features_structure_field_seq { #2 }
- \seq_map_inline:Nn \l__stex_features_structure_field_seq {
- \seq_set_split:Nnn \l_tmpa_seq{=}{ ##1 }
- \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} > 1 {
- \seq_get_left:NN \l_tmpa_seq \l_tmpa_tl
- \exp_args:NNno \seq_set_split:Nnn \l_tmpb_seq
- {!} \l_tmpa_tl
- \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} > 1 {
- \str_set:Nx \l__stex_features_structure_field_str {\seq_item:Nn \l_tmpb_seq 1}
- \seq_get_right:NN \l_tmpb_seq \l_tmpb_tl
- \seq_get_right:NN \l_tmpa_seq \l_tmpa_tl
- }{
- \str_set:Nx \l__stex_features_structure_field_str \l_tmpa_tl
- \seq_get_right:NN \l_tmpa_seq \l_tmpa_tl
- \exp_args:NNno \seq_set_split:Nnn \l_tmpb_seq{!}
- \l_tmpa_tl
- \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} > 1 {
- \seq_get_left:NN \l_tmpb_seq \l_tmpa_tl
- \seq_get_right:NN \l_tmpb_seq \l_tmpb_tl
+ }
+}
+
+\cs_new:Nn \stex_invoke_structure:nn {
+ \stex_invoke_symbol:n { #1?#2 }
+}
+
+\cs_new_protected:Nn \stex_get_structure:n {
+ \tl_if_head_eq_catcode:nNTF { #1 } \relax {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ \__stex_structures_get_from_cs:
+ }{
+ \cs_if_exist:cTF { #1 }{
+ \cs_set_eq:Nc \l_tmpa_cs { #1 }
+ \str_set:Nx \l_tmpa_str {\cs_argument_spec:N \l_tmpa_cs }
+ \str_if_empty:NTF \l_tmpa_str {
+ \cs_if_eq:NNTF { \tl_head:N \l_tmpa_cs} \stex_invoke_structure:nn {
+ \__stex_structures_get_from_cs:
}{
- \tl_clear:N \l_tmpb_tl
+ \__stex_structures_get_from_string:n { #1 }
}
- }
- }{
- \seq_set_split:Nnn \l_tmpa_seq{!}{ ##1 }
- \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} > 1 {
- \str_set:Nx \l__stex_features_structure_field_str {\seq_item:Nn \l_tmpa_seq 1}
- \seq_get_right:NN \l_tmpa_seq \l_tmpb_tl
- \tl_clear:N \l_tmpa_tl
}{
- % TODO throw error
+ \__stex_structures_get_from_string:n { #1 }
}
+ }{
+ \__stex_structures_get_from_string:n { #1 }
}
- % \l_tmpa_str: name
- % \l_tmpa_tl: definiens
- % \l_tmpb_tl: notation
- \tl_if_empty:NT \l__stex_features_structure_field_str {
- % TODO throw error
+ }
+}
+
+\cs_new_protected:Nn \__stex_structures_get_from_cs: {
+ \exp_args:NNx \tl_set:Nn \l_tmpa_tl
+ { \tl_tail:N \l_tmpa_tl }
+ \str_set:Nx \l_tmpa_str {
+ \exp_after:wN \use_i:nn \l_tmpa_tl
+ }
+ \str_set:Nx \l_tmpb_str {
+ \exp_after:wN \use_ii:nn \l_tmpa_tl
+ }
+ \str_set:Nx \l_stex_get_structure_str {
+ \l_tmpa_str ? \l_tmpb_str
+ }
+ \str_set:Nx \l_stex_get_structure_module_str {
+ \exp_args:Nno \prop_item:cn {c_stex_module_\l_tmpa_str _structures}{\l_tmpb_str}
+ }
+}
+
+\cs_new_protected:Nn \__stex_structures_get_from_string:n {
+ \tl_set:Nn \l_tmpa_tl {
+ \msg_error:nnn{stex}{error/unknownstructure}{#1}
+ }
+ \str_set:Nn \l_tmpa_str { #1 }
+ \int_set:Nn \l_tmpa_int { \str_count:N \l_tmpa_str }
+
+ \seq_map_inline:Nn \l_stex_all_modules_seq {
+ \prop_if_exist:cT {c_stex_module_##1_structures} {
+ \prop_map_inline:cn {c_stex_module_##1_structures} {
+ \str_if_eq:eeT { \l_tmpa_str }{ \str_range:nnn {##1?####1}{-\l_tmpa_int}{-1}}{
+ \prop_map_break:n{\seq_map_break:n{
+ \tl_set:Nn \l_tmpa_tl {
+ \str_set:Nn \l_stex_get_structure_str {##1?####1}
+ \str_set:Nn \l_stex_get_structure_module_str {####2}
+ }
+ }}
+ }
+ }
}
- \str_clear:N \l_tmpb_str
+ }
+ \l_tmpa_tl
+}
- \prop_get:NnN \l__stex_features_structure_prop { fields } \l_tmpa_seq
- \seq_map_inline:Nn \l_tmpa_seq {
- \seq_set_split:Nnn \l_tmpb_seq ? { ####1 }
- \seq_get_right:NN \l_tmpb_seq \l_tmpb_str
- \str_if_eq:NNT \l__stex_features_structure_field_str \l_tmpb_str {
- \seq_map_break:n {
- \str_set:Nn \l_tmpb_str { ####1 }
+\keys_define:nn { stex / instantiate } {
+ name .str_set_x:N = \l__stex_structures_name_str
+}
+\cs_new_protected:Nn \__stex_structures_instantiate_args:n {
+ \str_clear:N \l__stex_structures_name_str
+ \keys_set:nn { stex / instantiate } { #1 }
+}
+
+\NewDocumentCommand \instantiate {m O{} m m O{}}{
+ \begingroup
+ \stex_get_structure:n {#3}
+ \__stex_structures_instantiate_args:n { #2 }
+ \str_if_empty:NT \l__stex_structures_name_str {
+ \str_set:Nn \l__stex_structures_name_str { #1 }
+ }
+ \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str
+ \seq_clear:N \l__stex_structures_fields_seq
+ \exp_args:Nx \stex_collect_imports:n \l_stex_get_structure_module_str
+ \seq_map_inline:Nn \l_stex_collect_imports_seq {
+ \seq_map_inline:cn {c_stex_module_##1_constants}{
+ \seq_put_right:Nx \l__stex_structures_fields_seq { ##1 ? ####1 }
+ }
+ }
+
+ \tl_if_empty:nF{#5}{
+ \seq_set_split:Nnn \l_tmpa_seq , {#5}
+ \prop_clear:N \l_tmpa_prop
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \seq_set_split:Nnn \l_tmpb_seq = { ##1 }
+ \int_compare:nNnF { \seq_count:N \l_tmpb_seq } = 2 {
+ \msg_error:nnn{stex}{error/keyval}{##1}
}
+ \exp_args:Nx \stex_get_symbol_in_seq:nn {\seq_item:Nn \l_tmpb_seq 1} \l__stex_structures_fields_seq
+ \str_set_eq:NN \l__stex_structures_dom_str \l_stex_get_symbol_uri_str
+ \exp_args:NNx \seq_remove_all:Nn \l__stex_structures_fields_seq \l_stex_get_symbol_uri_str
+ \exp_args:Nx \stex_get_symbol:n {\seq_item:Nn \l_tmpb_seq 2}
+ \exp_args:Nxx \str_if_eq:nnF
+ {\prop_item:cn{l_stex_symdecl_\l__stex_structures_dom_str _prop}{args}}
+ {\prop_item:cn{l_stex_symdecl_\l_stex_get_symbol_uri_str _prop}{args}}{
+ \msg_error:nnxxxx{stex}{error/incompatible}
+ {\l__stex_structures_dom_str}
+ {\prop_item:cn{l_stex_symdecl_\l__stex_structures_dom_str _prop}{args}}
+ {\l_stex_get_symbol_uri_str}
+ {\prop_item:cn{l_stex_symdecl_\l_stex_get_symbol_uri_str _prop}{args}}
+ }
+ \prop_put:Nxx \l_tmpa_prop {\seq_item:Nn \l_tmpb_seq 1} \l_stex_get_symbol_uri_str
}
}
- \prop_get:cnN { l_stex_symdecl_ \l_tmpb_str _prop } {args}
- \l_tmpb_str
- \tl_if_empty:NTF \l_tmpb_tl {
- \tl_if_empty:NF \l_tmpa_tl {
- \exp_args:Nx \use:n {
- \symdecl{#3/\l__stex_features_structure_field_str}[args=\l_tmpb_str,def={\exp_args:No\exp_not:n{\l_tmpa_tl}}]
+ \seq_map_inline:Nn \l__stex_structures_fields_seq {
+ \str_set:Nx \l_tmpa_str {field:\l__stex_structures_name_str . \prop_item:cn {l_stex_symdecl_##1_prop}{name} }
+ \stex_debug:nn{instantiate}{Field~\l_tmpa_str :~##1}
+
+ \stex_add_constant_to_current_module:n {\l_tmpa_str}
+ \stex_execute_in_module:x {
+ \prop_set_from_keyval:cn { l_stex_symdecl_ \l_stex_current_module_str?\l_tmpa_str _prop}{
+ name = \l_tmpa_str ,
+ args = \prop_item:cn {l_stex_symdecl_##1_prop}{args} ,
+ arity = \prop_item:cn {l_stex_symdecl_##1_prop}{arity} ,
+ assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs}
}
+ \seq_clear:c {l_stex_symdecl_\l_stex_current_module_str?\l_tmpa_str _notations}
}
- }{
- \tl_if_empty:NTF \l_tmpa_tl {
- \exp_args:Nx \use:n {
- \symdef{#3/\l__stex_features_structure_field_str}[args=\l_tmpb_str]\exp_after:wN\exp_not:n\exp_after:wN{\l_tmpb_tl}
+
+ \seq_if_empty:cF{l_stex_symdecl_##1_notations}{
+ \stex_find_notation:nn{##1}{}
+ \stex_execute_in_module:x {
+ \seq_put_right:cn {l_stex_symdecl_\l_stex_current_module_str?\l_tmpa_str _notations}{\l_stex_notation_variant_str}
}
- }{
- \exp_args:Nx \use:n {
- \symdef{#3/\l__stex_features_structure_field_str}[args=\l_tmpb_str,def={\exp_args:No\exp_not:n{\l_tmpa_tl}}]
- \exp_after:wN\exp_not:n\exp_after:wN{\l_tmpb_tl}
+ \stex_copy_control_sequence_ii:ccN
+ {stex_notation_\l_stex_current_module_str?\l_tmpa_str\c_hash_str \l_stex_notation_variant_str _cs}
+ {stex_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}
+ \l_tmpa_tl
+ \exp_args:No \stex_execute_in_module:n \l_tmpa_tl
+
+ \cs_if_exist:cT{stex_op_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}{
+ \tl_set_eq:Nc \l_tmpa_cs {stex_op_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}
+ \stex_execute_in_module:x {
+ \tl_set:cn
+ {stex_op_notation_\l_stex_current_module_str?\l_tmpa_str\c_hash_str \l_stex_notation_variant_str _cs}
+ { \exp_args:No \exp_not:n \l_tmpa_cs}
+ }
}
+
}
+
+ \prop_put:Nxx \l_tmpa_prop {\prop_item:cn {l_stex_symdecl_##1_prop}{name}}{\l_stex_current_module_str?\l_tmpa_str}
+ }
+
+ \stex_execute_in_module:x {
+ \prop_set_from_keyval:cn {l_stex_instance_\l_stex_current_module_str?\l__stex_structures_name_str _prop}{
+ domain = \l_stex_get_structure_module_str ,
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ \tl_set:cn{ #1 }{\stex_invoke_instance:n{ \l_stex_current_module_str?\l__stex_structures_name_str} }
+ }
+ \stex_debug:nn{instantiate}{
+ Instance~\l_stex_current_module_str?\l__stex_structures_name_str \\
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ \exp_args:Nxx \stex_symdecl_do:nn {
+ type={\STEXsymbol{module-type}{
+ \STEXInternalTermMathOMSiiii {
+ \l_stex_get_structure_module_str
+ }{}{0}{}
+ }}
+ }{\l__stex_structures_name_str}
+ \str_set:Nx \l_stex_get_symbol_uri_str {\l_stex_current_module_str?\l__stex_structures_name_str}
+ \tl_set:Nn \l_stex_notation_after_do_tl {\__stex_notation_final:}
+ \stex_notation_do:nnnnn{}{0}{}{}{\comp{#4}}
+ % }
+ %\exp_args:Nx \notation{\l__stex_structures_name_str}{\comp{#5}}
+ \endgroup
+ \stex_smsmode_do:\ignorespacesandpars
+}
+
+\cs_new_protected:Nn \stex_symbol_or_var:n {
+ \cs_if_exist:cTF{#1}{
+ \cs_set_eq:Nc \l_tmpa_tl { #1 }
+ \str_set:Nx \l_tmpa_str { \cs_argument_spec:N \l_tmpa_tl }
+ \str_if_empty:NTF \l_tmpa_str {
+ \exp_args:Nx \cs_if_eq:NNTF { \tl_head:N \l_tmpa_tl }
+ \stex_invoke_variable:n {
+ \bool_set_true:N \l_stex_symbol_or_var_bool
+ \bool_set_false:N \l_stex_instance_or_symbol_bool
+ \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl}
+ \tl_set:Nx \l_tmpa_tl {\exp_after:wN \use:n \l_tmpa_tl}
+ \str_set:Nx \l_stex_get_symbol_uri_str {
+ \exp_after:wN \use:n \l_tmpa_tl
+ }
+ }{ % TODO \stex_invoke_varinstance:n
+ \exp_args:Nx \cs_if_eq:NNTF { \tl_head:N \l_tmpa_tl } \stex_invoke_varinstance:n {
+ \bool_set_true:N \l_stex_symbol_or_var_bool
+ \bool_set_true:N \l_stex_instance_or_symbol_bool
+ \tl_set:Nx \l_tmpa_tl {\tl_tail:N \l_tmpa_tl}
+ \tl_set:Nx \l_tmpa_tl {\exp_after:wN \use:n \l_tmpa_tl}
+ \str_set:Nx \l_stex_get_symbol_uri_str {
+ \exp_after:wN \use:n \l_tmpa_tl
+ }
+ }{
+ \bool_set_false:N \l_stex_symbol_or_var_bool
+ \stex_get_symbol:n{#1}
+ }
+ }
+ }{
+ \__stex_structures_symbolorvar_from_string:n{ #1 }
}
+ }{
+ \__stex_structures_symbolorvar_from_string:n{ #1 }
}
+}
- \tl_clear:N \l__stex_features_structure_def_tl
+\cs_new_protected:Nn \__stex_structures_symbolorvar_from_string:n {
+ \prop_if_exist:cTF {l_stex_variable_#1 _prop}{
+ \bool_set_true:N \l_stex_symbol_or_var_bool
+ \str_set:Nn \l_stex_get_symbol_uri_str { #1 }
+ }{
+ \bool_set_false:N \l_stex_symbol_or_var_bool
+ \stex_get_symbol:n{#1}
+ }
+}
- \prop_get:NnN \l__stex_features_structure_prop { fields } \l_tmpa_seq
- \seq_map_inline:Nn \l_tmpa_seq {
- \seq_set_split:Nnn \l_tmpb_seq ? { ##1 }
- \seq_get_right:NN \l_tmpb_seq \l_tmpa_str
- \exp_args:Nx \use:n {
- \tl_put_right:Nn \exp_not:N \l__stex_features_structure_def_tl {
+\keys_define:nn { stex / varinstantiate } {
+ name .str_set_x:N = \l__stex_structures_name_str,
+ bind .choices:nn =
+ {forall,exists}
+ {\str_set:Nx \l__stex_structures_bind_str {\l_keys_choice_tl}}
+}
+\cs_new_protected:Nn \__stex_structures_varinstantiate_args:n {
+ \str_clear:N \l__stex_structures_name_str
+ \str_clear:N \l__stex_structures_bind_str
+ \keys_set:nn { stex / varinstantiate } { #1 }
+}
+
+\NewDocumentCommand \varinstantiate {m O{} m m O{}}{
+ \begingroup
+ \stex_get_structure:n {#3}
+ \__stex_structures_varinstantiate_args:n { #2 }
+ \str_if_empty:NT \l__stex_structures_name_str {
+ \str_set:Nn \l__stex_structures_name_str { #1 }
+ }
+ \stex_if_do_html:TF{
+ \stex_annotate:nnn{varinstance}{\l__stex_structures_name_str}
+ }{\use:n}
+ {
+ \stex_if_do_html:T{
+ \stex_annotate_invisible:nnn{domain}{\l_stex_get_structure_module_str}{}
+ }
+ \seq_clear:N \l__stex_structures_fields_seq
+ \exp_args:Nx \stex_collect_imports:n \l_stex_get_structure_module_str
+ \seq_map_inline:Nn \l_stex_collect_imports_seq {
+ \seq_map_inline:cn {c_stex_module_##1_constants}{
+ \seq_put_right:Nx \l__stex_structures_fields_seq { ##1 ? ####1 }
+ }
}
- }
+ \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str
+ \prop_clear:N \l_tmpa_prop
+ \tl_if_empty:nF {#5} {
+ \seq_set_split:Nnn \l_tmpa_seq , {#5}
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \seq_set_split:Nnn \l_tmpb_seq = { ##1 }
+ \int_compare:nNnF { \seq_count:N \l_tmpb_seq } = 2 {
+ \msg_error:nnn{stex}{error/keyval}{##1}
+ }
+ \exp_args:Nx \stex_get_symbol_in_seq:nn {\seq_item:Nn \l_tmpb_seq 1} \l__stex_structures_fields_seq
+ \str_set_eq:NN \l__stex_structures_dom_str \l_stex_get_symbol_uri_str
+ \exp_args:NNx \seq_remove_all:Nn \l__stex_structures_fields_seq \l_stex_get_symbol_uri_str
+ \exp_args:Nx \stex_symbol_or_var:n {\seq_item:Nn \l_tmpb_seq 2}
+ \stex_if_do_html:T{
+ \stex_annotate:nnn{assign}{\l__stex_structures_dom_str,
+ \bool_if:NTF\l_stex_symbol_or_var_bool{var://}{}\l_stex_get_symbol_uri_str}{}
+ }
+ \bool_if:NTF \l_stex_symbol_or_var_bool {
+ \exp_args:Nxx \str_if_eq:nnF
+ {\prop_item:cn{l_stex_symdecl_\l__stex_structures_dom_str _prop}{args}}
+ {\prop_item:cn{l_stex_variable_\l_stex_get_symbol_uri_str _prop}{args}}{
+ \msg_error:nnxxxx{stex}{error/incompatible}
+ {\l__stex_structures_dom_str}
+ {\prop_item:cn{l_stex_symdecl_\l__stex_structures_dom_str _prop}{args}}
+ {\l_stex_get_symbol_uri_str}
+ {\prop_item:cn{l_stex_variable_\l_stex_get_symbol_uri_str _prop}{args}}
+ }
+ \prop_put:Nxx \l_tmpa_prop {\seq_item:Nn \l_tmpb_seq 1} {\stex_invoke_variable:n {\l_stex_get_symbol_uri_str}}
+ }{
+ \exp_args:Nxx \str_if_eq:nnF
+ {\prop_item:cn{l_stex_symdecl_\l__stex_structures_dom_str _prop}{args}}
+ {\prop_item:cn{l_stex_symdecl_\l_stex_get_symbol_uri_str _prop}{args}}{
+ \msg_error:nnxxxx{stex}{error/incompatible}
+ {\l__stex_structures_dom_str}
+ {\prop_item:cn{l_stex_symdecl_\l__stex_structures_dom_str _prop}{args}}
+ {\l_stex_get_symbol_uri_str}
+ {\prop_item:cn{l_stex_symdecl_\l_stex_get_symbol_uri_str _prop}{args}}
+ }
+ \prop_put:Nxx \l_tmpa_prop {\seq_item:Nn \l_tmpb_seq 1} {\stex_invoke_symbol:n {\l_stex_get_symbol_uri_str}}
+ }
+ }
+ }
+ \tl_gclear:N \g__stex_structures_aftergroup_tl
+ \seq_map_inline:Nn \l__stex_structures_fields_seq {
+ \str_set:Nx \l_tmpa_str {\l__stex_structures_name_str . \prop_item:cn {l_stex_symdecl_##1_prop}{name} }
+ \stex_debug:nn{varinstantiate}{Field~\l_tmpa_str :~##1}
+ \seq_if_empty:cF{l_stex_symdecl_##1_notations}{
+ \stex_find_notation:nn{##1}{}
+ \cs_gset_eq:cc{g__stex_structures_tmpa_\l_tmpa_str _cs}
+ {stex_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}
+ \stex_debug:nn{varinstantiate}{Notation:~\cs_meaning:c{g__stex_structures_tmpa_\l_tmpa_str _cs}}
+ \cs_if_exist:cT{stex_op_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}{
+ \cs_gset_eq:cc {g__stex_structures_tmpa_op_\l_tmpa_str _cs}
+ {stex_op_notation_##1\c_hash_str \l_stex_notation_variant_str _cs}
+ \stex_debug:nn{varinstantiate}{Operator~Notation:~\cs_meaning:c{g__stex_structures_tmpa_op_\l_tmpa_str _cs}}
+ }
+ }
- \prop_if_exist:cF {
- l_stex_symdecl_
- \prop_item:Nn \l_stex_current_module_prop {ns} ?
- \prop_item:Nn \l_stex_current_module_prop {name} ?
- #3/\l_tmpa_str
- _prop
- }{
- \prop_get:cnN { l_stex_symdecl_ ##1 _prop } {args}
- \l_tmpb_str
- \exp_args:Nx \use:n {
- \symdecl{#3/\l_tmpa_str}[args=\l_tmpb_str]
+ \exp_args:NNx \tl_gput_right:Nn \g__stex_structures_aftergroup_tl {
+ \prop_set_from_keyval:cn { l_stex_variable_ \l_tmpa_str _prop}{
+ name = \l_tmpa_str ,
+ args = \prop_item:cn {l_stex_symdecl_##1_prop}{args} ,
+ arity = \prop_item:cn {l_stex_symdecl_##1_prop}{arity} ,
+ assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs}
+ }
+ \cs_set_eq:cc {stex_var_notation_\l_tmpa_str _cs}
+ {g__stex_structures_tmpa_\l_tmpa_str _cs}
+ \cs_set_eq:cc {stex_var_op_notation_\l_tmpa_str _cs}
+ {g__stex_structures_tmpa_op_\l_tmpa_str _cs}
+ }
+ \prop_put:Nxx \l_tmpa_prop {\prop_item:cn {l_stex_symdecl_##1_prop}{name}}{\stex_invoke_variable:n {\l_tmpa_str}}
+ }
+ \exp_args:NNx \tl_gput_right:Nn \g__stex_structures_aftergroup_tl {
+ \prop_set_from_keyval:cn {l_stex_varinstance_\l__stex_structures_name_str _prop }{
+ domain = \l_stex_get_structure_module_str ,
+ \prop_to_keyval:N \l_tmpa_prop
+ }
+ \tl_set:cn { #1 }{\stex_invoke_varinstance:n {\l__stex_structures_name_str}}
+ \tl_set:cn {l_stex_varinstance_\l__stex_structures_name_str _op_tl}{
+ \exp_args:Nnx \exp_not:N \use:nn {
+ \str_set:Nn \exp_not:N \STEXInternalCurrentSymbolStr {var://\l__stex_structures_name_str}
+ \_stex_term_omv:nn {var://\l__stex_structures_name_str}{
+ \exp_not:n{
+ \_varcomp{#4}
+ }
+ }
+ }{
+ \exp_not:n{\_stex_reset:N \STEXInternalCurrentSymbolStr}
+ }
+ }
}
}
- }
+ \stex_debug:nn{varinstantiate}{\expandafter\detokenize\expandafter{\g__stex_structures_aftergroup_tl}}
+ \aftergroup\g__stex_structures_aftergroup_tl
+ \endgroup
+ \stex_smsmode_do:\ignorespacesandpars
+}
- \symdecl*{#3}[type={\STEXsymbol{module-type}{
- \_stex_term_math_oms:nnnn {
- \prop_item:Nn \l__stex_features_structure_prop {ns} ?
- \prop_item:Nn \l__stex_features_structure_prop {name}
- }{}{0}{}
- }}]
+\cs_new_protected:Nn \stex_invoke_instance:n {
+ \peek_charcode_remove:NTF ! {
+ \stex_invoke_symbol:n{#1}
+ }{
+ \_stex_invoke_instance:nn {#1}
+ }
+}
- % TODO: -> sms file
+\cs_new_protected:Nn \stex_invoke_varinstance:n {
+ \peek_charcode_remove:NTF ! {
+ \exp_args:Nnx \use:nn {
+ \def\comp{\_varcomp}
+ \use:c{l_stex_varinstance_#1_op_tl}
+ }{
+ \_stex_reset:N \comp
+ }
+ }{
+ \_stex_invoke_varinstance:nn {#1}
+ }
+}
- \tl_set:cx{ #3 }{
- \stex_invoke_structure:nnn {
- \prop_item:Nn \l_stex_current_module_prop {ns} ?
- \prop_item:Nn \l_stex_current_module_prop {name} ? #3
- } {
- \prop_item:Nn \l__stex_features_structure_prop {ns} ?
- \prop_item:Nn \l__stex_features_structure_prop {name}
+\cs_new_protected:Nn \_stex_invoke_instance:nn {
+ \prop_if_in:cnTF {l_stex_instance_ #1 _prop}{#2}{
+ \exp_args:Nx \stex_invoke_symbol:n {\prop_item:cn{l_stex_instance_ #1 _prop}{#2}}
+ }{
+ \prop_set_eq:Nc \l_tmpa_prop{l_stex_instance_ #1 _prop}
+ \msg_error:nnxxx{stex}{error/unknownfield}{#2}{#1}{
+ \prop_to_keyval:N \l_tmpa_prop
}
}
- \stex_smsmode_do:
+}
+
+\cs_new_protected:Nn \_stex_invoke_varinstance:nn {
+ \prop_if_in:cnTF {l_stex_varinstance_ #1 _prop}{#2}{
+ \prop_get:cnN{l_stex_varinstance_ #1 _prop}{#2}\l_tmpa_tl
+ \l_tmpa_tl
+ }{
+ \msg_error:nnnnn{stex}{error/unknownfield}{#2}{#1}{}
+ }
}
\cs_new_protected:Nn \stex_invoke_structure:nnn {
\tl_if_empty:nTF{ #3 }{
- \prop_set_eq:Nc \l__stex_features_structure_prop {
+ \prop_set_eq:Nc \l__stex_structures_structure_prop {
c_stex_feature_ #2 _prop
}
\tl_clear:N \l_tmpa_tl
- \prop_get:NnN \l__stex_features_structure_prop { fields } \l_tmpa_seq
+ \prop_get:NnN \l__stex_structures_structure_prop { fields } \l_tmpa_seq
\seq_map_inline:Nn \l_tmpa_seq {
\seq_set_split:Nnn \l_tmpb_seq ? { ##1 }
\seq_get_right:NN \l_tmpb_seq \l_tmpa_str
@@ -4135,7 +5055,7 @@
}
% TODO root
- \rustex_if:TF {
+ \stex_html_backend:TF {
\stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } { \l_tmpa_tl }
} {
\exp_args:Nnx \defemph@uri { \l_tmpa_tl } { \l_stex_get_symbol_uri_str }
@@ -4151,13 +5071,15 @@
\str_set:Nx \l_tmpa_str {
\prop_item:cn { l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop } { name }
}
- \exp_args:NNno \str_replace_all:Nnn \l_tmpa_str {-} {~}
- \rustex_if:TF {
- \stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } {
- \l_tmpa_str\l__stex_statements_definiendum_post_tl
+ \str_replace_all:Nnn \l_tmpa_str {-} {~}
+ \stex_html_backend:TF {
+ \stex_if_do_html:T {
+ \stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } {
+ \l_tmpa_str\l__stex_statements_definiendum_post_tl
}
+ }
} {
- \defemph@uri {
+ \exp_args:Nnx \defemph@uri {
\l_tmpa_str\l__stex_statements_definiendum_post_tl
} { \l_stex_get_symbol_uri_str }
}
@@ -4172,12 +5094,14 @@
}
\exp_args:NNno \str_replace_all:Nnn \l_tmpa_str {-} {~}
\stex_ref_new_sym_target:n \l_stex_get_symbol_uri_str
- \rustex_if:TF {
- \stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } {
- \l_tmpa_str\l__stex_statements_definiendum_post_tl
- }
+ \stex_html_backend:TF {
+ \stex_if_do_html:T {
+ \stex_annotate:nnn { definiendum } { \l_stex_get_symbol_uri_str } {
+ \exp_after:wN \stex_capitalize:n \l_tmpa_str\l__stex_statements_definiendum_post_tl
+ }
+ }
} {
- \defemph@uri {
+ \exp_args:Nnx \defemph@uri {
\exp_after:wN \stex_capitalize:n \l_tmpa_str\l__stex_statements_definiendum_post_tl
} { \l_stex_get_symbol_uri_str }
}
@@ -4185,18 +5109,51 @@
\stex_deactivate_macro:Nn \Definame {definition~environments}
\NewDocumentCommand \premise { m }{
- \stex_annotate:nnn{ premise }{}{ #1 }
+ \noindent\stex_annotate:nnn{ premise }{}{\ignorespaces #1 }
}
\NewDocumentCommand \conclusion { m }{
- \stex_annotate:nnn{ conclusion }{}{ #1 }
+ \noindent\stex_annotate:nnn{ conclusion }{}{\ignorespaces #1 }
+}
+\NewDocumentCommand \definiens { O{} m }{
+ \str_clear:N \l_stex_get_symbol_uri_str
+ \tl_if_empty:nF {#1} {
+ \stex_get_symbol:n { #1 }
+ }
+ \str_if_empty:NT \l_stex_get_symbol_uri_str {
+ \int_compare:nNnTF {\clist_count:N \l__stex_statements_sdefinition_for_clist} = 1 {
+ \str_set:Nx \l_stex_get_symbol_uri_str {\clist_item:Nn \l__stex_statements_sdefinition_for_clist 1}
+ }{
+ % TODO throw error
+ }
+ }
+ \str_if_eq:eeT {\prop_item:cn {l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop}{module}}
+ {\l_stex_current_module_str}{
+ \str_if_eq:eeF {\prop_item:cn {l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop}{defined}}
+ {true}{
+ \prop_put:cnn{l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop}{defined}{true}
+ \exp_args:Nx \stex_add_to_current_module:n {
+ \prop_put:cnn{l_stex_symdecl_ \l_stex_get_symbol_uri_str _prop}{defined}{true}
+ }
+ }
+ }
+ \stex_annotate:nnn{ definiens }{\l_stex_get_symbol_uri_str}{ #2 }
}
-\NewDocumentCommand \definiens { m }{
- \stex_annotate:nnn{ definiens }{}{ #1 }
+
+\NewDocumentCommand \varbindforall {m}{
+ \stex_symbol_or_var:n {#1}
+ \bool_if:NTF\l_stex_symbol_or_var_bool{
+ \stex_if_do_html:T {
+ \stex_annotate_invisible:nnn {bindtype}{forall,\l_stex_get_symbol_uri_str}{}
+ }
+ }{
+ % todo throw error
+ }
}
\stex_deactivate_macro:Nn \premise {definition,~example~or~assertion~environments}
\stex_deactivate_macro:Nn \conclusion {example~or~assertion~environments}
\stex_deactivate_macro:Nn \definiens {definition~environments}
+\stex_deactivate_macro:Nn \varbindforall {definition~or~assertion~environments}
\keys_define:nn {stex / sdefinition }{
@@ -4222,20 +5179,25 @@
\stex_reactivate_macro:N \Definame
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \definiens
+ \stex_reactivate_macro:N \varbindforall
\stex_if_smsmode:F{
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l__stex_statements_sdefinition_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
+ \clist_set_from_seq:NN \l__stex_statements_sdefinition_for_clist \l_tmpb_seq
\exp_args:Nnnx
- \begin{stex_annotate_env}{definition}{\seq_use:Nn \l_tmpa_seq {,}}
+ \begin{stex_annotate_env}{definition}{\seq_use:Nn \l_tmpb_seq {,}}
\str_if_empty:NF \sdefinitiontype {
- \stex_annotate_invisible:nnn{type}{\sdefinitiontype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sdefinitiontype}{}
+ }
+ \str_if_empty:NF \sdefinitionname {
+ \stex_annotate_invisible:nnn{statementname}{\sdefinitionname}{}
}
\clist_set:No \l_tmpa_clist \sdefinitiontype
\tl_clear:N \l_tmpa_tl
@@ -4253,7 +5215,9 @@
\stex_ref_new_doc_target:n \sdefinitionid
\stex_smsmode_do:
}{
- \str_if_empty:NF \sdefinitionname { \stex_symdecl_do:nn{}{\sdefinitionname} }
+ \stex_suppress_html:n {
+ \str_if_empty:NF \sdefinitionname { \stex_symdecl_do:nn{}{\sdefinitionname} }
+ }
\stex_if_smsmode:F {
\clist_set:No \l_tmpa_clist \sdefinitiontype
\tl_clear:N \l_tmpa_tl
@@ -4271,11 +5235,11 @@
}
}
\cs_new_protected:Nn \__stex_statements_sdefinition_start: {
- \par\noindent\titleemph{Definition\tl_if_empty:NF \sdefinitiontitle {
+ \stex_par:\noindent\titleemph{Definition\tl_if_empty:NF \sdefinitiontitle {
~(\sdefinitiontitle)
}~}
}
-\cs_new_protected:Nn \__stex_statements_sdefinition_end: {\par\medskip}
+\cs_new_protected:Nn \__stex_statements_sdefinition_end: {\stex_par:\medskip}
\newcommand\stexpatchdefinition[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
@@ -4308,26 +5272,31 @@
\stex_reactivate_macro:N \Definame
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \definiens
+ \stex_reactivate_macro:N \varbindforall
\stex_ref_new_doc_target:n \sdefinitionid
- \stex_if_smsmode:TF{
+ \stex_if_smsmode:TF{\stex_suppress_html:n {
\str_if_empty:NF \sdefinitionname { \stex_symdecl_do:nn{}{\sdefinitionname} }
- }{
- \seq_clear:N \l_tmpa_seq
+ }}{
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l__stex_statements_sdefinition_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
+ \clist_set_from_seq:NN \l__stex_statements_sdefinition_for_clist \l_tmpb_seq
\exp_args:Nnx
- \stex_annotate:nnn{definition}{\seq_use:Nn \l_tmpa_seq {,}}{
+ \stex_annotate:nnn{definition}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sdefinitiontype {
- \stex_annotate_invisible:nnn{type}{\sdefinitiontype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sdefinitiontype}{}
}
#2
- \str_if_empty:NF \sdefinitionname { \stex_symdecl_do:nn{}{\sdefinitionname} }
+ \str_if_empty:NF \sdefinitionname {
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sdefinitionname}}
+ \stex_annotate_invisible:nnn{statementname}{\sdefinitionname}{}
+ }
}
}
\endgroup
@@ -4355,21 +5324,25 @@
\__stex_statements_sassertion_args:n{ #1 }
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \conclusion
+ \stex_reactivate_macro:N \varbindforall
\stex_if_smsmode:F {
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l__stex_statements_sassertion_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnnx
- \begin{stex_annotate_env}{assertion}{\seq_use:Nn \l_tmpa_seq {,}}
+ \begin{stex_annotate_env}{assertion}{\seq_use:Nn \l_tmpb_seq {,}}
\str_if_empty:NF \sassertiontype {
\stex_annotate_invisible:nnn{type}{\sassertiontype}{}
}
+ \str_if_empty:NF \sassertionname {
+ \stex_annotate_invisible:nnn{statementname}{\sassertionname}{}
+ }
\clist_set:No \l_tmpa_clist \sassertiontype
\tl_clear:N \l_tmpa_tl
\clist_map_inline:Nn \l_tmpa_clist {
@@ -4393,7 +5366,7 @@
\stex_smsmode_do:
}{
\str_if_empty:NF \sassertionname {
- \stex_symdecl_do:nn{}{\sassertionname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sassertionname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sassertionname}
}
\stex_if_smsmode:F {
@@ -4414,11 +5387,11 @@
}
\cs_new_protected:Nn \__stex_statements_sassertion_start: {
- \par\noindent\titleemph{Assertion~\tl_if_empty:NF \sassertiontitle {
+ \stex_par:\noindent\titleemph{Assertion~\tl_if_empty:NF \sassertiontitle {
(\sassertiontitle)
}~}
}
-\cs_new_protected:Nn \__stex_statements_sassertion_end: {\par\medskip}
+\cs_new_protected:Nn \__stex_statements_sassertion_end: {\stex_par:\medskip}
\newcommand\stexpatchassertion[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
@@ -4447,6 +5420,7 @@
\begingroup
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \conclusion
+ \stex_reactivate_macro:N \varbindforall
\__stex_statements_inlineass_args:n{ #1 }
\str_if_empty:NTF \sassertionid {
\str_if_empty:NF \sassertionname {
@@ -4458,28 +5432,29 @@
\stex_if_smsmode:TF{
\str_if_empty:NF \sassertionname {
- \stex_symdecl_do:nn{}{\sassertionname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sassertionname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sassertionname}
}
}{
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l__stex_statements_sassertion_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnx
- \stex_annotate:nnn{assertion}{\seq_use:Nn \l_tmpa_seq {,}}{
+ \stex_annotate:nnn{assertion}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sassertiontype {
- \stex_annotate_invisible:nnn{type}{\sassertiontype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sassertiontype}{}
}
#2
\str_if_empty:NF \sassertionname {
- \stex_symdecl_do:nn{}{\sassertionname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sassertionname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sassertionname}
+ \stex_annotate_invisible:nnn{statementname}{\sassertionname}{}
}
}
}
@@ -4491,11 +5466,13 @@
type .str_set_x:N = \exampletype,
id .str_set_x:N = \sexampleid,
title .tl_set:N = \sexampletitle,
+ name .str_set_x:N = \sexamplename ,
for .clist_set:N = \l__stex_statements_sexample_for_clist,
}
\cs_new_protected:Nn \__stex_statements_sexample_args:n {
\str_clear:N \sexampletype
\str_clear:N \sexampleid
+ \str_clear:N \sexamplename
\tl_clear:N \sexampletitle
\clist_clear:N \l__stex_statements_sexample_for_clist
\keys_set:nn { stex / sexample }{ #1 }
@@ -4506,19 +5483,22 @@
\stex_reactivate_macro:N \premise
\stex_reactivate_macro:N \conclusion
\stex_if_smsmode:F {
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l__stex_statements_sexample_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnnx
- \begin{stex_annotate_env}{example}{\seq_use:Nn \l_tmpa_seq {,}}
+ \begin{stex_annotate_env}{example}{\seq_use:Nn \l_tmpb_seq {,}}
\str_if_empty:NF \sexampletype {
- \stex_annotate_invisible:nnn{type}{\sexampletype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sexampletype}{}
+ }
+ \str_if_empty:NF \sexamplename {
+ \stex_annotate_invisible:nnn{statementname}{\sexamplename}{}
}
\clist_set:No \l_tmpa_clist \sexampletype
\tl_clear:N \l_tmpa_tl
@@ -4538,7 +5518,9 @@
}
\stex_smsmode_do:
}{
- \str_if_empty:NF \sexamplename { \stex_symdecl_do:nn{}{\sexamplename} }
+ \str_if_empty:NF \sexamplename {
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sexamplename}}
+ }
\stex_if_smsmode:F {
\clist_set:No \l_tmpa_clist \sexampletype
\tl_clear:N \l_tmpa_tl
@@ -4557,11 +5539,11 @@
}
\cs_new_protected:Nn \__stex_statements_sexample_start: {
- \par\noindent\titleemph{Example~\tl_if_empty:NF \sexampletitle {
+ \stex_par:\noindent\titleemph{Example~\tl_if_empty:NF \sexampletitle {
(\sexampletitle)
}~}
}
-\cs_new_protected:Nn \__stex_statements_sexample_end: {\par\medskip}
+\cs_new_protected:Nn \__stex_statements_sexample_end: {\stex_par:\medskip}
\newcommand\stexpatchexample[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
@@ -4595,24 +5577,29 @@
\stex_ref_new_doc_target:n \sexampleid
}
\stex_if_smsmode:TF{
- \str_if_empty:NF \sexamplename { \stex_symdecl_do:nn{}{\examplename} }
+ \str_if_empty:NF \sexamplename {
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\examplename}}
+ }
}{
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l__stex_statements_sexample_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnx
- \stex_annotate:nnn{example}{\seq_use:Nn \l_tmpa_seq {,}}{
+ \stex_annotate:nnn{example}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sexampletype {
- \stex_annotate_invisible:nnn{type}{\sexampletype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sexampletype}{}
}
#2
- \str_if_empty:NF \sexamplename { \stex_symdecl_do:nn{}{\sexamplename} }
+ \str_if_empty:NF \sexamplename {
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sexamplename}}
+ \stex_annotate_invisible:nnn{statementname}{\sexamplename}{}
+ }
}
}
\endgroup
@@ -4626,7 +5613,8 @@
from .tl_set:N = \sparagraphfrom ,
to .tl_set:N = \sparagraphto ,
start .tl_set:N = \l_stex_sparagraph_start_tl ,
- name .str_set:N = \sparagraphname
+ name .str_set:N = \sparagraphname ,
+ imports .tl_set:N = \l__stex_statements_sparagraph_imports_tl
}
\cs_new_protected:Nn \stex_sparagraph_args:n {
@@ -4634,6 +5622,7 @@
\tl_clear:N \sparagraphfrom
\tl_clear:N \sparagraphto
\tl_clear:N \l_stex_sparagraph_start_tl
+ \tl_clear:N \l__stex_statements_sparagraph_imports_tl
\str_clear:N \sparagraphid
\str_clear:N \sparagraphtype
\clist_clear:N \l__stex_statements_sparagraph_for_clist
@@ -4651,19 +5640,19 @@
}
\@in@omtexttrue
\stex_if_smsmode:F {
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l__stex_statements_sparagraph_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnnx
- \begin{stex_annotate_env}{paragraph}{\seq_use:Nn \l_tmpa_seq {,}}
+ \begin{stex_annotate_env}{paragraph}{\seq_use:Nn \l_tmpb_seq {,}}
\str_if_empty:NF \sparagraphtype {
- \stex_annotate_invisible:nnn{type}{\sparagraphtype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sparagraphtype}{}
}
\str_if_empty:NF \sparagraphfrom {
\stex_annotate_invisible:nnn{from}{\sparagraphfrom}{}
@@ -4671,6 +5660,9 @@
\str_if_empty:NF \sparagraphto {
\stex_annotate_invisible:nnn{to}{\sparagraphto}{}
}
+ \str_if_empty:NF \sparagraphname {
+ \stex_annotate_invisible:nnn{statementname}{\sparagraphname}{}
+ }
\clist_set:No \l_tmpa_clist \sparagraphtype
\tl_clear:N \l_tmpa_tl
\clist_map_inline:Nn \sparagraphtype {
@@ -4678,6 +5670,7 @@
\tl_set:Nn \l_tmpa_tl {\use:c{__stex_statements_sparagraph_##1_start:}}
}
}
+ \stex_csl_to_imports:No \usemodule \l__stex_statements_sparagraph_imports_tl
\tl_if_empty:NTF \l_tmpa_tl {
\__stex_statements_sparagraph_start:
}{
@@ -4685,6 +5678,14 @@
}
}
\clist_set:No \l_tmpa_clist \sparagraphtype
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\tl_to_str:n{symdoc}}
+ {
+ \stex_reactivate_macro:N \definiendum
+ \stex_reactivate_macro:N \definame
+ \stex_reactivate_macro:N \Definame
+ \stex_reactivate_macro:N \premise
+ \stex_reactivate_macro:N \definiens
+ }
\str_if_empty:NTF \sparagraphid {
\str_if_empty:NTF \sparagraphname {
\exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\tl_to_str:n{symdoc}}{
@@ -4709,7 +5710,7 @@
\ignorespacesandpars
}{
\str_if_empty:NF \sparagraphname {
- \stex_symdecl_do:nn{}{\sparagraphname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sparagraphname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sparagraphname}
}
\stex_if_smsmode:F {
@@ -4730,7 +5731,7 @@
}
\cs_new_protected:Nn \__stex_statements_sparagraph_start: {
- \par\noindent\tl_if_empty:NTF \l_stex_sparagraph_start_tl {
+ \stex_par:\noindent\tl_if_empty:NTF \l_stex_sparagraph_start_tl {
\tl_if_empty:NF \l_stex_sparagraph_title_tl {
\titleemph{\l_stex_sparagraph_title_tl}:~
}
@@ -4738,7 +5739,7 @@
\titleemph{\l_stex_sparagraph_start_tl}~
}
}
-\cs_new_protected:Nn \__stex_statements_sparagraph_end: {\par\medskip}
+\cs_new_protected:Nn \__stex_statements_sparagraph_end: {\stex_par:\medskip}
\newcommand\stexpatchparagraph[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
@@ -4785,23 +5786,23 @@
}
\stex_if_smsmode:TF{
\str_if_empty:NF \sparagraphname {
- \stex_symdecl_do:nn{}{\sparagraphname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sparagraphname}}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sparagraphname}
}
}{
- \seq_clear:N \l_tmpa_seq
+ \seq_clear:N \l_tmpb_seq
\clist_map_inline:Nn \l__stex_statements_sparagraph_for_clist {
\tl_if_empty:nF{ ##1 }{
\stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \exp_args:NNo \seq_put_right:Nn \l_tmpb_seq {
\l_stex_get_symbol_uri_str
}
}
}
\exp_args:Nnx
- \stex_annotate:nnn{paragraph}{\seq_use:Nn \l_tmpa_seq {,}}{
+ \stex_annotate:nnn{paragraph}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sparagraphtype {
- \stex_annotate_invisible:nnn{type}{\sparagraphtype}{}
+ \stex_annotate_invisible:nnn{typestrings}{\sparagraphtype}{}
}
\str_if_empty:NF \sparagraphfrom {
\stex_annotate_invisible:nnn{from}{\sparagraphfrom}{}
@@ -4810,11 +5811,12 @@
\stex_annotate_invisible:nnn{to}{\sparagraphto}{}
}
\str_if_empty:NF \sparagraphname {
- \stex_symdecl_do:nn{}{\sparagraphname}
+ \stex_suppress_html:n{\stex_symdecl_do:nn{}{\sparagraphname}}
+ \stex_annotate_invisible:nnn{statementname}{\sparagraphname}{}
\stex_ref_new_sym_target:n {\l_stex_current_module_str ? \sparagraphname}
}
\exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\tl_to_str:n{symdoc}}{
- \clist_map_inline:Nn \l_tmpa_seq {
+ \clist_map_inline:Nn \l_tmpb_seq {
\stex_ref_new_sym_target:n {##1}
}
}
@@ -5146,7 +6148,7 @@
}
\cs_new_protected:Nn \__stex_sproof_sproof_end: {\sproofend}
-\newcommand\stexpatchsproof[3][] {
+\newcommand\stexpatchproof[3][] {
\str_set:Nx \l_tmpa_str{ #1 }
\str_if_empty:NTF \l_tmpa_str {
\tl_set:Nn \__stex_sproof_sproof_start: { #2 }
@@ -5173,6 +6175,17 @@
}
}{
\@in@omtexttrue
+ \clist_set:No \l_tmpa_clist \spftype
+ \tl_set:Nn \l_tmpa_tl {
+ \item[\sproofnumber]
+ \bool_set_true:N \l__stex_sproof_inc_counter_bool
+ }
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \exp_args:No \str_if_eq:nnT \c__stex_sproof_flow_str {##1} {
+ \tl_clear:N \l_tmpa_tl
+ }
+ }
+ \l_tmpa_tl
\seq_clear:N \l_tmpa_seq
\clist_map_inline:Nn \l__stex_sproof_spf_for_clist {
\tl_if_empty:nF{ ##1 }{
@@ -5187,17 +6200,6 @@
\str_if_empty:NF \spftype {
\stex_annotate_invisible:nnn{type}{\spftype}{}
}
- \clist_set:No \l_tmpa_clist \spftype
- \tl_set:Nn \l_tmpa_tl {
- \item[\sproofnumber]
- \bool_set_true:N \l__stex_sproof_inc_counter_bool
- }
- \clist_map_inline:Nn \l_tmpa_clist {
- \exp_args:No \str_if_eq:nnT \c__stex_sproof_flow_str {##1} {
- \tl_clear:N \l_tmpa_tl
- }
- }
- \l_tmpa_tl
\tl_if_empty:NF \spftitle {
{(\titleemph{\spftitle})\enspace}
}
@@ -5215,7 +6217,7 @@
\end{stex_annotate_env}
}
}
-\newenvironment{sproofcomment}[1][]{
+\newenvironment{spfcomment}[1][]{
\__stex_sproof_spf_args:n{#1}
\clist_set:No \l_tmpa_clist \spftype
\tl_set:Nn \l_tmpa_tl {
@@ -5358,23 +6360,13 @@
premises .tl_set:N = \l__stex_sproof_just_premises_tl,
args .tl_set:N = \l__stex_sproof_just_args_tl
}
-\newenvironment{justification}[1][]{}{}
+\newcommand\spfjust[1][]{}
\newcommand\stex_proof_premise:[2][]{#2}
\newcommand\justarg[2][]{#2}
-%%%%%%%%%%%%% others.dtx %%%%%%%%%%%%%
-
- % None
-\NewDocumentCommand \MSC {m} {
- % TODO
-}
-\@ifpackageloaded{tikzinput}{
- \RequirePackage{stex-tikzinput}
-}{}
-
%%%%%%%%%%%%% metatheory.dtx %%%%%%%%%%%%%
-\str_const:Nn \c_stex_metatheory_ns_str {http://mathhub.info/sTeX}
+\str_const:Nn \c_stex_metatheory_ns_str {http://mathhub.info/sTeX/meta}
\begingroup
\stex_module_setup:nn{
ns=\c_stex_metatheory_ns_str,
@@ -5387,15 +6379,21 @@
\csname stex_suppress_html:n\endcsname{
% is-a (a:A, a \in A, a is an A, etc.)
\symdecl{isa}[args=ai]
- \notation{isa}[typed]{#1 \comp{:} #2}{##1 \comp, ##2}
+ \notation{isa}[typed,op=:]{#1 \comp{:} #2}{##1 \comp, ##2}
\notation{isa}[in]{#1 \comp\in #2}{##1 \comp, ##2}
\notation{isa}[pred]{#2\comp(#1 \comp)}{##1 \comp, ##2}
% bind (\forall, \Pi, \lambda etc.)
- \symdecl{bind}[args=Bi]
+ \symdecl{bind}[args=Bi,assoc=pre]
+ \notation{bind}[depfun,prec=nobrackets,op={(\cdot)\;\to\;\cdot}]{\comp( #1 \comp{)\;\to\;} #2}{##1 \comp, ##2}
\notation{bind}[forall]{\comp\forall #1.\;#2}{##1 \comp, ##2}
\notation{bind}[Pi]{\comp\prod_{#1}#2}{##1 \comp, ##2}
- \notation{bind}[depfun]{\comp( #1 \comp{)\;\to\;} #2}{##1 \comp, ##2}
+
+ % implicit bind
+ \symdecl{implicitbind}[args=Bi,assoc=pre]
+ \notation{implicitbind}[braces,prec=nobrackets,op={\{\cdot\}_I\;\cdot}]{\comp\{ #1 \comp{\}_I\;} #2}{##1 \comp, ##2}
+ \notation{implicitbind}[depfun,prec=nobrackets]{\comp( #1 \comp{)\;\to_I\;} #2}{##1 \comp, ##2}
+ \notation{implicitbind}[Pi]{\comp\prod^I_{#1}#2}{##1\comp,##2}
% dummy variable
\symdecl{dummyvar}
@@ -5416,23 +6414,34 @@
% function/operator application
\symdecl{apply}[args=ia]
- \notation{apply}[prec=0;0x\infprec,parens]{#1 \comp( #2 \comp)}{##1 \comp, ##2}
+ \notation{apply}[prec=0;0x\infprec,parens,op=\cdot(\cdot)]{#1 \comp( #2 \comp)}{##1 \comp, ##2}
\notation{apply}[prec=0;0x\infprec,lambda]{#1 \; #2 }{##1 \; ##2}
- % ``type'' of all collections (sets,classes,types,kinds)
- \symdecl{collection}
- \notation{collection}[U]{\comp{\mathcal{U}}}
- \notation{collection}[set]{\comp{\textsf{Set}}}
-
% collection of propositions/booleans/truth values
\symdecl{prop}[name=proposition]
\notation{prop}[prop]{\comp{{\rm prop}}}
\notation{prop}[BOOL]{\comp{{\rm BOOL}}}
+ \symdecl{judgmentholds}[args=1]
+ \notation{judgmentholds}[vdash,op=\vdash]{\comp\vdash\; #1}
+
% sequences
\symdecl{seqtype}[args=1]
\notation{seqtype}[kleene]{#1^{\comp\ast}}
+ \symdecl{seqexpr}[args=a]
+ \notation{seqexpr}[angle,prec=nobrackets]{\comp\langle #1\comp\rangle}{##1\comp,##2}
+
+ \symdef{seqmap}[args=abi,setlike]{\comp\{#3 \comp| #2\comp\in \dobrackets{#1} \comp\}}{##1 \comp, ##2}
+ \symdef{seqprepend}[args=ia]{#1 \comp{::} #2}{##1 \comp, ##2}
+ \symdef{seqappend}[args=ai]{#1 \comp{::} #2}{##1 \comp, ##2}
+ \symdef{seqfoldleft}[args=iabbi]{ \comp{foldl}\dobrackets{#1,#2}\dobrackets{#3\comp,#4\comp\mapsto#5}}{##1 \comp, ##2}
+ \symdef{seqfoldright}[args=iabbi,op=foldr]{ \comp{foldr}\dobrackets{#1,#2}\dobrackets{#3\comp,#4\comp\mapsto#5}}{##1 \comp, ##2}
+ \symdef{seqhead}[args=a]{\comp{head}\dobrackets{#1}}{##1 \comp, ##2}
+ \symdef{seqtail}[args=a]{\comp{tail}\dobrackets{#1}}{##1 \comp, ##2}
+ \symdef{seqlast}[args=a]{\comp{last}\dobrackets{#1}}{##1 \comp, ##2}
+ \symdef{seqinit}[args=a]{\comp{tail}\dobrackets{#1}}{##1 \comp, ##2}
+
\symdef{sequence-index}[args=2,li,prec=nobrackets]{{#1}_{#2}}
\notation{sequence-index}[ui,prec=nobrackets]{{#1}^{#2}}
@@ -5440,6 +6449,9 @@
\symdef{aseqfromto}[args=ai,prec=nobrackets]{#1\comp{,\ellipses,}#2}{##1\comp,##2}
\symdef{aseqfromtovia}[args=aii,prec=nobrackets]{#1\comp{,\ellipses,}#2\comp{,\ellipses,}#3}{##1\comp,##2}
+ % nat literals
+ \symdef{natliteral}{\comp{\mathtt{Ord}}}
+
% letin (``let'', local definitions, variable substitution)
\symdecl{letin}[args=bii]
\notation{letin}[let]{\comp{{\rm let}}\;#1\comp{=}#2\;\comp{{\rm in}}\;#3}
@@ -5448,25 +6460,62 @@
% structures
\symdecl*{module-type}[args=1]
- \notation{module-type}{\mathtt{MOD} #1}
+ \notation{module-type}{\comp{\mathtt{MOD}} #1}
\symdecl{mathstruct}[name=mathematical-structure,args=a] % TODO
\notation{mathstruct}[angle,prec=nobrackets]{\comp\langle #1 \comp\rangle}{##1 \comp, ##2}
+ % objects
+ \symdecl{object}
+ \notation{object}{\comp{\mathtt{OBJECT}}}
+
}
+
+
\ExplSyntaxOn
\stex_add_to_current_module:n{
- \let\nappa\apply
\def\nappli#1#2#3#4{\apply{#1}{\naseqli{#2}{#3}{#4}}}
\def\nappui#1#2#3#4{\apply{#1}{\nasequi{#2}{#3}{#4}}}
\def\livar{\csname sequence-index\endcsname[li]}
\def\uivar{\csname sequence-index\endcsname[ui]}
\def\naseqli#1#2#3{\aseqfromto{\livar{#1}{#2}}{\livar{#1}{#3}}}
\def\nasequi#1#2#3{\aseqfromto{\uivar{#1}{#2}}{\uivar{#1}{#3}}}
- \def\nappe#1#2#3{\apply{#1}{\aseqfromto{#2}{#3}}}
}
\__stex_modules_end_module:
\endgroup
+%%%%%%%%%%%%% others.dtx %%%%%%%%%%%%%
+
+ % None
+\NewDocumentCommand \MSC {m} {
+ % TODO
+}
+\@ifpackageloaded{tikzinput}{
+ \RequirePackage{stex-tikzinput}
+}{}
+
+\bool_if:NT \c_stex_persist_mode_bool {
+ \let\__stex_notation_restore_notation_old:nnnnn
+ \__stex_notation_restore_notation:nnnnn
+ \def\__stex_notation_restore_notation_new:nnnnn#1#2#3#4#5{
+ \__stex_notation_restore_notation_old:nnnnn{#1}{#2}{#3}{#4}{#5}
+ \ExplSyntaxOn
+ }
+ \def\__stex_notation_restore_notation:nnnnn{
+ \ExplSyntaxOff
+ \catcode`~10
+ \__stex_notation_restore_notation_new:nnnnn
+ }
+ \input{\jobname.sms}
+ \let\__stex_notation_restore_notation:nnnnn
+ \__stex_notation_restore_notation_old:nnnnn
+ \prop_if_exist:NT\c_stex_mathhub_main_manifest_prop{
+ \prop_get:NnN \c_stex_mathhub_main_manifest_prop {id}
+ \l_tmpa_str
+ \prop_set_eq:cN { c_stex_mathhub_\l_tmpa_str _manifest_prop }
+ \c_stex_mathhub_main_manifest_prop
+ \exp_args:Nx \stex_set_current_repository:n { \l_tmpa_str }
+ }
+}
\endinput
%%
%% End of file `stex.sty'.
diff --git a/Master/texmf-dist/tex/latex/stex/tikzinput.sty b/Master/texmf-dist/tex/latex/stex/tikzinput.sty
index 036bde9376a..105ef77389e 100644
--- a/Master/texmf-dist/tex/latex/stex/tikzinput.sty
+++ b/Master/texmf-dist/tex/latex/stex/tikzinput.sty
@@ -9,7 +9,7 @@
%%%%%%%%%%%%% tikzinput.dtx %%%%%%%%%%%%%
-\ProvidesExplPackage{tikzinput}{2022/02/26}{3.0.1}{tikzinput package}
+\ProvidesExplPackage{tikzinput}{2022/05/24}{3.1.0}{tikzinput package}
\RequirePackage{l3keys2e}
\keys_define:nn { tikzinput } {