summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stex/source
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/stex/source')
-rw-r--r--macros/latex/contrib/stex/source/extensions/document-structure.dtx20
-rw-r--r--macros/latex/contrib/stex/source/extensions/hwexam.dtx51
-rw-r--r--macros/latex/contrib/stex/source/extensions/notesslides.dtx141
-rw-r--r--macros/latex/contrib/stex/source/extensions/problem.dtx167
-rw-r--r--macros/latex/contrib/stex/source/extensions/tikzinput.dtx19
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-basics.dtx29
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-features.dtx66
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-inheritance.dtx11
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-mathhub.dtx19
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-metatheory.dtx2
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-modules.dtx16
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-others.dtx4
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-proofs.dtx578
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-references.dtx573
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-statements.dtx6
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-symbols.dtx209
-rw-r--r--macros/latex/contrib/stex/source/stex/stex-terms.dtx182
17 files changed, 1226 insertions, 867 deletions
diff --git a/macros/latex/contrib/stex/source/extensions/document-structure.dtx b/macros/latex/contrib/stex/source/extensions/document-structure.dtx
index b05e4d464c..a73e0fd856 100644
--- a/macros/latex/contrib/stex/source/extensions/document-structure.dtx
+++ b/macros/latex/contrib/stex/source/extensions/document-structure.dtx
@@ -9,7 +9,7 @@
%
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -42,14 +42,14 @@
%
% \tableofcontents
%
-% \input{../../doc/packages/stex-document-structure}
-% \fi
-%
-%
% \begin{documentation}\label{pkg:documentstructure:doc}
-%
+% \begin{sfragment}{The User Interface}
+% \input{../../doc/packages/stex-document-structure}
+% \end{sfragment}
% \end{documentation}
%
+% \fi
+%
% \begin{implementation}\label{pkg:documentstructure:impl}
%
% \begin{sfragment}{document-structure.sty Implementation}
@@ -57,7 +57,7 @@
% \begin{macrocode}
%<*package>
%<@@=document_structure>
-\ProvidesExplPackage{document-structure}{2022/05/24}{3.1.0}{Modular Document Structure}
+\ProvidesExplPackage{document-structure}{2022/09/14}{3.2.0}{Modular Document Structure}
\RequirePackage{l3keys2e}
% \end{macrocode}
%
@@ -72,7 +72,7 @@
\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}
@@ -98,7 +98,7 @@
\AddToHook{begindocument}{
\ltx@ifpackageloaded{babel}{
\clist_set:Nx \l_tmpa_clist {\bbl@loaded}
- \clist_if_in:NnT \l_tmpa_clist {ngerman}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{ngerman}}{
\makeatletter\input{document-structure-ngerman.ldf}\makeatother
}
}{}
@@ -223,7 +223,6 @@
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
@@ -236,7 +235,6 @@
\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
diff --git a/macros/latex/contrib/stex/source/extensions/hwexam.dtx b/macros/latex/contrib/stex/source/extensions/hwexam.dtx
index e166fd0397..de3538d53f 100644
--- a/macros/latex/contrib/stex/source/extensions/hwexam.dtx
+++ b/macros/latex/contrib/stex/source/extensions/hwexam.dtx
@@ -10,7 +10,7 @@
% \iffalse
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -32,8 +32,10 @@
% \url{http://kwarc.info/kohlhase}}
% \maketitle
%
-%\ifinfulldoc\else
-%\begin{abstract}
+% \begin{documentation}
+%\ifinfulldoc\else
+%
+%\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.
%
@@ -43,12 +45,11 @@
% \end{abstract}
%
% \tableofcontents
-%
+% \begin{sfragment}{The User Intterface}
% \input{../../doc/packages/stex-hwexam}
+% \end{sfragment}
% \fi
%
-% \begin{documentation}
-%
% \end{documentation}
%
%\begin{implementation}
@@ -63,13 +64,14 @@
%
% \begin{macrocode}
%<*package>
-\ProvidesExplPackage{hwexam}{2022/05/24}{3.1.0}{homework assignments and exams}
+\ProvidesExplPackage{hwexam}{2022/09/14}{3.2.0}{homework assignments and exams}
\RequirePackage{l3keys2e}
\newif\iftest\testfalse
-\DeclareOption{test}{\testtrue}
+\DeclareOption{test}{\testtrue\PassOptionsToPackage{\CurrentOption}{problem}}
\newif\ifmultiple\multiplefalse
\DeclareOption{multiple}{\multipletrue}
+\DeclareOption{lang}{\PassOptionsToPackage{\CurrentOption}{problem}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{problem}}
\ProcessOptions
% \end{macrocode}
@@ -86,9 +88,8 @@
\newcommand\hwexam@assignment@kw{Assignment}
\newcommand\hwexam@given@kw{Given}
\newcommand\hwexam@due@kw{Due}
-\newcommand\hwexam@testemptypage@kw{This~page~was~intentionally~left~
- blank~for~extra~space}
- \def\hwexam@minutes@kw{minutes}
+\newcommand\hwexam@testemptypage@kw{This~page~was~intentionally~left~blank~for~extra~space}
+\newcommand\hwexam@minutes@kw{minutes}
\newcommand\correction@probs@kw{prob.}
\newcommand\correction@pts@kw{total}
\newcommand\correction@reached@kw{reached}
@@ -104,16 +105,16 @@
\ltx@ifpackageloaded{babel}{
\makeatletter
\clist_set:Nx \l_tmpa_clist {\bbl@loaded}
- \clist_if_in:NnT \l_tmpa_clist {ngerman}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{ngerman}}{
\input{hwexam-ngerman.ldf}
}
- \clist_if_in:NnT \l_tmpa_clist {finnish}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{finnish}}{
\input{hwexam-finnish.ldf}
}
- \clist_if_in:NnT \l_tmpa_clist {french}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{french}}{
\input{hwexam-french.ldf}
}
- \clist_if_in:NnT \l_tmpa_clist {russian}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{russian}}{
\input{hwexam-russian.ldf}
}
\makeatother
@@ -265,7 +266,7 @@
}{
\global\setcounter{assignment}{\int_use:N\l_@@_assign_number_int}
}
- \setcounter{problem}{0}
+ \setcounter{sproblem}{0}
\renewcommand\prob@label[1]{\assignment@number.##1}
\def\current@section@level{\document@hwexamtype}
%\sref@label@id{\document@hwexamtype \thesection}
@@ -416,24 +417,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\testspace}
-% \begin{macrocode}
-\newcommand\testspace[1]{\iftest\vspace*{#1}\fi}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\testnewpage}
-% \begin{macrocode}
-\newcommand\testnewpage{\iftest\newpage\fi}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\testemptypage}
-% \begin{macrocode}
-\newcommand\testemptypage[1][]{\iftest\begin{center}\hwexam@testemptypage@kw\end{center}\vfill\eject\else\fi}
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\@problem}
% This macro acts on a problem's record in the |*.aux| file. Here we redefine it (it was
% defined to do nothing in |problem.sty|) to generate the correction table.
diff --git a/macros/latex/contrib/stex/source/extensions/notesslides.dtx b/macros/latex/contrib/stex/source/extensions/notesslides.dtx
index ff06827660..e74693c26b 100644
--- a/macros/latex/contrib/stex/source/extensions/notesslides.dtx
+++ b/macros/latex/contrib/stex/source/extensions/notesslides.dtx
@@ -11,9 +11,8 @@
% \iffalse
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
-
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
@@ -54,7 +53,9 @@
% see \href{\basedocurl/manual.pdf}{the \sTeX Manual} or the
% \href{\basedocurl/stex.pdf}{full \sTeX documentation}.
%
-% \input{../../doc/packages/stex-slides}
+% \begin{sfragment}{The User Interface}
+% \input{../../doc/packages/stex-notesslides}
+% \end{sfragment}
% \fi
%
% \begin{documentation}\label{pkg:notesslides:doc}
@@ -76,7 +77,7 @@
% \begin{macrocode}
%<*cls>
%<@@=notesslides>
-\ProvidesExplClass{notesslides}{2022/05/24}{3.1.0}{notesslides Class}
+\ProvidesExplClass{notesslides}{2022/09/14}{3.2.0}{notesslides Class}
\RequirePackage{l3keys2e}
\keys_define:nn{notesslides / cls}{
@@ -121,7 +122,7 @@
% now we do the same for the |notesslides| package.
% \begin{macrocode}
%<*package>
-\ProvidesExplPackage{notesslides}{2022/05/24}{3.1.0}{notesslides Package}
+\ProvidesExplPackage{notesslides}{2022/09/14}{3.2.0}{notesslides Package}
\RequirePackage{l3keys2e}
\keys_define:nn{notesslides / pkg}{
@@ -208,35 +209,23 @@
\RequirePackage[bookmarks,bookmarksopen,bookmarksnumbered,breaklinks,hidelinks]{hyperref}
}
\RequirePackage{stex-tikzinput}
-\RequirePackage{etoolbox}
-\RequirePackage{amssymb}
-\RequirePackage{amsmath}
\RequirePackage{comment}
-\RequirePackage{textcomp}
\RequirePackage{url}
\RequirePackage{graphicx}
\RequirePackage{pgf}
+\RequirePackage{bookmark}
% \end{macrocode}
%
% \subsection{Notes and Slides}\label{sec:impl:noteslides}
%
% For the lecture notes cases, we also provide the |\usetheme| macro that would otherwise
-% come from the the |beamer| class. While the latter loads
-% |beamertheme|\meta{theme}{.sty}, the notes version loads
-% |beamernotestheme|\meta{theme}|.sty|.\ednote{MK: This is not ideal, but I am not sure
-% that I want to be able to provide the full theme functionality there.}
+% come from the the |beamer| class.
% \begin{macrocode}
\bool_if:NT \c_@@_notes_bool {
- \renewcommand\usetheme[2][]{\usepackage[#1]{beamernotestheme#2}}
+ \renewcommand\usetheme[2][]{\usepackage[#1]{beamertheme#2}}
}
-
-
\NewDocumentCommand \libusetheme {O{} m} {
- \bool_if:NTF \c_@@_notes_bool {
- \libusepackage[#1]{beamernotestheme#2}
- }{
\libusepackage[#1]{beamertheme#2}
- }
}
% \end{macrocode}
@@ -485,8 +474,6 @@
\includegraphics[#1]{\mhpath\Gin@mhrepos{#2}}
}
-
-
\bool_if:NTF \c_@@_notes_bool {
\setlength{\slidelogoheight}{.4cm}
}{
@@ -506,10 +493,26 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\author}
+% In notes mode, we redefine the |\author| macro so that it does not disregard the
+% optional argument (as \pkg{beamerarticle} does). We want to use it to set the source
+% later.
+% \begin{macrocode}
+\bool_if:NT \c_@@_notes_bool {
+ \def\author{\@dblarg\ns@author}
+ \long\def\ns@author[#1]#2{%
+ \def\c_@@_shortauthor{#1}%
+ \def\@author{#2}
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\setsource}
-% |\source| stores the writer's name. By default it is {\it Michael Kohlhase} since he is the main user and designer of this package. |\setsource{|\meta{name}|}| can change the writer's name.
+% |\source| stores the writer's name. By default it is {\it Michael Kohlhase} since he
+% is the main user and designer of this package. |\setsource{|\meta{name}|}| can change
+% the writer's name.
% \begin{macrocode}
-\def\source{Michael Kohlhase}% customize locally
\newrobustcmd{\setsource}[1]{\def\source{#1}}
% \end{macrocode}
% \end{macro}
@@ -521,7 +524,13 @@
% logo. |\setlicensing[|\meta{url}|]{|\meta{logo name}|}| is used for customization,
% where ||\meta{url}|| is optional.
% \begin{macrocode}
-\def\copyrightnotice{\footnotesize\copyright :\hspace{.3ex}{\source}}
+\def\copyrightnotice{%
+ \footnotesize\copyright :\hspace{.3ex}%
+ \ifcsname source\endcsname\source\else%
+ \ifcsname c_@@_shortauthor\endcsname\c_@@_shortauthor\else%
+ \PackageWarning{notesslides}{Author/Source~undefined~in~copyright~notice}%
+ ?source/author?\fi%
+ \fi}
\newsavebox{\cclogo}
\sbox{\cclogo}{\includegraphics[height=\slidelogoheight]{stex-cc_somerights}}
\newif\ifcchref\cchreffalse
@@ -617,69 +626,6 @@
% \end{macrocode}
% \end{macro}
%
-% \subsection{Colors and Highlighting}\label{sec:impl:highlighting}
-%
-% We first specify sans serif fonts as the default.
-%
-% \begin{macrocode}
-\sffamily
-% \end{macrocode}
-%
-% Now, we set up an infrastructure for highlighting phrases in slides. Note that we use
-% content-oriented macros for highlighting rather than directly using color markup.
-% The first thing to to is to adapt the green so that it is dark enough for most beamers
-% \begin{macrocode}
-\AddToHook{begindocument}{
- \definecolor{green}{rgb}{0,.5,0}
- \definecolor{purple}{cmyk}{.3,1,0,.17}
-}
-% \end{macrocode}
-%
-% We customize the |\defemph|, |\symrefemph|, |\compemph|, and |\titleemph| macros with
-% colors. Furthermore we customize the |\__omtextlec| macro for the appearance of line end
-% comments in |\lec|.
-%
-% \begin{macrocode}
-% \def\STpresent#1{\textcolor{blue}{#1}}
-\def\defemph#1{{\textcolor{magenta}{#1}}}
-\def\symrefemph#1{{\textcolor{cyan}{#1}}}
-\def\compemph#1{{\textcolor{blue}{#1}}}
-\def\titleemph#1{{\textcolor{blue}{#1}}}
-\def\__omtext_lec#1{(\textcolor{green}{#1})}
-% \end{macrocode}
-%
-% I like to use the dangerous bend symbol for warnings, so we provide it here.
-% \begin{macro}{\textwarning}
-% as the macro can be used quite often we put it into a box register, so that it is only
-% loaded once.
-% \begin{macrocode}
-\pgfdeclareimage[width=.8em]{miko@small@dbend}{stex-dangerous-bend}
-\def\smalltextwarning{
- \pgfuseimage{miko@small@dbend}
- \xspace
-}
-\pgfdeclareimage[width=1.2em]{miko@dbend}{stex-dangerous-bend}
-\newrobustcmd\textwarning{
- \raisebox{-.05cm}{\pgfuseimage{miko@dbend}}
- \xspace
-}
-\pgfdeclareimage[width=2.5em]{miko@big@dbend}{stex-dangerous-bend}
-\newrobustcmd\bigtextwarning{
- \raisebox{-.05cm}{\pgfuseimage{miko@big@dbend}}
- \xspace
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\newrobustcmd\putgraphicsat[3]{
- \begin{picture}(0,0)\put(#1){\includegraphics[#2]{#3}}\end{picture}
-}
-\newrobustcmd\putat[2]{
- \begin{picture}(0,0)\put(#1){#2}\end{picture}
-}
-% \end{macrocode}
-%
% \subsection{Sectioning}
%
% If the |sectocframes| option is set, then we make section frames. We first define
@@ -744,33 +690,48 @@
\ifcase\l_document_structure_section_level_int\or
\stepcounter{part}
\def\@@label{{\omdoc@part@kw}~\Roman{part}}
+ \addcontentsline{toc}{part}{\protect\numberline{\thepart}#2}
+ \pdfbookmark[0]{\thepart\ #2}{part.\thepart}
\def\currentsectionlevel{\omdoc@part@kw}
\or
\stepcounter{chapter}
\def\@@label{{\omdoc@chapter@kw}~\arabic{chapter}}
+ \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#2}
+ \pdfbookmark[1]{\thechapter\ #2}{chapter.\cs_if_exist:cT{thepart}\thepart.\thechapter}
\def\currentsectionlevel{\omdoc@chapter@kw}
\or
\stepcounter{section}
\def\@@label{\part@prefix\arabic{section}}
+ \addcontentsline{toc}{section}{\protect\numberline{\thesection}#2}
+ \pdfbookmark[2]{\cs_if_exist:cT{thechapter}{\thechapter.}\thesection\ #2}
+ {section.\cs_if_exist:cT{thepart}{\thepart}.\cs_if_exist:cT{thechapter}{\thechapter}.\thesection}
\def\currentsectionlevel{\omdoc@section@kw}
\or
\stepcounter{subsection}
\def\@@label{\part@prefix\arabic{section}.\arabic{subsection}}
+ \addcontentsline{toc}{subsection}{\protect\numberline{\thesubsection}#2}
+ \pdfbookmark[3]{\cs_if_exist:cT{thechapter}{\thechapter.}\thesection.\thesubsection\ #2}
+ {subsection.\cs_if_exist:cT{thepart}{\thepart}.\cs_if_exist:cT{thechapter}{\thechapter}.\thesection.\thesubsection}
\def\currentsectionlevel{\omdoc@subsection@kw}
\or
\stepcounter{subsubsection}
\def\@@label{\part@prefix\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}
+ \addcontentsline{toc}{subsubsection}{\protect\numberline{\thesubsubsection}#2}
+ \pdfbookmark[4]{\cs_if_exist:cT{thechapter}{\thechapter.}\thesection.\thesubsection.\thesubsubsection\ #2}
+ {subsubsection.\cs_if_exist:cT{thepart}{\thepart}.\cs_if_exist:cT{thechapter}{\thechapter}.\thesection.\thesubsection.\thesubsubsection}
\def\currentsectionlevel{\omdoc@subsubsection@kw}
\or
\stepcounter{paragraph}
\def\@@label{\part@prefix\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}}
+ \addcontentsline{toc}{paragraph}{\protect\numberline{\theparagraph}#2}
+ \pdfbookmark[5]{\cs_if_exist:cT{thechapter}{\thechapter.}\thesection.\thesubsection.\thesubsubsection.\theparagraph\ #2}
+ {paragraph.\cs_if_exist:cT{thepart}{\thepart}.\cs_if_exist:cT{thechapter}{\thechapter}.\thesection.\thesubsection.\thesubsubsection.\theparagraph}
\def\currentsectionlevel{\omdoc@paragraph@kw}
\else
\def\@@label{}
\def\currentsectionlevel{\omdoc@paragraph@kw}
\fi% end ifcase
- \@@label%\sref@label@id\@@label
- \quad #2%
+ \@@label\quad #2%
}%
\vfill%
\end{frame}%
diff --git a/macros/latex/contrib/stex/source/extensions/problem.dtx b/macros/latex/contrib/stex/source/extensions/problem.dtx
index 75a34eaf8e..3fcc3215ef 100644
--- a/macros/latex/contrib/stex/source/extensions/problem.dtx
+++ b/macros/latex/contrib/stex/source/extensions/problem.dtx
@@ -10,7 +10,7 @@
% \iffalse
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\RequirePackage[hints,solutions,notes]{problem}
@@ -32,6 +32,7 @@
% \maketitle
%
% \ifinfulldoc\else
+% \begin{documentation}
% \begin{abstract}
% This is the documentation for the \pkg{problem} package.
% For a more high-level introduction,
@@ -44,12 +45,13 @@
% \end{abstract}
%
% \tableofcontents
-%
-% \input{../../doc/packages/stex-problem}
+% \begin{sfragment}{User Interface}
+% \input{../../doc/packages/stex-problem}
+% \ednote{MK: the input does not work! it includes the commented stuff as well. }
+% \end{sfragment}
+% \end{documentation}
% \fi
%
-% \begin{documentation}
-% \end{documentation}
% \begin{implementation}
%
% \section{The Implementation}\label{sec:implementation}
@@ -63,8 +65,9 @@
% \begin{macrocode}
%<*package>
%<@@=problems>
-\ProvidesExplPackage{problem}{2022/05/24}{3.1.0}{Semantic Markup for Problems}
-\RequirePackage{l3keys2e,stex}
+\ProvidesExplPackage{problem}{2022/09/14}{3.2.0}{Semantic Markup for Problems}
+\RequirePackage{l3keys2e}
+\RequirePackage{amssymb}% for \Box
\keys_define:nn { problem / pkg }{
notes .default:n = { true },
@@ -81,7 +84,11 @@
min .bool_set:N = \c_@@_min_bool,
boxed .default:n = { true },
boxed .bool_set:N = \c_@@_boxed_bool,
- unknown .code:n = {}
+ test .default:n = { true },
+ test .bool_set:N = \c_@@_test_bool,
+ unknown .code:n = {
+ \PassOptionsToPackage{\CurrentOption}{stex}
+ }
}
\newif\ifsolutions
@@ -91,6 +98,7 @@
}{
\solutionsfalse
}
+\RequirePackage{stex}
% \end{macrocode}
%
% Then we make sure that the necessary packages are loaded (in the right versions).
@@ -117,6 +125,8 @@
\def\prob@gnote@kw{Grading}
\def\prob@pt@kw{pt}
\def\prob@min@kw{min}
+\def\prob@correct@kw{Correct}
+\def\prob@wrong@kw{Wrong}
% \end{macrocode}
% \end{macro}
%
@@ -126,16 +136,16 @@
\ltx@ifpackageloaded{babel}{
\makeatletter
\clist_set:Nx \l_tmpa_clist {\bbl@loaded}
- \clist_if_in:NnT \l_tmpa_clist {ngerman}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{ngerman}}{
\input{problem-ngerman.ldf}
}
- \clist_if_in:NnT \l_tmpa_clist {finnish}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{finnish}}{
\input{problem-finnish.ldf}
}
- \clist_if_in:NnT \l_tmpa_clist {french}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{french}}{
\input{problem-french.ldf}
}
- \clist_if_in:NnT \l_tmpa_clist {russian}{
+ \exp_args:NNx \clist_if_in:NnT \l_tmpa_clist {\detokenize{russian}}{
\input{problem-russian.ldf}
}
\makeatother
@@ -178,8 +188,10 @@
% Then we set up a counter for problems.
% \begin{macro}{\numberproblemsin}
% \begin{macrocode}
-\newcounter{problem}[section]
-\newcommand\numberproblemsin[1]{\@addtoreset{problem}{#1}}
+\newcounter{sproblem}[section]
+\newcommand\numberproblemsin[1]{\@addtoreset{sproblem}{#1}}
+\def\theplainsproblem{\arabic{sproblem}}
+\def\thesproblem{\thesection.\theplainsproblem}
% \end{macrocode}
% \end{macro}
%
@@ -200,10 +212,11 @@
\int_if_exist:NTF \l_@@_prob_refnum_int {
\prob@label{\int_use:N \l_@@_prob_refnum_int }
}{
- \prob@label\theproblem
+ \prob@label\theplainsproblem
}
}
}
+\def\sproblemautorefname{\prob@problem@kw}
% \end{macrocode}
% \end{macro}
%
@@ -216,10 +229,10 @@
\tl_if_exist:NTF \l_@@_inclprob_title_tl {
#2 \l_@@_inclprob_title_tl #3
}{
- \tl_if_exist:NTF \l_@@_prob_title_tl {
- #2 \l_@@_prob_title_tl #3
- }{
+ \tl_if_empty:NTF \l_@@_prob_title_tl {
#1
+ }{
+ #2 \l_@@_prob_title_tl #3
}
}
}
@@ -248,7 +261,7 @@
\newenvironment{sproblem}[1][]{
\_@@_prob_args:n{#1}%\sref@target%
\@in@omtexttrue% we are in a statement (for inline definitions)
- \stepcounter{problem}\record@problem
+ \refstepcounter{sproblem}\record@problem
\def\current@section@level{\prob@problem@kw}
\str_if_empty:NT \l_@@_prob_name_str {
@@ -315,7 +328,7 @@
}
}
\stex_ref_new_doc_target:n \sproblemid
- \stex_smsmode_do:
+ \stex_if_smsmode:TF \stex_smsmode_do: \ignorespacesandpars
}{
\__stex_modules_end_module:
\stex_if_smsmode:F{
@@ -408,35 +421,18 @@
% \begin{macrocode}
\keys_define:nn { problem / solution }{
id .str_set_x:N = \l_@@_solution_id_str ,
- for .tl_set:N = \l_@@_solution_for_tl ,
- height .dim_set:N = \l_@@_solution_height_dim ,
- creators .clist_set:N = \l_@@_solution_creators_clist ,
- contributors .clist_set:N = \l_@@_solution_contributors_clist ,
- srccite .tl_set:N = \l_@@_solution_srccite_tl
+ for .str_set_x:N = \l_@@_solution_for_str ,
+ type .str_set_x:N = \l_@@_solution_type_str ,
+ title .tl_set:N = \l_@@_solution_title_tl
}
\cs_new_protected:Nn \_@@_solution_args:n {
\str_clear:N \l_@@_solution_id_str
- \tl_clear:N \l_@@_solution_for_tl
- \tl_clear:N \l_@@_solution_srccite_tl
- \clist_clear:N \l_@@_solution_creators_clist
- \clist_clear:N \l_@@_solution_contributors_clist
- \dim_zero:N \l_@@_solution_height_dim
+ \str_clear:N \l_@@_solution_type_str
+ \str_clear:N \l_@@_solution_for_str
+ \tl_clear:N \l_@@_solution_title_tl
\keys_set:nn { problem / solution }{ #1 }
}
% \end{macrocode}
-% the next step is to define a helper macro that does what is needed to start a solution.
-% \begin{macrocode}
-\newcommand\@startsolution[1][]{
- \_@@_solution_args:n { #1 }
- \@in@omtexttrue% we are in a statement.
- \bool_if:NF \c_@@_boxed_bool { \hrule }
- \smallskip\noindent
- {\textbf\prob@solution@kw :\enspace}
- \begin{small}
- \def\current@section@level{\prob@solution@kw}
- \ignorespacesandpars
-}
-% \end{macrocode}
%
% \begin{macro}{\startsolutions}
% for the |\startsolutions| macro we use the |\specialcomment| macro from the |comment|
@@ -445,14 +441,20 @@
% \begin{macrocode}
\box_new:N \l_@@_solution_box
\newenvironment{solution}[1][]{
+ \_@@_solution_args:n{#1}
\stex_html_backend:TF{
\stex_if_do_html:T{
\begin{stex_annotate_env}{solution}{}
+ \str_if_empty:NF \l_@@_solution_type_str {
+ \par\noindent
+ \stex_annotate_invisible:nnn{typestrings}{\sexampletype}{}
+ }
+ \noindent\textbf{Solution\tl_if_empty:NF\l_@@_solution_title_tl{~(\l_@@_solution_title_tl)}: }~
}
}{
\setbox\l_@@_solution_box\vbox\bgroup
\par\smallskip\hrule\smallskip
- \noindent\textbf{Solution:}~
+ \noindent\textbf{Solution\tl_if_empty:NF\l_@@_solution_title_tl{~(\l_@@_solution_title_tl)}: }~
}
}{
\stex_html_backend:TF{
@@ -463,6 +465,7 @@
\smallskip\hrule
\egroup
\bool_if:NT \c_@@_solutions_bool {
+ \strut\par\noindent
\box\l_@@_solution_box
}
}
@@ -470,6 +473,7 @@
\newcommand\startsolutions{
\bool_set_true:N \c_@@_solutions_bool
+ \solutionstrue
% \specialcomment{solution}{\@startsolution}{
% \bool_if:NF \c_@@_boxed_bool {
% \hrule\medskip
@@ -485,19 +489,10 @@
%
% \begin{macro}{\stopsolutions}
% \begin{macrocode}
-\newcommand\stopsolutions{\bool_set_false:N \c_@@_solutions_bool}%\excludecomment{solution}}
+\newcommand\stopsolutions{\bool_set_false:N \c_@@_solutions_bool \solutionsfalse}%\excludecomment{solution}}
% \end{macrocode}
% \end{macro}
-%
-% so it only remains to start/stop solutions depending on what option was specified.
%
-% \begin{macrocode}
-\ifsolutions
- \startsolutions
-\else
- \stopsolutions
-\fi
-% \end{macrocode}
%
% \begin{environment}{exnote}
% \begin{macrocode}
@@ -550,8 +545,10 @@
}
% \end{macrocode}
% \end{environment}
+%
+% \subsection{Markup for Added Value Services}\label{sec:impl:avs}
%
-% \subsection{Multiple Choice Blocks}\label{sec:impl:mcq}
+% \subsubsection{Multiple Choice Blocks}\label{sec:impl:mcq}
%
% \begin{environment}{mcb}
% \ednote{MK: maybe import something better here from a dedicated MC package}
@@ -579,8 +576,8 @@
T .bool_set:N = \l_@@_mcc_t_bool ,
F .default:n = { false } ,
F .bool_set:N = \l_@@_mcc_f_bool ,
- Ttext .tl_set:N = \l_@@_mcc_Ttext_str ,
- Ftext .tl_set:N = \l_@@_mcc_Ftext_str
+ Ttext .tl_set:N = \l_@@_mcc_Ttext_tl ,
+ Ftext .tl_set:N = \l_@@_mcc_Ftext_tl
}
\cs_new_protected:Nn \l_@@_mcc_args:n {
\str_clear:N \l_@@_mcc_id_str
@@ -596,12 +593,12 @@
%
% \begin{macro}{\mcc}
% \begin{macrocode}
-\def\mccTrueText{\textbf{(true)~}}
-\def\mccFalseText{\textbf{(false)~}}
+\def\mccTrueText{\textbf{\prob@correct@kw!~}}
+\def\mccFalseText{\textbf{\prob@wrong@kw!~}}
\newcommand\mcc[2][]{
\l_@@_mcc_args:n{ #1 }
\item[$\Box$] #2
- \ifsolutions
+ \bool_if:NT \c_@@_solutions_bool{
\\
\bool_if:NT \l_@@_mcc_t_bool {
\tl_if_empty:NTF\l_@@_mcc_Ttext_tl\mccTrueText\l_@@_mcc_Ttext_tl
@@ -610,13 +607,27 @@
\tl_if_empty:NTF\l_@@_mcc_Ttext_tl\mccFalseText\l_@@_mcc_Ftext_tl
}
\tl_if_empty:NF \l_@@_mcc_feedback_tl {
- \emph{(\l_@@_mcc_feedback_tl)}
+ \emph{\l_@@_mcc_feedback_tl}
}
- \fi
+ }
} %solutions
% \end{macrocode}
% \end{macro}
+%
+% \subsubsection{Filling in Concrete Solutions}
%
+% \begin{macro}{\includeproblem}
+% This is embarrasingly simple, but can grow over time.
+% \begin{macrocode}
+\newcommand\fillinsol[2][]{%
+ \def\@test{#1}
+ \quad%
+ \ifsolutions\textcolor{red}{#1!}\else%
+ \fbox{\ifx\@test\@empty\phantom{\huge{21}}\else\hspace{#1}\fi}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Including Problems}\label{sec:impl:includeproblem}
%
% \begin{macro}{\includeproblem}
@@ -780,15 +791,45 @@
%</package>
% \end{macrocode}
% \end{macro}
+%
+% \subsection{Testing and Spacing}
+%
+% \begin{macro}{\testspace}
+% \begin{macrocode}
+\newcommand\testspace[1]{\bool_if:NT \c_@@_boxed_bool {\vspace*{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\testnewpage}
+% \begin{macrocode}
+\newcommand\testnewpage{\bool_if:NT \c_@@_boxed_bool {\newpage}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\testemptypage}
+% \begin{macrocode}
+\newcommand\testemptypage[1][]{%
+\bool_if:NT \c_@@_boxed_bool {\begin{center}\hwexam@testemptypage@kw\end{center}\vfill\eject\else}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\test*space}
+% \begin{macrocode}
+\newcommand\testsmallspace{\testspace{1cm}}
+\newcommand\testmedspace{\testspace{2cm}}
+\newcommand\testbigspace{\testspace{3cm}}
+% \end{macrocode}
+% \end{macro}
+%
% \end{implementation}
% \ifinfulldoc\else\printbibliography\fi
\endinput
-% LocalWords: GPL structuresharing STR dtx pts keyval xcomment CPERL DefKeyVal iffalse
%%% Local Variables:
%%% mode: doctex
%%% TeX-master: t
%%% End:
% \fi
+% LocalWords: GPL structuresharing STR dtx pts keyval xcomment CPERL DefKeyVal iffalse
% LocalWords: RequirePackage Semiverbatim DefEnvironment OptionalKeyVals soln texttt baz
% LocalWords: exnote DefConstructor inclprob NeedsTeXFormat omd.sty textbackslash exfig
% LocalWords: stopsolution fileversion filedate maketitle setcounter tocdepth newpage
diff --git a/macros/latex/contrib/stex/source/extensions/tikzinput.dtx b/macros/latex/contrib/stex/source/extensions/tikzinput.dtx
index fb7bbf76c9..acb6e4bc94 100644
--- a/macros/latex/contrib/stex/source/extensions/tikzinput.dtx
+++ b/macros/latex/contrib/stex/source/extensions/tikzinput.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -67,7 +67,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesExplPackage{tikzinput}{2022/05/24}{3.1.0}{tikzinput package}
+\ProvidesExplPackage{tikzinput}{2022/09/14}{3.2.0}{tikzinput package}
\RequirePackage{l3keys2e}
\keys_define:nn { tikzinput } {
@@ -130,7 +130,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesExplPackage{stex-tikzinput}{2022/05/24}{3.1.0}{stex-tikzinput}
+\ProvidesExplPackage{stex-tikzinput}{2022/09/14}{3.2.0}{stex-tikzinput}
\RequirePackage{stex}
\RequirePackage{tikzinput}
@@ -207,5 +207,14 @@
%
% \PrintIndex
-% LocalWords: bibfolder jobname.dtx tikzinput.dtx usetikzlibrary Gin@ewidth Gin@eheight
-% LocalWords: resizebox ctikzinput mhtikzinput Gin@mhrepos mhpath
+% \endinput
+% Local Variables:
+% mode: doctex
+% TeX-master: t
+% End:
+
+% LocalWords: libfolder jobname.dtx tikzinput.dtx usetikzlibrary Gin@ewidth Gin@eheight
+% LocalWords: ctikzinput mhpath pgfkeys@spdef pgfutil@empty 1@atcode catcode l_tmpa_str
+% LocalWords: pgfutil@InputIfFileExists libusetikzlibrary msg_error:nnn notinarchive
+% LocalWords: seq_clear:N seq_set_eq:NN l_tmpa_seq c_stex_mathhub_seq seq_set_split:NnV
+% LocalWords: l_tmpb_seq seq_if_empty_p:N tikzlibrary seq_put_right:No seq_pop_left:NN
diff --git a/macros/latex/contrib/stex/source/stex/stex-basics.dtx b/macros/latex/contrib/stex/source/stex/stex-basics.dtx
index d58f56a49c..0387e16439 100644
--- a/macros/latex/contrib/stex/source/stex/stex-basics.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-basics.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -150,7 +150,7 @@
%%%%%%%%%%%%% basics.dtx %%%%%%%%%%%%%
\RequirePackage{expl3,l3keys2e}
-\ProvidesExplClass{stex}{2022/05/24}{3.1.0}{sTeX document class}
+\ProvidesExplClass{stex}{2022/09/14}{3.2.0}{sTeX document class}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{stex}}
\ProcessOptions
@@ -198,14 +198,14 @@
%%%%%%%%%%%%% basics.dtx %%%%%%%%%%%%%
\RequirePackage{expl3,l3keys2e,ltxcmds}
-\ProvidesExplPackage{stex}{2022/05/24}{3.1.0}{sTeX package}
+\ProvidesExplPackage{stex}{2022/09/14}{3.2.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}
+\message{^^J*~This~is~sTeX~version~3.2.0~*^^J}
%\RequirePackage{morewrites}
%\RequirePackage{amsmath}
@@ -287,7 +287,7 @@
\msg_redirect_module:nnn{ stex }{ none }{ term }
}{
\clist_map_inline:Nn \c_stex_debug_clist {
- \msg_redirect_name:nnn{ stex }{ debug / ##1 }{ term }
+ \msg_redirect_name:nnn{ stex }{ debug / #1 }{ term }
}
}
@@ -367,14 +367,26 @@
% the \latexml-implementations resort to perl bindings.
%
% \begin{macrocode}
+\ifcsname if@rustex\endcsname\else
+ \expandafter\newif\csname if@rustex\endcsname
+ \@rustexfalse
+\fi
+\ifcsname if@latexml\endcsname\else
+ \expandafter\newif\csname if@latexml\endcsname
+ \@latexmlfalse
+\fi
\tl_if_exist:NF\stex@backend{
- \ifcsname if@rustex\endcsname
+ \if@rustex
\def\stex@backend{rustex}
\else
- \ifcsname if@latexml\endcsname
+ \if@latexml
\def\stex@backend{latexml}
\else
- \def\stex@backend{pdflatex}
+ \cs_if_exist:NTF\HCode{
+ \def\stex@backend{tex4ht}
+ }{
+ \def\stex@backend{pdflatex}
+ }
\fi
\fi
}
@@ -482,6 +494,7 @@
}
}
}
+
% \end{macrocode}
%
% \subsection{Persistence}
diff --git a/macros/latex/contrib/stex/source/stex/stex-features.dtx b/macros/latex/contrib/stex/source/stex/stex-features.dtx
index 3a5c8064b7..d770b76e42 100644
--- a/macros/latex/contrib/stex/source/stex/stex-features.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-features.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -385,6 +385,9 @@
{ \l_stex_import_ns_str } { \l_stex_import_archive_str }
{ \l_stex_import_path_str } { \l_stex_import_name_str }
}
+ \exp_args:Nx \stex_add_import_to_current_module:n{
+ \l_stex_import_ns_str ? \l_stex_import_name_str
+ }
\seq_map_inline:Nn \l_@@_copymodule_modules_seq {
\seq_map_inline:cn {c_stex_module_##1_constants}{
@@ -594,8 +597,12 @@
\str_clear:N \l_@@_name_str
\keys_set:nn { stex / features / structure } { #1 }
}
-
\NewDocumentEnvironment{mathstructure}{m O{}}{
+ \begin{mathstructure_inner}{#1}[#2]
+ \stex_smsmode_do:
+ \ignorespacesandpars
+ }{\end{mathstructure_inner}}
+\NewDocumentEnvironment{mathstructure_inner}{m O{}}{
\_@@_structure_args:n { #2 }
\str_if_empty:NT \l_@@_name_str {
\str_set:Nx \l_@@_name_str { #1 }
@@ -617,7 +624,6 @@
\exp_args:Nnnx
\begin{structural_feature_module}{ structure }
{ \l_@@_name_str }{}
- \stex_smsmode_do:
}{
\end{structural_feature_module}
\_stex_reset_up_to_module:n \l_stex_last_feature_str
@@ -696,7 +702,8 @@
\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}}{
+ \exp_args:No \str_if_eq:nnT \l_tmpa_str {####1}{
+ %\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}
@@ -716,6 +723,12 @@
% \begin{macro}{\instantiate}
% \begin{macrocode}
+\NewDocumentEnvironment{usestructure}{m}{
+ \stex_get_structure:n {#1}
+ \exp_args:Nnx \stex_debug:nn{features}{using~structure:~\l_stex_get_structure_module_str}
+ \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str
+}{}
+
\keys_define:nn { stex / instantiate } {
name .str_set_x:N = \l_@@_name_str
}
@@ -724,6 +737,37 @@
\keys_set:nn { stex / instantiate } { #1 }
}
+\NewDocumentEnvironment{extstructure}{m m O{}}{
+ \begin{mathstructure_inner}{#1}[#3]
+ \seq_set_split:Nnn\_@@_extstructure_imports_seq,{#2}
+ \seq_map_inline:Nn\_@@_extstructure_imports_seq {
+ \stex_get_structure:n {##1}
+ \exp_args:Nnx \stex_debug:nn{features}{importing~structure:~\l_stex_get_structure_module_str{}~into~\l_stex_current_module_str}
+ \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str
+ \stex_if_smsmode:F {
+ \stex_annotate_invisible:nnn
+ {import} {\l_stex_get_structure_module_str} {}
+ }
+ \exp_args:Nx \stex_add_import_to_current_module:n {
+ \l_stex_get_structure_module_str
+ }
+ \exp_args:Nx \stex_add_to_current_module:n {
+ \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str
+ }
+ }
+ \stex_smsmode_do:
+ \ignorespacesandpars
+}{
+ \end{mathstructure_inner}
+}
+
+\NewDocumentEnvironment{extstructure*}{m m O{}}{
+ % TODO
+ \begin{extstructure}{#1}{#2}[#3]
+}{
+ \end{extstructure}
+}
+
\NewDocumentCommand \instantiate {m O{} m m O{}}{
\begingroup
\stex_get_structure:n {#3}
@@ -775,7 +819,8 @@
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}
+ assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs} ,
+ argnames = {\prop_item:cn {l_stex_symdecl_##1_prop}{argnames}}
}
\seq_clear:c {l_stex_symdecl_\l_stex_current_module_str?\l_tmpa_str _notations}
}
@@ -872,7 +917,7 @@
}
\cs_new_protected:Nn \_@@_symbolorvar_from_string:n {
- \prop_if_exist:cTF {l_stex_variable_#1 _prop}{
+ \prop_if_exist:cTF {l_stex_symdecl_var://#1 _prop}{
\bool_set_true:N \l_stex_symbol_or_var_bool
\str_set:Nn \l_stex_get_symbol_uri_str { #1 }
}{
@@ -935,12 +980,12 @@
\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}}{
+ {\prop_item:cn{l_stex_symdecl_var://\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_item:cn{l_stex_symdecl_var://\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}}
}{
@@ -974,11 +1019,12 @@
}
\exp_args:NNx \tl_gput_right:Nn \g_@@_aftergroup_tl {
- \prop_set_from_keyval:cn { l_stex_variable_ \l_tmpa_str _prop}{
+ \prop_set_from_keyval:cn { l_stex_symdecl_ var://\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}
+ assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs} ,
+ argnames = {\prop_item:cn {l_stex_symdecl_##1_prop}{argnames}} ,
}
\cs_set_eq:cc {stex_var_notation_\l_tmpa_str _cs}
{g_@@_tmpa_\l_tmpa_str _cs}
diff --git a/macros/latex/contrib/stex/source/stex/stex-inheritance.dtx b/macros/latex/contrib/stex/source/stex/stex-inheritance.dtx
index cde0cfa5c3..109f7af5c9 100644
--- a/macros/latex/contrib/stex/source/stex/stex-inheritance.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-inheritance.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -240,7 +240,9 @@
sexample,
sassertion,
sparagraph,
- mathstructure
+ mathstructure,
+ extstructure,
+ extstructure*
}
}
% \end{macrocode}
@@ -643,14 +645,11 @@
\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_annotate_invisible:nnn
{import} {\l_stex_import_ns_str ? \l_stex_import_name_str} {}
}
- \exp_args:Nx \stex_add_to_current_module:n {
+ \stex_execute_in_module:x {
\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 }
diff --git a/macros/latex/contrib/stex/source/stex/stex-mathhub.dtx b/macros/latex/contrib/stex/source/stex/stex-mathhub.dtx
index 89da6af2fb..e7749dad93 100644
--- a/macros/latex/contrib/stex/source/stex/stex-mathhub.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-mathhub.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -245,6 +245,7 @@
% \begin{macro}{\stex_path_from_string:Nn}
% \begin{macrocode}
\cs_new_protected:Nn \stex_path_from_string:Nn {
+ \stex_debug:nn{files}{#2}
\str_set:Nx \l_tmpa_str { #2 }
\str_if_empty:NTF \l_tmpa_str {
\seq_clear:N #1
@@ -260,6 +261,7 @@
}
\stex_path_canonicalize:N #1
}
+ \stex_debug:nn{files}{Yields: \stex_path_to_string:N#1}
}
% \end{macrocode}
@@ -438,6 +440,7 @@
}
\seq_gset_eq:NN\g_stex_currentfile_seq\g_stex_currentfile_seq
\exp_args:NNo\seq_gpush:Nn\g_@@_stack\g_stex_currentfile_seq
+ \stex_get_document_uri:
}
% \end{macrocode}
% \end{macro}
@@ -454,6 +457,7 @@
\seq_get:NN\g_@@_stack\l_tmpa_seq
\seq_gset_eq:NN\g_stex_currentfile_seq\l_tmpa_seq
}
+ \stex_get_document_uri:
}
% \end{macrocode}
% \end{macro}
@@ -462,7 +466,11 @@
%
% \begin{macrocode}
\AddToHook{file/before}{
- \stex_filestack_push:n{\CurrentFilePath/\CurrentFile}
+ \tl_if_empty:NTF\CurrentFilePath{
+ \stex_filestack_push:n{\CurrentFile}
+ }{
+ \stex_filestack_push:n{\CurrentFilePath/\CurrentFile}
+ }
}
\AddToHook{file/after}{
\stex_filestack_pop:
@@ -483,6 +491,7 @@
\begingroup\escapechar=-1\catcode`\\=12
\exp_args:Nx\stex_kpsewhich:n{-expand-var~\c_percent_str MATHHUB\c_percent_str}
\exp_args:NNx\str_replace_all:Nnn\l_stex_kpsewhich_return_str{\c_backslash_str}/
+ \exp_args:NNx\str_if_eq:onT\l_stex_kpsewhich_return_str{\c_percent_str MATHHUB\c_percent_str}{\str_clear:N\l_stex_kpsewhich_return_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~MATHHUB}
@@ -498,15 +507,15 @@
}{
\stex_kpsewhich:n{-var-value~HOME}
}
- \ior_open:NnT \l_tmpa_ior{\l_stex_kpsewhich_return_str / .stex / mathhub.path}{
+ \ior_open:NnT \g_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
+ \ior_str_get:NN \g_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
+ \ior_close:N \g_tmpa_ior
}
}
\str_if_empty:NTF\c_stex_mathhub_str{
diff --git a/macros/latex/contrib/stex/source/stex/stex-metatheory.dtx b/macros/latex/contrib/stex/source/stex/stex-metatheory.dtx
index 8570531d17..5a9644ac5e 100644
--- a/macros/latex/contrib/stex/source/stex/stex-metatheory.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-metatheory.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
diff --git a/macros/latex/contrib/stex/source/stex/stex-modules.dtx b/macros/latex/contrib/stex/source/stex/stex-modules.dtx
index 5430bd153a..e76e1ead89 100644
--- a/macros/latex/contrib/stex/source/stex/stex-modules.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-modules.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -857,6 +857,20 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{environment}{mmtinterface}
+% \begin{macrocode}
+\NewDocumentEnvironment { mmtinterface } { O{} m m } {
+ \begin{smodule}[#1]{#3}
+ \str_set:Nx \l_stex_module_mmtfor_str {#2}
+ \MMTinclude{#2}
+ \stex_reactivate_macro:N \mmtdecl
+ \stex_reactivate_macro:N \mmtdef
+}{
+ \end{smodule}
+}
+% \end{macrocode}
+% \end{environment}
+%
% \begin{macrocode}
%</package>
% \end{macrocode}
diff --git a/macros/latex/contrib/stex/source/stex/stex-others.dtx b/macros/latex/contrib/stex/source/stex/stex-others.dtx
index e22aa88590..dd07d0e65c 100644
--- a/macros/latex/contrib/stex/source/stex/stex-others.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-others.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -97,6 +97,8 @@
\exp_args:Nx \stex_set_current_repository:n { \l_tmpa_str }
}
}
+
+\stex_get_document_uri:
% \end{macrocode}
%
%
diff --git a/macros/latex/contrib/stex/source/stex/stex-proofs.dtx b/macros/latex/contrib/stex/source/stex/stex-proofs.dtx
index c2cdb3b54e..7c48dc2f89 100644
--- a/macros/latex/contrib/stex/source/stex/stex-proofs.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-proofs.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -87,7 +87,9 @@
title .tl_set:N = \spftitle,
continues .tl_set:N = \l_@@_spf_continues_tl,
functions .tl_set:N = \l_@@_spf_functions_tl,
- method .tl_set:N = \l_@@_spf_method_tl
+ term .tl_set:N = \l_@@_spf_term_tl,
+ method .tl_set:N = \l_@@_spf_method_tl,
+ hide .bool_set:N = \l_@@_spf_hide_bool
}
\cs_new_protected:Nn \_@@_spf_args:n {
\str_clear:N \spfid
@@ -97,11 +99,13 @@
\str_clear:N \spftype
\tl_clear:N \spftitle
\tl_clear:N \l_@@_spf_continues_tl
+ \tl_clear:N \l_@@_spf_term_tl
\tl_clear:N \l_@@_spf_functions_tl
\tl_clear:N \l_@@_spf_method_tl
- \bool_set_false:N \l_@@_inc_counter_bool
+ \bool_set_false:N \l_@@_spf_hide_bool
\keys_set:nn { stex / spf }{ #1 }
}
+\bool_set_true:N \l_@@_inc_counter_bool
% \end{macrocode}
%
% \begin{macro}{\c_@@_flow_str}
@@ -275,168 +279,145 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{spfeq}
-% This is very similar to |\spfsketch|, but uses a computation array\ednote{This should
-% really be more like a tabular with an ensuremath in it. or invoke text on the last
-% column}\ednote{document above}
+% \begin{macro}{\_@@_maybe_comment:,\_@@_maybe_comment_end:,\_@@_start_comment:}
% \begin{macrocode}
-\newenvironment{spfeq}[2][]{
- \_@@_spf_args:n{#1}
- \let \premise \stex_proof_premise:
- \stex_if_smsmode:TF {
- \str_if_empty:NF \spfid {
- \stex_ref_new_doc_target:n \spfid
- }
- }{
- \seq_clear:N \l_tmpa_seq
- \clist_map_inline:Nn \l_@@_spf_for_clist {
- \tl_if_empty:nF{ ##1 }{
- \stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
- \l_stex_get_symbol_uri_str
- }
- }
- }
- \exp_args:Nnnx
- \begin{stex_annotate_env}{spfeq}{\seq_use:Nn \l_tmpa_seq {,}}
- \str_if_empty:NF \spftype {
- \stex_annotate_invisible:nnn{type}{\spftype}{}
- }
+\bool_set_false:N \l_@@_in_spfblock_bool
- \clist_set:No \l_tmpa_clist \spftype
- \tl_clear:N \l_tmpa_tl
- \clist_map_inline:Nn \l_tmpa_clist {
- \tl_if_exist:cT {_@@_spfeq_##1_start:}{
- \tl_set:Nn \l_tmpa_tl {\use:c{_@@_spfeq_##1_start:}}
- }
- \exp_args:No \str_if_eq:nnT \c_@@_flow_str {##1} {
- \tl_set:Nn \l_tmpa_tl {\use:n{}}
- }
- }
- \tl_if_empty:NTF \l_tmpa_tl {
- \_@@_spfeq_start:
- }{
- \l_tmpa_tl
- }{~#2}
- \str_if_empty:NF \spfid {
- \stex_ref_new_doc_target:n \spfid
- }
- \begin{displaymath}\begin{array}{rcll}
- }
- \stex_smsmode_do:
-}{
- \stex_if_smsmode:F {
- \end{array}\end{displaymath}
- \clist_set:No \l_tmpa_clist \spftype
- \tl_clear:N \l_tmpa_tl
- \clist_map_inline:Nn \l_tmpa_clist {
- \tl_if_exist:cT {_@@_spfeq_##1_end:}{
- \tl_set:Nn \l_tmpa_tl {\use:c{_@@_spfeq_##1_end:}}
- }
- }
- \tl_if_empty:NTF \l_tmpa_tl {
- \_@@_spfeq_end:
- }{
- \l_tmpa_tl
- }
- \end{stex_annotate_env}
+\cs_new_protected:Nn \_@@_maybe_comment: {
+ \bool_if:NF \l_@@_in_spfblock_bool {
+ \par \setbox \l_tmpa_box \vbox \bgroup \everypar{\_@@_start_comment:}
}
}
-
-\cs_new_protected:Nn \_@@_spfeq_start: {
- \titleemph{
- \tl_if_empty:NTF \spftitle {
- \spf@proof@kw
- }{
- \spftitle
- }
- }:
+\cs_new_protected:Nn \_@@_maybe_comment_end: {
+ \bool_if:NF \l_@@_in_spfblock_bool { \egroup }
}
-\cs_new_protected:Nn \_@@_spfeq_end: {\sproofend}
-
-\newcommand\stexpatchspfeq[3][] {
- \str_set:Nx \l_tmpa_str{ #1 }
- \str_if_empty:NTF \l_tmpa_str {
- \tl_set:Nn \_@@_spfeq_start: { #2 }
- \tl_set:Nn \_@@_spfeq_end: { #3 }
- }{
- \exp_after:wN \tl_set:Nn \csname _@@_spfeq_#1_start:\endcsname{ #2 }
- \exp_after:wN \tl_set:Nn \csname _@@_spfeq_#1_end:\endcsname{ #3 }
- }
+\cs_new_protected:Nn \_@@_start_comment: {
+ \csname @ @ par\endcsname\egroup\item[]\bgroup\stexcommentfont
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\stexcommentfont}
+% \begin{macrocode}
+\cs_new_protected:Npn \stexcommentfont {
+ \small\itshape
+}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{environment}{sproof}
% In this environment, we initialize the proof depth counter |\count10| to 10, and set
% up the description environment that will take the proof steps. At the end of the
% proof, we position the proof end into the last line.
% \begin{macrocode}
-\newenvironment{sproof}[2][]{
- \let \premise \stex_proof_premise:
+\cs_new_protected:Nn \_@@_start_env:nnn {
+ \seq_clear:N \l_tmpa_seq
+ \clist_map_inline:Nn \l_@@_spf_for_clist {
+ \tl_if_empty:nF{ ##1 }{
+ \stex_get_symbol:n { ##1 }
+ \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
+ \l_stex_get_symbol_uri_str
+ }
+ }
+ }
+ \exp_args:Nnnx
+ \begin{stex_annotate_env}{#1}{\seq_use:Nn \l_tmpa_seq {,}}
+ \str_if_empty:NF \spftype {
+ \stex_annotate_invisible:nnn{type}{\spftype}{}
+ }
+ #3 {~\stex_annotate:nnn{spftitle}{}{#2}}
+ \str_if_empty:NF \spfid {
+ \stex_ref_new_doc_target:n \spfid
+ }
+ \begin{stex_annotate_env}{spfbody}{\bool_if:NTF \l_@@_spf_hide_bool {false}{true}}
+ \bool_if:NT \l_@@_spf_hide_bool{
+ \stex_html_backend:F{\setbox\l_tmpa_box\vbox\bgroup}
+ }
+ \begin{list}{}{
+ \setlength\topsep{0pt}
+ \setlength\parsep{0pt}
+ \setlength\rightmargin{0pt}
+
+ }\_@@_maybe_comment:
+}
+\cs_new_protected:Nn \_@@_end_env:n {
+ \stex_if_smsmode:F{
+ \_@@_maybe_comment_end:
+ \end{list}
+ \bool_if:NT \l_@@_spf_hide_bool{
+ \stex_html_backend:F{\egroup}
+ }
+ \clist_set:No \l_tmpa_clist \spftype
+ #1
+ \end{stex_annotate_env}
+ \end{stex_annotate_env}
+ }
+}
+\NewDocumentEnvironment{sproof}{s O{} m}{
\intarray_gzero:N \l_@@_counter_intarray
\intarray_gset:Nnn \l_@@_counter_intarray 1 1
- \_@@_spf_args:n{#1}
+ \stex_reactivate_macro:N \yield
+ \stex_reactivate_macro:N \eqstep
+ \stex_reactivate_macro:N \assumption
+ \stex_reactivate_macro:N \conclude
+ \stex_reactivate_macro:N \spfstep
+ \_@@_spf_args:n{#2}
\stex_if_smsmode:TF {
\str_if_empty:NF \spfid {
\stex_ref_new_doc_target:n \spfid
}
}{
- \seq_clear:N \l_tmpa_seq
- \clist_map_inline:Nn \l_@@_spf_for_clist {
- \tl_if_empty:nF{ ##1 }{
- \stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
- \l_stex_get_symbol_uri_str
+ \_@@_start_env:nnn{sproof}{#3}{
+ \clist_set:No \l_tmpa_clist \spftype
+ \tl_clear:N \l_tmpa_tl
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \tl_if_exist:cT {_@@_sproof_##1_start:}{
+ \tl_set:Nn \l_tmpa_tl {\use:c{_@@_sproof_##1_start:}}
+ }
+ \exp_args:No \str_if_eq:nnT \c_@@_flow_str {##1} {
+ \tl_set:Nn \l_tmpa_tl {\use:n{}}
}
}
- }
- \exp_args:Nnnx
- \begin{stex_annotate_env}{sproof}{\seq_use:Nn \l_tmpa_seq {,}}
- \str_if_empty:NF \spftype {
- \stex_annotate_invisible:nnn{type}{\spftype}{}
- }
-
- \clist_set:No \l_tmpa_clist \spftype
- \tl_clear:N \l_tmpa_tl
- \clist_map_inline:Nn \l_tmpa_clist {
- \tl_if_exist:cT {_@@_sproof_##1_start:}{
- \tl_set:Nn \l_tmpa_tl {\use:c{_@@_sproof_##1_start:}}
- }
- \exp_args:No \str_if_eq:nnT \c_@@_flow_str {##1} {
- \tl_set:Nn \l_tmpa_tl {\use:n{}}
+ \tl_if_empty:NTF \l_tmpa_tl {
+ \_@@_sproof_start:
+ }{
+ \l_tmpa_tl
}
}
- \tl_if_empty:NTF \l_tmpa_tl {
- \_@@_sproof_start:
- }{
- \l_tmpa_tl
- }{~#2}
+ }
+ \stex_smsmode_do:
+}{\_@@_end_env:n{
+ \tl_clear:N \l_tmpa_tl
+ \clist_map_inline:Nn \l_tmpa_clist {
+ \tl_if_exist:cT {_@@_sproof_##1_end:}{
+ \tl_set:Nn \l_tmpa_tl {\use:c{_@@_sproof_##1_end:}}
+ }
+ }
+ \tl_if_empty:NTF \l_tmpa_tl {
+ \_@@_sproof_end:
+ }{
+ \l_tmpa_tl
+ }
+}}
+\NewDocumentEnvironment{subproof}{s O{} m}{
+ \_@@_spf_args:n{#2}
+ \stex_if_smsmode:TF {
\str_if_empty:NF \spfid {
\stex_ref_new_doc_target:n \spfid
}
- \begin{description}
+ }{
+ \_@@_start_env:nnn{subproof}{\item[\sproofnumber]\ignorespacesandpars #3}{}
}
+ \_@@_add_counter:
\stex_smsmode_do:
-}{
- \stex_if_smsmode:F{
- \end{description}
- \clist_set:No \l_tmpa_clist \spftype
- \tl_clear:N \l_tmpa_tl
- \clist_map_inline:Nn \l_tmpa_clist {
- \tl_if_exist:cT {_@@_sproof_##1_end:}{
- \tl_set:Nn \l_tmpa_tl {\use:c{_@@_sproof_##1_end:}}
- }
- }
- \tl_if_empty:NTF \l_tmpa_tl {
- \_@@_sproof_end:
- }{
- \l_tmpa_tl
- }
- \end{stex_annotate_env}
+}{\_@@_remove_counter:\_@@_end_env:n{}
+ \bool_if:NT \l_@@_inc_counter_bool {
+ \_@@_inc_counter:
}
+ \aftergroup\_@@_maybe_comment:
}
+\AddToHook{env/subproof/before}{\_@@_maybe_comment_end:}
\cs_new_protected:Nn \_@@_sproof_start: {
\par\noindent\titleemph{
@@ -461,290 +442,103 @@
}
% \end{macrocode}
% \end{environment}
-%
-% \begin{macro}{\spfidea}
-% \begin{macrocode}
-\newcommand\spfidea[2][]{
- \_@@_spf_args:n{#1}
- \titleemph{
- \tl_if_empty:NTF \spftype {Proof~Idea}{
- \spftype
- }:
- }~#2
- \sproofend
-}
-% \end{macrocode}
-% \end{macro}
%
-% The next two environments (proof steps) and comments, are mostly semantical, they take
-% |KeyVal| arguments that specify their semantic role. In draft mode, they read these
-% values and show them. If the surrounding proof had |display=flow|, then no new |\item| is
-% generated, otherwise it is. In any case, the proof step number (at the current level) is
-% incremented.
-% \begin{environment}{spfstep}
+% \begin{macro}{\pstep,\conclude,\assumption,\have,\eqstep}
% \begin{macrocode}
-\newenvironment{spfstep}[1][]{
- \_@@_spf_args:n{#1}
- \stex_if_smsmode:TF {
- \str_if_empty:NF \spfid {
- \stex_ref_new_doc_target:n \spfid
- }
- }{
- \@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 }{
- \stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
- \l_stex_get_symbol_uri_str
- }
- }
- }
- \exp_args:Nnnx
- \begin{stex_annotate_env}{spfstep}{\seq_use:Nn \l_tmpa_seq {,}}
- \str_if_empty:NF \spftype {
- \stex_annotate_invisible:nnn{type}{\spftype}{}
- }
- \tl_if_empty:NF \spftitle {
- {(\titleemph{\spftitle})\enspace}
- }
- \str_if_empty:NF \spfid {
- \stex_ref_new_doc_target:n \spfid
- }
- }
- \stex_smsmode_do:
- \ignorespacesandpars
-}{
- \bool_if:NT \l_@@_inc_counter_bool {
- \_@@_inc_counter:
- }
- \stex_if_smsmode:F {
- \end{stex_annotate_env}
- }
+
+\keys_define:nn { stex / spfsteps } {
+ id .str_set_x:N = \spfstepid,
+ for .clist_set:N = \l_@@_spf_for_clist ,
+ type .str_set_x:N = \spftype,
+ title .tl_set:N = \spftitle,
+ method .tl_set:N = \l_@@_spf_method_tl,
+ term .tl_set:N = \l_@@_spf_term_tl
}
-% \end{macrocode}
-% \end{environment}
-%
-% \begin{environment}{spfcomment}
-% \begin{macrocode}
-\newenvironment{spfcomment}[1][]{
- \_@@_spf_args:n{#1}
- \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
-}{
- \bool_if:NT \l_@@_inc_counter_bool {
- \_@@_inc_counter:
- }
+\cs_new_protected:Nn \_@@_spfstep_args:n {
+ \str_clear:N \spfstepid
+ \clist_clear:N \l_@@_spf_for_clist
+ \str_clear:N \spftype
+ \tl_clear:N \l_@@_spf_method_tl
+ \tl_clear:N \l_@@_spf_term_tl
+ %\bool_set_false:N \l_@@_inc_counter_bool
+ \keys_set:nn { stex / spfsteps }{ #1 }
}
-% \end{macrocode}
-% \end{environment}
-%
-% The next two environments also take a |KeyVal| argument, but also a regular one, which
-% contains a start text. Both environments start a new numbered proof level.
-%
-% \begin{environment}{subproof}
-% In the |subproof| environment, a new (lower-level) proproofof environment is started.
-% \begin{macrocode}
-\newenvironment{subproof}[2][]{
- \_@@_spf_args:n{#1}
- \stex_if_smsmode:TF{
- \str_if_empty:NF \spfid {
- \stex_ref_new_doc_target:n \spfid
- }
- }{
- \seq_clear:N \l_tmpa_seq
- \clist_map_inline:Nn \l_@@_spf_for_clist {
- \tl_if_empty:nF{ ##1 }{
- \stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
- \l_stex_get_symbol_uri_str
- }
- }
- }
- \exp_args:Nnnx
- \begin{stex_annotate_env}{subproof}{\seq_use:Nn \l_tmpa_seq {,}}
- \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
+\cs_new_protected:Nn \_@@_make_step_macro:Nnnnn {
+ \NewDocumentCommand #1 {s O{} +m} {
+ \_@@_maybe_comment_end:
+
+ \_@@_spfstep_args:n{##2}
+ \stex_annotate:nnn{spfstep}{#2}{
+ \tl_if_empty:NF \l_@@_spf_term_tl {
+ \stex_annotate_invisible:nnn{spfyield}{}{$\l_@@_spf_term_tl$}
}
+ \bool_if:NTF \l_@@_in_spfblock_bool {
+ #4
+ }{
+ \item[\IfBooleanTF ##1 {}{#3}]
+ }
+ \ignorespacesandpars ##3
}
- \l_tmpa_tl
- \tl_if_empty:NF \spftitle {
- {(\titleemph{\spftitle})\enspace}
- }
- {~#2}
- \str_if_empty:NF \spfid {
- \stex_ref_new_doc_target:n \spfid
- }
- }
- \_@@_add_counter:
- \stex_smsmode_do:
-}{
- \_@@_remove_counter:
- \bool_if:NT \l_@@_inc_counter_bool {
- \_@@_inc_counter:
- }
- \stex_if_smsmode:F{
- \end{stex_annotate_env}
+ \bool_if:NF \l_@@_in_spfblock_bool { \IfBooleanTF ##1 {}{ #5 } }
+ \_@@_maybe_comment:
}
+ \stex_deactivate_macro:Nn #1 {sproof~environments}
}
-% \end{macrocode}
-% \end{environment}
-%
-% \begin{environment}{spfcases}
-% In the |pfcases| environment, the start text is displayed as the first comment of the
-% proof.
-% \begin{macrocode}
-\newenvironment{spfcases}[2][]{
- \tl_if_empty:nTF{#1}{
- \begin{subproof}[method=by-cases]{#2}
- }{
- \begin{subproof}[#1,method=by-cases]{#2}
- }
-}{
- \end{subproof}
-}
-% \end{macrocode}
-% \end{environment}
-%
-% \begin{environment}{spfcase}
-% In the |pfcase| environment, the start text is displayed specification of the case
-% after the |\item|
-% \begin{macrocode}
-\newenvironment{spfcase}[2][]{
- \_@@_spf_args:n{#1}
- \stex_if_smsmode:TF {
- \str_if_empty:NF \spfid {
- \stex_ref_new_doc_target:n \spfid
- }
+
+\_@@_make_step_macro:Nnnnn \assumption {assumption} \sproofnumber {} \_@@_inc_counter:
+\_@@_make_step_macro:Nnnnn \conclude {conclusion} {$\Rightarrow$} {} {}
+\_@@_make_step_macro:Nnnnn \spfstep {} \sproofnumber {} \_@@_inc_counter:
+
+\NewDocumentCommand \eqstep {s m}{
+ \_@@_maybe_comment_end:
+ \bool_if:NTF \l_@@_in_spfblock_bool {
+ $=$
}{
- \seq_clear:N \l_tmpa_seq
- \clist_map_inline:Nn \l_@@_spf_for_clist {
- \tl_if_empty:nF{ ##1 }{
- \stex_get_symbol:n { ##1 }
- \exp_args:NNo \seq_put_right:Nn \l_tmpa_seq {
- \l_stex_get_symbol_uri_str
- }
- }
- }
- \exp_args:Nnnx
- \begin{stex_annotate_env}{spfcase}{\seq_use:Nn \l_tmpa_seq {,}}
- \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{#2}{
- \titleemph{#2}:~
- }
- }
- \_@@_add_counter:
- \stex_smsmode_do:
-}{
- \_@@_remove_counter:
- \bool_if:NT \l_@@_inc_counter_bool {
- \_@@_inc_counter:
- }
- \stex_if_smsmode:F{
- \clist_set:No \l_tmpa_clist \spftype
- \tl_set:Nn \l_tmpa_tl{\sproofend}
- \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
- \end{stex_annotate_env}
+ \item[$=$]
}
+ $\stex_annotate:nnn{spfstep}{eq}{ #2 }$
+ \_@@_maybe_comment:
}
-% \end{macrocode}
-% \end{environment}
-%
-% \begin{environment}{spfcase}
-% similar to |spfcase|, takes a third argument.
-% \begin{macrocode}
-\newcommand\spfcasesketch[3][]{
- \begin{spfcase}[#1]{#2}#3\end{spfcase}
+\stex_deactivate_macro:Nn \eqstep {sproof~environments}
+
+\NewDocumentCommand \yield {+m}{
+ \stex_annotate:nnn{spfyield}{}{ #1 }
}
-% \end{macrocode}
-% \end{environment}
-%
-% \subsection{Justifications}
-%
-% We define the actions that are undertaken, when the keys for justifications are
-% encountered. Here this is very simple, we just define an internal macro with the value,
-% so that we can use it later.
-% \begin{macrocode}
-\keys_define:nn { stex / just }{
- id .str_set_x:N = \l_@@_just_id_str,
- method .tl_set:N = \l_@@_just_method_tl,
- premises .tl_set:N = \l_@@_just_premises_tl,
- args .tl_set:N = \l_@@_just_args_tl
+\stex_deactivate_macro:Nn \yield {sproof~environments}
+
+\NewDocumentEnvironment{spfblock}{}{
+ \item[]
+ \bool_set_true:N \l_@@_in_spfblock_bool
+}{
+ \aftergroup\_@@_maybe_comment:
}
-% \end{macrocode}
-%
-% The next three environments and macros are purely semantic, so we ignore the keyval
-% arguments for now and only display the content.\ednote{need to do something about the
-% premise in draft mode.}
-%
-% \begin{macro}{\spfjust}
-% \begin{macrocode}
-\newcommand\spfjust[1][]{}
+\AddToHook{env/spfblock/before}{\_@@_maybe_comment_end:}
+
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\premise}
+%
+% \begin{macro}{\spfidea}
% \begin{macrocode}
-\newcommand\stex_proof_premise:[2][]{#2}
+\NewDocumentCommand\spfidea{O{} +m}{
+ \_@@_spf_args:n{#1}
+ \titleemph{
+ \tl_if_empty:NTF \spftype {Proof~Idea}{
+ \spftype
+ }:
+ }~#2
+ \sproofend
+}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\justarg}
-% the |\justarg| macro is purely semantic, so we ignore the keyval arguments for now and
-% only display the content.
% \begin{macrocode}
-\newcommand\justarg[2][]{#2}
+\newcommand\spfjust[1]{
+ #1
+}
%</package>
% \end{macrocode}
-% \end{macro}
% \end{implementation}
% \Finale
% \ifinfulldoc\else\printbibliography\fi
diff --git a/macros/latex/contrib/stex/source/stex/stex-references.dtx b/macros/latex/contrib/stex/source/stex/stex-references.dtx
index 96506e71f1..841115fd0e 100644
--- a/macros/latex/contrib/stex/source/stex/stex-references.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-references.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -47,22 +47,11 @@
%
% \section{Macros and Environments}\label{pkg:sref:doc:macros}
%
-% \begin{function}{\STEXreftitle}
-% \begin{syntax} \cs{STEXreftitle}\Arg{some title} \end{syntax}
-%
-% Sets the title of the current document to \meta{some title}.
-% A reference to the current document from \emph{some other}
-% document will then be displayed accordingly. e.g.
-% if |\STEXreftitle{foo book}| is called, then referencing
-% Definition 3.5 in this document in another document will display
-% |Definition 3.5 in foo book|.
-% \end{function}
%
% \begin{function}{\stex_get_document_uri:}
-% Computes the current document uri from the current archive's
-% |narr|-field and its location relative to the archive's
-% |source|-directory. Reference targets are computed from
-% this URI and the reference-id.
+% Computes the current document uri from the current archive's |narr|-field and its
+% location relative to the archive's |source|-directory. Reference targets are computed
+% from this URI and the reference-id.
%
% \begin{variable}{\l_stex_current_docns_str}
% Stores its result in |\l_stex_current_docns_str|
@@ -70,11 +59,9 @@
% \end{function}
%
% \begin{function}{\stex_get_document_url:}
-% Computes the current URL from the current archive's
-% |docurl|-field and its location relative to the archive's
-% |source|-directory. Reference targets are computed from
-% this URL and the reference-id, if this document is only included
-% in SMS mode.
+% Computes the current URL from the current archive's |docurl|-field and its location
+% relative to the archive's |source|-directory. Reference targets are computed from this
+% URL and the reference-id, if this document is only included in SMS mode.
%
% \begin{variable}{\l_stex_current_docurl_str}
% Stores its result in |\l_stex_current_docurl_str|
@@ -132,7 +119,7 @@
% \begin{macrocode}
%<*package>
-%%%%%%%%%%%%% references.dtx %%%%%%%%%%%%%
+%%%%%%%%%%%%% stex-references.dtx %%%%%%%%%%%%%
%<@@=stex_refs>
% \end{macrocode}
@@ -140,31 +127,30 @@
% Warnings and error messages
%
% \begin{macrocode}
-
+\msg_new:nnn{stex}{error/extrefmissing}{
+ Missing~in~or~cite~value~for~\detokenize{\extref}!
+}
+\msg_new:nnn{stex}{warning/smsmissing}{
+ .sref~file~#1~doesn't~exist!
+}
+\msg_new:nnn{stex}{warning/smslabelmissing}{
+ No~label~#2~in~.sref~file~#1!
+}
% \end{macrocode}
%
% References are stored in the file |\jobname.sref|, to enable
% cross-referencing external documents.
%
% \begin{macrocode}
-%\iow_new:N \c_@@_refs_iow
+\iow_new:N \c_@@_refs_iow
\AtBeginDocument{
-% \iow_open:Nn \c_@@_refs_iow {\jobname.sref}
+ \iow_open:Nn \c_@@_refs_iow {\jobname.sref}
}
\AtEndDocument{
-% \iow_close:N \c_@@_refs_iow
+ \iow_close:N \c_@@_refs_iow
}
% \end{macrocode}
%
-% \begin{macro}{\STEXreftitle}
-% \begin{macrocode}
-\str_set:Nn \g_@@_title_tl {Unnamed~Document}
-
-\NewDocumentCommand \STEXreftitle { m } {
- \tl_gset:Nx \g_@@_title_tl { #1 }
-}
-% \end{macrocode}
-% \end{macro}
%
% \subsection{Document URIs and URLs}
%
@@ -208,13 +194,14 @@
}
\seq_if_empty:NTF \l_tmpa_seq {
- \str_set_eq:NN \l_stex_current_docns_str \l_tmpa_str
+ \str_gset_eq:NN \l_stex_current_docns_str \l_tmpa_str
}{
- \str_set:Nx \l_stex_current_docns_str {
+ \str_gset:Nx \l_stex_current_docns_str {
\l_tmpa_str/\stex_path_to_string:N \l_tmpa_seq
}
}
}
+ %\stex_get_document_url:
}
% \end{macrocode}
% \end{macro}
@@ -281,57 +268,98 @@
% @currentlabel -> number
% @currentlabelname -> title
% @currentHref -> name.number <- id of some kind
+% @currentcounter <- name/id
+% \#autorefname <- "Section"
% \theH# -> \arabic{section}
% \the# -> number
% \hyper@makecurrent{#}
\int_new:N \l_@@_unnamed_counter_int
% \end{macrocode}
%
+% Restoring references from |.sref|-files
+%
+% \begin{macro}{\STEXInternalSrefRestoreTarget}
+% \begin{macrocode}
+\cs_new_protected:Npn \STEXInternalSrefRestoreTarget #1#2#3#4#5 {}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\stex_ref_new_doc_target:n}
% \begin{macrocode}
+\seq_new:N \g_stex_ref_files_seq
+
\cs_new_protected:Nn \stex_ref_new_doc_target:n {
- \stex_get_document_uri:
+ %\stex_get_document_uri:
\str_clear:N \l_@@_curr_label_str
\str_set:Nx \l_tmpa_str { #1 }
\str_if_empty:NT \l_tmpa_str {
- \int_incr:N \l_@@_unnamed_counter_int
+ \int_gincr:N \l_@@_unnamed_counter_int
\str_set:Nx \l_tmpa_str {REF\int_use:N \l_@@_unnamed_counter_int}
}
\str_set:Nx \l_@@_curr_label_str {
\l_stex_current_docns_str?\l_tmpa_str
}
- \seq_if_exist:cF{g_@@_labels_\l_tmpa_str _seq}{
- \seq_new:c {g_@@_labels_\l_tmpa_str _seq}
- }
- \seq_if_in:coF{g_@@_labels_\l_tmpa_str _seq}\l_@@_curr_label_str {
- \seq_gput_right:co{g_@@_labels_\l_tmpa_str _seq}\l_@@_curr_label_str
- }
+
+ \exp_args:Noo \STEXInternalAuxAddDocRef\l_stex_current_docns_str\l_tmpa_str
+
+ %\seq_if_exist:cF{g_@@_labels_\l_tmpa_str _seq}{
+ % \seq_new:c {g_@@_labels_\l_tmpa_str _seq}
+ %}
+ %\seq_if_in:coF{g_@@_labels_\l_tmpa_str _seq}\l_@@_curr_label_str {
+ % \seq_gput_right:co{g_@@_labels_\l_tmpa_str _seq}\l_@@_curr_label_str
+ %}
+
+
\stex_if_smsmode:TF {
- \stex_get_document_url:
- \str_gset_eq:cN {sref_url_\l_@@_curr_label_str _str}\l_stex_current_docurl_str
- \str_gset_eq:cN {sref_\l_@@_curr_label_str _type}\c_@@_url_str
+ %\stex_get_document_url:
+ %\str_gset_eq:cN {sref_url_\l_@@_curr_label_str _str}\l_stex_current_docurl_str
+ %\str_gset_eq:cN {sref_\l_@@_curr_label_str _type}\c_@@_url_str
}{
- %\iow_now:Nx \c_@@_refs_iow { \l_tmpa_str~=~\expandafter\unexpanded\expandafter{\@currentlabel}~in~\exp_args:No\unexpanded\g_@@_title_tl,}
+ \iow_now:Nx \c_@@_refs_iow {
+ \STEXInternalSrefRestoreTarget
+ {\l_stex_current_docns_str}
+ {\l_tmpa_str}
+ {\@currentcounter}
+ {\@currentlabel}
+ {\tl_if_exist:NT\@currentlabelname{\exp_args:No\unexpanded\@currentlabelname}}
+ }
+ %\iow_now:Nx \c_@@_refs_iow {
+ % {\l_stex_current_docns_str?\l_tmpa_str}~=~{{\use:c{\@currentcounter autorefname}~\@currentlabel}~(\@currentlabelname)~in~\exp_args:No\unexpanded\g_@@_title_tl},}
+ \stex_debug:nn{sref}{New~label~\l_@@_curr_label_str~at~\use:c{\use:c{@currentcounter}autorefname}}
\exp_args:Nx\label{sref_\l_@@_curr_label_str}
- \immediate\write\@auxout{\stexauxadddocref{\l_stex_current_docns_str}{\l_tmpa_str}}
- \str_gset:cx {sref_\l_@@_curr_label_str _type}\c_@@_ref_str
+ \immediate\write\@auxout{\STEXInternalAuxAddDocRef{\l_stex_current_docns_str}{\l_tmpa_str}}
+ %\str_gset:cx {sref_\l_@@_curr_label_str _type}\c_@@_ref_str
}
}
+\NewDocumentCommand \slabel {m} {\stex_ref_new_doc_target:n {#1}}
% \end{macrocode}
% \end{macro}
%
% The following is used to set the necessary macros in the |.aux|-file.
%
% \begin{macrocode}
-\cs_new_protected:Npn \stexauxadddocref #1 #2 {
- \str_set:Nn \l_tmpa_str {#1?#2}
- \str_gset_eq:cN{sref_#1?#2_type}\c_@@_ref_str
- \seq_if_exist:cF{g_@@_labels_#2_seq}{
- \seq_new:c {g_@@_labels_#2_seq}
- }
- \seq_if_in:coF{g_@@_labels_#2_seq}\l_tmpa_str {
- \seq_gput_right:co{g_@@_labels_#2_seq}\l_tmpa_str
+\cs_new_protected:Npn \STEXInternalAuxAddDocRef #1 #2 {
+ \exp_args:NNx \seq_if_in:NnTF \g_stex_ref_files_seq {\detokenize{#1}} {
+ \exp_args:Nnx \seq_if_in:cnF{g_stex_ref_ #1 _seq}{\detokenize{#2}}{
+ \exp_args:Nnx \seq_gput_left:cn{g_stex_ref_ #1 _seq}{\detokenize{#2}}
+ }
+ }{
+ \exp_args:NNx \seq_gput_right:Nn \g_stex_ref_files_seq {\detokenize{#1}}
+ %\seq_if_exist:cF{g_stex_ref_ #1 _seq}{
+ \seq_new:c{g_stex_ref_ #1 _seq} % <- seq_new throws errors??
+ %}
+ \exp_args:Nnx \seq_gput_left:cn{g_stex_ref_ #1 _seq}{\detokenize{#2}}
}
+
+ %\str_set:Nn \l_tmpa_str {#1?#2}
+ %\str_gset_eq:cN{sref_#1?#2_type}\c_@@_ref_str
+ %\seq_if_exist:cF{g_@@_labels_#2_seq}{
+ % \seq_new:c {g_@@_labels_#2_seq}
+ %}
+ %\seq_if_in:coF{g_@@_labels_#2_seq}\l_tmpa_str {
+ % \seq_gput_right:co{g_@@_labels_#2_seq}\l_tmpa_str
+ %}
}
% \end{macrocode}
% To avoid resetting the same macros when the |.aux|-file is read
@@ -339,122 +367,314 @@
%
% \begin{macrocode}
\AtEndDocument{
- \def\stexauxadddocref#1 #2 {}{}
+ \def\STEXInternalAuxAddDocRef#1 #2 {}{}
}
% \end{macrocode}
%
% \begin{macro}{\stex_ref_new_sym_target:n}
% \begin{macrocode}
\cs_new_protected:Nn \stex_ref_new_sym_target:n {
- \stex_if_smsmode:TF {
- \str_if_exist:cF{sref_sym_#1_type}{
- \stex_get_document_url:
- \str_gset_eq:cN {sref_sym_url_#1_str}\l_stex_current_docurl_str
- \str_gset_eq:cN {sref_sym_#1_type}\c_@@_url_str
- }
- }{
- \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 \exp_not:N\detokenize{sref_sym_#1_label_str}\exp_not:N\endcsname{
- \l_@@_curr_label_str
- }
- }
- }
- }
+
+% \stex_if_smsmode:TF {
+% \str_if_exist:cF{sref_sym_#1_type}{
+% \stex_get_document_url:
+% \str_gset_eq:cN {sref_sym_url_#1_str}\l_stex_current_docurl_str
+% \str_gset_eq:cN {sref_sym_#1_type}\c_@@_url_str
+% }
+% }{
+% \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 \exp_not:N\detokenize{sref_sym_#1_label_str}\exp_not:N\endcsname{
+% \l_@@_curr_label_str
+% }
+% }
+% }
+% }
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Using References}
%
-% \begin{macrocode}
-\str_new:N \l_@@_indocument_str
-% \end{macrocode}
-%
% \begin{macro}{\sref}
% Optional arguments:
% \begin{macrocode}
-\keys_define:nn { stex / sref } {
- linktext .tl_set:N = \l_@@_linktext_tl ,
- fallback .tl_set:N = \l_@@_fallback_tl ,
- pre .tl_set:N = \l_@@_pre_tl ,
- post .tl_set:N = \l_@@_post_tl ,
+\keys_define:nn { stex / sref / 1 } {
+ archive .str_set_x:N = \l_@@_repo_str,
+ file .str_set_x:N = \l_@@_file_str,
+ % TODO get rid of this
+ fallback .code:n = {},
+ pre .code:n = {},
+ post .code:n = {}
}
-\cs_new_protected:Nn \_@@_args:n {
- \tl_clear:N \l_@@_linktext_tl
- \tl_clear:N \l_@@_fallback_tl
- \tl_clear:N \l_@@_pre_tl
- \tl_clear:N \l_@@_post_tl
+\cs_new_protected:Nn \_@@_args_i:n {
\str_clear:N \l_@@_repo_str
- \keys_set:nn { stex / sref } { #1 }
+ \str_clear:N \l_@@_file_str
+ \keys_set:nn { stex / sref / 1 } { #1 }
+}
+\keys_define:nn { stex / sref / 2 } {
+ in .str_set_x:N = \l_@@_in_str,
+ archive .str_set_x:N = \l_@@_repob_str,
+ title .tl_set:N = \l_@@_title_tl
+}
+\cs_new_protected:Nn \_@@_args_ii:n {
+ \str_clear:N \l_@@_in_str
+ \tl_clear:N \l_@@_title_tl
+ \str_clear:N \l_@@_repob_str
+ \keys_set:nn { stex / sref / 2 } { #1 }
}
% \end{macrocode}
% The actual macro:
% \begin{macrocode}
-\NewDocumentCommand \sref { O{} m}{
- \_@@_args:n { #1 }
- \str_if_empty:NTF \l_@@_indocument_str {
- \str_set:Nx \l_tmpa_str { #2 }
- \exp_args:NNno \seq_set_split:Nnn \l_tmpa_seq ? \l_tmpa_str
- \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} = 1 {
- \seq_if_exist:cTF{g_@@_labels_\l_tmpa_str _seq}{
- \seq_get_left:cNF {g_@@_labels_\l_tmpa_str _seq} \l_tmpa_str {
- \str_clear:N \l_tmpa_str
+\NewDocumentCommand \sref { O{} m O{}}{
+ \_@@_args_i:n{#1}
+ \_@@_args_ii:n{#3}
+ \str_clear:N \l_@@_uri_str
+ \_@@_find_uri:n{#2}
+ \_@@_do_sref:n{#2}
+}
+\NewDocumentCommand \extref { O{} m m}{
+ \_@@_args_i:n{#1}
+ \_@@_args_ii:n{#3}
+ \str_if_empty:NT \l_@@_in_str {
+ \msg_error:nn{stex}{error/extrefmissing}
+ }
+ \str_clear:N \l_@@_uri_str
+ \_@@_find_uri:n{#2}
+ \_@@_do_sref_in:n{#2}
+}
+
+\cs_new_protected:Nn \_@@_find_uri:n {
+ \stex_debug:nn{sref}{File:~\l_@@_file_str^^JRepo:\l_@@_repo_str}
+ \str_if_empty:NTF \l_@@_file_str {
+ \stex_debug:nn{sref}{Empty.~Checking~current~file~for~#1}
+ \seq_if_exist:cT{g_stex_ref_\l_stex_current_docns_str _seq}{
+ \seq_map_inline:cn{g_stex_ref_\l_stex_current_docns_str _seq}{
+ \str_if_eq:nnT{#1}{##1}{
+ \str_set_eq:NN \l_@@_uri_str \l_stex_current_docns_str
+ \stex_debug:nn{sref}{Found.}
+ \seq_map_break:
}
- }{
- \str_clear:N \l_tmpa_str
}
- }{
- \seq_pop_left:NN \l_tmpa_seq \l_tmpb_str
- \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
- \int_set:Nn \l_tmpa_int { \exp_args:Ne \str_count:n {\l_tmpb_str?\l_tmpa_str} }
- \seq_if_exist:cTF{g_@@_labels_\l_tmpa_str _seq}{
- \str_set_eq:NN \l_tmpc_str \l_tmpa_str
- \str_clear:N \l_tmpa_str
- \seq_map_inline:cn {g_@@_labels_\l_tmpc_str _seq} {
- \str_if_eq:eeT { \l_tmpb_str?\l_tmpc_str }{
- \str_range:nnn { ##1 }{ -\l_tmpa_int}{ -1 }
- }{
- \seq_map_break:n {
- \str_set:Nn \l_tmpa_str { ##1 }
- }
+ }
+ \str_if_empty:NT \l_@@_uri_str {
+ \stex_debug:nn{sref}{Checking~other~files}
+ \seq_map_inline:Nn \g_stex_ref_files_seq {
+ \stex_debug:nn{sref}{##1...}
+ \seq_map_inline:cn{g_stex_ref_##1_seq}{
+ \str_if_eq:nnT{#1}{####1}{
+ \stex_debug:nn{sref}{Found~##1}
+ \str_set:Nn \l_@@_uri_str {##1}
+ \seq_map_break:n{\seq_map_break:}
}
}
+ }
+ }
+ }{
+ \str_if_empty:NTF \l_@@_repo_str {
+ \prop_if_exist:NTF \l_stex_current_repository_prop {
+ \prop_get:NnN \l_stex_current_repository_prop { ns } \l_@@_uri_str
+ \str_set:Nx \l_@@_uri_str {\l_@@_uri_str / \l_@@_file_str}
+ \stex_path_from_string:Nn \l_tmpb_seq \l_@@_uri_str
+ \str_set:Nx \l_@@_uri_str {\stex_path_to_string:N \l_tmpb_seq}
}{
- \str_clear:N \l_tmpa_str
+ \stex_path_from_string:Nn \l_tmpb_seq {
+ \stex_path_to_string:N \g_stex_currentfile_seq/ .. / \l_@@_file_str
+ }
+ \str_set:Nx \l_@@_uri_str {file:/\stex_path_to_string:N \l_tmpb_seq}
}
+ }{
+ \stex_require_repository:n \l_@@_repo_str
+ \prop_get:cnN { c_stex_mathhub_\l_@@_repo_str _manifest_prop } { ns } \l_@@_uri_str
+ \str_set:Nx \l_@@_uri_str {\l_@@_uri_str / \l_@@_file_str}
+ \stex_path_from_string:Nn \l_tmpb_seq \l_@@_uri_str
+ \str_set:Nx \l_@@_uri_str {\stex_path_to_string:N \l_tmpb_seq}
}
- \str_if_empty:NTF \l_tmpa_str {
- \tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl
+ }
+}
+
+\cs_new_protected:Nn \_@@_do_autoref:n{
+ \cs_if_exist:cTF{autoref}{
+ \exp_args:Nx\autoref{sref_#1}
+ }{
+ \exp_args:Nx\ref{sref_#1}
+ }
+}
+
+\cs_new_protected:Nn \_@@_do_sref:n {
+ \str_if_empty:NTF \l_@@_uri_str {
+ \str_if_empty:NTF \l_@@_in_str {
+ \stex_debug:nn{sref}{autoref~on~#1}
+ \_@@_do_autoref:n{#1}
}{
- \str_if_eq:cNTF {sref_\l_tmpa_str _type} \c_@@_ref_str {
- \tl_if_empty:NTF \l_@@_linktext_tl {
- \cs_if_exist:cTF{autoref}{
- \l_@@_pre_tl\exp_args:Nx\autoref{sref_\l_tmpa_str}\l_@@_post_tl
- }{
- \l_@@_pre_tl\exp_args:Nx\ref{sref_\l_tmpa_str}\l_@@_post_tl
- }
- }{
- \ltx@ifpackageloaded{hyperref}{
- \hyperref[sref_\l_tmpa_str]\l_@@_linktext_tl
- }{
- \l_@@_linktext_tl
- }
- }
+ \stex_debug:nn{sref}{srefin~on~#1}
+ \_@@_do_sref_in:n{#1}
+ }
+ }{
+ \exp_args:NNo \seq_if_in:NnTF \g_stex_ref_files_seq \l_@@_uri_str {
+ \exp_args:Nnx \seq_if_in:cnTF{g_stex_ref_\l_@@_uri_str _seq}{\detokenize{#1}}{
+ \stex_debug:nn{sref}{Reference~found~in~ref~files;~autoref~on~#1}
+ \_@@_do_autoref:n{\l_@@_uri_str?#1}
}{
- \ltx@ifpackageloaded{hyperref}{
- \href{\use:c{sref_url_\l_tmpa_str _str}}{\tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl}
+ \str_if_empty:NTF \l_@@_in_str {
+ \stex_debug:nn{sref}{in~empty;~autoref~on~#1}
+ \_@@_do_autoref:n{#1}
}{
- \tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl
+ \stex_debug:nn{sref}{in~non-empty;~srefin~on~#1}
+ \_@@_do_sref_in:n{#1}
}
}
+ }{
+ \str_if_empty:NTF \l_@@_in_str {
+ \stex_debug:nn{sref}{in~empty;~autoref~on~#1}
+ \_@@_do_autoref:n{#1}
+ }{
+ \stex_debug:nn{sref}{in~non-empty;~srefin~on~#1}
+ \_@@_do_sref_in:n{#1}
+ }
+ }
+ }
+}
+
+\cs_new_protected:Nn \_@@_restore_target:nnnnn {
+ \str_if_empty:NTF \l_@@_uri_str {
+ \exp_args:No \str_if_eq:nnT \l_@@_id_str {#2}{
+ \tl_set:Nn \l_@@_return_tl {
+ \use:c{#3autorefname}~#4\tl_if_empty:nF{#5}{~(#5)}~in~
+ \tl_if_empty:nTF\l_@@_title_tl{
+ ???
+ }\l_@@_title_tl
+ }
}
}{
- % TODO
+ \stex_debug:nn{sref}{\l_@@_uri_str{}~ == ~ #1 ~ ?}
+ \exp_args:No \str_if_eq:nnT \l_@@_uri_str {#1}{
+ \stex_debug:nn{sref}{\l_@@_id_str~ == ~ #2 ~ ?}
+ \exp_args:No \str_if_eq:nnT \l_@@_id_str {#2}{
+ \stex_debug:nn{sref}{success!}
+ \tl_set:Nn \l_@@_return_tl {
+ \use:c{#3autorefname}~#4\tl_if_empty:nF{#5}{~(#5)}~in~
+ \tl_if_empty:nTF\l_@@_title_tl{
+ ???
+ }\l_@@_title_tl
+ }
+ \endinput
+ }
+ }
}
}
+
+\cs_new_protected:Nn \_@@_do_sref_in:n {
+ \stex_debug:nn{sref}{In: \l_@@_in_str^^JRepo:\l_@@_repo_str}
+ \stex_debug:nn{sref}{URI: \l_@@_uri_str?#1}
+ %\msg_warning:nnn{stex}{warning/smsmissing}{<filename>}
+ \begingroup\catcode13=9\relax\catcode10=9\relax
+ \str_if_empty:NTF \l_@@_repob_str {
+ \prop_if_exist:NTF \l_stex_current_repository_prop {
+ \str_set:Nx \l_tmpa_str {
+ \c_stex_mathhub_str /
+ \prop_item:Nn \l_stex_current_repository_prop { id }
+ / source / \l_@@_in_str .sref
+ }
+ }{
+ \str_set:Nx \l_tmpa_str {
+ \stex_path_to_string:N \g_stex_currentfile_seq/ .. / \l_@@_in_str . sref
+ }
+ }
+ }{
+ \str_set:Nx \l_tmpa_str {
+ \c_stex_mathhub_str / \l_@@_repob_str
+ / source / \l_@@_in_str . sref
+ }
+ }
+ \stex_path_from_string:Nn \l_tmpb_seq \l_tmpa_str
+ \stex_path_to_string:NN \l_tmpb_seq \l_tmpa_str
+ \stex_debug:nn{sref}{File: \l_tmpa_str}
+ \exp_args:No \IfFileExists \l_tmpa_str {
+ \tl_clear:N \l_@@_return_tl
+ \str_set:Nn \l_@@_id_str {#1}
+ \let\STEXInternalSrefRestoreTarget\_@@_restore_target:nnnnn
+ \use:c{@ @ input}{\l_tmpa_str}
+ \exp_args:No \tl_if_empty:nTF \l_@@_return_tl {
+ \exp_args:Nnno \msg_warning:nnnn{stex}{warning/smslabelmissing}\l_tmpa_str{#1}
+ \_@@_do_autoref:n{
+ \str_if_empty:NF\l_@@_uri_str{\l_@@_uri_str?}#1
+ }
+ }{
+ \l_@@_return_tl
+ }
+ }{
+ \exp_args:Nnno \msg_warning:nnn{stex}{warning/smsmissing}\l_tmpa_str
+ \_@@_do_autoref:n{
+ \str_if_empty:NF\l_@@_uri_str{\l_@@_uri_str?}#1
+ }
+ }
+ \endgroup
+}
+
+ % \_@@_args:n { #1 }
+ % \str_if_empty:NTF \l_@@_indocument_str {
+ % \str_set:Nx \l_tmpa_str { #2 }
+ % \exp_args:NNno \seq_set_split:Nnn \l_tmpa_seq ? \l_tmpa_str
+ % \int_compare:nNnTF {\seq_count:N \l_tmpa_seq} = 1 {
+ % \seq_if_exist:cTF{g_@@_labels_\l_tmpa_str _seq}{
+ % \seq_get_left:cNF {g_@@_labels_\l_tmpa_str _seq} \l_tmpa_str {
+ % \str_clear:N \l_tmpa_str
+ % }
+ % }{
+ % \str_clear:N \l_tmpa_str
+ % }
+ % }{
+ % \seq_pop_left:NN \l_tmpa_seq \l_tmpb_str
+ % \seq_pop_right:NN \l_tmpa_seq \l_tmpa_str
+ % \int_set:Nn \l_tmpa_int { \exp_args:Ne \str_count:n {\l_tmpb_str?\l_tmpa_str} }
+ % \seq_if_exist:cTF{g_@@_labels_\l_tmpa_str _seq}{
+ % \str_set_eq:NN \l_tmpc_str \l_tmpa_str
+ % \str_clear:N \l_tmpa_str
+ % \seq_map_inline:cn {g_@@_labels_\l_tmpc_str _seq} {
+ % \str_if_eq:eeT { \l_tmpb_str?\l_tmpc_str }{
+ % \str_range:nnn { ##1 }{ -\l_tmpa_int}{ -1 }
+ % }{
+ % \seq_map_break:n {
+ % \str_set:Nn \l_tmpa_str { ##1 }
+ % }
+ % }
+ % }
+ % }{
+ % \str_clear:N \l_tmpa_str
+ % }
+ % }
+ % \str_if_empty:NTF \l_tmpa_str {
+ % \tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl
+ % }{
+ % \str_if_eq:cNTF {sref_\l_tmpa_str _type} \c_@@_ref_str {
+ % \tl_if_empty:NTF \l_@@_linktext_tl {
+ % \cs_if_exist:cTF{autoref}{
+ % \l_@@_pre_tl\exp_args:Nx\autoref{sref_\l_tmpa_str}\l_@@_post_tl
+ % }{
+ % \l_@@_pre_tl\exp_args:Nx\ref{sref_\l_tmpa_str}\l_@@_post_tl
+ % }
+ % }{
+ % \ltx@ifpackageloaded{hyperref}{
+ % \hyperref[sref_\l_tmpa_str]\l_@@_linktext_tl
+ % }{
+ % \l_@@_linktext_tl
+ % }
+ % }
+ % }{
+ % \ltx@ifpackageloaded{hyperref}{
+ % \href{\use:c{sref_url_\l_tmpa_str _str}}{\tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl}
+ % }{
+ % \tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl
+ % }
+ % }
+ % }
+ % }{
+ % TODO
+ % }
+%}
% \end{macrocode}
% \end{macro}
%
@@ -466,52 +686,53 @@
}
\cs_new_protected:Nn \_@@_sym_aux:nn {
- \str_if_exist:cTF {sref_sym_#2 _label_str }{
- \sref[#1]{\use:c{sref_sym_#2 _label_str}}
- }{
- \_@@_args:n { #1 }
- \str_if_empty:NTF \l_@@_indocument_str {
- \tl_if_exist:cTF{sref_sym_#2 _type}{
- % doc uri in \l_tmpb_str
- \str_set:Nx \l_tmpa_str {\use:c{sref_sym_#2 _type}}
- \str_if_eq:NNTF \l_tmpa_str \c_@@_ref_str {
- % reference
- \tl_if_empty:NTF \l_@@_linktext_tl {
- \cs_if_exist:cTF{autoref}{
- \l_@@_pre_tl\autoref{sref_sym_#2}\l_@@_post_tl
- }{
- \l_@@_pre_tl\ref{sref_sym_#2}\l_@@_post_tl
- }
- }{
- \ltx@ifpackageloaded{hyperref}{
- \hyperref[sref_sym_#2]\l_@@_linktext_tl
- }{
- \l_@@_linktext_tl
- }
- }
- }{
- % URL
- \ltx@ifpackageloaded{hyperref}{
- \href{\use:c{sref_sym_url_#2 _str}}{\tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl}
- }{
- \tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl
- }
- }
- }{
- \tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl
- }
- }{
- % TODO
- }
- }
+
+% \str_if_exist:cTF {sref_sym_#2 _label_str }{
+% \sref[#1]{\use:c{sref_sym_#2 _label_str}}
+% }{
+% \_@@_args:n { #1 }
+% \str_if_empty:NTF \l_@@_indocument_str {
+% \tl_if_exist:cTF{sref_sym_#2 _type}{
+% % doc uri in \l_tmpb_str
+% \str_set:Nx \l_tmpa_str {\use:c{sref_sym_#2 _type}}
+% \str_if_eq:NNTF \l_tmpa_str \c_@@_ref_str {
+% % reference
+% \tl_if_empty:NTF \l_@@_linktext_tl {
+% \cs_if_exist:cTF{autoref}{
+% \l_@@_pre_tl\autoref{sref_sym_#2}\l_@@_post_tl
+% }{
+% \l_@@_pre_tl\ref{sref_sym_#2}\l_@@_post_tl
+% }
+% }{
+% \ltx@ifpackageloaded{hyperref}{
+% \hyperref[sref_sym_#2]\l_@@_linktext_tl
+% }{
+% \l_@@_linktext_tl
+% }
+% }
+% }{
+% % URL
+% \ltx@ifpackageloaded{hyperref}{
+% \href{\use:c{sref_sym_url_#2 _str}}{\tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl}
+% }{
+% \tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl
+% }
+% }
+% }{
+% \tl_if_empty:NTF \l_@@_linktext_tl \l_@@_fallback_tl \l_@@_linktext_tl
+% }
+% }{
+% % TODO
+% }
+% }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\srefsymuri}
% \begin{macrocode}
-\cs_new_protected:Npn \srefsymuri #1 #2 {
- \_@@_sym_aux:nn{linktext={#2}}{#1}
+\cs_new_protected:Npn \srefsymuri #1 #2 { % TODO
+ #2%\_@@_sym_aux:nn{linktext={#2}}{#1}
}
% \end{macrocode}
% \end{macro}
diff --git a/macros/latex/contrib/stex/source/stex/stex-statements.dtx b/macros/latex/contrib/stex/source/stex/stex-statements.dtx
index 6a66eb80e7..cab2a678c8 100644
--- a/macros/latex/contrib/stex/source/stex/stex-statements.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-statements.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -365,6 +365,7 @@
}
}
\clist_set_from_seq:NN \l_@@_sdefinition_for_clist \l_tmpb_seq
+ \ifvmode\noindent\fi
\exp_args:Nnx
\stex_annotate:nnn{definition}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sdefinitiontype {
@@ -542,6 +543,7 @@
}
}
}
+ \ifvmode\noindent\fi
\exp_args:Nnx
\stex_annotate:nnn{assertion}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sassertiontype {
@@ -705,6 +707,7 @@
}
}
}
+ \ifvmode\noindent\fi
\exp_args:Nnx
\stex_annotate:nnn{example}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sexampletype {
@@ -926,6 +929,7 @@
}
}
}
+ \ifvmode\noindent\fi
\exp_args:Nnx
\stex_annotate:nnn{paragraph}{\seq_use:Nn \l_tmpb_seq {,}}{
\str_if_empty:NF \sparagraphtype {
diff --git a/macros/latex/contrib/stex/source/stex/stex-symbols.dtx b/macros/latex/contrib/stex/source/stex/stex-symbols.dtx
index ba9fa5f097..e5e7982abc 100644
--- a/macros/latex/contrib/stex/source/stex/stex-symbols.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-symbols.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -60,9 +60,6 @@
% 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
-% the current module will not make this declaration available.
% \item |args|: Specifies the ``signature'' of the semantic macro.
% Can be either an integer $0 \leq n \leq 9$, or a (more precise)
% sequence of the following characters:
@@ -92,7 +89,6 @@
% \item |name| (string),
% \item |module| (string),
% \item |notations| (sequence of strings; initially empty),
-% \item |local| (boolean),
% \item |type| (token list),
% \item |args| (string of |i|s, |a|s and |b|s),
% \item |arity| (integer string),
@@ -204,15 +200,14 @@
% \begin{macrocode}
\keys_define:nn { stex / symdecl } {
name .str_set_x:N = \l_stex_symdecl_name_str ,
- local .bool_set:N = \l_stex_symdecl_local_bool ,
args .str_set_x:N = \l_stex_symdecl_args_str ,
type .tl_set:N = \l_stex_symdecl_type_tl ,
deprecate .str_set_x:N = \l_stex_symdecl_deprecate_str ,
align .str_set:N = \l_stex_symdecl_align_str , % TODO(?)
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 ,
+ argnames .clist_set:N = \l_stex_symdecl_argnames_clist ,
assoc .choices:nn =
{bin,binl,binr,pre,conj,pwconj}
{\str_set:Nx \l_stex_symdecl_assoctype_str {\l_keys_choice_tl}}
@@ -229,6 +224,7 @@
\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
+ \clist_clear:N \l_stex_symdecl_argnames_clist
\keys_set:nn { stex / symdecl } { #1 }
}
@@ -324,6 +320,7 @@
}{##1}
}
}
+
\bool_if:NTF \l_tmpa_bool {
% possibly numeric
\str_if_empty:NTF \l_stex_symdecl_args_str {
@@ -351,6 +348,19 @@
\prop_put:Nnx \l_tmpa_prop { defined }{ true }
}
+ % argnames
+
+ \clist_clear:N \l_tmpa_clist
+ \int_step_inline:nn {\prop_item:Nn \l_tmpa_prop {arity}} {
+ \clist_if_empty:NTF \l_stex_symdecl_argnames_clist {
+ \clist_put_right:Nn \l_tmpa_clist {##1}
+ }{
+ \clist_pop:NN \l_stex_symdecl_argnames_clist \l_tmpa_tl
+ \exp_args:NNx \clist_put_right:Nn \l_tmpa_clist {\c_dollar_str\l_tmpa_tl}
+ }
+ }
+ \prop_put:Nnx \l_tmpa_prop {argnames} {\clist_use:Nn \l_tmpa_clist ,}
+
% semantic macro
\bool_if:NT \l_stex_symdecl_make_macro_bool {
@@ -396,7 +406,7 @@
_prop
} {
\bool_if:NTF \l_stex_symdecl_local_bool \stex_do_up_to_module:x \stex_execute_in_module:x {
- \_@@_restore_symbol:nnnnnnn
+ \_@@_restore_symbol:nnnnnnnn
{\l_stex_symdecl_name_str}
{ \prop_item:Nn \l_tmpa_prop {args} }
{ \prop_item:Nn \l_tmpa_prop {arity} }
@@ -404,10 +414,11 @@
{ \prop_item:Nn \l_tmpa_prop {defined} }
{\bool_if:NT \l_stex_symdecl_make_macro_bool {#1} }
{\l_stex_current_module_str}
+ { \prop_item:Nn \l_tmpa_prop {argnames} }
}
}
}
-\cs_new_protected:Nn \_@@_restore_symbol:nnnnnnn {
+\cs_new_protected:Nn \_@@_restore_symbol:nnnnnnnn {
\prop_clear:N \l_tmpa_prop
\prop_put:Nnn \l_tmpa_prop { module } { #7 }
\prop_put:Nnn \l_tmpa_prop { name } { #1}
@@ -415,6 +426,7 @@
\prop_put:Nnn \l_tmpa_prop { arity } { #3 }
\prop_put:Nnn \l_tmpa_prop { assocs } { #4 }
\prop_put:Nnn \l_tmpa_prop { defined } { #5 }
+ \prop_put:Nnn \l_tmpa_prop { argnames } { #8 }
\tl_if_empty:nF{#6}{
\tl_set:cx{#6}{\stex_invoke_symbol:n{\detokenize{#7 ? #1}}}
}
@@ -435,6 +447,7 @@
\cs_new_protected:Nn \_stex_textsymdecl_args:n {
\str_clear:N \l_@@_name_str
\tl_clear:N \l_@@_type_tl
+ \clist_clear:N \l_stex_symdecl_argnames_clist
\keys_set:nn { stex / textsymdecl } { #1 }
}
@@ -450,12 +463,12 @@
\stex_execute_in_module:n{
\cs_set_nopar:cpn{#1name}{
\ifvmode\hbox_unpack:N\c_empty_box\fi
- \hbox{#3}\xspace
+ \ifmmode\hbox{#3}\else#3\fi\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
+ \symref{#1-sym}{#3}\expandafter\xspace
\fi
}
}
@@ -594,12 +607,13 @@
% \begin{macrocode}
\keys_define:nn { stex / notation } {
% 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 ,
- primary .bool_set:N = \l_@@_primary_bool ,
- primary .default:n = {true} ,
- unknown .code:n = \str_set:Nx
+ variant .tl_set_x:N = \l_@@_variant_str ,
+ prec .str_set_x:N = \l_@@_prec_str ,
+ op .tl_set:N = \l_@@_op_tl ,
+ primary .bool_set:N = \l_@@_primary_bool ,
+ primary .default:n = {true} ,
+ hints .str_set_x:N = \l_@@_hints_str,
+ unknown .code:n = \str_set:Nx
\l_@@_variant_str \l_keys_key_str
}
@@ -607,6 +621,7 @@
% \str_clear:N \l_@@_lang_str
\str_clear:N \l_@@_variant_str
\str_clear:N \l_@@_prec_str
+ \str_clear:N \l_@@_hints_str
\tl_clear:N \l_@@_op_tl
\bool_set_false:N \l_@@_primary_bool
@@ -677,7 +692,7 @@
\exp_args:NNNo \exp_args:NNno \seq_set_split:Nnn
\l_tmpa_seq {\tl_to_str:n{x} } { \l_tmpa_str }
\seq_map_inline:Nn \l_tmpa_seq {
- \seq_put_right:Nn \l_tmpb_seq { ##1 }
+ \seq_put_right:Nn \l_@@_precedences_seq { ##1 }
}
}
}{
@@ -824,11 +839,12 @@
\seq_pop_left:NN \l_@@_remaining_precs_seq \l_tmpa_str
\tl_put_right:Nx \l_stex_notation_dummyargs_tl { {
- \STEXInternalTermMathAssocArgiiii
- { #1\int_use:N \l_@@_currarg_int }
+ \STEXInternalTermMathAssocArgiiiii
+ { \int_use:N \l_@@_currarg_int }
{ \l_tmpa_str }
{ ####\int_use:N \l_@@_currarg_int }
{ \l_tmpa_cs {####1} {####2} }
+ {#1}
} }
\_@@_arguments:
}
@@ -1036,7 +1052,6 @@
% \begin{macrocode}
\keys_define:nn { stex / symdef } {
name .str_set_x:N = \l_stex_symdecl_name_str ,
- local .bool_set:N = \l_stex_symdecl_local_bool ,
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 ,
@@ -1045,6 +1060,7 @@
% lang .str_set_x:N = \l_@@_lang_str ,
variant .str_set_x:N = \l_@@_variant_str ,
prec .str_set_x:N = \l_@@_prec_str ,
+ argnames .clist_set:N = \l_stex_symdecl_argnames_clist ,
assoc .choices:nn =
{bin,binl,binr,pre,conj,pwconj}
{\str_set:Nx \l_stex_symdecl_assoctype_str {\l_keys_choice_tl}},
@@ -1060,6 +1076,7 @@
\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
+ \clist_clear:N \l_stex_symdecl_argnames_clist
% \str_clear:N \l_@@_lang_str
\str_clear:N \l_@@_variant_str
\str_clear:N \l_@@_prec_str
@@ -1086,6 +1103,70 @@
{ \l_@@_prec_str}
}
\stex_deactivate_macro:Nn \symdef {module~environments}
+
+\keys_define:nn { stex / mmtdef } {
+ name .str_set_x:N = \l_stex_symdecl_name_str ,
+ args .str_set_x:N = \l_stex_symdecl_args_str ,
+ 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 ,
+ variant .str_set_x:N = \l_@@_variant_str ,
+ prec .str_set_x:N = \l_@@_prec_str ,
+ argnames .clist_set:N = \l_stex_symdecl_argnames_clist ,
+ assoc .choices:nn =
+ {bin,binl,binr,pre,conj,pwconj}
+ {\str_set:Nx \l_stex_symdecl_assoctype_str {\l_keys_choice_tl}},
+ unknown .code:n = \str_set:Nx
+ \l_@@_variant_str \l_keys_key_str
+}
+\cs_new_protected:Nn \_stex_mmtdef_args:n {
+ \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
+ \clist_clear:N \l_stex_symdecl_argnames_clist
+ % \str_clear:N \l_@@_lang_str
+ \str_clear:N \l_@@_variant_str
+ \str_clear:N \l_@@_prec_str
+ \tl_clear:N \l_@@_op_tl
+
+ \keys_set:nn { stex / mmtdef } { #1 }
+}
+
+\NewDocumentCommand \mmtdef {m O{} }{
+ \_stex_mmtdef_args:n{ #2 }
+ \bool_set_true:N \l_stex_symdecl_make_macro_bool
+ \str_if_empty:NT \l_stex_symdecl_name_str {
+ \str_set:Nx \l_stex_symdecl_name_str { #1 }
+ }
+ %\tl_set:Nx \l_stex_symdecl_definiens_tl {
+ % \stex_annotate:nnn{ OMID }{
+ % \l_stex_module_mmtfor_str?\l_stex_symdecl_name_str
+ % }{}
+ %}
+ \stex_symdecl_do:n { #1 }
+ \MMTrule{rules.stex.mmt.kwarc.info?SubstitutionRule}{
+ \stex_annotate:nnn{ OMID }{
+ \l_stex_current_module_str ? \l_stex_symdecl_name_str
+ }{},
+ \stex_annotate:nnn{ OMID }{
+ \l_stex_module_mmtfor_str?\l_stex_symdecl_name_str
+ }{}
+ }
+ \tl_set:Nn \l_stex_notation_after_do_tl {
+ \_@@_final:
+ \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: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 }
+ { \l_@@_prec_str}
+}
% \end{macrocode}
% \end{macro}
%
@@ -1102,6 +1183,7 @@
op .tl_set:N = \l_@@_op_tl ,
prec .str_set_x:N = \l_@@_prec_str ,
reorder .str_set_x:N = \l_@@_reorder_str ,
+ argnames .clist_set:N = \l_@@_argnames_clist ,
assoc .choices:nn =
{bin,binl,binr,pre,conj,pwconj}
{\str_set:Nx \l_@@_assoctype_str {\l_keys_choice_tl}},
@@ -1120,6 +1202,7 @@
\tl_clear:N \l_@@_type_tl
\tl_clear:N \l_@@_def_tl
\tl_clear:N \l_@@_op_tl
+ \clist_clear:N \l_@@_argnames_clist
\keys_set:nn { stex / vardef } { #1 }
}
@@ -1176,7 +1259,21 @@
\prop_put:Nnx \l_tmpa_prop { assocs } { \int_use:N \l_tmpb_int }
\tl_set:cx { #1 }{ \stex_invoke_variable:n { \l_@@_name_str } }
- \prop_set_eq:cN { l_stex_variable_\l_@@_name_str _prop} \l_tmpa_prop
+ % argnames
+
+ \clist_clear:N \l_tmpa_clist
+ \int_step_inline:nn {\prop_item:Nn \l_tmpa_prop {arity}} {
+ \clist_if_empty:NTF \l_@@_argnames_clist {
+ \clist_put_right:Nn \l_tmpa_clist {##1}
+ }{
+ \clist_pop:NN \l_@@_argnames_clist \l_tmpa_tl
+ \exp_args:NNx \clist_put_right:Nn \l_tmpa_clist {\c_dollar_str\l_tmpa_tl}
+ }
+ }
+ \prop_put:Nnx \l_tmpa_prop {argnames} {\clist_use:Nn \l_tmpa_clist ,}
+
+
+ \prop_set_eq:cN { l_stex_symdecl_var://\l_@@_name_str _prop} \l_tmpa_prop
\tl_if_empty:NF \l_@@_op_tl {
\cs_set:cpx {
@@ -1352,6 +1449,17 @@
\cs_generate_from_arg_count:cNnn {stex_varseq_\l_@@_name_str _cs}
\cs_set:Npn {\int_use:N \l_@@_args_int} { #5 }
+
+ % argnames
+
+ \clist_clear:N \l_tmpa_clist
+ \int_step_inline:nn {\l_@@_args_int} {
+ \clist_put_right:Nn \l_tmpa_clist {##1}
+ }
+ \prop_put:Nnx \l_tmpa_prop {argnames} {\clist_use:Nn \l_tmpa_clist ,}
+
+
+
\exp_args:NNo \tl_set:No \l_tmpa_tl {\use:c{stex_varseq_\l_@@_name_str _cs}}
\int_step_inline:nn \l_@@_args_int {
@@ -1399,6 +1507,8 @@
\expandafter\meaning\csname stex_varseq_\l_@@_name_str _cs\endcsname\\~\\
\prop_to_keyval:N \l_tmpa_prop
}
+ \prop_set_eq:cN {l_stex_symdecl_varseq://\l_@@_name_str _prop}\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$}
@@ -1428,10 +1538,63 @@
}}
- \prop_set_eq:cN {stex_varseq_\l_@@_name_str _prop}\l_tmpa_prop
\ignorespacesandpars
}
+
+\keys_define:nn { stex / mmtdecl } {
+ name .str_set_x:N = \l_stex_symdecl_name_str ,
+ args .str_set_x:N = \l_stex_symdecl_args_str ,
+ deprecate .str_set_x:N = \l_stex_symdecl_deprecate_str ,
+ reorder .str_set_x:N = \l_stex_symdecl_reorder_str ,
+ argnames .clist_set:N = \l_stex_symdecl_argnames_clist ,
+ assoc .choices:nn =
+ {bin,binl,binr,pre,conj,pwconj}
+ {\str_set:Nx \l_stex_symdecl_assoctype_str {\l_keys_choice_tl}}
+}
+
+\cs_new_protected:Nn \_stex_mmtdecl_args:n {
+ \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
+ \clist_clear:N \l_stex_symdecl_argnames_clist
+
+ \keys_set:nn { stex / symdecl } { #1 }
+}
+
+\NewDocumentCommand \mmtdecl { s m O{}} {
+ \_stex_mmtdecl_args:n{#3}
+ \IfBooleanTF #1 {
+ \bool_set_false:N \l_stex_symdecl_make_macro_bool
+ } {
+ \bool_set_true:N \l_stex_symdecl_make_macro_bool
+ }
+ \str_if_empty:NT \l_stex_symdecl_name_str {
+ \str_set:Nx \l_stex_symdecl_name_str { #1 }
+ }
+ %\tl_set:Nx \l_stex_symdecl_definiens_tl {
+ % \stex_annotate:nnn{ OMID }{
+ % \l_stex_module_mmtfor_str?\l_stex_symdecl_name_str
+ % }{}
+ %}
+ \stex_symdecl_do:n{#2}
+ \MMTrule{rules.stex.mmt.kwarc.info?SubstitutionRule}{
+ \stex_annotate:nnn{ OMID }{
+ \l_stex_current_module_str ? \l_stex_symdecl_name_str
+ }{},
+ \stex_annotate:nnn{ OMID }{
+ \l_stex_module_mmtfor_str?\l_stex_symdecl_name_str
+ }{}
+ }
+ \stex_smsmode_do:
+}
+
+\stex_deactivate_macro:Nn \mmtdecl {mmtinterface~environments}
+\stex_deactivate_macro:Nn \mmtdef {mmtinterface~environments}
+
% \end{macrocode}
%
% \begin{macrocode}
diff --git a/macros/latex/contrib/stex/source/stex/stex-terms.dtx b/macros/latex/contrib/stex/source/stex/stex-terms.dtx
index 3827466f14..500372bcb4 100644
--- a/macros/latex/contrib/stex/source/stex/stex-terms.dtx
+++ b/macros/latex/contrib/stex/source/stex/stex-terms.dtx
@@ -10,7 +10,7 @@
% TODO update copyright
%
%<*driver>
-\def\bibfolder#1{../../lib/bib/#1}
+\def\libfolder#1{../../lib/#1}
\input{../../doc/stex-docheader}
\begin{document}
@@ -89,8 +89,8 @@
% with (downwards) argument precedence \meta{prec}.
% \end{function}
%
-% \begin{function}{\STEXInternalTermMathAssocArgiiii}
-% \begin{syntax} \cs{stex_term_arg:nnn}\meta{int}\meta{prec}\meta{notation}\meta{body} \end{syntax}
+% \begin{function}{\STEXInternalTermMathAssocArgiiiii}
+% \begin{syntax} \cs{stex_term_arg:nnn}\meta{int}\meta{prec}\meta{notation}\meta{type}\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|,
% with (downwards) argument precedence \meta{prec} and associative
@@ -267,8 +267,10 @@
\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_mathml_intent:nn{#1}{
+ \_stex_term_oms:nnn {#1}{#1 \c_hash_str CUSTOM-}{
+ \comp{ #2 }
+ }
}
}{
\_stex_reset:N \comp
@@ -382,6 +384,8 @@
}
\prop_new:N \l_@@_custom_args_prop
+\clist_new:N \l_stex_argnames_seq
+\seq_new:N \l_@@_tmp_seq
\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}
@@ -394,23 +398,47 @@
\prop_get:cnN {
l_stex_symdecl_#1 _prop
}{ args } \l_tmpa_str
+ \exp_args:NNx \seq_set_from_clist:Nn \l_stex_argnames_seq {
+ \prop_item:cn {l_stex_symdecl_#1 _prop}{argnames}
+ }
\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\c_hash_str CUSTOM-}{\ignorespaces#2}
+ \stex_mathml_intent:nn{#1}{
+ \_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\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
+ \seq_clear:N \l_@@_tmp_seq
+ \exp_args:Nx\int_step_inline:nn{\prop_item:cn{l_stex_symdecl_#1 _prop}{arity}}{
+ \tl_set:Nx \l_@@_tmp_tl {\seq_item:Nn \l_stex_argnames_seq {##1}}
+ \bool_lazy_or:nnT{
+ \str_if_eq_p:nn{a}{\str_item:Nn\l_tmpa_str{##1}}
+ }{
+ \str_if_eq_p:nn{B}{\str_item:Nn\l_tmpa_str{##1}}
+ }{
+ \tl_put_right:Nn \l_@@_tmp_tl +
+ }
+ \seq_put_right:No \l_@@_tmp_seq \l_@@_tmp_tl
+ }
+ \stex_mathml_intent:nn{
+ #1[\prop_item:cn {l_stex_symdecl_#1 _prop}{ args }](
+ \seq_use:Nn \l_@@_tmp_seq ,
+ )
}{
- \str_if_in:NnTF \l_tmpa_str B {
+ \str_if_in:NnTF \l_tmpa_str b {
\_stex_term_ombind:nnn {#1}{#1\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
}{
- \_stex_term_oma: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\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
+ }{
+ \_stex_term_oma:nnn {#1}{#1\c_hash_str CUSTOM-\l_tmpa_str}{\ignorespaces#2}
+ }
}
}
}
% TODO check that all arguments exist
}{
+ \_stex_reset:N \l_stex_argnames_seq
\_stex_reset:N \STEXInternalCurrentSymbolStr
\_stex_reset:N \arg
\_stex_reset:N \comp
@@ -452,15 +480,21 @@
}
}
\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 { %TODO
+ \bool_if:NTF \l_stex_allow_semantic_bool \use_i:nn {
+ \bool_set_true:N \l_stex_allow_semantic_bool
+ \use:nn
+ }
+ {
+ \stex_mathml_arg:nn{\seq_item:Nn \l_stex_argnames_seq \l_tmpa_int}{
+ \IfBooleanTF#1{
+ \stex_annotate_invisible:n { %TODO
+ \exp_args:No \_stex_term_arg:nn {\l_tmpa_str\int_use:N \l_tmpa_int}{\ignorespaces#3}
+ }
+ }{ %TODO
\exp_args:No \_stex_term_arg:nn {\l_tmpa_str\int_use:N \l_tmpa_int}{\ignorespaces#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
+ }}
+ {\bool_set_false:N \l_stex_allow_semantic_bool}
}
@@ -473,35 +507,37 @@
\cs_new_protected:Npn \STEXInternalTermMathArgiii #1#2#3 {
\exp_args:Nnx \use:nn
{ \int_set:Nn \l_@@_downprec { #2 }
+ \stex_mathml_arg:nn{\seq_item:Nn \l_stex_argnames_seq \l_tmpa_int}{
\_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{macro}{\STEXInternalTermMathAssocArgiiiii}
% \begin{macrocode}
-\cs_new_protected:Npn \STEXInternalTermMathAssocArgiiii #1#2#3#4 {
+\cs_new_protected:Npn \STEXInternalTermMathAssocArgiiiii #1#2#3#4#5 {
\cs_set:Npn \l_tmpa_cs ##1 ##2 { #4 }
- \tl_set:Nn \l_tmpb_tl {\STEXInternalTermMathArgiii{#1}{#2}}
+ \tl_set:Nn \l_tmpb_tl {\STEXInternalTermMathArgiii{#5#1}{#2}}
\tl_if_empty:nTF { #3 }{
- \STEXInternalTermMathArgiii{#1}{#2}{}
+ \STEXInternalTermMathArgiii{#5#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}}
+ \tl_set:Nn \l_tmpa_tl {\_@@_math_assoc_arg_maybe_sequence:Nnn#3{#1}{#5}}
\else
- \tl_set:Nn \l_tmpa_tl {\_@@_math_assoc_arg_simple:nn{#1}{#3}}
+ \tl_set:Nn \l_tmpa_tl {\_@@_math_assoc_arg_simple:nnn{#1}{#3}{#5}}
\fi
\l_tmpa_tl
}{
- \_@@_math_assoc_arg_simple:nn{#1}{#3}
+ \_@@_math_assoc_arg_simple:nnn{#1}{#3}{#5}
}
}
}
-\cs_new_protected:Nn \_@@_math_assoc_arg_maybe_sequence:Nn {
+\cs_new_protected:Nn \_@@_math_assoc_arg_maybe_sequence:Nnn {
\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 {
@@ -509,7 +545,7 @@
} \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}}
+ \tl_set:Nx \l_tmpa_tl {\prop_item:cn {l_stex_symdecl_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} {
@@ -525,7 +561,7 @@
}
}
}}}
- \exp_args:Nno \use:nn {\seq_set_map:NNn \l_tmpa_seq \l_tmpa_seq} \l_tmpa_tl
+ \exp_args:Nno \use:n {\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 {
@@ -541,28 +577,38 @@
}
\exp_args:No\l_tmpb_tl\l_tmpa_tl
}{
- \_@@_math_assoc_arg_simple:nn{#2} { #1 }
+ \_@@_math_assoc_arg_simple:nnn{#2} { #1 }{#3}
}
} {
- \_@@_math_assoc_arg_simple:nn{#2} { #1 }
+ \_@@_math_assoc_arg_simple:nnn{#2} { #1 }{#3}
}
}
-\cs_new_protected:Nn \_@@_math_assoc_arg_simple:nn {
+\cs_new_protected:Nn \_@@_math_assoc_arg_simple:nnn {
\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 } }
+ \tl_set:Nn \l_tmpa_tl {
+ \stex_mathml_arg:nn{\seq_item:Nn \l_stex_argnames_seq #1}{
+ \_stex_term_arg:nn{A#3#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
+ \tl_set:Nx \l_tmpa_tl {
+ \stex_mathml_arg:nn{\seq_item:Nn \l_stex_argnames_seq #1}{
+ \_stex_term_arg:nn{A#3#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
+ \l_tmpa_cs {
+ \stex_mathml_arg:nn{\seq_item:Nn \l_stex_argnames_seq #1}{
+ \_stex_term_arg:nn{A#3#1}{##1}
+ }
+ } \l_tmpa_tl
}
}
}
@@ -679,7 +725,9 @@
\cs_new_protected:Npn \STEXInternalTermMathOMSiiii #1#2#3#4 {
\_@@_maybe_brackets:nn { #3 }{
- \_stex_term_oms:nnn { #1 } { #1\c_hash_str#2 } { #4 }
+ \stex_mathml_intent:nn{#1} {
+ \_stex_term_oms:nnn { #1 } { #1\c_hash_str#2 } { #4 }
+ }
}
}
% \end{macrocode}
@@ -704,8 +752,35 @@
}
\cs_new_protected:Npn \STEXInternalTermMathOMAiiii #1#2#3#4 {
+ \exp_args:Nnx \use:nn {
+ \seq_clear:N \l_@@_tmp_seq
+ \prop_if_exist:cT{l_stex_symdecl_#1 _prop}{
+ \exp_args:NNx \seq_set_from_clist:Nn \l_stex_argnames_seq {
+ \prop_item:cn {l_stex_symdecl_#1 _prop}{argnames}
+ }
+ \exp_args:Nx\int_step_inline:nn{\prop_item:cn{l_stex_symdecl_#1 _prop}{arity}}{
+ \tl_set:Nx \l_@@_tmp_tl {\seq_item:Nn \l_stex_argnames_seq {##1}}
+ \bool_lazy_or:nnT{
+ \str_if_eq_p:nn{a}{\str_item:Nn\l_tmpa_str{##1}}
+ }{
+ \str_if_eq_p:nn{B}{\str_item:Nn\l_tmpa_str{##1}}
+ }{
+ \tl_put_right:Nn \l_@@_tmp_tl +
+ }
+ \seq_put_right:No \l_@@_tmp_seq \l_@@_tmp_tl
+ }
+ }
\_@@_maybe_brackets:nn { #3 }{
- \_stex_term_oma:nnn { #1 } { #1\c_hash_str#2 } { #4 }
+ \stex_mathml_intent:nn{
+ #1[\prop_item:cn {l_stex_symdecl_#1 _prop}{ args }](
+ \seq_use:Nn \l_@@_tmp_seq ,
+ )
+ }{
+ \_stex_term_oma:nnn { #1 } { #1\c_hash_str#2 } { #4 }
+ }
+ }
+ }{
+ \_stex_reset:N \l_stex_argnames_seq
}
}
% \end{macrocode}
@@ -720,8 +795,35 @@
}
\cs_new_protected:Npn \STEXInternalTermMathOMBiiii #1#2#3#4 {
+ \exp_args:Nnx \use:nn {
+ \seq_clear:N \l_@@_tmp_seq
+ \prop_if_exist:cT{l_stex_symdecl_#1 _prop}{
+ \exp_args:NNx \seq_set_from_clist:Nn \l_stex_argnames_seq {
+ \prop_item:cn {l_stex_symdecl_#1 _prop}{argnames}
+ }
+ \exp_args:Nx\int_step_inline:nn{\prop_item:cn{l_stex_symdecl_#1 _prop}{arity}}{
+ \tl_set:Nx \l_@@_tmp_tl {\seq_item:Nn \l_stex_argnames_seq {##1}}
+ \bool_lazy_or:nnT{
+ \str_if_eq_p:nn{a}{\str_item:Nn\l_tmpa_str{##1}}
+ }{
+ \str_if_eq_p:nn{B}{\str_item:Nn\l_tmpa_str{##1}}
+ }{
+ \tl_put_right:Nn \l_@@_tmp_tl +
+ }
+ \seq_put_right:No \l_@@_tmp_seq \l_@@_tmp_tl
+ }
+ }
\_@@_maybe_brackets:nn { #3 }{
- \_stex_term_ombind:nnn { #1 } { #1\c_hash_str#2 } { #4 }
+ \stex_mathml_intent:nn{
+ #1[\prop_item:cn {l_stex_symdecl_#1 _prop}{ args }](
+ \seq_use:Nn \l_@@_tmp_seq ,
+ )
+ }{
+ \_stex_term_ombind:nnn { #1 } { #1\c_hash_str#2 } { #4 }
+ }
+ }
+ }{
+ \_stex_reset:N \l_stex_argnames_seq
}
}
% \end{macrocode}
@@ -990,7 +1092,7 @@
\_stex_reset:N \STEXInternalCurrentSymbolStr
}
}{
- \int_compare:nNnTF {\prop_item:cn {l_stex_variable_#1_prop}{arity}} = 0{
+ \int_compare:nNnTF {\prop_item:cn {l_stex_symdecl_var://#1_prop}{arity}} = 0{
\_@@_invoke_math_ii:n {#1}
}{
\msg_error:nnxx{stex}{error/noop}{variable~#1}{}
@@ -1024,7 +1126,7 @@
\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
+ l_stex_symdecl_var://#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: }
@@ -1063,7 +1165,7 @@
\exp_args:Nnx \use:nn {
\def\comp{\_varcomp}
\str_set:Nn \STEXInternalCurrentSymbolStr {varseq://#1}
- \prop_item:cn{stex_varseq_#1_prop}{notation}
+ \prop_item:cn{l_stex_symdecl_varseq://#1_prop}{notation}
}{
\_stex_reset:N \comp
\_stex_reset:N \STEXInternalCurrentSymbolStr