summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/omd/omd.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/omd/omd.dtx')
-rw-r--r--Master/texmf-dist/source/latex/stex/omd/omd.dtx222
1 files changed, 222 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/stex/omd/omd.dtx b/Master/texmf-dist/source/latex/stex/omd/omd.dtx
new file mode 100644
index 00000000000..ea175ed803a
--- /dev/null
+++ b/Master/texmf-dist/source/latex/stex/omd/omd.dtx
@@ -0,0 +1,222 @@
+% \iffalse meta-comment
+% An Infrastructure for marking up Metadata in LaTeX documents
+% $URL: https://svn.kwarc.info/repos/stex/trunk/sty/omd/omd.dtx $
+% $Rev: 1502 $; last modified by $Author: kohlhase $
+% $Date: 2010-07-20 10:17:00 +0200 (Tue, 20 Jul 2010) $
+% Copyright (c) 2009 Michael Kohlhase, all rights reserved
+% this file is released under the
+% LaTeX Project Public License (LPPL)
+% \fi
+%
+% \iffalse
+%<*package>
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{omd}[2010/06/25 v0.9 OMDoc Metadata Framework]
+%</package>
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{stex-logo,sref,url,array,float}
+\usepackage[show]{ed}
+\usepackage{../ctansvn}
+\usepackage[eso-foot,today]{svninfo}
+\usepackage[hyperref=auto,style=alphabetic]{biblatex}
+\bibliography{kwarc}
+\svnInfo $Id: omd.dtx 1502 2010-07-20 08:17:00Z kohlhase $
+\svnKeyword $HeadURL: https://svn.kwarc.info/repos/stex/trunk/sty/omd/omd.dtx $
+\usepackage{hyperref}
+\makeindex
+\floatstyle{boxed}
+\newfloat{exfig}{thp}{lop}
+\floatname{exfig}{Example}
+\usepackage{omd}
+\begin{document}\DocInput{omd.dtx}\end{document}
+%</driver>
+% \fi
+%
+%\CheckSum{58}
+%
+% \changes{v0.1}{2009/12/14}{First version}
+% \changes{v0.9}{2010/06/18}{This is almost done}
+%
+% \GetFileInfo{omd.sty}
+%
+% \MakeShortVerb{\|}
+% \def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}}
+% \def\latexml{\scsys{LaTeXML}}
+% \def\omdoc{OMDoc}
+% \def\omdocv#1{\omdoc{#1}}
+%
+% \title{{\texttt{omd.sty}}: A generic framework for extensible Metadata in {\LaTeX}\thanks{Version {\fileversion} (last revised
+% {\filedate})}}
+% \author{Michael Kohlhase\\
+% Jacobs University, Bremen\\
+% \url{http://kwarc.info/kohlhase}}
+% \maketitle
+% \begin{abstract}
+% The |omd| package 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 the infrastructure for extending {\sTeX} macros with {\omdoc}
+% metadata. This package is mainly intended for authors of {\sTeX} extension packages.
+% \end{abstract}
+%
+% \setcounter{tocdepth}{2}\tableofcontents\newpage
+%
+%\section{Introduction}
+%
+% The |omd| package supplies the infrastructure for extending {\sTeX} macros with
+% ontology-based metadata. The |omd| infrastructure is intended to support the new
+% metadata infrastructure for the {\omdoc} format~\cite{Kohlhase:omdoc1.2} introduced in
+% {\omdocv{1.3}}~\cite{Kohlhase:OMDoc1.3}\ednote{continue}
+%
+% \section{The User Interface}\label{sec:user}
+%
+% The \DescribeMacro{\omdaddkey}|\omdaddkey| command takes two arguments, a metadata group
+% \meta{group} and a metadata keyword name \meta{key}. It registers \meta{key} in the
+% metadata group \meta{group}. The keys registered for a metadata group can be used for
+% defining macros with a key/value arguments via the
+% \DescribeMacro{\omdsetkeys}|\omdsetkeys| macro, see for instance the the definition in
+% Figure~\ref{fig:foo}. With these definitions in a used package\footnote{The \texttt\@
+% character is only allowed in packages.} |\foo[type=bar,id=f4711]| is formatted to
+% \begin{quote}
+% \omdaddkey{foo}{id}\omdaddkey{foo}{type}\makeatletter
+% \newcommand\foo[1][]{\omdsetkeys{foo}{#1} I have seen a \emph{foo} of type \texttt{\foo@type}
+% with identifier \texttt{\foo@id}!}\makeatother
+% \foo[type=bar,id=f4711]
+% \end{quote}
+%
+% \begin{exfig}[ht]
+% \begin{verbatim}
+% \omdaddkey{foo}{id}
+% \omdaddkey{foo}{type}
+% \newcommand\foo[1][]{\omdsetkeys{foo}{#1}
+% I have seen a \emph{foo} of type \texttt{\foo@type} with identifier
+% \texttt\foo@id!}
+% \end{verbatim}
+% \vspace*{-2em}
+% \caption{Defining a macro with metadata}
+% \label{fig:foo}
+% \end{exfig}
+%
+% \StopEventually{\newpage\PrintIndex\newpage\PrintChanges\printbibliography}
+%
+% \section{The Implementation}\label{sec:impl}
+%
+% We build on the |keyval| package which we first need to load.
+% \begin{macrocode}
+%<*package>
+\RequirePackage{keyval}[1997/11/10]
+%<*ltxml>
+%</ltxml>
+% \end{macrocode}
+%
+% \begin{macro}{\omdaddkey}
+% An invocation of |\omdaddkey{|\meta{group}|}{|\meta{key}|}| macro first extends the
+% clearkeys macro and then defines the key \meta{key} with the |\define@key| macro from
+% the |keyval| package. This stores the key value given in the local macro
+% |\|\meta{group}|@|\meta{key}.
+% \begin{macrocode}
+%<*package>
+\newcommand\omdaddkey[3][]{\omd@ext@clear@keys{#2}{#3}{#1}%
+\define@key{#2}{#3}[#1]{\expandafter\gdef\csname #2@#3\endcsname{##1}}}
+%</package>
+%<*ltxml>
+%</ltxml>
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\omdsetkeys}
+% \begin{macrocode}
+%<*package>
+\newcommand\omdsetkeys[2]{\csname clear@#1@keys\endcsname\setkeys{#1}{#2}}
+%</package>
+%<*ltxml>
+%</ltxml>
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\omd@ext@clear@keys}
+% |\omd@ext@clear@keys{|\meta{group}|}{|\meta{key}|}{|\meta{default}|}| extends (or sets
+% up if this is the first |\omdaddkey| for \meta{group}) the
+% |\clear@|\meta{group}|@keys| macro to set the default value \meta{default} for
+% \meta{key}. The |\clear@|\meta{group}|@keys| macro is used in the generic
+% |\omdsetkeys| macro below.
+% \begin{macrocode}
+%<*package>
+\newcommand\omd@ext@clear@keys[3]{\@omd@ext@clear@keys{#1}{#1@#2}{#3}}
+\newcommand\@omd@ext@clear@keys[3]{\@ifundefined{clear@#1@keys}%
+{\expandafter\def\csname clear@#1@keys\endcsname%
+{\expandafter\gdef\csname #2\endcsname{#3}}}%
+{\expandafter\g@addto@macro\csname clear@#1@keys\endcsname%
+{\expandafter\gdef\csname #2\endcsname{#3}}}}
+%</package>
+%<*ltxml>
+%</ltxml>
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Using better defaults than empty}
+%
+% \begin{macro}{\omdaddkeynew}
+% |\omdaddkeynew| is an experimental version of |\omdaddkey| which gives
+% |\omd@unspecified| as an optional argument, so that it is used as the default value
+% here and then test for it in |\omfidus|. But unfortunately, this does not work yet.
+% \begin{macrocode}
+%<*package>
+\newcommand\omdaddkeynew[3][]{\omd@ext@clear@keys{#2}{#3}{#1}%
+\define@key{#2}{#3}{\expandafter\gdef\csname #2@#3\endcsname{##1}}}
+%</package>
+%<*ltxml>
+%</ltxml>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\omd@unspecified}
+% Ain internal macro for unspecified values. It is used to initialize keys.\ednote{MK:
+% we could probably embed an package error or warning in here}
+% \begin{macrocode}
+%<*package>
+\newcommand\omd@unspecified{an omd-defined key left unspecified}
+%</package>
+%<*ltxml>
+%</ltxml>
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\omdifus}
+% This just tests for equality of the first arg with |\omd@unspecified|
+% \begin{macrocode}
+%<*package>
+\newcommand\omdifus[4]{\message{testing #1@#2=\csname#1@#2\endcsname}\expandafter\ifx\csname #1@#2\endcsname\omd@unspecified{#3}\else{#4}\fi}
+%</package>
+%<*ltxml>
+%</ltxml>
+% \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}
+% \Finale
+\endinput
+% \iffalse
+%%% Local Variables:
+%%% mode: doctex
+%%% TeX-master: t
+%%% End:
+% \fi
+
+
+% LocalWords: iffalse kohlhase Thu omd omd.dtx scsys sc sc latexml omdoc foo
+% LocalWords: omdocv texttt fileversion maketitle setcounter tocdepth newpage
+% LocalWords: tableofcontents ednote omdaddkey omdaddkey omdsetkeys omdsetkeys
+% LocalWords: makeatletter newcommand emph makeatother exfig vspace impl ltxml
+% LocalWords: printbibliography keyval clearkeys expandafter gdef csname ifx
+% LocalWords: endcsname setkeys ifundefined omdaddkeynew omfidus omdifus
+% LocalWords: doctex