diff options
Diffstat (limited to 'Master')
55 files changed, 12094 insertions, 3 deletions
diff --git a/Master/texmf-dist/doc/latex/stex/README b/Master/texmf-dist/doc/latex/stex/README new file mode 100644 index 00000000000..2b48c9e9098 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/README @@ -0,0 +1,12 @@ +stex.sty: An Infrastructure for Semantic Preloading of LaTeX Documents + +This directory contains the sTeX package collection, a version of TeX/LaTeX that allows +to markup TeX/LaTeX documents semantically without leaving the document format, +essentially turning it into a document format for mathematical knowledge management +(MKM). + +Copyright (c) 2008 Michael Kohlhase +The package is distributed under the terms of the LaTeX Project Public License (LPPL) + +The development version of this package can be found at +https://svn.kwarc.info/repos/stex/sty/stex/ diff --git a/Master/texmf-dist/doc/latex/stex/README.cmathml b/Master/texmf-dist/doc/latex/stex/README.cmathml new file mode 100644 index 00000000000..69b3bc104bf --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/README.cmathml @@ -0,0 +1,12 @@ +cmathml.sty: Semantic Macros for Content MathML in LaTeX +cmathmlx.sty: Semantic Macros for extended Content MathML + +This package provides a collection of semantic macros for Content MathML and their LateXML +bindings. These macros form the basis of a naive translation from semantically preloaded +LaTeX formulae into the Content MathML formulae via the LaTeXML system. + +Copyright (c) 2008 Michael Kohlhase +The package is distributed under the terms of the LaTeX Project Public License (LPPL) + +The development version of this package can be found at +https://svn.kwarc.info/repos/stex/sty/stex/cmathml/ diff --git a/Master/texmf-dist/doc/latex/stex/README.cnx b/Master/texmf-dist/doc/latex/stex/README.cnx new file mode 100644 index 00000000000..da8cc14da60 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/README.cnx @@ -0,0 +1,13 @@ +cnx.cls: A LaTeX-based Syntax for Connexions Modules + +The cnx class is a collection of TeX macros that allow to write Connexions modules in the +CNXLaTeX format without leaving the LaTeX workflow. Modules are authored using cnx.cls +using only a text editor, transformed to PDF and proofread as usual. For publication, +CNXLaTeX modules are transformed to CNXML via the LaTeXML translator and can be uploaded +to the Connexions system. + +Copyright (c) 2008 Michael Kohlhase +The package is distributed under the terms of the LaTeX Project Public License (LPPL) + +The development version of this package can be found at +https://svn.kwarc.info/repos/stex/sty/stex/cnx/ diff --git a/Master/texmf-dist/doc/latex/stex/README.modules b/Master/texmf-dist/doc/latex/stex/README.modules new file mode 100644 index 00000000000..24b5f453c87 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/README.modules @@ -0,0 +1,20 @@ +modules.sty: An Infrastructure for Semantic Macros and Module Scoping + +The modules package supplies an infrastructure that allows mark up semantic macros +and to reuse them efficiently in multiple environments. + +This packge is a central part of the sTeX collection, a version of TeX/LaTeX that allows +to markup TeX/LaTeX documents semantically without leaving the document format, +essentially turning it into a document format for mathematical knowledge management +(MKM). + +This package supplies a definition mechanism for semantic macros and a non-standard +scoping construct for them, which is oriented at the semantic depency relation rather +than the document structure. This structure can be used by MKM systems for +added-value services, either directly from the sTeX sources, or after translation. + +Copyright (c) 2008 Michael Kohlhase +The package is distributed under the terms of the LaTeX Project Public License (LPPL) + +The development version of this package can be found at +https://svn.kwarc.info/repos/stex/sty/stex/modules/ diff --git a/Master/texmf-dist/doc/latex/stex/README.omdoc b/Master/texmf-dist/doc/latex/stex/README.omdoc new file mode 100644 index 00000000000..fe5ce57092d --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/README.omdoc @@ -0,0 +1,11 @@ +omdoc.cls: A LaTeX Class for OMDoc Documents +omdoc.sty: A LaTeX Package for OMDoc Document structures + +This package and class supplies a the infrastructure for writing OMDoc documents +(see http://www.omdoc.org) in LaTeX. + +Copyright (c) 2008 Michael Kohlhase +The package is distributed under the terms of the LaTeX Project Public License (LPPL) + +The development version of this package can be found at +https://svn.kwarc.info/repos/stex/sty/stex/omdoc/ diff --git a/Master/texmf-dist/doc/latex/stex/README.presentation b/Master/texmf-dist/doc/latex/stex/README.presentation new file mode 100644 index 00000000000..6c1101aee77 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/README.presentation @@ -0,0 +1,14 @@ +presentation.sty: An Infrastructure for Presenting Semantic Macros + +This package supplies an infrastructure that allows to specify the presentation of +semantic macros, including preference-based bracket elision. This allows to markup the +functional structure of mathematical formulae without having to lose high-quality +human-oriented presentation in {\LaTeX}. Moreover, the notation definitions can be used by +MKM systems for added-value services, either directly from the {\sTeX} sources, or after +translation. + +Copyright (c) 2008 Michael Kohlhase +The package is distributed under the terms of the LaTeX Project Public License (LPPL) + +The development version of this package can be found at +https://svn.kwarc.info/repos/stex/sty/stex/presentation/ diff --git a/Master/texmf-dist/doc/latex/stex/README.sproof b/Master/texmf-dist/doc/latex/stex/README.sproof new file mode 100644 index 00000000000..030862f57b1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/README.sproof @@ -0,0 +1,11 @@ +sproof.sty: An Infrastructure for Structural Markup for Proofs + +This package supplies macros and environment that allow to annotate the structure of +mathematical proofs. This structure can be used by MKM systems for added-value services, +either directly from the sTeX sources, or after translation via the LaTeXML system. + +Copyright (c) 2008 Michael Kohlhase +The package is distributed under the terms of the LaTeX Project Public License (LPPL) + +The development version of this package can be found at +https://svn.kwarc.info/repos/stex/sty/stex/sproof/ diff --git a/Master/texmf-dist/doc/latex/stex/cmathml.pdf b/Master/texmf-dist/doc/latex/stex/cmathml.pdf Binary files differnew file mode 100644 index 00000000000..ce1532986e8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/cmathml.pdf diff --git a/Master/texmf-dist/doc/latex/stex/cnx.pdf b/Master/texmf-dist/doc/latex/stex/cnx.pdf Binary files differnew file mode 100644 index 00000000000..c0e6133ce05 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/cnx.pdf diff --git a/Master/texmf-dist/doc/latex/stex/modules.pdf b/Master/texmf-dist/doc/latex/stex/modules.pdf Binary files differnew file mode 100644 index 00000000000..0356e1529e7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/modules.pdf diff --git a/Master/texmf-dist/doc/latex/stex/omdoc.pdf b/Master/texmf-dist/doc/latex/stex/omdoc.pdf Binary files differnew file mode 100644 index 00000000000..4a15383fde2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/omdoc.pdf diff --git a/Master/texmf-dist/doc/latex/stex/presentation.pdf b/Master/texmf-dist/doc/latex/stex/presentation.pdf Binary files differnew file mode 100644 index 00000000000..c5e76b8b726 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/presentation.pdf diff --git a/Master/texmf-dist/doc/latex/stex/sproof.pdf b/Master/texmf-dist/doc/latex/stex/sproof.pdf Binary files differnew file mode 100644 index 00000000000..20c5cb0b399 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/sproof.pdf diff --git a/Master/texmf-dist/doc/latex/stex/statements.pdf b/Master/texmf-dist/doc/latex/stex/statements.pdf Binary files differnew file mode 100644 index 00000000000..d807e97faff --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/statements.pdf diff --git a/Master/texmf-dist/doc/latex/stex/stex.pdf b/Master/texmf-dist/doc/latex/stex/stex.pdf Binary files differnew file mode 100644 index 00000000000..773ada4927e --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/stex.pdf diff --git a/Master/texmf-dist/doc/latex/stex/stex.tex b/Master/texmf-dist/doc/latex/stex/stex.tex new file mode 100644 index 00000000000..30a865014b0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/stex/stex.tex @@ -0,0 +1,538 @@ +% First a special index style for makeindex +% +\begin{filecontents}{stex.ist} +actual '=' +quote '!' +level '>' +preamble +"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n" +postamble +"\n\n \\end{theindex}\n" +item_x1 "\\efill \n \\subitem " +item_x2 "\\efill \n \\subsubitem " +delim_0 "\\pfill " +delim_1 "\\pfill " +delim_2 "\\pfill " +% The next lines will produce some warnings when +% running Makeindex as they try to cover two different +% versions of the program: +lethead_prefix "{\\bfseries\\hfil " +lethead_suffix "\\hfil}\\nopagebreak\n" +lethead_flag 1 +heading_prefix "{\\bfseries\\hfil " +heading_suffix "\\hfil}\\nopagebreak\n" +headings_flag 1 + +% and just for source2e: +% Remove R so I is treated in sequence I J K not I II III +page_precedence "rnaA" +\end{filecontents} + +\documentclass{ltxdoc} +\usepackage{stex,cmathml,cmathmlx} +\usepackage{lstdoc,textcomp,url,array,stex,float,chapterbib,amsfonts} +\usepackage[show]{ed} +\usepackage{hyperref} +\makeindex +\floatstyle{boxed} +\newfloat{exfig}{thp}{lop} +\floatname{exfig}{Example} + +\def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}} +\def\stex{{\raisebox{-.5ex}S\kern-.5ex\TeX}} +\def\sTeX{\stex} +\def\xslt{{\scsys{xslt}}} +\def\xml{\scsys{Xml}} +\def\mathml{\scsys{MathML}} +\def\omdoc{\scsys{OMDoc}} +\def\openmath{\scsys{OpenMath}} +\def\latexml{\scsys{LaTeXML}} +\def\connexions{\scsys{Connexions}} +\def\latexml{\scsys{LaTeXML}} +\def\perl{\scsys{Perl}} +\def\cmathml{Content-{\sc MathML}\index{Content {\sc MathML}}\index{MathML@{\sc MathML}!content}} +\def\activemath{\scsys{ActiveMath}} +\def\twin#1#2{\index{#1!#2}\index{#2!#1}} +\def\twintoo#1#2{{#1 #2}\twin{#1}{#2}} +\def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}} +\def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} + +% these macros are used in the short descriptions +\def\connexions{\scshape{Connexions}} +\def\cnxlatex{CNX\LaTeX} +\def\cnxml{\scshape{CNXml}} + +%%%%%%%%%%%%%% begin copied from source2e.tex + +\listfiles + +% Do not index some TeX primitives, and some common plain TeX commands. + +\DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global} +\DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,% + \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi} +\DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,% + \vbox,\vtop,\vcenter} +\DoNotIndex{\@empty,\immediate,\write} +\DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup} +\DoNotIndex{\divide,\advance,\multiply,\count,\dimen} +\DoNotIndex{\relax,\space,\string} +\DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,% + \closein,\closeout} +\DoNotIndex{\catcode,\endinput} +\DoNotIndex{\jobname,\message,\read,\the,\m@ne,\noexpand} +\DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss} +\DoNotIndex{\m@ne,\z@,\z@skip,\@ne,\tw@,\p@} +\DoNotIndex{\dp,\wd,\ht,\vss,\unskip} + +% Set up the Index and Change History to use \part +\IndexPrologue{\part*{Index}% + \markboth{Index}{Index}% + \addcontentsline{toc}{part}{Index}% + The italic numbers denote the pages where the + corresponding entry is described, + numbers underlined point to the definition, + all others indicate the places where it is used.} + +\GlossaryPrologue{\part*{Change History}% +% Allow control names to be hyphenated here... + {\GlossaryParms\ttfamily\hyphenchar\font=`\-}% + \markboth{Change History}{Change History}% + \addcontentsline{toc}{part}{Change History}} + +% The standard \changes command modified slightly to better cope with +% this multiple file document. +\makeatletter +\def\changes@#1#2#3{% + \let\protect\@unexpandable@protect + \edef\@tempa{\noexpand\glossary{#2\space\currentfile\space#1\levelchar + \ifx\saved@macroname\@empty + \space + \actualchar + \generalname + \else + \expandafter\@gobble + \saved@macroname + \actualchar + \string\verb\quotechar*% + \verbatimchar\saved@macroname + \verbatimchar + \fi + :\levelchar #3}}% + \@tempa\endgroup\@esphack} +\makeatother + +% Produce a Change Log and (2 column) Index. +\RecordChanges +\CodelineIndex +\EnableCrossrefs +\OnlyDescription +\setcounter{IndexColumns}{2} +%%%%%%%%%%%%%% end copied from source2e.tex + +%\includeonly{} + +\title{{\stex}: Semantic Markup in {\TeX/\LaTeX}} +\author{Michael Kohlhase\\ + Jacobs University, Bremen\\ + \url{http://kwarc.info/kohlhase}} + +\begin{document} + \pagenumbering{roman} + \maketitle + \renewcommand\maketitle{} + \begin{abstract} + We present a collection of {\TeX} macro packages that allow to markup + {\TeX/\LaTeX} documents semantically without leaving the document format, + essentially turning {\TeX/\LaTeX} into a document format for mathematical + knowledge management (MKM). + \end{abstract} +\newsavebox{\forgetbox} +\renewenvironment{abstract}{\begin{lrbox}{\forgetbox}}{\end{lrbox}} +\newpage +\setcounter{tocdepth}{1}\tableofcontents +\clearpage +\pagenumbering{arabic} + +\part{The sTeX Collection} + +\section{Introduction} + +The last few years have seen the emergence of various content-oriented {\xml}-based, +content-oriented markup languages for mathematics on the web, e.g. +{\openmath}~\cite{BusCapCar:2oms04}, {\cmathml}~\cite{CarIon:MathML03}, or our own +{\omdoc}~\cite{Kohlhase:omfmd05}. These representation languages for mathematics, that +make the structure of the mathematical knowledge in a document explicit enough that +machines can operate on it. Other examples of content-oriented formats for mathematics +include the various logic-based languages found in automated reasoning tools +(see~\cite{RobVor:hoar01} for an overview), program specification languages (see +e.g.~\cite{Bergstra:as89}). + +The promise if these content-oriented approaches is that various tasks involved in ``doing +mathematics'' (e.g. search, navigation, cross-referencing, quality control, user-adaptive +presentation, proving, simulation) can be machine-supported, and thus the working +mathematician is relieved to do what humans can still do infinitely better than machines: +The creative part of mathematics --- inventing interesting mathematical objects, +conjecturing about their properties and coming up with creative ideas for proving these +conjectures. However, before these promises can be delivered upon (there is even a +conference series~\cite{MKM-IG-Meetings:web} studying ``Mathematical Knowledge Management +(MKM)''), large bodies of mathematical knowledge have to be converted into content form. + +Even though {\mathml} is viewed by most as the coming standard for representing +mathematics on the web and in scientific publications, it has not not fully taken off in +practice. One of the reasons for that may be that the technical communities that need +high-quality methods for publishing mathematics already have an established method which +yields excellent results: the {\TeX/\LaTeX} system: and a large part of mathematical +knowledge is prepared in the form of {\TeX}/{\LaTeX} documents. + +{\TeX}~\cite{Knuth:ttb84} is a document presentation format that combines complex +page-description primitives with a powerful macro-expansion facility, which is utilized in +{\LaTeX} (essentially a set of {\TeX} macro packages, see~\cite{Lamport:ladps94}) to +achieve more content-oriented markup that can be adapted to particular tastes via +specialized document styles. It is safe to say that {\LaTeX} largely restricts content +markup to the document structure\footnote{supplying macros e.g. for sections, paragraphs, + theorems, definitions, etc.}, and graphics, leaving the user with the presentational +{\TeX} primitives for mathematical formulae. Therefore, even though {\LaTeX} goes a great +step into the direction of an MKM format, it is not, as it lacks infrastructure for +marking up the functional structure of formulae and mathematical statements, and their +dependence on and contribution to the mathematical context. + +\subsection{The {\xml} vs. {\TeX/\LaTeX} Formats and Workflows} + +{\mathml} is an {\xml}-based markup format for mathematical formulae, it is standardized +by the World Wide Web Consortium in {\cite{CarIon:MathML03}}, and is supported by the +major browsers. The {\mathml} format comes in two integrated components: presentation +{\mathml}\twin{presentation}{MathML} and content {\mathml}\twin{content}{MathML}. The +former provides a comprehensive set of layout primitives for presenting the visual +appearance of mathematical formulae, and the second one the functional/logical structure +of the conveyed mathematical objects. For all practical concerns, presentation {\mathml} +is equivalent to the math mode of {\TeX}. The text mode facilitates of {\TeX} (and the +multitude of {\LaTeX} classes) are relegated to other {\xml} formats, which embed +{\mathml}. + +The programming language constructs of {\TeX} (i.e. the macro definition +facilities\footnote{We count the parser manipulation facilities of {\TeX}, e.g. category + code changes into the programming facilities as well, these are of course impossible for + {\mathml}, since it is bound to {\xml} syntax.}) are relegated to the {\xml} +programming languages that can be used to develop language extensions. +transformation language {\xslt}~\cite{Deach:exls99,Kay:xpr00} or proper {\xml}-enabled +The {\xml}-based syntax and the separation of the presentational-, functional- and +programming/extensibility concerns in {\mathml} has some distinct advantages over the +integrated approach in {\TeX/\LaTeX} on the services side: {\mathml} gives us better +\begin{itemize} +\item integration with web-based publishing, +\item accessibility to disabled persons, e.g. (well-written) {\mathml} contains enough + structural information to supports screen readers. +\item reusability, searchabiliby and integration with mathematical software systems + (e.g. copy-and-paste to computer algebra systems), and +\item validation and plausibility checking. +\end{itemize} + +On the other hand, {\TeX/\LaTeX}/s adaptable syntax and tightly integrated programming +features within has distinct advantages on the authoring side: + +\begin{itemize} +\item The {\TeX/\LaTeX} syntax is much more compact than {\mathml} (see the difference in + Figure~\ref{fig:mathml-sum} and Equation ~\ref{eq:cmathml-sum}), and if needed, the + community develops {\LaTeX} packages that supply new functionality in with a succinct + and intuitive syntax. +\item The user can define ad-hoc abbreviations and bind them to new control sequences to + structure the source code. +\item The {\TeX/\LaTeX} community has a vast collection of language extensions and best + practice examples for every conceivable publication purpose and an established and very + active developer community that supports these. +\item There is a host of software systems centered around the {\TeX/\LaTeX} language that + make authoring content easier: many editors have special modes for {\LaTeX}, there are + spelling/style/grammar checkers, transformers to other markup formats, etc. +\end{itemize} + +In other words, the technical community is is heavily invested in the whole +{\index*{workflow}}, and technical know-how about the format permeates the +community. Since all of this would need to be re-established for a {\mathml}-based +workflow, the technical community is slow to take up {\mathml} over {\TeX/\LaTeX}, even in +light of the advantages detailed above. + +\subsection{A {\LaTeX}-based Workflow for {\xml}-based Mathematical Documents} + +An elegant way of sidestepping most of the problems inherent in transitioning from a +{\LaTeX}-based to an {\xml}-based workflow is to combine both and take advantage of the +respective advantages. + +The key ingredient in this approach is a system that can transform {\TeX\LaTeX} documents +to their corresponding {\xml}-based counterparts. That way, {\xml}-documents can be +authored and prototyped in the {\LaTeX} workflow, and transformed to {\xml} for +publication and added-value services, combining the two workflows. + +There are various attempts to solve the {\TeX/\LaTeX} to {\xml} transformation problem; the +most mature is probably Bruce Miller's {\latexml} system~\cite{Miller:latexml}. It +consists of two parts: a re-implementation of the {\TeX} {\index*{analyzer}} with all of +it's intricacies, and a extensible {\xml} emitter (the component that assembles the output +of the parser). Since the {\LaTeX} style files are (ultimately) programmed in {\TeX}, the +{\TeX} analyzer can handle all {\TeX} extensions, including all of {\LaTeX}. Thus the +{\latexml} parser can handle all of {\TeX/\LaTeX}, if the emitter is extensible, which is +guaranteed by the {\latexml} binding language: To transform a {\TeX/\LaTeX} document to a +given {\xml} format, all {\TeX} extensions\footnote{i.e. all macros, environments, and + syntax extensions used int the source document} must have ``{\latexml} +bindings''\index{LaTeXML}{binding}, i.e. a directive to the {\latexml} emitter that +specifies the target representation in {\xml}. + +\section{The Packages of the sTeX Collection}\label{sec:packages} + +In the following, we will shortly preview the packages and classes in the {\stex} +collection. They all provide part of the solution of representing semantic structure in +the {\TeX/\LaTeX} workflow. We will group them by the conceptual level they +address\ednote{come up with a nice overview figure here!} + +\subsection{Content Markup of Mathematical Formulae in {\TeX/\LaTeX}} + +The first two packages are concerned basically with the math mode in {\TeX}, +i.e. mathematical formulae. The underlying problem is that run-of-the-mill {\TeX/\LaTeX} +only specifies the presentation (i.e. what formulae look like) and not their content +(their functional structure). Unfortunately, there are no good methods (yet) to infer the +latter from the former, but there are ways to get presentation from content. + +Consider for instance the following ``standard notations''\footnote{The first one is + standard e.g. in Germany and the US, the third one in France, and the last one in + Russia} for binomial coefficients: $\left(n\atop k\right)$, $_nC^k$, $\mathcal{C}^n_k$, and +$\mathcal{C}^k_n$ all mean the same thing: $n!\over k!(n-k)!$. This shows that we cannot hope +to reliably recover the functional structure (in our case the fact that the expression is +constructed by applying the binomial function to the arguments $n$ and $k$) from the +presentation alone. + +The solution to this problem is to dump the extra work on the author (after all she knows +what she is talking about) and give them the chance to specify the intended structure. The +markup infrastructure supplied by the {\stex} collection lets the author do this without +changing\footnote{However, semantic annotation will make the author more aware of the + functional structure of the document and thus may in fact entice the author to use + presentation in a more consistent way than she would usually have.} the visual +appearance, so that the {\LaTeX} workflow is not disrupted. . We speak of +{\twintoo{semantic}{preloading}} for this process and call our collection of macro +packages {\stex} (Semantic {\TeX}). For instance, we can now write +\begin{equation}\label{eq:cmathml-sum} + |\CSumlLimits{k}1\infty{\Cexp{x}k}| \qquad\hbox{instead of the usual}\qquad + |\sum_{k=1}^\infty x^k| +\end{equation} + +In the first form, we specify that you are applying a function (|CSumLimits| $\hat=$ Sum +with Limits) to 4 arguments: ({\sl{i}}) the bound variable $k$ (that runs from) +({\sl{ii}}) the number 1 (to) ({\sl{iii}}) $\infty$ (to infinity summing the terms) +({\sl{iv}}) |\Cexp{x}k| (i.e. x to the power k). In the second form, we merely specify +hat {\LaTeX} should draw a capital Sigma character ($\sigma$) with a lower index which is +an equation $k=1$ and an upper index $\infty$. Then it should place next to it an $x$ with +an upper index $k$. + +Of course human readers (that understand the math) can infer the content structure from +this presentation, but the {\latexml} converter (who does not understand the math) cannot, +but we want to have the content {\mathml} expression in Figure~\ref{fig:mathml-sum} +\begin{exfig} +\begin{verbatim} + <math xmlns="http://www.w3.org/1998/Math/MathML"> + <apply> + <sum> + <bvar><ci>k</ci></bvar> + <lowlimit><cn>1</cn></lowlimit> + <uplimit><infinit/></cn></uplimit> + <apply><exp/><ci>x</ci><ci>k</ci></apply> + </apply> + </math> +\end{verbatim}\vspace*{-.6cm} + \caption{Content {\mathml} Form of $\sum_{k=1}^\infty x^k$}\label{fig:mathml-sum} +\end{exfig} + +Obviously, a converter can infer this from the first {\LaTeX} structure with the help of +the curly braces that indicate the argument structure, but not from the second (because it +does not understand the math). The nice thing about the |cmathml| infrastructure is that +you can still run {\LaTeX} over the first form and get the same formula in the DVI file +that you would have gotten from running it over the second form. That means, if the author +is prepared to write the mathematical formulae a little differently in her {\LaTeX} +sources, then she can use them in {\xml} and {\LaTeX} at the same time. + + +\subsubsection{{\tt{cmathml}}: Encoding Content {\mathml} in {\TeX/\LaTeX}} + +The |cmathml| package provides a set of macros that correspond to the K-14 fragment of +mathematics (Kindergarten to undergraduate college level ($\hat=14^{th}$ grade)). We have +already seen an example above in equation (\ref{eq:cmathml-sum}), where the content markup +in {\TeX} corresponds to a content {\mathml}-expression (and can actually be translated to +this by the {\latexml} system.) However, the content {\mathml} vocabulary is fixed in the +{\mathml} specification and limited to the K-14 fragment; the notation of mathematics of +course is much larger and extensible on the fly. + + +\subsubsection{{\tt{presentation}}: Flexible Presentation for Semantic Macros} + +The |presentation| package supplies an infrastructure that allows to specify the +presentation of semantic macros, including preference-based bracket elision. This allows +to markup the functional structure of mathematical formulae without having to lose +high-quality human-oriented presentation in {\LaTeX}. Moreover, the notation definitions +can be used by MKM systems for added-value services, either directly from the {\sTeX} +sources, or after translation. + +\subsection{Mathematical Statements} + +\subsubsection{{\tt{statements}}: Extending Content Macros for Mathematical Notation} + +This package provides semantic markup facilities for mathematical statements like +Theorems, Lemmata, Axioms, Definitions, etc. in {\stex} files. This structure can be +used by MKM systems for added-value services, either directly from the {\sTeX} +sources, or after translation. + +\subsubsection{{\tt{sproof}}: Extending Content Macros for Mathematical Notation} + +This package supplies macros and environment that allow to annotate the structure of +mathematical proofs in {\stex} files. This structure can be used by MKM systems for +added-value services, either directly from the {\sTeX} sources, or after translation. + + +\subsection{Context Markup for Mathematics} + +\subsubsection{{\tt{modules}}: Extending Content Macros for Mathematical Notation} + +This package supplies a definition mechanism for semantic macros and a non-standard +scoping construct for them, which is oriented at the semantic depency relation rather +than the document structure. This structure can be used by MKM systems for +added-value services, either directly from the {\sTeX} sources, or after translation. + +\subsection{Mathematical Document Classes} + +\subsubsection{Connexions Modules} + +{\cnxlatex} is a collection of {\LaTeX} macros that allow to write {\connexions} modules +without leaving the {\LaTeX} workflow. Modules are authored in {\cnxlatex} using only a +text editor, transformed to PDF and proofread as usual. In particular, the {\LaTeX} +workflow is independent of having access to the {\connexions} system, which makes +{\cnxlatex} attractive for the initial version of single-author modules. + + +For publication, {\cnxlatex} modules are transformed to {\cnxml} via the {\latexml} +translator and can be uploaded to the {\connexions} system. + +\subsubsection{OMDoc Documents} + +The |omdoc| package provides an infrastructure that allows to markup {\omdoc} documents in +{\LaTeX}. It provides |omdoc.cls|, a class with the and |omdocdoc.sty| + +\subsubsection{Slides and Presentations} + +We present a document class from which we can generate both course slides and course +notes in a transparent way. Furthermore, we present a set of {\latexml} bindings for +these, so that we can also generate {\omdoc}-based course materials, e.g. for +inclusion in the {\activemath} system. + +\subsection{Conclusion}\label{sec:concl} + +The {\stex} collection provides a set of semantic macros that extends the familiar and +time-tried {\LaTeX} workflow in academics until the last step of Internet publication of +the material. For instance, a {\connexions} module can be authored and maintained in +{\LaTeX} using a simple text editor, a process most academics in technical subjects are +well familiar with. Only in a last publishing step (which is fully automatic) does it get +transformed into the {\xml} world, which is unfamiliar to most academics. + +Thus, {\stex} can serve as a conceptual interface between the document author and MKM +systems: Technically, the semantically preloaded {\LaTeX} documents are transformed into +the (usually {\xml}-based) MKM representation formats, but conceptually, the ability to +semantically annotate the source document is sufficient. + +The {\stex} macro packages have been validated together with a case +study~\cite{Kohlhase:smtl05}, where we semantically preload the course materials for a +two-semester course in Computer Science at Jacobs University Bremen and transform them to +the {\omdoc} MKM format, so that they can be used in the {\activemath} +system~\cite{activemathAIEDJ01}. Another study of converting {\LaTeX} materials for the +{\connexions} project is under way.\ednote{say some more} + +\subsection{Licensing, Download and Setup}\label{sec:setup} + +\ednote{talk about licensing} + +The {\stex} packages and classes can be obtained as a self-documenting {\LaTeX} packages: +To obtain a package {\meta{package}} download the files \meta{package}|.dtx| and +\meta{package}|.ins| from +\begin{center} + {\url{https://svn.kwarc.info/repos/kwarc/projects/stex/sty/}\meta{package}/} +\end{center} +To extract the {\LaTeX} package \meta{package}|.sty| and the {\latexml} bindings in +\meta{package}|.ltxml|, run the {\LaTeX} formatter on |cmathml.ins|, e.g. by typing +|latex cmathml.ins| to a shell. To extract the documentation (the version of this document that +goes with the extracted package) run the {\LaTeX} formatter on |cmathml.dtx| e.g. by +typing |latex |\meta{package}|.dtx| to a shell. + +Usually, the {\stex} distribution will also have the newest versions of the files +\meta{package}|.sty|, \meta{package}|.ltxml|, and the documentation \meta{package}|.pdf| +pre-generated for convenience, so they can be downloaded directly from the URL above. + +To install the package, copy the file \meta{package}|.sty| somewhere, where +{\TeX}/{\LaTeX} can find it and rebuild {\TeX}'s file name database. This is done by +running the command |texhash| or |mktexlsr| (they are the same). In |MikTEX|, there is a +menu option to do this. + +\section{Utilities}\label{sec:utilities} + +To simplify dealing with {\stex} documents, we are providing a small collection of command +line utilities, which we will describe here. For details and downloads go to +{\url{http://kwarc.info/projects/stex}}. + +\begin{description} +\item[{\tt{msplit}}] splits an {\stex} file into smaller ones (one module per file) +\item[{\tt{rf}}] computes the ``reuse factor'', i.e. how often {\stex} modules are reused + over a collection of documents +\item[{\tt{sgraph}}] visualizes the module graph +\item[{\tt{sms}}] computes the {\stex} module signatures for a give {\stex} file +\item[{\tt{bms}}] proposes a sensible module structure for an un-annotated {\stex} file +\end{description} + +\DocInclude{cnx} +\DocInclude{cmathml} +\DocInclude{modules} +\DocInclude{statements} +\DocInclude{sproof} +\DocInclude{omdoc} +\DocInclude{presentation} + +% Stop here if ltxdoc.cfg says \AtEndOfClass{\OnlyDescription} +\StopEventually{\newpage +\bibliographystyle{alpha} +\bibliography{kwarc} +\PrintIndex +\newpage\PrintChanges +\end{document}} + +\clearpage +\pagestyle{headings} +% Make TeX shut up. +\hbadness=10000 +\newcount\hbadness +\hfuzz=\maxdimen + +\bibliographystyle{alpha} +\bibliography{../doc/macros/stex,../doc/macros/omdoc} + +\typeout{% + \string # Produce change log with^^J% + makeindex -s gglo.ist -o stex.gls stex.glo} + + +\PrintChanges +\clearpage + +% makeindex needs a symbol between the parts of composite page numbers +% but we dont want one, so: +\typeout{% + \string # Produce index with^^J% + makeindex -s stex.ist stex.idx} + +\PrintIndex + +% Make sure that the index is not printed twice +% (ltxdoc.cfg might have a second \PrintIndex command) +\let\PrintChanges\relax +\let\PrintIndex\relax + +\end{document} +%%% Local Variables: +%%% mode: stex +%%% TeX-master: t +%%% End: + +% LocalWords: hoc LaTeXML nC CSumLimits cmathml DVI th sproof dtx mikoslides +% LocalWords: ltxml pdf texhash mktexlsr MikTEX msplit rf sgraph sms bms un +% LocalWords: cnx omdoc diff --git a/Master/texmf-dist/makeindex/stex/stex.ist b/Master/texmf-dist/makeindex/stex/stex.ist new file mode 100644 index 00000000000..7486932fa63 --- /dev/null +++ b/Master/texmf-dist/makeindex/stex/stex.ist @@ -0,0 +1,29 @@ +%% LaTeX2e file `stex.ist' +%% generated by the `filecontents' environment +%% from source `stex' on 2008/05/07. +%% +actual '=' +quote '!' +level '>' +preamble +"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n" +postamble +"\n\n \\end{theindex}\n" +item_x1 "\\efill \n \\subitem " +item_x2 "\\efill \n \\subsubitem " +delim_0 "\\pfill " +delim_1 "\\pfill " +delim_2 "\\pfill " +% The next lines will produce some warnings when +% running Makeindex as they try to cover two different +% versions of the program: +lethead_prefix "{\\bfseries\\hfil " +lethead_suffix "\\hfil}\\nopagebreak\n" +lethead_flag 1 +heading_prefix "{\\bfseries\\hfil " +heading_suffix "\\hfil}\\nopagebreak\n" +headings_flag 1 + +% and just for source2e: +% Remove R so I is treated in sequence I J K not I II III +page_precedence "rnaA" diff --git a/Master/texmf-dist/source/latex/stex/cmathml.dtx b/Master/texmf-dist/source/latex/stex/cmathml.dtx new file mode 100644 index 00000000000..dc101d12f38 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/cmathml.dtx @@ -0,0 +1,2442 @@ +% \iffalse meta-comment +% Semantic Macros for Content MathML in LaTeX +% Copyright (c) 2006 Michael Kohlhase, all rights reserved +% this file is released under the +% Gnu Library Public Licences (LGPL) +% +% The development version of this file can be found at +% https://svn.kwarc.info/repos/kwarc/projects/stex/sty/cmathml.dtx +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{cmathml}[2006/01/10 v0.1 CMathML Bindings] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{url,array,float,amsfonts,a4wide} +\usepackage{cmathml,cmathmlx,presentation} +\usepackage[show]{ed} +\usepackage{hyperref} +\makeindex +\floatstyle{boxed} +\newfloat{exfig}{thp}{lop} +\floatname{exfig}{Example} +\begin{document}\DocInput{cmathml.dtx}\end{document} +%</driver> +% \fi +% +%\CheckSum{1586} +% +% \changes{v0.1}{10. January 2006}{Initial Version} +% \changes{v0.2}{16. January 2006}{Added big operators} +% +% \GetFileInfo{cmathml.sty} +% +% \MakeShortVerb{\|} +% +% \def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}} +% \def\stex{{\raisebox{-.5ex}S\kern-.5ex\TeX}\index{sTeX}} +% \def\sTeX{\stex} +% \newenvironment{pcmtab}[1][5cm]{\begin{center}\begin{tabular}{|l|l|p{#1}|l|}\hline% +% macro & args & Example & Result\\\hline\hline}% +% {\end{tabular}\end{center}} +% \newenvironment{cmtab}{\begin{center}\begin{tabular}{|l|l|l|l|}\hline% +% macro & args & Example & Result\\\hline\hline}% +% {\end{tabular}\end{center}} +% +% \def\snippet#1{\hbox{\ttfamily{#1}}} +% \def\xml{{\scsys{Xml}}} +% \def\xslt{{\scsys{xslt}}} +% \def\element#1{{\ttfamily{#1}}} +% \def\mathml{{\scshape{MathML}}\index{MathML}} +% \def\latexml{\hbox{{\LaTeX}ML}\index{LaTexML}} +% \def\twin#1#2{\index{#1!#2}\index{#2!#1}} +% \def\twintoo#1#2{{#1 #2}\twin{#1}{#2}} +% \def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}} +% \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} +% +% \title{A {\TeX/\LaTeX}-based Syntax for Content +% {\mathml}\thanks{Version {\fileversion} (last revised {\filedate})}} +% \author{Michael Kohlhase\\ +% Jacobs University, Bremen\\ +% \url{http://kwarc.info/kohlhase}} +% \maketitle +% +% \begin{abstract} +% The |cmathml| packge is part of the {\stex} collection, a +% version of {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents semantically +% without leaving the document format, essentially turning {\TeX/\LaTeX} into a document +% format for mathematical knowledge management (MKM). +% +% This package provides a collection of semantic macros for content {\mathml} and their +% {\latexml} bindings. These macros form the basis of a naive translation from +% semantically preloaded {\LaTeX} formulae into the content {\mathml} formulae via the +% {\latexml} system. +% \end{abstract} +% +% \newpage +% +%\section{Introduction}\label{sec:intro} +% +% This document describes the collection of semantic macros for content {\mathml} and +% their {\latexml} bindings. These macros can be used to mark up mathematical formulae, +% exposing their functional/logical structure. This structure can be used by MKM systems +% for added-value services, either directly from the {\sTeX} sources, or after +% translation. Even though it is part of the {\stex} collection, it can be used +% independently. Note that this documentation of the package presupposes the discussion of +% the {\stex} collection to be self-contained. +% +% \subsection{Encoding Content {\mathml} in {\TeX/\LaTeX}}\label{sec:encoding} +% +% The |cmathml| packge presented here addresses part of transformation problem: representing +% mathematical formulae in the {\LaTeX} workflow, so that content {\mathml} representations +% can be derived from them. The underlying problem is that run-of-the-mill {\TeX/\LaTeX} +% only specifies the presentation (i.e. what formulae look like) and not their content +% (their functional structure). Unfortunately, there are no good methods (yet) to infer the +% latter from the former, but there are ways to get presentation from content. +% +% The solution to this problem is to dump the extra work on the author (after all she knows +% what she is talking about) and give them the chance to specify the intended structure. The +% markup infrastructure supplied by the |cmathml| package lets the author do this without +% changing the visual appearance, so that the {\LaTeX} workflow is not disrupted. +% +% To use these |cmathml| macros in a {\LaTeX} document, you will have to include the +% |cmathml| package using |\usepackage{cmathml}| somewhere in the document preamble. Then +% you can use the macros +% \begin{verbatim} +% $\Ceq{\Cexp{\Ctimes{\Cimaginaryi,\Cpi}},\Cuminus{\Ccn{1}}}$ +% \end{verbatim} +% which will result in $e^{i\pi}=-1$ when the document is formatted in {\LaTeX}. If the +% document is converted to {\xml} using the {\latexml} conversion tool, then the result +% will be content {\mathml} representation: +% +%\begin{exfig} +% \begin{verbatim} +% <math xmlns="http://www.w3.org/1998/Math/MathML"> +% <apply> +% <eq/> +% <apply> +% <exp/> +% <apply><times><imaginaryi/><pi/></times></apply> +% </apply> +% <apply><minus/><cn>1</cn></apply> +% </apply> +% </math> +% \end{verbatim}\vspace*{-.6cm} +% \caption{Content {\mathml} Form of $e^{i\pi}=-1$}\label{fig:cmathml-eip} +% \end{exfig} +% +% \subsection{Changing the {\TeX/\LaTeX} Presentation}\label{sec:changing} +% +% It is possible to change the default presentation (i.e. the result under {\LaTeX} +% formatting): The semantic macros only function as interface control sequences, which +% call an internal macro that does the actual presentation. Thus we simply have to +% redefine the internal macro to change the presentation. This is possible locally or +% globally in the following way: +% \begin{verbatim} +% \makeatletter +% \gdef\CMathML@exp#1{exp(#1)} +% \def\CMathML@pi{\varpi} +% \makeatother +% \end{verbatim} +% +% The first line is needed to lift the {\LaTeX} redefinition protection for internal +% macros (those that contain the $\snippet{\@}$ character), and the last line restores it +% for the rest of the document. The second line has a {\em{global}} (i.e. the presentation +% will be changed from this point on to the end of the document.) redefinition of the +% presentation of the exponential function in the {\LaTeX} output. The third line has a +% {\em{local}} redefinition of the presentation (i.e. in the local group induced by +% {\LaTeX}'s $\snippet{begin}/\snippet{end}$ grouping or by {\TeX}'s grouping induced by +% curly braces). Note that the argument structure has to be respected by the presentation +% redefinitions. Given the redefinitions above, our equation above would come out as +% $exp(i\varpi)=-1$. +% +% \subsection{The Future: Heuristic Parsing}\label{sec:future} +% +% The current implementation of content {\mathml} transformation from {\LaTeX} to +% {\mathml} lays a heavy burden on the content author: the {\LaTeX} source must be +% semantically preloaded --- the structure of the formulae must be fully annotated. In our +% example above, we had to write {|\Ceq{A,B}|} instead of the more conventional (and more +% legible) {|A=B|}.\ednote{come up with a good mixed example} +% +% The reason for this is that this keeps the transformation to content {\mathml} very +% simple, predictable and robust at the expense of authoring convenience. The +% implementation described in this module should be considered as a first step and +% fallback solution only. Future versions of the $\latexml$ tool will feature more +% intelligent solutions for determining the implicit structure of more conventional +% mathematical notations (and {\LaTeX} representations), so that writing content {\mathml} +% via {\LaTeX} will become less tedious. +% +% However, such more advanced techniques usually rely on linguistic, structural, and +% semantic information about the mathematical objects and their preferred +% representations. They tend to be less predictable to casual users and may lead to +% semantically unexpected results.\ednote{talk about sTeX and extensibility in +% MathML/OpenMath/OMDoc} +% +% \newpage +% \section{The User Interface}\label{sec:modules} +% +% We will now tabulate the semantic macros for the Content {\mathml} elements. We have +% divided them into modules based on the sectional structure of the {\mathml}2 +% recommendation ($2^{nd}$ edition). Before we go into the specific elements one-by-one, +% we will discuss some general properties of the |cmatml| macros and their {\latexml} +% bindings. +% +% \subsection{Generalities of the Encoding}\label{sec:generalities} +% +% The semantic macros provided by the |cmatml| package differ mainly in the way they treat +% their arguments. The simplest case are those for constants~\ref{sec:constants} that do +% not take any. Others take one, two, three, or even four arguments, which have to be +% {\TeX} tokens or have to be wrapped in curly braces. For operators that are associative +% {\twin{associative}{operator}} like addition the argument sequence is provided as a +% single {\TeX} argument (wrapped in curly braces) that contains a comma-separated +% sequence of arguments (wrapped in curly braces where necessary). +% +% \DescribeMacro{\Capply} The current setup of the |cmathml| infrastructure minimizes the +% need of specifying the {\mathml} {\element{apply}} element, since the macros are all in +% applied form: As we have seen in the example in the Introduction~\ref{sec:intro}, a +% macro call like {|\Cexp{A}|} corresponds to the application of the exponential function +% to some object, so the necessary {\element{apply}} elements in the {\mathml} +% representation are implicit in the {\LaTeX} formulation and are thus added by the +% transformation. Of course this only works, if the function is a content {\mathml} +% element. Often, in mathematics we will have situations, where the function is a variable +% (or ``arbitrary but fixed'') function. Then the formula $f(x)$ represented as |$f(x)$| +% in {\TeX} could (and sometimes will) be misunderstood by the Math parser as $f\cdot x$, +% i.e. a product of the number $f$ with the number $x$, where $x$ has brackets for some +% reason. In this case, we can disambiguate by using |\Capply{f}x|, which will also format +% as $f(x)$.\ednote{what about $n$-ary functions?} +% +% By the same token, we do not need to represent the qualifier elements +% {\element{condition}} and {\element{domainofapplication}}\footnote{We do not support the +% {\element{fn}} element as it is deprecated in {\mathml}2 and the {\element{declare}} +% and {\element{sep}} elements, since their semantic status is unclear (to the author, +% if you feel it is needed, please gripe to me).}, for +% {\twintoo{binding}{operator}s}. They are are folded into the special forms of the +% semantic macros for the binding operators below (the ones with the {|Cond|} and {|DA|} +% endings): +% +% For operators that are {\index*{associative}}, {\index*{commutative}}, and +% {\index*{idempotent}} ({\index*{ACI}} i.e. {\index*{bracketing}}, +% order\twin{argument}{order}, and {\index*{multiplicity}} of arguments does not matter) +% {\mathml} supplies the a special form of application as a binding operator (often called +% the corresponding ``{\twintoo{big}{operator}})'', which ranges over a whole set of +% arguments. For instance for the ACI operator $\cup$ for set uinon has the ``big'' +% operator for unions over collections of sets e.g. used in the power set +% $\bigcup_{S\subseteq T}S$ of a set $T$. In some cases, the ``big'' operators are +% provided independently by {\mathml}, e.g. the ACI addition operator has the sum operator +% as a corresponding ``big operator'': $\sum_{x\in\Cnaturalnumbers}{x^i}$ is the sum of +% the powers of $x$ for all natural numbers. Where they are not, we will supply extra +% macros in the |cmathml| package, e.g. the |\CUnion| macro as the big operator for +% |\Cunion|. +% +% Finally, some of the binding operators have multiple content models flagged by the +% existence of various modifier elements. In these cases, we have provided different +% semantic macros for the different cases. +% +% \subsection{The Token Elements}\label{sec:tokens} +% +% The {\mathml} token elements are very simple containers that wrap some presentation +% {\mathml} text. The {\element{csymbol}} element is the extension element in +% {\mathml}. It's content is the presentation of symbol, and it has a |definitionURL| +% attribute that allows to specify a URI that specifies the semantics of the symbol. This +% URL can be specified in an optional argument to teh |\Ccsymbol| macro, in accordance +% with usual mathematical practice, the |definitionURL| is not presented. +% \DescribeMacro{\Ccn}\DescribeMacro{\Cci}\DescribeMacro{\Ccsymbol} +% \begin{cmtab} +% |\Ccn| & token & |\Ccn{t}| & $\Ccn{t}$\\\hline +% |\Cci| & token & |\Cci{t}| & $\Cci{t}$\\\hline +% |\Ccsymbol| & token, URI & |\Ccsymbol[http://w3.org]{t}| +% & $\Ccsymbol[http://w3.org]{t}$\\\hline +% \end{cmtab} +% Like the |\Ccsymbol| macro, all other macros in the |camthml| package take an optional +% argument\footnote{This may change into a KeyVaL argument in future versionss of the +% |cmathml| package.} for the |definitionURL| attribute in the corresponding {\mathml} +% element. +% +%\newpage +% \subsection{The Basic Content Elements}\label{sec:basic} +% +% The basic elements comprise various pieces of the {\mathml} infrastructure. Most of the +% semantic macros in this section are relatively uneventful. +% +% \DescribeMacro{\Cinverse}\DescribeMacro{\Ccompose}\DescribeMacro{\Cident} +% \DescribeMacro{\Cdomain}\DescribeMacro{\Ccodomain}\DescribeMacro{\Cimage} +% \begin{cmtab} +% |\Cinverse| & 1 & |\Cinverse{f}| & $\Cinverse{f}$\\\hline +% |\Ccompose| & 1 & |\Ccompose{f,g,h}| & $\Ccompose{f,g,h}$\\\hline +% |\Cident| & 0 & |\Cident| & $\Cident$\\\hline +% |\Cdomain| & 1 & |\Cdomain{f}| & $\Cdomain{f}$\\\hline +% |\Ccodomain| & 1 & |\Ccodomain{f}| & $\Ccodomain{f}$\\\hline +% |\Cimage| & 1 & |\Cimage{f}| & $\Cimage{f}$\\\hline +% \end{cmtab} +% +% \DescribeMacro{\Clambda}\DescribeMacro{\ClambdaDA}\DescribeMacro{\Crestrict} For the +% {\element{lambda}} element, we only have the {\element{domainofapplication}} element, so +% that we have three forms a $\lambda$-construct can have. The first one is the simple one +% where the first element is a bound variable. The second one restricts the appliccability +% of the bound variable via a {\element{domainofapplication}} element, while the third one +% does not have a bound variable, so it is just a function restriction +% operator.\ednote{need ClambdaCond} +% +% \begin{cmtab} +% |\Clambda| & 2 & |\Clambda{x,y}{A}| & $\Clambda{x,y}{A}$\\\hline +% |\ClambdaDA| & 3 & |\ClambdaDA{x}{C}{A}| & $\ClambdaDA{x,y}{C}{A}$\\\hline +% |\Crestrict| & 2 & |\Crestrict{f}{S}| & $\Crestrict{f}{S}$\\\hline +% \end{cmtab} +% +% \DescribeMacro{ccinterval}\DescribeMacro{cointerval} +% \DescribeMacro{ocinterval}\DescribeMacro{oointerval} +% The {\element{interval}} constructor actually represents four types of intervals in +% {\mathml}. Therefore we have four semantic macros, one for each combination of open and +% closed endings: +% \begin{cmtab} +% |\Cccinterval| & 2 & |\Cccinterval{1}{2}| & $\Cccinterval{1}{2}$\\\hline +% |\Ccointerval| & 2 & |\Ccointerval{1}{2}| & $\Ccointerval{1}{2}$\\\hline +% |\Cocinterval| & 2 & |\Cocinterval{1}{2}| & $\Cocinterval{1}{2}$\\\hline +% |\Coointerval| & 2 & |\Coointerval{1}{2}| & $\Coointerval{1}{2}$\\\hline +% \end{cmtab} +% +%\DescribeMacro{\Cpiecewise}\DescribeMacro{\Cpiece}\DescribeMacro{\Cotherwise} +% The final set of semantic macros are concerned with piecewise definition of functions. +% \begin{cmtab} +% |\Cpiecewise| & 1 & see below & see below\\\hline +% |\Cpiece| & 2 & |\Cpiece{A}{B}| & $\begin{array}{ll}\Cpiece{A}{B}\end{array}$\\\hline +% |\Cotherwise| & 1 & |\Cotherwise{B}| & $\begin{array}{ll}\Cotherwise{1}\end{array}$\\\hline +% \end{cmtab} +% +% For instance, we could define the abstract value function on the reals with the following +% markup +% +% \begin{center} +% \begin{tabular}{|l|l|}\hline +% Semantic Markup & Formatted\\\hline +% \begin{minipage}{8cm}\footnotesize +% \begin{verbatim} +% \Ceq{\Cabs{x}, +% \Cpiecewise{\Cpiece{\Cuminus{x}}{\Clt{x,0}} +% \Cpiece{0}{\Ceq{x,0}} +% \Cotherwise{x}}} +% \end{verbatim} +% \end{minipage} & +% $\Ceq{\Cabs{x},\Cpiecewise{\Cpiece{\Cuminus{x}}{\Clt{x,0}} +% \Cpiece{0}{\Ceq{x,0}} +% \Cotherwise{x}}}$ +% \\\hline +% \end{tabular} +% \end{center} +% +% \newpage +% \subsection{Elements for Arithmetic, Algebra, and Logic}\label{sec:arith} +% +% This section introduces the infrastructure for the basic arithmetic operators. The first +% set is very simple +% +% \DescribeMacro{\Cquotient}\DescribeMacro{\Cfactorial}\DescribeMacro{\Cdivide} +% \DescribeMacro{\Cminus}\DescribeMacro{\Cplus}\DescribeMacro{\Cpower} +% \DescribeMacro{\Crem}\DescribeMacro{\Ctimes}\DescribeMacro{\Croot} +% \begin{cmtab} +% |\Cquotient| & 2 & |\Cquotient{1}{2}| & $\Cquotient{1}{2}$\\\hline +% |\Cfactorial| & 1 & |\Cfactorial{7}| & $\Cfactorial{7}$\\\hline +% |\Cdivide| & 2 & |\Cdivide{1}{2}| & $\Cdivide{1}{2}$\\\hline +% |\Cminus| & 2 & |\Cminus{1}{2}| & $\Cminus{1}{2}$\\\hline +% |\Cplus| & 1 & |\Cplus{1}| & $\Cplus{1}$\\\hline +% |\Cpower| & 2 & |\Cpower{x}{2}| & $\Cpower{x}{2}$\\\hline +% |\Crem| & 2 & |\Crem{7}{2}| & $\Crem{7}{2}$\\\hline +% |\Ctimes| & 1 & |\Ctimes{1,2,3,4}| & $\Ctimes{1,2,3,4}$\\\hline +% |\Croot| & 2 & |\Croot{3}{2}| & $\Croot{3}{2}$\\\hline +% \end{cmtab} +% +% The second batch below is sligtly more complicated, since they take a set of +% arguments. In the |cmathml| package, we treat them like {\index*{associative}} +% operators, i.e. they act on a single argument that contains a sequence of +% comma-separated arguments\ednote{implement this in the latexml side} +% +% \DescribeMacro{\Cmax}\DescribeMacro{\Cmin}\DescribeMacro{\Cgcd}\DescribeMacro{\Clcm} +% \begin{cmtab} +% |\Cmax| & 1 & |\Cmax{1,3,6}| & $\Cmax{1,3,6}$\\\hline +% |\Cmin| & 1 & |\Cmin{1,4,5}| & $\Cmin{1,4,7}$\\\hline +% |\Cgcd| & 1 & |\Cgcd{7,3,5}| & $\Cgcd{7,3,5}$\\\hline +% |\Clcm| & 1 & |\Clcm{3,5,4}| & $\Clcm{3,5,4}$\\\hline +% \end{cmtab} +% +% The operators for the logical connectives are associative as well\ednote{maybe add some +% precedences here.}. Here, conjunction, (exclusive) disjunction are $n$-ary associative +% operators, therefore their semantic macro only has one {\TeX} argument which contains a +% comma-separated list of subformulae. +% \DescribeMacro{\Cand}\DescribeMacro{\Cor}\DescribeMacro{\Cxor}\DescribeMacro{\Cnot} +% \DescribeMacro{\Cimplies} +% \begin{cmtab} +% |\Cand| & 1 & |\Cand{A,B,C}| & $\Cand{A,B,C}$\\\hline +% |\Cor| & 1 & |\Cor{A,B,C}| & $\Cor{A,B,C}$\\\hline +% |\Cxor| & 1 & |\Cxor{A,B,C}| & $\Cxor{A,B,C}$\\\hline +% |\Cnot| & 1 & |\Cnot{A}| & $\Cnot{A}$\\\hline +% |\Cimplies| & 2 & |\Cimplies{A}{B}| & $\Cimplies{A}{B}$\\\hline +% \end{cmtab} +% +% The following are the corresponding big operators, where appropriate. +% \DescribeMacro{\CAndDA}\DescribeMacro{\CAndCond} +% \DescribeMacro{\COrDA}\DescribeMacro{\COrCond} +% \DescribeMacro{\CXorDA}\DescribeMacro{\CXorCond} +% \begin{cmtab} +% |\CAndDA| & 2 & |\CAndDA\Cnaturalnumbers\phi| & $\CAndDA\Cnaturalnumbers\phi$\\\hline +% |\CAndCond| & 3 & |\CAndCond{x}{\Cgt{x}5}{\psi(x)}| +% & $\CAndCond{x}{\Cgt{x}5}{\psi(x)}$\\\hline +% |\COrDA| & 2 & |\COrDA\Cnaturalnumbers\phi| & $\COrDa\Cnaturalnumbers\phi$\\\hline +% |\COrCond| & 3 & |\COrCond{x}{\Cgt{x}5}{\psi(x)}| +% & $\COrCond{x}{\Cgt{x}5}{\psi(x)}$\\\hline +% |\CXorDA| & 2 & |\CXorDA\Cnaturalnumbers\phi| & $\CXorDA\Cnaturalnumbers\phi$\\\hline +% |\CXorCond| & 3 & |\CXorCond{x}{\Cgt{x}5}{\psi(x)}| +% & $\CXorCond{x}{\Cgt{x}5}{\psi(x)}$\\\hline +% \end{cmtab} +% +% The semantic macros for the quantifiers come in two forms: with- and without a condition +% qualifier. In a restricted quantification of the form $\forall x,C:A$, the bound variable +% $x$ ranges over all values, such that $C$ holds ($x$ will usually occur in the condition +% $C$). In an unrestricted quantification of the form $\forall x:A$, the bound variable +% ranges over all possible values for $x$. +% \DescribeMacro{\Cforall}\DescribeMacro{\CforallCond} +% \DescribeMacro{\Cexists}\DescribeMacro{\CexistsCond} +% \begin{cmtab} +% |\Cforall| & 2 & |\Cforall{x,y}{A}| & $\Cforall{x,y}{A}$\\\hline +% |\CforallCond| & 3 & |\CforallCond{x}{C}{A}| & $\CforallCond{x}{C}{A}$\\\hline +% |\Cexists| & 2 & |\Cexists{x,y}{A}| & $\Cexists{x,y}{A}$\\\hline +% |\CexistsCond| & 3 & |\CexistsCond{x}{C}{A}| & $\CexistsCond{x}{C}{A}$\\\hline +% \end{cmtab} +% +% The rest of the operators are very simple in structure. +% \DescribeMacro{\Cabs}\DescribeMacro{\Cconjugate}\DescribeMacro{\Carg} +% \DescribeMacro{\Creal}\DescribeMacro{\Cimaginary}\DescribeMacro{\Cfloor} +% \DescribeMacro{\Cceiling} +% \begin{cmtab} +% |\Cabs| & 1 & |\Cabs{x}| & $\Cabs{x}$\\\hline +% |\Cconjugate| & 1 & |\Cconjugate{x}| & $\Cconjugate{x}$\\\hline +% |\Carg| & 1 & |\Carg{x}| & $\Carg{x}$\\\hline +% |\Creal| & 1 & |\Creal{x}| & $\Creal{x}$\\\hline +% |\Cimaginary| & 1 & |\Cimaginary{x}| & $\Cimaginary{x}$\\\hline +% |\Cfloor| & 1 & |\Cfloor{1.3}| & $\Cfloor{1.3}$\\\hline +% |\Cceiling| & 1 & |\Cceiling{x}| & $\Cceiling{x}$\\\hline +% \end{cmtab} +% +% \subsection{Relations}\label{sec:rels} +% +% The relation symbols in {\mathml} are mostly $n$-ary associative operators (taking a +% comma-separated list as an argument). +% +% \DescribeMacro{\Ceq}\DescribeMacro{\Cneq}\DescribeMacro{\Cgt}\DescribeMacro{\Clt} +% \DescribeMacro{\Cgeq}\DescribeMacro{\Cleq}\DescribeMacro{\Cequivalent} +% \DescribeMacro{\Capprox}\DescribeMacro{\Cfactorof} +% \begin{cmtab} +% |\Ceq| & 1 & |\CeqA,B,C| & $\Ceq{A,B,C}$\\\hline +% |\Cneq| & 2 & |\Cneq{1}{2}| & $\Cneq{1}{2}$\\\hline +% |\Cgt| & 1 & |\Cgt{A,B,C}| & $\Cgt{A,B,C}$\\\hline +% |\Clt| & 1 & |\Clt{A,B,C}| & $\Clt{A,B,C}$\\\hline +% |\Cgeq| & 1 & |\Cgeq{A,B,C}| & $\Cgeq{A,B,C}$\\\hline +% |\Cleq| & 1 & |\Cleq{A,B,C}| & $\Cleq{A,B,C}$\\\hline +% |\Cequivalent| & 1 & |\Cequivalent{A,B,C}| & $\Cequivalent{A,B,C}$\\\hline +% |\Capprox| & 2 & |\Capprox{1}{2}| & $\Capprox{1}{1.1}$\\\hline +% |\Cfactorof| & 2 & |\Cfactorof{7}{21}| & $\Cfactorof{7}{21}$\\\hline +% \end{cmtab} +% +% \subsection{Elements for Calculus and Vector Calculus}\label{sec:calculus-vector-calculus} +% +% The elements for calculus and vector calculus have the most varied forms. +% +% The integrals come in four forms: the first one is just an indefinite integral over a +% function, the second one specifies the bound variables, upper and lower limits. The +% third one specifies a set instead of an interval, and finally the last specifies a +% bound variable that ranges over a set specified by a condition. +% +% \DescribeMacro{\Cint}\DescribeMacro{\CintLimits}\DescribeMacro{\CintDA}\DescribeMacro{\CintCond} +% \begin{cmtab} +% |\Cint| & 1 & |\Cint{f}| & $\Cint{f}$\\\hline +% |\CintLimits| & 4 & |\CintLimits{x}{0}{\Cinfinit}{f(x)}| +% & $\CintLimits{x}{0}{\infty}{f(x)}$\\\hline +% |\CintDA| & 2 & |\CintDA{\Creals}{f}| +% & $\CintDA{\mathbb{R}}{f}$\\\hline +% |\CintCond| & 3 & |\CintCond{x}{\Cin{x}{D}}{f(x)}| +% & $\CintCond{x}{x\in D}{f(x)}$\\\hline +% \end{cmtab} +% +% \DescribeMacro{\Cdiff}\DescribeMacro{\Cddiff} The differentiation operators are used in +% the usual way: simple differentiation is represented by the |\Cdiff| macro which takes +% the function to be differentiated as an argument, differentiation with the $d$-notation +% is possible by the |\Cddiff|, which takes the bound varible\ednote{really only one?} as +% the first argument and the function expression (in the bound variable) as a second +% argument. +% +% \DescribeMacro{\Cpartialdiff} Partial Differentiation is specified by the +% |\Cpartialdiff| macro. It takes the overall degree as the first argument (to leave it +% out, just pass the empty argument). The second argument is the list of bound variables +% (with their degrees; see below), and the last the function expression (in these bound +% variables). \DescribeMacro{\Cdegree} To specify the respective degrees of +% differentiation on the variables, we use the |\Cdegree| macro, which takes two arguments +% (but no optional argument), the first one is the degree (a natural number) and the +% second one takes the variable. Note that the overall degree has to be the sum of the +% degrees of the bound variables. +% +% \begin{pcmtab}[6cm] +% |\Cdiff| & 1 & |\Cdiff{f}| & $\Cdiff{f}$\\\hline +% |\Cddiff| & 2 & |\Cddiff{x}{f}| & $\Cddiff{x}{f}$\\\hline +% |\Cpartialdiff| & 3 & |\Cpartialdiff{3}{x,y,z}{f(x,y)}| +% & $\Cpartialdiff{3}{x,y,z}{f(x,y)}$\\\hline +% |\Cpartialdiff| & 3 & |\Cpartialdiff{7}| |{\Cdegree{2}{x},\Cdegree{4}{y},z}| |{f(x,y)}| +% & $\Cpartialdiff{7}{\Cdegree{2}{x},\Cdegree{4}{y},z}{f(x,y)}$\\\hline +% \end{pcmtab} +% +% \DescribeMacro{\Climit}\DescribeMacro{\ClimitCond} For content {\mathml}, there are two +% kinds of limit expressions: The simple one is specified by the |\Climit| macro, which +% takes three arguments: the bound variable, the target, and the limit expression. If we +% want to place additional conditions on the limit construction, then we use the +% |\ClimitCond| macro, which takes three arguments as well, the first one is a sequence of +% bound variables, the second one is the condition, and the third one is again the limit +% expression. +% +% \DescribeMacro{\Ctendsto}\DescribeMacro{\CtendstoAbove}\DescribeMacro{\CtendstoBelow} If +% we want to speak qualitatively about limit processes (e.g. in the condition of a +% |\ClimitCond| expression), then can use the {\mathml} {\element{tendsto}} element, which +% is represented by the |\Ctendsto| macro, wich takes two expressions arguments. In +% {\mathml}, the {\element{tendsto}} element can be further specialized by an attribute to +% indicate the direction from which a limit is approached. In the |cmathml| package, we +% supply two additional (specialized) macros for that: |\CtendstoAbove| and +% |\CtendstoBelow|. +% \begin{cmtab} +% |\Climit| & 3 & |\Climit{x}{0}{\Csin{x}}| & $\Climit{x}{0}{\Csin{x}}$\\\hline +% |\ClimitCond| & 3 & |\ClimitCond{x}{\Ctendsto{x}{0}}{\Ccos{x}}| +% & $\ClimitCond{x}{\Ctendsto{x}{0}}{\Ccos{x}}$\\\hline +% |\Ctendsto| & 2 & |\Ctendsto{f(x)}{2}| & $\Ctendsto{f(x)}{2}$\\\hline +% |\CtendstoAbove| & 2 & |\CtendstoAbove{x}{1}| & $\CtendstoAbove{x}{1}$\\\hline +% |\CtendstoBelow| & 2 & |\CtendstoBelow{x}{2}| & $\CtendstoBelow{x}{2}$\\\hline +% \end{cmtab} +% +% \DescribeMacro{\Cdivergence}\DescribeMacro{\Cgrad}\DescribeMacro{\Ccurl} +% \DescribeMacro{\Claplacian} +% \begin{cmtab} +% |\Cdivergence| & 1 & |\Cdivergence{A}| & $\Cdivergence{A}$\\\hline +% |\Cgrad| & 1 & |\Cgrad{\Phi}| & $\Cgrad{\Phi}$\\\hline +% |\Ccurl| & 1 & |\Ccurl{\Xi}| & $\Ccurl{\Xi}$\\\hline +% |\Claplacian| & 1 & |\Claplacian{A}| & $\Claplacian{A}$\\\hline +% \end{cmtab} +% +% \subsection{Sets and their Operations}\label{sec:sets} +% +% \DescribeMacro{\Cset}\DescribeMacro{\Clist} +% \DescribeMacro{\CsetDA}\DescribeMacro{\CsetRes}\DescribeMacro{\CsetCond} +% The |\Cset| macros is used as the simple finite set constructor, it takes one argument +% that is a comma-separated sequence of members of the set. |\CsetRes| allows to specify a +% set by restricting a set of variables, and |\CsetCond| is the general form of the set +% construction.\ednote{need to do this for lists as well? Probably} +% \begin{cmtab} +% |\Cset| & 1 & |\Cset{1,2,3}| & $\Cset{1,2,3}$\\\hline +% |\CsetRes| & 2 & |\CsetRes{x}{\Cgt{x}5}| +% & $\CsetRes{x}{\Cgt{x}5}$\\\hline +% |\CsetCond| & 3 & |\CsetCond{x}{\Cgt{x}5}{\Cpower{x}3}| +% & $\CsetCond{x}{\Cgt{x}5}{\Cpower{x}3}$\\\hline +% |\CsetDA| & 3 & |\CsetDA{x}{\Cgt{x}5}{S_x}}| +% & $\CsetDA{x}{\Cgt{x}5}{S_x}$\\\hline +% |\Clist| & 1 & |\Clist{3,2,1}| & $\Clist{3,2,1}$\\\hline +%\end{cmtab} +% +%\DescribeMacro{\Cunion}\DescribeMacro{\Cintersect}\DescribeMacro{\Ccartesianproduct} +% \DescribeMacro{\Csetdiff}\DescribeMacro{\Ccard}\DescribeMacro{\Cin}\DescribeMacro{\Cnotin} +% \begin{cmtab} +% |\Cunion| & 1 & |\Cunion{S,T,L}| & $\Cunion{S,T,L}$\\\hline +% |\Cintersect| & 1 & |\Cintersect{S,T,L}| & $\Cintersect{S,T,L}$\\\hline +% |\Ccartesianproduct| & 1 & |\Ccartesianproduct{A,B,C}| & $\Ccartesianproduct{A,B,C}$\\\hline +% |\Csetdiff| & 2 & |\Csetdiff{S}{L}| & $\Csetdiff{S}{L}$\\\hline +% |\Ccard| & 1 & |\Ccard{\Cnaturalnumbers}| & $\Ccard{\mathbb{N}}$\\\hline +% |\Cin| & 2 & |\Cin{a}{S}| & $\Cin{a}{S}$\\\hline +% |\Cnotin| & 2 & |\Cnotin{b}{S}| & $\Cnotin{b}{S}$\\\hline +%\end{cmtab} +% +% The following are the corresponding big operators for the first three binary ACI +% functions. \DescribeMacro{\CUnionDA}\DescribeMacro{\CUnionCond} +% \DescribeMacro{\CIntersectDA}\DescribeMacro{\CIntersectCond} +% \DescribeMacro{\CCartesianproductDA}\DescribeMacro{\CCartesianproductCond} +% \begin{cmtab} +% |\CUnionDA| & 2 & |\CUnionDA\Cnaturalnumbers{S_i}| +% & $\CUnionDA\Cnaturalnumbers{S_i}$\\\hline +% |\CUnionCond| & 3 & |\CUnionCond{x}{\Cgt{x}5}{S_x}}| +% & $\CUnionCond{x}{\Cgt{x}5}{S_x}$\\\hline +% |\CIntersectDA| & 2 & |\CIntersectDA\Cnaturalnumbers{S_i}| +% & $\CIntersectDa\Cnaturalnumbers{S_i}$\\\hline +% |\CIntersectCond| & 3 & |\CIntersectCond{x}{\Cgt{x}5}{S_x}| +% & $\CIntersectCond{x}{\Cgt{x}5}{S_x}$\\\hline +% |\CCartesianproductDA| & 2 & |\CCartesianproductDA\Cnaturalnumbers{S_i}| +% & $\CCartesianproductDA\Cnaturalnumbers{S_i}$\\\hline +% |\CCartesianproductCond| & 3 & |\CCartesianproductCond{x}{\Cgt{x}5}{S_x}| +% & $\CCartesianproductCond{x}{\Cgt{x}5}{S_x}$\\\hline +% \end{cmtab} +% +% \DescribeMacro{\Csubset}\DescribeMacro{\Cprsubset} +% \DescribeMacro{\Cnotsubset}\DescribeMacro{\Cnotprsubset} For the set containment +% relations, we are in a somewhat peculiar situation: content {\mathml} only supplies the +% subset side of the reations and leaves out the superset relations. Of course they are +% not strictly needed, since they can be expressed in terms of the subset relation with +% reversed argument order. But for the |cmathml| package, the macros have a presentational +% side (for the {\LaTeX} workflow) and a content side (for the {\latexml} converter) +% therefore we will need macros for both relations. +% +% \begin{cmtab} +% |\Csubset| & 1 & |\Csubset{S,T,K}| & $\Csubset{S,T,K}$\\\hline +% |\Cprsubset| & 1 & |\Cprsubset{S,T,K}| & $\Cprsubset{S,T,K}$\\\hline +% |\Cnotsubset| & 2 & |\Cnotsubset{S}{K}| & $\Cnotsubset{S}{K}$\\\hline +% |\Cnotprsubset| & 2 & |\Cnotprsubset{S}{L}| & $\Cnotprsubset{S}{L}$\\\hline +% \end{cmtab} +% \DescribeMacro{\Csupset}\DescribeMacro{\Cprsupset} +% \DescribeMacro{\Cnotsupset}\DescribeMacro{\Cnotprsupset} +% The following set of macros are presented in {\LaTeX} as their name suggests, but upon +% transformation will generate content markup with the {\mathml} elements (i.e. in terms +% of the subset relation). +% +% \begin{cmtab} +% |\Csupset| & 1 & |\Csupset{S,T,K}| & $\Csupset{S,T,K}$\\\hline +% |\Cprsupset| & 1 & |\Cprsupset{S,T,K}| & $\Cprsupset{S,T,K}$\\\hline +% |\Cnotsupset| & 2 & |\Cnotsupset{S}{K}| & $\Cnotsupset{S}{K}$\\\hline +% |\Cnotprsupset| & 2 & |\Cnotprsupset{S}{L}| & $\Cnotprsupset{S}{L}$\\\hline +% \end{cmtab} +% +% \subsection{Sequences and Series}\label{sec:sequences} +% +% \DescribeMacro{\CsumLimits}\DescribeMacro{\CsumCond}\DescribeMacro{\CsumDA} +% \DescribeMacro{\CprodLimist}\DescribeMacro{\CprodCond}\DescribeMacro{\CprodDA} +% \begin{cmtab} +% |\CsumLimits| & 4 & |\CsumLimits{i}{0}{50}{x^i}| & $\CsumLimits{i}{0}{50}{x^i}$\\\hline +% |\CsumCond| & 3 & |\CsumCond{i}{\Cintegers}{i}| & $\CsumCond{i}{\mathbb{Z}}{i}$\\\hline +% |\CsumDA| & 2 & |\CsumDA{\Cintegers}{f}| & $\CsumDA{\mathbb{Z}}{f}$\\\hline +% |\CprodLimits| & 4 & |\CprodLimits{i}{0}{20}{x^i}| & $\CprodLimits{i}{0}{20}{x^i}$\\\hline +% |\CprodCond| & 3 & |\CprodCond{i}{\Cintegers}{i}| & $\CprodCond{i}{\mathbb{Z}}{i}$\\\hline +% |\CprodDA| & 2 & |\CprodDA{\Cintegers}{f}| & $\CprodDA{\mathbb{Z}}{f}$\\\hline +% \end{cmtab} +% +% \subsection{Elementary Classical Functions}\label{sec:specfun} +% +% \DescribeMacro{\Csin}\DescribeMacro{\Ccos}\DescribeMacro{\Ctan} +% \DescribeMacro{\Csec}\DescribeMacro{\Ccsc}\DescribeMacro{\Ccot} +% \begin{cmtab} +% |\Csin| & 1 & |\Csin{x}| & $\Csin{x}$\\\hline +% |\Ccos| & 1 & |\Ccos{x}| & $\Ccos{x}$\\\hline +% |\Ctan| & 1 & |\Ctan{x}| & $\Ctan{x}$\\\hline +% |\Csec| & 1 & |\Csec{x}| & $\Csec{x}$\\\hline +% |\Ccsc| & 1 & |\Ccsc{x}| & $\Ccsc{x}$\\\hline +% |\Ccot| & 1 & |\Ccot{x}| & $\Ccot{x}$\\\hline +% \end{cmtab} +% +% \DescribeMacro{\Csinh}\DescribeMacro{\Ccosh}\DescribeMacro{\Ctanh} +% \DescribeMacro{\Csech}\DescribeMacro{\Ccsch}\DescribeMacro{\Ccoth} +% \begin{cmtab} +% |\Csinh| & 1 & |\Csinh{x}| & $\Csinh{x}$\\\hline +% |\Ccosh| & 1 & |\Ccosh{x}| & $\Ccosh{x}$\\\hline +% |\Ctanh| & 1 & |\Ctanh{x}| & $\Ctanh{x}$\\\hline +% |\Csech| & 1 & |\Csech{x}| & $\Csech{x}$\\\hline +% |\Ccsch| & 1 & |\Ccsch{x}| & $\Ccsch{x}$\\\hline +% |\Ccoth| & 1 & |\Ccoth{x}| & $\Ccoth{x}$\\\hline +% \end{cmtab} +% +% \DescribeMacro{\Carcsin}\DescribeMacro{\Carccos}\DescribeMacro{\Carctan} +% \DescribeMacro{\Carcsec}\DescribeMacro{\Carccsc}\DescribeMacro{\Carccot} +% \begin{cmtab} +% |\Carcsin| & 1 & |\Carcsin{x}| & $\Carcsin{x}$\\\hline +% |\Carccos| & 1 & |\Carccos{x}| & $\Carccos{x}$\\\hline +% |\Carctan| & 1 & |\Carctan{x}| & $\Carctan{x}$\\\hline +% |\Carccosh| & 1 & |\Carccosh{x}| & $\Carccosh{x}$\\\hline +% |\Carccot| & 1 & |\Carccot{x}| & $\Carccot{x}$\\\hline +% \end{cmtab} +% +% \DescribeMacro{\Carcsinh}\DescribeMacro{\Carccosh}\DescribeMacro{\Carctanh} +% \DescribeMacro{\Carcsech}\DescribeMacro{\Carccsch}\DescribeMacro{\Carccoth} +% \begin{cmtab} +% |\Carccoth| & 1 & |\Carccoth{x}| & $\Carccoth{x}$\\\hline +% |\Carccsc| & 1 & |\Carccsc{x}| & $\Carccsc{x}$\\\hline +% |\Carcsinh| & 1 & |\Carcsinh{x}| & $\Carcsinh{x}$\\\hline +% |\Carctanh| & 1 & |\Carctanh{x}| & $\Carctanh{x}$\\\hline +% |\Cexp| & 1 & |\Cexp{x}| & $\Cexp{x}$\\\hline +% |\Cln| & 1 & |\Cln{x}| & $\Cln{x}$\\\hline +% |\Clog| & 2 & |\Clog{5}{x}| & $\Clog{5}{x}$\\\hline +% \end{cmtab} +% +% \subsection{Statistics}\label{sec:statistics} +% +% The only semantic macro that is non-standard in this module is the one for the +% {\element{moment}} and {\element{momentabout}} elements in {\mathml}. They are combined +% into the semantic macro {|CmomentA|}; its first argument is the degree, its +% second one the point in the distribution, the moment is taken about, and the third is +% the distribution. +% +% \DescribeMacro{\Cmean}\DescribeMacro{\Csdev}\DescribeMacro{\Cvar}\DescribeMacro{\Cmedian} +% \DescribeMacro{\Cmode}\DescribeMacro{\Cmoment}\DescribeMacro{\CmomentA} +% \begin{cmtab} +% |\Cmean| & 1 & |\Cmean{X}| & $\Cmean{X}$\\\hline +% |\Csdev| & 1 & |\Csdev{X}| & $\Csdev{X}$\\\hline +% |\Cvar| & 1 & |\Cvar{X}| & $\Cvar{X}$\\\hline +% |\Cmedian| & 1 & |\Cmedian{X}| & $\Cmedian{X}$\\\hline +% |\Cmode| & 1 & |\Cmode{X}| & $\Cmode{X}$\\\hline +% |\Cmoment| & 3 & |\Cmoment{3}{X}| & $\Cmoment{3}{X}$\\\hline +% |\CmomentA| & 3 & |\CmomentA{3}{p}{X}| & $\CmomentA{3}{p}{X}$\\\hline +% \end{cmtab} +% +% \subsection{Linear Algebra}\label{sec:linalg} +% +% In these semantic macros, only the matrix constructor is unusual; instead of +% constructing a matrix from {\element{matrixrow}} elements like {\mathml} does, the macro +% follows the {\TeX/\LaTeX} tradition allows to give a matrix as an array. The first +% argument of the macro is the column specification (it will only be used for presentation +% purposes), and the second one the rows. +% +% \DescribeMacro{\Cvector}\DescribeMacro{\Cmatrix}\DescribeMacro{\Cdeterminant} +% \DescribeMacro{\Ctranspose}\DescribeMacro{\Cselector} +% \DescribeMacro{\Cvectorproduct}\DescribeMacro{\Cscalarproduct}\DescribeMacro{\Couterproduct} +% \begin{cmtab} +% |\Cvector| & 1 & |\Cvector{1,2,3}| & $\Cvector{1,2,3}$\\\hline +% |\Cmatrix| & 2 & |\Cmatrix{ll}{1 & 2\\ 3 & 4}| & $\Cmatrix{ll}{1 & 2\\3 & 4}$\\\hline +% |\Cdeterminant| & 1 & |\Cdeterminant{A}| & $\Cdeterminant{A}$\\\hline +% |\Ctranspose| & 1 & |\Ctranspose{A}| & $\Ctranspose{A}$\\\hline +% |\Cselector| & 2 & |\Cselector{A}{2}| & $\Cselector{A}{2}$\\\hline +% |\Cvectproduct| & 2 & |\Cvectproduct{\phi}{\psi}| & $\Cvectproduct{\phi}{\psi}$\\\hline +% |\Cscalarproduct| & 2 & |\Cscalarproduct{\phi}{\psi}| & $\Cscalarproduct{\phi}{\psi}$\\\hline +% |\Couterproduct| & 2 & |\Couterproduct{\phi}{\psi}| & $\Couterproduct{\phi}{\psi}$\\\hline +% \end{cmtab} +% +% \subsection{Constant and Symbol Elements}\label{sec:constants} +% +% The semantic macros for the {\mathml} constant and symbol elements are very simple, they +% do not take any arguments, and their name is just the {\mathml} element name prefixed by +% a capital C. +% +% \DescribeMacro{\Cintegers}\DescribeMacro{\Creals}\DescribeMacro{\Crationals} +% \DescribeMacro{\Ccomplexes}\DescribeMacro{\Cprimes} +% \begin{cmtab} +% |\Cintegers| & & |\Cintegers| & $\Cintegers$\\\hline +% |\Creals| & & |\Creals| & $\Creals$\\\hline +% |\Crationals| & & |\Crationals| & $\Crationals$\\\hline +% |\Cnaturalnumbers| & & |\Cnaturalnumbers| & $\Cnaturalnumbers$\\\hline +% |\Ccomplexes| & & |\Ccomplexes| & $\Ccomplexes$\\\hline +% |\Cprimes| & & |\Cprimes| & $\Cprimes$\\\hline +% \end{cmtab} +% +% \DescribeMacro{\Cexponentiale}\DescribeMacro{\Cimaginaryi} +% \DescribeMacro{\Ctrue}\DescribeMacro{\Cfalse} \DescribeMacro{\Cemptyset} +% \DescribeMacro{\Cpi}\DescribeMacro{\Ceulergamma}\DescribeMacro{\Cinfinit} +% \begin{cmtab} +% |\Cexponemtiale| & & |\Cexponemtiale| & $\Cexponemtiale$\\\hline +% |\Cimaginaryi| & & |\Cimaginaryi| & $\Cimaginaryi$\\\hline +% |\Cnotanumber| & & |\Cnotanumber| & $\Cnotanumber$\\\hline +% |\Ctrue| & & |\Ctrue| & $\Ctrue$\\\hline +% |\Cfalse| & & |\Cfalse| & $\Cfalse$\\\hline +% |\Cemptyset| & & |\Cemptyset| & $\Cemptyset$\\\hline +% |\Cpi| & & |\Cpi| & $\Cpi$\\\hline +% |\Ceulergamma| & & |\Ceulergamma| & $\Ceulergamma$\\\hline +% |\Cinfinit| & & |\Cinfinit| & $\Cinfinit$\\\hline +% \end{cmtab} +% +% \subsection{Extensions}\label{sec:cmathmlx} +% Content MathML does not (even though it claims to cover M-14 Math) symbols for all the +% common mathematical notions. The |cmathmlx| attempts to collect these and provide +% {\TeX/\LaTeX} and {\latexml} bindings. +% +%\DescribeMacro{\Ccomplement} +% \begin{cmtab} +% |\Ccomplement| & 1 & |\Ccomplement{\Cnaturalnumbers}| & $\Ccomplement{\mathbb{N}}$\\\hline +%\end{cmtab} +% +% \StopEventually{\ednotemessage} +% +% \newpage +% \section{The Implementation}\label{sec:impl} +% +% In this file we document both the implementation of the |cmathml| package, as well as +% the corresponding {\latexml} bindings. This keeps similar items close to each other, +% even though they eventually go into differing files and helps promote consistency. We +% specify which code fragment goes into which file by the {\xml}-like grouping commands: +% The code between |<*sty>| and |</sty>| goes into the package file |cmathml.sty|, and the +% code between |<*ltxml>| and |</ltxml>| goes into |cmathml.ltxml|, the {\latexml} +% bindings. +% +% \subsection{Initialization and auxiliary functions}\label{sec:impl:init} +% +% We first make sure that the {\sTeX} |presentation| package is loaded. +% \begin{macrocode} +%<*sty|styx> +\RequirePackage{presentation} +%</sty|styx> +% \end{macrocode} +% +% Before we start im plementing the {\mathml} macros, we will need to set up the packages +% for perl in the {\latexml} bindings file. +% \begin{macrocode} +%<*ltxml|ltxmlx> +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +use LaTeXML::Document; +RequirePackage('LaTeX'); +%</ltxml|ltxmlx> +% \end{macrocode} +% +% The next step is to itroduce two auxiliary functions, they are needed to work with +% $n$-ary function elements. The first one removes arbitrary tokens from a list, and the +% specializes that to commas. In particular |remove_tokens_from_list($List, $pattern, $math)| +% returns a new |List| (or |MathList| if |$math| is true) +% with all the tokens in |$List| except the ones which follow +% the pattern |$pattern|. +% +% \begin{macrocode} +%<*ltxml> +sub remove_tokens_from_list { + my ($list, $pattern, $math) = @_; + if (ref $list) { + my @toks = $list->unlist; + @toks = grep($_->toString !~ /$pattern/, @toks); + ($math ? (LaTeXML::MathList->new(@toks)) : (LaTeXML::List)->new(@toks)); } + else { undef; } } + +sub remove_math_commas { + my ($whatsit, $argno) = @_; + my @args = $whatsit ? $whatsit->getArgs() : undef; + $argno--; + if ($args[$argno]) { + $args[$argno] = remove_tokens_from_list($args[$argno], ',', 1); + $whatsit->setArgs(@args); + } + return; +} +%</ltxml> +% \end{macrocode} +% +% The structural macros are rather simple: +% +% \begin{macrocode} +%<*sty> +\newcommand{\Capply}[3][]{#2(#3)} +%</sty> +%<*ltxml> +DefConstructor('\Capply [] {} {}', + "<ltx:XMApp ?#1(definitionURL='#1')()>#2 #3</ltx:XMApp>"); +%</ltxml> +% after this, the implementation will always have the same form. We will first +% implement a block of {\LaTeX} macros via a |\newcommand| and then specify the +% corresponding {\latexml} bindings for them. +% +% \subsection{The Token Elements}\label{impl:tokens} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@cn#1{#1} +\newcommand{\Ccn}[2][]{\CMathML@cn{#2}} +\def\CMathML@ci#1{#1} +\newcommand{\Cci}[2][]{\CMathML@ci{#2}} +\def\CMathML@csymbol#1{#1} +\newcommand{\Ccsymbol}[2][]{\CMathML@csymbol{#2}} +%</sty> +%<*ltxml> +DefConstructor('\Ccn [] {}',"#2"); +DefConstructor('\Cci [] {}',"#2"); +DefConstructor('\Ccsymbol [] {}', + "<ltx:XMTok role='CSYMBOL' meaning='#2' ?#1(definitionURL='#1')()/>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{The Basic Elements}\label{impl:basic} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@ccinterval#1#2{[#1,#2]} +\newcommand{\Cccinterval}[3][]{\CMathML@ccinterval{#2}{#3}} +\def\CMathML@cointerval#1#2{[#1,#2)} +\newcommand{\Ccointerval}[3][]{\CMathML@cointerval{#2}{#3}} +\def\CMathML@ocinterval#1#2{(#1,#2]} +\newcommand{\Cocinterval}[3][]{\CMathML@ocinterval{#2}{#3}} +\def\CMathML@oointerval#1#2{(#1,#2)} +\newcommand{\Coointerval}[3][]{\CMathML@oointerval{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\Cccinterval [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='ccinterval' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg></ltx:XMApp>"); +DefConstructor('\Ccointerval [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='cointerval' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg></ltx:XMApp>"); +DefConstructor('\Cocinterval [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='ocinterval' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg></ltx:XMApp>"); +DefConstructor('\Coointerval [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='oointerval' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg></ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> +\newcommand{\Cinverse}[2][]{#2^{-1}} +% what about separator +%</sty> +%<*ltxml> +DefConstructor('\Cinverse [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='inverse' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@lambda#1#2{\lambda({#1},{#2})} +\newcommand{\Clambda}[3][]{\CMathML@lambda{#2}{#3}} +\def\CMathML@lambdaDA#1#2#3{\lambda({#1}\colon{#2},#3)} +\newcommand{\ClambdaDA}[4][]{\CMathML@lambdaDA{#2}{#3}{#4}} +\def\CMathML@restrict#1#2{\left.#1\right|_{#2}} +\newcommand{\Crestrict}[3][]{\CMathML@restrict{#2}{#3}} +%</sty> +%\ednote{need do deal with multiple variables!} +%<*ltxml> +DefConstructor('\Clambda [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='lambda' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\ClambdaDA [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='lambda' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Crestrict [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='restrict' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> + \def\CMathML@composeOp{\circ} + \newcommand{\CcomposeOp}{\CMathML@composeOp} +\def\CMathML@compose#1{\assoc[p=500,pi=500]{\CMathML@composeOp}{#1}} +\newcommand{\Ccompose}[2][]{\CMathML@compose{#2}} +\def\CMathML@ident#1{\mathrm{id}} +\newcommand{\Cident}[1][]{\CMathML@ident{#1}} +\def\CMathML@domain#1{\mbox{dom}(#1)} +\newcommand{\Cdomain}[2][]{\CMathML@domain{#2}} +\def\CMathML@codomain#1{\mbox{codom}(#1)} +\newcommand{\Ccodomain}[2][]{\CMathML@codomain{#2}} +\def\CMathML@image#1{{\mathbf{Im}}(#1)} +\newcommand{\Cimage}[2][]{\CMathML@image{#2}} +\def\CMathML@piecewise#1{\left\{\begin{array}{ll}#1\end{array}\right.} +\newcommand{\Cpiecewise}[2][]{\CMathML@piecewise{#2}} +\def\CMathML@piece#1#2{#1&{\mathrm{if}}\;{#2}\\} +\newcommand{\Cpiece}[3][]{\CMathML@piece{#2}{#3}} +\def\CMathML@otherwise#1{#1&else\\} +\newcommand{\Cotherwise}[2][]{\CMathML@otherwise{#2}} +%</sty> +%<*ltxml> +DefConstructor('\CcomposeOp []', + "<ltx:XMTok meaning='compose' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ccompose [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='MULOP' meaning='compose' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\Cident []', + "<ltx:XMTok meaning='ident' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cdomain [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='domain' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccodomain [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='codomain' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cimage [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='image' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cpiecewise [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='piecewise' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cpiece [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='piece' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cotherwise [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='otherwise' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{Elements for Arithmetic, Algebra, and Logic}\label{impl:arith} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@quotient#1#2{\frac{#1}{#2}} +\newcommand{\Cquotient}[3][]{\CMathML@quotient{#2}{#3}} + \def\CMathML@factorialOp{!} + \newcommand{\CfactorialOp}{\CMathML@factorialOp} +\def\CMathML@factorial#1{#1{\CMathML@factorialOp}} +\newcommand{\Cfactorial}[2][]{\CMathML@factorial{#2}} + \def\CMathML@divideOp{\div} + \newcommand{\CdivideOp}{\CMathML@divideOp} +\def\CMathML@divide#1#2{\infix[p=400]{\CMathML@divideOp}{#1}{#2}} +\newcommand{\Cdivide}[3][]{\CMathML@divide{#2}{#3}} + \def\CMathML@maxOp{\mathrm{max}} + \newcommand{\CmaxOp}{\CMathML@maxOp} +\def\CMathML@max#1{{\CMathML@maxOp}(#1)} +\newcommand{\Cmax}[2][]{\CMathML@max{#2}} + \def\CMathML@minOp{\mathrm{min}} + \newcommand{\CminOp}{\CMathML@minOp} +\def\CMathML@min#1{{\CMathML@minOp}(#1)} +\newcommand{\Cmin}[2][]{\CMathML@min{#2}} + \def\CMathML@minusOp{-} + \newcommand{\CminusOp}{\CMathML@minusOp} +\def\CMathML@minus#1#2{\infix[p=500]{\CMathML@minusOp}{#1}{#2}} +\newcommand{\Cminus}[3][]{\CMathML@minus{#2}{#3}} +\def\CMathML@uminus#1{\prefix[p=200]{\CMathML@minusOp}{#1}} +\newcommand{\Cuminus}[2][]{\CMathML@uminus{#2}} + \def\CMathML@plusOp{+} + \newcommand{\CplusOp}{\CMathML@plusOp} +\def\CMathML@plus#1{\assoc[p=500]{\CMathML@plusOp}{#1}} +\newcommand{\Cplus}[2][]{\CMathML@plus{#2}} +\def\CMathML@power#1#2{\infix[p=200]{^}{#1}{#2}} +\newcommand{\Cpower}[3][]{\CMathML@power{#2}{#3}} + \def\CMathML@remOp{\bmod} + \newcommand{\CremOp}{\CMathML@remOp} +\def\CMathML@rem#1#2{#1 \CMathML@remOp #2} +\newcommand{\Crem}[3][]{\CMathML@rem{#2}{#3}} + \def\CMathML@timesOp{\cdot} + \newcommand{\CtimesOp}{\CMathML@timesOp} +\def\CMathML@times#1{\assoc[p=400]{\CMathML@timesOp}{#1}} +\newcommand{\Ctimes}[2][]{\CMathML@times{#2}} + \def\CMathML@rootOp{\sqrt} + \newcommand{\CrootOp}{\CMathML@rootOp{}} +\def\CMathML@root#1#2{\CMathML@rootOp[#1]{#2}} +\newcommand{\Croot}[3][]{\CMathML@root{#2}{#3}} +\def\CMathML@gcd#1{\gcd(#1)} +\newcommand{\Cgcd}[2][]{\CMathML@gcd{#2}} + \def\CMathML@andOp{\wedge} + \newcommand{\CandOp}{\CMathML@andOp} +\def\CMathML@and#1{\assoc[p=400]{\CMathML@andOp}{#1}} +\newcommand{\Cand}[2][]{\CMathML@and{#2}} + \def\CMathML@orOp{\vee} + \newcommand{\CorOp}{\CMathML@orOp} +\def\CMathML@or#1{\assoc[p=500]{\CMathML@orOp}{#1}} +\newcommand{\Cor}[2][]{\CMathML@or{#2}} + \def\CMathML@xorOp{\oplus} + \newcommand{\CxorOp}{\CMathML@xorOp} +\def\CMathML@xor#1{\assoc[p=400]{\CMathML@xorOp}{#1}} +\newcommand{\Cxor}[2][]{\CMathML@xor{#2}} + \def\CMathML@notOp{\neg} + \newcommand{\CnotOp}{\CMathML@notOp} +\def\CMathML@not#1{\CMathML@notOp{#1}} +\newcommand{\Cnot}[2][]{\CMathML@not{#2}} + \def\CMathML@impliesOp{\Longrightarrow} + \newcommand{\CimpliesOp}{\CMathML@impliesOp} +\def\CMathML@implies#1#2{#1\CMathML@impliesOp{#2}} +\newcommand{\Cimplies}[3][]{\CMathML@implies{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\Cquotient [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='quotient' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CfactorialOp []', + "<ltx:XMTok meaning='factorial' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cfactorial [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='factorial' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CdivideOp []', + "<ltx:XMTok meaning='divide' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cdivide [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='divide' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CmaxOp []', + "<ltx:XMTok meaning='max' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cmax [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='max' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CminOp []', + "<ltx:XMTok meaning='min' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cmin [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='min' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CminusOp []', + "<ltx:XMTok meaning='minus' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cminus [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='ADDOP' meaning='minus' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cuminus [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='uminus' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CplusOp []', + "<ltx:XMTok meaning='plus' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cplus [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='ADDOP' meaning='plus' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\Cpower [] {} {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='power' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CremOp []', + "<ltx:XMTok meaning='rem' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Crem [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='rem' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CtimesOp []', + "<ltx:XMTok meaning='times' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ctimes [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='MULOP' meaning='times' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CrootOp []', + "<ltx:XMTok meaning='root' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Croot [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='root' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cgcd [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='gcd' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CandOp []', + "<ltx:XMTok meaning='and' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cand [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='and' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CorOp []', + "<ltx:XMTok meaning='or' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cor [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='or' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CxorOp []', + "<ltx:XMTok meaning='xor' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cxor [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='xor' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CnotOp []', + "<ltx:XMTok meaning='not' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnot [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='not' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CimpliesOp []', + "<ltx:XMTok meaning='implies' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cimplies [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='implies' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% \ednote{need to do something about the associative things in ltxml} +% \begin{macrocode} +%<*sty> +\def\CMathML@AndDA#1#2{\bigwedge_{#1}{#2}} % set, scope +\newcommand{\CAndDA}[3][]{\CMathML@AndDA{#2}{#3}} +\def\CMathML@AndCond#1#2#3{\bigwedge_{#2}{#3}} % bvars,condition, scope +\newcommand{\CAndCond}[4][]{\CMathML@AndCond{#2}{#2}{#3}} +\def\CMathML@OrDA#1#2{\bigvee_{#1}{#2}} % set, scope +\newcommand{\COrDa}[3][]{\CMathML@OrDA{#2}{#3}} +\def\CMathML@OrCond#1#2#3{\bigvee_{#2}{#3}}% bvars,condition, scope +\newcommand{\COrCond}[4][]{\CMathML@OrCond{#2}{#3}{#4}} +\def\CMathML@XorDA#1#2{\bigoplus_{#1}{#2}} % set, scope +\newcommand{\CXorDA}[3][]{\CMathML@XorDA{#2}{#3}} +\def\CMathML@XorCond#1#2#3{\bigoplus_{#2}{#3}}% bvars,condition, scope +\newcommand{\CXorCond}[4][]{\CMathML@XorCond{#2}{#3}{#4}} +% +\def\CMathML@forall#1#2{\forall{#1}\colon{#2}} +\newcommand{\Cforall}[3][]{\CMathML@forall{#2}{#3}} +\def\CMathML@forallCond#1#2#3{\forall{#1},{#2}\colon{#3}} % list), condition, scope +\newcommand{\CforallCond}[4][]{\CMathML@forallCond{#2}{#3}{#4}} +%</sty> +%<*ltxml> +DefConstructor('\CAndDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='and' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CAndCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='and' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\COrDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='or' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\COrCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='or' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CXorDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='xor' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CXorCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='xor' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cforall [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='forall' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CforallCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='forall' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@exists#1#2{\exists{#1}\colon{#2}} +\newcommand{\Cexists}[3][]{\CMathML@exists{#2}{#3}} +\def\CMathML@esistsCont#1#2#3{\exists{#1},{#2}\colon{#3}} +\newcommand{\CexistsCond}[4][]{\CMathML@esistsCont{#2}{#3}{#4}} +%</sty> +%<*ltxml> +DefConstructor('\Cexists [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='exists' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CexistsCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='exists' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@abs#1{\left|#1\right|} +\newcommand{\Cabs}[2][]{\CMathML@abs{#2}} +\def\CMathML@conjugate#1{\overline{#1}} +\newcommand{\Cconjugate}[2][]{\CMathML@conjugate{#2}} +\def\CMathML@arg#1{\angle #1} +\newcommand{\Carg}[2][]{\CMathML@arg{#2}} +\def\CMathML@real#1{\Re #1} +\newcommand{\Creal}[2][]{\CMathML@real{#2}} +\def\CMathML@imaginary#1{\Im #1} +\newcommand{\Cimaginary}[2][]{\CMathML@imaginary{#2}} +\def\CMathML@lcm#1{\mbox{lcm}(#1)} +\newcommand{\Clcm}[2][]{\CMathML@lcm{#2}} +\def\CMathML@floor#1{\left\lfloor{#1}\right\rfloor} +\newcommand{\Cfloor}[2][]{\CMathML@floor{#2}} +\def\CMathML@ceiling#1{\left\lceil{#1}\right\rceil} +\newcommand{\Cceiling}[2][]{\CMathML@ceiling{#2}} +%</sty> +%<*ltxml> +DefConstructor('\Cabs [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='abs' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cconjugate [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='conjugate' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carg [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='arg' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Creal [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='real' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cimaginary [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='imaginary' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Clcm [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='lcm' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cfloor [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='floor' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cceiling [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='ceiling' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{Relations}\label{impl:rels} +% +% \begin{macrocode} +%<*sty> + \def\CMathML@eqOp{=} + \newcommand{\CeqOp}{\CMathML@eqOp} +\def\CMathML@eq#1{\assoc[p=700]{\CMathML@eqOp}{#1}} +\newcommand{\Ceq}[2][]{\CMathML@eq{#2}} + \def\CMathML@neqOp{\neq} + \newcommand{\CneqOp}{\CMathML@neqOp} +\def\CMathML@neq#1#2{\infix[p=700]{\CMathML@neqOp}{#1}{#2}} +\newcommand{\Cneq}[3][]{\CMathML@neq{#2}{#3}} + \def\CMathML@gtOp{>} + \newcommand{\CgtOp}{\CMathML@gtOp} +\def\CMathML@gt#1{\assoc[p=700]{\CMathML@gtOp}{#1}} +\newcommand{\Cgt}[2][]{\CMathML@gt{#2}} + \def\CMathML@ltOp{<} + \newcommand{\CltOp}{\CMathML@ltOp} +\def\CMathML@lt#1{\assoc[p=700]{\CMathML@ltOp}{#1}} +\newcommand{\Clt}[2][]{\CMathML@lt{#2}} + \def\CMathML@geqOp{\geq} + \newcommand{\CgeqOp}{\CMathML@geqOp} +\def\CMathML@geq#1{\assoc[p=700]{\CMathML@geqOp}{#1}} +\newcommand{\Cgeq}[2][]{\CMathML@geq{#2}} + \def\CMathML@leqOp{\leq} + \newcommand{\CleqOp}{\CMathML@leqOp} +\def\CMathML@leq#1{\assoc[p=700]{\CMathML@leqOp}{#1}} +\newcommand{\Cleq}[2][]{\CMathML@leq{#2}} + \def\CMathML@equivalentOp{\equiv} + \newcommand{\CequivalentOp}{\CMathML@equivalentOp} +\def\CMathML@equivalent#1{\assoc[p=700]{\CMathML@equivalentOp}{#1}} +\newcommand{\Cequivalent}[2][]{\CMathML@equivalent{#2}} + \def\CMathML@approxOp{\approx} + \newcommand{\CapproxOp}{\CMathML@approxOp} +\def\CMathML@approx#1#2{#1\CMathML@approxOp{#2}} +\newcommand{\Capprox}[3][]{\CMathML@approx{#2}{#3}} + \def\CMathML@factorofOp{\mid} + \newcommand{\CfactorofOp}{\CMathML@factorofOp} +\def\CMathML@factorof#1#2{#1\CMathML@factorofOp{#2}} +\newcommand{\Cfactorof}[3][]{\CMathML@factorof{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\CeqOp []', + "<ltx:XMTok meaning='eq' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ceq [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='eq' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CneqOp []', + "<ltx:XMTok meaning='neq' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cneq [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='neq' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CgtOp []', + "<ltx:XMTok meaning='gt' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cgt [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='gt' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CltOp []', + "<ltx:XMTok meaning='lt' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Clt [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='lt' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CgeqOp []', + "<ltx:XMTok meaning='geq' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cgeq [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='geq' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CleqOp []', + "<ltx:XMTok meaning='leq' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cleq [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='leq' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CequivalentOp []', + "<ltx:XMTok meaning='equivalent' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cequivalent [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='equivalent' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>"); +DefConstructor('\CapproxOp []', + "<ltx:XMTok meaning='approx' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Capprox [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='approx' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CfactorofOp []', + "<ltx:XMTok meaning='factorof' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cfactorof [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='factorof' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> + + \def\CMathML@intOp{\int} + \newcommand{\CintOp}{\CMathML@intOp} +\def\CMathML@int#1{\CMathML@intOp{#1}} +\newcommand{\Cint}[2][]{\CMathML@int{#2}} +\def\CMathML@intLimits#1#2#3#4{\CMathML@intOp_{#2}^{#3}{#4}d{#1}} %bvars,llimit, ulimit,body +\newcommand{\CintLimits}[5][]{\CMathML@intLimits{#2}{#3}{#4}{#5}} +\def\CMathML@intSet#1#2{\CMathML@intOp_{#1}{#2}}% set,function +\newcommand{\CintDA}[3][]{\CMathML@intSet{#2}{#3}} +\def\CMathML@intCond#1#2#3{\CMathML@intOp_{#2}{#3}d{#1}} %bvars, condition, body +\newcommand{\CintCond}[4][]{\CMathML@intCond{#2}{#3}{#4}} + +%</sty> +%<*ltxml> +DefConstructor('\CintOp []', + "<ltx:XMTok meaning='int' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cint [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='int' role='INTOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CintLimits [] {}{}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='int' role='INTOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "<ltx:XMArg>#5</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CintDA [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='int' role='INTOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CintCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='int' role='INTOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@diff#1{#1'} +\newcommand{\Cdiff}[2][]{\CMathML@diff{#2}} +\def\CMathML@ddiff#1#2{{d{#2}(#1)\over{d{#1}}}} +\newcommand{\Cddiff}[3][]{\CMathML@ddiff{#2}{#3}} +\def\CMathML@partialdiff#1#2#3{{\partial^{#1}\over\partial{#2}}{#3}}% degree, bvars, body +\newcommand{\Cpartialdiff}[4][]{\CMathML@partialdiff{#2}{#3}{#4}} +\newcommand{\Cdegree}[2]{#1^{#2}} +%</sty> +%<*ltxml> +DefConstructor('\Cdiff [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='diff' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cddiff [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='diff' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cpartialdiff [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='diff' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "?#2(<ltx:XMArg>#2</ltx:XMArg>)()" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cdegree {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='degree'/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#1</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@limit#1#2#3{\lim_{#1\rightarrow{#2}}{#3}} +\newcommand{\Climit}[4][]{\CMathML@limit{#2}{#3}{#4}} % bvar, lowlimit, scope +\def\CMathML@limitCond#1#2#3{\lim_{#2}{#3}} +\newcommand{\ClimitCond}[4][]{\CMathML@limitCond{#2}{#3}{#4}} % bvars, condition, scope +%</sty> +%<*ltxml> +DefConstructor('\Climit [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='limit' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\ClimitCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='limit' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> + \def\CMathML@tendstoOp{\rightarrow} + \newcommand{\CtendstoOp}{\CMathML@tendstoOp} +\def\CMathML@tendsto#1#2{#1\CMathML@tendstoOp{#2}} +\newcommand{\Ctendsto}[3][]{\CMathML@tendsto{#2}{#3}} + \def\CMathML@tendstoAboveOp{\searrow} + \newcommand{\CtendstoAboveOp}{\CMathML@tendstoAboveOp} +\def\CMathML@tendstoAbove#1#2{#1\searrow{#2}} +\newcommand{\CtendstoAbove}[3][]{\CMathML@tendstoAbove{#2}{#3}} + \def\CMathML@tendstoBelowOp{\nearrow} + \newcommand{\CtendstoBelowOp}{\CMathML@tendstoBelowOp} +\def\CMathML@tendstoBelow#1#2{#1\CMathML@tendstoBelowOp{#2}} +\newcommand{\CtendstoBelow}[3][]{\CMathML@tendstoBelow{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\CtendstoOp []', + "<ltx:XMTok meaning='tendsto' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ctendsto [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='RELOP' meaning='tendsto' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CtendstoAboveOp []', + "<ltx:XMTok meaning='tendsto' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CtendstoAbove [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='RELOP'meaning='tendsto' type='above' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CtendstoBelowOp []', + "<ltx:XMTok meaning='tendsto' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CtendstoBelow [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='RELOP' meaning='tendsto' type='below' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@divergence#1{\nabla\cdot{#1}} +\newcommand{\Cdivergence}[2][]{\CMathML@divergence{#2}} +\def\CMathML@grad#1{\nabla{#1}} +\newcommand{\Cgrad}[2][]{\CMathML@grad{#2}} +\def\CMathML@curl#1{\nabla\times{#1}} +\newcommand{\Ccurl}[2][]{\CMathML@curl{#2}} +\def\CMathML@laplacian#1{\nabla^2#1} +\newcommand{\Claplacian}[2][]{\CMathML@laplacian{#2}} +%</sty> +%<*ltxml> +DefConstructor('\Cdivergence [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='divergence' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cgrad [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='grad' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Curl [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='url' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Claplacian [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='laplacian' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{Sets and their Operations}\label{impl:sets} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@set#1{\left\{#1\right\}} +\newcommand{\Cset}[2][]{\CMathML@set{#2}} +\def\CMathML@setRes#1#2{\{#1|#2\}} +\newcommand{\CsetRes}[3][]{\CMathML@setRes{#2}{#3}} +\def\CMathML@setCond#1#2#3{\{#2|#3\}} +\newcommand{\CsetCond}[4][]{\CMathML@setCond{#2}{#3}{#4}} +\def\CMathML@setDA#1#2#3{\{#1\in{#2}|#3\}} +\newcommand{\CsetDA}[4][]{\CMathML@setDA{#2}{#3}{#4}} + \def\CMathML@listOp{\mbox{list}} + \newcommand{\ClistOp}{\CMathML@listOp} +\def\CMathML@list#1{\CMathML@listOp({#1})} +\newcommand{\Clist}[2][]{\CMathML@list{#2}} + \def\CMathML@unionOp{\cup} + \newcommand{\CunionOp}{\CMathML@unionOp} +\def\CMathML@union#1{\assoc[p=500]{\CMathML@unionOp}{#1}} +\newcommand{\Cunion}[2][]{\CMathML@union{#2}} + \def\CMathML@intersectOp{\cap} + \newcommand{\CintersectOp}{\CMathML@intersectOp} +\def\CMathML@intersect#1{\assoc[p=400]{\CMathML@intersectOp}{#1}} +\newcommand{\Cintersect}[2][]{\CMathML@intersect{#2}} + \def\CMathML@inOp{\in} + \newcommand{\CinOp}{\CMathML@inOp} +\def\CMathML@in#1#2{#1\CMathML@inOp{#2}} +\newcommand{\Cin}[3][]{\CMathML@in{#2}{#3}} + \def\CMathML@notinOp{\notin} + \newcommand{\CnotinOp}{\CMathML@notinOp} +\def\CMathML@notin#1#2{#1\CMathML@notinOp{#2}} +\newcommand{\Cnotin}[3][]{\CMathML@notin{#2}{#3}} + \def\CMathML@setdiffOp{\setminus} + \newcommand{\CsetdiffOp}{\CMathML@setdiffOp} +\def\CMathML@setdiff#1#2{#1\CMathML@setdiffOp{#2}} +\newcommand{\Csetdiff}[3][]{\CMathML@setdiff{#2}{#3}} + \def\CMathML@cardOp{\#} + \newcommand{\CcardOp}{\CMathML@cardOp} +\def\CMathML@card#1{\CMathML@cardOp #1} +\newcommand{\Ccard}[2][]{\CMathML@card{#2}} + \def\CMathML@cartesianproductOp{\times} + \newcommand{\CcartesianproductOp}{\CMathML@cartesianproductOp} +\def\CMathML@cartesianproduct#1{\assoc[p=400]{\CMathML@cartesianproductOp}{#1}} +\newcommand{\Ccartesianproduct}[2][]{\CMathML@cartesianproduct{#2}} + \def\CMathML@subsetOp{\subseteq} + \newcommand{\CsubsetOp}{\CMathML@subsetOp} +\def\CMathML@subset#1{\assoc[p=700]{\CMathML@subsetOp}{#1}} +\newcommand{\Csubset}[2][]{\CMathML@subset{#2}} + \def\CMathML@prsubsetOp{\subset} + \newcommand{\CprsubsetOp}{\CMathML@prsubsetOp} +\def\CMathML@prsubset#1{\assoc[p=700]{\CMathML@prsubsetOp}{#1}} +\newcommand{\Cprsubset}[2][]{\CMathML@prsubset{#2}} + \def\CMathML@notsubsetOp{\not\subseteq} + \newcommand{\CnotsubsetOp}{\CMathML@notsubsetOp} +\def\CMathML@notsubset#1#2{#1\CMathML@notsubsetOp{#2}} +\newcommand{\Cnotsubset}[3][]{\CMathML@notsubset{#2}{#3}} + \def\CMathML@notprsubsetOp{\not\subset} + \newcommand{\CnotprsubsetOp}{\CMathML@notprsubsetOp} +\def\CMathML@notprsubset#1#2{#1\CMathML@notprsubsetOp{#2}} +\newcommand{\Cnotprsubset}[3][]{\CMathML@notprsubset{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\Cset [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='set' role='CONSTRUCTOR' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CsetRes [] {}{}', + "<ltx:XMApp role='BIGOP'>" + . "<ltx:XMTok role='BIGOP' meaning='set' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg role='BVAR'>#2</ltx:XMArg>" + . "<ltx:XMArg role='CONDITION'>#3</ltx:XMArg>" + . "<ltx:XMArg role='SCOPE'>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsetCond [] {}{}{}', + "<ltx:XMApp role='BIGOP'>" + . "<ltx:XMTok role='BIGOP' meaning='set' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg role='BVAR'>#2</ltx:XMArg>" + . "<ltx:XMArg role='CONDITION'>#3</ltx:XMArg>" + . "<ltx:XMArg role='SCOPE'>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsetDA [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='set' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg role='BVAR'>#2</ltx:XMArg>" + . "<ltx:XMArg role='DOMAINOFAPPLICATION'>#3</ltx:XMArg>" + . "<ltx:XMArg role='SCOPE'>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\ClistOp []', + "<ltx:XMTok meaning='list' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Clist [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='list' role='CONSTRUCTOR' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CunionOp []', + "<ltx:XMTok meaning='union' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cunion [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='union' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CintersectOp []', + "<ltx:XMTok meaning='intersect' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cintersect [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='intersect' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CinOp []', + "<ltx:XMTok meaning='in' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cin [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='in' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CnotinOp []', + "<ltx:XMTok meaning='notin' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnotin [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='notin' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsubsetOp []', + "<ltx:XMTok meaning='subset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Csubset [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='subset' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CprsubsetOp []', + "<ltx:XMTok meaning='prsubset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cprsubset [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='prsubset' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CnotsubsetOp []', + "<ltx:XMTok meaning='notsubset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnotsubset [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='notsubset' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CnotprsubsetOp []', + "<ltx:XMTok meaning='notprsubset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnotprsubset [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='notprsubset' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsetdiffOp []', + "<ltx:XMTok meaning='setdiff' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Csetdiff [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='setdiff' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CcardOp []', + "<ltx:XMTok meaning='card' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ccard [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='card' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CcartesianproductOp []', + "<ltx:XMTok meaning='cartesianproduct' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ccartesianproduct [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='cartesianproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +%</ltxml> +% \end{macrocode} +% The next set of macros are needed, since they are presentational. +% \begin{macrocode} +%<*sty> + \def\CMathML@supsetOp{\supseteq} + \newcommand{\CsupsetOp}{\CMathML@supsetOp} +\def\CMathML@supset#1{\assoc[p=700]{\CMathML@supsetOp}{#1}} +\newcommand{\Csupset}[2][]{\CMathML@supset{#2}} + \def\CMathML@prsupsetOp{\supset} + \newcommand{\CprsupsetOp}{\CMathML@prsupsetOp} +\def\CMathML@prsupset#1{\assoc[p=700]{\CMathML@prsupsetOp}{#1}} +\newcommand{\Cprsupset}[2][]{\CMathML@prsupset{#2}} + \def\CMathML@notsupsetOp{\not\supseteq} + \newcommand{\CnotsupsetOp}{\CMathML@notsupsetOp} +\def\CMathML@notsupset#1#2{#1\CMathML@notsupsetOp{#2}} +\newcommand{\Cnotsupset}[3][]{\CMathML@notsupset{#2}{#3}} + \def\CMathML@notprsupsetOp{\not\supset} + \newcommand{\CnotprsupsetOp}{\CMathML@notprsupsetOp} +\def\CMathML@notprsupset#1#2{#1\CMathML@notprsupsetOp{#2}} +\newcommand{\Cnotprsupset}[3][]{\CMathML@notprsupset{#2}{#3}} +%</sty> +% \end{macrocode} +% +% On the semantic side (in {\latexml}), we need to implement them in terms of the +% {\mathml} elements. Fortunately, we can just turn them around. \ednote{ooooops, this +% does not work for the associative ones.} +% +% \begin{macrocode} +%<*ltxml> +DefConstructor('\CsupsetOp []', + "<ltx:XMTok meaning='supset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CprsupsetOp []', + "<ltx:XMTok meaning='prsupset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CnotsupsetOp []', + "<ltx:XMTok meaning='notsupset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CnotprsupsetOp []', + "<ltx:XMTok meaning='notprsupset' role='ID' ?#1(definitionURL='#1')()/>"); +DefMacro('\Csupset[]{}','\Csubset[#1]{#2}'); +DefMacro('\Cprsupset[]{}','\Cprsubset[#1]{#2}'); +DefMacro('\Cnotsupset[]{}{}','\Cnotsubset[#1]{#3}{#2}'); +DefMacro('\Cnotprsupset[]{}{}','\Cnotprsubset[#1]{#3}{#2}'); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*sty> + \def\CMathML@UnionDAOp{\bigwedge} + \newcommand{\CUnionDAOp}{\CMathML@UnionDAOp} +\def\CMathML@UnionDA#1#2{\CMathML@UnionDAOp_{#1}{#2}} % set, scope +\newcommand{\CUnionDA}[3][]{\CMathML@UnionDA{#2}{#3}} +\def\CMathML@UnionCond#1#2#3{\CMathML@UnionDAOp_{#2}{#3}} % bvars,condition, scope +\newcommand{\CUnionCond}[4][]{\CMathML@UnionCond{#2}{#2}{#3}} + \def\CMathML@IntersectDAOp{\bigvee} + \newcommand{\CIntersectDAOp}{\CMathML@IntersectDAOp} +\def\CMathML@IntersectDA#1#2{\CMathML@IntersectDAOp_{#1}{#2}} % set, scope +\newcommand{\CIntersectDa}[3][]{\CMathML@IntersectDA{#2}{#3}} +\def\CMathML@IntersectCond#1#2#3{\CMathML@IntersectDAOp_{#2}{#3}}% bvars,condition, scope +\newcommand{\CIntersectCond}[4][]{\CMathML@IntersectCond{#2}{#3}{#4}} + \def\CMathML@CartesianproductDAOp{\bigoplus} + \newcommand{\CCartesianproductDAOp}{\CMathML@CartesianproductDAOp} +\def\CMathML@CartesianproductDA#1#2{\CMathML@CartesianproductDAOp_{#1}{#2}} % set, scope +\newcommand{\CCartesianproductDA}[3][]{\CMathML@CartesianproductDA{#2}{#3}} +\def\CMathML@CartesianproductCond#1#2#3{\CMathML@CartesianproductDAOp_{#2}{#3}}% bvars,condition, scope +\newcommand{\CCartesianproductCond}[4][]{\CMathML@CartesianproductCond{#2}{#3}{#4}} +%</sty> +%<*ltxml> +DefConstructor('\CUnionDAOp []', + "<ltx:XMTok meaning='union' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CUnionDA [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='union' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CUnionCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='union' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CIntersectDaOp []', + "<ltx:XMTok meaning='intersect' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CIntersectDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='intersect' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CIntersectCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='intersect' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CCartesianproductDaOp []', + "<ltx:XMTok meaning='cartesianproduct' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CCartesianproductDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='cartesianproduct' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CCartesianproductCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='cartesianproduct' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{Sequences and Series}\label{impl:sequences} +% +% \begin{macrocode} +%<*sty> + \def\CMathML@sumOp{\sum} + \newcommand{\CsumOp}{\CMathML@sumOp} +\def\CMathML@sumLimits#1#2#3#4{\CMathML@sumOp_{#1=#2}^{#3}#4}% bvar, llimit, ulimit, body +\newcommand{\CsumLimits}[5][]{\CMathML@sumLimits{#2}{#3}{#4}{#5}} +\def\CMathML@sumCond#1#2#3{\CMathML@sumOp_{#1\in{#2}}#3} % bvar, condition, body +\newcommand{\CsumCond}[4][]{\CMathML@sumCond{#2}{#3}{#4}} +\def\CMathML@sumDA#1#2{\CMathML@sumOp_{#1}#2} % set, body +\newcommand{\CsumDA}[3][]{\CMathML@sumDA{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\CsumOp []', + "<ltx:XMTok meaning='sum' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CsumLimits [] {}{}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sum' role='SUMOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "#5</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% \ednote{complete the other cases}\ednote{add a keyword argument to all newcommands} +% \begin{macrocode} +%<*sty> + \def\CMathML@prodOp{\prod} + \newcommand{\CprodOp}{\CMathML@prodOp} +\def\CMathML@prodLimits#1#2#3#4{\CMathML@prodOp_{#1=#32^{#3}#4}}% bvar, llimit, ulimit, body +\newcommand{\CprodLimits}[5][]{\CMathML@prodLimits{#2}{#3}{#4}{#5}} +\def\CMathML@prodCond#1#2#3{\CMathML@prodOp_{#1\in{#2}}#3} % bvar, condition, body +\newcommand{\CprodCond}[4][]{\CMathML@prodCond{#2}{#3}{#4}} +\def\CMathML@prodDA#1#2{\CMathML@prodOp_{#1}#2} % set, body +\newcommand{\CprodDA}[3]{\CMathML@prodDA{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\CprodOp []', + "<ltx:XMTok meaning='prod' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CprodLimits [] {}{}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='prod' role='SUMOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg><ci>#2</ci></ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "#5</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% \ednote{complete the other cases} +% \subsection{Elementary Classical Functions}\label{impl:specfun} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@sin#1{\sin(#1)} +\newcommand{\Csin}[2][]{\CMathML@sin{#2}} +\def\CMathML@cos#1{\cos(#1)} +\newcommand{\Ccos}[2][]{\CMathML@cos{#2}} +\def\CMathML@tan#1{\tan(#1)} +\newcommand{\Ctan}[2][]{\CMathML@tan{#2}} +\def\CMathML@sec#1{\sec(#1)} +\newcommand{\Csec}[2][]{\CMathML@sec{#2}} +\def\CMathML@csc#1{\csc(#1)} +\newcommand{\Ccsc}[2][]{\CMathML@csc{#2}} +\def\CMathML@cot#1{\cot(#1)} +\newcommand{\Ccot}[2][]{\CMathML@cot{#2}} +\def\CMathML@sinh#1{\sinh(#1)} +\newcommand{\Csinh}[2][]{\CMathML@sinh{#2}} +\def\CMathML@cosh#1{\cosh(#1)} +\newcommand{\Ccosh}[2][]{\CMathML@cosh{#2}} +\def\CMathML@tanh#1{\tanh(#1)} +\newcommand{\Ctanh}[2][]{\CMathML@tanh{#2}} +\def\CMathML@sech#1{\mbox{sech}(#1)} +\newcommand{\Csech}[2][]{\CMathML@sech{#2}} +\def\CMathML@csch#1{\mbox{csch}(#1)} +\newcommand{\Ccsch}[2][]{\CMathML@csch{#2}} +\def\CMathML@coth#1{\mbox{coth}(#1)} +\newcommand{\Ccoth}[2][]{\CMathML@coth{#2}} +\def\CMathML@arcsin#1{\arcsin(#1)} +\newcommand{\Carcsin}[2][]{\CMathML@arcsin{#2}} +\def\CMathML@arccos#1{\arccos(#1)} +\newcommand{\Carccos}[2][]{\CMathML@arccos{#2}} +\def\CMathML@arctan#1{\arctan(#1)} +\newcommand{\Carctan}[2][]{\CMathML@arctan{#2}} +\def\CMathML@arccosh#1{\mbox{arccosh}(#1)} +\newcommand{\Carccosh}[2][]{\CMathML@arccosh{#2}} +\def\CMathML@arccot#1{\mbox{arccot}(#1)} +\newcommand{\Carccot}[2][]{\CMathML@arccot{#2}} +\def\CMathML@arccoth#1{\mbox{arccoth}(#1)} +\newcommand{\Carccoth}[2][]{\CMathML@arccoth{#2}} +\def\CMathML@arccsc#1{\mbox{arccsc}(#1)} +\newcommand{\Carccsc}[2][]{\CMathML@arccsc{#2}} +\def\CMathML@arcsinh#1{\mbox{arcsinh}(#1)} +\newcommand{\Carcsinh}[2][]{\CMathML@arcsinh{#2}} +\def\CMathML@arctanh#1{\mbox{arctanh}(#1)} +\newcommand{\Carctanh}[2][]{\CMathML@arctanh{#2}} + +\def\CMathML@exp#1{\exp(#1)} +\newcommand{\Cexp}[2][]{\CMathML@exp{#2}} +\def\CMathML@ln#1{\ln(#1)} +\newcommand{\Cln}[2][]{\CMathML@ln{#2}} +\def\CMathML@log#1#2{\log_{#1}(#2)} +\newcommand{\Clog}[3][]{\CMathML@log{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\Csin [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sin' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccos [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='cos' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ctan [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='tan' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Csec [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sec' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccsc [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='csc' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccot [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='cot' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Csinh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sinh' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccosh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='cosh' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ctanh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='tanh' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Csech [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sech' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccsch [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='csch' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccoth [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='coth' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carcsin [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arcsin' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccos [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccos' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carctan [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arctan' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carcsec [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arcsec' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccsc [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccsc' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccot [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccot' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carcsinh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arcsinh' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccosh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccosh' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carctanh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arctanh' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carcsech [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arcsech' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccsch [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccsch' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccoth [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccoth' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cexp [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='exp' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cln [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='ln' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Clog [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='log' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{Statistics}\label{impl:statistics} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@mean#1{\mbox{mean}(#1)} +\newcommand{\Cmean}[2][]{\CMathML@mean{#2}} +\def\CMathML@sdev#1{\mbox{std}(#1)} +\newcommand{\Csdev}[2][]{\CMathML@sdev{#2}} +\def\CMathML@var#1{\mbox{var}(#1)} +\newcommand{\Cvar}[2][]{\CMathML@var{#2}} +\def\CMathML@median#1{\mbox{median}(#1)} +\newcommand{\Cmedian}[2][]{\CMathML@median{#2}} +\def\CMathML@mode#1{\mbox{mode}(#1)} +\newcommand{\Cmode}[2][]{\CMathML@mode{#2}} +\def\CMathML@moment#1#2{\langle{#2}^{#1}\rangle}% degree, momentabout, scope +\newcommand{\Cmoment}[3][]{\CMathML@moment{#2}{#3}} +\def\CMathML@momentA#1#2{\langle{#2}^{#1}\rangle}% degree, momentabout, scope +\newcommand{\CmomentA}[4][]{\CMathML@momentA{#2}{#3}{#4}} +%</sty> +%<*ltxml> +DefConstructor('\Cmean [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='mean' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Csdev [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sdev' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cvar [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='var' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cmedian [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='median' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cmode [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='mode' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cmoment [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='moment' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% \ednote{we do not seem to need the momentabout.}\ednote{moment and momentA have funny +% elided arguments} +% +% \subsection{Linear Algebra}\label{impl:linalg} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@vector#1{(#1)} +\newcommand{\Cvector}[2][]{\CMathML@vector{#2}} +\def\CMathML@matrix#1#2{\left(\begin{array}{#1}#2\end{array}\right)}% row pattern, body +\newcommand{\Cmatrix}[3][]{\CMathML@matrix{#2}{#3}} +\def\CMathML@determinant#1{\left|#1\right|} +\newcommand{\Cdeterminant}[2][]{\CMathML@determinant{#2}} +\def\CMathML@transpose#1{#1^\top} +\newcommand{\Ctranspose}[2][]{\CMathML@transpose{#2}} +\def\CMathML@selector#1#2{#1_{#2}} +\newcommand{\Cselector}[3][]{\CMathML@selector{#2}{#3}} + \def\CMathML@vectproductOp{\cdot} + \newcommand{\CvectproductOp}{\CMathML@vectproductOp} +\def\CMathML@vectproduct#1#2{#1\CMathML@vectproductOp{#2}} +\newcommand{\Cvectproduct}[3][]{\CMathML@vectproduct{#2}{#3}} +\def\CMathML@scalarproduct#1#2{{#1}#2} +\newcommand{\Cscalarproduct}[3][]{\CMathML@scalarproduct{#2}{#3}} + \def\CMathML@outerproductOp{\times} + \newcommand{\CouterproductOp}{\CMathML@outerproductOp} +\def\CMathML@outerproduct#1#2{#1\CMathML@outerproductOp{#2}} +\newcommand{\Couterproduct}[3][]{\CMathML@outerproduct{#2}{#3}} +%</sty> +%<*ltxml> +DefConstructor('\Cvector [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='vector' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\Cmatrix [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='matrix' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cdeterminant [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='determinant' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ctranspose [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='transpose' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cselector [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='selector' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CvectorproductOp []', + "<ltx:XMTok meaning='vectorproduct' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cvectorproduct [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='vectorproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cscalarproduct [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='scalarproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CouterproductOp []', + "<ltx:XMTok meaning='outerproduct' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Couterproduct [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='outerproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{Constant and Symbol Elements}\label{impl:constants} +% +% \begin{macrocode} +%<*sty> +\def\CMathML@integers{{\mathbb{Z}}} +\newcommand{\Cintegers}[1][]{\CMathML@integers} +\def\CMathML@reals{{\mathbb{R}}} +\newcommand{\Creals}[1][]{\CMathML@reals} +\def\CMathML@rationals{{\mathbb{Q}}} +\newcommand{\Crationals}[1][]{\CMathML@rationals} +\def\CMathML@naturalnumbers{{\mathbb{N}}} +\newcommand{\Cnaturalnumbers}[1][]{\CMathML@naturalnumbers} +\def\CMathML@complexes{{\mathbb{C}}} +\newcommand{\Ccomplexes}[1][]{\CMathML@complexes} +\def\CMathML@primes{{\mathbb{P}}} +\newcommand{\Cprimes}[1][]{\CMathML@primes} +\def\CMathML@exponemtiale{e} +\newcommand{\Cexponemtiale}[1][]{\CMathML@exponemtiale} +\def\CMathML@imaginaryi{i} +\newcommand{\Cimaginaryi}[1][]{\CMathML@imaginaryi} +\def\CMathML@notanumber{{\mathrm{NaN}}} +\newcommand{\Cnotanumber}[1][]{\CMathML@notanumber} +\def\CMathML@true{{\mathrm{true}}} +\newcommand{\Ctrue}[1][]{\CMathML@true} +\def\CMathML@false{{\mathrm{false}}} +\newcommand{\Cfalse}[1][]{\CMathML@false} +\def\CMathML@emptyset{\emptyset} +\newcommand{\Cemptyset}[1][]{\CMathML@emptyset} +\def\CMathML@pi{\pi} +\newcommand{\Cpi}[1][]{\CMathML@pi} +\def\CMathML@eulergamma{\gamma} +\newcommand{\Ceulergamma}[1][]{\CMathML@eulergamma} +\def\CMathML@infinit{\infty} +\newcommand{\Cinfinit}[1][]{\CMathML@infinit} +%</sty> +%<*ltxml> +DefConstructor('\Cintegers []', + "<ltx:XMTok meaning='integers' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Creals []', + "<ltx:XMTok meaning='reals' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Crationals []', + "<ltx:XMTok meaning='rationals' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnaturalnumbers []', + "<ltx:XMTok meaning='naturalnumbers' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ccomplexes []', + "<ltx:XMTok meaning='complexes' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cprimes []', + "<ltx:XMTok meaning='primes' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cexponentiale []', + "<ltx:XMTok meaning='exponentiale' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cimaginaryi []', + "<ltx:XMTok meaning='imaginaryi' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnotanumber []', + "<ltx:XMTok meaning='notanumber' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ctrue []', + "<ltx:XMTok meaning='true' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cfalse []', + "<ltx:XMTok meaning='false' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cemptyset []', + "<ltx:XMTok meaning='emptyset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cpi []', + "<ltx:XMTok meaning='pi' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ceulergamma []', + "<ltx:XMTok meaning='eulergamma' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cinfinit []', + "<ltx:XMTok meaning='infinit' role='ID' ?#1(definitionURL='#1')()/>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{Extensions}\label{sec:impl:cmathmlx} +% \begin{macro}{\Ccomplement} +% \begin{macrocode} +%<*styx> +\def\CMathML@complement#1{#1^c} +\newcommand{\Ccomplement}[2][]{\CMathML@complement{#2}} +%</styx> +%<*ltxmlx> +DefConstructor('\Ccomplement [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='complement' role='CSYMBOL'/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +%</ltxmlx> +% \end{macrocode} +% \end{macro} +% +% \subsection{Finale}\label{sec:impl:finale} +% +% Finally, we need to terminate the file with a success mark for perl. +% \begin{macrocode} +%<ltxml>1; +% \end{macrocode} +% \Finale +\endinput + +% \iffalse +%%% Local Variables: +%%% mode: doctex +%%% TeX-master: t +%%% End: +% \fi + +% LocalWords: STeX cmathml symdefs CMathML dom codom Im ll reln fn bvar arith +% LocalWords: alg lcm rels Ceq llimit ulimit bvars lowlimit specfun sech csch +% LocalWords: coth arccosh arccot arccoth arccsc arcsinh arctanh logbase std +% LocalWords: var momentabout linalg matrixrow bruce NaN stex cnxml symdef +% LocalWords: DefinitionURLs domainofapplication CmomentA concl diff --git a/Master/texmf-dist/source/latex/stex/cmathml.ins b/Master/texmf-dist/source/latex/stex/cmathml.ins new file mode 100644 index 00000000000..36ec44c47e7 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/cmathml.ins @@ -0,0 +1,37 @@ +%% +%% This file generates files required to use the ed package. +%% At your command prompt write +%% +%% latex cmathml.ins +%% +%% Copyright(c) 2005 Michael Kohlhase +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.0 or, at your option, any later version. +%% +\input docstrip +\preamble +\endpreamble + +%\usedir{tex/latex/listings} +\keepsilent +\askforoverwritefalse + +% generate base package +\generate{\file{cmathml.sty}{\from{cmathml.dtx}{sty}} +\generate{\file{cmathmlx.sty}{\from{cmathml.dtx}{styx}} +% generated the LaTeXML bindings +\nopreamble\nopostamble +\file{cmathml.sty.ltxml}{\from{cmathml.dtx}{ltxml}}} +\file{cmathmlx.sty.ltxml}{\from{cmathml.dtx}{ltxmlx}}} + +\Msg{*} +\Msg{* You probably need to move the generated style files into a directory} +\Msg{* searched by TeX and LaTeXML respectively.} +\Msg{*} +\Msg{* And don't forget to refresh your filename database} +\Msg{* if your TeX distribution uses such a database.} +\Msg{*} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/stex/cnx.dtx b/Master/texmf-dist/source/latex/stex/cnx.dtx new file mode 100644 index 00000000000..ed53bc4d27a --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/cnx.dtx @@ -0,0 +1,1139 @@ +% \iffalse meta-comment +% A LaTeX Class for CNXML +% Copyright (c) 2006 Michael Kohlhase, all rights reserved +% this file is released under the +% Gnu Library Public Licences (LGPL) +% +% The development version of this file can be found at +% https://svn.kwarc.info/repos/kwarc/projects/stex/sty/cnx.dtx +% \fi +% +% \iffalse +%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<class>\ProvidesClass{cnx}[2006/01/10 v0.1 LaTeX Bindings for CNXML] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{url,array,float} +\usepackage[show]{ed} +\makeindex +\floatstyle{boxed} +\newfloat{exfig}{thp}{lop} +\floatname{exfig}{Example} +\begin{document}\DocInput{cnx.dtx}\end{document} +%</driver> +% \fi +% +%\CheckSum{443} +% +% \changes{v0.1}{2005/12/06}{Initial Version} +% \changes{v0.2}{2006/01/11}{Namespaces now work} +% +% \GetFileInfo{cnx.cls} +% +% \MakeShortVerb{\|} +%\def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}} +% \def\stex{{\raisebox{-.5ex}S\kern-.5ex\TeX}} +% \def\sTeX{\stex} +% \def\xml{\scshape{XML}} +% \def\cnxml{\scshape{CNXml}} +% \def\connexions{\scshape{Connexions}} +% \def\element#1{{\ttfamily{#1}}} +% \def\snippet#1{{\ttfamily{#1}}} +% \def\cnxlatex{CNX\LaTeX} +% \def\mathml{{\scshape{MathML}}} +% \def\latexml{\hbox{{\LaTeX}ML}} +% \title{{\cnxlatex}: A {\LaTeX}-based Syntax for Connexions Modules\thanks{Version {\fileversion} +% (last revised {\filedate})}} +% \author{Michael Kohlhase\\ +% Jacobs University, Bremen\\ +% \url{http://kwarc.info/kohlhase}} +% \maketitle +% +% \begin{abstract} +% We present {\cnxlatex}, a collection of {\LaTeX} macros that allow to write +% {\connexions} modules without leaving the {\LaTeX} workflow. Modules are authored in +% {\cnxlatex} using only a text editor, transformed to PDF and proofread as usual. In +% particular, the {\LaTeX} workflow is independent of havin access to the {\connexions} +% system, which makes {\cnxlatex} attractive for the initial version of single-author +% modules. +% +% For publication, {\cnxlatex} modules are transformed to {\cnxml} via the {\latexml} +% translator and can be uploaded to the {\connexions} system. +% \end{abstract} +%\newpage +%\section{Introduction} +% +% The Connexions project is a\ednote{continue; copy from somewhere...} +% +% The {\cnxml} format --- in particular the embeded content {\mathml} --- is hard to write +% by hand, so we provide a set of enviroments that allow to embed the {\cnxml} document +% model into {\LaTeX}. +% +%\section{The User Interface} +% +% This document is not a manual for the Connexions XML encoding, or a practical guide how +% to write Connexions modules. We only document the {\LaTeX} bindings for {\cnxml} and will +% presuppose experience with the format or familiarity with\ednote{cite the relevant stuff +% here}. Note that formatting {\cnxlatex} documents with the {\LaTeX} formatter does +% little to enforce the restrictions imposed by the {\cnxml} document model. You will need to +% run the {\latexml} converter for that (it includes DTD validation) and any CNX-specific +% quality assurance tools after that. \ednote{talk about Content {\mathml} and cmathml.sty +% somewhere} +% +% The {\cnxlatex} class makes heavy use of the |KeyVal| package, which is part of your +% {\LaTeX} distribution. This allows to add optional information to {\LaTeX} macros in the +% form of key-value pairs: A macro |\foo| that takes a KeyVal argument and a regular one, +% so a call might look like |\foo{bar}| (no KeyVal information given) or +% |\foo[key1=val1,...,keyn=valn]{bar}|, where |key1|,\dots,|keyn| are predefined keywords +% and values are {\LaTeX} token sequences that do not contain comma characters (though +% they may contain blank characters). If a value needs to contain commas, then it must be +% enclosed in curly braces, as in |\foo[args={a,comma,separated,list}]|. Note that the +% order the key/value pairs appear in a KeyVal Argument is immaterial. +% +% \subsection{Document Structure} +% +% \begin{exfig} +%\begin{verbatim} +% \documentclass{cnx} +% \begin{document} +% \begin{cnxmodule}[name=Hello World,id=m4711] +% \begin{ccontent} +% \begin{cpara}[id=p01] Hello World\end{cpara} +% \end{ccontent} +% \end{cnxmodule} +% \end{document} +% \end{verbatim} +% \caption{A Minimal {\cnxlatex} Document}\label{fig:minimal} +%\end{exfig} +% +% The first set of {\cnxlatex} environments concern the top-level structure of the +% modules. The minimal Connexions document in {\LaTeX} can be seen in +% Figure~\ref{fig:minimal}: we still need the {\LaTeX} document environment, then +% \DescribeEnv{cnxmodule} +% the |cnxmodule| environment contains the module-specific information as a KeyVal +% argument with the two keys: |id| for the module identifier supplied by the +% {\connexions} system) and |name| for the title of the module. +% +% \DescribeEnv{ccontent} +% The |content|envionrment delineates the module content from the metadata (see +% Section~\ref{sec:metadata}). It is needed to make the conversion to {\cnxml} simpler. +% +% \DescribeEnv{c*section} +% {\cnxml} knows three levels of sectioning, so the {\cnxlatex} class supplies three as +% well: |csection|, |csubsection| and |csubsubsection|. In contrast to regular +% {\LaTeX}, these are environments to keep the tight connection between the +% formats. These environments take an optional KeyVal argument with key |id| for the +% identifier and a regular argument for the title of the section (to be transformed into +% the {\cnxml} {\element{name}} element). +% +% \DescribeEnv{cpara, cnote} +% The lowest levels of the document structure are given by paragraphs and notes. The +% |cpara| and |cnote| environment take a KeyVal argument with the |id| key for +% identification, the latter also allows a |type| key for the note type (an unspecified +% string\ednote{what are good values?}). +% +% +% \subsection{Mathematics} +% +% Mathematical formulae are integrated into text via the {\LaTeX} math mode, i.e. wrapped +% in |$| characters or between |\(| and |\)| for inline mathematics and wrapped in |$$| or +% between |\[| and |\]| for display-style math. Note that {\cnxml} expects Content +% {\mathml} as the representation format for mathematical formulae, while run-of-the-mill +% {\LaTeX} only specifies the presentation (i.e. the two-dimensional layout of +% formulae). The {\latexml} converter can usually figure out some of the content {\mathml} +% from regular {\LaTeX}, in other cases, the author has to specify it e.g. using the +% infrastructure supplied by the |cmathml| package. +% +% \DescribeEnv{cequation} +% For numbered equations, {\cnxml} supplies the {\element{equation}} element, for which +% {\cnxlatex} provides the |cequation| environment. This environment takes a KeyVal +% argument with the |id| key for the (required) identifier. +% +% +% \subsection{Statements} +% +% {\cnxml} provides special elements that make represnet various types of claims; we +% collectively call them statements. +% +% \DescribeEnv{cexample} +% The |cexample| environment and |definition| elements take a KeyVal argument with key +% |id| for identification. +% +% +% \DescribeEnv{crule, statement, proof} +% In {\cnxml}, the {\element{rule}} element is used to represent a general assertion +% about the state of the world. The {\cnxlatex} |rule|\ednote{we have called this +% ``crule'', since ``rule'' is already used by {\TeX}.} environment is its {\cnxlatex} +% counterpart. It takes a KeyVal attribute with the keys |id| for identification, |type| +% to specify the type of the assertion (e.g. ``Theorem'', ``Lemma'' or ``Conjecture''), +% and |name|, if the assertion has a title. The body of the |crule| environment contains +% the statemnt of assertion in the |statement| environment and (optionally) a proof in +% the |proof| environment. Both take a KeyVal argument with an |id| key for +% identification. +% +%\begin{exfig} +%\begin{verbatim} +% \begin{crule}[id=prop1,type=Proposition] +% \begin{statement}[id=prop1s] +% Sample statement +% \end{statement} +% \begin{proof}[id=prop1p] +% Your favourite proof +% \end{proof} +% \end{crule} +% \end{verbatim} +% \caption{A Basic crule Example}\label{fig:crule} +%\end{exfig} +% +% \DescribeEnv{definition, cmeaning} A definition defines a new technical term or concept +% for later use. The |definition| environment takes a KeyVal argument with the keys |id| +% for identification and |term| for the concept (definiendum) defined in this form. The +% definion text is given in the |cmeaning| environment\footnote{we have called this +% |cmeaning|, sinc |menaning| is already taken by {\TeX}}, which takes a KeyVal argument +% with key |id| for identification. After the |cmeaning| environment, a |definition| can +% contain arbitrarily many |cexample|s. +% +%\begin{exfig} +%\begin{verbatim} +% \begin{definition}{term=term-to-be-defined, id=termi-def] +% \begin{cmeaning}[id=termi-meaning] +% {\term{Term-to-be-defined}} is defined as: Sample meaning +% \end{cmeaning} +% \end{definition} +%\end{verbatim} +% \caption{A Basic {\tt{definition}} and {\tt{cmeaning}} Example}\label{fig:def-cmean} +%\end{exfig} +% +% \subsection{Connexions: Links and Cross-References} +% +% As the name {\connexions} already suggests, links and cross-references are very +% important for {\connexions} modules. {\cnxml} provides three kinds of them. Module +% links, hyperlinks, and concept references. +% +% \DescribeMacro{cnxn} +% Module links are speficied by the |\cnxn| macro, which takes a keyval argument with +% the keys |document|, |target|, and |strength|. The |document| key allows to specify +% the module identifier of the desired module in the repository, if it is empty, then +% the current module is intended. The |target| key allows to specify the document +% fragment. Its value is the respective identifier (given by its |id| attribute in +% {\cnxml} or the |id| key of the corresponding environment in {\cnxlatex}). Finally, +% the |strength| key allows to specify the relevance of the link. +% +% The regular argument of the |\cnxn| macro is used to supply the link text. +% +% +% \DescribeMacro{link} +% Hyperlinks can be specified by the |\link| macro in {\cnxlatex}. It takes a KeyVal +% argument with the key |src| to specify the URL of the link. The regular argument of +% the |\link| macro is used to supply the link text. +% +% +% \DescribeMacro{term} +% The |\term| marcro can be used to specify the\ednote{continue, pending Chuck's +% investigation. } +% +% +% \subsection{Metadata}\label{sec:metadata} +% +% Metadata is mostly managed by the system in {\connexions}, so we often do not need to +% care about it. On the other hand, it influences the system, so if we have work on the +% module extensively before converting it to {\cnxml}, it may be worthwile specify some of +% the data in advance. +% +% \begin{exfig} +%\begin{verbatim} +% \begin{metadata}[version=2.19, +% created=2000/07/21,revised=2004/08/17 22:07:27.213 GMT-5] +% \begin{authorlist} +% \cnxauthor[id=miko,firstname=Michael,surname=Kohlhase, +% email=m.kohlhase@iu-bremen.de] +% \end{authorlist} +% \begin{keywordlist}\keyword{Hello}\end{keywordlist} +% \begin{cnxabstract} +% A Minimal CNXLaTeX Document +% \end{cnxabstract} +% \end{metadata} +% \end{verbatim} +% \caption{Typical {\cnxlatex} Metadata}\label{fig:metadata} +%\end{exfig} +% +% \DescribeEnv{metadata} +% The |metadata| environment takes a KeyVal argument with the keys |version|, |created|, +% and |revised| with the obvious meanings. The latter keys take ISO 8601 norm +% representations for dates and times. Concretely, the format is +% {\snippet{CCYY-MM-DDThh:mm:ss}} where ``{\snippet{CC}}'' represents the century, +% ``{\snippet{YY}}'' the year, ``{\snippet{MM}}'' the month, and ``{\snippet{DD}}'' the +% day, preceded by an optional leading ``{\snippet{-}}'' sign to indicate a negative +% number. If the sign is omitted, ``{\snippet{+}}'' is assumed. The letter +% ``{\snippet{T}}'' is the date/time separator and ``{\snippet{hh}}'', +% ``{\snippet{mm}}'', ``{\snippet{ss}}'' represent hour, minutes, and seconds +% respectively. +% +% +% \DescribeEnv{authorlist, maintainerlist} +% The lists of authors and maintainers can be specified in the |authorlist| and +% |maintainerlist| environments, which take no arguments. +% +% \DescribeMacro{cnxauthor,maintainer} +% The entries on this lists are specified by the |\cnxauthor| and |\maintainer| +% macros. Which take a KeyVal argument specifying the individual. The |id| key is the +% identifier for the person, the |honorific|, |firstname|, |other|, |surname|, and +% |lineage| keys are used to specify the various name parts, and the |email| key is used +% to speficy the e-mail address of the person. +% +% +% \DescribeEnv{keywordlist, keyword} +% The keywords are specified with a list of |keyword| macros, which take the respective +% keyword in their only argument, inside a |keyword| environment. Neither take any +% KeyVal arguments. +% +% +% \DescribeEnv{cnxabstract} +% The abstract of a {\connexions} module is considered to be part of the metadata. It is +% specified using the |cnxabstract| environment. It does not take any arguments. +% +% +% \subsection{Exercises} +% +% \DescribeEnv{cexercise, cproblem, csolution} +% An exercise or problem in {\connexions} is specified by the |cexercise| environment, +% which takes an optional keyval argument with the keys |id| and |name|. It must contain +% a |cproblem| environment for the problem statement and a (possibly) empty set of +% |csolution| environments. Both of these take an optional keyval argument with the key +% |id|. +% +% \subsection{Graphics, etc.} +% +% \DescribeMacro{cfigure} For graphics we will use the |cfigure|\ednote{probably better +% call it {\tt{cgraphics}}} macro, which provides a non-floating environment for +% including graphics into {\cnxml} files. |cfigure| takes three arguments first an +% optional {\cnxml} keys, then the keys of the |graphicx| package in a regular argument +% (leave that empty if you don't have any) and finally a path. So +% \begin{center} +% |\cfigure[id=foo,type=image/jpeg,caption=The first FOO]{width=7cm,height=2cm}{../images/foo}| +% \end{center} +% Would include a graphic from the file at the path |../images/foo|, equip this image with +% a caption, and tell {\latexml} that\ednote{err, exactly what does it tell latexml?} the +% original of the images has the MIME type |image/jpeg|. +% +% \StopEventually{\ednotemessage} +% +%\section{The Implementation} +% +% We first make sure that the |KeyVal| and |graphicx| packages are loaded. +% \begin{macrocode} +%<*cls> +\RequirePackage{keyval} +\RequirePackage{graphicx} +% \end{macrocode} +% +% The next step is to declare (a few) class options that handle the paper size; this is +% useful for printing. +% \begin{macrocode} +\DeclareOption{letterpaper} + {\setlength\paperheight {11in}% + \setlength\paperwidth {8.5in}} +\DeclareOption{a4paper} + {\setlength\paperheight {297mm}% + \setlength\paperwidth {210mm}} +\ExecuteOptions{letterpaper} +\ProcessOptions +% \end{macrocode} +% Finally, we input all the usual size settings. There is no sense to use something else, +% and we initialize the pagenumbering counter and tell it to output the numbers in arabic +% numerals (otherwise label and reference do not work). +% \begin{macrocode} +\input{size10.clo} +\pagenumbering{roman} +%</cls> +% \end{macrocode} +% Now comes the equivalent for {\latexml}: this is something that we will have throughout +% this document. Every part of the {\TeX/\LaTeX} implementation has a {\latexml} +% equivalent. We keep them together to ensure that they do not get out of sync. +% \begin{macrocode} +%<*ltxml> +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('keyval'); +% \end{macrocode} +% We set up the necessary namespaces, the first one is the default one for {\cnxml} +% \begin{macrocode} +RegisterNamespace('cnx'=>"http://cnx.rice.edu/cnxml"); +RegisterNamespace('md'=>"http://cnx.rice.edu/mdml/0.4"); +RegisterNamespace('bib'=>"http://bibtexml.sf.net/"); +RegisterNamespace('m'=>"http://www.w3.org/1998/Math/MathML"); +% \end{macrocode} +% For {\latexml} we also have to set up the correct document type information. The first line +% gives the root element. The second gives the public identifier for the CNX DTD, then we +% have its URL, and finally the CNX namespace. +% \begin{macrocode} +DocType("cnx:document", + "-//CNX//DTD CNXML 0.5 plus LaTeXML//EN", + "../dtd/cnxml+ltxml.dtd", + '#default'=>"http://cnx.rice.edu/cnxml", + 'md'=>"http://cnx.rice.edu/mdml/0.4", + 'bib'=>"http://bibtexml.sf.net/", + 'm'=>"http://www.w3.org/1998/Math/MathML", + 'ltx'=>"http://dlmf.nist.gov/LaTeXML"); +% \end{macrocode} +% +% And finally, we need to set up the counters for itemization, since we are defining a +% class file from scratch.\ednote{this will have to change, when Bruce updates to the next +% version (0.6?)} +% +% \begin{macrocode} +NewCounter('@itemizei', 'document', idprefix=>'I'); +NewCounter('@itemizeii', '@itemizei', idprefix=>'I'); +NewCounter('@itemizeiii', '@itemizeii', idprefix=>'I'); +NewCounter('@itemizeiv', '@itemizeiii',idprefix=>'I'); +NewCounter('@itemizev', '@itemizeiv', idprefix=>'I'); +NewCounter('@itemizevi', '@itemizev', idprefix=>'I'); + +NewCounter('enumi', '@itemizei', idprefix=>'i'); +NewCounter('enumii', '@itemizeii', idprefix=>'i'); +NewCounter('enumiii','@itemizeiii', idprefix=>'i'); +NewCounter('enumiv', '@itemizeiv', idprefix=>'i'); +# A couple of more levels, since we use these for ID's! +NewCounter('enumv', '@itemizev', idprefix=>'i'); +NewCounter('enumvi', '@itemizevi', idprefix=>'i'); + +DefMacro('\theenumi', '\arabic{enumi}'); +DefMacro('\theenumii', '\alph{enumii}'); +DefMacro('\theenumiii', '\roman{enumiii}'); +DefMacro('\theenumiv', '\Alph{enumiv}'); + +NewCounter('equation', 'document', idprefix=>'E'); +DefMacro('\theequation', '\arabic{equation}'); +DefMacro('\textwidth','16cm'); +% \end{macrocode} +% +% And another thing that is now needed: +% +% \begin{macrocode} +Let('\thedocument@ID','\@empty'); +%</ltxml> +% \end{macrocode} +% +% \subsection{Document Structure} +% +% Now, we start with the document structure markup. The |cnxmodule| environment does not +% add anything to the {\LaTeX} output, it's attributes only show up in the {\xml}. There +% we have a slight complication: we have to put an |id| attribute on the |document| +% element in {\cnxml}, but we cannot redefine the |document| environment in +% {\LaTeX}. Therefore we specify the information in the |cnxmodule| environment. This +% means however that we have to put in on the |document| element when we are already past +% this. The solution here is that when we parse the |cnxmodule| environement, we store the +% value and put it on the |document| element when we leave the |document| environment +% (thanks for Ioan Sucan for the code). +% +% \begin{environment}{cnxmodule} +% \begin{macrocode} +%<*cls> +\define@key{cnxmodule}{name}{\def\cnx@title{#1}} +\define@key{cnxmodule}{id}{} +\newenvironment{cnxmodule}[1][]{\setkeys{cnxmodule}{#1}}{} +%</cls> +%<*ltxml> +DefKeyVal('cnxmodule','name','Semiverbatim'); +DefKeyVal('cnxmodule','id','Semiverbatim'); + +DefEnvironment('{document}','<cnx:document>#body</cnx:document>', + beforeDigest=> sub { AssignValue(inPreamble=>0); }, + afterDigest=> sub { $_[0]->getGullet->flush; return; }); +DefEnvironment('{cnxmodule} OptionalKeyVals:cnxmodule', + "<cnx:name>&KeyVal('#1','name')</cnx:name>\n#body\n", + afterDigestBegin => sub { + AssignValue('cnxmodule_id', + KeyVal($_[1]->getArg(1), 'id')->toString, + 'global'); + }); +Tag('cnx:document', afterClose => sub { + $_[1]->setAttribute('id', LookupValue('cnxmodule_id')); + }); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{ccontent} +% The |ccontent| environment is only used for transformation. Its optional |id| attribute +% is not taken up in the {\LaTeX} bindings. +% \begin{macrocode} +%<*cls> +\newenvironment{ccontent}{}{} +%</cls> +%<*ltxml> +DefEnvironment('{ccontent}',"<cnx:content>#body</cnx:content>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{c*section} +% The sectioning environments employ the obvious nested set of counters. +% \begin{macrocode} +%<*cls> +\newcounter{section} +\define@key{sectioning}{id}{} +\newenvironment{csection}[2][]% +{\stepcounter{section}\strut\\[1.5ex]\noindent% +{\Large\bfseries\arabic{section}.~{#2}}\\[1.5ex] +\setkeys{sectioning}{#1}} +{} +\newcounter{subsection}[section] +\newenvironment{csubsection}[2][] +{\refstepcounter{subsection}\strut\\[1ex]\noindent% +{\large\bfseries{\arabic{section}.\arabic{subsection}.~#2\\[1ex]}}% +\setkeys{sectioning}{#1}}% +{} +\newcounter{subsubsection}[subsection] +\newenvironment{csubsubsection}[2][] +{\refstepcounter{subsubsection}\strut\\[.5ex]\noindent +{\bfseries\arabic{section}.\arabic{subsection}.\arabic{subsubsecction}~#2\\[.5ex]}% +\setkeys{sectioning}{#1}}{} +%</cls> +%<*ltxml> +DefKeyVal('sectioning','id','Semiverbatim'); +DefEnvironment('{csection}OptionalKeyVals:sectioning{}', + "<cnx:section %&KeyVals(#1)>\n" + . "?#2(<cnx:name>#2</cnx:name>\n)()" + . "#body\n</cnx:section>\n"); +DefEnvironment('{csubsection}OptionalKeyVals:sectioning{}', + "<cnx:section %&KeyVals(#1)>\n" + . "?#2(<cnx:name>#2</cnx:name>\n)()" + . "#body\n</cnx:section>\n"); +DefEnvironment('{csubsubsection}OptionalKeyVals:sectioning{}', + "<cnx:section %&KeyVals(#1)>\n" + . "?#2(<cnx:name>#2</cnx:name>\n)()" + . "#body\n</cnx:section>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{cpara} +% For the |<cnx:para>| element we have to do some work, since we want them to be +% numbered. This handline is adapted from Bruce Miller's |LaTeX.ltxml| +% numberd. +% \begin{macrocode} +%<*cls> +\define@key{para}{id}{} +\newenvironment{cpara}[1][]{\setkeys{para}{#1}}{\par} +%</cls> +%<*ltxml> +DefKeyVal('para','id','Semiverbatim'); +DefEnvironment('{cpara} OptionalKeyVals:para','<cnx:para %&KeyVals(#1)>#body</cnx:para>'); +sub number_para { + my($document,$node,$whatsit)=@_; + # Get prefix from first parent with an id. + my(@parents)=$document->findnodes('ancestor::*[@id]',$node); # find 1st id'd parent. + my $prefix= (@parents ? $parents[$#parents]->getAttribute('id')."." : ''); + # Get the previous number within parent; Worried about intervening elements around para's, but... + my(@siblings)=$document->findnodes("preceding-sibling::cnx:para",$node); + my $n=1; + $n = $1+1 if(@siblings && $siblings[$#siblings]->getAttribute('id')=~/(\d+)$/); + $node->setAttribute(id=>$prefix."p$n"); } +Tag('cnx:para',afterOpen=>\&number_para); +DefConstructor('\par',sub { $_[0]->maybeCloseElement('cnx:para'); },alias=>"\\par\n"); +Tag('cnx:para', autoClose=>1, autoOpen=>1); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{cnote} +% \begin{macrocode} +%<*cls> +\define@key{note}{id}{} +\define@key{note}{type}{\def\note@type{#1}} +\newenvironment{cnote}[1][]% +{\setkeys{note}{#1}\par\noindent\strut\hfill\begin{minipage}{10cm}{\bfseries\note@type}:~}% +{\end{minipage}\hfill\strut\par} +%</cls> +%<*ltxml> +DefKeyVal('note','id','Semiverbatim'); +DefKeyVal('note','type','Semiverbatim'); +DefEnvironment('{cnote}OptionalKeyVals:note','<cnx:note %&KeyVals(#1)>#body</cnx:note>'); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \subsection{Mathematics} +% +% \begin{environment}{cequation} +% \begin{macrocode} +%<*cls> +\define@key{equation}{id}{} +\newenvironment{cequation}[1][]% +{\setkeys{equation}{#1}\begin{displaymath}} +{\end{displaymath}} +%</cls> +%<*ltxml> +DefKeyVal('equation','id','Semiverbatim'); +DefEnvironment('{cequation} OptionalKeyVals:equation', + "<cnx:equation %&KeyVals(#1)>" + . "<ltx:Math mode='display'>" + . "<ltx:XMath>#body</ltx:XMath>" + . "</ltx:Math></cnx:equation>", + mode=>'display_math'); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \subsection{Rich Text} +% +% In this section, we redefine some of {\LaTeX} commands that have their counterparts in +% {\cnxml}. +% +% \begin{environment}{quote} +% \begin{macrocode} +%<*cls> +\define@key{cquote}{id}{} +\define@key{cquote}{type}{} +\define@key{cquote}{src}{} +\newenvironment{cquote}[1][]{% +\setkeys{cquote}{#1}\begin{center}\begin{minipage}{.8\textwidth}}{\end{minipage}\end{center}} +%</cls> +%<*ltxml> +DefKeyVal('cquote','id','Semiverbatim'); +DefKeyVal('cquote','type','Semiverbatim'); +DefKeyVal('cquote','src','Semiverbatim'); +DefEnvironment('{cquote} OptionalKeyVals:cquote', + "<cnx:quote %&KeyVals(#1)>#body</cnx:quote>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{footnote} +% \begin{macrocode} +%<*ltxml> +DefConstructor('\footnote[]{}',"<cnx:note type='foot'>#2</cnx:note>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{emph} +% \begin{macrocode} +%<*ltxml> +DefConstructor('\emph{}',"<cnx:emphasis>#1</cnx:emphasis>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{displaymath, eqnarray} +% We redefine the abbreviate display math envionment and the |eqnarray| and |eqnarray*| +% environments to use the {\cnxml} equation tags, everything else stays the same. +% +% \begin{macrocode} +%<*ltxml> +DefConstructor('\[', + "<cnx:equation id='#id'>" + . "<ltx:Math mode='display'>" + . "<ltx:XMath>" + . "#body" + . "</ltx:XMath>" + . "</ltx:Math>" + ."</cnx:equation>", + beforeDigest=> sub{ $_[0]->beginMode('display_math'); }, + captureBody=>1, + properties=> sub { RefStepID('equation') }); +DefConstructor('\]' ,"",beforeDigest=> sub{ $_[0]->endMode('display_math'); }); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{displaymath} +% We redefine the abbreviate display math envionment to use the {\cnxml} equation tags, +% everything else stays the same.\ednote{check {\tt{LaTeX.ltxml}} frequently and try to +% keep in sync, it would be good, if the code in LaTeXML.ltxml could be modularized, +% so that the {\tt{cnx}}/{\tt{ltx}} namespace differences could be relegated to +% config options} +% +% \begin{macrocode} +%<*ltxml> +DefConstructor('\[', + "<cnx:equation id='#id'>" + . "<ltx:Math mode='display'>" + . "<ltx:XMath>" + . "#body" + . "</ltx:XMath>" + . "</ltx:Math>" + ."</cnx:equation>", + beforeDigest=> sub{ $_[0]->beginMode('display_math'); }, + captureBody=>1, + properties=> sub { RefStepID('equation') }); +DefConstructor('\]' ,"",beforeDigest=> sub{ $_[0]->endMode('display_math'); }); + +DefMacro('\eqnarray', '\@@eqnarray\@start@alignment'); +DefMacro('\endeqnarray', '\@finish@alignment\end@eqnarray'); +DefMacro('\csname eqnarray*\endcsname', '\@@eqnarray*\@start@alignment'); +DefMacro('\csname endeqnarray*\endcsname', '\@finish@alignment\end@eqnarray'); +DefConstructor('\@@eqnarray OptionalMatch:* AlignmentBody:\end@eqnarray', + sub { + my($document,$star,$body,%props)=@_; + $document->openElement('cnx:equation',refnum=>$props{refnum},id=>$props{id}); + $document->openElement('ltx:Math',mode=>'display'); + $document->openElement('ltx:XMath'); + constructAlignment($document,$body,attributes=>{name=>'eqnarray'}); + $document->closeElement('ltx:XMath'); + $document->closeElement('ltx:Math'); + $document->closeElement('cnx:equation'); }, + mode=>'display_math', + beforeDigest=>sub { alignmentBindings('rcl'); }, + properties=> sub { ($_[1] ? RefStepID('equation') : RefStepCounter('equation')); }, + afterDigest=>sub { + $_[1]->setProperty(body=>$_[1]->getArg(2));}, # So we get TeX + reversion=>'\begin{eqnarray#1}#2\end{eqnarray#1}'); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{displaymath} +% We redefine the abbreviate display math envionment to use the {\cnxml} equation tags, +% everything else stays the same.\ednote{check {\tt{LaTeX.ltxml}} frequently and try to +% keep in sync, it would be good, if the code in LaTeXML.ltxml could be modularized, +% so that the {\tt{cnx}}/{\tt{ltx}} namespace differences could be relegated to +% config options} +% +% \begin{macrocode} +%<*cls> +\newcommand{\litem}[2][]{\item[#1]\label{#2}} +%</cls> +%<*ltxml> +Tag('cnx:item', autoClose=>1); +DefConstructor('\item[]',"<cnx:item>?#1(<cnx:name>#1</cnx:name>)"); +DefConstructor('\litem[]{}',"<cnx:item id='#2'>?#1(<cnx:name>#1</cnx:name>)"); +DefConstructor('\itemize@item[]', + "<cnx:item id='#id'>?#1(<cnx:name>#1</cnx:name>)", + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\enumerate@item[]', + "<cnx:item id='#id'>?#1(<cnx:name>#1</cnx:name>)", + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\description@item[]', + "<cnx::item id='#id'>?#1(<cnx:name>#1</cnx:name>)", + properties=>sub{ RefStepItemCounter(); }); +AssignValue(itemlevel=>0); +DefEnvironment('{itemize}', + "<cnx:list id='#id' type='itemize'>#body</cnx:list>", + properties=>sub { beginItemize('itemize'); }); +DefEnvironment('{enumerate}', + "<cnx:list type='enumerate' id='#id'>#body</cnx:list>", + properties=>sub { beginItemize('enumerate'); }); +DefEnvironment('{description}', + "<cnx:list type='description' id='#id'>#body</cnx:list>", + properties=>sub { beginItemize('description'); }); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% The next set of commands and environemnts are largely presentational, so we just skip +% them. +% +% \begin{macrocode} +%<*ltxml> +DefEnvironment('{center}','#body'); +DefEnvironment('{minipage}{}','#body'); +DefEnvironment('{small}','#body'); +DefEnvironment('{footnotesize}','#body'); +DefEnvironment('{tiny}','#body'); +DefEnvironment('{scriptsize}','#body'); +%</ltxml> +% \end{macrocode} +% +% \begin{macrocode} +%<*ltxml> +DefConstructor('\ref Semiverbatim', "<cnx:cnxn target='#1'>&LookupValue('LABEL@#1')</cnx:cnxn>"); +%</ltxml> +% \end{macrocode} +% +% \subsection{Statements} +% +% \begin{environment}{cexample} +% \begin{macrocode} +%<*cls> +\define@key{example}{id}{} +\define@key{example}{name}{\def\example@name{#1}} +\newenvironment{cexample}[1][]{\setkeys{example}{#1} +{\@ifundefined{example@name}{}{\noindent\bfseries{\example@name}}}} +{} +%</cls> +%<*ltxml> +DefKeyVal('example','id','Semiverbatim'); +DefEnvironment('{cexample}OptionalKeyVals:example', + "<cnx:example %&KeyVals(#1)>#body</cnx:example>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{cexercise} +% The |cexercise|, |cproblem| and |csolution| environments are very simple to set up for +% {\LaTeX}. For the {\latexml} side, we simplify matters considerably for the moment by +% restricting the possibilities we have on the {\cnxml} side: We assume that the content +% is just one |<cnx:para>| element for the |<cnx:problem>| and |<cnx:solution>| +% elements.\ednote{relax this when we have automated the generation of {\tt{cnx:para}} +% elements} +% \begin{macrocode} +%<*cls> +\newcounter{cexercise} +\define@key{cexercise}{id}{} +\define@key{cexercise}{name}{\def\cexercise@name{#1}} +\newenvironment{cexercise}[1][]{\setkeys{cexercise}{#1} +{\@ifundefined{cexercise@name}{}{\stepcounter{cexercise}\noindent\bfseries{\cexercise@name~\arabic{cexercise}}}}} +{} +\define@key{cproblem}{id}{} +\newenvironment{cproblem}[1][]{\setkeys{cproblem}{#1}}{}{} +\define@key{csolution}{id}{} +\newenvironment{csolution}[1][]{\setkeys{csolution}{#1}}{\par\noindent\bfseries{Solution}}{} +%</cls> +%<*ltxml> +DefKeyVal('cexercise','id','Semiverbatim'); +DefKeyVal('cexercise','name','Semiverbatim'); +DefEnvironment('{cexercise}OptionalKeyVals:exercise', + "<cnx:exercise ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>" + . "#body" + . "</cnx:exercise>"); +DefKeyVal('cproblem','id','Semiverbatim'); +DefKeyVal('cproblem','name','Semiverbatim'); +DefEnvironment('{cproblem}OptionalKeyVals:cproblem', + "<cnx:problem ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'name')(<cnx:name>&KeyVal(#1,'name')</cnx:name>\n)()" + . "#body" + . "</cnx:problem>"); +DefKeyVal('csolution','id','Semiverbatim'); +DefKeyVal('csolution','name','Semiverbatim'); +DefEnvironment('{csolution}OptionalKeyVals:cproblem', + "<cnx:solution ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'name')(<cnx:name>&KeyVal(#1,'name')</cnx:name>\n)()" + . "#body" + . "</cnx:solution>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{crule} +% \begin{macrocode} +%<*cls> +\define@key{rule}{id}{} +\define@key{rule}{name}{\def\rule@name{#1}} +\define@key{rule}{type}{\def\rule@type{#1}} +\newenvironment{crule}[1][]{\setkeys{rule}{#1}% +{\noindent\bfseries{\rule@type:}\@ifundefined{rule@name}{}{~(\rule@name)}}}% +{} +%</cls> +%<*ltxml> +DefKeyVal('rule','id','Semiverbatim'); +DefKeyVal('rule','name','Semiverbatim'); +DefKeyVal('rule','type','Semiverbatim'); +DefEnvironment('{crule}OptionalKeyVals:rule', + "<cnx:rule ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')() type='&KeyVal(#1,'type')'>\n" + . "?&KeyVal(#1,'name')(<cnx:name>&KeyVal(#1,'name')</cnx:name>\n)()" + . "\n#body\n" + . "</cnx:rule>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{statement} +% \begin{macrocode} +%<*cls> +\define@key{statement}{id}{} +\newenvironment{statement}[1][]{\setkeys{statement}{#1}}{} +%</cls> +%<*ltxml> +DefKeyVal('statement','id','Semiverbatim'); +DefEnvironment('{statement}OptionalKeyVals:statement','<cnx:statement %&KeyVals(#1)>#body</cnx:statement>'); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{proof} +% \begin{macrocode} +%<*cls> +\define@key{proof}{id}{} +\newenvironment{proof}[1][]{\setkeys{proof}{#1}}{} +%</cls> +%<*ltxml> +DefKeyVal('proof','id','Semiverbatim'); +DefEnvironment('{proof}OptionalKeyVals:proof','<cnx:proof %&KeyVals(#1)>#body</cnx:proof>'); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{definition} +% \begin{macrocode} +%<*cls> +\define@key{definition}{term}{} +\define@key{definition}{id}{} +\define@key{definition}{seealso}{} +\newenvironment{definition}[1][]{\setkeys{definition}{#1}{\noindent\bfseries{Definition:}}}{} +%</cls> +%<*ltxml> +DefKeyVal('definition','id','Semiverbatim'); +DefKeyVal('definition','term','Semiverbatim'); +DefKeyVal('definition','seealso','Semiverbatim'); +DefEnvironment('{definition}OptionalKeyVals:definition', + "<cnx:definition ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>\n" + . "?&KeyVal(#1,'term')(<cnx:term>&KeyVal(#1,'term')</cnx:term>\n)()" + . "\n#body\n" + . "?&KeyVal(#1,'seealso')(<cnx:seealso><cnx:term>&KeyVal(#1,'term')</cnx:term></cnx:seealso>\n)()" + . "</cnx:definition>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{cmeaning} +% \begin{macrocode} +%<*cls> +\define@key{meaning}{id}{} +\newenvironment{cmeaning}[1][]{\setkeys{meaning}{#1}}{} +%</cls> +%<*ltxml> +DefKeyVal('meaning','id','Semiverbatim'); +DefEnvironment('{cmeaning}OptionalKeyVals:meaning','<cnx:meaning %&KeyVals(#1)>#body</cnx:meaning>'); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \subsection{Conexxions} +% +% \begin{macro}{cnxn} +% \begin{macrocode} +%<*cls> +\define@key{cnxn}{document}{\def\cnxn@doc{#1}} +\define@key{cnxn}{target}{\def\cnxn@target{#1}} +\define@key{cnxn}{strength}{} +\newcommand{\cnxn}[2][]% keys, link text +{\setkeys{cnxn}{#1}{\underline{#2}}\footnote{{\ttfamily\@ifundefined{cnxn@doc}{\cnxn@doc}{}\#\cnxn@target}}} +\newcommand\@makefntext[1]{\parindent 1em\noindent\hb@xt@1.8em{\hss\@makefnmark}#1} +%</cls> +%<*ltxml> +DefKeyVal('cnxn','document','Semiverbatim'); +DefKeyVal('cnxn','target','Semiverbatim'); +DefKeyVal('cnxn','strength','Semiverbatim'); +DefConstructor('\cnxn OptionalKeyVals:cnxn {}','<cnx:cnxn %&KeyVals(#1)>#1</cnx:cnxn>'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{link} +% \begin{macrocode} +%<*cls> +\define@key{link}{src}{} +\newcommand{\link}[2][]{\setkeys{link}{#1}\underline{#2}} +%</cls> +%<*ltxml> +DefKeyVal('link','src','Semiverbatim'); +DefConstructor('\link OptionalKeyVals:link {}','<cnx:link %&KeyVals(#1)>#2</cnx:link>'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cfigure} +% The |cfigure| only gives us one of the possible instances of the |<figure>| +% element\ednote{extend that}.\ednote{do more about required and optional keys in +% arguments.} In {\LaTeX}, we just pipe the size information through to +% |includegraphics|, in {\latexml}, we construct the {\cnxml} structure\ednote{what do +% we do with the graphicx information about size,... CSS?} +% \begin{macrocode} +%<*cls> +\define@key{cfigure}{id}{\def\cf@id{#1}} +\define@key{cfigure}{type}{} +\define@key{cfigure}{caption}{\def\cf@caption{#1}} +\newcounter{figure} +\newcommand{\cfigure}[3][]{% cnx_keys, graphicx_keys, path +\begin{center}% +\includegraphics[#2]{#3}% +\setkeys{cfigure}{#1}% +\@ifundefined{cfigure@caption}{}{{\par\noindent Figure\refstepcounter{figure}} {\arabic{figure}}: \cf@caption% +\protected@edef\@currentlabel{\arabic{figure}}% +\@ifundefined{cf@id}{}{\label{\cf@id}}}% +\end{center}} +%</cls> +%<*ltxml> +DefKeyVal('cfigure','id','Semiverbatim'); +DefKeyVal('cfigure','name','Semiverbatim'); +DefKeyVal('cfigure','type','Semiverbatim'); +DefKeyVal('cfigure','caption','Semiverbatim'); +DefConstructor('\cfigure OptionalKeyVals:cfigure Semiverbatim Semiverbatim', + "<cnx:figure ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'name')(<cnx:name>&KeyVal(#1,'name')</cnx:name>\n)()" + . "<cnx:media type='&KeyVal(#1,'type')' src='#3'/>" + . "?&KeyVal(#1,'caption')(<cnx:caption>&KeyVal(#1,'caption')</cnx:caption>\n)()" + . "</cnx:figure>"); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ccite} +% \begin{macrocode} +%<*cls> +\define@key{ccite}{src}{} +\newcommand{\ccite}[2][]{\setkeys{ccite}{#1}\emph{#2}} +%</cls> +%<*ltxml> +DefKeyVal('ccite','src','Semiverbatim'); +DefConstructor('\ccite OptionalKeyVals:ccite {}','<cnx:cite %&KeyVals(#1)>#2</cnx:cite>'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{term} +% \begin{macrocode} +%<*cls> +\newcommand{\term}[1]{{\bfseries\underline{#1}}} +%</cls> +%<*ltxml> +DefConstructor('\term[]{}',"<cnx:term>#2</cnx:term>"); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \subsection{Metadata} +% +% \begin{environment}{metadata} +% \begin{macrocode} +%<*cls> +\define@key{metadata}{version}{} +\define@key{metadata}{created}{} +\define@key{metadata}{revised}{} +\newsavebox{\metadatabox} +\newenvironment{metadata}[1][]% +{\noindent\hfill\begin{lrbox}{\metadatabox} +\begin{minipage}{.8\textwidth}% +{\Large\bfseries CNX Module: \cnx@title\hfill\strut}\\[2ex]}% +{\end{minipage}\end{lrbox}\fbox{\usebox\metadatabox}\hfill} +% \newenvironment{metadata}[1][]% +% {\noindent\strut\hfill\begin{lrbox}{\metadatabox}\begin{minipage}{10cm}% +% {\strut\hfill\Large\bfseries CNX Module: \cnx@title\hfill\strut}\\[2ex]}% +% {\end{minipage}\end{lrbox}\fbox{\usebox\metadatabox}\hfill\strut\\[3ex]} +%</cls> +%<*ltxml> +DefKeyVal('metadata','version','Semiverbatim'); +DefKeyVal('metadata','created','Semiverbatim'); +DefKeyVal('metadata','revised','Semiverbatim'); +DefEnvironment('{metadata}OptionalKeyVals:metadata', + "<cnx:metadata>\n" + . "<md:version>&KeyVal('#1','version')</md:version>\n" + . "<md:created>&KeyVal('#1','created')</md:created>\n" + . "<md:revised>&KeyVal('#1','revised')</md:revised>\n" + . "#body\n" + . "</cnx:metadata>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{authorlist} +% \begin{macrocode} +%<*cls> +\newenvironment{authorlist}{{\bfseries{Authors}:~}}{\\[1ex]} +%</cls> +%<*ltxml> +DefEnvironment('{authorlist}',"<md:authorlist>#body</md:authorlist>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{maintainerlist} +% \begin{macrocode} +%<*cls> +\newenvironment{maintainerlist}{{\bfseries{Maintainers}:~}}{\\[1ex]} +%</cls> +%<*ltxml> +DefEnvironment('{maintainerlist}',"<md:maintainerlist>#body</md:maintainerlist>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{cnxauthor} +% \begin{macrocode} +%<*cls> +\define@key{auth}{id}{} +\define@key{auth}{honorific}{\def\auth@honorific{#1}} +\define@key{auth}{firstname}{\def\auth@first{#1}} +\define@key{auth}{other}{\def\auth@other{#1}} +\define@key{auth}{surname}{\def\auth@sur{#1}} +\define@key{auth}{lineage}{\def\auth@line{#1}} +\define@key{auth}{email}{} +\newcommand{\cnxauthor}[1][]{\setkeys{auth}{#1}\auth@first~\auth@sur,} +%</cls> +%<*ltxml> +DefKeyVal('auth','id','Semiverbatim'); +DefKeyVal('auth','firstname','Semiverbatim'); +DefKeyVal('auth','surname','Semiverbatim'); +DefKeyVal('auth','email','Semiverbatim'); +DefConstructor('\cnxauthor OptionalKeyVals:auth', + "<md:author id='&KeyVal('#1','id')'>\n" + . "?&KeyVal(#1,'honorific')(<md:honorific>&KeyVal('#1','honorific')</md:honorific>\n)()" + . "?&KeyVal(#1,'firstname')(<md:firstname>&KeyVal('#1','firstname')</md:firstname>\n)()" + . "?&KeyVal(#1,'other')(<md:other>&KeyVal('#1','other')</md:other>\n)()" + . "?&KeyVal(#1,'surname')(<md:surname>&KeyVal('#1','surname')</md:surname>\n)()" + . "?&KeyVal(#1,'lineage')(<md:lineage>&KeyVal('#1','lineage')</md:lineage>\n)()" + . "?&KeyVal(#1,'email')(<md:email>&KeyVal('#1','email')</md:email>\n)()" + . "</md:author>\n"); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{maintainer} +% \begin{macrocode} +%<*cls> +\newcommand{\maintainer}[1][]{\setkeys{auth}{#1}\auth@first~\auth@sur,} +%</cls> +%<*ltxml> +DefConstructor('\maintainer OptionalKeyVals:auth', + "<md:maintainer id='&KeyVal('#1','id')'>\n" + . "?&KeyVal(#1,'honorific')(<md:honorific>&KeyVal('#1','honorific')</md:honorific>\n)()" + . "?&KeyVal(#1,'firstname')(<md:firstname>&KeyVal('#1','firstname')</md:firstname>\n)()" + . "?&KeyVal(#1,'other')(<md:other>&KeyVal('#1','other')</md:other>\n)()" + . "?&KeyVal(#1,'surname')(<md:surname>&KeyVal('#1','surname')</md:surname>\n)()" + . "?&KeyVal(#1,'lineage')(<md:lineage>&KeyVal('#1','lineage')</md:lineage>\n)()" + . "?&KeyVal(#1,'email')(<md:email>&KeyVal('#1','email')</md:email>\n)()" + . "</md:maintainer>\n"); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{keywordlist} +% \begin{macrocode} +%<*cls> +\newenvironment{keywordlist}{\bfseries{Keywords}:~}{\\[1ex]} +%</cls> +%<*ltxml> +DefEnvironment('{keywordlist}',"<md:keywordlist>\n#body\n</md:keywordlist>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{keyword} +% \begin{macrocode} +%<*cls> +\newcommand{\keyword}[1]{#1,} +%</cls> +%<*ltxml> +DefConstructor('\keyword {}',"<md:keyword>#1</md:keyword>"); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{cnxabstract} +% \begin{macrocode} +%<*cls> +\newenvironment{cnxabstract}% +{\par\noindent\strut\hfill\begin{minipage}{10cm}{\bfseries{Abstract}:~}}% +{\end{minipage}\hfill} +%</cls> +%<*ltxml> +DefEnvironment('{cnxabstract} OptionalKeyVals:cnxabstract', + "<md:abstract>\n#body\n</md:abstract>\n"); +1; +%</ltxml> +% \end{macrocode} +% \end{environment} +% \Finale +\endinput + +% \iffalse +%%% Local Variables: +%%% mode: doctex +%%% TeX-master: t +%%% End: +% \fi diff --git a/Master/texmf-dist/source/latex/stex/cnx.ins b/Master/texmf-dist/source/latex/stex/cnx.ins new file mode 100644 index 00000000000..37b12071964 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/cnx.ins @@ -0,0 +1,35 @@ +%% +%% This file generates files required to use the ed package. +%% At your command prompt write +%% +%% latex cnx.ins +%% +%% Copyright(c) 2005 Michael Kohlhase +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.0 or, at your option, any later version. +%% +\input docstrip +\preamble +\endpreamble + +%\usedir{tex/latex/listings} +\keepsilent +\askforoverwritefalse + +% generate base package +\generate{\file{cnx.cls}{\from{cnx.dtx}{cls}} +% generated the LaTeXML bindings +\nopreamble\nopostamble + \file{cnx.cls.ltxml}{\from{cnx.dtx}{ltxml}}} + +\Msg{*} +\Msg{* You probably need to move the generated style files into a directory} +\Msg{* searched by TeX and LaTeXML respectively.} +\Msg{*} +\Msg{* And don't forget to refresh your filename database} +\Msg{* if your TeX distribution uses such a database.} +\Msg{*} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/stex/modules.dtx b/Master/texmf-dist/source/latex/stex/modules.dtx new file mode 100644 index 00000000000..3f9f8e46d86 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/modules.dtx @@ -0,0 +1,1054 @@ +% \iffalse meta-comment +% An Infrastructure for Semantic Macros and Module Scoping +% Copyright (C) 2004-2006 Michael Kohlhase, all rights reserved +% this file is released under the +% LaTeX Project Public License (LPPL) +% +% The development version of this file can be found at +% https://svn.kwarc.info/repos/kwarc/projects/stex/sty/modules.dtx +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{modules}[2006/01/13 v0.9a Semantic Markup] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{url,array,modules,float} +\usepackage[show]{ed} +\usepackage{hyperref} +\makeindex +\floatstyle{boxed} +\newfloat{exfig}{thp}{lop} +\floatname{exfig}{Example} +\begin{document}\DocInput{modules.dtx}\end{document} +%</driver> +% \fi +% +% \CheckSum{539} +% +% \changes{v0.9}{2005/06/14}{First Version with Documentation} +% \changes{v0.9a}{2005/07/01}{Completed Documentation} +% \changes{v0.9b}{2005/08/06}{Complete functionality and Updated Documentation} +% \changes{v0.9c}{2006/01/13}{more packaging} +% \changes{v0.9d}{2007/12/12}{fixing double loading of .tex and .sms} +% +% \GetFileInfo{modules.sty} +% +% \MakeShortVerb{\|} +%\def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}} +% \def\stex{{\raisebox{-.5ex}S\kern-.5ex\TeX}} +% \def\sTeX{\stex} +% \def\xml{\scsys{Xml}} +% \def\mathml{\scsys{MathML}} +% \def\omdoc{\scsys{OMDoc}} +% \def\openmath{\scsys{OpenMath}} +% \def\latexml{\scsys{LaTeXML}} +% \def\perl{\scsys{Perl}} +% \def\cmathml{Content-{\sc MathML}\index{Content {\sc MathML}}\index{MathML@{\sc MathML}!content}} +% \def\activemath{\scsys{ActiveMath}} +% \def\twin#1#2{\index{#1!#2}\index{#2!#1}} +% \def\twintoo#1#2{{#1 #2}\twin{#1}{#2}} +% \def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}} +% \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} +% \title{Semantic Macros and Module Scoping in {\stex}\thanks{Version {\fileversion} (last revised +% {\filedate})}} +% \author{Michael Kohlhase \& Rares Ambrus\\ +% Jacobs University, Bremen\\ +% \url{http://kwarc.info/kohlhase}} +% \maketitle +% +% \begin{abstract} +% The |modules| packge is a central part of the {\stex} collection, a version of +% {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents semantically without +% leaving the document format, essentially turning {\TeX/\LaTeX} into a document format +% for mathematical knowledge management (MKM). +% +% This package supplies a definition mechanism for semantic macros and a non-standard +% scoping construct for them, which is oriented at the semantic depency relation rather +% than the document structure. This structure can be used by MKM systems for +% added-value services, either directly from the {\sTeX} sources, or after translation. +% \end{abstract} +%\newpage +% \section{Introduction}\label{sec:intro} +% +% Following general practice in the {\TeX/\LaTeX} community, we use the term ``semantic +% macro'' for a macro whose expansion stands for a mathematical object, and whose name +% takes up the name of the mathematical object. This can range from simple definitions +% like |\def\Reals{{\mathbb R}}| for indivicual mathematical objects to more complex +% (functional) ones object constructors like +% |\def\SmoothFunctionsOn#1{{\cal{C}}^\infty(#1)}|. Semantic macros are traditionally used +% to make {\TeX/\LaTeX} code more portable. However, the {\TeX/\LaTeX} scoping model +% (macro definitions are scoped either in the local group or until the rest of the +% document), does not mirror mathematical practice, where notations are scoped by +% mathematical environments like statements, theories, or such. +% +% \section{The User Interface} +% +% The main contributions of the |modules| package are the |module| environment, which +% allows for lexical scoping of semantic macros with inheritance and the |\symdef| macro +% for declaration of semantic macros that underly the |module| scoping. +% +% \subsection{Modules}\label{sec:modules} +% +% \DescribeEnv{module} The |module| environment takes an optional |KeyVal| +% argument. Currently, only the |id| key is supported for specifying the identifier of a +% module (also called the {\twintoo{module}{name}}). +% +% \DescribeMacro{\importmodule} A module introduced by |\begin{module}[id=foo]| restricts +% the scope the semantic macros defined by the |\symdef| form to the end of this module +% given by the corresponding |\end{module}|, and to any other |module| environments that +% import them by a |\importmodule{foo}| directive. If the module |foo| contains +% |\importmodule| directives of its own, these are also exported to the importing +% module. Thus |\importmodule| induces the {\atwintoo{semantic}{inheritance}{relation}} +% and |usesqualified|\ednote{do an importqualified as well} for macros imported with a +% prefix (this is used whenever we have conflicting names for macros inherited from +% different modules). +% +% \subsection{Semantic Macros}\label{sec:symdef} +% +% \DescribeMacro{\symdef}A call to the |\symdef| macro has the general form +% \begin{quote} +% |\symdef[|\meta{keys}|]{|\meta{cseq}|}[|\meta{args}|]{|\meta{definiens}|}| +% \end{quote} +% where {\meta{cseq}} is a control sequence (the name of the semantic macro) {\meta{args}} +% is a number between 0 and 9 for the number of arguments {\meta{definiens}} is the token +% sequence used in macro expansion for {\meta{cseq}}. Finally {\meta{keys}} is a keyword +% list that further specifies the semantic status of the defined macro. +% +% A key |local| can be added to {\meta{keys}} to specify that the symbol is local to the +% module and is invisible outside. The key-value pair |aliases=|\meta{symname} specifies +% that the defined symbol {\meta{cseq}} is a presentational variant of the symbol +% {\meta{symname}}. +% +% Finallly, the keys |cmml|, |cattrs|, and |definitionURL| can be used to specify the +% {\cmathml} encoding of the symbols. They key-value pair |cmml=|\meta{elt} specifies that +% the semantic macro corresponds to the {\cmathml} element with the name \meta{elt}, +% |cattrs=|\meta{attrtring} its argument string and |definitionURL| allows to specify the +% |definitionURL| attribute on that element. The most common case will be a symbol +% definition of the following form: +% +% \begin{quote} +% |\symdef[cmml=csymbol,definitionURL=|\meta{URI}|]{|\meta{cseq}|}[|\meta{args}|]{|\meta{definiens}|}| +% \end{quote} +% +% where \meta{URI} is the URI pointing to the location of the {\xml} file generated from +% the current {\LaTeX} file. +% +% \DescribeMacro{\abbrdef}The |\abbrdef| macro is a variant of |\symdef| that is only +% different in semantics, not in presentation. An abbreviative macro is like a semantic +% macro, and underlies the same scoping and inheritance rules, but it is just an +% abbreviation that is meant to be expanded, it does not stand for an atomic mathematical +% object. +% +% We will use a simple module for natural number arithmetics as a running example. It +% defines exponentiation and summation as new concepts while drawing on the basic +% operations like $+$ and $-$ from {\LaTeX}. In our example, we will define a semantic +% macro for summation |\Sumfromto|, which will allow us to express an expression like +% $\sum{i=1}^nx^i$ as |\Sumfromto{i}1n{2i-1}| (see Example~\ref{fig:semmodule} for an +% example). In this example we have also made use of a local semantic symbol for $n$, +% which is treated as an arbitrary (but fixed) symbol. +% +% \begin{module}[id=arith] +% \symdef{Sumfromto}[4]{\sum_{#1=#2}^{#3}{#4}} +% \symdef[local]{arbitraryn}{n} +% +%\begin{exfig} +% \begin{verbatim} +% \begin{module}[id=arith] +% \symdef{Sumfromto}[4]{\sum_{#1=#2}^{#3}{#4}} +% \symdef[local]{arbitraryn}{n} +% What is the sum of the first $\arbitraryn$ odd numbers, i.e. +% $\Sumfromto{i}1\arbitraryn{2i-1}?$ +% \end{module} +% \end{verbatim} +% \vspace{-2em}is formatted by {\sTeX} to \medskip\par\noindent +% What is the sum of the first $\arbitraryn$ odd numbers, i.e. +% $\Sumfromto{i}1\arbitraryn{2i-1}?$ +% \caption{Semantic Markup in a {\tt{module}} context}\label{fig:semmodule} +% \end{exfig} +% \end{module} +% +% \subsection{Dealing with multiple Files}\label{sec:user:multiple} +% +% The infrastructure presented above works well if we are dealing with small files or +% small collections of modules. In reality, collections of modules tend to grow, get +% re-used, etc, making it much more difficult to keep everything in one file. This general +% trend towards increasing enthropy is aggravated by the fact that modules are very +% self-contiained objects that are ideal for re-used. Therefore in the absence of a +% content management system for {\LaTeX} document (fragments), module collections tend to +% develop towards the ``one module one file'' rule, which leads to situations with lots +% and lots of little files. +% +% Moreover, most mathematical documents are not self-contained, i.e. they do not build up +% the theory from scratch, but pre-suppose the knowledge (and notation) from other +% documents. In this case we want to make use of the semantic macros from these +% prerequisite documents without including their text into the current document. One way +% to do this would be to have {\LaTeX} read the prerequisite documents without producing +% output. For efficiency reasons, {\stex} chooses a different route. It comes with a +% utility |sms| (see Section~\ref{sec:utilities}) that exports the modules and macros +% defined inside them from a particular document and stores them inside |.sms| files. This +% way we can avoid overloading LaTeX with useless information, while retaining the +% important information which can then be imported in a more efficient way. +% +% \DescribeMacro{\importmodule} For such situations, the |\importmodule| macro can be +% given an optional first argument that is a path to a file that contains a path to the +% module file, whose module definition (the |.sms| file) is read. Note that the +% |\importmodule| macro can be used to make module files truly self-contained. To arrive +% at a file-based content management system, it is good practice to reuse the module +% identifiers as module names and to prefix module files with corresponding +% |\importmodule| statements that pre-load the corresponing module files. +% +%\begin{exfig} +% \begin{verbatim} +% \begin{module}[id=foo] +% \importmodule[../other/bar]{bar} +% \importmodule[../mycolleaguesmodules]{baz} +% \importmodule[../other/bar]{foobar} +% ... +% \end{module} +% \end{verbatim} +% \vspace{-1.7em} +% \caption{Self-contained Modules via {\tt{importmodule}}}\label{exf:importmodule} +% \end{exfig} +% +% In Example~\ref{exf:importmodule}, we have shown the typical setup of a module +% file. The |\importmodule| macro takes great care that files are only read once, as +% {\sTeX} allows multiple inheritance and this setup would lead to an exponential (in the +% module inheritance depth) number of file loads. +% +% Note that the recursive (depth-first) nature of the file loads induced by this setup is +% very natural, but can lead to problems with the depth of the file stack in the {\TeX} +% formatte (it is usually set to something like 15). Therefore, it may be necessary to +% circumvent the recursive load pattern providing (logically spurious) |\importmodule| +% commands. Consider for instance module |bar| in Example~\ref{exf:importmodule}, say that +% |bar| already has load deph 15, then we cannot naivedly import it in this way. If module +% |bar| depended say on a module |base| on the critical load path, then we could add a +% statement \DescribeMacro{\requiremodules} |\requiremodules{../base}| in the second +% line. This would load the modules from |../base.sms| in advance (uncritical, since it +% has load depth 10), so that it would not have to be re-loaded in the critical path of +% the module |foo|. Solving the load depth problem. +% +% \subsection{Including Externally Defined Semantic Macros } +% +% In some cases, we use an existing {\LaTeX} macro package for typesetting objects that +% have a conventionalized mathematical meaning. In this case, the macros are ``semantic'' +% even though they have not been defined by a |\symdef|. This is no problem, if we are +% only interested in the {\LaTeX} workflow. But if we want to e.g. transform them to +% {\omdoc} via {\latexml}, the {\latexml} bindings will need to contain references to an +% {\omdoc} theory that semantically correponds to the {\LaTeX} package. In particular, +% this theory will have to be imported in the generated {\omdoc} file to make it +% {\omdoc}-valid. +% + +% \DescribeMacro{\requirepackage} To deal with this situation, the |modules| package +% provides the |\requirepackage| macro. It takes two arguments: a package name, and a URI +% of the corresponing {\omdoc} theory. In the {\LaTeX} workflow this macro behaves like a +% |\usepackage| on the first argument, except that it can --- and should --- be used +% outside the {\LaTeX} preamble. In the {\latexml} workflow, this loads the {\latexml} +% bindings of the package specified in the first argument and generates an appropriate +% |imports| element using the URI in the second argument. +% +% \StopEventually{\ednotemessage} +% +% \section{The Implementation} +% +% We declare some switches which will modify the behavior accoring to the package +% options. Generally, an option |xxx| will just set the appropriate switches to true +% (otherwise they stay false). +% \begin{macrocode} +%<*package> +\newif\ifmod@env\mod@envfalse +\newif\ifmod@id\mod@idfalse +\newif\ifmod@display\mod@displayfalse +\newif\ifmod@uses\mod@usesfalse +\newif\ifmod@usesqualified\mod@usesqualifiedfalse +\DeclareOption{env}{\mod@envtrue} +\DeclareOption{id}{\mod@idtrue} +\DeclareOption{uses}{\mod@usestrue} +\DeclareOption{display}{\mod@displaytrue} +\DeclareOption{usesqualified}{\mod@usesqualifiedtrue} +% \end{macrocode} +% Now, we define two collective options, which are equivalent to turning on all the other +% options. +% \begin{macrocode} +\def\modtrue{\mod@idtrue\mod@usestrue\mod@displaytrue\mod@usesqualifiedtrue} +\DeclareOption{draft}{\modtrue} +\DeclareOption{all}{\modtrue} +% \end{macrocode} +% Finally, we need to declare the end of the option declaration section to {\LaTeX}. +% \begin{macrocode} +\ProcessOptions +%</package> +% \end{macrocode} +% +% {\latexml} does not support module options yet, so we do not have to do anything here +% for the {\latexml} bindings. We only set up the {\perl} packages (and tell {\tt{emacs}} +% about the appropriate mode for convenience +% +% The next measure is to ensure that the |KeyVal| package is loaded (in the right +% version). for {\latexml}, we also initialize the package inclusions. +% \begin{macrocode} +%<package>\RequirePackage{keyval}[1997/11/10] +%<*ltxml> +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Global; +use LaTeXML::Package; +RequirePackage('keyval'); +%</ltxml> +% \end{macrocode} +% +% \subsection{Modules}\label{sec:impl:modules} +% +% We define the keys for the |module| environment and the actions that are undertaken, +% when the keys are encountered. +% +% \begin{macro}{module:cd} +% This |KeyVal| key is only needed for {\latexml} at the moment; use this to specify a +% content dictionary name that is different from the module name. +% \begin{macrocode} +%<package>\define@key{module}{cd}{} +%<*ltxml> +DefKeyVal('Module','cd','Semiverbatim'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{module:id} +% For a module with |[id=name]|, we create a macro |\module@defs@name| and initialize +% it. Furthermore, we save the name in |\mod@id|. +% \begin{macrocode} +%<*package> +\define@key{module}{id}{% + \edef\this@module{\expandafter\noexpand\csname module@defs@#1\endcsname}% + \edef\this@qualified@module{\expandafter\noexpand\csname module@defs@qualified@#1\endcsname}% + \global\@namedef{module@defs@#1}{} + \global\@namedef{module@defs@qualified@#1}{} + \def\mod@id{#1}} +%</package> +%<*ltxml> +DefKeyVal('Module','id','Semiverbatim'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{module} +% finally, we define the begin module command for the module environment. All the work +% has already been done in the keyval bindings, so this is very simple. +% \begin{macrocode} +%<package>\newenvironment{module}[1][]{\setkeys{module}{#1}\ifmod@env\show@mod@keys{module}\fi}{} +% \end{macrocode} +% for the {\latexml} bindings, we have to do the work all at once. +% \begin{macrocode} +%<*ltxml> +DefEnvironment('{module} OptionalKeyVals:Module', + "?#excluded()(<omdoc:theory ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')> #body</omdoc:theory>)", + #closed bracket ) seems to work fine now + + #commented this out - do we need current_theory? + #plus: keyvals->getValue seems to be undefined?! + + #beforeConstruct=> sub { + #my ($doc, $keyvals, %props) = @_; + #my $theory = $keyvals->getValue('id') if $keyvals; + #$theory = ref $theory ? $theory->toString : 'UNDEFINED'; + #AssignValue(current_theory => $theory); + #return;}, +# $Doc->openElement('omdoc:theory', 'xml:id' => $theory); +# my $uses = $keyvals->getValue('usses'); +# $uses = ref $uses ? $uses->toString || '' : ''; +# $uses =~ s/\s+//g; $uses=~ s/^\{//; $uses=~ s/\}$//; +# my $module_paths = LookupValue('module_paths') || {}; +# foreach my $used(split(',',$uses)) { +# my $file = $module_paths->{$used}; $file .= '.omdoc#' if $file; +# $doc->openElement('omdoc:imports', 'from' => $file.$used); +# $doc->closeElement('omdoc:imports'); } +# $doc->absorb($props{body}) if $props{body}; +# $doc->closeElement('omdoc:theory'); } +# return; }, + beforeDigest=>\&useTheoryItemizations, + afterDigestBegin=>sub { + my($stomach, $whatsit)=@_; + $whatsit->setProperty(excluded=>LookupValue('excluding_modules')); + + my $keys = $whatsit->getArg(1); + my($id, $cd)=$keys + && map(ToString($keys->getValue($_)),qw(id cd)); + $cd = $id unless $cd; + # update the catalog with paths for modules + my $module_paths = LookupValue('module_paths') || {}; + $module_paths->{$id} = LookupValue('last_module_path'); + AssignValue('module_paths', $module_paths, 'global'); + + #Update the current module position + AssignValue(current_module => $id); + AssignValue(module_cd => $cd) if $cd; +# my @uses = (); +# if($uses){ +# $uses =~ s/\s//g; $uses=~ s/^\{//; $uses=~ s/\}$//; +# @uses = split(',',$uses); } +############### AssignValue("module_${id}_uses" => [@uses], 'global'); + #Idea: introdcue global list of used modules and activateScope on it once at the + # main block. + #use_module($id); #22.02.08 need to ALWAYS invoke this to make things global + + #activate the module in our current scope + $STATE->activateScope("module:".$id); #changed from use_module as only needs to take care of current module + return; }); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% +% \begin{macro}{usemodule} +% The |use_module| subroutine +% performs depth-first load of definitions of the used modules +% \begin{macrocode} +%<*ltxml> +sub use_module { + my($module)=@_; + $module = ToString($module); + # Depth-first load definitions from used modules + foreach my $used_module (@{ LookupValue("module_${module}_uses") || []}){ + use_module($used_module); } + # then load definitions for this module + $STATE->activateScope("module:$module"); } +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\show@mod@keys} +% The |\show@mod@keys| macro is used for the draft mode, they allow to annotate the +% document with reminders of the key values in the modules. +% \begin{macrocode} +%<*package> +\def\show@mod@keys@aux{% +\@ifundefined{mod@id}{}{\ifmod@id{id=\mod@id},\fi}% +\@ifundefined{mod@display}{}{\ifmod@display{display=\mod@display}\fi} +\@ifundefined{mod@uses}{\relax}{\ifmod@uses{uses=\mod@uses},\fi} +\@ifundefined{mod@usesqualified}\relax\else + \ifmod@usesqualified{usesqualified=\mod@usesqualified},\fi\fi} +\def\clear@mod@keys{\let\mod@usesqualified=\relax\mod@uses=\relax + \let\st@id=\relax\let\st@display=\relax} +\def\show@mod@keys#1{\footnote{#1[\show@mod@keys@aux]}\clear@mod@keys} +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{activate@defs} +% To activate the symdefs from a given module xxx, we call the macro |\module@defs@xxx|. +% \begin{macrocode} +%<package>\def\activate@defs#1{\csname module@defs@#1\endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{export@defs} +% To export a the symdefs from the current module, we all the macros |\module@defs@xxx| +% to |\module@defs@xxx| (if the current module has a name and it is xxx) +% \begin{macrocode} +%<*package> +\def\export@defs#1{\@ifundefined{mod@id}{}{ + \expandafter\expandafter\expandafter + \g@addto@macro\expandafter + \this@module\expandafter{\csname module@defs@#1\endcsname}}} +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\importmodule} +% The |\importmodule[|\meta{file}|]{|\meta{mod}|}| macro is an interface macro that +% loads \meta{file} and activates and re-exports the symdefs from module +% \meta{mod}.\ednote{document it above, and implement it in {\latexml}} +% \begin{macrocode} +%<*package> +\newcommand{\importmodule}[2][]{\def\@test{#1}% +\ifx\@test\@empty\else\requiremodules{#1}\fi +\activate@defs{#2}\export@defs{#2}} +%</package> +%<*ltxml> +DefConstructor('\importmodule[]{}',"<omdoc:imports from='?#1(#1)\# #2'/>", + afterDigest=>sub { + my($stomach,$whatsit)=@_; + my $file = $whatsit->getArg(1); + my $module = $whatsit->getArg(2); + $module = ToString($module); + #if filepath is not supply simply look for the $module.sms file + if (!$file) {$file=ToString($module)}; + my $containing_module = LookupValue('current_module'); + #set the relation between the current module and the one to be imported + PushValue("module_".$containing_module."_uses"=>$module); + #check if we've already loaded this module + if(LookupValue('module_'.$module.'_loaded')) {use_module($module);} #if so activate it! + else { + #if not: + my $gullet = $stomach->getGullet; + #1) mark as loaded + AssignValue('module_'.$module.'_loaded' => 1, 'global'); + #open a group for its definitions so that they are localized + $stomach->bgroup; + #update the last module path + AssignValue('last_module_path', $file); + #queue the closing tag for this module in the gullet where it will be executed + #after all other definitions of the imported module have been taken care of + $gullet->unread(Invocation(T_CS('\end@requiredmodule'), T_OTHER($module))->unlist); + #we only need to load the sms definitions without generating any xml output, so we set the flag to 1 + AssignValue('excluding_modules' => 1); + #queue this module's sms file in the gullet so that its definitions are imported + $gullet->input($file,['sms']); + } + return;}); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \subsection{Semantic Macros}\label{sec:impl:symdef} +% +% We first define the optional KeyVal arguments for the |\symdef| form and the actions +% that are taken when they are encountered. +% +% \begin{macro}{symdef:aliases} +% This optional key aliases for the symdef function allows us to provide additional +% arguments representing other functions that are aliased by the one currently being +% defined. +% \begin{macrocode} +%<package>\define@key{symdef}{aliases}{} +%<*ltxml> +DefKeyVal('symdef','aliases','Semiverbatim'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{symdef:local} +% The optional argument local specifies the scope of the function to be defined. If +% local is not present as an optional argument then |\symdef| assumes the scope of the +% function is global and it will include it in the pool of macros of the current +% module. Otherwise, if local is present then the function will be defined only locally +% 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}| +% \begin{macrocode} +%<package>\define@key{symdef}{local}[true]{\@symdeflocaltrue} +%<*ltxml> +DefKeyVal('symdef','local','Semiverbatim','true'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{symdef:} +% The keys |cmmml|, |cattrs|, and |definitionURL| are not used in {\TeX/\LaTeX} +% bindings\ednote{decide what we want to do about them in the future.}. +% \begin{macrocode} +%<*package> +\define@key{symdef}{cmml}{} +\define@key{symdef}{cattrs}{} +\define@key{symdef}{definitionURL}{} +%</package> +%<*ltxml> +DefKeyVal('symdef','cmml','Semiverbatim','true'); +DefKeyVal('symdef','cattrs','Semiverbatim','true'); +DefKeyVal('symdef','definitionURL','Semiverbatim','true'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\symdef} +% The the |\symdef|, and |\@symdef| macros just handle optional arguments. +% \begin{macrocode} +%<*package> +\newif\if@symdeflocal +\def\symdef{\@ifnextchar[{\@symdef}{\@symdef[]}} +\def\@symdef[#1]#2{\@ifnextchar[{\@@symdef[#1]{#2}}{\@@symdef[#1]{#2}[0]}} +% \end{macrocode} +% now comes the real meat: the |\@@symdef| macro does two things, it adds the macro +% definition to the macro definition pool of the current module and also provides it. +% \begin{macrocode} +\def\@@symdef[#1]#2[#3]#4{% +% \end{macrocode} +% We use a switch to keep track of the local optional argument. We initialize the switch +% to false and check for the local keyword. Then we set all the keys that have been +% provided as arguments: aliases, local. First, using |\providecommand| we +% initialize the intermediate function, the one that can be changed internally with +% |\redefine| and then we link the actual function to it, again with |\providecommand|. We +% check if the switch for the local scope is set: if it is we are done, since this +% function has a local scope. Otherwise, we add these two functions to the module's pool +% of defined macros using |\g@addto@macro|. We add both functions so that we can keep the +% link between the real and the intermediate function whenever we inherit the +% module. Finally, using |\g@addto@macro| we add the two functions to the qualified +% version of the module. +% \begin{macrocode} +\@symdeflocalfalse\setkeys{symdef}{#1} + \expandafter\providecommand\csname modules@#2@pres\endcsname[#3]{#4} + \expandafter\def\csname#2\endcsname{\csname modules@#2@pres\endcsname} + \if@symdeflocal\else + \@ifundefined{mod@id}{}{ + \expandafter\g@addto@macro\this@module{\expandafter\providecommand\csname modules@#2@pres\endcsname[#3]{#4}}% + \expandafter\g@addto@macro\this@module{\expandafter\def\csname#2\endcsname{\csname modules@#2@pres\endcsname}} + \expandafter\g@addto@macro\this@qualified@module{\expandafter\providecommand\csname modules@#2@pres@qualified\endcsname[#3]{#4}}% + \expandafter\g@addto@macro\this@qualified@module{\expandafter\def\csname#2atqualified\endcsname{\csname modules@#2@pres@qualified\endcsname}} + }\fi} +%</package> +% \end{macrocode} +% In the {\latexml} bindings, we have a top-level macro that delegates the work to two +% internal macros: |\@symdef|, which defines the content macro and |\@symdef@pres|, which +% generates the {\omdoc} |symbol| and |presentation| elements (see +% Section~\ref{sec:impl:presentation}). +% \begin{macrocode} +%<*ltxml> +DefMacro('\symdef OptionalKeyVals:symdef {}[][]{}', + sub { +my($self,@args)=@_; +# print STDERR "excluding" if LookupValue('excluding_modules'); +((Invocation(T_CS('\@symdef'),@args)->unlist), + (LookupValue('excluding_modules') ? () + : (Invocation(T_CS('\@symdef@pres'), @args)->unlist))); +}); + +DefPrimitive('\@symdef OptionalKeyVals:symdef {}[][]{}', sub { + my($stomach,$keys,$cs,$nargs,$opt,$presentation)=@_; + my($name,$cd,$role,$cmml,$cattrs,$definitionURL)=$keys + && map($_ && $_->toString,map($keys->getValue($_), qw(name cd role cmml cattrs definitionURL))); + $cd = LookupValue('module_cd') unless $cd; + $nargs = (ref $nargs ? $nargs->toString : $nargs || 0); + my $module = LookupValue('current_module'); +# print STDERR "Define ".Stringify($cs)." in $module\n"; + my $scope = (($keys && ($keys->getValue('local') || '' eq 'true')) ? 'module_local' : 'module').":".$module; + my $attr="name='#name' meaning='#meaning' omcd='#omcd'"; + DefConstructorI("\\".$cs->toString,convertLaTeXArgs($nargs,$opt), + ($nargs == 0 + ? "<ltx:XMTok $attr scriptpos='#scriptpos'/>" + : "<ltx:XMApp scriptpos='#scriptpos'>" + . "<ltx:XMTok $attr scriptpos='#operator_scriptpos'/>" + . join('',map("<ltx:XMArg>#$_</ltx:XMArg>", (1..$nargs))) + ."</ltx:XMApp>"), + properties => {name=>$name, meaning=>$cs->toString,omcd=>$cd,role => $role}, + scope=>$scope); + return; }); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +%\begin{macro}{\redefine} +% We can use this function to redefine our intermediate presentational function inside +% the modules\ednote{does not seem to have a {\latexml} counterpart yet!} +% \begin{macrocode} +%<package>\def\redefine#1[#2]#3{\expandafter\renewcommand\csname modules@#1@pres\endcsname[#2]{#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\abbrdef} +% The |\abbrdef| macro is a variant of |\symdef| that does the same on the {\LaTeX} level. +% \begin{macrocode} +%<package>\let\abbrdef\symdef +%<*ltxml> +DefPrimitive('\abbrdef OptionalKeyVals:symdef {}[][]{}', sub { + my($stomach,$keys,$cs,$nargs,$opt,$presentation)=@_; + my $module = LookupValue('current_module'); + my $scope = (($keys && ($keys->getValue('local') || '' eq 'true')) ? 'module_local' : 'module').":$module"; + DefMacroI("\\".$cs->toString,convertLaTeXArgs($nargs,$opt),$presentation, + scope=>$scope); + return; }); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \subsection{Loading Module Signatures}\ednote{talk about module signatures above (SMS +% files)} +% Before we can come to the functionality we want to offer, we need some auxiliary +% functions that deal with path names. +% \begin{macro}{\mod@simplify} +% The |\mod@simplify| macro removes |xxx/..| from a string. eg: |aaa/bbb/../ddd| goes to +% |aaa/ddd|. This is used to normalize relative path names below. +% \begin{macrocode} +%<*package> +\def\mod@simplify#1{\expandafter\mod@simpl#1/\relax} +% \end{macrocode} +% It is based on the |\mod@simpl| macro +% \begin{macrocode} +\def\mod@simpl#1/#2\relax{%\message{ 1 = #1, 2 = #2 }% +\def\mod@test{}\ifx\mod@blaaaa\mod@test\edef\mod@savedprefix{}\def\mod@blaaaa{aaa}\else\fi +\def\mod@comp{#2}\ifx\mod@test\mod@comp\edef\mod@savedprefix{\mod@savedprefix#1}% +\else\mod@simplhelp#1/#2\relax\fi} +% \end{macrocode} +% which in turn is based on a helper macro +% \begin{macrocode} +\def\mod@simplhelp#1/#2/#3\relax{% +\def\mod@test{}\def\mod@tust{#2}\def\mod@tist{#3}\def\mod@tost{..}\ifx\mod@test\mod@tist% +\ifx\mod@tost\mod@tust\edef\mod@savedprefix{}\else\edef\mod@savedprefix +{\mod@savedprefix#1/#2}\fi \else\ifx\mod@tost\mod@tust\mod@simpl#3\relax% +\else\edef\mod@savedprefix{\mod@savedprefix#1/}\mod@simplhelp#2/#3\relax\fi\fi}% +% \end{macrocode} +% \end{macro} +% We will need a switch\ednote{Rares, say why?} +% \begin{macrocode} +\newif\ifmodules +% \end{macrocode} +% and a ``registry'' macro whose expansion represents the list of added macros (or files) +% \begin{macro}{\reg} +% We initialize the |\reg| macro with the empty string. +% \begin{macrocode} +\gdef\reg{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mod@update} +% This macro provides special append functionality. It takes a string and appends it +% to the expansion of the |\reg| macro in the following way: |string@\reg|. +% \begin{macrocode} +\def\mod@update#1{\def\mod@empty{} +\ifx\reg\mod@empty\xdef\reg{#1}\else\xdef\reg{#1@\reg}\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mod@check} +% The |\mod@check| takes as input a file path (arg 3), and searches the registry. If the +% file path is not in the registry it means it means it has not been already added, so +% we make modulestrue, otherwise make modulesfalse. The macro |\mod@search| will look at +% ifinclude and update the registry for modulestrue or do nothing for modulesfalse. +% \begin{macrocode} +\def\mod@check#1@#2///#3\relax{% +\def\mod@empty{}\def\mod@one{#1}\def\mod@two{#2}\def\mod@three{#3}% +% \end{macrocode} +% Define a few intermediate macros so that we can split the registry into separate file +% paths and compare to the new one +% \begin{macrocode} +\expandafter\ifx\mod@three\mod@one\modulestrue\else\ifx\mod@two\mod@empty\modulesfalse% +\else\mod@check#2///#3\relax\fi\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mod@search} +% Macro for updating the registry after the execution of |\mod@check| +% \begin{macrocode} +\def\mod@search#1{% +% \end{macrocode} +% We put the registry as the first argument for |\mod@check| and the other +% argument is the new file path. +% \begin{macrocode} +\modulesfalse\expandafter\mod@check\reg @///#1\relax% +% \end{macrocode} +% We run |\mod@check| with these arguments and the check |\ifmodules| for +% the result +% \begin{macrocode} +\ifmodules\else\mod@update{#1}\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mod@reguse} +% The macro operates almost as the |mod@search| function, but it does not update the +% registry. Its purpose is to check whether some file is or not inside the registry but +% without updating it. Will be used before deciding on a new sms file +% \begin{macrocode} +\def\mod@reguse#1{\modulesfalse\expandafter\mod@check\reg @///#1\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mod@prefix} +% This is a local macro for storing the path prefix, we initialize it as the empty +% string. +% \begin{macrocode} +\def\mod@prefix{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mod@updatedpre} +% This macro allows to update the path prefix with the last part of the new path +% \begin{macrocode} +\def\mod@updatedpre#1{ + \edef\mod@prefix{\mod@prefix\mod@pathprefix@check#1/\relax}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mod@pathprefix@check} +% |\mod@pathprefix@check| returns the last word in a string composed of words separated +% by slashes +% \begin{macrocode} +\def\mod@pathprefix@check#1/#2\relax{% +\ifx\\#2\\% no slash in string +\else\mod@ReturnAfterFi{#1/\mod@pathprefix@help#2\relax}% +\fi} +% \end{macrocode} +% It needs two helper macros: +% \begin{macrocode} +\def\mod@pathprefix@help#1/#2\relax{% +\ifx\\#2\\% end of recursion +\else\mod@ReturnAfterFi{#1/\mod@pathprefix@help#2\relax}% +\fi} +\long\def\mod@ReturnAfterFi#1\fi{\fi#1} +% \end{macrocode} +% \end{macro} +% +%\begin{macro}{\mod@pathpostfix@check} +% |\mod@pathpostfix@check| takes a string composed of words separated by slashes and +% returns the part of the string until the last slash +% \begin{macrocode} +\def\mod@pathpostfix@check#1/#2\relax{% slash +\ifx\\#2\\%no slash in string +#1\else\mod@ReturnAfterFi{\mod@pathpostfix@help#2\relax}% +\fi} +% \end{macrocode} +% Helper function for the pathpostfix@check function defined above +% \begin{macrocode} +\def\mod@pathpostfix@help#1/#2\relax{% +\ifx\\#2\\% +#1\else\mod@ReturnAfterFi{\mod@pathpostfix@help#2\relax}% +\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\mod@updatedpost#1{% +\edef\mod@savedprefix{\mod@savedprefix\mod@pathpostfix@check#1/\relax} } +% \end{macrocode} +% Macro that will add a |.sms| extension to a path. Will be used when adding a |.sms| file +% \begin{macrocode} +\def\mod@updatesms{\edef\mod@savedprefix{\mod@savedprefix.sms}} +%</package> +% \end{macrocode} +% +% \subsection{Selective Inclusion} +% +% \begin{macro}{\requiremodules} +% \begin{macrocode} +%<*package> +\newcommand{\requiremodules}[1]{% +{\mod@updatedpre{#1} % add the new file to the already existing path +\let\mod@savedprefix\mod@prefix % add the path to the new file to the prefix +\mod@updatedpost{#1} +\def\mod@blaaaa{} % macro used in the simplify function (remove .. from the prefix) +\mod@simplify{\mod@savedprefix} % remove |xxx/..| from the path (in case it exists) +\mod@reguse{\mod@savedprefix} +\ifmodules\else +\mod@updatesms % update the file to contain the .sms extension +\let\newreg\reg % use to compare, in case the .sms file was loaded before +\mod@search{\mod@savedprefix} % update registry +\ifx\newreg\reg\else\input{\mod@savedprefix}\fi % check if the registry was updated and load if necessary +\fi}} +%</package> +%<*ltxml> +DefPrimitive('\requiremodules{}', sub { + my($stomach,$module)=@_; + my $GULLET = $stomach->getGullet; + $module = Digest($module)->toString; + if(LookupValue('module_'.$module.'_loaded')) {} + else { + AssignValue('module_'.$module.'_loaded' => 1, 'global'); + $stomach->bgroup; + AssignValue('last_module_path', $module); + $GULLET->unread(T_CS('\end@requiredmodule')); + AssignValue('excluding_modules' => 1); + $GULLET->input($module,['sms']); + } + return;}); + +DefPrimitive('\end@requiredmodule{}',sub { + #close the group + $_[0]->egroup; + #print STDERR "END: ".ToString(Digest($_[1])->toString); + #Take care of any imported elements in this current module by activating it and all its dependencies + #print STDERR "Important: ".ToString(Digest($_[1])->toString)."\n"; + use_module(ToString(Digest($_[1])->toString)); + return; }); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sinput} +% \begin{macrocode} +%<*package> +\def\sinput#1{ +{\mod@updatedpre{#1} % add the new file to the already existing path +\let\mod@savedprefix\mod@prefix % add the path to the new file to the prefix +\mod@updatedpost{#1} +\def\mod@blaaaa{} % macro used in the simplify function (remove .. from the prefix) +\mod@simplify{\mod@savedprefix} % remove |xxx/..| from the path (in case it exists) +\mod@reguse{\mod@savedprefix} +\let\newreg\reg % use to compare, in case the .sms file was loaded before +\mod@search{\mod@savedprefix} % update registry +\ifx\newreg\reg%\message{This file has been previously introduced} +\else\input{\mod@savedprefix}\fi}} +%</package> +%<*ltxml> +DefPrimitive('\sinput{}', sub { + my($stomach,$module)=@_; + my $GULLET = $stomach->getGullet; + $module = Digest($module)->toString; + AssignValue('module_'.$module.'_loaded' => 1, 'global'); + $stomach->bgroup; + AssignValue('last_module_path', $module); + $GULLET->unread(Invocation(T_CS('\end@requiredmodule'),T_OTHER($module))->unlist); + $GULLET->input($module,['tex']); + return;}); +%</ltxml> +% \end{macrocode} +% \end{macro} +% \ednote{the sinput macro is just faked, it should be more like requiremodules, except +% that the tex file is inputted; I wonder if this can be simplified.} +% +% \subsection{Generating {\texorpdfstring\omdoc{OMDoc}} Presentation Elements}\label{sec:impl:presentation} +% +% Additional bundle of code to generate presentation encodings. Redefined to an expandable +% (macro) so that we can add conversions. +% +% \begin{macrocode} +%<*ltxml> +DefMacro('\@symdef@pres OptionalKeyVals:symdef {}[][]{}', sub { + my($self,$keys, $cs,$nargs,$opt,$presentation)=@_; + Invocation(T_CS('\@symdef@pres@aux'), + $cs, + ($nargs || Tokens(T_OTHER(0))), + symdef_presentation_pmml($cs,ToString($nargs)||0,$presentation), + symdef_presentation_TeX($presentation), + $keys)->unlist; }); +% \end{macrocode} +% Generate the expansion of a symdef'd macro using special arguments +% \begin{macrocode} +sub symdef_presentation_pmml { + my($cs,$nargs,$presentation)=@_; + my @toks = $presentation->unlist; + while(@toks && $toks[0]->equals(T_SPACE)){ pop(@toks); } # Remove leading space + $presentation = Tokens(@toks); + # Wrap with \@use, unless already has a recognized formatter. + $presentation = Invocation(T_CS('\@use'),$presentation) # Using simple text for now, until getting a proper \@use + unless @toks && ($toks[0]->toString =~ /^\\(infix|prefix|postfix|assoc|use|mixfixi|mixfixa|mixfixii|mixfixia|mixfixai|mixfixiii)$/); + # Low level substitution. + my @args = map(Invocation(T_CS('\@SYMBOL'),T_OTHER("pres_arg:".($_+1))),1..$nargs); + $presentation = Tokens(LaTeXML::Expandable::substituteTokens($presentation,@args)); + $presentation; } +% \end{macrocode} +% The |\@use| macro just generates the contents of the notation element +% \begin{macrocode} +DefConstructor('\@use {}', + "<omdoc:prototype>" + . "<om:OMS cd='' name=''/>" + ."</omdoc:prototype>" + ."<omdoc:rendering>" + . "<ltx:Math><ltx:XMath>#1</ltx:XMath></ltx:Math>" + ."</omdoc:rendering>", + mode=>'inline_math'); +% \end{macrocode} +% The |get_cd| procedure reads of the cd from our list of keys. +% \begin{macrocode} +sub get_cd { + my($name,$cd,$role,$cmml,$cattrs,$definitionURL)=@_; + return $cd;} +% \end{macrocode} +% The |\@symdef@pres@aux| creates the |symbol| element and the outer layer of the of the +% |notation| element. The content of the latter is generated by applying the {\latexml} to +% the definiens of the |\symdef| form. +% \begin{macrocode} +DefConstructor('\@symdef@pres@aux{}{}{}{} OptionalKeyVals:symdef', + "<omdoc:symbol name='#1'/>" + ."<omdoc:notation name='#name' cd='&get_cd(#5)'>" + ."#3" + ."</omdoc:notation>", + afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $keys = $whatsit->getArg(5); + my $module = LookupValue('current_module'); + $whatsit->setProperties(for=>ToString($whatsit->getArg(1))); + $whatsit->setProperty(role=>($keys ? $keys->getValue('role') + : (ToString($whatsit->getArg(2)) ? 'applied' + : undef))); }); +% \end{macrocode} +% Convert a macro body (tokens with parameters |#1|,..) into a Presentation |style=TeX| form. +% walk through the tokens, breaking into chunks of neutralized (|T_OTHER|) tokens and +% parameter specs. +% \begin{macrocode} +sub symdef_presentation_TeX { + my($presentation)=@_; + my @tokens = $presentation->unlist; + my(@frag,@frags) = (); + while(my $tok = shift(@tokens)){ + if($tok->equals(T_PARAM)){ + push(@frags,Invocation(T_CS('\@symdef@pres@text'),Tokens(@frag))) if @frag; + @frag=(); + my $n = shift(@tokens)->getString; + push(@frags,Invocation(T_CS('\@symdef@pres@arg'),T_OTHER($n+1))); } + else { + push(@frag,T_OTHER($tok->getString)); }} # IMPORTANT! Neutralize the tokens! + push(@frags,Invocation(T_CS('\@symdef@pres@text'),Tokens(@frag))) if @frag; + Tokens(map($_->unlist,@frags)); } + +DefConstructor('\@symdef@pres@arg{}', "<omdoc:recurse select='#select'/>", + afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $select = $whatsit->getArg(1); + $select = ref $select ? $select->toString : ''; + $whatsit->setProperty(select=>"*[".$select."]"); }); + +DefConstructor('\@symdef@pres@text{}', "<omdoc:text>#1</omdoc:text>"); +%</ltxml> +% \end{macrocode} +% +% +% \subsection{Including Externally Defined Semantic Macros }\label{sec:impl:packages} +% +% \begin{macro}{\requirepackage} +% \begin{macrocode} +%<package>\def\requirepackage#1#2{\makeatletter\input{#1.sty}\makeatother} +%<*ltxml> +DefConstructor('\requirepackage{} Semiverbatim',"<omdoc:imports from='#2'/>", + afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $select = $whatsit->getArg(1); + RequirePackage($select->toString); }); +% \end{macrocode} +% \end{macro} +% +% \subsection{Deprecated Functionality}\label{sec:impl:deprecated} +% +% In this section we centralize old interfaces that are only partially supported any more. +% \begin{macro}{module:uses} +% For each the module name |xxx| specified in the |uses| key, we activate their symdefs +% and we export the local symdefs.\ednote{this isue is deprecated, it will be removed +% before 1.0.} +% \begin{macrocode} +%<*package> +\define@key{module}{uses}{% + \@for\module@tmp:=#1\do{\activate@defs\module@tmp\export@defs\module@tmp}} +%</package> +% \end{macrocode} +% +% \begin{macro}{module:usesqualified} +% This option operates similarly to the module:uses option defined above. The only +% difference is that here we import modules with a prefix. This is useful when two +% modules provide a macro with the same name. +% \begin{macrocode} +%<*package> +\define@key{module}{usesqualified}{% + \@for\module@tmp:=#1\do{\activate@defs{qualified@\module@tmp}\export@defs\module@tmp}} +%</package> +% \end{macrocode} +% \end{macro} +% +% \subsection{Finale} +% +% Finally, we need to terminate the file with a success mark for perl. +% \begin{macrocode} +%<ltxml>1; +% \end{macrocode} +% +% \section {Utility}\label{sec:utilities} +% \Finale +\endinput +% \iffalse +%%% Local Variables: +%%% mode: doctex +%%% TeX-master: t +%%% End: +% LocalWords: GPL structuresharing STR dtx env envfalse idfalse displayfalse +% LocalWords: usesfalse usesqualified usesqualifiedfalse envtrue idtrue CPERL +% LocalWords: usestrue displaytrue usesqualifiedtrue RequirePackage keyval tmp +% LocalWords: defs foreach LookupValue activateScope DefEnvironment keyvals cd +% LocalWords: OptionalKeyVals getValue toString AssignValue openElement omdoc +% LocalWords: closeElement beforeDigest useTheoryItemizations afterDigestBegin +% LocalWords: whatsit setProperty getArg qw symdef cmml cattrs definitionURL +% LocalWords: DefKeyVal Semiverbatim symdeflocal atqualified DefMacro STDERR +% LocalWords: args unlist DefPrimitive nargs Stringify eq attr omcd ltx XMTok +% LocalWords: DefConstructorI convertLaTeXArgs scriptpos XMApp OMA XMArg simpl +% LocalWords: DefMacroI blaaaa savedprefix aaa simplhelp tust tist tost reguse +% LocalWords: updatedpre ReturnAfterFi updateall updatedpost updatesms bgroup +% LocalWords: texclude tinclude getGullet requiredmodule tex sms egroup pmml +% LocalWords: toks mixfixi mixfixa mixfixii mixfixia mixfixai mixfixiii arg +% LocalWords: DefConstructor afterDigest setProperties undef tok PARAM +% LocalWords: getString +% \fi diff --git a/Master/texmf-dist/source/latex/stex/modules.ins b/Master/texmf-dist/source/latex/stex/modules.ins new file mode 100644 index 00000000000..52aa57ce4b2 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/modules.ins @@ -0,0 +1,38 @@ + %% +%% This file generates files required to use the ed package. +%% At your command prompt write +%% +%% latex modules.ins +%% +%% Copyright(c) 2005 Michael Kohlhase +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.0 or, at your option, any later version. +%% +\input docstrip +\preamble +\endpreamble + +%\usedir{tex/latex/listings} +\keepsilent +\askforoverwritefalse + +% generate base package +\generate{\file{modules.sty}{\from{modules.dtx}{package}}} + +\Msg{*} +\Msg{* You probably need to move the generated style files into a directory searched by TeX.} +\Msg{*} +\Msg{* And don't forget to refresh your filename database} +\Msg{* if your TeX distribution uses such a database.} +\Msg{*} + +\nopreamble\nopostamble +\generate{\file{modules.sty.ltxml}{\from{modules.dtx}{ltxml}}} + +\Msg{*} +\Msg{* You probably need to move the generated ltxml files into a directory searched by LaTeXML.} +\Msg{*} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/stex/omdoc.dtx b/Master/texmf-dist/source/latex/stex/omdoc.dtx new file mode 100644 index 00000000000..6a38bcd0ade --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/omdoc.dtx @@ -0,0 +1,775 @@ +% \iffalse meta-comment +% A LaTeX Class and Package for OMDoc Document Structures +% Copyright (c) 2006 Michael Kohlhase, all rights reserved +% this file is released under the +% LaTeX Project Public License (LPPL) +% +% The development version of this file can be found at +% https://svn.kwarc.info/repos/kwarc/projects/stex/sty/omdoc.dtx +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{omdoc}[2007/09/09 v0.3 OMDoc document Structure] +%<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<cls>\ProvidesClass{omdoc}[2007/09/09 v0.3 OMDoc Documents] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{url,array,omdoc,float} +\usepackage[show]{ed} +\usepackage{hyperref} +\makeindex +\floatstyle{boxed} +\newfloat{exfig}{thp}{lop} +\floatname{exfig}{Example} +\begin{document}\DocInput{omdoc.dtx}\end{document} +%</driver> +% \fi +% +%\CheckSum{341} +% +% \changes{v0.1}{2006/1/17}{First Version} +% \changes{v0.2}{2006/7/11}{added OMDoc class} +% \changes{v0.3}{2007/09/09}{moved omtext and friends here from the statements package} +% +% \GetFileInfo{omdoc.sty} +% +% \MakeShortVerb{\|} +% +% \def\twin#1#2{\index{#1!#2}\index{#2!#1}} +% \def\twintoo#1#2{{#1 #2}\twin{#1}{#2}} +% \def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}} +% \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} +% \def\sTeX{{\raisebox{-.5ex}S\kern-.5ex\TeX}} +% \def\omdoc{OMDoc} +% \def\latexml{{\LaTeX}ML} +% \title{Semantic Markup for Open Mathematical Documents in {\LaTeX}\thanks{Version {\fileversion} (last revised +% {\filedate})}} +% \author{Michael Kohlhase\\ +% Jacobs University, Bremen\\ +% \url{http://kwarc.info/kohlhase}} +% \maketitle +% +% \begin{abstract} +% The |omdoc| packge is part of the {\sTeX} collection, a version of {\TeX/\LaTeX} that +% allows to markup {\TeX/\LaTeX} documents semantically without leaving the document +% format, essentially turning {\TeX/\LaTeX} into a document format for mathematical +% knowledge management (MKM). +% +% This package supplies a the infrastructure for writing {\omdoc} documents in {\LaTeX}. +% This includes a simple structure sharing mechanism for {\sTeX} that allows to to move +% from a copy-and-paste document development model to a copy-and-reference model, which +% conserves space and simplifies document management. The augmented structure can be +% used by MKM systems for added-value services, either directly from the {\sTeX} +% sources, or after translation. +% \end{abstract} +%\newpage +% +%\section{Introduction}\label{sec:STR} +% +% The |omdoc| package supplies macros and environment that allow to label document +% fragements and to reference them later in the same document or in other documents. In +% essence, this enhances the docuent-as-trees model to +% documents-as-directed-acyclic-graphs (DAG) model. This structure can be used by MKM +% systems for added-value services, either directly from the {\sTeX} sources, or after +% translation. Currently, trans-document referencing provided by this package can conly be +% used in the {\sTeX} collection. +% +% {\sTeX} is a version of {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents +% semantically without leaving the document format, essentially turning {\TeX/\LaTeX} into +% a document format for mathematical knowledge management (MKM). +% +% DAG models of documents allow to replace the ``Copy and Paste'' in the source document +% with a label-and-reference model where document are shared in the document source and +% the formatter does the copying during document formatting/presentation.\ednote{talk +% about the advantages and give an example.}\ednote{is there a way to load documents at +% URIs in LaTeX?}\ednote{integrate with latexml's XMRef in the Math mode.} +% +% \section{The User Interface}\label{sec:user} +% +% \subsection{Document Structure}\label{sec:user:struct} +% +% \DescribeEnv{omgroup} The structure of the document is given by the |omgroup| +% environment just like in {\omdoc}. +% +% \subsection{Providing IDs for {\omdoc} Elements}\label{sec:user:ids} +% +% Some of the {\omdoc} elements need IDs to function corrrectly. The general strategy here +% is to equip the {\sTeX} macros with keys, so that the author can specify meaningful +% ones, but to let the transformation give default ones if the author did not. +% +% \subsection{Mathematical Text}\label{sec:user:omtext} +% +% \DescribeEnv{omtext} The |omtext| environment is used for any text fragment that has a +% contribution to a text that needs to be marked up. It can have a title, which can be +% specified via the |title| key. Often it is also helpful to annotate the |type| key. The +% standard relations from rhethorical structure theory |abstract|, |introduction|, +% |conclusion|, |thesis|, |comment|, |antithesis|, |elaboration|, |motivation|, +% |evidence|, |transition|, | note|, |annote| are recommended. Note that some of them are +% unary relations like |introduction|, which calls for a target. In this case, a target +% using the |for| key should be specified. The |transition| relation is special in that it +% is binary (a ``transition between two statements''), so additionally, a source should be +% specified using the |from| key.\ednote{describe the keys more fully} +% +% \subsection{Structure Sharing}\label{sec:user:sharing} +% +% \DescribeMacro{\STRlabel}\DescribeMacro{\STRcopy} The |\STRlabel| macro takes two +% arguments: a label and the content and stores the the content for later use by +% |\STRcopy{label}|, which expands to the previously stored content. +% +% \DescribeMacro{\STRsemantics} The |\STRlabel| macro has a variant |\STRsemantics|, where +% the label argument is optional, and which takes a third argument, which is ignored in +% {\LaTeX}. This allows to specify the meaning of the content (whatever that may mean) in +% cases, where the source document is not formatted for presentation, but is transformed +% into some content markup format. \ednote{make an example} +% +% \subsection{Phrase-Level Markup}\label{sec:user:phrase} +% +% \DescribeEnv{phrase} The |phrase| enviornment allows to mark up phrases with semantic +% information. It takes an optional |KeyVal| argument with the keys +% \StopEventually{\ednotemessage} +% +% \section{Implementation: The OMDoc Class}\label{sec:impl:cls} +% +% We load |article.cls|, and the desired packages. For the {\latexml} bindings, we make +% sure the right packages are loaded. +% \begin{macrocode} +%<*cls> +\LoadClass{article} +\RequirePackage{omdoc} +%</cls> +%<*ltxml.cls> +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +LoadClass('article'); +%</ltxml.cls> +% \end{macrocode} +% Now, we also need to register the namespace prefixes for {\latexml} to use. +% \begin{macrocode} +%<*ltxml.cls> +RegisterNamespace('omdoc'=>"http://www.mathweb.org/omdoc"); # OMDoc namespace +RegisterNamespace(om=>"http://www.openmath.org/OpenMath"); +RegisterNamespace('m'=>"http://www.w3.org/1998/Math/MathML"); +RegisterNamespace('dc'=>"http://purl.org/dc/elements/1.1/"); +RegisterNamespace('cc'=>"http://creativecommons.org/ns"); +%</ltxml.cls> +% \end{macrocode} +% Since we are dealing with a class, we need to set up the document type in the {\latexml} +% bindings. +% \begin{macrocode} +%<*ltxml.cls> +RelaxNGSchema('/Users/kohlhase/stex/rnc/omdoc+ltxml', + '#default'=>"http://www.mathweb.org/omdoc", + 'om'=>"http://www.openmath.org/OpenMath", + 'm'=>"http://www.w3.org/1998/Math/MathML", + 'dc'=>"http://purl.org/dc/elements/1.1/", + 'cc'=>"http://creativecommons.org/ns", + 'ltx'=>"http://dlmf.nist.gov/LaTeXML"); +%</ltxml.cls> +% \end{macrocode} +% Then we load the |omdoc| package, which we define separately in the next section so that +% it can be loaded separately\ednote{reword} +% \begin{macrocode} +%<*ltxml.cls> +RequirePackage('omdoc'); +%</ltxml.cls> +% \end{macrocode} +% Now, we will define the environments we need. The top-level one is the |document| +% environment, which we need to provide with an identifier.\ednote{probably move to the +% omdoc package} +% \begin{macrocode} +%<*ltxml.cls> +DefEnvironment('{document}','<omdoc:omdoc>#body</omdoc:omdoc>', + beforeDigest=> sub { AssignValue(inPreamble=>0); }, + afterDigest=> sub { $_[0]->getGullet->flush; return; }); +%</ltxml.cls>\iffalse$\fi +% \end{macrocode} +% +% \section{Implementation: OMDoc Package}\label{sec:impl:sty} +% We first need to set up the packages by requiring the |KeyVal| package to be loaded (in +% the ritht version). +% +% \begin{macrocode} +%<package>\RequirePackage{keyval}[1997/11/10] +%<*ltxml.sty> +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('keyval'); +%</ltxml.sty> +% \end{macrocode} +% +% \subsection{Document Structure}\label{sec:impl:struct} +% +% The structure of the document is given by the |omgroup| environment just like in +% OMDoc. The hierarchy is adjusted automatically\ednote{maybe define the toplevel +% according to a param, need to know how to detect that the chapter macro exists.} +% +% \begin{macrocode} +%<*package> +\define@key{omgroup}{id}{\label{#1}} +\define@key{omgroup}{type}{\def\omgroup@type{#1}} +\define@key{omgroup}{display}{\def\omgroup@display{#1}} +\def\omgroup@flow{flow} +\newcount\section@level\section@level=1 +\newenvironment{omgroup}[2][]% title +{\setkeys{omgroup}{#1} +\ifx\omgroup@display\omgroup@flow{#2}\else +\ifnum\section@level=1\section{#2}\fi +\ifnum\section@level=2\subsection{#2}\fi +\ifnum\section@level=3\subsubsection{#2}\fi +\ifnum\section@level=4\paragraph{#2}\fi +\advance\section@level by 1\fi}{} +\def\tgroup{\omgroup}\def\endtgroup{\endomgroup} +%</package> +%<*ltxml.sty> +DefKeyVal('omgroup','id','Semiverbatim'); +DefKeyVal('omgroup','type','Semiverbatim'); +DefKeyVal('omgroup','display','Semiverbatim'); +DefEnvironment('{omgroup} OptionalKeyVals:omgroup {}', + "<omdoc:omgroup ?&KeyVal(#1,'id')(xml:id='#1')() ?&KeyVal(#1,'type')(type='#1')()>\n" + . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>\n)()" + . "#body\n" + . "</omdoc:omgroup>"); + +DefEnvironment('{tgroup} OptionalKeyVals:omgroup {}', + "<omdoc:tgroup ?&KeyVal(#1,'id')(xml:id='#1')() ?&KeyVal(#1,'type')(type='#1')()>\n" + . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>\n)()" + . "#body\n" + . "</omdoc:tgroup>"); +%</ltxml.sty> +% \end{macrocode} +% +% +% the |itemize|, |description|, and |enumerate| environments do double duty in OMDoc, +% \begin{enumerate} +% \item outside a |CMP| they are transformed into a +% |<omgroup type='itemize|description|enumerate'>|, where the text after the macros +% |\item| come to be the children. If that is only text, then it is enclosed in an +% |<omtext><CMP>|, otherwise it is left as it is. The optional argument of the |\item| +% is transformed into the |<metadata><dc:title>| of the generated |\item| element. +% \item inside a |CMP|, they are transformed into |<ul>|, |<dl>|, and |<ol>| elements +% like in html. +% \item Outside a |CMP|, |\item| is turned into |\ignoe@item| +% \end{enumerate} +% \begin{macrocode} +%<*ltxml.sty> +DefParameterType('IfBeginFollows', sub { + my ($gullet) = @_; + $gullet->skipSpaces; + return 1 unless $gullet->ifNext(T_CS('\begin')); + return; }, + reversion=>'', optional=>1); + +Let('\group@item@maybe@unwrap','\relax'); + +DefMacro('\group@item[] IfBeginFollows', sub { + my($gullet,$tag,$needwrapper)=@_; + ( T_CS('\group@item@maybe@unwrap'), + ($needwrapper ? (Invocation(T_CS('\group@item@wrap'),$tag)->unlist) : ()) ); }); + +DefConstructor('\group@item@wrap {}', + "<omdoc:omtext>" + . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>", + beforeDigest=>sub { + Let('\group@item@maybe@unwrap','\group@item@unwrap'); + $_[0]->bgroup; + useCMPItemizations(); + return; }, + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\group@item@unwrap', + "</omdoc:p></omdoc:CMP></omdoc:omtext>", + beforeDigest=>sub { + $_[0]->egroup; + Let('\group@item@maybe@unwrap','\relax'); }); + +Let('group@item@maybe@unwrap','\relax'); + +Let('\itemize@item'=>'\group@item'); +Let('\enumerate@item'=>'\group@item'); +Let('\description@item'=>'\group@item'); + +DefEnvironment('{itemize}', + "<omdoc:omgroup xml:id='#id' type='itemize'>#body</omdoc:omgroup>", + properties=>sub { beginItemize('itemize'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{enumerate}', + "<omdoc:omgroup xml:id='#id' type='enumerate'>#body</omdoc:omgroup>", + properties=>sub { beginItemize('enumerate'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{description}', + "<omdoc:omgroup xml:id='#id' type='description'>#body</omdoc:omgroup>", + properties=>sub { beginItemize('description'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +%</ltxml.sty> +% \end{macrocode} +% +% Inside a |theory| element , use |tgroup| instead of |omgroup|, otherwise, same as default case +% +% \begin{macrocode} +%<*ltxml.sty> +Let('\tgroup@itemize@item'=>'\group@item'); +Let('\tgroup@enumerate@item'=>'\group@item'); +Let('\tgroup@description@item'=>'\group@item'); + +DefEnvironment('{tgroup@itemize}', + "<omdoc:tgroup xml:id='#id' type='itemize'>#body</omdoc:tgroup>", + properties=>sub { beginItemize('tgroup@itemize'); }, + beforeDigest=>sub { Let(T_CS('\end{itemize}') =>T_CS('\end{tgroup@itemize}')); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{tgroup@enumerate}', + "<omdoc:tgroup xml:id='#id' type='enumerate'>#body</omdoc:tgroup>", + properties=>sub { beginItemize('tgroup@enumerate'); }, + beforeDigest=>sub{ Let(T_CS('\end{enumerate}') =>T_CS('\end{tgroup@enumerate}'));}, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{tgroup@description}', + "<omdoc:tgroup xml:id='#id' type='description'>#body</omdoc:tgroup>", + properties=>sub { beginItemize('tgroup@description'); }, + beforeDigest=>sub{ Let(T_CS('\end{description}') =>T_CS('\end{tgroup@description}'));}, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); + +sub useTheoryItemizations { + Let(T_CS('\begin{itemize}') =>T_CS('\begin{tgroup@itemize}')); + Let(T_CS('\begin{enumerate}') =>T_CS('\begin{tgroup@enumerate}')); + Let(T_CS('\begin{description}')=>T_CS('\begin{tgroup@description}')); + return; } +%</ltxml.sty> +% \end{macrocode} +% +% Inside a |CMP|, we generate |omdoc:li|, |omdoc:di| with |autoclose| +% +% \begin{macrocode} +%<*ltxml.sty> +DefConstructor('\CMP@itemize@item[]', + '<omdoc:li>' + . '?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()', + properties=>sub{ RefStepItemCounter(); }); + +DefConstructor('\CMP@enumerate@item[]', + '<omdoc:li>' + . '?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()', + properties=>sub{ RefStepItemCounter(); }); + +DefConstructor('\CMP@description@item[]', + '<omdoc:di>' + . '?#1(<omdoc:dt>#1</omdoc:dt>)()<omdoc:dd>', # trust di and dt to autoclose + properties=>sub{ RefStepItemCounter(); }); + +DefEnvironment('{CMP@itemize}', + "<omdoc:ul xml:id='#id'>#body</omdoc:ul>", + properties=>sub { beginItemize('CMP@itemize'); }, + beforeDigest=>sub { Let(T_CS('\end{itemize}') =>T_CS('\end{CMP@itemize}')); }); +DefEnvironment('{CMP@enumerate}', + "<omdoc:ol xml:id='#id'>#body</omdoc:ol>", + properties=>sub { beginItemize('CMP@enumerate'); }, + beforeDigest=>sub { Let(T_CS('\end{enumerate}') =>T_CS('\end{CMP@enumerate}')); }); +DefEnvironment('{CMP@description}', + "<omdoc:dl xml:id='#id'>#body</omdoc:dl>", + properties=>sub { beginItemize('CMP@description'); }, + beforeDigest=>sub { Let(T_CS('\end{description}') =>T_CS('\end{CMP@description}'));}); + +sub useCMPItemizations { + Let(T_CS('\begin{itemize}') =>T_CS('\begin{CMP@itemize}')); + Let(T_CS('\begin{enumerate}') =>T_CS('\begin{CMP@enumerate}')); + Let(T_CS('\begin{description}')=>T_CS('\begin{CMP@description}')); + return; } + +Tag('omdoc:CMP', afterOpen => sub { + AssignValue('_LastSeenCMP', $_[1], 'global'); + return; }); + +Tag('omdoc:li', autoClose=>1); +Tag('omdoc:dd', autoClose=>1); +Tag('omdoc:di', autoClose=>1); +%</ltxml.sty> +% \end{macrocode} +% +% \subsection{Mathematical Text}\label{sec:impl:mtxt} +% +% We define the actions that are undertaken, when the keys 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} +%<*package> +\define@key{stat}{id}{\def\st@id{#1}} +\define@key{stat}{display}{\def\st@display{#1}} +\define@key{stat}{for}{\def\stat@for{#1}} +\define@key{stat}{from}{\def\stat@from{#1}} +\define@key{stat}{type}{\def\stat@type{#1}} +\define@key{stat}{title}{\def\stat@title{#1}} +\define@key{stat}{continues}{\def\stat@continues{#1}} +%</package> +%<*ltxml.sty> +DefKeyVal('stat','id','Semiverbatim'); +DefKeyVal('stat','for','Semiverbatim'); +DefKeyVal('stat','title','Semiverbatim'); +DefKeyVal('stat','from','Semiverbatim'); +DefKeyVal('stat','type','Semiverbatim'); +DefKeyVal('stat','display','Semiverbatim'); # not used at the moment +%</ltxml.sty> +% \end{macrocode} +% +% \begin{macro}{\show@st@keys@aux} +% We now define a macro that shows the |st| keys, if in draft mode, they annotate the +% document with key/value pairs. +% \begin{macrocode} +%<*package> +\def\show@st@keys@aux{% +\@ifundefined{st@id}{}{\ifst@id{id=\st@id},\fi}% +\@ifundefined{st@display}{}{\ifst@display{display=\st@display}\fi}} +\def\clear@st@keys{\let\st@id=\relax\let\st@display=\relax} +%</package> +% \end{macrocode} +% \end{macro} +% \begin{macro}{\show@stat@keys@aux} +% we do the same for the |stat| keys. +% \begin{macrocode} +%<*package> +\def\show@stat@keys@aux{% +\@ifundefined{st@for}{}{\ifstat@for{for=\stat@for},\fi}% +\@ifundefined{st@from}{}{\ifstat@from{from=\stat@from},\fi}% +\@ifundefined{st@type}{}{\ifstat@type{type=\stat@type},\fi}% +\@ifundefined{st@title}{}{\ifstat@title{title=\stat@title},\fi}% +\@ifundefined{st@continues}{}{\ifstat@continues{continues=\stat@continues}\fi}} +%</package> +% \end{macrocode} +% \end{macro} +% \begin{macro}{\show@stat@keys} +% and combine them, so that the code is more readable. +% \begin{macrocode} +%<*package> +\def\show@stat@keys#1{\footnote{#1[\show@st@keys@aux\show@stat@keys@aux]}% +\clear@st@keys\clear@stat@keys} +\def\clear@stat@keys{\let\stat@for=\relax\let\stat@from=\relax% +\let\stat@type=\relax\let\stat@title=\relax\let\stat@continues=\relax} +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\st@flow} +% We define this macro, so that we can test whether the |display| key has the value |flow| +% \begin{macrocode} +%<package>\def\st@flow{flow} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{omtext} +% The |omtext| environment is different, it does not have a keyword that marks +% it. Instead, it can have a title, which is used in a similar way. +% \begin{macrocode} +%<*package> +\def\omtext@pre@skip{\smallskip} +\def\omtext@post@skip{} +\newenvironment{omtext}[1][]{\setkeys{stat}{#1}{% keyval args +\def\lec#1{\@lec{#1}}% so the trailing \par does not get into the way +\omtext@pre@skip\par\noindent +\@ifundefined{stat@title}{}{\ifx\st@display\st@flow\else\stDMemph{\stat@title}:\fi}} +\ifst@env\show@stat@keys{omtext:\stat@title}\fi +\omtext@post@skip}{} +%</package> +%<*ltxml.sty> +DefCMPEnvironment('{omtext} OptionalKeyVals:stat', + "<omdoc:omtext " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " + . "?&KeyVal(#1,'type')(type='&KeyVal(#1,'type')')() " + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')() " + . "?&KeyVal(#1,'from')(from='&KeyVal(#1,'from')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>\n"); +%</ltxml.sty> +% \end{macrocode} +% \end{environment} +% +% We also make our life easier If defininig an environment that is +% turned into something that contains |<CMP>|\meta{body}|</CMP>|, use this method instead +% \begin{macrocode} +%<*ltxml.sty> +sub DefCMPEnvironment { + my ($proto, $replacement, %options) = @_; + my @before = $options{beforeDigest} ? ($options{beforeDigest}) : (); + push(@before, \&useCMPItemizations); + $options{beforeDigest} = \@before; + DefEnvironment($proto, $replacement, %options); +} +%</ltxml.sty> +% \end{macrocode} +% +% +% \subsection{Structure Sharing}\label{sec:impl:share} +% +% \begin{macro}{\STRlabel} +% The main macro, it it used to attach a label to some text expansion. Later on, using the +% |\STRcopy| macro, the author can use this label to get the expansion originally assigned. +% \begin{macrocode} +%<*package> +\long\def\STRlabel#1#2{\STRlabeldef{#1}{#2}{#2}} +%</package> +%<*ltxml.sty> +DefConstructor('\STRlabel{}{}', sub { + my($document,$label,$object)=@_; + $document->absorb($object); + $document->addAttribute('xml:id'=>ToString($label)) if $label; }); +%</ltxml.sty> +% \end{macrocode} +% \end{macro} +% \begin{macro}{\STRcopy} +% The |\STRcopy| macro is used to call the expansion of a given label. In case the label is +% not defined it will issue a warning. +% \begin{macrocode} +%<*package> +\def\STRcopy#1{\expandafter\ifx\csname STR@#1\endcsname\relax +\message{STR warning: reference #1 undefined!} +\else\csname STR@#1\endcsname\fi} +%</package> +%<*ltxml.sty> +DefConstructor('\STRcopy{}',"<omdoc:ref xref='#1'/>"); +%</ltxml.sty> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@semantics} +% if we have a presentation form and a semantic form, then we can use +% \begin{macrocode} +%<*package> +\long\def\@semantics[#1]#2#3{#2\STRlabeldef{#1}{#2}} +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\STRlabeldef} +% This is the macro that does the actual labelling. Is it called inside |\STRlabel| +% \begin{macrocode} +%<*package> +\def\STRlabeldef#1{\expandafter\gdef\csname STR@#1\endcsname} +%</package> +%<*ltxml.sty> +DefMacro('\STRlabeldef{}{}', ""); +%</ltxml.sty> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\STRsemantics} +% \ednote{some explanation here} +% \begin{macrocode} +%<*package> +\def\STRsemantics{\@ifnextchar[\@semantics{\@semantics[]}} +%</package> +%<*ltxml.sty> +DefConstructor('\STRsemantics[]{}{}', sub { + my($document,$label,$ignore,$object)=@_; + $document->absorb($object); + $document->addAttribute('xml:id'=>ToString($label)) if $label; }); +%</ltxml.sty> +% \end{macrocode} +% \end{macro} +% +% \subsection{Phrase-level Markup} +% +% \begin{environment}{phrase} +% For the moment, we do disregard the most of the keys +% \begin{macrocode} +%<*package> +\define@key{phrase}{id}{} +\define@key{phrase}{style}{} +\define@key{phrase}{class}{} +\define@key{phrase}{index}{} +\define@key{phrase}{verbalizes}{} +\define@key{phrase}{type}{} +\newenvironment{phrase}[1][]{\setkeys{phrase}{#1}}{} +%</package> +%<*ltxml.sty> +DefKeyVal('phrase','id','Semiverbatim'); +DefKeyVal('phrase','style','Semiverbatim'); +DefKeyVal('phrase','class','Semiverbatim'); +DefKeyVal('phrase','index','Semiverbatim'); +DefKeyVal('phrase','verbalizes','Semiverbatim'); +DefKeyVal('phrase','type','Semiverbatim'); +DefConstructor('\phrase OptionalKeyVals:phrase {}', + "<omdoc:phrase %&KeyVals(#1)>#body</omdoc:phrase>"); +%</ltxml.sty> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{nlex} +% For the moment, we do disregard the most of the keys +% \begin{macrocode} +%<*package> +\def\nlex#1{\green{\sl{#1}}} +\def\nlcex#1{*\green{\sl{#1}}} +%</package> +%<*ltxml.sty> +DefConstructor('\nlex{}',"<omdoc:phrase type='nlex'>#1</omdoc:phrase>"); +DefConstructor('\nlcex{}',"<omdoc:phrase type='nlcex'>#1</omdoc:phrase>"); +%</ltxml.sty> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{inlinequote} +% \ednote{describe above} +% \begin{macrocode} +%<package>\def\inlinequote#1{``{\sl{#1}}''} +%<ltxml.sty>DefConstructor('\inlinequote{}',"<omdoc:phrase type='inlinequote'>#1</omdoc:phrase>"); +% \end{macrocode} +% \end{environment} +% +% \subsection{Colors} +% +% \begin{environment}{blue, red, green, magenta} +% We will use the following abbreviations for colors from |color.sty| +% \begin{macrocode} +%<*package> +\def\blue#1{\textcolor{blue}{#1}} +\def\red#1{\textcolor{red}{#1}} +\def\green#1{\textcolor{green}{#1}} +\def\cyan#1{\textcolor{cyan}{#1}} +\def\magenta#1{\textcolor{magenta}{#1}} +\def\brown#1{\textcolor{brown}{#1}} +\def\yellow#1{\textcolor{yellow}{#1}} +%</package> +% \end{macrocode} +% For the {\latexml} bindings, we go a generic route, we replace |\blue{#1}| by +% |{\@omdoc@color{blue}\@omdoc@color@content{#1}}|. +% \begin{macrocode} +%<*ltxml.sty> +sub omdocColorMacro { + my ($color, @args) = @_; + my $tok_color = TokenizeInternal($color); + (T_BEGIN, T_CS('\@omdoc@color'), T_BEGIN, $tok_color->unlist, + T_END, T_CS('\@omdoc@color@content'), T_OTHER('['), $tok_color->unlist, T_OTHER(']'), + T_BEGIN, $args[1]->unlist, T_END, T_END); } +DefMacro('\@omdoc@color{}', sub { MergeFont(color=>$_[1]->toString); return; }); +%</ltxml.sty> +% \end{macrocode} +% Ideally, here we will remove the optional argument and have a conversion module +% add the attribute at the end (or maybe add it just for math?) +% or, we can take the attributes for style from the current font ? +% \begin{macrocode} +%<*ltxml.sty> +DefConstructor('\@omdoc@color@content[]{}', + "?#isMath(#2)(<omdoc:phrase ?#1(style='color:#1')()>#2</omdoc:phrase>)"); +foreach my $color(qw(blue red green magenta cyan brown yellow)) { + DefMacro("\\".$color.'{}', sub { omdocColorMacro($color, @_); }); } +%</ltxml.sty> +% \end{macrocode} +% \end{environment} +% +% +% \subsection{{\LaTeX} Commands we interpret differently} +% +% The first think we have to take care of are the paragraphs, we want to generate {\omdoc} +% that uses the |p| element for paragraphs inside |CMP|s. For that we have modified the +% DTD only to allowed |p| elements in |CMP| (in particular no text). Then we instruct the +% |\par| macro to close a |p| element if possible. The next |p| element is then opened +% automatically, since we make |p| autoclose. +% \begin{macrocode} +%<*ltxml.sty> +DefConstructor('\par',sub { $_[0]->maybeCloseElement('omdoc:p'); },alias=>"\\par\n"); +Tag('omdoc:p', autoClose=>1, autoOpen=>1); +%</ltxml.sty> +% \end{macrocode} +% the rest of the reinterpretations is quite simple, we either disregard presentational +% markup or we re-interpret it in terms of {\omdoc}. +% \begin{macrocode} +%<package>\def\omspace#1{\hspace*{#1}} +%<*ltxml.sty> +DefConstructor('\omspace{}',''); +DefConstructor('\emph{}',"<omdoc:phrase class='emphasis'>#1</omdoc:phrase>"); +DefConstructor('\em',"<omdoc:phrase class='emphasis'>"); +Tag('omdoc:phrase', autoClose=>1); +DefEnvironment('{center}','#body'); +DefEnvironment('{minipage}{}','#body'); +DefEnvironment('{quote}',"<omdoc:phrase type='quote' style='display:block'>#body</omdoc:phrase>"); +DefEnvironment('{quotation}',"<omdoc:phrase type='quote' style='display:block'>#body</omdoc:phrase>"); +DefEnvironment('{small}','#body'); +DefEnvironment('{footnotesize}','#body'); +DefEnvironment('{tiny}','#body'); +DefEnvironment('{scriptsize}','#body'); +DefConstructor('\LARGE',''); +DefConstructor('\Large',''); +DefConstructor('\large',''); +DefConstructor('\small',''); + +DefConstructor('\fbox{}','#1'); + +DefConstructor('\footnote[]{}', + "<omdoc:note class='foot' ?#1(mark='#1')>#2</omdoc:note>"); +DefConstructor('\footnotemark[]',""); +DefConstructor('\footnotetext[]{}', + "<omdoc:note class='foot' ?#1(mark='#1')>#2</omdoc:note>"); + +DefConstructor('\sf', ''); +DefConstructor('\sc', ''); +%</ltxml.sty> +% \end{macrocode} +% +% \subsection{Providing IDs for {\omdoc} Elements}\label{sec:impl:ids} +% +% To provide default identifiers (see section~\ref{sec:user:ids}), we tag all {\omdoc} +% elements that allow |xml:id| attributes by excuting the |numberIt| procedure below. +% +% \begin{macrocode} +%<*ltxml.sty> +Tag('omdoc:p',afterOpen=>\&numberIt); +Tag('omdoc:omtext',afterOpen=>\&numberIt); +Tag('omdoc:omgroup',afterOpen=>\&numberIt); +Tag('omdoc:tgroup',afterOpen=>\&numberIt); +Tag('omdoc:CMP',afterOpen=>\&numberIt); +%</ltxml.sty> +% \end{macrocode} +% The |numberIt| procedure gets the prefix from first parent with an |xml:id| attribute and then +% extends it with a label that reflects the number of preceding siblings, provided that +% there is not already an identifier. +% \begin{macrocode} +%<*ltxml.sty> +sub numberIt { + my($document,$node,$whatsit)=@_; + my(@parents)=$document->findnodes('ancestor::*[@xml:id]',$node); # find 1st id'd parent. + my $prefix= (@parents ? $parents[$#parents]->getAttribute('xml:id')."." : ''); + my(@siblings)=$document->findnodes('preceding-sibling::*[@xml:id]',$node); + my $n = scalar(@siblings)+1; + my $id = ($node -> getAttribute('xml:id')); + $node->setAttribute('xml:id'=>$prefix."p$n") unless $id; } +%</ltxml.sty> +% \end{macrocode} +% +% \subsection{Leftovers} +% +% \begin{macrocode} +%<*ltxml.sty> +DefConstructor('\url Semiverbatim',"<omdoc:link href='#1'>#1</omdoc:link>"); +%</ltxml.sty> +% \end{macrocode} +% \ednote{this should be handled differently, omdoc.sty should include url and give a new +% macro for it, which we then use in omdoc} +% and finally, we need to terminate the file with a success mark for perl. +% \begin{macrocode} +%<ltxml.sty|ltxml.cls>1; +% \end{macrocode} +% \Finale +\endinput + +% \iffalse +% LocalWords: GPL structuresharing STR omdoc dtx stex CPERL LoadClass url dc +%%% Local Variables: +%%% mode: doctex +%%% TeX-master: t +%%% End: +% \fi +% LocalWords: RequirePackage RegisterNamespace namespace xsl DocType ltxml dtd +% LocalWords: ltx DefEnvironment beforeDigest AssignValue inPreamble getGullet +% LocalWords: afterDigest keyval omgroup DefKeyVal Semiverbatim KeyVal tgroup +% LocalWords: OptionalKeyVals DefParameterType IfBeginFollows skipSpaces CMP +% LocalWords: ifNext DefMacro needwrapper unlist DefConstructor omtext bgroup +% LocalWords: useCMPItemizations RefStepItemCounter egroup beginItemize li di +% LocalWords: beforeDigestEnd useTheoryItemizations dt autoclose ul ol dl env +% LocalWords: afterOpen LastSeenCMP autoClose DefCMPEnvironment proto ToString +% LocalWords: addAttribute nlex nlcex omdocColorMacro args tok MergeFont qw +% LocalWords: TokenizeInternal toString isMath foreach maybeCloseElement id'd +% LocalWords: autoOpen minipage footnotesize scriptsize numberIt whatsit href +% LocalWords: getAttribute setAttribute diff --git a/Master/texmf-dist/source/latex/stex/omdoc.ins b/Master/texmf-dist/source/latex/stex/omdoc.ins new file mode 100644 index 00000000000..41de5776ed6 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/omdoc.ins @@ -0,0 +1,40 @@ +%% +%% This file generates files required to use the ed package. +%% At your command prompt write +%% +%% latex omdoc.ins +%% +%% Copyright(c) 2005 Michael Kohlhase +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.0 or, at your option, any later version. +%% +\input docstrip +\preamble +\endpreamble + +%\usedir{tex/latex/listings} +\keepsilent +\askforoverwritefalse + +% generate base package +\generate{\file{omdoc.sty}{\from{omdoc.dtx}{package}}} +\generate{\file{omdoc.cls}{\from{omdoc.dtx}{cls}}} + +\Msg{*} +\Msg{* You probably need to move the generated style files into a directory searched by TeX.} +\Msg{*} +\Msg{* And don't forget to refresh your filename database} +\Msg{* if your TeX distribution uses such a database.} +\Msg{*} + +\nopreamble\nopostamble +\generate{\file{omdoc.sty.ltxml}{\from{omdoc.dtx}{ltxml.sty}}} +\generate{\file{omdoc.cls.ltxml}{\from{omdoc.dtx}{ltxml.cls}}} + +\Msg{*} +\Msg{* You may need to move the generated ltxml files into a directory searched by LaTeXML.} +\Msg{*} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/stex/presentation.dtx b/Master/texmf-dist/source/latex/stex/presentation.dtx new file mode 100644 index 00000000000..63038539256 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/presentation.dtx @@ -0,0 +1,977 @@ +% \iffalse meta-comment +% An Infrastructure for Presenting Semantic Macros in sTeX +% Copyright (C) 2004-2007 Michael Kohlhase, all rights reserved +% This file is released under the LaTeX Project Public License (LPPL) +% +% The development version of this file can be found at +% https://svn.kwarc.info/repos/kwarc/projects/stex/sty/presentation.dtx +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{presentation}[2007/09/03 v0.9e presentation for semantic macros] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{url,array,presentation,float} +\usepackage[show]{ed} +\usepackage{hyperref} +\makeindex +\floatstyle{boxed} +\newfloat{exfig}{thp}{lop} +\floatname{exfig}{Example} +\begin{document}\DocInput{presentation.dtx}\end{document} +%</driver> +% \fi +% +% \CheckSum{373} +% +% \changes{v0.9}{2005/06/14}{First Version with Documentation} +% \changes{v0.9a}{2005/07/01}{Completed Documentation} +% \changes{v0.9b}{2005/08/06}{Complete functionality and Updated Documentation} +% \changes{v0.9c}{2006/01/13}{more packaging} +% \changes{v0.9d}{2006/10/13}{adding mixfix declarations} +% \changes{v0.9d}{2006/10/13}{dealing with precedences in keyword arguments} +% \changes{v0.9e}{2007/09/03}{fixing argument precedences, adding LaTeXML bindings} +% \changes{v0.9f}{2007/12/09}{adding general elision} +% +% \GetFileInfo{presentation.sty} +% +% \MakeShortVerb{\|} +%\def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}} +% \def\stex{{\raisebox{-.5ex}S\kern-.5ex\TeX}} +% \def\sTeX{\stex} +% \def\xml{\scsys{Xml}} +% \def\mathml{\scsys{MathML}} +% \def\omdoc{\scsys{OMDoc}} +% \def\openmath{\scsys{OpenMath}} +% \def\latexml{\scsys{LaTeXML}} +% \def\perl{\scsys{Perl}} +% \def\cmathml{Content-{\sc MathML}\index{Content {\sc MathML}}\index{MathML@{\sc MathML}!content}} +% \def\activemath{\scsys{ActiveMath}} +% \def\twin#1#2{\index{#1!#2}\index{#2!#1}} +% \def\twintoo#1#2{{#1 #2}\twin{#1}{#2}} +% \def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}} +% \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} +% \title{An Infrastructure for Presenting Semantic Macros in {\stex}\thanks{Version {\fileversion} (last revised +% {\filedate})}} +% \author{Michael Kohlhase\\ +% Jacobs University, Bremen\\ +% \url{http://kwarc.info/kohlhase}} +% \maketitle +% +% \begin{abstract} +% The |presentation| packge is a central part of the {\stex} collection, a version of +% {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents semantically without +% leaving the document format, essentially turning {\TeX/\LaTeX} into a document format +% for mathematical knowledge management (MKM). +% +% This package supplies an infrastructure that allows to specify the presentation of +% semantic macros, including preference-based bracket elision. This allows to markup the +% functional structure of mathematical formulae without having to lose high-quality +% human-oriented presentation in {\LaTeX}. Moreover, the notation definitions can be +% used by MKM systems for added-value services, either directly from the {\sTeX} +% sources, or after translation. +% \end{abstract} +% \setcounter{tocdepth}{2}\tableofcontents\newpage +% +%\section{Introduction}\label{sec:presentation} +% +% The |presentation| package supplies an infrastructure that allows to specify the +% presentation of semantic macros, including preference-based bracket elision. This allows +% to markup the functional structure of mathematical formulae without having to lose +% high-quality human-oriented presentation in {\LaTeX}. Moreover, the notation definitions +% can be used by MKM systems for added-value services, either directly from the {\sTeX} +% sources, or after translation. +% +% {\stex} is a version of {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents +% semantically without leaving the document format, essentially turning {\TeX/\LaTeX} into +% a document format for mathematical knowledge management (MKM). +% +% The setup for semantic macros described in the {\stex} |modules| package works well for +% simple mathematical functions: we make use of the macro application syntax in {\TeX} to +% express function application. For a simple function called ``foo'', we would just +% declare |\symdef{foo}[1]{foo(#1)}| and have the concise and intuitive syntax |\foo{x}| +% for $foo(x)$. But mathematical notation is much more varied and interesting than just +% this. +% +% \section{The User Interface} +% +% In this package we will follow the {\sTeX} approach and assume that there are four basic +% types of mathematical expressions: symbols, variables, applications and +% binders. Presentation of the variables is relatively straightforward, so we will not +% concern ourselves with that. The application of functions in mathematics is mostly +% presented in the form $f(a_1,\ldots,a_n)$, where $f$ is the function and the $a_i$ are +% the arguments. However, many commonly-used functions from this presentational scheme: +% for instance binomial coefficients: $\bigl({n\atop k}\bigr)$, pairs: $\langle +% a,b\rangle$, sets: $\{x\in S\,\vert\, x^2\ne0\}$, or even simple addition: $3+5+7$. Note +% that in all these cases, the presentation is determined by the (functional) head of the +% expression, so we will bind the presentational infrastructure to the operator. +% +% \subsection{Mixfix Notations}\label{sec:mixfix} +% +% For the presentation of ordinary operators, we will follow the approach used by the +% Isabelle theorem prover. There, the presentation of an $n$-ary function (i.e. one that +% takes $n$ arguments) is specified as +% \meta{pre}\meta{arg$_0$}\meta{mid$_1$}$\cdots$\meta{mid$_n$}\meta{arg$_n$}\meta{post}, +% where the \meta{arg$_i$} are the arguments and \meta{pre}, \meta{post}, and the +% \meta{mid$_i$} are presentational material. For instance, in infix operators like the +% binary subset operator, \meta{pre} and $\meta{post}$ are empty, and \meta{mid$_1$} is +% $\subseteq$. For the ternary conditional operator in a programming language, we might +% have the presentation pattern +% |if|\meta{arg$_1$}|then|\meta{arg$_2$}|else|\meta{arg$_3$}|fi| that utilizes all +% presentation positions. +% +% \DescribeMacro{\mixfix*}The |presentation| package provides mixfix declaration macros +% |\mixfixi|, |\mixfixii|, and |\mixfixiii| for unary, binary, and ternary functions. This +% covers most of the cases, larger arities would need a different argument +% pattern.\footnote{If you really need larger arities, contact the author!} The call +% pattern of these macros is just the presentation pattern above. In general, the mixfix +% declaration of arity $i$ has $2n+1$ arguments, where the even-numbered ones are for the +% arguments of the functions and the odd-numbered ones are for presentation material. For +% instance, to define a semantic macro for the subset relation and the conditional, we +% would use the markup in Figure~\ref{fig:mixfix}. +% \begin{exfig} +% \begin{verbatim} +% \symdef{sseteq}[2]{\mixfixii{}{#1}{\subseteq}{#2}{}} +% \symdef{sseteq}[2]{\infix\subseteq{#1}{#2}} +% \symdef{ite}[2]{\mixfixiii{{\tt{if}}\;}{#1} +% {\;{\tt{then}}\;}{#2} +% {\;{\tt{else}}\;}{#3}{\;{\tt{fi}}}} +% \end{verbatim} +% \vspace*{-1.5em} +% \begin{center} +% \begin{tabular}{|l|l|}\hline +% source & presentation \\\hline +% |\sseteq{S}T| & $(S\subseteq T)$\\\hline +% |\ite{x<0}{-x}x| & ${\tt{if}}\,x<0\,{\tt{then}}\,-x\,{\tt{else}}\,x\,{\tt{fi}}$\\\hline +% \end{tabular} +% \end{center} +% \caption{Declaration of mixfix operators}\label{fig:mixfix} +% \end{exfig} +% +% For certain common cases, the |presentation| package provides shortcuts for the mixfix +% declarations. The \DescribeMacro{\prefix}|\prefix| macro allows to specify a prefix +% presentation for a function (the usual presentation in mathematics). Note that it is +% better to specify |\symdef{uminus}[1]{\prefix{-}{#1}}| than just +% |\symdef{uminus}[1]{-#1}|, since we can specify the bracketing behavior in the former +% (see Section~\ref{sec:elision}). +% +% The \DescribeMacro{\postfix}|\postfix| macro is similar, only that the function is +% presented after the argument as for e.g. the factorial function: $5!$ stands for the +% result of applying the factorial function to the number 5. Note that the function is +% still the first argument to the |\postfix| macro: we would specify the presentation for +% the factorial function with |\symdef{factorial}[1]{\postfix{!}{#1}}|. +% +% Finally, we provide the \DescribeMacro{\infix}|\infix| macro for binary operators that +% are written between their arguments (see Figure~\ref{fig:mixfix}). +% +% \subsection{\texorpdfstring{$n$}{n}-ary Associative Operators}\label{sec:assoc} +% +% Take for instance the operator for set union: formally, it is a binary function on +% sets that is associative (i.e. $(S_1\cup S_2)\cup S_3=S_1\cup (S_2\cup S_3)$), therefore +% the brackets are often elided, and we write $S_1\cup S_2\cup S_3$ instead (once we have +% proven associativity). Some authors even go so far to introduce set union as a $n$-ary +% operator, i.e. a function that takes an arbitrary (positive) number of arguments. We will +% call such operators {\bf{$n$-ary +% associative}\atwin{n-ary}{associative}{operator}}. +% +% Specifying the presentation\ednote{introduce the notion of presentation above} of +% $n$-ary associative operators in |\symdef| forms is not straightforward, so we provide +% some infrastructure for that. As we cannot predict the number of arguments for $n$-ary +% operators, we have to give them all at once, if we want to maintain our use of {\TeX} +% macro application to specify function application. So a semantic macro for an $n$-ary +% operator will be applied as |\nunion{|\meta{$a_1$}|,|\ldots|,|\meta{$a_n$}|}|, where the +% sequence of $n$ logical arguments \meta{$a_i$} are supplied as one {\TeX} argument which +% contains a comma-separated list. We provide variants of the mixfix declarations +% presented in section~\ref{sec:mixfix} which deal with associative arguments. For +% instance, the variant \DescribeMacro{\mixfixa}|\mixfixa| allows to specify $n$-ary +% associative operators. +% |\mixfixa{|\meta{pre}|}{|\meta{arg}|}{|\meta{post}|}{|\meta{op}|}| specifies a +% presentation, where \meta{arg} is the associative argument and \meta{op} is the +% corresponding operator that is mapped over the argument list; as above, {\meta{pre}}, +% \meta{post}, are prefix and postfix presentational material. For instance, the finite +% set constructor could be constructed as +% \begin{verbatim} +% \newcommand{\fset}[1]{\mixfixa[p=0]{\{}{#1}{\}}{,}} +% \end{verbatim} +% +% The \DescribeMacro{\assoc}|\assoc| macro is a convenient abbreviation of a |\mixfixa| +% that can be used in cases, where \meta{pre} and \meta{post} are empty (i.e. in the +% majority of cases). It takes two arguments: the presentation of a binary operator, and a +% comma-separated list of arguments, it replaces the commas in the second argument with +% the operator in the first one. For instance |\assoc\cup{S_1,S_2,S_3}| will be formatted +% to $S_1\cup S_2\cup S_3$. Thus we can use |\def\nunion#1{\assoc\cup{#1}}| or even +% |\def\nunion{\assoc\cup}|, to define the $n$-ary operator for set union in {\TeX}. For +% the definition of a semantic macro in {\stex}, we use the second form, since we are more +% conscious of the right number of arguments and would declare +% |\symdef{nunion}[1]{\assoc\cup{#1}}|.\ednote{think about big operators for ACI +% functions} +% +% These macros |\prefix| and |\postfix| have $n$-ary variants +% \DescribeMacro{\prefixa}|\prefixa| and \DescribeMacro{\postfixa}|\postfixa| that take an +% arbitrary number of arguments (mathematically; syntactically grouped into one {\TeX} +% argument). These take an extra separator argument.\ednote{think of a good example!} + +% The |\mixfixii| macro has variants \DescribeMacro{\mixfixia}|\mixfixia|, +% \DescribeMacro{\mixfixai}|\mixfixai|, and \DescribeMacro{\mixfixaa}|\mixfixaa|, which +% allow to make one or two arguments in a binary function associative\footnote{If you +% really need larger arities with associative arguments, contact the package author!}. A +% use case for the second macro is an nary function type operator |\fntype|, which can be +% defined via +% \begin{verbatim} +% \def\fntype#1#2{\mixfixai{}{#1}\rightarrow{#2}{}\times} +% \end{verbatim} +% and which will format |\fntype{\alpha,\beta,\gamma}\delta| as +% $\alpha\times\beta\times\gamma\to\delta$. +% +% \subsection{Precedence-Based Bracket Elision}\label{sec:elision} +% +% With the infrastructure supplied by the |\assoc| macro we could now try to combine +% set union and set intersection in one formula. Then, writing +% \begin{equation}\label{cupcap} +% |\nunion{\ninters{a,b},\ninters{c,d}}| +% \end{equation} +% would yield $((a\cap b)\cup (c\cap d))$, and not $a\cap b\cup c\cap d$ as we would like, +% since $\cap$ binds stronger than $\cup$. Dropping outer brackets in the presentations of +% the presentation of the operators will not help in general: it would give the desired +% form for (\ref{cupcap}) but $a\cap b\cup c\cap d$ for (\ref{capcup}), where we would +% have liked $(a\cup b)\cap(c\cup d)$ +% \begin{equation}\label{capcup} +% |\ninters{\nunion{a,b},\nunion{c,d}}| +% \end{equation} +% +% In mathematics, brackets are elided, whenever the author anticipates that the reader can +% understand the formula without them, and would be overwhelmed with them. To achieve +% this, there are set of common conventions that govern bracket elision. The most common +% is to assign precedences to all operators, and elide brackets, if the +% {\index*{precedence}} of the operator is lower than that of the context it is presented +% in. In our example above, we would assign $\cap$ a lower precedence than $\cup$ (and +% both a lower precedence than the initial precedence). To compute the presentation of +% (\ref{capcup}) we start out with the |\ninters|, elide its brackets (since the +% precedence $n$ of $\cup$ is lower than the initial precedence $i$), and set the context +% precedence for the arguments to $n$. When we present the arguments, we present the +% brackets, since the precedence of |nunion| is lower than the context precedence $n$. +% +% This algorithm, which we call {\bf{precedence-based bracket elision}} goes a long +% way towards approximating mathematical practice. Note that full bracket elision in +% mathematical practice is a reader-oriented process, it cannot be fully mechanical, +% e.g. in $(a\cap b\cap c\cap d\cap e\cap f\cap g)\cup h$ we better put the brackets +% around the septary intersection to help the reader even thoug they could have been +% elided by our algorithm. Therefore, the author has to retain full control over +% bracketing in a bracket elision architecture (otherwise it would become impossible to +% explain the concept of associativity).\ednote{think about how to implement that}. +% +% \begin{figure}[htb] +% \begin{center} +% \begin{tabular}{|l|l|l|}\hline +% Precedence & Operators & Comment\\\hline\hline +% 200 & +,- & unary \\\hline +% 200 & $\hat{}$ & exponentiation \\\hline +% 400 & $*,\land,\cap$ & multiplicative \\\hline +% 500 & $+,-,\lor,\cup$ & additive\\\hline +% 600 & / & fraction \\\hline +% 700 & $=, \ne, \leq, <, >, \geq$ & relation\\\hline +% \end{tabular} +% \end{center} +% \caption{Common Operator Precedences}\label{fig:precedence} +% \end{figure} +% +% In {\stex} we supply an optional keyval arguments to the mixfix declarations and their +% abbreviations that allow to specify precedences: The key \DescribeMacro{p}|p| key is +% used to specify the {\bf{operator precedence}}, and the keys +% \DescribeMacro{pi}\DescribeMacro{pii}\DescribeMacro{piii}|p|\meta{i} can be used to +% specify the {\bf{argument precedence}s}. The latter will set the precedence level while +% processing the arguments, while the operator precedence invokes brackets, if it is +% larger than the current precedence level --- which is set by the appropriate argument +% precedence by the dominating operators or the outer precedence. +% +% If none of the precedences is specified, then the defaults are assumed. The operator +% precedence is set to the default operator precedence, which defaults to 1000 and can be +% set by {\DescribeMacro{\setDefaultPrecedence}}|\setDefaultPrecedence{|\meta{prec}|}| +% where \meta{prec} is an integer. The argument precedences default to the operator +% precedence. +% +% Figure~\ref{fig:precedence} gives an overview over commonly used precedences. Note that +% most operators have precedences lower than the default precedence of 1000, otherwise the +% brackets would not be elided. For our examples above, we would define +% \begin{verbatim} +% \newcommand{\nunion}[1]{\assoc[p=500]{\cup}{#1}} +% \newcommand{\ninters}[1]{\assoc[p=400]{\cap}{#1}} +% \end{verbatim} +% to get the desired behavior. +% +% Note that the presentation macros uses round brackets for grouping by default. We can +% specify other brackets via two more keywords: \DescribeMacro{lbrack}|lbrack| and +% \DescribeMacro{rbrack}|rbrack|. Just as above, we can also reset the default brackets +% with {\DescribeMacro{\setDefaultLeftBracket}}|\setDefaultLeftBracket{|\meta{lb}|}|and +% {\DescribeMacro{\setDefaultRightBracket}}|\setDefaultRightBracket{|\meta{rb}|}| where +% \meta{lb} and \meta{rb} expand to the desired brackets. Note that formula parts that +% look like brackets usually are not. For instance, we should not define the finite set +% constructor via +% \begin{verbatim} +% \newcommand{\fset}[1]{\assoc[lbrack=\{,rbrack=\}]{,}{#1}} +% \end{verbatim} +% where the curly braces are used as brackets, but as presented in section~\ref{sec:assoc} +% even though both would format |\fset{a,b,c}| as $\{a,b,c\}$. In the encoding here, an +% operator with suitably high operator precedence would be able to make the brackets +% disappear. +% +% \subsection{Flexible Elision}\label{sec:flexible-elision} +% +% There are several situations in which it is desirable to display only some parts of the +% presentation: +% \begin{itemize} +% \item We have alreday seen the case of redundant brackets above +% \item Arguments that are strictly necessary are omitted to simplify the notation, and the +% reader is trusted to fill them in from the context. +% \item Arguments are omitted because they have default values. For example $\log_{10}x$ +% is often written as $\log x$. +% \item Arguments whose values can be inferred from the other arguments are usually +% omitted. For example, matrix multiplication formally takes five arguments, namely the +% dimensions of the multiplied matrices and the matrices themselves, but only the latter +% two are displayed. +% \end{itemize} +% +% Typically, these elisions are confusing for readers who are getting acquainted with a +% topic, but become more and more helpful as the reader advances. For experienced readers +% more is elided to focus on relevant material, for beginners representations are more +% explicit. In the process of writing a mathematical document for traditional (print) +% media, an author has to decide on the intended audience and design the level of elision +% (which need not be constant over the document though). With electronic media we have new +% possibilities: we can make elisions flexible. The author still chooses the elision level +% for the initial presentation, but the reader can adapt it to her level of competence and +% comfort, making details more or less explicit. +% +% \DescribeMacro{\elide} To provide this functionality, the |presentation| package +% provides the |\elide| macro allows to asociate a text with an integer +% {\bf{visibility level}} and group them into {\bf{elision groups}}. High levels +% mean high elidability. +% +% Elision can take various forms in print and digital media. In static media like +% traditional print on paper or the PostScript format, we have to fix the elision level, +% and can decide at presentation time which elidable tokens will be printed and which will +% not. In this case, the presentation algorithm will take visibility thresholds $T_g$ for +% every elidability group $g$ as a user parameter and then elide (i.e. not print) all +% tokens in visibility group $g$ with level $l>T_g$. \DescribeMacro{\setelevel} We specify +% this threshold for via the |\setelevel| macro. For instance in the example below, we +% have a two type annotations |par| for type parameters and |typ| for type annotations +% themselves. +% +% \begin{exfig}[ht] +% \begin{verbatim} +% $\mathbf{I}\elide{par}{500}{^\alpha}\elide{typ}{100}{_{\alpha\to\alpha}} +% :=\lambda{X\elide{ty}{500}{_\alpha}}.X$ +% \end{verbatim} +% \vspace{-2em} +% \end{exfig} +% +% The visibility levels in the example encode how redundant the author thinks the elided +% parts of the formula are: low values show high redundancy. In our example the intuition +% is that the type paraemter on the $\mathbf{I}$ cominator and the type annotation on the +% bound variable $X$ in the $\lambda$ expression are of the same obviousness to the +% reader. So in a document that contains |\setegroup{typ}{1000}| and +% |\setegroup{an}{1000}| will show $\mathbf{I}:=\lambda{X}.X$ eliding all redundant +% information. If we have both values at 400, then we will see +% $\mathbf{I}^\alpha:=\lambda{X_\alpha}.X$ and only if the threshold for |typ| dips below +% 100, then we see the full information: +% $\mathbf{I}^\alpha_{\alpha\to\alpha}:=\lambda{X_\alpha}.X$. +% +% In an output format that is capable of interactively changing its appearance, e.g. +% dynamic XHTML+MathML (i.e. XHTML with embedded Presentation {\mathml} formulas, which can +% be manipulated via JavaScript in browsers), an application can export the information +% about elision groups and levels to the target format, and can then dynamically change the +% visibility thresholds by user interaction. Here the visibility threshold would also be +% used, but here it only determines the default rendering; a user can then fine-tune the +% document dynamically to reveal elided material to support understanding or to elide more +% to increase conciseness. +% +% The price the author has to pay for this enhanced user experience is that she has to +% specify elided parts of a formula that would have been left out in conventional +% {\LaTeX}. Some of this can be alleviated by good coding practices. Let us consider the log +% base case. This is elided in mathematics, since the reader is expected to pick it up from +% context. Using semantic macros, we can mimic this behavior: defining two semantic macros: +% |\logC| which picks up the log base from the context via the |\logbase| +% macro and |\logB| which takes it as a (first) argument. +% +% \begin{verbatim} +% \provideEdefault{logbase}{10} +% \symdef{logB}[2]{\prefix{\mathrm{log}\elide{base}{100}{_{#1}}}{#2}} +% \abbrdef{logC}[1]{\logB{\fromEcontext{logbase}}{#1}} +% \end{verbatim} +% +% \DescribeMacro{\provideEdefault} Here we use the |\provideEdefault| macor to initialize +% a {\LaTeX} token register for the |logbase| default, which we can pick up from the +% elision context using \DescribeMacro{\fromEcontext}|\fromEcontext| in the definition of +% |\logC|. Thus |\logC{x}| would render as $\mathrm{log}_{10}(x)$ with a threshold of 50 +% for |base| and as $\mathrm{log}_2$, if the local {\TeX} group e.g. given by the +% |assertion| environment contains a +% \DescribeMacro{setEdefault}|\setEdefault{logbase}{2}|. +% +% \subsection{Hyperlinking}\label{sec:hyperlinking} +% +%\ednote{describe what we want to do here} +% +% \subsection{Variable Names} +% +% \ednote{what is the problem?} +% +% \DescribeMacro{\vname} |\vname| identifies a token sequence as a name, and provides an +% ASCII ({\xml}-compatible) identifier for it. The optional argument is the identifier, +% and the second one the LaTeX representation. The identifier can also be used with +% |\vnameref| for copy and paste.\ednote{does this really work} +% +% \StopEventually{\ednotemessage} +% +% \section{The Implementation}\label{sec:implementation} +% +% We first make sure that the KeyVal package is loaded (in the right +% version). For {\latexml}, we also initialize the package inclusions. +% \begin{macrocode} +%<package>\RequirePackage{keyval}[1997/11/10] +%<*ltxml> +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('keyval'); +%</ltxml> +% \end{macrocode} +% We will first specify the default precedences and brackets, together with the macros +% that allow to set them. +% \begin{macrocode} +%<*package> +\def\pres@default@precedence{1000} +\def\setDefaultPrecedence#1{\def\pres@default@precedence{#1}} +\def\pres@initial@precedence{1000} +\def\setInitialPrecedence#1{\def\pres@initial@precedence{#1}} +\def\pres@current@precedence{\pres@initial@precedence} +\def\pres@default@lbrack{(}\def\pres@lbrack{\pres@default@lbrack} +\def\pres@default@rbrack{)}\def\pres@rbrack{\pres@default@rbrack} +\def\setDefaultLeftBracket#1{\def\pres@default@lbrack{#1}} +\def\setDefaultRightBracket#1{\def\pres@default@rbrack{#1}} +%</package> +% \end{macrocode} +% +% \subsection{The System Commands}\label{sec:impl:syscommands} +% +% \begin{macro}{\PrecSet} +% |\PrecSet| will set the default precedence.\ednote{need to implement this in {\latexml}?} +% \begin{macrocode} +%<package>\def\PrecSet#1{\def\pres@default@precedence{#1}} +%<*ltxml> +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\PrecWrite} +% |\PrecWrite| will write a bracket, if the precedence mandates it, i.e. if |\pres@p| is +% greater than the current |\pres@current@precedence| +% \begin{macrocode} +%<package>\def\PrecWrite#1{\ifnum\pres@current@precedence>\pres@p\else{#1}\fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{Mixfix Operators}\label{sec:impl:mixfix} +% +% \begin{macrocode} +%<*package> +\def\clearkeys{\let\pres@p@key=\relax +\let\pres@pi@key=\relax% +\let\pres@pi@key=\relax% +\let\pres@pii@key=\relax% +\let\pres@piii@key=\relax} +\define@key{mi}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{mi}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{mi}{p}{\def\pres@p@key{#1}} +\define@key{mi}{pi}{\def\pres@pi@key{#1}} +\def\prep@keys@mi% +{\edef\pres@lbrack{\@ifundefined{pres@lbrack@key}{\pres@default@lbrack}{\pres@lbrack@key}} +\edef\pres@rbrack{\@ifundefined{pres@rbrack@key}{\pres@default@rbrack}{\pres@rbrack@key}} +\edef\pres@p{\@ifundefined{pres@p@key}{\pres@default@precedence}{\pres@p@key}} +\edef\pres@pi{\@ifundefined{pres@pi@key}{\pres@p}{\pres@pi@key}}} +%</package> +%<*ltxml> +DefKeyVal('mi','lbrack','Semiverbatim'); +DefKeyVal('mi','rbrack','Semiverbatim'); +DefKeyVal('mi','p','Semiverbatim'); +DefKeyVal('mi','pi','Semiverbatim'); +%</ltxml> +% \end{macrocode} +% +% \begin{macro}{\mixfixi} +% \begin{macrocode} +%<*package> +\newcommand{\mixfixi}[4][]%key, pre, arg, post +{\setkeys{mi}{#1}\prep@keys@mi\clearkeys +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}#4% +\PrecWrite\pres@rbrack} +%</package> +%<*ltxml> +DefConstructor('\mixfixi OptionalKeyVals:mi {}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mixfixa} +% \begin{macrocode} +%<*package> +\newcommand{\mixfixa}[5][]%key, pre, arg, post, assocop +{\setkeys{mi}{#1}\prep@keys@mi\clearkeys% +\PrecWrite\pres@lbrack{#2}{\@assoc\pres@pi{#5}{#3}}{#4}\PrecWrite\pres@rbrack} +%</package> +%<*ltxml> +DefConstructor('\mixfixa OptionalKeyVals:mi {}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:exprlist name='args'>" + . "<omdoc:expr name='arg'/>" + . "</omdoc:exprlist>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:iterate name='args' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<omdoc:separator>" + . "<ltx:Math><ltx:XMath>#5</ltx:XMath></ltx:Math>" + . "</omdoc:separator>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%<*package> +\define@key{mii}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{mii}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{mii}{p}{\def\pres@p@key{#1}} +\define@key{mii}{pi}{\def\pres@pi@key{#1}} +\define@key{mii}{pii}{\def\pres@pii@key{#1}} +\def\prep@keys@mii{\prep@keys@mi% +\edef\pres@pii{\@ifundefined{pres@pii@key}{\pres@p}{\pres@pii@key}}% +\let\pres@pii@key=\relax} +%</package> +%<*ltxml> +DefKeyVal('mii','lbrack','Semiverbatim'); +DefKeyVal('mii','rbrack','Semiverbatim'); +DefKeyVal('mii','p','Semiverbatim'); +DefKeyVal('mii','pi','Semiverbatim'); +DefKeyVal('mii','pii','Semiverbatim'); +%</ltxml> +% \end{macrocode} +% +% \begin{macro}{\mixfixii} +% \begin{macrocode} +%<*package> +\newcommand{\mixfixii}[6][]%key, pre, arg1, mid, arg2, post +{\setkeys{mii}{#1}\prep@keys@mii\clearkeys% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\edef\pres@current@precedence{\pres@pii}#5}#6% +\PrecWrite\pres@rbrack} +%</package> +%<*ltxml> +DefConstructor('\mixfixii OptionalKeyVals:mi {}{}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "<omdoc:expr name='arg2'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg1' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg2' ?&KeyVal(#1,'pii')(precedence='&KeyVal(#1,'pii')')/>" + . "<ltx:Math><ltx:XMath>#6</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mixfixia} +% \begin{macrocode} +%<*package> +\newcommand{\mixfixia}[7][]%key, pre, arg1, mid, arg2, post, assocop +{\setkeys{mii}{#1}\prep@keys@mii\clearkeys% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\@assoc\pres@pii{#7}{#5}}#6% +\PrecWrite\pres@rbrack} +%</package> +%<*ltxml> +DefConstructor('\mixfixia OptionalKeyVals:mi {}{}{}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "<omdoc:exprlist name='args'>" + . "<omdoc:expr name='arg'/>" + . "</omdoc:exprlist>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg1' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "<omdoc:iterate name='args' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<omdoc:separator>" + . "<ltx:Math><ltx:XMath>#7</ltx:XMath></ltx:Math>" + . "</omdoc:separator>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "<ltx:Math><ltx:XMath>#6</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mixfixai} +% \begin{macrocode} +%<*package> +\newcommand{\mixfixai}[7][]%key, pre, arg1, mid, arg2, post, assocop +{\setkeys{mii}{#1}\prep@keys@mii\clearkeys% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\@assoc\pres@pi{#7}{#3}}% +#4{\edef\pres@current@precedence{\pres@pii}#5}#6% +\PrecWrite\pres@rbrack} +%</package> +%<*ltxml> +DefConstructor('\mixfixai OptionalKeyVals:mi {}{}{}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:exprlist name='args'>" + . "<omdoc:expr name='arg'/>" + . "</omdoc:exprlist>" + . "<omdoc:expr name='arg2'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:iterate name='args' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<omdoc:separator>" + . "<ltx:Math><ltx:XMath>#7</ltx:XMath></ltx:Math>" + . "</omdoc:separator>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg2' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#6</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%<*package> +\define@key{miii}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{miii}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{miii}{p}{\def\pres@p@key{#1}} +\define@key{miii}{pi}{\def\pres@pi@key{#1}} +\define@key{miii}{pii}{\def\pres@pii@key{#1}} +\define@key{miii}{piii}{\def\pres@piii@key{#1}} +\def\prep@keys@miii{\prep@keys@mii\edef\pres@piii{\@ifundefined{pres@piii@key}{\pres@p}{\pres@piii@key}}} +%</package> +%<*ltxml> +DefKeyVal('miii','lbrack','Semiverbatim'); +DefKeyVal('miii','rbrack','Semiverbatim'); +DefKeyVal('miii','p','Semiverbatim'); +DefKeyVal('miii','pi','Semiverbatim'); +DefKeyVal('miii','pii','Semiverbatim'); +DefKeyVal('miii','piii','Semiverbatim'); +%</ltxml> +% \end{macrocode} +% +% \begin{macro}{\mixfixiii} +% \begin{macrocode} +%<*package> +\newcommand{\mixfixiii}[8][]%key, pre, arg1, mid1, arg2, mid2, arg3, post +{\setkeys{miii}{#1}\prep@keys@miii\clearkeys% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\edef\pres@current@precedence{\pres@pii}#5}% +#6{\edef\pres@current@precedence{\pres@pii}#7}#8% +\PrecWrite\pres@rbrack} +%</package> +%<*ltxml> +DefConstructor('\mixfixiii OptionalKeyVals:mi {}{}{}{}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "<omdoc:expr name='arg2'/>" + . "<omdoc:expr name='arg3'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg1' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg2' ?&KeyVal(#1,'pii')(precedence='&KeyVal(#1,'pii')')/>" + . "<ltx:Math><ltx:XMath>#6</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg3' ?&KeyVal(#1,'piii')(precedence='&KeyVal(#1,'piii')')/>" + . "<ltx:Math><ltx:XMath>#8</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\prefix, \postfix} +% |\prefix|, |\prefixa|, |\postfix| and |\postfixa|\ednote{need prefixl and postfixl as +% well, use counters for precedences here.} are simple special cases of |\mixfixi| and +% |\mixfixa|. +% \begin{macrocode} +%<*package> +\newcommand{\prefix}[3][]%key, fn, arg +{\setkeys{mi}{#1}\prep@keys@mi\clearkeys +#2\PrecWrite\pres@lbrack% write bracket if necessary +{\edef\pres@current@precedence{\pres@pi}#3}% +\PrecWrite\pres@rbrack} +\newcommand{\postfix}[3][]%key, fn, arg +{\setkeys{mi}{#1}\prep@keys@mi\clearkeys +\PrecWrite\pres@lbrack% write bracket if necessary +{\edef\pres@current@precedence{\pres@pi}#3}% +\PrecWrite\pres@rbrack{#2}} +\newcommand{\prefixa}[4][]{\mixfixa[#1]{#2}{#3}{}{#4}} +\newcommand{\postfixa}[4][]{{#1}\mixfixa[#1]{}{#3}{#2}{#4}} +%</package> +%<*ltxml> +DefConstructor('\prefix OptionalKeyVals:mi {}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefConstructor('\postfix OptionalKeyVals:mi {}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\infix} +% |\infix|\ednote{need infixl as well, use counters for precedences here.} is a simple +% special case of |\mixfixii|. +% \begin{macrocode} +%<*package> +\newcommand{\infix}[4][]{\mixfixii[#1]{}{#3}{#2}{#4}{}} +%</package> +%<*ltxml> +DefMacro('\infix []{}{}{}','\mixfixii[#1]{}{#3}{#2}{#4}{}'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \subsection{Associative Operators}\label{sec:impl:assoc} +% +% \begin{macro}{\@assoc} +% We are using functionality from the {\LaTeX} core packages here to iterate over the +% arguments. +% \begin{macrocode} +%<*package> +\def\@assoc#1#2#3{% precedence, function, argv +\let\@tmpop=\relax% do not print the function the first time round +\@for\@I:=#3\do{\@tmpop% print the function +% write the i-th argument with locally updated precedence +{\edef\pres@current@precedence{#1}\@I}% +\let\@tmpop=#2}}%update the function +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\assoc} +% With the internal macro above, associatifivity is easily specified. +% \begin{macrocode} +%<package>\newcommand{\assoc}[3][]{\mixfixa[#1]{}{#3}{}{#2}} +%<*ltxml> +DefConstructor('\assoc OptionalKeyVals:mi {}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:exprlist name='args'>" + . "<omdoc:expr name='arg'/>" + . "</omdoc:exprlist>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<omdoc:iterate name='args' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<omdoc:separator>" + . "<ltx:Math><ltx:XMath>#3</ltx:XMath></ltx:Math>" + . "</omdoc:separator>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \subsection{General Elision}\label{sec:impl:elision} +% +% \begin{macro}{\setegroup} +% The elision macros are quite simple, a group |foo| is internally represented by a +% macro |foo@egroup|, which we set by a |\gdef|. +% \begin{macrocode} +%<package>\def\setegroup#1#2{\expandafter\def\csname #1@egroup\endcsname{#2}} +%<*ltxml> +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setegroup} +% Then the elision command is picks up on this (flags an error) if the internal macro +% does not exist and prints the third argument, if the elision value threshold is above +% the elision group threshold in the paper. +% \begin{macrocode} +%<*package> +\def\elide#1#2#3{\@ifundefined{#1@egroup}% +{\def\@elevel{1000} +\PackageError{presentation}{undefined egroup #1, assuming value 1000}% +{When calling \protect\elide{#1}... the elision group #1 has be have\MessageBreak +been set by \protect\setegroup before, e.g. by \protect\setegroup{an}{1000}.}}% +{\edef\@elevel{\csname #1@egroup\endcsname}}% +\ifnum\@elevel>#2\else{#3}\fi} +%</package> +%<*ltxml> +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\provideEdefault} +% The |\provideEdefault| macro sets up the context for an elision default by locally +% defining the internal macro \meta{default}|@edefault| and (if necessary) exporting it +% from the module. +% \begin{macrocode} +%<*package> +\def\provideEdefault#1#2{\expandafter\def\csname#1@edefault\endcsname{#2} +\@ifundefined{this@module}{}% +{\expandafter\g@addto@macro\this@module{\expandafter\def\csname#1@edefault\endcsname{#2}}}} +%</package> +%<*ltxml> +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setEdefault} +% The |\setEdefault| macro just redefines the internal \meta{default}|@edefault| in the +% local group +% \begin{macrocode} +%<package>\def\setEdefault#1#2{\expandafter\def\csname #1@edfault\endcsname{#2}} +%<*ltxml> +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fromEcontext} +% The |\fromEcontext| macro just calls internal \meta{default}|@edefault| macro. +% \begin{macrocode} +%<package>\def\fromEcontext#1{\csname #1@edefault\endcsname} +%<*ltxml> +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \subsection{Variable Names} +% +% \begin{macro}{\vname} +% a name macro\ednote{add some documentation here}\ednote{maybe this should go into the +% structuresharing package?} +% \begin{macrocode} +%<*package> +\def\MOD@namedef#1{\expandafter\def\csname MOD@name@#1\endcsname} +\def\MOD@name[#1]#2{#2\def\@test{#2}\ifx\@test\empty\else\MOD@namedef{#1}{#2}\fi} +\def\vname{\@ifnextchar[\MOD@name{\MOD@name[]}} +%</package> +%<*ltxml> +%</ltxml> +% \end{macrocode} +% \end{macro} +% \begin{macro}{\vnameref} +% \begin{macrocode} +%<package>\def\vnref#1{\csname MOD@name@#1\endcsname} +% \end{macrocode} +% \end{macro} +% +% \subsection{Hyperlinking} +% +% this only works for internal links\ednote{actually not at all!} +% \begin{macrocode} +%<package>\def\hrcr#1#2{\hyperlink{#1@\mod@id}{#2}} +%<*ltxml> +%</ltxml> +% \end{macrocode} +% the following would work for external ones, if we could know the proper extension. +% except that we should use |\char????| instead of |\#|, so that it parses +% |\def\hrcr#1#2{\href{\hr@baseURL\jobname.\hr@EXT\##1@\mod@id}{#2}}| +% where |\hr@baseURL| and |\hr@EXT| are defined in the file itself (they will need to go into +% the |SMS| file as well) +% +% \subsection{Finale} +% +% Finally, we need to terminate the file with a success mark for perl. +% \begin{macrocode} +%<ltxml>1; +% \end{macrocode} +% \Finale +\endinput + +% LocalWords: dtx CPERL RequirePackage keyval lbrack rbrack DefKeyVal omdoc +% LocalWords: Semiverbatim DefConstructor OptionalKeyVals pmml ltx XMath mii +% LocalWords: inline pii miii piii KeyVal egroup namedef diff --git a/Master/texmf-dist/source/latex/stex/presentation.ins b/Master/texmf-dist/source/latex/stex/presentation.ins new file mode 100644 index 00000000000..8816bef3454 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/presentation.ins @@ -0,0 +1,38 @@ +%% +%% This file generates files required to use the ed package. +%% At your command prompt write +%% +%% latex presentation.ins +%% +%% Copyright(c) 2005 Michael Kohlhase +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.0 or, at your option, any later version. +%% +\input docstrip +\preamble +\endpreamble + +%\usedir{tex/latex/listings} +\keepsilent +\askforoverwritefalse + +% generate base package +\generate{\file{presentation.sty}{\from{presentation.dtx}{package}}} + +\Msg{*} +\Msg{* You probably need to move the generated style files into a directory searched by TeX.} +\Msg{*} +\Msg{* And don't forget to refresh your filename database} +\Msg{* if your TeX distribution uses such a database.} +\Msg{*} + +\nopreamble\nopostamble +\generate{\file{presentation.sty.ltxml}{\from{presentation.dtx}{ltxml}}} + +\Msg{*} +\Msg{* You probably need to move the generated ltxml files into a directory searched by LaTeXML.} +\Msg{*} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/stex/sproof.dtx b/Master/texmf-dist/source/latex/stex/sproof.dtx new file mode 100644 index 00000000000..eb3581d1a53 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/sproof.dtx @@ -0,0 +1,770 @@ +% \iffalse meta-comment +% An Infrastructure for Structural Markup for Proofs +% Copyright (C) 2004-2006 Michael Kohlhase, all rights reserved +% this file is released under the +% LaTeX Project Public License (LPPL) +% +% The development version of this file can be found at +% $URL: https://svn.kwarc.info/repos/stex/sty/stex/sproof/sproof.dtx $ +% $Rev: 423 $; last modified by $Author: kohlhase $ +% $Date: 2008-05-07 15:39:51 +0200 (Wed, 07 May 2008) $ +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{sproof}[2006/01/13 v0.9a Semantic Markup for Proofs] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{url,array,stex,float,moreverb} +\usepackage[show]{ed} +\usepackage{hyperref} +\makeindex +\floatstyle{boxed} +\newfloat{exfig}{thp}{lop} +\floatname{exfig}{Example} +\begin{document}\DocInput{sproof.dtx}\end{document} +%</driver> +% \fi +% +% \CheckSum{407} +% +% \changes{v0.9}{2005/06/14}{First Version with Documentation} +% \changes{v0.9a}{2005/07/01}{Completed Documentation} +% \changes{v0.9b}{2005/08/06}{Complete functionality and Updated Documentation} +% \changes{v0.9c}{2006/01/13}{more packaging} +% \changes{v0.9d}{2006/10/31}{made sproof.dtx independent of statements.dtx} +% \changes{v0.9d}{2006/10/31}{revamped the proof end mark management} +% +% \GetFileInfo{sproofs.sty} +% +% \MakeShortVerb{\|} +%\def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}} +% \def\stex{{\raisebox{-.5ex}S\kern-.5ex\TeX}} +% \def\sTeX{\stex} +% \def\xml{\scsys{Xml}} +% \def\mathml{\scsys{MathML}} +% \def\omdoc{\scsys{OMDoc}} +% \def\openmath{\scsys{OpenMath}} +% \def\latexml{\scsys{LaTeXML}} +% \def\perl{\scsys{Perl}} +% \def\cmathml{Content-{\sc MathML}\index{Content {\sc MathML}}\index{MathML@{\sc MathML}!content}} +% \def\activemath{\scsys{ActiveMath}} +% \def\twin#1#2{\index{#1!#2}\index{#2!#1}} +% \def\twintoo#1#2{{#1 #2}\twin{#1}{#2}} +% \def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}} +% \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} +% \title{Structural Markup for Proofs\thanks{Version {\fileversion} (last revised +% {\filedate})}} +% \author{Michael Kohlhase\\ +% Jacobs University, Bremen\\ +% \url{http://kwarc.info/kohlhase}} +% \maketitle +% +% \begin{abstract} +% The |sproof| packge is part of the {\stex} collection, a version of {\TeX/\LaTeX} that +% allows to markup {\TeX/\LaTeX} documents semantically without leaving the document +% format, essentially turning {\TeX/\LaTeX} into a document format for mathematical +% knowledge management (MKM). +% +% This package supplies macros and environment that allow to annotate the structure of +% mathematical proofs in {\stex} files. This structure can be used by MKM systems for +% added-value services, either directly from the {\sTeX} sources, or after translation. +% \end{abstract} +% +%\section{Introduction}\label{sec:sproof} +% +% The |sproof| ({\twintoo{semantic}{proofs}}) package supplies macros and environment that +% allow to annotate the structure of mathematical proofs in {\stex} files. This structure +% can be used by MKM systems for added-value services, either directly from the {\sTeX} +% sources, or after translation. Even though it is part of the {\stex} collection, it can +% be used independently, like it's sister package |statements|. +% +% {\stex} is a version of {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents +% semantically without leaving the document format, essentially turning {\TeX/\LaTeX} into +% a document format for mathematical knowledge management (MKM). +% +% \begin{exfig}\scriptsize +% \begin{verbatim} +% \begin{sproof}[id=simple-proof,for=sum-over-odds] +% {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}[display=flow] then we compute $1=1^2$\end{spfstep} +% \end{spfcase} +% \begin{spfcase}{$n=2$} +% \begin{sproofcomment}[display=flow] +% This case is not really necessary, but we do it for the +% fun of it (and to get more intuition). +% \end{sproofcomment} +% \begin{spfstep}[display=flow] We compute $1+3=2^{2}=4$.\end{spfstep} +% \end{spfcase} +% \begin{spfcase}{$n>1$} +% \begin{spfstep}[type=assumption,id=ind-hyp] +% Now, we assume that the assertion is true for a certain $k\geq 1$, +% i.e. $\sum_{i=1}^k{(2i-1)}=k^{2}$. +% \end{spfstep} +% \begin{sproofcomment} +% We have to show that we can derive the assertion for $n=k+1$ from +% this assumption, i.e. $\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$. +% \end{sproofcomment} +% \begin{spfstep} +% We obtain $\sum_{i=1}^{k+1}{2i-1}=\sum_{i=1}^k{2i-1}+2(k+1)-1$ +% \begin{justification}[method=arith:split-sum] +% by splitting the sum. +% \end{justification} +% \end{spfstep} +% \begin{spfstep} +% Thus we have $\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1$ +% \begin{justification}[method=fertilize] by inductive hypothesis.\end{justification} +% \end{spfstep} +% \begin{spfstep}[type=conclusion] +% We can \begin{justification}[method=simplify]simplify\end{justification} +% the right-hand side to ${k+1}^2$, which proves the assertion. +% \end{spfstep} +% \end{spfcase} +% \begin{spfstep}[type=conclusion] +% We have considered all the cases, so we have proven the assertion. +% \end{spfstep} +% \end{spfcases} +% \end{sproof} +% \end{verbatim} +% \vspace*{-.5cm} +% \caption{A very explicit proof, marked up semantically}\label{fig:proof:src} +% \end{exfig} +% +% We will go over the general intuition by way of our running example (see +% Figure~\ref{fig:proof:src} for the source and Figure~\ref{fig:proof:result} for the +% formatted result).\ednote{talk a bit more about proofs and their structure,... maybe +% copy from OMDoc spec. } +% +% \section{The User Interface} +% +% \subsection{Proofs and Proof steps} +% +% \DescribeEnv{sproof} The |proof| environment is the main container for proofs. It takes +% an optional |KeyVal| argument that allows to specify the |id| (identifier) and |for| +% (for which assertion is this a proof) keys. The regular argument of the |proof| +% environment contains an introductory comment, that may be used to announce the proof +% style. The |proof| environment contains a sequence of |\step|, |proofcomment|, and +% |pfcases| environments that are used to markup the proof steps. The |proof| environment +% has a variant |Proof|, which does not use the proof end marker. This is convenient, if a +% proof ends in a case distinction, which brings it's own proof end marker with it. +% \DescribeEnv{sProof} The |Proof| environment is a variant of |proof| that does not mark +% the end of a proof with a little box; presumably, since one of the subproofs already has +% one and then a box supplied by the outer proof would generate an otherwise empty line. +% \DescribeMacro{\sproofidea} The |\sproofidea| macro allows to give a one-paragraph +% description of the proof idea. +% +% \DescribeEnv{spfstep} Regular proof steps are marked up with the |step| environment, which +% takes an optional |KeyVal| argument for annotations. A proof step usually contains a +% local assertion (the text of the step) together with some kind of evidence that this can +% be derived from already established assertions. +% +% Note that both |\premise| and |\justarg| can be used with an empty second argument to +% mark up premises and arguments that are not explicitly mentioned in the text. +% +% \begin{exfig} +% \begin{sproof}[id=simple-proof,for=sum-over-odds] +% {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}[display=flow] then we compute $1=1^2$\end{spfstep} +% \end{spfcase} +% \begin{spfcase}{$n=2$} +% \begin{sproofcomment}[display=flow] +% This case is not really necessary, but we do it for the fun +% of it (and to get more intuition). +% \end{sproofcomment} +% \begin{spfstep}[display=flow] +% We compute $1+3=2^{2}=4$ +% \end{spfstep} +% \end{spfcase} +% \begin{spfcase}{$n>1$} +% \begin{spfstep}[type=hypothesis,id=ind-hyp] +% Now, we assume that the assertion is true for a certain $k\geq 1$, i.e. +% $\sum_{i=1}^k{(2i-1)}=k^{2}$. +% \end{spfstep} +% \begin{sproofcomment} +% We have to show that we can derive the assertion for $n=k+1$ from this +% assumption, i.e. $\sum_{i=1}^{k+1}{(2i-1)}=(k+1)^{2}$. +% \end{sproofcomment} +% \begin{spfstep}[id=splitit] +% We obtain $\sum_{i=1}^{k+1}{(2i-1)}=\sum_{i=1}^k{(2i-1)}+2(k+1)-1$ +% \begin{justification}[method=arith:split-sum] +% by splitting the sum +% \end{justification} +% \end{spfstep} +% \begin{spfstep}[id=byindhyp] +% Thus we have $\sum_{i=1}^{k+1}{(2i-1)}=k^2+2k+1$ +% \begin{justification}[method=fertilize] +% by \premise[ind-hyp]{inductive hypothesis}. +% \end{justification} +% \end{spfstep} +% \begin{spfstep}[type=conclusion] +% We can \begin{justification}[method=simplify-eq] +% simplify the {\justarg[rhs]{right-hand side}} +% \end{justification} to ${k+1}^2$, which proves the assertion. +% \end{spfstep} +% \end{spfcase} +% \begin{spfstep}[type=conclusion] +% We have considered all the cases, so we have proven the assertion. +% \end{spfstep} +% \end{spfcases} +% \end{sproof} +% \caption{The formatted result of the proof in Figure~\ref{fig:proof:src}}\label{fig:proof:result} +% \end{exfig} +% +% \subsection{Justifications} +% +% \DescribeEnv{justification} This evidence is marked up with the |justification| +% environment in the |sproof| package. This environment totally invisible to the formatted +% result; it wraps the text in the proof step that corresponds to the evidence. The +% environment takes an optional |KeyVal| argument, which can have the |method| key, whose +% value is the name of a proof method (this will only need to mean something to the +% application that consumes the semantic annotations). Furthermore, the justification can +% contain ``premises'' (specifications to assertions that were used justify the step) and +% ``arguments'' (other information taken into account by the proof method). +% +% \DescribeMacro{\premise} The |\premise| macro allows to mark up part of the text as +% reference to an assertion that is used in the argumentation. In the example in +% Figure~\ref{fig:proof:src} we have used the |\premise| macro to identify the inductive +% hypothesis. +% +% \DescribeMacro{\justarg} The |\justarg| macro is very similar to |\premise| with the +% difference that it is used to mark up arguments to the proof method. Therefore the +% content of the first argument is interpreted as a mathematical object rather than as an +% identifier as in the case of |\premise|. In our example, we specified that the +% simplification should take place on the right hand side of the equation. Other examples +% include proof methods that instantiate. Here we would indicate the substituted object in +% a |\justarg| macro. +% +% \subsection{Proof Structure} +% +% \DescribeEnv{spfcases} The |pfcases| environment is used to mark up a proof by +% cases. 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). +% +% \DescribeEnv{spfcase} The content of a |pfcases| environment are a sequence of case +% proofs marked up in the |pfcase| environment, which takes an optional |KeyVal| argument +% for semantic annotations. The second argument is used to specify the the description of +% the case under considertation. The content of a |pfcase| environment is the same as that +% of a |proof|, i.e. |step|s, |proofcomment|s, and |pfcases| environments. +% +% \DescribeEnv{sproofcomment} The |proofcomment| environment is much like a |step|, only +% that it does not have an obejct-level assertion of its own. Rather than asserting some +% fact that is relevant for the proof, it is used to explain where the proof is going, +% what we are attempting to to, or what we have achieved so far. As such, it cannot be the +% target of a |\premise|. +% +% \subsection{Proof End Markers} +% +% Traditionally, the end of a mathematical proof is marked with a little box at the end of +% the last line of the proof (if there is space and on the end of the next line if there +% isn't), like so:\sproofend +% +% The |sproof| package provides the \DescribeMacro{\sproofend}|\sproofend| macro for +% this. If a different symbol for the proof end is to be used (e.g. {\sl{q.e.d}}), then +% this can be obtained by specifying it using the +% \DescribeMacro{\sProofEndSymbol}|\sProofEndSymbol| configuration macro (e.g. by specifying +% |\sProofEndSymbol{q.e.d}|). +% +% Some of the proof structuring macros above will insert proof end symbols for sub-proofs, +% in most cases, this is desirable to make the proof structure explicit, but sometimes +% this wastes space (especially, if a proof ends in a case analysis which will supply its +% own proof end marker). Therefore, all proof environments have the +% \DescribeMacro{noproofend}|noproofend| keyword that suppresses the proof end markers for +% this element. It can be specified on its own, and does not need a value (if one is +% specified, that is completely ignored). +% +% \StopEventually{\ednotemessage} +% +% \section{The Implementation} +% +% We first set up the Perl Packages for {\latexml} +% \begin{macrocode} +%<*ltxml> +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('omdoc'); +%</ltxml> +% Then we make sure that the {\stex} |omdoc| package is loaded. +% \begin{macrocode} +%<*package> +\RequirePackage{omdoc}[2007/09/09] +%</package> +% \end{macrocode} +% Then we define the pacakge options and what they do. +% \begin{macrocode} +%<*package> +\newif\ifjust@method\just@methodfalse +\DeclareOption{method}{\just@methodtrue} +%</package> +% \end{macrocode} +% We declare some switches which will modify the behavior according to the package +% options. Generally, an option |xxx| will just set the appropriate switches to true +% (otherwise they stay false). Firpf we have the general options +% \begin{macrocode} +%<*package> +\newif\ifspf@env\spf@envfalse +\newif\ifspf@id\spf@idfalse +\newif\ifspf@display\spf@displayfalse +\DeclareOption{id}{\spf@idtrue\spf@envtrue} +\DeclareOption{env}{\spf@envtrue} +\DeclareOption{display}{\spf@displaytrue\spf@envtrue} +% \end{macrocode} +% And then the options that are specific to the |sproof| package. +% \begin{macrocode} +\newif\ifspf@for\spf@forfalse +\newif\ifspf@from\spf@forfalse +\newif\ifspf@type\spf@typefalse +\newif\ifspf@title\spf@titlefalse +\newif\ifspf@proofend\spf@proofendtrue +\newif\ifspf@continues\spf@continuesfalse +\DeclareOption{for}{\spf@fortrue\spf@envtrue} +\DeclareOption{from}{\spf@fromtrue\spf@envtrue} +\DeclareOption{type}{\spf@typetrue\spf@envtrue} +\DeclareOption{title}{\spf@titletrue\spf@envtrue} +\DeclareOption{continues}{\spf@continuepfrue\spf@envtrue} +\DeclareOption{noproofend}{\spf@proofendfalse\spf@envtrue} +% \end{macrocode} +% \begin{macro}{\spftrue} +% For convenience, we collect the switches into one. +% \begin{macrocode} +\def\spftrue{\spf@fortrue\spf@fromtrue\spf@typetrue\spf@continuepfrue} +% \end{macrocode} +% \end{macro} +% +% Now, we define a set of collective options and tell {\LaTeX} about the end of the +% declaration section. +% \begin{macrocode} +\DeclareOption{draft}{\spf@envtrue\just@methodtrue} +\DeclareOption{all}{\spf@envtrue\just@medhodtrue} +\ProcessOptions +%</package> +% \end{macrocode} +% +% \subsection{Proofs}\label{sec:impl:proofs} +% +% \begin{macrocode} +%<*package> +\define@key{spf}{id}{\def\spf@id{#1}} +\define@key{spf}{display}{\def\spf@display{#1}} +\define@key{spf}{for}{\def\spf@for{#1}} +\define@key{spf}{from}{\def\spf@from{#1}} +\define@key{spf}{sproofend}{\spf@proofendtrue\def\sproof@box{#1}} +\define@key{spf}{noproofend}[imeanit]{\spf@proofendfalse} +\define@key{spf}{type}{\def\spf@type{#1}} +\define@key{spf}{title}{\def\spf@title{#1}} +\define@key{spf}{continues}{\def\spf@continues{#1}} +%</package> +%<*ltxml> +DefKeyVal('pf','id','Semiverbatim'); +DefKeyVal('pf','display','Semiverbatim'); # not used at the moment +DefKeyVal('pf','for','Semiverbatim'); +DefKeyVal('pf','from','Semiverbatim'); +DefKeyVal('pf','proofend','Semiverbatim'); +DefKeyVal('pf','noproofend','Semiverbatim'); +DefKeyVal('pf','type','Semiverbatim'); +DefKeyVal('pf','title','Semiverbatim'); +DefKeyVal('pf','continues','Semiverbatim'); +%</ltxml> +% \end{macrocode} +% +% \begin{macro}{\show@st@keys@aux} +% We now define a macro that shows the |st| keys, if in draft mode, they annotate the +% document with key/value pairs. +% \begin{macrocode} +%<*package> +\def\show@st@keys@aux{% +\@ifundefined{spf@id}{}{\ifspf@id{id=\spf@id},\fi}% +\@ifundefined{spf@display}{}{\ifspf@display{display=\spf@display}\fi}} +\def\clear@pf@keys{\let\spf@id=\relax\let\spf@display=\relax} +%</package> +% \end{macrocode} +% \end{macro} +% \begin{macro}{\show@pf@keys@aux} +% we do the same for the |pf| keys. +% \begin{macrocode} +%<*package> +\def\show@pf@keys@aux{% +\@ifundefined{spf@for}{}{\ifspf@for{for=\spf@for},\fi}% +\@ifundefined{spf@from}{}{\ifspf@from{from=\spf@from},\fi}% +\@ifundefined{spf@prefix}{}{\ifspf@prefix{prefix=\spf@prefix},\fi}% +\@ifundefined{spf@type}{}{\ifspf@type{type=\spf@type},\fi}% +\@ifundefined{spf@title}{}{\ifspf@title{title=\spf@title},\fi}% +\@ifundefined{spf@continues}{}{\ifspf@continues{continues=\spf@continues}\fi}} +%</package> +% \end{macrocode} +% \end{macro} +% \begin{macro}{\show@pf@keys} +% and combine them, so that the code is more readable. +% \begin{macrocode} +%<*package> +\def\show@pf@keys#1{\footnote{#1[\show@pf@keys@aux\show@pf@keys@aux]}% +\clear@pf@keys\clear@pf@keys} +\def\clear@pf@keys{\let\spf@for=\relax\let\spf@from=\relax\let\spf@prefix=\relax% +\let\spf@type=\relax\let\spf@title=\relax\let\spf@continues=\relax} +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\spf@flow} +% We define this macro, so that we can test whether the |display| key has the value |flow| +% \begin{macrocode} +%<package>\def\spf@flow{flow} +% \end{macrocode} +% \end{macro} +% +% For proofs, we will have to have deeply nested structures of enumerated list-like +% environments. However, {\LaTeX} only allows |enumerate| environments up to nesing depth +% 4 and general list environments up to listing depth 6. This is not enough for us. +% Therefore we have decided to go along the route proposed by Leslie Lamport to use a +% single top-level list with dotted sequences of numbers to identify the position in the +% proof tree. Unfortunately, we could not use his |pf.sty| package directly, since it does +% not do automatic numbering, and we have to add keyword arguments all over the place, to +% accomodate semantic information. +% +% \begin{environment}{pst@with@label} +% This environment manages\ednote{This gets the labeling right but only works 8 levels +% deep} the path labeling of the proof steps in the description envionment of the +% outermost |proof| environment. The argument is the label prefix up to now; which we +% cache in |\pst@label| (we need evaluate it first, since are in the right place +% now!). Then we increment the proof depth which is stored in |\count10| (lower +% counters are used by {\TeX} for page numbering) and initialize +% the next level counter |\count\count10| with 1. In the end call for this environment, +% we just decrease the proof depth counter by 1 again. +% \begin{macrocode} +%<*package> +\newenvironment{pst@with@label}[1]{\edef\pst@label{#1}\advance\count10 by 1\count\count10=1} +{\advance\count10 by -1} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\the@pst@label} +% |\the@pst@label| evaluates to the current step label. +% \begin{macrocode} +\def\the@pst@label{\pst@label.\number\count\count10} +% \end{macrocode} +%\end{macro} +% +% \begin{macro}{\next@pst@label} +% |\next@pst@label| increments the step label at the current level. +% \begin{macrocode} +\def\next@pst@label{\global\advance\count\count10 by 1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\sproofend} +% This macro places a little box at the end of the line if there is space, or at the +% end of the next line if there isn't +% \begin{macrocode} +\def\sproof@box{\hbox{\vrule\vbox{\hrule width 6 pt\vskip 6pt\hrule}\vrule}} +\def\sproofend{\ifspf@proofend\hfil\null\nobreak\hfill\sproof@box\par\smallskip\fi} +\def\sProofEndSymbol#1{\def\sproof@box{#1}} +%</package> +%<ltxml>DefConstructor('\sproofend',""); +% \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} +%<*package> +\newenvironment{@proof}[2][]{\setkeys{spf}{#1} +\count10=10\ifx\spf@display\spf@flow\else{\stDMemph{Proof}:}\fi% +\ifspf@env\show@pf@keys{sproof}\fi{ #2}% +\def\pst@label{}\newcount\pst@count% initialize the labeling mechanism +\begin{description}\begin{pst@with@label}{P}} +{\end{pst@with@label}\end{description}} +\newenvironment{sproof}[2][]{\begin{@proof}[#1]{#2}}{\sproofend\end{@proof}} +%</package> +%<*ltxml> +DefEnvironment('{sproof} OptionalKeyVals:pf{}', + "<omdoc:proof ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>\n" + . "?#2(<omdoc:omtext><omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP></omdoc:omtext>\n)()" + . "#body" + . "</omdoc:proof>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{sproofidea} +% \begin{macrocode} +%<package>\newcommand{\sproofidea}[2][]{{\stDMemph{Proof Idea}:} #2\sproofend} +%<*ltxml> +DefEnvironment('{sproofidea} OptionalKeyVals:pf {}', + "<omdoc:proof ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>\n" + . "<omdoc:omtext><omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP></omdoc:omtext>\n" + . "</omdoc:proof>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% 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 surrounging 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{macrocode} +%<*package> +\newenvironment{spfstep}[1][]{\setkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi +\@ifundefined{spf@title}{}{(\stDMemph{\spf@title})}% +\ifspf@env\show@pf@keys{spfstep}\fi} +{\next@pst@label} +%</package> +%<*ltxml> +DefCMPEnvironment('{spfstep} OptionalKeyVals:pf', + "<omdoc:derive ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:derive>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{sproofcomment} +% \begin{macrocode} +%<*package> +\newenvironment{sproofcomment}[1][]{\setkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi +\ifspf@env\show@pf@keys{sproofcomment}\fi} +{\next@pst@label} +%</package> +%<*ltxml> +DefCMPEnvironment('{sproofcomment} OptionalKeyVals:pf', + "<omdoc:omtext ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% The next two environments also take a |KeyVal| arguement, but also a regular one, which +% contains a start text. Both environments start a new numbered proof level. +% +% \begin{environment}{spfcases} +% In the |pfcases| environment, the start text is displayed as the first comment of the +% proof. +% \begin{macrocode} +%<*package> +\newenvironment{spfcases}[2][]{\setkeys{spf}{#1} +\def\@test{#2}\ifx\@test\empty\else +\ifx\spf@display\spf@flow {#2}\else\item[\the@pst@label]{#2} \fi\fi +\ifspf@env\show@pf@keys{spfcases}\fi +\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\end{pst@with@label}\next@pst@label} +%</package> +%<*ltxml> +DefEnvironment('{spfcases} OptionalKeyVals:pf {}', + "<omdoc:derive ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>\n" + . "<omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP>\n" + . "<omdoc:method xref='#proof-by-cases'>" + . "#body" + . "</omdoc:method>" + . "</omdoc:derive>\n"); +%</ltxml> +% \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} +%<*package> +\newenvironment{spfcase}[2][]{\setkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi +\def\@test{#2}\ifx\@test\empty\else{\stDMemph{#2}:}\fi +\ifspf@env\show@pf@keys{spfcase}\fi +\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\ifx\spf@display\spf@flow\else\sproofend\fi\end{pst@with@label}\next@pst@label} +%</package> +%<*ltxml> +DefEnvironment('{spfcase} OptionalKeyVals:pf{}', + "<omdoc:proof ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>\n" + . "?#2(<omdoc:omtext><omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP></omdoc:omtext>\n)()" + . "#body" + . "</omdoc:proof>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{subproof} +% In the |subproof| environment, a new (lower-level) proof environment is +% started.\ednote{document this above} +% \begin{macrocode} +%<*package> +\newenvironment{subproof}{\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\ifx\spf@display\spf@flow\else\sproofend\fi\end{pst@with@label}} +%</package> +%<*ltxml> +DefEnvironment('{subproof}', + "<omdoc:proof>\n #body\n</omdoc:proof>\n"); +%</ltxml> +% \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.\ednote{why are there more in ltxml?, why st@id?} +% \begin{macrocode} +%<*package> +\define@key{just}{id}{\def\just@id{#1}} +\define@key{just}{method}{\def\just@method{#1}} +%</package> +%<*ltxml> +DefKeyVal('just','id','Semiverbatim'); +DefKeyVal('just','method','Semiverbatim'); +DefKeyVal('just','premises','Semiverbatim'); +DefKeyVal('just','args','Semiverbatim'); +%</ltxml> +% \end{macrocode} +% +% \begin{macro}{\show@just@keys} +% This macro shows all the key/value pairs when in draft mode. +% \begin{macrocode} +%<*package> +\def\show@just@keys#1{\footnote{#1[\show@pf@keys@aux\show@just@keys@aux]}}% +\def\show@just@keys@aux{% +\@ifundefined{just@method}{\relax}{\ifjust@method{method=\just@method},\fi}% +\clear@pf@keys\clear@just@keys} +\def\clear@just@keys{\let\just@method=\relax} +%</package> +% \end{macrocode} +% \end{macro} +% +% 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{environment}{justification} +% \begin{macrocode} +%<*package> +\newenvironment{justification}[1][]{\ifspf@env\setkeys{just}{#1} + \show@just@keys{justification}\fi}{} +%</package> +%<*ltxml> +sub extractBodyText { + my ($box, $remove) = @_; + my $str = ''; + my @boxes = $box->unlist; + foreach my $b(@boxes) { + my $s = ''; + if ($b =~ /LaTeXML::Whatsit/) { + my $body = $b->getBody; + $s = $body ? extractBodyText($body, $remove) : ''; + } elsif ($b =~ /LaTeXML::Box/) { + $s = $b->toString || ''; + @{$b}[0] = '' if $remove; } + $str .= $s; } + $str =~ s/\s+/ /g; + $str; } + +DefEnvironment('{justification} OptionalKeyVals:just', sub { + my ($doc, $keys, %props) = @_; + my $text = extractBodyText($props{body}, 1); + my $node = LookupValue('_LastSeenCMP'); + $node->appendText($text) if $node; + my $method = $keys ? $keys->getValue('method') : undef; + $doc->openElement("omdoc:method", $method ? (xref => $method) : ()); + $doc->absorb($props{body}) if $props{body}; + $doc->closeElement("omdoc:method"); + return; }); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\premise} +% \begin{macrocode} +%<*package> +\newcommand{\premise}[2][]{#2} +%</package> +%<*ltxml> +DefMacro('\premise[]{}', sub { + my ($xref, $text) = ($_[1], $_[2]); + my @res = (T_CS('\premise@content')); + push(@res, T_OTHER('['), $xref->unlist, T_OTHER(']')) if $xref; + push(@res, T_SPACE, $text->unlist) if $text; + @res; }); +DefConstructor('\premise@content[]', "<omdoc:premise xref='#1'/>"); +%</ltxml> +% \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} +%<*package> +\newcommand{\justarg}[2][]{#2} +%</package> +%<*ltxml> +DefMacro('\justarg[]{}', sub { (($_[1] ? $_[1]->unlist : ()), + T_SPACE, $_[2]->unlist, T_SPACE); }); + +Tag('omdoc:derive', afterClose=>sub { + my ($doc, $node) = @_; + my @children = grep($_->nodeType == XML_ELEMENT_NODE, $node->childNodes); + my $firstCMP = undef; + foreach my $child(@children) { + next unless ($child->localname || '') eq 'CMP'; + if ($child->hasChildNodes()) { + next unless $#{$child->childNodes} == 0; + next unless $child->firstChild->nodeType == XML_TEXT_NODE; } + + if ($firstCMP) { + $firstCMP->appendText($child->textContent); + $node->removeChild($child); + } else { $firstCMP = $child; } + } + }); + +%</ltxml> +% \end{macrocode} +% \end{macro} +% +% \subsection{Providing IDs for {\omdoc} Elements}\label{sec:impl:ids} +% +% To provide default identifiers, we tag all {\omdoc} +% elements that allow |xml:id| attributes by excuting the |numberIt| procedure from |omdoc.sty.ltxml|. +% +% \begin{macrocode} +%<*ltxml> +Tag('omdoc:proof',afterOpen=>\&numberIt); +Tag('omdoc:derive',afterOpen=>\&numberIt); +Tag('omdoc:method',afterOpen=>\&numberIt); +%</ltxml> +% \end{macrocode} +% +% \section{Finale} +% +% Finally, we need to terminate the file with a success mark for perl. +% \begin{macrocode} +%<ltxml>1; +% \end{macrocode} +% \Finale +\endinput + +% \iffalse +% LocalWords: GPL structuresharing STR sproof dtx CPERL keyval methodfalse env +%%% Local Variables: +%%% mode: doctex +%%% TeX-master: t +%%% End: +% \fi +% LocalWords: methodtrue envtrue medhodtrue DefKeyVal Semiverbatim omdoc args +% LocalWords: DefEnvironment OptionalKeyVals KeyVal omtext DefConstructor str +% LocalWords: proofidea KeyVal pfstep DefCMPEnvironment KeyVal proofcomment eq +% LocalWords: KeyVal pfcases KeyVal pfcase KeyVal extractBodyText unlist elsif +% LocalWords: foreach getBody toString str str str LookupValue LastSeenCMP +% LocalWords: appendText getValue undef openElement closeElement DefMacro +% LocalWords: afterClose nodeType childNodes firstCMP localname hasChildNodes +% LocalWords: firstChild textContent removeChild diff --git a/Master/texmf-dist/source/latex/stex/sproof.ins b/Master/texmf-dist/source/latex/stex/sproof.ins new file mode 100644 index 00000000000..639af148fdc --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/sproof.ins @@ -0,0 +1,38 @@ +%% +%% This file generates files required to use the ed package. +%% At your command prompt write +%% +%% latex sproof.ins +%% +%% Copyright(c) 2005 Michael Kohlhase +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.0 or, at your option, any later version. +%% +\input docstrip +\preamble +\endpreamble + +%\usedir{tex/latex/listings} +\keepsilent +\askforoverwritefalse + +% generate base package +\generate{\file{sproof.sty}{\from{sproof.dtx}{package}}} + +\Msg{*} +\Msg{* You probably need to move the generated style files into a directory searched by TeX.} +\Msg{*} +\Msg{* And don't forget to refresh your filename database} +\Msg{* if your TeX distribution uses such a database.} +\Msg{*} + +\nopreamble\nopostamble +\generate{\file{sproof.sty.ltxml}{\from{sproof.dtx}{ltxml}}} + +\Msg{*} +\Msg{* You probably need to move the generated ltxml files into a directory searched by LaTeXML.} +\Msg{*} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/stex/statements.dtx b/Master/texmf-dist/source/latex/stex/statements.dtx new file mode 100644 index 00000000000..a1ca69e5614 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/statements.dtx @@ -0,0 +1,595 @@ +% \iffalse meta-comment +% An Infrastructure for Mathematical Statements in sTeX +% Copyright (C) 2004-2006 Michael Kohlhase, all rights reserved +% this file is released under the +% LaTeX Project Public License (LPPL) +% +% The development version of this file can be found at +% https://svn.kwarc.info/repos/kwarc/projects/stex/sty/statements.dtx +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{statements}[2007/09/09 v0.9d Semantic Markup for Statements] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{url,array,stex,float} +\usepackage[show]{ed} +\usepackage{hyperref} +\makeindex +\floatstyle{boxed} +\newfloat{exfig}{thp}{lop} +\floatname{exfig}{Example} +\begin{document}\DocInput{statements.dtx}\end{document} +%</driver> +% \fi +% +% \CheckSum{266} +% +% \changes{v0.9}{2005/06/14}{First Version with Documentation} +% \changes{v0.9a}{2005/07/01}{Completed Documentation} +% \changes{v0.9b}{2005/08/06}{Complete functionality and Updated Documentation} +% \changes{v0.9c}{2006/01/13}{more packaging} +% \changes{v0.9d}{2007/09/09}{moved omtext and friends to the omdoc package} +% \changes{v0.9d}{2007/09/09}{made dependence on the omdoc package explicit} +% \changes{v0.9d}{2007/09/09}{adding ids to many elements} +% +% \GetFileInfo{statements.sty} +% +% \MakeShortVerb{\|} +%\def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}} +% \def\stex{{\raisebox{-.5ex}S\kern-.5ex\TeX}} +% \def\sTeX{\stex} +% \def\xml{\scsys{Xml}} +% \def\mathml{\scsys{MathML}} +% \def\omdoc{\scsys{OMDoc}} +% \def\openmath{\scsys{OpenMath}} +% \def\latexml{\scsys{LaTeXML}} +% \def\perl{\scsys{Perl}} +% \def\activemath{\scsys{ActiveMath}} +% \def\twin#1#2{\index{#1!#2}\index{#2!#1}} +% \def\twintoo#1#2{{#1 #2}\twin{#1}{#2}} +% \def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}} +% \def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} +% \title{Semantic Markup for Mathematical Statements\thanks{Version {\fileversion} (last revised +% {\filedate})}} +% \author{Michael Kohlhase\\ +% Jacobs University, Bremen\\ +% \url{http://kwarc.info/kohlhase}} +% \maketitle +% +% \begin{abstract} +% The |statements| packge is part of the {\stex} collection, a version of {\TeX/\LaTeX} +% that allows to markup {\TeX/\LaTeX} documents semantically without leaving the +% document format, essentially turning {\TeX/\LaTeX} into a document format for +% mathematical knowledge management (MKM). +% +% This package provides semantic markup facilities for mathematical statements like +% Theorems, Lemmata, Axioms, Definitions, etc. in {\stex} files. This structure can be +% used by MKM systems for added-value services, either directly from the {\sTeX} +% sources, or after translation. +% \end{abstract} +%\newpage +%\section{Introduction}\label{sec:statements} +% +% The motivation for the |statemets| package is very similar to that for semantic macros +% in the |modules| package: We want to annotate the structural semantic properties of +% statements in the source, but present them as usual in the formatted documents. In +% contrast to the case for mathematical objects, the repertoire of mathematical statements +% and their structure is more or less fixed. +% +% This structure can be used by MKM systems for added-value services, either directly from +% the {\sTeX} sources, or after translation. Even though it is part of the {\stex} +% collection, it can be used independently, like it's sister package |sproofs|. +% +% {\stex} is a version of {\TeX/\LaTeX} that allows to markup {\TeX/\LaTeX} documents +% semantically without leaving the document format, essentially turning {\TeX/\LaTeX} into +% a document format for mathematical knowledge management (MKM). +% +% \section{The User Interface} +% +% All the statements are marked up as envioronments, that take a |KeyVal| argument that +% allows to annotate semantic information. \DescribeEnv{assertion} For instance, instead +% of providing environments for ``Theorem'', ``Lemma'', ``Proposition'',... we have a +% single |assertion| environment that generalizes all of these, and takes a |type| key +% that allows to specify the ``type''. So instead of |\begin{Lemma}|\iffalse\end{Lemma}\fi +% we have to write |\begin{assertion}[type=Lemma]|\iffalse\end{assertion}\fi (see +% Example~\ref{fig:assertion} for an example).\ednote{talk about package options here! +% Draft mode,...} +%\begin{exfig} +% \begin{verbatim} +% \begin{assertion}[id=sum-over-odds,type=Lemma] +% $\sum_{i=1}^n{2i-1}=n^2$ +% \end{assertion} +% \end{verbatim} +% \vspace{-1em}will lead to the result\medskip\par\noindent +% \begin{assertion}[id=sum-over-odds,type=Lemma] +% $\sum_{i=1}^n{2i-1}=n^2$ +% \end{assertion} +% \caption{Semantic Markup for a Lemma in a {\tt{module}} context}\label{fig:assertion} +% \end{exfig} +% +% Whether we will see the keyword ``Lemma'' will depend on the value of the optional +% |display| key. In all of the |assertion| environments, the presentation expectation is +% that the text will be presented in italic font. Generally, we distinguish two forms of +% statements: +% \begin{description} +% \item[{\twintoo{block}{statement}s}] have explicit discourse markers that delimit their content in the +% surrounding text, e.g. the boldface word ``{\bf{Theorem}:}'' as a start marker and a +% little line-end box as an end marker of a proof. +% \item[{\twintoo{flow}{statement}s}] do not have explicit markers, they are interspersed +% with the surrounding text. +% \end{description} +% Since they have the same semantic status, they must both be marked up, but styled +% differently. We distinguis between these two presentational forms with the |display| +% key, which is allowed on all statement environments. If it has the value |block| (the +% default), then the statement will be presented in a paragraph of its own, have explicit +% discourse markers for its begin and end, possibly numbering, etc. If it has the value +% |flow|, then no extra presentation will be added\ednote{in the flow case, the text +% should not be made italic; implement this! } the semantic information is invisible to +% the reader. +% +% Another key that is present on all statement environments in the |id| key it allows to +% identify the statement with a name. +% +% \DescribeEnv{axiom} The |axiom| environment is similar to |assertion|, but the content +% has a different ontological status: axioms are assumed without (formal) justification, +% whereas assertions are expeceted to be justified from other assertions, axioms or +% definitions. +% +% \DescribeEnv{definition} The |definition| environment is used for marking up +% mathematical definitions. Its peculiarity is that it defines (i.e. gives a meaning to) +% new mathematical concepts or objects. These\DescribeMacro{\definiendum} are identified by +% the |definiendum| macro, which takes two arguments. The first one is the system name of +% the symbol defined (for reference via |\termin| ), the second one is the text that is to +% be emphasized in the presentation. Note that the |\definiendum| macro can only be used +% inside the |definition| environment. If you find yourself in a situation where you want +% to use it outside, you will most likely want to wrap the apporpriate text fragment in a +% |\begin{definition}[display=flow]| ... and |\end{definition}|.\ednote{need to leave +% hypertargets on the definiendum, so that we can crosslink} +% +% \DescribeMacro{\termin} If we have defined a concept with the |\definiendum| macro, then +% we can mark up other occurrences of the term as referring to this concept. Note that +% this process cannot be fully automatized yet, since that would need advanced lanauge +% technology to get around problems of disambiguation, inflection, and non-contiguous +% phrases\footnote{We do have a program that helps annotate larger text collections +% spotting the easy cases; see {\url{http://kwarc.info/projects/stex}} and +% look for the program |termin|.}. Therefore, the |\termin| can be used to make this +% information explicit. +% +% \DescribeEnv{simpleDef} The |simpleDef| environment is a statement environment for +% simple definitions, which introduce a new symbol that abbreviates another concept. The +% envioronment takes an argument for the new concept +% +% \DescribeEnv{example} The |example| environment is a generic statement envionment, +% except that the |for| key should be given to specify the identifier what this is an +% example for. The |example| environment also expcets a |type| key to be specified, so +% that we know whether this is an example or a counterexample\ednote{think about this some +% more} +% +% \DescribeMacro{\defemph} The |\defemph| macro is a configuration hook that allows to +% specify the style of presentation of the {\index*{definiendum}}. By default, it is set to +% |\bf| as a fallback, since we can be sure that this is always available. It can be +% customized by redefinition: For instance |\renewcommand{\defemph}[1]{\emph{#1}}|, +% changes the default behavior to italics. +% +% \DescribeMacro{\termemph} The |\termenph| macro does the same for the style for +% |\termin|, it is empty by default. Note the term might carry an implicit hyperreference +% to the defining occurrance and that the presentation engine might mark this up, changing +% this behavior. +% +% \DescribeMacro{\stDMemph} The |\stDMemph| macro does the same for the style for the +% markup of the discourse markers like ``Theorem''. If it is not defined, it is set to +% |\bf|; that allows to preset this in the class file. +% +% \StopEventually{\ednotemessage} +% +% \section{The Implementation}\label{sec:impl} +% +% We declare some switches which will modify the behavior according to the package +% options. Generally, an option |xxx| will just set the appropriate switches to true +% (otherwise they stay false). First we have the general options +% \begin{macrocode} +%<*package> +\newif\ifst@env\st@envfalse +\newif\ifst@id\st@idfalse +\newif\ifst@display\st@displayfalse +\DeclareOption{id}{\st@idtrue\st@envtrue} +\DeclareOption{env}{\st@envtrue} +\DeclareOption{display}{\st@displaytrue\st@envtrue} +% \end{macrocode} +% And then the options that are specific to the |statements| package. +% \begin{macrocode} +\newif\ifstat@for\stat@forfalse +\newif\ifstat@from\stat@forfalse +\newif\ifstat@type\stat@typefalse +\newif\ifstat@title\stat@titlefalse +\newif\ifstat@continues\stat@continuesfalse +\DeclareOption{for}{\stat@fortrue\st@envtrue} +\DeclareOption{from}{\stat@fromtrue\st@envtrue} +\DeclareOption{type}{\stat@typetrue\st@envtrue} +\DeclareOption{title}{\stat@titletrue\st@envtrue} +\DeclareOption{continues}{\stat@continuestrue\st@envtrue} +% \end{macrocode} +% \begin{macro}{\stattrue} +% For convenience, we collect the switches into one. +% \begin{macrocode} +\def\stattrue{\stat@fortrue\stat@fromtrue\stat@typetrue\stat@continuestrue} +% \end{macrocode} +% \end{macro} +% Now, we define two collective options, which are equivalent to turning on all the other +% options. +% \begin{macrocode} +\DeclareOption{draft}{\st@envtrue\st@idtrue\stat@fortrue\stat@fromtrue\typetrue\justtrue} +\DeclareOption{all}{\st@envtrue\stattrue\justtrue} +% \end{macrocode} +% Finally, we need to declare the end of the option declaration section to {\LaTeX}. +% \begin{macrocode} +\ProcessOptions +%</package> +% \end{macrocode} +% +% The next measure is to ensure that the |omdoc| package is loaded (in the right +% version). For {\latexml}, we also initialize the package inclusions. +% \begin{macrocode} +%<package>\RequirePackage{omdoc}[2007/09/09] +%<*ltxml> +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('omdoc'); +RequirePackage('myindex'); +%</ltxml> +% \end{macrocode} +% +% \begin{macro}{\define@statement@env} +% We define a meta-macro that allows us to define several variants of statements. Upon +% beginning this environment, we first set the |KeyVal| attributes, then we decide +% whether to print the discourse marker based on the value of the |display| key, then +% (given the right Options were set), we show the semantic annotations, and finally +% initialize the environment using the appropriate macro. Upon ending the environment, +% we just run the respcective termination macro. +% \begin{macrocode} +%<*package> +\def\define@statement@env#1#2{ +\newenvironment{#1}[1][]{\setkeys{stat}{##1} +\ifx\st@display\st@flow\else\stDMemph{#2}:\fi% +\@ifundefined{stat@title}{}% +{\space\ifx\st@display\st@flow\else(\fi\stDMemph{\stat@title}\ifx\st@display\st@flow:\else)\par\fi}\space% +\ifst@env\show@stat@keys{#1}\fi\csname st@#1@initialize\endcsname} +{\csname st@#1@terminate\endcsname}} +%</package> +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{assertion} +% \begin{macrocode} +%<*package> +\newenvironment{assertion}[1][]{\setkeys{stat}{#1} +\ifx\st@display\st@flow\else{\stDMemph{\stat@type}:}\fi% +\@ifundefined{stat@title}{~}{~(\stDMemph{\stat@title})\par}% +\ifst@env\show@stat@keys{#1}\fi\em}{} +%</package> +%<*ltxml> +DefCMPEnvironment('{assertion} OptionalKeyVals:stat', + "<omdoc:assertion ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() type='&KeyVal(#1,'type')'>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + ."</omdoc:assertion>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{simpleDef} +% \begin{macrocode} +%<*package> +\newenvironment{simpleDef}[1][]{\setkeys{stat}{#1} +\ifx\st@display\st@flow\else{\stDMemph{Definition}:}\fi% +\@ifundefined{stat@title}{~}{~(\stDMemph{\stat@title})\par}% +\ifst@env\show@stat@keys{#1}\fi}{} +%</package> +%<*ltxml> +DefCMPEnvironment('{simpleDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='simple' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:definition>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{PatternDef} +% \begin{macrocode} +%<*package> +\newenvironment{PatternDef}[1][]{\setkeys{stat}{#1} +\ifx\st@display\st@flow\else{\stDMemph{Definition}:}\fi% +\@ifundefined{stat@title}{~}{~(\stDMemph{\stat@title})\par}% +\ifst@env\show@stat@keys{#1}\fi}{} +\newenvironment{PatternRule}[1]{#1$\colon=$}{} +\newenvironment{PatternCMP}{}{} +%</package> +%<*ltxml> +DefCMPEnvironment('{PatternDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='pattern' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "#body" + . "</omdoc:definition>\n"); +DefEnvironment('{PatternRule}{}', + "<omdoc:requation>#1 #body</omdoc:requation>"); +DefEnvironment('{PatternCMP}{}', + "<omdoc:CMP>#body</omdoc:CMP>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{RecDef} +% \begin{macrocode} +%<*package> +\newenvironment{RecDef}[1][]{\setkeys{stat}{#1} +\ifx\st@display\st@flow\else{\stDMemph{Definition}:}\fi% +\@ifundefined{stat@title}{~}{~(\stDMemph{\stat@title})\par}% +\ifst@env\show@stat@keys{#1}\fi}{} +%</package> +%<*ltxml> +DefEnvironment('{RecDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='inductive' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:definition>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{example} +% \begin{macrocode} +%<*package> +\def\st@example@initialize{}\def\st@example@terminate{} +\define@statement@env{example}{Example} +%</package> +%<*ltxml> +DefCMPEnvironment('{example} OptionalKeyVals:stat', + "<omdoc:example " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " + . "for='&KeyVal(#1,'for')'>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:example>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{axiom} +% \begin{macrocode} +%<*package> +\def\st@axiom@initialize{}\def\st@axiom@terminate{} +\define@statement@env{axiom}{Axiom} +%</package> +%<*ltxml> +DefCMPEnvironment('{axiom} OptionalKeyVals:stat', + "<omdoc:axiom ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:axiom>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{consymb} +% \begin{macrocode} +%<*package> +\define@key{consymb}{type}{\def\consymb@type{#1}} +\define@key{consymb}{title}{\def\consymb@title{#1}} +\define@key{consymb}{name}{\def\consymb@name{#1}} +\def\consymb@type{Symbol} +\newenvironment{consymb}[1][]{\setkeys{consymb}{#1} +\ifx\st@display\st@flow\else{\stDMemph{\consymb@type} \consymb@name:}\fi% +\@ifundefined{consymb@title}{~}{~(\stDMemph{\consymb@title})\par}}{} +%</package> +%<*ltxml> +DefEnvironment('{consymb} OptionalKeyVals:stat', + "<omdoc:symbol ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()" + . "name='&KeyVal(#1,'name')'>" + . "<omdoc:metadata>" + . "<dc:description>" + . "#body" + . "</dc:description>" + . "</omdoc:metadata>" + . "</omdoc:symbol>\n"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\symtype} +% \begin{macrocode} +%<package>\newcommand{\symtype}[2]{Type (#1): #2} +%<ltxml>DefConstructor('\symtype{}{}',"<omdoc:type system='#1'>#2</omdoc:type>"); +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{definition} +% The |definition| environment itself is quite simple. The only interesting thing is +% that it locally defines the |definiendum| macro, which we do in the initialization +% macro. +% \begin{macro}{\definiendum} +% The |\definiendum| macro is very simple: at the moment we do not do anything with the +% keyword arguments. +% \end{macro} +% \begin{macrocode} +%<*package> +\def\st@definition@initialize{% +\newcommand{\notatiendum}[2][]{\notemph{##2}} +\newcommand{\definiendum}[2][]{\defemph{##2}}} +\def\st@definition@terminate{} +\define@statement@env{definition}{Definition} +%</package> +%<*ltxml> +DefCMPEnvironment('{definition} OptionalKeyVals:stat', sub { + my ($doc, $keyvals, %props) = @_; + my @symbols = @{$props{defs} || []}; + foreach my $symb(@symbols) { + $doc->openElement('omdoc:symbol', name=>$symb); + $doc->closeElement('omdoc:symbol'); } + my %attrs = (); + my $id = $keyvals->getValue('id') if $keyvals; + $attrs{'xml:id'} = $id if $id; + my $ffor = $keyvals->getValue('for') if $keyvals; + my $for = $ffor . join(' ',@symbols) if $ffor; + $attrs{for} = $for if $for; + $doc->openElement('omdoc:definition', %attrs); + my $title = $keyvals->getValue('title') if $keyvals; + if ($title) { + $doc->openElement('omdoc:metadata'); + $doc->openElement('dc:title'); + $doc->absorb($title); + $doc->closeElement('dc:title'); + $doc->closeElement('omdoc:metadata'); } + $doc->openElement('omdoc:CMP'); + $doc->openElement('omdoc:p'); + $doc->absorb($props{body}) if $props{body}; + $doc->closeElement('omdoc:p'); + $doc->closeElement('omdoc:CMP'); + $doc->closeElement('omdoc:definition'); + return; }, + afterDigestBegin=>sub { + my ($stomach, $whatsit) = @_; + my @symbols = (); + $whatsit->setProperty(defs=>\@symbols); + AssignValue('defs', \@symbols, 'global'); + return; }, + afterDigest => sub { + AssignValue('defs', undef, 'global'); + return; }); + +DefConstructor('\definiendum[]{}', + "<omdoc:term role='definiendum' name='#1' cd='#theory'>#2</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% We expand the {\latexml} bindings for |\defin|, |\twindef| and |\atwindef| into two +% instances one will be used for the definition and the other for indexing +% +% \begin{macrocode} +%<*ltxml> +DefMacro('\defin{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END); + (T_CS('\definiendum'), T_OTHER('['), $_[1]->unlist, T_OTHER(']'), @args, T_CS('\defin@index'), @args); }); +DefMacro('\twindef{}{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END, T_BEGIN, $_[2]->unlist, T_END); + (T_CS('\twindef@def'), @args, T_CS('\twindef@index'), @args); }); +DefMacro('\atwindef{}{}{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END, T_BEGIN, $_[2]->unlist, T_END, + T_BEGIN, $_[3]->unlist, T_END); + (T_CS('\atwindef@def'), @args, T_CS('\atwindef@index'), @args); }); +DefConstructor('\twindef@def{}{}', + "<omdoc:term role='definiendum' name='#1-#2' cd='#theory'>#1 #2</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString.'-'.$whatsit->getArg(2)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias => ''); +DefConstructor('\atwindef@def{}{}{}', + "<omdoc:term role='definiendum' name='#1-#2-#3' cd='#theory'>#1 #2 #3</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString.'-'.$whatsit->getArg(2)->toString + .'-'.$whatsit->getArg(3)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias => ''); +%</ltxml> +% \end{macrocode} +% +% \begin{environment}{notation} +% \begin{macrocode} +%<*package> +\def\notemph#1{{\bf{#1}}} +\def\st@notation@initialize{\newcommand{\notatiendum}[2][]{\notemph{##2}}} +\def\st@notation@terminate{} +\define@statement@env{notation}{Notation} +%</package> +%<*ltxml> +DefCMPEnvironment('{notation} OptionalKeyVals:stat', + "<omdoc:omtext type='notation' ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').not')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>\n"); +DefConstructor('\notatiendum OptionalKeyVals:notation {}', + "<omdoc:phrase type='notation'>#1</omdoc:phrase>"); +%</ltxml> +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\termin} +% The |termin| macro is very simple, it forgets the semantic annotations\ednote{use +% those for hyperlinking in the future} and puts the +% \begin{macrocode} +%<*package> +\def\termin{\@ifnextchar[{\@termin}{\@termin[]}} +\def\@termin[#1]#2{{\termemph{\index*{#2}}}} +%</package> +% \end{macrocode} +% \end{macro} +% +% Now we care about the configuration switches, they are set to sensible values, if they +% are not defined already. These are just configuration parameters, which should not +% appear in documents, therefore we do not provide {\latexml} bindings for them. +% +% \begin{macrocode} +%<*package> +\providecommand{\termemph}[1]{#1} +\providecommand{\defemph}[1]{{\bf{#1}}} +\providecommand{\stDMemph}[1]{{\bf{#1}}} +%</package> +% \end{macrocode} +% +% \subsection{Providing IDs for {\omdoc} Elements}\label{sec:impl:ids} +% +% To provide default identifiers, we tag all {\omdoc} +% elements that allow |xml:id| attributes by excuting the |numberIt| procedure from |omdoc.sty.ltxml|. +% +% \begin{macrocode} +%<*ltxml.sty> +Tag('omdoc:assertion',afterOpen=>\&numberIt); +Tag('omdoc:definition',afterOpen=>\&numberIt); +%</ltxml.sty> +% \end{macrocode} +% +% \subsection{Finale} +% +% Finally, we need to terminate the file with a success mark for perl. +% \begin{macrocode} +%<ltxml>1; +% \end{macrocode} +% \Finale +\endinput + +% \iffalse +% LocalWords: GPL structuresharing STR dtx keyval env envfalse idfalse idtrue +% LocalWords: displayfalse envtrue displaytrue forfalse typefalse titlefalse +% LocalWords: continuesfalse fortrue fromtrue typetrue titletrue +% LocalWords: continuestrue consymb omtext +%%% Local Variables: +%%% mode: doctex +%%% TeX-master: t +%%% End: +% \fi diff --git a/Master/texmf-dist/source/latex/stex/statements.ins b/Master/texmf-dist/source/latex/stex/statements.ins new file mode 100644 index 00000000000..98628a07d7c --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/statements.ins @@ -0,0 +1,38 @@ +%% +%% This file generates files required to use the ed package. +%% At your command prompt write +%% +%% latex statements.ins +%% +%% Copyright(c) 2005 Michael Kohlhase +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.0 or, at your option, any later version. +%% +\input docstrip +\preamble +\endpreamble + +%\usedir{tex/latex/listings} +\keepsilent +\askforoverwritefalse + +% generate base package +\generate{\file{statements.sty}{\from{statements.dtx}{package}}} + +\Msg{*} +\Msg{* You probably need to move the generated style files into a directory searched by TeX.} +\Msg{*} +\Msg{* And don't forget to refresh your filename database} +\Msg{* if your TeX distribution uses such a database.} +\Msg{*} + +\nopreamble\nopostamble +\generate{\file{statements.sty.ltxml}{\from{statements.dtx}{ltxml}}} + +\Msg{*} +\Msg{* You probably need to move the generated ltxml files into a directory searched by LaTeXML.} +\Msg{*} + +\endbatchfile diff --git a/Master/texmf-dist/tex/latex/stex/cmathml.sty b/Master/texmf-dist/tex/latex/stex/cmathml.sty new file mode 100644 index 00000000000..90b215dd2ab --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/cmathml.sty @@ -0,0 +1,450 @@ +%% +%% This is file `cmathml.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% cmathml.dtx (with options: `sty') +%% +\RequirePackage{presentation} +\newcommand{\Capply}[3][]{#2(#3)} +\def\CMathML@cn#1{#1} +\newcommand{\Ccn}[2][]{\CMathML@cn{#2}} +\def\CMathML@ci#1{#1} +\newcommand{\Cci}[2][]{\CMathML@ci{#2}} +\def\CMathML@csymbol#1{#1} +\newcommand{\Ccsymbol}[2][]{\CMathML@csymbol{#2}} +\def\CMathML@ccinterval#1#2{[#1,#2]} +\newcommand{\Cccinterval}[3][]{\CMathML@ccinterval{#2}{#3}} +\def\CMathML@cointerval#1#2{[#1,#2)} +\newcommand{\Ccointerval}[3][]{\CMathML@cointerval{#2}{#3}} +\def\CMathML@ocinterval#1#2{(#1,#2]} +\newcommand{\Cocinterval}[3][]{\CMathML@ocinterval{#2}{#3}} +\def\CMathML@oointerval#1#2{(#1,#2)} +\newcommand{\Coointerval}[3][]{\CMathML@oointerval{#2}{#3}} +\newcommand{\Cinverse}[2][]{#2^{-1}} +\def\CMathML@lambda#1#2{\lambda({#1},{#2})} +\newcommand{\Clambda}[3][]{\CMathML@lambda{#2}{#3}} +\def\CMathML@lambdaDA#1#2#3{\lambda({#1}\colon{#2},#3)} +\newcommand{\ClambdaDA}[4][]{\CMathML@lambdaDA{#2}{#3}{#4}} +\def\CMathML@restrict#1#2{\left.#1\right|_{#2}} +\newcommand{\Crestrict}[3][]{\CMathML@restrict{#2}{#3}} +\def\CMathML@composeOp{\circ} +\newcommand{\CcomposeOp}{\CMathML@composeOp} +\def\CMathML@compose#1{\assoc[p=500,pi=500]{\CMathML@composeOp}{#1}} +\newcommand{\Ccompose}[2][]{\CMathML@compose{#2}} +\def\CMathML@ident#1{\mathrm{id}} +\newcommand{\Cident}[1][]{\CMathML@ident{#1}} +\def\CMathML@domain#1{\mbox{dom}(#1)} +\newcommand{\Cdomain}[2][]{\CMathML@domain{#2}} +\def\CMathML@codomain#1{\mbox{codom}(#1)} +\newcommand{\Ccodomain}[2][]{\CMathML@codomain{#2}} +\def\CMathML@image#1{{\mathbf{Im}}(#1)} +\newcommand{\Cimage}[2][]{\CMathML@image{#2}} +\def\CMathML@piecewise#1{\left\{\begin{array}{ll}#1\end{array}\right.} +\newcommand{\Cpiecewise}[2][]{\CMathML@piecewise{#2}} +\def\CMathML@piece#1#2{#1&{\mathrm{if}}\;{#2}\\} +\newcommand{\Cpiece}[3][]{\CMathML@piece{#2}{#3}} +\def\CMathML@otherwise#1{#1&else\\} +\newcommand{\Cotherwise}[2][]{\CMathML@otherwise{#2}} +\def\CMathML@quotient#1#2{\frac{#1}{#2}} +\newcommand{\Cquotient}[3][]{\CMathML@quotient{#2}{#3}} +\def\CMathML@factorialOp{!} +\newcommand{\CfactorialOp}{\CMathML@factorialOp} +\def\CMathML@factorial#1{#1{\CMathML@factorialOp}} +\newcommand{\Cfactorial}[2][]{\CMathML@factorial{#2}} +\def\CMathML@divideOp{\div} +\newcommand{\CdivideOp}{\CMathML@divideOp} +\def\CMathML@divide#1#2{\infix[p=400]{\CMathML@divideOp}{#1}{#2}} +\newcommand{\Cdivide}[3][]{\CMathML@divide{#2}{#3}} +\def\CMathML@maxOp{\mathrm{max}} +\newcommand{\CmaxOp}{\CMathML@maxOp} +\def\CMathML@max#1{{\CMathML@maxOp}(#1)} +\newcommand{\Cmax}[2][]{\CMathML@max{#2}} +\def\CMathML@minOp{\mathrm{min}} +\newcommand{\CminOp}{\CMathML@minOp} +\def\CMathML@min#1{{\CMathML@minOp}(#1)} +\newcommand{\Cmin}[2][]{\CMathML@min{#2}} +\def\CMathML@minusOp{-} +\newcommand{\CminusOp}{\CMathML@minusOp} +\def\CMathML@minus#1#2{\infix[p=500]{\CMathML@minusOp}{#1}{#2}} +\newcommand{\Cminus}[3][]{\CMathML@minus{#2}{#3}} +\def\CMathML@uminus#1{\prefix[p=200]{\CMathML@minusOp}{#1}} +\newcommand{\Cuminus}[2][]{\CMathML@uminus{#2}} +\def\CMathML@plusOp{+} +\newcommand{\CplusOp}{\CMathML@plusOp} +\def\CMathML@plus#1{\assoc[p=500]{\CMathML@plusOp}{#1}} +\newcommand{\Cplus}[2][]{\CMathML@plus{#2}} +\def\CMathML@power#1#2{\infix[p=200]{^}{#1}{#2}} +\newcommand{\Cpower}[3][]{\CMathML@power{#2}{#3}} +\def\CMathML@remOp{\bmod} +\newcommand{\CremOp}{\CMathML@remOp} +\def\CMathML@rem#1#2{#1 \CMathML@remOp #2} +\newcommand{\Crem}[3][]{\CMathML@rem{#2}{#3}} +\def\CMathML@timesOp{\cdot} +\newcommand{\CtimesOp}{\CMathML@timesOp} +\def\CMathML@times#1{\assoc[p=400]{\CMathML@timesOp}{#1}} +\newcommand{\Ctimes}[2][]{\CMathML@times{#2}} +\def\CMathML@rootOp{\sqrt} +\newcommand{\CrootOp}{\CMathML@rootOp{}} +\def\CMathML@root#1#2{\CMathML@rootOp[#1]{#2}} +\newcommand{\Croot}[3][]{\CMathML@root{#2}{#3}} +\def\CMathML@gcd#1{\gcd(#1)} +\newcommand{\Cgcd}[2][]{\CMathML@gcd{#2}} +\def\CMathML@andOp{\wedge} +\newcommand{\CandOp}{\CMathML@andOp} +\def\CMathML@and#1{\assoc[p=400]{\CMathML@andOp}{#1}} +\newcommand{\Cand}[2][]{\CMathML@and{#2}} +\def\CMathML@orOp{\vee} +\newcommand{\CorOp}{\CMathML@orOp} +\def\CMathML@or#1{\assoc[p=500]{\CMathML@orOp}{#1}} +\newcommand{\Cor}[2][]{\CMathML@or{#2}} +\def\CMathML@xorOp{\oplus} +\newcommand{\CxorOp}{\CMathML@xorOp} +\def\CMathML@xor#1{\assoc[p=400]{\CMathML@xorOp}{#1}} +\newcommand{\Cxor}[2][]{\CMathML@xor{#2}} +\def\CMathML@notOp{\neg} +\newcommand{\CnotOp}{\CMathML@notOp} +\def\CMathML@not#1{\CMathML@notOp{#1}} +\newcommand{\Cnot}[2][]{\CMathML@not{#2}} +\def\CMathML@impliesOp{\Longrightarrow} +\newcommand{\CimpliesOp}{\CMathML@impliesOp} +\def\CMathML@implies#1#2{#1\CMathML@impliesOp{#2}} +\newcommand{\Cimplies}[3][]{\CMathML@implies{#2}{#3}} +\def\CMathML@AndDA#1#2{\bigwedge_{#1}{#2}} % set, scope +\newcommand{\CAndDA}[3][]{\CMathML@AndDA{#2}{#3}} +\def\CMathML@AndCond#1#2#3{\bigwedge_{#2}{#3}} % bvars,condition, scope +\newcommand{\CAndCond}[4][]{\CMathML@AndCond{#2}{#2}{#3}} +\def\CMathML@OrDA#1#2{\bigvee_{#1}{#2}} % set, scope +\newcommand{\COrDa}[3][]{\CMathML@OrDA{#2}{#3}} +\def\CMathML@OrCond#1#2#3{\bigvee_{#2}{#3}}% bvars,condition, scope +\newcommand{\COrCond}[4][]{\CMathML@OrCond{#2}{#3}{#4}} +\def\CMathML@XorDA#1#2{\bigoplus_{#1}{#2}} % set, scope +\newcommand{\CXorDA}[3][]{\CMathML@XorDA{#2}{#3}} +\def\CMathML@XorCond#1#2#3{\bigoplus_{#2}{#3}}% bvars,condition, scope +\newcommand{\CXorCond}[4][]{\CMathML@XorCond{#2}{#3}{#4}} +\def\CMathML@forall#1#2{\forall{#1}\colon{#2}} +\newcommand{\Cforall}[3][]{\CMathML@forall{#2}{#3}} +\def\CMathML@forallCond#1#2#3{\forall{#1},{#2}\colon{#3}} % list), condition, scope +\newcommand{\CforallCond}[4][]{\CMathML@forallCond{#2}{#3}{#4}} +\def\CMathML@exists#1#2{\exists{#1}\colon{#2}} +\newcommand{\Cexists}[3][]{\CMathML@exists{#2}{#3}} +\def\CMathML@esistsCont#1#2#3{\exists{#1},{#2}\colon{#3}} +\newcommand{\CexistsCond}[4][]{\CMathML@esistsCont{#2}{#3}{#4}} +\def\CMathML@abs#1{\left|#1\right|} +\newcommand{\Cabs}[2][]{\CMathML@abs{#2}} +\def\CMathML@conjugate#1{\overline{#1}} +\newcommand{\Cconjugate}[2][]{\CMathML@conjugate{#2}} +\def\CMathML@arg#1{\angle #1} +\newcommand{\Carg}[2][]{\CMathML@arg{#2}} +\def\CMathML@real#1{\Re #1} +\newcommand{\Creal}[2][]{\CMathML@real{#2}} +\def\CMathML@imaginary#1{\Im #1} +\newcommand{\Cimaginary}[2][]{\CMathML@imaginary{#2}} +\def\CMathML@lcm#1{\mbox{lcm}(#1)} +\newcommand{\Clcm}[2][]{\CMathML@lcm{#2}} +\def\CMathML@floor#1{\left\lfloor{#1}\right\rfloor} +\newcommand{\Cfloor}[2][]{\CMathML@floor{#2}} +\def\CMathML@ceiling#1{\left\lceil{#1}\right\rceil} +\newcommand{\Cceiling}[2][]{\CMathML@ceiling{#2}} +\def\CMathML@eqOp{=} +\newcommand{\CeqOp}{\CMathML@eqOp} +\def\CMathML@eq#1{\assoc[p=700]{\CMathML@eqOp}{#1}} +\newcommand{\Ceq}[2][]{\CMathML@eq{#2}} +\def\CMathML@neqOp{\neq} +\newcommand{\CneqOp}{\CMathML@neqOp} +\def\CMathML@neq#1#2{\infix[p=700]{\CMathML@neqOp}{#1}{#2}} +\newcommand{\Cneq}[3][]{\CMathML@neq{#2}{#3}} +\def\CMathML@gtOp{>} +\newcommand{\CgtOp}{\CMathML@gtOp} +\def\CMathML@gt#1{\assoc[p=700]{\CMathML@gtOp}{#1}} +\newcommand{\Cgt}[2][]{\CMathML@gt{#2}} +\def\CMathML@ltOp{<} +\newcommand{\CltOp}{\CMathML@ltOp} +\def\CMathML@lt#1{\assoc[p=700]{\CMathML@ltOp}{#1}} +\newcommand{\Clt}[2][]{\CMathML@lt{#2}} +\def\CMathML@geqOp{\geq} +\newcommand{\CgeqOp}{\CMathML@geqOp} +\def\CMathML@geq#1{\assoc[p=700]{\CMathML@geqOp}{#1}} +\newcommand{\Cgeq}[2][]{\CMathML@geq{#2}} +\def\CMathML@leqOp{\leq} +\newcommand{\CleqOp}{\CMathML@leqOp} +\def\CMathML@leq#1{\assoc[p=700]{\CMathML@leqOp}{#1}} +\newcommand{\Cleq}[2][]{\CMathML@leq{#2}} +\def\CMathML@equivalentOp{\equiv} +\newcommand{\CequivalentOp}{\CMathML@equivalentOp} +\def\CMathML@equivalent#1{\assoc[p=700]{\CMathML@equivalentOp}{#1}} +\newcommand{\Cequivalent}[2][]{\CMathML@equivalent{#2}} +\def\CMathML@approxOp{\approx} +\newcommand{\CapproxOp}{\CMathML@approxOp} +\def\CMathML@approx#1#2{#1\CMathML@approxOp{#2}} +\newcommand{\Capprox}[3][]{\CMathML@approx{#2}{#3}} +\def\CMathML@factorofOp{\mid} +\newcommand{\CfactorofOp}{\CMathML@factorofOp} +\def\CMathML@factorof#1#2{#1\CMathML@factorofOp{#2}} +\newcommand{\Cfactorof}[3][]{\CMathML@factorof{#2}{#3}} + +\def\CMathML@intOp{\int} +\newcommand{\CintOp}{\CMathML@intOp} +\def\CMathML@int#1{\CMathML@intOp{#1}} +\newcommand{\Cint}[2][]{\CMathML@int{#2}} +\def\CMathML@intLimits#1#2#3#4{\CMathML@intOp_{#2}^{#3}{#4}d{#1}} %bvars,llimit, ulimit,body +\newcommand{\CintLimits}[5][]{\CMathML@intLimits{#2}{#3}{#4}{#5}} +\def\CMathML@intSet#1#2{\CMathML@intOp_{#1}{#2}}% set,function +\newcommand{\CintDA}[3][]{\CMathML@intSet{#2}{#3}} +\def\CMathML@intCond#1#2#3{\CMathML@intOp_{#2}{#3}d{#1}} %bvars, condition, body +\newcommand{\CintCond}[4][]{\CMathML@intCond{#2}{#3}{#4}} + +\def\CMathML@diff#1{#1'} +\newcommand{\Cdiff}[2][]{\CMathML@diff{#2}} +\def\CMathML@ddiff#1#2{{d{#2}(#1)\over{d{#1}}}} +\newcommand{\Cddiff}[3][]{\CMathML@ddiff{#2}{#3}} +\def\CMathML@partialdiff#1#2#3{{\partial^{#1}\over\partial{#2}}{#3}}% degree, bvars, body +\newcommand{\Cpartialdiff}[4][]{\CMathML@partialdiff{#2}{#3}{#4}} +\newcommand{\Cdegree}[2]{#1^{#2}} +\def\CMathML@limit#1#2#3{\lim_{#1\rightarrow{#2}}{#3}} +\newcommand{\Climit}[4][]{\CMathML@limit{#2}{#3}{#4}} % bvar, lowlimit, scope +\def\CMathML@limitCond#1#2#3{\lim_{#2}{#3}} +\newcommand{\ClimitCond}[4][]{\CMathML@limitCond{#2}{#3}{#4}} % bvars, condition, scope +\def\CMathML@tendstoOp{\rightarrow} +\newcommand{\CtendstoOp}{\CMathML@tendstoOp} +\def\CMathML@tendsto#1#2{#1\CMathML@tendstoOp{#2}} +\newcommand{\Ctendsto}[3][]{\CMathML@tendsto{#2}{#3}} +\def\CMathML@tendstoAboveOp{\searrow} +\newcommand{\CtendstoAboveOp}{\CMathML@tendstoAboveOp} +\def\CMathML@tendstoAbove#1#2{#1\searrow{#2}} +\newcommand{\CtendstoAbove}[3][]{\CMathML@tendstoAbove{#2}{#3}} +\def\CMathML@tendstoBelowOp{\nearrow} +\newcommand{\CtendstoBelowOp}{\CMathML@tendstoBelowOp} +\def\CMathML@tendstoBelow#1#2{#1\CMathML@tendstoBelowOp{#2}} +\newcommand{\CtendstoBelow}[3][]{\CMathML@tendstoBelow{#2}{#3}} +\def\CMathML@divergence#1{\nabla\cdot{#1}} +\newcommand{\Cdivergence}[2][]{\CMathML@divergence{#2}} +\def\CMathML@grad#1{\nabla{#1}} +\newcommand{\Cgrad}[2][]{\CMathML@grad{#2}} +\def\CMathML@curl#1{\nabla\times{#1}} +\newcommand{\Ccurl}[2][]{\CMathML@curl{#2}} +\def\CMathML@laplacian#1{\nabla^2#1} +\newcommand{\Claplacian}[2][]{\CMathML@laplacian{#2}} +\def\CMathML@set#1{\left\{#1\right\}} +\newcommand{\Cset}[2][]{\CMathML@set{#2}} +\def\CMathML@setRes#1#2{\{#1|#2\}} +\newcommand{\CsetRes}[3][]{\CMathML@setRes{#2}{#3}} +\def\CMathML@setCond#1#2#3{\{#2|#3\}} +\newcommand{\CsetCond}[4][]{\CMathML@setCond{#2}{#3}{#4}} +\def\CMathML@setDA#1#2#3{\{#1\in{#2}|#3\}} +\newcommand{\CsetDA}[4][]{\CMathML@setDA{#2}{#3}{#4}} +\def\CMathML@listOp{\mbox{list}} +\newcommand{\ClistOp}{\CMathML@listOp} +\def\CMathML@list#1{\CMathML@listOp({#1})} +\newcommand{\Clist}[2][]{\CMathML@list{#2}} +\def\CMathML@unionOp{\cup} +\newcommand{\CunionOp}{\CMathML@unionOp} +\def\CMathML@union#1{\assoc[p=500]{\CMathML@unionOp}{#1}} +\newcommand{\Cunion}[2][]{\CMathML@union{#2}} +\def\CMathML@intersectOp{\cap} +\newcommand{\CintersectOp}{\CMathML@intersectOp} +\def\CMathML@intersect#1{\assoc[p=400]{\CMathML@intersectOp}{#1}} +\newcommand{\Cintersect}[2][]{\CMathML@intersect{#2}} +\def\CMathML@inOp{\in} +\newcommand{\CinOp}{\CMathML@inOp} +\def\CMathML@in#1#2{#1\CMathML@inOp{#2}} +\newcommand{\Cin}[3][]{\CMathML@in{#2}{#3}} +\def\CMathML@notinOp{\notin} +\newcommand{\CnotinOp}{\CMathML@notinOp} +\def\CMathML@notin#1#2{#1\CMathML@notinOp{#2}} +\newcommand{\Cnotin}[3][]{\CMathML@notin{#2}{#3}} +\def\CMathML@setdiffOp{\setminus} +\newcommand{\CsetdiffOp}{\CMathML@setdiffOp} +\def\CMathML@setdiff#1#2{#1\CMathML@setdiffOp{#2}} +\newcommand{\Csetdiff}[3][]{\CMathML@setdiff{#2}{#3}} +\def\CMathML@cardOp{\#} +\newcommand{\CcardOp}{\CMathML@cardOp} +\def\CMathML@card#1{\CMathML@cardOp #1} +\newcommand{\Ccard}[2][]{\CMathML@card{#2}} +\def\CMathML@cartesianproductOp{\times} +\newcommand{\CcartesianproductOp}{\CMathML@cartesianproductOp} +\def\CMathML@cartesianproduct#1{\assoc[p=400]{\CMathML@cartesianproductOp}{#1}} +\newcommand{\Ccartesianproduct}[2][]{\CMathML@cartesianproduct{#2}} +\def\CMathML@subsetOp{\subseteq} +\newcommand{\CsubsetOp}{\CMathML@subsetOp} +\def\CMathML@subset#1{\assoc[p=700]{\CMathML@subsetOp}{#1}} +\newcommand{\Csubset}[2][]{\CMathML@subset{#2}} +\def\CMathML@prsubsetOp{\subset} +\newcommand{\CprsubsetOp}{\CMathML@prsubsetOp} +\def\CMathML@prsubset#1{\assoc[p=700]{\CMathML@prsubsetOp}{#1}} +\newcommand{\Cprsubset}[2][]{\CMathML@prsubset{#2}} +\def\CMathML@notsubsetOp{\not\subseteq} +\newcommand{\CnotsubsetOp}{\CMathML@notsubsetOp} +\def\CMathML@notsubset#1#2{#1\CMathML@notsubsetOp{#2}} +\newcommand{\Cnotsubset}[3][]{\CMathML@notsubset{#2}{#3}} +\def\CMathML@notprsubsetOp{\not\subset} +\newcommand{\CnotprsubsetOp}{\CMathML@notprsubsetOp} +\def\CMathML@notprsubset#1#2{#1\CMathML@notprsubsetOp{#2}} +\newcommand{\Cnotprsubset}[3][]{\CMathML@notprsubset{#2}{#3}} +\def\CMathML@supsetOp{\supseteq} +\newcommand{\CsupsetOp}{\CMathML@supsetOp} +\def\CMathML@supset#1{\assoc[p=700]{\CMathML@supsetOp}{#1}} +\newcommand{\Csupset}[2][]{\CMathML@supset{#2}} +\def\CMathML@prsupsetOp{\supset} +\newcommand{\CprsupsetOp}{\CMathML@prsupsetOp} +\def\CMathML@prsupset#1{\assoc[p=700]{\CMathML@prsupsetOp}{#1}} +\newcommand{\Cprsupset}[2][]{\CMathML@prsupset{#2}} +\def\CMathML@notsupsetOp{\not\supseteq} +\newcommand{\CnotsupsetOp}{\CMathML@notsupsetOp} +\def\CMathML@notsupset#1#2{#1\CMathML@notsupsetOp{#2}} +\newcommand{\Cnotsupset}[3][]{\CMathML@notsupset{#2}{#3}} +\def\CMathML@notprsupsetOp{\not\supset} +\newcommand{\CnotprsupsetOp}{\CMathML@notprsupsetOp} +\def\CMathML@notprsupset#1#2{#1\CMathML@notprsupsetOp{#2}} +\newcommand{\Cnotprsupset}[3][]{\CMathML@notprsupset{#2}{#3}} +\def\CMathML@UnionDAOp{\bigwedge} +\newcommand{\CUnionDAOp}{\CMathML@UnionDAOp} +\def\CMathML@UnionDA#1#2{\CMathML@UnionDAOp_{#1}{#2}} % set, scope +\newcommand{\CUnionDA}[3][]{\CMathML@UnionDA{#2}{#3}} +\def\CMathML@UnionCond#1#2#3{\CMathML@UnionDAOp_{#2}{#3}} % bvars,condition, scope +\newcommand{\CUnionCond}[4][]{\CMathML@UnionCond{#2}{#2}{#3}} +\def\CMathML@IntersectDAOp{\bigvee} +\newcommand{\CIntersectDAOp}{\CMathML@IntersectDAOp} +\def\CMathML@IntersectDA#1#2{\CMathML@IntersectDAOp_{#1}{#2}} % set, scope +\newcommand{\CIntersectDa}[3][]{\CMathML@IntersectDA{#2}{#3}} +\def\CMathML@IntersectCond#1#2#3{\CMathML@IntersectDAOp_{#2}{#3}}% bvars,condition, scope +\newcommand{\CIntersectCond}[4][]{\CMathML@IntersectCond{#2}{#3}{#4}} +\def\CMathML@CartesianproductDAOp{\bigoplus} +\newcommand{\CCartesianproductDAOp}{\CMathML@CartesianproductDAOp} +\def\CMathML@CartesianproductDA#1#2{\CMathML@CartesianproductDAOp_{#1}{#2}} % set, scope +\newcommand{\CCartesianproductDA}[3][]{\CMathML@CartesianproductDA{#2}{#3}} +\def\CMathML@CartesianproductCond#1#2#3{\CMathML@CartesianproductDAOp_{#2}{#3}}% bvars,condition, scope +\newcommand{\CCartesianproductCond}[4][]{\CMathML@CartesianproductCond{#2}{#3}{#4}} +\def\CMathML@sumOp{\sum} +\newcommand{\CsumOp}{\CMathML@sumOp} +\def\CMathML@sumLimits#1#2#3#4{\CMathML@sumOp_{#1=#2}^{#3}#4}% bvar, llimit, ulimit, body +\newcommand{\CsumLimits}[5][]{\CMathML@sumLimits{#2}{#3}{#4}{#5}} +\def\CMathML@sumCond#1#2#3{\CMathML@sumOp_{#1\in{#2}}#3} % bvar, condition, body +\newcommand{\CsumCond}[4][]{\CMathML@sumCond{#2}{#3}{#4}} +\def\CMathML@sumDA#1#2{\CMathML@sumOp_{#1}#2} % set, body +\newcommand{\CsumDA}[3][]{\CMathML@sumDA{#2}{#3}} +\def\CMathML@prodOp{\prod} +\newcommand{\CprodOp}{\CMathML@prodOp} +\def\CMathML@prodLimits#1#2#3#4{\CMathML@prodOp_{#1=#32^{#3}#4}}% bvar, llimit, ulimit, body +\newcommand{\CprodLimits}[5][]{\CMathML@prodLimits{#2}{#3}{#4}{#5}} +\def\CMathML@prodCond#1#2#3{\CMathML@prodOp_{#1\in{#2}}#3} % bvar, condition, body +\newcommand{\CprodCond}[4][]{\CMathML@prodCond{#2}{#3}{#4}} +\def\CMathML@prodDA#1#2{\CMathML@prodOp_{#1}#2} % set, body +\newcommand{\CprodDA}[3]{\CMathML@prodDA{#2}{#3}} +\def\CMathML@sin#1{\sin(#1)} +\newcommand{\Csin}[2][]{\CMathML@sin{#2}} +\def\CMathML@cos#1{\cos(#1)} +\newcommand{\Ccos}[2][]{\CMathML@cos{#2}} +\def\CMathML@tan#1{\tan(#1)} +\newcommand{\Ctan}[2][]{\CMathML@tan{#2}} +\def\CMathML@sec#1{\sec(#1)} +\newcommand{\Csec}[2][]{\CMathML@sec{#2}} +\def\CMathML@csc#1{\csc(#1)} +\newcommand{\Ccsc}[2][]{\CMathML@csc{#2}} +\def\CMathML@cot#1{\cot(#1)} +\newcommand{\Ccot}[2][]{\CMathML@cot{#2}} +\def\CMathML@sinh#1{\sinh(#1)} +\newcommand{\Csinh}[2][]{\CMathML@sinh{#2}} +\def\CMathML@cosh#1{\cosh(#1)} +\newcommand{\Ccosh}[2][]{\CMathML@cosh{#2}} +\def\CMathML@tanh#1{\tanh(#1)} +\newcommand{\Ctanh}[2][]{\CMathML@tanh{#2}} +\def\CMathML@sech#1{\mbox{sech}(#1)} +\newcommand{\Csech}[2][]{\CMathML@sech{#2}} +\def\CMathML@csch#1{\mbox{csch}(#1)} +\newcommand{\Ccsch}[2][]{\CMathML@csch{#2}} +\def\CMathML@coth#1{\mbox{coth}(#1)} +\newcommand{\Ccoth}[2][]{\CMathML@coth{#2}} +\def\CMathML@arcsin#1{\arcsin(#1)} +\newcommand{\Carcsin}[2][]{\CMathML@arcsin{#2}} +\def\CMathML@arccos#1{\arccos(#1)} +\newcommand{\Carccos}[2][]{\CMathML@arccos{#2}} +\def\CMathML@arctan#1{\arctan(#1)} +\newcommand{\Carctan}[2][]{\CMathML@arctan{#2}} +\def\CMathML@arccosh#1{\mbox{arccosh}(#1)} +\newcommand{\Carccosh}[2][]{\CMathML@arccosh{#2}} +\def\CMathML@arccot#1{\mbox{arccot}(#1)} +\newcommand{\Carccot}[2][]{\CMathML@arccot{#2}} +\def\CMathML@arccoth#1{\mbox{arccoth}(#1)} +\newcommand{\Carccoth}[2][]{\CMathML@arccoth{#2}} +\def\CMathML@arccsc#1{\mbox{arccsc}(#1)} +\newcommand{\Carccsc}[2][]{\CMathML@arccsc{#2}} +\def\CMathML@arcsinh#1{\mbox{arcsinh}(#1)} +\newcommand{\Carcsinh}[2][]{\CMathML@arcsinh{#2}} +\def\CMathML@arctanh#1{\mbox{arctanh}(#1)} +\newcommand{\Carctanh}[2][]{\CMathML@arctanh{#2}} + +\def\CMathML@exp#1{\exp(#1)} +\newcommand{\Cexp}[2][]{\CMathML@exp{#2}} +\def\CMathML@ln#1{\ln(#1)} +\newcommand{\Cln}[2][]{\CMathML@ln{#2}} +\def\CMathML@log#1#2{\log_{#1}(#2)} +\newcommand{\Clog}[3][]{\CMathML@log{#2}{#3}} +\def\CMathML@mean#1{\mbox{mean}(#1)} +\newcommand{\Cmean}[2][]{\CMathML@mean{#2}} +\def\CMathML@sdev#1{\mbox{std}(#1)} +\newcommand{\Csdev}[2][]{\CMathML@sdev{#2}} +\def\CMathML@var#1{\mbox{var}(#1)} +\newcommand{\Cvar}[2][]{\CMathML@var{#2}} +\def\CMathML@median#1{\mbox{median}(#1)} +\newcommand{\Cmedian}[2][]{\CMathML@median{#2}} +\def\CMathML@mode#1{\mbox{mode}(#1)} +\newcommand{\Cmode}[2][]{\CMathML@mode{#2}} +\def\CMathML@moment#1#2{\langle{#2}^{#1}\rangle}% degree, momentabout, scope +\newcommand{\Cmoment}[3][]{\CMathML@moment{#2}{#3}} +\def\CMathML@momentA#1#2{\langle{#2}^{#1}\rangle}% degree, momentabout, scope +\newcommand{\CmomentA}[4][]{\CMathML@momentA{#2}{#3}{#4}} +\def\CMathML@vector#1{(#1)} +\newcommand{\Cvector}[2][]{\CMathML@vector{#2}} +\def\CMathML@matrix#1#2{\left(\begin{array}{#1}#2\end{array}\right)}% row pattern, body +\newcommand{\Cmatrix}[3][]{\CMathML@matrix{#2}{#3}} +\def\CMathML@determinant#1{\left|#1\right|} +\newcommand{\Cdeterminant}[2][]{\CMathML@determinant{#2}} +\def\CMathML@transpose#1{#1^\top} +\newcommand{\Ctranspose}[2][]{\CMathML@transpose{#2}} +\def\CMathML@selector#1#2{#1_{#2}} +\newcommand{\Cselector}[3][]{\CMathML@selector{#2}{#3}} +\def\CMathML@vectproductOp{\cdot} +\newcommand{\CvectproductOp}{\CMathML@vectproductOp} +\def\CMathML@vectproduct#1#2{#1\CMathML@vectproductOp{#2}} +\newcommand{\Cvectproduct}[3][]{\CMathML@vectproduct{#2}{#3}} +\def\CMathML@scalarproduct#1#2{{#1}#2} +\newcommand{\Cscalarproduct}[3][]{\CMathML@scalarproduct{#2}{#3}} +\def\CMathML@outerproductOp{\times} +\newcommand{\CouterproductOp}{\CMathML@outerproductOp} +\def\CMathML@outerproduct#1#2{#1\CMathML@outerproductOp{#2}} +\newcommand{\Couterproduct}[3][]{\CMathML@outerproduct{#2}{#3}} +\def\CMathML@integers{{\mathbb{Z}}} +\newcommand{\Cintegers}[1][]{\CMathML@integers} +\def\CMathML@reals{{\mathbb{R}}} +\newcommand{\Creals}[1][]{\CMathML@reals} +\def\CMathML@rationals{{\mathbb{Q}}} +\newcommand{\Crationals}[1][]{\CMathML@rationals} +\def\CMathML@naturalnumbers{{\mathbb{N}}} +\newcommand{\Cnaturalnumbers}[1][]{\CMathML@naturalnumbers} +\def\CMathML@complexes{{\mathbb{C}}} +\newcommand{\Ccomplexes}[1][]{\CMathML@complexes} +\def\CMathML@primes{{\mathbb{P}}} +\newcommand{\Cprimes}[1][]{\CMathML@primes} +\def\CMathML@exponemtiale{e} +\newcommand{\Cexponemtiale}[1][]{\CMathML@exponemtiale} +\def\CMathML@imaginaryi{i} +\newcommand{\Cimaginaryi}[1][]{\CMathML@imaginaryi} +\def\CMathML@notanumber{{\mathrm{NaN}}} +\newcommand{\Cnotanumber}[1][]{\CMathML@notanumber} +\def\CMathML@true{{\mathrm{true}}} +\newcommand{\Ctrue}[1][]{\CMathML@true} +\def\CMathML@false{{\mathrm{false}}} +\newcommand{\Cfalse}[1][]{\CMathML@false} +\def\CMathML@emptyset{\emptyset} +\newcommand{\Cemptyset}[1][]{\CMathML@emptyset} +\def\CMathML@pi{\pi} +\newcommand{\Cpi}[1][]{\CMathML@pi} +\def\CMathML@eulergamma{\gamma} +\newcommand{\Ceulergamma}[1][]{\CMathML@eulergamma} +\def\CMathML@infinit{\infty} +\newcommand{\Cinfinit}[1][]{\CMathML@infinit} +\endinput +%% +%% End of file `cmathml.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/cmathml.sty.ltxml b/Master/texmf-dist/tex/latex/stex/cmathml.sty.ltxml new file mode 100644 index 00000000000..a6ce629f220 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/cmathml.sty.ltxml @@ -0,0 +1,974 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +use LaTeXML::Document; +RequirePackage('LaTeX'); +sub remove_tokens_from_list { + my ($list, $pattern, $math) = @_; + if (ref $list) { + my @toks = $list->unlist; + @toks = grep($_->toString !~ /$pattern/, @toks); + ($math ? (LaTeXML::MathList->new(@toks)) : (LaTeXML::List)->new(@toks)); } + else { undef; } } + +sub remove_math_commas { + my ($whatsit, $argno) = @_; + my @args = $whatsit ? $whatsit->getArgs() : undef; + $argno--; + if ($args[$argno]) { + $args[$argno] = remove_tokens_from_list($args[$argno], ',', 1); + $whatsit->setArgs(@args); + } + return; +} +DefConstructor('\Capply [] {} {}', + "<ltx:XMApp ?#1(definitionURL='#1')()>#2 #3</ltx:XMApp>"); +DefConstructor('\Ccn [] {}',"#2"); +DefConstructor('\Cci [] {}',"#2"); +DefConstructor('\Ccsymbol [] {}', + "<ltx:XMTok role='CSYMBOL' meaning='#2' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cccinterval [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='ccinterval' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg></ltx:XMApp>"); +DefConstructor('\Ccointerval [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='cointerval' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg></ltx:XMApp>"); +DefConstructor('\Cocinterval [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='ocinterval' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg></ltx:XMApp>"); +DefConstructor('\Coointerval [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='oointerval' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg></ltx:XMApp>"); +DefConstructor('\Cinverse [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='inverse' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Clambda [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='lambda' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\ClambdaDA [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='lambda' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Crestrict [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='restrict' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CcomposeOp []', + "<ltx:XMTok meaning='compose' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ccompose [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='MULOP' meaning='compose' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\Cident []', + "<ltx:XMTok meaning='ident' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cdomain [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='domain' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccodomain [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='codomain' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cimage [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='image' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cpiecewise [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='piecewise' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cpiece [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='piece' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cotherwise [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='otherwise' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cquotient [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='quotient' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CfactorialOp []', + "<ltx:XMTok meaning='factorial' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cfactorial [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='factorial' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CdivideOp []', + "<ltx:XMTok meaning='divide' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cdivide [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='divide' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CmaxOp []', + "<ltx:XMTok meaning='max' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cmax [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='max' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CminOp []', + "<ltx:XMTok meaning='min' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cmin [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='min' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CminusOp []', + "<ltx:XMTok meaning='minus' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cminus [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='ADDOP' meaning='minus' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cuminus [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='uminus' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CplusOp []', + "<ltx:XMTok meaning='plus' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cplus [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='ADDOP' meaning='plus' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\Cpower [] {} {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='power' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CremOp []', + "<ltx:XMTok meaning='rem' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Crem [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='rem' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CtimesOp []', + "<ltx:XMTok meaning='times' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ctimes [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='MULOP' meaning='times' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CrootOp []', + "<ltx:XMTok meaning='root' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Croot [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='root' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cgcd [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='gcd' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CandOp []', + "<ltx:XMTok meaning='and' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cand [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='and' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CorOp []', + "<ltx:XMTok meaning='or' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cor [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='or' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CxorOp []', + "<ltx:XMTok meaning='xor' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cxor [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='xor' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CnotOp []', + "<ltx:XMTok meaning='not' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnot [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='not' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CimpliesOp []', + "<ltx:XMTok meaning='implies' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cimplies [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONNECTIVE' meaning='implies' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CAndDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='and' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CAndCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='and' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\COrDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='or' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\COrCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='or' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CXorDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='xor' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CXorCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='xor' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cforall [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='forall' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CforallCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='forall' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cexists [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='exists' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CexistsCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BINDER' meaning='exists' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cabs [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='abs' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cconjugate [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='conjugate' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carg [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='arg' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Creal [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='real' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cimaginary [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='imaginary' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Clcm [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='lcm' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cfloor [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='floor' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cceiling [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='ceiling' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CeqOp []', + "<ltx:XMTok meaning='eq' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ceq [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='eq' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CneqOp []', + "<ltx:XMTok meaning='neq' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cneq [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='neq' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CgtOp []', + "<ltx:XMTok meaning='gt' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cgt [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='gt' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CltOp []', + "<ltx:XMTok meaning='lt' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Clt [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='lt' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CgeqOp []', + "<ltx:XMTok meaning='geq' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cgeq [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='geq' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CleqOp []', + "<ltx:XMTok meaning='leq' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cleq [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='leq' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CequivalentOp []', + "<ltx:XMTok meaning='equivalent' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cequivalent [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='equivalent' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>"); +DefConstructor('\CapproxOp []', + "<ltx:XMTok meaning='approx' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Capprox [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='approx' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CfactorofOp []', + "<ltx:XMTok meaning='factorof' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cfactorof [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='factorof' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CintOp []', + "<ltx:XMTok meaning='int' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cint [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='int' role='INTOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CintLimits [] {}{}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='int' role='INTOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "<ltx:XMArg>#5</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CintDA [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='int' role='INTOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CintCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='int' role='INTOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cdiff [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='diff' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cddiff [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='diff' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cpartialdiff [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='diff' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "?#2(<ltx:XMArg>#2</ltx:XMArg>)()" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cdegree {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='degree'/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#1</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Climit [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='limit' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\ClimitCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='limit' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CtendstoOp []', + "<ltx:XMTok meaning='tendsto' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ctendsto [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='RELOP' meaning='tendsto' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CtendstoAboveOp []', + "<ltx:XMTok meaning='tendsto' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CtendstoAbove [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='RELOP'meaning='tendsto' type='above' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CtendstoBelowOp []', + "<ltx:XMTok meaning='tendsto' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CtendstoBelow [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='RELOP' meaning='tendsto' type='below' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cdivergence [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='divergence' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cgrad [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='grad' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Curl [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='url' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Claplacian [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='OPFUNCTION' meaning='laplacian' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cset [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='set' role='CONSTRUCTOR' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CsetRes [] {}{}', + "<ltx:XMApp role='BIGOP'>" + . "<ltx:XMTok role='BIGOP' meaning='set' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg role='BVAR'>#2</ltx:XMArg>" + . "<ltx:XMArg role='CONDITION'>#3</ltx:XMArg>" + . "<ltx:XMArg role='SCOPE'>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsetCond [] {}{}{}', + "<ltx:XMApp role='BIGOP'>" + . "<ltx:XMTok role='BIGOP' meaning='set' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg role='BVAR'>#2</ltx:XMArg>" + . "<ltx:XMArg role='CONDITION'>#3</ltx:XMArg>" + . "<ltx:XMArg role='SCOPE'>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsetDA [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='set' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg role='BVAR'>#2</ltx:XMArg>" + . "<ltx:XMArg role='DOMAINOFAPPLICATION'>#3</ltx:XMArg>" + . "<ltx:XMArg role='SCOPE'>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\ClistOp []', + "<ltx:XMTok meaning='list' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Clist [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='list' role='CONSTRUCTOR' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CunionOp []', + "<ltx:XMTok meaning='union' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cunion [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='union' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CintersectOp []', + "<ltx:XMTok meaning='intersect' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cintersect [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='intersect' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CinOp []', + "<ltx:XMTok meaning='in' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cin [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='in' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CnotinOp []', + "<ltx:XMTok meaning='notin' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnotin [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='notin' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsubsetOp []', + "<ltx:XMTok meaning='subset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Csubset [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='subset' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CprsubsetOp []', + "<ltx:XMTok meaning='prsubset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cprsubset [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='prsubset' role='RELOP' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CnotsubsetOp []', + "<ltx:XMTok meaning='notsubset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnotsubset [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='notsubset' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CnotprsubsetOp []', + "<ltx:XMTok meaning='notprsubset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnotprsubset [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='notprsubset' role='RELOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsetdiffOp []', + "<ltx:XMTok meaning='setdiff' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Csetdiff [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='setdiff' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CcardOp []', + "<ltx:XMTok meaning='card' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ccard [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='card' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CcartesianproductOp []', + "<ltx:XMTok meaning='cartesianproduct' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ccartesianproduct [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='cartesianproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\CsupsetOp []', + "<ltx:XMTok meaning='supset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CprsupsetOp []', + "<ltx:XMTok meaning='prsupset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CnotsupsetOp []', + "<ltx:XMTok meaning='notsupset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CnotprsupsetOp []', + "<ltx:XMTok meaning='notprsupset' role='ID' ?#1(definitionURL='#1')()/>"); +DefMacro('\Csupset[]{}','\Csubset[#1]{#2}'); +DefMacro('\Cprsupset[]{}','\Cprsubset[#1]{#2}'); +DefMacro('\Cnotsupset[]{}{}','\Cnotsubset[#1]{#3}{#2}'); +DefMacro('\Cnotprsupset[]{}{}','\Cnotprsubset[#1]{#3}{#2}'); +DefConstructor('\CUnionDAOp []', + "<ltx:XMTok meaning='union' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CUnionDA [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='union' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CUnionCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='union' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CIntersectDaOp []', + "<ltx:XMTok meaning='intersect' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CIntersectDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='intersect' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CIntersectCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='intersect' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CCartesianproductDaOp []', + "<ltx:XMTok meaning='cartesianproduct' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CCartesianproductDa [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='cartesianproduct' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CCartesianproductCond [] {}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='BIGOP' meaning='cartesianproduct' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CsumOp []', + "<ltx:XMTok meaning='sum' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CsumLimits [] {}{}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sum' role='SUMOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "#5</ltx:XMApp>"); +DefConstructor('\CprodOp []', + "<ltx:XMTok meaning='prod' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\CprodLimits [] {}{}{}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='prod' role='SUMOP' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg><ci>#2</ci></ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "<ltx:XMArg>#4</ltx:XMArg>" + . "#5</ltx:XMApp>"); +DefConstructor('\Csin [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sin' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccos [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='cos' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ctan [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='tan' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Csec [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sec' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccsc [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='csc' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccot [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='cot' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Csinh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sinh' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccosh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='cosh' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ctanh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='tanh' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Csech [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sech' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccsch [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='csch' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ccoth [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='coth' role='TRIGFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carcsin [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arcsin' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccos [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccos' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carctan [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arctan' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carcsec [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arcsec' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccsc [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccsc' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccot [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccot' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carcsinh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arcsinh' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccosh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccosh' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carctanh [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arctanh' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carcsech [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arcsech' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccsch [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccsch' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Carccoth [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='arccoth' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cexp [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='exp' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cln [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='ln' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Clog [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='log' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cmean [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='mean' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Csdev [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='sdev' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cvar [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='var' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cmedian [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='median' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cmode [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='mode' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cmoment [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='moment' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cvector [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='vector' ?#1(definitionURL='#1')()/>" + . "#2" + . "</ltx:XMApp>", + afterDigest=>sub { remove_math_commas($_[1], 2); }); +DefConstructor('\Cmatrix [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok role='CONSTRUCTOR' meaning='matrix' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cdeterminant [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='determinant' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Ctranspose [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='transpose' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cselector [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='selector' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CvectorproductOp []', + "<ltx:XMTok meaning='vectorproduct' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cvectorproduct [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='vectorproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cscalarproduct [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='scalarproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\CouterproductOp []', + "<ltx:XMTok meaning='outerproduct' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Couterproduct [] {}{}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='outerproduct' role='OPFUNCTION' ?#1(definitionURL='#1')()/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "<ltx:XMArg>#3</ltx:XMArg>" + . "</ltx:XMApp>"); +DefConstructor('\Cintegers []', + "<ltx:XMTok meaning='integers' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Creals []', + "<ltx:XMTok meaning='reals' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Crationals []', + "<ltx:XMTok meaning='rationals' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnaturalnumbers []', + "<ltx:XMTok meaning='naturalnumbers' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ccomplexes []', + "<ltx:XMTok meaning='complexes' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cprimes []', + "<ltx:XMTok meaning='primes' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cexponentiale []', + "<ltx:XMTok meaning='exponentiale' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cimaginaryi []', + "<ltx:XMTok meaning='imaginaryi' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cnotanumber []', + "<ltx:XMTok meaning='notanumber' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ctrue []', + "<ltx:XMTok meaning='true' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cfalse []', + "<ltx:XMTok meaning='false' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cemptyset []', + "<ltx:XMTok meaning='emptyset' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cpi []', + "<ltx:XMTok meaning='pi' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Ceulergamma []', + "<ltx:XMTok meaning='eulergamma' role='ID' ?#1(definitionURL='#1')()/>"); +DefConstructor('\Cinfinit []', + "<ltx:XMTok meaning='infinit' role='ID' ?#1(definitionURL='#1')()/>"); +1; diff --git a/Master/texmf-dist/tex/latex/stex/cmathmlx.sty b/Master/texmf-dist/tex/latex/stex/cmathmlx.sty new file mode 100644 index 00000000000..dd9f04945f4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/cmathmlx.sty @@ -0,0 +1,14 @@ +%% +%% This is file `cmathmlx.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% cmathml.dtx (with options: `styx') +%% +\RequirePackage{presentation} +\def\CMathML@complement#1{#1^c} +\newcommand{\Ccomplement}[2][]{\CMathML@complement{#2}} +\endinput +%% +%% End of file `cmathmlx.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/cmathmlx.sty.ltxml b/Master/texmf-dist/tex/latex/stex/cmathmlx.sty.ltxml new file mode 100644 index 00000000000..93025278369 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/cmathmlx.sty.ltxml @@ -0,0 +1,22 @@ +%% +%% This is file `cmathmlx.sty.ltxml', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% cmathml.dtx (with options: `ltxmlx') +%% +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +use LaTeXML::Document; +RequirePackage('LaTeX'); +DefConstructor('\Ccomplement [] {}', + "<ltx:XMApp>" + . "<ltx:XMTok meaning='complement' role='CSYMBOL'/>" + . "<ltx:XMArg>#2</ltx:XMArg>" + . "</ltx:XMApp>"); +\endinput +%% +%% End of file `cmathmlx.sty.ltxml'. diff --git a/Master/texmf-dist/tex/latex/stex/cnx.cls b/Master/texmf-dist/tex/latex/stex/cnx.cls new file mode 100644 index 00000000000..ca898bce841 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/cnx.cls @@ -0,0 +1,141 @@ +%% +%% This is file `cnx.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% cnx.dtx (with options: `cls') +%% +\RequirePackage{keyval} +\RequirePackage{graphicx} +\DeclareOption{letterpaper} + {\setlength\paperheight {11in}% + \setlength\paperwidth {8.5in}} +\DeclareOption{a4paper} + {\setlength\paperheight {297mm}% + \setlength\paperwidth {210mm}} +\ExecuteOptions{letterpaper} +\ProcessOptions +\input{size10.clo} +\pagenumbering{roman} +\define@key{cnxmodule}{name}{\def\cnx@title{#1}} +\define@key{cnxmodule}{id}{} +\newenvironment{cnxmodule}[1][]{\setkeys{cnxmodule}{#1}}{} +\newenvironment{ccontent}{}{} +\newcounter{section} +\define@key{sectioning}{id}{} +\newenvironment{csection}[2][]% +{\stepcounter{section}\strut\\[1.5ex]\noindent% +{\Large\bfseries\arabic{section}.~{#2}}\\[1.5ex] +\setkeys{sectioning}{#1}} +{} +\newcounter{subsection}[section] +\newenvironment{csubsection}[2][] +{\refstepcounter{subsection}\strut\\[1ex]\noindent% +{\large\bfseries{\arabic{section}.\arabic{subsection}.~#2\\[1ex]}}% +\setkeys{sectioning}{#1}}% +{} +\newcounter{subsubsection}[subsection] +\newenvironment{csubsubsection}[2][] +{\refstepcounter{subsubsection}\strut\\[.5ex]\noindent +{\bfseries\arabic{section}.\arabic{subsection}.\arabic{subsubsecction}~#2\\[.5ex]}% +\setkeys{sectioning}{#1}}{} +\define@key{para}{id}{} +\newenvironment{cpara}[1][]{\setkeys{para}{#1}}{\par} +\define@key{note}{id}{} +\define@key{note}{type}{\def\note@type{#1}} +\newenvironment{cnote}[1][]% +{\setkeys{note}{#1}\par\noindent\strut\hfill\begin{minipage}{10cm}{\bfseries\note@type}:~}% +{\end{minipage}\hfill\strut\par} +\define@key{equation}{id}{} +\newenvironment{cequation}[1][]% +{\setkeys{equation}{#1}\begin{displaymath}} +{\end{displaymath}} +\define@key{cquote}{id}{} +\define@key{cquote}{type}{} +\define@key{cquote}{src}{} +\newenvironment{cquote}[1][]{% +\setkeys{cquote}{#1}\begin{center}\begin{minipage}{.8\textwidth}}{\end{minipage}\end{center}} +\newcommand{\litem}[2][]{\item[#1]\label{#2}} +\define@key{example}{id}{} +\define@key{example}{name}{\def\example@name{#1}} +\newenvironment{cexample}[1][]{\setkeys{example}{#1} +{\@ifundefined{example@name}{}{\noindent\bfseries{\example@name}}}} +{} +\newcounter{cexercise} +\define@key{cexercise}{id}{} +\define@key{cexercise}{name}{\def\cexercise@name{#1}} +\newenvironment{cexercise}[1][]{\setkeys{cexercise}{#1} +{\@ifundefined{cexercise@name}{}{\stepcounter{cexercise}\noindent\bfseries{\cexercise@name~\arabic{cexercise}}}}} +{} +\define@key{cproblem}{id}{} +\newenvironment{cproblem}[1][]{\setkeys{cproblem}{#1}}{}{} +\define@key{csolution}{id}{} +\newenvironment{csolution}[1][]{\setkeys{csolution}{#1}}{\par\noindent\bfseries{Solution}}{} +\define@key{rule}{id}{} +\define@key{rule}{name}{\def\rule@name{#1}} +\define@key{rule}{type}{\def\rule@type{#1}} +\newenvironment{crule}[1][]{\setkeys{rule}{#1}% +{\noindent\bfseries{\rule@type:}\@ifundefined{rule@name}{}{~(\rule@name)}}}% +{} +\define@key{statement}{id}{} +\newenvironment{statement}[1][]{\setkeys{statement}{#1}}{} +\define@key{proof}{id}{} +\newenvironment{proof}[1][]{\setkeys{proof}{#1}}{} +\define@key{definition}{term}{} +\define@key{definition}{id}{} +\define@key{definition}{seealso}{} +\newenvironment{definition}[1][]{\setkeys{definition}{#1}{\noindent\bfseries{Definition:}}}{} +\define@key{meaning}{id}{} +\newenvironment{cmeaning}[1][]{\setkeys{meaning}{#1}}{} +\define@key{cnxn}{document}{\def\cnxn@doc{#1}} +\define@key{cnxn}{target}{\def\cnxn@target{#1}} +\define@key{cnxn}{strength}{} +\newcommand{\cnxn}[2][]% keys, link text +{\setkeys{cnxn}{#1}{\underline{#2}}\footnote{{\ttfamily\@ifundefined{cnxn@doc}{\cnxn@doc}{}\#\cnxn@target}}} +\newcommand\@makefntext[1]{\parindent 1em\noindent\hb@xt@1.8em{\hss\@makefnmark}#1} +\define@key{link}{src}{} +\newcommand{\link}[2][]{\setkeys{link}{#1}\underline{#2}} +\define@key{cfigure}{id}{\def\cf@id{#1}} +\define@key{cfigure}{type}{} +\define@key{cfigure}{caption}{\def\cf@caption{#1}} +\newcounter{figure} +\newcommand{\cfigure}[3][]{% cnx_keys, graphicx_keys, path +\begin{center}% +\includegraphics[#2]{#3}% +\setkeys{cfigure}{#1}% +\@ifundefined{cfigure@caption}{}{{\par\noindent Figure\refstepcounter{figure}} {\arabic{figure}}: \cf@caption% +\protected@edef\@currentlabel{\arabic{figure}}% +\@ifundefined{cf@id}{}{\label{\cf@id}}}% +\end{center}} +\define@key{ccite}{src}{} +\newcommand{\ccite}[2][]{\setkeys{ccite}{#1}\emph{#2}} +\newcommand{\term}[1]{{\bfseries\underline{#1}}} +\define@key{metadata}{version}{} +\define@key{metadata}{created}{} +\define@key{metadata}{revised}{} +\newsavebox{\metadatabox} +\newenvironment{metadata}[1][]% +{\noindent\hfill\begin{lrbox}{\metadatabox} +\begin{minipage}{.8\textwidth}% +{\Large\bfseries CNX Module: \cnx@title\hfill\strut}\\[2ex]}% +{\end{minipage}\end{lrbox}\fbox{\usebox\metadatabox}\hfill} +\newenvironment{authorlist}{{\bfseries{Authors}:~}}{\\[1ex]} +\newenvironment{maintainerlist}{{\bfseries{Maintainers}:~}}{\\[1ex]} +\define@key{auth}{id}{} +\define@key{auth}{honorific}{\def\auth@honorific{#1}} +\define@key{auth}{firstname}{\def\auth@first{#1}} +\define@key{auth}{other}{\def\auth@other{#1}} +\define@key{auth}{surname}{\def\auth@sur{#1}} +\define@key{auth}{lineage}{\def\auth@line{#1}} +\define@key{auth}{email}{} +\newcommand{\cnxauthor}[1][]{\setkeys{auth}{#1}\auth@first~\auth@sur,} +\newcommand{\maintainer}[1][]{\setkeys{auth}{#1}\auth@first~\auth@sur,} +\newenvironment{keywordlist}{\bfseries{Keywords}:~}{\\[1ex]} +\newcommand{\keyword}[1]{#1,} +\newenvironment{cnxabstract}% +{\par\noindent\strut\hfill\begin{minipage}{10cm}{\bfseries{Abstract}:~}}% +{\end{minipage}\hfill} +\endinput +%% +%% End of file `cnx.cls'. diff --git a/Master/texmf-dist/tex/latex/stex/cnx.cls.ltxml b/Master/texmf-dist/tex/latex/stex/cnx.cls.ltxml new file mode 100644 index 00000000000..d29f6776607 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/cnx.cls.ltxml @@ -0,0 +1,281 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('keyval'); +RegisterNamespace('cnx'=>"http://cnx.rice.edu/cnxml"); +RegisterNamespace('md'=>"http://cnx.rice.edu/mdml/0.4"); +RegisterNamespace('bib'=>"http://bibtexml.sf.net/"); +RegisterNamespace('m'=>"http://www.w3.org/1998/Math/MathML"); +DocType("cnx:document", +"-//CNX//DTD CNXML 0.5 plus LaTeXML//EN", +"../dtd/cnxml+ltxml.dtd", +'#default'=>"http://cnx.rice.edu/cnxml", + 'md'=>"http://cnx.rice.edu/mdml/0.4", + 'bib'=>"http://bibtexml.sf.net/", + 'm'=>"http://www.w3.org/1998/Math/MathML", + 'ltx'=>"http://dlmf.nist.gov/LaTeXML"); +NewCounter('@itemizei', 'document', idprefix=>'I'); +NewCounter('@itemizeii', '@itemizei', idprefix=>'I'); +NewCounter('@itemizeiii', '@itemizeii', idprefix=>'I'); +NewCounter('@itemizeiv', '@itemizeiii',idprefix=>'I'); +NewCounter('@itemizev', '@itemizeiv', idprefix=>'I'); +NewCounter('@itemizevi', '@itemizev', idprefix=>'I'); + +NewCounter('enumi', '@itemizei', idprefix=>'i'); +NewCounter('enumii', '@itemizeii', idprefix=>'i'); +NewCounter('enumiii','@itemizeiii', idprefix=>'i'); +NewCounter('enumiv', '@itemizeiv', idprefix=>'i'); +# A couple of more levels, since we use these for ID's! +NewCounter('enumv', '@itemizev', idprefix=>'i'); +NewCounter('enumvi', '@itemizevi', idprefix=>'i'); + +DefMacro('\theenumi', '\arabic{enumi}'); +DefMacro('\theenumii', '\alph{enumii}'); +DefMacro('\theenumiii', '\roman{enumiii}'); +DefMacro('\theenumiv', '\Alph{enumiv}'); + +NewCounter('equation', 'document', idprefix=>'E'); +DefMacro('\theequation', '\arabic{equation}'); +DefMacro('\textwidth','16cm'); +Let('\thedocument@ID','\@empty'); +DefKeyVal('cnxmodule','name','Semiverbatim'); +DefKeyVal('cnxmodule','id','Semiverbatim'); + +DefEnvironment('{document}','<cnx:document>#body</cnx:document>', + beforeDigest=> sub { AssignValue(inPreamble=>0); }, + afterDigest=> sub { $_[0]->getGullet->flush; return; }); +DefEnvironment('{cnxmodule} OptionalKeyVals:cnxmodule', + "<cnx:name>&KeyVal('#1','name')</cnx:name>\n#body\n", + afterDigestBegin => sub { + AssignValue('cnxmodule_id', + KeyVal($_[1]->getArg(1), 'id')->toString, + 'global'); + }); +Tag('cnx:document', afterClose => sub { + $_[1]->setAttribute('id', LookupValue('cnxmodule_id')); + }); +DefEnvironment('{ccontent}',"<cnx:content>#body</cnx:content>"); +DefKeyVal('sectioning','id','Semiverbatim'); +DefEnvironment('{csection}OptionalKeyVals:sectioning{}', + "<cnx:section %&KeyVals(#1)>\n" + . "?#2(<cnx:name>#2</cnx:name>\n)()" + . "#body\n</cnx:section>\n"); +DefEnvironment('{csubsection}OptionalKeyVals:sectioning{}', + "<cnx:section %&KeyVals(#1)>\n" + . "?#2(<cnx:name>#2</cnx:name>\n)()" + . "#body\n</cnx:section>\n"); +DefEnvironment('{csubsubsection}OptionalKeyVals:sectioning{}', + "<cnx:section %&KeyVals(#1)>\n" + . "?#2(<cnx:name>#2</cnx:name>\n)()" + . "#body\n</cnx:section>\n"); +DefKeyVal('para','id','Semiverbatim'); +DefEnvironment('{cpara} OptionalKeyVals:para','<cnx:para %&KeyVals(#1)>#body</cnx:para>'); +sub number_para { + my($document,$node,$whatsit)=@_; + # Get prefix from first parent with an id. + my(@parents)=$document->findnodes('ancestor::*[@id]',$node); # find 1st id'd parent. + my $prefix= (@parents ? $parents[$#parents]->getAttribute('id')."." : ''); + # Get the previous number within parent; Worried about intervening elements around para's, but... + my(@siblings)=$document->findnodes("preceding-sibling::cnx:para",$node); + my $n=1; + $n = $1+1 if(@siblings && $siblings[$#siblings]->getAttribute('id')=~/(\d+)$/); + $node->setAttribute(id=>$prefix."p$n"); } +Tag('cnx:para',afterOpen=>\&number_para); +DefConstructor('\par',sub { $_[0]->maybeCloseElement('cnx:para'); },alias=>"\\par\n"); +Tag('cnx:para', autoClose=>1, autoOpen=>1); +DefKeyVal('note','id','Semiverbatim'); +DefKeyVal('note','type','Semiverbatim'); +DefEnvironment('{cnote}OptionalKeyVals:note','<cnx:note %&KeyVals(#1)>#body</cnx:note>'); +DefKeyVal('equation','id','Semiverbatim'); +DefEnvironment('{cequation} OptionalKeyVals:equation', + "<cnx:equation %&KeyVals(#1)>" + . "<ltx:Math mode='display'>" + . "<ltx:XMath>#body</ltx:XMath>" + . "</ltx:Math></cnx:equation>", + mode=>'display_math'); +DefKeyVal('cquote','id','Semiverbatim'); +DefKeyVal('cquote','type','Semiverbatim'); +DefKeyVal('cquote','src','Semiverbatim'); +DefEnvironment('{cquote} OptionalKeyVals:cquote', + "<cnx:quote %&KeyVals(#1)>#body</cnx:quote>"); +DefConstructor('\footnote[]{}',"<cnx:note type='foot'>#2</cnx:note>"); +DefConstructor('\emph{}',"<cnx:emphasis>#1</cnx:emphasis>"); +DefConstructor('\[', + "<cnx:equation id='#id'>" + . "<ltx:Math mode='display'>" + . "<ltx:XMath>" + . "#body" + . "</ltx:XMath>" + . "</ltx:Math>" + ."</cnx:equation>", + beforeDigest=> sub{ $_[0]->beginMode('display_math'); }, + captureBody=>1, + properties=> sub { RefStepID('equation') }); +DefConstructor('\]' ,"",beforeDigest=> sub{ $_[0]->endMode('display_math'); }); +DefConstructor('\[', + "<cnx:equation id='#id'>" + . "<ltx:Math mode='display'>" + . "<ltx:XMath>" + . "#body" + . "</ltx:XMath>" + . "</ltx:Math>" + ."</cnx:equation>", + beforeDigest=> sub{ $_[0]->beginMode('display_math'); }, + captureBody=>1, + properties=> sub { RefStepID('equation') }); +DefConstructor('\]' ,"",beforeDigest=> sub{ $_[0]->endMode('display_math'); }); + +DefMacro('\eqnarray', '\@@eqnarray\@start@alignment'); +DefMacro('\endeqnarray', '\@finish@alignment\end@eqnarray'); +DefMacro('\csname eqnarray*\endcsname', '\@@eqnarray*\@start@alignment'); +DefMacro('\csname endeqnarray*\endcsname', '\@finish@alignment\end@eqnarray'); +DefConstructor('\@@eqnarray OptionalMatch:* AlignmentBody:\end@eqnarray', + sub { + my($document,$star,$body,%props)=@_; + $document->openElement('cnx:equation',refnum=>$props{refnum},id=>$props{id}); + $document->openElement('ltx:Math',mode=>'display'); + $document->openElement('ltx:XMath'); + constructAlignment($document,$body,attributes=>{name=>'eqnarray'}); + $document->closeElement('ltx:XMath'); + $document->closeElement('ltx:Math'); + $document->closeElement('cnx:equation'); }, + mode=>'display_math', + beforeDigest=>sub { alignmentBindings('rcl'); }, + properties=> sub { ($_[1] ? RefStepID('equation') : RefStepCounter('equation')); }, + afterDigest=>sub { + $_[1]->setProperty(body=>$_[1]->getArg(2));}, # So we get TeX + reversion=>'\begin{eqnarray#1}#2\end{eqnarray#1}'); +Tag('cnx:item', autoClose=>1); +DefConstructor('\item[]',"<cnx:item>?#1(<cnx:name>#1</cnx:name>)"); +DefConstructor('\litem[]{}',"<cnx:item id='#2'>?#1(<cnx:name>#1</cnx:name>)"); +DefConstructor('\itemize@item[]', + "<cnx:item id='#id'>?#1(<cnx:name>#1</cnx:name>)", + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\enumerate@item[]', + "<cnx:item id='#id'>?#1(<cnx:name>#1</cnx:name>)", + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\description@item[]', + "<cnx::item id='#id'>?#1(<cnx:name>#1</cnx:name>)", + properties=>sub{ RefStepItemCounter(); }); +AssignValue(itemlevel=>0); +DefEnvironment('{itemize}', + "<cnx:list id='#id' type='itemize'>#body</cnx:list>", + properties=>sub { beginItemize('itemize'); }); +DefEnvironment('{enumerate}', + "<cnx:list type='enumerate' id='#id'>#body</cnx:list>", + properties=>sub { beginItemize('enumerate'); }); +DefEnvironment('{description}', + "<cnx:list type='description' id='#id'>#body</cnx:list>", + properties=>sub { beginItemize('description'); }); +DefEnvironment('{center}','#body'); +DefEnvironment('{minipage}{}','#body'); +DefEnvironment('{small}','#body'); +DefEnvironment('{footnotesize}','#body'); +DefEnvironment('{tiny}','#body'); +DefEnvironment('{scriptsize}','#body'); +DefConstructor('\ref Semiverbatim', "<cnx:cnxn target='#1'>&LookupValue('LABEL@#1')</cnx:cnxn>"); +DefKeyVal('example','id','Semiverbatim'); +DefEnvironment('{cexample}OptionalKeyVals:example', + "<cnx:example %&KeyVals(#1)>#body</cnx:example>"); +DefKeyVal('cexercise','id','Semiverbatim'); +DefKeyVal('cexercise','name','Semiverbatim'); +DefEnvironment('{cexercise}OptionalKeyVals:exercise', + "<cnx:exercise ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>" + . "#body" + . "</cnx:exercise>"); +DefKeyVal('cproblem','id','Semiverbatim'); +DefKeyVal('cproblem','name','Semiverbatim'); +DefEnvironment('{cproblem}OptionalKeyVals:cproblem', + "<cnx:problem ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'name')(<cnx:name>&KeyVal(#1,'name')</cnx:name>\n)()" + . "#body" + . "</cnx:problem>"); +DefKeyVal('csolution','id','Semiverbatim'); +DefKeyVal('csolution','name','Semiverbatim'); +DefEnvironment('{csolution}OptionalKeyVals:cproblem', + "<cnx:solution ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'name')(<cnx:name>&KeyVal(#1,'name')</cnx:name>\n)()" + . "#body" + . "</cnx:solution>"); +DefKeyVal('rule','id','Semiverbatim'); +DefKeyVal('rule','name','Semiverbatim'); +DefKeyVal('rule','type','Semiverbatim'); +DefEnvironment('{crule}OptionalKeyVals:rule', + "<cnx:rule ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')() type='&KeyVal(#1,'type')'>\n" + . "?&KeyVal(#1,'name')(<cnx:name>&KeyVal(#1,'name')</cnx:name>\n)()" + . "\n#body\n" + . "</cnx:rule>\n"); +DefKeyVal('statement','id','Semiverbatim'); +DefEnvironment('{statement}OptionalKeyVals:statement','<cnx:statement %&KeyVals(#1)>#body</cnx:statement>'); +DefKeyVal('proof','id','Semiverbatim'); +DefEnvironment('{proof}OptionalKeyVals:proof','<cnx:proof %&KeyVals(#1)>#body</cnx:proof>'); +DefKeyVal('definition','id','Semiverbatim'); +DefKeyVal('definition','term','Semiverbatim'); +DefKeyVal('definition','seealso','Semiverbatim'); +DefEnvironment('{definition}OptionalKeyVals:definition', + "<cnx:definition ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>\n" + . "?&KeyVal(#1,'term')(<cnx:term>&KeyVal(#1,'term')</cnx:term>\n)()" + . "\n#body\n" + . "?&KeyVal(#1,'seealso')(<cnx:seealso><cnx:term>&KeyVal(#1,'term')</cnx:term></cnx:seealso>\n)()" + . "</cnx:definition>\n"); +DefKeyVal('meaning','id','Semiverbatim'); +DefEnvironment('{cmeaning}OptionalKeyVals:meaning','<cnx:meaning %&KeyVals(#1)>#body</cnx:meaning>'); +DefKeyVal('cnxn','document','Semiverbatim'); +DefKeyVal('cnxn','target','Semiverbatim'); +DefKeyVal('cnxn','strength','Semiverbatim'); +DefConstructor('\cnxn OptionalKeyVals:cnxn {}','<cnx:cnxn %&KeyVals(#1)>#1</cnx:cnxn>'); +DefKeyVal('link','src','Semiverbatim'); +DefConstructor('\link OptionalKeyVals:link {}','<cnx:link %&KeyVals(#1)>#2</cnx:link>'); +DefKeyVal('cfigure','id','Semiverbatim'); +DefKeyVal('cfigure','name','Semiverbatim'); +DefKeyVal('cfigure','type','Semiverbatim'); +DefKeyVal('cfigure','caption','Semiverbatim'); +DefConstructor('\cfigure OptionalKeyVals:cfigure Semiverbatim Semiverbatim', + "<cnx:figure ?&KeyVal(#1,'id')(id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'name')(<cnx:name>&KeyVal(#1,'name')</cnx:name>\n)()" + . "<cnx:media type='&KeyVal(#1,'type')' src='#3'/>" + . "?&KeyVal(#1,'caption')(<cnx:caption>&KeyVal(#1,'caption')</cnx:caption>\n)()" + . "</cnx:figure>"); +DefKeyVal('ccite','src','Semiverbatim'); +DefConstructor('\ccite OptionalKeyVals:ccite {}','<cnx:cite %&KeyVals(#1)>#2</cnx:cite>'); +DefConstructor('\term[]{}',"<cnx:term>#2</cnx:term>"); +DefKeyVal('metadata','version','Semiverbatim'); +DefKeyVal('metadata','created','Semiverbatim'); +DefKeyVal('metadata','revised','Semiverbatim'); +DefEnvironment('{metadata}OptionalKeyVals:metadata', + "<cnx:metadata>\n" + . "<md:version>&KeyVal('#1','version')</md:version>\n" + . "<md:created>&KeyVal('#1','created')</md:created>\n" + . "<md:revised>&KeyVal('#1','revised')</md:revised>\n" + . "#body\n" + . "</cnx:metadata>"); +DefEnvironment('{authorlist}',"<md:authorlist>#body</md:authorlist>"); +DefEnvironment('{maintainerlist}',"<md:maintainerlist>#body</md:maintainerlist>"); +DefKeyVal('auth','id','Semiverbatim'); +DefKeyVal('auth','firstname','Semiverbatim'); +DefKeyVal('auth','surname','Semiverbatim'); +DefKeyVal('auth','email','Semiverbatim'); +DefConstructor('\cnxauthor OptionalKeyVals:auth', + "<md:author id='&KeyVal('#1','id')'>\n" + . "?&KeyVal(#1,'honorific')(<md:honorific>&KeyVal('#1','honorific')</md:honorific>\n)()" + . "?&KeyVal(#1,'firstname')(<md:firstname>&KeyVal('#1','firstname')</md:firstname>\n)()" + . "?&KeyVal(#1,'other')(<md:other>&KeyVal('#1','other')</md:other>\n)()" + . "?&KeyVal(#1,'surname')(<md:surname>&KeyVal('#1','surname')</md:surname>\n)()" + . "?&KeyVal(#1,'lineage')(<md:lineage>&KeyVal('#1','lineage')</md:lineage>\n)()" + . "?&KeyVal(#1,'email')(<md:email>&KeyVal('#1','email')</md:email>\n)()" + . "</md:author>\n"); +DefConstructor('\maintainer OptionalKeyVals:auth', + "<md:maintainer id='&KeyVal('#1','id')'>\n" + . "?&KeyVal(#1,'honorific')(<md:honorific>&KeyVal('#1','honorific')</md:honorific>\n)()" + . "?&KeyVal(#1,'firstname')(<md:firstname>&KeyVal('#1','firstname')</md:firstname>\n)()" + . "?&KeyVal(#1,'other')(<md:other>&KeyVal('#1','other')</md:other>\n)()" + . "?&KeyVal(#1,'surname')(<md:surname>&KeyVal('#1','surname')</md:surname>\n)()" + . "?&KeyVal(#1,'lineage')(<md:lineage>&KeyVal('#1','lineage')</md:lineage>\n)()" + . "?&KeyVal(#1,'email')(<md:email>&KeyVal('#1','email')</md:email>\n)()" + . "</md:maintainer>\n"); +DefEnvironment('{keywordlist}',"<md:keywordlist>\n#body\n</md:keywordlist>"); +DefConstructor('\keyword {}',"<md:keyword>#1</md:keyword>"); +DefEnvironment('{cnxabstract} OptionalKeyVals:cnxabstract', + "<md:abstract>\n#body\n</md:abstract>\n"); +1; diff --git a/Master/texmf-dist/tex/latex/stex/modules.sty b/Master/texmf-dist/tex/latex/stex/modules.sty new file mode 100644 index 00000000000..49ce55bc45c --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/modules.sty @@ -0,0 +1,145 @@ +%% +%% This is file `modules.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% modules.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{modules}[2006/01/13 v0.9a Semantic Markup] + +\newif\ifmod@env\mod@envfalse +\newif\ifmod@id\mod@idfalse +\newif\ifmod@display\mod@displayfalse +\newif\ifmod@uses\mod@usesfalse +\newif\ifmod@usesqualified\mod@usesqualifiedfalse +\DeclareOption{env}{\mod@envtrue} +\DeclareOption{id}{\mod@idtrue} +\DeclareOption{uses}{\mod@usestrue} +\DeclareOption{display}{\mod@displaytrue} +\DeclareOption{usesqualified}{\mod@usesqualifiedtrue} +\def\modtrue{\mod@idtrue\mod@usestrue\mod@displaytrue\mod@usesqualifiedtrue} +\DeclareOption{draft}{\modtrue} +\DeclareOption{all}{\modtrue} +\ProcessOptions +\RequirePackage{keyval}[1997/11/10] +\define@key{module}{cd}{} +\define@key{module}{id}{% + \edef\this@module{\expandafter\noexpand\csname module@defs@#1\endcsname}% + \edef\this@qualified@module{\expandafter\noexpand\csname module@defs@qualified@#1\endcsname}% + \global\@namedef{module@defs@#1}{} + \global\@namedef{module@defs@qualified@#1}{} + \def\mod@id{#1}} +\newenvironment{module}[1][]{\setkeys{module}{#1}\ifmod@env\show@mod@keys{module}\fi}{} +\def\show@mod@keys@aux{% +\@ifundefined{mod@id}{}{\ifmod@id{id=\mod@id},\fi}% +\@ifundefined{mod@display}{}{\ifmod@display{display=\mod@display}\fi} +\@ifundefined{mod@uses}{\relax}{\ifmod@uses{uses=\mod@uses},\fi} +\@ifundefined{mod@usesqualified}\relax\else + \ifmod@usesqualified{usesqualified=\mod@usesqualified},\fi\fi} +\def\clear@mod@keys{\let\mod@usesqualified=\relax\mod@uses=\relax + \let\st@id=\relax\let\st@display=\relax} +\def\show@mod@keys#1{\footnote{#1[\show@mod@keys@aux]}\clear@mod@keys} +\def\activate@defs#1{\csname module@defs@#1\endcsname} +\def\export@defs#1{\@ifundefined{mod@id}{}{ + \expandafter\expandafter\expandafter + \g@addto@macro\expandafter + \this@module\expandafter{\csname module@defs@#1\endcsname}}} +\newcommand{\importmodule}[2][]{\def\@test{#1}% +\ifx\@test\@empty\else\requiremodules{#1}\fi +\activate@defs{#2}\export@defs{#2}} +\define@key{symdef}{aliases}{} +\define@key{symdef}{local}[true]{\@symdeflocaltrue} +\define@key{symdef}{cmml}{} +\define@key{symdef}{cattrs}{} +\define@key{symdef}{definitionURL}{} +\newif\if@symdeflocal +\def\symdef{\@ifnextchar[{\@symdef}{\@symdef[]}} +\def\@symdef[#1]#2{\@ifnextchar[{\@@symdef[#1]{#2}}{\@@symdef[#1]{#2}[0]}} +\def\@@symdef[#1]#2[#3]#4{% +\@symdeflocalfalse\setkeys{symdef}{#1} + \expandafter\providecommand\csname modules@#2@pres\endcsname[#3]{#4} + \expandafter\def\csname#2\endcsname{\csname modules@#2@pres\endcsname} + \if@symdeflocal\else + \@ifundefined{mod@id}{}{ + \expandafter\g@addto@macro\this@module{\expandafter\providecommand\csname modules@#2@pres\endcsname[#3]{#4}}% + \expandafter\g@addto@macro\this@module{\expandafter\def\csname#2\endcsname{\csname modules@#2@pres\endcsname}} + \expandafter\g@addto@macro\this@qualified@module{\expandafter\providecommand\csname modules@#2@pres@qualified\endcsname[#3]{#4}}% + \expandafter\g@addto@macro\this@qualified@module{\expandafter\def\csname#2atqualified\endcsname{\csname modules@#2@pres@qualified\endcsname}} + }\fi} +\def\redefine#1[#2]#3{\expandafter\renewcommand\csname modules@#1@pres\endcsname[#2]{#3}} +\let\abbrdef\symdef +\def\mod@simplify#1{\expandafter\mod@simpl#1/\relax} +\def\mod@simpl#1/#2\relax{%\message{ 1 = #1, 2 = #2 }% +\def\mod@test{}\ifx\mod@blaaaa\mod@test\edef\mod@savedprefix{}\def\mod@blaaaa{aaa}\else\fi +\def\mod@comp{#2}\ifx\mod@test\mod@comp\edef\mod@savedprefix{\mod@savedprefix#1}% +\else\mod@simplhelp#1/#2\relax\fi} +\def\mod@simplhelp#1/#2/#3\relax{% +\def\mod@test{}\def\mod@tust{#2}\def\mod@tist{#3}\def\mod@tost{..}\ifx\mod@test\mod@tist% +\ifx\mod@tost\mod@tust\edef\mod@savedprefix{}\else\edef\mod@savedprefix +{\mod@savedprefix#1/#2}\fi \else\ifx\mod@tost\mod@tust\mod@simpl#3\relax% +\else\edef\mod@savedprefix{\mod@savedprefix#1/}\mod@simplhelp#2/#3\relax\fi\fi}% +\newif\ifmodules +\gdef\reg{} +\def\mod@update#1{\def\mod@empty{} +\ifx\reg\mod@empty\xdef\reg{#1}\else\xdef\reg{#1@\reg}\fi} +\def\mod@check#1@#2///#3\relax{% +\def\mod@empty{}\def\mod@one{#1}\def\mod@two{#2}\def\mod@three{#3}% +\expandafter\ifx\mod@three\mod@one\modulestrue\else\ifx\mod@two\mod@empty\modulesfalse% +\else\mod@check#2///#3\relax\fi\fi} +\def\mod@search#1{% +\modulesfalse\expandafter\mod@check\reg @///#1\relax% +\ifmodules\else\mod@update{#1}\fi} +\def\mod@reguse#1{\modulesfalse\expandafter\mod@check\reg @///#1\relax} +\def\mod@prefix{} +\def\mod@updatedpre#1{ + \edef\mod@prefix{\mod@prefix\mod@pathprefix@check#1/\relax}} +\def\mod@pathprefix@check#1/#2\relax{% +\ifx\\#2\\% no slash in string +\else\mod@ReturnAfterFi{#1/\mod@pathprefix@help#2\relax}% +\fi} +\def\mod@pathprefix@help#1/#2\relax{% +\ifx\\#2\\% end of recursion +\else\mod@ReturnAfterFi{#1/\mod@pathprefix@help#2\relax}% +\fi} +\long\def\mod@ReturnAfterFi#1\fi{\fi#1} +\def\mod@pathpostfix@check#1/#2\relax{% slash +\ifx\\#2\\%no slash in string +#1\else\mod@ReturnAfterFi{\mod@pathpostfix@help#2\relax}% +\fi} +\def\mod@pathpostfix@help#1/#2\relax{% +\ifx\\#2\\% +#1\else\mod@ReturnAfterFi{\mod@pathpostfix@help#2\relax}% +\fi} +\def\mod@updatedpost#1{% +\edef\mod@savedprefix{\mod@savedprefix\mod@pathpostfix@check#1/\relax} } +\def\mod@updatesms{\edef\mod@savedprefix{\mod@savedprefix.sms}} +\newcommand{\requiremodules}[1]{% +{\mod@updatedpre{#1} % add the new file to the already existing path +\let\mod@savedprefix\mod@prefix % add the path to the new file to the prefix +\mod@updatedpost{#1} +\def\mod@blaaaa{} % macro used in the simplify function (remove .. from the prefix) +\mod@simplify{\mod@savedprefix} % remove |xxx/..| from the path (in case it exists) +\mod@reguse{\mod@savedprefix} +\ifmodules\else +\mod@updatesms % update the file to contain the .sms extension +\let\newreg\reg % use to compare, in case the .sms file was loaded before +\mod@search{\mod@savedprefix} % update registry +\ifx\newreg\reg\else\input{\mod@savedprefix}\fi % check if the registry was updated and load if necessary +\fi}} +\def\sinput#1{ +{\mod@updatedpre{#1} % add the new file to the already existing path +\let\mod@savedprefix\mod@prefix % add the path to the new file to the prefix +\mod@updatedpost{#1} +\def\mod@blaaaa{} % macro used in the simplify function (remove .. from the prefix) +\mod@simplify{\mod@savedprefix} % remove |xxx/..| from the path (in case it exists) +\mod@reguse{\mod@savedprefix} +\let\newreg\reg % use to compare, in case the .sms file was loaded before +\mod@search{\mod@savedprefix} % update registry +\ifx\newreg\reg%\message{This file has been previously introduced} +\else\input{\mod@savedprefix}\fi}} +\def\requirepackage#1#2{\makeatletter\input{#1.sty}\makeatother} +\endinput +%% +%% End of file `modules.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/modules.sty.ltxml b/Master/texmf-dist/tex/latex/stex/modules.sty.ltxml new file mode 100644 index 00000000000..4d1313374a4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/modules.sty.ltxml @@ -0,0 +1,246 @@ + +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Global; +use LaTeXML::Package; +RequirePackage('keyval'); +DefKeyVal('Module','cd','Semiverbatim'); +DefKeyVal('Module','id','Semiverbatim'); +DefEnvironment('{module} OptionalKeyVals:Module', + "?#excluded()(<omdoc:theory ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')> #body</omdoc:theory>)", +#closed bracket ) seems to work fine now + +#commented this out - do we need current_theory? +#plus: keyvals->getValue seems to be undefined?! + + #beforeConstruct=> sub { + #my ($doc, $keyvals, %props) = @_; + #my $theory = $keyvals->getValue('id') if $keyvals; + #$theory = ref $theory ? $theory->toString : 'UNDEFINED'; + #AssignValue(current_theory => $theory); + #return;}, +# $Doc->openElement('omdoc:theory', 'xml:id' => $theory); +# my $uses = $keyvals->getValue('usses'); +# $uses = ref $uses ? $uses->toString || '' : ''; +# $uses =~ s/\s+//g; $uses=~ s/^\{//; $uses=~ s/\}$//; +# my $module_paths = LookupValue('module_paths') || {}; +# foreach my $used(split(',',$uses)) { +# my $file = $module_paths->{$used}; $file .= '.omdoc#' if $file; +# $doc->openElement('omdoc:imports', 'from' => $file.$used); +# $doc->closeElement('omdoc:imports'); } +# $doc->absorb($props{body}) if $props{body}; +# $doc->closeElement('omdoc:theory'); } +# return; }, + beforeDigest=>\&useTheoryItemizations, + afterDigestBegin=>sub { + my($stomach, $whatsit)=@_; + $whatsit->setProperty(excluded=>LookupValue('excluding_modules')); + + my $keys = $whatsit->getArg(1); + my($id, $cd)=$keys + && map(ToString($keys->getValue($_)),qw(id cd)); + $cd = $id unless $cd; + # update the catalog with paths for modules + my $module_paths = LookupValue('module_paths') || {}; + $module_paths->{$id} = LookupValue('last_module_path'); + AssignValue('module_paths', $module_paths, 'global'); + + #Update the current module position + AssignValue(current_module => $id); + AssignValue(module_cd => $cd) if $cd; +# my @uses = (); +# if($uses){ +# $uses =~ s/\s//g; $uses=~ s/^\{//; $uses=~ s/\}$//; +# @uses = split(',',$uses); } +############### AssignValue("module_${id}_uses" => [@uses], 'global'); +#Idea: introdcue global list of used modules and activateScope on it once at the +# main block. + #use_module($id); #22.02.08 need to ALWAYS invoke this to make things global + + #activate the module in our current scope + $STATE->activateScope("module:".$id); #changed from use_module as only needs to take care of current module + return; }); +sub use_module { + my($module)=@_; + $module = ToString($module); + # Depth-first load definitions from used modules + foreach my $used_module (@{ LookupValue("module_${module}_uses") || []}){ + use_module($used_module); } + # then load definitions for this module + $STATE->activateScope("module:$module"); } +DefConstructor('\importmodule[]{}',"<omdoc:imports from='?#1(#1)\# #2'/>", + afterDigest=>sub { + my($stomach,$whatsit)=@_; + my $file = $whatsit->getArg(1); + my $module = $whatsit->getArg(2); + $module = ToString($module); + #if filepath is not supply simply look for the $module.sms file + if (!$file) {$file=ToString($module)}; + my $containing_module = LookupValue('current_module'); + #set the relation between the current module and the one to be imported + PushValue("module_".$containing_module."_uses"=>$module); + #check if we've already loaded this module + if(LookupValue('module_'.$module.'_loaded')) {use_module($module);} #if so activate it! + else { + #if not: + my $gullet = $stomach->getGullet; + #1) mark as loaded + AssignValue('module_'.$module.'_loaded' => 1, 'global'); + #open a group for its definitions so that they are localized + $stomach->bgroup; + #update the last module path + AssignValue('last_module_path', $file); + #queue the closing tag for this module in the gullet where it will be executed + #after all other definitions of the imported module have been taken care of + $gullet->unread(Invocation(T_CS('\end@requiredmodule'), T_OTHER($module))->unlist); + #we only need to load the sms definitions without generating any xml output, so we set the flag to 1 + AssignValue('excluding_modules' => 1); + #queue this module's sms file in the gullet so that its definitions are imported + $gullet->input($file,['sms']); + } + return;}); +DefKeyVal('symdef','aliases','Semiverbatim'); +DefKeyVal('symdef','local','Semiverbatim','true'); +DefKeyVal('symdef','cmml','Semiverbatim','true'); +DefKeyVal('symdef','cattrs','Semiverbatim','true'); +DefKeyVal('symdef','definitionURL','Semiverbatim','true'); +DefMacro('\symdef OptionalKeyVals:symdef {}[][]{}', + sub { +my($self,@args)=@_; +# print STDERR "excluding" if LookupValue('excluding_modules'); +((Invocation(T_CS('\@symdef'),@args)->unlist), + (LookupValue('excluding_modules') ? () + : (Invocation(T_CS('\@symdef@pres'), @args)->unlist))); +}); + +DefPrimitive('\@symdef OptionalKeyVals:symdef {}[][]{}', sub { + my($stomach,$keys,$cs,$nargs,$opt,$presentation)=@_; + my($name,$cd,$role,$cmml,$cattrs,$definitionURL)=$keys + && map($_ && $_->toString,map($keys->getValue($_), qw(name cd role cmml cattrs definitionURL))); + $cd = LookupValue('module_cd') unless $cd; + $nargs = (ref $nargs ? $nargs->toString : $nargs || 0); + my $module = LookupValue('current_module'); +# print STDERR "Define ".Stringify($cs)." in $module\n"; + my $scope = (($keys && ($keys->getValue('local') || '' eq 'true')) ? 'module_local' : 'module').":".$module; + my $attr="name='#name' meaning='#meaning' omcd='#omcd'"; + DefConstructorI("\\".$cs->toString,convertLaTeXArgs($nargs,$opt), + ($nargs == 0 + ? "<ltx:XMTok $attr scriptpos='#scriptpos'/>" + : "<ltx:XMApp scriptpos='#scriptpos'>" + . "<ltx:XMTok $attr scriptpos='#operator_scriptpos'/>" + . join('',map("<ltx:XMArg>#$_</ltx:XMArg>", (1..$nargs))) + ."</ltx:XMApp>"), + properties => {name=>$name, meaning=>$cs->toString,omcd=>$cd,role => $role}, + scope=>$scope); + return; }); +DefPrimitive('\abbrdef OptionalKeyVals:symdef {}[][]{}', sub { + my($stomach,$keys,$cs,$nargs,$opt,$presentation)=@_; + my $module = LookupValue('current_module'); + my $scope = (($keys && ($keys->getValue('local') || '' eq 'true')) ? 'module_local' : 'module').":$module"; + DefMacroI("\\".$cs->toString,convertLaTeXArgs($nargs,$opt),$presentation, + scope=>$scope); + return; }); +DefPrimitive('\requiremodules{}', sub { + my($stomach,$module)=@_; + my $GULLET = $stomach->getGullet; + $module = Digest($module)->toString; + if(LookupValue('module_'.$module.'_loaded')) {} + else { + AssignValue('module_'.$module.'_loaded' => 1, 'global'); + $stomach->bgroup; + AssignValue('last_module_path', $module); + $GULLET->unread(T_CS('\end@requiredmodule')); + AssignValue('excluding_modules' => 1); + $GULLET->input($module,['sms']); + } + return;}); + +DefPrimitive('\end@requiredmodule{}',sub { + #close the group + $_[0]->egroup; + #print STDERR "END: ".ToString(Digest($_[1])->toString); + #Take care of any imported elements in this current module by activating it and all its dependencies + #print STDERR "Important: ".ToString(Digest($_[1])->toString)."\n"; + use_module(ToString(Digest($_[1])->toString)); + return; }); +DefPrimitive('\sinput{}', sub { + my($stomach,$module)=@_; + my $GULLET = $stomach->getGullet; + $module = Digest($module)->toString; + AssignValue('module_'.$module.'_loaded' => 1, 'global'); + $stomach->bgroup; + AssignValue('last_module_path', $module); + $GULLET->unread(Invocation(T_CS('\end@requiredmodule'),T_OTHER($module))->unlist); + $GULLET->input($module,['tex']); + return;}); +DefMacro('\@symdef@pres OptionalKeyVals:symdef {}[][]{}', sub { + my($self,$keys, $cs,$nargs,$opt,$presentation)=@_; + Invocation(T_CS('\@symdef@pres@aux'), + $cs, + ($nargs || Tokens(T_OTHER(0))), + symdef_presentation_pmml($cs,ToString($nargs)||0,$presentation), + symdef_presentation_TeX($presentation), + $keys)->unlist; }); +sub symdef_presentation_pmml { + my($cs,$nargs,$presentation)=@_; + my @toks = $presentation->unlist; + while(@toks && $toks[0]->equals(T_SPACE)){ pop(@toks); } # Remove leading space + $presentation = Tokens(@toks); + # Wrap with \@use, unless already has a recognized formatter. + $presentation = Invocation(T_CS('\@use'),$presentation) # Using simple text for now, until getting a proper \@use + unless @toks && ($toks[0]->toString =~ /^\\(infix|prefix|postfix|assoc|use|mixfixi|mixfixa|mixfixii|mixfixia|mixfixai|mixfixiii)$/); + # Low level substitution. + my @args = map(Invocation(T_CS('\@SYMBOL'),T_OTHER("pres_arg:".($_+1))),1..$nargs); + $presentation = Tokens(LaTeXML::Expandable::substituteTokens($presentation,@args)); + $presentation; } +DefConstructor('\@use {}', + "<omdoc:prototype>" + . "<om:OMS cd='' name=''/>" + ."</omdoc:prototype>" + ."<omdoc:rendering>" + . "<ltx:Math><ltx:XMath>#1</ltx:XMath></ltx:Math>" + ."</omdoc:rendering>", + mode=>'inline_math'); +sub get_cd { + my($name,$cd,$role,$cmml,$cattrs,$definitionURL)=@_; + return $cd;} +DefConstructor('\@symdef@pres@aux{}{}{}{} OptionalKeyVals:symdef', + "<omdoc:symbol name='#1'/>" + ."<omdoc:notation name='#name' cd='&get_cd(#5)'>" + ."#3" + ."</omdoc:notation>", + afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $keys = $whatsit->getArg(5); + my $module = LookupValue('current_module'); + $whatsit->setProperties(for=>ToString($whatsit->getArg(1))); + $whatsit->setProperty(role=>($keys ? $keys->getValue('role') + : (ToString($whatsit->getArg(2)) ? 'applied' + : undef))); }); +sub symdef_presentation_TeX { + my($presentation)=@_; + my @tokens = $presentation->unlist; + my(@frag,@frags) = (); + while(my $tok = shift(@tokens)){ + if($tok->equals(T_PARAM)){ + push(@frags,Invocation(T_CS('\@symdef@pres@text'),Tokens(@frag))) if @frag; + @frag=(); + my $n = shift(@tokens)->getString; + push(@frags,Invocation(T_CS('\@symdef@pres@arg'),T_OTHER($n+1))); } + else { + push(@frag,T_OTHER($tok->getString)); }} # IMPORTANT! Neutralize the tokens! + push(@frags,Invocation(T_CS('\@symdef@pres@text'),Tokens(@frag))) if @frag; + Tokens(map($_->unlist,@frags)); } + +DefConstructor('\@symdef@pres@arg{}', "<omdoc:recurse select='#select'/>", + afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $select = $whatsit->getArg(1); + $select = ref $select ? $select->toString : ''; + $whatsit->setProperty(select=>"*[".$select."]"); }); + +DefConstructor('\@symdef@pres@text{}', "<omdoc:text>#1</omdoc:text>"); +DefConstructor('\requirepackage{} Semiverbatim',"<omdoc:imports from='#2'/>", + afterDigest=>sub { my ($stomach, $whatsit) = @_; + my $select = $whatsit->getArg(1); + RequirePackage($select->toString); }); +1; diff --git a/Master/texmf-dist/tex/latex/stex/omdoc.cls b/Master/texmf-dist/tex/latex/stex/omdoc.cls new file mode 100644 index 00000000000..0e19acb0bd3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc.cls @@ -0,0 +1,15 @@ +%% +%% This is file `omdoc.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% omdoc.dtx (with options: `cls') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesClass{omdoc}[2007/09/09 v0.3 OMDoc Documents] +\LoadClass{article} +\RequirePackage{omdoc} +\endinput +%% +%% End of file `omdoc.cls'. diff --git a/Master/texmf-dist/tex/latex/stex/omdoc.cls.ltxml b/Master/texmf-dist/tex/latex/stex/omdoc.cls.ltxml new file mode 100644 index 00000000000..e197af2a37d --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc.cls.ltxml @@ -0,0 +1,22 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +LoadClass('article'); +RegisterNamespace('omdoc'=>"http://www.mathweb.org/omdoc"); # OMDoc namespace +RegisterNamespace(om=>"http://www.openmath.org/OpenMath"); +RegisterNamespace('m'=>"http://www.w3.org/1998/Math/MathML"); +RegisterNamespace('dc'=>"http://purl.org/dc/elements/1.1/"); +RegisterNamespace('cc'=>"http://creativecommons.org/ns"); +RelaxNGSchema('/Users/kohlhase/stex/rnc/omdoc+ltxml', + '#default'=>"http://www.mathweb.org/omdoc", + 'om'=>"http://www.openmath.org/OpenMath", + 'm'=>"http://www.w3.org/1998/Math/MathML", + 'dc'=>"http://purl.org/dc/elements/1.1/", + 'cc'=>"http://creativecommons.org/ns", + 'ltx'=>"http://dlmf.nist.gov/LaTeXML"); +RequirePackage('omdoc'); +DefEnvironment('{document}','<omdoc:omdoc>#body</omdoc:omdoc>', + beforeDigest=> sub { AssignValue(inPreamble=>0); }, + afterDigest=> sub { $_[0]->getGullet->flush; return; }); +1; diff --git a/Master/texmf-dist/tex/latex/stex/omdoc.sty b/Master/texmf-dist/tex/latex/stex/omdoc.sty new file mode 100644 index 00000000000..38d365517dc --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc.sty @@ -0,0 +1,83 @@ +%% +%% This is file `omdoc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% omdoc.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{omdoc}[2007/09/09 v0.3 OMDoc document Structure] +\RequirePackage{keyval}[1997/11/10] +\define@key{omgroup}{id}{\label{#1}} +\define@key{omgroup}{type}{\def\omgroup@type{#1}} +\define@key{omgroup}{display}{\def\omgroup@display{#1}} +\def\omgroup@flow{flow} +\newcount\section@level\section@level=1 +\newenvironment{omgroup}[2][]% title +{\setkeys{omgroup}{#1} +\ifx\omgroup@display\omgroup@flow{#2}\else +\ifnum\section@level=1\section{#2}\fi +\ifnum\section@level=2\subsection{#2}\fi +\ifnum\section@level=3\subsubsection{#2}\fi +\ifnum\section@level=4\paragraph{#2}\fi +\advance\section@level by 1\fi}{} +\def\tgroup{\omgroup}\def\endtgroup{\endomgroup} +\define@key{stat}{id}{\def\st@id{#1}} +\define@key{stat}{display}{\def\st@display{#1}} +\define@key{stat}{for}{\def\stat@for{#1}} +\define@key{stat}{from}{\def\stat@from{#1}} +\define@key{stat}{type}{\def\stat@type{#1}} +\define@key{stat}{title}{\def\stat@title{#1}} +\define@key{stat}{continues}{\def\stat@continues{#1}} +\def\show@st@keys@aux{% +\@ifundefined{st@id}{}{\ifst@id{id=\st@id},\fi}% +\@ifundefined{st@display}{}{\ifst@display{display=\st@display}\fi}} +\def\clear@st@keys{\let\st@id=\relax\let\st@display=\relax} +\def\show@stat@keys@aux{% +\@ifundefined{st@for}{}{\ifstat@for{for=\stat@for},\fi}% +\@ifundefined{st@from}{}{\ifstat@from{from=\stat@from},\fi}% +\@ifundefined{st@type}{}{\ifstat@type{type=\stat@type},\fi}% +\@ifundefined{st@title}{}{\ifstat@title{title=\stat@title},\fi}% +\@ifundefined{st@continues}{}{\ifstat@continues{continues=\stat@continues}\fi}} +\def\show@stat@keys#1{\footnote{#1[\show@st@keys@aux\show@stat@keys@aux]}% +\clear@st@keys\clear@stat@keys} +\def\clear@stat@keys{\let\stat@for=\relax\let\stat@from=\relax% +\let\stat@type=\relax\let\stat@title=\relax\let\stat@continues=\relax} +\def\st@flow{flow} +\def\omtext@pre@skip{\smallskip} +\def\omtext@post@skip{} +\newenvironment{omtext}[1][]{\setkeys{stat}{#1}{% keyval args +\def\lec#1{\@lec{#1}}% so the trailing \par does not get into the way +\omtext@pre@skip\par\noindent +\@ifundefined{stat@title}{}{\ifx\st@display\st@flow\else\stDMemph{\stat@title}:\fi}} +\ifst@env\show@stat@keys{omtext:\stat@title}\fi +\omtext@post@skip}{} +\long\def\STRlabel#1#2{\STRlabeldef{#1}{#2}{#2}} +\def\STRcopy#1{\expandafter\ifx\csname STR@#1\endcsname\relax +\message{STR warning: reference #1 undefined!} +\else\csname STR@#1\endcsname\fi} +\long\def\@semantics[#1]#2#3{#2\STRlabeldef{#1}{#2}} +\def\STRlabeldef#1{\expandafter\gdef\csname STR@#1\endcsname} +\def\STRsemantics{\@ifnextchar[\@semantics{\@semantics[]}} +\define@key{phrase}{id}{} +\define@key{phrase}{style}{} +\define@key{phrase}{class}{} +\define@key{phrase}{index}{} +\define@key{phrase}{verbalizes}{} +\define@key{phrase}{type}{} +\newenvironment{phrase}[1][]{\setkeys{phrase}{#1}}{} +\def\nlex#1{\green{\sl{#1}}} +\def\nlcex#1{*\green{\sl{#1}}} +\def\inlinequote#1{``{\sl{#1}}''} +\def\blue#1{\textcolor{blue}{#1}} +\def\red#1{\textcolor{red}{#1}} +\def\green#1{\textcolor{green}{#1}} +\def\cyan#1{\textcolor{cyan}{#1}} +\def\magenta#1{\textcolor{magenta}{#1}} +\def\brown#1{\textcolor{brown}{#1}} +\def\yellow#1{\textcolor{yellow}{#1}} +\def\omspace#1{\hspace*{#1}} +\endinput +%% +%% End of file `omdoc.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/omdoc.sty.ltxml b/Master/texmf-dist/tex/latex/stex/omdoc.sty.ltxml new file mode 100644 index 00000000000..24c3ca3b119 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc.sty.ltxml @@ -0,0 +1,230 @@ +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('keyval'); +DefKeyVal('omgroup','id','Semiverbatim'); +DefKeyVal('omgroup','type','Semiverbatim'); +DefKeyVal('omgroup','display','Semiverbatim'); +DefEnvironment('{omgroup} OptionalKeyVals:omgroup {}', + "<omdoc:omgroup ?&KeyVal(#1,'id')(xml:id='#1')() ?&KeyVal(#1,'type')(type='#1')()>\n" + . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>\n)()" + . "#body\n" + . "</omdoc:omgroup>"); + +DefEnvironment('{tgroup} OptionalKeyVals:omgroup {}', + "<omdoc:tgroup ?&KeyVal(#1,'id')(xml:id='#1')() ?&KeyVal(#1,'type')(type='#1')()>\n" + . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>\n)()" + . "#body\n" + . "</omdoc:tgroup>"); +DefParameterType('IfBeginFollows', sub { + my ($gullet) = @_; + $gullet->skipSpaces; + return 1 unless $gullet->ifNext(T_CS('\begin')); + return; }, + reversion=>'', optional=>1); + +Let('\group@item@maybe@unwrap','\relax'); + +DefMacro('\group@item[] IfBeginFollows', sub { + my($gullet,$tag,$needwrapper)=@_; + ( T_CS('\group@item@maybe@unwrap'), + ($needwrapper ? (Invocation(T_CS('\group@item@wrap'),$tag)->unlist) : ()) ); }); + +DefConstructor('\group@item@wrap {}', + "<omdoc:omtext>" + . "?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>", + beforeDigest=>sub { + Let('\group@item@maybe@unwrap','\group@item@unwrap'); + $_[0]->bgroup; + useCMPItemizations(); + return; }, + properties=>sub{ RefStepItemCounter(); }); +DefConstructor('\group@item@unwrap', + "</omdoc:p></omdoc:CMP></omdoc:omtext>", + beforeDigest=>sub { + $_[0]->egroup; + Let('\group@item@maybe@unwrap','\relax'); }); + +Let('group@item@maybe@unwrap','\relax'); + +Let('\itemize@item'=>'\group@item'); +Let('\enumerate@item'=>'\group@item'); +Let('\description@item'=>'\group@item'); + +DefEnvironment('{itemize}', + "<omdoc:omgroup xml:id='#id' type='itemize'>#body</omdoc:omgroup>", + properties=>sub { beginItemize('itemize'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{enumerate}', + "<omdoc:omgroup xml:id='#id' type='enumerate'>#body</omdoc:omgroup>", + properties=>sub { beginItemize('enumerate'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{description}', + "<omdoc:omgroup xml:id='#id' type='description'>#body</omdoc:omgroup>", + properties=>sub { beginItemize('description'); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +Let('\tgroup@itemize@item'=>'\group@item'); +Let('\tgroup@enumerate@item'=>'\group@item'); +Let('\tgroup@description@item'=>'\group@item'); + +DefEnvironment('{tgroup@itemize}', + "<omdoc:tgroup xml:id='#id' type='itemize'>#body</omdoc:tgroup>", + properties=>sub { beginItemize('tgroup@itemize'); }, + beforeDigest=>sub { Let(T_CS('\end{itemize}') =>T_CS('\end{tgroup@itemize}')); }, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{tgroup@enumerate}', + "<omdoc:tgroup xml:id='#id' type='enumerate'>#body</omdoc:tgroup>", + properties=>sub { beginItemize('tgroup@enumerate'); }, + beforeDigest=>sub{ Let(T_CS('\end{enumerate}') =>T_CS('\end{tgroup@enumerate}'));}, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); +DefEnvironment('{tgroup@description}', + "<omdoc:tgroup xml:id='#id' type='description'>#body</omdoc:tgroup>", + properties=>sub { beginItemize('tgroup@description'); }, + beforeDigest=>sub{ Let(T_CS('\end{description}') =>T_CS('\end{tgroup@description}'));}, + beforeDigestEnd=>sub { Digest(T_CS('\group@item@maybe@unwrap')); }); + +sub useTheoryItemizations { + Let(T_CS('\begin{itemize}') =>T_CS('\begin{tgroup@itemize}')); + Let(T_CS('\begin{enumerate}') =>T_CS('\begin{tgroup@enumerate}')); + Let(T_CS('\begin{description}')=>T_CS('\begin{tgroup@description}')); + return; } +DefConstructor('\CMP@itemize@item[]', + '<omdoc:li>' + . '?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()', + properties=>sub{ RefStepItemCounter(); }); + +DefConstructor('\CMP@enumerate@item[]', + '<omdoc:li>' + . '?#1(<omdoc:metadata><dc:title>#1</dc:title></omdoc:metadata>)()', + properties=>sub{ RefStepItemCounter(); }); + +DefConstructor('\CMP@description@item[]', + '<omdoc:di>' + . '?#1(<omdoc:dt>#1</omdoc:dt>)()<omdoc:dd>', # trust di and dt to autoclose + properties=>sub{ RefStepItemCounter(); }); + +DefEnvironment('{CMP@itemize}', + "<omdoc:ul xml:id='#id'>#body</omdoc:ul>", + properties=>sub { beginItemize('CMP@itemize'); }, + beforeDigest=>sub { Let(T_CS('\end{itemize}') =>T_CS('\end{CMP@itemize}')); }); +DefEnvironment('{CMP@enumerate}', + "<omdoc:ol xml:id='#id'>#body</omdoc:ol>", + properties=>sub { beginItemize('CMP@enumerate'); }, + beforeDigest=>sub { Let(T_CS('\end{enumerate}') =>T_CS('\end{CMP@enumerate}')); }); +DefEnvironment('{CMP@description}', + "<omdoc:dl xml:id='#id'>#body</omdoc:dl>", + properties=>sub { beginItemize('CMP@description'); }, + beforeDigest=>sub { Let(T_CS('\end{description}') =>T_CS('\end{CMP@description}'));}); + +sub useCMPItemizations { + Let(T_CS('\begin{itemize}') =>T_CS('\begin{CMP@itemize}')); + Let(T_CS('\begin{enumerate}') =>T_CS('\begin{CMP@enumerate}')); + Let(T_CS('\begin{description}')=>T_CS('\begin{CMP@description}')); + return; } + +Tag('omdoc:CMP', afterOpen => sub { + AssignValue('_LastSeenCMP', $_[1], 'global'); + return; }); + +Tag('omdoc:li', autoClose=>1); +Tag('omdoc:dd', autoClose=>1); +Tag('omdoc:di', autoClose=>1); +DefKeyVal('stat','id','Semiverbatim'); +DefKeyVal('stat','for','Semiverbatim'); +DefKeyVal('stat','title','Semiverbatim'); +DefKeyVal('stat','from','Semiverbatim'); +DefKeyVal('stat','type','Semiverbatim'); +DefKeyVal('stat','display','Semiverbatim'); # not used at the moment +DefCMPEnvironment('{omtext} OptionalKeyVals:stat', + "<omdoc:omtext " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " + . "?&KeyVal(#1,'type')(type='&KeyVal(#1,'type')')() " + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')() " + . "?&KeyVal(#1,'from')(from='&KeyVal(#1,'from')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>\n"); +sub DefCMPEnvironment { + my ($proto, $replacement, %options) = @_; + my @before = $options{beforeDigest} ? ($options{beforeDigest}) : (); + push(@before, \&useCMPItemizations); + $options{beforeDigest} = \@before; + DefEnvironment($proto, $replacement, %options); +} +DefConstructor('\STRlabel{}{}', sub { + my($document,$label,$object)=@_; + $document->absorb($object); + $document->addAttribute('xml:id'=>ToString($label)) if $label; }); +DefConstructor('\STRcopy{}',"<omdoc:ref xref='#1'/>"); +DefMacro('\STRlabeldef{}{}', ""); +DefConstructor('\STRsemantics[]{}{}', sub { + my($document,$label,$ignore,$object)=@_; + $document->absorb($object); + $document->addAttribute('xml:id'=>ToString($label)) if $label; }); +DefKeyVal('phrase','id','Semiverbatim'); +DefKeyVal('phrase','style','Semiverbatim'); +DefKeyVal('phrase','class','Semiverbatim'); +DefKeyVal('phrase','index','Semiverbatim'); +DefKeyVal('phrase','verbalizes','Semiverbatim'); +DefKeyVal('phrase','type','Semiverbatim'); +DefConstructor('\phrase OptionalKeyVals:phrase {}', + "<omdoc:phrase %&KeyVals(#1)>#body</omdoc:phrase>"); +DefConstructor('\nlex{}',"<omdoc:phrase type='nlex'>#1</omdoc:phrase>"); +DefConstructor('\nlcex{}',"<omdoc:phrase type='nlcex'>#1</omdoc:phrase>"); +DefConstructor('\inlinequote{}',"<omdoc:phrase type='inlinequote'>#1</omdoc:phrase>"); +sub omdocColorMacro { + my ($color, @args) = @_; + my $tok_color = TokenizeInternal($color); + (T_BEGIN, T_CS('\@omdoc@color'), T_BEGIN, $tok_color->unlist, + T_END, T_CS('\@omdoc@color@content'), T_OTHER('['), $tok_color->unlist, T_OTHER(']'), + T_BEGIN, $args[1]->unlist, T_END, T_END); } +DefMacro('\@omdoc@color{}', sub { MergeFont(color=>$_[1]->toString); return; }); +DefConstructor('\@omdoc@color@content[]{}', + "?#isMath(#2)(<omdoc:phrase ?#1(style='color:#1')()>#2</omdoc:phrase>)"); +foreach my $color(qw(blue red green magenta cyan brown yellow)) { + DefMacro("\\".$color.'{}', sub { omdocColorMacro($color, @_); }); } +DefConstructor('\par',sub { $_[0]->maybeCloseElement('omdoc:p'); },alias=>"\\par\n"); +Tag('omdoc:p', autoClose=>1, autoOpen=>1); +DefConstructor('\omspace{}',''); +DefConstructor('\emph{}',"<omdoc:phrase class='emphasis'>#1</omdoc:phrase>"); +DefConstructor('\em',"<omdoc:phrase class='emphasis'>"); +Tag('omdoc:phrase', autoClose=>1); +DefEnvironment('{center}','#body'); +DefEnvironment('{minipage}{}','#body'); +DefEnvironment('{quote}',"<omdoc:phrase type='quote' style='display:block'>#body</omdoc:phrase>"); +DefEnvironment('{quotation}',"<omdoc:phrase type='quote' style='display:block'>#body</omdoc:phrase>"); +DefEnvironment('{small}','#body'); +DefEnvironment('{footnotesize}','#body'); +DefEnvironment('{tiny}','#body'); +DefEnvironment('{scriptsize}','#body'); +DefConstructor('\LARGE',''); +DefConstructor('\Large',''); +DefConstructor('\large',''); +DefConstructor('\small',''); + +DefConstructor('\fbox{}','#1'); + +DefConstructor('\footnote[]{}', + "<omdoc:note class='foot' ?#1(mark='#1')>#2</omdoc:note>"); +DefConstructor('\footnotemark[]',""); +DefConstructor('\footnotetext[]{}', + "<omdoc:note class='foot' ?#1(mark='#1')>#2</omdoc:note>"); + +DefConstructor('\sf', ''); +DefConstructor('\sc', ''); +Tag('omdoc:p',afterOpen=>\&numberIt); +Tag('omdoc:omtext',afterOpen=>\&numberIt); +Tag('omdoc:omgroup',afterOpen=>\&numberIt); +Tag('omdoc:tgroup',afterOpen=>\&numberIt); +Tag('omdoc:CMP',afterOpen=>\&numberIt); +sub numberIt { + my($document,$node,$whatsit)=@_; + my(@parents)=$document->findnodes('ancestor::*[@xml:id]',$node); # find 1st id'd parent. + my $prefix= (@parents ? $parents[$#parents]->getAttribute('xml:id')."." : ''); + my(@siblings)=$document->findnodes('preceding-sibling::*[@xml:id]',$node); + my $n = scalar(@siblings)+1; + my $id = ($node -> getAttribute('xml:id')); + $node->setAttribute('xml:id'=>$prefix."p$n") unless $id; } +DefConstructor('\url Semiverbatim',"<omdoc:link href='#1'>#1</omdoc:link>"); +1; diff --git a/Master/texmf-dist/tex/latex/stex/presentation.sty b/Master/texmf-dist/tex/latex/stex/presentation.sty new file mode 100644 index 00000000000..53eb139fe7a --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/presentation.sty @@ -0,0 +1,125 @@ +%% +%% This is file `presentation.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% presentation.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{presentation}[2007/09/03 v0.9e presentation for semantic macros] + +\RequirePackage{keyval}[1997/11/10] +\def\pres@default@precedence{1000} +\def\setDefaultPrecedence#1{\def\pres@default@precedence{#1}} +\def\pres@initial@precedence{1000} +\def\setInitialPrecedence#1{\def\pres@initial@precedence{#1}} +\def\pres@current@precedence{\pres@initial@precedence} +\def\pres@default@lbrack{(}\def\pres@lbrack{\pres@default@lbrack} +\def\pres@default@rbrack{)}\def\pres@rbrack{\pres@default@rbrack} +\def\setDefaultLeftBracket#1{\def\pres@default@lbrack{#1}} +\def\setDefaultRightBracket#1{\def\pres@default@rbrack{#1}} +\def\PrecSet#1{\def\pres@default@precedence{#1}} +\def\PrecWrite#1{\ifnum\pres@current@precedence>\pres@p\else{#1}\fi} +\def\clearkeys{\let\pres@p@key=\relax +\let\pres@pi@key=\relax% +\let\pres@pi@key=\relax% +\let\pres@pii@key=\relax% +\let\pres@piii@key=\relax} +\define@key{mi}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{mi}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{mi}{p}{\def\pres@p@key{#1}} +\define@key{mi}{pi}{\def\pres@pi@key{#1}} +\def\prep@keys@mi% +{\edef\pres@lbrack{\@ifundefined{pres@lbrack@key}{\pres@default@lbrack}{\pres@lbrack@key}} +\edef\pres@rbrack{\@ifundefined{pres@rbrack@key}{\pres@default@rbrack}{\pres@rbrack@key}} +\edef\pres@p{\@ifundefined{pres@p@key}{\pres@default@precedence}{\pres@p@key}} +\edef\pres@pi{\@ifundefined{pres@pi@key}{\pres@p}{\pres@pi@key}}} +\newcommand{\mixfixi}[4][]%key, pre, arg, post +{\setkeys{mi}{#1}\prep@keys@mi\clearkeys +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}#4% +\PrecWrite\pres@rbrack} +\newcommand{\mixfixa}[5][]%key, pre, arg, post, assocop +{\setkeys{mi}{#1}\prep@keys@mi\clearkeys% +\PrecWrite\pres@lbrack{#2}{\@assoc\pres@pi{#5}{#3}}{#4}\PrecWrite\pres@rbrack} +\define@key{mii}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{mii}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{mii}{p}{\def\pres@p@key{#1}} +\define@key{mii}{pi}{\def\pres@pi@key{#1}} +\define@key{mii}{pii}{\def\pres@pii@key{#1}} +\def\prep@keys@mii{\prep@keys@mi% +\edef\pres@pii{\@ifundefined{pres@pii@key}{\pres@p}{\pres@pii@key}}% +\let\pres@pii@key=\relax} +\newcommand{\mixfixii}[6][]%key, pre, arg1, mid, arg2, post +{\setkeys{mii}{#1}\prep@keys@mii\clearkeys% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\edef\pres@current@precedence{\pres@pii}#5}#6% +\PrecWrite\pres@rbrack} +\newcommand{\mixfixia}[7][]%key, pre, arg1, mid, arg2, post, assocop +{\setkeys{mii}{#1}\prep@keys@mii\clearkeys% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\@assoc\pres@pii{#7}{#5}}#6% +\PrecWrite\pres@rbrack} +\newcommand{\mixfixai}[7][]%key, pre, arg1, mid, arg2, post, assocop +{\setkeys{mii}{#1}\prep@keys@mii\clearkeys% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\@assoc\pres@pi{#7}{#3}}% +#4{\edef\pres@current@precedence{\pres@pii}#5}#6% +\PrecWrite\pres@rbrack} +\define@key{miii}{lbrack}{\def\pres@lbrack@key{#1}} +\define@key{miii}{rbrack}{\def\pres@lbrack@key{#1}} +\define@key{miii}{p}{\def\pres@p@key{#1}} +\define@key{miii}{pi}{\def\pres@pi@key{#1}} +\define@key{miii}{pii}{\def\pres@pii@key{#1}} +\define@key{miii}{piii}{\def\pres@piii@key{#1}} +\def\prep@keys@miii{\prep@keys@mii\edef\pres@piii{\@ifundefined{pres@piii@key}{\pres@p}{\pres@piii@key}}} +\newcommand{\mixfixiii}[8][]%key, pre, arg1, mid1, arg2, mid2, arg3, post +{\setkeys{miii}{#1}\prep@keys@miii\clearkeys% +\PrecWrite\pres@lbrack% write bracket if necessary +#2{\edef\pres@current@precedence{\pres@pi}#3}% +#4{\edef\pres@current@precedence{\pres@pii}#5}% +#6{\edef\pres@current@precedence{\pres@pii}#7}#8% +\PrecWrite\pres@rbrack} +\newcommand{\prefix}[3][]%key, fn, arg +{\setkeys{mi}{#1}\prep@keys@mi\clearkeys +#2\PrecWrite\pres@lbrack% write bracket if necessary +{\edef\pres@current@precedence{\pres@pi}#3}% +\PrecWrite\pres@rbrack} +\newcommand{\postfix}[3][]%key, fn, arg +{\setkeys{mi}{#1}\prep@keys@mi\clearkeys +\PrecWrite\pres@lbrack% write bracket if necessary +{\edef\pres@current@precedence{\pres@pi}#3}% +\PrecWrite\pres@rbrack{#2}} +\newcommand{\prefixa}[4][]{\mixfixa[#1]{#2}{#3}{}{#4}} +\newcommand{\postfixa}[4][]{{#1}\mixfixa[#1]{}{#3}{#2}{#4}} +\newcommand{\infix}[4][]{\mixfixii[#1]{}{#3}{#2}{#4}{}} +\def\@assoc#1#2#3{% precedence, function, argv +\let\@tmpop=\relax% do not print the function the first time round +\@for\@I:=#3\do{\@tmpop% print the function +{\edef\pres@current@precedence{#1}\@I}% +\let\@tmpop=#2}}%update the function +\newcommand{\assoc}[3][]{\mixfixa[#1]{}{#3}{}{#2}} +\def\setegroup#1#2{\expandafter\def\csname #1@egroup\endcsname{#2}} +\def\elide#1#2#3{\@ifundefined{#1@egroup}% +{\def\@elevel{1000} +\PackageError{presentation}{undefined egroup #1, assuming value 1000}% +{When calling \protect\elide{#1}... the elision group #1 has be have\MessageBreak +been set by \protect\setegroup before, e.g. by \protect\setegroup{an}{1000}.}}% +{\edef\@elevel{\csname #1@egroup\endcsname}}% +\ifnum\@elevel>#2\else{#3}\fi} +\def\provideEdefault#1#2{\expandafter\def\csname#1@edefault\endcsname{#2} +\@ifundefined{this@module}{}% +{\expandafter\g@addto@macro\this@module{\expandafter\def\csname#1@edefault\endcsname{#2}}}} +\def\setEdefault#1#2{\expandafter\def\csname #1@edfault\endcsname{#2}} +\def\fromEcontext#1{\csname #1@edefault\endcsname} +\def\MOD@namedef#1{\expandafter\def\csname MOD@name@#1\endcsname} +\def\MOD@name[#1]#2{#2\def\@test{#2}\ifx\@test\empty\else\MOD@namedef{#1}{#2}\fi} +\def\vname{\@ifnextchar[\MOD@name{\MOD@name[]}} +\def\vnref#1{\csname MOD@name@#1\endcsname} +\def\hrcr#1#2{\hyperlink{#1@\mod@id}{#2}} +\endinput +%% +%% End of file `presentation.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/presentation.sty.ltxml b/Master/texmf-dist/tex/latex/stex/presentation.sty.ltxml new file mode 100644 index 00000000000..cd153933e57 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/presentation.sty.ltxml @@ -0,0 +1,197 @@ + +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('keyval'); +DefKeyVal('mi','lbrack','Semiverbatim'); +DefKeyVal('mi','rbrack','Semiverbatim'); +DefKeyVal('mi','p','Semiverbatim'); +DefKeyVal('mi','pi','Semiverbatim'); +DefConstructor('\mixfixi OptionalKeyVals:mi {}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefConstructor('\mixfixa OptionalKeyVals:mi {}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:exprlist name='args'>" + . "<omdoc:expr name='arg'/>" + . "</omdoc:exprlist>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:iterate name='args' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<omdoc:separator>" + . "<ltx:Math><ltx:XMath>#5</ltx:XMath></ltx:Math>" + . "</omdoc:separator>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefKeyVal('mii','lbrack','Semiverbatim'); +DefKeyVal('mii','rbrack','Semiverbatim'); +DefKeyVal('mii','p','Semiverbatim'); +DefKeyVal('mii','pi','Semiverbatim'); +DefKeyVal('mii','pii','Semiverbatim'); +DefConstructor('\mixfixii OptionalKeyVals:mi {}{}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "<omdoc:expr name='arg2'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg1' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg2' ?&KeyVal(#1,'pii')(precedence='&KeyVal(#1,'pii')')/>" + . "<ltx:Math><ltx:XMath>#6</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefConstructor('\mixfixia OptionalKeyVals:mi {}{}{}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "<omdoc:exprlist name='args'>" + . "<omdoc:expr name='arg'/>" + . "</omdoc:exprlist>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg1' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "<omdoc:iterate name='args' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<omdoc:separator>" + . "<ltx:Math><ltx:XMath>#7</ltx:XMath></ltx:Math>" + . "</omdoc:separator>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "<ltx:Math><ltx:XMath>#6</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefConstructor('\mixfixai OptionalKeyVals:mi {}{}{}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:exprlist name='args'>" + . "<omdoc:expr name='arg'/>" + . "</omdoc:exprlist>" + . "<omdoc:expr name='arg2'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:iterate name='args' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<omdoc:separator>" + . "<ltx:Math><ltx:XMath>#7</ltx:XMath></ltx:Math>" + . "</omdoc:separator>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg2' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#6</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefKeyVal('miii','lbrack','Semiverbatim'); +DefKeyVal('miii','rbrack','Semiverbatim'); +DefKeyVal('miii','p','Semiverbatim'); +DefKeyVal('miii','pi','Semiverbatim'); +DefKeyVal('miii','pii','Semiverbatim'); +DefKeyVal('miii','piii','Semiverbatim'); +DefConstructor('\mixfixiii OptionalKeyVals:mi {}{}{}{}{}{}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "<omdoc:expr name='arg2'/>" + . "<omdoc:expr name='arg3'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg1' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#4</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg2' ?&KeyVal(#1,'pii')(precedence='&KeyVal(#1,'pii')')/>" + . "<ltx:Math><ltx:XMath>#6</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg3' ?&KeyVal(#1,'piii')(precedence='&KeyVal(#1,'piii')')/>" + . "<ltx:Math><ltx:XMath>#8</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefConstructor('\prefix OptionalKeyVals:mi {}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefConstructor('\postfix OptionalKeyVals:mi {}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:expr name='arg1'/>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<ltx:Math><ltx:XMath>#2</ltx:XMath></ltx:Math>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +DefMacro('\infix []{}{}{}','\mixfixii[#1]{}{#3}{#2}{#4}{}'); +DefConstructor('\assoc OptionalKeyVals:mi {}{}', + "<omdoc:prototype>" + . "<om:OMA>" + . "<om:OMS cd='' name=''/>"##### need to get $cd and $name here. + . "<omdoc:exprlist name='args'>" + . "<omdoc:expr name='arg'/>" + . "</omdoc:exprlist>" + . "</om:OMA>" + ."</omdoc:prototype>" + ."<omdoc:rendering ?&KeyVal(#1,'p')(precedence='&KeyVal(#1,'p')')>" + . "<m:mrow>" + . "<omdoc:iterate name='args' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "<omdoc:separator>" + . "<ltx:Math><ltx:XMath>#3</ltx:XMath></ltx:Math>" + . "</omdoc:separator>" + . "<omdoc:render name='arg' ?&KeyVal(#1,'pi')(precedence='&KeyVal(#1,'pi')')/>" + . "</omdoc:iterate>" + . "</m:mrow>" + ."</omdoc:rendering>", + mode=>'inline_math'); +1; diff --git a/Master/texmf-dist/tex/latex/stex/sproof.sty b/Master/texmf-dist/tex/latex/stex/sproof.sty new file mode 100644 index 00000000000..b2501b45948 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/sproof.sty @@ -0,0 +1,112 @@ +%% +%% This is file `sproof.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% sproof.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{sproof}[2006/01/13 v0.9a Semantic Markup for Proofs] +\RequirePackage{omdoc}[2007/09/09] +\newif\ifjust@method\just@methodfalse +\DeclareOption{method}{\just@methodtrue} +\newif\ifspf@env\spf@envfalse +\newif\ifspf@id\spf@idfalse +\newif\ifspf@display\spf@displayfalse +\DeclareOption{id}{\spf@idtrue\spf@envtrue} +\DeclareOption{env}{\spf@envtrue} +\DeclareOption{display}{\spf@displaytrue\spf@envtrue} +\newif\ifspf@for\spf@forfalse +\newif\ifspf@from\spf@forfalse +\newif\ifspf@type\spf@typefalse +\newif\ifspf@title\spf@titlefalse +\newif\ifspf@proofend\spf@proofendtrue +\newif\ifspf@continues\spf@continuesfalse +\DeclareOption{for}{\spf@fortrue\spf@envtrue} +\DeclareOption{from}{\spf@fromtrue\spf@envtrue} +\DeclareOption{type}{\spf@typetrue\spf@envtrue} +\DeclareOption{title}{\spf@titletrue\spf@envtrue} +\DeclareOption{continues}{\spf@continuepfrue\spf@envtrue} +\DeclareOption{noproofend}{\spf@proofendfalse\spf@envtrue} +\def\spftrue{\spf@fortrue\spf@fromtrue\spf@typetrue\spf@continuepfrue} +\DeclareOption{draft}{\spf@envtrue\just@methodtrue} +\DeclareOption{all}{\spf@envtrue\just@medhodtrue} +\ProcessOptions +\define@key{spf}{id}{\def\spf@id{#1}} +\define@key{spf}{display}{\def\spf@display{#1}} +\define@key{spf}{for}{\def\spf@for{#1}} +\define@key{spf}{from}{\def\spf@from{#1}} +\define@key{spf}{sproofend}{\spf@proofendtrue\def\sproof@box{#1}} +\define@key{spf}{noproofend}[imeanit]{\spf@proofendfalse} +\define@key{spf}{type}{\def\spf@type{#1}} +\define@key{spf}{title}{\def\spf@title{#1}} +\define@key{spf}{continues}{\def\spf@continues{#1}} +\def\show@st@keys@aux{% +\@ifundefined{spf@id}{}{\ifspf@id{id=\spf@id},\fi}% +\@ifundefined{spf@display}{}{\ifspf@display{display=\spf@display}\fi}} +\def\clear@pf@keys{\let\spf@id=\relax\let\spf@display=\relax} +\def\show@pf@keys@aux{% +\@ifundefined{spf@for}{}{\ifspf@for{for=\spf@for},\fi}% +\@ifundefined{spf@from}{}{\ifspf@from{from=\spf@from},\fi}% +\@ifundefined{spf@prefix}{}{\ifspf@prefix{prefix=\spf@prefix},\fi}% +\@ifundefined{spf@type}{}{\ifspf@type{type=\spf@type},\fi}% +\@ifundefined{spf@title}{}{\ifspf@title{title=\spf@title},\fi}% +\@ifundefined{spf@continues}{}{\ifspf@continues{continues=\spf@continues}\fi}} +\def\show@pf@keys#1{\footnote{#1[\show@pf@keys@aux\show@pf@keys@aux]}% +\clear@pf@keys\clear@pf@keys} +\def\clear@pf@keys{\let\spf@for=\relax\let\spf@from=\relax\let\spf@prefix=\relax% +\let\spf@type=\relax\let\spf@title=\relax\let\spf@continues=\relax} +\def\spf@flow{flow} +\newenvironment{pst@with@label}[1]{\edef\pst@label{#1}\advance\count10 by 1\count\count10=1} +{\advance\count10 by -1} +\def\the@pst@label{\pst@label.\number\count\count10} +\def\next@pst@label{\global\advance\count\count10 by 1} +\def\sproof@box{\hbox{\vrule\vbox{\hrule width 6 pt\vskip 6pt\hrule}\vrule}} +\def\sproofend{\ifspf@proofend\hfil\null\nobreak\hfill\sproof@box\par\smallskip\fi} +\def\sProofEndSymbol#1{\def\sproof@box{#1}} +\newenvironment{@proof}[2][]{\setkeys{spf}{#1} +\count10=10\ifx\spf@display\spf@flow\else{\stDMemph{Proof}:}\fi% +\ifspf@env\show@pf@keys{sproof}\fi{ #2}% +\def\pst@label{}\newcount\pst@count% initialize the labeling mechanism +\begin{description}\begin{pst@with@label}{P}} +{\end{pst@with@label}\end{description}} +\newenvironment{sproof}[2][]{\begin{@proof}[#1]{#2}}{\sproofend\end{@proof}} +\newcommand{\sproofidea}[2][]{{\stDMemph{Proof Idea}:} #2\sproofend} +\newenvironment{spfstep}[1][]{\setkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi +\@ifundefined{spf@title}{}{(\stDMemph{\spf@title})}% +\ifspf@env\show@pf@keys{spfstep}\fi} +{\next@pst@label} +\newenvironment{sproofcomment}[1][]{\setkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi +\ifspf@env\show@pf@keys{sproofcomment}\fi} +{\next@pst@label} +\newenvironment{spfcases}[2][]{\setkeys{spf}{#1} +\def\@test{#2}\ifx\@test\empty\else +\ifx\spf@display\spf@flow {#2}\else\item[\the@pst@label]{#2} \fi\fi +\ifspf@env\show@pf@keys{spfcases}\fi +\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\end{pst@with@label}\next@pst@label} +\newenvironment{spfcase}[2][]{\setkeys{spf}{#1} +\ifx\spf@display\spf@flow\else\item[\the@pst@label]\fi +\def\@test{#2}\ifx\@test\empty\else{\stDMemph{#2}:}\fi +\ifspf@env\show@pf@keys{spfcase}\fi +\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\ifx\spf@display\spf@flow\else\sproofend\fi\end{pst@with@label}\next@pst@label} +\newenvironment{subproof}{\begin{pst@with@label}{\pst@label.\number\count\count10}} +{\ifx\spf@display\spf@flow\else\sproofend\fi\end{pst@with@label}} +\define@key{just}{id}{\def\just@id{#1}} +\define@key{just}{method}{\def\just@method{#1}} +\def\show@just@keys#1{\footnote{#1[\show@pf@keys@aux\show@just@keys@aux]}}% +\def\show@just@keys@aux{% +\@ifundefined{just@method}{\relax}{\ifjust@method{method=\just@method},\fi}% +\clear@pf@keys\clear@just@keys} +\def\clear@just@keys{\let\just@method=\relax} +\newenvironment{justification}[1][]{\ifspf@env\setkeys{just}{#1} + \show@just@keys{justification}\fi}{} +\newcommand{\premise}[2][]{#2} +\newcommand{\justarg}[2][]{#2} +\endinput +%% +%% End of file `sproof.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/sproof.sty.ltxml b/Master/texmf-dist/tex/latex/stex/sproof.sty.ltxml new file mode 100644 index 00000000000..afd3433e9b8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/sproof.sty.ltxml @@ -0,0 +1,107 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('omdoc'); +DefKeyVal('pf','id','Semiverbatim'); +DefKeyVal('pf','display','Semiverbatim'); # not used at the moment +DefKeyVal('pf','for','Semiverbatim'); +DefKeyVal('pf','from','Semiverbatim'); +DefKeyVal('pf','proofend','Semiverbatim'); +DefKeyVal('pf','noproofend','Semiverbatim'); +DefKeyVal('pf','type','Semiverbatim'); +DefKeyVal('pf','title','Semiverbatim'); +DefKeyVal('pf','continues','Semiverbatim'); +DefConstructor('\sproofend',""); +DefEnvironment('{sproof} OptionalKeyVals:pf{}', + "<omdoc:proof ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>\n" + . "?#2(<omdoc:omtext><omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP></omdoc:omtext>\n)()" + . "#body" + . "</omdoc:proof>\n"); +DefEnvironment('{sproofidea} OptionalKeyVals:pf {}', + "<omdoc:proof ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>\n" + . "<omdoc:omtext><omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP></omdoc:omtext>\n" + . "</omdoc:proof>\n"); +DefCMPEnvironment('{spfstep} OptionalKeyVals:pf', + "<omdoc:derive ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:derive>\n"); +DefCMPEnvironment('{sproofcomment} OptionalKeyVals:pf', + "<omdoc:omtext ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>"); +DefEnvironment('{spfcases} OptionalKeyVals:pf {}', + "<omdoc:derive ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>\n" + . "<omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP>\n" + . "<omdoc:method xref='#proof-by-cases'>" + . "#body" + . "</omdoc:method>" + . "</omdoc:derive>\n"); +DefEnvironment('{spfcase} OptionalKeyVals:pf{}', + "<omdoc:proof ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>\n" + . "?#2(<omdoc:omtext><omdoc:CMP><omdoc:p>#2</omdoc:p></omdoc:CMP></omdoc:omtext>\n)()" + . "#body" + . "</omdoc:proof>\n"); +DefEnvironment('{subproof}', + "<omdoc:proof>\n #body\n</omdoc:proof>\n"); +DefKeyVal('just','id','Semiverbatim'); +DefKeyVal('just','method','Semiverbatim'); +DefKeyVal('just','premises','Semiverbatim'); +DefKeyVal('just','args','Semiverbatim'); +sub extractBodyText { + my ($box, $remove) = @_; + my $str = ''; + my @boxes = $box->unlist; + foreach my $b(@boxes) { + my $s = ''; + if ($b =~ /LaTeXML::Whatsit/) { + my $body = $b->getBody; + $s = $body ? extractBodyText($body, $remove) : ''; + } elsif ($b =~ /LaTeXML::Box/) { + $s = $b->toString || ''; + @{$b}[0] = '' if $remove; } + $str .= $s; } + $str =~ s/\s+/ /g; + $str; } + +DefEnvironment('{justification} OptionalKeyVals:just', sub { + my ($doc, $keys, %props) = @_; + my $text = extractBodyText($props{body}, 1); + my $node = LookupValue('_LastSeenCMP'); + $node->appendText($text) if $node; + my $method = $keys ? $keys->getValue('method') : undef; + $doc->openElement("omdoc:method", $method ? (xref => $method) : ()); + $doc->absorb($props{body}) if $props{body}; + $doc->closeElement("omdoc:method"); + return; }); +DefMacro('\premise[]{}', sub { + my ($xref, $text) = ($_[1], $_[2]); + my @res = (T_CS('\premise@content')); + push(@res, T_OTHER('['), $xref->unlist, T_OTHER(']')) if $xref; + push(@res, T_SPACE, $text->unlist) if $text; + @res; }); +DefConstructor('\premise@content[]', "<omdoc:premise xref='#1'/>"); +DefMacro('\justarg[]{}', sub { (($_[1] ? $_[1]->unlist : ()), +T_SPACE, $_[2]->unlist, T_SPACE); }); + +Tag('omdoc:derive', afterClose=>sub { + my ($doc, $node) = @_; + my @children = grep($_->nodeType == XML_ELEMENT_NODE, $node->childNodes); + my $firstCMP = undef; + foreach my $child(@children) { + next unless ($child->localname || '') eq 'CMP'; + if ($child->hasChildNodes()) { + next unless $#{$child->childNodes} == 0; + next unless $child->firstChild->nodeType == XML_TEXT_NODE; } + + if ($firstCMP) { + $firstCMP->appendText($child->textContent); + $node->removeChild($child); + } else { $firstCMP = $child; } + } + }); + +Tag('omdoc:proof',afterOpen=>\&numberIt); +Tag('omdoc:derive',afterOpen=>\&numberIt); +Tag('omdoc:method',afterOpen=>\&numberIt); +1; diff --git a/Master/texmf-dist/tex/latex/stex/statements.sty b/Master/texmf-dist/tex/latex/stex/statements.sty new file mode 100644 index 00000000000..0ae7cda7c74 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/statements.sty @@ -0,0 +1,85 @@ +%% +%% This is file `statements.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% statements.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{statements}[2007/09/09 v0.9d Semantic Markup for Statements] +\newif\ifst@env\st@envfalse +\newif\ifst@id\st@idfalse +\newif\ifst@display\st@displayfalse +\DeclareOption{id}{\st@idtrue\st@envtrue} +\DeclareOption{env}{\st@envtrue} +\DeclareOption{display}{\st@displaytrue\st@envtrue} +\newif\ifstat@for\stat@forfalse +\newif\ifstat@from\stat@forfalse +\newif\ifstat@type\stat@typefalse +\newif\ifstat@title\stat@titlefalse +\newif\ifstat@continues\stat@continuesfalse +\DeclareOption{for}{\stat@fortrue\st@envtrue} +\DeclareOption{from}{\stat@fromtrue\st@envtrue} +\DeclareOption{type}{\stat@typetrue\st@envtrue} +\DeclareOption{title}{\stat@titletrue\st@envtrue} +\DeclareOption{continues}{\stat@continuestrue\st@envtrue} +\def\stattrue{\stat@fortrue\stat@fromtrue\stat@typetrue\stat@continuestrue} +\DeclareOption{draft}{\st@envtrue\st@idtrue\stat@fortrue\stat@fromtrue\typetrue\justtrue} +\DeclareOption{all}{\st@envtrue\stattrue\justtrue} +\ProcessOptions +\RequirePackage{omdoc}[2007/09/09] +\def\define@statement@env#1#2{ +\newenvironment{#1}[1][]{\setkeys{stat}{##1} +\ifx\st@display\st@flow\else\stDMemph{#2}:\fi% +\@ifundefined{stat@title}{}% +{\space\ifx\st@display\st@flow\else(\fi\stDMemph{\stat@title}\ifx\st@display\st@flow:\else)\par\fi}\space% +\ifst@env\show@stat@keys{#1}\fi\csname st@#1@initialize\endcsname} +{\csname st@#1@terminate\endcsname}} +\newenvironment{assertion}[1][]{\setkeys{stat}{#1} +\ifx\st@display\st@flow\else{\stDMemph{\stat@type}:}\fi% +\@ifundefined{stat@title}{~}{~(\stDMemph{\stat@title})\par}% +\ifst@env\show@stat@keys{#1}\fi\em}{} +\newenvironment{simpleDef}[1][]{\setkeys{stat}{#1} +\ifx\st@display\st@flow\else{\stDMemph{Definition}:}\fi% +\@ifundefined{stat@title}{~}{~(\stDMemph{\stat@title})\par}% +\ifst@env\show@stat@keys{#1}\fi}{} +\newenvironment{PatternDef}[1][]{\setkeys{stat}{#1} +\ifx\st@display\st@flow\else{\stDMemph{Definition}:}\fi% +\@ifundefined{stat@title}{~}{~(\stDMemph{\stat@title})\par}% +\ifst@env\show@stat@keys{#1}\fi}{} +\newenvironment{PatternRule}[1]{#1$\colon=$}{} +\newenvironment{PatternCMP}{}{} +\newenvironment{RecDef}[1][]{\setkeys{stat}{#1} +\ifx\st@display\st@flow\else{\stDMemph{Definition}:}\fi% +\@ifundefined{stat@title}{~}{~(\stDMemph{\stat@title})\par}% +\ifst@env\show@stat@keys{#1}\fi}{} +\def\st@example@initialize{}\def\st@example@terminate{} +\define@statement@env{example}{Example} +\def\st@axiom@initialize{}\def\st@axiom@terminate{} +\define@statement@env{axiom}{Axiom} +\define@key{consymb}{type}{\def\consymb@type{#1}} +\define@key{consymb}{title}{\def\consymb@title{#1}} +\define@key{consymb}{name}{\def\consymb@name{#1}} +\def\consymb@type{Symbol} +\newenvironment{consymb}[1][]{\setkeys{consymb}{#1} +\ifx\st@display\st@flow\else{\stDMemph{\consymb@type} \consymb@name:}\fi% +\@ifundefined{consymb@title}{~}{~(\stDMemph{\consymb@title})\par}}{} +\newcommand{\symtype}[2]{Type (#1): #2} +\def\st@definition@initialize{% +\newcommand{\notatiendum}[2][]{\notemph{##2}} +\newcommand{\definiendum}[2][]{\defemph{##2}}} +\def\st@definition@terminate{} +\define@statement@env{definition}{Definition} +\def\notemph#1{{\bf{#1}}} +\def\st@notation@initialize{\newcommand{\notatiendum}[2][]{\notemph{##2}}} +\def\st@notation@terminate{} +\define@statement@env{notation}{Notation} +\def\termin{\@ifnextchar[{\@termin}{\@termin[]}} +\def\@termin[#1]#2{{\termemph{\index*{#2}}}} +\providecommand{\termemph}[1]{#1} +\providecommand{\defemph}[1]{{\bf{#1}}} +\providecommand{\stDMemph}[1]{{\bf{#1}}} +\endinput +%% +%% End of file `statements.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/statements.sty.ltxml b/Master/texmf-dist/tex/latex/stex/statements.sty.ltxml new file mode 100644 index 00000000000..d938af97167 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/statements.sty.ltxml @@ -0,0 +1,142 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +RequirePackage('omdoc'); +RequirePackage('myindex'); +DefCMPEnvironment('{assertion} OptionalKeyVals:stat', + "<omdoc:assertion ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() type='&KeyVal(#1,'type')'>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + ."</omdoc:assertion>\n"); +DefCMPEnvironment('{simpleDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='simple' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:definition>\n"); +DefCMPEnvironment('{PatternDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='pattern' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "#body" + . "</omdoc:definition>\n"); +DefEnvironment('{PatternRule}{}', + "<omdoc:requation>#1 #body</omdoc:requation>"); +DefEnvironment('{PatternCMP}{}', + "<omdoc:CMP>#body</omdoc:CMP>"); +DefEnvironment('{RecDef} OptionalKeyVals:stat', + "?&KeyVal(#1,'for')(<omdoc:symbol name='&KeyVal(#1,'for')'/>)()" + . "<omdoc:definition type='inductive' " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').def')()" + . "?&KeyVal(#1,'for')(for='&KeyVal(#1,'for')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:definition>\n"); +DefCMPEnvironment('{example} OptionalKeyVals:stat', + "<omdoc:example " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')() " + . "for='&KeyVal(#1,'for')'>" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:example>\n"); +DefCMPEnvironment('{axiom} OptionalKeyVals:stat', + "<omdoc:axiom ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:axiom>\n"); +DefEnvironment('{consymb} OptionalKeyVals:stat', + "<omdoc:symbol ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()" + . "name='&KeyVal(#1,'name')'>" + . "<omdoc:metadata>" + . "<dc:description>" + . "#body" + . "</dc:description>" + . "</omdoc:metadata>" + . "</omdoc:symbol>\n"); +DefConstructor('\symtype{}{}',"<omdoc:type system='#1'>#2</omdoc:type>"); +DefCMPEnvironment('{definition} OptionalKeyVals:stat', sub { + my ($doc, $keyvals, %props) = @_; + my @symbols = @{$props{defs} || []}; + foreach my $symb(@symbols) { + $doc->openElement('omdoc:symbol', name=>$symb); + $doc->closeElement('omdoc:symbol'); } + my %attrs = (); + my $id = $keyvals->getValue('id') if $keyvals; + $attrs{'xml:id'} = $id if $id; + my $ffor = $keyvals->getValue('for') if $keyvals; + my $for = $ffor . join(' ',@symbols) if $ffor; + $attrs{for} = $for if $for; + $doc->openElement('omdoc:definition', %attrs); + my $title = $keyvals->getValue('title') if $keyvals; + if ($title) { + $doc->openElement('omdoc:metadata'); + $doc->openElement('dc:title'); + $doc->absorb($title); + $doc->closeElement('dc:title'); + $doc->closeElement('omdoc:metadata'); } + $doc->openElement('omdoc:CMP'); + $doc->openElement('omdoc:p'); + $doc->absorb($props{body}) if $props{body}; + $doc->closeElement('omdoc:p'); + $doc->closeElement('omdoc:CMP'); + $doc->closeElement('omdoc:definition'); + return; }, + afterDigestBegin=>sub { + my ($stomach, $whatsit) = @_; + my @symbols = (); + $whatsit->setProperty(defs=>\@symbols); + AssignValue('defs', \@symbols, 'global'); + return; }, + afterDigest => sub { + AssignValue('defs', undef, 'global'); + return; }); + +DefConstructor('\definiendum[]{}', + "<omdoc:term role='definiendum' name='#1' cd='#theory'>#2</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }); +DefMacro('\defin{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END); + (T_CS('\definiendum'), T_OTHER('['), $_[1]->unlist, T_OTHER(']'), @args, T_CS('\defin@index'), @args); }); +DefMacro('\twindef{}{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END, T_BEGIN, $_[2]->unlist, T_END); + (T_CS('\twindef@def'), @args, T_CS('\twindef@index'), @args); }); +DefMacro('\atwindef{}{}{}', sub { + my @args = (T_BEGIN, $_[1]->unlist, T_END, T_BEGIN, $_[2]->unlist, T_END, + T_BEGIN, $_[3]->unlist, T_END); + (T_CS('\atwindef@def'), @args, T_CS('\atwindef@index'), @args); }); +DefConstructor('\twindef@def{}{}', + "<omdoc:term role='definiendum' name='#1-#2' cd='#theory'>#1 #2</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString.'-'.$whatsit->getArg(2)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias => ''); +DefConstructor('\atwindef@def{}{}{}', + "<omdoc:term role='definiendum' name='#1-#2-#3' cd='#theory'>#1 #2 #3</omdoc:term>", + afterDigest => sub { + my ($stomach, $whatsit) = @_; + my $addr = LookupValue('defs'); + push(@$addr, $whatsit->getArg(1)->toString.'-'.$whatsit->getArg(2)->toString + .'-'.$whatsit->getArg(3)->toString) if $addr; + $whatsit->setProperty(theory=>LookupValue('current_module')); + return; }, + alias => ''); +DefCMPEnvironment('{notation} OptionalKeyVals:stat', + "<omdoc:omtext type='notation' ?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id').not')()>" + . "?&KeyVal(#1,'title')(<omdoc:metadata><dc:title>&KeyVal(#1,'title')</dc:title></omdoc:metadata>)()" + . "<omdoc:CMP><omdoc:p>#body</omdoc:p></omdoc:CMP>" + . "</omdoc:omtext>\n"); +DefConstructor('\notatiendum OptionalKeyVals:notation {}', + "<omdoc:phrase type='notation'>#1</omdoc:phrase>"); +1; diff --git a/Master/texmf-dist/tex/latex/stex/stex.sty b/Master/texmf-dist/tex/latex/stex/stex.sty new file mode 100644 index 00000000000..518540f8bca --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/stex.sty @@ -0,0 +1,20 @@ +%% +%% This is file `stex.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% stex.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{stex}[2006/01/13 v0.9a Semantic Markup] +\def\stex{{\raisebox{-.5ex}S\kern-.5ex\TeX}} +\def\sTeX{\stex} +\usepackage{modules} +\usepackage{statements} +\usepackage{sproof} +\usepackage{omdoc} +\usepackage{presentation} +\endinput +%% +%% End of file `stex.sty'. diff --git a/Master/tlpkg/bin/ctan2tds b/Master/tlpkg/bin/ctan2tds index b2ffce53525..7b5db3ac7dc 100755 --- a/Master/tlpkg/bin/ctan2tds +++ b/Master/tlpkg/bin/ctan2tds @@ -362,6 +362,7 @@ chdir $startdir || die "chdir($startdir) failed: $!"; # back to raw 'songs', "die 'skipping, requires binary'", 'staves', "&MAKEflatten", 'stellenbosch',"&MAKEcopy", + 'stex', "&MAKEflatten", 'symbolindex', "die 'skipping, requires binary'", 't2', "&MAKEt2", 'tamethebeast',"&MAKEtamethebeast", diff --git a/Master/tlpkg/bin/ctan2tl b/Master/tlpkg/bin/ctan2tl index 8f852e12bcd..ff4b8d78187 100755 --- a/Master/tlpkg/bin/ctan2tl +++ b/Master/tlpkg/bin/ctan2tl @@ -102,7 +102,7 @@ ctan2tds --ctan-dir=$ctan_dir1 $pkg || exit 1 cd $cooked || exit 1 printf "\n\f cooked\n" find -depth -type d | xargs rmdir 2>/dev/null # remove empty directories -find $pkg \! -type d -printf "%TY%Tm%Td.%TH%TM %p\n" | sort -r -k1 +find $pkg \! -type d -printf "%TY%Tm%Td.%TH%TM %p\n" | sort -k2 printf "\n$0: calling place $place_chicken $pkg\n" rm -rf $pkg.done diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index ff06f7f82bd..0701e0a3824 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -169,8 +169,8 @@ my @WorkingTLP = qw( skak skaknew slideshow smalltableof smartref snapshot songbook sort-by-letters soul sparklines spie splines splitbib splitindex spotcolor sprite srcltx sseq - ssqquote stack stage staves stdclsdv stdpage statex2 stellenbosch - stringstrings struktex + ssqquote stack stage statex2staves stdclsdv stdpage stellenbosch + stex stringstrings struktex sttools stubs subdepth subeqn subeqnarray subfig subfigure subfloat substr sudoku sudokubundle sugconf supertabular susy svgcolor svn svn-multi svninfo diff --git a/Master/tlpkg/tlpsrc/collection-mathextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-mathextra.tlpsrc index 5919c57c7d8..69d5f19954f 100644 --- a/Master/tlpkg/tlpsrc/collection-mathextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-mathextra.tlpsrc @@ -19,6 +19,7 @@ depend mh depend mhequ depend nath depend statex2 +depend stex depend stmaryrd depend susy depend synproof diff --git a/Master/tlpkg/tlpsrc/stex.tlpsrc b/Master/tlpkg/tlpsrc/stex.tlpsrc new file mode 100644 index 00000000000..b057bb0d965 --- /dev/null +++ b/Master/tlpkg/tlpsrc/stex.tlpsrc @@ -0,0 +1,2 @@ +name stex +category Package |