summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/omdoc/omdoc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/omdoc/omdoc.dtx')
-rw-r--r--Master/texmf-dist/source/latex/stex/omdoc/omdoc.dtx148
1 files changed, 102 insertions, 46 deletions
diff --git a/Master/texmf-dist/source/latex/stex/omdoc/omdoc.dtx b/Master/texmf-dist/source/latex/stex/omdoc/omdoc.dtx
index 2503218bc51..8a844940e3b 100644
--- a/Master/texmf-dist/source/latex/stex/omdoc/omdoc.dtx
+++ b/Master/texmf-dist/source/latex/stex/omdoc/omdoc.dtx
@@ -9,9 +9,8 @@
% \fi
%
% \iffalse
-%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+%<package|cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{omdoc}[2010/06/25 v1.0 OMDoc document Structure]
-%<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<cls>\ProvidesClass{omdoc}[2010/06/25 v1.0 OMDoc Documents]
%
%<*driver>
@@ -21,7 +20,7 @@
\usepackage[hyperref=auto,style=alphabetic]{biblatex}
\bibliography{kwarc}
\usepackage[eso-foot,today]{svninfo}
-\svnInfo $Id: omdoc.dtx 1502 2010-07-20 08:17:00Z kohlhase $
+\svnInfo $Id: omdoc.dtx 1671 2010-11-06 07:05:15Z kohlhase $
\svnKeyword $HeadURL: https://svn.kwarc.info/repos/stex/trunk/sty/omdoc/omdoc.dtx $
\usepackage{stex-logo}
\usepackage{../ctansvn}
@@ -30,11 +29,12 @@
\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{omdoc.dtx}\end{document}
%</driver>
% \fi
%
-%\CheckSum{275}
+%\iffalse\CheckSum{275}\fi
%
% \changes{v0.1}{2006/1/17}{First Version}
% \changes{v0.2}{2006/7/11}{added OMDoc class}
@@ -136,7 +136,7 @@
% \DescribeMacro{short}|short| allows to give a short title for the generated section.
% \end{omgroup}
%
-% \begin{omgroup}[id=sec:user:omtext]{Mathematical Text}
+% \begin{omgroup}[id=sec:user:ignore]{Ignoring Inputs}
%
% The \DescribeEnv{ignore}|ignore| environment can be used for hiding text parts from the
% document structure. The body of the environment is not PDF or DVI output unless the
@@ -168,54 +168,50 @@
% into some content markup format. \ednote{make an example}
% \end{omgroup}
%
-% \begin{omgroup}[id=sec:user:phrase]{Phrase-Level Markup}
-%
-% \DescribeEnv{phrase} The |phrase| environment allows to mark up phrases with semantic
-% information. It takes an optional |KeyVal| argument with the keys\ednote{continue}
-%
-% \DescribeMacro{\sinlinequote} The |sinlinequote| macro allows to mark up quotes inline and
-% attribute them. The quote itself is given as the argument, possibly preceded by the a
-% specification of the source in a an optional argument. For instance, we would quote
-% Hamlet with
-% \begin{verbatim}
-% \sinlinequote[Hamlet, \cite{Shak:1603:Hamlet}]{To be or not to be}
-% \end{verbatim}
-% which would appear as \sinlinequote[Hamlet, (Shakespeare 1603)]{To be or not to be} in
-% the text. The style in which inline quotations appear in the text can be adapted by
-% specializing the macros \DescribeMacro{\@sinlinequote}|\@sinlinequote| --- for quotations
-% without source and \DescribeMacro{\@@sinlinequote}|\@@sinlinequote| --- for quotations with
-% source.
-% \end{omgroup}
-%
% \begin{omgroup}[id=sec:user:colors]{Colors}
%
% For convenience, the |omdoc| package defines a couple of color macros for the |color|
% package: For instance \DescribeMacro{\blue}|\blue| abbreviates |\textcolor{blue}|, so
% that |\blue{|\meta{something}|}| writes \meta{something} in blue. The macros
-% \DescribeMacro{\red}|\red| \DescribeMacro{\green}|\green| \DescribeMacro{\cyan}|\cyan|
-% \DescribeMacro{\magenta}|\magenta| \DescribeMacro{\brown}|\brown|
-% \DescribeMacro{\yellow}|\yellow|, and finally \DescribeMacro{\black}|\black| are
+% \DescribeMacro{\red}|\red| \DescribeMacro{...}|\green|, |\cyan|, |\magenta|, |\brown|,
+% |\yellow|, |\orange|, |\gray|, and finally \DescribeMacro{\black}|\black| are
% analogous.
% \end{omgroup}
% \end{omgroup}
%
+% \begin{omgroup}[id=sec:limitations]{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}.
+% \begin{compactenum}
+% \item none reported yet
+% \end{compactenum}
+% \end{omgroup}
+%
% \StopEventually{\newpage\PrintIndex\newpage\PrintChanges\printbibliography}\newpage
%
% \begin{omgroup}[id=sec:impl:cls]{Implementation: The OMDoc Class}
%
-% The |omdoc| package generates four files: |omdoc.cls| (all the code between
+% The functionality is spread over the |omdoc| class and package. The class provides the
+% |document| environment and the |omdoc| element corresponds to it, whereas the
+% package provides the concrete functionality.
+%
+% |omdoc.dtx| generates four files: |omdoc.cls| (all the code between
% {\textsf{$\langle$*cls$\rangle$}} and {\textsf{$\langle$/cls$\rangle$}}), |omdoc.sty|
% (between {\textsf{$\langle$*package$\rangle$}} and
% {\textsf{$\langle$/package$\rangle$}}) and their {\latexml} bindings (between
% {\textsf{$\langle$*ltxml.cls$\rangle$}} and {\textsf{$\langle$/ltxml.cls$\rangle$}} and
% {\textsf{$\langle$*ltxml.sty$\rangle$}} and {\textsf{$\langle$/ltxml.sty$\rangle$
-% respetively}}). We keep the corresponding code fragments together, since the
+% respetively}}). We keep the corresponding code fragments together, since the
% documentation applies to both of them and to prevent them from getting out of sync.
%
-% We load |article.cls|, and the desired packages. For the {\latexml} bindings, we make
-% sure the right packages are loaded.
+% \begin{omgroup}[id=sec:impl:cls:options]{Class Options}
+% To initialize the |omdoc| class, we declare and process the necessary options.
+%
% \begin{macrocode}
%<*cls>
+\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}}
\def\omdoc@class{article}
\DeclareOption{report}{\def\omdoc@class{report}\PassOptionsToPackage{\CurrentOption}{omdoc}}
\DeclareOption{book}{\def\omdoc@class{book}\PassOptionsToPackage{\CurrentOption}{omdoc}}
@@ -225,8 +221,6 @@
\DeclareOption{extrefs}{\PassOptionsToPackage{\CurrentOption}{sref}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
-\LoadClass{\omdoc@class}
-\RequirePackage{omdoc}
%</cls>
%<*ltxml.cls>
# -*- CPERL -*-
@@ -243,10 +237,26 @@ DeclareOption('showignores',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS(
DeclareOption('extrefs',sub {PassOptions('sref','sty',ToString(Digest(T_CS('\CurrentOption')))); });
DeclareOption(undef,sub {PassOptions('article','cls',ToString(Digest(T_CS('\CurrentOption')))); });
ProcessOptions();
+%</ltxml.cls>
+% \end{macrocode}
+%
+% We load |article.cls|, and the desired packages. For the {\latexml} bindings, we make
+% sure the right packages are loaded.
+%
+% \begin{macrocode}
+%<*cls>
+\LoadClass{\omdoc@class}
+\RequirePackage{omdoc}
+%</cls>
+%<*ltxml.cls>
LoadClass('article');
RequirePackage('sref');
%</ltxml.cls>
% \end{macrocode}
+% \end{omgroup}
+%
+% \begin{omgroup}[id=sec:impl:cls:namespaces]{Setting up Namespaces and Schemata for LaTeXML}
+%
% Now, we also need to register the namespace prefixes for {\latexml} to use.
% \begin{macrocode}
%<*ltxml.cls>
@@ -280,6 +290,9 @@ RelaxNGSchema('omdoc+ltxml',
RequirePackage('omdoc');
%</ltxml.cls>
% \end{macrocode}
+% \end{omgroup}
+%
+% \begin{omgroup}[id=sec:impl:cls:document]{Beefing up the \texttt{document} environment}
%
% Now, we will define the environments we need. The top-level one is the |document|
% environment, which we redefined so that we can provide keyval arguments.
@@ -290,7 +303,8 @@ RequirePackage('omdoc');
% \begin{macrocode}
%<*cls>
\let\orig@document=\document
-\renewcommand{\document}[1][]{\orig@document}
+\srefaddidkey{document}
+\renewcommand{\document}[1][]{\metasetkeys{document}{#1}\orig@document}
%</cls>
%<*ltxml.cls>
sub xmlBase {
@@ -317,6 +331,7 @@ DefEnvironment('{document} OptionalKeyVals:omdoc',
% \end{macrocode}
% \end{environment}
% \end{omgroup}
+% \end{omgroup}
%
% \begin{omgroup}[id=sec:impl:sty]{Implementation: OMDoc Package}
%
@@ -339,6 +354,7 @@ use Cwd qw(cwd abs_path);
%
% \begin{macrocode}
%<*package>
+\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}}
\newif\if@chapter\@chapterfalse
\newif\if@part\@partfalse
\newcount\section@level\section@level=3
@@ -386,13 +402,13 @@ RequirePackage('omtext');
% \begin{macrocode}
%<*package>
\srefaddidkey{omgroup}
-\omdaddkey{omgroup}{creators}
-\omdaddkey{omgroup}{contributors}
-\omdaddkey{omgroup}{type}
-\omdaddkey{omgroup}{short}
-\omdaddkey{omgroup}{display}
+\addmetakey{omgroup}{creators}
+\addmetakey{omgroup}{contributors}
+\addmetakey{omgroup}{type}
+\addmetakey*{omgroup}{short}
+\addmetakey*{omgroup}{display}
\newenvironment{omgroup}[2][]% title
-{\bgroup\omdsetkeys{omgroup}{#1}\sref@target
+{\bgroup\metasetkeys{omgroup}{#1}\sref@target
\ifx\omgroup@display\st@flow\noindent{\Large\textbf{#2}\\[.3ex]\noindent\ignorespaces}
\else
\if@part\ifnum\section@level=1\part{#2}\sref@label@id{Part \thepart}\fi\fi
@@ -484,15 +500,54 @@ DefEnvironment('{description}',
%</ltxml.sty>
% \end{macrocode}
% \end{omgroup}
+%
+% \begin{omgroup}[id=sec:user:docmatter]{Front and Backmatter}
+%
+% Index markup is provided by the |omtext| package~\cite{Kohlhase:smmtf:ctan}, so in the
+% |omdoc| package we only need to supply the correpsonding |\printindex| command, if it
+% is not already defined
+% \begin{macro}{\printindex}
+% \begin{macrocode}
+%<*package>
+\providecommand\printindex{\IfFileExists{\jobname.ind}{\input{\jobname.ind}}{}}
+%</package>
+%<*ltxml.sty>
+DefConstructor('\printindex','<omdoc:index/>');
+%</ltxml.sty>
+% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{\tableofcontents}
+% The table of contents already exists in {\LaTeX}, so we only need to provide a
+% {\latexml} binding for it.\ednote{@Deyan, we need to insert the current value of the
+% {\texttt{tocdepth}} counter into a @level attribute.}
+% \begin{macrocode}
+%<*ltxml.sty>
+DefConstructor('\tableofcontents',"<omdoc:tableofcontents level='2'/>");
+%</ltxml.sty>
+% \end{macrocode}
+% \end{macro}
+%
+% The case of the |\bibliography| command is similar
+%
+% \begin{macro}{\bibliography}
+% \begin{macrocode}
+%<*ltxml.sty>
+DefConstructor('\bibliography{}',"<omdoc:bibliography files='#1'/>");
+%</ltxml.sty>
+% \end{macrocode}
+% \end{macro}
+% \end{omgroup}
+%
+% \begin{omgroup}[id=sec:impl:ignore]{Ignoring Inputs}
% \begin{environment}{ignore}
% \begin{macrocode}
%<*package>
\ifshow@ignores
-\omdaddkey{ignore}{type}
-\omdaddkey{ignore}{comment}
+\addmetakey{ignore}{type}
+\addmetakey{ignore}{comment}
\newenvironment{ignore}[1][]
-{\omdsetkeys{ignore}{#1}\textless\ignore@type\textgreater\bgroup\itshape}
+{\metasetkeys{ignore}{#1}\textless\ignore@type\textgreater\bgroup\itshape}
{\egroup\textless/\ignore@type\textgreater}
\renewenvironment{ignore}{}{}\else\excludecomment{ignore}\fi
%</package>
@@ -574,6 +629,7 @@ DefMacro('\STRlabeldef{}{}', "");
% \begin{macrocode}
%<*package>
\def\black#1{\textcolor{black}{#1}}
+\def\gray#1{\textcolor{gray}{#1}}
\def\blue#1{\textcolor{blue}{#1}}
\def\red#1{\textcolor{red}{#1}}
\def\green#1{\textcolor{green}{#1}}
@@ -581,7 +637,6 @@ DefMacro('\STRlabeldef{}{}', "");
\def\magenta#1{\textcolor{magenta}{#1}}
\def\brown#1{\textcolor{brown}{#1}}
\def\yellow#1{\textcolor{yellow}{#1}}
-\def\yellow#1{\textcolor{yellow}{#1}}
\def\orange#1{\textcolor{orange}{#1}}
%</package>
% \end{macrocode}
@@ -605,7 +660,7 @@ DefMacro('\@omdoc@color{}', sub { MergeFont(color=>$_[1]->toString); return; });
%<*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)) {
+foreach my $color(qw(black gray blue red green cyan magenta brown yellow orange)) {
DefMacro("\\".$color.'{}', sub { omdocColorMacro($color, @_); }); }#$
%</ltxml.sty>
% \end{macrocode}
@@ -657,6 +712,7 @@ DefConstructor('\href Semiverbatim {}',"<omdoc:link href='#1'>#2</omdoc:link>");
%<ltxml.sty|ltxml.cls>1;
% \end{macrocode}
% \end{omgroup}
+% \end{omgroup}
% \Finale
\endinput
% \iffalse
@@ -688,7 +744,7 @@ DefConstructor('\href Semiverbatim {}',"<omdoc:link href='#1'>#2</omdoc:link>");
% LocalWords: textsf langle textsf langle respetively orig renewcommand cdir
% LocalWords: baseuri baseuri baselocal baselocal SOURCEFILE cooluri newif ifx
% LocalWords: SOURCEBASE chapterfalse partfalse newcount ifshow chaptertrue
-% LocalWords: parttrue srefaddidkey omdaddkey newenvironment omdsetkeys textbf
+% LocalWords: parttrue srefaddidkey newenvironment textbf
% LocalWords: noindent noindent ignorespaces ifnum thepart thechapter regexp
% LocalWords: thesection thesubsection thesubsubsection needswrapper itshape
% LocalWords: textgreater renewenvironment excludecomment STRlabeldef csname