diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/cmath/cmath.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/stex/cmath/cmath.dtx | 219 |
1 files changed, 96 insertions, 123 deletions
diff --git a/Master/texmf-dist/source/latex/stex/cmath/cmath.dtx b/Master/texmf-dist/source/latex/stex/cmath/cmath.dtx index 413729e1c6f..868110a2b14 100644 --- a/Master/texmf-dist/source/latex/stex/cmath/cmath.dtx +++ b/Master/texmf-dist/source/latex/stex/cmath/cmath.dtx @@ -3,13 +3,13 @@ % 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 -% $HeadURL: https://svn.kwarc.info/repos/stex/trunk/sty/cmath/cmath.dtx $ +% The original of this file is in the public repository at +% http://github.com/KWARC/sTeX/ % \fi % % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] -%<package>\ProvidesPackage{cmath}[2012/01/28 v0.1 inline content math] +%<package>\ProvidesPackage{cmath}[2016/04/07 v0.1 inline content math] % %<*driver> \documentclass{ltxdoc} @@ -17,12 +17,12 @@ \usepackage{modules,cmath,stex-logo} \usepackage[show]{ed} \usepackage[hyperref=auto,style=alphabetic]{biblatex} -\bibliography{kwarc} -\usepackage{../ctansvn} +\addbibresource{kwarcpubs.bib} +\addbibresource{extpubs.bib} +\addbibresource{kwarccrossrefs.bib} +\addbibresource{extcrossrefs.bib} +\usepackage{ctangit} \usepackage{hyperref} -\usepackage[eso-foot,today]{svninfo} -\svnInfo $Id: cmath.dtx 1999 2012-01-28 07:32:11Z kohlhase $ -\svnKeyword $HeadURL: https://svn.kwarc.info/repos/stex/trunk/sty/cmath/cmath.dtx $ \makeindex \floatstyle{boxed} \newfloat{exfig}{thp}{lop} @@ -32,10 +32,11 @@ %</driver> % \fi % -% \CheckSum{83} +% \CheckSum{84} % -% \changes{v0.1}{2011/01/24}{First Version with Documentation, extracted variables stuff +% \changes{v0.2}{2016/02/12}{First Version with Documentation, extracted variables stuff % from \texttt{presentation.dtx}} +% \changes{v0.2}{2016/02/12}{reinstating id macros from \texttt{latexml.sty}} % \GetFileInfo{cmath.sty} % % \MakeShortVerb{\|} @@ -66,7 +67,7 @@ % 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 build content math expresions +% This package supplies an infrastructure that allows to build content math expressions % (strict content MathML or OpenMath objects) in the text. This is needed whenever the % head symbols of expressions are variables and can thus not be treated via the % |\symdef| mechanism in \stex. @@ -134,9 +135,9 @@ % \subsection{Applications}\label{sec:user:appl} % % To construct a content math application of the form $f(a_1,\ldots,a_n)$ with concrete -% arrugments $a_i$ (i.e. without elisions), then we can use the -% \DescribeMacro{\nappa}|\nappa| maro. If we have elisions in the arguments, then we have -% to interpret the arguments as a sequence of argument constructors applied to the +% arguments $a_i$ (i.e. without elisions), then we can use the +% \DescribeMacro{\nappa}|\nappa| macro. If we have elisions in the arguments, then we +% have to interpret the arguments as a sequence of argument constructors applied to the % respective positional indexes. We can mark up this situation with the % \DescribeMacro{\nappf}|\nappf| macro: % |\nappf{|\meta{fun}|}{|\meta{const}|}{|\meta{first}|}{|\meta{last}|}| where \meta{const} @@ -145,23 +146,32 @@ % Figure~\ref{fig:application} for a concrete example, and % Figure~\ref{fig:application-result}.\ednote{MK@MK: we need a meta-cd |cmath| with the % respective notation definition here. It is very frustrating that we cannot even really -% write down the axiomatization of } -% +% write down the axiomatization of flexary constants in OpenMath.} +% % \begin{figure}\centering % \begin{tabular}{|l|l|}\hline % \verb|\nappa{f}{a_1,a_2,a_3}| & $\nappa{f}{a_1,a_2,a_3}$\\\hline % \verb|\nappe{f}{a_1}{a_n}| & $\nappe{f}{a_1}{a_n}$\\\hline -% \verb|\symdef{eph}[1]{e_{#1}^{\varphi(#1)}}\nappf{g}\eph14| -% & $\def\foo#1{e_{#1}^{\varphi(#1)}}\nappf{g}\foo14$\\\hline +% \verb|\symdef{eph}[1]{e_{#1}^{\varphi(#1)}}|& $\def\foo#1{e_{#1}^{\varphi(#1)}}\nappf{g}\foo14$\\ +% \verb|\nappf{g}\eph14| +% & \\\hline % \verb|\nappli{f}a1n| & $\nappli{f}a1n$\\\hline +% \verb|\nappui{f}a1n| & $\nappui{f}a1n$\\\hline % \end{tabular} % \caption{Application Macros}\label{fig:application} % \end{figure} % -% For a simple elision in the argument list, we can use \DescribeMacro{\nappe}|\nappe| -% macro: |\nappe{|\meta{fun}|}{|\meta{firstarg}|}{|\meta{lastarg}|}| will be formatted as -% $\meta{fun}(\meta{firstarg},\ldots,\meta{lastarg})$. Note that this is quite unsemantic -% (we have to guess the sequence), so the use of |\nappe| is discouraged. +% For a simple elision in the arguments, we can use +% \DescribeMacro{\nappe}|\nappe{|\meta{fun}|}{|\meta{first}|}{|\meta{last}|}| will be +% formatted as $\meta{fun}(\meta{first},\ldots,\meta{last})$. Note that this is quite +% un-semantic (we have to guess the sequence), so the use of |\nappe| is discouraged. +% +% A solution to this situation is if we can think of the arguments as a finite sequence +% $a=:(a_i)_{l\leq i\leq h}$, then we can use \DescribeMacro +% {\nappli}|\nappli{|\meta{fun}|}{|\meta{seq}|}{|\meta{start}|}{|\meta{end}|}|, where +% \meta{seq} is the sequence, and the remaining arguments are the start and end index. The +% \DescribeMacro{\nappui} works like |\nappli|, but uses upper indices in the +% presentation. % % \begin{exfig}\centering % \begin{verbatim} @@ -186,12 +196,16 @@ % \end{exfig} % % \subsection{Binders}\label{sec:user:bind} +%\ednote{MK: document} +% +% \subsection{Sharing}\label{sec:user:sharing} +% We (currently) use the % % \section{Limitations}\label{sec:limitations} % % In this section we document known limitations. If you want to help alleviate them, % please feel free to contact the package author. Some of them are currently discussed in -% the \sTeX TRAC~\cite{sTeX:online}. +% the \sTeX GitHub repository~\cite{sTeX:github:on}. % \begin{compactenum} % \item none reported yet % \end{compactenum} @@ -200,35 +214,23 @@ % % \section{The Implementation}\label{sec:implementation} % -% The |cmath| package generates to files: the {\LaTeX} package (all the code -% between {\textsf{$\langle$*package$\rangle$}} and {\textsf{$\langle$/package$\rangle$}}) and the -% {\latexml} bindings (between {\textsf{$\langle$*ltxml$\rangle$}} and -% {\textsf{$\langle$/ltxml$\rangle$}}). We keep the corresponding code fragments together, -% since the documentation applies to both of them and to prevent them from getting out of -% sync. -% -% For {\latexml}, we initialize the package inclusions. -% \begin{macrocode} -%<*ltxml> -# -*- CPERL -*- -package LaTeXML::Package::Pool; -use strict; -use LaTeXML::Package; -%</ltxml> -% \end{macrocode} -% % \subsection{Package Options}\label{sec:impl:options} % -% We declare some switches which will modify the behavior according to the package -% options. Generally, an option |xxx| will just set the appropriate switches to true -% (otherwise they stay false).\ednote{we have no options at the moment} +% The |cmath| package does not take options (at the moment), but we pass any we get to the +% |presentation| package. % % \begin{macrocode} %<*package> +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{presentation}} \ProcessOptions -%</package> % \end{macrocode} % +% The next measure is to ensure that some {\sTeX} packages are loaded. For {\latexml}, we +% also initialize the package inclusions, there we do not need |ntheorem|, since the XML +% does not do the presentation. +% \begin{macrocode} +\RequirePackage{presentation} +% \end{macrocode} % \subsection{Variable Names}\label{sec:impl:vname} % @@ -239,114 +241,85 @@ use LaTeXML::Package; % we default them to |xml:id="cvar.|\meta{count}|"| and % |name="name.cvar.|\meta{count}|"|. % \begin{macrocode} -%<*package> -\newcommand{\vname}[2][]{#2% +\newcommand\vname[2][]{#2% \def\@opt{#1}% \ifx\@opt\@empty\else\expandafter\gdef\csname MOD@name@#1\endcsname{#2}\fi} -%</package> -%<*ltxml> -# return: unique ID for variable -sub cvar_id { - my ($id) = @_; - $id = ToString($id); - if (!$id) { - $id=LookupValue('cvar_id') || 0; - AssignValue('cvar_id', $id + 1, 'global'); } - "cvar.$id"; }#$ -DefConstructor('\vname[]{}', - "<ltx:XMWrap role='ID' xml:id='&cvar_id(#1)'>#2</ltx:XMWrap>", - requireMath=>1); -%</ltxml> % \end{macrocode} % \end{macro} % % \begin{macro}{\vnref} % \begin{macrocode} -%<*package> \def\vnref#1{\csname MOD@name@#1\endcsname} -%</package> -%<*ltxml> -# \vnref{<reference>} -DefMacro('\vnref{}','\@XMRef{cvar.#1}'); - -%</ltxml> % \end{macrocode} % \end{macro} % \ednote{the following macros are just ideas, they need to be implemented and documented} % \begin{macro}{\uivar} % constructors for variables. % \begin{macrocode} -%<*package> -\newcommand{\primvar}[2][]{\vname[#1]{#2^\prime}} -\newcommand{\pprimvar}[2][]{\vname[#1]{#2^{\prime\prime}}} -\newcommand{\uivar}[3][]{\vname[#1]{{#2}^{#3}}} -\newcommand{\livar}[3][]{\vname[#1]{{#2}_{#3}}} -\newcommand{\ulivar}[4][]{\vname[#1]{{#2}^{#3}_{#4}}} -%</package> -%<*ltxml> -# variants for declaring variables -DefMacro('\uivar[]{}{}', '\vname[#1]{{#2}^{#3}}'); -DefMacro('\livar[]{}{}', '\vname[#1]{{#2}_{#3}}'); -DefMacro('\ulivar[]{}{}{}', '\vname[#1]{{#2}^{#3}_{#4}}'); -DefMacro('\primvar[]{}', '\vname[#1]{#2^\prime}'); -DefMacro('\pprimvar[]{}', '\vname[#1]{#2^{\prime\prime}}'); - -%</ltxml> +\newcommand\primvar[2][]{\vname[#1]{#2^\prime}} +\newcommand\pprimvar[2][]{\vname[#1]{#2^{\prime\prime}}} +\newcommand\uivar[3][]{\vname[#1]{{#2}^{#3}}} +\newcommand\livar[3][]{\vname[#1]{{#2}_{#3}}} +\newcommand\ulivar[4][]{\vname[#1]{{#2}^{#3}_{#4}}} % \end{macrocode} % \end{macro} % % \subsection{Applications}\label{sec:impl:appl} % % \begin{macro}{\napp*} +% \ednote{document keyval args above and implement them in LaTeXML} % \begin{macrocode} -%<*package> -\newcommand\nappa[2]{#1\left(#2\right)} -\newcommand\nappe[3]{\nappa{#1}{#2,\ldots,#3}} -\newcommand\nappf[4]{\nappe{#1}{#2{#3}}{#2{#4}}} -\newcommand\nappli[4]{\nappe{#1}{#2_{#3}}{#2_{#4}}} -\newcommand\nappui[4]{\nappe{#1}{#2^{#3}}{#2^{#4}}} -%</package> -%<*ltxml> -# \nappa{<function>}{<(const)(,\1)*>} -# @#1(#2) -DefConstructor('\nappa{}{}', - "<ltx:XMApp>" - ."<ltx:XMTok meaning='#1' />" - ."<ltx:XMArg>#2</ltx:XMArg>" - ."</ltx:XMApp>"); - -# \@napp@seq{<function>}{start <const>}{end <const>} -# @#1(@sequence(#2,sequencefromto,#3)) -DefConstructor('\@napp@seq{}{}{}', - "<ltx:XMApp>" - ."<ltx:XMTok meaning='#1' />" - ."<ltx:XMArg>" - ."<ltx:XMApp>" - ."<ltx:XMTok meaning='sequence' />" - ."<ltx:XMArg>#2</ltx:XMArg>" - ."<ltx:XMArg><ltx:XMTok meaning='sequencefromto' /></ltx:XMArg>" - ."<ltx:XMArg>#3</ltx:XMArg>" - ."</ltx:XMApp>" - ."</ltx:XMArg>" - ."</ltx:XMApp>"); - -DefMacro('\nappe{}{}{}', '\@napp@seq{#1}{#2}{#3}'); -DefMacro('\nappf{}{}{}{}', '\@napp@seq{#1}{#2{#3}}{#2{#4}}'); -DefMacro('\nappli{}{}{}{}', '\@napp@seq{#1}{#2_{#3}}{#2_{#4}}'); -DefMacro('\nappui{}{}{}{}', '\@napp@seq{#1}{#2^{#3}}{#2^{#4}}'); - -%</ltxml> +\newcommand\nappa[3][]{\prefix[#1]{#2}{#3}} +\newcommand\nappe[4][]{\nappa[#1]{#2}{#3,\ldots,#4}} +\newcommand\nappf[5][]{\nappe[#1]{#2}{#3{#4}}{#3{#5}}} +\newcommand\nappli[5][]{\nappe[#1]{#2}{#3_{#4}}{#3_{#5}}} +\newcommand\nappui[5][]{\nappe[#1]{#2}{#3^{#4}}{#3^{#5}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\anapp*} +% \ednote{document anapp* and implement in LaTeXML (i.e. get the presentation +% information into the OM/MathML).} +% \begin{macrocode} +\newcommand\anappa[3][]{\assoc[#1]{#2}{#3}} +\newcommand\anappe[4][]{\anappa[#1]{#2}{#3,\ldots,#4}} +\newcommand\anappf[5][]{\anappe[#1]{#2}{#3{#4}}{#3{#5}}} +\newcommand\anappli[5][]{\anappe[#1]{#2}{#3_{#4}}{#3_{#5}}} +\newcommand\anappui[5][]{\anappe[#1]{#2}{#3^{#4}}{#3^{#5}}} % \end{macrocode} % \end{macro} % % \subsection{Binders}\label{sec:impl:bind} % -% \subsection{Finale} +% \subsection{Sharing}\label{sec:user:sharing} +% These macros are lifted from Bruce Miller's |latexml.sty|, we do not want the rest. +% \begin{macro}{\LXMID} +% \begin{macrocode} +\def\LXMID#1#2{\expandafter\gdef\csname xmarg#1\endcsname{#2}\csname xmarg#1\endcsname} +% \end{macrocode} +% \end{macro} % -% Finally, we need to terminate the file with a success mark for perl. +% \begin{macro}{\LXMRef} % \begin{macrocode} -%<ltxml>1; +\def\LXMRef#1{\csname xmarg#1\endcsname} +%</package> % \end{macrocode} +% \end{macro} % \Finale \endinput % +% Local Variables: +% mode: doctex +% TeX-master: t +% End: +% +% LocalWords: iffalse NeedsTeXFormat cmath cmath.dtx texttt presentation.dtx scsys sc +% LocalWords: sc mathml omdoc latexml cmathml activemath twintoo atwin atwintoo stex lt +% LocalWords: fileversion filedate maketitle symdef newpage setcounter tocdepth newpage +% LocalWords: tableofcontents ary widetilde cdot vname vname vnref vnname ednote livar +% LocalWords: livar ulivar ulivar primvar primvar pprimvar pprimvar ldots nappa nappa +% LocalWords: nappf nappf hline nappe eph varphi nappli nappli firstarg lastarg exfig +% LocalWords: compactenum printbibliography textsf langle rangle textsf langle rangle +% LocalWords: ltxml cvar newcommand ifx expandafter gdef csname endcsname ltx uivar leq +% LocalWords: napp nappui sequencefromto endinput seq + |