diff options
author | Karl Berry <karl@freefriends.org> | 2012-03-30 23:23:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-03-30 23:23:02 +0000 |
commit | 849996eca72af498b48b10fbea7f14c4b9d21b8f (patch) | |
tree | 2d40d42dfc9fc0b0622212cc220868f98345305f /Master/texmf-dist/tex/latex/stex/omdoc | |
parent | d82e1c23973fd0271f93686f487bd1cee8dcd947 (diff) |
restore stex (ca. 28jan12)
git-svn-id: svn://tug.org/texlive/trunk@25792 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stex/omdoc')
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls | 28 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml | 58 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty | 85 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty.ltxml | 67 |
4 files changed, 238 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls new file mode 100644 index 00000000000..6cb3c77a74b --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls @@ -0,0 +1,28 @@ +%% +%% 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}[2012/01/28 v1.0 OMDoc Documents] +\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}} +\DeclareOption{chapter}{\PassOptionsToPackage{\CurrentOption}{omdoc}} +\DeclareOption{part}{\PassOptionsToPackage{\CurrentOption}{omdoc}} +\DeclareOption{showignores}{\PassOptionsToPackage{\CurrentOption}{omdoc}} +\DeclareOption{extrefs}{\PassOptionsToPackage{\CurrentOption}{sref}} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +\ProcessOptions +\LoadClass{\omdoc@class} +\RequirePackage{omdoc} +\let\orig@document=\document +\srefaddidkey{document} +\renewcommand{\document}[1][]{\metasetkeys{document}{#1}\orig@document} +\endinput +%% +%% End of file `omdoc.cls'. diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml new file mode 100644 index 00000000000..56d43b7138e --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.cls.ltxml @@ -0,0 +1,58 @@ +# -*- CPERL -*- +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +use LaTeXML::Util::Pathname; +use Cwd qw(cwd abs_path); +DeclareOption('report',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('book',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('chapter',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('part',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('showignores',sub {PassOptions('omdoc','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption('extrefs',sub {PassOptions('sref','sty',ToString(Digest(T_CS('\CurrentOption')))); }); +DeclareOption(undef,sub {PassOptions('article','cls',ToString(Digest(T_CS('\CurrentOption')))); }); +ProcessOptions(); +LoadClass('article'); +RequirePackage('sref'); +RegisterNamespace('omdoc'=>"http://omdoc.org/ns"); +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"); +RegisterNamespace('stex'=>"http://kwarc.info/ns/sTeX"); +RegisterNamespace('ltx'=>"http://dlmf.nist.gov/LaTeXML"); +RelaxNGSchema('omdoc+ltxml', + '#default'=>"http://omdoc.org/ns", + '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", + 'stex'=>"http://kwarc.info/ns/sTeX", + 'ltx'=>"http://dlmf.nist.gov/LaTeXML"); +RequirePackage('omdoc'); +sub xmlBase { + my $baseuri = LookupValue('baseuri'); + my $baselocal = LookupValue('baselocal'); + my $cdir = abs_path(cwd()); + $cdir =~ s/^$baselocal// if $baselocal; + #DG: Make this more robust! + my ($d,$f,$t); + my $srcf = LookupValue('SOURCEFILE'); + if ( $srcf =~ /^(\w+):\/\//) { + $srcf =~ s/^(\w+):\///; + } # TODO: Hacky, do something better + ($d, $f,$t) = pathname_split(LookupValue('SOURCEFILE')); + $t = '' if LookupValue('cooluri'); + Tokenize($baseuri.$cdir.'/'.$f.$t); } +DefEnvironment('{document} OptionalKeyVals:omdoc', + "<omdoc:omdoc " + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')" + . "(?&Tokenize(&LookupValue('SOURCEBASE'))" + . "(xml:id='&Tokenize(&LookupValue('SOURCEBASE')).omdoc')()) " + . "?&Tokenize(&LookupValue('baseuri'))" + . "(xml:base='&xmlBase()')()>" + . "#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/omdoc.sty b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty new file mode 100644 index 00000000000..54f275d7c46 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty @@ -0,0 +1,85 @@ +%% +%% 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}[2012/01/28 v1.0 OMDoc document Structure] +\DeclareOption{showmeta}{\PassOptionsToPackage{\CurrentOption}{metakeys}} +\newif\if@chapter\@chapterfalse +\newif\if@part\@partfalse +\newcount\section@level\section@level=3 +\newif\ifshow@ignores\show@ignoresfalse +\def\omdoc@class{article} +\DeclareOption{report}{\def\omdoc@class{report}\section@level=2} +\DeclareOption{book}{\def\omdoc@class{book}\section@level=1} +\DeclareOption{chapter}{\section@level=2\@chaptertrue} +\DeclareOption{part}{\section@level=1\@chaptertrue\@parttrue} +\DeclareOption{showignores}{\show@ignorestrue} +\DeclareOption{extrefs}{\PassOptionsToPackage{\CurrentOption}{sref}} +\ProcessOptions +\RequirePackage{sref} +\RequirePackage{xspace} +\RequirePackage{comment} +\def\level@section#1{\ifcase#1\or{part}\or{chapter}\or{section}\or{subsection}\or{subsubsection}\or{paragraph}\or{subparagraph}\fi} +\def\Level@Section#1{\ifcase#1\or{Part}\or{Chapter}\or{Section}\or{Subsection}\or{Subsubsection}\or{Paragraph}\or{Subparagraph}\fi} +\def\in@level@section#1{\ifcase#1\or{this document}\or{part}\or{chapter}\or{section}\or{subsection}\or{subsubsection}\or{paragraph}\or{subparagraph}\fi} +\def\In@Level@Section#1{\ifcase#1\or{This document}\or{Part}\or{Chapter}\or{Section}\or{Subsection}\or{Subsubsection}\or{Paragraph}\or{Subparagraph}\fi} +\def\currentsectionlevel{\in@level@section\section@level\xspace} +\def\CurrentSectionLevel{\In@Level@Section\section@level\xspace} +\srefaddidkey{omgroup} +\addmetakey{omgroup}{creators} +\addmetakey{omgroup}{date} +\addmetakey{omgroup}{contributors} +\addmetakey{omgroup}{type} +\addmetakey*{omgroup}{short} +\addmetakey*{omgroup}{display} +\def\at@begin@omgroup#1{} +\newenvironment{omgroup}[2][]% keys, title +{\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% +\if@chapter\ifnum\section@level=2\chapter{#2}\sref@label@id{Chapter \thechapter}\fi\fi% +\ifnum\section@level=3\section{#2}\sref@label@id{Section \thesection}\fi% +\ifnum\section@level=4\subsection{#2}\sref@label@id{Subsection \thesubsection}\fi% +\ifnum\section@level=5\subsubsection{#2}\sref@label@id{Subsubsection \thesubsubsection}\fi% +\ifnum\section@level=6\paragraph{#2}\sref@label@id{this paragraph}\fi% +\ifnum\section@level=7\subparagraph{#2}\sref@label@id{this subparagraph}\fi% +\at@begin@omgroup\section@level% for customization +\advance\section@level by 1% +\fi}{\advance\section@level by -1} +\providecommand\printindex{\IfFileExists{\jobname.ind}{\input{\jobname.ind}}{}} +\ifshow@ignores +\addmetakey{ignore}{type} +\addmetakey{ignore}{comment} +\newenvironment{ignore}[1][] +{\metasetkeys{ignore}{#1}\textless\ignore@type\textgreater\bgroup\itshape} +{\egroup\textless/\ignore@type\textgreater} +\renewenvironment{ignore}{}{}\else\excludecomment{ignore}\fi +\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} +\newcommand{\STRsemantics}[3][]{#2\def\@test{#1}\ifx\@test\@empty\STRlabeldef{#1}{#2}\fi} +\def\STRlabeldef#1{\expandafter\gdef\csname STR@#1\endcsname} +\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}} +\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\orange#1{\textcolor{orange}{#1}} +\newcommand\hateq{\ensuremath{\hat=}\xspace} +\newcommand\hatequiv{\ensuremath{\hat\equiv}\xspace} +\newcommand\textleadsto{\ensuremath{\leadsto}\xspace} +\newcommand{\baseURI}[2][]{} +\endinput +%% +%% End of file `omdoc.sty'. diff --git a/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty.ltxml b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty.ltxml new file mode 100644 index 00000000000..207a53b6f2b --- /dev/null +++ b/Master/texmf-dist/tex/latex/stex/omdoc/omdoc.sty.ltxml @@ -0,0 +1,67 @@ +package LaTeXML::Package::Pool; +use strict; +use LaTeXML::Package; +use Cwd qw(cwd abs_path); +DeclareOption('report',''); +DeclareOption('book',''); +DeclareOption('chapter',''); +DeclareOption('part',''); +DeclareOption('showignores',''); +DeclareOption('extrefs',''); +RequirePackage('sref'); +RequirePackage('xspace'); +RequirePackage('omtext'); +DefEnvironment('{omgroup} OptionalKeyVals:omgroup {}', + "<omdoc:omgroup layout='sectioning'" + . "?&KeyVal(#1,'id')(xml:id='&KeyVal(#1,'id')')()" + . "?&KeyVal(#1,'type')(type='&KeyVal(#1,'type')')()>\n" + . "<dc:title>#2</dc:title>\n" + . "#body\n" + . "</omdoc:omgroup>"); +DefConstructor('\printindex','<omdoc:index/>'); +DefConstructor('\tableofcontents',"<omdoc:tableofcontents level='&ToString(&CounterValue('tocdepth'))'/>"); +DefConstructor('\bibliography{}',"<omdoc:bibliography files='#1'/>"); +DefKeyVal('ignore','type','Semiverbatim'); +DefKeyVal('ignore','comment','Semiverbatim'); +DefEnvironment('{ignore} OptionalKeyVals:ignore', + "<omdoc:ignore %&KeyVals(#1)>#body</omdoc:ignore>"); +DefConstructor('\STRlabel{}{}', sub { + my($document,$label,$object)=@_; + $document->absorb($object); + $document->addAttribute('xml:id'=>ToString($label)) if $label; }); +DefConstructor('\STRcopy{}',"<omdoc:ref xref='##1'/>"); +DefConstructor('\STRsemantics[]{}{}', sub { + my($document,$label,$ignore,$object)=@_; + $document->absorb($object); + $document->addAttribute('xml:id'=>ToString($label)) if $label; }); +DefMacro('\STRlabeldef{}{}', ""); +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)(<ltx:text ?#1(style='color:#1')()>#2</ltx:text>)"); +foreach my $color(qw(black gray blue red green cyan magenta brown yellow orange)) { + DefMacro("\\".$color.'{}', sub { omdocColorMacro($color, @_); }); }#$ +DefConstructor('\newpage',''); +Tag('omdoc:ignore',afterOpen=>\&numberIt,afterClose=>\&locateIt); +Tag('omdoc:ref',afterOpen=>\&numberIt,afterClose=>\&locateIt); +DefConstructor('\hateq',"\x{2259}"); +DefConstructor('\hatequiv',"\x{2A6F}"); +DefConstructor('\textleadsto',"\x{219D}"); +DefMacro('\baseURI []Semiverbatim', sub { + if (LookupValue('SOURCEFILE')!~/^(\w+):\/\//) { + my $baselocal = ToString(Expand($_[1])); + $baselocal = abs_path($baselocal) unless $baselocal=~/^(\w+):\/\//; + AssignValue('baselocal'=>$baselocal); + AssignValue('baseuri'=>ToString(Expand($_[2])));} + else { + AssignValue('baselocal'=>undef); + AssignValue('baseuri'=>ToString(Expand($_[2]))); + }}); +DefConstructor('\url Semiverbatim',"<omdoc:link href='#1'>#1</omdoc:link>"); +DefConstructor('\href Semiverbatim {}',"<omdoc:link href='#1'>#2</omdoc:link>"); +1; |