diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/omtext/omtext.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/stex/omtext/omtext.dtx | 250 |
1 files changed, 156 insertions, 94 deletions
diff --git a/Master/texmf-dist/source/latex/stex/omtext/omtext.dtx b/Master/texmf-dist/source/latex/stex/omtext/omtext.dtx index 15fef2612a2..c5cc4c0c20a 100644 --- a/Master/texmf-dist/source/latex/stex/omtext/omtext.dtx +++ b/Master/texmf-dist/source/latex/stex/omtext/omtext.dtx @@ -10,12 +10,14 @@ % % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] -%<package>\ProvidesPackage{omtext}[2016/04/07 v1.1 OMDoc Text Fragments] +%<package>\ProvidesPackage{omtext}[2019/03/20 v1.1 OMDoc Text Fragments] % %<*driver> \documentclass{ltxdoc} +\usepackage[utf8]{inputenc} \usepackage{url,array,float,amsfonts} \usepackage{omtext,omdoc} +\usepackage{graphicx} \usepackage[show]{ed} \usepackage[hyperref=auto,style=alphabetic]{biblatex} \addbibresource{kwarcpubs.bib} @@ -29,8 +31,11 @@ \floatstyle{boxed} \newfloat{exfig}{thp}{lop} \floatname{exfig}{Example} -\def\tracissue#1{\cite{sTeX:online}, \hyperlink{http://trac.kwarc.info/sTeX/ticket/#1}{issue #1}} -\begin{document}\DocInput{omtext.dtx}\end{document} +\def\githubissue#1{\cite{sTeX:github:on}, \hyperlink{https://github.com/KWARC/sTeX/issues/#1}{issue #1}} +\begin{document} +\RecordChanges +\DocInput{omtext.dtx} +\end{document} %</driver> % \fi % @@ -59,7 +64,7 @@ % \title{\texttt{omtext}: Semantic Markup for Mathematical Text Fragments in {\LaTeX}\thanks{Version {\fileversion} (last revised % {\filedate})}} % \author{Michael Kohlhase\\ -% Jacobs University, Bremen\\ +% FAU Erlangen-N\"urnberg\\ % \url{http://kwarc.info/kohlhase}} % \maketitle % @@ -177,13 +182,13 @@ % A more complex example has multiple identifiers embedded in a restriction, as in ``Let % $x,y,z\in\mathbb{R}$, such that $x+2y=z$, then \ldots'', which we mark up as % \begin{verbatim} -% Let \vdec{\vids[x,y,z]{$\minset{x,y,z}\Reals$}, +% Let \vdec[x,y,z]{\vcond$\minset{x,y,z}\Reals$}, % such that \vrest{$x+2y=z$}}, then \ldots'' % \end{verbatim} -% \ednote{explain and make better examples}\ednote{unify this with the vardef macros -% from (currently) the modules package.}\ednote{talk with Frederic about this see what -% other examples there are.}\ednote{how do we identify the variables in complex +% \ednote{explain and make better examples}\ednote{talk with Frederic about this see +% what other examples there are.}\ednote{how do we identify the variables in complex % restriction patterns. maybe with LMXref, which we should reinstate for this.} +% \ednote{document strucdec and impdec} % \end{omgroup} % % \begin{omgroup}[id=sec:user:block]{Block-Level Markup} @@ -222,42 +227,69 @@ % package and class make the usual |\index| macro undefined\ednote{implement this and % issue the respective error message}. % -% The \DescribeMacro{\indextoo}|\indextoo| macro renders a word and marks it for the -% index. Sometimes, we want to index a slightly different form of the word, e.g. for -% non-standard plurals: while |\indextoo{word}s| works fine, we cannot use this for the -% word ``datum'', which has the plural ``data''. For this we have the macro -% \DescribeMacro{\indexalt}|\indexalt|, which takes another argument for the displayed -% text, allowing us to use |\indexalt{data}{datum}|, which prints ``data'' but puts -% ``datum'' into the index. -% -% The second set of macros adds an infrastructure for two-word compounds. Take for -% instance the compound ``OMDoc document'', which we usually want to add into the index -% under ``OMDoc'' and ``document''. \DescribeMacro{\twintoo}|\twintoo{OMDoc}{document}| -% is a variant of |\indextoo| that will do just this. Again, we have a version that -% prints a variant: This is useful for situations like this the one in -% Figure~\ref{fig:index-markup}: +% The \DescribeMacro{\indi}|\indi| macro renders a word and marks it for the +% index. Sometimes, we want to index a slightly different form of the word, e.g. for +% non-standard plurals: while |\indi{word}s| works fine, we cannot use this for the +% word ``datum'', which has the plural ``data''. For this we have the macro +% \DescribeMacro{\aindi}|\aindi|, which takes another argument for the displayed text, +% allowing us to use |\aindi{data}{datum}|, which prints ``data'' but puts ``datum'' +% into the index. +% +% The second set of macros adds an infrastructure for multi-word compounds. Take for +% instance the compound ``OMDoc document'', which we usually want to add into the +% index under ``OMDoc'' and +% ``document''. \DescribeMacro{\indii}|\indii{OMDoc}{document}| is a variant of +% |\indi| that will do just this. Again, we have a version that prints a variant: This +% is useful for situations like this the one in Figure~\ref{fig:index-markup}: % \begin{exfig} % \begin{verbatim} -% We call group \twinalt{Abelian}{Abelian}{group}, iff \ldots +% We call group \aindii{Abelian}{Abelian}{group}, iff \ldots % \end{verbatim} % \vspace*{-1em}will result in the following % \begin{quote} -% We call group \twinalt{Abelian}{Abelian}{group}, iff \ldots +% We call group \aindii{Abelian}{Abelian}{group}, iff \ldots % \end{quote} % and put ``Abelian Group'' into the index. % \caption{Index markup}\label{fig:index-markup} % \end{exfig} % -% The third set of macros does the same for two-word compounds with adjectives, -% e.g. ``wonderful OMDoc -% document''. \DescribeMacro{\atwintoo}|\atwin{wonderful}{OMdoc}{document}| will make the -% necessary index entries under ``wonderful'' and ``document''. Again, we have a variant -% \DescribeMacro{\atwinalt}|\atwinalt| whose first argument is the alternative text. -% -% All index macros take an optional first argument that is used for ordering the -% respective entries in the index. +% Analogously, there are variants for tree/four-word compounds: +% \DescribeMacro{\indiii}|\indiii|, \DescribeMacro{\aindiii}|\aindiii|, +% \DescribeMacro{\indiv}|\indiv|, and \DescribeMacro{\aindiv}|\indiv|. For instance for +% ``wonderful OMDoc +% document''. \DescribeMacro{\indiii}|\atwin{wonderful}{OMdoc}{document}| will make the +% necessary index entries under ``wonderful'' and ``document''. +% +% Finally, there are variants \DescribeMacro{\Indi*}|\Indi|, |\Indii|, |\Indiii|, and +% |\Indiv| that print the capitalized version of the word complex, and |\indis|, +% |\indiis|, |\indiiis|, and |\indivs| that add a plurals, and ultimately +% \DescribeMacro{\Indi*}|\Indis|, |\Indiis|, |\indiiis|, and |\Indivs| that print the +% capitalized version of the plural. +% +% All index macros take an optional first keyword argument: If the |loadmodules| key is +% given, we import the module we are in, otherwise all the currently imported modules. We +% do not have to require the module files, since the index is a the end of the +% document. If the |at| key is given, then we use that for sorting in the index. % \end{omgroup} % +% \begin{omgroup}[id=sec:user:misc]{Miscellaneous} +% +% We supply some text-level shortcuts for mathematical formulations, for instance \hateq +% for ``this corresponds to'' or \ergo for ``therefore''. They are semantic in the sense +% that they are used as special words -- not part of formulae, even though they look +% like mathematical symbols. The following table gives the full set. +% \begin{center} +% \DescribeMacro{\hateq}\DescribeMacro {\hatequiv} +% \DescribeMacro {\ergo}\DescribeMacro{\ogre} +% \begin{tabular}{|l|l|l|}\hline +% macro & pres. & stands for \\\hline +% |\hateq| & \hateq& this corresponds to\\ +% |\hatequiv| & \hatequiv & this statement corresponds to\\ +% |\ergo| &\ergo & therefore\\ +% |\ogre| &\ogre & because of \\\hline +% \end{tabular} +% \end{center} +% \end{omgroup} % \end{omgroup} % % \begin{omgroup}{Limitations}\label{sec:limitations} @@ -265,9 +297,9 @@ % 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 GitHub repository~\cite{sTeX:github:on}. -% \begin{compactenum} +% \begin{enumerate} % \item none reported yet -% \end{compactenum} +% \end{enumerate} % \end{omgroup} % % \StopEventually{\newpage\PrintIndex\newpage\PrintChanges\printbibliography}\newpage @@ -419,10 +451,25 @@ % development and may change at any time. Currently they are completely empty. % % \begin{macrocode} -\newcommand\vdec[1]{#1} -\newcommand\vids[2][]{#2} +\newcommand\vdec[2][]{#2} \newcommand\vrest[2][]{#2} +\newcommand\vcond[2][]{#2} +% \end{macrocode} +% +% \begin{macro}{\strucdec} +% \ednote{document above} +% \begin{macrocode} +\newcommand\strucdec[2][]{#2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\impdec} +% \ednote{document above} +% \begin{macrocode} +\newcommand\impdec[2][]{#2} % \end{macrocode} +% \end{macro} +% % \end{omgroup} % % \begin{omgroup}[id=sec:impl:block]{Block-Level Markup} @@ -432,7 +479,7 @@ \def\begin@sblockquote{\begin{quote}\sl} \def\end@sblockquote{\end{quote}} \def\begin@@sblockquote#1{\begin@sblockquote} -\def\end@@sblockquote#1{\def\@@lec##1{{\rm ##1}}\@lec{#1}\end@sblockquote} +\def\end@@sblockquote#1{\def\@@lec##1{\textrm{##1}}\@lec{#1}\end@sblockquote} \newenvironment{sblockquote}[1][] {\def\@opt{#1}\ifx\@opt\@empty\begin@sblockquote\else\begin@@sblockquote\@opt\fi} {\ifx\@opt\@empty\end@sblockquote\else\end@@sblockquote\@opt\fi} @@ -443,7 +490,7 @@ % \begin{macrocode} \newenvironment{sboxquote}[1][] {\def\@@src{#1}\begin{mdframed}[leftmargin=.5cm,rightmargin=.5cm]} -{\@lec{\rm\@@src}\end{mdframed}} +{\@lec{\textrm\@@src}\end{mdframed}} % \end{macrocode} % \end{environment} % @@ -473,8 +520,9 @@ % \end{omgroup} % % \begin{omgroup}[id=sec:impl:index]{Index Markup} +% % \begin{macro}{\omdoc@index*} -% these are the main internal indexing commands -- dividing them into three is awful, +% these are the main internal indexing commands -- dividing them into four macros is awful, % but I did not get list processing running. It makes sure that the modules necessary % for interpreting the math in the index entries are loaded. If the |loadmodules| key is % given, we import the module we are in otherwise all the currently imported modules. We @@ -513,7 +561,20 @@ \string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#2}!% \string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#3}!% \string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#4}% -\else #2!#3\fi% loadmodules +\else #2!#3!#4\fi% loadmodules +}{\thepage}}% +\endgroup\@esphack\fi}%ifindex +\newcommand\omdoc@indexiv[5][]{\ifindex% +\metasetkeys{omdoc@index}{#1}% +\@bsphack\begingroup\@sanitize% +\protected@write\@indexfile{}{\string\indexentry% +{\ifx\omdoc@index@at\@empty\else\omdoc@index@at @\fi% +\ifx\omdoc@index@loadmodules\@true% +\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#2}!% +\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#3}!% +\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#4}% +\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#5}% +\else #2!#3!#4!#5\fi% loadmodules }{\thepage}}% \endgroup\@esphack\fi}%ifindex % \end{macrocode} @@ -521,57 +582,34 @@ % % Now, we make two interface macros that make use of this: % -% \begin{macro}{\indexalt} -% \begin{macrocode} -\newcommand\indexalt[3][]{{#2}\omdoc@indexi[#1]{#3}} % word in text and index -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\indextoo} -% \begin{macrocode} -\newcommand\indextoo[2][]{{#2}\omdoc@indexi[#1]{#2}} % word in text and index -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@twin} -% this puts two-compound words into the index in various permutations -% \begin{macrocode} -\newcommand\@twin[3][]{\omdoc@indexii[#1]{#2}{#3}\omdoc@indexii[#1]{#3}{#2}} -% \end{macrocode} -% \end{macro} -% -% And again we have two interface macros building on this -% -% \begin{macro}{\twinalt} -% \begin{macrocode} -\newcommand\twinalt[4][]{#2\@twin[#1]{#3}{#4}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\twinalt} -% \begin{macrocode} -\newcommand\twintoo[3][]{{#2 #3}\@twin[#1]{#2}{#3}} % and use the word compound too -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@atwin} -% this puts adjectivized two-compound words into the index in various -% permutations\ednote{what to do with the optional argument here and below?} +% \begin{macro}{\*indi*} % \begin{macrocode} -\newcommand\@atwin[4][]{\omdoc@indexiii[#1]{#2}{#3}{#4}\omdoc@indexii[#1]{#3}{#2 (#4)}} -% \end{macrocode} -% \end{macro} -% -% and the two interface macros for this case: -% \begin{macro}{\@atwinalt} -% \begin{macrocode} -\newcommand\atwinalt[5][]{#2\@atwin[#1]{#3}{#4}{#4}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\atwintoo} -% \begin{macrocode} -\newcommand\atwintoo[4][]{{#2 #3 #4}\@atwin[#1]{#2}{#3}{#4}} % and use it too +\newcommand\aindi[3][]{{#2}\omdoc@indexi[#1]{#3}} +\newcommand\indi[2][]{{#2}\omdoc@indexi[#1]{#2}} +\newcommand\indis[2][]{{#2}\omdoc@indexi[#1]{#2s}} +\newcommand\Indi[2][]{{\captitalize{#2}}\omdoc@indexi[#1]{#2}} +\newcommand\Indis[2][]{{\capitalize{#2}}\omdoc@indexi[#1]{#2s}} + +\newcommand\@indii[3][]{\omdoc@indexii[#1]{#2}{#3}\omdoc@indexii[#1]{#3}{#2}} +\newcommand\aindii[4][]{#2\@indii[#1]{#3}{#4}} +\newcommand\indii[3][]{{#2 #3}\@indii[#1]{#2}{#3}} +\newcommand\indiis[3][]{{#2 #3s}\@indii[#1]{#2}{#3}} +\newcommand\Indii[3][]{{\captitalize{#2 #3}}\@indii[#1]{#2}{#3}} +\newcommand\Indiis[3][]{{\capitalize{#2 #3}}\@indii[#1]{#2}{#3}} + +\newcommand\@indiii[4][]{\omdoc@indexiii[#1]{#2}{#3}{#4}\omdoc@indexii[#1]{#3}{#2 (#4)}} +\newcommand\aindiii[5][]{{#2}\@indiii[#1]{#3}{#4}{#5}} +\newcommand\indiii[4][]{{#2 #3 #4}\@indiii[#1]{#2}{#3}{#4}} +\newcommand\indiiis[4][]{{#2 #3 #4s}\@indiii[#1]{#2}{#3}{#4}} +\newcommand\Indiii[4][]{\captitalize{#2 #3 #4}\@indiii[#1]{#2}{#3}{#4}} +\newcommand\Indiiis[4][]{\capitalize{#2 #3 #4s}\@indiii[#1]{#2}{#3}{#4}} + +\newcommand\@indiv[5][]{\omdoc@indexiv[#1]{#2}{#3}{#4}{#5}} +\newcommand\aindiv[6][]{#2\@indiv[#1]{#3}{#4}{#5}{#6}} +\newcommand\indiv[5][]{{#2 #3 #4 #5}\@indiv[#1]{#2}{#3}{#4}{#5}} +\newcommand\indivs[5][]{{#2 #3 #4 #5s}\@indiv[#1]{#2}{#3}{#4}{#5}} +\newcommand\Indiv[5][]{\capitalize{#2 #3 #4 #5s}\@indiv[#1]{#2}{#3}{#4}{#5}} +\newcommand\Indivs[5][]{\capitalize{#2 #3 #4 #5s}\@indiv[#1]{#2}{#3}{#4}{#5}} % \end{macrocode} % \end{macro} % \end{omgroup} @@ -580,18 +618,42 @@ % Some shortcuts that use math symbols but are not mathematical at all; in particular, % they should not be translated by {\latexml}. % \begin{macrocode} -\newcommand\hateq{\ensuremath{\hat=}\xspace} -\newcommand\hatequiv{\ensuremath{\hat\equiv}\xspace} +\newcommand\hateq{\ensuremath{\widehat=}\xspace} +\newcommand\hatequiv{\ensuremath{\widehat\equiv}\xspace} \@ifundefined{ergo}% {\newcommand\ergo{\ensuremath{\leadsto}\xspace}}% {\renewcommand\ergo{\ensuremath{\leadsto}\xspace}}% \newcommand{\reflect@squig}[2]{\reflectbox{$\m@th#1\rightsquigarrow$}}% \newcommand\ogre{\ensuremath{\mathrel{\mathpalette\reflect@squig\relax}}\xspace}% -%</package> +\newcommand\notergo{\ensuremath{\not\leadsto}} +\newcommand\notogre{\ensuremath{\not\mathrel{\mathpalette\reflect@squig\relax}}\xspace}% % \end{macrocode} % % \end{omgroup} -%\end{omgroup} +% +% \begin{omgroup}{Deprecated Functionality}\label{sec:deprecated} +% +% In this section we centralize old interfaces that are only partially supported any +% more. +% \begin{macro}{\*def*} +% \begin{macrocode} +\newcommand\indextoo[2][]{\indi[#1]{#2}% +\PackageWarning{omtext}{\protect\indextoo\space is deprecated, use \protect\indi\space instead}} +\newcommand\indexalt[2][]{\aindi[#1]{#2}% +\PackageWarning{omtext}{\protect\indextoo\space is deprecated, use \protect\aindi\space instead}} +\newcommand\twintoo[3][]{\indii[#1]{#2}{#3}% +\PackageWarning{omtext}{\protect\twintoo\space is deprecated, use \protect\indii\space instead}} +\newcommand\twinalt[3][]{\aindii[#1]{#2}{#3}% +\PackageWarning{omtext}{\protect\twinalt\space is deprecated, use \protect\aindii\space instead}} +\newcommand\atwintoo[4][]{\indiii[#1]{#2}{#3}{#4}% +\PackageWarning{omtext}{\protect\atwintoo\space is deprecated, use \protect\indiii\space instead}} +\newcommand\atwinalt[4][]{\aindii[#1]{#2}{#3}{#4}% +\PackageWarning{omtext}{\protect\atwinalt\space is deprecated, use \protect\aindiii\space instead}} +%</package> +% \end{macrocode} +% \end{macro} +% \end{omgroup} +% \end{omgroup} % \Finale \endinput % \iffalse |