diff options
Diffstat (limited to 'macros/latex/contrib/stex')
48 files changed, 2336 insertions, 1305 deletions
diff --git a/macros/latex/contrib/stex/doc/Makefile b/macros/latex/contrib/stex/doc/Makefile index b727f2f94d..7544a3c2fd 100644 --- a/macros/latex/contrib/stex/doc/Makefile +++ b/macros/latex/contrib/stex/doc/Makefile @@ -2,7 +2,7 @@ STY = stex extensions SPATH = $(STY:%=../source/%) DTX = $(shell ls $(SPATH:%=%/*.dtx)) INS = $(shell ls $(SPATH:%=%/*.ins)) -DOC = stex-doc.pdf stex-manual.pdf +DOC = stex-doc.pdf stex-manual.pdf stex-ide.pdf TEXDIR = ../tex TEXINPUTS = $(TEXDIR)//: diff --git a/macros/latex/contrib/stex/doc/img/vsc1.png b/macros/latex/contrib/stex/doc/img/vsc1.png Binary files differnew file mode 100644 index 0000000000..c6c3847f69 --- /dev/null +++ b/macros/latex/contrib/stex/doc/img/vsc1.png diff --git a/macros/latex/contrib/stex/doc/img/vsc2.png b/macros/latex/contrib/stex/doc/img/vsc2.png Binary files differnew file mode 100644 index 0000000000..e6365ad802 --- /dev/null +++ b/macros/latex/contrib/stex/doc/img/vsc2.png diff --git a/macros/latex/contrib/stex/doc/img/vsc3.png b/macros/latex/contrib/stex/doc/img/vsc3.png Binary files differnew file mode 100644 index 0000000000..d7b67ae278 --- /dev/null +++ b/macros/latex/contrib/stex/doc/img/vsc3.png diff --git a/macros/latex/contrib/stex/doc/packages/stex-document-structure.tex b/macros/latex/contrib/stex/doc/packages/stex-document-structure.tex index f8d570ea5e..f2cabec6c0 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-document-structure.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-document-structure.tex @@ -1,3 +1,4 @@ +\begin{sfragment}[id=sec:ds:intro]{Introduction} The \pkg{document-structure} package supplies an infrastructure for writing {\omdoc} documents in {\LaTeX}. This includes a simple structure sharing mechanism for \sTeX that allows to to move from a copy-and-paste document development model to a copy-and-reference model, which @@ -17,7 +18,9 @@ after translation. DAG models of documents allow to replace the ``Copy and Paste'' in the source document with a label-and-reference model where document are shared in the document source and the formatter does the copying during document formatting/presentation. +\end{sfragment} +\begin{sfragment}{Package Options} The \pkg{document-structure} package accepts the following options: \begin{center} \begin{tabular}{|l|p{10cm}|}\hline @@ -26,7 +29,9 @@ The \pkg{document-structure} package accepts the following options: \meta{sect} is \texttt{section}\\\hline \end{tabular} \end{center} +\end{sfragment} +\begin{sfragment}{Document Fragments} \begin{environment}{sfragment} The structure of the document is given by nested |sfragment| environments. In the {\LaTeX} route, the |sfragment| environment is flexibly mapped to sectioning commands, @@ -36,8 +41,8 @@ The \pkg{document-structure} package accepts the following options: sfragment. The optional metadata argument has the keys |id| for an identifier, |creators| and |contributors| for the Dublin Core metadata~\cite{DCMI:dmt03}. The option |short| allows to give a short title for the generated section. If the title contains - semantic macros, they need to be protected by |\protect|\ednote{MK: still?}, and we need - to give the |loadmodules| key it needs no value. For instance we would have + semantic macros, we need to give the |loadmodules| key (it needs no value). For instance + we would have \begin{latexcode} \begin{smodule}{foo} \symdef{bar}{B^a_r} @@ -90,9 +95,8 @@ Here we use two levels of |blindfragment|: the introductory remarks become a ``chapter'' instead of a ``part''. \item The inner one groups the frontmatter\footnote{We shied away from redefining the |frontmatter| to induce a blindfragment, but this may be the ``right'' way to go in - the future.} and makes the preface of the book a section-level construct.\ednote{MK: - We need a substitute for the ``Note that here the |display=flow| on the |sfragment| - environment prevents numbering as is traditional for prefaces.''} + the future.} and makes the preface of the book a section-level construct. The + |frontmatter| environment also suppresses numbering as is traditional for prefaces. \end{itemize} \end{environment} @@ -110,11 +114,13 @@ Here we use two levels of |blindfragment|: will\ldots'' in an |sfragment| environment, where we do not know which sectioning level we will end up. \end{function} +\end{sfragment} +\begin{sfragment}{Ending Documents Prematurely} \begin{function}{\prematurestop,\afterprematurestop} For prematurely stopping the formatting of a document, \sTeX provides the |\prematurestop| macro. It can be used everywhere in a document and ignores all input - after that -- backing out of the |sfragment| environment as needed. After that -- and + after that -- backing out of the |sfragment| environments as needed. After that -- and before the implicit |\end{document}| it calls the internal |\afterprematurestop|, which can be customized to do additional cleanup or e.g. print the bibliography. @@ -132,7 +138,12 @@ instance, the admin section of a course can be made course-independent (and ther re-usable) by using variables (actually token registers) |courseAcronym| and |courseTitle| instead of the text itself. The variables can then be set in the \sTeX preamble of the course notes file. - +\end{sfragment} + +\begin{sfragment}{Global Document Variables} + To make document fragments more reusable, we sometimes want to make the content depend + on the context. We use \defemph{document variables} for that. + \begin{function}{\setSGvar,\useSGvar} |\setSGvar{|\meta{vname}|}{|\meta{text}|}| to set the global variable \meta{vname} to \meta{text} and |\useSGvar{|\meta{vname}|}| to reference it. @@ -144,6 +155,7 @@ course notes file. variable \meta{vname}, only if (after expansion) it is equal to \meta{val}, the conditional text \meta{ctext} is formatted. \end{function} +\end{sfragment} %%% Local Variables: %%% mode: latex diff --git a/macros/latex/contrib/stex/doc/packages/stex-features.tex b/macros/latex/contrib/stex/doc/packages/stex-features.tex index b5ce5906d1..4e0cd21457 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-features.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-features.tex @@ -144,8 +144,16 @@ and be a \symname{monoid} on $\Int$ ... } - We will return to these two example later, when we also know - how to handle the \emph{axioms} of a monoid. + +We will return to these two example later, when we also know how to handle the +\emph{axioms} of a monoid. + +\begin{environment}{usestructure} + The |usestructure{<struct>}| environment is used in multilingual settings as a parallel + to the |mathstructure|. It opens a group and then issues a + |\usemodule{.../<struct>-structure}| that gives the body access to all the semantic + macros in the referenced structure. +\end{environment} \end{smodule} \end{sfragment} diff --git a/macros/latex/contrib/stex/doc/packages/stex-hwexam.tex b/macros/latex/contrib/stex/doc/packages/stex-hwexam.tex index 5aced96e66..a3679d0d94 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-hwexam.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-hwexam.tex @@ -1,15 +1,29 @@ - +\begin{sfragment}{Introduction} The \pkg{hwexam} package and class supplies an infrastructure that allows to format nice-looking assignment sheets by simply including problems from problem files marked up -with the \pkg{roblem} package. It is designed to be compatible with |problems.sty|, and +with the \pkg{problem} package. It is designed to be compatible with |problems.sty|, and inherits some of the functionality. +\end{sfragment} +\begin{sfragment}{Package Options} \begin{variable}{solutions,notes,hints,gnotes,pts,min} - The \pkg{wexam} package and class take the options |solutions|, |notes|, |hints|, + The \pkg{hwexam} package and class take the options |solutions|, |notes|, |hints|, |gnotes|, |pts|, |min|, and |boxed| that are just passed on to the \pkg{problems} package (cf. its documentation for a description of the intended behavior). \end{variable} +Furthermore, the \pkg{hwexam} package takes the option +\DescribeMacro{multiple}|multiple| that allows to combine multiple assignment sheets +into a compound document (the assignment sheets are treated as section, there is a table +of contents, etc.). + +Finally, there is the option \DescribeMacro{test}|test| that modifies the behavior to +facilitate formatting tests. Only in |test| mode, the macros |\testspace|, +|\testnewpage|, and |\testemptypage| have an effect: they generate space for the +students to solve the given problems. Thus they can be left in the {\LaTeX} source. +\end{sfragment} + +\begin{sfragment}{Assignments} This package supplies the \DescribeEnv{assignment}|assignment| environment that groups problems into assignment sheets. It takes an optional KeyVal argument with the keys \DescribeMacro{number}|number| (for the assignment number; if none is given, 1 is @@ -19,23 +33,22 @@ is referenced in the title of the assignment sheet), \DescribeMacro{type}|type| assignment type; e.g. ``quiz'', or ``homework''), \DescribeMacro{given}|given| (for the date the assignment was given), and \DescribeMacro{due}|due| (for the date the assignment is due). +\end{sfragment} -Furthermore, the \pkg{hwexam} package takes the option -\DescribeMacro{multiple}|multiple| that allows to combine multiple assignment sheets -into a compound document (the assignment sheets are treated as section, there is a table -of contents, etc.). - -Finally, there is the option \DescribeMacro{test}|test| that modifies the behavior to -facilitate formatting tests. Only in |test| mode, the macros |\testspace|, -|\testnewpage|, and |\testemptypage| have an effect: they generate space for the -students to solve the given problems. Thus they can be left in the {\LaTeX} source. +\begin{sfragment}{Including Assignments} +\begin{function}{\inputassignment} + The |\inputassignment| macro can be used to input an assignment from another file. It + takes an optional KeyVal argument and a second argument which is a path to the file + containing the problem (the macro assumes that there is only one |assignment| + environment in the included file). The keys |number|, |title|, |type|, |given|, and + |due| are just as for the |assignment| environment and (if given) overwrite the ones + specified in the |assignment| environment in the included file. +\end{function} +\end{sfragment} -\DescribeMacro{\testspace}|\testspace| takes an argument that expands to a dimension, -and leaves vertical space accordingly. \DescribeMacro{\testnewpage}|\testnewpage| makes -a new page in |test| mode, and \DescribeMacro{\testemptypage}|\testemptypage| generates -an empty page with the cautionary message that this page was intentionally left empty. +\begin{sfragment}{Typesetting Exams} -Finally, the \DescribeEnv{testheading}|\testheading| takes an optional keyword argument +The \DescribeEnv{testheading}|\testheading| takes an optional keyword argument where the keys \DescribeMacro{duration}|duration| specifies a string that specifies the duration of the test, \DescribeMacro{min}|min| specifies the equivalent in number of minutes, and \DescribeMacro{reqpts}|reqpts| the points that are required for a perfect @@ -68,17 +81,12 @@ Will result in \end{center} \ednote{MK: The first three ``problems'' come from the stex examples above, how do we get rid of this?} - -\begin{function}{\inputassignment} - The |\inputassignment| macro can be used to input an assignment from another file. It - takes an optional KeyVal argument and a second argument which is a path to the file - containing the problem (the macro assumes that there is only one |assignment| - environment in the included file). The keys |number|, |title|, |type|, |given|, and - |due| are just as for the |assignment| environment and (if given) overwrite the ones - specified in the |assignment| environment in the included file. -\end{function} +\end{sfragment} %%% Local Variables: %%% mode: latex %%% TeX-master: "../stex-manual" %%% End: + +% LocalWords: hwexam solutions,notes,hints,gnotes,pts,min gnotes testemptypage reqpts +% LocalWords: inputassignment reqpts hour,min 60,reqpts diff --git a/macros/latex/contrib/stex/doc/packages/stex-idesetup.tex b/macros/latex/contrib/stex/doc/packages/stex-idesetup.tex new file mode 100644 index 0000000000..b4d495b628 --- /dev/null +++ b/macros/latex/contrib/stex/doc/packages/stex-idesetup.tex @@ -0,0 +1,61 @@ +\begin{sfragment}{Setting up the \sTeX IDE} + + The \sTeX IDE consists of two components using the + \emph{Language Server Protocol (LSP)}: A \emph{client} + in the form of a VSCode extension, and a \emph{server} + included in the \mmt system. Installing the extension will + open up a setup routine that will guide you through the rest. + + \begin{sfragment}{The \sTeX VSCode Extension} + + If you have not already, you should first install the VSCode editor + available at \url{https://code.visualstudio.com/}. + + Next, open VSCode and install the \sTeX extension by clicking on + the \emph{extensions} menu on the very left of the VSCode window + and searching for ``sTeX'' in the + \emph{``Search Extensions in Marketplace''} field, as in + \autoref{fig:install}, and clicking the \emph{Install}-button + of the \sTeX extension by KWARC. + + \begin{figure} + \begin{center} + \includegraphics[width=0.6\textwidth]{img/vsc1.png} + \end{center} + \caption{Installing the \sTeX extension for VSCode}\label{fig:install} + \end{figure} + + \end{sfragment} + + \begin{sfragment}{Setting up \mmt} + + Next, open any directory (\texttt{File $\to$ Open Folder...}) that contains + a \verb|.tex|-file, and a setup window as in \autoref{fig:setup} + will pop up. Clik on the highlighted link `\emph{here}' and download + the latest version of the \texttt{MMT.jar} file (at least version 23.0.0) + anywhere you like. Then click the \emph{``Browse...''}-button + and select your freshly downloaded \texttt{MMT.jar}. + + If you have already set a system variable for your MathHub-directory, + you are now done and can click \emph{``Finish''}. If you have not, + you can now also enter a directory path in the lower text field, + and the VSCode extension will attempt to globally set one up + for you, depending on your operating system. + + \begin{figure} + \begin{center} + \includegraphics[width=\textwidth]{img/vsc2.png} + \end{center} + \caption{\sTeX Setup Routine}\label{fig:setup} + \end{figure} + + Once you click \emph{``Finish''}, the client will connect + to \url{https://stexmmt.mathhub.info/:sTeX}, query for + available archives, download the core libraries required + for all (or most) semantic services (\texttt{MMT/urtheories} + and \texttt{sTeX/meta-inf}) and set up \RusTeX for you + automatically. + + \end{sfragment} + + \end{sfragment}
\ No newline at end of file diff --git a/macros/latex/contrib/stex/doc/packages/stex-mathhub.tex b/macros/latex/contrib/stex/doc/packages/stex-mathhub.tex index fb872acfba..eb09414ac7 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-mathhub.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-mathhub.tex @@ -1,4 +1,4 @@ -\begin{sfragment}{The Local MathHub-Directory} +\begin{sfragment}[id=sec:localmh]{The Local MathHub-Directory} \stexcode"\usemodule", \stexcode"\importmodule", \stexcode"\inputref" etc. allow for including content modularly without having to specify absolute diff --git a/macros/latex/contrib/stex/doc/packages/stex-mathhubsetup.tex b/macros/latex/contrib/stex/doc/packages/stex-mathhubsetup.tex new file mode 100644 index 0000000000..7a653186b3 --- /dev/null +++ b/macros/latex/contrib/stex/doc/packages/stex-mathhubsetup.tex @@ -0,0 +1,25 @@ + \begin{sfragment}{Setting your MathHub Directory} + One of \sTeX's features is a proper \emph{module system} + of interconnected document snippets for mathematical + content. Analogously to \emph{object-oriented programming}, + it allows for ``object-oriented mathematics'' via individual + combinable and, importantly, \emph{reusable} modules, developed + collaboratively. + + To make use of such modules, the \sTeX system needs to be told + where to find them. There are several ways to do so (see + \sref[file=stex-mathhub]{sec:localmh}[in=../stex-manual, + title={\href{\basedocurl/stex-manual.pdf}{the \sTeX{}3 Manual}}]), + but the most convenient way to do so is via a system variable. + + To do so, create a directory \texttt{MathHub} somewhere on + your local file system and set the environment + variable \texttt{MATHHUB} to the file path to that directory. + + In linux, you can do so by writing + \begin{lstlisting}[language=bash] + export MATHHUB="/path/to/your/MathHub" + \end{lstlisting} + in your \verb|~/.profile| (for all shells) or \verb|~/.bashrc| + (for the bash terminal only) file. + \end{sfragment}
\ No newline at end of file diff --git a/macros/latex/contrib/stex/doc/packages/stex-slides.tex b/macros/latex/contrib/stex/doc/packages/stex-notesslides.tex index a900c1fcbb..75fd9ee9e8 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-slides.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-notesslides.tex @@ -1,4 +1,5 @@ -The \pkg{notesslides} document class is derived from |beamer.cls|~\cite{beamerclass:on}, +\begin{sfragment}{Introduction} + The \pkg{notesslides} document class is derived from |beamer.cls|~\cite{beamerclass:on}, it adds a ``notes version'' for course notes that is more suited to printing than the one supplied by |beamer.cls|. @@ -14,27 +15,36 @@ In practice we want to generate two documents from the same source: the slides f presentation in the lecture and the course notes as a narrative document for home study. To achieve this, the \pkg{notesslides} class has two modes: \emph{slides mode} and \emph{notes mode} which are determined by the package option. +\end{sfragment} + +\begin{sfragment}{Package Options} + The \pkg{notesslides} class takes a variety of class options: + + \begin{variable}{slides,notes} The options |slides| and |notes| switch between slides + mode and notes mode (see \sref{sec:user:notesslides}). + \end{variable} + + \begin{variable}{sectocframes} If the option |sectocframes| is given, then for the + |sfragment|s, special frames with the |sfragment| title (and number) are generated. + \end{variable} + \begin{variable}{frameimages,fiboxed} + If the option |frameimages| is set, then slide mode also shows the + |\frameimage|-generated frames (see \sref{sec:user:frameimage}). If also the |fiboxed| + option is given, the slides are surrounded by a box. + \end{variable} +\end{sfragment} + +\begin{sfragment}[id=sec:user:notesslides]{Notes and Slides} -\begin{variable}{slides,notes,sectocframes,frameimages,fiboxed} - The \pkg{notesslides} class takes a variety of class options: - \begin{itemize} - \item The options |slides| and |notes| switch between slides mode and notes mode (see - Section~\ref{sec:user:notesslides}). - \item If the option |sectocframes| is given, then for the |sfragment|s, special frames - with the |sfragment| title (and number) are generated. - \item If the option |frameimages| is set, then slide mode also shows the - |\frameimage|-generated frames (see section~\ref{sec:user:frameimage}). If also the - |fiboxed| option is given, the slides are surrounded by a box. - \end{itemize} -\end{variable} - -\begin{environment}{frame,note} +\begin{environment}{frame} Slides are represented with the |frame| environment just like in the \pkg{beamer} class, - see~\cite{Tantau:ugbc} for details. The \pkg{notesslides} class adds the |note| - environment for encapsulating the course note fragments.\footnote{MK: it would be very - nice, if we did not need this environment, and this should be possible in principle, - but not without intensive LaTeX trickery. Hints to the author are welcome.} + see~\cite{Tantau:ugbc} for details. +\end{environment} + +\begin{environment}{note} + The \pkg{notesslides} class adds the |note| environment for encapsulating the course + note fragments. \end{environment} \begin{dangerbox} @@ -86,6 +96,7 @@ here: least in conjunction with |\newpage|, frame numbering behaves funnily (we have tried to fix this, but who knows). \end{dangerbox} +\end{sfragment} \begin{function}{\inputref*} If we want to transclude a the contents of a file as a note, we can use a new variant @@ -101,6 +112,17 @@ here: |ndefinition|, |nexample|, |nsproof|, and |nassertion| environments. \end{environment} +\begin{sfragment}{Customizing Header and Footer Lines} + The \pkg{notesslides} package and class comes with a simple default theme named + \pkg{sTeX} that provided by the \pkg{beamterthemesTeX}. It is assumed as the default + theme for \sTeX-based notes and slides. + The result in |notes| mode (which is like the |slides| version except that the slide + hight is variable) is + + \includegraphics[width=.95\textwidth]{\libfolder{img/notes-frame}} + +The footer line can be customized. In particular the logos. + \begin{function} {\setslidelogo} The default logo provided by the \pkg{notesslides} package is the {\sTeX} logo it can be customized using |\setslidelogo{|\meta{logo name}|}|. @@ -108,10 +130,9 @@ here: \begin{function}{\setsource} The default footer line of the \pkg{notesslides} package mentions copyright and - licensing. In the \pkg{beamer} class, |\source| stores the author's name as the - copyright holder . By default it is \emph{Michael Kohlhase} in the \pkg{notesslides} - package since he is the main user and designer of this - package. |\setsource{|\meta{name}|}| can change the writer's name. + licensing. In \pkg{notesslides} |\source| stores the author's name as the copyright + holder. By default it is the author's name as defined in the |\author| macro in the + preamble. |\setsource{|\meta{name}|}| can change the writer's name. \end{function} \begin{function}{\setlicensing} @@ -120,8 +141,10 @@ here: hyperlink to the license logo. |\setlicensing[|\meta{url}|]{|\meta{logo name}|}| is used for customization, where \meta{url} is optional. \end{function} +\end{sfragment} -Sometimes, we want to integrate slides as images after all -- e.g. because we already +\begin{sfragment}[id=sec:user:frameimages]{Frame Images} + Sometimes, we want to integrate slides as images after all -- e.g. because we already have a PowerPoint presentation, to which we want to add \sTeX notes. \begin{function}{\frameimage,\mhframeimage} @@ -150,21 +173,28 @@ argument is redundant, so we can just use \begin{latexcode} \mhframeimage{baz/foobar} \end{latexcode} +\end{sfragment} \begin{function}{\textwarning} The |\textwarning| macro generates a warning sign: \textwarning \end{function} +\begin{sfragment}[id=sec:user:excursions]{Excursions} In course notes, we sometimes want to point to an ``excursion'' -- material that is either presupposed or tangential to the course at the moment -- e.g. in an appendix. The typical setup is the following: \begin{latexcode} -\excursion{founif}{../ex/founif}{We will cover first-order unification in} +\excursion{founif}{../fragments/founif.en} + {We will cover first-order unification in} ... \begin{appendix}\printexcursions\end{appendix} \end{latexcode} +It generates a paragraph that references the excursion whose source is in the file +|../fragments/founif.en.tex| and automatically books the file for the |\printexcursions| +command that is used here to put it into the appendix. We will look at the mechanics now. + \begin{function}{\excursion} The |\excursion{|\meta{ref}|}{|\meta{path}|}{|\meta{text}|}| is syntactic sugar for @@ -198,6 +228,7 @@ setup is the following: \end{note} \end{latexcode} \end{function} +\end{sfragment} \begin{dangerbox} When option |book| which uses |\pagestyle{headings}| is given and semantic macros are diff --git a/macros/latex/contrib/stex/doc/packages/stex-problem.tex b/macros/latex/contrib/stex/doc/packages/stex-problem.tex index a90c36412d..53316b28bc 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-problem.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-problem.tex @@ -1,4 +1,5 @@ -The \pkg{problem} package supplies an infrastructure that allows specify problem. Problems +\begin{sfragment}{Introduction} + The \pkg{problem} package supplies an infrastructure that allows specify problem. Problems are text fragments that come with auxiliary functions: hints, notes, and solutions\footnote{for the moment multiple choice problems are not supported, but may well be in a future version}. Furthermore, we can specify how long the solution to a @@ -7,7 +8,11 @@ solution. Finally, the \pkg{problem} package facilitates the management of problems in small files, so that problems can be re-used in multiple environment. +\end{sfragment} + +\begin{sfragment}{Problems and Solutions} + \begin{function}{solutions,notes,hints,gnotes,pts,min,boxed,test} The \pkg{problem} package takes the options |solutions| (should solutions be output?), |notes| (should the problem notes be presented?), |hints| (do we give the hints?), @@ -43,7 +48,7 @@ so that problems can be re-used in multiple environment. \begin{exnote} Justify your answer \end{exnote} -\begin{solution}[for=elefants,height=3cm] +\begin{solution}[for=elefants] Four, two in the front seats, and two in the back. \begin{gnote} if they do not give the justification deduct 5 pts @@ -66,7 +71,7 @@ so that problems can be re-used in multiple environment. \begin{environment}{hint,exnote,gnote} The |hint| and |exnote| environments can be used in a |problem| environment to give hints and to make notes that elaborate certain aspects of the problem. The |gnote| - (grading notes) environment can be used to document situtations that may arise in + (grading notes) environment can be used to document situations that may arise in grading. \end{environment} @@ -80,7 +85,22 @@ so that problems can be re-used in multiple environment. Also, sometimes, we want content (e.g. in an exam with master solutions) conditional on whether solutions are shown. This can be done with the |\ifsolutions| conditional. \end{function} +\end{sfragment} + +\begin{sfragment}{Markup for Added-Value Services} + +\begin{sparagraph} + The |problem| package is all about specifying the meaning of the various moving parts of + practice/exam problems. The motivation for the additional markup is that we can base + added-value services from these, for instance auto-grading and immediate feedback. + The simplest example of this are multiple-choice problems, where the |problem| package + allows to annotate answer options with the intended values and possibly feedback that + can be delivered to the users in an interactive setting. In this section we will give + some infrastructure for these, we expect that this will grow over time. +\end{sparagraph} + +\begin{sfragment}{Multiple Choice Blocks} \begin{environment}{mcb} Multiple choice blocks can be formatted using the |mcb| environment, in which single choices are marked up with |\mcc| macro. @@ -96,8 +116,8 @@ so that problems can be re-used in multiple environment. \item |feedback| for a short feedback text given to the student. \end{itemize} \end{function} - -If we start the solutions, then we get +What we see when this is formatted to PDF depends on the context. In solutions mode (we +start the solutions in the code fragment below) we get \stexexample{% \startsolutions @@ -111,8 +131,8 @@ If we start the solutions, then we get \end{mcb} \end{sproblem} } -without solutions (that is what the students see during the exam/quiz)\ednote{MK: that did -not work!} + +In ``exam mode'' where disable solutions (here via |\stopsolutions|) \stexexample{% \stopsolutions \begin{sproblem}[title=Functions,name=functions1] @@ -125,7 +145,44 @@ not work!} \end{mcb} \end{sproblem} } - +we get the questions without solutions (that is what the students see during the +exam/quiz). +\end{sfragment} + +\begin{sfragment}{Filling-In Concrete Solutions} +The next simplest situation, where we can implement auto-grading is the case where we +have fill-in-the-blanks + +\begin{function}{\fillinsol} + The |\fillinsol| macro takes\Ednote{for now; more to come} an a single argument, which + contains a concrete solution (i.e. a number, a string, \ldots), which generates a + fill-in-box in test mode: +\stexexample{% + \stopsolutions + \begin{sproblem}[id=elefants.fillin,title=Fitting Elefants] + How many Elefants can you fit into a Volkswagen beetle? \fillinsol{4} +\end{sproblem}} + and the actual solution in solutions mode: +\end{function} +\stexexample{% + \begin{sproblem}[id=elefants.fillin,title=Fitting Elefants] + How many Elefants can you fit into a Volkswagen beetle? \fillinsol{4} + \end{sproblem}} +If we do not want to leak information about the solution by the size of the blank we can +also give |\fillinsol| an optional argument with a size: |\fillinsol[3cm]{12}| makes a box + three cm wide. + + Obviously, the required argument of |\fillinsol| can be used for auto-grading. For + concrete data like numbers, this is immediate, for more complex data like strings ``soft + comparisons'' might be in order. \ednote{For the moment we only assume a single concrete + value as correct. In the future we will almost certainly want to extend the + functionality to multiple answer classes that allow different feedback like im + MCQ. This still needs a bit of design. Also we want to make the formatting of the + answer in solutions/test mode configurable.} +\end{sfragment} +\end{sfragment} + +\begin{sfragment}{Including Problems} \begin{function}{\includeproblem} The |\includeproblem| macro can be used to include a problem from another file. It takes an optional KeyVal argument and a second argument which is a path to the file containing @@ -144,8 +201,32 @@ The |\min| and |\pts| macros allow to specify (i.e. to print to the margin) the distribution of time and reward to parts of a problem, if the |pts| and |pts| options are set. This allows to give students hints about the estimated time and the points to be awarded. +\end{sfragment} + +\begin{sfragment}{Testing and Spacing} +The |problem| package is often used by the |hwexam| package, which is used to create +homework assignments and exams. Both of these have a ``test mode'' (invoked by the +package option |test|), where certain information --master solutions or feedback -- is +not shown in the presentation. + +\DescribeMacro{\testspace}|\testspace| takes an argument that expands to a dimension, and +leaves vertical space accordingly. Specific instances exist: +\DescribeMacro{\testsmallspace}|\testsmallspace|, +\DescribeMacro{\testsmallspace}|\testsmallspace|, +\DescribeMacro{\testsmallspace}|\testsmallspace| give small (1cm), medium (2cm), and big (3cm) +vertical space. + +\DescribeMacro{\testnewpage}|\testnewpage| makes a new page in |test| mode, and +\DescribeMacro{\testemptypage}|\testemptypage| generates an empty page with the cautionary +message that this page was intentionally left empty. +\end{sfragment} %%% Local Variables: %%% mode: latex %%% TeX-master: "../stex-manual" %%% End: + +% LocalWords: solutions,notes,hints,gnotes,pts,min,boxed,test gnotes elefants,pts gnote +% LocalWords: 2,title exnote hint,exnote,gnote ifsolutions mcb keyvals Ttext Ftext +% LocalWords: Functions,name F,feedback Nooooooooo,feedback 2,title includeproblem +% LocalWords: elefants.fillin,title diff --git a/macros/latex/contrib/stex/doc/packages/stex-proofs.tex b/macros/latex/contrib/stex/doc/packages/stex-proofs.tex index d06db1282f..9e6e44f5ca 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-proofs.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-proofs.tex @@ -1,100 +1,308 @@ +\begin{sfragment}{Proofs} + The \pkg{stex-proof} package supplies macros and environment that allow to annotate the structure of mathematical proofs in \sTeX document. This structure can be used by MKM systems for added-value services, either directly from the \sTeX sources, or after translation. -We will go over the general intuition by way of a running example: +Its central component is the |sproof|-environment, whose body consists +of: +\begin{itemize} + \item \emph{subproofs} via the |subproof|-environment, + \item \emph{proof steps} via the |\spfstep|, |\eqstep| + |\assumption|, and |\conclude| macros, and + \item \emph{comments}, via normal text without special markup. +\end{itemize} + +|sproof|, |subproof| and the various proof step macros take the following +optional arguments: +\begin{itemize} + \item[|id|] (\meta{string}) for referencing, + \item[|method|] (\meta{string}) the proof method (e.g. contradiction, induction,...) + \item[|term|] (\meta{token list}) the (ideally semantically-marked up) + proposition that is derived/proven by this proof/subproof/proof step. +\end{itemize} +Additionally, they take one mandatory argument for the document text +to be annotated, or (in the case of the environments) +as an introductory description of the proof itself. Since +the latter often contains the |term| to be derived +as text, alternatively to providing it as +an optional argument, the mandatory argument can use the +|\yield|-macro to mark it up in the text. + +The |sproof| and |subproof| environments additionally take +two optional arguments: +\begin{itemize} + \item[|for|] the symbol identifier/name corresponding to the |sassertion| + to be proven. This too subsumes |\yield| and the |term|-argument. + \item[|hide|] In the pdf, this only shows the mandatory argument text + and hides the body of the environment. In the HTML (as served by \mmt), + the bodies of all |proof| and |subproof| environments are \emph{collapsible}, + and |hide| collapses the body by default. +\end{itemize} + +\begin{smodule}{sproofs} + \symdef{coprime}[args=2]{#1 \comp\bot #2} + \symdef{realroot}[args=1]{\sqrt{#1}} + \symdecl{irrational}[args=1] + \symdecl{rational}[args=1] + \symdef{eq}[args=2]{#1 \comp= #2} + \symdef{ratfrac}[args=2,prec=1]{\frac{#1}{#2}} + \symdef{intpow}[args=2,prec=-1]{{#1}^{#2}} + \symdef{ratpow}[args=2]{{#1}^{#2}} + \symdef{inset}[args=ai]{#1\comp\in#2}{##1\comp,##2} + \symdef{Int}{\comp{\mathbb Z}} + \symdef{PosInt}{\comp{{\mathbb Z}^+}} + \symdef{inttimes}[args=2]{#1 #2} + \symdef{divides}[args=2]{#1\comp\|#2} + + \vardef{vara}{\comp a} + \vardef{varb}{\comp b} + \vardef{varc}{\comp c} + + \def\contradiction{} \begin{latexcode} -\begin{sproof}[id=simple-proof] + \begin{sassertion}[type=theorem,name=sqrt2irr] + \conclusion{\irrational{$\arg{\realroot{2}}$ is \comp{irrational}}}. +\end{sassertion} + +\begin{sproof}[for=sqrt2irr,method=contradiction]{By contradiction} + \assumption{Assume \yield{\rational{$\arg{\realroot{2}}$ is + \comp{rational}}}} + \begin{subproof}[method=straightforward]{Then + \yield{$\eq{\ratfrac{\intpow{\vara}{2}}{\intpow{\varb}2}}{2}$ + for some $\inset{\vara,\varb}\PosInt$ with + \coprime{$\arg{\vara},\arg{\varb}$ \comp{coprime}}}} + \assumption{By assumption, \yield{there are + $\inset{\vara,\varb}\PosInt $ with + $\realroot{2}=\ratfrac{\vara}{\varb}$}} + \spfstep{wlog, we can assume \coprime{$\arg{\vara},\arg{\varb}$ + to be \comp{coprime}}} + % a comment: + If not, reduce the fraction until numerator and denominator + are coprime, and let the resulting components be + $\vara $ and $\varb $ + \spfstep{Then \yield{$\eq{\intpow{\ratfrac{\vara}{\varb}}2}2$}} + \eqstep{\ratfrac{\intpow{\vara}2}{\intpow{\varb}2}} + \end{subproof} + \begin{subproof}[term=\divides{2}{\vara},method=straightforward]{ + Then $\vara $ is even} + \spfstep{Multiplying the equation by $\intpow{\varb}2$ yields + $\yield{\eq{\intpow{\vara}2}{\inttimes{2}{\intpow{\varb}2}}}$} + \spfstep[term=\divides{2}{\intpow{\vara}2}]{Hence + $\intpow{\vara}2$ is even} + \conclude[term=\divides{2}{\vara}]{Hence $\vara $ is even as well} + % another comment: + Hint: Think about the prime factorizations of $\vara $ and + $\intpow{\vara}2$ + \end{subproof} + \begin{subproof}[term=\divides{2}{\varb},method=straightforward,]{ + Then $\varb $ is also even} + \spfstep{Since $\vara $ is even, we have \yield{some $\varc $ + such that $\eq{\inttimes{2}{\varc}}{\vara}$}} + \spfstep{Plugging into the above, we get + \yield{$\eq{\intpow{\inttimes{2}{\vara}}2} + {\inttimes{2}{\intpow{\varb}2}}$}} + \eqstep{\inttimes{4}{\intpow{\vara}2}} + \spfstep{Dividing both sides by $2$ yields + \yield{$\eq{\intpow{\varb}2}{\inttimes{2}{\intpow{\vara}2}}$}} + \spfstep[term=\divides{2}{\intpow{\varb}2}]{Hence + $\intpow{\varb}2$ is even} + \conclude[term=\divides{2}{\varb}]{Hence $\varb $ is even} + % one more comment: + By the same argument as above + \end{subproof} + \conclude[term=\contradiction]{Contradiction to $\vara,\varb $ being + \symname{coprime}.} +\end{sproof} +\end{latexcode} + +which will produce: + +\begin{mdframed} +\begin{sassertion}[type=theorem,name=sqrt2irr] + \conclusion{\irrational{$\arg{\realroot2}$ is \comp{irrational}}}. +\end{sassertion} + +\begin{sproof}[for=sqrt2irr,method=contradiction]{By contradiction} + \assumption{Assume \yield{\rational{$\arg{\realroot2}$ is \comp{rational}}}} + \begin{subproof}[method=straightforward]% + {Then \yield{$\eq{\ratfrac{\intpow \vara2}{\intpow \varb2}}{2}$ for some $\inset{\vara,\varb}\PosInt$ with \coprime{$\arg \vara,\arg \varb$ \comp{coprime}}}} + \assumption{By assumption, \yield{there are $\inset{\vara,\varb}\PosInt$ with $\realroot2=\ratfrac\vara\varb$}} + \spfstep{wlog, we can assume \coprime{$\arg{\vara},\arg{\varb}$ to be \comp{coprime}}} + If not, reduce the fraction until numerator and denominator are + coprime, and let the resulting components be $\vara$ and $\varb$ + \spfstep{Then \yield{$\eq{\intpow{\ratfrac\vara\varb}2}2$}} + \eqstep{\ratfrac{\intpow\vara2}{\intpow\varb2}} + \end{subproof} + \begin{subproof}[term=\divides{2}{\vara},method=straightforward]{Then $\vara$ is even} + \spfstep{Multiplying the equation by $\intpow\varb2$ yields $\yield{\eq{\intpow\vara2}{\inttimes2{\intpow\varb2}}}$} + \spfstep[term=\divides{2}{\intpow\vara2}]{Hence $\intpow\vara2$ is even} + \conclude[term=\divides{2}{\vara}]{Hence $\vara$ is even as well} + Hint: Think about the prime factorizations of $\vara$ and $\intpow\vara2$ + \end{subproof} + \begin{subproof}[term=\divides{2}{\varb},method=straightforward]{Then $\varb$ is also even} + \spfstep{Since $\vara$ is even, we have \yield{some $\varc$ such that $\eq{\inttimes2\varc}{\vara}$}} + \spfstep{Plugging into the above, we get \yield{$\eq{\intpow{\inttimes2\vara}2}{\inttimes2{\intpow\varb2}}$}} + \eqstep{\inttimes4{\intpow\vara2}} + \spfstep{Dividing both sides by $2$ yields \yield{$\eq{\intpow\varb2}{\inttimes2{\intpow\vara2}}$}} + \spfstep[term=\divides{2}{\intpow\varb2}]{Hence $\intpow\varb2$ is even} + \conclude[term=\divides{2}{\varb}]{Hence $\varb$ is even} + By the same argument as above + \end{subproof} + \conclude[term=\contradiction]{Contradiction to $\vara,\varb$ being \symname{coprime}.} +\end{sproof} +\end{mdframed} + +If we mark all subproofs with |hide|, we will obtain the following +instead: + +\begin{mdframed} + \begin{sassertion}[type=theorem,name=sqrt2irr] + \conclusion{\irrational{$\arg{\realroot2}$ is \comp{irrational}}}. + \end{sassertion} + + \begin{sproof}[for=sqrt2irr,method=contradiction]{By contradiction} + \assumption{Assume \yield{\rational{$\arg{\realroot2}$ is \comp{rational}}}} + \begin{subproof}[hide,method=straightforward]% + {Then \yield{$\eq{\ratfrac{\intpow \vara2}{\intpow \varb2}}{2}$ for some $\inset{\vara,\varb}\PosInt$ with \coprime{$\arg \vara,\arg \varb$ \comp{coprime}}}} + \assumption{By assumption, \yield{there are $\inset{\vara,\varb}\PosInt$ with $\realroot2=\ratfrac\vara\varb$}} + \spfstep{wlog, we can assume \coprime{$\arg{\vara},\arg{\varb}$ to be \comp{coprime}}} + If not, reduce the fraction until numerator and denominator are + coprime, and let the resulting components be $\vara$ and $\varb$ + \spfstep{Then \yield{$\eq{\intpow{\ratfrac\vara\varb}2}2$}} + \eqstep{\ratfrac{\intpow\vara2}{\intpow\varb2}} + \end{subproof} + \begin{subproof}[hide,term=\divides{2}{\vara},method=straightforward]{Then $\vara$ is even} + \spfstep{Multiplying the equation by $\intpow\varb2$ yields $\yield{\eq{\intpow\vara2}{\inttimes2{\intpow\varb2}}}$} + \spfstep[term=\divides{2}{\intpow\vara2}]{Hence $\intpow\vara2$ is even} + \conclude[term=\divides{2}{\vara}]{Hence $\vara$ is even as well} + Hint: Think about the prime factorizations of $\vara$ and $\intpow\vara2$ + \end{subproof} + \begin{subproof}[hide,term=\divides{2}{\varb},method=straightforward,]{Then $\varb$ is also even} + \spfstep{Since $\vara$ is even, we have \yield{some $\varc$ such that $\eq{\inttimes2\varc}{\vara}$}} + \spfstep{Plugging into the above, we get \yield{$\eq{\intpow{\inttimes2\vara}2}{\inttimes2{\intpow\varb2}}$}} + \eqstep{\inttimes4{\intpow\vara2}} + \spfstep{Dividing both sides by $2$ yields \yield{$\eq{\intpow\varb2}{\inttimes2{\intpow\vara2}}$}} + \spfstep[term=\divides{2}{\intpow\varb2}]{Hence $\intpow\varb2$ is even} + \conclude[term=\divides{2}{\varb}]{Hence $\varb$ is even} + By the same argument as above + \end{subproof} + \conclude[term=\contradiction]{Contradiction to $\vara,\varb$ being \symname{coprime}.} + \end{sproof} + \end{mdframed} + + However, the hidden subproofs will still be shown in the HTML, + only in an expandable section which is collapsed by default. + + +The above style of writing proofs is usually called \emph{structured proofs}. +They have a huge advantage over the traditional purely prosaic style, +in that (as the name suggests) the actual \emph{structure} of the proof +is made explicit, which almost always makes it considerably more +comprehensible. We, among many others, encourage the general use of +structured proofs. + +Alas, most proofs are not written in this style, and we would +do users a disservice by insisting on this style. For that reason, +the |spfblock| environment turns all subproofs and proof step +macros into presentationally neutral \emph{inline} annotations, +as in the induction step of the following example: + +\begin{latexcode} +\begin{sproof}[id=simple-proof,method=induction] {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$} - \begin{spfcases}{For the induction we have to consider three cases:} - \begin{spfcase}{$n=1$} - \begin{spfstep}[type=inline] then we compute $1=1^2$\end{spfstep} - \end{spfcase} - \begin{spfcase}{$n=2$} - \begin{spfcomment}[type=inline] + For the induction we have to consider three cases: % <- a comment + \begin{subproof}{$n=1$} + \spfstep*{then we compute $1=1^2$} + \end{subproof} + \begin{subproof}{$n=2$} This case is not really necessary, but we do it for the fun of it (and to get more intuition). - \end{spfcomment} - \begin{spfstep}[type=inline] We compute $1+3=2^{2}=4$.\end{spfstep} - \end{spfcase} - \begin{spfcase}{$n>1$} - \begin{spfstep}[type=assumption,id=ind-hyp] + \spfstep*{We compute $1+3=2^{2}=4$.} + \end{subproof} + \begin{subproof}{$n>1$}\begin{spfblock} + \assumption[id=ind-hyp]{ Now, we assume that the assertion is true for a certain $k\geq 1$, - i.e. $\sum_{i=1}^k{(2i-1)}=k^{2}$. - \end{spfstep} - \begin{spfcomment} + i.e. \yield{$\sum_{i=1}^k{(2i-1)}=k^{2}$}. + } + We have to show that we can derive the assertion for $n=k+1$ from this assumption, i.e. $\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$. - \end{spfcomment} - \begin{spfstep} - We obtain $\sum_{i=1}^{k+1}{2i-1}=\sum_{i=1}^k{2i-1}+2(k+1)-1$ - \spfjust[method=arith:split-sum]{by splitting the sum}. - \end{spfstep} - \begin{spfstep} - Thus we have $\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1$ - \spfjust[method=fertilize]{by inductive hypothesis}. - \end{spfstep} - \begin{spfstep}[type=conclusion] - We can \spfjust[method=simplify]{simplify} the right-hand side to + + \spfstep{ + We obtain $\yield{\sum_{i=1}^{k+1}{2i-1}= + \sum_{i=1}^k{2i-1}+2(k+1)-1}$ + \spfjust{by \splitsum{\comp{splitting the sum} + \arg*{$\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$}}}. + } + \spfstep{ + Thus we have $\yield{\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1}$ + \spfjust{by \symname{induction-hypothesis}}. + } + \conclude{ + We can \spfjust{\simplification{\comp{simplify} the right-hand side + \arg*{k^2+2k+1}}} to ${k+1}^2$, which proves the assertion. - \end{spfstep} - \end{spfcase} - \begin{spfstep}[type=conclusion] + } + \end{spfblock}\end{subproof} + \conclude{ We have considered all the cases, so we have proven the assertion. - \end{spfstep} - \end{spfcases} + } \end{sproof} \end{latexcode} + +\symdecl{splitsum}[args=1] +\symdecl{inducthypothesis}[name=induction-hypothesis] +\symdecl{simplification}[args=1] + This yields the following result: \begin{mdframed} - \begin{sproof}[id=simple-proof] - {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$} - \begin{spfcases}{For the induction we have to consider the following cases:} - \begin{spfcase}{$n=1$} - \begin{spfstep}[type=inline] then we compute $1=1^2$\end{spfstep} - \end{spfcase} - \begin{spfcase}{$n=2$} - \begin{spfcomment}[type=inline] - This case is not really necessary, but we do it for the fun - of it (and to get more intuition). - \end{spfcomment} - \begin{spfstep}[type=inline] - We compute $1+3=2^{2}=4$ - \end{spfstep} - \end{spfcase} - \begin{spfcase}{$n>1$} - \begin{spfstep}[type=hypothesis,id=ind-hyp] - Now, we assume that the assertion is true for a certain $k\geq 1$, i.e. - $\sum_{i=1}^k{(2i-1)}=k^{2}$. - \end{spfstep} - \begin{spfcomment} - We have to show that we can derive the assertion for $n=k+1$ from this - assumption, i.e. $\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$. - \end{spfcomment} - \begin{spfstep}[id=splitit] - We obtain $\sum_{i=1}^{k+1}{(2i-1)}=\sum_{i=1}^k{(2i-1)}+2(k+1)-1$ - \spfjust[method=arith:split-sum]{by splitting the sum}. - \end{spfstep} - \begin{spfstep}[id=byindhyp] - Thus we have $\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1$ - \spfjust[method=fertilize]{by \premise[ind-hyp]{inductive hypothesis}}. - \end{spfstep} - \begin{spfstep}[type=conclusion] - We can \spfjust[method=simplify-eq]{simplify the \justarg[rhs]{right-hand side}} to - $(k+1)^2$, which proves the assertion. - \end{spfstep} - \end{spfcase} - \begin{spfstep}[type=conclusion] - We have considered all the cases, so we have proven the assertion. - \end{spfstep} - \end{spfcases} -\end{sproof} + \begin{sproof}[id=simple-proof,method=induction] + {We prove that $\sum_{i=1}^n{2i-1}=n^{2}$ by induction over $n$} + For the induction we have to consider three cases: % <- a comment + \begin{subproof}{$n=1$} + \spfstep*{then we compute $1=1^2$} + \end{subproof} + \begin{subproof}{$n=2$} + This case is not really necessary, but we do it for the + fun of it (and to get more intuition). + \spfstep*{We compute $1+3=2^{2}=4$.} + \end{subproof} + \begin{subproof}{$n>1$}\begin{spfblock} + \assumption[id=ind-hyp]{ + Now, we assume that the assertion is true for a certain $k\geq 1$, + i.e. \yield{$\sum_{i=1}^k{(2i-1)}=k^{2}$}. + } + + We have to show that we can derive the assertion for $n=k+1$ from + this assumption, i.e. $\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$. + + \spfstep{ + We obtain $\yield{\sum_{i=1}^{k+1}{2i-1}=\sum_{i=1}^k{2i-1}+2(k+1)-1}$ + \spfjust{by \splitsum{\comp{splitting the sum}\arg*{$\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$}}}. + } + \spfstep{ + Thus we have $\yield{\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1}$ + \spfjust{by \symname{induction-hypothesis}}. + } + \conclude{ + We can \spfjust{\simplification{\comp{simplify} the right-hand side + \arg*{k^2+2k+1}}} to + ${k+1}^2$, which proves the assertion. + } + \end{spfblock}\end{subproof} + \conclude{ + We have considered all the cases, so we have proven the assertion. + } + \end{sproof} \end{mdframed} +\end{smodule} + \begin{environment}{sproof} The |sproof| environment is the main container for proofs. It takes an optional |KeyVal| argument that allows to specify the |id| (identifier) and |for| (for which assertion is @@ -114,78 +322,39 @@ This yields the following result: the proof. \end{function} -\begin{environment}{spfstep} - Regular proof steps are marked up with the |step| environment, which takes an optional +\begin{function}{\spfstep} + Regular proof steps are marked up with the |\spfstep| macro, which takes an optional |KeyVal| argument for annotations. A proof step usually contains a local assertion (the text of the step) together with some kind of evidence that this can be derived from already established assertions. -\end{environment} +\end{function} + +\begin{function}{\yield} + See above +\end{function} \begin{function}{\spfjust} This evidence is marked up with the |\spfjust| macro in the \pkg{stex-proofs} package. This environment totally invisible to the formatted result; it wraps the text - in the proof step that corresponds to the evidence. The environment takes an optional - |KeyVal| argument, which can have the |method| key, whose value is the name of a proof - method (this will only need to mean something to the application that consumes the - semantic annotations). Furthermore, the justification can contain ``premises'' - (specifications to assertions that were used justify the step) and ``arguments'' - (other information taken into account by the proof method). + in the proof step that corresponds to the evidence (ideally, a + semantically marked-up term). \end{function} -\begin{function}{\premise} - The |\premise| macro allows to mark up part of the text as reference to an assertion - that is used in the argumentation. In the running example we have used the |\premise| - macro to identify the inductive hypothesis. +\begin{function}{\assumption} + The |\assumption| macro allows to mark up a (justified) assumption. \end{function} \begin{function}{\justarg} - The |\justarg| macro is very similar to |\premise| with the difference that it is used - to mark up arguments to the proof method. Therefore the content of the first argument - is interpreted as a mathematical object rather than as an identifier as in the case of - |\premise|. In our example, we specified that the simplification should take place on - the right hand side of the equation. Other examples include proof methods that - instantiate. Here we would indicate the substituted object in a |\justarg| macro. \end{function} -Note that both |\premise| and |\justarg| can be used with an empty second argument to -mark up premises and arguments that are not explicitly mentioned in the text. - \begin{environment}{subproof} - The |spfcases| environment is used to mark up a subproof. This environment takes an + The |subproof| environment is used to mark up a subproof. This environment takes an optional |KeyVal| argument for semantic annotations and a second argument that allows to specify an introductory comment (just like in the |proof| environment). The |method| key can be used to give the name of the proof method executed to make this subproof. \end{environment} -\begin{environment}{spfcases} - The |spfcases| environment is used to mark up a proof by cases. Technically it is a - variant of the |subproof| where the |method| is |by-cases|. Its contents are |spfcase| - environments that mark up the cases one by one. -\end{environment} - -\begin{environment}{spfcase} - The content of a |spfcases| environment are a sequence of case proofs marked up in the - |spfcase| environment, which takes an optional |KeyVal| argument for semantic - annotations. The second argument is used to specify the the description of the case - under consideration. The content of a |spfcase| environment is the same as that of a - |sproof|, i.e. |spfstep|s, |spfcomment|s, and |spfcases| environments. -\end{environment} - -\begin{function}{\spfcasesketch} - |\spfcasesketch| is a variant of the |spfcase| environment that takes the same - arguments, but instead of the |spfstep|s in the body uses a third argument for a proof - sketch. -\end{function} - -\begin{environment}{spfcomment} - The |spfcomment| environment is much like a |step|, only that it does not have an - object-level assertion of its own. Rather than asserting some fact that is relevant - for the proof, it is used to explain where the proof is going, what we are attempting - to to, or what we have achieved so far. As such, it cannot be the target of a - |\premise|. -\end{environment} - \begin{function}{\sproofend} Traditionally, the end of a mathematical proof is marked with a little box at the end of the last line of the proof (if there is space and on the end of the next line if there @@ -205,10 +374,14 @@ in most cases, this is desirable to make the proof structure explicit, but somet wastes space (especially, if a proof ends in a case analysis which will supply its own proof end marker). To suppress it locally, just set |proofend={}| in them or use use |\sProofEndSymbol{}|. +\end{sfragment} %%% Local Variables: %%% mode: latex %%% TeX-master: "../stex-manual" %%% End: -% LocalWords: hypothesis,id geq splitit arith:split-sum byindhyp rhs proofend +% LocalWords: hypothesis,id geq splitit arith:split-sum byindhyp rhs proofend eqstep +% LocalWords: sproofs coprime ratfrac 2,prec intpow ratpow inttimes varb varc sqrt2irr +% LocalWords: theorem,name sqrt2irr,method wlog hide,method hide,term spfblock splitsum +% LocalWords: simple-proof,method inducthypothesis diff --git a/macros/latex/contrib/stex/doc/packages/stex-references.tex b/macros/latex/contrib/stex/doc/packages/stex-references.tex index 11de003e9b..3850d644ee 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-references.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-references.tex @@ -1,6 +1,90 @@ -\begin{sfragment}[id=sec.references]{Referencing Symbols and Statements} -\textcolor{red}{TODO: references documentation} -\end{sfragment} +If we take features like \stexcode"\inputref" and \stexcode"\mhinput" +(and the \stexcode"sfragment"-environment, see +\sref[file=stex-document-structure]{sec:ds:intro}[in=../stex-manual,title={the \sTeX{}3 manual}]) seriously, +and build large documents modularly from individually compiling documents for sections, chapters +and so on, cross-referencing becomes an interesting problem. + +Say, we have a document |main.tex|, which \stexcode"\inputref"s a section +|section1.tex|, which references a definition with label |some_definition| in +|section2.tex| (subsequently also inputted in |main.tex|). +Then the numbering of the definition will depend on the \emph{document context} +in which the document fragment |section2.tex| occurs - in |section2.tex| itself +(as a standalone document), it might be \emph{Definition 1}, in |main.tex| it might +be \emph{Definition 3.1}, and in |section1.tex|, the definition \emph{does not even occur}, so +it needs to be referenced by some other text. + +What we would want in that instance is an equivalent of \stexcode"\autoref", that takes +the document context into account to yield something like \emph{Definition 1}, \emph{Definition 3.1} +or ``\emph{Definition 1 in the section on Foo}'' respectively. + +The \stexcode"\sref" command attempts to do precisely that. Unlike plain \stexcode"\ref", \stexcode"\autoref" +etc., \stexcode"\sref" refers to not just a \emph{label}, but instead a pair consisting of a \emph{label} +and the \emph{document} in whose context we want to refer to it. Conversely, every \emph{document} +(i.e. standalone compilable |.tex|-file) keeps track of the ``names'' (\emph{Definition 3.1} etc.) for every +label as determined in the context of the document, and stores them in a dedicated file |\jobname.sref|. +Additionally, every document has a ``\emph{reference name}'' (e.g. ``\emph{the section on Foo}''). +This allows us to refer to ``label $x$ in document $D$'' to yield ``\emph{Definition 1 in the section on Foo}''. +And of course, \sTeX can decide based on the current document to either refer to the label by its +``full name'' or directly as e.g. \emph{Definition 3.1} depending on whether the label occurs in +the current document anyway (and link to it accordingly). + +\paragraph{} For that to work, we need to supply (up to) three pieces +of information: +\begin{itemize} + \item The \emph{label} of the reference target (e.g. |some_definition|), + \item (optionally) the \emph{file}/document containing the reference target + (e.g. |section2|). + This is not strictly necessary, but allows for additional disambiguation + between possibly duplicate labels across files, and + \item (optionally) the document context, in which we want to + refer to the reference target (e.g. |main|). +\end{itemize} +Additionally, the document in which we want to reference a label needs +a title for external references. + + +\begin{function}{\sref} + \begin{syntax} \cs{sref}|[archive=|\meta{archive1}|,file=|\meta{file}|]|% + \Arg{label}|[archive=|\meta{archive2}|,in=|\meta{document-context}|,title=|\meta{title}|]| \end{syntax} + This command references \meta{label} (declared in \meta{file} in \meta{archive1}). + If the object (section, figure, etc.) with that label occurs ultimately + in the same document, \cs{sref} will ignore the second set of optional arguments + and simply defer to \cs{autoref} if that command exists, or \cs{ref} if the \pkg{hyperref} + package is not included. + + If the referenced object does \emph{not} occur in the current document however, + \cs{sref} will refer to it by the object's name as it occurs in + the file \meta{document-context} in \meta{archive2}. + +For example, the reference to the \stexcode"sfragment"-environment above +will appear as ``subsection 7.2.1 (Introduction) in the \sTeX{}3 manual'' +if you are reading this in the package documentation for |stex-references| +directly, but as a linked ``subsection 7.2.1'' in the full documentation +or manual. This is achieved using + +\stexcode"\sref[file=stex-document-structure]{sec:ds:intro}[in=../stex-manual,title={the \sTeX{}3 manual}]". + +\end{function} + +For a further example, the following: +\begin{center} + \sref[file=../stex-doc]{part:extends}[in=../stex-doc,title={the full \sTeX{}3 documentation}] +\end{center} +will say ``Part III'' (and link accordingly) in the full documentation, +and ``Part III (Extensions) in the full \sTeX{}3 documentation'' +everywhere else. This is achieved using + +\stexcode"\sref[file=../stex-doc]{part:extends}[in=../stex-doc,title={the full \sTeX{}3 documentation}]". + +\begin{function}{\extref} + \begin{syntax} \cs{sref}|[archive=|\meta{archive1}|,file=|\meta{file}|]|% + \Arg{label}|{archive=|\meta{archive2}|,in=|\meta{document-context}|,title=|\meta{title}|}| \end{syntax} + The \cs{extref}-command behaves exactly like \cs{sref}, but takes + \emph{required} the document context argument and will always use it + for generating the document text, regardless of whether the label + occurs in the current document. +\end{function} + %%% Local Variables: %%% mode: latex diff --git a/macros/latex/contrib/stex/doc/packages/stex-setup.tex b/macros/latex/contrib/stex/doc/packages/stex-setup.tex new file mode 100644 index 0000000000..7e0e1fe4a4 --- /dev/null +++ b/macros/latex/contrib/stex/doc/packages/stex-setup.tex @@ -0,0 +1,34 @@ +\begin{sfragment}{Setting up the \sTeX Package} + + \begin{sfragment}[id=sec.minimal-setup]{Minimal Setup for the \sTeX Package} + In the best of all worlds, there is no setup, as you already have a new version of + {\TeX}Live on your system as a {\LaTeX} enthusiast. If not now is the time to + install it; see \cite{TeXLive:on}. You can usually update {\TeX}Live via a package + manager or the {\TeX}Live manager \textbf{tlmgr}. + \sTeX requires a \TeX{} kernel newer than February 2022. + + Alternatively, you can install \sTeX from CTAN, the Comprehensive {\TeX} Archive + Network; see \cite{stexCTAN:on} for details. We + assume you have the \sTeX package in at least version 3.2 (September 2022). + \end{sfragment} + + \begin{sfragment}[id=sec.git-setup]{GIT-based Setup for the \sTeX Development Version} + If you want use the latest and greatest \sTeX packages + that have not even been released to CTAN, + then you can directly clone them from the \sTeX development + repository \cite{sTeX:github:on} by the following command-line instructions: + \begin{lstlisting}[language=bash] + cd <stexdir> + git clone https://github.com/slatex/sTeX.git + \end{lstlisting} + and keep it updated by pulling updates via \lstinline|git pull| in the cloned \sTeX + directory. + Make sure to either clone the \sTeX repository into a local texmf-tree or to update your \lstinline|TEXINPUTS| environment variable, e.g. by placing the following line in your \lstinline|.bashrc|: + \begin{lstlisting}[language=bash] + export TEXINPUTS="$(TEXINPUTS):<sTeXDIR>//:" + \end{lstlisting} + \end{sfragment} + + \input{packages/stex-mathhubsetup} + +\end{sfragment}
\ No newline at end of file diff --git a/macros/latex/contrib/stex/doc/packages/stex-symbols.tex b/macros/latex/contrib/stex/doc/packages/stex-symbols.tex index e7bafeda6b..67e9a32e70 100644 --- a/macros/latex/contrib/stex/doc/packages/stex-symbols.tex +++ b/macros/latex/contrib/stex/doc/packages/stex-symbols.tex @@ -413,9 +413,9 @@ Note that the precise numbers used for precedences are pretty arbitrary - what m which precedences are higher than which other precedences when used in conjunction. \begin{variable}{\infprec,\neginfprec} It is occasionally useful to have ``infinitely'' high or low precedences to enforce or - forbid automated bracketing entirely -- for those purposes, \stexcode"\infprec" and - \stexcode"\neginfprec" exist (which are implemented as the maximal and minimal integer - values accordingly). + forbid automated bracketing entirely, e.g. for bracket-like notations such as intervals + -- for those purposes, \stexcode"\infprec" and \stexcode"\neginfprec" exist (which are + implemented as the maximal and minimal integer values accordingly).g \end{variable} \begin{dangerbox} @@ -499,7 +499,7 @@ which precedences are higher than which other precedences when used in conjuncti \vardef{varx}[name=x,type=\Nat]{\comp{x}} Given a function $\varf!:\funtype{\Nat}{\Nat}$, -by $\addition{\varf!,\varn}$ we mean the function +by $\addition{\varf!,\varn}$ we mean the function\rustexBREAK $\fun{\varx}{\varf{\addition{\varx,\varn}}}$ } diff --git a/macros/latex/contrib/stex/doc/stex-doc.pdf b/macros/latex/contrib/stex/doc/stex-doc.pdf Binary files differindex 0d0a36720c..e53c98213a 100644 --- a/macros/latex/contrib/stex/doc/stex-doc.pdf +++ b/macros/latex/contrib/stex/doc/stex-doc.pdf diff --git a/macros/latex/contrib/stex/doc/stex-doc.tex b/macros/latex/contrib/stex/doc/stex-doc.tex index 7a98ff49c2..d2ff005554 100644 --- a/macros/latex/contrib/stex/doc/stex-doc.tex +++ b/macros/latex/contrib/stex/doc/stex-doc.tex @@ -1,4 +1,7 @@ -\def\bibfolder#1{../lib/bib/#1} +\def\libfolder#1{../lib/#1} +\newif\ifinidedoc\inidedocfalse +\newif\ifinfulldoc\inidedocfalse + \input{stex-docheader} \infulldoctrue @@ -9,8 +12,6 @@ } \ExplSyntaxOff -\expandafter\newif\csname if@infulldoc\expandafter\endcsname\csname @infulldoctrue\endcsname - \begin{document} \title{ The {\stex{3}} Package Collection @@ -185,7 +186,7 @@ \OmitDocInput{../source/stex/stex-others.dtx} \DocInput{../source/stex/stex-metatheory.dtx} -\part{Extensions}\label{part:extensions} +\part{Extensions}\label{part:extensions}\slabel{part:extends} \DocInput{../source/extensions/tikzinput.dtx} \DocInput{../source/extensions/document-structure.dtx} diff --git a/macros/latex/contrib/stex/doc/stex-docheader.tex b/macros/latex/contrib/stex/doc/stex-docheader.tex index d16b19703b..c6bea9b3da 100644 --- a/macros/latex/contrib/stex/doc/stex-docheader.tex +++ b/macros/latex/contrib/stex/doc/stex-docheader.tex @@ -1,4 +1,5 @@ \RequirePackage{paralist} +\ifcsname libfolder\endcsname\else\def\libfolder#1{../lib/#1}\fi \documentclass[full,kernel]{l3doc} \usepackage[dvipsnames]{xcolor} \usepackage[utf8]{inputenc} @@ -7,15 +8,14 @@ \RequirePackage{tikzinput} \usetikzlibrary{fit} -% \usepackage[debug=all,lang=en, mathhub=./tests]{stex} -\usepackage[lang=en, mathhub=./tests]{stex} -\usepackage{url,array,float,textcomp} +\usepackage[lang=en, mathhub=./tests,debug=sref]{stex} +\usepackage{url,array,float} \usepackage[show]{ed} \usepackage[hyperref=auto,style=alphabetic]{biblatex} -\addbibresource{\bibfolder{kwarcpubs.bib}} -\addbibresource{\bibfolder{extpubs.bib}} -\addbibresource{\bibfolder{kwarccrossrefs.bib}} -\addbibresource{\bibfolder{extcrossrefs.bib}} +\addbibresource{\libfolder{bib/kwarcpubs.bib}} +\addbibresource{\libfolder{bib/extpubs.bib}} +\addbibresource{\libfolder{bib/kwarccrossrefs.bib}} +\addbibresource{\libfolder{bib/extcrossrefs.bib}} \usepackage{amssymb} \usepackage{amsfonts} \usepackage{xspace} @@ -50,7 +50,9 @@ \\symbolname,\\binarysymbol,\\newbinarysymbol,\\addition, \\summation,\\ascendingchain,\\quantforall,\\set,\\funtype, \\Nat,\\successor,\\multiplication,\\Int,\\zero,\\uminus, - \\intmonoid + \\intmonoid,\\divides,\\intpow,\\ratfrac,\\ratpow,\\inttimes, + \\inset,\\eq,\\rational,\\irrational,\\coprime,\\PosInt, + \\realroot }, classoffset=2,keywordstyle=\color{blue},morekeywords={ \\symdecl,\\symdef,\\notation,\\vardef,\\varseq,\\instantiate, @@ -64,11 +66,11 @@ classoffset=4,keywordstyle=\color{Purple},morekeywords={ \\definiendum,\\definame,\\symref,\\symname,\\comp, \\compemph,\\definiens,\\svar,\\infprec,\\neginfprec,\\ellipses, - \\Symname,\\arg + \\Symname,\\arg,\\yield,\\assumption,\\spfstep,\\eqstep,\\conclude }, classoffset=5,keywordstyle=\color{magenta},morekeywords={ smodule,sdefinition,sassertion,sparagraph,sexample, - sproof,subproof,spfcases,spfcase,spfstep,spfcomment, + sproof,subproof,spfcases,spfcase,spfstep,spfcomment,spfblock, \\spfidea,\\spfsketch,\\spfcasesketch,\\sproofend, \\spfjust,\\premise,\\justarg, copymodule,interpretmodule,mathstructure,sexample @@ -88,57 +90,12 @@ }, classoffset=8,keywordstyle=\color{red},morekeywords={ frame,note + }, + classoffset=9,keywordstyle=\color{gray},morekeywords={ + \\vara,\\varb,\\varc } } -%\lstdefinestyle{mylatex}{ -% keywordstyle=\color{BurntOrange} -%} -%\lstdefinelanguage{mylatex}{ -% emphstyle=\underbar, -% alsodigit={:}, -% %alsoletter={_}, -% alsoletter={\\} -% sensitive=true, -% classoffset=0,keywordstyle=\bfseries, -% morekeywords={\\begin,\\end,\\ExplSyntaxOn,\\ExplSyntaxOff}, -% classoffset=1,keywordstyle=\color{blue}, -% morekeywords={ -% \\symdecl, -% \\symdef, -% \\notation, -% \\abbrdef, -% \\importmodule, -% \\usemodule, -% \\STEXwithbrackets, -% \\symref -% }, -% classoffset=2,keywordstyle=\color{Purple}, -% morekeywords={ -% \\stex_path_from_string:Nn, -% \\stex_path_to_string:NN, -% \\stex_path_to_string:N, -% \\stex_require_repository:n, -% \\stex_modules_current_namespace:, -% \\stex_debug:n, -% \\stex_set_current_repository:n, -% \\stex_file_in_smsmode:nn, -% \\stex_get_symbol:n, -% }, -% classoffset=3,keywordstyle=\color{SkyBlue}, -% morekeywords={ -% \\l_stex_module_ns_str, -% \\g_stex_currentfile_seq, -% \\l_stex_current_module_prop, -% \\l_stex_get_symbol_uri_str, -% } -% classoffset=0, -%%^^A morecomment=[l][\color{Gray}]{//}, -%%^^A morecomment=[s][\color{Gray}]{/*}{*/}, -% morecomment=[s][\color{Green}]{$}{$},, -% morecomment=[s][\color{OliveGreen}]{\\[}{\\]}, -%^^A morestring=[b][\color{Purple}]\$, -%} \lstnewenvironment{latexcode}[1][]{\lstset{language=sTeX,#1}}{} \def\stexcode{\lstinline[language=sTeX]} @@ -183,28 +140,6 @@ outer arc=4pt } - -%\newtcolorbox{exampleborderbox}{ -% enhanced, -% left=0pt, -% title={Example \the\example@counter}, -% right=0pt, -% top=8pt, -% bottom=8pt, -% colback=white, -% colframe=blue, -% width=\textwidth, -% enlarge left by=0mm, -% boxsep=5pt, -% fontupper=\small, -% arc=4pt, -% outer arc=4pt, -% leftupper=1.5cm, -% fonttitle=\bfseries, -% coltitle=blue, -% boxed title style={empty,size=minimal,toprule=0pt,top=1pt,left=3mm,overlay={}}, -%} - \newenvironment{example@border} { \global\advance\example@counter by 1 @@ -262,7 +197,7 @@ Output: \begin{stextest@output} - \input{stextest.tex} + \csname @ @ input\endcsname{stextest.tex} \end{stextest@output} \end{example@border} } @@ -371,7 +306,7 @@ \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} \def\cT{\mathcal{T}}\def\cD{\mathcal{D}} -\def\fileversion{3.1} +\def\fileversion{3.2} \def\filedate{\today} \RequirePackage{pdfcomment} @@ -446,4 +381,4 @@ \end{mdframed}\end{remarkbox}\endlist } -\usepackage{rustex} +\usepackage{rustex}
\ No newline at end of file diff --git a/macros/latex/contrib/stex/doc/stex-ide.pdf b/macros/latex/contrib/stex/doc/stex-ide.pdf Binary files differnew file mode 100644 index 0000000000..a04d7ddd60 --- /dev/null +++ b/macros/latex/contrib/stex/doc/stex-ide.pdf diff --git a/macros/latex/contrib/stex/doc/stex-ide.tex b/macros/latex/contrib/stex/doc/stex-ide.tex new file mode 100644 index 0000000000..a563d277fb --- /dev/null +++ b/macros/latex/contrib/stex/doc/stex-ide.tex @@ -0,0 +1,155 @@ +\ifcsname ifinfulldoc\endcsname\else + \expandafter\newif\csname ifinfulldoc\endcsname\infulldocfalse +\fi +\ifcsname ifinidedoc\endcsname\else + \expandafter\newif\csname ifinidedoc\endcsname\inidedoctrue +\fi + +\ifinidedoc +\input{stex-docheader} + + +\begin{document} + + \title{ + The {\stex} VSCode IDE + \thanks{Version {\fileversion} (last revised {\filedate})} + } + \author{Michael Kohlhase, Dennis Müller\\ + FAU Erlangen-Nürnberg\\ + \url{http://kwarc.info/} + } + \pagenumbering{roman} + \maketitle + + This is the user manual for the \sTeX Plugin for VSCode, available at + \url{https://marketplace.visualstudio.com/items?itemName=kwarc.stexide}. + For the manual for the \sTeX package itself, see \href{\basedocurl/stex-manual.pdf}{the \sTeX{}3 Manual}. + + \makeatletter + \renewcommand\part{% + \clearpage + \thispagestyle{plain}% + \@tempswafalse + \null\vfil + \secdef\@part\@spart% + } + \newcounter{chapter} + \numberwithin{section}{chapter} + \renewcommand\thechapter{\@arabic\c@chapter} + \renewcommand\thesection{\thechapter.\@arabic\c@section} + \newcommand*\chaptermark[1]{} + \setcounter{secnumdepth}{2} + \newcommand\@chapapp{\chaptername} + %\newcommand\chaptername{Chapter} + \def\ps@headings{% + \let\@oddfoot\@empty + \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markright{\MakeUppercase{% + \ifnum \c@secnumdepth >\m@ne + \@chapapp\ \thechapter. \ % + \fi + ##1}}% + }% + } + \newcommand\chapter{\clearpage + \thispagestyle{plain}% + \global\@topnum\z@ + \@afterindentfalse + \secdef\@chapter\@schapter% + } + \def\@chapter[#1]#2{\refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}#1}% + \chaptermark{#1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \@makechapterhead{#2}% + \@afterheading% + } + \def\@makechapterhead#1{% + \vspace*{50\p@}% + {\parindent \z@ \raggedright \normalfont + \huge\bfseries \@chapapp\space \thechapter + \par\nobreak + \vskip 20\p@ + \interlinepenalty\@M + \Huge \bfseries #1\par\nobreak + \vskip 40\p@ + }% + } +\newcommand*\l@chapter[2]{% + \ifnum \c@tocdepth >\m@ne + \addpenalty{-\@highpenalty}% + \vskip 1.0em \@plus\p@ + \setlength\@tempdima{1.5em}% + \begingroup + \parindent \z@ \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + \leavevmode \bfseries + \advance\leftskip\@tempdima + \hskip -\leftskip + #1\nobreak\hfil + \nobreak\hb@xt@\@pnumwidth{\hss #2% + \kern-\p@\kern\p@}\par + \penalty\@highpenalty + \endgroup + \fi} +\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.8em}} +\renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}} +\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}} +\def\partname{Part} +\def\toclevel@part{-1} +\def\maketitle{\chapter{\@title}} +\let\thanks\@gobble +\let\DelayPrintIndex\PrintIndex +\let\PrintIndex\@empty +\providecommand*{\hexnum}[1]{\text{\texttt{\char`\"}#1}} +\makeatother + +\ExplSyntaxOn +\int_set:Nn \l_document_structure_section_level_int {1} +\ExplSyntaxOff + +\clearpage + +{% + \def\\{:}% fix "newlines" in the ToC + \tableofcontents +} + +\clearpage +\pagenumbering{arabic} + +\long\def\ignore#1{} + +\input{packages/stex-setup} +\input{packages/stex-idesetup} + +\fi + + + + +\ifinidedoc +\newpage +\printbibliography +\end{document} +\fi + + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: + +% LocalWords: stex-docheader infulldoctrue l@subsubsection toclevel@part ExplSyntaxOff +% LocalWords: l_document_structure_section_level_int dangerbox mmtbox omdoc OBJref lmh +% LocalWords: own:fifom MueRabRot:rslffml20 sec.stexarchives stex-mathhub ngerman a,b +% LocalWords: Metatheory sec.customhighlight sproof stexthm xspace stexpatchmodule +% LocalWords: stexpatchexample stexpatchparagraph sexampleid amsthm sassertiontitle +% LocalWords: sdefinitiontitle compemph varemph srefsymuri stex-hwexam TeXLive:on tlmgr +% LocalWords: stexls:on,stexls-vscode-plugin:on diff --git a/macros/latex/contrib/stex/doc/stex-manual.pdf b/macros/latex/contrib/stex/doc/stex-manual.pdf Binary files differindex 32c1e047ca..2facc41ad1 100644 --- a/macros/latex/contrib/stex/doc/stex-manual.pdf +++ b/macros/latex/contrib/stex/doc/stex-manual.pdf diff --git a/macros/latex/contrib/stex/doc/stex-manual.tex b/macros/latex/contrib/stex/doc/stex-manual.tex index 31b9c4eaeb..547e238f54 100644 --- a/macros/latex/contrib/stex/doc/stex-manual.tex +++ b/macros/latex/contrib/stex/doc/stex-manual.tex @@ -1,19 +1,15 @@ -\makeatletter -\ifcsname if@infulldoc\endcsname\else - \expandafter\newif\csname if@infulldoc\endcsname\@infulldocfalse -\fi -\makeatother - -\csname if@infulldoc\endcsname\else - -\def\bibfolder#1{../lib/bib/#1} -\input{stex-docheader} +\ifcsname ifinfulldoc\endcsname\else + \expandafter\newif\csname ifinfulldoc\endcsname\infulldocfalse +\fi +\ifcsname ifinidedoc\endcsname\else + \expandafter\newif\csname ifinidedoc\endcsname\inidedocfalse +\fi -\infulldoctrue +\ifinfulldoc\else + \input{stex-docheader} \begin{document} - \csname if@infulldoc\endcsname\else \title{ The {\stex{3}} Manual \thanks{Version {\fileversion} (last revised {\filedate})} @@ -192,82 +188,55 @@ provided by several pieces of software: \end{itemize} \end{sfragment} - -\begin{sfragment}{Quickstart} - \begin{sfragment}{Setup} - There are two ways of using \sTeX: as a - \begin{enumerate} - \item way of writing {\LaTeX} more modularly (object-oriented Math) for creating PDF - documents or - \item foundation for authoring active documents in HTML5 instrumented with knowledge - management services. - \end{enumerate} - Both are legitimate and useful. The first requires a significantly smaller - tool-chain, so we describe it first. The second requires a much more substantial - (and experimental) toolchain of knowledge management systems. Both workflows profit - from an integrated development environment (IDE), which (also) automates setup as - far as possible (see \sref{sec.sTeX-IDE}). - - \begin{sfragment}[id=sec.minimal-setup]{Minimal Setup for the PDF-only Workflow} - In the best of all worlds, there is no setup, as you already have a new version of - {\TeX}Live on your system as a {\LaTeX} enthusiast. If not now is the time to - install it; see \cite{TeXLive:on}. You can usually update {\TeX}Live via a package - manager or the {\TeX}Live manager \textbf{tlmgr}. - - Alternatively, you can install \sTeX from CTAN, the Comprehensive {\TeX} Archive - Network; see \cite{stexCTAN:on} for details. - \end{sfragment} - - \begin{sfragment}[id=sec.git-setup]{GIT-based Setup for the \sTeX Development Version} - If you want use the latest and greatest \sTeX packages - that have not even been released to CTAN, - then you can directly clone them from the \sTeX development - repository \cite{sTeX:github:on} by the following command-line instructions: -\begin{lstlisting}[language=bash] - cd <stexdir> - git clone https://github.com/slatex/sTeX.git -\end{lstlisting} - and keep it updated by pulling updates via \lstinline|git pull| in the cloned \sTeX - directory. - Then update your \lstinline|TEXINPUTS| environment variable, e.g. by placing the following line in your \lstinline|.bashrc|: -\begin{lstlisting}[language=bash] -export TEXINPUTS="$(TEXINPUTS):<sTeXDIR>//:" -\end{lstlisting} - \end{sfragment} - - \begin{sfragment}[id=sec.stex-archives]{\sTeX Archives (Manual Setup)} - Writing semantically annotated \sTeX becomes much easier, if we can use - well-designed libraries of already annotated content. \sTeX provides such - libraries as \sTeX archives -- i.e. GIT repositories at - \url{https://gl.mathhub.info} -- most prominently the SMGLoM libraries at - \url{https://gl.mathhub.info/smglom}. - - To do so, we set up a \textbf{local MathHub} by creating a MathHub directory - \lstinline|<mhdir>|. Every \sTeX archive as an \textbf{archive path} - \lstinline|<apath>| and a name \lstinline|<archive>|. We can clone the \sTeX - archive by the following command-line instructions: +\begin{sfragment}{Setup} + There are two ways of using \sTeX: as a + \begin{enumerate} + \item way of writing {\LaTeX} more modularly (object-oriented Math) for creating PDF + documents or + \item foundation for authoring active documents in HTML5 instrumented with knowledge + management services. + \end{enumerate} + Both are legitimate and useful. The first requires a significantly smaller + tool-chain, so we describe it first. The second requires a much more substantial + toolchain of knowledge management systems. + + Luckily, the \sTeX-IDE will take care of much of the setup required + for the full toolchain, if you are willing to use it. + + \input{packages/stex-setup} + + \input{packages/stex-idesetup} + + \begin{sfragment}{Manual Setup} + + In lieu of using the \sTeX IDE, we can do the following: + + \begin{sfragment}[id=sec.stex-archives]{\sTeX Archives (Manual Setup)} + Writing semantically annotated \sTeX becomes much easier, if we can use + well-designed libraries of already annotated content. \sTeX provides such + libraries as \sTeX archives -- i.e. GIT repositories at + \url{https://gl.mathhub.info} -- most prominently the SMGLoM libraries at + \url{https://gl.mathhub.info/smglom}. + + To do so, we set up a \textbf{local MathHub} by creating a MathHub directory + \lstinline|<mhdir>|. Every \sTeX archive as an \textbf{archive path} + \lstinline|<apath>| and a name \lstinline|<archive>|. We can clone the \sTeX + archive by the following command-line instructions: \begin{lstlisting}[language=bash] - cd <mhdir>/<apath> - git clone https://gl.mathhub.info/smglom/<archive>.git +cd <mhdir>/<apath> +git clone https://gl.mathhub.info/smglom/<archive>.git \end{lstlisting} - Note that \sTeX archives often depend on other archives, thus you should be - prepared to clone these as well -- e.g. if \texttt{pdflatex} reports missing - files. - To make sure that \sTeX too knows where to find its archives, we need to set a global - system variable |MATHHUB|, that points to your local |MathHub|-directory (see - \sref{sec.stexarchives}). + Note that \sTeX archives often depend on other archives, thus you should be + prepared to clone these as well -- e.g. if \texttt{pdflatex} reports missing + files. + To make sure that \sTeX too knows where to find its archives, we need to set a global + system variable |MATHHUB|, that points to your local |MathHub|-directory (see + \sref{sec.stexarchives}). \begin{lstlisting}[language=bash] -export MATHHUB="<mhdir>'' +export MATHHUB="<mhdir>" \end{lstlisting} - \end{sfragment} - - \begin{sfragment}[id=sec.sTeX-IDE]{The \sTeX IDE} - We are currently working on an \sTeX IDE as an \sTeX plugin for |VScode|; - see~\cite{sTeX-IDE:on}. It will feature a setup procedure that automates the setup - described above (and below). For additional functionality see the (now obsolete) - plugin for \sTeX1 \cite{stexls:on,stexls-vscode-plugin:on}. - \end{sfragment} + \end{sfragment} \begin{sfragment}{Manual Setup for Active Documents and Knowledge Management Services} Foregoing on the \sTeX IDE, we will need several additional (on top of the minimal @@ -301,11 +270,15 @@ export MATHHUB="<mhdir>'' \end{itemize} \end{sfragment} \end{sfragment} +\end{sfragment} - \input{stex-tutorial} - +\begin{sfragment}[id=sec.sTeX-IDE]{The \sTeX IDE} + \input{stex-ide} \end{sfragment} +\input{stex-tutorial} + + \begin{sfragment}{Creating \sTeX Content} \input{packages/stex-basics} @@ -453,7 +426,6 @@ export MATHHUB="<mhdir>'' \begin{sfragment}{\sTeX Statements} \input{packages/stex-statements} \input{packages/stex-proofs} -\end{sfragment} \begin{sfragment}[id=sec.customhighlight]{Highlighting and Presentation Customizations} @@ -538,7 +510,7 @@ export MATHHUB="<mhdir>'' \begin{latexcode} \protected\def\symrefemph@uri#1#2{ \pdftooltip{ - \srefsymuri{#2}{\symrefemph{#1}} + \symrefemph{#1} }{ URI:~\detokenize{#2} } @@ -548,6 +520,10 @@ export MATHHUB="<mhdir>'' other three commands). \end{function} \end{sfragment} +\end{sfragment} +\begin{sfragment}[id=sec.references]{Cross References} + \input{packages/stex-references} +\end{sfragment} \begin{sfragment}{Additional Packages} \begin{sfragment}{Tikzinput: Treating TIKZ code as images} @@ -557,7 +533,7 @@ export MATHHUB="<mhdir>'' \input{packages/stex-document-structure} \end{sfragment} \begin{sfragment}{Slides and Course Notes} - \input{packages/stex-slides} + \input{packages/stex-notesslides} \end{sfragment} \begin{sfragment}{Representing Problems and Solutions} \input{packages/stex-problem} @@ -567,7 +543,7 @@ export MATHHUB="<mhdir>'' \end{sfragment} \end{sfragment} -\csname if@infulldoc\endcsname\else +\ifinfulldoc\else \newpage \printbibliography \end{document} diff --git a/macros/latex/contrib/stex/doc/stex-tutorial.tex b/macros/latex/contrib/stex/doc/stex-tutorial.tex index dcd4c442e0..7b3b723826 100644 --- a/macros/latex/contrib/stex/doc/stex-tutorial.tex +++ b/macros/latex/contrib/stex/doc/stex-tutorial.tex @@ -21,7 +21,7 @@ \symdef{geometricSeries}[name=geometric-series]{\comp{S}} \begin{sdefinition}[for=geometricSeries] - The \definame{geometricSeries} is the \symname{?series} + The \definame{geometricSeries} is the \symname{series} \[\defeq{\geometricSeries}{\definiens{ \infinitesum{\svar{n}}{1}{ \realdivide[frac]{1}{ 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 diff --git a/macros/latex/contrib/stex/tex/etc/beamernotesthemesTeX.sty b/macros/latex/contrib/stex/tex/etc/beamernotesthemesTeX.sty deleted file mode 100644 index af1c0c2a4c..0000000000 --- a/macros/latex/contrib/stex/tex/etc/beamernotesthemesTeX.sty +++ /dev/null @@ -1,14 +0,0 @@ -% Beamer sTeX notes theme; -% Copyright (c) 2022 Michael Kohlhase <michael.kohlhase@fau.de>. -\ProvidesPackage{beamernotestheme-sTeX} -\typeout{Beamer sTeX notes theme} -\setbeamertemplate{theorem begin} -{% - \inserttheoremheadfont - \inserttheoremname - \inserttheoremnumber - \ifx \inserttheoremaddition \empty \else\ (\inserttheoremaddition)\fi - \inserttheorempunctuation\xspace - \inserttheorembodyfont -} -\setbeamertemplate{theorem end}{} diff --git a/macros/latex/contrib/stex/tex/etc/beamerthemesTeX.sty b/macros/latex/contrib/stex/tex/etc/beamerthemesTeX.sty index d7b861086a..85fd253eeb 100644 --- a/macros/latex/contrib/stex/tex/etc/beamerthemesTeX.sty +++ b/macros/latex/contrib/stex/tex/etc/beamerthemesTeX.sty @@ -1,25 +1,58 @@ % Beamer sTeX slide theme; % Copyright (c) 20 Michael Kohlhase <michael.kohlhase@fau.de>. -\ProvidesPackage{beamertheme-sTeX} +\ProvidesPackage{beamerthemesTeX} \typeout{Beamer sTeX theme} \RequirePackage{xspace} +\RequirePackage{xcolor} +\RequirePackage{stex} -% General appearance of theorems, like "ams style", but without the block env. -\setbeamertemplate{theorem begin} -{% - \inserttheoremheadfont - \inserttheoremname - \inserttheoremnumber - \ifx \inserttheoremaddition \empty \else\ (\inserttheoremaddition)\fi - \inserttheorempunctuation\xspace - \inserttheorembodyfont +\ExplSyntaxOn +\protected\def\stexbeamerthm#1#2#3#4#5#6#7#8{ + \newcounter{#1} + \tl_if_empty:nF{#4}{ + \tl_set:cn{the#1}{ + \use:c{the#4}.\arabic{#1} + } + } + \tl_set:cn{#1autorefname}{#6} + + \newenvironment{#1}{ + \ifhmode\par\fi + + \tl_if_empty:nF{#5}{ + \setcounter{#1}{\value{#5}} + \stepcounter{#5} + } + \refstepcounter{#1} + \noindent#7{ + #6~\use:c{the#1} + \tl_if_empty:cF{s#2title}{ + {}~(\csname s#2title\endcsname) + }. + } + #8 + }{\par} + \csname stexpatch#2\endcsname[#3]{\begin{#1}}{\end{#1}} } -\setbeamertemplate{theorem end}{} +\ExplSyntaxOff + +\stexbeamerthm{theorem}{assertion}{theorem}{section}{}{Theorem}\textbf\itshape +\stexbeamerthm{observation}{assertion}{observation}{section}{theorem}{Observation}\textbf\itshape +\stexbeamerthm{corollary}{assertion}{corollary}{section}{theorem}{Corollary}\textbf\itshape +\stexbeamerthm{lemma}{assertion}{lemma}{section}{theorem}{Lemma}\textbf\itshape +\stexbeamerthm{axiom}{assertion}{axiom}{section}{theorem}{Axiom}\textbf\itshape +\stexbeamerthm{remark}{assertion}{remark}{section}{theorem}{Remark}\emph{} +\stexpatchparagraph[remark]{\begin{remark}}{\end{remark}} +\stexbeamerthm{example}{example}{}{section}{theorem}{Example}\textbf{} +\stexbeamerthm{definition}{definition}{}{section}{theorem}{Definition}\textbf{} + % THEME \mode <presentation> +\sffamily + \ifcsname slidelogo\endcsname\else \newsavebox\slidelogo \sbox\slidelogo{\sTeX} @@ -64,3 +97,42 @@ \setlength\leftmarginii{1em} \setlength\leftmarginiii{1em} \providecommand{\vstretch}[1]{\vspace*{\stretch{#1}}} + +%% set the colors for sTeX content highlighting + +\def\compemph#1{\ifcsname textcolor\endcsname\textcolor{SteelBlue}{#1}\else#1\fi} +\def\symrefemph#1{\ifcsname textcolor\endcsname\textcolor{SteelBlue}{#1}\else#1\fi} +\def\defemph#1{\ifcsname textcolor\endcsname\textcolor{magenta}{#1}\else\textbf{#1}\fi} +\def\varemph#1{\ifcsname textcolor\endcsname\textcolor{gray}{#1}\else#1\fi} +\def\titleemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{#1}\else\textbf{#1}\fi} + +%% set PDF tooltips +\RequirePackage{pdfcomment} +\protected\def\compemph@uri#1#2{% + \pdftooltip{% + \srefsymuri{#2}{\compemph{#1}}% + }{% + URI:~\detokenize{#2}% + }% +} +\protected\def\symrefemph@uri#1#2{% + \pdftooltip{% + \srefsymuri{#2}{\symrefemph{#1}}% + }{% + URI:~\detokenize{#2}% + }% +} +\protected\def\defemph@uri#1#2{% + \pdftooltip{% + \defemph{#1}% + }{% + URI:~\detokenize{#2}% + }% +} +\protected\def\varemph@uri#1#2{% + \pdftooltip{% + \varemph{#1}% + }{% + Variable~\detokenize{#2}% + }% +}
\ No newline at end of file diff --git a/macros/latex/contrib/stex/tex/etc/stex-backend-pdflatex.cfg b/macros/latex/contrib/stex/tex/etc/stex-backend-pdflatex.cfg index bdd2810d09..484f930db6 100644 --- a/macros/latex/contrib/stex/tex/etc/stex-backend-pdflatex.cfg +++ b/macros/latex/contrib/stex/tex/etc/stex-backend-pdflatex.cfg @@ -1,6 +1,8 @@ \tl_const:Nx \c_stex_html_emptyarg_tl {~} \cs_new_protected:Nn \stex_annotate:nnn {#3} +\cs_new_protected:Nn \stex_mathml_intent:nn { #2 } +\cs_new_protected:Nn \stex_mathml_arg:nn { #2 } \cs_new_protected:Nn \stex_annotate_invisible:n {} \cs_new_protected:Nn \stex_annotate_invisible:nnn {} \NewDocumentEnvironment{stex_annotate_env} { m m } {}{} diff --git a/macros/latex/contrib/stex/tex/etc/stex-backend-rustex.cfg b/macros/latex/contrib/stex/tex/etc/stex-backend-rustex.cfg index 3f48631e40..c9ad36613b 100644 --- a/macros/latex/contrib/stex/tex/etc/stex-backend-rustex.cfg +++ b/macros/latex/contrib/stex/tex/etc/stex-backend-rustex.cfg @@ -20,6 +20,16 @@ } } } +\cs_new_protected:Nn \stex_mathml_intent:nn { + \rustex_annotate_HTML:nn { + mml:intent="#1" + }{ #2 } +} +\cs_new_protected:Nn \stex_mathml_arg:nn { + \rustex_annotate_HTML:nn { + mml:arg="#1" + }{ #2 } +} \cs_new_protected:Nn \stex_annotate_invisible:n { \_stex_html_checkempty:n { #1 } diff --git a/macros/latex/contrib/stex/tex/etc/stex-backend-tex4ht.cfg b/macros/latex/contrib/stex/tex/etc/stex-backend-tex4ht.cfg new file mode 100644 index 0000000000..b4c39b50b7 --- /dev/null +++ b/macros/latex/contrib/stex/tex/etc/stex-backend-tex4ht.cfg @@ -0,0 +1,13 @@ +% TODO +\tl_const:Nx \c_stex_html_emptyarg_tl {~} + +\cs_new_protected:Nn \stex_annotate:nnn {#3} % TODO +\cs_new_protected:Nn \stex_mathml_intent:nn { #2 } % TODO +\cs_new_protected:Nn \stex_mathml_arg:nn { #2 } % TODO +\cs_new_protected:Nn \stex_annotate_invisible:n {} % TODO +\cs_new_protected:Nn \stex_annotate_invisible:nnn {} % TODO +\NewDocumentEnvironment{stex_annotate_env} { m m } {}{} % TODO + +\prg_new_conditional:Nnn \stex_html_backend: {p, T, F, TF} { + \prg_return_true: +}
\ No newline at end of file diff --git a/macros/latex/contrib/stex/tex/etc/stexthm.sty b/macros/latex/contrib/stex/tex/etc/stexthm.sty index 16931b514a..c81b6358df 100644 --- a/macros/latex/contrib/stex/tex/etc/stexthm.sty +++ b/macros/latex/contrib/stex/tex/etc/stexthm.sty @@ -4,51 +4,53 @@ \RequirePackage{amsthm} \RequirePackage{thmtools} +\ExplSyntaxOn + \declaretheorem[parent=section]{theorem} \stexpatchassertion[theorem] -{\ifx\sassertiontitle\@empty\begin{theorem}\else\begin{theorem}[\sassertiontitle]\fi} +{\ifx\sassertiontitle\@empty\begin{theorem}\else\exp_args:Nno\use:nn{\begin{theorem}[}\sassertiontitle]\fi} {\end{theorem}} \declaretheorem[sibling=theorem]{observation} \stexpatchassertion[observation] -{\ifx\sassertiontitle\@empty\begin{observation}\else\begin{observation}[\sassertiontitle]\fi} +{\ifx\sassertiontitle\@empty\begin{observation}\else\exp_args:Nno\use:nn{\begin{observation}[}\sassertiontitle]\fi} {\end{observation}} \declaretheorem[sibling=theorem]{corollary} \stexpatchassertion[corollary] -{\ifx\sassertiontitle\@empty\begin{corollary}\else\begin{corollary}[\sassertiontitle]\fi} +{\ifx\sassertiontitle\@empty\begin{corollary}\else\exp_args:Nno\use:nn{\begin{corollary}[}\sassertiontitle]\fi} {\end{corollary}} \declaretheorem[sibling=theorem]{lemma} \stexpatchassertion[lemma] -{\ifx\sassertiontitle\@empty\begin{lemma}\else\begin{lemma}[\sassertiontitle]\fi} +{\ifx\sassertiontitle\@empty\begin{lemma}\else\exp_args:Nno\use:nn{\begin{lemma}[}\sassertiontitle]\fi} {\end{lemma}} \declaretheorem[sibling=theorem]{axiom} \stexpatchassertion[axiom] -{\ifx\sassertiontitle\@empty\begin{axiom}\else\begin{axiom}[\sassertiontitle]\fi} +{\ifx\sassertiontitle\@empty\begin{axiom}\else\exp_args:Nno\use:nn{\begin{axiom}[}\sassertiontitle]\fi} {\end{axiom}} \declaretheorem[sibling=theorem,style=remark]{remark} \stexpatchassertion[remark] -{\ifx\sassertiontitle\@empty\begin{remark}\else\begin{remark}[\sassertiontitle]\fi} +{\ifx\sassertiontitle\@empty\begin{remark}\else\exp_args:Nno\use:nn{\begin{remark}[}\sassertiontitle]\fi} {\end{remark}} \stexpatchparagraph[remark] -{\ifx\sparagraphtitle\@empty\begin{remark}\else\begin{remark}[\sparagraphtitle]\fi} +{\ifx\sparagraphtitle\@empty\begin{remark}\else\exp_args:Nno\use:nn{\begin{remark}[}\sparagraphtitle]\fi} {\end{remark}} \declaretheorem[sibling=theorem,style=definition]{example} \stexpatchexample -{\ifx\sexampletitle\@empty\begin{example}\else\begin{example}[\sexampletitle]\fi} +{\ifx\sexampletitle\@empty\begin{example}\else\exp_args:Nno\use:nn{\begin{example}[}\sexampletitle]\fi} {\end{example}} \declaretheorem[sibling=theorem,style=definition]{definition} \stexpatchdefinition -{\ifx\sdefinitiontitle\@empty\begin{definition}\else\begin{definition}[\sdefinitiontitle]\fi} +{\ifx\sdefinitiontitle\@empty\begin{definition}\else\exp_args:Nno\use:nn{\begin{definition}[}\sdefinitiontitle]\fi} {\end{definition}} - -\RequirePackage{pdfcomment} +\ExplSyntaxOff + \RequirePackage{xcolor} \def\compemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{#1}\else#1\fi} @@ -56,31 +58,32 @@ \def\defemph#1{\ifcsname textcolor\endcsname\textcolor{blue}{\textbf{#1}}\else\textbf{#1}\fi} \def\varemph#1{\ifcsname textcolor\endcsname\textcolor{gray}{#1}\else#1\fi} +\RequirePackage{pdfcomment} \protected\def\compemph@uri#1#2{% - \pdftooltip{% - \srefsymuri{#2}{\compemph{#1}}% - }{% - URI:~\detokenize{#2}% - }% + \pdftooltip{% + \srefsymuri{#2}{\compemph{#1}}% + }{% + URI:~\detokenize{#2}% + }% } \protected\def\symrefemph@uri#1#2{% - \pdftooltip{% - \srefsymuri{#2}{\symrefemph{#1}}% - }{% - URI:~\detokenize{#2}% - }% -} + \pdftooltip{% + \srefsymuri{#2}{\symrefemph{#1}}% + }{% + URI:~\detokenize{#2}% + }% + } \protected\def\defemph@uri#1#2{% - \pdftooltip{% - \defemph{#1}% - }{% - URI:~\detokenize{#2}% - }% + \pdftooltip{% + \defemph{#1}% + }{% + URI:~\detokenize{#2}% + }% } \protected\def\varemph@uri#1#2{% - \pdftooltip{% - \varemph{#1}% - }{% - Variable~\detokenize{#2}% - }% -}
\ No newline at end of file + \pdftooltip{% + \varemph{#1}% + }{% + Variable~\detokenize{#2}% + }% +} diff --git a/macros/latex/contrib/stex/tex/ldf/problem-ngerman.ldf b/macros/latex/contrib/stex/tex/ldf/problem-ngerman.ldf index d53bed5591..6cadab0850 100644 --- a/macros/latex/contrib/stex/tex/ldf/problem-ngerman.ldf +++ b/macros/latex/contrib/stex/tex/ldf/problem-ngerman.ldf @@ -14,4 +14,6 @@ \def\prob@note@kw{Bewertung} \def\prob@pt@kw{Pkt} \def\prob@min@kw{Min} +\def\prob@correct@kw{Korrekt} +\def\prob@wrong@kw{Falsch} } |