summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/modules
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-20 22:31:24 +0000
committerKarl Berry <karl@freefriends.org>2019-03-20 22:31:24 +0000
commit2b006ec0e0cafe12255f874f9c44786ab6f38901 (patch)
treec40f5796e1b34e3f051abd84d049e092e4ffd0ab /Master/texmf-dist/source/latex/stex/modules
parent8e508e8b0218f17eb318645073096f2cf645cc78 (diff)
stex (20mar19)
git-svn-id: svn://tug.org/texlive/trunk@50489 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/modules')
-rw-r--r--Master/texmf-dist/source/latex/stex/modules/modules.dtx149
1 files changed, 94 insertions, 55 deletions
diff --git a/Master/texmf-dist/source/latex/stex/modules/modules.dtx b/Master/texmf-dist/source/latex/stex/modules/modules.dtx
index b65107d2aa6..e3f9787873f 100644
--- a/Master/texmf-dist/source/latex/stex/modules/modules.dtx
+++ b/Master/texmf-dist/source/latex/stex/modules/modules.dtx
@@ -10,10 +10,12 @@
%
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-%<package>\ProvidesPackage{modules}[2016/04/07 v1.4 Semantic Markup]
+%<package>\ProvidesPackage{modules}[2019/03/20 v1.4 Semantic Markup]
%
%<*driver>
\documentclass{ltxdoc}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
\usepackage{stex-logo,modules}
\usepackage{url,array,float,textcomp}
\usepackage[show]{ed}
@@ -31,8 +33,11 @@
\floatstyle{boxed}
\newfloat{exfig}{thp}{lop}
\floatname{exfig}{Example}
-\def\tracissue#1{\cite{sTeX:online}, \hyperlink{http://trac.kwarc.info/sTeX/ticket/#1}{issue #1}}
-\begin{document}\DocInput{modules.dtx}\end{document}
+\def\githubissue#1{\cite{sTeX:github:on}, \hyperlink{https://github.com/KWARC/sTeX/issues/#1}{issue #1}}
+\begin{document}
+\RecordChanges
+\DocInput{modules.dtx}
+\end{document}
%</driver>
% \fi
%
@@ -66,6 +71,7 @@
% but can no longer do relative paths.}
% \changes{v1.4}{2015/04/02}{deprecated \texttt {\textbackslash sinput} and \texttt {\textbackslash sinputref}}
% \changes{v1.5}{2015/11/02}{Moved MH Versions to a separate \texttt{mathhub} package}
+% \changes{v1.5}{2018/06/15}{``unidentified cd'' in termref is now an error.}
%
% \GetFileInfo{modules.sty}
%
@@ -85,10 +91,12 @@
% \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}}
% \def\cT{\mathcal{T}}\def\cD{\mathcal{D}}
% \title{{\texttt{modules.sty}}: Semantic Macros and Module Scoping in {\stex}\thanks{Version {\fileversion} (last revised
-% {\filedate})}}
-% \author{Michael Kohlhase \& Deyan Ginev \& Rares Ambrus\\
-% Jacobs University, Bremen\\
-% \url{http://kwarc.info/kohlhase}}
+% {\filedate})}}
+% \author{Michael Kohlhase\\
+% FAU Erlangen-N\"urnberg\\
+% \url{http://kwarc.info/kohlhase}\and
+% Deyan Ginev\\Authorea\and
+% Rares Ambrus\\Jacobs University Bremen}
% \maketitle
%
% \begin{abstract}
@@ -158,7 +166,7 @@
%
% \subsection{Package Options}\label{sec:options}
%
-% The |modules| package takes two options: If we set
+% The |modules| package takes six options: If we set
% \DescribeMacro{showmods}|showmods|\ednote{This mechanism does not work yet, since we
% cannot disable it when importing modules and that leads to unwanted boxes. What we need
% to do instead is to tweak the sms utility to use an internal version that never shows
@@ -171,10 +179,15 @@
% \DescribeMacro{noauxreq}|noauxreq| prohibits the registration of |\@requiremodules|
% commands in the |aux| file. They are necessary for preloading the module signatures so
% that entries in the table of contents can have semantic macros; but as they sometimes
-% cause trouble the option allows to turn off preloading.
+% cause trouble the option allows to turn off preloading.
%
-% If the \DescribeMacro{showmeta}|showmeta| is set, then the metadata keys are shown
+% If the \DescribeMacro{showmeta}|showmeta| optin is set, then the metadata keys are shown
% (see~\cite{Kohlhase:metakeys:ctan} for details and customization options).
+%
+% The \texttt{mh} option enables MathHub support; see~\cite{Kohlhase:mss:ctan}.
+%
+% Finally, if the \DescribeMacro{trwarn}|trwrn| is given, then the |modules| package only
+% gives warnings instead of hard errors when term references are unknown.
%
% \subsection{Semantic Macros}\label{sec:symdef}
%
@@ -320,7 +333,7 @@
% \subsection{Axiomatic Assumptions}\label{sec:user:assumptions}
%
% In many ways, axioms and assumptions in definitions behave a lot like symbols
-% (see~\cite{RabKoh:WSMSML10} for discussion). Therefore we provide the macro
+% (see~\cite{RabKoh:WSMSML13} for discussion). Therefore we provide the macro
% \DescribeMacro{\assdef}|\assdef| that can be used to mark up assumptions. Given a phrase
% \meta{phrase} in a definition\ednote{only definitions?}, we can use
% |\assdef{|\meta{name}|}{|\meta{phrase}|}| to give this the symbol name
@@ -347,20 +360,20 @@
% \end{exfig}
%
% Semantic variables differ from semantic constants in two ways:
-% \begin{inparaenum}[\em i\rm)]
+% \begin{enumerate}
% \item they do not participate
% in the imports mechanism and
% \item they generate markup with variables.
-% \end{inparaenum}
+% \end{enumerate}
% In the case of
% Figure~\ref{fig:monoid} we (want to) have the \xml markup in Figure~\ref{fig:omsemvar}.
% To associate the notation to the variables, we define semantic macros for them, here the
% macro |\op| for the (semigroup) operation via the \DescribeMacro{\vardef}|\vardef|
% macro. |\vardef| works exactly like, except
-% \begin{inparaenum}[\em i\rm)]
+% \begin{enumerate}
% \item semantic variables are local to the current {\TeX} group and
% \item they generate variable markup in the \xml
-% \end{inparaenum}
+% \end{enumerate}
%
% \begin{exfig}\lstset{basicstyle=\scriptsize,aboveskip=-.5em,belowskip=-1.5em}
% \begin{tabular}{l|p{9.7cm}}
@@ -470,7 +483,7 @@
% The \DescribeMacro{\metalanguage}|\metalanguage| macro is a variant of
% \lstinline|importmodule| that imports the meta language, i.e. the language in which the
% meaning of the new symbols is expressed. For mathematics this is often first-order logic
-% with some set theory; see~\cite{RabKoh:WSMSML10} for discussion.
+% with some set theory; see~\cite{RabKoh:WSMSML13} for discussion.
%
% \subsection{Dealing with multiple Files}\label{sec:user:multiple}
%
@@ -570,7 +583,7 @@
%\begin{exfig}
% \begin{verbatim}
% \begin{omtext}
-% \usemodule[../algebra/rings.tex]{ring}
+% \usemodule[load=../algebra/rings.tex]{ring}
% We $R$ be a ring $(\rbase,\rplus,\rzero,\rminusOp,\rtimes,\rone)$, ...
% \end{omtext}
% \end{verbatim}
@@ -600,7 +613,7 @@
%
% In this section we will discuss limitations and possible extensions of the |modules|
% package. Any contributions and extension ideas are welcome; please discuss ideas,
-% requests, fixes, etc on the {\sTeX} TRAC~\cite{sTeX:online}.
+% requests, fixes, etc on the {\sTeX} TRAC~\cite{sTeX:github:on}.
%
% \subsection{Perl Utility \texttt{sms}}\label{sec:limitations:sms}
%
@@ -608,7 +621,7 @@
% signatures from \sTeX files. This considerably adds to the complexity of the \sTeX
% installation and workflow. If we can solve security setting problems that allows us to
% write to \sTeX module signatures outside the current directory, writing them from \sTeX
-% may be an avenue of future development see~\cite[issue \#1522]{sTeX:online} for a
+% may be an avenue of future development see~\cite[issue \#1522]{sTeX:github:on} for a
% discussion.
%
% \subsection{Qualified Imports}\label{sec:limitations:qualified-imports}
@@ -617,7 +630,7 @@
% for importing macros with a disambiguating prefix (this is used whenever we have
% conflicting names for macros inherited from different modules). This is not accessible
% from the current interface. We need something like a |\importqualified| macro for this;
-% see~\cite[issue \#1505]{sTeX:online}. Until this is implemented the infrastructure is
+% see~\cite[issue \#1505]{sTeX:github:on}. Until this is implemented the infrastructure is
% turned off by default, but we have already introduced the
% \DescribeMacro{qualifiedimports}|qualifiedimports| option for the future.
%
@@ -699,7 +712,9 @@
\DeclareOption{noauxreq}{\aux@reqfalse}
\newif\ifmod@qualified\mod@qualifiedfalse
\DeclareOption{qualifiedimports}{\mod@qualifiedtrue}
-\newif\if@mmt\@mmtfalse
+\newif\if@trwarn\@trwarnfalse
+\DeclareOption{trwarn}{\@trwarntrue}
+\newif\if@mmt\@mmtfalse
\DeclareOption{mmt}{\@mmttrue}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{sref}}
\ProcessOptions
@@ -713,7 +728,7 @@
% right version). For {\latexml}, we also initialize the package inclusions.
% \begin{macrocode}
\RequirePackage{sref}
-\if@modules@mh@\RequirePackage{modules-mh}\fi
+\if@modules@mh@\RequirePackage{modules-mh}\fi
\if@mmt\RequirePackage{mmt}\fi
\RequirePackage{xspace}
\RequirePackage{mdframed}
@@ -735,6 +750,8 @@
\addmetakey*{module}{creators}
\addmetakey*{module}{contributors}
\addmetakey*{module}{srccite}
+\addmetakey*{module}{align}[WithTheModuleOfTheSameName]
+\addmetakey*{module}{noalign}[true]
% \end{macrocode}
% \end{macro}
%
@@ -767,7 +784,7 @@
% \begin{macro}{module@heading}
% Then we make a convenience macro for the module heading. This can be customized.
% \begin{macrocode}
-\newcounter{module}[section]%
+\ifdef{\thesection}{\newcounter{module}[section]}{\newcounter{module}}%
\newrobustcmd\module@heading{%
\stepcounter{module}%
\ifmod@show%
@@ -833,12 +850,9 @@
% problem?}\ednote{Jinbo: This part of code is extremely easy to generate bugs, cautiously edit this part of code.}\newline
% Naive understanding of this code: |#1| be will be expanded first, then |\this@module|, then |\active@defs|, then |\g@addto@macro|.
% \begin{macrocode}
-\def\export@defs#1{%
- \@ifundefined{mod@id}{}{%
- \expandafter\expandafter\expandafter\g@addto@macro%
- \expandafter\this@module\expandafter{\activate@defs{#1}}%
- }%
-}%
+\def\export@defs#1{\@ifundefined{mod@id}{}{%
+\expandafter\expandafter\expandafter\g@addto@macro%
+\expandafter\this@module\expandafter{\activate@defs{#1}}}}%
% \end{macrocode}
% \end{macro}
%
@@ -911,11 +925,11 @@
\relax% do nothing, it has already been loaded, else signal an error
}{%
\PackageError{modules}
- {{Module Name Clash\MessageBreak
+ {Module Name Clash\MessageBreak
A module with name #2 was already loaded under the path "\@path"\MessageBreak
The imported path "\@load" is probably a different module with the\MessageBreak
same name; this is dangerous -- not importing}%
- {Check whether the Module name is correct}}%
+ {Check whether the Module name is correct}%
}%
}%
\fi}%
@@ -1002,11 +1016,15 @@
% and it will not be added to the current module (i.e. we cannot inherit a local
% function). Note, the optional key local does not need a value: we write
% |\symdef[local]{somefunction}[0]{some expansion}|. The other keys are not used in the
-% {\LaTeX} part.
+% {\LaTeX} part.
% \begin{macrocode}
\newif\if@symdeflocal%
\srefaddidkey{symdef}%
\define@key{symdef}{local}[true]{\@symdeflocaltrue}%
+\define@key{symdef}{noverb}[all]{}%
+\define@key{symdef}{align}[WithTheSymbolOfTheSameName]{}%
+\define@key{symdef}{specializes}{}%
+\addmetakey*{symdef}{noalign}[true]
\define@key{symdef}{primary}[true]{}%
\define@key{symdef}{assocarg}{}%
\define@key{symdef}{bvars}{}%
@@ -1022,12 +1040,8 @@
% \begin{macro}{\symdef}
% The the |\symdef|, and |\@symdef| macros just handle optional arguments.
% \begin{macrocode}
-\def\symdef{%
- \@ifnextchar[{\@symdef}{\@symdef[]}%
-}%
-\def\@symdef[#1]#2{%
- \@ifnextchar[{\@@symdef[#1]{#2}}{\@@symdef[#1]{#2}[0]}%
-}%
+\def\symdef{\@ifnextchar[{\@symdef}{\@symdef[]}}%
+\def\@symdef[#1]#2{\@ifnextchar[{\@@symdef[#1]{#2}}{\@@symdef[#1]{#2}[0]}}%
% \end{macrocode}
% \end{macro}
%
@@ -1310,6 +1324,15 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\module@component}
+% This macro computes the module component identifier for external links on term
+% references. It is initially empty, but can be redefined later (e.g.in the |smultiling|
+% package).
+% \begin{macrocode}
+\newcommand\mod@component[1]{}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\mod@termref}
% |\mod@termref{|\meta{module}|}{|\meta{name}|}{|\meta{nl}|}| determines whether the
% macro |\module@|\meta{module}|@path| is defined. If it is, we make it the prefix of a
@@ -1317,19 +1340,26 @@
% otherwise we give a warning.\ednote{MK: this should be rethought, in particular the
% local reference does not work!}
% \begin{macrocode}
-\def\mod@termref#1#2#3{%
- \def\@test{#3}%
+\newcommand\mod@termref[3]{\def\@test{#3}%
\@ifundefined{module@defs@#1}{%
\protect\G@refundefinedtrue%
- \@latex@warning{\protect\termref with unidentified cd "#1": the cd key must reference an active module}%
- \def\@label{sref@#2@target}%
- }%
- {\def\@label{sref@#2@#1@target}}%
- \@ifundefined{module@#1@path}% local reference
- {\sref@hlink@ifh{\@label}{\ifx\@test\@empty #2\else #3\fi}}%
- {\def\@uri{\csname module@#1@path\endcsname.pdf\#\@label}%
- \sref@href@ifh{\@uri}{\ifx\@test\@empty #2\else #3\fi}}%
+ \if@trwarn
+ \PackageWarning{modules}{`\protect\termref' with unidentified cd "#1":\MessageBreak
+ the cd key must reference an active module}%
+ \else
+ \PackageError{modules}{`\protect\termref' with unidentified cd "#1"}
+ {the cd key must reference an active module}%
+ \fi}%
+ {\def\@label{sref@#2@#1\mod@component{#1}@target}%
+ \@ifundefined{module@#1@path}% local reference
+ {\sref@hlink@ifh{\@label}{\ifx\@test\@empty #2\else #3\fi}%
+% \footnote{sTeX mod@termref: local reference to\\ \@label}
+ }%
+ {\def\@uri{\csname module@#1@path\endcsname\mod@component{#1}.pdf\#\@label}%
+ \sref@href@ifh{\@uri}{\ifx\@test\@empty #2\else #3\fi}%
+% \footnote{sTeX mod@termref: external reference to \\\@uri}
}%
+ }}%
% \end{macrocode}
% \end{macro}
%
@@ -1392,8 +1422,9 @@
% \begin{macro}{\inputref}
% |\inputref{|\meta{path to the current file without extension}|}| supports both
% absolute path and relative path, meanwhile, records the path and the extension (not
-% for relative path). \ednote{MK: maybe do something with a non-standard
-% (i.e. non-\texttt{tex}) extension with an optional argument?}
+% for relative path). \ednote{MK: the first (optional) argument is not used. Maybe do
+% something with a non-standard (i.e. non-\texttt{tex}) extension with an optional
+% argument?}
% \begin{macrocode}
\newrobustcmd\inputref[2][]{%
\def\@Slash{/}
@@ -1424,7 +1455,7 @@
% \begin{macrocode}
\newrobustcmd\sinput[1]{%
\PackageError{modules}%
- {The \protect\sinput macro is deprecated}{use the \protect\input instead!}%
+ {The `\protect\sinput' macro is deprecated}{use the \protect\input instead!}%
}%
\newrobustcmd\sinputref[1]{%
\PackageError{modules}%
@@ -1590,7 +1621,7 @@
% LocalWords: toks mixfixi mixfixa mixfixii mixfixia mixfixai mixfixiii arg cr OPaths
% LocalWords: undef tok PARAM thyid BerFieMas inparaenum omsemvar vardef vardef mhview
% LocalWords: getString showfalse showtrue xcomment stex srcref KeyVal omext osslepsdl13
-% LocalWords: beginItemize getProperty introdcue afterOpen numberIt Tokenize mathhub
+% LocalWords: beginItemize getProperty introdcue afterOpen numberIt Tokenize mathhub mmt
% LocalWords: OptionalSemiverbatim omdocmod PushValue assocarg getStomach prs HorIacJuc
% LocalWords: begingroup beginMode endMode endgroup insertElement resymdef sym cscpnrr11
% LocalWords: updir nargkey PresFormatters mixfixaii formatters argname expr behavior
@@ -1605,7 +1636,7 @@
% LocalWords: vspace hrule vspace arith arbitraryn xbool oplus xdisjunction tw mhinput
% LocalWords: emph capitalize ldots termref termref symref symref ctancite nc mhinputref
% LocalWords: smms hyperref RahObe hmlmh10 widehat texmf.cnf requiremodules cs 2oms04
-% LocalWords: sinput sinputref sinputref cname csname 2oms04
+% LocalWords: sinput sinputref sinputref cname csname 2oms04 if@mmt modules-mh pathsuris
% LocalWords: OPhats usepackage importqualified Crossreferencing jobname ltxml etoolbox
% LocalWords: jobname printbibliography textsf langle textsf langle textlangle listadd
% LocalWords: textrangle textlangle newif ifmod qualifiedfalse qualifiedtrue usemhmodule
@@ -1631,5 +1662,13 @@
% LocalWords: auxout omtext surroundwithmdframed ignorespaces NeedsTeXFormat lstinline
% LocalWords: modularizations conventionalized initialize xstring srccite csgdef csxdef
% LocalWords: customized newrobustcmd ifcsundef definedness providerobustcmd cpath
-% LocalWords: canonicalization canonicalize canoncalized RealAddrNum itemize
-% LocalWords: NEWrequiremodules
+% LocalWords: canonicalization canonicalize canoncalized RealAddrNum itemize mmtheory
+% LocalWords: NEWrequiremodules mmtheoryend ignorespacesafterend ignorespacesandpars
+% LocalWords: mmtinclude noexport withusedmodules catcode13 ignorespacesandparsafterend
+% LocalWords: ifhmode unskip mmtconstdec mmtconstdec
+
+% \endinput
+% Local Variables:
+% mode: doctex
+% TeX-master: t
+% End: