diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/modules/mkii')
96 files changed, 32152 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-arabtex.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-arabtex.mkii new file mode 100644 index 00000000000..dea1cae252d --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-arabtex.mkii @@ -0,0 +1,450 @@ +%D \module +%D [ file=m-arabtex, % was font-arb, +%D version=2003.02.22, % 1999.11.06, +%D title=\CONTEXT\ Modules, +%D subtitle=Arabic, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% I still need to hook in some features into the setup +% macro. I also have to (re)define farsi etc. in ways +% similar to arab, so that we have dedicated environments. +% +% keywords needed: vocalize transscribe +% +% \startarabic[option=vocalize] % or vocalize=yes +% ...... +% \stoparabic + +\writestatus{loading}{ConTeXt Font Macros / ArabTeX support} + +%D At the \NTG\ 10\high{th} anniversary meeting Klaus Lagally +%D introduced the audience to arabic typesetting, and after +%D that I knew that some day I really had to look into his +%D generic package. And then, sort of simultaniously Maarten +%D Wisse and Imran Ahsan Nyazee asked me if \CONTEXT\ could +%D support \ARABTEX, a package that provides right to left +%D typesetting of (several variants of) arab and hebrew. +%D Having implemented support for chinese a few weeks before, +%D I could not resist to build in support for arab and hebrew +%D too. Writing support for languages that don't give me any +%D cue on how to pronounce their script, is kind of special. + +%D This is a beta version, since I still have to take care of some +%D macros that conflict with existing stuff. + +\unprotect + +\definesystemvariable{ARABTEX} + +\def\setupARABTEX + {\getparameters[\??ARABTEX]} + +\setupARABTEX + [\s!rscale=1.2, + \c!before=, + \c!after=, + \c!inner=\setarab, + \c!style=\setarabicfont\fontstylesuffix] + +%D A few (maybe too) simple hooks into the font mechanism. The +%D hook into the language module is not yet done. + +% \unexpanded\def\setarabicfont#1% rscale +% {\scratchdimen\@@ARABTEXrscale\bodyfontsize +% \font\arbfont\truefontname{Arabic#1} at \currentfontscale\scratchdimen +% \setx@skels +% \newfonttrue +% \arbfont} +% +% more modern +% +% \unexpanded\def\setarabicfont#1% rscale +% {\definefont[arbfont][Arabic#1 sa \@@ARABTEXrscale]% +% \setx@skels +% \newfonttrue +% \arbfont} +% +% more efficient + +\unexpanded\def\setarabicfont#1% + {\setx@skels + \newfonttrue + \definedfont[Arabic#1 sa \ARABTEXparameter\s!rscale]} + +%D Just to be compatible with Arab\TEX\ we define: + +\unexpanded\def\nash {\setarabicfont\s!Regular} +\unexpanded\def\nashbf {\setarabicfont\s!Bold } +\unexpanded\def\pnash {\setarabicfont\s!Regular} +\unexpanded\def\pnashbf{\setarabicfont\s!Bold } +\unexpanded\def\xnash {\setarabicfont\s!Regular} +\unexpanded\def\xnashbf{\setarabicfont\s!Bold } + +%D The display arabic environment (will be an installable +%D object) uses a few conditionals. Let's do it the +%D \CONTEXT\ way and define an anvironment that we later can +%D adapt. + +\newif\if@ignore +\newif\if@endpe + +\def\setupARABTEXalternative[#1]% + {\dodoubleempty\getparameters[\??ARABTEX#1]} + +\def\defineARABTEXalternative + {\dodoubleempty\dodefineARABTEXalternative} + +\def\dodefineARABTEXalternative[#1][#2]% + {\iffirstargument % \startarab is defined but used already + \getparameters + [\??ARABTEX#1] + [\c!before=\@@ARABTEXbefore, + \c!after=\@@ARABTEXafter, + \c!inner=\@@ARABTEXinner, + \c!style=\@@ARABTEXstyle, + \s!rscale=\@@ARABTEXrscale, + #2]% + \setvalue {\e!start#1}{\displayARABTEXalternative{#1}}% + \unexpanded\setvalue{#1}{\inlineARABTEXalternative {#1}}% + \unexpanded\def\RL{\getvalue{#1}}% + \unexpanded\def\LR{\a@LR}% + \let\R=\RL + \let\L=\LR + \expandafter\all@wcmd\csname\e!stop#1\endcsname + \else + \defineARABTEXalternative[arabic]% + \fi} + +\def\initializeARABTEXinternals + {\ARABTEXparameter\c!inner + \the\everyARABTEXpreset} + +\newtoks \everyARABTEXpreset + +\let\currentARABTEXalternative\empty + +\def\ARABTEXparameter#1% + {\csname\??ARABTEX\currentARABTEXalternative#1\endcsname} + +\def\inlineARABTEXalternative#1#2% + {\bgroup + \edef\currentARABTEXalternative{#1}% + \initializeARABTEXinternals + \a@RL{#2}% + \egroup} + +\def\displayARABTEXalternative#1% + {\dodoubleempty\dostartARABTEXalternative[#1]} + +\def\dostartARABTEXalternative[#1][#2]% + {\begingroup + \edef\currentARABTEXalternative{#1}% + \getparameters[\??ARABTEX\currentARABTEXalternative][#2]% + \ifnum1<0\ARABTEXparameter\c!n\relax + \startcolumns + \else + \ARABTEXparameter\c!before + \fi + \initializeARABTEXinternals + \initializeARABTEXend + \arabtext + \initializeARABTEXalternative} + +\def\initializeARABTEXalternative + {\ARABTEXparameter\c!style} + +\def\initializeARABTEXend% \CONTEXT\ does use \end quite differently + {\long\def\end##1% + {\endarabtext + \ifnum1<0\ARABTEXparameter\c!n\relax + \stopcolumns + \else + \ARABTEXparameter\c!after + \fi + \endgroup}% + \let\a@l@end\end + \letvalue{\e!stop\currentARABTEXalternative}=\end + \long\def\end##1% + {\endarabtext + \endgroup + \if@ignore\global\@ignorefalse\expandafter\ignorespaces\fi}} + +%D Arabic verbatim. + +\def\typearab{\a@@verb} + +%D Some \LATEX\ macros. + +\def \makeatletter{\unprotect} +\def \makeatother {\protect} +\def \typeout {\writestatus{arabtex}} + +%D We have to save some macros. + +\let\ARABTEXversion=\empty + +\def\startloadingARABTEX% ugly hacks + {\catcode`!=12 + \catcode`?=12 + \pushmacro\output \let \output \scratchtoks + \pushmacro\LaTeX \let \LaTeX \undefined + \pushmacro\CJK \let \CJK \undefined +% \pushmacro\peek@token \let \peek@token \undefined +% \pushmacro\edmacloaded \let \edmacloaded \undefined + \pushmacro\year \let \year \normalyear + \pushmacro\month \let \month \normalmonth + \pushmacro\day \let \day \normalday + \pushmacro\input \def \input ##1 {\normalinput ##1 } + \pushmacro\linewidth + \pushmacro\datum \def\datum {\toks0} + \pushmacro\version \def\version {\toks2} + \pushmacro\theversion \let\theversion \ARABTEXversion + \pushmacro\emphasize + \pushmacro\cap} + +\def\stoploadingARABTEX + {\catcode`!=11 + \catcode`?=11 + \popmacro\cap + \popmacro\emphasize + \popmacro\theversion + \popmacro\version + \popmacro\datum + \popmacro\linewidth + \popmacro\input + \popmacro\day + \popmacro\month + \popmacro\year +% \popmacro\edmacloaded +% \popmacro\peek@token + \popmacro\CJK + \popmacro\LaTeX + \popmacro\output} + +%D We save some macros: + +\startloadingARABTEX + +%D When loading \ARABTEX\ we have to set back the~! and~?. + +\input arabtex.sty + +%D Since \ARABTEX\ has its own \type {\cap}, we save the +%D new meaning. We also redefine some \PLAIN\ macros, which +%D happen to have a different meaning in \LATEX. + +\let\ARABTEXversion\theversion +\let\ARABTEXcap \cap + +\appendtoks + \let\cap\ARABTEXcap +\to \everyARABTEXpreset + +\def\ARABTEXsh@ft#1% + {\dimen@.00#1ex + \multiply\dimen@\slantperpoint + \kern-.0156\dimen@} + +\appendtoks + \let\sh@ft\ARABTEXsh@ft +\to \everyARABTEXpreset + +\def\ARABTEXd#1% + {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{10}% + .\hidewidth}}} + +\def\ARABTEXb#1% + {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}% + \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}} + +\appendtoks + \let\b\ARABTEXb + \let\d\ARABTEXd +\to \everyARABTEXpreset + +\def \ARABTEXbreakA {\hfill\break} +\def \ARABTEXbreakB {\break} +\edef\ARABTEXbar {\string|} +\def \ARABTEXcomma {\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} + +\appendtoks + \let\\=\ARABTEXbreakA + \let\|=\ARABTEXbreakB + \let |=\ARABTEXbar + \let\,=\ARABTEXcomma +\to \everyARABTEXpreset + +\let\ARABTEXprotect\relax + +\appendtoks + \let\protect\ARABTEXprotect +\to \everyARABTEXpreset + +%D Now we can pop the saved macros. + +\stoploadingARABTEX + +%D Ah, we have to get rid of some \type {\protect} stuff but +%D to permit testing we add it in the \CONTEXT\ way. + +% \bgroup +% \catcode`\<=\@other +% \unexpanded\gdef\a@ins +% {\ifmmode +% \expandafter<% +% \else +% \dontleavehmode \bgroup +% \arab@codes \set@arabfont \@waslafalse \@wasfalse +% \expandafter\arab@insert +% \fi} +% \unexpanded\gdef\<{\a@ins} +% \catcode`\<=\active +% \global\let<=\a@ins +% \egroup +% +% cleaner: + +\defineactivecharacter < {\a@ins} \unexpanded\gdef\<{\a@ins}% + +\def\normal@a@ins + {\dontleavehmode % context prefers this instead of \leavevmode + \bgroup + \arab@codes + \set@arabfont + \@waslafalse + \@wasfalse + \arab@insert} + +\unexpanded\gdef\a@ins + {\mathortext<\normal@a@ins} + +%D We also need to register a few macros: + +\all@wcmd\initializeARABTEXalternative % no argument, internal command +\all@wcmd\tx % no argument, small font +\all@wcmd\txx % no argument, smaller font + +%D We also hook it into the presetter. + +\appendtoks + \let\normaltx \tx \def\tx {\normaltx \setarabicfont\fontstylesuffix}% + \let\normaltxx\txx\def\txx{\normaltxx\setarabicfont\fontstylesuffix}% +\to \everyARABTEXpreset + +%D The main definitions are: + +\definefontsynonym [ArabicRegular] [xnsh14] +\definefontsynonym [ArabicBold] [xnsh14bf] + +\defineARABTEXalternative + [arabic] + [\c!inner=\setarab, + \c!style=\setarabicfont\fontstylesuffix] + +\defineARABTEXalternative + [farsi] + [\c!inner=\setfarsi, + \c!style=\setarabicfont\fontstylesuffix] + +\defineARABTEXalternative + [urdu] + [\c!inner=\seturdu, + \c!style=\setarabicfont\fontstylesuffix] + +\defineARABTEXalternative + [maghribi] + [\c!inner=\setmaghribi, + \c!style=\setarabicfont\fontstylesuffix] + +%D Apart from such definitions, one can adapt the settings +%D using \type {\setupARABTEXalternative}. +%D +%D A few years ago at the Holland Festivities, I attended {\em +%D The Cave}, one of the most impressive combinations of music +%D and video I know. This composition of Steve Reich (music) +%D and .. (video) concentrates on the common grounds of arabs +%D and jews: their ancestor Abram. Listening to the \CDROM's +%D of {\em The Cave}, provided me the right ambiance for +%D filling in the details of this module. In {\em The Cave}, +%D interviews, music, and |<|believe it or not|>| rhythmic +%D typography are the cornerstones. Remembering those big +%D screens, it strikes me that like music, \TEX\ too is a +%D perfect instrument to cross cultural and linguistic +%D borders. So, let's load Hebrew support as well: + +\unexpanded\def\sethebrewfont#1% + {\setx@skels + \newfonttrue + \definedfont[Hebrew#1 sa \ARABTEXparameter\s!rscale]} + +% \let \setheb \sethebrew + +\unexpanded\def\pheb {\sethebrewfont\s!Regular} +\unexpanded\def\phebbf{\sethebrewfont\s!Bold} + +% \startloadingARABTEX + +% \ReadFile{hebtex.sty} +% \ReadFile{apatch.sty} +% \ReadFile{hepatch.sty} + +% \stoploadingARABTEX + +\definefontsynonym [HebrewRegular] [hclassic] +\definefontsynonym [HebrewBold] [hcaption] + +\defineARABTEXalternative + [hebrew] + [\c!inner=\sethebrew, + \c!style=\sethebrewfont\fontstylesuffix] + +%D Now we're done: + +\protect \endinput + +% everyoutput : \charsubdefmax \arab@charsubdefmax + +% \defineconversion [abjad] [\abj@d] +% +% voetnoten verbatim lijsten indexen tabellen uitlijnen +% +% \v!hoofdstuk=al-fa.slu +% \v!inhoud=al-mu.htawayAtu +% \v!figuren=qA'imaTu al-.suwaru +% \v!tabellen=qA'imaTu al-^gadAwilu +% \v!grafieken=qA'imaTu al-rusUmu +% \v!index=al-fihrisu +% \v!bijlage=al-mul.haqu + +% \usemodule[arabtex] +% +% \usetypescript[postscript] \switchtotypeface[postscript] +% +% \setarab \novocalize +% +% \starttext +% +% \placecontent +% +% \section{\<mu.hammad>} % short arabic use \< .. > +% \section{\<mu.hammad>} % short arabic use \< .. > +% +% \startarabic +% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm +% +% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm +% \stoparabic +% +% \section{\<al-maq.sad>} +% +% \startarabic +% mu.hammad 'i_d q"aAm zay"d" + i_d yaqUm zyd + A_d zyd q"aAm +% \stoparabic +% +% \stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-chart.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-chart.mkii new file mode 100644 index 00000000000..8a5f480ee7f --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-chart.mkii @@ -0,0 +1,1315 @@ +%D \module +%D [ file=m-chart, +%D version=1998.10.10, +%D title=\CONTEXT\ Modules, +%D subtitle=Flow Charts, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% todo: \localpushmacro/\localpopmacro (dohandleflowchart etc) +% todo: make mkiv variant +% todo: use dimexpr/numspr + +% will be redone with layers and dimexpr or even better, by just using +% textext .. a nice example of old code + +%D This is an experimental module. Pieces of code will be moved +%D to other modules. More features are possible but will be +%D interfaces later. +%D +%D When finished this module will be documented. The main macro +%D is still a rather big one and there is some redundant and +%D slow code that needs a clean up. + +% arrow, dash +% crossing +% \goto -> \normalgoto +% class -> class:name (ref prefix) +% c, automatisch geen overlap zoeken +% eind eerder chart connecties +% relateren aan korps +% check op bestaan naam, bestaan shape +% auto als extern figuur +% subchart +% pijlen +% focus +% ook nog \MPmessage +% areapath -> krappe vlak +% clippath -> gehele vlak +% +% offset : clip offset +% breedte : breedte cel +% hoogte : hoogte cel +% dx : halve afstand in breedte (grid breedte = breedte + 2dx) +% dy : halve afstand in hoogte (grid hoogte = hoogte + 2dy) +% x : x offset (clipping) +% y : y offset (clipping) +% nx : minimaal aantal cellen horizontaal +% ny : minimaal aantal cellen vertikaal +% +% shape none en geen equivalent maken +% +% kaderkleur achtergrondkleur +% lijnkleur lijndikte +% focus focuskaderkleur focusachtergrondkleur +% richting +% +% focus koppelen aan kleur + +\unprotect + +\definesorting [flowchart] [flowcharts] [\v!none] % no access +\setupsorting [flowchart] [\c!state=\v!stop] % off by default + +\def\@FLOW@{@FLOW@} +\def\@FLOC@{@FLOC@} +\def\@FLOX@{@FLOX@} + +\def\@@FLOW{@@FLOW} +\def\@@FLOL{@@FLOL} +\def\@@FLOS{@@FLOS} +\def\@@FLOF{@@FLOF} +\def\@@FLOT{@@FLOT} +\def\@@FLOX{@@FLOX} + +\def\@@MPx {@@MPx} +\def\@@MPy {@@MPy} + +\def\FLOWbufferprefix{flw-} + +\def\processFLOWbuffer#1{\getbuffer[\FLOWbufferprefix#1]} +\def\typeFLOWbuffer #1{\typebuffer[\FLOWbufferprefix#1]} + +\def\setFLOWname#1#2% funny hack that makes sure that we get + {\bgroup % names that are acceptable for METAPOST + \lccode`0=`a\lccode`1=`b\lccode`2=`c\lccode`3=`d\lccode`4=`e% + \lccode`5=`f\lccode`6=`g\lccode`7=`h\lccode`8=`i\lccode`9=`j% + \lccode` =`\_\lccode`-=`\_\lccode`_=`\_% + \lowercase{\gdef#1{#2}}% + \egroup} + +% een gobble als default is sneller, en dan alleen setten als +% nodig + +\def\resetFLOWcell + {% variables + \global\let\FLOWname \empty + \global\let\FLOWalign \empty + \global\let\FLOWshape \empty + \global\let\FLOWlocation \empty + \global\let\FLOWtext \empty + \global\let\FLOWhelp \empty + \global\let\FLOWdestination\empty + \global\let\FLOWoverlay \empty + \global\let\FLOWfocus \empty + \global\let\tFLOWlabel \empty + \global\let\bFLOWlabel \empty + \global\let\lFLOWlabel \empty + \global\let\rFLOWlabel \empty + \global\let\bcFLOWlabel \empty + \global\let\tcFLOWlabel \empty + \global\let\lcFLOWlabel \empty + \global\let\rcFLOWlabel \empty + \global\let\tFLOWexit \empty + \global\let\bFLOWexit \empty + \global\let\lFLOWexit \empty + \global\let\rFLOWexit \empty + % commands + \let\name \doFLOWname + \let\shape \doFLOWshape + \let\destination\doFLOWdestination + \let\location \doFLOWlocation + \let\focus \doFLOWfocus + \let\overlay \doFLOWoverlay + \let\figure \doFLOWfigure + \let\text \doFLOWtext + \let\comment \doFLOWcomment + \let\label \doFLOWlabel + \let\help \doFLOWhelp + \let\connection \doFLOWconnection + \let\exit \doFLOWexit + % convenience commands + \let\locate \doFLOWlocate + \let\connect \doFLOWconnect} + +\let\FLOWcell \s!unknown +\let\FLOWshape \s!unknown +\let\FLOWdestination\s!unknown +\let\FLOWfocus \s!unknown +\let\FLOWoverlay \empty +\let\FLOWtext \empty + +\def\doFLOWname#1% + {\def\FLOWcell{#1}\setFLOWname\FLOWname{name_#1}\ignorespaces} + +\def\doFLOWshape#1% + {\gdef\FLOWshape{#1}\ignorespaces} + +\def\doFLOWdestination#1% + {\gdef\FLOWdestination{#1}\ignorespaces} + +\def\doFLOWlocation#1% + {\setFLOWlocation#1\end\ignorespaces} + +\def\doFLOWfocus#1% + {\gdef\FLOWfocus{#1}\ignorespaces} + +\def\doFLOWoverlay#1% + {\gdef\FLOWoverlay{#1}\ignorespaces} + +\def\doFLOWfigure#1% + {\defineoverlay[\s!dummy][\overlayfigure{#1}]% + \overlay\s!dummy} + +\def\doFLOWtext + {\dosingleempty\dodoFLOWtext} + +\def\dodoFLOWtext[#1]% % #2% + {\gdef\FLOWalign{#1}\gdef\FLOWtext}% {#2}} + +\def\doFLOWcomment[#1]#2% + {\ignorespaces\dogobblesingleempty} + +\def\doFLOWlabel[#1]#2% wordt dit gebruikt ? + {\setgvalue{#1FLOWlabel}{#2}\ignorespaces} + +\def\doFLOWhelp#1% + {\gdef\FLOWhelp{#1}\ignorespaces} + +\def\doFLOWconnection + {\dodoubleempty\dodoFLOWconnection} + +\def\dodoFLOWconnection[#1][#2]#3% + {\ignorespaces} + +\def\doFLOWconnect + {\connection} + +\def\doFLOWlocate + {\location} + +\def\doFLOWexit[#1]#2% + {\setgvalue{#1FLOWexit}{#2}\ignorespaces} + +\def\startFLOWchart + {\bgroup + \let\stopFLOWchart\egroup + \obeylines % lelijk, buffers nog eens fatsoeneren + \dodoubleempty\dostartFLOWchart} + +\def\dostartFLOWchart[#1][#2]% + {\preparenextFLOWchart{#1}{#2}% + \dostartbuffer[\FLOWbufferprefix\nofFLOWcharts][startFLOWchart][stopFLOWchart]} + +\def\defineFLOWchart% + {\dodoubleempty\dodefineFLOWchart} + +\long\def\dodefineFLOWchart[#1][#2]#3% + {\preparenextFLOWchart{#1}{#2}% + \setbuffer[\FLOWbufferprefix\nofFLOWcharts]#3\endbuffer} + +\def\preparenextFLOWchart#1#2% + {\doglobal\increment\nofFLOWcharts + \flowchart{#1}% + \setxvalue{\@FLOW@-#1}{\noexpand\dohandleflowchart[\nofFLOWcharts][#2]}} + +\def\setupFLOWcharts{\dodoubleargument\getparameters[\@@FLOW]} +\def\setupFLOWlines {\dodoubleargument\getparameters[\@@FLOL]} +\def\setupFLOWshapes{\dodoubleargument\getparameters[\@@FLOS]} +\def\setupFLOWfocus {\dodoubleargument\getparameters[\@@FLOF]} +\def\setupFLOWsets {\dodoubleargument\getparameters[\@@FLOX]} + +\setupFLOWcharts + [\c!option=, + \c!bodyfont=, + \c!dot=, % private option + \c!width=12\bodyfontsize, + \c!height=7\bodyfontsize, + \c!maxwidth=, + \c!maxheight=, + \c!offset=\v!standard, % == auto offset + \c!dx=2\bodyfontsize, + \c!dy=2\bodyfontsize, + \c!nx=0, % 1, + \c!ny=0, % 1, + \c!x=1, + \c!y=1, + \c!autofocus=, + \c!focus=, + \c!background=, % \v!color, + \c!backgroundcolor=\s!white, + \c!rulethickness=\linewidth, + \c!frame=\v!off, + \c!framecolor=] + +\setupFLOWlines + [\c!corner=\v!round, + \c!arrow=\v!yes, + \c!dash=\v!no, + \c!radius=.375\bodyfontsize, % 2.5\c!rulethickness + \c!color=FLOWlinecolor, + \c!rulethickness=.15\bodyfontsize, % 2pt, + \c!offset=\v!none] + +\setupFLOWshapes + [\c!default=action, + \c!framecolor=FLOWframecolor, + \c!background=\v!color, + \c!backgroundcolor=FLOWbackgroundcolor, + \c!backgroundscreen=\@@rsscreen, + \c!rulethickness=.15\bodyfontsize, % 2pt, + \c!offset=.5\bodyfontsize] + +\setupFLOWfocus + [\c!framecolor=FLOWfocuscolor, + \c!background=\@@FLOSbackground, + \c!backgroundcolor=\@@FLOSbackgroundcolor, + \c!backgroundscreen=\@@FLOSbackgroundscreen, + \c!rulethickness=\@@FLOSrulethickness, + \c!offset=\@@FLOSoffset] + +\definecolor [FLOWfocuscolor] [s=.2] +\definecolor [FLOWlinecolor] [s=.5] +\definecolor [FLOWframecolor] [s=.7] +\definecolor [FLOWbackgroundcolor] [s=.9] + +\newcounter\includeFLOWx +\newcounter\includeFLOWy + +\def\includeFLOWchart + {\dodoubleempty\doincludeFLOWchart} + +\def\doincludeFLOWchart[#1][#2]% + {\pushmacro\includeFLOWx + \pushmacro\includeFLOWy + \getparameters[FLOWi][x=1,y=1,#2]% + \increment(\includeFLOWx,0\FLOWix)\decrement\includeFLOWx + \increment(\includeFLOWy,0\FLOWiy)\decrement\includeFLOWy + \def\dodoincludeFLOWchart##1% + {\doifdefined{\@FLOW@-##1} + {\globalpushmacro\dohandleflowchart % was local + \gdef\dohandleflowchart[####1][####2]% + {\globalpopmacro\dohandleflowchart % was local + \resetFLOWlocation + \processFLOWbuffer{####1}}% + \getvalue{\@FLOW@-##1}}}% + \processcommalist[#1]\dodoincludeFLOWchart + \popmacro\includeFLOWx + \popmacro\includeFLOWy} + +\def\resetFLOWlocation + {\globallet\lastFLOWx\!!zerocount + \globallet\lastFLOWy\!!zerocount} + +\def\dosetFLOWlocation[#1#2]#3#4% + {\processaction + [#1#2] + [ +=>\scratchcounter\numexpr#4+ 1+#3\relax, + -=>\scratchcounter\numexpr#4- 1+#3\relax, + +#2=>\scratchcounter\numexpr#4+#2+#3\relax, + -#2=>\scratchcounter\numexpr#4-#2+#3\relax, + \s!default=>\scratchcounter\numexpr#4 +#3\relax, + \s!unknown=>\scratchcounter\numexpr0#1#2+#3\relax]% + \xdef#4{\the\scratchcounter}} + +\def\setFLOWlocation#1,#2\end + {\dosetFLOWlocation[#1\empty]\includeFLOWx\lastFLOWx + \dosetFLOWlocation[#2\empty]\includeFLOWy\lastFLOWy + \xdef\FLOWlocation{\lastFLOWx,\lastFLOWy}} + +\def\FLOWshapes + {node, action, procedure, product, decision, archive, + loop, wait, subprocedure, singledocument, multidocument, + sub procedure, single document, multi document, up, down, + left, right} + +\def\FLOWlines + {up, down, left, right} + +\def\FLOWsetconnect#1% + {\donefalse + \let\cFLOWfrom\empty + \let\cFLOWto\empty + \let\zFLOWfrom\!!zerocount + \let\zFLOWto\!!zerocount + \handletokens#1\with\doFLOWsetconnect + \ifx\cFLOWto\empty\let\cFLOWfrom\empty\fi} + +\def\doFLOWsetconnect#1% + {\ifx #1p% + \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi + \else\ifx#1+% + \ifdone\def\zFLOWto{+1}\else\def\zFLOWfrom{+1}\fi + \else\ifx#1n% + \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi + \else\ifx#1-% + \ifdone\def\zFLOWto{-1}\else\def\zFLOWfrom{-1}\fi + \else\ifdone + \edef\cFLOWto{\FLOWconnector#1}% + \else + \edef\cFLOWfrom{\FLOWconnector#1}% + \donetrue + \fi\fi\fi\fi\fi} + +\def\FLOWconnector#1% + {\if#1bbottom\else\if#1ttop\else\if#1lleft\else\if#1rright\fi\fi\fi\fi} + +\newif\ifFLOWscaling \FLOWscalingtrue + +\def\@@FLOW@@offset{\@@FLOWoffset} + +\def\getFLOWchart + {\dodoubleempty\dogetFLOWchart} + +\def\dogetFLOWchart[#1][#2]% + {\doifundefinedelse{\@FLOW@-#1} + {\writestatus{FLOW}{unknown chart #1}% + \framed + [\c!width=12\bodyfontsize,\c!height=8\bodyfontsize] + {\tttf [chart #1]}} + {\dodogetFLOWchart[#1][#2]}} + +\def\dodogetFLOWchart[#1][#2]% to be split a bit more + {\vbox\bgroup + \insidefloattrue + \forgetall + \dontcomplain + % \offinterlineskip % we now explicitly use \nointerlineskip later on + \def\dohandleflowchart[##1][##2]% + {\def\currentFLOWnumber{##1}% + \getparameters[\@@FLOW][##2]}% + \getvalue{\@FLOW@-#1}% + \getparameters[\@@FLOW][#2]% dubbelop ? + \doifsomething{\@@FLOWautofocus} + {\checkFLOWautofocus}% + %\message{AUTOSHAPE 3: (\@@FLOWx,\@@FLOWy)->(\@@FLOWnx,\@@FLOWny)}\wait + \global\let\FLOWwidth \@@FLOWnx + \global\let\FLOWheight\@@FLOWny + \let\startFLOWcell\startFLOWcellA + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + \ifcase\@@FLOWnx\relax \let\@@FLOWnx\FLOWwidth \fi + \ifcase\@@FLOWny\relax \let\@@FLOWny\FLOWheight \fi + \doifnothing{\@@FLOWmaxwidth\@@FLOWmaxheight}{\FLOWscalingfalse}% + \ifFLOWscaling + \doifnothing{\@@FLOWmaxwidth }{\let\@@FLOWmaxwidth \maxdimen}% + \doifnothing{\@@FLOWmaxheight}{\let\@@FLOWmaxheight\maxdimen}% + \scratchcounter\bodyfontpoints + \doloop % NOG FONTSWITCH OM EX EN EM TE LATEN WERKEN + {\ifnum\scratchcounter>1 % NU DIMENSIONS IN TERMS OF BODYFONTSIZE + \bodyfontsize=\the\scratchcounter pt + \dimen0=\@@FLOWmaxwidth + \dimen2=\@@FLOWwidth + \dimen4=\@@FLOWdx + \advance\dimen2 2\dimen4 + \dimen2=\@@FLOWnx\dimen2 + \advance\dimen2 2\dimen4 + \ifdim\dimen2>\dimen0 + \advance\scratchcounter \minusone + \else + \dimen0=\@@FLOWmaxheight + \dimen2=\@@FLOWheight + \dimen4=\@@FLOWdy + \advance\dimen2 2\dimen4 + \dimen2=\@@FLOWny\dimen2 + \advance\dimen2 2\dimen4 + \ifdim\dimen2>\dimen0 + \advance\scratchcounter \minusone + \else + \exitloop + \fi + \fi + \else + \exitloop + \fi}% + \expanded{\switchtobodyfont[\the\scratchcounter pt]}% + \forgetall + % \offinterlineskip % needed ? + \else\ifx\@@FLOWbodyfont\empty\else + \expanded{\switchtobodyfont[\@@FLOWbodyfont]}% \expanded ? + \fi\fi + \global\let\FLOWcells\empty + \dimen0=\@@FLOWwidth + \edef\FLOWshapewidth{\the\dimen0}% + \dimen2=\@@FLOWdx + \advance\dimen0 2\dimen2 + \edef\FLOWgridwidth{\the\dimen0}% + \dimen0=\@@FLOWheight + \edef\FLOWshapeheight{\the\dimen0}% + \dimen2=\@@FLOWdy + \advance\dimen0 2\dimen2 + \edef\FLOWgridheight{\the\dimen0}% + \scratchdimen=\@@FLOSrulethickness + \edef\@@FLOSrulethickness{\the\scratchdimen}% + \scratchdimen=\@@FLOFrulethickness + \edef\@@FLOFrulethickness{\the\scratchdimen}% + \scratchdimen=\@@FLOLrulethickness + \edef\@@FLOLrulethickness{\the\scratchdimen}% + \ifdim\@@FLOLradius<2.5\scratchdimen + \scratchdimen=2.5\scratchdimen + \edef\@@FLOLradius{\the\scratchdimen}% + \ifdim\@@FLOLradius>\@@FLOWdx + \scratchdimen=\@@FLOWdx + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \ifdim\@@FLOLradius>\@@FLOWdy + \scratchdimen=\@@FLOWdy + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \else + \scratchdimen=\@@FLOLradius + \edef\@@FLOLradius{\the\scratchdimen}% + \fi + \processaction % magic 2.5 + [\@@FLOWoffset] + [ \v!none=>\scratchdimen=-2.5\scratchdimen, + \v!overlay=>\scratchdimen=-2.5\scratchdimen, + \v!standard=>\scratchdimen=\scratchdimen, + \s!unknown=>\scratchdimen=\@@FLOWoffset, + \s!default=>\scratchdimen=-2.5\scratchdimen]% + \edef\@@FLOW@@offset{\the\scratchdimen}% + \forgetall + \offinterlineskip + \resetMPdrawing + \doglobal\newcounter\FLOWcomment + \startMPdrawing + if unknown context_char : input mp-char.mpii ; fi ; + grid_width := \FLOWgridwidth ; + grid_height := \FLOWgridheight ; + shape_width := \FLOWshapewidth ; + shape_height := \FLOWshapeheight ; + connection_line_width := \@@FLOLrulethickness ; + connection_smooth_size := \@@FLOLradius ; + connection_arrow_size := \@@FLOLradius ; + connection_dash_size := \@@FLOLradius ; + currentpicture := nullpicture ; + begin_chart(0,\FLOWwidth,\FLOWheight); + reverse_y := true ; + chart_offset := \@@FLOW@@offset ; + \stopMPdrawing + \doifelsenothing\@@FLOWbackgroundcolor + {\startMPdrawing + chart_background_color := white ; + \stopMPdrawing} + {\startMPdrawing + chart_background_color := \MPcolor{\@@FLOWbackgroundcolor} ; + \stopMPdrawing}% + \doif\@@FLOWoption\v!test + {\startMPdrawing + show_con_points := true ; + show_mid_points := true ; + show_all_points := true ; + \stopMPdrawing}% + \processaction % private + [\@@FLOWdot] + [ \v!yes=>\startMPdrawing + show_con_points := true ; + show_mid_points := true ; + show_all_points := true ; + \stopMPdrawing, + \s!unknown=>\startMPdrawing + show_\@@FLOWdot_points := true ; + \stopMPdrawing]% +\doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellB + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber +\doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellC + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + \startMPdrawing + clip_chart(\@@FLOWx,\@@FLOWy,\@@FLOWnx,\@@FLOWny) ; + end_chart ; + \stopMPdrawing + \MPdrawingdonetrue + \setbox0\hbox + {\MPstaticgraphictrue + \MPshiftdrawingfalse + \getMPdrawing}% + \def\MPmessage##1% + {\writestatus{MP charts}{##1}}% + \def\MPposition##1##2##3% + {\setvalue{\@@MPx##1}{##2}\setvalue{\@@MPy##1}{##3}}% + \def\MPclippath##1##2##3##4% + {\def\clipMPllx{##1bp}\def\clipMPlly{##2bp}% + \def\clipMPurx{##3bp}\def\clipMPury{##4bp}}% + \def\MPareapath##1##2##3##4% + {\def\areaMPllx{##1bp}\def\areaMPlly{##2bp}% + \def\areaMPurx{##3bp}\def\areaMPury{##4bp}}% + \getMPdata + \doglobal\newcounter\FLOWcomment + \let\startFLOWcell\startFLOWcellD + \setbox2\vbox to \ht0 + {\forgetall % \offinterlineskip + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber\vss}% + \setbox2\hbox + {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box2}% + \wd2\wd0\ht2\ht0\dp2\dp0 + \let\startFLOWcell\startFLOWcellE + \setbox4\vbox to \ht0 + {\forgetall % \offinterlineskip + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber\vss}% + \setbox4\hbox + {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}% + \wd4\wd0\ht4\ht0\dp4\dp0 + \doifelse\@@FLOWoption\v!test + {\setbox6\vbox + {\forgetall + \vskip\@@FLOW@@offset + \hskip\@@FLOW@@offset + \basegrid + [\c!x=\@@FLOWx,\c!nx=\@@FLOWnx,\c!dx=\withoutpt\FLOWgridwidth, + \c!y=\@@FLOWy,\c!ny=\@@FLOWny,\c!dy=\withoutpt\FLOWgridheight, + \c!xstep=1,\c!ystep=1, + \c!unit=pt,\c!location=\v!middle]}% + \wd6\wd0\ht6\ht0\dp6\dp0 + \setbox8\vbox + {\forgetall + \offinterlineskip + \vskip\@@FLOW@@offset + \dostepwiserecurse\@@FLOWy\@@FLOWny\plusone + {\vbox to \FLOWgridheight + {\vfill + \hskip\@@FLOW@@offset + \hbox + {\dostepwiserecurse\@@FLOWx\@@FLOWnx\plusone + {\hbox to \FLOWgridwidth + {\hfill + \framed + [\c!framecolor=red, + \c!width=\FLOWshapewidth, + \c!height=\FLOWshapeheight] + {}% + \hfill}}} + \vfill}}}% + \wd8\wd0\ht8\ht0\dp8\dp0 + \framed + [\c!offset=\v!overlay,\c!framecolor=green] + {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2\hskip-\wd6\box6\hskip-\wd8\box8}}} + {\framed + [\c!offset=\v!overlay, + \c!frame=\@@FLOWframe, + \c!rulethickness=\@@FLOWrulethickness, + \c!framecolor=\@@FLOWframecolor, + \c!background=\@@FLOWbackground, + \c!backgroundcolor=\@@FLOWbackgroundcolor] + {\hbox{\box4\hskip-\wd0\box0\hskip-\wd2\box2}}}% + %\message{[\FLOWcells]}\wait + \egroup} + +% Pass A + +\long\def\startFLOWcellA#1\stopFLOWcell% + {\resetFLOWcell + \ignorespaces#1\unskip + \expandafter\getFLOWlocationA\FLOWlocation\end + \ignorespaces} + +\def\getFLOWlocationA#1,#2\end + {\ifnum0#1>\FLOWwidth \xdef\FLOWwidth {#1}\fi + \ifnum0#2>\FLOWheight\xdef\FLOWheight{#2}\fi} + +% Pass B +% +% beware: the - after \@FLOC@ is needed since name can be +% empty and we don't want to redefine \@FLOC@ itself by +% mistake + +\long\def\startFLOWcellB#1\stopFLOWcell + {\resetFLOWcell\ignorespaces#1\unskip + \setxvalue{\@FLOC@-\FLOWname}{\FLOWlocation}% kost veel cs's + \ifx\FLOWshape\empty + \global\let\FLOWshape\@@FLOSdefault + \fi + \doifnot\FLOWshape{none} % {\v!none} + {\ExpandBothAfter\doifinsetelse{\FLOWshape}{\FLOWshapes} + {\edef\FLOWshapetag{shape_\FLOWshape}% beter \expanded + \@EA\setFLOWname\@EA\FLOWshapetag\@EA{\FLOWshapetag}} + {\doifnumberelse\FLOWshape + {\let\FLOWshapetag\FLOWshape} + {\let\FLOWshapetag\empty}}% + \ifx\FLOWshapetag\empty \else + \ExpandBothAfter\doifinsetelse{\FLOWshape}{\FLOWlines} + {\chardef\FLOWstate0 } + {\ExpandBothAfter\doifcommonelse{\FLOWcell,\FLOWfocus}{\@@FLOWfocus} + {\chardef\FLOWstate1 } + {\chardef\FLOWstate2 }}% + \startMPdrawing + begin_sub_chart ; + \ifcase\FLOWstate + shape_line_color := \MPcolor{\@@FLOLcolor} ; + shape_fill_color := \MPcolor{\@@FLOLcolor} ; + shape_line_width := \@@FLOLrulethickness ; + \or + shape_line_color := \MPcolor{\@@FLOFframecolor} ; + shape_fill_color := \MPcolor{\@@FLOFbackgroundcolor} ; + shape_line_width := \@@FLOFrulethickness ; + \or + shape_line_color := \MPcolor{\@@FLOSframecolor} ; + shape_fill_color := \MPcolor{\@@FLOSbackgroundcolor} ; + shape_line_width := \@@FLOSrulethickness ; + \fi + %\ifx\FLOWoverlay\empty + % peepshape := false ; + %\else + % peepshape := true ; + %\fi + peepshape := \ifx\FLOWoverlay\empty false \else true \fi ; + new_shape(\FLOWlocation,\FLOWshapetag) ; + end_sub_chart ; + \stopMPdrawing + \fi}% + \ignorespaces} + +% Pass C + +\long\def\startFLOWcellC#1\stopFLOWcell% + {\resetFLOWcell +\pushmacro\lastFLOWx +\pushmacro\lastFLOWy + \ignorespaces#1\unskip % makes sure that vars are set +\popmacro\lastFLOWy +\popmacro\lastFLOWx + \let\connection\doFLOWconnectionC + \ignorespaces#1\unskip} + +\def\FLOWorigin{0,0} + +\def\doFLOWdisplace[#1,#2,#3]% experiment + {dsp_x := #1 ; dsp_y := #2 ;} + +\def\doFLOWconnectionC + {\dodoubleempty\dodoFLOWconnectionC} + +\def\dodoFLOWconnectionC[#1][#2]#3% + {\doglobal\increment\FLOWcomment + \setFLOWname\otherFLOWname{name_#3}% + \doifdefinedelse{\@FLOC@-\FLOWname} + {\edef\FLOWfrom{\getvalue{\@FLOC@-\FLOWname}}} + {\let \FLOWfrom \FLOWorigin}% + \ifx\FLOWfrom\FLOWorigin \else + \doifdefinedelse{\@FLOC@-\otherFLOWname} + {\edef\FLOWto {\getvalue{\@FLOC@-\otherFLOWname}}} + {\let \FLOWto \FLOWorigin}% + \ifx\FLOWto\FLOWorigin \else + \FLOWsetconnect{#1}% + \ifx\cFLOWfrom\empty \else + \doifelse\@@FLOLcorner\v!round + {\startMPdrawing smooth := true ; \stopMPdrawing} + {\startMPdrawing smooth := false ; \stopMPdrawing}% + \doifelse\@@FLOLdash\v!yes + {\startMPdrawing dashline := true ; \stopMPdrawing} + {\startMPdrawing dashline := false ; \stopMPdrawing}% + \doifelse\@@FLOLarrow\v!yes + {\startMPdrawing arrowtip := true ; \stopMPdrawing} + {\startMPdrawing arrowtip := false ; \stopMPdrawing}% + \doifelse\@@FLOLoffset\v!none + {\startMPdrawing touchshape := true ; \stopMPdrawing} + {\startMPdrawing touchshape := false ; \stopMPdrawing}% +%\doifsomething{#2} +% {\startMPdrawing +% \doFLOWdisplace[0#2,0,0]% +% \stopMPdrawing}% + \startMPdrawing +\doFLOWdisplace[0#2,0,0]% + connection_line_color := \MPcolor{\@@FLOLcolor} ; + connection_line_width := \@@FLOLrulethickness ; + connect_\cFLOWfrom_\cFLOWto (\FLOWfrom,\zFLOWfrom) (\FLOWto,\zFLOWto) ; +\doFLOWdisplace[0,0,0]% + \stopMPdrawing + \fi + \fi + \fi + \ignorespaces} + +% Pass D + +\long\def\startFLOWcellD#1\stopFLOWcell + {\resetFLOWcell +\pushmacro\lastFLOWx +\pushmacro\lastFLOWy + \ignorespaces#1\unskip % presets vars +\popmacro\lastFLOWy +\popmacro\lastFLOWx + \let\doprocessFLOWcell\doprocessFLOWcellD + \expandafter\doprocessFLOWcellD\FLOWlocation\end + \let\connection\doFLOWconnectionD + \let\comment\doFLOWcommentD + \ignorespaces#1\unskip\ignorespaces} + +\def\doFLOWconnectionD + {\dodoubleempty\dodoFLOWconnectionD} + +\def\dodoFLOWconnectionD[#1][#2]#3% + {\doglobal\increment\FLOWcomment + \ignorespaces} + +\def\doFLOWcommentD[#1]#2% + {\bgroup + \let\FLOW \middlebox + \let\FLOWb \bottombox + \let\FLOWbl\bottomleftbox + \let\FLOWbr\bottomrightbox + \let\FLOWt \topbox + \let\FLOWtl\topleftbox + \let\FLOWtr\toprightbox + \let\FLOWl \leftbox + \let\FLOWlt\lefttopbox + \let\FLOWlb\leftbottombox + \let\FLOWr \rightbox + \let\FLOWrt\righttopbox + \let\FLOWrb\rightbottombox + \let\FLOWc \middlebox +%\ifdefined{FLOW#1}% + \ifcase0\getvalue{\@@MPx\FLOWcomment}\getvalue{\@@MPy\FLOWcomment}\relax + \else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp<\areaMPllx\relax\else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp>\areaMPurx\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp<\areaMPlly\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp>\areaMPury\relax\else + \dimen0=\getvalue{\@@MPx\FLOWcomment}\s!bp + \advance\dimen0 -\@@FLOW@@offset + \advance\dimen0 -\clipMPllx + \dimen2=\clipMPury + \advance\dimen2 -\@@FLOW@@offset + \advance\dimen2 -\getvalue{\@@MPy\FLOWcomment}\s!bp + \setbox\scratchbox\hbox{\strut#2}% + \boxoffset.5\bodyfontsize + \setbox\scratchbox\hbox{\hskip\dimen0\lower\dimen2\getvalue{FLOW#1}{\box\scratchbox}}% + \smashbox\scratchbox + \box\scratchbox + \boxoffset\zeropoint + \nointerlineskip % really needed + \fi + \fi + \fi + \fi + \fi +%\fi + \egroup + \ignorespaces} + +% pass D + +\def\dophaseoneFLOWcellX#1#2% + {\!!counta#1\relax + \!!countb#2\relax + \!!countc\@@FLOWx + \!!countd\@@FLOWy + \advance\!!countc \@@FLOWnx + \advance\!!countd \@@FLOWny + \advance\!!countc \minusone + \advance\!!countd \minusone + \ifnum\!!counta<\@@FLOWx\relax \donefalse + \else\ifnum\!!counta>\!!countc \donefalse + \else\ifnum\!!countb<\@@FLOWy\relax \donefalse + \else\ifnum\!!countb>\!!countd \donefalse + \else \donetrue + \fi\fi\fi\fi} + +\def\dophasetwoFLOWcellX + {\advance\!!counta -\@@FLOWx + \advance\!!counta \plusone + \advance\!!countb -\@@FLOWy + \advance\!!countb \plusone + \dimen0=\FLOWgridwidth + \dimen0=\!!counta\dimen0 + \advance\dimen0 -\FLOWgridwidth + \dimen4=\FLOWgridwidth + \advance\dimen4 -\FLOWshapewidth + \advance\dimen0 .5\dimen4 + \dimen2=\FLOWgridheight + \dimen2=\!!countb\dimen2 + \dimen4=\FLOWgridheight + \advance\dimen4 -\FLOWshapeheight + \advance\dimen2 -.5\dimen4 + \edef\FLOWdx{\the\dimen0}% + \edef\FLOWdy{\the\dimen2}} + +\def\positionFLOWzero% assumes \FLOWdx and \FLOWdy are set + {\setbox0\hbox{\hskip\FLOWdx\lower\FLOWdy\box0}% + \smashbox0\box0 + \nointerlineskip} % new, needed since we somehow reset that + +\def\doFLOWtlabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi + \setbox0\hbox{\hskip\dimen2\raise\scratchdimen + \hbox{\raise\dimen4\hbox{#1{\strut#3}}}}% + \positionFLOWzero}% + +\def\doFLOWblabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdy\fi + \setbox0\hbox{\hskip\dimen2\raise-\scratchdimen + \hbox{#1{\strut#3}}}% + \positionFLOWzero}% + +\def\doFLOWllabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi + \setbox0\hbox{\hskip-\scratchdimen\raise\dimen6 + \hbox{#1{\strut#3}}}% + \positionFLOWzero}% + +\def\doFLOWrlabel#1#2#3% + {\scratchdimen\ifcase#2 \zeropoint\else\@@FLOWdx\fi + \setbox0\hbox{\hskip\dimen0\hskip\scratchdimen + \hbox{\raise\dimen6\hbox{#1{\strut#3}}}}% + \positionFLOWzero} + +\def\doprocessFLOWcellD#1,#2\end + {\dophaseoneFLOWcellX{#1}{#2}% + \ifdone + \dophasetwoFLOWcellX + \doglobal\addtocommalist\FLOWcell\FLOWcells + \def\FLOWx{#1}% + \def\FLOWy{#2}% + \directsetup{flowcell}% + \setbox0\hbox + {\ifx\FLOWalign\empty\else + \setupframed + [\c!align=\v!normal,\c!bottom=\vfill,\c!top=\vfill]% + \@EA\processallactionsinset\@EA + [\FLOWalign] + [t=>{\setupframed[\c!bottom=\vfill,\c!top=]}, + b=>{\setupframed[\c!bottom=,\c!top=\vfill]}, + l=>{\setupframed[\c!align=\v!right]}, + r=>{\setupframed[\c!align=\v!left]}, + m=>{\setupframed[\c!align=\v!middle]}, + c=>{\setupframed[\c!align=\v!middle]}]% + \fi + \doifelse\FLOWshape{none} % {\v!none} + {\setupframed[\c!offset=\v!overlay]} + {\setupframed[\c!offset=\@@FLOSoffset]}% + \framed + [\c!frame=\v!off,\c!background=flowcell, + \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] + {\FLOWtext}}% + \showFLOWhelp0 + \ifx\FLOWdestination\empty\else + \setbox0\hbox + {\setupinteraction[\c!color=,\c!contrastcolor=]% + \gotobox{\box0}[\FLOWdestination]}% + \fi + \positionFLOWzero + \dimen0=\FLOWshapewidth \dimen2=.5\dimen0 + \dimen4=\FLOWshapeheight\dimen6=.5\dimen4 + \boxoffset.5\bodyfontsize + \doFLOWtlabel \righttopbox0\tFLOWlabel + \doFLOWblabel\rightbottombox0\bFLOWlabel + \doFLOWllabel \lefttopbox0\lFLOWlabel + \doFLOWrlabel \righttopbox0\rFLOWlabel + \doFLOWtlabel \topbox0\tcFLOWlabel % for me only + \doFLOWblabel \bottombox0\bcFLOWlabel % for me only + \doFLOWllabel \leftbox0\lcFLOWlabel % for me only + \doFLOWrlabel \rightbox0\rcFLOWlabel % for me only + \ifnum#1=\@@FLOWx\relax \doFLOWllabel \leftbox1\lFLOWexit \fi + \ifnum#1=\!!countc \doFLOWrlabel \rightbox1\rFLOWexit \fi + \ifnum#2=\@@FLOWy\relax \doFLOWtlabel \topbox1\tFLOWexit \fi + \ifnum#2=\!!countd \doFLOWblabel \bottombox1\bFLOWexit \fi + \boxoffset\zeropoint + \fi} + +% For Willy Egger: +% +% \startsetups flowcell +% \definelayer +% [flowcell] +% [width=\FLOWshapewidth, +% height=\FLOWshapeheight] +% \setlayerframed +% [flowcell] +% [preset=rightbottom,offset=1ex] +% [frame=off] +% {\tx(\FLOWx,\FLOWy)} +% \stopsetups + +% Pass E + +\long\def\startFLOWcellE#1\stopFLOWcell + {\resetFLOWcell + \ignorespaces#1\unskip + \let\doprocessFLOWcell\doprocessFLOWcellE + \expandafter\doprocessFLOWcell\FLOWlocation\end} + +\def\doprocessFLOWcellE#1,#2\end % redundant + {\ifx\FLOWoverlay\empty \else + \dophaseoneFLOWcellX{#1}{#2}% + \ifdone + \dophasetwoFLOWcellX + \edef\FLOWdx{\the\dimen0}% + \edef\FLOWdy{\the\dimen2}% + \setbox0\hbox + {\framed + [%\c!frame=\v!off, + \c!background={\@@FLOWbackground,\FLOWoverlay}, + \c!backgroundcolor=\@@FLOSbackgroundcolor, + \c!width=\FLOWshapewidth,\c!height=\FLOWshapeheight] + {}}% + \positionFLOWzero + \fi + \fi} + +% Pass F + +\def\checkFLOWautofocus + {\def\@@FLOWminx{100}\let\@@FLOWminy\@@FLOWminx + \def\@@FLOWmaxx {0}\let\@@FLOWmaxy\@@FLOWmaxx + \def\@@FLOWabsx {0}\let\@@FLOWabsy\@@FLOWabsx + \let\startFLOWcell\startFLOWcellF + \resetFLOWlocation + \processFLOWbuffer\currentFLOWnumber + %\message{AUTOSHAPE 1: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% + \ifnum\@@FLOWabsx<\@@FLOWmaxx\let\@@FLOWmaxx\@@FLOWabsx\fi + \ifnum\@@FLOWabsy<\@@FLOWmaxy\let\@@FLOWmaxy\@@FLOWabsy\fi + %\message{AUTOSHAPE 2: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}% + \donetrue + \ifnum\@@FLOWminx=100 \donefalse\fi + \ifnum\@@FLOWminy=100 \donefalse\fi + \ifnum\@@FLOWmaxx=0 \donefalse\fi + \ifnum\@@FLOWmaxy=0 \donefalse\fi + \doFLOWcheckF\@@FLOWx\@@FLOWminx\@@FLOWmaxx\@@FLOWnx + \doFLOWcheckF\@@FLOWy\@@FLOWminy\@@FLOWmaxy\@@FLOWny} + +\def\startFLOWcellF#1\stopFLOWcell% + {\resetFLOWcell + \ignorespaces#1\unskip + \expandafter\doFLOWlocationF\FLOWlocation\end}% + +\def\doFLOWlocationF#1,#2\end% + {\ifnum#1>\@@FLOWabsx\def\@@FLOWabsx{#1}\fi + \ifnum#2>\@@FLOWabsy\def\@@FLOWabsy{#2}\fi + \ExpandBothAfter\doifinset{\FLOWcell}{\@@FLOWautofocus} + {\dodoFLOWlocationF{#1}<-\@@FLOWminx + \dodoFLOWlocationF{#1}>+\@@FLOWmaxx + \dodoFLOWlocationF{#2}<-\@@FLOWminy + \dodoFLOWlocationF{#2}>+\@@FLOWmaxy}} + +\def\dodoFLOWlocationF#1#2#3#4% + {\ifnum#1#2#4\relax + \!!counta=#1\advance\!!counta #31\relax + \edef#4{\ifnum\!!counta<1 1\else\the\!!counta\fi}% + \fi} + +\def\doFLOWcheckF#1#2#3#4% + {\ifdone + \let#1=#2% + \!!counta=#3% + \advance\!!counta \plusone\advance\!!counta -#2\relax + \ifnum\!!counta<1 \!!counta=1 \fi + \edef#4{\the\!!counta}% + \else + \let#1\!!plusone + \let#4\!!zerocount % no {1} + \fi} + +% \useFLOWchart[name][parent][setting,setting][additional settings] +% \useFLOWchart[name][parent][additional settings] + +\let\currentFLOWchart\empty + +\def\useFLOWchart + {\doquadrupleempty\douseFLOWchart} + +\def\douseFLOWchart[#1][#2][#3][#4]% name parent sets mainsettings + {\iffourthargument + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][#4,##1]}% + \else + \checkparameters[#3]% + \ifparameters + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][][#3,##1]}% + \else + \setvalue{\@FLOW@--#1}[##1]{\setgetFLOWchart[#2][#3][##1]}% + \fi + \fi} + +\def\setgetFLOWchart[#1][#2][#3]% + {\def\docommand##1{}% cell line focus ? + \processcommalist[#2]\docommand + \getFLOWchart[#1][#3]} + +\def\doFLOWchart[#1][#2]% + {\hbox\bgroup\vbox\bgroup % vmode suppresses spaces +\def\currentFLOWchart{#1}% + \doifundefinedelse{\@FLOW@--#1} + {\getFLOWchart[#1][#2]} + {\getvalue{\@FLOW@--#1}[#2]}% + \egroup\egroup} + +\def\FLOWchart% + {\dodoubleempty\doFLOWchart} + +%D A hook into the help system. + +\def\showFLOWhelp#1% + {\doifhelpinfo\FLOWhelp + {\setbox#1=\hbox + {\setbox\scratchbox=\hbox{\lower\@@FLOWdy\hbox + {\helpbutton + [\c!width=\wd0,\c!color=,\c!height=\@@FLOWdy,\c!frame=\v!no]% + [\FLOWhelp]}}% + \smashbox\scratchbox + \setbox#1=\vbox + {\forgetall\offinterlineskip\box#1\box\scratchbox}% + \box#1}}} + +%D The next section is dedicated to splitting up charts. + +\def\getFLOWsize[#1]% + {\bgroup\let\dodogetFLOWchart\dogetFLOWsize\FLOWchart[#1]\egroup} + +\def\dogetFLOWsize[#1][#2]% + {\setbox\scratchbox=\vbox + {\globallet\FLOWmaxwidth \!!zerocount + \globallet\FLOWmaxheight\!!zerocount + \def\getFLOWlocation##1,##2\end + {\ifnum0##1>\FLOWmaxwidth \xdef\FLOWmaxwidth {##1}\fi + \ifnum0##2>\FLOWmaxheight\xdef\FLOWmaxheight{##2}\fi}% + \resetFLOWcell + \long\def\startFLOWcell##1\stopFLOWcell + {{##1\expandafter\getFLOWlocation\FLOWlocation\end}}% + \def\dohandleflowchart[##1][##2]% + {\resetFLOWlocation + \processFLOWbuffer{##1}}% + \getvalue{\@FLOW@-#1}}} + +\def\setupFLOWsplit% + {\dodoubleargument\getparameters[\@@FLOT]} + +\setupFLOWsplit% + [\c!nx=3,\c!ny=3, + \c!dx=1,\c!dy=1, + \c!command=, + \c!marking=\v!on, + \c!before=,\c!after=] + +\def\FLOWsplitx {1} +\def\FLOWsplity {1} +\def\FLOWsplitnx{1} +\def\FLOWsplitny{1} + +\def\FLOWcharts + {\dodoubleempty\doFLOWcharts} + +%D While splitting, the following variables are available: +%D +%D \starttyping +%D \FLOWsplitnx \FLOWsplitny \FLOWsplitx \FLOWsplity +%D \stoptyping + +\def\doFLOWcharts[#1][#2]% + {\bgroup + \getFLOWsize[#1]% + \dodoFLOWcharts\relax + \global\let\FLOWsplitnx\FLOWsplitx + \global\let\FLOWsplitny\FLOWsplity + \dodoFLOWcharts{\dododoFLOWcharts[#1][#2]}% + \egroup} + +\def\dodoFLOWcharts#1% + {\def\@@FLOTx{1}% + \global\let\FLOWsplitx\@@FLOTx + \doloop + {\def\@@FLOTy{1}% + \global\let\FLOWsplity\@@FLOTy + \doloop + {\bgroup + \scratchcounter\FLOWmaxwidth + \advance\scratchcounter -\@@FLOTx + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\@@FLOTnx\edef\@@FLOTnx{\the\scratchcounter}\fi + \scratchcounter\FLOWmaxheight + \advance\scratchcounter -\@@FLOTy + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\@@FLOTny\edef\@@FLOTny{\the\scratchcounter}\fi + #1% does something with the float, or not + \egroup + \increment(\@@FLOTy,\@@FLOTny)% + \ifnum\@@FLOTy>\FLOWmaxheight + \exitloop + \else + \doglobal\increment\FLOWsplity + \decrement(\@@FLOTy,\@@FLOTdy)% + \fi}% + \increment(\@@FLOTx,\@@FLOTnx)% + \ifnum\@@FLOTx>\FLOWmaxwidth + \exitloop + \else + \doglobal\increment\FLOWsplitx + \decrement(\@@FLOTx,\@@FLOTdx)% + \fi}} + +\def\dododoFLOWcharts[#1][#2]% + {\bgroup + \@@FLOTbefore + \doifnot\@@FLOTmarking\v!on{\let\cuthbox\hbox}% + \cuthbox + {\@@FLOTcommand + {\FLOWchart[#1][#2, + \c!x=\@@FLOTx,\c!nx=\@@FLOTnx, + \c!y=\@@FLOTy,\c!ny=\@@FLOTny]}}% + \@@FLOTafter + \egroup} + +%D An example of splitting is given below: +%D +%D \starttyping +%D \setupFLOWsplit +%D [nx=5,ny=10, +%D dx=0,dy=0, +%D before=, +%D after=\page] +%D +%D \FLOWcharts[mybigflow] +%D \stoptyping +%D +%D Or, one can say: +%D +%D \starttyping +%D \splitfloat +%D {\placefigure{What a big flowchart this is!}} +%D {\FLOWcharts[mybigflow]} +%D \stoptyping + +%D \macros +%D {typeFLOWchart} +%D +%D For documentation purposes the following macro is +%D provided. Watch the use of the first and last line hooks, +%D which is needed because the start and stop commands are +%D not part of the buffer. + +\def\typeFLOWchart[#1]% + {\bgroup + \def\dohandleflowchart[##1][##2]{\typeFLOWbuffer{##1}}% + \defconvertedargument\firstverbatimfileline{\startFLOWchart[#1]}% + \defconvertedargument\lastverbatimfileline {\stopFLOWchart}% + \getvalue{\@FLOW@-#1} + \egroup} + +%D New: +%D +%D \starttyping +%D \setupFLOWcharts[command=\Whow] +%D +%D \startFLOWset[convert-en] % [tag][convert-en] +%D \subFLOWchart[a][x=1,y=1,nx=3,ny=3] +%D \subFLOWchart[b][x=1,y=2,nx=3,ny=3] +%D \subFLOWchart[c][x=2,y=1,nx=3,ny=3] +%D \stopFLOWset +%D +%D \def\Whow#1% +%D {\ifnum\currentFLOWset=1 \framed{Some Chart}\fi} +%D +%D \FLOWset[convert-en] % [tag] +%D +%D \def\Whow#1% +%D {\setuphead[state=high] +%D \startstandardmakeup +%D \centerbox{#1} +%D \stopstandardmakeup} +%D +%D \FLOWset[convert-en] % [tag] +%D \stoptyping + +\def\startFLOWset + {\dodoubleempty\dostartFLOWset} + +\def\dostartFLOWset[#1][#2]#3\stopFLOWset % tag name data + {\ifsecondargument + \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#2}{#3}}% + \else + \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#1}{#3}}% + \fi} + +\long\def\dohandleFLOWset#1#2#3% tag name data + {\bgroup + \def\subFLOWchart + {\dodoubleempty\dosubFLOWchart}% + \def\dosubFLOWchart[##1][##2]% subtag settings + {\ifsecondargument + \dodohandleFLOWset{#1}{##1}{#2}{##2}% + \else + \subFLOWchart[][##1]% + \fi}% + #3% + \egroup} + +\def\dodohandleFLOWset#1#2#3#4% tag subtag name settings + {\increment\currentFLOWset + \bgroup + \@@FLOXcommand + {\ifnum\currentFLOWset=1 \pagereference[#1]\fi + \doifsomething{#2} + {\setupreferencing[\c!prefix=]% + \pagereference[#1:#2]% -:#1:#2 + \setupreferencing[\c!prefix=#1:#2]}% + \FLOWchart[#3][#4]}% + \egroup} + +\def\FLOWset[#1]% + {\newcounter\currentFLOWset + \doifdefinedelse{\@FLOX@#1} + {\getvalue{\@FLOX@#1}} + {\dodohandleFLOWset{#1}{}{#1}{}}} + +\newcounter\currentFLOWset + +\setupFLOWsets + [\c!command=] + +%D This will be an option: + +% \def\startFLOWchart% +% {\dodoubleempty\dostartFLOWchart} +% +% \long\def\dostartFLOWchart[#1][#2]#3\stopFLOWchart +% {\preparenextFLOWchart{#1}{#2}% +% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} +% +% \long\def\dodefineFLOWchart[#1][#2]#3% +% {\preparenextFLOWchart{#1}{#2}% +% \long\setgvalue{\FLOWbufferprefix\nofFLOWcharts}{#3}} +% +% \def\processFLOWbuffer#1{\getvalue{\FLOWbufferprefix#1}} +% \def\typeFLOWbuffer #1{[Sorry, no verbatim chart #1 available.]} + +%D The \XML\ interface: + +\startXMLdefinitions flowchart + +\defineXMLargument [flowchartdefinition] + {\defineFLOWchart[\XMLpar{flowchartdefinition}{identifier}{unknown}]} + +\defineXMLpickup [flowcell] + {\startFLOWcell + \defineXMLargument[name]{\unspaceafter\name}% + \defineXMLargument[shape]{\unspaceafter\shape}% + \defineXMLnestedargument[text]{\text}} + {\stopFLOWcell} + +\defineXMLenvironment [location] % global unspace/store + {\bgroup\defineXMLpush[x]\defineXMLpush[y]} + {\XMLunspace{x}\XMLunspace{y}% + \expanded{\egroup\noexpand\location{\XMLpop{x},\XMLpop{y}}}} + +\defineXMLenvironment [connection] + {\bgroup\defineXMLpush[type]\defineXMLpush[name]}% + {\XMLunspace{type}\XMLunspace{name}% + \expanded{\egroup\noexpand\connection[\XMLpop{type}]{\XMLpop{name}}}} + +\defineXMLsingular [flowchart] + {\expanded{\FLOWchart[\XMLpar{flowchart}{identifier}{unknown}]}} + +\defineXMLdirective [flowchart] [shapes] \setupFLOWshapes +\defineXMLdirective [flowchart] [lines] \setupFLOWlines + +\stopXMLdefinitions + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-chemic.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-chemic.mkii new file mode 100644 index 00000000000..0b3c98221a1 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-chemic.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=ppchtex (m-chemic), +%D version=1997.03.19, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\PPCHTEX\ (Plain Pictex Context cHemie \TEX), +%D author=Hans Hagen, +%D date=\currentdate, +%D suggestions={Tobias Burnus, Dirk Kuypers \& Ton Otten}, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\ifx\psaxes\undefined \ifx\beginpicture\undefined + \usemodule[pictex] +\fi \fi + +\input ppchtex.mkii \relax + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-cweb.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-cweb.mkii new file mode 100644 index 00000000000..bf80e229c14 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-cweb.mkii @@ -0,0 +1,1371 @@ +%D \module +%D [ file=m-cweb, +%D version=1997.01.15, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\CWEB\ Pretty Printing Macros, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D First some auxiliary stuff, to be moved to system module. + +\def\dodofindfirstcharacter#1% + {\ifx#1\relax + \let\next=\egroup + \else + \handlecase + {\expandafter\ifnum\expandafter\catcode\expandafter`#1=11 + \def\next##1\relax{\egroup\def\firstcharacter{#1}}% + \fi}% + \fi + \next} + +\def\dofindfirstcharacter#1#2% + {\def\firstcharacter{}% + \bgroup + \defconvertedargument\ascii{#2}% + \let\next\dodofindfirstcharacter + \let\handlecase#1% + \expandafter\next\ascii\relax} + +\def\normalcase#1% + {#1} + +\def\findfirstcharacter% + {\dofindfirstcharacter\lowercase} + +\def\FindFirstCharacter% + {\dofindfirstcharacter\normalcase} + +\def\FINDFIRSTCHARACTER% + {\dofindfirstcharacter\uppercase} + +% nog doen: +% +% \deactivateCWEB in output routine +% status info +% gelinkte entries +% parskip en parindent + +%D \gdef\CWEBquote#1.{{\em Quote :}\ #1.} % checks the . + +%D This module (re)implements the \CWEB\ macros as defined in +%D the file \type{cwebmac.tex}. +%D +%D \CWEB\ uses short, often one character long, names for +%D macros. This is no real problem because no one is supposed +%D to read and understand the files generated by \CWEB. The +%D standard macros are meant for \PLAIN\ \TEX\ users. In +%D \CONTEXT\ and other macro packages however, there is a +%D potential conflict with format specific or user defined +%D commands. Furthermore, the \CWEB\ macros implement their own +%D output routines. When integrating \CWEB\ documents in +%D another environment, the \CWEB\ specific macros have to be +%D made local. The first part of this module is dedicated to +%D this feature. +%D +%D Instead of using \type{\def} and \type{\let} for defining +%D macros, we use: +%D +%D \starttyping +%D \defCEBmacro arguments {meaning} +%D \letCEBmacro arguments {meaning} +%D \stoptyping +%D +%D \CWEB files contain implicit calls to macros that generate +%D the table of contents, the lists of sections and the index. +%D Because we want to be much more flexible, we implemented our +%D own alternatives, and therefore have to bypass the original +%D ones. The next macro is used for defining these obsolete +%D \CWEB\ macros. The dummies take care of arguments. +%D +%D \starttyping +%D \defCEBdummy arguments {meaning} +%D \stoptyping +%D +%D The list of \CWEB\ specific macro names is saved in a +%D \TOKENLIST. This serves two purposes. First it enables us to +%D activate the \CWEB\ macros, which are saved under a +%D different name, second it can be used to temporary restore +%D the meanings, for instance when the output routine builds +%D the page. + +\newtoks\CWEBmacros + +%D Activating and deactivating is done by means of: +%D +%D \starttyping +%D \activateCWEB +%D \deactivateCWEB +%D \stoptyping +%D +%D Which are implemented as: + +\def\activateCWEB% + {\let\doCWEB=\activateCWEBmacro + \the\CWEBmacros} + +\def\deactivateCWEB% + {\let\doCWEB=\deactivateCWEBmacro + \the\CWEBmacros} + +%D The three definition macros append the name of the macro to +%D the list. The first two macros save the meaning, the last one +%D assigns \type{{}} to the macro and gobbles original meaning. + +\long\def\defCWEBmacro#1% + {\appendtoks\doCWEB#1\to\CWEBmacros + \setvalue{newCWEB\string#1}} + +\long\def\letCWEBmacro#1% + {\appendtoks\doCWEB#1\to\CWEBmacros + \letvalue{newCWEB\string#1}} + +\long\def\defCWEBdummy#1#2#% + {\appendtoks\doCWEB#1\to\CWEBmacros + \setvalue{newCWEB\string#1}#2{}% + \gobbleoneargument} + +%D The macro \type{\defCWEBdummy} of course takes care of the +%D argument. This leaves the two (de|)|activating macros: + +\def\CWEBmacro#1% + {\getvalue{newCWEB\string#1}} + +\def\activateCWEBmacro#1% + {\letvalue{oldCWEB\string#1}=#1% + \def#1{\CWEBmacro#1}} + +\def\deactivateCWEBmacro#1% + {\expandafter\let\expandafter#1\expandafter=\csname oldCWEB\string#1\endcsname} + +%D I did consider loading the \CWEB\ macros using temporary +%D substitutes of \type{\def}, \type{\font}, \type{\newbox} etc. +%D The main problem is that the file contains more than +%D definitions and taking all kind of assignments into account +%D too would not make things easier. So I decided to stick to +%D the method as just described. + +%D Now we're ready for the real job. What follows is a partial +%D adaption of the file \type{cwebmac.tex}, version 3.1, dated +%D September 1994 and written by Levy and Knuth. When possible +%D we kept the original meaning, but we've granted ourselves +%D the freedom to reformat the macro's for readibility. +%D +%D We'll only present the macros we actually use. The source +%D however contains the original implementation. + +% standard macros for CWEB listings (in addition to plain.tex) +% Version 3.1 --- September 1994. +% +% \ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros +% +% \xdef\fmtversion{\fmtversion+CWEB3.1} + +%D \macros{.}{} +%D +%D \CWEBquote preserve a way to get the dot accent (all +%D other accents will still work as usual). + +\letCWEBmacro\: = \. + +% \parskip = 0pt % no stretch between paragraphs +% \parindent = 1em % for paragraphs and for the first line of C text + +% \font\ninerm = cmr9 +% \let\mc = \ninerm % medium caps +% \font\eightrm = cmr8 +% \let\sc = \eightrm % small caps (NOT a caps-and-small-caps font) +% \let\mainfont = \tenrm +% \let\cmntfont = \tenrm +% \font\tenss = cmss10 +% \let\cmntfont = \tenss % alternative comment font +% \font\titlefont = cmr7 scaled \magstep4 % title on the contents page +% \font\ttitlefont = cmtt10 scaled \magstep2 % typewriter type in title +% \font\tentex = cmtex10 % TeX extended character set (used in strings) +% \fontextraspace\tentex = 0pt % no double space after sentences + +%D \macros{mc,sc,cmntfont,eightrm}{} +%D +%D The naming of the fonts in in line with those in \PLAIN\ +%D \TEX. Although \CONTEXT\ implements its own scheme, there is +%D still support for the \PLAIN\ ones. We keep the original +%D names, but change their meaning. That way the macros obey +%D switching to other sizes or styles. + +\defCWEBmacro\mc {\tx} +\defCWEBmacro\sc {\txx} +\defCWEBmacro\cmntfont {\ss} +\defCWEBmacro\eightrm {\tx} + +%D \macros{tentex,sevenrm,sevensy,teni}{} +%D +%D The next one uses a temporary solution. The \type{cmtex10} +%D font is not part of the default mechanism. We make use of +%D the \CONTEXT\ variables \type{\textface}, \type{\scriptface} +%D and \type{\scriptscriptface}, which hold the current +%D sizes. + +\defCWEBmacro\tentex% + {\font\next=cmtex10 at \textface + \fontextraspace\next\zeropoint + \next} + +\defCWEBmacro\sevenrm {\getvalue{\scriptface rmtf}} +\defCWEBmacro\sevensy {\getvalue{\scriptface mmsy}} +\defCWEBmacro\teni {\getvalue{\textface mmmi}} + +%D \macros{CWEBpt}{} +%D +%D The original macros are based on a 10~point bodyfont size. We +%D therefore have to specify dimension in points a bit +%D different. Specifications like .6pt are changed to +%D \type{.06} times \type{\bodyfontsize}. + +\defCWEBmacro\CWEBpt {\bodyfontsize} % still dutch + +%D \macros{CEE,UNIX,TEX,CPLUSPLUS}{} +%D +%D Next come some logo's. It does not make much sense to use +%D the \CONTEXT\ logo mechanism here, so we simply say: + +\defCWEBmacro \CEE/{{\mc C\spacefactor1000}} +\defCWEBmacro \UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} +\defCWEBmacro \TEX/{\TeX} +\defCWEBmacro\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} +\defCWEBmacro \Cee{\CEE/} % for backward compatibility + +%D \macros{\ }{} +%D +%D Now we come to the real work: the short commands that make +%D up the typography. +%D +%D \CWEBquote italic type for identifiers. + +\defCWEBmacro\\#1% + {\leavevmode\hbox{\it#1\/\kern.05em}} + +%D \macros{\string|}{} +%D +%D \CWEBquote one letter identifiers look better this way. + +\defCWEBmacro\|#1% + {\leavevmode\hbox{$#1$}} + +%D \macros{\string\&}{} +%D +%D \CWEBquote boldface type for reserved words. + +\defCWEBmacro\% + {\leavevmode + \hbox + {\def\_% + {\kern.04em + \vbox{\hrule width.3em height .06\CWEBpt}% .6pt}% + \kern.08em}% + \bf#1\/\kern.05em}} + +%D \macros{.}{} +%D +%D Here we use the previously saved period. This macro +%D takes care of special characters in strings. + +\defCWEBmacro\.#1% + {\leavevmode + \hbox + {\tentex % typewriter type for strings + \let\\=\BS % backslash in a string + \let\{=\LB % left brace in a string + \let\}=\RB % right brace in a string + \let\~=\TL % tilde in a string + \let\ =\SP % space in a string + \let\_=\UL % underline in a string + \let\&=\AM % ampersand in a string + \let\^=\CF % circumflex in a string + #1\kern.05em}} + +%D \macros{)}{} +%D +%D Some discretionary hack. + +\defCWEBmacro\)% + {\discretionary{\hbox{\tentex\BS}}{}{}} + +%D \macros{AT}{} +%D +%D \CWEBquote at sign for control text (not needed in versions +%D $>=$ 2.9). + +\defCWEBmacro\AT{@} + +%D \macros{ATL,postATL,NOATL}{} +%D +%D A two step macro that handles whatever. + +\defCWEBmacro\ATL% + {\par + \noindent + \bgroup + \catcode`\_=12 + \postATL} + +\defCWEBmacro\postATL#1 #2 % + {\bf letter \\{\uppercase{\char"#1}} tangles as \tentex "#2"% + \egroup + \par} + +\defCWEBmacro\noATL#1 #2 % + {} + +%D \macros{noatl}{} +%D +%D \CWEBquote suppress output from \type{@l}. + +\defCWEBmacro\noatl% + {\let\ATL=\noATL} + +% \defCWEBmacro\ATH% +% {\X\kern-.5em:Preprocessor definitions\X} + +%D \macros{PB} +%D +%D \CWEBquote hook for program brackets {\tttf\string|...\string|} +%D in TeX part or section name. + +\defCWEBmacro\PB% + {\relax} + +% \chardef\AM = `\& % ampersand character in a string +% \chardef\BS = `\\ % backslash in a string +% \chardef\LB = `\{ % left brace in a string +% \chardef\RB = `\} % right brace in a string +% \chardef\TL = `\~ % tilde in a string +% \chardef\UL = `\_ % underline character in a string +% \chardef\CF = `\^ % circumflex character in a string + +\defCWEBmacro\AM {\char`\&} % ampersand character in a string +\defCWEBmacro\BS {\char`\\} % backslash in a string +\defCWEBmacro\LB {\char`\{} % left brace in a string +\defCWEBmacro\RB {\char`\}} % right brace in a string +\defCWEBmacro\TL {\char`\~} % tilde in a string +\defCWEBmacro\UL {\char`\_} % underline character in a string +\defCWEBmacro\CF {\char`\^} % circumflex character in a string + +\defCWEBmacro\SP {{\tt\char`\ }} % (visible) space in a string + +% \newbox\PPbox \setbox\PPbox=\hbox +% {\kern.5pt\raise1pt\hbox{\sevenrm+\kern-1pt+}\kern.5pt} +% \newbox\MMbox \setbox\MMbox=\hbox +% {\kern.5pt\raise1pt\hbox{\sevensy\char0\kern-1pt\char0}\kern.5pt} +% \newbox\MGbox \setbox\MGbox=\hbox % symbol for -> +% {\kern-2pt\lower3pt\hbox{\teni\char'176}\kern1pt} +% \newbox\MODbox \setbox\MODbox=\hbox +% {\eightrm\%} +% +% \def\PP {\copy\PPbox} +% \def\MM {\copy\MMbox} +% \def\MG {\copy\MGbox} +% \def\MOD {\mathbin{\copy\MODbox}} + +\defCWEBmacro\PP% symbol for ++ + {\kern.05\CWEBpt + \raise.1\CWEBpt\hbox{\sevenrm+\kern-.1\CWEBpt+}% + \kern.05\CWEBpt} + +\defCWEBmacro\MM% + {\kern.05\CWEBpt + \raise.1\CWEBpt\hbox{\sevensy\char0\kern-.1\CWEBpt\char0}% + \kern.05\CWEBpt} + +\defCWEBmacro\MG% + {\kern-.2\CWEBpt + \lower.3\CWEBpt\hbox{\teni\char'176}% + \kern .1\CWEBpt} + +\defCWEBmacro\MRL#1% + {\mathrel{\let\K==#1}} + +% \def\MRL#1% +% {\KK#1} +% \def\KK#1#2% +% {\buildrel\;#1\over{#2}} + +\letCWEBmacro\GG = \gg +\letCWEBmacro\LL = \ll +\letCWEBmacro\NULL = \Lambda + +% \mathchardef\AND = "2026 % bitwise and; also \& (unary operator) + +\defCWEBmacro\AND% redefines itself (funny) + {\mathchardef\AND="2026 \AND} % bitwise and; also \& (unary operator) + +\letCWEBmacro\OR = \mid % bitwise or +\letCWEBmacro\XOR = \oplus % bitwise exclusive or +\defCWEBmacro\CM {{\sim}} % bitwise complement +\defCWEBmacro\MOD {\mathbin{\eightrm\%}} +\defCWEBmacro\DC {\kern.1em{::}\kern.1em} % symbol for :: +\defCWEBmacro\PA {\mathbin{.*}} % symbol for .* +\defCWEBmacro\MGA {\mathbin{\MG*}} % symbol for ->* +\defCWEBmacro\this {\&{this}} + +% \newbox \bak % backspace one em +% \newbox \bakk % backspace two ems +% +% \setbox\bak =\hbox to -1em{} +% \setbox\bakk=\hbox to -2em{} + +\newcount\CWEBind % current indentation in ems + +\defCWEBmacro\1% indent one more notch + {\global\advance\CWEBind by 1 + \hangindent\CWEBind em} + +\defCWEBmacro\2% indent one less notch + {\global\advance\CWEBind by -1 } + +\defCWEBmacro\3#1% optional break within a statement + {\hfil + \penalty#10 + \hfilneg} + +\defCWEBmacro\4% backspace one notch + {\hbox to -1em{}} + +\defCWEBmacro\5% optional break + {\hfil + \penalty-1 + \hfilneg + \kern2.5em + \hbox to -2em{}% + \ignorespaces} + +\defCWEBmacro\6% forced break + {\ifmmode + \else + \par + \hangindent\CWEBind em + \noindent + \kern\CWEBind em + \hbox to -2em{}% + \ignorespaces + \fi} + +\defCWEBmacro\7% forced break and a little extra space + {\Y + \6} + +\defCWEBmacro\8% no indentation + {\hskip-\CWEBind em + \hskip 2em} + +\defCWEBmacro\9#1% + {} + +\newcount\gdepth % depth of current major group, plus one +\newcount\secpagedepth +\secpagedepth=3 % page breaks will occur for depths -1, 0, and 1 + +% \newtoks\gtitle % title of current major group +% \newskip\intersecskip +% \intersecskip=12pt minus 3pt % space between sections + +% \let\yskip=\smallskip + +\defCWEBmacro\?% + {\mathrel?} + +% \def\note#1#2.% +% {\Y\noindent +% {\hangindent2em\baselineskip10pt\eightrm#1~#2.\par}} + +\defCWEBmacro\lapstar% + {\rlap{*}} + +% \def\stsec% +% {\rightskip=0pt % get out of C mode (cf. \B) +% \sfcode`;=1500 +% \pretolerance 200 +% \hyphenpenalty 50 +% \exhyphenpenalty 50 +% \noindent{\let\*=\lapstar\bf\secstar.\quad}} +% +% \let\startsection=\stsec + +\defCWEBmacro\defin#1% + {\global\advance\CWEBind by 2 \1\&{#1 } } % begin `define' or `format' + +% \def\A% xref for doubly defined section name +% {\note{See also section}} +% +% \def\As% xref for multiply defined section name +% {\note{See also sections}} + +\defCWEBmacro\B% + {\rightskip=0pt plus 100pt minus 10pt % go into C mode + \sfcode`;=3000 + \pretolerance 10000 + \hyphenpenalty 1000 % so strings can be broken (discretionary \ is inserted) + \exhyphenpenalty 10000 + \global\CWEBind=2 \1\ \unskip} + +\defCWEBmacro\C#1% + {\5\5\quad$/\ast\,${\cmntfont #1}$\,\ast/$} + +% \let\SHC\C % "// short comments" treated like "/* ordinary comments */" + +\defCWEBmacro\SHC#1% + {\5\5\quad$//\,${\cmntfont#1}} + +% \def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$} +% \def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}} + +\defCWEBmacro\D% macro definition + {\defin{\#define}} + +\letCWEBmacro\E=\equiv % equivalence sign + +% \def\ET% conjunction between two section numbers +% { and~} +% +% \def\ETs% conjunction between the last two of several section numbers +% {, and~} + +\defCWEBmacro\F% format definition + {\defin{format}} + +\letCWEBmacro\G = \ge % greater than or equal sign + +% \H is long Hungarian umlaut accent + +\letCWEBmacro\I = \ne % unequal sign + +\defCWEBmacro\J% TANGLE's join operation + {\.{@\&}} + +% \let\K== % assignment operator + +\letCWEBmacro\K = \leftarrow % "honest" alternative to standard assignment operator + +% \L is Polish letter suppressed-L + +% \outer\def\M#1% +% {\MN{#1}% +% \ifon +% \vfil +% \penalty-100 +% \vfilneg % beginning of section +% \vskip\intersecskip +% \startsection +% \ignorespaces} +% +% \outer\def\N#1#2#3.% +% {\gdepth=#1% +% \gtitle={#3}% +% \MN{#2}% beginning of starred section +% \ifon +% \ifnum#1<\secpagedepth +% \vfil +% \eject % force page break if depth is small +% \else +% \vfil +% \penalty-100 +% \vfilneg +% \vskip\intersecskip +% \fi +% \fi +% \message{*\secno}% progress report +% \edef\next% +% {\write\cont % write to contents file +% {\ZZ{#3}{#1}{\secno}{\noexpand\the\pageno}}}% +% \next % \ZZ{title}{depth}{sec}{page} +% \ifon +% \startsection +% {\bf#3.\quad}% +% \ignorespaces} +% +% \def\MN#1% +% {\par % common code for \M, \N +% {\xdef\secstar{#1}% +% \let\*=\empty +% \xdef\secno{#1}}% remove \* from section name +% \ifx\secno\secstar +% \onmaybe +% \else +% \ontrue +% \fi +% \mark{{{\tensy x}\secno}{\the\gdepth}{\the\gtitle}}} +% +% each \mark is {section reference or null}{depth plus 1}{group title} + +% \O is Scandinavian letter O-with-slash +% \P is paragraph sign + +\defCWEBmacro\Q {\note{This code is cited in section}} % xref for mention of a section +\defCWEBmacro\Qs {\note{This code is cited in sections}} % xref for mentions of a section + +% \S is section sign + +\defCWEBmacro\T#1% + {\leavevmode % octal, hex or decimal constant + \hbox + {$\def\?{\kern.2em}% + \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant + \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick) + \let\~=\oct + \let\^=\hex + {#1}$}} + +\defCWEBmacro\U {\note{This code is used in section}} % xref for use of a section +\defCWEBmacro\Us {\note{This code is used in sections}} % xref for uses of a section + +\letCWEBmacro\R = \lnot % logical not +\letCWEBmacro\V = \lor % logical or +\letCWEBmacro\W = \land % logical and + +% defined later on +% +% \def\X#1:#2\X% +% {\ifmmode +% \gdef\XX{\null$\null}% +% \else +% \gdef\XX{}% +% \fi % section name +% \XX$\langle\,${#2\eightrm\kern.5em#1}$\,\rangle$\XX} + +\unprotect + +\def\theCWEByskip {\blank[\v!small]} +\def\theCWEBvskip {\blank[\v!big]} + +\protect + +\defCWEBmacro\Y% + {\par + \yskip} + +\defCWEBmacro\yskip% + {\theCWEByskip} + +\letCWEBmacro\Z = \le +% \letCWEBmacro\ZZ = \let % now you can \write the control sequence \ZZ +\letCWEBmacro\* = * + +\defCWEBmacro\oct% + {\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}} + +\defCWEBmacro\hex% + {\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} + +\defCWEBmacro\vb#1% + {\leavevmode + \hbox + {\kern.2\CWEBpt + \vrule + \vtop + {\vbox + {\hrule + \hbox{\strut\kern.2\CWEBpt\.{#1}\kern.2\CWEBpt}} + \hrule}% + \vrule + \kern.2\CWEBpt}} % verbatim string + +\def\onmaybe% + {\let\ifon=\maybe} + +\let\maybe=\iftrue + +\newif\ifon + +% \newif\iftitle +% \newif\ifpagesaved +% +% \def\lheader% +% {\mainfont +% \the\pageno +% \eightrm +% \qquad +% \grouptitle +% \hfill +% \title +% \qquad +% \mainfont +% \topsecno} % top line on left-hand pages +% +% \def\rheader% +% {\mainfont +% \topsecno +% \eightrm +% \qquad +% \title +% \hfill +% \grouptitle +% \qquad +% \mainfont +% \the\pageno} % top line on right-hand pages +% +% \def\grouptitle +% {\let\i=I +% \let\j=J +% \uppercase\expandafter{\expandafter\takethree\topmark}} +% +% \def\topsecno% +% {\expandafter\takeone\topmark} +% +% \def\takeone #1#2#3{#1} +% \def\taketwo #1#2#3{#2} +% \def\takethree #1#2#3{#3} +% +% \def\nullsec% +% {\eightrm +% \kern-2em} % the \kern-2em cancels \qquad in headers +% +% \let\page=\pagebody % \def\page {\box255 } +% \raggedbottom % \normalbottom % faster, but loses plain TeX footnotes +% +% \def\normaloutput#1#2#3% +% {\shipout\vbox +% {\ifodd +% \pageno +% \hoffset=\pageshift +% \fi +% \vbox to \fullpageheight +% {\iftitle +% \global\titlefalse +% \else +% \hbox to \pagewidth +% {\vbox to 10pt{}% +% \ifodd\pageno #3\else#2\fi} +% \fi +% \vfill#1}} % parameter #1 is the page itself +% \global\advance\pageno by 1} +% +% \gtitle={\.{CWEB} output} % this running head is reset by starred sections +% +% \mark{\noexpand\nullsec0{\the\gtitle}} +% +% \def\title% +% {\expandafter\uppercase\expandafter{\jobname}} +% +% \def\topofcontents% +% {\centerline{\titlefont\title} +% \vskip.7in +% \vfill} % this material will start the table of contents page + +\def\botofcontents% + {\vfill + \centerline{\covernote}} % this material will end the table of contents page + +\def\covernote% + {} + +% some leftover + +\defCWEBmacro\contentspagenumber{0} % default page number for table of contents + +% \newdimen\pagewidth \pagewidth = 158mm % the width of each page +% \newdimen\pageheight \pageheight = 223mm % the height of each page +% \newdimen\fullpageheight \fullpageheight = 240mm % page height including headlines +% \newdimen\pageshift \pageshift = 0in % shift righthand pages wrt lefthand ones +% +% \def\magnify#1% +% {\mag=#1 +% \pagewidth=6.5truein +% \pageheight=8.7truein +% \fullpageheight=9truein +% \setpage} +% +% \def\setpage% +% {\hsize\pagewidth +% \vsize\pageheight} % use after changing page size +% +% \def\contentsfile {\jobname.toc} % file that gets table of contents info +% \def\readcontents {\input \contentsfile} +% \def\readindex {\input \jobname.idx} +% \def\readsections {\input \jobname.scn} +% +% \newwrite\cont +% \output{\setbox0=\page % the first page is garbage +% \openout\cont=\contentsfile +% \write\cont{\catcode `\noexpand\@=11\relax} % \makeatletter +% \global\output{\normaloutput\page\lheader\rheader}} +% \setpage +% \vbox to \vsize{} % the first \topmark won't be null + +\defCWEBdummy\magnify#1% magnify the page + {} + +\defCWEBmacro\ch% + {\note{The following sections were changed by the change file:} + \let\*=\relax} + +% \newbox\sbox % saved box preceding the index +% \newbox\lbox % lefthand column in the index +% +% \def\inx% +% {\par\vskip6pt plus 1fil % we are beginning the index +% \def\page{\box255 } +% \normalbottom +% \write\cont{} % ensure that the contents file isn't empty +% \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother +% \closeout\cont % the contents information has been fully gathered +% \output +% {\ifpagesaved +% \normaloutput{\box\sbox}\lheader\rheader +% \fi +% \global\setbox\sbox=\page +% \global\pagesavedtrue} +% \pagesavedfalse +% \eject % eject the page-so-far and predecessors +% \setbox\sbox\vbox{\unvbox\sbox} % take it out of its box +% \vsize=\pageheight +% \advance\vsize by -\ht\sbox % the remaining height +% \hsize=.5\pagewidth +% \advance\hsize by -10pt +% % column width for the index (20pt between cols) +% \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines +% \def\lr{L} % this tells whether the left or right column is next +% \output +% {\if L\lr +% \global\setbox\lbox=\page +% \gdef\lr{R} +% \else +% \normaloutput +% {\vbox to\pageheight +% {\box\sbox +% \vss +% \hbox to\pagewidth{\box\lbox\hfil\page}}} +% \lheader +% \rheader +% \global\vsize\pageheight\gdef\lr{L}\global\pagesavedfalse\fi} +% \message{Index:} +% \parskip 0pt plus .5pt +% \outer\def\I##1, {\par\hangindent2em\noindent##1:\kern1em} % index entry +% \def\[##1]{$\underline{##1}$} % underlined index item +% \rm +% \rightskip0pt plus 2.5em +% \tolerance 10000 +% \let\*=\lapstar +% \hyphenpenalty 10000 +% \parindent0pt +% \readindex} +% +% \def\fin% +% {\par\vfill\eject % this is done when we are ending the index +% \ifpagesaved\null\vfill\eject\fi % output a null index column +% \if L\lr\else\null\vfill\eject\fi % finish the current page +% \parfillskip 0pt plus 1fil +% \def\grouptitle{NAMES OF THE SECTIONS} +% \let\topsecno=\nullsec +% \message{Section names:} +% \output={\normaloutput\page\lheader\rheader} +% \setpage +% \def\note##1##2.{\quad{\eightrm##1~##2.}} +% \def\Q{\note{Cited in section}} % crossref for mention of a section +% \def\Qs{\note{Cited in sections}} % crossref for mentions of a section +% \def\U{\note{Used in section}} % crossref for use of a section +% \def\Us{\note{Used in sections}} % crossref for uses of a section +% \def\I{\par\hangindent 2em}\let\*=* +% \readsections} +% +% \def\con% +% {\par\vfill\eject % finish the section names +% %\ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers +% \rightskip = 0pt +% \hyphenpenalty = 50 +% \tolerance = 200 +% \setpage +% \output={\normaloutput\page\lheader\rheader} +% \titletrue % prepare to output the table of contents +% \pageno=\contentspagenumber +% \def\grouptitle{TABLE OF CONTENTS} +% \message{Table of contents:} +% \topofcontents +% \line{\hfil Section\hbox to3em{\hss Page}} +% \let\ZZ=\contentsline +% \readcontents\relax % read the contents info +% \botofcontents +% \end} % print the contents page(s) and terminate +% +% \def\contentsline#1#2#3#4% +% {\ifnum#2=0 +% \smallbreak +% \fi +% \line{\consetup{#2}#1 +% \rm\leaders\hbox to .5em{.\hfil}\hfil\ #3\hbox to3em{\hss#4}}} +% + +\defCWEBmacro\consetup#1% + {\ifcase#1 \bf % depth -1 (@**) + \or % depth 0 (@*) + \or \hskip2em % depth 1 (@*1) + \or \hskip4em % depth 2 (@*2) + \or \hskip6em % depth 3 (@*3) + \or \hskip8em % depth 4 (@*4) + \or \hskip10em % depth 5 (@*5) + \else \hskip12em + \fi} % depth 6 or more + +\defCWEBdummy \inx {} % index +\defCWEBdummy \fin {} % finish +\defCWEBdummy \con {} % table of contents and finish + +\defCWEBdummy \noinx {} % no indexes or table of contents +\defCWEBdummy \nosecs {} % no index of section names or table of contents +\defCWEBdummy \nocon {} % no table of contents + +\defCWEBmacro\,% + {\relax + \ifmmode + \mskip\thinmuskip + \else + \thinspace + \fi} + +% \def\noinx% +% {\let\inx=\end} +% +% \def\nosecs% +% {\let\FIN=\fin +% \def\fin% +% {\let\parfillskip=\end +% \FIN}} +% +% \def\nocon% +% {\let\con=\end} +% +% \newcount\twodigits +% +% \def\hours% +% {\twodigits=\time +% \divide\twodigits by 60 +% \printtwodigits +% \multiply\twodigits by -60 +% \advance\twodigits by \time +% :\printtwodigits} +% +% \def\gobbleone1{} +% +% \def\printtwodigits% +% {\advance\twodigits by 100 +% \expandafter\gobbleone\number\twodigits +% \advance\twodigits by -100 } +% +% \def\today% +% {\ifcase\month +% \or January\or February\or March\or April\or May\or June% +% \or July\or August\or September\or October\or November\or December% +% \fi +% \space +% \number\day, \number\year} +% +% \def\datethis% +% {\def\startsection% +% {\leftline{\sc\today\ at \hours} +% \bigskip +% \let\startsection=\stsec +% \stsec}} +% +% \def\datecontentspage% +% {\def\topofcontents% +% {\leftline{\sc\today\ at \hours} +% \bigskip +% \centerline{\titlefont\title} +% \vfill}} + +\defCWEBdummy\datethis {} % say `\datethis' in limbo, to get your listing timestamped before section 1 +\defCWEBdummy\datecontentspage {} % timestamps the contents page + +\defCWEBmacro\TeX% + {{\ifmmode\it\fi + \leavevmode + \hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} + +% alternative implementation + +\newif\ifCWEBnotes + +\defCWEBmacro\Q {\CWEBnotesfalse \note{This code is cited in section}} % xref for mention of a section +\defCWEBmacro\Qs {\CWEBnotestrue \note{This code is cited in sections}} % xref for mentions of a section + +\defCWEBmacro\U {\CWEBnotesfalse \note{This code is used in section}} % xref for use of a section +\defCWEBmacro\Us {\CWEBnotestrue \note{This code is used in sections}} % xref for uses of a section + +\defCWEBmacro\A {\CWEBnotesfalse \note{See also section}} % xref for doubly defined section name +\defCWEBmacro\As {\CWEBnotestrue \note{See also sections}} % xref for multiply defined section name + +\defCWEBmacro\ET% conjunction between two section numbers + { and~} + +\defCWEBmacro\ETs% conjunction between the last two of several section numbers + {, and~} + +%\def\processCWEBsectionnumbers[#1]% +% {\bgroup +% \def\CWEBcomma% +% {\def\CWEBcomma{, }}% +% \def\docommand##1% +% {\bgroup +% \def\[####1]{####1}% +% \xdef\CWEBreference{##1}% +% \egroup +% \CWEBcomma{\naar{\donottest{##1}}[web:\CWEBreference]}}% +% \processcommalist[{#1}]\docommand +% \egroup} + +% \def\processCWEBsectionnumbers[#1]% +% {\bgroup +% \def\CWEBcomma% +% {\def\CWEBcomma{, }}% +% \def\docommand##1% +% {\bgroup +% \def\(####1){####1}% +% \xdef\CWEBreference{##1}% +% \egroup +% \CWEBcomma +% {\localcolortrue\naar{\donottest{##1}}[web:\CWEBreference]}}% +% \bgroup +% \def\[##1]{\(##1)}\let\(=\relax\xdef\CWEBreferences{#1}% +% \egroup +% \unexpanded\def\(##1){\[##1]}% +% \processcommacommand[\CWEBreferences]\docommand +% \egroup} + +\def\processCWEBsectionnumbers[#1]% + {\bgroup + \def\CWEBcomma% + {\def\CWEBcomma{, }}% + \def\docommand##1% + {\bgroup + \def\[####1]{####1}% + \xdef\CWEBreference{##1}% + \egroup + \CWEBcomma{\localcolortrue\goto{\donottest{##1}}[web:\CWEBreference]}}% + \processlist{(}{)}{,}\docommand(#1) + \egroup} + +\def\processCWEBsectionnotes% + {\catcode`\s=12 + \doprocessCWEBsectionnotes} + +\def\doprocessCWEBsectionnotes#1.% + {\ifCWEBnotes + \def\next##1\ET##2##3.% + {\processCWEBsectionnumbers[##1]% + \if##2s% + {, and~\goto{##3}[web:##3]}% + \else + { and~\goto{##2##3}[web:##2##3]}% + \fi}% + \next#1.% + \else + \goto{#1}[web:#1]% + \fi + \afterCWEBnote % inside group! + \egroup} + +\let\afterCWEBnote=\relax + +\defCWEBmacro\note#1% + {\bgroup + \Y\noindent + \def\afterCWEBnote{\par}% + \hangindent2em + %\baselineskip10pt + \eightrm#1~\processCWEBsectionnotes} + +\def\oldCWEBmacroX#1:#2\X% original + {\ifmmode + \gdef\XX{\null$\null}% + \else + \gdef\XX{}% + \fi % section name + \XX$\langle\,${#2\eightrm\kern.5em#1}$\,\rangle$\XX} + +\defCWEBmacro\ATH% + {\oldCWEBmacroX\kern-.5em:Preprocessor definitions\X} + +\def\newCWEBmacroX#1:#2\X% original + {\ifmmode + \gdef\XX{\null$\null}% + \else + \gdef\XX{}% + \fi % section name + \XX$\langle\,$% + {#2\eightrm\kern.5em\processCWEBsectionnumbers[{#1}]}% + $\,\rangle$\XX} + +\defCWEBmacro\X#1:#2\X% + {\newCWEBmacroX#1:#2\X} + +\definemarking[CWEBfilename] +\definemarking[CWEBsectiontitle] +\definemarking[CWEBsectionnumber] +\definemarking[CWEBsectiondepth] + +\defCWEBmacro\M#1% + {\MN{#1}% + \ifon + \vfil + \penalty-100 + \vfilneg % beginning of section + \theCWEBvskip + \startsection + \pagereference[web:#1]% + \expanded{\marking[CWEBsectionnumber]{\secno}}% + \expanded{\marking[CWEBsectiondepth]{\the\gdepth}}% + \ignorespaces} + +\defCWEBmacro\N#1#2#3.% + {\gdepth=#1% + \MN{#2}% beginning of starred section + \ifon + \ifnum#1<\secpagedepth + \vfil + \eject % force page break if depth is small + \else + \vfil + \penalty-100 + \vfilneg + \theCWEBvskip + \fi + \fi + \message{*\secno}% progress report + \makesectionformat % context + \defconvertedargument\ascii{#3}% + \edef\next% + {\write\CWEBcont % write to contents file + {\string\ZZ{\ascii}{#1}{\secno}% + {\sectionformat::\noexpand\userfolio}{\noexpand\realfolio}}}% + \next % \ZZ{title}{depth}{sec}{page} + \ifon + \startsection + \pagereference[web:#2]% + \marking[CWEBsectiontitle] {#3}% + \expanded{\marking[CWEBsectionnumber]{\secno}}% + \expanded{\marking[CWEBsectiondepth]{\the\gdepth}}% + {\bf#3.\quad}% + \ignorespaces} + +\defCWEBmacro\MN#1% + {\par % common code for \M, \N + {\xdef\secstar{#1}% + \let\*=\empty + \xdef\secno{#1}}% remove \* from section name + \ifx\secno\secstar + \onmaybe + \else + \ontrue + \fi} + +\newif\iflinktoCWEBfile + +\def\setCWEBlinkfile#1% + {\linktoCWEBfiletrue + \def\otherCWEBfile{#1}} + +\unprotect + +\def\gotoCWEBsection#1[#2]% + {\iflinktoCWEBfile + \bgroup + \setupinteraction[\c!color=,\c!style=]% + \let\savedreferenceprefix=\referenceprefix + \localcolortrue + \goto{#1}[\otherCWEBfile::\savedreferenceprefix web:#2]% + \egroup + \else + #1% + \fi} + +\protect + +\defCWEBmacro\startsection% + {\rightskip=0pt % get out of C mode (cf. \B) + \sfcode`;=1500 + \pretolerance 200 + \hyphenpenalty 50 + \exhyphenpenalty 50 + \noindent + \bgroup + \let\*=\lapstar + \gotoCWEBsection{\bf\secstar.\quad}[\secno]% + \egroup} + +\def\ignoreCWEBinput% + {\let\normalinput=\input + \def\input ##1 % + {\let\input=\normalinput}} + +\def\loadCWEBmacros#1% + {\let\oldN=\N + \def\N{\bgroup\setbox0=\vbox\bgroup\endinput}% + \ignoreCWEBinput + \ReadFile{#1.tex}% + \egroup\egroup + \let\N=\oldN} + +\def\resetCWEBcontext% + {\catcode`\|=12 % used in context discretionaries + \everypar{} % used for context indentation and floats + \parskip=0pt % no stretch between cweb paragraphs + \parindent=1em} % is related to cweb backspace etc + +\newwrite\CWEBcont + +\def\processCWEBsource #1 % + {\bgroup + \resetCWEBcontext + \activateCWEB + \ignoreCWEBinput + \immediate\openout\CWEBcont=#1.toc + \write\CWEBcont{\noexpand\unprotect} + \message{Source:} + \marking[CWEBfilename]{#1} + \ReadFile{#1.tex}\relax + \write\CWEBcont{\noexpand\protect} + \closeout\CWEBcont + \par + \egroup} + +\def\resetCWEBindexentry% + {\xdef\currentCWEBindexentry{}} + +\def\showCWEBindexentry#1% can be redefined + {\theCWEBvskip + \vskip3\lineheight + \goodbreak + \vskip-3\lineheight + {\pagereference[web:#1]\bf#1}% + \theCWEBvskip} + +\def\checkCWEBindexentry#1% + {\bgroup + \def\\##1{##1}% a dummy that also removes the {} + \def\|##1{##1}% another dummy + \def\.##1{*##1}% and another (the typewriter one) + \def\&##1{##1}% and a last one + \def\9##1{##1}% hold this one + \catcode`*=11 + \expandafter\def\expandafter\entry\expandafter{#1}% + \defconvertedcommand\ascii\entry + \expanded{\FINDFIRSTCHARACTER{\ascii}}% + \doifnot{\currentCWEBindexentry}{\firstcharacter} + {\doifnot{\firstcharacter}{*} % signal for \firstbunch + {\global\let\currentCWEBindexentry=\firstcharacter + \showCWEBindexentry{\currentCWEBindexentry}}}% + \egroup} + +\def\theCWEBbeforeindex {\startcolumns} +\def\theCWEBafterindex {\stopcolumns} + +\def\processCWEBindex #1 % + {\bgroup + \resetCWEBcontext + \activateCWEB + \resetCWEBindexentry + \def\I##1, % + {\par + \checkCWEBindexentry{##1}% + \hangindent2em + \noindent##1:\kern1em% + \def\next####1.% + {\processCWEBsectionnumbers[{####1}]}% + \next}% + \def\[##1]% + {$\underline{##1}$}% + \let\*=\lapstar + \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines +% \parskip 0pt plus .5pt + \rightskip0pt plus 2.5em + \tolerance 10000 + \hyphenpenalty 10000 + \parindent0pt + \message{Index:} + \marking[CWEBfilename] {#1} + \marking[CWEBsectiontitle] {index} + \marking[CWEBsectionnumber]{} + \marking[CWEBsectiondepth]{} + \loadCWEBmacros{#1} + \theCWEBbeforeindex + \ReadFile{#1.idx}\relax + \theCWEBafterindex + \par + \egroup} + +\def\processCWEBsections #1 % + {\bgroup + \resetCWEBcontext + \activateCWEB + \loadCWEBmacros{#1} + \parfillskip = 0pt plus 1fil + \parindent = 0pt + \let\topsecno=\nullsec + \def\note##1% + {\quad + \bgroup + \eightrm + ##1~\processCWEBsectionnotes} + \def\Q {\CWEBnotesfalse \note{Cited in section}} % crossref for mention of a section + \def\Qs{\CWEBnotestrue \note{Cited in sections}} % crossref for mentions of a section + \def\U {\CWEBnotesfalse \note{Used in section}} % crossref for use of a section + \def\Us{\CWEBnotestrue \note{Used in sections}} % crossref for uses of a section + \def\I {\par\hangindent 2em}% + \let\*=* + \message{Section names:} + \marking[CWEBfilename] {#1} + \marking[CWEBsectiontitle] {sections} + \marking[CWEBsectionnumber]{} + \marking[CWEBsectiondepth]{} + \loadCWEBmacros{#1} + \ReadFile{#1.scn}\relax + \par + \botofcontents + \par + \egroup} + +\def\processCWEBcontents #1 % + {\bgroup + \resetCWEBcontext + \activateCWEB + \loadCWEBmacros{#1} + \rightskip = 0pt + \hyphenpenalty = 50 + \tolerance = 200 + \parindent = 0pt + \line{\hfil Section\hbox to3em{\hss Page}} + \let\ZZ=\contentsline + \message{Table of contents:} + \marking[CWEBfilename] {#1} + \marking[CWEBsectiontitle] {table of contents} + \marking[CWEBsectionnumber]{} + \marking[CWEBsectiondepth]{} + \loadCWEBmacros{#1} + \ReadFile{#1.toc}\relax + \par + \egroup} + +\defCWEBmacro\contentsline#1#2#3#4#5% + {\ifnum#2=0 + \smallbreak + \fi + \line{\consetup{#2}#1 + \rm + \leaders\hbox to .5em{.\hfil}\hfil\ + {\localcolortrue\goto{#3}[web:#3]}% below: \gotorealpage ? should be changed + \hbox to3em{\localcolortrue\hss\gotorealpage{}{}{#5}{\translatednumber[#4]\presetgoto}}}} + +%D A last hack, needed because a file can overload of the +%D above. (Some day: a check like \type{\ifx#1\CWEBdefined}.) + +\def\outer#1#2% + {\ifx#2\undefined + \expandafter#1\expandafter#2% + \else + \expandafter#1\expandafter\ThrowAway + \fi} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-database.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-database.mkii new file mode 100644 index 00000000000..abb67986e02 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-database.mkii @@ -0,0 +1,420 @@ +%D \module +%D [ file=m-database, +%D version=2006.04.23, +%D title=\CONTEXT\ Modules, +%D subtitle=Database Thingies, +%D author=Hans Hagen\& Taco Hoekwater, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] + +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +% % % to be added to mult-* files +% +% % % todo: \dontcollectseparatedlist via k/v + +\definesystemvariable{ls} + +\def\c!first {first} +\def\c!last {last} +\def\c!quotechar {quotechar} + +\let\@NX\noexpand + +%D {processquotedlist} +%D +%D An even more general list processing macro is the +%D following one: +%D +%D \starttyping +%D \processquotedlist{beginsym}{endsym}{separator}\docommand list +%D \stoptyping +%D +%D This one supports arbitrary open and close symbols as well +%D as user defined separators. +%D +%D \starttyping +%D \processquotedlist(){,}{"}\docommand(a=>b=>c=>d) +%D \stoptyping + +\def\processquotedlist#1#2#3#4#5% + {\def\csvquotechar{#4}% + \edef\doconvertcsvquoteditem#4##1#4##2% + {\@NX\ifx##2#3% + \let\@NX\next\@NX\doconvertcsvlist + \def\@NX\arg{#3}% + \edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\else + \let\@NX\next\@NX\redoconvertcsvquoteditem + \def\@NX\arg{##1\@NX\csvquotechar}% + \@NX\fi + \@NX\expandafter\@NX\next\@NX\arg}% + \edef\redoconvertcsvquoteditem##1#4##2% + {\@NX\ifx##2#3% + \let\@NX\next\@NX\doconvertcsvlist + \def\@NX\arg{#3}% + \edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\else + \let\@NX\next\@NX\redoconvertcsvquoteditem + \def\@NX\arg{##1\@NX\csvquotechar}% + \@NX\fi + \@NX\expandafter\@NX\next\@NX\arg}% + \edef\doconvertcsvitem##1#3% + {\edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\doconvertcsvlist#3}% + \edef\doconvertcsvlist#3##1% + {\@NX\ifx##1\@NX#2% + \let\@NX\next \@NX\gobbleoneargument + \@NX\else\@NX\ifx##1#4% + \let\@NX\next \@NX\doconvertcsvquoteditem + \@NX\else + \let\@NX\next \@NX\doconvertcsvitem + \@NX\fi\@NX\fi \@NX\next##1}% + \doconvertcsvitem} + +\gdef\doprocessseparatedquoteditem#1% + {\appendseparatedlistparameter\c!left% + \appendseparatedlistcontent{#1}% + \appendseparatedlistparameter\c!right} + +% a version more robust with regard to {a a} b c d situations: + +\edef\detokenizedrelax{\detokenize{\relax}} + +\edef\processseplistseparator{\detokenize{,}}% + +\def\dodefineprocessseplist#1#2% separator \docommand + {\edef\processseplistseparator{\detokenize{#1}}% + \def\dodoprocessseplist##1##2#1% + {\edef\!!stringa{\detokenize{##1}}% + \ifx\detokenizedrelax\!!stringa + \expandafter\nodoprocessseplist + % \else\ifx\!!stringa#1% + \else\ifx\!!stringa\processseplistseparator + #2{}% + #2{##2}% + \expandafter\expandafter\expandafter\dodoprocessseplist + \else + #2{##1##2}% + \expandafter\expandafter\expandafter\dodoprocessseplist + \fi\fi}% + \def\doprocessseplist##1\relax + {\dodoprocessseplist##1#1\relax#1\relax\relax\end}} + +\def\nodoprocessseplist#1\end + {} + +\long\def\processseplist#1#2#3\relax raw version + {\dodefineprocessseplist{#1}{#2}% + \dodoprocessseplist#3#1\relax#1\relax\relax\end} + +% \dodefineprocessseplist{,}\test +% \dodoprocessseplist{,}a,b,c\relax,\relax\relax\end +% \doprocessseplista,b,c\relax + +% \def\test#1{[#1]} +% \startlines +% \processseplist{,}\test ,2,,\relax +% \processseplist{,}\test ,,,44\relax +% \processseplist{,}\test ,,33,44\relax +% \processseplist{,}\test 11,,33,44\relax +% \processseplist{,}\test 1,2,3,4\relax +% \stoplines + +\newtoks\separatedlistdata + +\def\appendseparatedlistparameter#1% + {\@EAEAEA\appendtoks\csname\??ls\currentseparatedlist#1\endcsname\to\separatedlistdata} + +\def\appendseparatedlistcontent#1% + {\appendtoks#1\to\separatedlistdata} + +\def\flushseparatedlistdata + {\the\separatedlistdata + \separatedlistdata\emptytoks} + +\def\initializeseparatedlistdata + {\separatedlistdata{\egroup}} + +\def\dontcollectseparatedlist + {\def\dodoprocessseparatedfileline + {\the\separatedlistdata + \separatedlistdata\emptytoks + \doprocessseparatedfileline}% + \def\dodoprocessseparatedline + {\the\separatedlistdata + \separatedlistdata\emptytoks + \doprocessseparatedline}% + \let\flushseparatedlistdata\egroup + \let\initializeseparatedlistdata\donothing} + +\chardef\separatedlistmode\zerocount + +\def\setcurrentlistseparator + {\edef\currentlistseparator + {\executeifdefined + {\??ls::\csname\??ls\currentseparatedlist\c!separator\endcsname}% + {\csname\??ls\currentseparatedlist\c!separator\endcsname}}% + \doifvalue{\??ls\currentseparatedlist\c!separator}{tab} + {\catcode`\^^I=12\relax}% + \ifx\currentlistseparator\empty\def\currentlistseparator{,}\fi} + +\bgroup \catcode`\^^I=12 + \setgvalue{\??ls::tab}{ } + \setgvalue{\??ls::space}{ } + \setgvalue{\??ls::comma}{,} +\egroup + +\def\doprocessseparatedfileline + {\ifeof\scratchread + \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi + \immediate\closein\scratchread + \expandafter\flushseparatedlistdata + \else\ifx\line\empty + % skip, can be comment + \read\scratchread to\line + \@EA\dodoprocessseparatedfileline + \else + \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% + \ifx\currentlistquotechar\empty% + \expandafter\doprocessseplist\line\relax + \else + \expanded{\processquotedlist{}{\noexpand\end}% + {\currentlistseparator}{\currentlistquotechar}% + \noexpand\doprocessseparatedquoteditem \line\currentlistseparator\noexpand\end}% + \fi + \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi + \read\scratchread to\line + \@EAEAEA\dodoprocessseparatedfileline + \fi\fi} + +\def\dodoprocessseparatedfileline + {\doprocessseparatedfileline} + +\def\doprocessseparatedfile[#1][#2]% + {\bgroup + \edef\currentseparatedlist{#1}% + \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% + \setcurrentlistseparator + \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% + \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem + \initializeseparatedlistdata + \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% + \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi + \endlinechar\minusone + \ignorelines + \catcode`\#\@@comment + \immediate\openin\scratchread=#2\relax % todo: \doopenin + \read\scratchread to\line + \doprocessseparatedfileline} + +\def\dostartseparatedlist#1[#2]% + {\bgroup + \edef\currentseparatedlist{#2}% + \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% + \obeylines + \let#1\relax + \def\separateslistend{#1}% + \setcurrentlistseparator + \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% + \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem + \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% + \initializeseparatedlistdata + \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi + \dodostartseparatedlist} + +\def\redoprocessseparatedline#1% + {\def\!!stringa{#1}% + \ifx\!!stringa\separateslistend + \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi + \expandafter\flushseparatedlistdata + \else% + \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% + \ifx\currentlistquotechar\empty% + \doprocessseplist#1\relax + \else% + \defconvertedargument\csvdata{#1}% + \expanded{\processquotedlist{}{\noexpand\end}% + {\currentlistseparator}{\currentlistquotechar}% + \noexpand\doprocessseparatedquoteditem \csvdata\currentlistseparator\noexpand\end}% + \fi + \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi + \expandafter\dodoprocessseparatedline + \fi} + +\def\doprocessseparatedline + {\doifnextbgroupelse\xdoprocessseparatedline\ydoprocessseparatedline} + +\def\dodoprocessseparatedline + {\doprocessseparatedline} + +\def\doprocessseparateditem#1% + {\ifcase\separatedlistmode + \appendseparatedlistparameter\c!left + \appendseparatedlistcontent{#1}% + \appendseparatedlistparameter\c!right + \else + \appendseparatedlistcontent{{#1}}% + \fi} + + +\bgroup \obeylines + + \gdef\dodostartseparatedlist#1 + {\doprocessseparatedline} + + \gdef\xdoprocessseparatedline#1#2 + {\redoprocessseparatedline{{{#1}}#2}} + + \gdef\ydoprocessseparatedline#1 + {\redoprocessseparatedline{#1}} + +\egroup + +\startsetups CSV:unix + \catcode`\#=\@@comment +\stopsetups + +\def\defineseparatedlist + {\dodoubleempty\dodefineseparatedlist} + +\def\dodefineseparatedlist[#1][#2]% + {\setvalue{\e!start#1}{\expandafter\dostartseparatedlist\csname\e!stop#1\endcsname[#1]}% + \getparameters + [\??ls#1] + [\c!separator=, + \c!quotechar=, + \c!first=, + \c!left=, + \c!before=, + \c!right=, + \c!last=, + \c!after=, +% \c!command=, + #2]} + +\def\setupseparatedlist + {\dodoubleempty\dosetupseparatedlist} + +\def\dosetupseparatedlist[#1]% [#2] + {\getparameter[\??ls#1]} % [#2] + +\def\startseparatedlist[#1]% + {\dostartseparatedlist\stopseparatedlist[#1]} + +\def\processseparatedfile + {\dodoubleargument\doprocessseparatedfile} + +\protect \doifnotmode{demo}{\endinput} + +\defineseparatedlist + [CSV] + [separator={,}, + first=\bTR,last=\eTR, + left=\bTD,right=\eTD, + before=\bTABLE,after=\eTABLE] + +\startseparatedlist[CSV] +a,b,c +d,e,f +\stopseparatedlist + +\startCSV +a,b,c +d,e,f +\stopCSV + +\defineseparatedlist + [CSV] + [separator={,}, + quotechar={"}, + first=\NC,last=\NR, + left=,right=\NC, + before={\starttabulate[|l|l|l|]},after=\stoptabulate] + +\startCSV +a,b,"c,d" +d,"""",f +\stopCSV + +\defineseparatedlist + [CSV] + [separator={ }, + first=\NC,last=\NR, + left=,right=\NC, + before={\starttabulate[|l|l|l|]},after=\stoptabulate] + +\startCSV +a b c +d e f +\stopCSV + +\defineseparatedlist + [CSV] + [setups=unix, + first=\NC,last=\NR, + left=,right=\NC, + before={\starttabulate[|l|l|l|]},after=\stoptabulate] + +% \startsetups CSV:unix +% \catcode`\#=\@@comment +% \stopsetups + +% %1,2,3 +% 1,2,3 +% # 4,5,6 +% 4,5,6 + +\processseparatedfile[CSV][test.dat] + +\defineseparatedlist + [CSVX] + [command=\Whatever, + separator={,}, + first=\bTR,last=\eTR, + left=\bTD,right=\eTD, + before=\bTABLE,after=\eTABLE] + +\def\Whatever#1#2#3{[#1][#2][#3]\endgraf} + +\startseparatedlist[CSVX] +a,b,c +d,e,f +\stopseparatedlist + +\defineseparatedlist[CSV] + [separator=comma, + before=\bTABLE, after=\eTABLE, + first=\bTR, last=\eTR, + left=\bTD, right=\eTD] + +\startCSV +a,b,c,Ä +d,e,f,Å¡ +\stopCSV + +\enableregime[utf] + +\defineseparatedlist[X][separator=X,left=(,right=),first=\endgraf,last=\endgraf] +\defineseparatedlist[Y][separator=Y,left=(,right=),first=\endgraf,last=\endgraf] + +\startX +aXb +Xc +ÄXÅ¡ +\stopX + +\startY +aYb +Yc +ÄYÅ¡ +\stopY + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-dratex.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-dratex.mkii new file mode 100644 index 00000000000..2b5f0be2a6f --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-dratex.mkii @@ -0,0 +1,21 @@ +%D \module +%D [ file=m-dratex, +%D version=2005.11.25, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\DRATEX\ Loading Macros, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details + +\readfile{DraTex.sty}{}{\readfile{dratex.sty}{}{\endinput}} + +\letvalue{:NewCount}\newcount +\letvalue{:NewDimen}\newdimen + +\readfile{AlDraTex.sty}{}{\readfile{aldratex.sty}{}{\endinput}} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-edtsnc.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-edtsnc.mkii new file mode 100644 index 00000000000..0f66893e833 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-edtsnc.mkii @@ -0,0 +1,207 @@ +%D \module +%D [ file=m-editsnc, +%D version=2003.12.23, +%D title=\CONTEXT\ Modules, +%D subtitle=Editor Synchronization, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.edit for +%C details. + +% \enablemode[demo] + +% This file is a variation of the file m-pdfsync. This time we do it +% in a more abstract way and prepare ourselves for support in dvi +% output. + +% \enableeditsync +% \disableeditsync +% \editsync +% \editsynctext {string} +% \editsyncnode {char} +% \editsynctracemode [chardef: 0-4] + +\writestatus{editsync}{loading and enabling editor synchronization support} + +\unprotect % not really needed + +\ifx\pdfoutput\undefined + \donefalse +\else\ifcase\pdfoutput + \donefalse +\else\ifx\pdfsavepos\undefined + \donefalse +\else + \donetrue +\fi\fi\fi + +\chardef \editsyncstate \zerocount +\chardef \editsynctracemode \zerocount +\newcount \editsynccounter +\newwrite \editsyncwrite + +\def\enableeditsync {\chardef\editsyncstate\plusone} +\def\disableeditsync{\chardef\editsyncstate\zerocount} + +% The following definitions can go into the special drivers, but +% for the moment we do it this way. + +\ifdone + + \def\dostarteditsync + {\immediate\openout\editsyncwrite\jobname.pdfsync + \immediate\write\editsyncwrite{\jobname}% + \immediate\write\editsyncwrite{version 0}} + + \def\dostopeditsync + {\closeout\editsyncwrite} + + \def\doeditsyncregisterpage#1{\immediate\write\editsyncwrite{s\space\number#1}} + \def\doeditsyncopenfile #1{\immediate\write\editsyncwrite{(\space#1}} + \def\doeditsyncclosefile #1{\immediate\write\editsyncwrite{)}} + + \def\doregistereditsyncnode#1#2#3% tag counter linenumber + {\pdfsavepos + \immediate\write\editsyncwrite{l\space\number#2\space\number#3}% + \expanded{\write\editsyncwrite{p\ifnum#1=\plusone*\fi\space\number#2\space\noexpand\the\pdflastxpos\space\noexpand\the\pdflastypos}}} + +\else + + \let\dostarteditsync \relax + \let\dostopeditsync \relax + + \let\doeditsyncregisterpage\gobbleoneargument + \let\doeditsyncopenfile \gobbleoneargument + \let\doeditsyncclosefile \gobbleoneargument + \let\doregistereditsyncnode\gobblethreearguments + + % These specials could be filtered by a dvitopdf backend and + % written to a jobname.pdfsync file. In that case, the x and + % y coordinates have to be to be resolved by driver. + + % \def\doeditsyncregisterpage#1{\special{pdfsync: s\space\number#1}} + % \def\doeditsyncopenfile #1{\special{pdfsync: ( #1}} + % \def\doeditsyncclosefile #1{\special{pdfsync: )}} + + % \def\doregistereditsyncnode#1#2#3% + % {\special{pdfsync: l the\editsynccounter\space\number#3}% + % \special{pdfsync: p\ifnum#1=\plusone*\fi\space\number#2}} + +\fi + +\let\editsynctracer\gobbleoneargument + +\editsynccounter\minusone % counting starts at zero and we increment beforehand + +\def\registereditsyncnode#1% we assume #1 is one token + {\ifcase\editsyncstate + \expandafter\gobbleoneargument + \else + \global\advance\editsynccounter\plusone + \doregistereditsyncnode#1\editsynccounter\inputlineno + \expandafter\editsynctracer + \fi} + +\def\editsync {\registereditsyncnode\plusone *} +\def\editsyncnode{\registereditsyncnode\zerocount} +\def\editsynctext{\registereditsyncnode\plusone } + +\appendtoks \dostarteditsync \to \everystarttext +%appendtoks \dostopeditsync \to \everystoptext +\appendtoks \doeditsyncregisterpage\realfolio \to \everyshipout +\appendtoks \doeditsyncopenfile\readfilename \to \everybeforereadfile +\appendtoks \doeditsyncclosefile\readfilename \to \everyafterreadfile + +\appendtoks \enableeditsync \to \everystarttext +\appendtoks \disableeditsync \to \everypagebody + +\def\editsynctracer#1% + {\ifcase\editsynctracemode\else + \begingroup + \forgetall + \disableeditsync + \ifcase\editsynctracemode\or % could be done more efficient, box around ifcase + \setbox\scratchbox\hbox to \zeropoint{\hss\infofont#1\hss}% 1 + \else + \setbox\scratchbox\hbox to \zeropoint{\hss\traceboxplacementtrue\boxcursor\hss}% 2/3/4 + \fi + \smashbox\scratchbox\box\scratchbox + \ifcase\editsynctracemode\or\or\or + \setbox\scratchbox\hbox to \zeropoint{\hss\raise1.25ex\hbox{\infofont#1}\hss}% 3 + \smashbox\scratchbox\box\scratchbox + \or + \setbox\scratchbox\hbox to \zeropoint{\hss\lower1.25ex\hbox{\infofont#1}\hss}% 4 + \smashbox\scratchbox\box\scratchbox + \fi + \endgroup + \fi} + +% \def\editsynctracer#1% more efficient but unreadable +% {\ifcase\editsynctracemode\else +% \ifcase\editsyncstate\else +% \begingroup +% \forgetall +% \disableeditsync +% \setbox\scratchbox\hbox to \zeropoint +% {\hss +% \ifcase\editsynctracemode\or +% \infofont#1% 1 +% \else +% \traceboxplacementtrue\boxcursor% 2/3/4 +% \fi +% \hss}% +% \smashbox\scratchbox\box\scratchbox +% \setbox\scratchbox\hbox to \zeropoint +% {\hss +% \ifcase\editsynctracemode\or\or\or +% \raise1.25ex\hbox{\infofont#1}% 3 +% \or +% \lower1.25ex\hbox{\infofont#1}% 4 +% \fi +% \hss}% +% \smashbox\scratchbox\box\scratchbox +% \endgroup +% \fi +% \fi} + +% beware, adding nodes this way will interfere with the typesetting + +\appendtoks \editsyncnode p\to \everypar +\appendtoks \editsyncnode m\to \everymath +\appendtoks \editsyncnode d\to \everydisplay +\appendtoks \editsyncnode h\to \everyhbox + +% For compatibility with 'pdfsync4context' we provide: + +\let\pdfsyncstart\enableeditsync +\let\pdfsyncstop \disablepdfsync +\let\pdfsync \editsync + +\protect + +\doifnotmode{demo}{\endinput} + +\chardef\editsynctracemode=3 + +\starttext + +\chapter{Test} + +\processfile{tufte} + +\startitemize +\item first +\item second +\stopitemize + +\processfile{tufte} + +\startlines +some local \editsync sync and \editsynctext{here}a marked point +some local \editsync sync and \editsyncnode{here}a marked point +\stoplines + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-educat.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-educat.mkii new file mode 100644 index 00000000000..93b1a6c5db3 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-educat.mkii @@ -0,0 +1,217 @@ +%D \module +%D [ file=m-educat, +%D version=2003.03.05, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Educational Extras, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module will collect a few macros cq.\ definitions +%D meant for educational use. Most of the code has been laying +%D around for some time and has been (or is still) used in +%D \PRAGMA\ projects. + +\unprotect + +\definesystemvariable{iv} + +\definecolor [answerareacolor] [s=.90] +\definecolor [answerlinecolor] [white] + +\definetextbackground + [\v!answerarea] + [\c!location=\v!text, + \c!n=0, + \c!frame=\v!off, + \c!framecolor=answerlinecolor, + \c!rulethickness=2pt, + \c!background=\v!color, + \c!backgroundcolor=answerareacolor, + \c!alternative=2] % betweenline + +% n=gedwongen +% m=extra auto + +\def\setupanswerarea + {\setuptextbackground[\v!answerarea]} + +\setvalue\e!answerspace + {\dosingleempty\doanswerspace} + +\def\doanswerspace[#1]% + {\begingroup + \dontcomplain + \setupanswerarea + [\c!n=0,\c!m=,#1,\c!location=\v!text]% + \doifelsenothing{\textbackgroundparameter\c!m} + {\expandafter\donoanswerspace} + {\expandafter\dodoanswerspace}% + [#1]} + +\def\donoanswerspace[#1]#2% + {\setupthinrules + [\c!alternative=\textbackgroundparameter\c!alternative, + \c!color=\textbackgroundparameter\c!framecolor, + \c!background=\textbackgroundparameter\c!background, + \c!backgroundcolor=\textbackgroundparameter\c!backgroundcolor, + \c!rulethickness=\textbackgroundparameter\c!rulethickness]% + \doifelse{\textbackgroundparameter\c!n}{*} + {\thinrule + \par} + {\scratchcounter0\textbackgroundparameter\c!n\relax + % tricky, guess + \def\processisolatedword##1% + {\setbox\scratchbox=\hbox{##1}% + \vbox{\hsize\wd\scratchbox\thinrule + \ifcase\scratchcounter\else + \setbox\scratchbox=\hbox{\space}% + \nobreak\hskip\zeropoint \!!minus \wd\scratchbox + \vbox{\hsize\wd\scratchbox\thinrule}% + \fi}}% + \processisolatedwords{#2}\processisolatedword + % so far + \ifcase\scratchcounter \else \ifnum\scratchcounter<3 + \nobreak \vbox{\hsize\scratchcounter em\thinrule}% + \else % more + \advance \scratchcounter -2 + \dorecurse\scratchcounter{\allowbreak\vbox{\hsize1em\thinrule}}% + \nobreak \vbox{\hsize2em\thinrule}% + \fi \fi}% + \endgroup} + +\def\dodoanswerspace[#1]#2% m case + {\getvalue{\e!start\v!answerarea}% + #2% + \doifelse{\textbackgroundparameter\c!m}{*} + {\hfill\strut + \getvalue{\e!stop\v!answerarea}% + \par} + {\scratchcounter0\textbackgroundparameter\c!m\relax + \ifcase\scratchcounter \else \ifnum\scratchcounter<3 + \nobreak \hbox to \scratchcounter em{\strut\hss}% + \else % more + \advance \scratchcounter -2 + \dorecurse\scratchcounter{\allowbreak\hbox to 1em{\strut\hss}}% + \nobreak \hbox to 2em{\strut\hss}% + \fi \fi + \getvalue{\e!stop\v!answerarea}}% + \endgroup} + +\setvalue{\e!start\e!answerlines}% + {\dosingleempty\dostartanswerlines} + +\def\dostartanswerlines[#1]% + {\begingroup + \dontcomplain + \setupanswerarea + [\c!n=0,\c!m=,#1,\c!location=\v!text]% + \doifnot{\textbackgroundparameter\c!option}\v!joinedup\softbreak + \doifelsenothing{\textbackgroundparameter\c!m} + {\expandafter\donostartanswerlines} + {\expandafter\dodostartanswerlines}% + [#1]} + +\def\donostartanswerlines[#1]% + {\setupthinrules + [\c!alternative=\textbackgroundparameter\c!alternative, + \c!color=\textbackgroundparameter\c!framecolor, + \c!background=\textbackgroundparameter\c!background, + \c!backgroundcolor=\textbackgroundparameter\c!backgroundcolor, + \c!rulethickness=\textbackgroundparameter\c!rulethickness]% + \thinrules[\c!n=\textbackgroundparameter\c!n]\par + \endgroup + \grabuntil{\e!stop\e!answerlines}} + +\def\dodostartanswerlines[#1]% + {\begingroup + \getvalue{\e!start\v!answerarea}% + \ignorespaces} + +\setvalue{\e!stop\e!answerlines}% + {\scratchcounter0\textbackgroundparameter\c!m\relax + % a \softbreak is more efficient in pos dan \par + \ifcase\scratchcounter + % nothing + \or + \softbreak + \else + \softbreak + \advance \scratchcounter \minusone + \dorecurse\scratchcounter{\strut\hfill\strut\softbreak}% + \fi + \strut\hfill\strut + \getvalue{\e!stop\v!answerarea}% + \par\endgroup\endgroup} + +\setvalue\e!answerlines + {\dosingleempty\doanswerlines} + +\def\doanswerlines[#1]#2% + {\getvalue{\e!start\e!answerlines}[#1]% + #2% + \getvalue{\e!stop\e!answerlines}} + +\protect \doifnotmode{demo}{\endinput} + +%D Test materiaal. + +\starttext + +\startnotmode[answers] + + \setupanswerarea[level=+1] + +\stopnotmode + +\setupcolors[state=start] + +test test test \answerspace [n=10] {Whow}. test test test +test tets test test \answerspace [n=10] {Whow}. test test +test test tets test test \answerspace [n=10] {Whow}. test +test test test tets test test \answerspace [n=10] {Whow}. +test test test test test test \answerspace [n=*] {Whow.} + +test test test test test test test \startanswerlines +[n=3] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[n=3,alternative=0] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[n=3,alternative=1] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[n=3,alternative=2] What A Junk Answer \stopanswerlines + +\startitemize[paragraph] +\item \startanswerlines [option=seried,n=2] xxx \stopanswerlines +\stopitemize + +test test test \answerspace [m=10] {Whow}. test test test +test tets test test \answerspace [m=10] {Whow}. test test +test test tets test test \answerspace [m=10] {Whow}. test +test test test tets test test \answerspace [m=10] {Whow}. +test test test test test test \answerspace [m=*] {Whow.} + +test test test test test test test \startanswerlines +[m=2] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[m=2,alternative=0] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[m=2,alternative=1] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[m=2,alternative=2] What A Junk Answer \stopanswerlines + +\startitemize[paragraph] +\item \startanswerlines [option=seried,m=2] xxx \stopanswerlines +\stopitemize + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-format.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-format.mkii new file mode 100644 index 00000000000..7cedd803f5e --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-format.mkii @@ -0,0 +1,411 @@ +%D \module +%D [ file=m-formay, +%D version=ancient, +%D title=\CONTEXT\ Modules, +%D subtitle=Ancient Formatting Code, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Here is some code that I had laying around and had forgotten +%D about. Let's make it a module and see if there is interest in +%D such things. + +% \defineformatblock [poem] +% \defineformatsegment [verse] % [poem] +% \defineformatline [line] % [verse] +% +% \startpoem [title] [author] +% \startverse [ref] +% \startline [ref] +% +% block : voor na tussen *tekstletter *tekstkleur +% +% segment : voor na tussen *tekstletter *tekstkleur +% : links rechts linkeroffset rechteroffset +% : ?marge *evenmarge *onevenmarge breedte +% : nummer *nummercommando *conversie +% : nummerletter nummerkleur *label +% +% line : voor na tussen *tekstletter *tekstkleur +% : nummer *nummercommando *conversie +% : nummerletter nummerkleur *label +% +% * = todo + +\unprotect + +\definesystemvariable {fx} % format block +\definesystemvariable {fy} % format segment +\definesystemvariable {fz} % format line + +\def\defineformatblock + {\dodoubleempty\dodefineformatblock} + +\def\dodefineformatblock[#1][#2]% + {\setupformatblock + [#1] + [\c!before=\blank,\c!after=\blank,\c!inbetween=\blank, + \c!textstyle=,\c!textcolor=,#2]% + \setvalue{\e!start#1}{\startformatblock[#1]}% + \setvalue{\e!stop #1}{\stopformatblock}} + +\def\setupformatblock + {\dodoubleempty\dosetupformatblock} + +\def\setupformatblock[#1]% + {\getparameters[\??fx#1]} + +\def\startformatblock[#1]% + {\dotriplegroupempty\dostartformatblock{#1}} + +\def\dostartformatblock#1#2#3 + {\bgroup + \getvalue{\??fx#1\c!before} + \doglobal\newcounter\formatsegmentcounter + \doglobal\newcounter\formatlinecounter + \doglobal\newcounter\formatlinesubcounter + \doglobal\newcounter\formatlinemaxcounter + \doifsomething{#2}{\leftaligned{#2}\getvalue{\??fx#1\c!inbetween}} + \def\stopformatblock% + {\doifsomething{#3}{\getvalue{\??fx#1\c!inbetween}\leftaligned{#3}} + \getvalue{\??fx#1\c!after} + \egroup}} + +\def\defineformatsegment + {\dodoubleempty\dodefineformatsegment} + +\def\dodefineformatsegment[#1][#2]% + {\setupformatsegment + [#1] + [\c!before=\blank,\c!after=\blank,\c!inbetween=\blank, + \c!textstyle=,\c!textcolor=,\c!left=,\c!right=, + \c!leftoffset=\!!zeropoint,\c!rightoffset=\!!zeropoint, + %\c!margin=\!!zeropoint,\c!evenmargin=\!!zeropoint,\c!oddmargin=\hsize, + \c!width=\hsize,\c!numberstyle=,\c!numbercolor=,\c!number=\v!no, + \c!numbercommand=,\c!conversion=,\c!label=, + #2]% + \setvalue{\e!start#1}{\startformatsegment[#1]}% + \setvalue{\e!stop #1}{\stopformatsegment}} + +\def\setupformatsegment + {\dodoubleempty\dosetupformatsegment} + +\def\setupformatsegment[#1]% + {\getparameters[\??fy#1]} + +\def\placeformatsegmentcounter + {\formatsegmentcounter\quad\hphantom{\placeformatlinecounter}} + +\def\placeformatlinecounter + {\formatlinecounter} + +\def\startformatsegment[#1]% + {\bgroup + \doifelsevalue{\??fy#1\c!number}\v!yes + {\def\doplaceformatsegmentcounter + {\inleftmargin + {\doattributes{\??fy#1}\c!numberstyle\c!numbercolor + {\placeformatsegmentcounter}}}} + {\let\doplaceformatsegmentcounter\relax}% + \getvalue{\??fy#1\c!before} + \doglobal\increment\formatsegmentcounter + \def\formatrightoffset{\getvalue{\??fy#1\c!rightoffset}} + \def\formatleftoffset {\getvalue{\??fy#1\c!leftoffset}} + \def\formatminwidth {\getvalue{\??fy#1\c!minwidth}} + \def\formatwidth {\getvalue{\??fy#1\c!width}} + %\def\formatmargin {\getvalue{\??fy#1\c!margin}} + \def\formatbefore {\getvalue{\??fy#1\c!before}} + \def\formatinbetween {\getvalue{\??fy#1\c!inbetween}} + \def\formatafter {\getvalue{\??fy#1\c!after}} + \def\formatleft {\getvalue{\??fy#1\c!left}} + \def\formatright {\getvalue{\??fy#1\c!right}} + \@@segmentvarianta + \getvalue{@@segmentvariant\getvalue{\??fy#1\c!alternative}} + \def\stopformatsegment + {\getvalue{\??fy#1\c!after} + \egroup}} + +\newif\iftraceformatblock + +\def\@@segmentvarianta % ragged right, symbols + {\let\formatraggedness\raggedright + \let\dostartformatline\dostartformatlineab + \let\formatleftfirst\relax \let\formatrightfirst\hfill + \let\formatleftnext \hfill \let\formatrightnext \relax} + +\def\@@segmentvariantb % ragged right, equal parts, symbols + {\let\formatraggedness\raggedcenter + \let\dostartformatline\dostartformatlineab + \let\formatleftfirst\relax \let\formatrightfirst\hfill + \let\formatleftnext \hfill \let\formatrightnext \relax} + +\def\@@segmentvariantc % ragged right + {\let\formatraggedness\veryraggedright + \let\dostartformatline\dostartformatlinecde + \let\formatleftnext\relax \let\formatrightnext\hfill} + +\def\@@segmentvariantd % ragged center + {\let\formatraggedness\veryraggedcenter + \let\dostartformatline\dostartformatlinecde + \let\formatleftnext\hfill \let\formatrightnext\hfill} + +\def\@@segmentvariante % ragged left + {\let\formatraggedness\veryraggedleft + \let\dostartformatline\dostartformatlinecde + \let\formatleftnext\hfill \let\formatrightnext\relax} + +\def\defineformatline + {\dodoubleempty\dodefineformatline} + +\def\dodefineformatline[#1][#2]% + {\setupformatline + [#1] + [\c!before=\blank,\c!after=\blank,\c!inbetween=\blank, + \c!textstyle=,\c!textcolor=, + \c!number=\v!no,\c!numbercommand=,\c!conversion=, + \c!numberstyle=,\c!numbercolor=,\c!label=, + #2]% + \setvalue{\e!start#1}{\startformatline[#1]}% + \setvalue{\e!stop #1}{\stopformatline}} + +\def\setupformatline + {\dodoubleempty\dosetupformatline} + +\def\setupformatline[#1]% + {\getparameters[\??fz#1]} + +\newconditional\formatforcedbreak + +\def\startformatline[#1]% + {\bgroup + \doifelsevalue{\??fz#1\c!number}\v!yes + {\def\doplaceformatlinecounter + {\inleftmargin + {\doattributes{\??fz#1}\c!numberstyle\c!numbercolor + {\placeformatlinecounter}}}} + {\let\doplaceformatlinecounter\relax}% + \global\setfalse\formatforcedbreak + \def\\{\break\global\settrue\formatforcedbreak}% + \hsize\formatwidth + \doglobal\increment\formatlinecounter + \par + \nobreak + \def\stopformatline + {\unskip\unskip\unskip\unskip\unskip\egroup + \let\doplaceformatsegmentcounter\relax} + \postponenotes + \dowithnextbox{\dostartformatline}\hbox\bgroup\ignorespaces} + +\def\dostartformatlineab + {%\dosetleftskipadaption\formatmargin + %\advance\hsize-\leftskipadaption\relax + \ifdim\nextboxwd>\hsize + \beginofshapebox + \forgetall + \hangafter\plusone + \hangindent\formatleftoffset + \formatraggedness + \hskip\formatrightoffset + \unhbox\nextbox\par + \endofshapebox + %\advance\hsize \leftskipadaption + \doglobal\newcounter\formatlinesubcounter + \reshapebox + {\doglobal\increment\formatlinesubcounter} + \global\let\formatlinemaxcounter\formatlinesubcounter + \reshapebox + {\doglobal\decrement\formatlinesubcounter + \ifnum\formatlinesubcounter=\zerocount + \doplaceformatsegmentcounter + \doplaceformatlinecounter + \hskip-\formatrightoffset + %\hskip\leftskipadaption + \formatleftfirst + \unhbox\shapebox + \ifnum\formatlinemaxcounter>\plusone + \ifx\formatright\empty\else + \shapedhbox to \zeropoint{\formatright\hss}% + \fi + \fi + \formatrightfirst + \iftraceformatblock + \ruledhskip\formatrightoffset\hskip-\formatrightoffset + \fi + \else + %\hskip\leftskipadaption + \iftraceformatblock + \ruledhskip\formatleftoffset\hskip-\formatleftoffset + \fi + \formatleftnext + \ifx\formatleft\empty\else + \shapedhbox to \zeropoint{\hss\formatleft}% + \fi + \unhbox\shapebox + \formatrightnext + \fi} + \flushshapebox + \else + \dontleavehmode\hbox + {\doplaceformatsegmentcounter + \doplaceformatlinecounter + %\hskip\leftskipadaption + \formatleftfirst + \unhbox\nextbox + \formatrightfirst} + \fi + \par + \egroup} + +\def\dostartformatlinecde + {%\dosetleftskipadaption\formatmargin + %\advance\hsize -\leftskipadaption\relax + \dimen0=\hsize + \ifconditional\formatforcedbreak\else + \ifdim\formatminwidth>\zeropoint\relax + \ifdim\nextboxwd>\hsize + \doloop + {\global\dimen1=\dimen0 + \beginofshapebox + \hsize\dimen0 + \forgetall + \formatraggedness + \unhcopy\nextbox\par + \endofshapebox + \reshapebox + {\setbox\scratchbox=\hbox{\unhbox\shapebox}% + \ifdim\wd\scratchbox<\dimen1 + \global\dimen1=\wd\scratchbox + \fi} + \ifdim\dimen1<\formatminwidth\relax + \advance\dimen0 by -.25em + \else + \exitloop + \fi + \ifdim\dimen0<10em + \dimen0=\hsize + \exitloop + \fi} + \fi + \fi + \fi + \beginofshapebox + \hsize\dimen0 + \forgetall + \formatraggedness + \unhcopy\nextbox\par + \endofshapebox + %\advance\hsize \leftskipadaption + \doglobal\newcounter\formatlinesubcounter + \reshapebox + {\doglobal\increment\formatlinesubcounter}% + \global\let\formatlinemaxcounter\formatlinesubcounter + \reshapebox + {\doglobal\decrement\formatlinesubcounter + \ifnum\formatlinesubcounter=\zerocount + \doplaceformatsegmentcounter + \doplaceformatlinecounter + \fi + %\hskip\leftskipadaption + \formatleftnext + \unhbox\shapebox + \formatrightnext\strut}% strut prevents unskip + \flushshapebox + \par + \egroup} + +\defineformatblock[poem] + [\c!before=\blank, + \c!inbetween={\blank[\v!medium]}, + \c!after=\blank] + +\defineformatsegment[verse] + [\c!alternative=\v!left, + \c!width=\hsize, + %\c!margin=\!!zeropoint, + \c!before={\blank[\v!medium]}, + \c!after={\blank[\v!medium]}, + \c!inbetween={\blank[\v!medium]}, + \c!leftoffset=3em, + \c!rightoffset=2em, + \c!minwidth=5em, + \c!left={$[$\enspace}, + \c!right={\enspace$]$}] + +\defineformatline[line] + [] + +\protect + +\doifnotmode{demo} {\endinput} + +% evt defineblank[formatbefore,formatinbetween,formatafter] + +%\showframe \traceformatblocktrue + +\usemodule[visual] + +\setuplayout[height=middle,topspace=1cm,header=0pt,footer=0pt] +\setupbodyfont[10pt] + +% All interfaces supported, but testing with english; todo: +% more options, more alternatives, inheritance and mixed +% definitions, and so. + +\starttext + +\startbuffer +\startbuffer[poem] +\startpoem{A Random Poem}{Hans Hagen} + \startverse + \startline \fakewords{4}{8} \stopline + \startline \fakewords{4}{8} \stopline + \startline \fakewords{4}{8} \stopline + \startline \fakewords{4}{8} \stopline + \stopverse + \startverse + \startline \fakewords{4}{8} \stopline + \startline \fakewords{4}{8} \stopline + \startline \fakewords{4}{8} \stopline + \startline \fakewords{4}{8} \stopline + \stopverse +\stoppoem +\stopbuffer + +\setupformatsegment[verse][width=.4\hsize,number=yes,numberstyle=slanted] +\setupformatline [line] [number=yes,numberstyle=smallslanted] + +\startbuffer[x] +\setupformatsegment[verse][leftoffset=0pt,rightoffset=0pt,left=,right=] +\stopbuffer + +\section{Alternative A} + +\setupformatsegment[verse][alternative=a] {\getbuffer[poem]} +\setupformatsegment[verse][alternative=a] {\getbuffer[x,poem]} + +\section{Alternative B} + +\setupformatsegment[verse][alternative=b] {\getbuffer[poem]} +\setupformatsegment[verse][alternative=b] {\getbuffer[x,poem]} + +\section{Alternative C} + +\setupformatsegment[verse][alternative=c] {\getbuffer[poem]} + +\section{Alternative D} + +\setupformatsegment[verse][alternative=d] {\getbuffer[poem]} + +\section{Alternative E} + +\setupformatsegment[verse][alternative=e] {\getbuffer[poem]} +\stopbuffer + +\typebuffer \getbuffer + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-graph.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-graph.mkii new file mode 100644 index 00000000000..8e28cf53724 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-graph.mkii @@ -0,0 +1,231 @@ +%D \module +%D [ file=m-graph, +%D version=2000.08.06, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\METAPOST\ graph module support, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D I finally finished graph support, if only because I could +%D not stand the idea that Karel Wesseling would revert to +%D \PiCTeX. + +% pre 2000.08.06 version +% +% \forceMPTEXgraphictrue +% +% \startMPinitializations +% initialize_numbers ; % make sure that pseudo typesetting is set up +% input graph ; % load the graph package +% Autoform := "@g" ; % change the % template char into @ +% \stopMPinitializations + +%D The latest version does things more automatically (and +%D efficiently when no text processing is needed). For +%D definitions embedded in your document, you need to +%D use \type {@} as template character, in external files, +%D \type {%} is also supported. + +\startMPinclusions + input graph ; +\stopMPinclusions + +%D Graphics that have \type {begingraph} in them are +%D recognized as such and force handling of embedded \TEX\ +%D code. + +\forceMPTEXcheck{begingraph} + +%D If you run into troubles, try: +%D +%D \starttyping +%D \forceMPTEXgraphictrue +%D \stoptyping +%D +%D A demo can be run with: +%D +%D \starttyping +%D texexec --mode=demo --pdf m-graph +%D \stoptyping + +\startMPinclusions + % @# is X_ or Y_; $ is Gxcvlin_ or Gycvlin_; l and h are numeric or string + % It would not be OK to set (@#low,@#high) to a pair expression because $ might + % try to rescale @#low when evaluating the right-hand side for @#high. + vardef Gsetr_@\#(suffix $)(expr l, h) = + Gclbnds_@\# ; + if @\#ctyp>0 : + @\#low = if abs @\#ctyp<>log: $ fi Mlog_Str l ; + @\#high = if abs @\#ctyp<>log: $ fi Mlog_Str h ; + else : + -@\#high = if abs @\#ctyp<>log: $ fi Mlog_Str l ; + -@\#low = if abs @\#ctyp<>log: $ fi Mlog_Str h ; + fi + enddef ; +\stopMPinclusions + +\doifnotmode {demo} {\endinput} + +%D You need to have the data files in your path, +%D otherwise the run is aborted. + +\doiffileelse {agepop91.d} {} {\writestatus{graph}{no data files found}\wait\end} + +%D The test: + +\starttext + +\startMPpage +draw begingraph(3in,2in); + gdraw "agepop91.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + gdraw "agepop91.d" plot btex$\bullet$etex; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); + glabel.bot(btex Age in years etex, OUT); + gdraw "agepopm.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); + glabel.bot(btex Age in years etex, OUT); + setrange(origin, whatever,whatever); + gdraw "agepopm.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(2.3in,2in); + setcoords(log,log); + glabel.lft(btex Seconds etex,OUT); + glabel.bot(btex Matrix size etex, + OUT); + gdraw "matmul.d" dashed evenly; + glabel.ulft(btex Standard etex,8); + gdraw "matmul.d"; + glabel.lrt(btex Strassen etex,7); + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(6.5cm,4.5cm); + setrange(80,0, 90,whatever); + glabel.bot(btex Year etex, OUT); + glabel.lft(btex \vbox{\hbox{Emissions in} \hbox{thousands of} + \hbox{metric tons} \hbox{(heavy line)}}etex, OUT); + gdraw "lead.d" withpen pencircle scaled 1.5pt; + autogrid(,otick.lft); + setcoords(linear,linear); + setrange(80,0, 90,whatever); + glabel.rt(btex \vbox{\hbox{Micrograms} \hbox{per cubic} + \hbox{meter of air} \hbox{(thin line)}}etex, OUT); + gdraw "lead.d"; + autogrid(otick.bot,otick.rt); + endgraph; +\stopMPpage + +\stoptext + +% No longer needed, since John will fix it. +% +% %D For the moment we need the following patch. Adam T. Lindsay +% %D found out that the following code produced an error: +% %D +% %D \starttyping +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,0,10,22000); +% %D glabel.lft(btex {correct 0--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,50,10,22000); +% %D glabel.lft(btex {wrong 50--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,110,10,30000); +% %D glabel.lft(btex {failed 110--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D \stoptyping +% %D +% %D The bug is a rather nasty one and needs some tweaking in +% %D the low level graph code. John Hobby suggested for the +% %D moment to initialize \type {setrange} as follows: +% %D +% %D \starttyping +% %D setrange(0,0,"22000","22000") +% %D \stoptyping +% %D +% %D Folowing this suggesion, I provide the following +% %D extension: + +% def begingraph(expr w, h) = +% begingroup +% save X_, Y_, Gfin_, Gcur_, Gcbb_, Gneedgr_, Gneedfr_, Gdidsc_; +% save Gdpic_, Gppic_, Ggl_, Garw_; +% picture Gfin_, Gcur_, Gcbb_, Gdpic_, Gppic_, Ggl_[]; +% boolean Gneedgr_, Gneedfr_, Gdidsc_; +% Gfin_ = nullpicture; +% Gcur_ = nullpicture; +% Gcbb_ = nullpicture; +% X_.ctyp = Y_.ctyp = linear; +% Z_.gdim = (w,h); +% X_.sc = Y_.sc = 0; +% Gneedgr_ = true; +% Gneedfr_ = true; +% Gdidsc_ = false; +% Gdpic_ = nullpicture; +% Garw_ = 0; +% scantokens everybegingraph ; +% enddef; +% +% boolean fixsetrange ; fixsetrange := true ; +% +% vardef dosetrange(text t) = +% interim warningcheck:=0; +% save r_; r_=0; +% string r_[]s; +% for x_= +% for p_=t: if pair p_: xpart p_, ypart fi p_, endfor: +% r_[incr r_] if string x_: s fi = x_; +% if r_>2: +% Gsetr_ if r_=3: X_(Gxcvlin_) else: Y_(Gycvlin_) fi( +% r_[r_-2] if unknown r_[r_-2]: s fi, x_); +% fi +% exitif r_=4; +% endfor +% enddef; +% +% vardef setrange(text t) = +% if fixsetrange : dosetrange(0,0,20000,20000) ; fi ; +% dosetrange(t) ; +% enddef ; +% +% if unknown everybegingraph : +% string everybegingraph ; +% % everybegingraph := "setrange(0,0,20000,20000)" ; +% fi ; diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-layout.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-layout.mkii new file mode 100644 index 00000000000..5ccf0e98731 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-layout.mkii @@ -0,0 +1,102 @@ +%D \module +%D [ file=m-layout, +%D version=2004.01.16, +%D title=\CONTEXT\ Modules, +%D subtitle=Additional Layouts, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% layout-preset - thf th tf + +%D This is a preliminary module, don't depend on these dimensions yet. + +\readsysfile{lang-frq}\donothing\donothing +\readsysfile{lang-frd}\donothing\donothing + +\unprotect + +% \def\layouthwratio{\withoutpt\the\dimexpr8\paperheight/\dimexpr(\paperwidth/ 8192)\relax} +% \def\layouthwratio{\withoutpt\the\dimexpr4\paperheight/\dimexpr(\paperwidth/16384)\relax} +% \def\layouthwratio{\withoutpt\the\dimexpr2\paperheight/\dimexpr(\paperwidth/32768)\relax} + +\def\layouthwratio + {\withoutpt\the\dimexpr2\paperheight/(\paperwidth/32768)\relax} + +\def\layouthfheight + {\dimexpr\layoutparameter\c!header+\layoutparameter\c!headerdistance+ + \layoutparameter\c!footer+\layoutparameter\c!footerdistance\relax} + +\startsetups[preset-1] + + \xdef\layoutwidth {\dimexpr\layoutparameter\c!width\relax} + \gdef\layoutheight{\dimexpr\layouthwratio\dimexpr\layoutwidth\relax+\layouthfheight\relax} + +\stopsetups + +\definelayout + [preset-1-1] + [\c!preset=preset-1, + \c!backspace=\dimexpr(\paperwidth-\layoutwidth)/2\relax, + \c!width=\dimexpr2\paperwidth/3\relax, + \c!cutspace=\dimexpr(\paperwidth-\layoutwidth)/2\relax, + \c!margin=\dimexpr(\paperwidth-\layoutwidth)/3\relax, + \c!header=2\lineheight, + \c!headerdistance=\lineheight, + \c!height=\v!middle, % \layoutheight + \c!footerdistance=\layoutparameter\c!headerdistance, % \lineheight, + \c!footer=\layoutparameter\c!header, % 2\lineheight, + \c!topspace=\dimexpr1\dimexpr\paperheight-(\layoutheight+\layouthfheight)\relax/3\relax, + \c!bottomspace=\dimexpr2\dimexpr\paperheight-(\layoutheight+\layouthfheight)\relax/3\relax] + +\startsetups[preset-2] + + \gdef\layouthstep{\dimexpr\paperwidth /\layoutparameter\c!columns\relax} + \gdef\layoutvstep{\dimexpr\paperheight/\layoutparameter\c!columns\relax} + +\stopsetups + +\definelayout + [preset-2-1] + [\c!preset=preset-2, + \c!columns=12, + \c!backspace=\layouthstep, + \c!width=\v!middle, + \c!cutspace=2\layouthstep, + \c!margin=\layouthstep, + \c!header=2\lineheight, + \c!headerdistance=\lineheight, + \c!height=\v!middle, % \layoutheight + \c!footerdistance=\layoutparameter\c!headerdistance, + \c!footer=\layoutparameter\c!header, + \c!topspace=\dimexpr\layoutvstep-\layoutparameter\c!header-\layoutparameter\c!headerdistance\relax, + \c!bottomspace=\dimexpr(2\layoutvstep)-\layoutparameter\c!header-\layoutparameter\c!headerdistance\relax] + +\definelayout + [preset-2-2] + [\c!preset=preset-2, + \c!columns=12, + \c!backspace=\layouthstep, + \c!width=\v!middle, + \c!cutspace=2\layouthstep, + \c!margin=\layouthstep, + \c!header=2\lineheight, + \c!headerdistance=\lineheight, + \c!height=\v!middle, % \layoutheight + \c!footerdistance=\layoutparameter\c!headerdistance, + \c!footer=\layoutparameter\c!header, + \c!topspace=\layoutvstep, + \c!bottomspace=\layoutvstep] % maybe 1.5 + +% \setuplayout[preset-1-1] test \showframe \page +% \setuplayout[preset-1-1][width=65\averagecharwidth] \setuplayout[preset-1-1] test \showframe \page +% \setuplayout[preset-2-1] test \showframe \page +% \setuplayout[preset-2-1][columns=10] \setuplayout[preset-2-1] test \showframe \page +% \setuplayout[preset-2-2] test \showframe \page +% \setuplayout[preset-2-2][columns=10] \setuplayout[preset-2-2] test \showframe \page + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-level.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-level.mkii new file mode 100644 index 00000000000..d758288d7ef --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-level.mkii @@ -0,0 +1,94 @@ +%D \module +%D [ file=level, +%D version=2002.10.20, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Catching Nesting Errors, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\newcount\currentnesting + +\def\startnesting#1% + {\global\advance\currentnesting\plusone + \setxvalue{level::\number\currentnesting}{#1}} + +\def\stopnesting#1% + {\edef\nestingstring{#1}% + \relax\ifnum\currentnesting>\zerocount + \doifelsevalue{level::\number\currentnesting}\nestingstring + {\global\advance\currentnesting\minusone} + {\@EA\reportnestingerror\@EA\stoptext} + \else + \@EA\reportnestingerror\@EA\stoptext + \fi} + +\def\checknesting + {\relax\ifnum\currentnesting>\zerocount + \def\nestingstring{end of document}% + \@EA\reportnestingerror + \fi} + +\def\reportnestingerror + {\endgraf + \global\let\checknesting\relax + \bgroup \definedfont[Mono at 18pt]\incolortrue + \setupinterlinespace + \raggedright + \bgroup \red + \ifnum\currentnesting>\plusone + wrong end level + \else + too many end levels + \fi + at \nestingstring\space in line \number\inputlineno + \ifnum\currentnesting>\zerocount, stack:\fi\endgraf + \egroup + \dostepwiserecurse\currentnesting\plusone\minusone + {\space\getvalue{level::\recurselevel}} + \endgraf + \egroup + \writestatus\m!systems{quitting due to level error}\wait + \batchmode} + +\prependtoks + \checknesting +\to \everystoptext + +\protect \doifnotmode{demo}{\endinput} + +\starttext + +% \startnesting{eerste} +% \startnesting{tweede} +% \startnesting{derde} +% \startnesting{vierde} +% test +% \stopnesting{vierde} +% \stopnesting{eerste} + +% \startnesting{eerste} +% \startnesting{tweede} +% test +% \stopnesting{vierde} +% \stopnesting{derde} +% \stopnesting{tweede} +% \stopnesting{eerste} + +\startnesting{eerste} + \startnesting{tweede} + \startnesting{derde} + \startnesting{vierde} + test + \stopnesting{vierde} + \stopnesting{derde} + \stopnesting{tweede} +\stopnesting{eerste} + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-narrowtt.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-narrowtt.mkii new file mode 100644 index 00000000000..129bf270b9d --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-narrowtt.mkii @@ -0,0 +1,39 @@ +%D \module +%D [ file=m-narrowtt, +%D version=2005.09.08, +%D title=\CONTEXT\ Modules, +%D subtitle=Narrow Verbatim, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Test file +%D +%D \starttyping +%D \startTEX +%D \usemodule[narrowtt] +%D \starttext +%D \starttyping +%D Test test test. +%D \stoptyping +%D test \type {test} test \type{test} test +%D \starttyping +%D Test test test. +%D \stoptyping +%D \stoptext +%D \stopTEX + +\unprotect + +\definetypeface + [narrowtt] [tt] + [mono] [modern-condensed] [default] [encoding=\defaultencoding] + +\definetyping[n\v!typing] \setuptyping[n\v!typing][style=\narrowtt] +\definetype [n\v!type] \setuptype [n\v!type] [style=\narrowtt] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-obsolete.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-obsolete.mkii new file mode 100644 index 00000000000..a97002cf64c --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-obsolete.mkii @@ -0,0 +1,5 @@ +\unprotect + +\writestatus\m!systems{skipping obsolete module} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-pdfsnc.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-pdfsnc.mkii new file mode 100644 index 00000000000..12e2e2d68ba --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-pdfsnc.mkii @@ -0,0 +1,200 @@ +%D \module +%D [ file=m-pdfsnc, +%D version=2003.12.23, +%D title=\CONTEXT\ Modules, +%D subtitle=Editor Synchronization, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% \enablemode[demo] + +% This file is a variation of the file pdfsync4context.tex that ships +% with the pdfsync package (used by iTeXMac and TeXShop) by Piero +% D'Ancona and Jérôme Laurens. I made the macros a bit more efficient +% and added some basic tracing options as well as a few more options. +% I made this one while playing a bit with the Mac and TeX). Maybe I'll +% add a bit of support to the kernel in in order to get rid of redundant +% markers. Also, this had better be rewritten in a bit less \pdf +% dependent way so that it can also be supported by dvipdfmx. I could +% write a generic file as well, but since there is already support for +% other packages I'll not do that (now). + +% compatible commands: +% +% \pdfsyncstart \pdfsyncstop \pdfsync +% +% extra commands: +% +% \enablepdfsync \disablepdfsync \pdfsynctext \pdfsyncnode \pdfsynctracemode + +\ifx\pdfoutput\undefined + \donefalse +\else\ifcase\pdfoutput + \donefalse +\else\ifx\pdfsavepos\undefined + \donefalse +\else + \donetrue +\fi\fi\fi + +\chardef \pdfsyncstate \zerocount +\chardef \pdfsynctracemode \zerocount + +\ifdone + + \writestatus{pdfsync}{loading and enabling synchronization support} + +\else + + \writestatus{pdfsync}{synchronization is only available with pdftex} + + \let \pdfsyncstart \relax % brr, not per se symmetrically used, so + \let \pdfsyncstop \relax % enable and disable are better names + \let \pdfsync \relax + + \let \pdfsynctext \gobbleoneargument + \let \pdfsyncnode \gobbleoneargument + + \let \enablepdfsync \pdfsyncstart + \let \disablepdfsync \pdfsyncstop + + \expandafter\endinput +\fi + +\unprotect % not really needed + +\newcount \pdfsynccounter +\newwrite \pdfsyncwrite + +\def\pdfsyncstart{\chardef\pdfsyncstate\plusone} \let\enablepdfsync \pdfsyncstart +\def\pdfsyncstop {\chardef\pdfsyncstate\zerocount} \let\disablepdfsync\pdfsyncstop + +\def\dostartpdfsync + {\immediate\openout\pdfsyncwrite\jobname.pdfsync + \immediate\write\pdfsyncwrite{\jobname}% + \immediate\write\pdfsyncwrite{version 0}} + +\def\dostoppdfsync + {\immediate\closeout\pdfsyncwrite} + +\def\doregisterpdfsyncpage + {\immediate\write\pdfsyncwrite{s\space\realfolio}} + +\def\dopdfsyncopenfile + {\immediate\write\pdfsyncwrite{(\space\readfilename}} + +\def\dopdfsyncclosefile + {\immediate\write\pdfsyncwrite{)}} + +\def\doregisterpdfsyncnode#1% + {\ifcase\pdfsyncstate\else + \pdfsavepos + \immediate\write\pdfsyncwrite{l\space\the\pdfsynccounter\space\the\inputlineno}% + \expanded{\write\pdfsyncwrite{p\ifnum#1=\plusone*\fi\space\the\pdfsynccounter\space\noexpand\the\pdflastxpos\space\noexpand\the\pdflastypos}}% + \global\advance\pdfsynccounter\plusone + \fi} + +\let\pdfsynctracer\gobbleoneargument + +\def\pdfsync {\doregisterpdfsyncnode\plusone \pdfsynctracer*} +\def\pdfsyncnode{\doregisterpdfsyncnode\zerocount\pdfsynctracer} +\def\pdfsynctext{\doregisterpdfsyncnode\plusone \pdfsynctracer} + +\appendtoks \dostartpdfsync \to \everystarttext +%appendtoks \dostoppdfsync \to \everystoptext +\appendtoks \doregisterpdfsyncpage \to \everyshipout +\appendtoks \dopdfsyncopenfile \to \everybeforereadfile +\appendtoks \dopdfsyncclosefile \to \everyafterreadfile + +\appendtoks \enablepdfsync \to \everystarttext +\appendtoks \disablepdfsync \to \everypagebody + +% beware, adding nodes this way will interfere with the typesetting + +\appendtoks \pdfsyncnode p\to \everypar +\appendtoks \pdfsyncnode m\to \everymath +\appendtoks \pdfsyncnode h\to \everyhbox + +% just for fun + +\def\pdfsynctracer#1% + {\ifcase\pdfsynctracemode\else + \ifcase\pdfsyncstate\else + \begingroup + \forgetall + \disablepdfsync + \ifcase\pdfsynctracemode\or % could be done more efficient, box around ifcase + \setbox\scratchbox\hbox to \zeropoint{\hss\infofont#1\hss}% 1 + \else + \setbox\scratchbox\hbox to \zeropoint{\hss\traceboxplacementtrue\boxcursor\hss}% 2/3/4 + \fi + \smashbox\scratchbox\box\scratchbox + \ifcase\pdfsynctracemode\or\or\or + \setbox\scratchbox\hbox to \zeropoint{\hss\raise1.25ex\hbox{\infofont#1}\hss}% 3 + \smashbox\scratchbox\box\scratchbox + \or + \setbox\scratchbox\hbox to \zeropoint{\hss\lower1.25ex\hbox{\infofont#1}\hss}% 4 + \smashbox\scratchbox\box\scratchbox + \fi + \endgroup + \fi + \fi} + +% \def\pdfsynctracer#1% more efficient but unreadable +% {\ifcase\pdfsynctracemode\else +% \ifcase\pdfsyncstate\else +% \begingroup +% \forgetall +% \disablepdfsync +% \setbox\scratchbox\hbox to \zeropoint +% {\hss +% \ifcase\pdfsynctracemode\or +% \infofont#1% 1 +% \else +% \traceboxplacementtrue\boxcursor% 2/3/4 +% \fi +% \hss}% +% \smashbox\scratchbox\box\scratchbox +% \setbox\scratchbox\hbox to \zeropoint +% {\hss +% \ifcase\pdfsynctracemode\or\or\or +% \raise1.25ex\hbox{\infofont#1}% 3 +% \or +% \lower1.25ex\hbox{\infofont#1}% 4 +% \fi +% \hss}% +% \smashbox\scratchbox\box\scratchbox +% \endgroup +% \fi +% \fi} + +\protect + +\doifnotmode{demo}{\endinput} + +\chardef\pdfsynctracemode=3 + +\starttext + +\chapter{Test} + +\processfile{tufte} + +\startitemize +\item first +\item second +\stopitemize + +\processfile{tufte} + +\startlines +some local \pdfsync sync and \pdfsynctext{here}a marked point +some local \pdfsync sync and \pdfsyncnode{here}a marked point +\stoplines + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-pictex.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-pictex.mkii new file mode 100644 index 00000000000..e27bf63158a --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-pictex.mkii @@ -0,0 +1,239 @@ +%D \module +%D [ file=m-pictex, +%D version=1997.01.15, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\PICTEX\ Loading Macros, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module is one big hack. This hack is not needed when +%D using \ETEX, so there we simply load \PICTEX\ and quit. + +%D Not every package defines \type{\fiverm}, \PICTEX's pixel, +%D so let's take care of that omision here. The actual loading +%D of \PICTEX\ depends on the package. For \LATEX\ users we +%D take care of loading the auxiliary ones too. + +\def\loadpictex + {\ifx\grid\undefined \else \let\normalgrid\grid \fi + \ifx\axis\undefined \else \let\normalaxis\axis \fi + \ifx\undefined\fiverm + \font\fiverm=cmr5 + \fi + \ifx\beginpicture\undefined + \ifx\newenvironment\undefined + \loadmarkfile{thrd-pic}% + \else + \input prepictex.tex \relax + \input pictex.tex \relax + \input postpictex.tex \relax + \fi + \fi + \ifx\normalgrid\undefined \else + \let\pictexgrid\grid + \let\grid\normalgrid + \fi + \ifx\normalaxis\undefined \else + \let\pictexaxis\axis + \let\axis\normalaxis + \fi} + +\ifx\eTeXversion\undefined \else \loadpictex \expandafter \endinput \fi + +%D When not in \ETEX\ and not in \CONTEXT, we load a few +%D auxiliary macros. + +\ifx \undefined \writestatus \input supp-mis.tex \relax \fi + +\unprotect + +%D \TEX\ provides 256 \DIMENSIONS\ and 256 \SKIPS. In \CONTEXT\ +%D this is no problem, but in packages that have many +%D authors, one can be quite sure that a lot of \DIMENSIONS\ are +%D allocated. Packages that use \PICTEX\ can therefore run out +%D of \DIMENSIONS\ quite fast. This module was written as a +%D reaction to persistent problems with loading \PPCHTEX\ in +%D \LATEX\ and \PICTEX\ deserves a solution. I therefore +%D dedicate this module to Tobias Burnus and Dirk Kuypers, who +%D use \PPCHTEX\ in a \LATEX\ environment and suggested a lot +%D of extensions to the repertoire of \PPCHTEX\ commands. +%D +%D This module presents a solution that is quite effective: all +%D \DIMENSIONS\ are drawn from the pool of \DIMENSIONS\ and +%D \SKIPS, depending on the availability. This is possible +%D because \DIMENSIONS\ are \SKIPS\ without a glue component. +%D Therefore we can use \SKIPS\ as \DIMENSIONS. However, some +%D incompatibility can result from assignments that look like: +%D +%D \starttyping +%D \somedimen=\someskip +%D \stoptyping +%D +%D In such cases the \DIMENSION\ equals the fixed part of the +%D \SKIP\ or in other words: this assignment strips off the +%D glue. Because \PICTEX\ uses no glue components, I thought +%D I could interchange both register types without problems, +%D but alas, this didn't hold for all \DIMENSIONS. + +%D In \PLAIN\ \TEX\ the allocation macros are defined with (as) +%D \type{\outer}. This means that they cannot appear inside +%D macros, not even in an indirect way. We therefore have to +%D redefine both \type{\newdimen} and \type{\newskip} to +%D non||\type{\outer} alternatives. In most macro packages this +%D redefinition already took place. We save the original +%D meanings, so we can restores them afterwards. + +% \def\temporarynewdimen {\alloc@1\dimen\dimendef\insc@unt} +% \def\temporarynewskip {\alloc@2\skip \skipdef \insc@unt} + +\let\normalnewdimen \newdimen +\let\normalnewskip \newskip + +\let\temporarynewdimen\newdimen +\let\temporarynewskip \newskip + +%D Here comes the trick. Depending on how many \DIMENSIONS\ and +%D \SKIPS\ are allocated, the \type{\newdimen} assigns a +%D \DIMENSIONS\ or \SKIP. \PLAIN\ \TEX\ allocates 15 \DIMENSIONS\ +%D and 17 \SKIPS. After loading \PICTEX, 71 \DIMENSIONS\ and +%D and 71 \SKIPS\ are allocated. Indeed, \PICTEX\ needs 110 +%D \DIMENSIONS ! +%D +%D \starttyping +%D \def\newdimen +%D {\ifnum\count11>\count12 +%D \let\next\temporarynewskip +%D \else +%D \let\next\temporarynewdimen +%D \fi +%D \next} +%D \stoptyping +%D +%D When I was testing a new version of \PPCHTEX\ in \PLAIN\ +%D \TEX\ I had to find out that this exchange of registers +%D sometimes leads to unwanted results. It took me some hours +%D to find out that the source of errors originated in +%D constructions like: +%D +%D \starttyping +%D \ifdim\DimenOne<\DimenTwo whatever you want \else or not \fi +%D \stoptyping +%D +%D When \type{\DimenOne} is a \SKIP\ and \type{\DimenTwo} is a +%D \DIMENSION, \TEX\ scans for some optional glue component, +%D like in: +%D +%D \starttyping +%D \skip0=\dimen0 plus 10pt minus 5pt +%D \stoptyping +%D +%D The most robust solution to this problem is: +%D +%D \starttyping +%D \ifdim\DimenOne<\DimenTwo\relax right \else wrong \fi +%D \stoptyping +%D +%D Some close reading of the \PICTEX\ source however learned me +%D that this problem could be solved best by just honoring the +%D allocation of \DIMENSIONS\ when the name of the macro +%D explictly stated the character sequence \type{dimen}. A next +%D implementation therefore automatically declared all +%D \DIMENSIONS\ with this sequence in their names with +%D \type{\dimen}. Again I was too optimistic, so now we do it +%D this way (the comments are from \PICTEX, which like \TABLE, +%D is an example of a well documented package): + +\temporarynewdimen\!dimenA %.AW.X.DVEUL..OYQRST +\temporarynewdimen\!dimenB %....X.DVEU...O.QRS. +\temporarynewdimen\!dimenC %..W.X.DVEU......RS. +\temporarynewdimen\!dimenD %..W.X.DVEU....Y.RS. +\temporarynewdimen\!dimenE %..W........G..YQ.S. +\temporarynewdimen\!dimenF %...........G..YQ.S. +\temporarynewdimen\!dimenG %...........G..YQ.S. +\temporarynewdimen\!dimenH %...........G..Y..S. +\temporarynewdimen\!dimenI %...BX.........Y.... +\temporarynewdimen\!dxpos %..W......U..P....S. +\temporarynewdimen\!dypos %..WB.....U..P...... +\temporarynewdimen\!xloc %..WB.....U.......S. +\temporarynewdimen\!xpos %..........L.P..Q.ST +\temporarynewdimen\!yloc %..WB.....U.......S. +\temporarynewdimen\!ypos %..........L.P..Q.ST +\temporarynewdimen\!zpt %.AWBX.DVEULGP.YQ.ST + +%D Tobias tested this module in all kind of \LATEX\ dialects +%D so we were able to find out that we also needed to declare: + +\temporarynewdimen\linethickness + +%D After all, the new definition of \type{\newdimen} became: + +\def\newdimen#1% + {\ifx#1\undefined + \ifnum\count11>\count12\relax + \temporarynewskip#1\relax + \else + \temporarynewdimen#1\relax + \fi + %\edef\ascii{\meaning#1}% + %\immediate\write20{\string#1 becomes \ascii}% + \else + %\edef\ascii{\meaning#1}% + %\immediate\write20{\string#1 already is \ascii}% + \fi} + +% This macro is as unreadable, inefficient and as compact as +% can be, but uses no extra hash entries, which sometimes are +% scarce too. A more readable alternative, that also takes +% explicit \SKIPS\ into account, is included in the source. +% +% \def\doifregisterpreferenceelse#1#2#3#4% +% {\def\dodoifregisterpreferenceelse##1#1##2##3\war{\if##2@}% +% \expandafter\dodoifregisterpreferenceelse\string#2#1@@\war +% #4% +% \else +% #3% +% \fi} +% +% \def\newdimen#1% +% {\bgroup +% \escapechar=-1 +% \expandafter\doifregisterpreferenceelse\expandafter{\string\dimen}#1 +% {\egroup +% \temporarynewdimen#1} +% {\expandafter\doifregisterpreferenceelse\expandafter{\string\skip}#1 +% {\egroup +% \temporarynewskip#1} +% {\egroup +% \ifnum\count11>\count12 +% \temporarynewskip#1\relax +% \else +% \temporarynewdimen#1\relax +% \fi}}} + +%D Curious readers can still find the previous solution in +%D the source. The next macro is used instead of +%D \type{\input}. This macro also reports some statistics. + +\def\dimeninput#1 % + {\message{[before: d=\the\count11,s=\the\count12]}% + \input #1 \relax + \message{[after: d=\the\count11,s=\the\count12]}}% + +%D Now we can load \PICTEX: + +\loadpictex + +%D Finally we restore the old definitions of \type{\newdimen} +%D and \type{\newskip}: + +\let\newdimen=\normalnewdimen +\let\newskip =\normalnewskip + +%D and just hope for the best. + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-pstricks.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-pstricks.mkii new file mode 100644 index 00000000000..d41f1987118 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-pstricks.mkii @@ -0,0 +1,127 @@ +%D \module +%D [ file=m-pstricks, +%D version=1997.01.15, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\PSTRICKS\ Connections, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% pstricks is not supported in context mkii (it's no problem doing that +% but as we also need to support latex it would become quite messy so for +% context we use metapost and for latex pstricks) + +%M \usemodule[pstric] + +\letvalue{@unused}\plussixteen +\letvalue{alloc@}\gobblefivearguments + +\chardef\oldbarcode\the\catcode`\| \catcode`\|=12 + +\def\loadpstrickscolors#1% + {\pushmacro\dodefinecolor + \pushmacro\dodefinepalet + \pushmacro\dodefinecolorgroup + \def\dodefinecolor[##1][##2]% + {\doifassignmentelse{##2} + {\getparameters[pstricks][r=0,g=0,b=0,##2]% + \expanded{\newrgbcolor{##1}{{\pstricksr} {\pstricksg} {\pstricksb}}}}% + {}}% + \def\dodefinepalet [##1][##2]{}% + \def\dodefinecolorgroup[##1][##2][##3]{}% + \writestatus{pstricks}{loading colors from #1}% + \input #1 \relax + \popmacro\dodefinecolorgroup + \popmacro\dodefinepalet + \popmacro\dodefinecolor} + +\doifelse{\jobsuffix}{dvi} + {\input multido \relax + \input pstricks \relax + \input pst-plot \relax + \loadpstrickscolors{colo-rgb.mkii}} + {\writestatus{pstricks}{using indirect method; enable write18}} + +\catcode`\|=\oldbarcode + +\def\loadpstricksmodule[#1]% + {\chardef\oldbarcode\the\catcode`\| + \catcode`\|=12 + \readfile{#1}{}{}% + \catcode`\|=\oldbarcode} + +%D The next piece of code is for John Culleton who suggested to +%D handle \PSTRICKS\ in a similar fashion as \METAPOST, i.e.\ +%D using a child process. For the moment there is no support +%D for passing environments, so these should be called +%D explicitly inside this environment. + +\unprotect + +%D \startPSTRICKS[offset=2pt] ... \stopPSTRICKS +%D +%D works in both dvi and pdf mode +%D +%D % \usemodule[pstric] +%D +%D \startPSTRICKS +%D \pspicture(0,0)(10,10) +%D \dorecurse{10}{\psline(0,0)(\recurselevel,10)} +%D \dorecurse{10}{\psline(0,0)(10,\recurselevel)} +%D \endpspicture +%D \stopPSTRICKS + +\def\startPSTRICKS + {\dosingleempty\dostartPSTRICKS} + +% \ifx\startTEXapplication\undefined +% +% \long\def\dostartPSTRICKS[#1]#2\stopPSTRICKS +% {\doifelse{\jobsuffix}{dvi} +% {#2} +% {\bgroup +% \setbuffer[pstricks]% +% \usemodule[pstric]% +% \setbox\scratchbox\hbox{#2}% +% % There is probably a nicer way to handle this +% \immediate\openout\scratchwrite=\bufferprefix dim.tmp +% \immediate\write\scratchwrite{\dimen0=\the\ht\scratchbox}% +% \immediate\write\scratchwrite{\dimen2=\the\wd\scratchbox}% +% \immediate\closeout\scratchwrite +% % Quick and dirty +% \startTEXpage[#1]\box\scratchbox\stopTEXpage +% \endbuffer +% % Here we go! +% %\immediate\write18{texexec \bufferprefix pstricks.tmp --once --batch}% +% %\immediate\write18{dvips -G0 -Ppdf \bufferprefix pstricks -o}% +% %\immediate\write18{ps2pdf \bufferprefix pstricks.ps \bufferprefix pstricks.pdf}% +% \executesystemcommand{texexec \bufferprefix pstricks.tmp --once --batch}% +% \executesystemcommand{dvips -G0 -Ppdf \bufferprefix pstricks -o}% +% \executesystemcommand{texmfstart pstopdf \bufferprefix pstricks.ps \bufferprefix pstricks.pdf}% +% % We pick up the dimensions from the scratch file. +% \readlocfile{\bufferprefix pstricks-dim.tmp}{}{}% +% % Since the graphic is put on a page (sigh) by dvips/gs +% % we need to shift it around a bit. +% \setbox\scratchbox\hbox +% {\externalfigure[\bufferprefix pstricks.pdf][\c!object=\v!no]}% +% \setbox\scratchbox\hbox +% {\lower\ht\scratchbox\hbox{\raise\dimen2\box\scratchbox}}% +% \wd\scratchbox\dimen0 +% \ht\scratchbox\dimen2 +% \dp\scratchbox\zeropoint +% \box\scratchbox +% \egroup}} +% +% \fi + +\long\def\dostartPSTRICKS[#1]#2\stopPSTRICKS + {\doifelse{\jobsuffix}{dvi} % will some day move to app as switch + {\hbox{#2}} +% {\startTEXapplication[#1]{\usemodule[pstric]}#2\stopTEXapplication}} + {\startTEXapplication[#1]{}#2\stopTEXapplication}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-r.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-r.mkii new file mode 100644 index 00000000000..c2cb7ba8816 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-r.mkii @@ -0,0 +1,174 @@ +%D \module +%D [ file=m-r, +%D version=2006.06.06, +%D title=\CONTEXT\ Modules, +%D subtitle=R Support, +%D author={Johan Sandblom \& Hans Hagen}, +%D date=\currentdate, +%D copyright={Johan Sandblom \& Hans Hagen}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D The following R-processor is a variation on Johan Sandblom's +%D prototype. +%D +%D We can combine both variants in one macro definition. Also, we +%D can minimize the number of runs by checking for a change. + +%D JS: The call to R has \type {-q} in order to prevent banner, +%D \type {--save} to make sure it saves the workspace after the run, +%D \type {--restore} to make sure it reads any workspace from a +%D previous session. + +%D An easier and better solution is to use the buffering mechanisms: + +\def\Rbufferprefix{r-} + +\newcounter\nofRfiles + +\def\Rfile{\TEXbufferfile{\Rbufferprefix\nofRfiles}} + +\def\startR + {\doglobal\increment\nofRfiles + \dostartbuffer[\Rbufferprefix\nofRfiles][startR][stopR]} + +\def\stopR + {\doifmode{*\v!first}\runR + \typefile{\Rfile.out}} + +\def\startRhidden + {\doglobal\increment\nofRfiles + \dostartbuffer[\Rbufferprefix\nofRfiles][startRhidden][stopRhidden]} + +\def\stopRhidden + {\doifmode{*\v!first}\runR} + +\def\runR + {\executesystemcommand{texmfstart + --ifchanged=\Rfile\space --direct R + CMD BATCH -q --save --restore \Rfile\space \Rfile.out}} + +\protect \doifnotmode{demo}{\endinput} + +% Johan's test file: + +\usemodule[r] + +\def\R{R} + +\setupcolors[state=start] + +\setuptyping + [Rtype] + [color=darkgreen] + +\starttext + +First a test of whether the workspace is persistent: +bla + +\startR +a <- "bla" +b <- "blabla" +ls() +\stopR + +One \R run ends, another begins. + +\startR +ls() +\stopR + +Now follows a hidden \R run which cleans the R workspace + +\startRhidden +rm(list=ls()) +save.image() +\stopRhidden + +What is in the workspace now? + +\startR +ls() +\stopR + +Then a small test of generating a graphic, in this case a pdf +\startR +ushape <- c(rexp(500000), 12-rexp(500000)) +pdf("ushape.pdf") +par(mfrow=c(1,2)) +hist(ushape) +plot(density(ushape), main="Density") +dev.off() +\stopR + +The graphic \type{ushape.pdf} can be included in the standard \CONTEXT\ way +\startbuffer +\placefigure{An ugly distribution}{\externalfigure[ushape]} +\stopbuffer +\typebuffer +\getbuffer + +\startR +x <- rnorm(900) +y <- rexp(900) +# test comment +f <- gl(9,9,900) +summary(aov(y~x+Error(f))) +library(lattice) +pdf("lattice.pdf") +xyplot(y~x|f) +dev.off() +\stopR + +With \type{Sweave} lattice graphics calls must be enclosed in +\type{print()} statements but that is not necessary here. + +\startbuffer +\placefigure[here]{Lattice graphics}{\externalfigure[lattice]} +\stopbuffer +\typebuffer +\getbuffer + +A test string with nasty characters. In \R, the result of a statement +is not printed by default. Enclosing the statement in parentheses, +however causes the parser to see only the value of the statement and +applying the \type{print()} method. +\startR +(test <- ".*\\\\ [[{[{]{[{[{}\]\}=?!+%#|<|>@$") +cat(test) +\stopR + +A combination +\startbuffer +\placefigure{A combination of two previously used graphics}{ +\startcombination[2*1] + {\externalfigure[ushape][width=.4\textwidth]}{The first graphic, rescaled} + {\externalfigure[lattice][width=.4\textwidth]}{The second graphic, rescaled}} +\stopcombination +\stopbuffer +\typebuffer +\getbuffer + +Testing a function definition. + +\startR +a.df <- data.frame(a=1:2, b=rnorm(2)) +a.df$a +testfunction <- function(a=NULL, ...) { + for(i in 1:length(a)) { + gsub(a[[i]], "([a-r]|[A-R])", "bla")} + print(a)} +\stopR + +What is in the workspace now? + +\startR +ls() +\stopR + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-steps.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-steps.mkii new file mode 100644 index 00000000000..e6bd45548c3 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-steps.mkii @@ -0,0 +1,837 @@ +%D \module +%D [ file=m-steps, +%D version=2001.05.28, +%D title=\CONTEXT\ Modules, +%D subtitle=Step Charts \& Tables, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D When I need this module, I will reimplement it by using the new +%D sometxt macro. Anyhow, it reflects the state of 2001. + +\unprotect + +% temp hack : + +% \ifx\v!kleinkorps\undefined \let\v!kleinkorps\setsmallbodyfont \fi + +% end of hack + +\definecolor [STEPlinecolor] [s=.5] +\definecolor [STEPframecolor] [s=.7] +\definecolor [STEPbackgroundcolor] [s=.9] + +\def\@@STPF{@@STPF} % frames + +\def\@@STPC{@@STPC} % charts +\def\@@STPT{@@STPT} % tables + +\def\@@STEC{@@STEC} % cells +\def\@@STET{@@STET} % tables +\def\@@STEL{@@STEL} % lines + +\def\setupSTEPcharts{\dodoubleargument\getparameters[\@@STPC]} +\def\setupSTEPtables{\dodoubleargument\getparameters[\@@STPT]} +\def\setupSTEPcells {\dodoubleargument\getparameters[\@@STEC]} +\def\setupSTEPtexts {\dodoubleargument\getparameters[\@@STET]} +\def\setupSTEPlines {\dodoubleargument\getparameters[\@@STEL]} + +\setupSTEPcharts + [\c!before=\blank, + \c!after=\blank, + %\c!distance=.25em, % nvt + \c!hoffset=1em, + \c!voffset=1ex, + \c!method=1, + \c!height=2ex, + \c!offset=.15\bodyfontsize] + +\setupSTEPtables + [\c!before=\blank, + \c!after=\blank, + \c!distance=.25em, + %\c!hoffset=1em, % nvt + \c!voffset=1ex, + \c!method=1, + \c!width=4em, + \c!offset=.15\bodyfontsize] + +\setupSTEPcells + [\c!alternative=24, + \c!background=\v!color, + \c!backgroundcolor=STEPbackgroundcolor, + \c!rulethickness=.1\bodyfontsize, + \c!framecolor=STEPframecolor, + \c!offset=.25\bodyfontsize, + \c!style=, + \c!color=] + +\setupSTEPtexts + [\c!alternative=24, + \c!background=\v!color, + \c!backgroundcolor=STEPbackgroundcolor, + \c!rulethickness=.1\bodyfontsize, + \c!framecolor=STEPframecolor, + \c!offset=.25\bodyfontsize, + \c!style=\v!smallbodyfont, + \c!color=] + +\setupSTEPlines + [\c!alternative=1, + \c!rulethickness=.15\bodyfontsize, + \c!color=STEPlinecolor] + +\def\initializeSTEP + {\initializeSTET \initializeSTEC \initializeSTEL} + +\def\initializeSTPC + {\freezedimenmacro\@@STPCoffset + \startMPdrawing + line_v_offset := \@@STPCoffset ; + line_method := \@@STPCmethod ; % only charts + \stopMPdrawing} + +\def\initializeSTPT + {\freezedimenmacro\@@STPToffset + \startMPdrawing + line_h_offset := \@@STPToffset ; + line_method := \@@STPTmethod ; % only charts + \stopMPdrawing} + +\def\initializeSTET + {\freezedimenmacro\@@STETrulethickness + \freezedimenmacro\@@STEToffset} + +\def\initializeSTEC + {\freezedimenmacro\@@STECrulethickness + \freezedimenmacro\@@STECoffset} + +\def\initializeSTEL + {\freezedimenmacro\@@STELrulethickness} + +%D ... + +\presetlocalframed[\@@STPF] + +\def\@@stepcell#1% + {\doattributes\@@STEC\c!style\c!color + {\localframed + [\@@STPF][\c!offset=\@@STECoffset,\c!frame=\v!off] + {\ignorespaces#1\unskip}}} + +\def\@@stepfake#1% + {\doattributes\@@STEC\c!style\c!color + {\ignorespaces#1\unskip}} + +\def\@@steptext#1% + {\doattributes\@@STET\c!style\c!color + {\localframed + [\@@STPF][\c!offset=\@@STEToffset,\c!frame=\v!off] + {\ignorespaces#1\unskip}}} + +%D The first attempt was purely \METAPOST\ based and spawned +%D the typesetting to the \METAFUN\ handler. This method +%D collects the cells, and directly passes them on to +%D \METAPOST. This method is the cleanest, but has the +%D disadvantage that one cannot embed hyperlinks or document +%D dependent definitions in the cells. The implementation +%D roughly looks as follows: +%D +%D \starttyping +%D \def\startSTEPchart% +%D {\bgroup +%D \startMPdrawing +%D input mp-step.mpii ; begin_step_chart ; +%D \stopMPdrawing +%D \initializeSTEP +%D \let\cells\stepchartcells \def\cell{\cells{}}% +%D \let\texts\stepcharttexts \def\text{\texts{}}} +%D +%D \def\stepchartcells#1#2% +%D {\setMPtext{tdummy}{\strut\ignorespaces#1\unskip}% beter etex/btex +%D \setMPtext{bdummy}{\strut\ignorespaces#2\unskip}% beter etex/btex +%D \startMPdrawing +%D set_step_chart_cells(\MPstring{tdummy},\MPstring{bdummy}) ; +%D \stopMPdrawing} +%D +%D \def\stepcharttexts#1#2% +%D {\setMPtext{tdummy}{\strut\ignorespaces#1\unskip}% beter etex/btex +%D \setMPtext{bdummy}{\strut\ignorespaces#2\unskip}% beter etex/btex +%D \startMPdrawing +%D set_step_chart_texts(\MPstring{tdummy},\MPstring{bdummy}) ; +%D \stopMPdrawing} +%D +%D \def\stopSTEPchart +%D {\startMPdrawing +%D end_step_chart ; +%D \stopMPdrawing +%D \MPdrawingdonetrue +%D \getMPdrawing +%D \resetMPdrawing +%D \egroup} +%D \stoptyping +%D +%D This method has the advantage that it does the job in +%D (virtually) one pass, while the next methods need multiple +%D passes: one to build the table, another to synchronize the +%D positions, and a third one beause the dimensions may have +%D changed. The last pass is a result from the fact that +%D positions are related to the page. +%D +%D The second attempt was based on tabulations and used the +%D build in position tracking mechanism, which uses two +%D position nodes per cell. +%D +%D This method collects the content in token list registers +%D and build a table from them. In the collecting pass, the +%D graphics are build stepwise. We need to collect because the +%D order of definitions is not the same as the order of +%D typesetting. We show this alternative too because it +%D demonstrates how to apply backgrounds to table cells. +%D +%D \starttyping +%D \newtoks\stepsonetop \newtoks\stepstwotop +%D \newtoks\stepsonebot \newtoks\stepstwobot +%D \stoptyping +%D +%D During the collecting phase, we temporarily have to +%D increment the name space counter. +%D +%D \starttyping +%D \def\startSTEPchart% +%D {\bgroup +%D \resetMPdrawing +%D \advance\noftabpositions\plusone % begin of preroll +%D \startMPdrawing +%D input mp-step.mpii ; +%D begin_step_chart ; +%D \stopMPdrawing +%D \initializeSTEP +%D \newcounter\cellcounter +%D \stepsonetop\emptytoks \chardef\somesteponetop=1 +%D \stepsonebot\emptytoks \chardef\somesteponebot=1 +%D \stepstwotop\emptytoks \chardef\somesteptwotop=1 +%D \stepstwobot\emptytoks \chardef\somesteptwobot=1 +%D \let\cells\stepchartcells \def\cell{\cells{}}% +%D \let\texts\stepcharttexts \def\text{\texts{}}} +%D \stoptyping +%D +%D Now we collect the steps and texts, and in the process the +%D graphic is built. Then we continue with building the table. +%D +%D Watch how we anchor the graphic to the main table box. This +%D is needed since the graphic may be larger than the table +%D itself. Actually, these small point took me the most time to +%D digest, even with the right tools (anchors) already in +%D place. +%D +%D \starttyping +%D \def\stopSTEPchart +%D {\splittabulatefalse +%D \insidefloattrue +%D \startMPdrawing +%D nofcells := \cellcounter ; +%D end_step_chart ; +%D anchor_box(\MPpos{\tbPOSprefix origin}) ; +%D \stopMPdrawing +%D \MPdrawingdonetrue +%D \advance\noftabpositions\minusone % end of preroll +%D \setbox0=\vbox +%D {\getMPdrawing} +%D \resetMPdrawing +%D \increment(\cellcounter,\cellcounter)\decrement\cellcounter +%D \setbox2=\vbox +%D {\definetabulate[chart][|*{\cellcounter}{ck0|}] % k0 nills space +%D \startchart +%D \ifcase\somesteptwotop \the\stepstwotop \NC \NR \noalign{\kern2ex} \fi +%D \ifcase\somesteponetop \the\stepsonetop \NC \NR \noalign{\kern2ex} \fi +%D \ifcase\somesteponebot \the\stepsonebot \NC \NR \noalign{\kern2ex} \fi +%D \ifcase\somesteptwobot \the\stepstwobot \NC \NR \noalign{\kern2ex} \fi +%D \noalign{\kern-2ex}% +%D \stopchart} +%D \hbox +%D {\scratchdimen\wd0 +%D \advance\scratchdimen \MPllx bp +%D \raise\MPlly bp\box0 +%D \hskip-\scratchdimen +%D \hpos{\tbPOSprefix origin}{\box2}} +%D \egroup} +%D \stoptyping +%D +%D The steps and texts fill the (at most 4) lines that make up +%D the table. We also feed the (automatically registerd) cell +%D dimensions to the graphic backend. +%D +%D \starttyping +%D \newcounter\cellcounter +%D \newcounter\textcounter +%D +%D \def\stepchartcells#1#2% +%D {\doloop +%D {\ifnum\cellcounter>\textcounter +%D \stepcharttexts{}{}% +%D \else +%D \exitloop +%D \fi}% +%D \increment\cellcounter +%D \doifelsenothing{#1} +%D {\startMPdrawing +%D cells[t][\cellcounter] := origin ; +%D \stopMPdrawing +%D \appendtoks\NC\NC\to\stepsonetop} +%D {\chardef\somesteponetop=0 +%D \edef\stepidentifier{\cellcounter-t-c}% +%D \startMPdrawing +%D initialize_area(\MPpos{b:\tbPOSprefix\stepidentifier}, +%D \MPpos{e:\tbPOSprefix\stepidentifier}) ; +%D cells[t][\cellcounter] := pxy ; +%D \stopMPdrawing +%D \@EA\appendtoks\@EA\stepidentifierposition\@EA{\stepidentifier}#1\NC\to\stepsonetop}% +%D \doifelsenothing{#2} +%D {\startMPdrawing +%D cells[b][\cellcounter] := origin ; +%D \stopMPdrawing +%D \appendtoks\NC\NC\to\stepsonebot} +%D {\chardef\somesteponebot=0 +%D \edef\stepidentifier{\cellcounter-b-c}% +%D \startMPdrawing +%D initialize_area(\MPpos{b:\tbPOSprefix\stepidentifier}, +%D \MPpos{e:\tbPOSprefix\stepidentifier}) ; +%D cells[b][\cellcounter] := pxy ; +%D \stopMPdrawing +%D \@EA\appendtoks\@EA\stepidentifierposition\@EA{\stepidentifier}#2\NC\to\stepsonebot}} +%D +%D \def\stepcharttexts#1#2% \cellcounter = nofcells +%D {\increment\textcounter +%D \doifelsenothing{#1} +%D {\startMPdrawing +%D texts[t][\cellcounter][\textcounter] := origin ; +%D \stopMPdrawing +%D \appendtoks\NC\NC\to\stepstwotop} +%D {\chardef\somesteptwotop=0 +%D \edef\stepidentifier{\cellcounter-\textcounter-t-t}% +%D \startMPdrawing +%D initialize_area(\MPpos{b:\tbPOSprefix\stepidentifier}, +%D \MPpos{e:\tbPOSprefix\stepidentifier}) ; +%D texts[t][\cellcounter][\textcounter] := pxy ; +%D \stopMPdrawing +%D \@EA\appendtoks\@EA\NC\@EA\textcellposition\@EA{\stepidentifier}#1\to\stepstwotop}% +%D \doifelsenothing{#2} +%D {\startMPdrawing +%D texts[b][\cellcounter][\textcounter] := origin ; +%D \stopMPdrawing +%D \appendtoks\NC\NC\to\stepstwobot} +%D {\chardef\somesteptwobot=0 +%D \edef\stepidentifier{\cellcounter-\textcounter-b-t}% +%D \startMPdrawing +%D initialize_area(\MPpos{b:\tbPOSprefix\stepidentifier}, +%D \MPpos{e:\tbPOSprefix\stepidentifier}) ; +%D texts[b][\cellcounter][\textcounter] := pxy ; +%D \stopMPdrawing +%D \@EA\appendtoks\@EA\NC\@EA\textcellposition\@EA{\stepidentifier}#2\to\stepstwobot}} +%D \stoptyping +%D +%D Here are the hooks that take care of calculating the cell +%D dimensions. +%D +%D \starttyping +%D \def\textcellposition#1{\GSC[#1:text]} +%D \def\stepidentifierposition#1{\GSC[#1:step]} +%D \stoptyping +%D +%D We abandoned this method after some testing and went for +%D a third one. It was this third method that evolved into the +%D current mechanism. +%D +%D Since this method was not that efficient, a third one was +%D implemented, which used one position per cell. So, +%D +%D \blank {\bf Here starts the real implementation!} \blank +%D +%D Because we want to build one graphic only we need to store +%D the graphic directives. We also need to collect the cells, +%D which are not defined in the order they show up. This +%D solution uses multiple passes over the definitions. First +%D the cells and texts are processed and the associated +%D graphics are defined in the \METAPOST\ file. Next the +%D lines are flushed. We need to do that in a second pass, +%D because in order to determine the nature of the line, +%D \METAPOST\ needs to know if the start and end cells exist. +%D This need comes from the fact that we store the shapes +%D and lines kind of directly with their associated colors and +%D types, so that we can change the settings in between. So, +%D changing for instance the line color, can take place +%D locally. + +\newbox\stepboxone \newbox\stepboxtwo +\newbox\textboxone \newbox\textboxtwo + +%D We need to define a dedicated name space counter. + +\newcounter\currentstepchart + +\def\stepchartprefix{@sc@-\currentstepchart-} + +%D Next we define the initialization part of the macros. + +\newcounter\cellcounter +\newcounter\textcounter + +\def\startSTEPchart + {\dosingleempty\dostartSTEPchart} + +\long\def\dostartSTEPchart[#1]#2\stopSTEPchart + {\ifinsidefloat + \else + \whitespace + \@@STPCbefore + \startbaselinecorrection + \setlocalhsize + \noindent + \fi + \vbox\bgroup + \setupSTEPcharts[#1]% + \forgetall + \pushMPdrawing + \resetMPdrawing + \doglobal\increment\currentstepchart + \startMPdrawing + input mp-step.mpii ; + begin_step_chart ; + \stopMPdrawing + \initializeSTEP + \initializeSTPC + \global\chardef\somestepboxone\plusone + \global\chardef\sometextboxone\plusone + \global\chardef\somestepboxtwo\somestepboxone + \global\chardef\sometextboxtwo\sometextboxone + \def\startlines{\bgroup\setupSTEPlines}% + \def\stoplines {\egroup}% + \def\cells{\dosingleempty\dostepchartcells} + \def\texts{\dosingleempty\dostepcharttexts} + \def\cell {\dosingleempty\docell}% + \def\text {\dosingleempty\dotext}% + \def\docell[##1]{\dostepchartcells[##1]{}}% + \def\dotext[##1]{\dostepcharttexts[##1]{}} + \doglobal\newcounter\cellcounter + \doglobal\newcounter\textcounter + \let\dostepchartcells\doSTEPchartcellsA + \let\dostepcharttexts\doSTEPcharttextsA + {#2} % pass one: cells and texts {} keeps setting local + \startMPdrawing + nofcells := \cellcounter ; + analyze_step_chart ; + \stopMPdrawing + \doglobal\newcounter\cellcounter + \doglobal\newcounter\textcounter + \let\dostepchartcells\doSTEPchartcellsB + \let\dostepcharttexts\doSTEPcharttextsB + {#2} % pass two: lines + \startMPdrawing + end_step_chart ; + % if box_found(\MPpos{\stepchartprefix origin}) : + % initialize_box(\MPpos{\stepchartprefix origin}) ; + % draw pxy ; + % fi ; + anchor_box(\MPpos{\stepchartprefix origin}) ; + \stopMPdrawing + \MPdrawingdonetrue + \doifelse\@@STPCmethod{0} + {\setbox0\null} + {\setbox0\vbox{\MPstaticgraphictrue\getMPdrawing}}% + \resetMPdrawing + \setbox2\vbox + {\offinterlineskip + \scratchdimen\@@STPCheight + \advance\scratchdimen\@@STPCoffset + \advance\scratchdimen\@@STPCoffset + \ifcase\sometextboxone \box\textboxone \vskip\scratchdimen \fi + \ifcase\somestepboxone \box\stepboxone \vskip\@@STPCvoffset \fi + \ifcase\somestepboxtwo \box\stepboxtwo \vskip\scratchdimen \fi + \ifcase\sometextboxtwo \box\textboxtwo \vskip\@@STPCvoffset \fi + \global\setbox\stepboxone\emptybox \global\setbox\stepboxtwo\emptybox % needed indeed + \global\setbox\textboxone\emptybox \global\setbox\textboxtwo\emptybox % needed indeed + %\kern-\scratchdimen % no, instead: + \vskip-\lastskip} + \hbox + {\scratchdimen\wd0 + \advance\scratchdimen \MPllx bp + \raise\MPlly bp\box0 + \hskip-\scratchdimen + \hpos{\stepchartprefix origin}{\box2}}% + \popMPdrawing + \egroup + \ifinsidefloat \else \stopbaselinecorrection \@@STPCafter \fi} + +%D The next macro looks more complicated than it is. We collect +%D the cells in boxes. Before adding a new step cell, we padd +%D the text rows. After adding the step cells, we flush text +%D cells that are defined but not yet processed. + +\def\doSTEPchartcellsA[#1]#2#3% + {% synchronize texts + \doSTEPchartcellsAB[#1]{#2}{#3}% + % package steps + \setbox0\hbox{\doifsomething{#2}{\@@stepcell{#2}}}% + \setbox2\hbox{\doifsomething{#3}{\@@stepcell{#3}}}% + \ifdim\wd0>\zeropoint \!!doneafalse \else \!!doneatrue \fi + \ifdim\wd2>\zeropoint \!!donebfalse \else \!!donebtrue \fi + \ifdim\wd0>\wd2 + \setbox2\hbox to \wd0{\hss\box2\hss}% + \else + \setbox0\hbox to \wd2{\hss\box0\hss}% + \fi + \if!!donea + \startMPdrawing + cells[t][\cellcounter] := nullpicture ; + \stopMPdrawing + \else + \global\chardef\somestepboxone\zerocount + \edef\stepidentifier{\stepchartprefix\cellcounter-t-c}% + \setbox0\hbox{\hpos{\stepidentifier}{\box0}}% + \bgroup + \iffirstargument\setupSTEPcells[#1]\fi\initializeSTEC + \startMPdrawing + initialize_box(\MPpos{\stepidentifier}) ; + cells[t][\cellcounter] := \MPcellsgraphic ; + \stopMPdrawing + \egroup + \fi + \if!!doneb + \startMPdrawing + cells[b][\cellcounter] := nullpicture ; + \stopMPdrawing + \else + \global\chardef\somestepboxtwo\zerocount + \edef\stepidentifier{\stepchartprefix\cellcounter-b-c}% + \setbox2\hbox{\hpos{\stepidentifier}{\box2}}% + \bgroup + \iffirstargument\setupSTEPcells[#1]\fi\initializeSTEC + \startMPdrawing + initialize_box(\MPpos{\stepidentifier}) ; + cells[b][\cellcounter] := \MPcellsgraphic ; + \stopMPdrawing + \egroup + \fi + \global\setbox\stepboxone\hbox + {\ifdim\wd\stepboxone>\zeropoint + \box\stepboxone\hskip\@@STPChoffset\else + \fi\box0}% + \global\setbox\stepboxtwo\hbox + {\ifdim\wd\stepboxtwo>\zeropoint + \box\stepboxtwo\hskip\@@STPChoffset\else + \fi\box2}% + % flush saved texts + \doSTEPchartcellsBA} + +\def\doSTEPchartcellsB[#1]#2#3% + {\doSTEPchartcellsAB[#1]{#2}{#3}% + \doSTEPchartcellsBA} + +\def\doSTEPchartcellsAB[#1]#2#3% + {\doloop + {\ifnum\cellcounter>\textcounter + \texts{}{}\else\exitloop + \fi}% + \doglobal\increment\cellcounter} + +\def\doSTEPchartcellsBA + {\scratchtoks\stepchartbuffer + \stepchartbuffer\emptytoks + \the\scratchtoks} + +\def\MPcellsgraphic + {image ( drawshape ( + \@@STECalternative, pxy enlarged (-.5*\@@STECoffset), + \@@STECrulethickness, \MPcolor{\@@STECframecolor}, + \MPcolor{\@@STECbackgroundcolor} ) )} + +%D Although each step can have only one associated text, the +%D place where the text is defined determines the starting +%D point of the connecting arrow. Although several methods are +%D possible, we've chosen a funny collector that flushes one +%D step text at a time. + +\newtoks\stepchartbuffer + +\def\doSTEPcharttextsA[#1]% #2 #3 + {\dodoSTEPcharttextsA{\cellcounter}{#1}} + +\def\dodoSTEPcharttextsA#1#2#3#4% #1=number #2=setup + {\dodoSTEPcharttextsAB{#1}{#2}{#3}{#4}\dodoSTEPcharttextsA + \ifnum\textcounter>\cellcounter\relax + \doglobal\decrement\textcounter\relax + \else + \setbox0\hbox{\doifsomething{#3}{\@@steptext{#3}}}% + \setbox2\hbox{\doifsomething{#4}{\@@steptext{#4}}}% + \ifdim\wd0>\zeropoint \!!doneafalse \else \!!doneatrue \fi + \ifdim\wd2>\zeropoint \!!donebfalse \else \!!donebtrue \fi + \if!!donea + \setbox0\hbox to \@@STPChoffset{\hss}% + \startMPdrawing + texts[t][#1][\textcounter] := nullpicture ; + \stopMPdrawing + \else + \global\chardef\sometextboxone\zerocount + \edef\stepidentifier{\stepchartprefix#1-\textcounter-t-t}% + \setbox0\hbox to \@@STPChoffset + {\hss\hpos{\stepidentifier}{\box0}\hss}% + \bgroup + \setupSTEPtexts[#2]\initializeSTET + \startMPdrawing + initialize_box(\MPpos{\stepidentifier}) ; + texts[t][#1][\textcounter] := \MPtextsgraphic ; + \stopMPdrawing + \egroup + \fi + \if!!doneb + \setbox2\hbox to \@@STPChoffset{\hss}% + \startMPdrawing + texts[b][#1][\textcounter] := nullpicture ; + \stopMPdrawing + \else + \global\chardef\sometextboxtwo\zerocount + \edef\stepidentifier{\stepchartprefix#1-\textcounter-b-t}% + \setbox2\hbox to \@@STPChoffset + {\hss\hpos{\stepidentifier}{\box2}\hss}% + \bgroup + \setupSTEPtexts[#2]\initializeSTET + \startMPdrawing + initialize_box(\MPpos{\stepidentifier}) ; + texts[b][#1][\textcounter] := \MPtextsgraphic ; + \stopMPdrawing + \egroup + \fi + \global\setbox\textboxone\hbox + {\hbox to \wd\stepboxone{\box\textboxone\hss}\box0} + \global\setbox\textboxtwo\hbox + {\hbox to \wd\stepboxtwo{\box\textboxtwo\hss}\box2} + \fi} + +\def\doSTEPcharttextsB[#1]% #2 #3 + {\dodoSTEPcharttextsB{\cellcounter}{#1}} + +\def\dodoSTEPcharttextsB#1#2#3#4% #1=number #2=setup + {\dodoSTEPcharttextsAB{#1}{#2}{#3}{#4}\dodoSTEPcharttextsB + \ifnum\textcounter>\cellcounter\relax + \doglobal\decrement\textcounter\relax + \else + \bgroup + \initializeSTEL + \startMPdrawing + lines[t][#1][\textcounter] := \MPcharttoplinesgraphic{#1}\textcounter ; + lines[b][#1][\textcounter] := \MPchartbotlinesgraphic{#1}\textcounter ; + \stopMPdrawing + \egroup + \fi} + +\def\dodoSTEPcharttextsAB#1#2#3#4#5% #1=number #2=setup + {\doglobal\increment\textcounter\relax + \ifnum\textcounter>\cellcounter\relax + \@EA\appendtoks\@EA#5\@EA{#1}{#2}{#3}{#4}\to\stepchartbuffer + \fi} + +\def\MPtextsgraphic + {image(drawshape( + \@@STETalternative, pxy enlarged (-.5*\@@STEToffset), + \@@STETrulethickness, \MPcolor{\@@STETframecolor}, + \MPcolor{\@@STETbackgroundcolor} ) )} + +\def\MPcharttoplinesgraphic#1#2% + {image(drawline( + \@@STELalternative, get_step_chart_top_line(#1,#2), + \@@STELrulethickness, \MPcolor{\@@STELcolor} ) )} + +\def\MPchartbotlinesgraphic#1#2% + {image(drawline( + \@@STELalternative, get_step_chart_bot_line(#1,#2), + \@@STELrulethickness, \MPcolor{\@@STELcolor} ) )} + +%D Step tables are the vertical counterpart of stepcharts. + +\newcounter\currentsteptable + +\def\steptableprefix{@st@-\currentsteptable-} + +\def\startSTEPtable + {\dosingleempty\dostartSTEPtable} + +\def\dostartSTEPtable[#1]#2\stopSTEPtable + {\dostartSTEPaligntable[0][#1]#2\stopSTEPaligntable} + +\def\startSTEPaligntable + {\dodoubleempty\dostartSTEPaligntable[1]} + +\def\dostartSTEPaligntable[#1][#2]#3\stopSTEPaligntable % flag settings data + {\ifinsidefloat + \else + \whitespace + \@@STPTbefore + \startbaselinecorrection + \setlocalhsize + \noindent + \fi + \vbox\bgroup + \setupSTEPtables[#2]% + \forgetall + \pushMPdrawing + \doglobal\increment\currentsteptable + \startMPdrawing + input mp-step.mpii ; + begin_step_table ; + \stopMPdrawing + \initializeSTEP + \initializeSTPT + \def\startlines{\bgroup\setupSTEPlines}% + \def\stoplines {\egroup}% + \def\prep##1{\ignorespaces##1\unskip\enspace\ignorespaces}% + \def\cell {\dosingleempty\docell}% + \def\cells {\dosingleempty\docells}% + \def\text {\dosingleempty\dotext}% + % first graphic pass, also trial pass + \global\dimen1\zeropoint + \global\dimen3\zeropoint + \global\dimen5\zeropoint + \def\docell[##1]% + {\docells[##1]{}{}}% + \def\docells[##1]##2##3##4% + {\doglobal\increment\cellcounter + \bgroup + \iffirstargument\setupSTEPcells[##1]\fi + \initializeSTEC + \startMPdrawing + if box_found(\MPpos{\steptableprefix\cellcounter-c}) : + initialize_box(\MPpos{\steptableprefix\cellcounter-c}) ; + cells[\cellcounter] := \MPcellsgraphic ; + fi ; + \stopMPdrawing + \egroup + \def\do####1####2% + {\setbox\scratchbox\hbox{\@@stepfake{####2}}% + \ifdim\wd\scratchbox>\dimen####1\global\dimen####1=\wd\scratchbox\fi}% + \ifcase#1\else\do1{##2}\do3{##3}\fi\do5{##4}}% + \def\dotext[##1]##2% + {\bgroup + \iffirstargument\setupSTEPtexts[##1]\fi + \initializeSTET + \startMPdrawing + if box_found(\MPpos{\steptableprefix\cellcounter-t}) : + initialize_box(\MPpos{\steptableprefix\cellcounter-t}) ; + texts[\cellcounter] := \MPtextsgraphic ; + fi ; + \stopMPdrawing + \egroup} + \doglobal\newcounter\cellcounter#3 + % second graphic pass pass, drawing lines + \def\docells[##1]##2##3##4% + {\doglobal\increment\cellcounter} + \def\dotext[##1]##2% + {\bgroup + \initializeSTEL + \startMPdrawing + lines[\cellcounter] := \MPtablelinesgraphic ; + \stopMPdrawing + \egroup} + \doglobal\newcounter\cellcounter#3 + % finishing graphic touch + \startMPdrawing + nofcells := \cellcounter ; + end_step_table ; + anchor_box(\MPpos{\steptableprefix origin}) ; + \stopMPdrawing + \MPdrawingdonetrue + \doifelse\@@STPTmethod{0} + {\setbox0\null} + {\setbox0\vbox{\MPstaticgraphictrue\getMPdrawing}}% + \resetMPdrawing + % typesetting pass + \dimen6=\@@STPTdistance \dimen6=2\dimen6 + % cell width + \dimen8=\dimen1 + \advance\dimen8\dimen3 + \advance\dimen8\dimen5 + % offset width + \ifcase#1\else \advance\dimen8 \dimen6 \fi + % arrow width + \advance\dimen8 \@@STPTwidth + \advance\dimen8 \@@STPToffset + \advance\dimen8 \@@STPToffset + \def\docells[##1]##2##3##4% + {\doglobal\increment\cellcounter + \def\do####1####2####3####4% % strut really needed there ! + {\hbox to \dimen####1{####2\@@stepfake{####3}\strut####4}}% + \setbox8\hbox + {\ifcase#1\else + \do1\hss{##2}\relax \hskip\@@STPTdistance + \do3\hss{##3}\hss \hskip\@@STPTdistance + \fi + \do5\relax{##4}\hss}% + \hpos{\steptableprefix\cellcounter-c}{\@@stepcell{\box8}} + \endgraf + \nointerlineskip + \kern\@@STPTvoffset} + \def\dotext[##1]##2% + {\bgroup + \hskip\dimen8 + \advance\hsize-\dimen8 + \advance\hsize-\dimen6 % twice the offset + \setbox0\hbox{\@@steptext{##2}}% +% to do +% \ifdim\wd0>\hsize +% \setbox0=\vbox{\@@steptext{##2}}% +% \fi +% align + \hpos{\steptableprefix\cellcounter-t}{\box0}% + \endgraf + \egroup + \nointerlineskip + \kern\@@STPTvoffset} + \setbox2\vbox + {\doglobal\newcounter\cellcounter + #3\kern-\@@STPTvoffset} + \hbox + {\scratchdimen\wd0 + \advance\scratchdimen \MPllx bp + \raise\MPlly bp\box0 + \hskip-\scratchdimen + \hpos{\steptableprefix origin}{\box2}} + \popMPdrawing + \egroup + \ifinsidefloat \else \stopbaselinecorrection \@@STPTafter \fi} + +\def\MPtablelinesgraphic + {image ( drawline ( + \@@STELalternative, get_step_table_line(\cellcounter), + \@@STELrulethickness, \MPcolor{\@@STELcolor} ) )} + +\protect + +\continueifinputfile{m-steps.tex} + +% A simple paragraph-flow test: + +\starttext + +\startbuffer +\startSTEPchart +\cells {A} {B} +\cells {one} {five} \texts{$+2$}{$-2$} +\cells {two} {four} \texts{$+3$}{$-3$} +\cells {three} {three} \texts{$+4$}{$-4$} +\cells {four} {two} \texts{$+5$}{$-5$} +\cells {five} {one} +\stopSTEPchart +\stopbuffer + +\getbuffer + +\startnarrower \getbuffer \stopnarrower + +\placefigure[left]{}{\getbuffer} + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-subsub.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-subsub.mkii new file mode 100644 index 00000000000..88be1168000 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-subsub.mkii @@ -0,0 +1,76 @@ +%D \module +%D [ file=m-subsub, +%D version=2000.12.14, +%D title=\CONTEXT\ Private Modules, +%D subtitle=More Section Levels, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. This module is not public. + +\unprotect + +\definesection[\s!section-8] +\definesection[\s!section-9] +\definesection[\s!section-10] +\definesection[\s!section-11] +\definesection[\s!section-12] + +\definehead + [\v!subsubsubsubsubsection] + [\c!section=\s!section-8, + \c!default=\v!subsubsubsubsection] + +\definehead + [\v!subsubsubsubsubsubsection] + [\c!section=\s!section-9, + \c!default=\v!subsubsubsubsubsection] + +\definehead + [\v!subsubsubsubsubsubsubsection] + [\c!section=\s!section-10, + \c!default=\v!subsubsubsubsubsubsection] + +\definehead + [\v!subsubsubsubsubsubsubsubsection] + [\c!section=\s!section-11, + \c!default=\v!subsubsubsubsubsubsubsection] + +\definehead + [\v!subsubsubsubsubsubsubsubsubsection] + [\c!section=\s!section-12, + \c!default=\v!subsubsubsubsubsubsubsubsection] + +\definehead + [\v!subsubsubsubsubsubject] + [\c!coupling=\v!subsubsubsubsubsection, + \c!default=\v!subsubsubsubsubsection, + \c!incrementnumber=\v!no] + +\definehead + [\v!subsubsubsubsubsubsubject] + [\c!coupling=\v!subsubsubsubsubsubsection, + \c!default=\v!subsubsubsubsubsubsection, + \c!incrementnumber=\v!no] + +\definehead + [\v!subsubsubsubsubsubsubsubject] + [\c!coupling=\v!subsubsubsubsubsubsubsection, + \c!default=\v!subsubsubsubsubsubsubsection, + \c!incrementnumber=\v!no] + +\definehead + [\v!subsubsubsubsubsubsubsubsubject] + [\c!coupling=\v!subsubsubsubsubsubsubsubsection, + \c!default=\v!subsubsubsubsubsubsubsubsection, + \c!incrementnumber=\v!no] + +\definehead + [\v!subsubsubsubsubsubsubsubsubsubject] + [\c!coupling=\v!subsubsubsubsubsubsubsubsubsection, + \c!default=\v!subsubsubsubsubsubsubsubsubsection, + \c!incrementnumber=\v!no] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-tex4ht.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-tex4ht.mkii new file mode 100644 index 00000000000..8a3dc9dbb03 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-tex4ht.mkii @@ -0,0 +1,9 @@ +%D Preliminaty module + +\input tex4ht.sty + +\appendtoks + \Preamble{\env{ht-1},\env{ht-2},html}\EndPreamble +\to \everystarttext + +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-units.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-units.mkii new file mode 100644 index 00000000000..af4629d4860 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-units.mkii @@ -0,0 +1,904 @@ +%D \module +%D [ file=m-units, +%D version=1997.03.19, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Scientific Units, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Scientific units can be typeset in math mode pretty well, +%D but occasionally one has to take care of spacing. +%D Furthermore, entering these units is not that natural as +%D wanted. Therefore this module presents a more natural way of +%D doing things, like: +%D +%D \starttyping +%D 1.23 \Cubic \Meter \Per \Second +%D \stoptyping +%D +%D This example shows that we use the order in which we say +%D things, instead of typeset things. There is a separate +%D manual for this module. + +%D Message number~1 deals with overruling the \type {\Degrees} +%D macro defined in the core modules. Let's say that this is +%D an upward compatibility issue. + +\startmessages dutch library: units + title: eenheden + 1: gebruik \string\Degrees\space\string\Celsius\space in plaats van \string\Celsius ! +\stopmessages + +\startmessages english library: units + title: units + 1: use \string\Degrees\space\string\Celsius\space instead of \string\Celsius ! +\stopmessages + +\startmessages german library: units + title: Einheiten + 1: Verwende \string\Degrees\space\string\Celsius\space statt \string\Celsius ! +\stopmessages + +\startmessages italian library: units + title: unita + 1: usare \string\Degrees\space\string\Celsius\space invece di \string\Celsius ! +\stopmessages + +\startmessages norwegian library: units + title: enheter + 1: bruk \string\Degrees\space\string\Celsius\space istedenfor \string\Celsius ! +\stopmessages + +\startmessages romanian library: units + title: unitati + 1: folositi \string\Degrees\space\string\Celsius\space in locul \string\Celsius ! +\stopmessages + +\startmessages french library: units + title: unitas + 1: utilisez \string\Degrees\space\string\Celsius\space A la place de \string\Celsius ! +\stopmessages + +\unprotect + +%D This runtime loadable module implements a way of defining +%D units. The core macro is \type {\dimension}, a rather clever +%D one that is able to cooperate with some other dimension +%D related macros. As said, this module enables user to enter: +%D +%D \startbuffer +%D some 10 \Square \Meter \Per \Second or more +%D \stopbuffer +%D +%D \getbuffer +%D +%D as: +%D +%D \typebuffer +%D +%D The units itself are implemented as synonyms. +%D +%D \starttyping +%D \definesynonyms [unit] [units] [\unitmeaning] +%D \setupsynonyms [unit] [textstyle=\dimension] +%D \stoptyping +%D +%D This definition means that we can ask for the meaning of a +%D unit using \type {\unitmeaning} and get a list of used +%D units by saying \type {\placelistofunits} +%D +%D We have to use the command \type {\unitmeaning} instead +%D of \type {\meaning}, simply because the latter is a \TEX\ +%D primitive we don't want to loose. We use the label text +%D mechanism for translations. + +%D \macros +%D {dimension} +%D +%D The core of this module is the low level macro \type +%D {\dimension}. Before presenting this macro, it's best to +%D look at some applications, because it's supposed to show +%D some intelligence that can beter be understood from the +%D context. +%D +%D The next useless examples show some of the cases we want +%D to handle in a proper way. +%D +%D \startbuffer +%D ... 10 \Square \Meter \Per \Volt \ +%D ... 10 \Square \Meter \Volt \ +%D ... 10 \Meter \Volt \ +%D ... 10 \Milli \Square \Meter \Per \Volt \ +%D ... 10 \Square \Milli \Meter \Per \Volt \ +%D ... 10 \Meter \Times \Meter \ +%D ... 10 \Square \Meter \Times \Meter \ +%D ... 10 \Square \Milli \Meter \Times \Meter \ +%D \stopbuffer +%D +%D \typebuffer +%D +%D Becomes: +%D +%D \getbuffer + +%D \macros +%D {mathematicstypeface, dimensiontypeface, +%D dimensionhalfspace, dimensionbackspace} +%D +%D There are some low level constants, that can be changed +%D when needed. Some day I will write a decent setup command. + +\def\mathematicstypeface{\rm} +\def\dimensiontypeface {\tf} + +\def\dimensionhalfspace {\ifmmode\,\else\hskip+.1em\relax\fi} +\def\dimensionbackspace {\ifmmode\!\else\hskip-.1em\relax\fi} + +%D \macros +%D {smashdimensionpower} +%D +%D Sometimes the baseline distance is not enough to provide +%D for superscripts, so we smash their height by default. + +\newif\ifsmashdimensionpower \smashdimensionpowertrue + +%D The dimension mechanism uses a lot of signals to keep +%D track if the current state. + +\newsignal\dimensionsignal +\newsignal\dimensionpowersignal +\newsignal\dimensionmidfixsignal +\newsignal\dimensionaddfixsignal + +\let\thedimensionprefix = \empty +\let\thedimensionpower = \empty + +%D \macros +%D {spaceddimensions,textdimensions} +%D +%D The actual definition of \type {\dimension} overruled the +%D one in the core modules. The boolean can be used to +%D force spacing between units. Vergelijk {\Newton \Meter} +%D eens met {\spaceddimensionstrue \Newton \Meter}. The +%D rather ugly test prevents problems with nested dimensions. + +\newif\ifspaceddimensions \spaceddimensionsfalse % user switch +\newif\iftextdimensions \textdimensionsfalse % user switch + +%D You can see the consequence of forcing text dimensions +%D when you compare the following code: +%D +%D \starttyping +%D {\rm test \Square \Meter \Per \Second\ ziezo\Degrees} \par +%D {\ss test \Square \Meter \Per \Second\ ziezo} \par +%D {\tt test \Square \Meter \Per \Second\ ziezo} +%D +%D \textdimensionstrue +%D +%D {\rm test \Square \Meter \Per \Second\ ziezo} \par +%D {\ss test \Square \Meter \Per \Second\ ziezo} \par +%D {\tt test \Square \Meter \Per \Second\ ziezo} +%D \stoptyping + +\newif\ifnesteddimension \nesteddimensionfalse % local switch + +\def\dodimensionpower#1% + {\iftextdimensions\expandafter\high\else\expandafter^\fi{#1}} + +\def\ustartmathmode {\iftextdimensions\else\expandafter\startmathmode \fi} +\def\ustopmathmode {\iftextdimensions\else\expandafter\stopmathmode \fi} +\def\umathematicstypeface{\iftextdimensions\else\expandafter\mathematicstypeface\fi} + +%D In forced text mode, we ignore spacing in monospaced fonts. + +\def\udimensionhalfspace {\dodimensionspace\dimensionhalfspace} +\def\udimensionbackspace {\dodimensionspace\dimensionbackspace} + +\def\dodimensionspace + {\iftextdimensions + \begingroup + \setbox0\hbox{i}% + \setbox2\hbox{m}% + \ifdim\wd0=\wd2 + \endgroup + \@EAEAEA\gobbleoneargument + \else + \endgroup + \fi + \fi} + +\unexpanded\def\dimension#1% + {\begingroup + \global\let\savedthedimensionprefix\thedimensionprefix + \global\let\savedthedimensionpower\thedimensionpower + \unexpanded\def\dimension##1{\global\nesteddimensiontrue}% + \let\dimensionprefix\dimension + \let\dimensionmidfix\dimension + \let\dimensionsuffix\dimension + \let\dimensionpower \dimension + \global\nesteddimensionfalse + \setbox\scratchbox\hbox{\ustartmathmode#1\ustopmathmode}% pre-roll + \global\let\thedimensionprefix\savedthedimensionprefix + \global\let\thedimensionpower \savedthedimensionpower + \endgroup + \ifnesteddimension#1\else\dodimension{#1}\fi} + +\def\dodimension#1% + {\dontbreakdimension + \ifdim\scratchdimen=\zeropoint\relax + \ifmmode + \udimensionhalfspace + \udimensionhalfspace + \fi + \ustartmathmode\dimensiontypeface + \else + \ustartmathmode\dimensiontypeface + \ifspaceddimensions + \ifdim\scratchdimen=\dimensionsignal\relax + \udimensionhalfspace + \else\ifdim\scratchdimen=\dimensionpowersignal\relax + \udimensionhalfspace + \fi + \fi + \fi + \fi + \umathematicstypeface\thedimensionprefix#1% + \ifx\thedimensionpower\empty + \else\ifsmashdimensionpower + \setbox\scratchbox=\hbox + {\iftextdimensions + \tx\thedimensionpower + \else + $\scriptstyle\thedimensionpower$% + \fi}% + \ht\scratchbox=\zeropoint + \dodimensionpower{\box\scratchbox}% + \else + \dodimensionpower{\thedimensionpower}% + \fi\fi + \ustopmathmode + % otherwise nobreak before space in 2 \Milli \Meter\ blabla + \doifnotmode{atpragma}{\nobreak}% this was always \nobreak + % only test this at pragma + \ifx\thedimensionpower\empty + \hskip\dimensionsignal + \else + \hskip\dimensionpowersignal + \fi + \global\let\thedimensionprefix\empty + \global\let\thedimensionpower\empty} + +%D \macros +%D {dontbreakdimension, +%D dimensionprefix, dimensionaddfix, +%D dimensionnopfix, dimensionmidfix, +%D dimensionpower} +%D +%D Here are some auxilliary macros. + +\def\dontbreakdimension + {\scratchdimen\lastskip + \unskip + \nobreak + \hskip\scratchdimen + \nobreak} + +\def\dimensionprefix#1% + {\gdef\thedimensionprefix{#1}} + +\def\dimensionaddfix#1% + {\unskip + %\mathematics{\umathematicstypeface#1}% + \ustartmathmode\umathematicstypeface#1\ustopmathmode + \nobreak + \hskip\dimensionaddfixsignal} + +\def\dimensionnopfix#1% + {\dontbreakdimension + \ifdim\scratchdimen=\dimensionpowersignal\relax + \ustartmathmode + \else + \ustartmathmode + \udimensionhalfspace + \nobreak + \fi + \umathematicstypeface#1% + \ustopmathmode + \nobreak + \hskip\dimensionsignal} + +\def\dimensionmidfix#1% + {\dontbreakdimension + \ifdim\scratchdimen=\dimensionpowersignal\relax + \ustartmathmode + \udimensionbackspace + \nobreak + \else + \ustartmathmode + \fi + \umathematicstypeface#1% + \ustopmathmode + \nobreak + \hskip\dimensionmidfixsignal} + +\def\dimensionpower#1% + {\gdef\thedimensionpower{#1}} + +%D \macros +%D {SIunits, noSI, doSI} +%D +%D Some low level unit switching macros: + +\newif\ifSIunits \SIunitstrue + +\def\noSI#1{\begingroup\SIunitsfalse#1\endgroup} +\def\doSI#1{\begingroup\SIunitstrue #1\endgroup} + +%D \macros +%D {Degrees} +%D +%D We can fake the degrees symbol with: + +\def\Degrees{\dimensionaddfix{\mathematics{^\circ}}} + +%D \macros +%D {Unit, NoUnit} +%D +%D When a dimension has no leading number, we can use \type +%D {\Unit}, and when no unit is appended, \type {\NoUnit} is +%D to be used, just to prevent the prefix migrating to the +%D next occasion. + +\def\Unit {\hskip\dimensionsignal} +\def\NoUnit {\dimension{}} + +%D The mechanism described at the top of this module, depends +%D on several dimensional components, like prefixes: + +\def\Atto {\dimensionprefix{a}} +\def\Femto {\dimensionprefix{f}} +\def\Pico {\dimensionprefix{p}} +\def\Nano {\dimensionprefix{n}} +\def\Micro {\dimensionprefix{\iftextdimensions u\else\mu\fi}} +\def\Milli {\dimensionprefix{m}} +\def\Centi {\dimensionprefix{c}} +\def\Deci {\dimensionprefix{d}} % 10^01 +\def\Hecto {\dimensionprefix{h}} % 10^02 +\def\Kilo {\dimensionprefix{k}} % 10^03 +\def\Mega {\dimensionprefix{M}} % 10^06 +\def\Giga {\dimensionprefix{G}} % 10^09 +\def\Tera {\dimensionprefix{T}} % 10^12 +\def\Peta {\dimensionprefix{P}} % 10^15 +\def\Exa {\dimensionprefix{E}} % 10^18 + +%def\Terra {\dimensionprefix{T}} % for old times sake + +\def\Kibi {\dimensionprefix{ki}} % 2^10 +\def\Mebi {\dimensionprefix{Mi}} % 2^20 +\def\Gibi {\dimensionprefix{Gi}} % 2^30 +\def\Tebi {\dimensionprefix{Ti}} % 2^40 +\def\Pebi {\dimensionprefix{Pi}} % 2^50 + +%D and binary prefixes: + +\def\Kibi {\dimensionprefix{Ki}} +\def\Mebi {\dimensionprefix{Mi}} +\def\Gibi {\dimensionprefix{Gi}} +\def\Tebi {\dimensionprefix{Ti}} +\def\Pebi {\dimensionprefix{Pi}} +\def\Exbi {\dimensionprefix{Ei}} +\def\Zebi {\dimensionprefix{Zi}} +\def\Yobi {\dimensionprefix{Yi}} + +%D and operators: + +\def\Times {\dimensionnopfix{\iftextdimensions.\else\cdot\fi}} +\def\Solidus {\dimensionmidfix{/}} +\def\Per {\dimensionmidfix{/}} +\def\OutOf {\dimensionnopfix{:}} + +%D and suffixes: + +\def\Linear {\dimensionpower{1}} +\def\Square {\dimensionpower{2}} +\def\Cubic {\dimensionpower{3}} + +\def\Inverse {\dimensionpower{-1}} +\def\ILinear {\dimensionpower{-1}} +\def\ISquare {\dimensionpower{-2}} +\def\ICubic {\dimensionpower{-3}} + +%D Apart from these components, the units themselves are +%D defined using the synonym mechanism. First we define some +%D length and volume related units. + +\getvalue{\v!unit} [Meter] {m} {meter} +\getvalue{\v!unit} [pMeter] {\Pico \Meter} {picometer} +\getvalue{\v!unit} [nMeter] {\Nano \Meter} {nanometer} +\getvalue{\v!unit} [uMeter] {\Micro \Meter} {micrometer} +\getvalue{\v!unit} [mMeter] {\Milli \Meter} {millimeter} +\getvalue{\v!unit} [cMeter] {\Centi \Meter} {centimeter} +\getvalue{\v!unit} [dMeter] {\Deci \Meter} {decimeter} +\getvalue{\v!unit} [hMeter] {\Hecto \Meter} {hectometer} +\getvalue{\v!unit} [kMeter] {\Kilo \Meter} {kilometer} + +%D After some discussion on the \CONTEXT\ mailing list in +%D february 2002 it was decided to go from L to l for liters +%D (Karel Wesselings alternative: \mathematics{\ell}). + +\getvalue{\v!unit} [Liter] {l} {liter} +\getvalue{\v!unit} [mLiter] {\Milli \Liter} {milliliter} +\getvalue{\v!unit} [cLiter] {\Centi \Liter} {centiliter} +\getvalue{\v!unit} [dLiter] {\Deci \Liter} {deciliter} + +%D Next we define time related units (\type {\ifSI} still dutch only). + +\getvalue{\v!unit} [Sec] {s} {\labeltext{u:sec}} +\getvalue{\v!unit} [fSec] {\Femto \Sec} {\labeltext{u:fsec}} +\getvalue{\v!unit} [pSec] {\Pico \Sec} {\labeltext{u:psec}} +\getvalue{\v!unit} [nSec] {\Nano \Sec} {\labeltext{u:nsec}} +\getvalue{\v!unit} [uSec] {\Micro \Sec} {\labeltext{u:usec}} +\getvalue{\v!unit} [mSec] {\Milli \Sec} {\labeltext{u:msec}} +\getvalue{\v!unit} [Year] {\ifSIunits a \else j\fi} {\labeltext{u:year}} +\getvalue{\v!unit} [Month] {m} {\labeltext{u:month}} +\getvalue{\v!unit} [Week] {w} {\labeltext{u:week}} +\getvalue{\v!unit} [Day] {d} {\labeltext{u:day}} +\getvalue{\v!unit} [Hour] {\ifSIunits h \else u\fi} {\labeltext{u:hour}} +\getvalue{\v!unit} [Min] {min} {\labeltext{u:min}} + +\setuplabeltext + [\s!nl] + [u:sec=seconde, + u:psec=picoseconde, + u:fsec=femtoseconde, + u:nsec=nanoseconde, + u:usec=microseconde, + u:msec=milliseconde, + u:year=jaar, + u:month=maand, + u:week=week, + u:day=dag, + u:hour=uur, + u:min=minuten] + +\setuplabeltext + [\s!en] + [u:sec=second, + u:fsec=femtosecond, + u:psec=picosecond, + u:nsec=nanosecond, + u:usec=microsecond, + u:msec=millisecond, + u:year=year, + u:month=month, + u:week=week, + u:day=day, + u:hour=hour, + u:min=minutes] + +\setuplabeltext + [\s!de] + [u:sec=Sekunde, + u:fsec=Femtosekunde, + u:psec=Picosekunde, + u:nsec=Nanosekunde, + u:usec=Microsekunde, + u:msec=Millisekunde, + u:year=Jahr, + u:month=Monat, + u:week=Woche, + u:day=Tag, + u:hour=Stunde, + u:min=Minuten] + +\setuplabeltext + [\s!hr] + [u:sec=sekunda, + u:fsec=femtosekunda, + u:psec=pikosekunda, + u:nsec=nanosekunda, + u:usec=mikrosekunda, + u:msec=milisekunda, + u:year=godina, + u:month=mjesec, + u:week=tjedan, + u:day=dan, + u:hour=sat, + u:min=minuta] + +\setuplabeltext + [\s!it] + [u:sec=secondo, + u:fsec=femtosecondo, + u:psec=picosecondo, + u:nsec=nanosecondo, + u:usec=microsecondo, + u:msec=millisecondo, + u:year=anno, + u:month=mese, + u:week=settimana, + u:day=giorno, + u:hour=ora, + u:min=minuti] + +%D Then we define some angles. + +\getvalue{\v!unit} [Rad] {rad} {\labeltext{u:rad}} +\getvalue{\v!unit} [Deg] {{\mathematics{^\circ}}} {\labeltext{u:deg}} + +\setuplabeltext + [\s!nl] + [u:rad=hoek radialen, + u:deg=hoek graden] + +\setuplabeltext + [\s!en] + [u:rad=angle radians, + u:deg=angle degrees] + +\setuplabeltext + [\s!de] + [u:rad=Bogenma\SS, + u:deg=Gradma\SS] + +\setuplabeltext + [\s!hr] + [u:rad=radijani, + u:deg=kutni stupnjevi] + +\setuplabeltext + [\s!it] + [u:rad=radianti, + u:deg=angoli sessagesimali] + +%D Rotation and frequency related units are defined by: + +\getvalue{\v!unit} [Hertz] {Hz} {Hertz} +\getvalue{\v!unit} [kHertz] {\Kilo \Hertz} {kilo Hertz} +\getvalue{\v!unit} [MHertz] {\Mega \Hertz} {mega Hertz} +\getvalue{\v!unit} [GHertz] {\Giga \Hertz} {giga Hertz} +\getvalue{\v!unit} [THertz] {\Tera \Hertz} {tera Hertz} +\getvalue{\v!unit} [mHertz] {\Milli \Hertz} {milli Hertz} + +\getvalue{\v!unit} [RevPerSec] {RPS} {\labeltext{u:rps}} +\getvalue{\v!unit} [RevPerMin] {RPM} {\labeltext{u:rpm}} + +\setuplabeltext + [\s!nl] + [u:rps=omwentelingen per seconde, + u:rpm=omwentelingen per minuut] + +\setuplabeltext + [\s!en] + [u:rps=revolutions per second, + u:rpm=revolutions per minute] + +\setuplabeltext + [\s!de] + [u:rps=Umdrehungen pro Sekunde, + u:rpm=Umdrehungen pro Minute] + +\setuplabeltext + [\s!hr] + [u:rps=okretaji po sekundi, + u:rpm=okretaji po minuti] + +\setuplabeltext + [\s!it] + [u:rps=giri al secondo, + u:rpm=giri al minuto] + +%D Mass and force: + +\getvalue{\v!unit} [Gram] {g} {gram} +\getvalue{\v!unit} [uGram] {\Micro \Gram} {microgram} +\getvalue{\v!unit} [mGram] {\Milli \Gram} {milligram} +\getvalue{\v!unit} [kGram] {\Kilo \Gram} {kilogram} +\getvalue{\v!unit} [Atom] {u} {\labeltext{u:u}} + +\getvalue{\v!unit} [Newton] {N} {Newton} +\getvalue{\v!unit} [kNewton] {\Kilo \Newton} {kilo Newton} + +\getvalue{\v!unit} [Pascal] {Pa} {Pascal} +\getvalue{\v!unit} [mPascal] {\Milli \Pascal} {milli Pascal} +\getvalue{\v!unit} [kPascal] {\Kilo \Pascal} {kilo Pascal} + +\setuplabeltext + [\s!nl] + [u:u=atomaire massa eenheid] + +\setuplabeltext + [\s!en] + [u:u=atom mass unit] + +\setuplabeltext + [\s!de] + [u:u=Atomare Masseneinheit] + +\setuplabeltext + [\s!hr] + [u:u=unificirana atomska jedinica mase] + +\setuplabeltext + [\s!it] + [u:u=unit\`a di massa atomica] + +%D Energy units comes in two alternatives: + +\getvalue{\v!unit} [Joule] {J} {Joule} +\getvalue{\v!unit} [mJoule] {\Milli \Joule} {milli Joule} +\getvalue{\v!unit} [kJoule] {\Kilo \Joule} {kilo Joule} +\getvalue{\v!unit} [MJoule] {\Mega \Joule} {mega Joule} +\getvalue{\v!unit} [GJoule] {\Giga \Joule} {giga Joule} + +\getvalue{\v!unit} [Watt] {W} {Watt} +\getvalue{\v!unit} [mWatt] {\Milli \Watt} {milli Watt} +\getvalue{\v!unit} [kWatt] {\Kilo \Watt} {kilo Watt} +\getvalue{\v!unit} [MWatt] {\Mega \Watt} {mega Watt} +\getvalue{\v!unit} [GWatt] {\Giga \Watt} {giga Watt} +\getvalue{\v!unit} [TWatt] {\Tera \Watt} {tera Watt} + +%D Although Celsius is no longer permitted, we define it by +%D saying: + +\getvalue{\v!unit} [Celsius] {C} {Celsius} +\getvalue{\v!unit} [Kelvin] {K} {Kelvin} +\getvalue{\v!unit} [Fahrenheit] {F} {Fahrenheit} + +%D Some chemic related units are: + +\getvalue{\v!unit} [Mol] {mol} {mol} +\getvalue{\v!unit} [mMol] {\Milli \Mol} {millimol} +\getvalue{\v!unit} [kMol] {\Kilo \Mol} {kilomol} +\getvalue{\v!unit} [Molair] {M} {molair (\Mol \Per \Liter)} +\getvalue{\v!unit} [Equivalent] {eq} {equivalent} +\getvalue{\v!unit} [mEquivalent] {\Milli \Equivalent} {milli equivalent} + +%D There are quite a lot units related to electricity and +%D magnetism: + +\getvalue{\v!unit} [Farad] {F} {Farad} +\getvalue{\v!unit} [pFarad] {\Pico \Farad} {pico Farad} +\getvalue{\v!unit} [nFarad] {\Nano \Farad} {nano Farad} +\getvalue{\v!unit} [uFarad] {\Micro \Farad} {micro Farad} +\getvalue{\v!unit} [mFarad] {\Milli \Farad} {milli Farad} + +\getvalue{\v!unit} [Ohm] {\Omega} {Ohm} +\getvalue{\v!unit} [kOhm] {\Kilo \Ohm} {kilo Ohm} + +\getvalue{\v!unit} [Siemens] {S} {Siemens} + +\getvalue{\v!unit} [Ampere] {A} {Amp\`ere} +\getvalue{\v!unit} [mAmpere] {\Milli \Ampere} {milli Amp\`ere} + +\getvalue{\v!unit} [Coulomb] {C} {Coulomb} + +\getvalue{\v!unit} [Volt] {V} {Volt} +\getvalue{\v!unit} [mVolt] {\Milli \Volt} {milli Volt} +\getvalue{\v!unit} [kVolt] {\Kilo \Volt} {kilo Volt} +\getvalue{\v!unit} [eVolt] {eV} {electronvolt} +\getvalue{\v!unit} [keVolt] {\Kilo \eVolt} {kilo electronvolt} +\getvalue{\v!unit} [MeVolt] {\Mega \eVolt} {mega electronvolt} + +\getvalue{\v!unit} [Tesla] {T} {Tesla} + +\getvalue{\v!unit} [VoltAC] {V_{\xbox{ac}}} {\labeltext{u:vac}} +\getvalue{\v!unit} [VoltDC] {V_{\xbox{dc}}} {\labeltext{u:vdc}} + +\setuplabeltext + [\s!nl] + [u:vac=wisselspanning, + u:vdc=gelijkspanning] + +\setuplabeltext + [\s!en] + [u:vac=alternating current, + u:vdc=direct current] + +\setuplabeltext + [\s!de] + [u:vac=Wechselspannung, + u:vdc=Gleichspannung] + +\setuplabeltext + [\s!hr] + [u:vac=izmjeni\ccaron ni napon, + u:vdc=istosmjerni napon] + +\setuplabeltext + [\s!it] + [u:vac=corrente alternata, + u:vdc=corrente continua] + +%D Network bandwidth is specified in Bits: + +\getvalue{\v!unit} [Bit] {bit} {\labeltext{u:bit}} +\getvalue{\v!unit} [Baud] {Bd} {Baud (Bit/s)} + +%D Computer memory size is specified in Bytes: + +\getvalue{\v!unit} [Byte] {B} {\labeltext{u:byte}} +\getvalue{\v!unit} [kByte] {\Kilo \Byte} {kilo Byte} +\getvalue{\v!unit} [MByte] {\Mega \Byte} {mega Byte} +\getvalue{\v!unit} [GByte] {\Giga \Byte} {giga Byte} +\getvalue{\v!unit} [TByte] {\Tera \Byte} {tera Byte} + +\setuplabeltext + [\s!en] + [u:bit=Bit, + u:byte=Byte] + +\setuplabeltext + [\s!hr] + [u:bit=bit, + u:byte=bajt] + +%D Telecommunication call density is specified in Erlangs: + +\getvalue{\v!unit} [Erlang] {E} {Erlang} + +%D Some radiation related units: + +\getvalue{\v!unit} [Bequerel] {Bq} {Bequerel} +\getvalue{\v!unit} [MBequerel] {\Mega \Bequerel} {Bequerel} +\getvalue{\v!unit} [Sievert] {Sv} {Sievert} +\getvalue{\v!unit} [mSievert] {\Milli \Sievert} {milli Sievert} + +%D Light: + +\getvalue{\v!unit} [Candela] {cd} {Candela} + +%D and some sound ones: + +\getvalue{\v!unit} [Bell] {B} {Bell} +\getvalue{\v!unit} [dBell] {\Deci \Bell} {decibel} + +%D We also define some non||regular, sometimes even forbidden, +%D units: + +\getvalue{\v!unit} [At] {at} {\labeltext{u:at}} +\getvalue{\v!unit} [Atm] {atm} {\labeltext{u:atm}} +\getvalue{\v!unit} [Bar] {bar} {bar (100 \Kilo \Pascal)} +\getvalue{\v!unit} [EVolt] {eV} {electronvolt} +\getvalue{\v!unit} [Foot] {ft} {\labeltext{u:ft}} +\getvalue{\v!unit} [Inch] {inch} {\labeltext{u:inch}} +\getvalue{\v!unit} [Cal] {cal} {\labeltext{u:cal}} +\getvalue{\v!unit} [Force] {f} {\labeltext{u:f}} +\getvalue{\v!unit} [kCal] {\Kilo \Cal} {\labeltext{u:kcal}} +\getvalue{\v!unit} [Lux] {lux} {lux} + + +\def\xPercent {\dimensionaddfix{\percent }} +\def\xPromille{\dimensionaddfix{\promille}} + +\getvalue{\v!unit} [Percent] {\xPercent } {percent} +\getvalue{\v!unit} [Permille] {\xPromille} {promille} +\getvalue{\v!unit} [Promille] {\xPromille} {promille} + +%D Some more, thanks to Tobias: + +\getvalue{\v!unit} [Gray] {Gr} {Gray} +\getvalue{\v!unit} [Weber] {Wb} {Weber} +\getvalue{\v!unit} [Henry] {H} {Henry} +\getvalue{\v!unit} [Sterant] {sr} {Sterant} +\getvalue{\v!unit} [Angstrom] {\hbox{\Aring}} {\Aring ngstr\"om} +\getvalue{\v!unit} [Gauss] {G} {Gauss} + +\setuplabeltext + [\s!nl] + [u:at=technische atmosfeer, + u:atm=fysische atmosfeer, + u:ft=voet, + u:cal=calorie, + u:f=kracht (force), + u:kcal=kilocalorie] + +\setuplabeltext + [\s!en] + [u:at=technical atmospheric pressure, + u:atm=physical atmospheric pressure, + u:ft=foot, + u:inch=inch, + u:cal=calory, + u:f=force, + u:kcal=kilocalory] + +\setuplabeltext + [\s!de] + [u:at=Technischer atmosph\"arischer Druck, + u:atm=physkalischer atmosph\"arischer Druck, + u:ft=Fu\SS, + u:cal=Kalorien, + u:f=Force, + u:kcal=Kilokalorien] + +\setuplabeltext + [\s!hr] + [u:at=tehni\ccaron ka atmosfera, + u:atm=standardna atmosfera, + u:ft=stopa, + u:inch=in\ccaron a, + u:cal=kalorija, + u:f=Force, + u:kcal=Kilokalorien] + +\setuplabeltext + [\s!it] + [u:at=pressione atmosferica tecnica, + u:atm=pressione atmosfera fisica, + u:ft=piede, + u:cal=caloria, + u:f=forza, + u:kcal=chilocaloria] + +%D Here are some old ones, still there for compatibility +%D reasons. These will probably be obsolete in a few years. + +\def\MeterTwee {\Square \Meter} +\def\mMeterTwee {\Square \Milli \Meter} +\def\cMeterTwee {\Square \Centi \Meter} +\def\dMeterTwee {\Square \Deci \Meter} +\def\kMeterTwee {\Square \Kilo \Meter} + +\def\MeterDrie {\Cubic \Meter} +\def\mMeterDrie {\Cubic \Milli \Meter} +\def\cMeterDrie {\Kubic \Centi \Meter} +\def\dMeterDrie {\Cubic \Deci \Meter} +\def\kMeterDrie {\Cubic \Kilo \Meter} + +\def\LiterTwee {\Square \Liter} +\def\SecTwee {\Square \Sec} +\def\SecMinEen {\Inverse \Sec} + +%D To make ourselves happy, we define some dutch specific +%D units: + +\startinterface dutch + + \getvalue{\v!unit} [PaardenKracht] {pk} {paardenkracht} + \getvalue{\v!unit} [Duits] {D} {duits} + \getvalue{\v!unit} [Kwik] {Hg} {kwikkolom} + \getvalue{\v!unit} [Hectare] {ha} {hectare} + \getvalue{\v!unit} [kGramForce] {\Kilo \Gram \Force} {kilogramforce} + \getvalue{\v!unit} [kWattUur] {\Kilo \Watt \Uur} {kilowattuur} + \getvalue{\v!unit} [MeterKwik] {\Meter \Kwik} {meter kwikkolom} + \getvalue{\v!unit} [Waterkolom] {WK} {waterkolom} + \getvalue{\v!unit} [MeterWater] {\Meter \Waterkolom} {meter waterkolom} + \getvalue{\v!unit} [DrogeStof] {ds} {droge stof} + \getvalue{\v!unit} [Normaal] {N} {normaal} + + \getvalue{\v!unit} [Ton] {t} {ton} + \getvalue{\v!unit} [kTon] {\Kilo \Ton} {kiloton} + + \let \OmwPerSec \RevPerSec + \let \OmwPerMin \RevPerMin + \let \Graden \Deg + \let \PaardeKracht \PaardenKracht + \let \Atoom \Atom + \let \Heure \Hour + \let \Jaar \Year + \let \Maand \Month + \let \Dag \Day + \let \Uur \Hour + +\stopinterface + +%D Finally we define some equivalents. By using \type {\let} +%D we can be sure that they don't end up double in the lists of +%D units. + +\let \Second \Sec +\let \Kubic \Cubic +\let \IKubic \ICubic + +%D Option: + +% \def\Micro{\dimensionprefix{\iftextdimensions\mathematics\mu \else\mu \fi}} +% \def\Times{\dimensionnopfix{\iftextdimensions\mathematics\cdot\else\cdot\fi}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/m-visual.mkii b/Master/texmf-dist/tex/context/modules/mkii/m-visual.mkii new file mode 100644 index 00000000000..ae52f65718f --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/m-visual.mkii @@ -0,0 +1,315 @@ +%D \module +%D [ file=m-visual, +%D version=2000.01.10, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Visualization and Faking, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D This module collect a few more visual debugger features. I +%D needed them for manuals and styles. The macros are documented +%D in a my way document. + +%D For Mojca: +%D +%D \starttyping +%D \def\simplethesis +%D {\setupsystem[random=1234] +%D \title{\fakewords{3}{4}} +%D \placelist[chapter,section] +%D \dorecurse{6} +%D {\chapter{\fakewords{5}{10}} +%D \dorecurse{5} +%D {\section{\fakewords{2}{5}} +%D \dorecurse{2} +%D {\dorecurse{3}{\fakewords{100}{200}\endgraf} +%D \placefigure{\fakewords{8}{15}}{\fakefigure{5cm}{3cm}{10cm}{5cm}} +%D \dorecurse{2}{\fakewords{100}{200}\endgraf}}}}} +%D +%D \starttext +%D \simplethesis +%D \stoptext +%D \stoptyping + +\definecolor[fakerulecolor] [black] +\definecolor[fakebaselinecolor] [green] +\definecolor[fakeparindentcolor][blue] + +\newif\iffakebaseline \fakebaselinetrue + +\def\fakerule#1% + {\strut + \startcolor[fakerulecolor]% + \iffakebaseline + \vrule\!!height1.25ex\!!depth-.05ex\!!width#1% + \kern-#1% + \vrule\!!height-.05ex\!!depth .25ex\!!width#1% + \else + \vrule\!!height1.25ex\!!depth .25ex\!!width#1% + \fi + \stopcolor + \allowbreak} + +\def\dorandomrecurse#1% + {\getrandomcount\scratchcounter{1}{#1}% + \dorecurse\scratchcounter} + +% can be used in hbox, so %'s are really needed + +\unexpanded\def\fakelines#1#2% min max / 3 10 + {\fakeparindent + \scratchdimen\hsize + \ifindentation + \advance\scratchdimen -\parindent + \fi + \fakerule\scratchdimen\break + \getrandomcount\scratchcounter{\ifcase0#1 3\else#1\fi}{\ifcase0#2 10\else#2\fi}% + \dorecurse\scratchcounter{\fakerule\hsize}% + \getrandomdimen\scratchdimen{.25\hsize}\hsize + \fakerule\scratchdimen + \par} % indeed + +\unexpanded\def\fakewords + {\ifvmode\fakeparindent\fi\onlyfakewords} + +\definepalet + [fakerule] + [fr1c=darkred, + fr2c=darkgreen, + fr3c=darkblue, + fr4c=darkyellow, + fr5c=darkgray] + +\unexpanded\def\onlyfakewords#1#2% min max / 10 40 + {\getrandomcount\scratchcounter{\ifcase0#1 10\else#1\fi}{\ifcase0#2 40\else#2\fi}% + \dofakewords\scratchcounter + } % no \par + +\unexpanded\def\fakenwords#1#2% words seed + {\fakeparindent + \getrandomseed\fakedwordseed + \setrandomseed{\ifcase0#2 #1\else#2\fi}% + \dofakewords{#1}% + \setrandomseed\fakedwordseed + } % no \par + +\def\dofakewords#1% + {\bgroup + \dorecurse{#1} + {\getrandomcount\scratchcounter{1}{5}% + \dorecurse\scratchcounter + {\getrandomdimen\scratchdimen{.5em}{1.25em}% + \fakerule\scratchdimen}% + \space}% + \removeunwantedspaces + \egroup} + +\def\doshowfakewords#1% + {\bgroup + \setuppalet[fakerule]% + \definecolor[fakerulecolor]% + \dorecurse{#1} + {\getrandomcount\scratchcounter{1}{5}% + \dorecurse\scratchcounter + {\getrandomdimen\scratchdimen{.5em}{1.25em}% + \color[fr\recurselevel c]{\fakerule\scratchdimen}}% + \space}% + \removeunwantedspaces + \egroup} + +\def\showfakewords{\let\dofakewords\doshowfakewords} + +\def\fakeword + {\fakewords{1}{1}} % no \plusone + +\def\fakeparindent + {\noindent + \ifindentation + \ifx\dofakedroppedcaps\relax + {\fakeparindentcolor + \vrule + \!!height \strutheight % not longer .5ex + \!!depth \strutdepth % not longer 0pt + \!!width \parindent}% + \else + \dofakedroppedcaps \let\dofakedroppedcaps\relax + \fi +% \else +% \dontleavehmode + \fi} + +\let\dofakedroppedcaps\relax + +\unexpanded\def\fakedroppedcaps#1% + {\ifnum#1>0 + \def\dofakedroppedcaps + {\setbox\scratchbox\hbox + {\setbox\scratchbox\hbox{W}% + \scratchdimen#1\lineheight + \advance\scratchdimen -\lineheight + \advance\scratchdimen \dp\strutbox + \vrule + \!!width#1\wd\scratchbox + \!!height\ht\scratchbox + \!!depth\scratchdimen}% + \ht\scratchbox\ht\strutbox + \dp\scratchbox\dp\strutbox + \hangindent\wd\scratchbox + \advance\hangindent .5em + \wd\scratchbox\hangindent + \hangafter-#1\noindent + \llap{\fakeparindentcolor\box\scratchbox}}% + \fi} + +\newcounter\noffakedfigures + +\unexpanded\def\showfakefigure + {\donetrue\dodoubleempty\dofakefigure} + +\unexpanded\def\fakefigure + {\donefalse\dodoubleempty\dofakefigure} + +\def\dofakefigure[#1][#2]#3#4#5#6% [] [] minwidth maxwidth minheight maxheight + {\doglobal\increment\noffakedfigures + \ifdone + \endgraf + \hbox to \hsize + {\hss\fakeparindentcolor + \strut\bf Figure \noffakedfigures + \doifsomething{#1}{\space(#1)}% + \hss} + \endgraf + \fi + \getvalue{\e!place\v!figure} + [#1][#2]% + {\freezerandomseed + \let\endstrut\relax + \let\begstrut\relax + \doifinsetelse{#1}{\v!left,\v!right} + {\fakewords{2}{4}} + {\fakewords{4}{10}}}% + {\getrandomdimen{\dimen0}{#3}{#4}% + \getrandomdimen{\dimen2}{#5}{#6}% + \doifinset{#1}{\v!left,\v!right} + {\dimen0=.75\dimen0 + \ifdim\dimen0>.6\hsize \dimen0=.5\hsize\fi + \ifdim\dimen0<.3\hsize \dimen0=.3\hsize\fi}% + \framed + [\c!width=\dimen0, + \c!height=\dimen2, + \c!frame=\v!off, + \c!background=\v!color, + \c!backgroundcolor=fakeparindentcolor] + {\bf\white#1}}% + \defrostrandomseed} + +\def\fakeformula + {\dimen0\zeropoint + \getrandomcount\scratchcounter{3}{6}% + \dorecurse\scratchcounter + {\getrandomdimen\scratchdimen{1em}{3em}% + \mathinner{\red\fakerule\scratchdimen}% + \ifnum\recurselevel<\scratchcounter+\fi + \advance\scratchdimen\dimen0}% + =\mathinner{\red\fakerule\scratchdimen}} + +\def\fakespacingformula + {\color[fakebaselinecolor]{\ruledbaseline}\fakeformula} + +%D test \type{\bodyfontgrid}\space test +%D test \type{\emexgrid} \space test + +\def\smashedgrid + {\dosingleempty\dosmashedgrid} + +\def\dosmashedgrid[#1]% + {\hsmashed + {\setbox\scratchbox=\hbox + {\basegrid + [\c!nx=10,\c!ny=10,\c!dx=1,\c!dy=1, + \c!unit=\bodyfontsize,#1]}% + \hbox to \zeropoint + {\hss\lower.5\ht\scratchbox\box\scratchbox\hss}% + \hbox to \zeropoint + {\hss + \black\vrule\!!width6\linewidth\!!height3\linewidth\!!depth3\linewidth + \hss}}} + +\def\bodyfontgrid + {\hbox + {{\linewidth.1pt\yellow\smashedgrid[\c!nx=30,\c!ny=30,\c!scale=.3333]}% + {\linewidth.2pt\green \smashedgrid[\c!nx=20,\c!ny=20,\c!scale=.5]}% + {\linewidth.3pt\red \smashedgrid[\c!nx=10,\c!ny=10,\c!scale=1]}}} + +\def\emexgrid + {\hbox + {{\linewidth.15pt\green\smashedgrid[\c!nx=20,\c!ny=20,\c!unit=ex]}% + {\linewidth.15pt\red \smashedgrid[\c!nx=10,\c!ny=10,\c!unit=em]}}} + +%D The next few macros are not really public and kind of low +%D level. They are obscure and a bit perverse. + +\definecolor[llblack][s=0.01] + +\def\lowlevelstream#1#2#3% + {\ifinotr \else + \dontleavehmode + \prewordbreak + \bgroup\bgroup % make sure aftergroup stuff is handled + %\let#1#2\optimizetransparencyfalse\black + \infofont\clap{\vl}\ignorespaces#3\unskip\clap{\vl}% + \egroup\egroup + \prewordbreak + \fi + #2{#3}} + +\let\normalPDFcode\PDFcode + +\def\showlowlevelstream + {\def\PDFcode{\lowlevelstream\PDFcode\normalPDFcode}% + \def\special{\lowlevelstream\special\normalspecial}} + +\def\showlowlevelstreamonly + {\def\PDFcode{\lowlevelstream\PDFcode\gobbleoneargument}% + \def\special{\lowlevelstream\special\gobbleoneargument}} + +\startnotmode[mkiv] + + \let\normaldostartgraymode \dostartgraymode + \let\normaldostartgraycolormode\dostartgraycolormode + \let\normaldostartrgbcolormode \dostartrgbcolormode + \let\normaldostartcmykcolormode\dostartcmykcolormode + \let\normaldostartspotcolormode\dostartspotcolormode + + \def\traceddostartgraymode#1% + {#1\normaldostartgraymode{#1}} + + \def\traceddostartgraycolormode#1% + {#1\normaldostartgraycolormode{#1}} + + \def\traceddostartrgbcolormode#1#2#3% + {#1 #2 #3\normaldostartrgbcolormode{#1}{#2}{#3}} + + \def\traceddostartcmykcolormode#1#2#3#4% + {#1 #2 #3 #4\normaldostartcmykcolormode{#1}{#2}{#3}{#4}} + + \def\traceddostartspotcolormode#1#2% + {#1 #2\normaldostartspotcolormode{#1}{#2}} + + \def\showcolormodes + {\let\dostartgraymode \traceddostartgraymode + \let\dostartgraycolormode\traceddostartgraycolormode + \let\dostartrgbcolormode \traceddostartrgbcolormode + \let\dostartcmykcolormode\traceddostartcmykcolormode + \let\dostartspotcolormode\traceddostartspotcolormode} + +\stopnotmode + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/ppchtex.mkii b/Master/texmf-dist/tex/context/modules/mkii/ppchtex.mkii new file mode 100644 index 00000000000..07ca9789ac0 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/ppchtex.mkii @@ -0,0 +1,3555 @@ +%D \module +%D [ file=ppchtex (m-chemie), +%D version=1997.03.19, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\PPCHTEX\ (Plain Pictex Context cHemie \TEX), +%D author=Hans Hagen, +%D date=\currentdate, +%D suggestions={Tobias Burnus, Dirk Kuypers \& Ton Otten}. +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% option=test => boxes +% dummy => file +% final => file / local run +% +% constante van phantom in definitie ONE: \setchemicaltextwidth 300 +% +% it would be interesting to rewrite this module with todays +% experiences and new context functionality, maybe ... + +% Deze module ondersteunt het zetten van chemische +% (structuur)formules. Hoewel de macro' zijn afgestemd op +% CONTEXT, zijn ze ook buiten deze zetomgeving te gebruiken. +% +% Dit is, afgezien van updates, de definitieve versie van +% PPCHTEX. Gebruikersgemak, eenvoud, flexibiliteit, en +% snelheid zijn inmiddels redelijk geoptimaliseerd. Dit neemt +% niet weg dat hier en daar nog verbetering mogelijk is. Dit +% zal dan ook nog gebeuren. +% +% Volgende versies zullen tenminste dezelfde functionaliteit +% hebben. We houden ons natuurlijk het recht voor de kwaliteit +% van de output te verbeteren. Daarnaast staan nog op het +% wensenlijstje: +% +% - optimaliseren in termen van proces-tijd +% - aanpassen naamgeving van interne macro's +% - toevoegen van functionaliteit +% - in \x!-vorm omzetten van GIVES, TB enz. +% +% De mix tussen engels en nederlands lijkt soms verwarrend. +% Meestal zijn verborgen macro's engels en zichtbare macro's +% nederlands. Het gebruik van [ ] en { } sluit aan op andere +% Context-macro's. Hetzelfde geldt voor instellingen en +% \start-\stop-constructies. +% +% De schijnbaar overbodige \bgroup-\egroup constructie +% garandeert aansluiting bij de Context-macro's voor het +% plaatsen van figuren, tabellen en andere floats. +% +% Binnen Context worden de macro's geladen met +% \gebruikextras[chemie]. Daarbij wordt een passende melding +% getoont. Buiten Context genereren we een melding: + +\doifundefined{usemodule} + {\writestatus{loading}{ConTeXt Chemical Macro's / 1996.3.1}} + +% Er kan gebruik worden gemaakt van PiCTeX of PStricks. Een +% van deze pakketten moet van te voren zijn geladen. +% +% \input prepictex.tex (i.g.v. LaTeX) +% \input pictex.tex +% \input postpictex.tex (i.g.v. LaTeX) +% +% of: +% +% \input multido.tex +% \input pstricks.tex +% \input pst-plot.tex +% +% In \CONTEXT\ kan men de modules m-pictex en m-pstricks +% gebruiken. De eerste module laad of efficiente wijze PiCTeX +% en de tweede module koppelt het PSTRICKS kleurmechanisme +% aan dat van \CONTEXT. +% + +% PSTricks: {-\chemicalangle} instead of {*0}, which produces +% faulty ps code when \chemicalangle=0 + +\startcommands dutch english german + + gotochemical: naarchemie gotochemical zurchemie + setupchemical: stelchemiein setupchemical stellechemieein + startchemical: startchemie startchemical startchemie + stopchemical: stopchemie stopchemical stopchemie + definechemical: definieerchemie definechemical definierechemie + chemical: chemie chemical chemie + toptext: boventekst toptext textueber + bottext: ondertekst bottext textunter + midtext: middentekst midtext textmitte + +\stopcommands + +\doifundefined{fiverm} % In the more recent LaTeX versions + {\font\fiverm=cmr5 } % \fiverm is no longer (pre)defined. + +\doifdefinedelse{beginpicture} % PiCTeX + {\doifdefinedelse{startMPdrawing} + {\chardef\chemicaldrawingmode=2 } % MetaPost + {\chardef\chemicaldrawingmode=0 }} % raw + {\doifdefinedelse{psaxes} + {\chardef\chemicaldrawingmode=1 } % PSTricks + {\chardef\chemicaldrawingmode=3 }} % unknown + +\ifcase\chemicaldrawingmode + \writestatus{ppchtex}{using PiCTeX} +\or + \writestatus{ppchtex}{using PSTricks (still experimental)} + \writestatus{ppchtex}{automatic sizing not (yet) supported} +\or + \writestatus{ppchtex}{using PiCTeX and MetaPost} +\else + \writestatus{ppchtex}{load PiCTeX (+pre/post) or PSTricks (+pst_plot) first} + \bgroup + \read16 to \exit + \egroup + \expandafter\endinput +\fi + +% De onderstaande help-informatie (%I) kan worden opgeroepen +% in TeXEdit. De daaropvolgende setup-informatie (%S) kan +% nadat zij is uit deze file is gefilterd met TeXUtil, in +% handleidingen worden gebruikt. In deze file opgenomen +% documentatie (%D en %M) kan worden gebruikt voor een +% technische handleiding. Met %T kunnen templates worden +% gedefinieerd voor TeXEdit. + +%I n=Chemie +%I c=\stelchemiein,\chemie +%I +%I Chemische formules kunnen worden gezet met behulp van de +%I onderstaande commando's: +%I +%I buiten $ en $$ : +%I +%I \chemie[segmenten][symbolen] +%I +%I \startchemie[instellingen] +%I \chemie... +%I \chemie... +%I \stopchemie +%I +%I en binnen $ en $$: +%I +%I \chemie{}{} +%I +%I Voor tekst, uitleg en voorbeelde verwijzen we vooralsnog +%I naar de handleiding. +%P +%I Het gedrag van de macro's kan worden ingesteld met: +%I +%I \stelchemiein[breedte=,hoogte=,links=,rechts=,boven=, +%I onder=,korps=,schaal=,status=,assenstelsel=,kader=, +%I variant=,optie=,formaat=,tekstformaat=,resolutie=, +%I offset=,letter=] +%I +%I Structuren kunnen worden voorgedefinieerd met het commando +%I +%I \definieerchemie[naam]{\chemie...} + +%S \startsetup +%S \command +%S [\!stelchemiein] +%S \type +%S [\c!vars!] +%S \variable +%S [\c!breedte] +%S [\c!number!,\v!passend] +%S [0] +%S \variable +%S [\c!hoogte] +%S [\c!number!,\v!passend] +%S [0] +%S \variable +%S [\c!links] +%S [\c!number!] +%S [0] +%S \variable +%S [\c!rechts] +%S [\c!number!] +%S [0] +%S \variable +%S [\c!boven] +%S [\c!number!] +%S [0] +%S \variable +%S [\c!onder] +%S [\c!number!] +%S [0] +%S \variable +%S [\c!resolutie] +%S [\c!number!] +%S [\outputresolution] +%S \variable +%S [\c!korps] +%S [10pt,11pt,12pt] +%S [\bodyfontsize] +%S \variable +%S [\c!schaal] +%S [\v!klein,\v!middel,\v!groot] +%S [\v!middel] +%S \variable +%S [\c!formaat] +%S [\v!klein,\v!middel,\v!groot] +%S [\v!groot] +%S \variable +%S [\c!tekstformaat] +%S [\v!klein,\v!middel,\v!groot] +%S [\v!groot] +%S \variable +%S [\c!status] +%S [\v!start,\v!stop] +%S [\v!start] +%S \variable +%S [\c!kader] +%S [\v!aan,\v!uit] +%S [\v!uit] +%S \variable +%S [\c!assenstelsel] +%S [\v!aan,\v!uit] +%S [\v!uit] +%S \variable +%S [\c!optie] +%S [\v!test] +%S [] +%S \variable +%S [\c!variant] +%S [1,2] +%S [1] +%S \variable +%S [\c!offset] +%S [HIGH,LOW] +%S [LOW] +%S \variable +%S [\c!letter] +%S [\c!command!] +%S [\rm] +%S \stopsetup + +%S \startsetup +%S \command +%S [\v!startchemie] +%S \type +%S [\c!vars!\c!stp!] +%S \inheritvariable +%S [\v!stelchemiein] +%S [] +%S \stopsetup + +%S \startsetup +%S \command +%S [\v!chemie] +%S \type +%S [\c!vals!\c!vals!] +%S \value +%S [\c!list!] +%S [] +%S \value +%S [\c!list!] +%S [] +%S \stopsetup + +%S \startsetup +%S \command +%S [definieerchemie] +%S \type +%S [\c!val!\c!arg!] +%S \value +%S [\c!text!] +%S [] +%S \stopsetup + +\unprotect + +% Om te voorkomen dat sub- en superscripts botsen passen we +% wat fontdimen's aan (Knuth, The TeXBook, p179). Helaas +% kunnen deze instellingen niet lokaal worden gehouden door +% groeperen, vandaar dat een en ander moet worden geset ‚n +% gereset. +% +% Er dient een relatie te worden gelegd met de afmetingen +% van de letters. In een eerdere versie werden daartoe de +% \fontdimen's opgehoogd. Omdat dit problemen gaf bij +% scaled fonts, is bij nader inzien gekozen voor de +% onderstaande oplossing, waarbij de nieuwe waarden worden +% afgeleid van de x-height (\fontexheight). De factor 0.70 +% is min of meer experimenteel vastgesteld. Soms worden de +% regels iets verder uit elkaar gezet. Jammer. Italic fonts +% hebben grotere cijfers en vallen min of meer uit de boot. + +\newif\ifloweredsubscripts + +% Due to some upward incompatibality of LaTeX to LaTeX2.09 +% and/or LaTeX2e we had to force \@@dochemicalstyle. Otherwise +% some weird \nullfont error comes up. + +\def\beginlatexmathmodehack + {\ifmmode + \let\endlatexmathmodehack=\relax + \else + \def\endlatexmathmodehack{$}$\@@dochemicalstyle\empty + \fi} + +\def\setsubscripts% + {\beginlatexmathmodehack + \def\dosetsubscript##1##2##3% + {\dimen0=##3\fontexheight##2% + \setxvalue{@@\string##1\string##2}{\the##1##2\relax}% + ##1##2=\dimen0\relax}% + \def\dodosetsubscript##1##2% + {\dosetsubscript{##1}{\textfont 2}{##2}% + \dosetsubscript{##1}{\scriptfont 2}{##2}% + \dosetsubscript{##1}{\scriptscriptfont2}{##2}}% + %dodosetsubscript\mathsupnormal {?}% + \dodosetsubscript\mathsubnormal {.7}% + \dodosetsubscript\mathsubcombined{.7}% + \global\loweredsubscriptstrue + \endlatexmathmodehack} + +\def\resetsubscripts + {\ifloweredsubscripts + \beginlatexmathmodehack + \def\doresetsubscript##1##2% + {\dimen0=\getvalue{@@\string##1\string##2}\relax + ##1##2=\dimen0}% + \def\dodoresetsubscript##1% + {\doresetsubscript{##1}{\textfont2}% + \doresetsubscript{##1}{\scriptfont2}% + \doresetsubscript{##1}{\scriptscriptfont2}}% + %dodoresetsubscript\mathsupnormal + \dodoresetsubscript\mathsubnormal + \dodoresetsubscript\mathsubcombined + \global\loweredsubscriptsfalse + \endlatexmathmodehack + \fi} + +\ifx\Umathchar\undefined \else + % for the moment we nil them, soon we will have a proper + % way to deal with this + \let\setsubscripts \relax + \let\resetsubscripts\relax +\fi + +\def\doresetsubscripts + {\resetsubscripts} + +\def\sethighsubscripts + {\resetsubscripts + \let\dosetsubscripts=\relax} + +\def\setlowsubscripts + {\def\dosetsubscripts{\setsubscripts}} + +\setlowsubscripts + +\newcount\horchemical % t.z.t. \newcounter +\newcount\verchemical % t.z.t. \newcounter +\newcount\txtchemical % t.z.t. \newcounter +\newcount\levchemical % t.z.t. \newcounter + +\newif\ifinchemical \inchemicalfalse +\newif\iffixedchemical \fixedchemicalfalse + +\newbox\chemicalsymbols + +% Eigenlijk moeten de constanten en variabelen in cont-nl.tex +% staan. Dit pakket is echter relatief onafhankelijk van CONTEXT. + +\definesystemvariable {chemical} + +\definesystemconstant {chemical} + +\definesystemconstant {translate} +\definesystemconstant {distance} +\definesystemconstant {mirror} +\definesystemconstant {rotate} +\definesystemconstant {substitute} +\definesystemconstant {angle} + +\definesystemconstant {executechemical} +\definesystemconstant {chemicaltextelement} +\definesystemconstant {chemicallinesegment} +\definesystemconstant {chemicalcircsegment} + +\def\chemicalspace {\quad} + +% begin van experiment: +% +% De onderstaande twee macro's kunnen worden gebruikt voor +% bijvoorbeeld een interactiemechanisme. +% +% \localgotochemical {verwijzing} {tekst} +% \localthisischemical {verwijzing} + +\def\dowithchemical% + {} + +\doifdefinedelse{@@iastate} + {\def\localgotochemical#1#2{\naarbox{#2}[#1]}% + \def\localthisischemical#1{\pagereference[#1]}} + {\def\localgotochemical#1{}% + \def\localthisischemical#1{}} + +% eind van experiment + +\def\setchemicalmaximum #1 + {\def\maxchemical{#1}} + +\def\doifchemicalnumber#1#2#3% + {\doifnumberelse{#1} + {\ifnum#1>\maxchemical\relax + \writestatus{ppchtex}{number #1 is skipped}% + \else + #3% + \fi} + {\unknownchemical{#2}}}% + +\newif\ifsmallchemicaltext + +\let\@@localchemicalstyle\empty + +\def\setupchemicalformat[#1]% + {\processaction + [\getvalue{#1\c!size}] + [ \v!small=>\def\@@localchemicalformat{\scriptscriptstyle}, + \v!medium=>\def\@@localchemicalformat{\ifsmallchemicaltext\scriptscriptstyle\else\scriptstyle\fi}, + \v!big=>\def\@@localchemicalformat{\ifsmallchemicaltext\scriptstyle\else\textstyle\fi}, + \s!unknown=>\def\@@localchemicalformat{\getvalue{#1\c!size}}]% + \processaction + [\getvalue{#1\c!textsize}] + [ \v!small=>\def\@@localchemicalstyle{\scriptscriptstyle}, + \v!medium=>\def\@@localchemicalstyle{\ifsmallchemicaltext\scriptscriptstyle\else\scriptstyle\fi}, + \v!big=>\def\@@localchemicalstyle{\ifsmallchemicaltext\scriptstyle\else\textstyle\fi}, + \s!unknown=>\def\@@localchemicalstyle{\getvalue{#1\c!textsize}}]% + \processaction + [\getvalue{#1\c!scale}] + [ \v!small=>\def\@@localchemicalscale{500}, + \v!medium=>\def\@@localchemicalscale{625}, + \v!big=>\def\@@localchemicalscale{750}, + \s!unknown=>\def\@@localchemicalscale{\getvalue{#1\c!scale}}]} + +\def\@@currentchemicalformat + {\ifinchemical + \@@localchemicalformat + \else + \@@localchemicalstyle + \fi} + +\def\dosetupchemical[#1]% + {\getparameters[\??chemical\s!chemical][#1]% + \doifelse{\@@chemicalchemicaloffset}{LOW} + {\setlowsubscripts} + {\sethighsubscripts}% + \setupchemicalformat[\??chemical\s!chemical]% + \ignorespaces} + +\def\setupchemical + {\dosingleargument\dosetupchemical} + +\def\@@dochemicalstyle% % default mapping + {\@@chemicalstyle} + +\def\@@dochemicalcolor% % no mapping yet + {} + +\def\@@chemicalstyle % $inner-style$ % (overloaded) + {\@@chemicalchemicalstyle} % $$outer-style$$ + +\def\@@writechemicalstate#1#2% + {} + +\def\@@beginchemicallocalpicture + {\ifcase\chemicaldrawingmode + \beginpicture + \or + \pspicture(0,0)(0,0) % is this permitted ? + \or + \pushMPdrawing + \startMPdrawing + %prologues := 1 ; + %input mp-tool ; + u := 10*\@@chemicalunit; + bboxmargin := 0pt ; + pickup pencircle scaled 2u ; % ??? + \stopMPdrawing + \beginpicture + \fi} + +\def\@@endchemicallocalpicture#1#2% + {\ifcase\chemicaldrawingmode + \endpicture + \or + \endpspicture + \or + \resetchemicalcoordinates + \setbox2\hbox{\MPshiftdrawingtrue\MPstaticgraphictrue\getMPdrawing}% + \wd2=\!!zeropoint + \ht2=\!!zeropoint + \dp2=\!!zeropoint + \put {\box2} at 0 0 + \endpicture + \popMPdrawing + \fi} + +\def\@@beginchemicalpicture#1#2#3#4% + {\ifnum\chemicaldrawingmode=1 + \pspicture(#1,#3)(#2,#4)% + \def\account##1##2{}% + \psaxes[axesstyle=none,labels=none,ticks=none](#1,#3)(#2,#4)% + \else + \beginpicture + \setplotarea + x from {#1} to {#2}, + y from {#3} to {#4} + \iffixedchemical + \accountingon + \def\account##1##2% + {\put {} at {##1} {##2} }% + \else + \accountingoff + \def\account##1##2{}% + \fi + \fi + \ignorespaces} + +\def\@@endchemicalpicture% + {\ifcase\chemicaldrawingmode + \put {\box\chemicalsymbols} at 0 0 % elders + \endpicture + \or + \rput(0,0){\box\chemicalsymbols}% + \endpspicture + \or + \put {\box\chemicalsymbols} at 0 0 % elders + \ifMPdrawingdone + \resetchemicalcoordinates + \setbox2\hbox{\MPshiftdrawingtrue\MPstaticgraphictrue\getMPdrawing}% + \wd2=\!!zeropoint + \ht2=\!!zeropoint + \dp2=\!!zeropoint + \put {\box2} at 0 0 % + \fi + \endpicture + \fi} + +\def\@@setchemicalcoordinatesystem#1% + {\edef\@@chemicalunit{#1}% + \ifcase\chemicaldrawingmode + \setcoordinatesystem units <\@@chemicalunit,\@@chemicalunit> % + \or + \psset{unit=\@@chemicalunit}% + \or + \setcoordinatesystem units <\@@chemicalunit,\@@chemicalunit> % + \startMPdrawing + %input mp-tool ; + %prologues := 1 ; + u := 10*#1; + bboxmargin := 0pt ; + pickup pencircle scaled 2u ; % ??? + \stopMPdrawing + \fi} + +\ifx\MPdivten\undefined % hack to prevent overflows in mp + \def\MPdivten[#1]{\withoutpt\the\dimexpr#1pt/10\relax} +\fi + +\def\@@setchemicalaxis#1#2#3#4% + {\ifcase\chemicaldrawingmode + \axis + bottom shiftedto y=0 + ticks from {#1} to {#2} by 500 / + \axis + left shiftedto x=0 + ticks from {#3} to {#4} by 500 / % + \or + \psaxes[labels=none,Dx=500,Dy=500](0,0)(#1,#3)(#2,#4)% + \or + \global\MPdrawingdonetrue + % we need to div beforehand because of mp limitations + \startMPdrawing + x1 := \MPdivten[#1]u ; x2 := \MPdivten[#2]u; + y1 := \MPdivten[#3]u ; y2 := \MPdivten[#4]u; + draw z1--(x2,y1)--z2--(x1,y2)--cycle ; + d := 50u ; dd := 10u ; + draw (x1,0)--(x2,0) ; + draw (0,y1)--(0,y2) ; + for i=d step -d until x1: draw (i,dd)--(i,-dd) ; endfor ; + for i=d step d until x2: draw (i,dd)--(i,-dd) ; endfor ; + for i=d step -d until y1: draw (-dd,i)--(dd,i) ; endfor ; + for i=d step d until y2: draw (-dd,i)--(dd,i) ; endfor ; + \stopMPdrawing + \fi} + +\def\@@setsecondchemicalplotsymbol% + {\ifcase\chemicaldrawingmode + \!!widtha=50.8mm + \divide\!!widtha by \@@chemicalresolution\relax + \plotsymbolspacing=\!!widtha + \setplotsymbol({\vrule\!!height\!!widtha\!!width\!!widtha})% + \fi} + +% Something for Dirk: + +\newcount \currentchemical + +%\newif \ifskipchemical + +\def\setchemicaldimensions#1#2#3% + {\bgroup + \global\advance\currentchemical by 1 + \dimen0=#1\relax + \dimen2=#2\relax + \dimen4=#3\relax + \setxvalue{chemical::\the\currentchemical}% + {\noexpand\docommand{\the\dimen0}{\the\dimen2}{\the\dimen4}}% + \egroup} + +%\def\getchemicaldimensions#1#2#3% +% {\global\advance\currentchemical by 1 +% \def\docommand##1##2##3% +% {#1=##1\relax#2=##2\relax#3=##3\relax}% +% \doifdefinedelse{chemical::\the\currentchemical} +% {\getvalue{chemical::\the\currentchemical}} +% {\docommand{6cm}{4cm}{0cm}}} +% +%\def\savechemicaldimensions% +% {\bgroup +% \writestatus{ppchtex}{saving dimensions in ppchtex.dim}% +% \def\docommand##1##2##3% +% {\immediate\write\scratchwrite +% {\noexpand\setchemicaldimensions{##1}{##2}{##3}}}% +% \immediate\openout\scratchwrite=ppchtex.dim +% \scratchcounter=0 +% \loop +% \ifnum\scratchcounter<\currentchemical +% \advance\scratchcounter by 1 +% \getvalue{chemical::\the\scratchcounter}% +% \repeat +% \immediate\closeout\scratchwrite +% \egroup} +% +%\def\loadchemicaldimensions% oh, how nice it would be to use +% {\bgroup % one of the context read commands +% \global\currentchemical=0 +% \immediate\openin\scratchread=./ppchtex.dim +% \ifeof\scratchread +% \immediate\closein\scratchread +% \global\skipchemicalfalse +% \else +% \immediate\closein\scratchread +% \input ./ppchtex.dim\relax +% \ifnum\currentchemical>0 +% \writestatus{ppchtex}{loading dimensions from ppchtex.dim}% +% \global\skipchemicaltrue +% \else +% \global\skipchemicalfalse +% \fi +% \global\currentchemical=0 +% \global\let\savechemicaldimensions=\relax +% \fi +% \egroup +% \global\let\loadchemicaldimensions=\relax} + +\ifx\normalchemicalframe\undefined + \let\normalchemicalframe\hbox % hook for educational purposes +\fi + +\unexpanded\def\complexstartchemical[#1]% + {\copyparameters + [\??chemical][\??chemical\s!chemical] + [\c!width,\c!height,\c!left,\c!right,\c!top,\c!bottom, + \c!bodyfont,\c!size,\c!scale,\c!state,\c!frame,\c!axis,\c!factor, + \c!location,\c!option,\c!alternative,\c!resolution,\c!offset,\c!style, + \c!color,\c!rulecolor,\c!rulethickness]% + \getparameters + [\??chemical] + [#1]% + % + \setupchemicalformat[\??chemical]% + % + \ifnum\chemicaldrawingmode=2 + \resetMPdrawing + \fi + % + \doif{\@@chemicalalternative}{2} + {\@@setsecondchemicalplotsymbol}% + % + \doif{\@@chemicalaxis}\v!on + {\let\chemicalframe\hbox}% + % + \!!counta=250000 + \divide\!!counta by \@@localchemicalscale + \!!widtha=\@@chemicalbodyfont + \divide\!!widtha by \!!counta + \@@setchemicalcoordinatesystem{\the\!!widtha}% + % + % \!!counta = -x \!!countc = -y + % \!!countb = +x \!!countd = +y + % + \def\calculateaxis##1##2##3##4##5% + {##1=##3\relax + ##2=##4\relax + \ifnum##5=0 + \ifnum##3=0 + \ifnum##4=0 + ##1=2000 + ##2=2000 + \fi + \fi + \else + \ifnum##3=0 + \ifnum##4=0 + ##1=##5\relax + \divide##1 by 2 + ##2=##1\relax + \else + ##1=##5\relax + \advance##1 by -##2\relax + \fi + \else + \ifnum##4=0 + ##2=##5\relax + \advance##2 by -##1\relax + \fi + \fi + \fi}% + \fixedchemicalfalse + \doif\@@chemicalwidth\v!fit + {\edef\@@chemicalwidth + {\ifnum\chemicaldrawingmode=1 2000 \else 1 \fi}% + \fixedchemicaltrue}% + \doif\@@chemicalheight\v!fit + {\edef\@@chemicalheight + {\ifnum\chemicaldrawingmode=1 2000 \else 1 \fi}% + \fixedchemicaltrue}% + \doifelse\@@chemicallocation\v!intext + {\!!counta=0 \!!countb=0 + \!!counta=0 \!!countd=0 } + {\calculateaxis + \!!counta\!!countb + \@@chemicalleft\@@chemicalright\@@chemicalwidth + \calculateaxis + \!!countc\!!countd + \@@chemicalbottom\@@chemicaltop\@@chemicalheight}% + % + \edef\@@chemheight {\the\!!countc}% + \edef\@@chemdepth {\the\!!countd}% + \edef\@@chemicaltop {\the\!!countc}% + \edef\@@chemicalbottom{\the\!!countd}% + % + \doifinsetelse\v!on{\@@chemicalframe,\@@chemicalaxis} + {\def\@@chemicalborder{\chemicalframe}} + {\def\@@chemicalborder{\normalchemicalframe}}% + % + \setbox0=\hbox\bgroup % this was a \vbox which took \hsize + % + \@@beginchemicalpicture + {-\the\!!counta}{\the\!!countb} + {-\the\!!countc}{\the\!!countd}% + \doif{\@@chemicalstate}\v!start + {\doif\@@chemicalaxis\v!on + {\@@setchemicalaxis + {-\the\!!counta}{\the\!!countb} + {-\the\!!countc}{\the\!!countd}}}% + \doifelse\@@chemicaloption\v!test + {\def\@@writechemicalstate##1##2% + {\convertargument##2\to\ascii + \writestatus{##1}{\ascii}}} + {\def\@@writechemicalstate##1##2{}}% + \ignorespaces} + +\def\dostartchemical% + {\catcode`\^=\@@superscript% t.b.v. \enableduplication + \catcode`\_=\@@subscript % t.b.v. de zekerheid + \begingroup + \inchemicaltrue + \def\toptext##1{\gdef\thetoptext{##1}\ignorespaces}\toptext{}% + \def\bottext##1{\gdef\thebottext{##1}\ignorespaces}\bottext{}% + \def\midtext##1{\gdef\themidtext{##1}\ignorespaces}\midtext{}% + \def\@@chemicalpostponed{}% + \complexorsimpleempty\startchemical} + +\def\startchemical + {\bgroup % t.b.v. ungrouped floats +% \loadchemicaldimensions +% \ifskipchemical +% \def\dostartchemical% +% {\def\dummy[####1]{}\dosingleempty\dummy}% +% \def\chemical% +% {\def\dummy[####1][####2][####3]{}\dotripleempty\dummy}% +% \def\toptext##1{}% +% \def\midtext##1{}% +% \def\bottext##1{}% +% \fi + \dostartchemical} + +\def\stopchemical + {%\ifskipchemical + % \getchemicaldimensions{\dimen0}{\dimen2}{\dimen4}% + % \dimen8=\dimen2\advance\dimen8 by \dimen4 + % \setbox0=\vbox to \dimen8 + % {\vss\hbox to \dimen0{\hss\the\currentchemical\hss}\vss}% + % \wd0=\dimen0\ht0=\dimen2\dp0=\dimen4 + % \chemicalframe{\box0}% + %\else + \checkchemicalpicture + \@@endchemicalpicture + \egroup + \ifnum\chemicaldrawingmode=1 + \dimen0=\@@chemicalunit + \setbox0=\hbox{\lower\@@chemdepth\dimen0\box0}% + \ht0=\@@chemheight\dimen0 + \dp0=\@@chemdepth\dimen0 + \fi + \dimen0=\ht0 + \advance\dimen0 by \dp0 + \inchemicalfalse % enables \chemie{} in text + \setbox4=\alignedchemical\themidtext + \setbox6=\alignedchemical\thetoptext + \setbox8=\alignedchemical\thebottext + \setbox4=\hbox to \wd0 + {\strut\hss$\vcenter{\box4}$\hss}% + \setbox2=\vbox to \dimen0 + {\hbox to \wd0{\strut\hss\box6\hss} + \vfill + \hbox to \wd0{\strut\hss\box8\hss} + \vss}% disables the depth + \wd0=0pt \wd4=0pt + \ht2=\ht0 \dp2=\dp0 + \ht4=\ht0 \dp4=\dp0 + %\setchemicaldimensions{\wd2}{\ht2}{\dp2}% + \@@chemicalborder{\box0\box4\box2}% text on top of chemicals + \endgroup + %\fi + \ignorespaces + \egroup} % t.b.v. ungrouped floats + +\def\alignedchemical#1% + {\vtop + {\def\par{\egroup\hbox\bgroup\strut}% + \let\\=\par + \let\endgraf=\par + \hbox\bgroup\strut#1\egroup}} + +% \setchemicalcoordinates{#1}{#2} +% +% #1: verplaatsing in x-richting +% #2: verplaatsing in y-richting + +\newif\ifchemicaldirection + +\def\checkchemicaldirection#1#2% + {\ifchemicaldirection + \ifnum#1>0 \advance\horchemical -\chemicaldirection \fi + \ifnum#1<0 \advance\horchemical +\chemicaldirection \fi + \ifnum#2>0 \advance\verchemical -\chemicaldirection \fi + \ifnum#2<0 \advance\verchemical +\chemicaldirection \fi + \chemicaldirectionfalse + \fi} + +\def\processchemicaldirection% + {\chemicaldirectiontrue\processchemicaltranslate} + +\def\setchemicalcoordinates#1#2% + {\advance\horchemical #1\relax + \advance\verchemical #2\relax + \checkchemicaldirection{#1}{#2}% + \!!counta=-\horchemical\edef\chemicalxoffset{\the\!!counta}% + \!!countb=-\verchemical\edef\chemicalyoffset{\the\!!countb}% + \ifnum\chemicaldrawingmode=1 + % njet + \else + \setcoordinatesystem point at {\the\horchemical} {\the\verchemical} + \fi} + +\def\resetchemicalcoordinates + {\horchemical=0 + \verchemical=0 + \edef\chemicalxoffset{0}% + \edef\chemicalyoffset{0}% + \ifnum\chemicaldrawingmode=1 + % njet + \else + \setcoordinatesystem point at 0 0 + \fi} + +\def\restorechemicalcoordinates + {%\writestatus{ppchtex}{restoring \the\horchemical,\the\verchemical}% + \edef\chemicalxoffset{\the\horchemical}% + \edef\chemicalyoffset{\the\verchemical}% + \ifnum\chemicaldrawingmode=1 + % njet + \else + \setcoordinatesystem point at {\the\horchemical} {\the\verchemical} + \fi} + +\def\setchemicaltranslate #1 #2 #3 + {\setvalue{\s!translate#1}{\setchemicalcoordinates{#2}{#3}}} + +\def\processchemicaltranslate#1% + {\def\doprocess[##1##2]% + {\doifchemicalnumber{##1}{MOV#1} + {\ifnum##1=0 + \def\chemicaloffset{0}% incompatible change + \resetchemicalcoordinates + \else + \getvalue{\s!translate##1}% + \dochemicaloffset{##1}% + \def\chemicaloffset{0}% + \fi}}% + \doprocess[#1]} + +\def\setchemicaldistance #1 + {\setvalue{\s!distance1}{\setchemicalcoordinates{-#1}{ 0}}% + \setvalue{\s!distance2}{\setchemicalcoordinates{ 0}{ #1}}% + \setvalue{\s!distance3}{\setchemicalcoordinates{ #1}{ 0}}% + \setvalue{\s!distance4}{\setchemicalcoordinates{ 0}{-#1}}} + +\def\setchemicaldirection #1 + {\def\chemicaldirection{#1}} + +\def\processchemicaldistance#1% + {\def\doprocess[##1##2]% + {\doifchemicalnumber{##1}{ADJ#1} + {\ifnum##1=0 + \resetchemicalcoordinates + \else + \def\@@chemicalpostponed{\getvalue{\s!distance##1}}% + \@@chemicalpostponed + \fi}}% + \doprocess[#1]} + +\def\setchemicalsubstitute #1 + {\setvalue{\s!substitute1}{\setchemicalcoordinates{-#1}{ 0}}% + \setvalue{\s!substitute2}{\setchemicalcoordinates{ 0}{ #1}}% + \setvalue{\s!substitute3}{\setchemicalcoordinates{ #1}{ 0}}% + \setvalue{\s!substitute4}{\setchemicalcoordinates{ 0}{-#1}}} + +\def\processchemicalsubstitute#1% + {\def\doprocess[##1##2]% + {\doifchemicalnumber{##1}{SUB#1} + {\ifnum##1=0 + \resetchemicalcoordinates + \else + \def\@@chemicalpostponed{\getvalue{\s!substitute##1}}% + \@@chemicalpostponed + \fi}}% + \doprocess[#1]} + +% Het is mogelijk een offset of move meerdere malen uit te +% voeren, door een nummer voor het commando te plaatsen. + +\def\chemicalrepeat {1} + +\def\redoprocesschemical[#1#2]% + {\doifinstringelse{#1}{0123456789.} + {\edef\chemicalrepeat{\chemicalrepeat#1}% + \redoprocesschemical[#2]} + {\processchemical[#1#2]% + \def\chemicalrepeat{1}}} + +\def\doprocesschemical[#1#2]#3% + {\doifinstringelse{#1}{0123456789.} + {\def\chemicalrepeat{#1}% + \redoprocesschemical[#2]} + {#3}} + +% \dochemicaloffset{#1} +% +% #1: binding + +\def\chemicaloffset{0} + +\def\processchemicaloffset#1% + {\dimen0=62500 sp % real calc on cardinals, funny number + \dimen0=\chemicalrepeat\dimen0 + \divide\dimen0 by \@@localchemicalscale + \!!counta=\dimen0 + \def\doprocess[##1##2]% + {\doifinstringelse{##1}{128} + {\edef\chemicaloffset{\the\!!counta}} + {\doifinstringelse{##1}{456} + {\edef\chemicaloffset{-\the\!!counta}} + {\doifelse{##1}{0} + {\edef\chemicaloffset{0}} + {\unknownchemical{OFF#1}}}}}% + \doprocess[#1]} + +\def\dochemicaloffset#1% + {\ifnum\chemicaloffset=0 + \def\undochemicaloffset{}% + \else + \setchemicalcoordinates{-\chemicaloffset}{0}% + \def\undochemicaloffset% + {\setchemicalcoordinates{\chemicaloffset}{0}% + \def\undochemicaloffset{}}% + \fi} + +\def\processchemicalphantom#1#2% + {\setbox0=\hbox + {\def\splitoff##1????{##1}% + $\@@dochemicalstyle{\@@localchemicalformat\splitoff#2}$}% + \dimen0=.25\wd0 + \divide\dimen0 by \@@localchemicalscale + \!!counta=\dimen0 + \doifinstringelse{#1}{128} + {\edef\chemicaloffset{\the\!!counta}} + {\doifinstringelse{#1}{456} + {\edef\chemicaloffset{-\the\!!counta}} + {\doifelse{#1}{0} + {\edef\chemicaloffset{0}} + {\unknownchemical{OF#1:#2}}}}} + +% \dosetchemicalrotation{#1}{#2} +% +% #1: cos(phi) +% #2: sin(phi) + +\def\chemicalrotation {1} +\def\chemicalangle {0} +\def\chemicalxoffset {0} +\def\chemicalyoffset {0} + +\def\setchemicalmirror#1% + {\setvalue{\s!mirror#1}{*}} + +\def\resetchemicalmirror#1% + {\resetvalue{\s!mirror#1}} + +\def\togglechemicalmirror#1% + {\doifelse{\getvalue{\s!mirror#1}}{*} + {\resetchemicalmirror{#1}} + {\setchemicalmirror{#1}}} + +\def\setchemicalrotation #1 #2 #3 #4 #5 #6 #7 #8 #9 + {\setvalue{\s!rotate1.#1}{\dosetchemicalrotation{#2}{#3}}% + \setvalue{\s!rotate2.#1}{\dosetchemicalrotation{#4}{#5}}% + \setvalue{\s!rotate3.#1}{\dosetchemicalrotation{#6}{#7}}% + \setvalue{\s!rotate4.#1}{\dosetchemicalrotation{#8}{#9}}} + +\def\setchemicalangle #1 #2 #3 #4 #5 + {\setvalue{\s!angle1.#1}{\dosetchemicalangle{#2}}% + \setvalue{\s!angle2.#1}{\dosetchemicalangle{#3}}% + \setvalue{\s!angle3.#1}{\dosetchemicalangle{#4}}% + \setvalue{\s!angle4.#1}{\dosetchemicalangle{#5}}} + +\def\chemicalrotate[#1]% + {\doifdefinedelse{\s!mirror#1} + {\getvalue{\s!rotate\chemicalrotation.#1\getvalue{\s!mirror#1}}% + \getvalue{\s!angle\chemicalrotation.#1\getvalue{\s!mirror#1}}} + {\getvalue{\s!rotate\chemicalrotation.#1}% + \getvalue{\s!angle\chemicalrotation.#1}}} + +\def\dosetchemicalangle#1% zwak zie onder + {\def\chemicalangle{#1}} + +\def\dosetchemicalrotation#1#2% + {\ifnum\chemicaldrawingmode=1 + % njet + \else + \startrotation by {#1} {#2} %% \stoprotation (t.b.v. testen) + \fi} + +\def\doresetchemicalrotation + {\ifnum\chemicaldrawingmode=1 + % njet + \else + \stoprotation + \fi} + +\def\processchemicalrotation#1% + {\def\doprocess[##1##2]% + {\doifnumberelse{##1} + {\def\chemicalrotation{##1}} + {\unknownchemical{ROT#1}}}% + \doprocess[#1]} + +% \filtertextelement[#1][#2][#3][#4] +% +% #1: volgnummer +% #2: offset in uitlijningen +% #3: lijst met uitlijningen -> \chemicalloca +% #4: lijst met teksten -> \chemicaltext + +\def\setchemicallocation#1% + {\doifelse{#1}{} + {\edef\chemicalloca{c}} + {\edef\chemicalloca{#1}}} + +\newif\iffixedchemicaltext + +\def\filterchemicaltextelement[#1][#2][#3][#4]% + {\ifchemicaltextconstant + \def\chemicaltext{#4}% + \setchemicallocation{}% + \else + \ifnum#1=0\relax + \setchemicallocation{}% + \else + \iffixedchemicaltext + \!!counta#2 + \else + \!!counta=\chemicalrotation + \advance\!!counta -1 + \multiply\!!counta #2 + \advance\!!counta #1 + \fi + \getfromcommalist[#3][\the\!!counta]% + \setchemicallocation\commalistelement + \fi + \ifchemicalpicture + \let\chemicaltext\relax + \else + \advance\txtchemical 1 + \getfromcommalist[#4][\txtchemical]% + \let\chemicaltext\commalistelement + \fi + \fi + \fixedchemicaltextfalse} + +% \putchemicaltext{#1}{#2} +% +% #1 : x-coordinaat +% #2 : y-coordinaat +% +% \chemicaltext en \chemicalloca worden met \gettextelement +% opgehaald uit de tweede set bij \chemie +% +% Ten behoeve van testdoeleinden wordt gebruik gemaakt van +% \chemicalframe in plaats van het meer sjieke, maar tevens +% meer trage \framed. + +\ifx\ruledhbox\undefined + \def\chemicalframe#1% + {\hbox + {\vrule\hskip-.4pt + \vbox{\hrule\vskip-.4pt\hbox{#1}\vskip-.4pt\hrule}% + \hskip-.4pt\vrule}} +\else + \def\chemicalframe#1% + {\ruledhbox{#1}} +\fi + +\def\doputchemicaltext#1 [#2] at #3 #4 % + {\ifnum\chemicaldrawingmode=1 + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\expanded{\rput[#2]{\chemicalangle}(#3,#4){#1}}}% + \else + \put {#1} [#2] at {#3} {#4} % + \fi} + +\def\dodoifsinglelocation#1#2\\#3% + {\ifx#2\relax#3\fi} + +\def\doifsinglelocationelse#1% + {\expandafter\dodoifsinglelocationelse#1\relax\\} + +\def\putchemicaltext#1#2% + {\enablechemicalspecials + \ifchemicalpicture + \setchemicalpicture{#1}{#2}% + \else + \doifelse\@@chemicaloption\v!test + {\def\@@chemicalframe{\chemicalframe}} + {\def\@@chemicalframe{}}% + \dosetsubscripts + \setbox2=\hbox{\@@dochemicalcolor + $\@@dochemicalstyle{\@@localchemicalformat \chemicaltext}$}% + \setbox4=\hbox{$\@@dochemicalstyle{\@@localchemicalformat C_2^2}$}% + \setbox6=\hbox{$\@@dochemicalstyle{\@@localchemicalformat O}$}% or C + \doresetsubscripts + \doifnot\@@chemicallocation\v!intext + {\ht2=\ht4 + \dp2=\dp4}% + \setbox2=\hbox{\@@chemicalframe{\box2}}% + \ifdim\wd2>\wd6 + \doifelse{#1}{0} + {\doifnot{#2}{0}{\wd2=\wd6}} + {%\doifsinglelocation\chemicalloca + {\doifinset{\chemicalloca}{t,b}{\wd2=\wd6}}}% common ? + \fi + \expanded + {\doputchemicaltext + {\noexpand\dowithchemical{\copy2}} % per se \copy2 i.p.v. \box2 + [\chemicalloca] at {#1} {#2} } + \nomoreaccounting + \fi + \disablechemicalspecials} + +\def\setchemicaltextelement #1 #2 #3 + {\setvalue{\s!chemicaltextelement#1}{\putchemicaltext{#2}{#3}}} + +\def\getchemicalfixedtextelement% + {\fixedchemicaltexttrue + \getchemicaltextelement} + +\def\getchemicaltextelement[#1][#2][#3][#4][#5]% + {\filterchemicaltextelement[#2][#3][#4][#5]% + \doifelse{#2}{0} + {\dochemicaloffset{#2}% % incompatible change + \putchemicaltext{0}{0}% + \undochemicaloffset} % incompatible change + {\chemicalrotate[#2]% + \dochemicaloffset{#2}% + \def\chemicaltextelementnumber{#2}% + \getvalue{\s!chemicaltextelement#1}% + \getvalue{\s!chemicaltextelement#11}% + \getvalue{\s!chemicaltextelement#12}% + \getvalue{\s!chemicaltextelement#13}% + \undochemicaloffset}} + +\def\processchemicaltextelement#1#2#3#4#5% + {\def\doprocess[##1##2##3##4##5]% + {\doifelse{##1}{?} + {\doprocess[1..\maxchemical ????]} + {\doifchemicalnumber{##1}{#1#2} + {\doifelse{##2##3}{..} + {\doifchemicalnumber{##4}{#1#2} + {\getchemicaltextelement[#1][##1][#4][#5][#3]% + \doifnot{##1}{##4} + {\!!counta=##1\relax + \advance\!!counta by 1 + \edef\nextsegment{\the\!!counta}% + \doprocess[\nextsegment..##4##5]}}} + {\getchemicaltextelement[#1][##1][#4][#5][#3]% + \doifnot{##2}{?}{\doprocess[##2##3##4##5]}}}}}% + \doprocess[#2]% + \smallchemicaltextfalse} + +\def\processchemicalsmalltextelement% + {\smallchemicaltexttrue\processchemicaltextelement} + +\def\processchemicalsmalltextconstant% + {\smallchemicaltexttrue\processchemicaltextconstant} + +\def\processchemicalunrotatedtextelement#1#2#3#4#5#6% + {\bgroup + \xdef\@@xxx{0}% + \xdef\@@yyy{0}% + \def\putchemicaltext##1##2% + {\xdef\@@xxx{##1}% + \xdef\@@yyy{##2}}% + \getvalue{\s!chemicaltextelement#1}% + \egroup + \bgroup + \def\doputchemicaltext##1 [##2] at ##3 ##4 % + {\ifnum\chemicaldrawingmode=1 + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\rput{\chemicalangle}(\@@xxx,\@@yyy){\expanded{\rput[##2](##3,##4){##1}}}}% + \else + \put + {\stoprotation \setcoordinatesystem point at 0 0 + \expanded{\put {##1} [##2] at {##3} {##4} }} + at {\@@xxx} {\@@yyy} + \fi}% + \processchemicaltextelement{#2}{#3}{#4}{#5}{#6}% + \egroup} + +\newif\ifchemicaltextconstant + +\def\processchemicaltextconstant#1#2#3#4% + {\chemicaltextconstanttrue + \let\@@oldchemicalframe\@@chemicalframe + \let\@@chemicalframe\relax + \processchemicaltextelement{#1}{#2}{#3}{#4}{}% + \let\@@chemicalframe\@@oldchemicalframe + \chemicaltextconstantfalse} + +% \plotchemicalline{#1}{#2}{#3}{#4} +% +% #1: x-coordinaat beginpunt +% #2: y-coordinaat beginpunt +% #3: x-coordinaat eindpunt +% #4: y-coordinaat eindpunt + +\chardef\chemicallinetype=0 + +\def\doplotchemicalline + {\!!counte=\!!countc \advance\!!counte by -\!!counta + \!!countf=\!!countd \advance\!!countf by -\!!countb + \bgroup + \ifcase\chemicaldrawingmode + \ifcase\chemicallinetype + % 0 : normal line + \plot {\!!counta} {\!!countb} {\!!countc} {\!!countd} /% + \or + % 1 : normal arrow + \arrow <5pt> [.2,.67] from {\!!counta} {\!!countb} to {\!!countc} {\!!countd} + \or + % 2 : reverse arrow + \arrow <5pt> [.2,.67] from {\!!countc} {\!!countd} to {\!!counta} {\!!countb} + \or + % 3 : unrotated line + \put {\stoprotation \setcoordinatesystem point at 0 0 + \plot 0 0 {\!!counte} {\!!countf} /} + [\chemicallineposition] at {\!!counta} {\!!countb} + \else + % 4 : dashed line + \findlength {\plot {\!!counta} {\!!countb} {\!!countc} {\!!countd} /}% + \setdashesnear <2pt> for <\totalarclength>% + \plot {\!!counta} {\!!countb} {\!!countc} {\!!countd} /% + \fi + \or + \ifcase\chemicallinetype + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\psline(\!!counta,\!!countb)(\!!countc,\!!countd)}% + \or + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\psline{->}(\!!counta,\!!countb)(\!!countc,\!!countd)}% + \or + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\psline{<-}(\!!counta,\!!countb)(\!!countc,\!!countd)}% + \or + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\expanded{\rput[\chemicallineposition]{-\chemicalangle}% + (\!!counta,\!!countb){\psline(0,0)(\!!counte,\!!countf)}}}% + \else + \psset{linestyle=dashed}% + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\psline(\!!counta,\!!countb)(\!!countc,\!!countd)}% + \fi + \or + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + x3 := \MPdivten[\the\!!counte]u ; + y3 := \MPdivten[\the\!!countf]u ; + \ifcase\chemicallinetype + % 0 : normal line + draw ((z1--z2) rotatedaround(origin,-\chemicalangle)) + shifted z0 ; + \or + % 1 : normal arrow + drawarrow ((z1--z2) rotatedaround(origin,-\chemicalangle)) + shifted z0 ; + \or + % 2 : reverse arrow + drawarrow ((z2--z1) rotatedaround(origin,-\chemicalangle)) + shifted z0 ; + \or + % 3 : unrotated line % nog \chemicalineposition: t/b + draw (origin--z3) + shifted (z1 rotatedaround(origin,-\chemicalangle)) + shifted z0 ; + \else + % 4 : dashed line + draw ((z1--z2) rotatedaround(origin,-\chemicalangle)) +% shifted z0 dashed evenly ; + shifted z0 dashed dashpattern(on 5.5u off 6u) ; + \fi + \stopMPdrawing + \fi + \egroup + \account\!!counta\!!countb + \account\!!countc\!!countd} + +\def\plotchemicalline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \doplotchemicalline} + +\def\plotchemicalfactorline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifdim\@@chemicalfactor\onepoint=\onepoint \else + \scratchdimen\!!counta\s!sp \multiply\scratchdimen1000 \scratchdimen\@@chemicalfactor\scratchdimen \divide\scratchdimen1000 \!!counta\scratchdimen + \scratchdimen\!!countc\s!sp \multiply\scratchdimen1000 \scratchdimen\@@chemicalfactor\scratchdimen \divide\scratchdimen1000 \!!countc\scratchdimen + \fi + \doplotchemicalline} + +\def\plotchemicalzline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifnum\chemicaldrawingmode=2 + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + filldraw (( + \ifnum\chemicalangle>180 + z1--z2 + \else\ifnum\chemicalangle<90 + z1--(z2 shifted (-2u,+2u))--(z2 shifted (+2u,-2u)) + \else\ifnum\chemicalangle=90 + (z1 shifted (-2u,+2u))--(z1 shifted (+2u,-2u))-- + (z2 shifted (+2u,+2u))--(z2 shifted (-2u,-2u)) + \else + (z1 shifted (+2u,+2u))--(z1 shifted (-2u,-2u))--z2 + \fi\fi\fi + --cycle) rotatedaround(origin,-\chemicalangle)) shifted z0 ; + \stopMPdrawing + \else + \doplotchemicalline + \ifnum\chemicalangle>180 \else + \ifnum\chemicalangle=90 + \advance\!!counta by -20 \advance\!!countc by -20 + \doplotchemicalline + \advance\!!counta by 40 \advance\!!countc by 40 + \else\ifnum\chemicalangle<90 + \advance\!!countc by -20 \advance\!!countd by +20 + \doplotchemicalline + \advance\!!countc by +40 \advance\!!countd by -40 + \else + \advance\!!counta by 20 \advance\!!countb by 20 + \doplotchemicalline + \advance\!!counta by -40 \advance\!!countb by -40 + \fi\fi + \fi + \doplotchemicalline + \fi} + +\def\plotchemicaldeltaline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifnum\chemicaldrawingmode=2 + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + filldraw ((z1--(z2 rotatedaround(z1,5))--(z2 rotatedaround(z1,-5)) + --cycle) rotatedaround(origin,-\chemicalangle)) + shifted z0 ; + \stopMPdrawing + \account{#1}{#2}% + \account{#3}{#4}% + \else + \doplotchemicalline + \advance\!!countc by 16 \advance\!!countd by -21 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -8 \advance\!!countd by 14 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \fi} + +\def\setchemicallinesegment #1 #2 #3 #4 #5 + {\setvalue{\s!chemicallinesegment#1}{\plotchemicalline{#2}{#3}{#4}{#5}}} + +\def\setchemicalfactorlinesegment #1 #2 #3 #4 #5 + {\setvalue{\s!chemicallinesegment#1}{\plotchemicalfactorline{#2}{#3}{#4}{#5}}} + +\def\getchemicallinesegment[#1][#2]% + {\chemicalrotate[#1]% + \dochemicaloffset{#1}% + \getvalue{\s!chemicallinesegment#2}% + \getvalue{\s!chemicallinesegment#21}% + \getvalue{\s!chemicallinesegment#22}% + \undochemicaloffset} + +\def\getprivatechemicallinesegment[#1][#2]% + {\chemicalrotate[#1]% + \getvalue{\s!chemicallinesegment#2#1}} + +\def\doprocesschemicallinesegment#1#2#3#4#5% + {\chardef\chemicallinetype=#1 + \def\chemicallineposition{#2}% + \def\doprocess[##1##2##3##4##5]% + {\doifelse{##1}{?} + {\doprocess[1..\maxchemical ????]} + {\doifchemicalnumber{##1}{#4#5} + {\doifelse{##2##3}{..} + {\doifchemicalnumber{##4}{#4#5} + {#3[##1][#4]% + \doifnot{##1}{##4} + {\!!counta=##1\relax + \advance\!!counta by 1 + \edef\nextsegment{\the\!!counta}% + \doprocess[\nextsegment..##4##5]}}} + {#3[##1][#4]% + \doifnot{##2}{?} + {\doprocess[##2##3##4##5]}}}}}% + \doprocess[#5]} + +\def\processchemicallinesegment + {\doprocesschemicallinesegment0c\getchemicallinesegment} + +\def\processchemicalzlinesegment#1#2% + {%\doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \bgroup + \def\plotchemicalline{\plotchemicalzline}% + \doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \egroup} + +\def\processchemicaldeltalinesegment#1#2% + {%\doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \bgroup + \def\plotchemicalline{\plotchemicaldeltaline}% + \doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \egroup} + +\def\processprivatechemicallinesegment% + {\doprocesschemicallinesegment0c\getprivatechemicallinesegment} + +\def\processchemicaldownarrowsegment% + {\doprocesschemicallinesegment1c\getchemicallinesegment} + +\def\processchemicaluparrowsegment% + {\doprocesschemicallinesegment2c\getchemicallinesegment} + +\def\processchemicalunrotatedlinesegment#1% + {\doprocesschemicallinesegment3{#1}\getchemicallinesegment} + +\def\processchemicaldashedlinesegment + {\doprocesschemicallinesegment4c\getchemicallinesegment} + +\def\plotchemicaldasheddeltaline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifnum\chemicaldrawingmode=2 + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + z20 = z2 rotatedaround(z1,+5) ; + z21 = z2 rotatedaround(z1,-5) ; + draw (z1 rotatedaround(origin,-\chemicalangle)) shifted z0 ; + save n ; n := 5 ; + for i=1 upto n : + draw ((((z20--z21) shifted -z2) shifted (i/n)[z2,z1]) + rotatedaround(origin,-\chemicalangle)) shifted z0 ; + endfor + \stopMPdrawing + \account{#1}{#2}% + \account{#3}{#4}% + \else + \doplotchemicalline + \advance\!!countc by 16 \advance\!!countd by -21 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -8 \advance\!!countd by 14 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \fi} + +\def\plotchemicalwavyline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifnum\chemicaldrawingmode=2 + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + save d ; pair d ; + d := z2 rotatedaround(z1,+5) shifted -z2 ; + save n ; n := 4 ; + draw ((for i=0 upto n-1 : + ((i)/n)[z1,z2] .. + ((i+.25)/n)[z1,z2] shifted d .. + ((i+.50)/n)[z1,z2] .. + ((i+.75)/n)[z1,z2] shifted -d .. + endfor + z2) rotatedaround(origin,-\chemicalangle)) shifted z0 ; + \stopMPdrawing + \account{#1}{#2}% + \account{#3}{#4}% + \else + \doplotchemicalline + \advance\!!countc by 16 \advance\!!countd by -21 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -8 \advance\!!countd by 14 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \fi} + +\def\processchemicaldasheddeltalinesegment#1#2% + {\bgroup + \def\plotchemicalline{\plotchemicaldasheddeltaline}% + \doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \egroup} + +\def\processchemicalwavylinesegment#1#2% + {\bgroup + \def\plotchemicalline{\plotchemicalwavyline}% + \doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \egroup} + +\def\processchemicalopenend#1#2% + {\doprocesschemicallinesegment0c\doprocesschemicalopenend{#1}{#2}} + +\def\doprocesschemicalopenend[#1][#2]% + {\chemicalrotate[#1]% + \dochemicaloffset{#1}% + \ifcase\chemicaldrawingmode + \beginpicture + \setquadratic\plot + 300 0 400 0 + 500 0 550 75 + 600 0 650 -75 + 700 0 750 75 + 800 0 850 -75 + 900 0 950 0 + 1050 0 / + \endpicture + \or + \rput{-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\psline(300,0)(500,0)% + \rput(500,0){\psplot[yunit=75,plotstyle=curve]{0}{720}{x sin}}% + \psline(950,0)(1050,0)}% + \or + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + draw + (((30.0u,0)--(50.0u,0){up}..(55.0u,7.5u).. + (60.0u,0)..(65.0u,-7.5u)..(70.0u,0).. + (75.0u,7.5u)..(80.0u,0)..(85.0u,-7.5u)..{up} + (90.0u,0)--(105.0u,0)) rotatedaround(origin,-\chemicalangle)) + shifted z0 ; + \stopMPdrawing + \fi + \undochemicaloffset} + +% \plotchemicalcircle{#1}{#2}{#3}{#4} +% +% #1: lengte van de boog in graden +% #2: x-coordinaat eindpunt +% #3: y-coordinaat eindpunt + +\newif\ifchemicaldotted + +\def\plotchemicalcircle#1#2#3#4#5#6% + {\bgroup + \ifcase\chemicaldrawingmode + \ifchemicaldotted + \findlength{\circulararc {#4} degrees from {#5} {#6} center at {0} {0} }% + \divide\totalarclength by 6 + \def\b{\the\totalarclength}% + \divide\totalarclength by 2 + \def\a{\the\totalarclength}% + \setdashpattern <\a,\b,\b,\b,\b,\b,\a> + \fi + \circulararc {#4} degrees from {#5} {#6} center at {0} {0} % + \or + \ifchemicaldotted + \psset{linestyle=dashed}% + \fi + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\psarc(0,0){#3}{#1}{#2}}% + \or + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + r := \MPdivten[#3]*2u; + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + draw ((subpath (#1/45,#2/45) of (fullcircle scaled (r))) + rotatedaround (origin,\chemicalangle+150)) + shifted z0 \ifchemicaldotted dashed withdots \fi ; + \stopMPdrawing + \fi + \egroup} + +\def\setchemicalcircsegment #1 #2 #3 #4 #5 #6 #7 + {\setvalue{\s!chemicalcircsegment#1}{\plotchemicalcircle{#2}{#3}{#4}{#5}{#6}{#7}}} + +\def\getchemicalcircsegment[#1][#2]% + {\chemicalrotate[#1]% + \getvalue{\s!chemicalcircsegment#2}} + +\def\doprocesschemicalcircsegment#1#2% + {\def\doprocess[##1##2##3##4##5]% + {\doifelse{##1}{?} + {\doprocess[1..\maxchemical ????]} + {\doifchemicalnumber{##1}{#1#2} + {\doifelse{##2##3}{..} + {\doifchemicalnumber{##4}{#1#2} + {\getchemicalcircsegment[##1][#1]% + \doifnot{##1}{##4} + {\!!counta=##1\relax + \advance\!!counta by 1 + \edef\nextsegment{\the\!!counta}% + \doprocess[\nextsegment..##4##5]}}} + {\getchemicalcircsegment[##1][#1]% + \doifnot{##2}{?} + {\doprocess[##2##3##4##5]}}}}}% + \doprocess[#2]} + +\def\processchemicalcircsegment% + {\chemicaldottedfalse\doprocesschemicalcircsegment} + +\def\processchemicaldottsegment% + {\chemicaldottedtrue\doprocesschemicalcircsegment} + +\let\endchemicalpicture = \relax +\let\checkchemicalpicture = \relax +\let\nomoreaccounting = \relax + +\newif\ifchemicalpicture + +\def\beginchemicalpicture#1% NO PSTRICKS SUPPORT YET + {\checkchemicalpicture + \bgroup % DOES NOT HANDLE AUTOWIDTH/HEIGHT + \chemicalpicturetrue + \processchemical[#1]} + +\def\setchemicalpicture#1#2% + {\chemicalpicturefalse + \def\endchemicalpicture% + {\@@endchemicallocalpicture{#1}{#2}% + \egroup + \ifnum\chemicaldrawingmode=1 + \rput + {-\chemicalangle}(\chemicalxoffset,\chemicalyoffset)% + {\expanded{\rput[\chemicalloca]{\chemicalangle}(#1,#2){\box\nextbox}}}% + \else + \expanded{\put{\box\nextbox}[\chemicalloca] at {#1} {#2} } + \fi + \egroup}% + \def\checkchemicalpicture% + {\ifx\endchemicalpicture\relax \else + \writestatus{ppchtex}{missing end of picture (PE)}% + \endchemicalpicture + \fi}% + \setbox\nextbox=\hbox\bgroup + \@@beginchemicallocalpicture + % alternatief: gewoon accounting, en zelf l,r afhandelen + \ifnum\chemicaldrawingmode=1 + % njet + \else + \accountingon + \let\nomoreaccounting=\accountingoff + \fi} + +\def\doskipchemical[#1][#2]% + {{\tt[ppchtex]}} + +\def\skipchemical% + {\dodoubleargument\doskipchemical} + +\def\complexchemical% met \expandafter + {\ifinchemical + \expandafter\dochemical + \else + \writestatus{ppchtex}{the [][]-alternative is not permitted here}% + \expandafter\skipchemical + \fi} + +\newif\ifinnerchemical + +\def\dosimplechemical#1#2#3% + {\doifdefinedelse{\??chemical\c!location} + {\writestatus{ppchtex}{the {}{}-alternative is not permitted here}} + {\ifinnerchemical + \let\chemicalsign = \chemicalinnersign + \let\chemicalmolecule = \chemicalinnermolecule + \let\chemicalsinglearrow = \chemicalsingleinnerarrow + \let\chemicaldoublearrow = \chemicaldoubleinnerarrow + \let\chemicaltwintiparrow = \chemicaltwintipinnerarrow + \else + \let\chemicalsign = \chemicaloutersign + \let\chemicalmolecule = \chemicaloutermolecule + \let\chemicalsinglearrow = \chemicalsingleouterarrow + \let\chemicaldoublearrow = \chemicaldoubleouterarrow + \let\chemicaltwintiparrow = \chemicaltwintipouterarrow + \fi + \disablechemicalspecials + \unexpandedprocessallactionsinset + [#1] + [ HIGH=>\sethighsubscripts, + LOW=>\setlowsubscripts, + PLUS=>\chemicalsign{+}, + GIVES=>\chemicalsinglearrow{#2}{#3}, + EQUILIBRIUM=>\chemicaldoublearrow{#2}{#3}, + MESOMERIC=>\chemicaltwintiparrow{#2}{#3}, + SINGLE=>\singlechemicalbond, + DOUBLE=>\doublechemicalbond, + TRIPLE=>\triplechemicalbond, + +=>\chemicalsign{+}, + ->=>\chemicalsinglearrow{#2}{#3}, + <->=>\chemicaldoublearrow{#2}{#3}, + <>=>\chemicaltwintiparrow{#2}{#3}, + -=>\singlechemicalbond, + --=>\doublechemicalbond, + ---=>\triplechemicalbond, + \s!unknown=>\enablechemicalspecials + \chemicalmolecule{\commalistelement}{#2}{#3}]}} + +%\def\dosimplechemicalA#1#2#3% +% {\let\chemicalspace=\relax +% \def\dodosimplechemical##1% +% {\dosimplechemical{##1}{}{}}% +% \@EA\processcommalist\@EA[\@@chemicalchemicaloffset,#1]\dodosimplechemical +% \egroup} + +\def\dosimplechemicalA#1#2#3% % evt: {#1,\relax} + {\let\chemicalspace=\relax + \@EA\dosimplechemical\@EA{\@@chemicalchemicaloffset,#1}{#2}{#3}% + \egroup} + +\def\dosimplechemicalB#1#2#3% + {\dosimplechemical{#1}{#2}{#3}% + \egroup} + +\def\dosimplechemicalC#1#2#3% + {$\simplechemical{#1}{#2}{#3}$% + \egroup} % erbij + +\def\simplechemical + {\ifinner + \innerchemicaltrue + \else + \innerchemicalfalse + \fi + \bgroup + \catcode`\^=\@@superscript % t.b.v. \enableduplication + \catcode`\_=\@@subscript % t.b.v. de zekerheid + \ifmmode + \ifinnerchemical + \def\next{\dotriplegroupempty\dosimplechemicalA}% + \else + \def\next{\dotriplegroupempty\dosimplechemicalB}% + \fi + \else + \def\next{\dotriplegroupempty\dosimplechemicalC}% + \fi + \next} + +\definecomplexorsimple\chemical + +\def\dogotochemical#1#2% + {\def\dowithchemical% % experiment + {\localgotochemical{#1}}% % experiment + \chemical} % experiment + +\def\gotochemical% % experiment + {\dosingleargument\dogotochemical} % experiment + +\def\dododochemical#1[#2][#3]% % experiment + {\def\simpledododochemical% % experiment + {#1[#2][#3]}% % experiment + \def\complexdododochemical[##1]% % experiment + {\def\dowithchemical% % experiment + {\localthisischemical{#2}}% % experiment + #1[#3][##1]}% % experiment + \complexorsimple\dododochemical} % experiment + +\def\dodochemical[#1][#2]% + {\ignorespaces + \ifinchemical + \drawchemical[#1][#2]% + \ignorespaces + \else + \startchemical[\c!location=\v!intext]% + \drawchemical[#1][#2]% + \expandafter\stopchemical + \fi + \ignorespaces} + +\def\dochemical[#1]% + {\def\simpledochemical% + {\@@writechemicalstate{ppchtex}{[#1][]}% + \dodochemical[#1][]}% + % + \def\complexdochemical[##1]% + {\@@writechemicalstate{ppchtex}{[#1][##1]}% + \txtchemical=0% + \dodochemical[#1][##1]}% + % + \def\complexdochemical[##1]% % experiment + {\@@writechemicalstate{ppchtex}{[#1][##1]}% % experiment + \txtchemical=0% % experiment + \dododochemical\dodochemical[#1][##1]}% % experiment + % + \complexorsimple\dochemical} + +% \processlocalchemicals{#1} +% +% #1: commando's + +\def\dodoprocesschemical#1% + {\processchemical[#1????]} + +\def\processlocalchemicals#1% + {\processcommalist[#1]\dodoprocesschemical} + +% \drawchemical[#1][#2] +% +% #1: bindingen enz. +% #2: atomen enz. + +\def\localdodochemical[#1][#2]% + {\@@writechemicalstate{ppchtex}{[#1][#2]}% + %\bgroup % koppelen en afmetingen gaat fout, vandaar: + \advance\levchemical 1 + \letvalue{\??chemical\s!unknown\the\levchemical}\unknownchemical + \setevalue{\??chemical\c!text\the\levchemical}{\the\txtchemical}% + \txtchemical=0 + \dodochemical[#1][#2]% + % \@EA\txtchemical\@EA\csname\??chemical\c!text\the\levchemical\endcsname + \txtchemical\csname\??chemical\c!text\the\levchemical\endcsname + \@EA\let\@EA\unknownchemical\csname\??chemical\s!unknown\the\levchemical\endcsname + \advance\levchemical -1 + %\egroup + \ignorespaces} + +\def\drawchemical[#1][#2]% + {\ignorespaces + \def\dodochemical[##1][##2]% + {\drawchemical[##1][##2]% + \ignorespaces}% + \def\dochemical[##1]% + {\def\simpledochemical% + {\@@writechemicalstate{ppchtex}{[##1][#2]}% + \dodochemical[##1][#2]% + \ignorespaces}% + \def\complexdochemical[####1]% + {\dododochemical\localdodochemical[##1][####1,#2]}% + \complexorsimple\dochemical}% + \doif\@@chemicalstate\v!start + {\doifelse\chemicalname\s!unknown + {\getvalue{\s!executechemical\defaultchemical}[#2]} + {\getvalue{\s!executechemical\chemicalname}[#2]}% + \def\unknownchemical##1% + {\processunknownchemical[##1][#2]}% + \processcommalist[\@@chemicaloffset,#1]\dodoprocesschemical}% + \ignorespaces} + +\unexpanded\def\chemicaloxidation#1#2#3% + {\chemicaltop + {\ifnum#20=0 + 0% + \else + #1\expandafter\uppercase\expandafter{\romannumeral#2}% + \fi} + {#3}} + +\def\chemicaltfraction{\ifinchemical.60\else.8\fi} +\def\chemicalbfraction{\ifinchemical.45\else.6\fi} +\def\chemicallfraction{\ifinchemical.1\else.1\fi} +\def\chemicalrfraction{\ifinchemical.1\else.1\fi} + +\def\chemicaltighttext + {\def\chemicaltfraction{\ifinchemical.3\else.6\fi}% + \def\chemicalbfraction{\ifinchemical.2\else.4\fi}% + \def\chemicallfraction{\ifinchemical 0\else 0\fi}% + \def\chemicalrfraction{\ifinchemical 0\else 0\fi}} + +\def\dochemicaltop#1#2#3#4% + {\vbox + {\@@dochemicalcolor + \baselineskip=\chemicaltfraction\baselineskip \lineskip0pt + \halign + {#1###2\cr + $\@@dochemicalstyle{\scriptscriptstyle#3}$\cr + $\@@dochemicalstyle{\@@currentchemicalformat#4}$\cr}}} + +\def\dochemicalbottom#1#2#3#4% + {\vtop + {\@@dochemicalcolor + \baselineskip=\chemicalbfraction\baselineskip \lineskip0pt + \halign + {#1###2\cr + $\@@dochemicalstyle{\@@currentchemicalformat#4}$\cr + $\@@dochemicalstyle{\scriptscriptstyle#3}$\cr}}} + +\def\chemicalleft#1#2% + {\hbox + {\@@dochemicalcolor + $\@@dochemicalstyle{\scriptscriptstyle#1}$% + $\@@dochemicalstyle{\@@currentchemicalformat\hskip\chemicallfraction em#2}$}} + +\def\chemicalright#1#2% + {\hbox + {\@@dochemicalcolor + $\@@dochemicalstyle{\@@currentchemicalformat#2\hskip\chemicalrfraction em}$% + $\@@dochemicalstyle{\scriptscriptstyle#1}$}} + +\def\chemicalcentered#1% + {\setbox0=\hbox{$\@@dochemicalstyle{\scriptscriptstyle#1}$}% + \setbox2=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat C}$}% + \dimen0=.5\ht2 + \advance\dimen0 by -.5\ht0 + \advance\dimen0 by \dp0 + \hbox{\@@dochemicalcolor\raise\dimen0\box0}} + +\def\chemicalleftcentered#1#2% + {\hbox + {\@@dochemicalcolor + \chemicalcentered{#1}% + $\@@dochemicalstyle{\@@currentchemicalformat\hskip\chemicallfraction em#2}$}} + +\def\chemicalrightcentered#1#2% + {\hbox + {\@@dochemicalcolor + $\@@dochemicalstyle{\@@currentchemicalformat#2\hskip\chemicalrfraction em}$% + \chemicalcentered{#1}}} + +\def\chemicaltop {\dochemicaltop \hss \hss } +\def\chemicallefttop {\dochemicaltop \relax \hss } +\def\chemicalrighttop {\dochemicaltop \hss \relax} +\def\chemicalbottom {\dochemicalbottom \hss \hss } +\def\chemicalleftbottom {\dochemicalbottom \relax \hss } +\def\chemicalrightbottom {\dochemicalbottom \hss \relax} + +\def\chemicaltopleft #1{\chemicalleft {\chemicallefttop {#1}{}}} +\def\chemicalbottomleft #1{\chemicalleft {\chemicalleftbottom{#1}{}}} +\def\chemicaltopright #1{\chemicalright{\chemicallefttop {#1}{}}} +\def\chemicalbottomright#1{\chemicalright{\chemicalleftbottom{#1}{}}} + +\def\chemicalsmashedleft#1% + {\hbox\bgroup + \@@dochemicalcolor + \setbox0=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat C}$}% + \setbox2=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat#1}$}% + \wd2=\wd0 + \box2 + \egroup} + +\def\chemicalsmashedmiddle#1% + {\hbox\bgroup + \@@dochemicalcolor + \setbox0=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat C}$}% + \setbox2=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat#1}$}% + \hbox{\hskip-.5\wd2\hskip.5\wd0\box2} + \egroup} + +\def\chemicalsmashedright#1% + {\hbox\bgroup + \@@dochemicalcolor + \setbox0=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat C}$}% + \setbox2=\hbox{$\@@dochemicalstyle{\@@currentchemicalformat#1}$}% + \hbox to \wd0{\hskip-\wd2\hskip\wd0\box2}% + \egroup} + +\def\+{\tabalign} % is \long in Plain + +\def\chemicalforever#1#2% + {\bgroup + \setbox0=\hbox + {\@@dochemicalcolor + $\@@dochemicalstyle{\scriptscriptstyle\hskip-.15em#2}$}% + \wd0=0pt + \big#1_{\hskip.1em\box0}% + \egroup} + +\def\disablechemicalspecials% + {\def\+##1{##1}\def\-##1{##1}% + \def\[{[}\def\]{]}% + \def\1{}\def\2{}\def\3{}\def\4{}\def\5{}\def\6{}\def\7{}% + \def\X{}% + \def\T{}\def\B{}\def\L{}\def\R{}\def\LC{}\def\RC{}% + \def\TL{}\def\BL{}\def\TR{}\def\BR{}% + \def\LT{}\def\LB{}\def\RT{}\def\RB{}% + \def\SL{}\def\SM{}\def\SR{}} + +\def\enablechemicalspecials% + {\def\+{\dodoublegroupempty\chemicaloxidation{+}}% {} needed! + \def\-{\dodoublegroupempty\chemicaloxidation{-}}% {} needed! + \def\[{\dodoublegroupempty\chemicalforever {[}}% {} needed! + \def\]{\dodoublegroupempty\chemicalforever {]}}% {} needed! + \def\1{\chemicaloxidation\relax1}% + \def\2{\chemicaloxidation\relax2}% + \def\3{\chemicaloxidation\relax3}% + \def\4{\chemicaloxidation\relax4}% + \def\5{\chemicaloxidation\relax5}% + \def\6{\chemicaloxidation\relax6}% + \def\7{\chemicaloxidation\relax7}% + \def\X{\chemicaltighttext}% + \def\T{\chemicaltop}% + \def\B{\chemicalbottom}% + \def\L{\chemicalleft}% + \def\LC{\chemicalleftcentered}% + \def\R{\chemicalright}% + \def\RC{\chemicalrightcentered}% + \def\TL{\chemicaltopleft}% + \def\BL{\chemicalbottomleft}% + \def\TR{\chemicaltopright}% + \def\BR{\chemicalbottomright}% + \def\LT{\chemicallefttop}% + \def\LB{\chemicalleftbottom}% + \def\RT{\chemicalrighttop}% + \def\RB{\chemicalrightbottom}% + \def\SL{\chemicalsmashedleft}% + \def\SM{\chemicalsmashedmiddle}% + \def\SR{\chemicalsmashedright}% +} + +% \reversechemical#1#2#3 +% +% #1: prefix +% #2: volgnummer enz +% #3: tegengestelde volgnummers + +\def\reversechemical#1#2#3% + {\def\doprocess[##1##2]% + {\doifchemicalnumber{##1}{#1#2}% + {\getfromcommalist[#3][##1]% + \let\reversechemicalaction=\commalistelement + \processchemical[#1\reversechemicalaction##2]}}% + \doprocess[#2]} + +% \processunknownchemical[#1????][#2] +% +% #1: bindingen enz. +% #2: atomen enz. + +\def\defaultchemical% + {SIX} + +\def\processunknownchemical[#1????][#2]% + {\processaction + [#1] + [ SAVE=>\executechemicalSAVE, + RESTORE=>\executechemicalRESTORE, + HIGH=>\sethighsubscripts, + LOW=>\setlowsubscripts, + \s!default=>, + \s!unknown=>\doifdefinedelse{\s!executechemical#1} + {\def\chemicalrotation{1}% + \def\chemicaloffset{0}% + \doifdefined{\s!executechemical#1} + {\getvalue{\s!executechemical#1}[#2]}% + \@@chemicalpostponed} + {\getpredefinedchemical{#1}}]} + +\newcount\chemicalstack % tzt \newwounter + +\setvalue{\s!chemical\c!x1}{0} +\setvalue{\s!chemical\c!y1}{0} + +\def\executechemicalSAVE + {%\writestatus{ppchtex}{saving \the\horchemical,\the\verchemical}% + \advance\chemicalstack by 1 + \letvalue {\s!chemical n\the\chemicalstack}=\chemicalname + %\letvalue {\s!chemical p\the\chemicalstack}=\@@chemicalpostponed + \setevalue{\s!chemical x\the\chemicalstack}{\the\horchemical}% + \setevalue{\s!chemical y\the\chemicalstack}{\the\verchemical}} + +\def\restorechemicalvalues#1% + {\let\oldprocesschemical=\processchemical + \doifdefined{\s!executechemical#1}{\getvalue{\s!executechemical#1}[]}% + \let\processchemical=\oldprocesschemical} + +\def\executechemicalRESTORE + {\ifnum\chemicalstack=0\relax + \horchemical=\getvalue{\s!chemical x1}\relax + \verchemical=\getvalue{\s!chemical y1}\relax + \else + \restorechemicalvalues{\getvalue{\s!chemical n\the\chemicalstack}}% + %\@EA\let\@EA\@@chemicalpostponed\@EA=\csname\s!chemical p\the\chemicalstack\endcsname + \let\@@chemicalpostponed=\relax + \horchemical=\getvalue{\s!chemical x\the\chemicalstack}\relax + \verchemical=\getvalue{\s!chemical y\the\chemicalstack}\relax + \advance\chemicalstack by -1 + \fi + \restorechemicalcoordinates} + +% De onderstaande macro's zijn verantwoordelijk voor het zetten +% van de + en pijlen. De +, en dus ook de pijlen, worden omhoog +% gehaald. Dit oogt m.i. fraaier. + +\def\chemicalinnerclip#1% + {{\setbox0=\hbox{#1}\ht0\ht\strutbox\dp0\dp\strutbox\box0}} + +\def\chemicalraise#1#2% + {\chemicalinnerclip + {\setbox0=\hbox{$#1+$}% + \raise\dp0\hbox{$#1#2$}}} + +\def\chemicalinnersign#1% todo: \@@chemicaltextcolor + {\chemicalraise{\@@localchemicalstyle}{#1}} + +\def\chemicaloutersign#1% + {\chemicalraise{}{\@@dochemicalcolor#1}} + +\def\chemicalsingleinnerarrow#1#2% + {\chemicalraise{\@@localchemicalstyle}{\longrightarrow}} + +\def\chemicaldoubleinnerarrow#1#2% todo: \@@chemicaltextcolor + {\chemicalinnerclip + {\lower.2ex\hbox + {\setbox0=\hbox{$\@@localchemicalstyle\longrightarrow$}% + \setbox2=\hbox{$\@@localchemicalstyle\longleftarrow$}% + \wd0=0pt\raise\ht0\box0\box2}}} + +\def\chemicaltwintipinnerarrow#1#2% todo: \@@chemicaltextcolor + {\chemicalinnerclip + {\setbox0=\hbox{\chemicalraise{\@@localchemicalstyle}{\longrightarrow}}% + \setbox2=\hbox{\chemicalraise{\@@localchemicalstyle}{\longleftarrow}}% + \wd0=0pt\box0\box2}} + +\def\dochemicalouterarrow#1#2#3% + {\bgroup + \setbox0=\hbox{$\longrightarrow$}% + \setbox2=\hbox{$\@@dochemicalstyle{\scriptstyle\quad#2\quad}$}% + \setbox4=\hbox{$\@@dochemicalstyle{\scriptstyle\quad#3\quad}$}% + \dimen2=\wd0 % \dimen0 is used elsewhere + \ifdim\wd2>\dimen2 \dimen0=\wd2 \fi + \ifdim\wd4>\dimen2 \dimen0=\wd4 \fi + \chemicaloutermolecule + {#1} + {\ifdim\ht2>\!!zeropoint\box2\fi} % expands to \empty in test + {\ifdim\ht4>\!!zeropoint\box4\fi}% % expands to \empty in test + \egroup} + +\def\chemicalsingleouterarrow + {\dochemicalouterarrow + {\hbox to \dimen2{\rightarrowfill}}} + +\def\chemicaldoubleouterarrow + {\dochemicalouterarrow + {\lower.5\ht0\vbox + {\offinterlineskip + \hbox to \dimen2{\rightarrowfill} + \hbox to \dimen2{\leftarrowfill}}}} + +\def\chemicaltwintipouterarrow + {\dochemicalouterarrow + {\hbox + {\hbox to \dimen2{\rightarrowfill}% + \hskip-\dimen2 + \hbox to \dimen2{\leftarrowfill}}}} + +\def\chemicalinnermolecule#1#2#3% no mathop here, can generate space + {\chemicalspace % todo: \@@chemicaltextcolor + \chemicalinnerclip + {\dosetsubscripts + $\@@dochemicalstyle{\@@localchemicalstyle\strut#1}$% + \doresetsubscripts}% + \chemicalspace} + +\def\chemicaloutermolecule#1#2#3% + {\chemicalspace + \bgroup + \@@dochemicalcolor + \setbox0=\hbox % else the font is reset + {\dosetsubscripts + \hbox{$\@@dochemicalstyle{\strut#1}$}% + \doresetsubscripts}% + \mathop{\box0}% + \ifthirdargument + \doifnot{#2}{} + {^{\@@dochemicalstyle{\strut#2}}}% + \doifnot{#3}{} + {_{\@@dochemicalstyle{\strut#3}}}% + \else + \doifnot{#2}{} + {_{\@@dochemicalstyle{\strut#2}}}% + \fi + \egroup + \chemicalspace} + +\def\chemicalsinglepicturearrow#1% + {\lower.5ex\hbox + {\@@dochemicalstyle + $\chemicalspace + \buildrel + \@@dochemicalstyle{\scriptstyle\quad#1\quad}% + \over{\overrightarrow + {\hphantom{\@chemicalstyle{\scriptstyle\quad#1\quad}}}}% + \chemicalspace$}} + +\def\chemicaldoublepicturearrow#1% + {\lower.5ex\hbox + {\@@dochemicalstyle + $\chemicalspace + \buildrel + \@@dochemicalstyle{\scriptstyle\quad#1\quad}% + \over{\overrightarrow{\overleftarrow + {\hphantom{\@@dochemicalstyle{\scriptstyle\quad#1\quad}}}}}% + \chemicalspace$}} + +% Bij de in-line bindingen wordt gebruik gemaakt van +% een \hrule. De maatvoering wordt bepaald door een +% kunstmatige em (\wd0). + +\def\somechemicalbond% + {\hrule width \wd0 height .4pt} + +\def\dochemicalbonds#1#2#3% todo: \@@chemicaltextstyle + {{\setbox0=\hbox + {${\@@localchemicalstyle M}$}% + \vbox to \ht0 + {\@@dochemicalcolor + \hsize\wd0 + \vskip.1\wd0#1\vfill#2\vfill#3\vskip.1\wd0}}} + +\def\singlechemicalbond% + {\dochemicalbonds{}{\somechemicalbond}{}} + +\def\doublechemicalbond% + {\dochemicalbonds{\somechemicalbond}{}{\somechemicalbond}} + +\def\triplechemicalbond% + {\dochemicalbonds{\somechemicalbond}{\somechemicalbond}{\somechemicalbond}} + +% In plaats van \def\naam{\chemie[...]...} kan beter gebruik +% worden gemaakt van het commando +% +% \definieerchemie[naam]{commando's} +% +% De naam krijgt, om problemen met bestaande macro's te +% voorkomen, een prefix. Bij het ophalen van een commando +% worden beide definities afgehandeld. + +\def\dodefinechemical[#1]#2% + {\doifdefined{\??chemical#1} + {\writestatus{ppchtex}{chemical definition #1 is redefined}}% + \setvalue{\??chemical#1}{#2}} + +\def\definechemical% + {\dosingleargument\dodefinechemical} + +\def\getpredefinedchemical#1% + {\doifdefinedelse{\??chemical#1} + {\getvalue{\??chemical#1}} + {\doifdefinedelse{#1} + {\getvalue{#1}} + {\writestatus{ppchtex}{unknown chemical definition #1}}}} + +% Hieronder zijn de definities van de structuren opgenomen. De +% naam van de structuur is als volgt opgebouwd: +% +% \executechemicalNUMBER[#1] +% +% waarbij [#1] betrekking heeft op de tekstelementen van \chemie, +% de [tweede lijst] dus. +% +% De aan \chemie[#1][#2] meegegeven lijst van segmenten wordt +% deels door de in \execute gedefinieerde macro's afgehandeld, +% deels door algemene macro's. Segmenten hebben de vorm: +% +% [+|-|]identifier[X|XYZ|X..Y] +% +% Voorbeelden van segmenten zijn: +% +% R1 +% R1..4 +% R135 +% -R1 +% +R35 + +\setchemicalmaximum 0 + +\def\processchemical[#1]% + {\unknownchemical{#1}} + +\def\setchemicalname#1 % + {\def\chemicalname{#1}} + +\let\chemicalname=\s!unknown + +% Vooruitlopend op een gedetailleerde documentatie, zijn hier +% vast enkele gebruikte afmetingen: +% +% lengte radikalen : 500 +% afstand radikalen : 100 +% afstand dubbele radikalen : 260 +% afstand substituenten : +125 + +\def\executechemicalONE[#1]% + {\setchemicalname ONE + % + \setchemicalmaximum 8 + \setchemicaldistance 0 + \setchemicalsubstitute 625 + \setchemicaldirection 303 + % + \setchemicalrotation 1 1 0 1 0 1 0 1 0 + \setchemicalrotation 2 0.707 -0.707 0.707 -0.707 0.707 -0.707 0.707 -0.707 + \setchemicalrotation 3 0 -1 0 -1 0 -1 0 -1 + \setchemicalrotation 4 -0.707 -0.707 -0.707 -0.707 -0.707 -0.707 -0.707 -0.707 + \setchemicalrotation 5 -1 0 -1 0 -1 0 -1 0 + \setchemicalrotation 6 -0.707 0.707 -0.707 0.707 -0.707 0.707 -0.707 0.707 + \setchemicalrotation 7 0 1 0 1 0 1 0 1 + \setchemicalrotation 8 0.707 0.707 0.707 0.707 0.707 0.707 0.707 0.707 + % + \setchemicalangle 1 0 90 180 270 + \setchemicalangle 2 45 135 225 315 + \setchemicalangle 3 90 180 270 0 + \setchemicalangle 4 135 225 315 45 + \setchemicalangle 5 180 270 0 90 + \setchemicalangle 6 225 315 45 135 + \setchemicalangle 7 270 0 90 180 + \setchemicalangle 8 315 45 135 225 + % + \setchemicaltranslate 1 -1000 0 + \setchemicaltranslate 2 -1000 1000 + \setchemicaltranslate 3 0 1000 + \setchemicaltranslate 4 1000 1000 + \setchemicaltranslate 5 1000 0 + \setchemicaltranslate 6 1000 -1000 + \setchemicaltranslate 7 0 -1000 + \setchemicaltranslate 8 -1000 -1000 + % + \setchemicallinesegment SB 300 0 700 0 + \setchemicallinesegment DB1 300 50 700 50 + \setchemicallinesegment DB2 300 -50 700 -50 + % + %setchemicallinesegment EP 200 125 200 -125 + \setchemicalfactorlinesegment EP 200 125 200 -125 + % + \setchemicaltextelement ES 200 0 + \setchemicaltextelement ED1 200 50 + \setchemicaltextelement ED2 200 -50 + \setchemicaltextelement ET1 200 75 + \setchemicaltextelement ET2 200 0 + \setchemicaltextelement ET3 200 -75 + \setchemicaltextelement HB1 300 0 + \setchemicaltextelement HB2 475 0 + \setchemicaltextelement HB3 650 0 + % + \setchemicaltextelement Z 800 0 + \setchemicaltextelement RZ 950 0 + \setchemicaltextelement ZN 500 0 + \setchemicaltextelement ZTN 500 150 + \setchemicaltextelement ZBN 500 -150 + % + \def\processchemical[##1##2##3##4##5]% + {\doprocesschemical[##1##2##3##4##5] + {\processaction + [##1##2##3##4##5] + [ PB:##4##5=>\beginchemicalpicture{##4##5}, + PE????=>\endchemicalpicture, + SUB##4##5=>\processchemicalsubstitute{##4##5}, + ADJ##4##5=>\processchemicaldistance{##4##5}, + MOV##4##5=>\processchemicaltranslate{##4##5}, + DIR##4##5=>\processchemicaldirection{##4##5}, + OFF##4##5=>\processchemicaloffset{##4##5}, + CCD##4##5=>\processchemicaldottsegment{CC}{##4##5}, + LDD##4##5=>\processchemicaldashedlinesegment{DB1}{##4##5}% + \processchemicallinesegment{DB2}{##4##5}, + RDD##4##5=>\processchemicallinesegment{DB1}{##4##5}% + \processchemicaldashedlinesegment{DB2}{##4##5}, + OF##3:##5=>\processchemicalphantom{##3}{##5}, + OE##3##4##5=>\processchemicalopenend{OE}{##3##4##5}, + EP##3##4##5=>\processchemicallinesegment{EP}{##3##4##5}, + ES##3##4##5=>\processchemicaltextconstant{ES}{##3##4##5}{\hbox{$\cdot$}}{0}, + ED##3##4##5=>\processchemicaltextconstant{ED}{##3##4##5}{\hbox{$\cdot$}}{0}, + ET##3##4##5=>\processchemicaltextconstant{ET}{##3##4##5}{\hbox{$\cdot$}}{0}, + HB##3##4##5=>\processchemicaltextconstant{HB}{##3##4##5}{\hbox{$\cdot$}}{0}, + SB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}, + DB##3##4##5=>\processchemicallinesegment{DB}{##3##4##5}, + SB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}, + BB##3##4##5=>\processchemicaldeltalinesegment{SB}{##3##4##5}, + BD##3##4##5=>\processchemicaldasheddeltalinesegment{SB}{##3##4##5}, + BW##3##4##5=>\processchemicalwavylinesegment{SB}{##3##4##5}, + SD##3##4##5=>\processchemicaldashedlinesegment{SB}{##3##4##5}, + TB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}% + \processchemicallinesegment{DB}{##3##4##5}, + CZ##3##4##5=>\processchemicaltextelement{RZ}{##3##4##5}{#1}{0}{}, + ZTN##4##5=>\processchemicalsmalltextconstant{ZTN}{##4##5}{\chemicaltextelementnumber}{0}, + ZTT##4##5=>\processchemicalsmalltextelement{ZTN}{##4##5}{#1}{0}{}, + ZBN##4##5=>\processchemicalsmalltextconstant{ZBN}{##4##5}{\chemicaltextelementnumber}{0}, + ZBT##4##5=>\processchemicalsmalltextelement{ZBN}{##4##5}{#1}{0}{}, + ZN##3##4##5=>\processchemicaltextconstant{ZN}{##3##4##5}{\chemicaltextelementnumber}{0}, + ZT##3##4##5=>\processchemicaltextelement{ZN}{##3##4##5}{#1}{0}{}, + Z##2##3##4##5=>\processchemicaltextelement{Z}{##2##3##4##5}{#1}{0} + {l,l,t,r,r,r,b,l}, + \s!unknown=>\unknownchemical{##1##2##3##4##5}]}}} + +\def\executechemicalTHREE[#1]% + {\setchemicalname THREE + % + \setchemicalmaximum 3 + \setchemicaldistance 289 + \setchemicalsubstitute 952 + % + \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 + \setchemicalrotation 2 -0.5 -0.866 -0.866 0.5 0.5 0.866 0.866 -0.5 + \setchemicalrotation 3 -0.5 0.866 0.866 0.5 0.5 -0.866 -0.866 -0.5 + % + \setchemicalangle 1 0 90 180 270 + \setchemicalangle 2 120 210 300 30 + \setchemicalangle 3 240 330 60 150 + % + \setchemicaltranslate 1 -1000 0 + \setchemicaltranslate 2 0 1000 + \setchemicaltranslate 3 1000 0 + \setchemicaltranslate 4 0 -1000 + % + \setchemicallinesegment B 577 0 -289 -500 + \setchemicallinesegment SB 352 -130 -64 -370 + \setchemicallinesegment -SB 352 -130 -289 -500 + \setchemicallinesegment +SB 577 0 -64 -370 + \setchemicallinesegment DB1 327 -87 -89 -327 + \setchemicallinesegment DB2 377 -172 -39 -413 + \setchemicallinesegment R 577 0 1077 0 + \setchemicallinesegment -R 577 0 1010 250 + \setchemicallinesegment +R 577 0 1010 -250 + \setchemicallinesegment ER1 577 50 1077 50 + \setchemicallinesegment ER2 577 -50 1077 -50 + \setchemicallinesegment SR 837 0 1077 0 + \setchemicallinesegment -SR 802 130 1010 250 + \setchemicallinesegment +SR 802 -130 1010 -250 + \setchemicallinesegment DR1 837 50 1077 50 + \setchemicallinesegment DR2 837 -50 1077 -50 + % + \setchemicaltextelement Z 577 0 + \setchemicaltextelement RZ 1177 0 + \setchemicaltextelement -RZ 1097 300 + \setchemicaltextelement +RZ 1097 -300 + \setchemicaltextelement CRZ 1077 0 + % + \def\processchemical[##1##2##3##4]% + {\processaction + [##1##2##3##4] + [ ROT##4=>\processchemicalrotation{##4}, + MOV##4=>\processchemicaltranslate{##4}, + SUB##4=>\processchemicalsubstitute{##4}, + ADJ##4=>\processchemicaldistance{##4}, + -RZ##4=>\processchemicaltextelement{-RZ}{##4}{#1}{3} + {l,t,r, l,r,l, r,b,l, r,l,r}, + +RZ##4=>\processchemicaltextelement{+RZ}{##4}{#1}{3} + {l,r,b, r,r,l, r,l,t, l,l,r}, + -SB##4=>\processchemicallinesegment{-SB}{##4}, + +SB##4=>\processchemicallinesegment{+SB}{##4}, + -SR##4=>\processchemicallinesegment{-SR}{##4}, + +SR##4=>\processchemicallinesegment{+SR}{##4}, + CRZ##4=>\processchemicaltextelement{CRZ}{##4}{#1}{0} + {}, + DB##3##4=>\processchemicallinesegment{DB}{##3##4}, + DR##3##4=>\processchemicallinesegment{DR}{##3##4}, + RZ##3##4=>\processchemicaltextelement{RZ}{##3##4}{#1}{3} + {l,r,r, t,r,l, r,l,l, b,l,r}, + ER##3##4=>\processchemicallinesegment{ER}{##3##4}, + SB##3##4=>\processchemicallinesegment{SB}{##3##4}, + SR##3##4=>\processchemicallinesegment{SR}{##3##4}, + -R##3##4=>\processchemicallinesegment{-R}{##3##4}, + +R##3##4=>\processchemicallinesegment{+R}{##3##4}, + B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, + R##2##3##4=>\processchemicallinesegment{R}{##2##3##4}, + Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0}{}, + \s!unknown=>\unknownchemical{##1##2##3##4}]}} + +\def\executechemicalFOUR[#1]% + {\setchemicalname FOUR + % + \setchemicalmaximum 4 + \setchemicaldistance 500 + \setchemicalsubstitute 0 + % + \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 + \setchemicalrotation 2 0 -1 -1 0 0 1 1 0 + \setchemicalrotation 3 -1 0 0 1 1 0 0 -1 + \setchemicalrotation 4 0 1 1 0 0 -1 -1 0 + % + \setchemicalangle 1 0 90 180 270 + \setchemicalangle 2 90 180 270 0 + \setchemicalangle 3 180 270 0 90 + \setchemicalangle 4 270 0 90 180 + % + \setchemicaltranslate 1 -1000 0 + \setchemicaltranslate 2 0 1000 + \setchemicaltranslate 3 1000 0 + \setchemicaltranslate 4 0 -1000 + % + \setchemicallinesegment B 500 500 500 -500 + \setchemicallinesegment SB 500 240 500 -240 + \setchemicallinesegment -SB 500 240 500 -500 + \setchemicallinesegment +SB 500 500 500 -240 + \setchemicallinesegment DB1 450 240 450 -240 + \setchemicallinesegment DB2 550 240 550 -240 + \setchemicallinesegment EB 360 300 360 -300 + \setchemicallinesegment R 500 500 854 854 + \setchemicallinesegment -R 500 500 500 1000 + \setchemicallinesegment +R 500 500 1000 500 + \setchemicallinesegment ER1 465 535 819 889 + \setchemicallinesegment ER2 535 465 889 819 + \setchemicallinesegment SR 684 684 854 854 + \setchemicallinesegment -SR 500 760 500 1000 + \setchemicallinesegment +SR 760 500 1000 500 + \setchemicallinesegment DR1 649 719 819 889 + \setchemicallinesegment DR2 719 649 889 819 + % + \setchemicaltextelement Z 500 500 + \setchemicaltextelement RZ 925 925 + \setchemicaltextelement -RZ 500 1100 + \setchemicaltextelement +RZ 1100 500 + \setchemicaltextelement CRZ 1038 1038 + % + \setchemicaltextelement ZN 350 350 + % + \def\processchemical[##1##2##3##4]% + {\processaction + [##1##2##3##4] + [ PB:##4=>\beginchemicalpicture{##4}, + PE????=>\endchemicalpicture, + ROT##4=>\processchemicalrotation{##4}, + SUB##4=>\processchemicalsubstitute{##4}, + ADJ##4=>\processchemicaldistance{##4}, + MOV##4=>\processchemicaltranslate{##4}, + -RZ##4=>\processchemicaltextelement{-RZ}{##4}{#1}{4} + {b,l,t,r, l,t,r,b, t,r,b,l, r,b,l,t}, + +RZ##4=>\processchemicaltextelement{+RZ}{##4}{#1}{4} + {l,t,r,b, t,r,b,l, r,b,l,t, b,l,t,r}, + -SB##4=>\processchemicallinesegment{-SB}{##4}, + +SB##4=>\processchemicallinesegment{+SB}{##4}, + -SR##4=>\processchemicallinesegment{-SR}{##4}, + +SR##4=>\processchemicallinesegment{+SR}{##4}, + CRZ##4=>\processchemicaltextelement{CRZ}{##4}{#1}{0}{}, + ZN##3##4=>\processchemicaltextconstant{ZN}{##3##4}{\chemicaltextelementnumber}{0}, + ZT##3##4=>\processchemicaltextelement{ZN}{##3##4}{#1}{0}{}, + DB##3##4=>\processchemicallinesegment{DB}{##3##4}, + DR##3##4=>\processchemicallinesegment{DR}{##3##4}, + EB##3##4=>\processchemicallinesegment{EB}{##3##4}, + ER##3##4=>\processchemicallinesegment{ER}{##3##4}, + RZ##3##4=>\processchemicaltextelement{RZ}{##3##4}{#1}{4} + {lb,lt,rt,rb, lt,rt,rb,lb, rt,rb,lb,lt, rb,lb,lt,rt}, + SB##3##4=>\processchemicallinesegment{SB}{##3##4}, + SR##3##4=>\processchemicallinesegment{SR}{##3##4}, + -R##3##4=>\processchemicallinesegment{-R}{##3##4}, + +R##3##4=>\processchemicallinesegment{+R}{##3##4}, + B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, + R##2##3##4=>\processchemicallinesegment{R}{##2##3##4}, + Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0}{}, + \s!unknown=>\unknownchemical{##1##2##3##4}]}} + +\def\executechemicalFIVE[#1]% + {\setchemicalname FIVE + % + \setchemicalmaximum 5 + \setchemicaldistance 688 + \setchemicalsubstitute 1226 + % + \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 + \setchemicalrotation 2 0.309 -0.951 -0.951 -0.309 -0.309 0.940 0.951 0.309 + \setchemicalrotation 3 -0.809 -0.588 -0.588 0.809 0.809 0.588 0.588 -0.809 + \setchemicalrotation 4 -0.809 0.588 0.588 0.809 0.809 -0.588 -0.588 -0.809 + \setchemicalrotation 5 0.309 0.951 0.951 -0.309 -0.309 -0.951 -0.951 0.309 + % + \setchemicalangle 1 0 90 180 270 + \setchemicalangle 2 72 162 252 342 + \setchemicalangle 3 144 234 324 54 + \setchemicalangle 4 216 306 36 126 + \setchemicalangle 5 288 18 108 198 + % + \setchemicaltranslate 1 -1376 0 + \setchemicaltranslate 2 -425 1304 + \setchemicaltranslate 3 1113 809 + \setchemicaltranslate 4 1113 -809 + \setchemicaltranslate 5 -425 -1304 + % + \setchemicallinesegment A 1188 500 1188 -500 + \setchemicallinesegment B 688 500 688 -500 + \setchemicallinesegment S -263 808 688 -500 + \setchemicallinesegment SS -116 606 541 -298 + \setchemicallinesegment -SS -263 808 541 -298 + \setchemicallinesegment +SS -116 606 688 -500 + \setchemicallinesegment SB 688 240 688 -240 + \setchemicallinesegment -SB 688 240 688 -500 + \setchemicallinesegment +SB 688 500 688 -240 + \setchemicallinesegment DB1 638 240 638 -240 + \setchemicallinesegment DB2 738 240 738 -240 + \setchemicallinesegment EB 548 340 548 -340 + \setchemicallinesegment R 688 500 1093 794 + \setchemicallinesegment -R 688 500 688 1000 + \setchemicallinesegment +R 688 500 1163 345 + \setchemicallinesegment ER1 659 540 1064 834 + \setchemicallinesegment ER2 727 460 1122 754 + \setchemicallinesegment SR 898 653 1093 794 + \setchemicallinesegment -SR 688 760 688 1000 + \setchemicallinesegment +SR 935 420 1163 345 + \setchemicallinesegment DR1 869 693 1064 834 + \setchemicallinesegment DR2 927 613 1122 754 + % + \setchemicaltextelement Z 688 500 + \setchemicaltextelement RZ 1188 863 + \setchemicaltextelement -RZ 688 1100 + \setchemicaltextelement +RZ 1258 315 + \setchemicaltextelement CRZ 1323 947 + % + \setchemicalcircsegment C -36 36 590 72 475 -345 + \setchemicalcircsegment CC -72 0 590 72 182 -561 + % + \setchemicaltextelement ZN 468 350 + \setchemicaltextelement RN 860 625 % 1.25 Z + \setchemicaltextelement RTN 785 728 % .12 / 103 75 + \setchemicaltextelement RBN 935 522 + % + \def\processchemical[##1##2##3##4]% + {\processaction + [##1##2##3##4] + [ FRONT????=>{\executechemicalFIVEFRONT[#1]}, + PB:##4=>\beginchemicalpicture{##4}, + PE????=>\endchemicalpicture, + ROT##4=>\processchemicalrotation{##4}, + SUB##4=>\processchemicalsubstitute{##4}, + ADJ##4=>\processchemicaldistance{##4}, + MOV##4=>\processchemicaltranslate{##4}, + -RZ##4=>\processchemicaltextelement{-RZ}{##4}{#1}{5} + {b,l,t,r,r, l,t,r,r,l, t,r,r,l,l, r,b,l,t,r}, + +RZ##4=>\processchemicaltextelement{+RZ}{##4}{#1}{5} + {l,t,r,r,b, t,r,r,l,l, r,r,l,l,r, b,l,l,r,r}, + -SB##4=>\processchemicallinesegment{-SB}{##4}, + +SB##4=>\processchemicallinesegment{+SB}{##4}, + -SR##4=>\processchemicallinesegment{-SR}{##4}, + +SR##4=>\processchemicallinesegment{+SR}{##4}, + -RD##4=>\processchemicaldashedlinesegment{-R}{##4}, + +RD##4=>\processchemicaldashedlinesegment{+R}{##4}, + -RB##4=>\processchemicaldeltalinesegment{-R}{##4}, + +RB##4=>\processchemicaldeltalinesegment{+R}{##4}, + CRZ##4=>\processchemicaltextelement{CRZ}{##4}{#1}{0}{}, + RTN##4=>\processchemicaltextconstant{RTN}{##4}{\chemicaltextelementnumber}{0}, + RTT##4=>\processchemicaltextelement{RTN}{##4}{#1}{0}{}, + RBN##4=>\processchemicaltextconstant{RBN}{##4}{\chemicaltextelementnumber}{0}, + RBT##4=>\processchemicaltextelement{RBN}{##4}{#1}{0}{}, + -SS##4=>\processchemicallinesegment{-SS}{##4}, + +SS##4=>\processchemicallinesegment{+SS}{##4}, + CCD##4=>\processchemicaldottsegment{CC}{##4}, + SS##3##4=>\processchemicallinesegment{SS}{##3##4}, + RD##3##4=>\processchemicaldashedlinesegment{R}{##3##4}, + RB##3##4=>\processchemicaldeltalinesegment{R}{##3##4}, + ZN##3##4=>\processchemicaltextconstant{ZN}{##3##4}{\chemicaltextelementnumber}{0}, + ZT##3##4=>\processchemicaltextelement{ZN}{##3##4}{#1}{0}{}, + RN##3##4=>\processchemicaltextconstant{RN}{##3##4}{\chemicaltextelementnumber}{0}, + RT##3##4=>\processchemicaltextelement{RN}{##3##4}{#1}{0}{}, + AU##3##4=>\processchemicaluparrowsegment{A}{##3##4}, + AD##3##4=>\processchemicaldownarrowsegment{A}{##3##4}, + CC##3##4=>\processchemicalcircsegment{CC}{##3##4}, + CD##3##4=>\processchemicaldottsegment{C}{##3##4}, + DB##3##4=>\processchemicallinesegment{DB}{##3##4}, + DR##3##4=>\processchemicallinesegment{DR}{##3##4}, + EB##3##4=>\processchemicallinesegment{EB}{##3##4}, + ER##3##4=>\processchemicallinesegment{ER}{##3##4}, + RZ##3##4=>\processchemicaltextelement{RZ}{##3##4}{#1}{5} + {l,l,r,r,r, l,r,r,b,l, r,r,b,l,t, r,l,l,t,r}, + SB##3##4=>\processchemicallinesegment{SB}{##3##4}, + SR##3##4=>\processchemicallinesegment{SR}{##3##4}, + -R##3##4=>\processchemicallinesegment{-R}{##3##4}, + +R##3##4=>\processchemicallinesegment{+R}{##3##4}, + B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, + C##2##3##4=>\processchemicalcircsegment{C}{##2##3##4}, + R##2##3##4=>\processchemicallinesegment{R}{##2##3##4}, + S##2##3##4=>\processchemicallinesegment{S}{##2##3##4}, + Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0}{}, + \s!unknown=>\unknownchemical{##1##2##3##4}]}} + +\def\executechemicalSIX[#1]% + {\setchemicalname SIX + % + \setchemicalmaximum 6 + \setchemicalsubstitute 1375 + \setchemicaldistance 866 + % + \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 + \setchemicalrotation 2 0.5 -0.866 -0.866 -0.5 -0.5 0.866 0.866 0.5 + \setchemicalrotation 3 -0.5 -0.866 -0.866 0.5 0.5 0.866 0.866 -0.5 + \setchemicalrotation 4 -1 0 0 1 1 0 0 -1 + \setchemicalrotation 5 -0.5 0.866 0.866 0.5 0.5 -0.866 -0.866 -0.5 + \setchemicalrotation 6 0.5 0.866 0.866 -0.5 -0.5 -0.866 -0.866 0.5 + % + \setchemicalangle 1 0 90 180 270 + \setchemicalangle 2 60 150 240 330 + \setchemicalangle 3 120 210 300 30 + \setchemicalangle 4 180 270 0 90 + \setchemicalangle 5 240 330 60 150 + \setchemicalangle 6 300 30 120 210 + % + \setchemicaltranslate 1 -1732 0 + \setchemicaltranslate 2 -866 1500 + \setchemicaltranslate 3 866 1500 + \setchemicaltranslate 4 1732 0 + \setchemicaltranslate 5 866 -1500 + \setchemicaltranslate 6 -866 -1500 + % + \setchemicallinesegment A 1386 500 1386 -500 + \setchemicallinesegment S 0 1000 866 -500 + \setchemicallinesegment SS 125 783 741 -283 + \setchemicallinesegment -SS 0 1000 741 -283 + \setchemicallinesegment +SS 125 783 866 -500 + \setchemicallinesegment B 866 500 866 -500 + \setchemicallinesegment SB 866 240 866 -240 + \setchemicallinesegment -SB 866 240 866 -500 + \setchemicallinesegment +SB 866 500 866 -240 + \setchemicallinesegment DB1 816 240 816 -240 + \setchemicallinesegment DB2 916 240 916 -240 + \setchemicallinesegment EB 726 340 726 -340 + \setchemicallinesegment R 866 500 1299 750 + \setchemicallinesegment -R 866 500 866 1000 + \setchemicallinesegment +R 866 500 1299 250 + \setchemicallinesegment ER1 841 543 1274 793 + \setchemicallinesegment ER2 891 457 1324 707 + \setchemicallinesegment SR 1091 630 1299 750 + \setchemicallinesegment -SR 866 740 866 1000 + \setchemicallinesegment +SR 1091 370 1299 250 + \setchemicallinesegment DR1 1066 673 1274 793 + \setchemicallinesegment DR2 1116 588 1324 707 + \setchemicallinesegment MID1 0 1000 -150 200 + \setchemicallinesegment MID2 0 -1000 -150 -200 + \setchemicallinesegment MIDS1 0 1000 -180 0 + \setchemicallinesegment MIDS2 0 -1000 -180 0 + % + \setchemicalcircsegment C -30 30 700 60 600 -346 + \setchemicalcircsegment CC -60 0 700 60 350 -606 + % + \setchemicaltextelement Z 866 500 + \setchemicaltextelement RZ 1386 800 + \setchemicaltextelement -RZ 866 1100 + \setchemicaltextelement +RZ 1386 200 + \setchemicaltextelement CRZ 1524 880 + \setchemicaltextelement MIDZ -150 0 + % + \setchemicaltextelement ZN 589 350 + \setchemicaltextelement RN 1083 625 % 1.25 Z + \setchemicaltextelement RTN 1008 755 % .12 / 130 75 + \setchemicaltextelement RBN 1158 495 + % + \def\processchemical[##1##2##3##4##5]% + {\processaction + [##1##2##3##4##5] + [ FRONT????=>{\executechemicalSIXFRONT[#1]}, + MID????=>\processchemicallinesegment{MID}{1????}, + MIDS????=>\processchemicallinesegment{MIDS}{1????}, + MIDZ????=>\processchemicaltextelement{MIDZ}{1????}{#1}{0}{}, + PB:##4##5=>\beginchemicalpicture{##4##5}, + PE????=>\endchemicalpicture, + ROT##4##5=>\processchemicalrotation{##4##5}, + SUB##4##5=>\processchemicalsubstitute{##4##5}, + ADJ##4##5=>\processchemicaldistance{##4##5}, + MOV##4##5=>\processchemicaltranslate{##4##5}, + -RZ##4##5=>\processchemicaltextelement{-RZ}{##4##5}{#1}{6} + {b,l,l,t,r,r, l,l,r,r,r,l, t,r,r,b,l,l, r,r,l,l,l,r}, + +RZ##4##5=>\processchemicaltextelement{+RZ}{##4##5}{#1}{6} + {l,t,r,r,b,l, r,r,r,l,l,l, r,b,l,l,t,r, l,l,l,r,r,r}, + -SB##4##5=>\processchemicallinesegment{-SB}{##4##5}, + +SB##4##5=>\processchemicallinesegment{+SB}{##4##5}, + -SR##4##5=>\processchemicallinesegment{-SR}{##4##5}, + +SR##4##5=>\processchemicallinesegment{+SR}{##4##5}, + -RD##4##5=>\processchemicaldashedlinesegment{-R}{##4##5}, + +RD##4##5=>\processchemicaldashedlinesegment{+R}{##4##5}, + -RB##4##5=>\processchemicaldeltalinesegment{-R}{##4##5}, + +RB##4##5=>\processchemicaldeltalinesegment{+R}{##4##5}, + CRZ##4##5=>\processchemicaltextelement{CRZ}{##4##5}{#1}{0}{}, + -SS##4##5=>\processchemicallinesegment{-SS}{##4##5}, + +SS##4##5=>\processchemicallinesegment{+SS}{##4##5}, + CCD##4##5=>\processchemicaldottsegment{CC}{##4##5}, +RTN##4##5=>\processchemicaltextconstant{RTN}{##4##5}{\chemicaltextelementnumber}{0}, +RTT##4##5=>\processchemicaltextelement{RTN}{##4##5}{#1}{0}{}, +RBN##4##5=>\processchemicaltextconstant{RBN}{##4##5}{\chemicaltextelementnumber}{0}, +RBT##4##5=>\processchemicaltextelement{RBN}{##4##5}{#1}{0}{}, + SS##3##4##5=>\processchemicallinesegment{SS}{##3##4##5}, + RD##3##4##5=>\processchemicaldashedlinesegment{R}{##3##4##5}, + RB##3##4##5=>\processchemicaldeltalinesegment{R}{##3##4##5}, + ZN##3##4##5=>\processchemicaltextconstant{ZN}{##3##4##5}{\chemicaltextelementnumber}{0}, + ZT##3##4##5=>\processchemicaltextelement{ZN}{##3##4##5}{#1}{0}{}, +RN##3##4##5=>\processchemicaltextconstant{RN}{##3##4##5}{\chemicaltextelementnumber}{0}, +RT##3##4##5=>\processchemicaltextelement{RN}{##3##4##5}{#1}{0}{}, + AU##3##4##5=>\processchemicaluparrowsegment{A}{##3##4##5}, + AD##3##4##5=>\processchemicaldownarrowsegment{A}{##3##4##5}, + CD##3##4##5=>\processchemicaldottsegment{C}{##3##4##5}, + CC##3##4##5=>\processchemicalcircsegment{CC}{##3##4##5}, + DB##3##4##5=>\processchemicallinesegment{DB}{##3##4##5}, + EB##3##4##5=>\processchemicallinesegment{EB}{##3##4##5}, + ER##3##4##5=>\processchemicallinesegment{ER}{##3##4##5}, + RZ##3##4##5=>\processchemicaltextelement{RZ}{##3##4##5}{#1}{6} + {l,l,t,r,r,b, l,r,r,r,l,l, r,r,b,l,l,t, r,l,l,l,r,r}, + SB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}, + SR##3##4##5=>\processchemicallinesegment{SR}{##3##4##5}, + DR##3##4##5=>\processchemicallinesegment{DR}{##3##4##5}, + -R##3##4##5=>\processchemicallinesegment{-R}{##3##4##5}, + +R##3##4##5=>\processchemicallinesegment{+R}{##3##4##5}, + B##2##3##4##5=>\processchemicallinesegment{B}{##2##3##4##5}, + C##2##3##4##5=>\processchemicalcircsegment{C}{##2##3##4##5}, + R##2##3##4##5=>\processchemicallinesegment{R}{##2##3##4##5}, + S##2##3##4##5=>\processchemicallinesegment{S}{##2##3##4##5}, + Z##2##3##4##5=>\processchemicaltextelement{Z}{##2##3##4##5}{#1}{0}{}, + \s!unknown=>\unknownchemical{##1##2##3##4##5}]}} + +\def\executechemicalSEVEN[#1]% incomplete ! + {\setchemicalname SEVEN + % + \setchemicalmaximum 7 + \setchemicalsubstitute - + \setchemicaldistance 1038 + % + \setchemicalrotation 1 .623 .782 - - - - - - + \setchemicalrotation 2 -.223 .975 - - - - - - + \setchemicalrotation 3 -.901 .434 - - - - - - + \setchemicalrotation 4 -.901 -.434 - - - - - - + \setchemicalrotation 5 -.223 -.975 - - - - - - + \setchemicalrotation 6 .623 -.782 - - - - - - + \setchemicalrotation 7 1 0 - - - - - - + % + \setchemicalangle 1 0 - - - + \setchemicalangle 2 51.429 - - - + \setchemicalangle 3 102.857 - - - + \setchemicalangle 4 154.286 - - - + \setchemicalangle 5 205.714 - - - + \setchemicalangle 6 257.143 - - - + \setchemicalangle 7 308.571 - - - + % + \setchemicaltranslate 1 - - + \setchemicaltranslate 2 - - + \setchemicaltranslate 3 - - + \setchemicaltranslate 4 - - + \setchemicaltranslate 5 - - + \setchemicaltranslate 6 - - + \setchemicaltranslate 7 - - + % + \setchemicallinesegment B 1038 500 1038 -500 + \setchemicallinesegment SB 1038 240 1038 -240 + \setchemicallinesegment -SB 1038 240 1038 -500 + \setchemicallinesegment +SB 1038 500 1038 -240 + % + \setchemicaltextelement Z 1038 500 + % + \def\processchemical[##1##2##3##4##5]% + {\processaction + [##1##2##3##4##5] + [ PB:##4##5=>\beginchemicalpicture{##4##5}, + PE????=>\endchemicalpicture, + %ROT##4##5=>\processchemicalrotation{##4}, + %SUB##4##5=>\processchemicalsubstitute{##4##5}, + %ADJ##4##5=>\processchemicaldistance{##4##5}, + %MOV##4##5=>\processchemicaltranslate{##4##5}, + -SB##4##5=>\processchemicallinesegment{-SB}{##4##5}, + +SB##4##5=>\processchemicallinesegment{+SB}{##4##5}, + SB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}, + B##2##3##4##5=>\processchemicallinesegment{B}{##2##3##4##5}, + Z##2##3##4##5=>\processchemicaltextelement{Z}{##2##3##4##5}{#1}{0}{}, + \s!unknown=>\unknownchemical{##1##2##3##4##5}]}} + +\def\executechemicalEIGHT[#1]% incomplete ! + {\setchemicalname EIGHT + % + \setchemicalmaximum 8 + %\setchemicalsubstitute 1307 + \setchemicaldistance 1207 + % + \setchemicalrotation 1 .707 .707 - - - - - - + \setchemicalrotation 2 0 1 - - - - - - + \setchemicalrotation 3 -.707 .707 - - - - - - + \setchemicalrotation 4 -1 0 - - - - - - + \setchemicalrotation 5 -.707 -.707 - - - - - - + \setchemicalrotation 6 0 -1 - - - - - - + \setchemicalrotation 7 .707 -.707 - - - - - - + \setchemicalrotation 8 1 0 - - - - - - + % + \setchemicalangle 1 45 - - - + \setchemicalangle 2 90 - - - + \setchemicalangle 3 135 - - - + \setchemicalangle 4 180 - - - + \setchemicalangle 5 225 - - - + \setchemicalangle 6 270 - - - + \setchemicalangle 7 315 - - - + \setchemicalangle 8 0 - - - + % + \setchemicaltranslate 1 -2414 0 + \setchemicaltranslate 2 -1706 1706 + \setchemicaltranslate 3 0 2414 + \setchemicaltranslate 4 1706 1706 + \setchemicaltranslate 5 2414 0 + \setchemicaltranslate 6 1706 -1706 + \setchemicaltranslate 7 0 -2414 + \setchemicaltranslate 8 -1706 -1706 + % + \setchemicallinesegment B 1207 500 1207 -500 + \setchemicallinesegment SB 1207 240 1207 -240 + \setchemicallinesegment -SB 1207 240 1207 -500 + \setchemicallinesegment +SB 1207 500 1207 -240 + % + \setchemicaltextelement Z 1207 500 + % + \def\processchemical[##1##2##3##4##5]% + {\processaction + [##1##2##3##4##5] + [ PB:##4##5=>\beginchemicalpicture{##4##5}, + PE????=>\endchemicalpicture, + %SUB##4##5=>\processchemicalsubstitute{##4##5}, + ADJ##4##5=>\processchemicaldistance{##4##5}, + MOV##4##5=>\processchemicaltranslate{##4##5}, + -SB##4##5=>\processchemicallinesegment{-SB}{##4##5}, + +SB##4##5=>\processchemicallinesegment{+SB}{##4##5}, + SB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}, + B##2##3##4##5=>\processchemicallinesegment{B}{##2##3##4##5}, + Z##2##3##4##5=>\processchemicaltextelement{Z}{##2##3##4##5}{#1}{0}{}, + \s!unknown=>\unknownchemical{##1##2##3##4##5}]}} + +\def\executechemicalFIVEFRONT[#1]% + {\executechemicalFIVE[]% + % + \setchemicalname FIVEFRONT + % + \setchemicallinesegment -R 688 500 688 100 + \setchemicallinesegment +R 688 500 688 900 + % + \setchemicaltextelement -RZ 0 -1300 + \setchemicaltextelement +RZ 0 1300 + % + \def\processchemical[##1##2##3##4]% + {\def\chemicalrotation{2}% + \processaction + [##1##2##3##4] + [ -RZ##4=>\processchemicalunrotatedtextelement{Z}{-RZ}{##4}{#1}{5} + {,,,,, t,t,t,t,t}, + +RZ##4=>\processchemicalunrotatedtextelement{Z}{+RZ}{##4}{#1}{5} + {,,,,, b,b,b,b,b}, + -SB##4=>\processchemicallinesegment{-SB}{##4}, + +SB##4=>\processchemicallinesegment{+SB}{##4}, + SB##3##4=>\processchemicallinesegment{SB}{##3##4}, + -R##3##4=>\processchemicalunrotatedlinesegment{t}{-R}{##3##4}, + +R##3##4=>\processchemicalunrotatedlinesegment{b}{+R}{##3##4}, + BB##3##4=>\processchemicalzlinesegment{B}{##3##4}, + R##2##3##4=>\processchemicalunrotatedlinesegment{t}{-R}{##2##3##4}% + \processchemicalunrotatedlinesegment{b}{+R}{##2##3##4}, + B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, + Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0}{}, + \s!unknown=>\unknownchemical{##1##2##3##4}]}} + +\def\executechemicalSIXFRONT[#1]% + {\executechemicalSIX[]% + % + \setchemicalname SIXFRONT + % + \setchemicallinesegment -R 866 500 866 100 + \setchemicallinesegment +R 866 500 866 900 + % + \setchemicaltextelement -RZ 0 -1300 + \setchemicaltextelement +RZ 0 1300 + % + \def\processchemical[##1##2##3##4]% + {\def\chemicalrotation{2}% + \processaction + [##1##2##3##4] + [ -RZ##4=>\processchemicalunrotatedtextelement{Z}{-RZ}{##4}{#1}{6} + {,,,,,, t,t,t,t,t,t}, + +RZ##4=>\processchemicalunrotatedtextelement{Z}{+RZ}{##4}{#1}{6} + {,,,,,, b,b,b,b,b,b}, + -SB##4=>\processchemicallinesegment{-SB}{##4}, + +SB##4=>\processchemicallinesegment{+SB}{##4}, + SB##3##4=>\processchemicallinesegment{SB}{##3##4}, + -R##3##4=>\processchemicalunrotatedlinesegment{t}{-R}{##3##4}, + +R##3##4=>\processchemicalunrotatedlinesegment{b}{+R}{##3##4}, + BB##3##4=>\processchemicalzlinesegment{B}{##3##4}, + R##2##3##4=>\processchemicalunrotatedlinesegment{t}{-R}{##2##3##4}% + \processchemicalunrotatedlinesegment{b}{+R}{##2##3##4}, + B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, + Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0}{}, + \s!unknown=>\unknownchemical{##1##2##3##4}]}} + +% 1 : 0 +% 2 : -115 +% 3* : -195 +% 3 : -165 +% 4 : -245 + +\def\executechemicalCARBON[#1]% + {\setchemicalname CARBON + % + \setchemicalmaximum 4 + \setchemicaldistance 0 + \setchemicalsubstitute 0 + % + \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 + \setchemicalrotation 2 -0.423 -0.906 -0.906 0.423 0.423 0.906 0.906 -0.423 + \setchemicalrotation 3 -0.966 -0.259 -0.259 0.966 0.966 0.259 0.259 -0.966 + \setchemicalrotation 3* -0.966 0.259 0.259 0.966 0.966 -0.259 -0.259 -0.966 + \setchemicalrotation 4 -0.423 0.906 0.906 0.423 0.423 -0.906 -0.906 -0.423 + % + \setchemicalangle 1 0 90 180 270 + \setchemicalangle 2 115 205 295 25 + \setchemicalangle 3 165 255 345 75 + \setchemicalangle 3* 195 285 15 105 + \setchemicalangle 4 245 335 65 155 + % + \setchemicaltranslate 1 -1500 0 + \setchemicaltranslate 2 0 1500 + \setchemicaltranslate 3 1500 0 + \setchemicaltranslate 4 0 -1500 + % + \setchemicallinesegment B1 500 0 1000 0 + \setchemicallinesegment B2 300 0 1000 0 + \setchemicallinesegment B3 500 0 1000 0 + \setchemicallinesegment B4 300 0 1000 0 + % + \setchemicaltextelement Z 1100 0 + % + \setchemicalcircsegment C 0 360 500 360 0 -500 + % + \def\processchemical[##1##2##3##4##5]% + {\processaction + [##1##2##3##4##5] + [ MIR????=>\setchemicalmirror{3}, + -MIR????=>\resetchemicalmirror{3}, + *MIR????=>\togglechemicalmirror{3}, + CB????=>\processlocalchemicals{B,C,Z}, + C????=>\processchemicalcircsegment{C}{1????}, + -ROT##5=>\reversechemical{ROT}{##5}{3,4,1,2}, + ROT##4##5=>\processchemicalrotation{##4##5}, + MOV##4##5=>\processchemicaltranslate{##4##5}, + CB##3##4##5=>\processlocalchemicals + {ROT##3,C,B,Z2..4, + MOV##3,*MIR,-ROT##3,C,B,Z2..4}, + B##2##3##4##5=>\processprivatechemicallinesegment{B}{##2##3##4##5}, + Z##2##3##4##5=>\processchemicaltextelement{Z}{##2##3##4##5}{#1}{4} + {l,t,r,b, t,r,b,l, r,b,l,t, b,l,t,r}, + \s!unknown=>\unknownchemical{##1##2##3##4##5}]}} + +% 1: 45 2: -90 3: -225 +% 4: -45 5: -135 6: -270 + +\newif\ifNEWMANstagger \NEWMANstaggertrue + +\def\executechemicalNEWMANSTAGGER% + {\NEWMANstaggertrue\executechemicalNEWMAN} + +\def\executechemicalNEWMANECLIPSE% + {\NEWMANstaggerfalse\executechemicalNEWMAN} + +\def\executechemicalNEWMAN[#1]% + {\setchemicalname NEWMAN + % + \setchemicalmaximum 6 + \setchemicaldistance 0 + \setchemicalsubstitute 0 + % + \ifNEWMANstagger + \setchemicalrotation 1 0.707 0.707 0.707 -0.707 -0.707 -0.707 -0.707 0.707 + \setchemicalrotation 2 0 -1 -1 0 0 1 1 0 + \setchemicalrotation 3 -0.707 0.707 0.707 0.707 0.707 -0.707 -0.707 -0.707 + \else + \setchemicalrotation 1 .866 -.5 -.5 -.866 -.866 .5 .5 .866 + \setchemicalrotation 2 -.259 .966 .966 .259 .259 -.966 -.966 -.259 + \setchemicalrotation 3 -.5 -.866 -.866 .5 .5 .866 .866 -.5 + \fi + \setchemicalrotation 4 0.707 -0.707 -0.707 -0.707 -0.707 0.707 0.707 0.707 + \setchemicalrotation 5 -0.707 -0.707 -0.707 0.707 0.707 0.707 0.707 -0.707 + \setchemicalrotation 6 0 1 1 0 0 -1 -1 0 + % + \ifNEWMANstagger + \setchemicalangle 1 315 45 135 225 + \setchemicalangle 2 90 180 270 0 + \setchemicalangle 3 225 315 45 135 + \else + \setchemicalangle 1 30 120 210 300 + \setchemicalangle 2 255 345 75 165 + \setchemicalangle 3 120 210 300 30 + \fi + \setchemicalangle 4 45 135 225 315 + \setchemicalangle 5 135 225 315 45 + \setchemicalangle 6 270 0 90 180 + % + \setchemicaltranslate 1 -1500 0 + \setchemicaltranslate 2 0 1500 + \setchemicaltranslate 3 1500 0 + \setchemicaltranslate 4 0 -1500 + % + \setchemicallinesegment B1 0 0 1000 0 + \setchemicallinesegment B2 0 0 1000 0 + \setchemicallinesegment B3 0 0 1000 0 + \setchemicallinesegment B4 500 0 1000 0 + \setchemicallinesegment B5 500 0 1000 0 + \setchemicallinesegment B6 500 0 1000 0 + % + \setchemicaltextelement Z 1100 0 + % + \setchemicalcircsegment C 0 360 500 360 0 -500 + % + \def\processchemical[##1##2##3##4]% + {\processaction + [##1##2##3##4] + [STAGGER????=>{\executechemicalNEWMANSTAGGER[#1]}, + ECLIPSE????=>{\executechemicalNEWMANECLIPSE[#1]}, + B????=>\processlocalchemicals{B1..6}, + CB????=>\processlocalchemicals{B1..6,C,Z1..6}, + C????=>\processchemicalcircsegment{C}{1????}, + ROT##4=>\processchemicalrotation{##4}, + MOV##4=>\processchemicaltranslate{##4}, + B##2##3##4=>\processprivatechemicallinesegment{B}{##2##3##4}, + Z##2##3##4=>\ifNEWMANstagger + \processchemicaltextelement{Z}{##2##3##4}{#1}{6} + {l,t,r,l,r,b, l,r,l,r,r,l, r,b,l,r,l,t, r,l,r,l,l,r}% + \else + \processchemicaltextelement{Z}{##2##3##4}{#1}{6} + {l,r,t,t,r,b, t,b,r,r,b,l, r,l,b,b,l,t, b,t,l,l,t,r}% + \fi, + \s!unknown=>\unknownchemical{##1##2##3##4}]}} + +\def\executechemicalCHAIR[#1]% smaller + {\setchemicalname CHAIR + % + \setchemicalmaximum 6 + % + \setchemicallinesegment B1 1600 800 2800 -800 + \setchemicallinesegment B2 2800 -800 800 0 + \setchemicallinesegment B3 800 0 -1600 -800 + \setchemicallinesegment B4 -1600 -800 -2800 800 + \setchemicallinesegment B5 -2800 800 -800 0 + \setchemicallinesegment B6 -800 0 1600 800 + % + \setchemicallinesegment +R1 1600 800 1600 1600 + \setchemicallinesegment +R2 2800 -800 2800 -1600 + \setchemicallinesegment +R3 800 0 800 800 + \setchemicallinesegment +R4 -1600 -800 -1600 -1600 + \setchemicallinesegment +R5 -2800 800 -2800 1600 + \setchemicallinesegment +R6 -800 0 -800 -800 + % + \setchemicallinesegment -R1 1600 800 2350 522 % 750 278 + \setchemicallinesegment -R2 2800 -800 3493 -400 + \setchemicallinesegment -R3 800 0 1329 -600 % 528 600 + \setchemicallinesegment -R4 -1600 -800 -2350 -522 % 750 278 + \setchemicallinesegment -R5 -2800 800 -3493 400 + \setchemicallinesegment -R6 -800 0 -1329 600 % 528 600 + % + \setchemicaltextelement +RZ1 1600 1800 + \setchemicaltextelement +RZ2 2800 -1800 + \setchemicaltextelement +RZ3 800 1000 + \setchemicaltextelement +RZ4 -1600 -1800 + \setchemicaltextelement +RZ5 -2800 1800 + \setchemicaltextelement +RZ6 -800 -1000 + % + \setchemicaltextelement -RZ1 2538 453 % 200 lang + \setchemicaltextelement -RZ2 3666 -300 + \setchemicaltextelement -RZ3 1460 -750 + \setchemicaltextelement -RZ4 -2538 -453 + \setchemicaltextelement -RZ5 -3666 300 + \setchemicaltextelement -RZ6 -1460 750 + % + \def\processchemical[##1##2##3##4##5]% + {\def\chemicalrotation{1}% + \processaction + [##1##2##3##4##5] + [ B????=>\processlocalchemicals{B1,B2,B3,B4,B5,B6}, + -R????=>\processlocalchemicals{-R1,-R2,-R3,-R4,-R5,-R6}, + +R????=>\processlocalchemicals{+R1,+R2,+R3,+R4,+R5,+R6}, + B##2????=>{\getchemicallinesegment[0][B##2]}, + -RZ##4????=>{\getchemicalfixedtextelement[-RZ##4][1][##4][l,l,tc,r,r,bc][#1]}, + +RZ##4????=>{\getchemicalfixedtextelement[+RZ##4][1][##4][c][#1]}, + -R##3????=>{\getchemicallinesegment[0][-R##3]}, + +R##3????=>{\getchemicallinesegment[0][+R##3]}, + \s!unknown=>\unknownchemical{##1##2##3##4##5}]}} + +\def\executechemicalarrow#1#2[#3]% + {\dogetcommalistelement1\from#3\to\toptext + \dogetcommalistelement2\from#3\to\bottext + \def\dochemicaltext##1% + {\dosetsubscripts% + $\@@dochemicalstyle{\@@localchemicalformat\strut##1}$% + \doresetsubscripts}% + \doifelse\@@chemicallocation\v!intext + {#1{\dochemicaltext\toptext}}% + {\setbox\chemicalsymbols=\hbox + {\box\chemicalsymbols + \vbox{\halign{##\cr + \hbox to 3em{\hss\dochemicaltext{\toptext}\hss}\cr + #2% + \hbox to 3em{\hss\dochemicaltext{\bottext}\hss}\cr}}}}} + +\def\executechemicalGIVES + {\executechemicalarrow + {\chemicalsinglepicturearrow}% nodig + {\rightarrowfill\cr}} + +\def\executechemicalEQUILIBRIUM + {\executechemicalarrow + {\chemicaldoublepicturearrow}% nodig + {\rightarrowfill\cr\leftarrowfill\cr}} + +\def\executechemicalMESOMERIC + {\executechemicalarrow + {\chemicalsinglepicturearrow}% nodig + {$\leftarrow\hskip-1em$\rightarrowfill\cr}} + +\def\executechemicalsign#1[#2]% + {\doifelse\@@chemicallocation\v!intext + {\dosetsubscripts + $\@@dochemicalstyle{\@@localchemicalformat#1}$% + \doresetsubscripts} + {\setbox\chemicalsymbols\hbox + {\box\chemicalsymbols + \dosetsubscripts + $\@@dochemicalstyle{\@@localchemicalformat#1}$% + \doresetsubscripts}}} + +\def\executechemicalPLUS + {\executechemicalsign{+}} + +\def\executechemicalMINUS + {\executechemicalsign{-}} + +\def\executechemicalEQUAL + {\executechemicalsign{=}} + +\def\executechemicalSPACE[#1]% + {\doifnot\@@chemicallocation\v!intext + {\setbox\chemicalsymbols\hbox + {\box\chemicalsymbols + \quad}}} + +\def\executechemicalCHEM[#1]% + {\doifnot\@@chemicallocation\v!intext + {\setbox\chemicalsymbols\hbox + {\box\chemicalsymbols + $\@@dochemicalstyle{\@@localchemicalformat#1}$}}} + +\def\executechemicalTEXT[#1]% + {\doifnot\@@chemicallocation\v!intext + {\setbox\chemicalsymbols\hbox + {\box\chemicalsymbols#1}}} + +%\def\executechemicalLOW[#1]% +% {\setlowsubscripts} +% +%\def\executechemicalHIGH[#1]% +% {\sethighsubscripts} + +\def\putchemicalrule#1#2#3#4% + {\ifcase\chemicaldrawingmode + \putrule from {#1} {#2} to {#3} {#4} + \or + \psline(#1,#2)(#3,#4)% + \or + \bgroup + \!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + draw z1--z2 ; + \stopMPdrawing + \egroup + \fi} + +\def\executechemicalcomplex#1% + {\bgroup + \putchemicalrule {0} {-\@@chemicalbottom} {0} {\@@chemicaltop}% + \putchemicalrule {0} {\@@chemicaltop} {#1150} {\@@chemicaltop}% + \putchemicalrule {0} {-\@@chemicalbottom} {#1150} {-\@@chemicalbottom}% + \egroup} + +\def\executechemicalOPENCOMPLEX[#1]% + {\executechemicalcomplex+\ignorespaces + \executechemicalSPACE[]} + +\def\executechemicalCLOSECOMPLEX[#1]% + {\executechemicalSPACE[]% + \executechemicalcomplex-\ignorespaces} + +% nog niet door midden as! + +\def\executechemicalverticalsymbol#1#2% + {\executechemicalTEXT + [$\left#1\relax + \dimen0=\@@chemicalunit + \scratchcounter=\@@chemicaltop + \advance\scratchcounter by \@@chemicalbottom + \dimen0=\scratchcounter\dimen0 + \vcenter to \dimen0{} + \dimen2=\@@chemicalunit + \dimen2=\@@chemicalright\dimen0 + \vcenter{\leftskip1em\hsize\dimen2\relax\strut#2\strut}% + \right.$]}% + +\def\executechemicalUPARROW[#1]% + {\executechemicalverticalsymbol\uparrow{#1}} + +\def\executechemicalDOWNARROW[#1]% + {\executechemicalverticalsymbol\downarrow{#1}} + +\def\executechemicalUPDOWNARROW[#1]% + {\executechemicalverticalsymbol\updownarrow{#1}} + +\let\setchemicalattributes\relax + +\setupchemical + [\c!width=0, + \c!height=0, + \c!left=0, + \c!right=0, + \c!top=0, + \c!bottom=0, + \c!bodyfont=\the\bodyfontsize, + \c!resolution=\outputresolution, + \c!scale=\v!medium, + \c!size=\v!medium, + \c!textsize=\v!big, + \c!frame=\v!off, + \c!axis=\v!off, + \c!state=\v!start, + \c!style=\rm, + \c!location=, + \c!option=, + \c!offset=LOW, + \c!alternative=1, + \c!color=, + \c!rulethickness=, + \c!rulecolor=, + \c!factor=1] + +% Tijdelijk plaatsen we deze extra macro's hier. +% +% mathontop: \mtop {} {} +% textontop: \ttop {} {} + +\def\putontop#1#2% + {\vbox + {\halign + {\strut\hss##\hss\cr + #1\cr + #2\cr}}} + +\def\ttop#1#2% + {\putontop{\tx#1}{#2}} + +\def\mtop#1#2% + {\vbox + {\offinterlineskip + \halign + {\hss##\hss\cr + $\scriptscriptstyle#1$\cr + \noalign{\vskip.5ex}% + $#2$\cr}}} + +\def\ctop#1#2% + {\vbox + {\offinterlineskip + \halign + {\hss##\hss\cr + $\@@dochemicalstyle{\@@localchemicalformat\scriptscriptstyle#1}$\cr + \noalign{\vskip.5ex}% + $\@@dochemicalstyle{\@@localchemicalformat#2}$\cr}}} + +%D Here are a couple of \CONTEXT\ goodies: +%D +%D \startitemize +%D \item styles hooked into \CONTEXT\ style mechanism +%D \item support for color and rulethickness (mp mode only) +%D \item position tracking +%D \stopitemize + +\ifCONTEXT \else \protect \endinput \fi + +\let\@@chemicalrulecolor\empty +\let\@@chemicalcolor \empty + +% \def\setchemicalattributes +% {\scratchdimen\@@chemicalchemicalrulethickness +% \def\chemicalattributes +% {withpen pencircle scaled \the\scratchdimen\space +% withcolor }% +% \doifelsenothing\@@chemicalchemicalrulecolor +% {\edef\chemicalattributes{\chemicalattributes black}} +% {\edef\chemicalattributes{\chemicalattributes \MPcolor{\@@chemicalchemicalrulecolor}}}% +% \startMPdrawing +% drawoptions (\chemicalattributes) ; +% \stopMPdrawing} + +\def\setchemicalattributes + {\scratchdimen\@@chemicalrulethickness + \def\chemicalattributes + {withpen pencircle scaled \the\scratchdimen\space + withcolor }% + \doifelsenothing\@@chemicalrulecolor + {\edef\chemicalattributes{\chemicalattributes black}} + {\edef\chemicalattributes{\chemicalattributes \MPcolor{\@@chemicalrulecolor}}}% + \startMPdrawing + drawoptions (\chemicalattributes) ; + \stopMPdrawing} + +\def\@@dochemicalcolor + {\doifsomething\@@chemicalcolor{\color[\@@chemicalcolor]}} + +\def\@@dochemicalstyle + {\doconvertfont\@@chemicalstyle} + +\setupchemical + [\c!rulethickness=\linewidth, + \c!rulecolor=, + \c!color=] + +\def\cpos#1#2% + {\iftrialtypesetting + #2% + \else + \bgroup + \globalpushmacro\dowithchemical + \gdef\dowithchemical##1{\hpos{#1}{##1}\globalpopmacro\dowithchemical}% + #2% + \egroup + \fi} + +\protect \endinput + +% \startchemical[axis=on,frame=yes] +% \chemical[SIX,ROT2,B,R36,RZ6][CH_3] +% \chemical[PB:RZ3,ONE,Z05,SB5,EP37,PE][O,H] +% \stopchemical + +% \startchemical[size=big,scale=small,axis=on,frame=yes,factor=1.5] +% \chemical[SIX,ROT2,B,R36,RZ6][CH_3] +% \chemical[PB:RZ3,ONE,Z05,SB5,EP37,PE][O,H] +% \stopchemical + +% \startchemical[size=big,scale=medium,axis=on,frame=yes,factor=1.5] +% \chemical[SIX,ROT2,B,R36,RZ6][CH_3] +% \chemical[PB:RZ3,ONE,Z05,SB5,EP37,PE][O,H] +% \stopchemical + +% \startchemical[size=big,scale=big,axis=on,frame=yes,factor=1.5] +% \chemical[SIX,ROT2,B,R36,RZ6][CH_3] +% \chemical[PB:RZ3,ONE,Z05,SB5,EP37,PE][O,H] +% \stopchemical + diff --git a/Master/texmf-dist/tex/context/modules/mkii/rlxcache.rlx b/Master/texmf-dist/tex/context/modules/mkii/rlxcache.rlx new file mode 100644 index 00000000000..006e5feac7b --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/rlxcache.rlx @@ -0,0 +1,71 @@ +<?xml version='1.0 standalone='yes'?> + +<rl:manipulators> + + <rl:manipulator name='pdf' suffix='eps'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.eps</rl:old> + <rl:new><rl:value name='cache' default='rlxcache'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath="<rl:value name='path'/>" + --outputpath="<rl:value name='cache' default='.'/>" + "<rl:value name='file' method='nosuffix'/>.eps" + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='svg'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.svg</rl:old> + <rl:new><rl:value name='cache' default='rlxcache'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath="<rl:value name='path'/>" + --outputpath="<rl:value name='cache' default='.'/>" + "<rl:value name='file' method='nosuffix'/>.svg" + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='svgz'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.svgz</rl:old> + <rl:new><rl:value name='cache' default='rlxcache'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath="<rl:value name='path'/>" + --outputpath="<rl:value name='cache' default='.'/>" + "<rl:value name='file' method='nosuffix'/>.svgz" + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='gif'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.gif</rl:old> + <rl:new><rl:value name='cache' default='rlxcache'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath="<rl:value name='path'/>" + --outputpath="<rl:value name='cache' default='.'/>" + "<rl:value name='file' method='nosuffix'/>.gif" + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='tif'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.tif</rl:old> + <rl:new><rl:value name='cache' default='rlxcache'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath="<rl:value name='path'/>" + --outputpath="<rl:value name='cache' default='.'/>" + "<rl:value name='file' method='nosuffix'/>.tif" + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='tiff'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.tiff</rl:old> + <rl:new><rl:value name='cache' default='rlxcache'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath="<rl:value name='path'/>" + --outputpath="<rl:value name='cache' default='.'/>" + "<rl:value name='file' method='nosuffix'/>.tiff" + </rl:step> + </rl:manipulator> + +</rl:manipulators> diff --git a/Master/texmf-dist/tex/context/modules/mkii/rlxtools.rlx b/Master/texmf-dist/tex/context/modules/mkii/rlxtools.rlx new file mode 100644 index 00000000000..b230c6d5b54 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/rlxtools.rlx @@ -0,0 +1,136 @@ +<?xml version='1.0 standalone='yes'?> + +<rl:manipulators> + + <!-- normally the file tag will also have a suffix! --> + + <!-- pstopdf will be made independent of the example framework --> + + <!-- rl:manipulator name='pdf' suffix='svg'> + <rl:old><rl:value name='path'/>/<rl:value name='file'/></rl:old> + <rl:new><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + inkscape + --without-gui + --print="><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.ps" + <rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.svg + </rl:step> + <rl:step> + texmfstart pstopdf + <rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.ps + <rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.pdf + </rl:step> + </rl:manipulator --> + + <!-- rl:manipulator name='pdf' suffix='svgz'> + <rl:old><rl:value name='path'/>/<rl:value name='file'/></rl:old> + <rl:new><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + inkscape + --without-gui + --print="><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.ps" + <rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.svgz + </rl:step> + <rl:step> + texmfstart pstopdf + <rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.ps + <rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.pdf + </rl:step> + </rl:manipulator --> + + <rl:manipulator name='pdf' suffix='eps'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.eps</rl:old> + <rl:new><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + <rl:value name='old'/> + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='svg'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.svg</rl:old> + <rl:new><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + <rl:value name='old'/> + <rl:value name='new'/> + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='svgz'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.svgz</rl:old> + <rl:new><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + <rl:value name='old'/> + <rl:value name='new'/> + </rl:step> + </rl:manipulator> + + <rl:manipulator name='lowres' suffix='pdf'> + <rl:old><rl:value name='path'/>/<rl:value name='file'/></rl:old> + <rl:new><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file'/></rl:new> + <rl:step> + texmfstart pstopdf --convert --method=4 + --inputpath=<rl:value name='path'/> + --outputpath=<rl:value name='path'/>/<rl:value name='prefix'/> + <rl:value name='file'/> + </rl:step> + </rl:manipulator> + + <rl:manipulator name='medres' suffix='pdf'> + <rl:old><rl:value name='path'/>/<rl:value name='file'/></rl:old> + <rl:new><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file'/></rl:new> + <rl:step> + texmfstart pstopdf --convert --method=4 + --inputpath=<rl:value name='path'/> + --outputpath=<rl:value name='path'/>/<rl:value name='prefix'/> + <rl:value name='file'/> + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='gif'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.gif</rl:old> + <rl:new><rl:value name='cache' default='.'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath=<rl:value name='path'/> + --outputpath=<rl:value name='cache' default='.'/> + <rl:value name='file' method='nosuffix'/>.gif + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='tif'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.tif</rl:old> + <rl:new><rl:value name='cache' default='.'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath=<rl:value name='path'/> + --outputpath=<rl:value name='cache' default='.'/> + <rl:value name='file' method='nosuffix'/>.tif + </rl:step> + </rl:manipulator> + + <rl:manipulator name='pdf' suffix='tiff'> + <rl:old><rl:value name='path'/>/<rl:value name='file' method='nosuffix'/>.tiff</rl:old> + <rl:new><rl:value name='cache' default='.'/>/<rl:value name='file' method='nosuffix'/>.pdf</rl:new> + <rl:step> + texmfstart pstopdf --convert + --inputpath=<rl:value name='path'/> + --outputpath=<rl:value name='cache' default='.'/> + <rl:value name='file' method='nosuffix'/>.tiff + </rl:step> + </rl:manipulator> + + <rl:manipulator name='cropped' suffix='pdf'> + <rl:old><rl:value name='path'/>/<rl:value name='file'/></rl:old> + <rl:new><rl:value name='path'/>/<rl:value name='prefix'/><rl:value name='file'/></rl:new> + <rl:step> + texmfstart pstopdf --convert --method=3 + --inputpath=<rl:value name='path'/> + --outputpath=<rl:value name='path'/>/<rl:value name='prefix'/> + <rl:value name='file'/> + </rl:step> + </rl:manipulator> + +</rl:manipulators> diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-chi-00.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-chi-00.mkii new file mode 100644 index 00000000000..fb8d47603be --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-chi-00.mkii @@ -0,0 +1,76 @@ +%D \module +%D [ file=s-chi-00, +%D version=1999.12.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Basic Chinese Style, +%D author=Hans Hagen, +%D date=\currentdate, +%D suggestions=Wang Lei, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\input font-chi.mkii % faster than \setupbodyfont[chi] + +\mainlanguage [cn] + +\unprotect + +\setupsection [\s!section-1] [\c!headconversion=\s!chinese] +\setupsection [\s!section-2] [\c!headconversion=\s!chinese] +\setupsection [\s!section-3] [\c!headconversion=\s!chinese] + +\setupsection [\s!section-2] [\v!appendix\c!conversion=] + +\setuphead [\v!chapter] [\c!distance=1.25em] +\setuphead [\v!section] [\c!distance=1.25em] +\setuphead [\v!subsection] [\c!distance=1.00em] + +\setuplist [\v!chapter] [\c!headlabel=\v!yes,\c!headconversion=\v!yes,\c!width=5em] +\setuplist [\v!section] [\c!headlabel=\v!yes,\c!headconversion=\v!yes,\c!width=5em] + +\setupmarking [\v!chapter\v!number] [\c!headlabel=\v!yes,\c!headconversion=\v!yes] +\setupmarking [\v!section\v!number] [\c!headlabel=\v!yes,\c!headconversion=\v!yes] + +\setuplabeltext [cn] [\v!subsection={\symbol[S]\kern.25em}] +\setuplabeltext [cn] [\v!subsubsection={\symbol[S]\kern.25em}] +\setuplabeltext [cn] [\v!subsubsubsection={\symbol[S]\kern.25em}] +\setuplabeltext [cn] [\v!subsubsubsubsection={\symbol[S]\kern.25em}] + +% nog taalonafhankelijk maken -> \e!tabel enz + +\definereferenceformat [intable] [\c!label=\v!table] +\definereferenceformat [infigure] [\c!label=\v!figure] +\definereferenceformat [inchapter] [\c!label=\v!chapter] +\definereferenceformat [insection] [\c!label=\v!section] + +% important + +\setuptyping[\c!tab=\v!no] + +%D This module (and font support) adapts to the \UTF\ regime, but you +%D need to enable \UTF\ first! +%D +%D \starttyping +%D \enableregime[utf] \usemodule[chi-00] +%D +%D \starttext +%D +%D å…¡ä¹ŸåŒ…å› æ²˜æ°“ä¾·æŸµè‹—å«å«è²¡ +%D 崧淫è¨å¼¼ç¶è·‘æ„窟榜蒸å¥ç¨½ +%D 霄瓢館縲擻鼕åƒé”é‡ä½‰æ²Žå² +%D 狋垚柛胅å¨æ¶˜ç½žåŸæƒˆç‰»èºå‚’ +%D 焱èé…¡å»…æ»˜çµºèµ©å¡´æ¦—ç®‚è¸ƒå¬ +%D 澕蓴醊ç§èž—餟燱螬駸礑鎞瀧 +%D 鄿瀯騬醹躕鱕 +%D +%D \blank +%D +%D Wang Lei is written as: 王磊 +%D +%D \stoptext +%D \stoptyping + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-fnt-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-fnt-01.mkii new file mode 100644 index 00000000000..aedcf913d97 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-fnt-01.mkii @@ -0,0 +1,61 @@ +%D \module +%D [ file=s-fnt-01, +%D version=2001.08.22, +%D title=\CONTEXT\ Style File, +%D subtitle=Font Environment 1, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This file is used by the \type {texfont.pl} installation +%D script. It is of no use for \MKIV. + +%D Modes: compact + +\dontcomplain + +\setupbodyfont + [10pt] + +\setuplayout + [backspace=30pt, + topspace=30pt, + footer=0pt, + header=36pt, + width=middle, + height=middle] + +\setupcolors + [state=start] + +\def\ShowFont + {\dotripleempty\doShowFont} + +\def\doShowFont[#1][#2][#3]% + {\doifsomething{#1} + {\bgroup + \ifthirdargument + \definefontsynonym[WhateverName][#2][encoding=#3] + \definefont[WhateverFont][WhateverName] + \setupheadertexts[\tttf#2\quad#1\quad#3] + \WhateverFont + \setupinterlinespace + \showfont[WhateverName] + \showligatures[WhateverName] + \doifnotmode{compact}{\showaccents\showcharacters} + \else + \definefontsynonym[WhateverName][#2] + \definefont[WhateverFont][WhateverName] + \setupheadertexts[\tttf#2\quad#1\quad(special font)] + \WhateverFont + \setupinterlinespace + \showfont[WhateverName] + \fi + \page + \egroup}} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-fnt-02.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-fnt-02.mkii new file mode 100644 index 00000000000..69f976102b1 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-fnt-02.mkii @@ -0,0 +1,133 @@ +% output=pdftex modes=demo + +% nice example: +% +% \usemodule[s-fnt-02] +% +% \usetypescriptfile[type-ghz.tex] +% +% \usetypescript [sans] [optima,optima-nova] [texnansi] +% +% \setvariables +% [glyphs] +% [name-1=OptimaLT, +% name-2=OptimaNovaLT-Regular] +% +% \starttext +% +% \setups[show-glyphs] +% +% \stoptext +% +% see end, for other example (or run texexec s-fnt-02 --mode=demo) + +\setvariables + [glyphs] + [frame=on, + name-1=cmr10, + name-2=cmtt10, + map-1=, + map-2=] + +\setuppapersize[S4][S4] + +\setupcolors[state=start] + +\setuplayout[page] + +\definecolor[Gray] [s=.2] +\definecolor[ColorNone][s=1,t=.5,a=1] +\definecolor[ColorOne] [r=1,t=.5,a=1] +\definecolor[ColorTwo] [g=1,t=.5,a=1] +\definecolor[BackOne] [b=1,t=.5,a=1] +\definecolor[BackTwo] [r=1,g=1,t=.5,a=1] + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=Gray] + +\startsetups[show-glyphs] + + \doifnothing{\getvariable{glyphs}{name-1}}{\endinput} + \doifnothing{\getvariable{glyphs}{name-2}}{\endinput} + + \doifsomething{\getvariable{glyphs}{map-1}}{\loadmapfile[\getvariable{glyphs}{map-1}]} + \doifsomething{\getvariable{glyphs}{map-2}}{\loadmapfile[\getvariable{glyphs}{map-2}]} + + \definefont[FontOne][\getvariable{glyphs}{name-1} at 280pt] + \definefont[FontTwo][\getvariable{glyphs}{name-2} at 280pt] + +% \dostepwiserecurse{0}{255}{1} +% {\doiffontcharelse{\getvariable{glyphs}{name-1}}{\recurselevel} +% {\doiffontcharelse{\getvariable{glyphs}{name-2}}{\recurselevel} +% {\startstandardmakeup +% \doifelse{\getvariable{glyphs}{frame}}{on} % too many box calculations when off, but who cares +% {\boxrulewidth=2pt} +% {\boxrulewidth=0pt} +% \setbox 0=\hbox{\white\ruledhbox{\FontOne \char\recurselevel}} +% \setbox 2=\hbox{\white\ruledhbox{\FontTwo \char\recurselevel}} +% \setbox 4=\hbox{\FontOne \ColorOne \char\recurselevel} +% \setbox 6=\hbox{\FontTwo \ColorTwo \char\recurselevel} +% \setbox 8=\hbox{\BackOne \ruledhbox{\FontOne \phantom{\char\recurselevel}}} +% \setbox10=\hbox{\BackTwo \ruledhbox{\FontTwo \phantom{\char\recurselevel}}} +% \vfill +% \hbox{\dostepwiserecurse{0}{10}{2}{\hbox to \hsize{\hss\box\recurselevel\hss}\hskip-\hsize}} +% \vfill +% \tttf +% \setstrut +% \hbox to \hsize{\strut\hss +% {\ColorOne \getvariable{glyphs}{name-1}}\quad +% {\ColorTwo \getvariable{glyphs}{name-2}}\quad +% {\ColorNone char \recurselevel }\hss} +% \stopstandardmakeup} +% {}} +% {}} + + \dostepwiserecurse{0}{255}{1} + {\donefalse + \doiffontcharelse{\getvariable{glyphs}{name-1}}{\recurselevel}{\donetrue}{}% + \doiffontcharelse{\getvariable{glyphs}{name-2}}{\recurselevel}{\donetrue}{}% + \ifdone + \startstandardmakeup + \doifelse{\getvariable{glyphs}{frame}}{on} % too many box calculations when off, but who cares + {\boxrulewidth=2pt} + {\boxrulewidth=0pt} + \setbox 0=\hbox{\white\ruledhbox{\FontOne \char\recurselevel}} + \setbox 2=\hbox{\white\ruledhbox{\FontTwo \char\recurselevel}} + \setbox 4=\hbox{\FontOne \ColorOne \char\recurselevel} + \setbox 6=\hbox{\FontTwo \ColorTwo \char\recurselevel} + \setbox 8=\hbox{\BackOne \ruledhbox{\FontOne \phantom{\char\recurselevel}}} + \setbox10=\hbox{\BackTwo \ruledhbox{\FontTwo \phantom{\char\recurselevel}}} + \vfill + \hbox{\dostepwiserecurse{0}{10}{2}{\hbox to \hsize{\hss\box\recurselevel\hss}\hskip-\hsize}} + \vfill + \tttf + \setstrut + \hbox to \hsize{\strut\hss + {\ColorOne \getvariable{glyphs}{name-1}}\quad + {\ColorTwo \getvariable{glyphs}{name-2}}\quad + {\ColorNone char \recurselevel }\hss} + \stopstandardmakeup + \fi} + +\stopsetups + +\doifnotmode{demo}{\endinput} + +\starttext + + \setupencoding[default=ec] + + \loadmapline [=][aer10 <cmr10.pfb] + \loadmapline [=][\defaultencoding-lmr10 <\defaultencoding.enc <lmr10.pfb] + + \setvariables + [glyphs] + [frame=on, + name-1=aer10, + name-2=\defaultencoding-lmr10] + + \setups[show-glyphs] + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-grk-00.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-grk-00.mkii new file mode 100644 index 00000000000..f76d0c220b8 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-grk-00.mkii @@ -0,0 +1,77 @@ +%D \module +%D [ file=s-grk-00, +%D version=2004.08.23, +%D title=\CONTEXT\ Style File, +%D subtitle=CB Greek Support, +%D author=Hans Hagen, +%D date=\currentdate, +%D suggestions=Giuseppe Bilotta, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\usetypescriptfile[type-cbg] + +\usetypescript [all] [cbgreek-medium] + +\startsetups [cbgreek] + + \catcode`~=\other + \catcode`|=\other + + \language[greek] + \switchtobodyfont[cbgreek] + +\stopsetups + +\definestartstop + [greek] + [commands=\directsetup{cbgreek}] + +\doifnotmode{demo}{\endinput} + +% The following sample file was submitted to the \CONTEXT\ +% mailing list by Giuseppe Bilotta, along with the right +% typescripts. + +% already loaded: \usemodule[greek] + +\mainlanguage[english] + +\starttext + +We can easily use plain English for normal text, and then switch +to greek when we want; as a first try we type the lower and +upper case 26 letters of the latin alphabet and see how they come +out in greek: + +\startgreek +a b c d e f g h i j k l m n o p q r s t u v w x y z \par +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z +\stopgreek + +As it can be observed, some uppercase letters have strange +outcomes; also, j gives \greek{j} and c gives the +end-of-word sigma \greek{c}; interestingly, s gives either the +normal sigma or the end-of-word one, depending on whether it's at +the end of the word or not: \greek{satrapws}. + +Of course we can use the various diacritical signs: accents +(\greek{`a, 'a, ~a}), breathings (\greek{<r, >w, a"}) and +subscribed iotas (\greek{a|, h|, w|}) (these last are pretty ugly in my +opinion); observe how they automatically get the correct position +with uppercase letters: (\greek{`A, 'A, ~A, <A, >A, A|}). + +Can the thing be used for serious work? + +\startgreek +>>'Andra moi >'ennepe, Mo~usa, pol'utropon, >'os m'ala poll`a\hfill\break +pl'agqjh, >epe`i Tro'ihs <er`on ptol'iejron >'eperse;\hfill\break +poll~wn d" >anjr'wpwn >'iden >'astea ka`i n'oon >'egnw,\hfill\break +poll`a d" <'o g" >en p'ontw| p'ajen >'algea <`on kat`a jum'on,\hfill\break +>>arn'umenos <'hn te yuq`hn ka`i n'oston <eta'irwn. +\stopgreek + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-jap-00.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-jap-00.mkii new file mode 100644 index 00000000000..5eec2f72594 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-jap-00.mkii @@ -0,0 +1,23 @@ +%D \module +%D [ file=s-jap-00, +%D version=2006.01.19, +%D title=\CONTEXT\ Style File, +%D subtitle=Basic Japanese Style, +%D author=Hans Hagen, +%D date=\currentdate, +%D suggestions=Richard Gabriel, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\input font-jap.tex % faster than \setupbodyfont[jap] + +\mainlanguage [ja] + +\unprotect + +\setuptyping[\c!tab=\v!no] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-map-10.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-map-10.mkii new file mode 100644 index 00000000000..3446a214c52 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-map-10.mkii @@ -0,0 +1,491 @@ +%\module [ +% file=s-map-10.mkii, +% version=2012.06.06, +% title=\CONTEXT\ Style File, +% subtitle=\MAPS\ journal style, +% author={Hans Hagen, Taco Hoekwater and Siep Kroonenberg}, +% date=\currentdate, +% copyright={NTG / MAPS}% +%] + +% NOTE: this (MkII) version is not guaranteed to give exactly the +% same output as the MkIV one, and exists mostly for compatibility +% with old-fashioned authors. All final typesetting for the MAPS +% is done with MkIV. If you are reading this: please consider +% switching! + +% This module implements the MAPS style for use with the Context +% macro package. The original MAPS layout was designed and +% implemented in LaTeX by Taco Hoekwater and Siep Kroonenberg. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newif\ifMapsInColumns +\doifmode{asym}{\enablemode[onecolumn]} % implies onecolumn +\doifnotmode{onecolumn}{\MapsInColumnstrue} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% fonts + +%%%%%%%%% first, font sizes +\definebodyfontenvironment [7pt][% LaTeX: scriptsize + interlinespace=8pt, + big=8pt, + small=6pt% +] + +\definebodyfontenvironment [8pt][% LaTeX: footnotesize + interlinespace=9pt, + big=9pt, + small=7pt, + x=6pt% +] + +\definebodyfontenvironment [9pt][% LaTeX: small + interlinespace=10pt, + big=10pt, + small=8pt,% + x=7pt,% + script=6pt% +] + +\definebodyfontenvironment [10pt][% LaTeX: normalsize + interlinespace=11pt, + big=11pt, + a=11pt, + small=9pt,% + x=8pt,% + script=7pt% +] + +\definebodyfontenvironment [11pt][% LaTeX: large + interlinespace=11pt, + big=11pt, + small=10pt,% + x=9pt,% + script=8pt% +] + +\definebodyfontenvironment [14pt][% + interlinespace=14pt, + big=18pt, + small=11pt, + x=10pt% +] + +\definebodyfontenvironment [18pt][% + interlinespace=18pt, + big=24pt, + small=14pt, + x=10pt% +] + +\definebodyfontenvironment [24pt][% + interlinespace=24pt, + big=24pt, + small=18pt, + x=11pt% +] + +%%% font families (no realfonts, no protruding) + +\starttypescript [maps][ec] +\definetypeface [maps] [rm] [serif] [modern] [default] [encoding=ec,rscale=0.95] +\definetypeface [maps] [mm] [math] [modern] [computer-modern] +\definetypeface [maps] [tt] [mono] [modern] [default] [encoding=ec,rscale=0.90] +\definetypeface [maps] [ss] [sans] [modern] [default] [encoding=ec,rscale=0.95] +\stoptypescript + +\writestatus{maps\space warning}{This, the MkII style, is OUTDATED and UNSUPPORTED!} +\writestatus{maps\space warning}{Please consider using ConTeXt MkIV instead.} + +\startmode[realfonts] +\writestatus{maps\space error}{The MkII version of the module does not support 'realfonts'!} +\wait +\stopmode + +\setupbodyfont[maps,10pt,rm] + +\setupinterlinespace[line=11pt] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% additional general typographic details + +\setupindenting [yes,next,11pt] % indenting after enumerations etc. + +\definepapersize + [maps] + [width=21cm,height=26.5cm] + +\setuppapersize [maps][maps] + +% parameters: +% margin -> latex marginparwith + +\setuplayout[% + topspace=40pt, + height=688pt, + header=33pt, + margin=106pt, + leftmargindistance=11pt, + rightmargindistance=11pt% +] + + +\setupblank[5.5pt] + +\setuppagenumbering [location=] + +\definetyping [widetyping] + +\setupheader [style=\ss] +\setupfooter [style=\ss] + +\def\AuHead{% + %\ifnum\pageno=\MapsPage \hbox{}\else + \MapsRunningAuthor%\fi +} +\def\TiHead{% + \ifnum\pageno=\MapsPage \relax \MapsRunningAuthor %\hbox{} + \else \MapsRunningTitle\fi} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% sectioning + +\setupheads[sectionnumber=no, align=right] + +\def\hfonti{\ssbfa} +\def\hfontii{\ssbf} +\def\hfontiii{\rm\it} +\def\runin#1#2{#2.} + +\doifmodeelse{nosubsub}{% +\setuphead [section][% + style=\hfontii, + before={\blank[line]}, + after={}% +] +\setuphead [subsection][% + style=\hfontiii, + command=\runin, + alternative=text, + distance=6pt, + before={\blank[halfline]}% +]}{% +\setuphead [section][% + style=\hfonti, + before={\blank[line]}, + after={\blank[halfline]}% +] +\setuphead [subsection][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubsection][% + style=\hfontiii, + command=\runin, + distance=6pt, + alternative=text, + before={\blank[halfline]}% +]} + +\doifmodeelse{nosubsub}{% +\setuphead [subject][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubject][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]}{% +\setuphead [subject][% + style=\hfonti, + before={\blank}, + after={\blank[halfline]}% +] +\setuphead [subsubject][% + style=\hfontii, + before={\blank[halfline]}, + after={}% +] +\setuphead [subsubsubject][% + style=\hfontiii, + command=\runin, + alternative=text, + before={\blank[halfline]}% +]} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% floats + +\setupfloats [location=center, before={\ss}] +\setupcaptions [headstyle={\ssbf},style={\ssx}, + suffix=,distance=6pt, + inbetween={\blank[halfline]}] + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% various document elements + +\def\ChkBox{% + \hbox {\boxrulewidth=.4pt \raise.2ex\ruledvbox + {\phantom{\vrule width .85ex height .85ex% +}}}} +\definesymbol [1][\ChkBox] + +\setupitemize[1][packed] + +\setupitemize [each][% + indentnext=no, + align=right, + width=1em, + distance=0pt% +] + +% an outer form of itemize that does not indent +% the paragraph. + +\definecomplexorsimpleempty\startouteritemize +\def\complexstartouteritemize[#1]{\begingroup + \startitemize[width=1sp,#1] + \let\doitem\item + \def\item{\doitem[]\hbox{}\kern12pt\rightskip=0pt}% +} + +\def\stopouteritemize{\stopitemize\endgroup} + + +\setupenumerations [indentnext=no] + +\setupdescriptions [indentnext=no] + +\unexpanded\def\smalltyping{% + \switchtobodyfont[tt]% + \parindent=0pt +} + +% typing: +% - prettyverbatim is NOT the default +% - smaller size + +\unexpanded\def + \XeTeX{X\lower.5ex\hbox{\kern-.1em\mirror{E}}\kern-.1667em\TeX} + +\setuptyping [% + style={\smalltyping}, + option=none, + indentnext=no% +] + +\def\footnum#1{#1.} + +\setupfootnotes + [location=none, + width=\textwidth, + before={\blank}, + numbercommand=, + command=\footnum] + +\setupfootnotedefinition + [location=serried, + before=, + after=, + distance=0.5em] + +\setuptabulate + [before=\blank, + inner=\ss, + after=\blank] + +\def\startIntroEntry#1% + {\startlinecorrection + \bgroup + \setupalign[right] + \setuptolerance[verytolerant] + \setupindenting[no] + \noindent + \switchtobodyfont[9pt]% + \setuplocalinterlinespace[line=10pt]% + %\hyphenpenalty10000 + \parfillskip 0pt plus 1fill + \rightskip6pt plus 1fill + \ss + \bgroup\bf #1\par\egroup + \ignorespaces } + +\def\stopIntroEntry + {\par\egroup \stoplinecorrection + \blank[line] } + +\def\defineIntroEntry[#1][#2][#3]% + {\setvalue{start#1}{\startIntroEntry{#2}}% + \setvalue {stop#1}{\stopIntroEntry#3}} + +\defineIntroEntry[Keywords][Keywords][] +\defineIntroEntry[Abstract][Abstract][] + +% article parameters (other fields and defaults) +\def\MapsBibData[#1]% + {\getparameters [Maps] + [SubTitle=, + RunningAuthor=, + RunningTitle=, + Email=, + Address=, + Page=1, + Title=, + Author=, + Period=, + Number=, + Year=, + #1]% + \doifnothing{\MapsPeriod}{% + \ifnum \normalmonth<6 \gdef\MapsPeriod{VOORJAAR}\else \gdef\MapsPeriod{NAJAAR}\fi} + \doifinstringelse{oorjaar}{\MapsPeriod}{\gdef\MapsPeriod{VOORJAAR}}{}% + \doifinstringelse{pring}{\MapsPeriod}{\gdef\MapsPeriod{VOORJAAR}}{}% + \doifinstringelse{ajaar}{\MapsPeriod}{\gdef\MapsPeriod{NAJAAR}}{}% + \doifinstringelse{utumn}{\MapsPeriod}{\gdef\MapsPeriod{NAJAAR}}{}% + \doifnothing{\MapsYear}{\gdef\MapsYear{\the\year}}% + \doifnothing{\MapsNumber}{% + \ifnum \normalmonth<6 + \xdef\MapsNumber{\the\numexpr (\the\year-1990)*2\relax}% + \else + \xdef\MapsNumber{\the\numexpr (\the\year-1990)*2+1\relax}% + \fi }% + \doifnothing\MapsRunningAuthor + {\global\let\MapsRunningAuthor\MapsAuthor}% + \doifnothing\MapsRunningTitle + {\global\let\MapsRunningTitle\MapsTitle}}% + +\def\dostartArticle[#1]{% + \MapsBibData[#1] + \pageno=\MapsPage + \setuppagenumber[start=\MapsPage] + \startbaselinecorrection + \bgroup + \hsize = 457pt + \let\\\crlf + \blank[35pt,force] + \switchtobodyfont[24pt] + \setupalign[right] + {\noindent\bf\MapsTitle\par} + \ifx\MapsSubTitle\empty + \blank[30pt] + \else + \bgroup + \blank[12pt] + \switchtobodyfont[18pt]\noindent \it + \advance \rightskip 0pt plus 2em + \MapsSubTitle\par + \egroup + \blank[30pt] + \fi + \egroup + \setupalign[width] + \switchtobodyfont[rm,10pt] + \stopbaselinecorrection + \ifMapsInColumns + \startcolumns\hyphenpenalty1000 + \else + \clubpenalty10000 + \widowpenalty10000 + \fi +} + +\def\startArticle{\dosingleempty\dostartArticle} + +\def\signArticle{% + \blank\let\\\crlf + \noindent\switchtobodyfont[ss,9pt]% + \MapsAuthor + \doifsomething{\MapsAddress}{\\\MapsAddress}% + \doifsomething{\MapsEmail}{\\\MapsEmail}% + \switchtobodyfont[10pt]% + \def\signArticle{}% +} + +\def\stopArticle{% + \par\signArticle + \ifMapsInColumns \stopcolumns \fi + \page +} + +\installpagebreakhandler{last}{} + +%%% `logos' %%%%%%%%%%%%%%%%%%%%%%%%%% + +\unexpanded\def\LaTeX % requested by erik frambach + {{\setbox\scratchbox\hbox{L}% + \scratchdimen\ht\scratchbox + \setbox\scratchbox\hbox{\switchtobodyfont[script]A}% + L\kern-.55\wd\scratchbox + \raise\scratchdimen\hbox{\lower\ht\scratchbox\copy\scratchbox}% + \kern-.2\wd\scratchbox\TeX}} + + +\def\CONTEXT{Con{\TeX}t} +\def\ConTeXt{Con{\TeX}t} +\def\METAFONT{Metafont} +\def\METAPOST{MetaPost} +\def\POSTSCRIPT{PostScript} + +\def\acro#1{{\switchtobodyfont[9pt]#1}} + + +%%%%%%%%%%% + +\doifmodeelse{onecolumn}{% + \setuplayout[width=340pt] + \doifmodeelse{asym}{% one col, asymmetric + \setuplayout[backspace=187.3pt]% + \setuptyping [widetyping][oddmargin=-117pt] + \setuppagenumbering [alternative={singlesided,doublesided}] + \setupheadertexts + [{\hbox{}\hskip-117pt\TiHead}] + [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-30pt\hbox{}}] + [{\hbox{}\hskip-147pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] + [\AuHead] + \setupfootertexts + }{% one col, symmetric + \setuplayout[backspace=70.3pt] + \setuppagenumbering [alternative=doublesided] + \setuptyping[blank=halfline] + \setupheadertexts + [\TiHead] + [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-147pt\hbox{}}] + [{\hbox{}\hskip-147pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] + [\AuHead] + \setupfootertexts +}}{% two col + \setuplayout[width=457pt] + \setupcolumns[n=2,tolerance=verytolerant,distance=11pt] + \setuplayout[backspace=70.3pt,grid=yes] + \setuppagenumbering [alternative=doublesided] + \setuptyping[blank=halfline] + \setupheadertexts + [\TiHead] + [{\cap{\MapsPeriod\ \MapsYear}\quad\bf \pagenumber\hskip-30pt\hbox{}}] + [{\hbox{}\hskip-30pt{\bf \pagenumber}\quad \cap {maps\ \MapsNumber}}] + [\AuHead] + \setupfootertexts +} + +\def\fulltextwidth{457pt} + +\def\startdescription + {\blank + \bgroup + \def\sym##1{\par\noindent\hbox{\bf\kern -16pt ##1}\hskip 12pt} + \startnarrower[left] + } +\def\stopdescription + {\par \stopnarrower \egroup \blank \noindentation } + +\frenchspacing +\setuptolerance[tolerant] + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-mod-00.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-mod-00.mkii new file mode 100644 index 00000000000..a81406a7346 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-mod-00.mkii @@ -0,0 +1,511 @@ +%D \module +%D [ file=s-mod-00, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Base Environment, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +% todo: +% +% file inclusions -> hyperlinks + +\mainlanguage[en] % better not here + +\usemodule[units] + +\enableactivediscretionaries +\newprettytrue + +\unprotect + +% beter: +% +% group -> title +% title -> category +% subtitle -> subtitle + +% herzien ivm fonts + +% nog eens \interface \\ \\ verder doorvoeren + +\def\resetmoduledocumentation + {\getrawparameters + [Module] + [ file=\jobname, + type=, + version={\currentdate[\v!year,{.},\v!month,{.},\v!day]}, + system=\CONTEXT, + title=Unknown Title, + subtitle=, + author=Unknown Author, + date=\currentdate, + copyright=Unknown Copyright, + suggestions=]} + +\resetmoduledocumentation + +\def\dostartmoduledocumentation[#1]% + {\newcounter\ParagraphNumber + \resetmoduledocumentation + \getrawparameters[Module][type=tex,#1]} + +\def\startmoduledocumentation + {\starttext + \dosingleempty\dostartmoduledocumentation} + +\def\stopmoduledocumentation + {\page + \placeregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no, + \c!criterium=\v!text] + \stoptext} + +% \def\complexmodule[#1]% +% {\startglobal % i.v.m. \bgroup in \startdocumentation +% \getrawparameters[Module][#1] +% \stopglobal % i.v.m. \bgroup in \startdocumentation +% \moduletitle} +% +% \def\simplemodule#1% +% {\type{#1}} +% +% \definecomplexorsimple\module + +% \startmode[atpragma] +% +% \def\TitlePage#1% can be done more efficient +% {\startMPrun +% mpgraph := #1 ; +% input mp-cont ; +% \stopMPrun +% \externalfigure +% [\bufferprefix mprun.#1] +% [\c!height=\vsize, +% \c!width=\hsize]} +% +% \defineoverlay[titlepage][\TitlePage{512}] +% +% \stopmode + +\startuseMPgraphic{titlepage} + + width := PaperWidth ; + height := PaperHeight ; + + color local_red, local_white, local_blue ; + + local_white := white ; + + local_blue := local_white randomized (.6,.8) ; + local_red := local_white randomized (.3,.4) ; + + u := width/400 ; + + def a_module (expr dx, dy) = + picture p ; p := image + ( ddy := 0 ; sx := 60u ; + for i=1 upto (4 randomized 2) : + sy := 7u randomized 3u ; + fill unitsquare xyscaled(sx,sy) shifted (0,ddy) + withcolor local_red ; + ddy := ddy + sy + 4u ; + endfor ) ; + p := p shifted (dx,dy) shifted - center p ; + fill boundingbox p enlarged 8u withcolor local_white ; + fill boundingbox p enlarged 4u withcolor local_blue ; + draw p ; + enddef ; + + set_grid(width, height, width/15, height/15) ; + forever: + if new_on_grid(uniformdeviate width,uniformdeviate height): + a_module(dx,dy) ; + fi ; + exitif grid_full ; + endfor ; + + clip currentpicture to unitsquare xyscaled(width,height) ; +\stopuseMPgraphic + +\defineoverlay + [titlepage] + [\useMPgraphic{titlepage}] + +\doifmode{atpragma}{\readfile{s-mod-04.tex}{}{}} + +\defineframed + [TitleFrame] + [\c!background=\v!color, + \c!backgroundcolor=white, + \c!align=\v!right, + \c!offset=12pt, + \c!strut=\v!no, + \c!frame=\v!off, + \c!bottom=] + +\definelayout + [titlepage] + [\c!backspace=0pt, + \c!topspace=0pt, + \c!header=0pt, + \c!footer=0pt, + \c!height=\v!middle, + \c!width=\v!middle] + +\def\moduletitle + {\setuplayout[titlepage] + \ifx\ModuleNumber\undefined \else + \ifnum\ModuleNumber<10 + \edef\ModuleNumber{00\ModuleNumber} + \else\ifnum\ModuleNumber<100 + \edef\ModuleNumber{0\ModuleNumber} + \fi\fi + \setupbackgrounds + [\v!page] + [\c!background=titlepage] + \fi + \startmakeup[\v!standard][\c!headerstate=\v!none,\c!footerstate=\v!none] + \switchtobodyfont[14.4pt,ss] + \bgroup + \def\CONTEXT {Con\kern-.15em\TeX t} + \def\TEXUTIL {\TeX Util} + \def\PPCHTEX {PPCH\TeX} + \def\METAPOST{MetaPost} + \hfill + {\definedfont[SansBold at 96pt]\setstrut + \TitleFrame{\Modulesystem}} + \vfill + \definetabulate[temp][|l|l|]% + \switchtobodyfont[17.3pt,ss] + \hfill + {\bf\setstrut + \TitleFrame + {\insidefloattrue\setuptabulate[\c!before=,\c!after=]% + \starttemp + \doifsomething{\Moduletitle} + {\NC title \EQ \Moduletitle \NC\NR}% + \doifsomething{\Modulesubtitle} + {\NC subtitle \EQ \Modulesubtitle \NC\NR}% + \doifsomething{\Moduleauthor} + {\NC author \EQ \Moduleauthor \NC\NR}% + \NC date \EQ \currentdate \NC\NR + %\doifsomething{\Modulesuggestions} % todo: generates space + % {\NC suggestions \NC \Modulesuggestions \NC\NR}% + \stoptemp}} + \egroup + \stopmakeup + \ifx\ModuleNumber\undefined \else + \setupbackgrounds + [\v!page] + [\c!background=] + \fi + \setuplayout} + +\let\stopdocumentation=\relax + +\def\startdocumentation + {\bgroup + \doglobal\newcounter\NOfMarginLines + \def\stopdocumentation{\par\egroup}} + +\newif\ifcompressdefinitions + +\def\startcompressdefinitions {\global\compressdefinitionstrue} +\def\stopcompressdefinitions {\global\compressdefinitionsfalse} + +\gdef\CompressDefinitions% + {\ifcompressdefinitions + \switchtobodyfont[\v!small]% + \fi} + +\startnotmode[nocode] + + \definetyping + [definition] + + \setuptyping + [definition] + [\c!before={\page[\v!preference]}\blank\PresetParagraphNumber\CompressDefinitions, + \c!after=\ResetParagraphNumber\blank, + \c!option=\Moduletype] + +\stopnotmode + +\startmode[nocode] + +% \definieerbuffer[definition] % ignore + + \long\def\startdefinition#1\stopdefinition{} + +\stopmode + +\definetyping [PL] [\c!option=PL, \c!margin=\v!standard] +\definetyping [JV] [\c!option=JV, \c!margin=\v!standard] +\definetyping [MP] [\c!option=MP, \c!margin=\v!standard] +\definetyping [TEX] [\c!option=TEX,\c!margin=\v!standard] + +\setuptyping [\v!typing] [\c!margin=\v!standard] +\setuptyping [\v!file] [\c!margin=\v!standard] +\setuptyping [definition] [\c!margin=0pt] + +\newcounter\NOfMarginLines +\newcounter\ParagraphNumber + +\def\ResetParagraphNumber + {\egroup} + +\def\PresetParagraphNumber + {\bgroup + \xdef\NOfTextLines% + {\the\prevgraf}% + \doglobal\decrement\NOfMarginLines + \doglobal\increment\ParagraphNumber + \message{.}% + \gdef\ShowParagraphNumber% + {\llap{\slx\ParagraphNumber\hskip\leftmargindistance}}% + \gdef\ShowParagraphNumberA% + {\ifnum\NOfMarginLines>\NOfTextLines\relax + \doglobal\increment\NOfTextLines + \else + \ShowParagraphNumber + \global\let\ShowParagraphNumberA=\relax + \global\let\ShowParagraphNumberB=\ShowParagraphNumber + \doglobal\newcounter\NOfMarginLines + \fi}% + \gdef\ShowParagraphNumberB% + {}% + \EveryLine + {\ShowParagraphNumberA}% + \EveryPar + {\vadjust{\nobreak}% + \ShowParagraphNumberB}} + +\EveryPar % skip one + {\EveryPar + {\doglobal\newcounter\NOfMarginLines}} + +\def\dodomargeaanduidingen[#1]#2% + {\def\docommand##1% + {\indent\hbox + {\ifx#2\relax + \index{##1}% + \else + \index{#2{##1}}% + \fi + #2{\doboundtext{##1}{\leftmarginwidth}{..}}}% + \doglobal\increment\NOfMarginLines + \endgraf}% + \processcommalist[#1]\docommand} + +\def\margeaanduidingen#1[#2]% + {\def\domargeaanduidingen##1##2% + {\margintitle[#2]% + {\switchtobodyfont[\v!small]% + \doglobal\newcounter\NOfMarginLines + \dodomargeaanduidingen[##1]#1% + \scratchcounter=\NOfMarginLines + \multiply\scratchcounter by 10 + \divide\scratchcounter by 12 + \advance\scratchcounter by 1 + \xdef\NOfMarginLines{\the\scratchcounter}% + \processcommalist[##2]\index}}% + \dodoublegroupempty\domargeaanduidingen} + +\def\complexmacros{\margeaanduidingen\tex } +\def\complexextras{\margeaanduidingen\relax} + +\def\complexelements + {\margeaanduidingen\someelement} + +\def\someelement#1{\type{<#1>}} + +\definecomplexorsimpleempty\macros +\definecomplexorsimpleempty\extras +\definecomplexorsimpleempty\elements + +\def\showelements{\dodoubleempty\doshowelements} + +\def\doshowelements[#1][#2] + {\bgroup + \processXMLbuffer + \typebuffer + \setupcolors[\c!state=\v!stop] + \showXSDcomponent[#1][#2] + \egroup} + +% \macros{a,b} +% \macros{a,b}{b} +% \macros[a]{a,b}{b} + +% weg ermee + +\defineparagraphs [interface] [\c!n=2] +\setupparagraphs [interface] [1] [\c!width=4cm] + +\def\startexample{\par\startnarrower} \let\startvoorbeeld\startexample +\def\stopexample {\stopnarrower} \let\stopvoorbeeld \stopexample + +\gdef\VisualizeLastSpace{\ifdim\lastskip>0pt\unskip\tttf\char32\fi} + +\gdef\ShowHeadText #1{\tttf#1\VL\mainlanguage[\currentlanguage]\headtext {#1}\VisualizeLastSpace} +\gdef\ShowLabelText#1{\tttf#1\VL\mainlanguage[\currentlanguage]\labeltext{#1}\VisualizeLastSpace} + +\startbuffer[lang-a] +\starttable[|l|l|] + \HL + \VL \bf head key \VL \bf current value \VL\SR + \HL + \VL \ShowHeadText \v!abbreviations \VL\FR + \VL \ShowHeadText \v!units \VL\MR + \VL \ShowHeadText \v!figures \VL\MR + \VL \ShowHeadText \v!graphics \VL\MR + \VL \ShowHeadText \v!index \VL\MR + \VL \ShowHeadText \v!content \VL\MR + \VL \ShowHeadText \v!intermezzi \VL\MR + \VL \ShowHeadText \v!logos \VL\MR + \VL \ShowHeadText \v!tables \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-b] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!table \VL\FR + \VL \ShowLabelText \v!figure \VL\MR + \VL \ShowLabelText \v!intermezzo \VL\MR + \VL \ShowLabelText \v!graphic \VL\MR + \VL \ShowLabelText \v!chapter \VL\MR + \VL \ShowLabelText \v!section \VL\MR + \VL \ShowLabelText \v!subsection \VL\MR + \VL \ShowLabelText \v!subsubsection \VL\MR + \VL \ShowLabelText \v!appendix \VL\MR + \VL \ShowLabelText \v!part \VL\MR + \VL \ShowLabelText \v!line \VL\MR + \VL \ShowLabelText \v!lines \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-c] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!january \VL\FR + \VL \ShowLabelText \v!february \VL\MR + \VL \ShowLabelText \v!march \VL\MR + \VL \ShowLabelText \v!april \VL\MR + \VL \ShowLabelText \v!may \VL\MR + \VL \ShowLabelText \v!june \VL\MR + \VL \ShowLabelText \v!july \VL\MR + \VL \ShowLabelText \v!august \VL\MR + \VL \ShowLabelText \v!september \VL\MR + \VL \ShowLabelText \v!october \VL\MR + \VL \ShowLabelText \v!november \VL\MR + \VL \ShowLabelText \v!december \VL\LR + \HL +\stoptable +\stopbuffer + +\startbuffer[lang-d] +\starttable[|l|l|] + \HL + \VL \bf label key \VL \bf current value \VL\SR + \HL + \VL \ShowLabelText \v!sunday \VL\FR + \VL \ShowLabelText \v!monday \VL\MR + \VL \ShowLabelText \v!tuesday \VL\MR + \VL \ShowLabelText \v!wednesday \VL\MR + \VL \ShowLabelText \v!thursday \VL\MR + \VL \ShowLabelText \v!friday \VL\MR + \VL \ShowLabelText \v!saturday \VL\LR + \HL +\stoptable +\stopbuffer + +\gdef\ShowTextsValues[#1][#2]% + {\vbox\bgroup + \language[#1]% + \setbox\scratchbox\hbox to \hsize{\hss\bfb#2 language defaults\hss} + \dp\scratchbox\zeropoint + \box\scratchbox + \vskip1em + \hrule + \vskip2em + \halign + {\hss##\hss&##\hskip1em&\hss##\hss\cr + $\vcenter{\getbuffer[lang-a]}$&&$\vcenter{\getbuffer[lang-b]}$\cr + \noalign{\vskip1em} + $\vcenter{\getbuffer[lang-c]}$&&$\vcenter{\getbuffer[lang-d]}$\cr}% + \egroup} + +\gdef\ShowLanguageValues[#1][#2]#3#4% + {\hbox to \hsize + {\hss + \vbox + \bgroup + \language[#1]% + \let\normalbar=| + \starttable[||||] + \HL + \VL \THREE{\bf subsentence symbol and quotes} \VL\SR + \HL + \VL \quotation{#3 #4} \VL \quote{#2} \VL \let|=\normalbar |<||<|#3|>|#4|>| \VL\FR + \VL \quotation{#3 #4} \VL \quote{#2} \VL |<||<|#3|>|#4|>| \VL\LR + \HL + \stoptable + \egroup + \hss}} + +\gdef\doShowAllLanguageValues[#1][#2]#3#4% + {\vbox + {\ShowTextsValues[#1][#2] + \vskip2em + \ShowLanguageValues[#1][#2]{#3}{#4}} + \protect + \page} + +\gdef\ShowAllLanguageValues + {\page + \unprotect + \dodoubleargument\doShowAllLanguageValues} + +\protect + +%D Command references: + +% \input setupa +% \input setupb + +\usemodule[int-load] \loadsetups + +\unprotect + +% \def\showsetup +% {\doglobal\newcounter\CurrentArgument +% \setup} + +\def\showsetup#1% + {{\def\y##1{\writestatus{setups}{warning: remove y! from #1}}% + \setup{#1}}} + +\setupframedtexts + [setuptext] + [\c!background=\v!screen, + \c!frame=\v!off] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-mod-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-mod-01.mkii new file mode 100644 index 00000000000..5b83cd12110 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-mod-01.mkii @@ -0,0 +1,155 @@ +%D \module +%D [ file=s-mod-01, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Paper Environment, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +\usemodule[mod-00,abr-01] + +\dontcomplain + +\unprotect + +\setupbodyfont + [10pt] + +\definetypeface + [narrowtt] [tt] + [mono] [modern-cond] [default] [encoding=\defaultencoding] + +\setuptyping[\v!typing][\c!style=\narrowtt] +\setuptype [\v!type] [\c!style=\narrowtt] + +\mainlanguage + [en] + +\setupwhitespace + [\v!big] + +\setuptolerance + [\v!verytolerant,\v!stretch] + +\setuplayout + [\c!backspace=3.5cm, + \c!leftmargin=1.75cm, + \c!rightmargin=0cm, + \c!margindistance=.5cm, + \c!leftedgedistance=.25cm, + \c!rightedgedistance=.5cm, + \c!edge=1.5cm, + \c!width=15.55333cm, % 13.998cm at 9pt => 15.55333 at 10pt + \c!topspace=2cm, + \c!header=1.25cm, + \c!footer=1.25cm, + \c!height=middle, + \c!style=\ss] + +\setupsetup + [\c!reference=1] + +\startnotmode[single] + + \setuppagenumbering + [\c!alternative={\v!doublesided,\v!singlesided}] + +\stopnotmode + +\setuppagenumbering + [\c!location=] + +\expanded{\setupfootertexts + [\v!edge] + [][\v!pagenumber]} + +\startmode[single] + + \setupfootertexts + [\v!margin] + [\filename{\Modulefile}][] + +\stopmode + +\startnotmode[single] + + \setupfootertexts + [\v!margin] + [\filename{\Modulefile}][] + [\filename{\Modulefile}][] + +\stopnotmode + +\setupfootertexts + [\v!text] + [\CONTEXT] + [\Moduletitle] + +\setupheadertexts + [\v!text] + [] + [\Modulesubtitle] + +\setupinmargin + [\c!location=\v!left] + +\setupheads + [\c!alternative=\v!inmargin] + +\setuphead + [\v!chapter] + [\c!style=\ssc, + \c!page=\v!right, + \c!header=\v!empty] + +\setuphead + [\v!section] + [\c!style=\ssb, + \c!page=\v!right] + +\setuplist + [\v!chapter] + [\c!style=\v!bold, + \c!after=\blank] + +\setupcombinedlist + [\v!content] + [\c!width=3em, + \c!aligntitle=\v!yes] + +\setupregister + [\v!index] + [\c!balance=\v!yes, + \c!indicator=\v!no] + +\startnotmode[nocolor] + +\setupcolors + [\c!state=\v!start] + +\stopnotmode + +\startnotmode[color] + + \setupcolors + [\c!conversion=\v!always] + + \setuptyping + [\c!palet=graypretty] + +\stopnotmode + +\setupinteraction + [\c!state=\v!start, + \c!color=, + \c!style=] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-mod-02.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-mod-02.mkii new file mode 100644 index 00000000000..2d095ff9ab6 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-mod-02.mkii @@ -0,0 +1,421 @@ +%D \module +%D [ file=s-mod-02, +%D version=very-old, +%D title=\CONTEXT\ Style File, +%D subtitle=Documentation Screen Environment, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module looks like crap, is not documented, will +%D change, and used to be called modu-*.tex. + +% Macro's + +\usemodule[mod-00] + +\unprotect + +% todo: internationalize + setups + +\setuphead[paragraaf][expansion=command] +\setuphead[section][expansion=command] + +\def\complexmodule[#1]% redefined + {\startglobal % i.v.m. \bgroup in \startdocumentation + \getparameters[Module][#1] + \stopglobal % i.v.m. \bgroup in \startdocumentation + %%\section{\Modulesubtitle} + \xdef\Temp{\Modulesubtitle}%%Modulesubtitle:\framed{BEGIN \Modulesubtitle END} :#1 !} + \@EA\section\@EA{\Temp} + \WriteLists} + +\def\stopmodule % redefined + {\page + \determineregistercharacteristics + [index] + [criterium=section] + \doifmode{*register} + {\pagereference + [index] + \placeregister + [index] + [balance=yes, + indicator=no, + criterium=section]}} + +\let\ComposeLists=\relax + +\newcounter\ModuleNumber + +\newwrite\BatchFile \openout\BatchFile=\jobname.bat + +\def\WriteBatchFile + {\doglobal\increment\ModuleNumber +% \immediate\write\BatchFile{call modu-run \FileName\space \ModuleNumber}} +% \immediate\write\BatchFile{texmfstart texutil --modu \FileName}} + \immediate\write\BatchFile{texmfstart texexec --pdf --modu --batch \FileName }} + +\newif\ifProcessingPublic + +\def\WriteLists + {\writetolist[FileNames] {}{\FileName} + \writetolist[GroupItems]{}{\GroupItem}} + +\def\moduletitle{} + +\def\TypeZeroModule#1% + {\section{[to be extracted: #1]} + {\em This module is not yet split off.} + \WriteLists} + +\def\TypeOneModule#1% + {\section{[to be documented: #1]} + {\em This module is not yet fully documented.} + \WriteLists} + +\def\TypeTwoModule#1% + {\ifProcessingPublic + \readfile{#1.ted}{}{}% + \WriteBatchFile + \else + \section{[not yet public: #1]} + {\em This module is documented but not yet public.} + \WriteLists + \fi} + +\def\TypeThreeModule#1% + {\readfile{#1.ted}{}{}% + \WriteBatchFile} + +\def\processmodule#1#2% + {\page + \bgroup + \def\FileName{#1} + \setupreferencing[prefix=#1] + \useexternaldocument[PaperVersion][#1][] + \aftersplitstring#1\at-\to\GroupItem + \ComposeLists + \ifcase#2 + \TypeZeroModule{#1} + \or + \TypeOneModule{#1} + \or + \TypeTwoModule{#1} + \or + \TypeThreeModule{#1} + \fi + \page + \setupreferencing[prefix=] + \egroup} + +\def\ModuleGroup#1#2% + {\page + \let\Modulefile=\empty + \setupreferencing[prefix=#1] + \def\FileGroup{#1} + \writetolist[FileGroups]{}{\FileGroup} + \chapter[content]{#2} + \MakeListOfItems + \MakeListOfNames + \MakeListOfGroups + \placecontent[criterium=chapter,level=section]} + +% Layout + +\setupbodyfont + [9pt] + +\setuppapersize + [S6][S6] + +\setuplayout + [backspace=72.5pt, + leftmargin=50pt, + leftmargindistance=12.5pt, + rightmargin=0pt, + rightedge=80pt, + rightedgedistance=10pt, + leftedge=0pt, + width=430pt, + topspace=10pt, + header=0pt, + footer=30pt, + bottomdistance=10pt, + bottom=15pt, + height=410pt, + style=\ss] + +\setuptyping + [palet=colorpretty] + +\setupsetup + [reference=3] + +\definecolor [AchtergrondKleur] [s=.6] +\definecolor [ButtonKleur] [r=.2,g=.2,b=.6] +\definecolor [TekstKleur] [r=.6,g=.2,b=.2] + +\definecolor [colorprettyone] [r=.6,g=.0,b=.0] % red +\definecolor [colorprettytwo] [r=.0,g=.6,b=.0] % green +\definecolor [colorprettythree] [r=.0,g=.0,b=.6] % blue +\definecolor [colorprettyfour] [r=.6,g=.6,b=.0] % yellow + +\setupinteraction + [state=start, + page=yes, + contrastcolor=, + menu=on, + color=] + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=AchtergrondKleur, + offset=2.5pt] % this offset influences the menus! + +\setupbackgrounds + [text,footer] + [text,leftmargin] + [background=color, + backgroundcolor=white] + +\setupsubpagenumber + [way=bysection, + state=start] + +\setupinteractionbar + [frame=off, + offset=0pt, + height=fit] + +\setupwhitespace + [big] + +\setuptyping + [typing] + [option=color] + +\setuptyping + [definition] + [option=color] + +\setuptyping + [file] + [option=color] + +\setuppagenumbering + [alternative=singlesided, + way=bysection, + state=none] + +\setupinmargin + [location=left] + +\setupheads + [alternative=inmargin] + +\setuphead + [chapter] + [style=\ssc, + page=right] + +\setuphead + [section] + [style=\ssb, + page=right] + +\setuplist + [chapter] + [style=bold, + after=\blank] + +\setupcontent + [width=2em] + +\setupindex + [balance=yes, + indicator=no] + +\setupcolors + [state=start] + +\def\TitelBlad#1% + {\startstandardmakeup + \definefont[GrootFont] [SansBold at 72pt] + \definefont[MiddelFont][Sans at 32pt] + \definefont[KleinFont] [Sans at 24pt] + \startcolor[AchtergrondKleur] + \vskip12pt + \midaligned{\GrootFont\setstrut\strut Con\TeX t} + \vskip24pt + \midaligned{\MiddelFont\setstrut\strut #1} + \vskip24pt + \midaligned{\KleinFont\setstrut\strut Hans Hagen} + \vfilll + \midaligned{\KleinFont\setstrut\strut PRAGMA ADE} + \vskip24pt + \midaligned{\KleinFont\setstrut\strut www.pragma-ade.com --- \currentdate} + \vskip12pt + \stopcolor + \stopstandardmakeup} + +\def\ColofonBlad + {\startmode[atpragma] + \page + \bgroup + \def\PragmaHoogte {\makeupheight} + \def\PragmaBreedte{\textwidth} + \def\PragmaKopwit {\topspace} + \def\PragmaRugwit {\backspace} + \def\PragmaMarge {0pt} + \PragmaLijnentrue + \PlaatsPragmaLogo[ADE] + \vfill + todo: colofon + \startnarrower[3*middle] + This is the official documentation of \CONTEXT\ version + \referraldate, a \TEX\ macropackage developed by J.~Hagen + \& A.F.~Otten, who both hold the copyrights. + \stopnarrower + \vfill + \page + \egroup + \stopmode} + +\def\ColofonBlad + {} + +\newbox\ListOfItems +\newbox\ListOfGroups +\newbox\ListOfNames + +\definelist[FileNames] \def\FileName {} +\definelist[FileGroups] \def\FileGroup {} +\definelist[GroupItems] \def\GroupItem {} + +\setuplist + [FileNames,FileGroups,FileGroups] + [expansion=yes, + pagenumber=no, + style=\ss\bf] + +\setuplist + [FileNames] + [command=\FileNameEntry, + after=\endgraf, + alternative=none] % horizontal + +\setuplist + [FileGroups] + [command=\FileGroupEntry, + after=\hss, + alternative=horizontal] + +\def\FileNameEntry#1#2#3% + {\strut\hbox{#2}\endgraf} + +\def\FileGroupEntry#1#2#3% + {\strut\hbox{#2}\endgraf} + +\def\MakeListOfItems + {\setbox\ListOfItems=\vbox + {\ss\bf + \placelist[GroupItems][color=ButtonKleur,contrastcolor=white,criterium=chapter]}} + +\def\MakeListOfNames + {\setbox\ListOfNames=\vbox + {\hsize\rightedgewidth + \ss\bf\setupinterlinespace + \startsimplecolumns[distance=10pt] + \placelist[FileNames][color=ButtonKleur,contrastcolor=white,criterium=chapter] + \stopsimplecolumns}} + +\def\MakeListOfGroups + {\setbox\ListOfGroups=\hbox to \textwidth + {\ss\bf + \setupinteraction[color=ButtonKleur]% + \placelist[FileGroups][color=ButtonKleur,contrastcolor=white,criterium=all]\unskip\unskip}} + +\setbox\ListOfGroups=\hbox{} + +%\setupfootertexts +% [rand] +% [] +% [{\interactiebalk[variant=g]}] + +\setupinteractionmenu + [right,bottom] + [state=start, + frame=off, + color=AchtergrondKleur, + contrastcolor=white, + style=\ss\bf, + height=15pt, + offset=0pt, + inbetween=\vskip5pt, + background=color, + backgroundcolor=ButtonKleur] + +\startinteractionmenu[right] + \boxofsize \vbox \textheight \footerdistance \footerheight 5pt + \bgroup + \copy\ListOfNames + \vfill + \but [\FileGroup:content] local contents \\ + \but [\FileName:index] local register \\ + \but [PaperVersion::begin] paper version \\ + \but [content] main contents \\ + \but [index] main register \\ + \but [PreviousJump] previous jump \\ + \but [CloseDocument] close document \\ + \unskip + \egroup +\stopinteractionmenu + +\startinteractionmenu[bottom] + \unhcopy\ListOfGroups +\stopinteractionmenu + +\def\placemoduleregister + {\startbackmatter + \setupsubpagenumber[reset] + \title[-:index]{Register} + \placeregister[index] + \stopbackmatter} + +\def\placemodulecontent + {\startfrontmatter + \title[-:content]{Contents} + \setupinteractionbar[state=stop] + \placecontent[criterium=text,level=chapter] + \stopfrontmatter} + +\setupcontent + [pagenumber=no, + level=chapter, + interaction=all, + style=, + before=, + after=] + +\setupfootertexts + [margin] + [\tt\Modulefile] + [] + +\setupfootertexts + [text] + [chapter][chapter] + +\setupindex + [symbol=1] + +\setuptolerance + [verytolerant] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-pre-17.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-pre-17.mkii new file mode 100644 index 00000000000..7e8310a537e --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-pre-17.mkii @@ -0,0 +1,399 @@ +%D \module +%D [ file=s-pre-17, +%D version=1999.08.20, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 17, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\setupbodyfont + [12pt,ss] + +\setupcolors + [state=start] + +\setupsystem + [random=medium] + +\setupbackgrounds + [state=repeat] + +\setupbackgrounds + [page] + [background={page,forward}] + +\setupbackgrounds + [text][text] + [background=blowup] + +\setupinteraction + [state=start, + %click=off, + color=TitleColor, + contrastcolor=TitleColor] + +\setupinteractionscreen + [option=max] + +\setuptolerance + [verytolerant,stretch] + +\definecolor [BackColor] [s=.30] +\definecolor [PageColor] [g=1] +\definecolor [FrameColor] [r=1] +\definecolor [TitleColor] [y=1] +\definecolor [ArrowColor] [b=1] + +\defineoverlay [title] [\useMPgraphic{title}] +\defineoverlay [page] [\useMPgraphic{page}] +\defineoverlay [blowup] [\overlaybutton{page(\realfolio)}] +\defineoverlay [forward] [\overlaybutton{forward}] + +\startMPpositiongraphic{mppos:connection} + path pa, pb, pc ; pair ca, cb ; + initialize_box(\MPpos{\MPvar{self}}) ; pa := pxy ; ca := cxy ; + initialize_box(\MPpos{\MPvar{prev}}) ; pb := pxy ; cb := cxy ; + pickup pencircle scaled .5pt ; + pa := pa enlarged 10pt ; + pb := pb enlarged 10pt ; + for i=1 upto 10 : + draw pa randomized 20pt withcolor \MPcolor{FrameColor} ; + endfor ; + if \MPp{\MPvar{prev}}>0 : + pair a, b, c, d ; + for i=1 upto 25 : + a := .5[ulcorner pa,urcorner pa] randomized (10pt,10pt) ; + b := .5[llcorner pb,lrcorner pb] randomized (20pt,10pt) ; + c := .5[a,b] rotatedaround(a,-25) randomized (5pt,5pt) ; + d := .5[a,b] rotatedaround(a,+25) randomized (5pt,5pt) ; + draw (a--b) withcolor \MPcolor{ArrowColor} ; + draw (d--a--c) withcolor \MPcolor{ArrowColor} ; + endfor ; + fi ; + anchor_box(\MPanchor{\MPvar{self}}) ; +\stopMPpositiongraphic + +\startuseMPgraphic{title} + pickup pencircle scaled .5pt ; + for i=1 upto 10 : + draw + fullsquare xyscaled(OverlayWidth,OverlayHeight) + enlarged 10pt randomized 20pt + withcolor \MPcolor{TitleColor} ; + endfor ; +\stopuseMPgraphic + +\startuseMPgraphic{page} + StartPage ; + pickup pencircle scaled .5pt ; + fill Page withcolor \MPcolor{BackColor} ; + for i=1 upto 20 : + draw Page enlarged -50pt randomized 50pt withcolor \MPcolor{PageColor} ; + endfor ; + StopPage ; +\stopuseMPgraphic + +\def\StartText% + {\bgroup + \getrandomdimen\scratchdimen{250pt}{350pt}% + \edef\TextWidth{\the\scratchdimen}% + \setbox\scratchbox=\hbox\bgroup + \hsize\TextWidth + \setupframedtexts + [before=,after=, + width=fit,align=right, % normal, + frame=off,foregroundcolor=white]% + \framedtext\bgroup} + +\def\BlowX{450pt} % \def\BlowX{600pt} +\def\BlowY{300pt} % \def\BlowY{450pt} +\def\BlowV {50pt} % \def\BlowV{100pt} +\def\BlowH {75pt} % \def\BlowH{100pt} +\def\BackO {50pt} % \def\BackO {50pt} + +\def\StopText% + {\egroup\egroup + \doglobal\increment\CurrentBlaBla + \let\PrevBlaBla\CurrentBlaBla \doglobal\decrement\PrevBlaBla + \let\NextBlaBla\CurrentBlaBla \doglobal\increment\NextBlaBla + \setMPpositiongraphic + {connection:\CurrentBlaBla}% + {mppos:connection}% + {seed=\CurrentBlaBla, + prev=connection:\PrevBlaBla, + next=connection:\NextBlaBla}% + \SetBlowUp{connection:\CurrentBlaBla}\BlowX\BlowY\BlowH\BlowV + \hbox to 600pt +% {\getrandomdimen\scratchdimen{50pt}{100pt}% + {\getrandomdimen\scratchdimen{50pt}{75pt}% + \hskip0pt plus \scratchdimen minus \scratchdimen + \hpos{connection:\CurrentBlaBla}% + {\framed + [frame=off, + offset=overlay, + backgroundoffset=\BackO, + background=blowup] + {\box\scratchbox}}% +% \getrandomdimen\scratchdimen{50pt}{100pt}% + \getrandomdimen\scratchdimen{50pt}{75pt}% + \hskip0pt plus \scratchdimen minus \scratchdimen}% +% \getrandomdimen\scratchdimen{100pt}{150pt}% + \getrandomdimen\scratchdimen{75pt}{125pt}% + \vskip\scratchdimen + \egroup} + +\def\xStartText + {\bgroup + \setbox\scratchbox=\hbox\bgroup + \framed + [frame=off,foregroundcolor=white] + \bgroup} + +\def\xStopText{\StopText} + +\def\SetBlowUp#1#2#3#4#5% tag width height hoffset voffset + {\scratchdimen=\MPw{#1}% + \advance\scratchdimen-#2 % + \divide\scratchdimen by 2 + \advance\scratchdimen by \MPx{#1}\relax + \ifdim\scratchdimen<0pt \scratchdimen=0pt \fi + \ScaledPointsToBigPoints{\number\scratchdimen}\TextX + \advance\scratchdimen by #2 % + \ScaledPointsToBigPoints{\number\scratchdimen}\TextW + % + \scratchdimen=\MPh{#1}% + \advance\scratchdimen-#3 % + \divide\scratchdimen by 2 + \advance\scratchdimen\MPy{#1}\relax + \ifdim\scratchdimen<0pt \scratchdimen=0pt \fi + \ScaledPointsToBigPoints{\number\scratchdimen}\TextY + \advance\scratchdimen by #3 + \ScaledPointsToBigPoints{\number\scratchdimen}\TextH + % + \def\PDFpageviewkey{ fitr \TextX\space\TextY\space\TextW\space\TextH}% + \def\PDFpageviewwrd{ /FitR \TextX\space\TextY\space\TextW\space\TextH}% + \edef\PDFpageview{/View [\PDFpageviewwrd]}} + +\def\xSetBlowUp#1#2#3#4#5% tag width height hoffset voffset + {\scratchdimen\MPx{#1}\relax + \ifdim\scratchdimen<#4 + \ScaledPointsToBigPoints{0}\TextX + \multiply\scratchdimen 2 + \else + \advance\scratchdimen-#4 + \ScaledPointsToBigPoints{\number\scratchdimen}\TextX + \advance\scratchdimen#4 + \advance\scratchdimen#4 + \fi + \advance\scratchdimen\MPw{#1}% + \ScaledPointsToBigPoints{\number\scratchdimen}\TextW + % + \scratchdimen\MPy{#1}\relax + \ifdim\scratchdimen<#5 + \ScaledPointsToBigPoints{0}\TextY + \multiply\scratchdimen 2 + \else + \advance\scratchdimen-#5 + \ScaledPointsToBigPoints{\number\scratchdimen}\TextY + \advance\scratchdimen#5 + \advance\scratchdimen#5 + \fi + \advance\scratchdimen\MPh{#1}% + \ScaledPointsToBigPoints{\number\scratchdimen}\TextH + % + \def\PDFpageviewkey{ fitr \TextX\space\TextY\space\TextW\space\TextH}% + \def\PDFpageviewwrd{ /FitR \TextX\space\TextY\space\TextW\space\TextH}% + \edef\PDFpageview{/View [\PDFpageviewwrd]}} + +\dontcomplain + +\def\StartPage#1% + {\doStartPage{1}{#1}} + +\def\doStartPage#1#2% + {\def\StopPage{\doStopPage{#1}{#2}}% + \setbox\scratchbox=\hbox\bgroup + \valign\bgroup\ignorespaces##\vss\cr} + +\def\doStopPage#1#2% + {\cr + \egroup + \egroup + \setbox\scratchbox=\vbox + {\vskip100pt + \hbox \ifcase#1 spread 200pt \else to \wd\scratchbox \fi + {\hss + \switchtobodyfont[big]% + \bfd\setupinterlinespace + \ifcase#1\else \SetBlowUp{title:\realfolio}\BlowX\BlowY\BlowH\BlowV \fi + \hpos{title:\realfolio} + {\framed + [frame=off,align=middle, + foregroundcolor=white, + background={title,blowup}] + {#2}}% + \hss} + \vskip100pt + \box\scratchbox} + \doFlushPage} + +\def\doFlushPage + {\scratchdimen=\ht\scratchbox + \advance\scratchdimen \dp\scratchbox + \advance\scratchdimen 100pt + \edef\height{\the\scratchdimen} + \scratchdimen=\wd\scratchbox + \advance\scratchdimen 100pt + \edef\width {\the\scratchdimen} + \expanded{\definepapersize[MASTER][width=\width,height=\height]} + \setuppapersize + [MASTER][MASTER] + \setuplayout + [topspace=25pt,backspace=25pt, + width=middle,header=0pt,footer=0pt,height=middle] + \centerbox{\box\scratchbox} + \page} + +\def\StartTopic#1% + {\unskip\unskip\cr + \doglobal\increment(\CurrentBlaBla,100)% + \vbox\bgroup + \vskip100pt + \bgroup + \definecolor[FrameColor][TitleColor] + \switchtobodyfont[big] + \bfd\setupinterlinespace + \xStartText#1\xStopText + \vskip25pt + \egroup} + +\def\StopTopic% + {\vskip-\lastskip + \vskip100pt + \egroup + \ignorespaces} + +\def\TitlePage#1% + {\doStartPage{0}{\def\\{\vskip1ex\bfc\def\\{\vskip1ex\bfb}}#1} + \StopPage} + +\doifnotmode{demo}{\endinput} + +\setupoutput[pdftex] + +\starttext + +\TitlePage{About Text\\Today's Talk\\Hans Hagen} + +\StartPage{The First Page} + +\StartTopic{Some Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input knuth \StopText +\StopTopic + +\StartTopic{Another Text} + \StartText \input tufte \StopText + \StartText \input zapf \StopText + \StartText \input knuth \StopText +\StopTopic + +\StartTopic{Some More Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText +\StopTopic + +\StartTopic{Some Text Agian} + \StartText \input tufte \StopText + \StartText \input zapf \StopText + \StartText \input knuth \StopText + \StartText \input tufte \StopText +\StopTopic + +\StopPage + +\StartPage{The Second Page} + +\StartTopic{Some Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText +\StopTopic + +\StartTopic{Another Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText +\StopTopic + +\StartTopic{Some Nice Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input tufte \StopText +\StopTopic + +\StartTopic{Some Funny Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText +\StopTopic + +\StartTopic{Quite Some Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText +\StopTopic + +\StartTopic{Even More Text} + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText +\StopTopic + +\StopPage + +\StartPage{The Third Page} + +\StartTopic{Some Short Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText +\StopTopic + +\StartTopic{Some Minimal Text} + \StartText \input tufte \StopText + \StartText \input zapf \StopText +\StopTopic + +\StartTopic{Some More Text} + \StartText \input tufte \StopText + \StartText \input knuth \StopText + \StartText \input zapf \StopText + \StartText \input tufte \StopText + \StartText \input tufte \StopText +\StopTopic + +\StopPage + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-pre-30.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-pre-30.mkii new file mode 100644 index 00000000000..a7152deb60b --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-pre-30.mkii @@ -0,0 +1,258 @@ +%D \module +%D [ file=s-pre-30, +%D version=2006.04.25, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 30, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\usemodule[streams] + +\setuppapersize + [S6] [S6] + +\setupbodyfont + [12pt,tt] + +\definemeasure[bleed][6pt] + +\definecolor[maincolor-3][r=.5,g=.2,b=.2] +\definecolor[maincolor-1][r=.2,g=.5,b=.2] +\definecolor[maincolor-2][r=.2,g=.2,b=.5] + +\definecolor[pagecolor] [s=.5] +\definecolor[resultcolor][s=1,t=.85,a=1] +\definecolor[maincolor] [maincolor-3] + +\definecolorgroup + [maingroup] + [.5:.2:.2, + .2:.5:.2, + .2:.2:.5] + +\definecolorgroup + [resultgroup] + [1:.85:.85, + .85:1:.85, + .85:.85:1] + +\def\CurrentColor{1} + +\definecolor[maincolor] [maingroup:\CurrentColor] +\definecolor[resultcolor][resultgroup:\CurrentColor] + +\def\NextColor{\ifnum\CurrentColor=3 \def\CurrentColor{1}\else\doglobal\increment\CurrentColor\fi} + +\setuplayout + [backspace=\measure{bleed}, + topspace=30pt, + bottomdistance=\measure{bleed}, + bottom=\dimexpr30pt-\measure{bleed}\relax, + header=0pt, + footer=0pt, + topdistance=\measure{bleed}, + top=\dimexpr30pt-\measure{bleed}\relax, + width=middle, + height=middle] + +\setuptop + [before=\vfill, + after=\vfill, + strut=yes] + +\setupbackgrounds + [text] + [backgroundoffset=\measure{bleed}, + background=color, + backgroundcolor=maincolor] + +\setupbackgrounds + [page] + [background=color, + backgroundcolor=pagecolor] + +\setupcolors + [state=start, + textcolor=white] + +\setuphead + [chapter] + [style=\ttd] + +\setuphead + [section] + [style=\ttd] + +\defineproperty + [result] + [layer] + [state=stop] + +\definelayer + [result] + +\setuplayer + [result] + [width=\textwidth, + height=\textheight] + +\setupbackgrounds + [text] + [background={color,toggle,foreground,result}] + +\setupinteraction + [state=start, + click=no, + menu=on, + color=white, + contrastcolor=white, + closepageaction=HideLayer{result}, + openpageaction=HideLayer{result}] + +% We add a dummy color switch so that each page has at least one +% transparency; else acrobat will render the pages differently +% bug in 6 and 7). + +\startinteractionmenu[bottom] +% \color[resultcolor]{ }% + \hfill + \got [content] content \\ + \got [previouspage] previous \\ + \got [nextpage] next \\ + \got [ToggleLayer{result}] result \\ + \got [CloseDocument] close \\ +\stopinteractionmenu + +\setuphead + [section] + [placehead=no, + incrementnumber=list] + +\setuplist + [section] + [alternative=f] + +\defineoverlay + [toggle] + [\overlaybutton{ToggleLayer{result}}] + +\definestreamlayer + [resultstream] + +\startsetups streamlayer:resultstream:flush + \setlayer + [result] + [preset=middlebottom, + hoffset=\measure{bleed}, +% voffset=-\measure{bleed}] + voffset=\measure{bleed}] + {\startproperty[result]% +% \framed +% [offset=overlay, +% frame=off, +% background=color, +% backgroundoffset=1\dimexpr\measure{bleed}\relax, +% backgroundcolor=maincolor] + {\framed + [offset=overlay, + frame=off, + foregroundcolor=maincolor, + background=color, + backgroundoffset=1\dimexpr\measure{bleed}\relax, + backgroundcolor=resultcolor] + {\tightlayer[\currentstreamlayer]}} + \stopproperty} +\stopsetups + +\startsetups show-definition + \subject{definition} + \typebuffer + \getbuffer + \page +\stopsetups + +\startsetups show-result + \startstreamlayer[resultstream] + \subject{result} + \getbuffer + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-usage + \subject{usage} + \typebuffer + \startstreamlayer[resultstream] + \subject{result} + \getbuffer + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-usage-lines + \subject{usage} + \typebuffer + \startstreamlayer[resultstream] + \subject{result} + \startlines + \getbuffer + \stoplines + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + +\startsetups show-contents + \startcolumns[n=3] + \placelist[section][criterium=text] + \stopcolumns + \pagereference[content] + \page + \NextColor +\stopsetups + +\def\TitlePage#1% + {\title{#1} + \setups{show-contents}} + +\def\StartSample#1% + {\starttext + \page + \section{#1} + \setuptoptexts[][\processedfile\enspace:\enspace\lowercase{#1}]} + +\def\StopSample + {\page + \setuptoptexts[][] + \stoptext + \NextColor} + +\endinput + +\usemodule[pre-30] + +% \TitlePage{Howling to the moon} + +\StartSample{Basics} + +\startbuffer +\lua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;} + +\startlua + a = 1 + b = 2 + c = a*b + tex.print(c) +\stoplua +\stopbuffer + +\setups{show-usage} + +\StopSample diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-pre-60.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-pre-60.mkii new file mode 100644 index 00000000000..8823c66ce1e --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-pre-60.mkii @@ -0,0 +1,143 @@ +%D \module +%D [ file=s-pre-60, +%D version=2004.03.15, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 60, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmode[paper,print] + \let\StartSteps\relax + \let\StopSteps \relax + \let\FlushStep \relax + \let\ResetStep \relax + \let\StartBusy\relax + \let\StopBusy \relax + \endinput +\stopmode + +\newcounter\StepCounter +\newcounter\StepMaximum + +\useJSscripts[stp] + +\startsetups[set-stepper] + + \ifnum\getvariable{stepper}{nofsteps}>\StepMaximum + + \dostepwiserecurse {\numexpr(\StepMaximum+1)} {\getvariable{stepper}{nofsteps}} {1} + {\doifnotmode{nosteps,nostep} + {\expanded{\defineproperty[step:\recurselevel][layer][state=stop,global=yes]}}} + + \xdef\StepMaximum{\getvariable{stepper}{nofsteps}} + + \fi + +\stopsetups + +\setvariables + [stepper] + [set=\setups{set-stepper}, + nofsteps=50] + +\defineproperty[step:busy][layer][state=start,global=no] + +\definereference [SetupStepper] [JS(SetupStepper{step,\StepMaximum})] +\definereference [ResetStepper] [JS(ResetStepper)] +\definereference [CheckStepper] [JS(CheckStepper{\StepCounter})] +\definereference [InvokeStepper] [JS(InvokeStepper)] + +\def\ResetStep {\doglobal\newcounter\StepCounter} +\def\NextStep {\doglobal\increment \StepCounter} +\def\PrevStep {\doglobal\decrement \StepCounter} + +% todo: roll back blank + +\def\StepLayer {step:\StepCounter} +\def\NextStepLayer {step:\the\numexpr\StepCounter+1\relax} +\def\FirstStepLayer{step:1} + +\def\StartStep + {\ifvmode + \scratchskip\lastskip + \vskip-\scratchskip + \startproperty[\StepLayer]% + \vskip\scratchskip + \else + \startproperty[\StepLayer]% + \fi + \ignorespaces} + +\def\StopStep + {\removeunwantedspaces + \stopproperty} + +\def\StartSteps{\iftrialtypesetting\else\ResetStep\NextStep\StartStep\fi} +\def\StopSteps {\iftrialtypesetting\else\StopStep \PrevStep \fi} +\def\FlushStep {\iftrialtypesetting\else\StopStep \NextStep\StartStep\fi} + +\appendtoks + \ResetStep +\to \everyaftershipout + +\def\StartBusy{\startproperty[step:busy]\ignorespaces} +\def\StopBusy {\removeunwantedspaces\stopproperty} + +\setupinteraction + [%openaction=SetupStepper, + closeaction=ResetStepper, + openpageaction=CheckStepper, + closepageaction=ResetStepper] + +\defineoverlay[invoke][\overlaybutton{InvokeStepper}] + +\setupbackgrounds + [text] + [background=invoke] + +% bonus + +\useMPlibrary[nav] + +\definepalet + [navplus] + [attach=interactioncolor, + comment=interactioncolor] + +\setupcomment + [symbol={comment-normal,comment-down}, + textlayer=\StepLayer, + option=buffer, + height=\textheight, + width=\textwidth, + margin=0pt] + +\setupattachments + [symbol={attach-normal,attach-down}, + textlayer=\StepLayer] + +%D Handy: + +\def\StartLocalSteps{\ResetStep} +\def\StopLocalSteps {} + +\def\StartLocalStep {\NextStep\StartStep} +\def\StopLocalStep {\StopStep} + +%D used as (given some definitions): +%D +%D \starttyping +%D \StartLocalSteps +%D \startcombination[both] +%D {\StartLocalStep\placestreamlayer[left]\StopLocalStep} {} +%D {\StartLocalStep\placestreamlayer[right]\StopLocalStep} {} +%D \stopcombination +%D \StopLocalSteps +%D \stoptyping + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-pre-71.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-pre-71.mkii new file mode 100644 index 00000000000..3431367685e --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-pre-71.mkii @@ -0,0 +1,213 @@ +% engine=luatex + +%D \module +%D [ file=s-pre-71, +%D version=2008.08.05, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment 71, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D I might improve this module so consider it experimental. + +% \enablemode[numbers] +% \enablemode[paper] + +\usemodule[pre-60,abr-02] + +\setupinteraction[state=start,click=off] + +\definepapersize[wide][width=900pt,height=600pt] + +\setuppapersize[wide][wide] + +\setuplayout[page] + +% \setupbodyfont[15pt] + +\usetypescriptfile[type-hgz] +\usetypescript[palatino-informal] +\setupbodyfont[palatino-informal,15pt] + +\setupsorting[logo][style=] + +\startnotmode[paper] + \setupbackgrounds[page][background=color,backgroundcolor=black] +\stopnotmode + +\TransparencyHack + +\definelayer[page][width=\paperwidth,height=\paperheight] + +\definecolor[TopicColor-1][r=.3,g=.4,b=.5] +\definecolor[TopicColor-2][r=.3,g=.5,b=.4] +\definecolor[TopicColor-3][r=.4,g=.3,b=.5] +\definecolor[TopicColor-4][r=.4,g=.5,b=.3] +\definecolor[TopicColor-5][r=.5,g=.3,b=.4] +\definecolor[TopicColor-6][r=.5,g=.4,b=.3] +\definecolor[TopicColor-7][r=.35,g=.35,b=.6] +\definecolor[TopicColor-8][r=.6,g=.35,b=.35] +\definecolor[TopicColor-9][r=.35,g=.6,b=.35] + +\definecolor[TopicColor-0][t=.5,a=1,s=.5] +\definecolor[TopicColor] [s=1] + +\setupcolors[state=start] +\setupcolors[textcolor=TopicColor] + +\startluacode + local locations = { + 'lefttop', + 'middletop', + 'righttop', + 'middleleft', + 'middle', + 'middleright', + 'leftbottom', + 'middlebottom', + 'rightbottom', + } + local done, current, previous, n = table.tohash(locations,false), 0, 0, 0 + function document.reset_locations() + done, current, previous, n = table.tohash(locations,false), 0, 0, 0 + end + function document.next_location(loc) + previous = current + n = n + 1 + loc = loc and loc ~= "" and tonumber(loc) + while true do + current = loc or math.random(1,#locations) + if not done[current] then + done[current] = true + break + end + end + end + function document.current_location() + tex.print(locations[current] or "") + end + function document.previous_location() + tex.print(locations[previous] or "") + end + function document.current_n() + tex.print(tostring(current)) + end + function document.previous_n() + tex.print(tostring(previous)) + end + function document.step() + tex.print(tostring(n)) + end +\stopluacode + +\def\StartTopics + {\startstandardmakeup + \ctxlua{document.reset_locations()} + \doifnotmode{paper}{\StartLocalSteps}} + +\def\StopTopics + {\doifnotmode{paper}{\StopLocalSteps} + \flushlayer[page] + \stopstandardmakeup} + +\def\StartTopic + {\dosingleempty\doStartTopic} + +\def\doStartTopic[#1]% + {\doifnotmode{paper}{\NextStep} + \ctxlua{document.next_location("#1")} + \startnotmode[paper] + \doifnothing{#1} + {\ifcase\ctxlua{document.previous_n()}\else + \setlayer + [page] + [preset=\ctxlua{document.previous_location()}] + \bgroup + \doifnotmode{paper}{\startproperty[\StepLayer]}% + \framed + [offset=20pt, + strut=no, + align=normal, + frame=off, + height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + background=color, + backgroundcolor=TopicColor-0] + {}% + \doifnotmode{paper}{\stopproperty}% + \egroup + \fi} + \stopnotmode + \setlayer + [page] + [preset=\ctxlua{document.current_location()}] + \bgroup + \doifnotmode{paper}{\startproperty[\StepLayer]}% + \framed + [offset=20pt, + strut=no, + align=\expdoifelse{#1}{}{normal}{middle,lohi}, + align=\expdoifelse{#1}{}{flushleft,verytolerant}{middle,lohi}, + frame=off, + height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + background=color, + backgroundcolor=TopicColor-\ctxlua{document.current_n()}] + \bgroup + \ignorespaces} + +\def\StopTopic + {\removeunwantedspaces + \egroup + \doifnotmode{paper}{\stopproperty}% + \egroup + \startmode[numbers] + \setlayerframed + [page] + [preset=\ctxlua{document.current_location()}] + [height=\dimexpr\paperheight/3\relax, + width=\dimexpr\paperwidth/3\relax, + frame=off, + foregroundstyle=\bfa, + align={flushright,low}] + {\doifnotmode{paper}{\startproperty[\StepLayer]}% + \ctxlua{document.step()}\kern\strutdepth + \doifnotmode{paper}{\stopproperty}} + \stopmode} + +\logo [METAPOST] {MetaPost} + +\definefont[TitleFont][SansBold at 60pt] +\definefont[TempFont] [SansBold at 12pt] + +\let\StartText\starttext +\let\StopText \stoptext + +\doifnotmode{demo}{\endinput} + +\starttext + +\StartTopics + \StartTopic[1] A \StopTopic + \StartTopic[5] B \StopTopic + \StartTopic[9] C \StopTopic +\StopTopics + +\StartTopics + \StartTopic A \StopTopic + \StartTopic B \StopTopic + \StartTopic C \StopTopic + \StartTopic D \StopTopic + \StartTopic E \StopTopic + \StartTopic F \StopTopic + \StartTopic G \StopTopic + \StartTopic H \StopTopic + \StartTopic I \StopTopic +\StopTopics + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-ptj-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-ptj-01.mkii new file mode 100644 index 00000000000..a14a03ef145 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-ptj-01.mkii @@ -0,0 +1,425 @@ +%D \module +%D [ file=s-ptj-01, +%D version=2009.12.18, +%D title=\CONTEXT\ Style File, +%D subtitle=PracTeX Journal Style, +%D author=Aditya Mahajan, +%D email=adityam at umich dot edu, +%D date=\currentdate, +%D copyright={Aditya Mahajan}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%M % These macros are needed to compile the documentation. +%M \def\PracTeX {Prac\kern-0.07em\TeX} +%M \def\PRACTEX {\PracTeX} +%M \def\pracjourn {The \PRACTEX\ Journal} +%M \useurl[pracjourn][http://www.tug.org/pracjourn/][][\pracjourn] +%M \useurl[texgyre] [http://www.gust.org.pl/projects/e-foundry/tex-gyre/] + +\writestatus {loading} {Context Module for the PracTeX Journal} + +%D This module is for producing acticles for \from[pracjourn]. It merely copies the +%D layout of the the \LATEX\ class \filename{pracjourn.cls} available from +%D \pracjourn\ website (\url[pracjourn]). This module has a filename synonym +%D \filename{pracjourn}. So to use this module, you can write: +%D \starttyping +%D \usemodule[pracjourn] +%D \stoptyping +%D A sample document is given at the end of this file. The typeset sample can +%D be obtained by +%D \starttyping +%D texmfstart texexec --mode=demo s-ptj-01.tex +%D \stoptyping +%D The documentation is written as comments. If you want to see a \PDF\ copy +%D \starttyping +%D texmfstart texexec --module s-ptj-01.tex +%D \stoptyping + +\startmodule[pracjourn] + +\unprotect + +%D First let's setup the paper size and layout for \pracjourn. I am actually not +%D sure about the \quote{official} layout requirement for \pracjourn\ and have +%D reverse engineered the layout from the typeset \LATEX\ examples. If you +%D feel that anything is wrong here, please let me know. + +\setuppapersize + [letter][letter] + +\setuplayout + [ width=middle, + height=middle, + location=middle, + topspace=1.25in, + bottomspace=1in, + backspace=1in, + cutspace=1in, + leftmargin=0.25in, + rightmargin=0.25in, + leftmargindistance=0in, + rightmargindistance=0in, + header=1in, + footer=.5in, + headerdistace=0in, + footerdistance=.25in, + ] + +%D Next we do the font setup. \pracjourn\ uses mathpazo for roman and math faces and +%D uses latin modern for sans serif and monotype. For the main face, 12pt is +%D used with a 15.5pt baseline skip. Font protrusion is enabled, but font +%D expansion is not. We follow these conventions. \CONTEXT\ uses Pagella fonts +%D from \TEX{gyre} project, so we use them instead. + +\usetypescript [serif,sans,mono] [hanging] [pure] +\setupalign [hanging] +\usetypescript [palatino][encoding=texnansi] +\setupbodyfont [palatino,12pt] + +\definefont [titlefont] [Regular at 20pt] +\definefont [authorfont] [Regular at 14pt] + +\setupbodyfontenvironment + [12pt] + [interlinespace=15.5pt,em=italic] + +\setupbodyfontenvironment + [11pt] + [interlinespace=13.6pt,em=italic] + +%D The variables for the article are stored in the \mono{pracjourn} namespace. +%D To initialize these variables use +%D \starttyping +%D \setvariables +%D [pracjourn] +%D [ title=Tile of the Article, +%D author=Name of Author, +%D address=Write your Address, +%D revision={d=14,m=11,y=2006}, +%D copyright=Whatever you want, +%D ] +%D \stoptyping +%D \mono{title} and \mono{author} should always be entered (even though this +%D module does not make them mandatory, it makes little sense to have an +%D article without a title or author. Other variables are optional. If a +%D revision is not written, current date will be used to show the revision. +%D Other variables for the article are the author's email address and website +%D url. Due to catcode problems, it is not always possible to reliably enter +%D these using the variable mechanism. To enter these use \type|\useURL| +%D \starttyping +%D \useURL[email][mailto:address@whatever.com][][address@whatever.com] +%D \useURL[website][link to your homepage] +%D \stoptyping +%D If either of these \URL's are not present, they will be silently ignored +%D while generating the title. + +\setvariables [pracjourn] [ title=] +\setvariables [pracjourn] [ author=] +\setvariables [pracjourn] [ address=] +\setvariables [pracjourn] [copyright=] +\setvariables [pracjourn] [ revision=] + +%D We use the buffer \filename{abstract} for the abstract. So to enter the +%D abstract, write +%D \starttyping +%D \startbuffer[abstract] +%D Write your abstract +%D \stopbuffer +%D \stoptyping +%D Right now, there is no mechanism to inhibt abstracts. In case someone +%D requires it, such a mechanism is easy to implement. + +\startbuffer[abstract] +\stopbuffer + +%D The actual title with the additional information is typset by calling +%D \starttyping +%D \setups{title} +%D \stoptyping +%D Remember that the \type|\setvariables[pracjourn][...]| step must be done +%D before \type|\setups{title}|. + +\setuphead + [title] + [style=\titlefont, + after={\blank[big]}] + +%D Next we define internal frames to take care of the layout of the extra +%D material in the title. + +\defineframed + [pracjourninfotitle] + [ frame=off, + strut=yes, + width=0.1\textwidth, + height=fit, + align=left, + location=hanging, + ] + +\defineframed + [pracjourninfodetails] + [ frame=off, + strut=yes, + width=0.85\textwidth, + height=fit, + align=normal, + location=hanging, + ] + +\newif\ifpracjourntitleskipdone + +\def\pracjourninfo#1#2% + {\pracjourntitleskipdonetrue + \hbox to \textwidth + \bgroup + \hfill \pracjourninfotitle{#1} + \hfill \pracjourninfodetails{#2} + \egroup\endgraf} + +%D Now we take care of the actual layout of the title. Most of this is +%D heuristic, as I was trying to get the same visual effect as the +%D \filename{pracjourn.cls} class. If something does not match, please let me +%D know. The information is typeset as +%D \starttyping +%D \hfill <box of .1\textwidth> \hfill <box of .85\textwidth> +%D \stoptyping +%D at 11pt size. We also add the title and author information in the \PDF\ +%D metadata. + +\startsetups [title] +% Place the tile and the author + \title{\getvariable{pracjourn}{title}} + \blank[medium] + \bgroup\authorfont\setupinterlinespace + \getvariable{pracjourn}{author} \endgraf\egroup + \blank[2*big] +% Place the additional information + \bgroup\switchtobodyfont[11pt] + \setupindenting[no] + \doifurldefinedelse{email} + {\pracjourninfo{Email}{\tttf\from[email]\relax}} + \empty + \doifurldefinedelse{website} + {\pracjourninfo{Website}{\from[website]\relax}} + \empty + \doifsomething{\getvariable{pracjourn}{address}} + {\pracjourninfo{Address}{\getvariable{pracjourn}{address}}} + \ifpracjourntitleskipdone \blank[big] \fi + \pracjourninfo{Abstract} + {\setupindenting[yes] + \setupinterlinespace + \getbuffer[abstract] + \endgraf} + \egroup + \blank[big] + \setups{pracjourndate} + % Add information to pdfmetadata + \setupinteraction + [title={\getvariable{pracjourn}{title}}, + author={\getvariable{pracjourn}{author}}, + subtitle={The PracTeX Journal Article}] +\stopsetups + +% If revision number is present, write it to \filename{_rev.tex} +% FIXME: Do we need to ensure that the dates and month are two digits? +\startrawsetups [pracjourndate] + \doifsomething{\getvariable{pracjourn}{revision}} + {\expanded{\setvariables[pracjourn:date][y=,m=,d=,\getvariable{pracjourn}{revision}]} + \immediate\openout \scratchwrite _rev.tex + \immediate\write \scratchwrite + {\getvariable{pracjourn:date}{y}/\getvariable{pracjourn:date}{m}/\getvariable{pracjourn:date}{d}} + \immediate\closeout\scratchwrite} +\stoprawsetups + +%D Next we setup the header and footer for the first page. \pracjourn\ formats the +%D header as +%D \startlines +%D The PracTeX Journal, year, No. number +%D Article revision year/mm/dd +%D \stoplines +%D If a copyright notice is present, it is printed right aligned on the bottom +%D of first page. Otherwise the footer on the first page is empty. + +\startsetups [pracjourntitleheader] + \framed[frame=off,width=\textwidth,align=normal,location=low] + {\small\setupinterlinespace + \doifelsenothing{\pracjournissue} + {For submission to \pracjourn} + {\pracjournissue} + \endgraf + \doifelsenothing{\getvariable{pracjourn}{revision}} + {Draft of \currentdate[year,/,mm,/,dd]} + {Article revision\space + \expanded{\date[\getvariable{pracjourn}{revision}][year,/,mm,/,dd]}} + \endgraf} +\stopsetups + +\startsetups [pracjourntitlefooter] + \framed[frame=off,width=\textwidth,align=flushright,location=low] + {\small\setupinterlinespace \getvariable{pracjourn}{copyright}\endgraf} +\stopsetups + +\definetext [pracjourntitleheader] [header] [\setups{pracjourntitleheader}][] +\definetext [pracjourntitlefooter] [footer] [\setups{pracjourntitlefooter}] + +\setuphead + [title] + [header=pracjourntitleheader, + footer=pracjourntitlefooter] + +%D For rest of the pages, page number is printed on the middle of the footer. + +\setuppagenumbering [location={footer,middle}, style=mediaeval] + +%D Next we setup the formating for the sections. \pracjourn\ wants font sizes of +%D 17pt, 14pt, and 12pt respectively for section, subsection, and +%D subsubsection. By default, \tex{tfa} is 1.2, \tex{tfb} is 1.4, so the sizes +%D come out close to what is required. The section number is typset in +%D oldstyle fonts. + +\setuphead + [section,subject] + [ style=\tfb, + numberstyle=mediaeval, + before={\blank[2*big]}, + after={\blank[big]}, + ] + +\setuphead + [subsection,subsubject] + [ style=\tfa, + numberstyle=mediaeval, + before={\blank[big]}, + after={\blank[medium]}, + ] + +\setuphead + [subsubsection,subsubsubject] + [ style=\tf, + numberstyle=mediaeval, + before={\blank[medium]}, + after={\blank}, + ] + +%D Now we setup the captions. The captions head are set in normal font, and +%D the caption number is set in oldstlyle. + +\setupcaptions [headstyle=normal,stopper=:,conversion=mediaeval] + +%D Footnotes are placed in a box with a width of 1.5em. The footnote numeral +%D are set in oldstyle font. + +\setupnote + [footnote] + [margindistance=0em, + conversion=mediaeval, + command=\pracjournfootnote, + ] + +\setupnotedefinition [footnote] [location=left,hang=1] + +\def\pracjournfootnote#1{\hbox to 1.5em{#1.}} + +%D \pracjourn\ uses dash as the first level of itemize and text period as the second +%D level. The third level is left unspecified. + +\definesymbol [1] [{\symbol[dash]}] +\definesymbol [2] [\periodcentered] + +\setupitemize [each] [packed] +\setupitemize [1] [packed,autointro] [margin=1em] + +%D We enable colors, interaction and bookmarks. + +\setupinteraction [state=start,color=darkred,style=normal] +\setupurl [color=darkred] +\setupcolors [state=start] +\placebookmarks [section,subsection] [section] + +%D We setup medium indenting, whitespace and blanks. + +\setupindenting [medium,yes] +\setupwhitespace [medium] +\setupblank [medium] + +%D We define logos for \PRACTEX\ and \pracjourn. These definitions are copied from +%D \filename{pracjourn.cls} and can be accessed by \type|\PracTeX|, +%D \type|\PRACTEX| and \type|\pracjourn|. + +\def\PracTeX{Prac\kern-0.07em\TeX} +\def\PRACTEX{\PracTeX} +\def\pracjourn {The \PRACTEX\ Journal} + +%D \filename{pracjourn.cls} provides two macros \type|\ctanfile| and +%D \type|\ctanloc|. I am not sure what is the advantage of these macors. If +%D you want to use these macros, you can use the \type|\useURL| mechanism of +%D \CONTEXT. For example +%D \starttyping +%D \useURL[pracjourn][http://ctan.org/get?fn=/macros/contrib/latex/pracjourn][][\mono{CTAN:macros/contrib/latex/pracjourn}] +%D The \LATEX\ style files for \pracjourn\ is localed at \from[pracjourn] +%D \stoptyping + +%D For the final version of the paper, the string \quotation{The PracTeX +%D Journal year, No x} is written on the header. This only happens when the +%D current directory contains a file \filename{_iss.tex} which contains string +%D like \quotation{pracjourn 2006 No 04, 2006-11-15}. This step is usually taken in +%D the final production of the article. If this file is absent, \quotation{For +%D submission to the PracTeX Journal} is written instead. The next macros are +%D used to parse this file. + +\let\pracjournissue\empty + +\def\parse@iss pracjourn #1 No #2, #3-#4-#5\@nil% + {\!!counta#2\relax + \edef\pracjournissue{\pracjourn, #1, No.\,\the\!!counta}} + +%D Read the \filename{_iss.tex} file, if present to determine the current +%D issue. + +\immediate\openin\scratchread _iss.tex +\ifeof\scratchread\else + \read \scratchread to \!!stringa + \expandafter\parse@iss\!!stringa\@nil +\fi +\immediate\closein\scratchread + +\protect + +\stopmodule + +\doifnotmode{demo}{\endinput} + +\usemodule[pracjourn] + +\setvariables + [pracjourn] + [ title=\PRACTEX\ Article in \CONTEXT, + author=Aditya Mahajan, + address={Ann Arbor,\\ Michigan, USA.}, + revision={y=2006,m=11,d=14}, + copyright={Copyright \copyright\ 2006 Aditya Mahajan.} + ] + +\useURL[website][http://www.eecs.umich.edu/~adityam] +\useURL[email][mailto:adityam@umich.edu][][adityam@umich.edu] + +%D If any of the above information is not provided, the corresponding entry +%D will not apprear in the title. + +\startbuffer[abstract] +Write abstract here +\stopbuffer + +\starttext \setups[title] + +\section{Introduction} + +Write your article \unknown + +\stoptext + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/s-syntax.mkii b/Master/texmf-dist/tex/context/modules/mkii/s-syntax.mkii new file mode 100644 index 00000000000..6d1d59697ec --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/s-syntax.mkii @@ -0,0 +1,54 @@ +%D \module +%D [ file=s-syntax, % was: s-syn-01, +%D version=0000.00.00, +%D title=\CONTEXT\ Style File, +%D subtitle=Preliminary Syntax Stuff, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is needed for the \METAFUN\ manual (this module was +%D called \type {p-syn-01} on my machine). + +\unprotect + +\def\Indent #1{\ifvmode\noindent\hbox to 2em{\hss#1}\else#1\fi} +\def\Sugar #1{\ifhmode\unskip\unskip\unskip\fi\kern.25em{#1}\kern.25em\ignorespaces} +\def\Something#1{\Sugar{\mathematics{\langle\hbox{#1}\rangle}}} +\def\Lbrace {\Sugar{\tttf\leftargument}} +\def\Rbrace {\Sugar{\tttf\rightargument}} +\def\Or {\Sugar{\mathematics{\vert}}} +\def\Optional #1{\Sugar{\mathematics{[\hbox{#1}]}}} +\def\Means {\Sugar{\mathematics{\rightarrow}}} +\def\Tex #1{\Sugar{\type{#1}}} +\def\Literal #1{\Sugar{\type{#1}}} +\def\Syntax #1{\strut\kern-.25em{#1}\kern-.25em} +\def\Next {\crlf\hbox to 2em{}\nobreak} +\def\Whatever #1{\Sugar{\mathematics{(\hbox{#1})}}} +\def\Quote #1{\Sugar{\quote{#1}}} + +\def\Or {\Sugar{\Indent{\mathematics{\vert}}}} +\def\Means {\Sugar{\Indent{\mathematics{\rightarrow}}}} + +\def\StartSyntax + {\goodbreak + \startlines + \catcode`\#=12 + \let\L \Literal + \let\S \Something + \def\FL##1{\color[darkred]{\L{##1}}} + \def\FS##1{\S{\color[darkred]{##1}}} + \let\M \Means + \let\O \Or + \let\Q \Quote + \let\LB\Lbrace + \let\RB\Rbrace} + +\def\StopSyntax + {\stoplines} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-calcmath.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-calcmath.mkii new file mode 100644 index 00000000000..a649aa64878 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-calcmath.mkii @@ -0,0 +1,24 @@ +%D \module +%D [ file=m-calcmath, +%D version=2006.04.24, % 1999.11.06, +%D title=\CONTEXT\ Modules, +%D subtitle=Calculator Math, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\writestatus{calcmath}{this is not supported in mkii} + +\let\inlinecalcmath \inlinemathematics +\def\displaycalcmath \displaymathematics +\let\calcmath \inlinecalcmath +\let\icm \inlinecalcmath +\let\dcm \displaycalcmath + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-chemml.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-chemml.mkii new file mode 100644 index 00000000000..08d64e54b80 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-chemml.mkii @@ -0,0 +1,212 @@ +%D \module +%D [ file=m-chemml, +%D version=2001.09.12, +%D title=\CONTEXT\ XML Modules, +%D subtitle=Loading CHEMML Filters, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\useXMLfilter[cml] + +%D Structural formulas are codes in a \PPCHTEX\ way; this +%D will change -) +%D +%D \startbuffer +%D <dchem> +%D <structure> +%D <component> +%D <graphic>SIX,B</graphic> +%D <graphic>R135</graphic> +%D </component> +%D <component> +%D <graphic>R246</graphic> +%D </component> +%D <component> +%D <graphic>RZ</graphic> +%D <text>A,B,C,D,E,F</text> +%D </component> +%D <component> +%D <graphic>Z</graphic> +%D <oxidation n="3">A</oxidation> +%D <text>A</text> +%D <annotation location="t"> +%D <text>B</text> +%D <caption>x<context:b>x<context:compound token="*"/>x</context:b>x</caption> +%D </annotation> +%D <oxidation n="3" sign="+">B</oxidation> +%D <text>C,D,E,F</text> +%D </component> +%D </structure> +%D <structure> +%D <component> +%D <graphic>SIX,B</graphic> +%D <graphic>r135</graphic> +%D </component> +%D <component> +%D <graphic>R246</graphic> +%D </component> +%D <component> +%D <graphic>RZ</graphic> +%D <text>A,B,C,D,E,F</text> +%D </component> +%D </structure> +%D </dchem> +%D \stopbuffer +%D +%D \typebuffer + +% \ifx\XMLgtoks\undefined \newtoks\XMLgtoks \fi +% \ifx\XMLttoks\undefined \newtoks\XMLttoks \fi +% +% \defineXMLenvironment [structure] +% {\startchemical\ignorespaces} +% {\relax\stopchemical} +% +% \def\chemicalXMLg#1% \defineXMLcollect [graphic] \XMLgtoks +% {\doifelsenothing{\the\XMLgtoks} +% {\doglobal\appendtoks #1\to\XMLgtoks\ignorespaces} +% {\doglobal\appendtoks,#1\to\XMLgtoks\ignorespaces}} +% +% \def\chemicalXMLt#1% +% {\doifelsenothing{\the\XMLttoks} +% {\doglobal\appendtoks #1\to\XMLttoks\ignorespaces} +% {\doglobal\appendtoks,#1\to\XMLttoks\ignorespaces}} +% +% \defineXMLenvironment [component] [type=] +% {\global\XMLgtoks\emptytoks +% \global\XMLttoks\emptytoks +% \defineXMLargument[graphic]\chemicalXMLg +% \defineXMLargument[text]\chemicalXMLt +% \ignorespaces} +% {\expanded{\chemical[\the\XMLgtoks][\the\XMLttoks]}% +% \ignorespaces} +% +% \defineXMLargument [oxidation] [sign=,n=1] \chemicalXMLo % +/- 1..7 +% +% \def\chemicalXMLo#1% +% {\expanded{\chemicalXMLt +% {\noexpand\chemicaloxidation{\XMLop{sign}}{\XMLop{n}}{#1}}}% +% \ignorespaces} +% +% \defineXMLenvironment [annotation] [location=] +% {\bgroup +% \defineXMLenvironmentsave[text]{\ignorespaces}{\ignorespaces}% +% \defineXMLenvironmentsave[caption]{\ignorespaces}{\ignorespaces}% +% \ignorespaces} +% {\scratchtoks{\chemicalright}% +% \processaction +% [\XMLop{location}] +% [ t=>\scratchtoks{\chemicaltop}, +% b=>\scratchtoks{\chemicalbottom}, +% l=>\scratchtoks{\chemicalleft}, +% r=>\scratchtoks{\chemicalright}, +% lc=>\scratchtoks{\chemicalleftcentered}, +% rc=>\scratchtoks{\chemicalrightcentered}, +% tl=>\scratchtoks{\chemicaltopleft}, +% bl=>\scratchtoks{\chemicalbottomleft}, +% tr=>\scratchtoks{\chemicaltopright}, +% br=>\scratchtoks{\chemicalbottomright}, +% lt=>\scratchtoks{\chemicallefttop}, +% lb=>\scratchtoks{\chemicalleftbottom}, +% rt=>\scratchtoks{\chemicalrighttop}, +% rb=>\scratchtoks{\chemicalrightbottom}, +% x=>\scratchtoks{\chemicaltighttext}, +% sl=>\scratchtoks{\chemicalsmashedleft}, +% sm=>\scratchtoks{\chemicalsmashedmiddle}, +% sr=>\scratchtoks{\chemicalsmashedright}]% +% \expanded{\chemicalXMLt +% {\the\scratchtoks{\XMLflush{text}}{\XMLflush{caption}}}}% +% \egroup +% \ignorespaces} +% +% \defineXMLenvironment [forever] +% {\chemicalXMLt{\[}\ignorespaces} +% {\chemicalXMLt{\]}\ignorespaces} + +\ifx\XMLgtoks\undefined \newtoks\XMLgtoks \fi +\ifx\XMLttoks\undefined \newtoks\XMLttoks \fi + +\startXMLmapping [cml] + +% this will be a more natural method; this also triggers it + +\installXMLunknownremapping + +% extensions + +\remapXMLsequence [structure] [CPA] \doCMLstructure +\remapXMLsequence [component] [CPA] \doCMLcomponent +\remapXMLsequence [graphic] [CPA] \doCMLgraphic +\remapXMLsequence [text] [CPA] \doCMLtext + +\remapXMLsequence [caption] [CPA] \doCMLcaption +\remapXMLsequence [oxidation] [CPA] \doCMLoxidation +\remapXMLsequence [annotation][CPA] \doCMLannotation +\remapXMLsequence [forever] [CPA] \doCMLforever + +\def\doCMLstructure#1#2% + {\startchemical\ignorespaces#2\unskip\stopchemical} + +\def\doCMLgraphic#1#2% + {\doifelsenothing{\the\XMLgtoks} + {\uppercase{\doglobal\appendtoks #2\to\XMLgtoks\ignorespaces}} + {\uppercase{\doglobal\appendtoks,#2\to\XMLgtoks\ignorespaces}}% + \ignorespaces} + +\def\doCMLtext#1#2% + {\doifelsenothing{\the\XMLttoks} + {\doglobal\appendtoks #2\to\XMLttoks\ignorespaces} + {\doglobal\appendtoks,#2\to\XMLttoks\ignorespaces}% + \ignorespaces} + +\def\doCMLcomponent#1#2% + {\global\XMLgtoks\emptytoks + \global\XMLttoks\emptytoks + \ignorespaces#2\unskip + \expanded{\chemical[\the\XMLgtoks][\the\XMLttoks]}% + \ignorespaces} + +\def\doCMLannotation#1#2% + {\getXMLarguments{cml}{location="" #1}% + \def\dodoCMLannotation##1% + {\doCMLtext\empty{##1% + {\let\doCMLtext \secondoftwoarguments\processXMLRchild{text}{#2}}% + {\let\doCMLcaption\unmapXMLdata \processXMLRchild{caption}{#2}}}}% + \processaction + [\XMLpar{cml}{location}{r}] + [ t=>\dodoCMLannotation\chemicaltop, + b=>\dodoCMLannotation\chemicalbottom, + l=>\dodoCMLannotation\chemicalleft, + r=>\dodoCMLannotation\chemicalright, + lc=>\dodoCMLannotation\chemicalleftcentered, + rc=>\dodoCMLannotation\chemicalrightcentered, + tl=>\dodoCMLannotation\chemicaltopleft, + bl=>\dodoCMLannotation\chemicalbottomleft, + tr=>\dodoCMLannotation\chemicaltopright, + br=>\dodoCMLannotation\chemicalbottomright, + lt=>\dodoCMLannotation\chemicallefttop, + lb=>\dodoCMLannotation\chemicalleftbottom, + rt=>\dodoCMLannotation\chemicalrighttop, + rb=>\dodoCMLannotation\chemicalrightbottom, + x=>\dodoCMLannotation\chemicaltighttext, + sl=>\dodoCMLannotation\chemicalsmashedleft, + sm=>\dodoCMLannotation\chemicalsmashedmiddle, + sr=>\dodoCMLannotation\chemicalsmashedright]% + \ignorespaces} + +\def\doCMLoxidation#1#2% + {\getXMLarguments{cml}{sign="" n="1" #1}% + \expanded{\doCMLtext{}% + {\noexpand\chemicaloxidation{\XMLpar{cml}{sign}{}}{\XMLpar{cml}{n}{}}{#2}}}% + \ignorespaces} + +\def\doCMLforever#1#2{\[#2\]} + +\stopXMLmapping + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-chemml.xsd b/Master/texmf-dist/tex/context/modules/mkii/x-chemml.xsd new file mode 100644 index 00000000000..b511219115c --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-chemml.xsd @@ -0,0 +1,93 @@ +<?xml version="1.0"?> + +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + +<xsd:annotation> + <xsd:documentation xml:lang="en"> + <p>This schema covers (basic presentational) Chemical + markup. We will extend this schema with names and + predefined components.</p> + <p>author: Hans Hagen, copyright: PRAGMA-ADE / Hasselt NL</p> + </xsd:documentation> +</xsd:annotation> + +<xsd:element type="chemType"> + <xsd:sequence> + <xsd:element ref="chemicalComponentType" /> + <xsd:choice> + <xsd:element ref="chemicalActionType" /> + <xsd:element ref="chemicalBondType" /> + </xsd:choice> + </xsd:sequence> +</xsd:element> + +<xsd:element name="chem" type="chemType" /> +<xsd:element name="ichem" type="chemType" /> +<xsd:element name="dchem" type="chemType" /> + +<xsd:element name="molecule"> + <xsd:complexType> + <xsd:sequence> + <xsd:choice> + <xsd:element name="ion" /> + <xsd:element name="atom" /> + </xsd:choice> + <xsd:element name="caption" type="chemicalCaptionType" /> + </xsd:sequence> + <xsd:attribute name="n" type="xsd:positiveInteger" /> + </xsd:complexType> +</xsd:element> + +<xsd:element name="ion"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="atom" /> + </xsd:sequence> + <xsd:attribute name="n" type="xsd:positiveInteger" /> + <xsd:attribute name="charge" type="xsd:integer" /> + </xsd:complexType> +</xsd:element> + +<xsd:element name="atom" type="xsd:string"> + <xsd:complexType> + <xsd:attribute name="n" type="xsd:positiveInteger"/> + <xsd:attribute name="charge" type="xsd:integer" /> + <xsd:attribute name="protons" type="xsd:positiveInteger" /> + <xsd:attribute name="weight" type="xsd:positiveInteger" /> + </xsd:complexType> +</xsd:element> + +<xsd:complexType name="chemicalActionType"> + <xsd:choice> + <xsd:element name="plus" type="chemicalCaptionType" /> + <xsd:element name="minus" type="chemicalCaptionType" /> + <xsd:element name="equal" type="chemicalCaptionType" /> + <xsd:element name="gives" type="chemicalCaptionType" /> + <xsd:element name="equilibrium" type="chemicalCaptionType" /> + <xsd:element name="mesomeric" type="chemicalCaptionType" /> + </xsd:choice> +</xsd:complexType> + +<xsd:complexType name="chemicalBondType"> + <xsd:choice> + <xsd:element name="singlebond" /> + <xsd:element name="doublebond" /> + <xsd:element name="triplebond" /> + </xsd:choice> +</xsd:complexType> + +<xsd:complexType name="chemicalComponentType"> + <xsd:choice> + <xsd:element ref="molecule" /> + <xsd:element ref="ion" /> + <xsd:element ref="atom" /> + </xsd:choice> +</xsd:complexType> + +<xsd:complexType name="chemicalCaptionType" minOccurs="0" maxOccurs="2"> + <xsd:sequence> + <xsd:element name="caption" type="xsd:string" minOccurs="0" maxOccurs="2" /> + </xsd:sequence> +</xsd:complexType> + +</xsd:schema> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-contml.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-contml.mkii new file mode 100644 index 00000000000..22fffa50a37 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-contml.mkii @@ -0,0 +1,491 @@ +%M \usemodule [contml] \autoXMLnamespace [context] +%M \definefilesynonym [context] [x-contml.xsd] + +%D \module +%D [ file=x-contml, +%D version=mid 2001, +%D title=\CONTEXT\ XML Support, +%D subtitle=Basic \CONTEXT\ commands, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% This module provides some basic \XML\ elements. These definitions +% are highly experimental and serve as a playground for interface +% development. + +\unprotect + +%D \elements {include} +%D +%D \startbuffer +%D You can include another file in the current document with the +%D <element>include</element> element. When including the file, &context; +%D will look at the suffix, in order to decide how to include the file. +%D +%D <verbatim> +%D <line><include name="mine"/></line> +%D <line><include name="mine" type="txt"/></line> +%D <line><include name="mine" type="tex"/></line> +%D </verbatim> +%D \stopbuffer +%D +%D \showelements [context] [include] + +\defineXMLsingular [context:include] [name=,type=xml] + {\doifsomethingXMLop{name} + {\processaction + [\XMLop{type}] + [xml=>\readfile{\XMLop{name}}\donothing\donothing, + tex=>{{\disableXML\readfile{\XMLop{name}}\donothing\donothing}}, + txt=>{{\disableXML\typefile{\XMLop{name}}}}]}} + +% or, nicer: +% +% \defineXMLsingular [context:include] [name=unknown,type=txt] +% {\XMLval{include:type}{\XMLop{type}}{}} +% +% \mapXMLvalue {include:type} {xml} {\readfile{\XMLop{name}}\donothing\donothing} +% \mapXMLvalue {include:type} {tex} {{\disableXML\readfile{\XMLop{name}}\donothing\donothing}} +% \mapXMLvalue {include:type} {txt} {{\disableXML\typefile{\XMLop{name}}}} + +%D \elements {compound} +%D +%D \startbuffer +%D Instead of using hard coded compound tokens, you should use the +%D <element>compound</element> element, as in high<compound token="/" />low. +%D The overhead in keying is rewarded with proper symbols and hyphenation. +%D \stopbuffer +%D +%D \showelements [context] [compound] + +\ifx\normalcompound\undefined \let\normalcompound=| \fi + +% \defineXMLsingular [context:compound] [token=] +% {\expanded{\normalcompound\XMLop{token}}|} + +% \defineXMLsingular [context:compound] [token=] +% {\ifmmode +% \doifXMLop{token}{\XMLop{token}}{\compoundhyphen}% +% \else +% \expanded{\normalcompound\XMLop{token}}|% +% \fi} + +\defineXMLsingular [context:compound] [token=] + {\mathortext % disc comm looks ahead, so \relax + {\doifXMLop{token}{\XMLop{token}}\compoundhyphen}% + {\expanded{\directdiscretionary{\XMLop{token}}}\relax}} + +\defineXMLenvironmentsave [context:cp] + {} + {\expanded{\directdiscretionary{\XMLflush{cp}}}\relax} + +%D \elements {p} +%D +%D \startbuffer +%D <p>Although for &tex; it is often enough to mark the end of a paragraph, +%D in &xml; we want to add a bit more structure. <p/> This permits a more +%D robust implementation of begin<compound/>of<compound/>par actions</p> +%D \stopbuffer +%D +%D \showelements [context] [p] + +\defineXMLenvironment [context:p] {} \endgraf +\defineXMLsingular [context:p] \endgraf + +%D \elements {pageref,textref,lineref} +%D +%D \startbuffer +%D You can ask for a page (<pageref label="lastpage">the last pagenumber +%D is</pageref> aka page <pageref label="lastpage"/>), text or line reference +%D with the following three elements. The label may be any valid &context; +%D reference label. +%D \stopbuffer +%D +%D \showelements [context] [references] + +\defineXMLpickup [context:pageref] [label=] {\at} {[\XMLop{label}]} +\defineXMLpickup [context:textref] [label=] {\in} {[\XMLop{label}]} +\defineXMLpickup [context:lineref] [label=] {\inline} {[\XMLop{label}]} + +%D \elements{text} +%D +%D \startbuffer +%D If you have a self contained &xml; file, you need to signal &context; the +%D begin and end of the document. The following elements can be used for +%D that purpose: +%D +%D <verbatim> +%D <line><text></line> +%D <line> ...</line> +%D <line></text></line> +%D </verbatim> +%D \stopbuffer +%D +%D \showelements [context] [text] + +\defineXMLenvironment [context:text] \starttext \stoptext + +%D \elements {em} +%D +%D \startbuffer +%D Authors often want some control over the way a text is typeset, which is +%D why we provide the <element>em</element> element. We may only hope that +%D the author is <em>consistent</em> in his decisions on what to emphasize. +%D \stopbuffer +%D +%D \showelements [context] [em] + +\defineXMLgrouped [context:em] \em + +%D \elements {b} +%D +%D \startbuffer +%D Bold is not always <b>beautiful</b> but if you really want it, you can +%D get it by using this element. +%D \stopbuffer +%D +%D \showelements [context] [b] + +\defineXMLgrouped [context:b] \bf + +%D \elements {verbatim,typing,line,verb,type} +%D +%D \startbuffer +%D Although the following method can be used to typeset a piece of code +%D verbatim +%D +%D <![CDATA[ +%D Dit \is nogal verbatim ! +%D Dit is {nogal} verbatim ! +%D Dit is <nogal> verbatim ! +%D ]]> +%D +%D we prefer the more structured: +%D +%D <verbatim> +%D <line>Dit \is nogal verbatim !</line> +%D <line>Dit is {nogal} verbatim !</line> +%D <line>Dit is <nogal> verbatim !</line> +%D </verbatim> +%D \stopbuffer +%D +%D The element to tag in<compound/>line verbatim is <type><verb></type>. +%D +%D \showelements [context] [verbatim] + +\defineXMLenvironment [context:verbatim] + {\startpacked + \defineXMLargument[context:line]{\endgraf\type}} + {\stoppacked} + +\defineXMLenvironment [context:typing] + {\startpacked\defineXMLargument[context:line]{\endgraf\type}} + {\stoppacked} + +\defineXMLargument [context:verb] \type +\defineXMLargument [context:type] \type + +%D \elements {itemize,item} +%D +%D \startbuffer +%D Itemized lists are quite common in documents, al least in the ones that +%D we produce. For the moment we only provide a few options, later we will +%D hook it into the &context; attribute handler. +%D +%D <itemize type="a"> +%D <item label="bla"> test </item> +%D <item> test </item> +%D </itemize> +%D +%D <itemize packed="yes"> +%D <item label="more bla"> test </item> +%D <item> test <em>what?</em></item> +%D </itemize> +%D \stopbuffer +%D +%D \showelements [context] [itemize] + +\defineXMLenvironment [context:itemize] [type=,packed=] + {\let\XMLoptions\empty + \doifsomethingXMLop{type}{\addtocommalist{\XMLop{type}}\XMLoptions}% + \doifXMLop{packed}{yes}{\addtocommalist{packed}\XMLoptions}% + \expanded{\startitemize[\XMLoptions]}} + {\stopitemize} + +\defineXMLenvironment [context:item] [label=] + {\expanded{\item[\XMLop{label}]}} + {\endgraf} + +%D \elements {externalfigure} +%D +%D \startbuffer +%D The previous examples already demonstrated how we can include a graphic: +%D +%D <verbatim> +%D <line><externalfigure file="cow" width="5cm" /></line> +%D </verbatim> +%D \stopbuffer +%D +%D \showelements [context] [externalfigure] + +\defineXMLsingular [context:externalfigure] [\??ef] [base=,label=,file=] + {\bgroup % \getXMLta \expandXMLta \expandXMLtp{file}% + \expandXMLta + \getXMLta % expand entities first + \doifelsenothing{\XMLtp{label}} + {\expanded{\externalfigure[\XMLtp{file}][\XMLta]}} + {\doifsomething{\XMLtp{base}}{\usefigurebase[\XMLtp{base}]}% + \expanded{\externalfigure[\XMLtp{label}][\XMLta]}} + \egroup} + +%D \elements {fixed} +%D \setupexternalfigures[directory={../sample}] +%D \startbuffer +%D Something fixed will end up at the place where it defined in the input +%D stream. The main idea behind this element is that it gives you control +%D over the placement. +%D +%D <itemize> +%D <item> +%D <fixed align="high"> +%D <content> +%D <externalfigure file="cow" frame="on" height="1cm" /> +%D </content> +%D </fixed> +%D </item> +%D </itemize> +%D \stopbuffer +%D +%D \showelements [context] [fixed] + +\defineXMLenvironment [context:fixed] [type=figure,location=,label=] + {\bgroup + \defineXMLsave[context:caption] + \defineXMLsave[context:content]} + {\expanded{\startfixed[\XMLop{location}]}% + \doifXMLdataelse{context:caption} + {\startcombination[1*1] + {\XMLflush{context:content}} {\XMLflush{context:caption}} + \stopcombination} + {\XMLflush{context:content}}% + \stopfixed + \egroup} + +%D \elements {float} +%D \setupexternalfigures[directory={../sample}] +%D \startbuffer +%D A floating body will be placed at the first location available, unless +%D a location is specified. As with the <element>fixed</element> element, +%D you can provide a caption. +%D +%D <float type="figure"> +%D <content> +%D <externalfigure file="cow" frame="on" height="3cm" /> +%D </content> +%D <caption>This is a cow!</caption> +%D </float> +%D \stopbuffer +%D +%D \showelements [context] [float] + +\defineXMLenvironment [context:float] [type=figure,location=here,label=] + {\bgroup + \defineXMLsave[context:caption] + \defineXMLsave[context:content]} + {\expanded + {\placefloat + [\XMLop{type}] [\XMLop{location}] [\XMLop{label}] + {\XMLflush{context:caption}} {\XMLflush{context:content}}} + \egroup} + +%D \elements {quotation,quote} +%D +%D \startbuffer +%D There is a (not so) subtle difference between a display +%D <quotation>quotation</quotation> and an <quote>in<compound/>line</quote> +%D one. +%D \stopbuffer +%D +%D \showelements [context] [table] + +\defineXMLgrouped [context:quote] \quote +\defineXMLgrouped [context:quotation] \quotation + +%D \elements {table,tr,td} +%D +%D \startbuffer +%D There are (currently) three table mechanisms in &context;. One of them +%D resembles the well known &html; tables. +%D +%D <?context-command \startlinecorrection[blank] ?> +%D <table> +%D <tr> <td>one</td> <td>a</td> <td>first </td> </tr> +%D <tr> <td>two</td> <td>b</td> <td>second</td> </tr> +%D </table> +%D <?context-command \stoplinecorrection ?> +%D +%D As you can see here, we use a similar syntax but stick to the &context; +%D attributes (which provide quite advanced control over the layout). +%D +%D <?context-command \startlinecorrection[blank] ?> +%D <table frame="off" background="color" color="white"> +%D <tr backgroundcolor="red"> <td>xx</td> <td>xx</td> </tr> +%D <tr backgroundcolor="green"> <td>xx</td> <td>xx</td> </tr> +%D </table> +%D <?context-command \stoplinecorrection ?> +%D \stopbuffer +%D +%D \showelements [context] [table] + +\defineXMLenvironment [context:table] [\@@tbl\@@tbl] + {\bgroup + \defineXMLnested [context:tr] [\@@tbl] {\expanded{\bTR[\theXMLarguments{\@@tbl}}]} \eTR + \defineXMLnested [context:td] [\@@tbl] {\expanded{\bTD[\theXMLarguments{\@@tbl}}]} \eTD + \expanded{\bTABLE[\theXMLarguments{\@@tbl\@@tbl}]}} + {\eTABLE + \egroup} + +%D \elements {tabulate,tspec,thead,tbody,ttail,trule,tr,td} +%D +%D \startbuffer +%D The second mechanism that we support is tabulation. The advantage of this +%D mechanism is that it it well tuned for tables that have much text in the +%D cells and cross page boundaires. +%D +%D <tabulate> +%D <tspec> +%D <tcell align="left"/> <tcell align="middle"/> <tcell align="right"/> +%D </tspec> +%D <thead> +%D <trule/> +%D <tr> <td> bagger </td> <td> bagger </td> <td> bagger </td> </tr> +%D <trule/> +%D </thead> +%D <ttail> +%D <trule/> +%D </ttail> +%D <tbody> +%D <tr> <td> bagger </td> <td> bagger </td> <td> bagger </td> </tr> +%D <tr> <td> bagg </td> <td> ger </td> <td> gr </td> </tr> +%D <tr> <td> bag </td> <td> er </td> <td> gger </td> </tr> +%D </tbody> +%D </tabulate> +%D \stopbuffer +%D +%D \showelements [context] [tabulate] + +\newtoks\XMLtabtoks + +\defineXMLgrouped [context:tabulate] {\XMLtabtoks{|l|p|}} + +\defineXMLpickup [context:tbody] + {\expanded{\definetabulate[dummy][\the\XMLtabtoks]} + \startdummy\XMLflush{context:thead}} + {\XMLflush{context:ttail}\stopdummy} + +\defineXMLsave [context:thead] +\defineXMLsave [context:ttail] + +\defineXMLenvironment[context:tspec] + {\XMLtabtoks\emptytoks} + {\appendtoks|\to\XMLtabtoks} + +\defineXMLsingular [context:trule] % verrrry ugly + {\crcr\noalign{\kern-\lineheight}\HL} + +\defineXMLsingular [context:tcell] [align=] + {\appendtoks|\to\XMLtabtoks + \expanded{\processallactionsinset + [\XMLop{align}]} + [ paragraph=>\appendtoks p\to\XMLtabtoks, + left=>\appendtoks l\to\XMLtabtoks, + right=>\appendtoks r\to\XMLtabtoks, + center=>\appendtoks c\to\XMLtabtoks, + middle=>\appendtoks c\to\XMLtabtoks]} + +\defineXMLenvironment [context:tr] {\ignorespaces} {\NC\NR} +\defineXMLenvironment [context:td] {\NC} {\ignorespaces} + +%D \elements {hide} +%D +%D \startbuffer +%D This is the way to [<hide>this is gone</hide>] something for the +%D typesetting engine. Normally this element is only used for testing +%D purposes. +%D \stopbuffer +%D +%D \showelements [context] [tabulate] + +\defineXMLignore[context:hide] + +%D \elements {unknown} +%D +%D \startbuffer +%D We can go on and on and <unknown/> with defining elements that map onto +%D &context; commands, but why not just use &tex; input syntax then? +%D \stopbuffer +%D +%D \showelements [context] [unknown] + +\defineXMLsingular [context:unknown] \unknown + +%D A (for the moment) private one. + +\defineXMLargument [context:element] \type + +%D The following common schema definitions apply: +%D +%D {\setupcolors[state=stop]\showXSDcomponent[context][definitions]} + +\defineXMLargument [context:chapter] [label=] {\chapter[\XMLop{label}]} +\defineXMLargument [context:section] [label=] {\section[\XMLop{label}]} +\defineXMLargument [context:subsection] [label=] {\subsection[\XMLop{label}]} +\defineXMLargument [context:subsubsection] [label=] {\subsubsection[\XMLop{label}]} +\defineXMLargument [context:subsubsubsection] [label=] {\subsubsubsection[\XMLop{label}]} + +\defineXMLargument [context:title] [label=] {\title[\XMLop{label}]} +\defineXMLargument [context:subject] [label=] {\subject[\XMLop{label}]} +\defineXMLargument [context:subsubject] [label=] {\subsubject[\XMLop{label}]} +\defineXMLargument [context:subsubsubject] [label=] {\subsubsubject[\XMLop{label}]} +\defineXMLargument [context:subsubsubsubject] [label=] {\subsubsubsubject[\XMLop{label}]} + +\defineXMLenvironment [context:frontmatter] \startfrontmatter \stopfrontmatter +\defineXMLenvironment [context:bodymatter] \startbodymatter \stopbodymatter +\defineXMLenvironment [context:backmatter] \startbackmatter \stopbackmatter +\defineXMLenvironment [context:appendices] \startappendices \stopappendices + +\defineXMLargument [context:index] [key=] + {\doifelsenothingXMLop{key}{\index}{\expanded{\index[\XMLop{key}]}}} + +% \enableXMLfiledata + +% Needed for example (stickers and so): + +\defineXMLenvironment [context:makeup] + \startstandardmakeup \stopstandardmakeup + +\protect \endinput + +% TO DO + +\defineXMLenvironment [combination] [columns=2,rows=1] + {\scratchtoks\emptytoks + \expanded{\appendtoks \noexpand \startcombination + [\XMLop{columns}*\XMLop{rows}]}\to \scratchtoks} + {\appendtoks \stopcombination \to \scratchtoks + \the\scratchtoks} + +\defineXMLprocess[combinationentry] + +\defineXMLpickup [combinationitem] + {\appendtoks\bgroup}{\egroup\to\scratchtoks} + +\defineXMLpickup [combinationcaption] + {\appendtoks\bgroup}{\egroup\to\scratchtoks} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-contml.xsd b/Master/texmf-dist/tex/context/modules/mkii/x-contml.xsd new file mode 100644 index 00000000000..3b71e31e850 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-contml.xsd @@ -0,0 +1,375 @@ +<?xml version="1.0"?> + + +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + +<xsd:annotation> + <xsd:documentation xml:lang="en"> + This schema describes a class of presentations. The structure is + (normally) reflected in the design. + + author: Hans Hagen, copyright: PRAGMA-ADE / Hasselt NL + </xsd:documentation> +</xsd:annotation> + + +<?context-block begin definitions ?> + + <xsd:complexType name="filename.value"> + <xsd:restriction base="xsd:string"> + <xsd:pattern value='[a-zA-Z0-9\-\:\.]*' /> + </xsd:restriction> + </xsd:complexType> + + <xsd:complexType name="filetype.value"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="tex" /> + <xsd:enumeration value="xml" /> + <xsd:enumeration value="txt" /> + </xsd:restriction> + </xsd:complexType> + + <xsd:complexType name="confirmation.value"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="yes" /> + <xsd:enumeration value="no" /> + </xsd:restriction> + </xsd:complexType> + + <xsd:complexType name="conversion.value"> + <xsd:restriction base="xsd:string"> + <xsd:pattern value='(a|A|n|g|G|r|R|1|2|3|4)' /> + </xsd:restriction> + </xsd:complexType> + + <xsd:complexType name="reference.label.value"> + <xsd:restriction base="xsd:string"> + <xsd:pattern value='([a-zA-Z0-9\-\:]*' /> + </xsd:restriction> + </xsd:complexType> + +<?context-block end definitions ?> + + +<?context-block begin text ?> + + <xsd:element name="presentation" mixed="true" /> + +<?context-block end text ?> + + +<?context-block begin p ?> + + <xsd:element name="p" mixed="true" /> + +<?context-block end p ?> + + +<?context-block begin hide ?> + + <xsd:element name="hide" mixed="true" /> + +<?context-block end hide ?> + + +<?context-block begin em ?> + + <xsd:element name="em" mixed="true" /> + +<?context-block end em ?> + + +<?context-block begin b ?> + + <xsd:element name="b" mixed="true" /> + +<?context-block end b ?> + + +<?context-block begin quote ?> + + <xsd:element name="quote" mixed="true" /> + <xsd:element name="quotation" mixed="true" /> + +<?context-block end quote ?> + + +<?context-block begin include ?> + + <xsd:attributeGroup name="include.attributes"> + <xsd:attribute name="file" type="filename.value" use="required" /> + <xsd:attribute name="type" type="filetype.value" /> + </xsd:attributeGroup> + + <xsd:complexType type="include.type"> + <xsd:attributeGroup ref="include.attributes" /> + </xsd:complexType> + + <xsd:element name="include" type="include.type" /> + +<?context-block end include ?> + + +<?context-block begin compound ?> + + <xsd:attributeGroup name="compound.attributes"> + <xsd:attribute name="token" type="xsd:string" /> + </xsd:attributeGroup> + + <xsd:complexType type="compound.type"> + <xsd:attributeGroup ref="compound.attributes" /> + </xsd:complexType> + + <xsd:element name="compound" type="compound.type" /> + +<?context-block end compound ?> + + +<?context-block begin references ?> + + <xsd:attributeGroup name="reference.attributes"> + <xsd:attribute name="label" type="reference.label.value" /> + </xsd:attributeGroup> + + <xsd:complexType type="reference.type"> + <xsd:attributeGroup ref="reference.attributes" /> + </xsd:complexType> + + <xsd:element name="lineref" type="reference.type" /> + <xsd:element name="pageref" type="reference.type" /> + <xsd:element name="textref" type="reference.type" /> + +<?context-block end references ?> + + +<?context-block begin unknown ?> + + <xsd:element name="unknown"/> + +<?context-block end unknown ?> + + +<?context-block begin verbatim ?> <!-- string or anyType --> + + <xsd:complexType name="verbatim.verbatim"> + <xsd:sequence maxOccurs="unbounded" > + <xsd:element name="line" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="verbatim" type="verbatim.verbatim" /> + <xsd:element name="typing" type="verbatim.verbatim" /> + + <xsd:element name="verb" type="xsd:string" /> + <xsd:element name="type" type="xsd:string" /> + +<?context-block end verbatim ?> + + +<?context-block begin itemize ?> + + <xsd:attributeGroup name="itemize.attributes"> + <xsd:attribute name="type" type="conversion.value" /> + <xsd:attribute name="packed" type="confirmation.value" /> + <xsd:attribute name="label" type="reference.label.value" /> + </xsd:attributeGroup> + + <xsd:attributeGroup name="item.attributes"> + <xsd:attribute name="label" type="reference.label.value" /> + </xsd:attributeGroup> + + <xsd:complexType name="item.type" mixed="true"> + <xsd:attributeGroup ref="item.attributes" /> + </xsd:complexType> + + <xsd:complexType name="itemize.type"> + <xsd:sequence minOccurs="1" maxOccurs="unbounded"> + <xml:element name="item" type="item.type" /> + </xsd:sequence> + <xsd:attributeGroup ref="itemize.attributes" /> + </xsd:complexType> + + <xsd:element name="itemize" type="itemize.type" /> + +<?context-block end itemize ?> + + +<?context-block begin fixed ?> + + <xsd:complexType name="fixed.type.value"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="figure" /> + <xsd:enumeration value="table" /> + </xsd:restriction> + </xsd:complexType> + + <xsd:complexType name="fixed.location.value"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="high" /> + <xsd:enumeration value="low" /> + <xsd:enumeration value="lohi" /> + </xsd:restriction> + </xsd:complexType> + + <xsd:attributeGroup name="fixed.attributes"> + <xsd:attribute name="type" type="fixed.type.value" /> + <xsd:attribute name="location" type="fixed.location.value" /> + <xsd:attribute name="label" type="reference.label.value" /> + </xsd:attributeGroup> + + <xsd:complexType name="fixed.type"> + <xsd:all> + <xsd:element name="caption" mixed="true" /> + <xsd:element name="content" mixed="true" /> + </xsd:all> + <xsd:attributeGroup ref="fixed.attributes" /> + </xsd:complexType> + + <xsd:element name="fixed" type="fixed.type" /> + +<?context-block end fixed ?> + + +<?context-block begin float ?> + + <xsd:complexType name="float.type.value"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="figure" /> + <xsd:enumeration value="table" /> + </xsd:restriction> + </xsd:complexType> + + <xsd:complexType name="float.location.value"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="high" /> + <xsd:enumeration value="low" /> + <xsd:enumeration value="lohi" /> + </xsd:restriction> + </xsd:complexType> + + <xsd:attributeGroup name="float.attributes"> + <xsd:attribute name="type" type="float.type.value" /> + <xsd:attribute name="location" type="float.location.value" /> + <xsd:attribute name="label" type="reference.label.value" /> + </xsd:attributeGroup> + + <xsd:complexType name="float.type"> + <xsd:all> + <xsd:element name="caption" mixed="true" /> + <xsd:element name="content" mixed="true" /> + </xsd:all> + <xsd:attributeGroup ref="float.attributes" /> + </xsd:complexType> + + <xsd:element name="float" type="float.type" /> + +<?context-block end float ?> + + +<?context-block begin externalfigure ?> + + <xsd:attributeGroup name="externalfigure.attributes"> + <xsd:extension base="context.kernel.externalfigure.attributes"> + <xsd:attribute name="base" type="filename.value"/> + <xsd:attribute name="file" type="filename.value"/> + <xsd:attribute name="label" type="reference.label.value"/> + </xsd:extension> + </xsd:attributeGroup> + + <xsd:complexType name="externalfigure.type"> + <xsd:attributeGroup ref="externalfigure.attributes" /> + </xsd:complexType> + + <xsd:element name="externalfigure" type="externalfigure.type" /> + +<?context-block end externalfigure ?> + + +<?context-block begin table ?> + + <xsd:attributeGroup name="table.attributes"> + <!-- these elements inherit ConTeXt TABLE parameters --> + <xsd:extension base="context.kernel.table.attributes" /> + </xsd:attributeGroup> + + <xsd:complexType name="table.td.type" mixed="true"> + <xsd:attributeGroup name="table.attributes" /> + </xsd:complexType> + + <xsd:complexType name="table.tr.type"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="td" type="table.td.type" /> + </xsd:sequence> + <xsd:attributeGroup name="table.attributes" /> + </xsd:complexType> + + <xsd:complexType name="table.type"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="tr" type="table.tr.type" /> + </xsd:sequence> + <xsd:attributeGroup name="table.attributes" /> + </xsd:complexType> + + <xsd:element name="table" type="table.type" /> + +<?context-block end table ?> + + +<?context-block begin tabulate ?> + + <xsd:complexType name="tabulate.td.type" mixed="true"> + </xsd:complexType> + + <xsd:complexType name="tabulate.tr.type"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="td" type="tabulate.td.type" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="tabulate.base.type"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="tr" type="tabulate.tr.type" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="tabulate.align.value"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="high" /> + <xsd:enumeration value="low" /> + <xsd:enumeration value="lohi" /> + </xsd:restriction> + </xsd:complexType> + + <xsd:attributeGroup name="tabulate.tcell.attributes"> + <xsd:attribute name="align" type="tabulate.align.value" /> + </xsd:attributeGroup> + + <xsd:complexType name="tabulate.tcell.type" mixed="true"> + <xsd:attributeGroup ref="tabulate.tcell.attributes" /> + </xsd:complexType> + + <xsd:complexType name="tabulate.tcell.type"> + </xsd:complexType> + + <xsd:complexType name="tabulate.tcells.type"> + <xsd:sequence maxOccurs="unbounded"> + <xsd:element name="tcell" type="tabulate.tcell.type" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="tabulate.type"> + <xsd:sequence> + <xsd:element name="tcells" type="tabulate.tcells.type" /> + <xsd:element name="thead" type="tabulate.base.type" minOccurs="0" maxOccurs="1" /> + <xsd:element name="ttail" type="tabulate.base.type" minOccurs="0" maxOccurs="1" /> + <xsd:element name="tbody" type="tabulate.base.type" minOccurs="1" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="tabulate" type="tabulate.type" /> + +<?context-block end tabulate ?> + + +</xsd:schema> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-corres.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-corres.mkii new file mode 100644 index 00000000000..effd79a5b31 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-corres.mkii @@ -0,0 +1,136 @@ +%D \module +%D [ file=x-corres, +%D version=2003.12.15, % replaces keep-02a cum suis +%D title=\CONTEXT\ XML Modules, +%D subtitle=Handling Correspondence Base, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D The selection spec: + +\setvariables + [contacts] + [selection=, + file=x-corres.xml] % fall back + +%D First we define the group expansion pass: + +\startsetups[contacts:collect] + + \defineXMLprocess [contacts] + + \defineXMLignore [contact] + + \defineXMLargument [contactfile] + \processfile + + \defineXMLenvironmentsave [contactgroup] [label=] + {\startXMLmappinggroup[contacts]} + {\XMLaddcontactgrouptoselection + \stopXMLmappinggroup} + +\stopsetups + +%D Next we define the main processing pass: + +\startsetups[contacts:process] + + \defineXMLprocess[contacts] + + \defineXMLignore [contactgroup] + + \defineXMLargument [contactfile] + \processfile + + \defineXMLenvironmentsave[contact] [label=] + {\startXMLmappinggroup[contacts]} + {\XMLselectcontact + \stopXMLmappinggroup} + +\stopsetups + +\startXMLmapping[contacts] + + \defineXMLsave [initials] + \defineXMLsave [formalname] + \defineXMLsave [informalname] + \defineXMLsave [title] + \defineXMLsave [prefix] + \defineXMLsave [suffix] + \defineXMLsave [telephone] + \defineXMLsave [mobiletelephone] + \defineXMLsave [telefax] + \defineXMLsave [email] + \defineXMLsave [address] + \defineXMLsave [information] + + \defineXMLenvironment [p] \endgraf \endgraf + + \defineXMLargument [member] \XMLaddcontacttoselection + +\stopXMLmapping + +%D The selection macros: we expand groups and replace them +%D by contact labels in the selection spec. + +\def\XMLaddcontactgrouptoselection + {\edef\XMLcontactlist{\getvariable{contacts}{selection}}% + \edef\XMLgrouplabel {\XMLop{label}}% + \expanded{\doifinset{\XMLgrouplabel}{\XMLcontactlist}} + {\let\XMLgrouplist\empty + \XMLflush{contactgroup}% + \substituteincommalist\XMLgrouplabel\XMLgrouplist\XMLcontactlist + \expanded + {\globalsetvariables + [contacts] + [selection={\XMLcontactlist}]}}} + +\def\XMLaddcontacttoselection#1% + {\addtocommalist{#1}\XMLgrouplist} + +%D The main selector: + +\def\XMLselectcontact + {\edef\XMLcontactlist {\getvariable{contacts}{selection}}% + \edef\XMLcontactlabel{\XMLop{label}}% + \doifelsenothing{\XMLcontactlist} + {\donetrue} + {\expanded{\doifinsetelse{\XMLcontactlabel}{\XMLcontactlist}} + {\donetrue} + {\donefalse}}% + \ifdone + \XMLflush{contact}% + \setups[contact:handle]% + \fi} + +%D The default: + +\startsetups[contact:handle] + + \XMLflush{address} + +\stopsetups + +\setups[contacts:process] + +%D Handy: + +\def\XMLprocesscontacts + {\dosingleempty\XMLprocesscontacts} + +\def\XMLprocesscontacts[#1]% + {\bgroup + \doifelsenothing{#1} + {\XMLprocesscontacts[\getvariable{contacts}{file}]} + {\setups[contacts:collect]% + \processcommacommand[#1]\processXMLfile + \setups[contacts:process]% + \processcommacommand[#1]\processXMLfile}% + \egroup} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-corres.rng b/Master/texmf-dist/tex/context/modules/mkii/x-corres.rng new file mode 100644 index 00000000000..09de5d26718 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-corres.rng @@ -0,0 +1,170 @@ +<?xml version="1.0" ?> + +<?context-block begin grammar ?> + +<grammar xmlns="http://relaxng.org/ns/structure/1.0"> + + <?context-block end grammar ?> + + <?context-block begin contacts ?> + + <start> + <ref name="contacts"/> + </start> + + <define name="contacts"> + <element name="contacts"> + <zeroOrMore> + <choice> + <ref name="contacts.contact"/> + <ref name="contacts.contactgroup"/> + <ref name="contacts.contactfile"/> + </choice> + </zeroOrMore> + </element> + </define> + + <?context-block end contacts ?> + + <?context-block begin contact ?> + + <define name="contacts.contact"> + <element name="contact"> + <interleave> + <optional> <ref name="contact.initials"/> </optional> + <optional> <ref name="contact.formalname"/> </optional> + <optional> <ref name="contact.informalname"/> </optional> + <optional> <ref name="contact.title"/> </optional> + <optional> <ref name="contact.prefix"/> </optional> + <optional> <ref name="contact.suffix"/> </optional> + <optional> <ref name="contact.telephone"/> </optional> + <optional> <ref name="contact.mobiletelephone"/> </optional> + <optional> <ref name="contact.telefax"/> </optional> + <optional> <ref name="contact.email"/> </optional> + <optional> <ref name="contact.address"/> </optional> + <optional> <ref name="contact.information"/> </optional> + </interleave> + <attribute name="label"/> + </element> + </define> + + <?context-block end contact ?> + + <?context-block begin fields ?> + + <define name="contact.initials"> + <element name="initials"> + <text/> + </element> + </define> + + <define name="contact.formalname"> + <element name="formalname"> + <text/> + </element> + </define> + + <define name="contact.informalname"> + <element name="informalname"> + <text/> + </element> + </define> + + <define name="contact.title"> + <element name="title"> + <text/> + </element> + </define> + + <define name="contact.prefix"> + <element name="prefix"> + <text/> + </element> + </define> + + <define name="contact.suffix"> + <element name="suffix"> + <text/> + </element> + </define> + + <define name="contact.telephone"> + <element name="telephone"> + <text/> + </element> + </define> + + <define name="contact.mobiletelephone"> + <element name="mobiletelephone"> + <text/> + </element> + </define> + + <define name="contact.telefax"> + <element name="telefax"> + <text/> + </element> + </define> + + <define name="contact.email"> + <element name="email"> + <text/> + </element> + </define> + + <define name="contact.address"> + <element name="address"> + <zeroOrMore> + <ref name="contact.address.p"/> + </zeroOrMore> + </element> + </define> + + <define name="contact.information"> + <element name="information"> + <text/> + </element> + </define> + + <define name="contact.address.p"> + <element name="p"> + <text/> + </element> + </define> + + <?context-block end fields ?> + + <?context-block begin contactgroup ?> + + <define name="contacts.contactgroup"> + <element name="contactgroup"> + <zeroOrMore> + <ref name="contactgroup.member"/> + </zeroOrMore> + <attribute name="label"/> + </element> + </define> + + <define name="contactgroup.member"> + <element name="member"> + <text/> + </element> + </define> + + <?context-block end contactgroup ?> + + <?context-block begin contactfile ?> + + <define name="contacts.contactfile"> + <element name="contactfile"> + <text/> + </element> + </define> + + <?context-block end contactfile ?> + + <?context-block begin grammar ?> + +</grammar> + +<?context-block end grammar ?>
\ No newline at end of file diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-dir-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-dir-01.mkii new file mode 100644 index 00000000000..6e4192a1326 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-dir-01.mkii @@ -0,0 +1,145 @@ +%D \module +%D [ file=x-dir-01, +%D version=2003.05.10, % around that time -) +%D title=\CONTEXT\ Directory Handling, +%D subtitle=Overview (1), +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\setuppapersize + [S6][S6] + +\setuplayout + [width=middle, + height=middle, + backspace=12pt, + topspace=12pt, + bottomspace=32pt, + header=0pt, + footer=0pt, + bottomdistance=9pt, + bottom=18pt] + +\setupinteractionmenu + [bottom] + [state=start, + frame=off, + rightoffset=-3pt, + background=color, + backgroundcolor=TextColor, + middle=\hskip4pt, + left=\hfill] + +\startinteractionmenu[bottom] + \but [PreviousJump] Previous Jump \\ + \but [previouspage] Previous Page \\ + \but [nextpage] Next Page \\ +\stopinteractionmenu + +\setupbackgrounds + [page] + [backgroundoffset=3pt, + background=color, + backgroundcolor=PageColor] + +\setupbackgrounds + [text] + [background=color, + backgroundcolor=TextColor] + +\definecolor [PageColor] [r=.6,g=.7,b=.8] +\definecolor [TextColor] [r=.7,g=.8,b=.9] +\definecolor [DoneColor] [s=.5] + +\startmode[colorscheme-red] + + \definecolor [PageColor] [r=.9,g=.7,b=.6] + \definecolor [TextColor] [r=.9,g=.8,b=.7] + +\stopmode + +\startmode[colorscheme-green] + + \definecolor [PageColor] [r=.6,g=.8,b=.7] + \definecolor [TextColor] [r=.7,g=.9,b=.8] + +\stopmode + +\setupcolors + [state=start] + +\setupinteraction + [state=start, + menu=on, + color=, + display=new, + contrastcolor=DoneColor, + style=] + +\definehead + [directory] + [subject] + +\setuphead + [directory] + [style=\tfc] + +\setupbodyfont + [tt] + +\defineXMLenvironment [files] [url=] + {\doifelsenothing{\XMLop{url}} + {\xdef\XMLDIRurl{}} + {\xdef\XMLDIRurl{\XMLop{url}/}} + \startXMLignore} + {\stopXMLignore} + +\newcounter\NOfEntries + +\startsetups[xmldir:file] + + \doglobal\increment\NOfEntries + + \goto {\hbox to \hsize \bgroup + + \XMLflush{base} + \hss + \hbox to 2em{\XMLflush{type}\hss} + \quad + \quad + \hbox to 5em{\hss\XMLflush{size}} + \quad + \quad + \XMLflush{date} + + \egroup} [url(\XMLDIRurl\XMLop{name})]% [program(\XMLDIRurl\XMLop{name})] + +\stopsetups + +\defineXMLenvironment [directory] [name=] + {\directory{Path \XMLop{name}}} + {} + +\defineXMLenvironment [file] [name=] + {\bgroup} + {\setups[xmldir:file] + \endgraf + \egroup} + +\defineXMLsave[base] +\defineXMLsave[type] +\defineXMLsave[size] +\defineXMLsave[date] + +\starttext + + \processXMLfilegrouped{\inputfilename} + + \ifnum\NOfEntries=0 There are no files found that match the pattern. \fi + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-dir-02.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-dir-02.mkii new file mode 100644 index 00000000000..90c32d7042c --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-dir-02.mkii @@ -0,0 +1,130 @@ +%D \module +%D [ file=x-dir-02, +%D version=2003.05.10, % around that time -) +%D title=\CONTEXT\ Directory Handling, +%D subtitle=Overview (2), +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\setuplayout + [width=middle, + height=middle, + backspace=.5cm, + topspace=.5cm, + header=1cm, + footer=0cm] + +\definehead + [directory] + [subject] + +\setuphead + [directory] + [style=\tfa] + +\setupbodyfont + [tt] + +\setuptabulate + [before=,after=] + +\setupcombinations + [location=top] + +\defineXMLenvironment [files] [root=.,url=] + {\doifelsenothing{\XMLop{url}} + {\xdef\XMLDIRurl{}} + {\xdef\XMLDIRurl{\XMLop{url}/}} + \startXMLignore} + {\stopXMLignore} + +\newcounter\NOfEntries + +\startsetups[xmldir:file:normal] + + \doglobal\increment\NOfEntries + + \startfiguretext + [left,none] + [] + {} + {\hbox + {\externalfigure + [\XMLpar{files}{root}{.}/\XMLpar{directory}{name}{.}/\XMLop{name}] + [frame=on,width=6cm] + \quad + \framed[width=\figurewidth,height=\figureheight]{}}} + \strut \vskip-\lineheight + \starttabulate[|l|l|] + \NC base \NC \XMLflush{base} \NC \NR + \NC type \NC \XMLflush{type} \NC \NR + \NC width \NC \figurenaturalwidth \NC \NR + \NC height \NC \figurenaturalheight \NC \NR + \NC date \NC \XMLflush{date} \NC \NR + \NC size \NC \XMLflush{size} \NC \NR + \stoptabulate + \stopfiguretext + +\stopsetups + +\startsetups[xmldir:file:small] + + \doglobal\increment\NOfEntries + + \startlinecorrection + + \startcombination + {\externalfigure + [\XMLpar{files}{root}{.}/\XMLpar{directory}{name}{.}/\XMLop{name}] + [frame=on,width=3cm]} + {} + {\vbox{\starttabulate[|l|l|] + \NC base \NC \XMLflush{base} \NC \NR + \NC type \NC \XMLflush{type} \NC \NR + \NC date \NC \XMLflush{date} \NC \NR + \stoptabulate}} + {} + \stopcombination + + \stoplinecorrection + +\stopsetups + +\defineXMLenvironment [directory] [name=] + {\directory{Path \XMLop{name}}} + {} + +\defineXMLenvironment [file] [name=] + {\bgroup} + {% the next quick hack is really needed + \expanded{\defconvertedargument\noexpand\asciia{./\jobfilename}.pdf}% + \expanded{\defconvertedargument\noexpand\asciib{\XMLpar{directory}{name}{.}/\XMLop{name}}}% + % else we can not do an overview of the curent path + \doifnot\asciia\asciib + {\doifmodeelse{alternative-small} + {\setups[xmldir:file:small]} + {\setups[xmldir:file:normal]} + \endgraf} + \egroup} + +\defineXMLsave[base] +\defineXMLsave[type] +\defineXMLsave[size] +\defineXMLsave[date] + +\starttext + + \doifmode{alternative-small}{\startcolumns[balance=no]} + + \processXMLfilegrouped{\inputfilename} + + \doifmode{alternative-small}{\stopcolumns} + + \ifnum\NOfEntries=0 There are no files found that match the pattern. \fi + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-dir-05.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-dir-05.mkii new file mode 100644 index 00000000000..53e73c5eb86 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-dir-05.mkii @@ -0,0 +1,51 @@ +%D \module +%D [ file=x-dir-05, +%D version=2003.05.10, % around that time -) +%D title=\CONTEXT\ Directory Handling, +%D subtitle=Access, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\setvariables + [filestate] + [name=,base=,type=,size=,permissions=,date=] + +\def\savefilestate + {\dodoubleargument\dosavefilestate} + +\def\dosavefilestate[#1][#2]% + {\startnointerference + \setxvariables + [#1] + [name=#2,base=,type=,size=,permissions=,date=] + \executesystemcommand{texmfstart xmltools.rb --dir --pattern=\getvariable{#1}{name} --output=xmldir.tmp} + \defineXMLprocess [files] + \defineXMLprocess [directory] + \defineXMLenvironment [file] + {\defineXMLsave [base] + \defineXMLsave [type] + \defineXMLsave [size] + \defineXMLsave [permissions] + \defineXMLsave [date]} + {\setxvariables + [#1] + [name=\XMLop{name}, + base=\XMLflush{base}, + type=\XMLflush{type}, + size=\XMLflush{size}, + permissions=\XMLflush{permissions}, + date=\XMLflush{date}]} + \startXMLignore + \processXMLfile{xmldir.tmp} + \stopXMLignore + \stopnointerference} + +\def\getfilestate#1% old one + {\savefilestate[filestate][#1]} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fdf-00.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-fdf-00.mkii new file mode 100644 index 00000000000..fd4bea7e74c --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fdf-00.mkii @@ -0,0 +1,41 @@ +% <xfdf> +% <fields> +% <field name="one"> +% <value>first</value> +% </field> +% <field name="two"> +% <value>second</value> +% </field> +% </fields> +% </xfdf> +% +% previous method: +% +% object +% data +% fields +% field + +\defineXMLprocess[fdf:xfdf] +\defineXMLprocess[fdf:fields] +\defineXMLignore [fdf:f] +\defineXMLpush [fdf:value] + +\defineXMLenvironment [fdf:field] [name=,value=] + {\XMLerase{fdf:value}} + {\gsaveXMLdata{fdf:\XMLop{name}}{fdf:value}} + +\defineXMLsingular [fdf:field] [name=,value=] + {\gsaveXMLasdata{fdf:\XMLop{name}}{\XMLop{value}}} + +\def\doifelseFDFfield#1{\doifelseXMLelement{fdf:#1}} +\def\flushFDFfield #1{\flushXMLelement {fdf:#1}} +\def\processFDFfield #1{\processXMLelement {fdf:#1}} + +\def\loadFDFfile#1% + {\bgroup + \autoXMLnamespace[fdf]% + \processXMLfilegrouped{#1}% + \egroup} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fe.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-fe.mkii new file mode 100644 index 00000000000..dcf415850a3 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fe.mkii @@ -0,0 +1,143 @@ +%D \module +%D [ file=x-fe, +%D version=2004.03.12, % based on earlier experiments +%D title=\FOXET, +%D subtitle=Simple Extensions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Extensions: fe:definecolor + +% menus +% extra areas +% protruding and hz +% compound +% title container +% more float placements + +\unprotect + +% \XMLattributes{aural}, + +\defineXMLnested + [fe:table-next] + [id=, + \XMLattributes{accessibility}, + \XMLattributes{border-padding-background}, + \XMLattributes{relative-position}, + border-after-precedence=, + border-before-precedence=, + border-end-precedence=, + border-start-precedence=, + visibility=] + {\bTABLEnext} + {\eTABLEnext} + +% definitions + +\defineXMLcommand + [fe:definecolor] + [name=,r=,g=,b=,c=,m=,y=,k=,s=,p=,a=,t=] + {\expanded{\definecolor[\XMLop{name}] + [r=\XMLop r,g=\XMLop g,b=\XMLop b, + c=\XMLop c,m=\XMLop m,y=\XMLop y,k=\XMLop k, + s=\XMLop s,p=\XMLop p,a=\XMLop a,t=\XMLop t]}} + +\defineXMLcommand + [fe:definefontsynonym] + [name=,file=,encoding=] + {\doifelsenothing{\XMLop{encoding}} + {\expanded{\definefontsynonym[\XMLop{name}][\XMLop{file}][encoding=\XMLop{encoding}]}} + {\expanded{\definefontsynonym[\XMLop{name}][\XMLop{file}]}}} + +%D Extensions: fe:include + +\defineXMLsingular + [fe:include] + [url=,n=1] + {\doifelse{\XMLop{n}}{1} + {\readfile{\XMLpar{fe:include}{url}{}}{}{}} + {\dorecurse{\XMLop{n}}{\readfile{\XMLpar{fe:include}{url}{}}{}{}\endgraf}}} + +%D Extensions: fe:sample + +\defineXMLenvironment + [fe:sample] + [origin=unknown] + {\removeunwantedspaces\ignorespaces} + {\removeunwantedspaces} + +%D Extensions: fe: + +% \defineXMLenvironmentsave +% [fe:loop] +% [n=1] +% {} +% {\dorecurse{\XMLop{n}}{\XMLflush{fe:loop}}} + +\defineXMLargument + [fe:loop] + [n=1] + {\dorecurse{\XMLop{n}}} + +%D Extensions: fe:compound + +\defineXMLsingular + [fe:compound] + [character=-] + {\prewordbreak\XMLop{character}\prewordbreak} + +%D Extensions: fe:message + +\defineXMLargument + [fe:message] + [category=XML-FO] + {\expanded{\writestatus{\XMLop{category}}}} + +%D Handy + +\defineXMLargument + [fe:trace] + [attribute=,option=] + {\showXMLinh[\XMLop{attribute}]% + \XMLval{fe:trace}{\XMLop{option}}{}} + +\mapXMLvalue + {fe:trace} + {font} + {\hbox\bgroup\infofont[% + \xFOfont/\xFOfontsize/\xFOfontsizeadjust/\xFOfontfamily/\xFOfontweight/\xFOfontstyle/\xFOfontvariant:\FOfontdefinition + ]\egroup} + +%D Extensions: + +\startsetups fe:page:option:fit:start + \startTEXpage[margin=page] +\stopsetups + +\startsetups fe:page:option:fit:stop + \stopTEXpage +\stopsetups + +\useMPlibrary[pre] + +\mapXMLvalue {fe:tracing} {true} {\tracingFOtrue} +\mapXMLvalue {fe:tracing} {false} {\tracingFOfalse} +\mapXMLvalue {fe:testgrid} {true} {\setupbackgrounds[page][background=pagegrid]} + +\startsetups fe:setup + \XMLval{fe:tracing} {\XMLop{fe:tracing}} {} + \XMLval{fe:testgrid}{\XMLop{fe:testgrid}}{} +\stopsetups + +%D Private (testing) + +\defineXMLcommand[fe:synchronizeoutput]{\synchronizeoutput} + + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.dtd b/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.dtd new file mode 100644 index 00000000000..34b4d0bef9b --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.dtd @@ -0,0 +1,24 @@ +<!-- author : Taco Hoekwater / Hans Hagen + info : x-fig-00.tex / x-fig-01.tex + usage : <!DOCTYPE figurelibrary SYSTEM "x-fig-00.dtd"> + --> + +<!ELEMENT figurelibrary (description?,figure*)> + +<!ATTLIST figurelibrary language CDATA #IMPLIED> +<!ATTLIST dummy width CDATA #IMPLIED> +<!ATTLIST dummy height CDATA #IMPLIED> + +<!ELEMENT description (organization?,project?,product?,comment?)> +<!ELEMENT organization (#PCDATA)> +<!ELEMENT project (#PCDATA)> +<!ELEMENT product (#PCDATA)> + +<!ELEMENT figure (label,file?,dummy?,copyright?,comment?,status?)> +<!ELEMENT dummy (#PCDATA)> +<!ELEMENT file (#PCDATA)> +<!ELEMENT label (#PCDATA)> +<!ELEMENT copyright (#PCDATA)> +<!ELEMENT status (#PCDATA)> + +<!ELEMENT comment (#PCDATA)> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.mkii new file mode 100644 index 00000000000..2e000c64ca7 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.mkii @@ -0,0 +1,252 @@ +%D \module +%D [ file=x-fig-00, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Base Loading, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% \readfile{x-res-04} \donothing \donothing \endinput + +% naast label, ook fig als ref en dan naar fig ref springen + +%D This module implements an interface to a figure database +%D and file. The database is formatted in \XML\ conforming +%D the following \DTD: +%D +%D \typefile{x-fig-00.dtd} +%D +%D A figure base coded this way looks like: +%D +%D \starttyping +%D <!-- texexec --pdf --use=fig-01 figtest.xml --> +%D +%D <figurelibrary language="nl"> +%D +%D <description> +%D <organization>PRAGMA Advanced Document Engineering</organization> +%D <project>Manuals</project> +%D <product>Beginners Manual</product> +%D <comment>A bunch of figures.</comment> +%D </description> +%D +%D <figure> +%D <file>koe.pdf</file> +%D <label>a dutch cow</label> +%D <copyright>Corel Draw Suite</copyright> +%D <comment>I bet that you've seen this cow before.</comment> +%D </figure> +%D +%D <figure> +%D <dummy width="4cm" height="3cm">non existent</dummy> +%D <label>a european cow</label> +%D <copyright>Nobody</copyright> +%D <comment>When will we talk about European cows?</comment> +%D </figure> +%D +%D </figurelibrary> +%D \stoptyping +%D +%D You can convert this base into a \PDF\ file using +%D \TEXEXEC\ and another module in this suite. +%D +%D \starttyping +%D texexec --pdf --use=fig-make yourfile.xml +%D \stoptyping +%D +%D You can now select a graphic from this file using the +%D +%D \starttyping +%D \externalfigure[a dutch cow][width=4cm] +%D \stoptyping +%D +%D This module overloads this command so that a figure is +%D it first searched in the list of databases. +%D +%D \starttyping +%D \usemodule [fig-base] +%D \usefigurebases[yourfile] +%D \stoptyping +%D +%D The special keyword \type {reset} can be used to reset +%D this list. + +%D We park some mkiv code here. Eventually we will hook this into mkiv +%D searching differently (just a standard feature, no need for loading +%D modules because we need less code). Actually, what we do here is more +%D like res-*: we load the xml file once. + +% \startluacode +% +% document.figurebases = { } +% document.figurebases.data = { } +% document.figurebases.found = { } +% +% function document.figurebases.find(basename,askedlabel) +% document.figurebases.found = { } +% local base = document.figurebases.data[basename] +% local page = 0 +% if not base then +% base = xml.load(basename) +% document.figurebases.data[basename] = base +% end +% for e, d, k in xml.elements(base,"figurelibrary/figure/label") do +% page = page + 1 +% if xml.content(d[k]) == askedlabel then +% document.figurebases.found = { +% name = xml.filters.text(e,"file"), +% page = page, +% } +% return true +% end +% end +% return false +% end +% +% function commands.findfigurefilenameinbase(basename,askedlabel) +% if document.figurebases.find(basename,askedlabel) then +% commands.xdef("figurefilename",document.figurebases.found.name or "") +% commands.xdef("figurefilepage",document.figurebases.found.page or "") +% end +% end +% +% \stopluacode +% +% \def\findfigurefilenameinbase#1#2% +% {\ctxlua{commands.findfigurefilenameinbase("#1","\askedlabel")}} + +\startcommands dutch english + german czech + italian romanian + + usefigurebase: gebruikfiguurbestand usefigurebase + usefigurebase usefigurebase + usefigurebase usefigurebase + +\stopcommands + +\unprotect + +\consultutilityfilefalse + +\startXMLmapping [-] [figbase] + +\defineXMLprocess [figurelibrary] +\defineXMLignore [description] +\defineXMLignore [copyright] +\defineXMLignore [comment] +\defineXMLignore [status] +\defineXMLpush [file] +\defineXMLpush [label] +\defineXMLpush [dummy] +\defineXMLenvironment [figure] \figbase@StartFigure \figbase@StopFigure + +\stopXMLmapping + +\newcounter\figurefilepage + +\def\figbase@StartFigure + {\bgroup} + +\def\figbase@StopFigure + {\doglobal\increment\figurefilepage + \doif\askedlabel{\XMLpop{label}} + {\doglobal\settrue\figurefiledone + \xdef\figurefilename{\XMLpop{file}}\endinput}% + \egroup} + +\def\findfigurefilenameinbase#1#2% sets \figurefilename and \figurefilepage + {\processXMLfilegrouped{#1}} + +\def\getfigurefilename#1#2% + {\startnointerference + \traceXMLelementsfalse + \startXMLmapping[-][figbase] + \resetfigurefilebase + \XMLerase{file} + \XMLerase{dummy} + \XMLerase{label} + \xdef\figurefilebase{#1}% + \doglobal\newcounter\figurefilepage + \def\askedlabel{#2} + \processcommacommand[\figurepathlist]\dogetfigurefilename + \stopXMLmapping + \stopnointerference} + +\globalletempty\figurebasepath + +\def\dogetfigurefilename#1% + {\ifx\figurefilename\empty + \bgroup + \xdef\figurefilebasepath{#1}% + \assignfullfilename{#1}{\figurefilebase}\to\filename + \doiffileelse{\filename.xml} + {\doshowfigurestate{base file : \filename}% + \expanded{\findfigurefilenameinbase{\filename.xml}{\askedlabel}}} + \donothing + \ifx\figurefilename\empty\else +% \globallet\figurefilebase\figurefilebase + \globallet\figurefilebase\filename % hm, bad omen that this is needed + \fi + \egroup + \fi} + +\def\resetfigurefilebase + {\globalletempty\figurefilebase + \globalletempty\figurefilename + \globalletempty\figurefilebasepath + \globalletempty\figurefilepage} + +\def\doanalyzefiguredimensionsfromfile + {\ifcase\figurestatus \ifx\figurebaselist\empty \else + \resetfigurefilebase + \doshowfigurestate{base list : \figurebaselist}% + \processcommacommand[\figurebaselist]\dodoanalyzefiguredimensionsfromfile + \ifx\figurefilename\empty + \doshowfigurestate{base warning : no matching name found}% + \else + \doiffileelse{\figurefilebase.pdf} + {\doshowfigurestate{base file : \figurefilebase.pdf}% + \doshowfigurestate{base page : \figurefilepage}% + \let\figurepathlist\figurefilebasepath + \analyzefigurefilename{\figurefilebase.pdf}\wantedfigurelabel + \let\wantedfigurepage\figurefilepage} + {\doshowfigurestate{base missing : \figurefilebase.pdf}} + \fi + \ifcase\figurestatus + \analyzefigurefilename\expandedfigurename\wantedfigurelabel + \fi + \fi \fi} + +\def\dodoanalyzefiguredimensionsfromfile#1% + {\doshowfigurestate{base check : \wantedfigurename\space in #1}% + \getfigurefilename{#1}\wantedfigurename + \ifx\figurefilename\empty\else + \quitcommalist + \fi} + +\def\usefigurebase[#1]% + {\doifelse{#1}\v!reset + {\let\figurebaselist\empty} + {\addtocommalist{#1}\figurebaselist}} + +\let\figurebaselist\empty + +\resetfigurefilebase + +\protect \endinput + +\usefigurebase[figtest] + +\externalfigure[koetje] [width=3cm] +\externalfigure[de molen op de dijk][width=3cm] +\externalfigure[de molen op de dijk][width=2cm] +\externalfigure[weet ik veel] [width=3cm] +\externalfigure[weet ik veel] [width=2cm] +\externalfigure[weet ik wat] [width=2cm] +\externalfigure[koe] [width=2cm] diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.xsd b/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.xsd new file mode 100644 index 00000000000..615841a1e6c --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fig-00.xsd @@ -0,0 +1,77 @@ +<?xml version="1.0"?> + +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + +<xsd:annotation> + <xsd:documentation xml:lang="en"> + <p>This schema described the figure database. This base + can be used to collect graphics that later can be used + in applications like ConTeXt.</p> + <p>author: Tobias Burnus & Hans Hagen, copyright: + PRAGMA-ADE / Hasselt NL</p> + </xsd:documentation> +</xsd:annotation> + +<xsd:element name="figurelibrary" type="figureLibraryType" /> + +<xsd:element name="comment" type="nonZeroString" /> + +<xsd:complexType name="figureLibraryType"> + <xsd:sequence> + <xsd:element name="description" type="descriptionType" /> + <xsd:element name="figure" type="figureType" + minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attribute name="language" type="xsd:language" /> +</xsd:complexType> + +<xsd:complexType name="descriptionType"> + <xsd:sequence> + <xsd:element name="organization" type="nonZeroString" /> + <xsd:element name="project" type="nonZeroString" /> + <xsd:element name="product" type="nonZeroString" /> + <xsd:element ref="comment" minOccurs="0" /> + </xsd:sequence> +</xsd:complexType> + +<xsd:complexType name="figureType"> + <xsd:sequence> + <xsd:choice> + <xsd:element name="file" type="NZNormalizedString" /> + <xsd:element name="dummy" type="dummyType" /> + </xsd:choice> + <xsd:element name="label" type="NZNormalizedString" /> + <xsd:element name="copyright" type="nonZeroString" /> + <xsd:element ref="comment" minOccurs="0" /> + </xsd:sequence> +</xsd:complexType> + +<xsd:complexType name="dummyType"> + <xsd:simpleContent> + <xsd:extension base="nonZeroString"> + <xsd:attribute name="width" type="TeXUnit" use="required" /> + <xsd:attribute name="height" type="TeXUnit" use="required" /> + </xsd:extension> + </xsd:simpleContent> +</xsd:complexType> + +<xsd:simpleType name="nonZeroString"> + <xsd:restriction base="xsd:string"> + <xsd:minLength value="1" /> + </xsd:restriction> +</xsd:simpleType> + +<xsd:simpleType name="NZNormalizedString"> + <xsd:restriction base="xsd:normalizedString"> + <xsd:minLength value="1" /> + </xsd:restriction> +</xsd:simpleType> + +<xsd:simpleType name="TeXUnit"> + <xsd:restriction base="xsd:string"> + <xsd:pattern + value='[0-9]*(,|\.|[0-9])?[0-9]*(cm|mm|in|pt|pc|em|ex|bp|dd|cc|sp)' /> + </xsd:restriction> +</xsd:simpleType> + +</xsd:schema> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fig-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-fig-01.mkii new file mode 100644 index 00000000000..5a2ea20c83e --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fig-01.mkii @@ -0,0 +1,461 @@ +%D \module +%D [ file=x-fig-01, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Base Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% \readfile {x-res-01} \donothing \donothing \endinput + +%D See \type {x-fig-00.tex} for more information on how to use +%D and generate figure databases. This file loads the file +%D named \type {\jobfilename} (\TEXEXEC\ will set this +%D variable). You can apply this style to a database by +%D saying: +%D +%D \starttyping +%D texexec --pdf --use=fig-make yourfile.xml +%D \stoptyping +%D +%D The following modes are supported: +%D +%D \starttabulate[|lT|l|] +%D \NC letter \NC map the preview on letter size \NC \NR +%D \NC compact \NC use an alternative presentation \NC \NR +%D \stoptabulate +%D +%D The resulting file has the following characteristics: +%D +%D \startitemize[packed] +%D \item the document is split into three sections: first each +%D figure is shown at its own page, then an overview of +%D figures is shown with some data alongside, and +%D finally an index and table of contents shows up +%D \item there is no title page, which means that one can +%D access a figure by page number without offset +%D \item the document is opened at the first overview page, +%D that is, when the viewer supports it +%D \item the graphic is shown 3~times: on a page of its own, +%D scaled to a fixed dimension, and relative to a4 or +%D letter paper size +%D \item the labels can be accessed in an index and list at +%D the end of the document +%D \stopitemize +%D +%D We use named destinations, which means that one can +%D access a figure by name from an external application. + +\usemodule[fig-00] + +\setupoutput[pdftex] \overcomePDFspacefalse + +\doifnothing {\jobfilename} {\end} +\doiffileelse {\jobfilename.xml} {} {\end} + +\definesymbol [attachment] [{\bf\color[darkred]{\jobname.xml}}] +\setupattachments [symbol=attachment] +\useattachment [datafile] [\jobname.xml] + +\def\StartDescription + {\bgroup + \defineXMLpush[organization] + \defineXMLpush[project] + \defineXMLpush[product] + \defineXMLpush[comment]} + +\def\StopDescription + {\subject {Figure collection} + \starttabulate[|lBe|p|] + \doifXMLdataelse{organization} + {\NC organization \NC \XMLpop{organization} \NC \NR}{} + \doifXMLdataelse{project} + {\NC project \NC \XMLpop{project} \NC \NR}{} + \doifXMLdataelse{product} + {\NC product \NC \XMLpop{product} \NC \NR}{} + \doifXMLdataelse{comment} + {\NC comment \NC \XMLpop{comment} \NC \NR}{} + \NC specification \NC \attachment[datafile] \NC \NR + \stoptabulate + \blank[2*big] + \egroup} + +\def\StartFigureA + {\bgroup + \defineXMLpush[file] + \XMLassign{file}{buffer} + \defineXMLpush[dummy] + \defineXMLpush[label] + \defineXMLpush[copyright] + \defineXMLpush[comment] + \defineXMLpush[status]} + +\defineoverlay[page][\overlaybutton{Description}] + +\startbuffer + \framed + [width=\XMLpar{dummy}{width}{12cm}, + height=\XMLpar{dummy}{height}{8cm}, + background=color, + backgroundcolor=gray, + foregroundcolor=darkred, + frame=off] + {\bf \XMLpop{dummy}} +\stopbuffer + +\def\StopFigureA + {\doglobal\increment\CurrentPage + \setupbackgrounds[page][background=page] + \doifelsenothing{\XMLpop{label}} + {\expanded{\definereference[Description][about: \XMLpop{file}]}% + \pagereference[\XMLpop{file}]} + {\expanded{\definereference[Description][about: \XMLpop{label}]}% + \pagereference[\XMLpop{label}]} + \pagefigure[\XMLpop{file}] + \setupbackgrounds[page][background=] + \egroup} + +\def\StartFigureB + {\StartFigureA} + +\defineregister + [figureindex] + [figureindices] + +\setupregister + [figureindex] + [ownnumber=yes, + criterium=text, + interaction=text, + indicator=no] + +\definelist + [figurelist] + +\setuplist + [figurelist] + [criterium=text, + pagenumber=no, + width=2em, + interaction=all] + +\setupcolors + [state=start] + +\setuptolerance + [verytolerant] + +% Ugly: + +\startnotmode[previewpage-letter,previewpage-S6] + \enablemode[previewpage-A4] +\stopnotmode + +\startmode[letter] % downward compatible + \enablemode[previewpage-letter] +\stopmode + +%startbuffer[paper] +\startsetups[paper] +\startmode[previewpage-A4] + \framed + [width=210mm,height=297mm,offset=overlay,frame=off, + background=color,backgroundcolor=white] + {\externalfigure[\XMLpop{file}][reset=yes]} +\stopmode +\startmode[previewpage-letter] + \framed + [width=8.5in,height=11in,offset=overlay,frame=off, + background=color,backgroundcolor=white] + {\externalfigure[\XMLpop{file}][reset=yes]} +\stopmode +\startmode[previewpage-S6] + \framed + [width=600pt,height=450pt,offset=overlay,frame=off, + background=color,backgroundcolor=white] + {\externalfigure[\XMLpop{file}][reset=yes]} +\stopmode +\stopsetups +%stopbuffer + +\setupbuttons + [offset=10pt, + width=broad, + strut=no, + rulethickness=1pt, + framecolor=darkred] + +\def\StopFigureB + {\par + \doglobal\increment\CurrentPage + \doifelsenothing{\XMLpop{label}} + {\expanded{\definereference[Figure][\XMLpop{file}]}% + \expanded{\definereference[GridPg][grid:\XMLpop{file}]}} + {\expanded{\definereference[Figure][\XMLpop{label}]}% + \expanded{\definereference[GridPg][grid:\XMLpop{label}]}}% + \button % content in setup + {\hbox to \hsize + {\forgetall \dontcomplain + \doifelsenothing{\XMLpop{label}} + {\pagereference[about: \XMLpop{file}]} + {\pagereference[about: \XMLpop{label}]}% + % moved here, because descriptions may be absent + \ifnum\CurrentPage=1 \pagereference[begin]\fi + % + \expanded{\writetolist[figurelist]{\CurrentPage}{\XMLpop{label}}}% + \expanded{\figureindex{\CurrentPage}{\XMLpop{label}}}% + \startnotmode[compact]% + \vbox to 100pt + {\hsize30pt + \vskip5pt + \hbox to \hsize{\hss\strut\bf\CurrentPage\hss}% + \vfill}% + \advance\hsize by -30pt + \stopnotmode + \startmode[compact]% + \advance\hsize by -10pt + \hskip10pt + \stopmode + \button % \framed + [width=150pt,height=100pt,offset=10pt,frame=off, + background=color,backgroundcolor=white,color=] + {\externalfigure + [\XMLpop{file}] + [maxheight=80pt,frame=off,maxwidth=130pt,factor=max]}% + [GridPg]% + \let\FigWid\figurenaturalwidth + \let\FigHei\figurenaturalheight + \advance\hsize by -150pt + \hskip10pt + \advance\hsize by -10pt + \vbox to 100pt + {\hsize40pt + %\externalfigure + % [paper] + % [type=buffer,frame=on, + % framecolor=darkred,rulethickness=.5pt, + % width=40pt,object=no] + \framed + [offset=overlay, + framecolor=darkred, + rulethickness=.5pt] + {\scale[width=40pt]{\setups[paper]}}% {\disableXML\getbuffer[paper]}}% + \startmode[compact]% + \vfill + \hbox to \hsize{\hss\strut\bf\CurrentPage\hss}% + \stopmode + \vfill}% + \advance\hsize by -40pt + \hskip10pt + \advance\hsize by -10pt + \vbox to 100pt + {\blank[disable] + \starttabulate[|Bel|p|] + \NC file \NC \XMLpop{file} \NC \NR + \doifXMLdata{label} + {\NC label \NC \XMLpop{label} \NC \NR} + \NC w$\times$h \NC \FigWid$\times$\FigHei \NC \NR + \doifXMLdata{copyright} + {\NC copyright \NC \XMLpop{copyright} \NC \NR} + \doifXMLdata{status} + {\doifelse{\XMLpop{status}}{obsolete} + {\NC status \NC \bf\darkred\XMLpop{status} \NC \NR} + {\NC status \NC \XMLpop{status} \NC \NR}} + \doifXMLdata{comment} + {\NC comment \NC \XMLpop{comment} \NC \NR} + \stoptabulate + \vfill}}}% + [Figure] + \vskip10pt + \egroup} + +\def\StartFigureC + {\StartFigureA} + +\def\StopFigureC + {\doglobal\increment\NumberOfFigures + \egroup} + +\setuplayout + [topspace=15pt,backspace=15pt, + header=0pt,footer=0pt,bottom=20pt,bottomdistance=10pt, + width=middle,height=fit] + +\setupbackgrounds + [page] + [background=, + backgroundcolor=gray] + +\setupinteractionscreen + [width=max, + height=max] + +\setupcolors + [state=start] + +\setupinteraction + [style=, + color=, + contrastcolor=, + state=start] + +\setuphead + [section] + [style=bfb] + +\setupbodyfont + [pos] + +\setupinteractionmenu + [bottom] + [left=\hfill, + middle=\hskip10pt, + frame=off, + style=bold, + background=color, + backgroundcolor=darkred, + foregroundcolor=white] + +\startinteractionmenu[bottom] + \but [begin] begin \\ + \but [index] index \\ + \but [list] list \\ + \but [CloseDocument] close \\ + \but [PreviousJump] go back \\ +\stopinteractionmenu + +\setupinteraction + [openaction=begin] + +\defineXMLenvironment [figurelibrary] \StartLibrary \StopLibrary + +\starttext + +\def\StartLibrary{\mainlanguage[\XMLpar{figurelibrary}{language}{en}]} +\def\StopLibrary {} + +\defineXMLignore [description] +\defineXMLenvironment [figure] \StartFigureC \StopFigureC + +\doglobal\newcounter\CurrentPage + +\processXMLfilegrouped{\jobfilename.xml} + +\increment\NumberOfFigures + +\defineXMLignore [description] +\defineXMLenvironment [figure] \StartFigureA \StopFigureA + +\doglobal\newcounter\CurrentPage + +\processXMLfilegrouped{\jobfilename.xml} + +\setuppapersize + [S6][S6] + +\setupbackgrounds + [page] + [background=color] + +\setupinteraction + [menu=on] + +\defineXMLenvironment [description] \StartDescription \StopDescription +\defineXMLenvironment [figure] \StartFigureB \StopFigureB + +\doglobal\newcounter\CurrentPage + +\processXMLfilegrouped{\jobfilename.xml} \page + +\subject [list] {List of figures} + +\placelist[figurelist] \page + +\subject [index] {Index of figures} + +\startcolumns +\placeregister[figureindex] +\stopcolumns + +\doifmodeelse{clipgrid-distance,clipgrid-steps}{\page}{\stoptext} + +\startuniqueMPgraphic{clipgrid}{dx,dy,nx,ny,type} + numeric gdx, gdy, lbx, lby ; + if \MPvar{type}=1 : + gdx := \MPvar{dy} ; + gdy := \MPvar{dx} ; + else : + gdx := OverlayWidth /\MPvar{nx} ; + gdy := OverlayHeight/\MPvar{ny} ; + fi ; + lbx := gdx ; + lby := gdy ; + defaultfont := "\truefontname{Mono}" ; + defaultscale := .5 ; + numeric pen ; pen := .25pt ; + def MyGrid text t = + draw vlingrid (0,OverlayWidth ,gdy,OverlayWidth ,OverlayHeight) t ; + draw hlingrid (0,OverlayHeight,gdx,OverlayHeight,OverlayWidth ) t ; + enddef ; + pickup pencircle scaled pen ; + MyGrid withcolor white ; + MyGrid dashed evenly scaled pen ; + draw OverlayBox withcolor white ; + draw OverlayBox dashed evenly scaled pen ; + draw vlinlabel.bot(0,eps+OverlayWidth /lby,2,OverlayWidth ) ; + draw hlinlabel.lft(0,eps+OverlayHeight/lbx,2,OverlayHeight) ; + setbounds currentpicture to OverlayBox enlarged (2*EmWidth) ; +\stopuniqueMPgraphic + +\presetMPvariable[clipgrid][dx=10pt] +\presetMPvariable[clipgrid][dy=10pt] +\presetMPvariable[clipgrid][nx=10] +\presetMPvariable[clipgrid][ny=10] + +\startmode[clipgrid-distance] + \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=1}] +\stopmode + +\startmode[clipgrid-steps] + \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=2}] +\stopmode + +\setupexternalfigures + [background={color,foreground,grid}, + backgroundcolor=white] + +\def\StartFigureD + {\StartFigureA} + +\def\StopFigureD + {\doglobal\increment\CurrentPage + \setupbackgrounds[page][background=page] + \startpagefigure[\XMLpop{file}][offset=20pt]% + \doifelsenothing{\XMLpop{label}} + {\expanded{\definereference[Description][about: \XMLpop{file}]}% + \pagereference[grid:\XMLpop{file}]} + {\expanded{\definereference[Description][about: \XMLpop{label}]}% + \pagereference[grid:\XMLpop{label}]} + \stoppagefigure + %\pagefigure[\XMLpop{file}][offset=20pt] + \setupbackgrounds[page][background=] + \egroup} + +\defineXMLignore + [description] + +\defineXMLenvironment + [figure] + \StartFigureD + \StopFigureD + +\doglobal\newcounter\CurrentPage + +\processXMLfilegrouped{\jobfilename.xml} \page + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fig-02.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-fig-02.mkii new file mode 100644 index 00000000000..a8232fba9e1 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fig-02.mkii @@ -0,0 +1,78 @@ +%D \module +%D [ file=x-fig-02, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Base Inclusion (I), +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% \readfile {x-res-02} \donothing \donothing \endinput + +%D This module enables non||\ConTeXt\ users to access the +%D database. For this, you need to run +%D +%D \starttyping +%D texexec --pdf --use=fig-fake yourfile.xml +%D \stoptyping +%D +%D The resulting file, \type {yourfile.fig}, can be loaded +%D in the normal way. The figures can be accessed with: +%D +%D \starttyping +%D \getfigurefile{label} +%D \getfigurepage{label} +%D \stoptyping +%D +%D A a bonus, the following macro is defined: +%D +%D \starttyping +%D \includefigurefile width 10cm {label} +%D \stoptyping + +\usemodule[fig-00] + +\doifnothing {\jobfilename} {\end} +\doiffileelse {\jobfilename.xml} {} {\end} + +\defineXMLenvironment [figurelibrary] \StartLibrary \StopLibrary +\defineXMLignore [description] +\defineXMLenvironment [figure] \StartFigure \StopFigure + +\def\StartLibrary + {\immediate\openout \scratchwrite=\jobfilename.fig + \immediate\write\scratchwrite{\string\input\space x-fig-03.tex \string\relax} + \immediate\write\scratchwrite{}} + +\def\StopLibrary + {\immediate\write\scratchwrite{} + \immediate\write\scratchwrite{\string\endinput} + \immediate\closeout\scratchwrite} + +\def\StartFigure + {\defineXMLpush[file] + \defineXMLpush[dummy] + \defineXMLpush[label] + \defineXMLpush[copyright] + \defineXMLpush[comment] + \defineXMLpush[status]} + +\def\StopFigure + {\doglobal\increment\CurrentPage + \immediate\write\scratchwrite + {\string\setfiguredata\space + {\XMLpop{label}} + {\jobfilename} + {\CurrentPage}}} + +\doglobal\newcounter\CurrentPage + +\starttext + +\processXMLfilegrouped{\jobfilename.xml} + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fig-03.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-fig-03.mkii new file mode 100644 index 00000000000..c7f03453e09 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fig-03.mkii @@ -0,0 +1,44 @@ +%D \module +%D [ file=x-fig-03, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Base Inclusion (II), +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\ifx \undefined \convertMPtoPDF \input supp-pdf.mkii \fi +\ifx \undefined \includefigurefile \else \expandafter \endinput \fi + +\gdef\getfigurefile#1% + {\expandafter\ifx\csname x-fig-f-#1\endcsname\relax + \currentfigurefile + \else + \csname x-fig-f-#1\endcsname + \fi} + +\gdef\getfigurepage#1% + {\expandafter\ifx\csname x-fig-p-#1\endcsname\relax + 1% + \else + \csname x-fig-p-#1\endcsname + \fi} + +\gdef\setfiguredata#1#2#3% + {\gdef\currentfigurefile{#2}% + \expandafter\gdef\csname x-fig-f-#1\endcsname{#2}% + \expandafter\gdef\csname x-fig-p-#1\endcsname{#3}} + +\def\includefigurefile#1#% + {\doincludefigurefile{#1}} + +\def\doincludefigurefile#1#2% + {\edef\next{\noexpand\pdfimage + #1 page \getfigurepage{#2} {\getfigurefile{#2}.pdf}}% + \next} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-fo.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-fo.mkii new file mode 100644 index 00000000000..2c1ac0d96f0 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-fo.mkii @@ -0,0 +1,4057 @@ +%D \module +%D [ file=x-fo, +%D version=2004.03.12, % based on earlier experiments +%D title=\FOXET, +%D subtitle=Formatting Objects, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% \showframe + +% This is a first implementation, maybe I will write another one with mixed +% element indifferent vars and something 'when set, act upon it, and forget', +% for instance: in each element check if font set, if so, change font and +% reset font attributes. I'm not sure if this is wise. + +% todo: global assignment in order to limit restore +% todo: combine mp graphics (see end) saves 30% +% todo: using contants and variables (for internal use) + +% todo: language at more levels + +% beware: aftergroup vs egroup/endgroup + +\useXMLfilter[prs,run] + +\unprotect + +% syst-new.tex + +\long\def\unstringed#1% " ' space + {\csname\ifcsname @u@s@#1\endcsname @u@s@#1\else\s!empty\fi\endcsname#1} + +\long\setvalue{@u@s@"}#1#2"{#2} +\long\setvalue{@u@s@'}#1#2'{#2} +\long\setvalue{@u@s@ }#1#2 {#2} + +% xtag-ini + +\def\letXMLpar #1#2{\@EA \let\csname\@@XMLvariable:#1:#2\endcsname} +\def\setXMLpar #1#2{\@EA \def\csname\@@XMLvariable:#1:#2\endcsname} +\def\setXMLepar#1#2{\@EA\edef\csname\@@XMLvariable:#1:#2\endcsname} + +\protect + +%D Most time went into figuring out the specifications, especially +%D because there are no examples included. Samples that circulate on the +%D web are often border cases and torture test and don't have much to do +%D with real live. Another complication lays in the inheritance model: +%D some of the attributes are inherited. This also leaves some room for +%D interpretation, for instance do values that are used at a certain +%D point migrate downwards or not. +%D +%D The \CONTEXT\ \XML handler can deal with attributes in several ways +%D and for this purpose I have played with a few experimental mechanisms +%D just to end up with the existing begin/end mechanism combined with +%D a recursive attribute resolver which means that one has to implicitly +%D ask for an inherited attributes. This approach is probably one of the +%D most efficient ways of dealing with formatting objects in \CONTEXT, +%D unless of course I start adding rather specific support to the kernel. +%D +%D This module is rather experimental. More information about its usage +%D can be found in the \FOXET\ manual. + +%D Since we're not dealing with the fine points of typesetting here, we +%D can safely ignore \TEX's warnings about overful or underful boxes. + +\dontcomplain + +%D We will use fonts that have the characters in the normal (ascii) +%D slots. We will also use the stupid verbatim handler. + +\chardef\XMLtokensreduction = 2 +\chardef\XMLcdatamethod = 2 + +%D For the purpose of testing. + +\startmode[fo-verbose] + \def\writeFOstatus{\writestatus{XML-FO}} +\stopmode + +\startnotmode[fo-verbose] + \let\writeFOstatus\gobbleoneargument +\stopnotmode + +%D For the moment we stick to utf-8. + +\useXMLfilter[utf] + +%D This will be sorted out later (esp in relation to mathml). + +\setupbodyfont[pos,10pt] + +%D There are a couple of predefined colors. Don't ask me why, but +%D formatting objects are not a fresh start but a mix of existing +%D technologies. Color support is poluted by cascading stylesheets. +%D +%D Because hexadecimal color specifications are not enabled by +%D default, this feature has to be enables by loading the appropriate +%D color module. Here we define colors in \RGB\ values because we +%D don't want to loose accuracy. + +\setupcolors[state=start] \setupcolor[hex] + +\definecolor [black] [s=0] % [h=000000] +\definecolor [gray] [s=.5] % [h=808080] +\definecolor [silver] [s=.75] % [h=C0C0C0] +\definecolor [white] [s=1] % [h=FFFFFF] +\definecolor [maroon] [r=.5] % [h=800000] +\definecolor [red] [r=1] % [h=FF0000] +\definecolor [purple] [r=.5,b=.5] % [h=800080] +\definecolor [fuchsia] [r=1,b=1] % [h=FF00FF] +\definecolor [green] [g=.5] % [h=008000] +\definecolor [lime] [g=1] % [h=00FF00] +\definecolor [olive] [r=.5,g=.5] % [h=808000] +\definecolor [yellow] [r=1,g=1] % [h=FFFF00] +\definecolor [navy] [r=1,g=1] % [h=000080] +\definecolor [blue] [b=1] % [h=0000FF] +\definecolor [teal] [g=.5,b=.5] % [h=008080] +\definecolor [aqua] [g=1,b=1] % [h=00FFFF] + +%D The layout is rather basic. Of the 25 available areas we +%D only use the text area. Maybe some day I will plug in a +%D more dedicated page builder. + +\setuplayout + [backspace=0pt, + topspace=0pt, + header=0pt, + footer=0pt, + width=middle, + height=middle, + % marking=on, + location=middle] + +\setuppagenumbering + [alternative={doublesided,singlesided}, % sic + location=] + +\setuptolerance + [verytolerant,stretch] + +%D We will position the regions using layers. + +\definelayer[regions][width=\paperwidth,height=\paperheight] + +\definelayer[xsl-region-before] +\definelayer[xsl-region-after] +\definelayer[xsl-region-start] +\definelayer[xsl-region-end] +\definelayer[xsl-region-body] + +\setupbackgrounds[page][background=regions] + +%D We now enter the part of this module where the action takes +%D place. As usual we provide some tracing options. + +\newif\iftracingFO \readsysfile{page-run}\donothing\donothing + +%D We will organize the attribute definitions in a similar fashion as in +%D the specification. Unfortunately there are more sets defined in there +%D than are actually used, so the definitions later on will look a bit +%D messy. +%D +%D Quite some attributes can be inherited, which means that they can +%D end up in all elements and influence those way down the tree. + +\defineXMLattributeset + [fo:inherited] + +%D The properties: + +% \defineXMLattributeset +% [fe:tracing] +% [tracing=] + +\defineXMLattributeset + [fo:accessibility] + [source-document=none, + role=none] + +\defineXMLattributeset + [fo:absolute-position] + [absolute-position=auto, + top=auto, + right=auto, + bottom=auto, + left=auto] + +% \defineXMLattributeset +% [fo:aural] +% [azitmuth=, +% cue-after=, +% cue-before=, +% elevation=, +% pause-after=, +% pause-before=, +% pitch=, +% pitch-range=, +% play-during=, +% richness=, +% speak=, +% speak-header=, +% speak-numeral=, +% speak-punctuation=, +% speech-rate=, +% stress=, +% voice-family=, +% volume=] + +\defineXMLattributeset + [fo:border-padding-background] + [background-attachment=scroll, + background-color=transparent, + background-image=none, + background-repeat=repeat, + background-position-horizontal=left, + background-position-vertical=top, + border-color=transparent, + border-style=none, + border-width=medium, + background-position=, + border-top=, + border-bottom=, + border-left=, + border-right=, + border-before-color=\XMLop{border-color}, + border-before-style=\XMLop{border-style}, + border-before-width=\XMLop{border-width}, + border-after-color=\XMLop{border-color}, + border-after-style=\XMLop{border-style}, + border-after-width=\XMLop{border-width}, + border-start-color=\XMLop{border-color}, + border-start-style=\XMLop{border-style}, + border-start-width=\XMLop{border-width}, + border-end-color=\XMLop{border-color}, + border-end-style=\XMLop{border-style}, + border-end-width=\XMLop{border-width}, + border-top-color=\XMLop{border-before-color}, + border-top-style=\XMLop{border-before-style}, + border-top-width=\XMLop{border-before-width}, + border-bottom-color=\XMLop{border-after-color}, + border-bottom-style=\XMLop{border-after-style}, + border-bottom-width=\XMLop{border-after-width}, + border-left-color=\XMLop{border-start-color}, + border-left-style=\XMLop{border-start-style}, + border-left-width=\XMLop{border-start-width}, + border-right-color=\XMLop{border-end-color}, + border-right-style=\XMLop{border-end-style}, + border-right-width=\XMLop{border-end-width}, + padding=,% 0pt, + padding-before=0pt,%\XMLop{padding}, + padding-after=0pt,%\XMLop{padding}, + padding-start=0pt,%\XMLop{padding}, + padding-end=0pt,%\XMLop{padding}, + padding-top=\XMLop{padding-before}, + padding-bottom=\XMLop{padding-after}, + padding-left=\XMLop{padding-start}, + padding-right=\XMLop{padding-end}] + +\extendXMLattributeset + [fo:border-padding-background] + [fe:background-height=, + fe:background-width=] + +\defineXMLattributeset + [fo:font] + [] + +\extendXMLattributeset + [fo:inherited] + [font=, + font-family=,% Times, + font-selection-strategy=, + font-size=,% 12pt, + font-size-adjust=, % 1, + font-style=, % normal, + font-variant=, % normal, + font-weight=] % normal] + +\defineXMLattributeset + [fo:hyphenation] + [] + +\extendXMLattributeset + [fo:inherited] + [country=, + language=, + script=, + hyphenate=, + hyphenation-character=, + hyphenation-push-character-count=, + hyphenation-remain-character-count=] + +\defineXMLattributeset + [fo:margin-block] + [margin=, % 0pt, + margin-top=0pt,% \XMLop{margin}, + margin-bottom=0pt,% \XMLop{margin}, + margin-left=0pt,% \XMLop{margin}, + margin-right=0pt,% \XMLop{margin}, + space-before=0pt, + space-after=0pt, + space-before.precedence=, + space-before.conditionality=, + space-before.minimum=, + space-before.optimum=, + space-before.maximum=, + space-after.precedence=, + space-after.conditionality=, + space-after.minimum=, + space-after.optimum=, + space-after.maximum=] + +\extendXMLattributeset + [fo:inherited] + [start-indent=, + end-indent=] + +\defineXMLattributeset + [fo:margin-inline] + [space-start=, + space-end=] + +\defineXMLattributeset + [fo:relative-position] + [relative-position=, + top=auto, + right=auto, + bottom=auto, + left=auto] + +\defineXMLattributeset + [fo:area-alignment] + [alignment-adjust=, + alignment-baseline=, + baseline-shift=, + dominant-baseline=] + +\extendXMLattributeset + [fo:inherited] + [display-align=, + relative-align=] + +\defineXMLattributeset + [fo:area-dimension] + [block-progression-dimension=, + inline-progression-dimension=, + content-height=, + content-width=, + height=, + width=, + max-height=, + max-width=, + min-height=, + min-width=, + scaling=, + scaling-method=] + +\defineXMLattributeset + [fo:block-and-line] + [] + +\extendXMLattributeset + [fo:inherited] + [hyphenation-keep=, + hyphenation-ladder-count=, + last-line-end-indent=, + line-height=, + line-height-shift-adjustment=, + line-stacking-strategy=, + linefeed-treatment=, + white-space-treatment=, + text-align=, + text-align-last=, + text-indent=, + white-space-collapse=, + wrap-option=] + +\defineXMLattributeset + [fo:character] + [character=, + suppress-at-line-break=, + text-decoration=, + text-shadow=, + treat-as-word-space=] + +\extendXMLattributeset + [fo:inherited] + [letter-spacing=, + text-transform=, + word-spacing=] + +\defineXMLattributeset + [fo:color] + [color-profile-name=, + rendering-intent=] + +\extendXMLattributeset + [fo:inherited] + [color=] + +\defineXMLattributeset + [fo:float] + [clear=, + float=] + +\extendXMLattributeset + [fo:inherited] + [intrusion-displace=] + +\defineXMLattributeset + [fo:keeps-and-breaks] + [break-after=, + break-before=, + keep-with-next.within-line=, + keep-with-next.within-column=, + keep-with-next.within-page=, + keep-with-previous.within-line=, + keep-with-previous.within-column=, + keep-with-previous.within-page=] + +\extendXMLattributeset + [fo:inherited] + [keep-together.within-line=, + keep-together.within-column=, + keep-together.within-page=, + orphans=, + widows=] + +\defineXMLattributeset + [fo:layout] + [clip=, + overflow= + span=] + +\extendXMLattributeset + [fo:inherited] + [reference-orientation=] + +\defineXMLattributeset + [fo:leader-and-rule] + [] + +\extendXMLattributeset + [fo:inherited] + [leader-alignment=, + leader-pattern=, + leader-pattern-width=, + leader-pattern-width=, + leader-length=, + rule-style=, + rule-thickness=] + +\defineXMLattributeset + [fo:dynamic-effects] + [active-state=, + case-name=, + case-title=, + destination-placement-offset=, + external-destination=, + indicate-destination=, + internal-destination=, + show-destination=, + starting-state=, + switch-to=, + target-presentation-context=, + target-processing-context=, + target-stylesheet=] + +\extendXMLattributeset + [fo:inherited] + [auto-restore=] + +\defineXMLattributeset + [fo:markers] + [marker-class-name=, + retrieve-class-name=, + retrieve-position=, + retrieve-boundary=] + +\defineXMLattributeset + [fo:number-to-string] + [country=, + language=, + format=, + grouping-separator=, + grouping-size=, + letter-value=] + +% \defineXMLattributeset +% [fo:pagination-and-layout] +% [black-or-not-blank=, +% column-count=1, +% column-gap=12pt, +% extent=, +% flow-name=, +% force-page-count=, +% initial-page-number=, +% master-name=, +% master-reference=, +% maximum-repeats=, +% media-usage=, +% odd-or-even=, +% page-height=, +% page-position=, +% page-width=, +% precedence=, +% region-name=] + +\defineXMLattributeset + [fo:table] + [border-after-precedence=, + border-before-precedence=, + border-end-precedence=, + border-start-precedence=, + column-number=, + column-width=, + ends-row=, + number-columns-repeated=, + number-columns-spanned=, + number-rows-spanned=, + starts-row=, + table-layout=, + table-omit-footer-at-break=, + table-omit-header-at-break=] + +\extendXMLattributeset + [fo:inherited] + [border-collapse=, + border-separation=, + caption-side=, + empty-cells=] + +\defineXMLattributeset + [fo:writing-mode] + [%text-altitude=, + %text-depth=, + unicode-bidi=] + +\extendXMLattributeset % for practical reasons we inherit along the whole chain + [fo:inherited] % unless we implement relax skipping + [text-altitude=, + text-depth=] + +\extendXMLattributeset + [fo:inherited] + [direction=, + glyph-orientation-horizontal=, + glyph-orientation-vertical=, + writing-mode=] + +\defineXMLattributeset + [fo:list-block] + [] + +\extendXMLattributeset + [fo:inherited] + [provisional-label-separation=, + provisional-distance-between-starts=] + +% \starttext +% \setuplayout[topspace=1cm,height=middle,header=0pt,footer=0pt] +% \setupbodyfont[small,tt] +% \expanded{\processcommalist[\XMLattributeset{fo:inherited}]}\endgraf +% \stoptext + +% content-type +% id + +% ref-id +% score-spaces % inherited +% src +% visibility % inherited +% z-index + +% shorthands: +% +% background +% background-position +% border +% border-bottom +% border-left +% border-top +% border-right +% border-style +% border-color +% border-spacing % inherited +% border-width +% cue +% font % inherited +% margin +% padding +% page-break-after +% page-break-before +% page-break-inside % inherited +% pause +% position +% size +% vertical-align +% white-space % inherited + +%D We will speed up the process of setting up attributes by compiling the +%D definitions. Sometimes we need to access attributes explicitly by +%D element (for instance when handling regions). We also need to deal +%D with nested elements (for instance blocks) or a sequence of similar +%D ones, while we may not always want to use grouping. As a result, the +%D next series of definitions and macros are quite ugly. The begin|/|end +%D is needed in order to comfortably fetch attribute values from +%D ancestors. + +\startXMLcompiling[inherit] + +%D Element: fo:root + +%D todo: set defaults here + +\defineXMLenvironment + [fo:root] + [\XMLattributeset{fo:inherited}, +leader-pattern=spaces, +leader-pattern-width=12pt, + media-usage=] + {\directsetup{fo:root:start}} + {\directsetup{fo:root:stop}} + +\startsetups fo:root:start + \starttext \beginXMLelement \startXMLignore + \doifsomething{\XMLop{language}}{\mainlanguage[\XMLop{language}]}% todo, everywhere +\stopsetups + +\startsetups fo:root:stop + \stopXMLignore \endXMLelement \stoptext +\stopsetups + +%D Element: fo:declarations + +\defineXMLprocess + [fo:declarations] + +%D Element: fo:color-profile + +\defineXMLignore + [fo:color-profile] + [src=, + color-profile-name=, + rendering-intent=] + +%D Element: fo:page-sequence + +% master-name and master-reference are often mixed up in examples + +\defineXMLenvironment + [fo:page-sequence] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fe:tracing}, + \XMLattributeset{fo:number-to-string}, + initial-page-number=auto, + master-reference=any, + force-page-count=auto] + {\beginXMLelement\directsetup{fo:page-sequence:start}} + {\directsetup{fo:page-sequence:stop}\endXMLelement} + +\mapXMLvalue {fo:page-initial} {auto} {\relax} +\mapXMLvalue {fo:page-initial} {auto-odd} {\ifodd\pageno \expanded{\setuppagenumber[number=\the\dimexpr(\pageno+1)]}\fi} +\mapXMLvalue {fo:page-initial} {auto-even} {\ifodd\pageno\else\expanded{\setuppagenumber[number=\the\dimexpr(\pageno+1)]}\fi} + +% todo: blokkeer left/right/etc in geval van blank + +\mapXMLvalue {fo:page-start} {auto} {\page} +\mapXMLvalue {fo:page-start} {even} {\page\setuplayout[blank]\page[even]} +\mapXMLvalue {fo:page-start} {odd} {\page\setuplayout[blank]\page[odd]} +\mapXMLvalue {fo:page-end} {end-on-even} {\page\setuplayout[blank]\page[even]} +\mapXMLvalue {fo:page-end} {end-on-odd} {\page\setuplayout[blank]\page[odd]} +\mapXMLvalue {fo:page-start} {no-force} {\page} + +\startsetups fo:page-sequence:start + + % we're still in the previous page-sequence + + \XMLval{fo:page-start}{\XMLop{force-page-count}}{\page} \begingroup + + \directsetup{fe:setup} + + \iftracingFO \showframe[text] \fi + + \xdef\SavedPageNumber{\the\realpageno} + + % now we enter the new page-sequence + + % todo: check on number + + \doifXMLvalelse{fo:page-initial}{\XMLop{initial-page-number}} + {\XMLval{fo:page-initial}{\XMLop{initial-page-number}}{}} + {\doifnot{\XMLop{initial-page-number}}{auto} + {\expanded{\setuppagenumber[number=\XMLop{initial-page-number}]}}} + + \doifsomething{\XMLpar{fo:page-sequence}{master-reference}{}} + {\doifelseXMLelement{fo:page-sequence-master:\XMLpar{fo:page-sequence}{master-reference}{}} + {%[starting page sequence master: \XMLpar{fo:page-sequence}{master-reference}{}]\endgraf + \flushXMLelement{fo:page-sequence-master:\XMLpar{fo:page-sequence}{master-reference}{}}} + {%[starting simple page master: \XMLpar{fo:page-sequence}{master-reference}{any}]\endgraf + \flushXMLelement{fo:simple-page-master:\XMLpar{fo:page-sequence}{master-reference}{any}}}} + + \doif{\XMLpar{fo:simple-page-master-do}{fe:option}{}}{fit} + {\directsetup{fe:page:option:fit:start}} + + \doifnot{\XMLpar{fo:region-body}{column-count}{1}}{1} + {\directsetup{fo:columns:start}} + +\stopsetups + +\startsetups fo:page-sequence:stop + + \doifnot{\XMLpar{fo:region-body}{column-count}{1}}{1} + {\directsetup{fo:columns:stop}} + + \doif{\XMLpar{fo:simple-page-master-do}{fe:option}{}}{fit} + {\directsetup{fe:page:option:fit:stop}} + + % \XMLval{fo:page-end}{\XMLop{force-page-count}}{\page} \endgroup + + \ifnum\SavedPageNumber=\realpageno + + \ifdim\pagetotal<.5\textheight \null \vfill \fi % force a page with only containers + + \fi + + \XMLval{fo:page-end}{\XMLpar{fo:page-sequence}{force-page-count}{}}{\page} \endgroup + +\stopsetups + +\newdimen\FOcolumngap + +\startsetups fo:columns:start + + \FOcolumngap\textwidth + + \setpercentdimen\FOcolumngap{\XMLpar{fo:region-body}{column-gap}{12pt}} + + % we need to freeze the lineheight here + + \expanded{\definecolumnset + [fo:set] + [n=\XMLpar{fo:region-body}{column-count}{1}, + distance=\FOcolumngap]} + + \expanded{\definecolumnsetspan + [fo:set] + [n=\XMLpar{fo:region-body}{column-count}{1}]} + + \directsetup{fo:font:setup} % else problems + + \directsetup{fo:line-height:setup} + +% \parseXMLattributes{fo:flow}{line-height='normal'} + + \startcolumnset[fo:set] + + % \startcolumns[\XMLpar{fo:region-body}{column-count}{1}] + +\stopsetups + +\startsetups fo:columns:stop + + % \stopcolumns + + \stopcolumnset + +\stopsetups + +%D Element: fo:layout-master-set + +\defineXMLprocess + [fo:layout-master-set] + +%D Element: fo:page-sequence-master + +\defineXMLenvironmentsave + [fo:page-sequence-master] + [\XMLattributeset{fo:inherited}, + master-name=any] + {} + {%[saved page sequence master: \XMLop{master-name}]\endgraf + \gsaveXMLdatainelement + {fo:page-sequence-master:\XMLop{master-name}} + {fo:page-sequence-master-do} + {fo:page-sequence-master}} + +\defineXMLprocess + [fo:page-sequence-master-do] + [\XMLattributeset{fo:inherited}] + +%D Element: fo:single-page-master-reference + +% makeup - one page + +\defineXMLcommand + [fo:single-page-master-reference] + [master-reference=any] + {\flushXMLelement{fo:simple-page-master:\XMLop{master-reference}}} + +%D Element: fo:repeatable-page-master-reference + +\defineXMLcommand + [fo:repeatable-page-master-reference] + [master-reference=any, + maximum-repeats=] + {\flushXMLelement{fo:simple-page-master:\XMLop{master-reference}}} + +%D Element: fo:repeatable-page-master-alternatives + +\defineXMLprocess + [fo:repeatable-page-master-alternatives] + [maximum-repeats=] + +%D Element: fo:conditional-page-master-reference + +% page-position : first last rest any +% odd-or-even : odd even any +% blank-or-not-blank : blank not-blank + +% The page-position default is needed (else possible loops) + +\defineXMLcommand + [fo:conditional-page-master-reference] + [master-reference=any, + page-position=\XMLpar{fo:conditional-page-master-reference}{master-reference}{any}, + blank-or-not-blank=, + odd-or-even=] + {\flushXMLelement{fo:simple-page-master:\XMLpar{fo:conditional-page-master-reference}{master-reference}{}}} + +%D Element: fo:simple-page-master + +% first-page left-page right-page blank-page + +% default dimensions + +\defineXMLenvironmentsave + [fo:simple-page-master] + [master-name=any] + {} + {%[saved simple page master: \XMLop{master-name}]\endgraf + \gsaveXMLdatainelement + {fo:simple-page-master:\XMLop{master-name}} + {fo:simple-page-master-do} + {fo:simple-page-master}} + +% reference-orientation=0deg, +% writing-mode= + +\defineXMLenvironment + [fo:simple-page-master-do] + [\XMLattributeset{fo:inherited}, % added + \XMLattributeset{fo:margin-block}, + page-height=29.7cm, + page-width=21cm] + {\directsetup{fo:simple-page-master:start}} + {\directsetup{fo:simple-page-master:stop}} + +% not needed any more: + +\mapXMLvalue {fo:reference-orientation} {0deg} {0} +\mapXMLvalue {fo:reference-orientation} {90deg} {90} +\mapXMLvalue {fo:reference-orientation} {180deg} {180} +\mapXMLvalue {fo:reference-orientation} {270deg} {270} +\mapXMLvalue {fo:reference-orientation} {-90deg} {270} +\mapXMLvalue {fo:reference-orientation} {-180deg} {180} +\mapXMLvalue {fo:reference-orientation} {-270deg} {90} + +\startsetups fo:simple-page-master:start + + % nothing + +\stopsetups + +% can be low level tex + +\startsetups fo:simple-page-master:stop + + \writeFOstatus{defining papersize '\directsetup{fo:layout:kind}'} + + \expanded + {\definepapersize + [\directsetup{fo:layout:kind}] + [width=\XMLop{page-width}, + height=\XMLop{page-height}]} + + \checkFOpadding {fo:region-body} + \checkFOmargin {fo:region-body} + \checkFOmargin {fo:simple-page-master-do} + + \writeFOstatus{defining layout '\directsetup{fo:layout:kind}'} + + \FOscratchMT\paperheight \setpercentdimen\FOscratchMT{\XMLpar{fo:simple-page-master-do}{margin-top} \zeropoint} + \FOscratchMB\paperheight \setpercentdimen\FOscratchMB{\XMLpar{fo:simple-page-master-do}{margin-bottom}\zeropoint} + \FOscratchML\paperwidth \setpercentdimen\FOscratchML{\XMLpar{fo:simple-page-master-do}{margin-left} \zeropoint} + \FOscratchMR\paperwidth \setpercentdimen\FOscratchMR{\XMLpar{fo:simple-page-master-do}{margin-right} \zeropoint} + + \FOscratchRB\paperheight \setpercentdimen\FOscratchRB{\XMLpar{fo:region-body}{margin-top} \zeropoint} + \FOscratchRA\paperheight \setpercentdimen\FOscratchRA{\XMLpar{fo:region-body}{margin-bottom}\zeropoint} + \FOscratchRS\paperwidth \setpercentdimen\FOscratchRS{\XMLpar{fo:region-body}{margin-left} \zeropoint} + \FOscratchRE\paperwidth \setpercentdimen\FOscratchRE{\XMLpar{fo:region-body}{margin-right} \zeropoint} + + \FOscratchPB\paperheight \setpercentdimen\FOscratchPB{\XMLpar{fo:region-body}{padding-top} \zeropoint} + \FOscratchPA\paperheight \setpercentdimen\FOscratchPA{\XMLpar{fo:region-body}{padding-bottom}\zeropoint} + \FOscratchPS\paperwidth \setpercentdimen\FOscratchPS{\XMLpar{fo:region-body}{padding-left} \zeropoint} + \FOscratchPE\paperwidth \setpercentdimen\FOscratchPE{\XMLpar{fo:region-body}{padding-right} \zeropoint} + + \expanded + {\definelayout + [\directsetup{fo:layout:kind}] + [ page={\directsetup{fo:layout:kind},\XMLval{fo:reference-orientation}{\XMLop{reference-orientation}}{}}, + paper=\directsetup{fo:layout:kind}, + backspace=\the\dimexpr(\FOscratchML+\FOscratchPS+\FOscratchRS), + cutspace=\the\dimexpr(\FOscratchMR+\FOscratchPE+\FOscratchRE), + topspace=\the\dimexpr(\FOscratchMT+\FOscratchPB+\FOscratchRB), + bottomspace=\the\dimexpr(\FOscratchMB+\FOscratchPA+\FOscratchRA)]} + + \expanded{\setuplayout[\directsetup{fo:layout:kind}]} + + % this is a nasty bit of code: this local setup stores some data that + % needs to be used later + + \startexpanded + \noexpand \startlocalsetups[layout:\directsetup{fo:layout:kind}] + \noexpand \writeFOstatus{processing simple page master '\XMLpar{fo:simple-page-master-do}{master-name}{any}'} + \noexpand \resetsetups[fo:simple-page-master:start] + \noexpand \resetsetups[fo:simple-page-master:stop] + \noexpand \flushXMLelement{fo:simple-page-master:\XMLpar{fo:simple-page-master-do}{master-name}{any}} + \noexpand \stoplocalsetups + \stopexpanded + +\stopsetups + +% \defineXMLcommand[fo:simple-page-master-do-do] +% {\writeFOstatus{setting up master \XMLop{master-name} in page body}} + +%D Element: fo:region-body + +% display-align=, +% reference-orientation=, +% writing-mode=, + +\defineXMLcommand % or process + [fo:region-body] + [\XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-block}, + fe:z-order=above, + clip=, + column-count=1, + column-gap=12pt, + overflow=, + region-name=] + {\directsetup{fo:region-body:process}} + +\startsetups fo:region-body:process + \writeFOstatus{refreshing region-body parameters} +\stopsetups + +% todo: naar realfolio handelen ipv folio + +\mapXMLvalue {fo:odd-or-even} {odd} {odd} +\mapXMLvalue {fo:odd-or-even} {even} {even} + +\mapXMLvalue {fo:page-position} {any} {rest} % todo +\mapXMLvalue {fo:page-position} {first} {current} +\mapXMLvalue {fo:page-position} {last} {last} % todo +\mapXMLvalue {fo:page-position} {rest} {rest} % todo + +%mapXMLvalue {fo:blank-or-not-blank} {any} {} % todo +%mapXMLvalue {fo:blank-or-not-blank} {not-blank} {} % todo +%mapXMLvalue {fo:blank-or-not-blank} {blank} {} % todo + +% check this one esp default value + +\startsetups fo:layout:kind + + \XMLpav + {fo:odd-or-even} + {fo:conditional-page-master-reference} + {odd-or-even} + {\XMLpav + {fo:page-position} + {fo:conditional-page-master-reference} + {page-position} + {\XMLpar{fo:page-sequence-master}{master-reference}{any}}} + +\stopsetups + +% common border things + +% clip +% display-align +% extent +% overflow +% precedence +% region-name +% reference-orientation +% writing-mode + +%D Element: fo:region-before fo:region-after fo:region-start fo:region-end + +% border-before-color : <color> | inherit +% border-before-style : <border style> | inherit +% border-before-width.length|conditional : <border width> | <length conditional> | inherit +% +% style: none hidden dotted dashed solid double groove ridge inset outset +% width: thin medium thick length + +\mapXMLvalue {fo:display-align} {auto} {before} % todo: related to relative-align +\mapXMLvalue {fo:display-align} {before} {high} +\mapXMLvalue {fo:display-align} {after} {low} +\mapXMLvalue {fo:display-align} {center} {lohi} + +% display-align=, +% reference-orientation=, +% writing-mode=, + +\defineXMLcommand % will become process when stable + [fo:region-before] + [\XMLattributeset{fo:border-padding-background}, + clip=, + extent=, + overflow=, + precedence=, + region-name=] + {\directsetup{fo:region-before:process}} + +\startsetups fo:region-before:process + \writeFOstatus{refreshing region-before parameters} +\stopsetups + +\defineXMLprocess + [fo:region-after] + [\XMLattributeset{fo:border-padding-background}, + clip=, + extent=, + overflow=, + precedence=, + region-name=] + +\defineXMLprocess + [fo:region-start] + [\XMLattributeset{fo:border-padding-background}, + clip=, + extent=, + overflow=, + region-name=] + +\defineXMLprocess + [fo:region-end] + [\XMLattributeset{fo:border-padding-background}, + clip=, + extent=, + overflow=, + region-name=] + +\mapXMLvalue {fo:border-style} {none} {0} +\mapXMLvalue {fo:border-style} {hidden} {1} +\mapXMLvalue {fo:border-style} {dotted} {2} +\mapXMLvalue {fo:border-style} {dashed} {3} +\mapXMLvalue {fo:border-style} {solid} {4} +\mapXMLvalue {fo:border-style} {double} {5} +\mapXMLvalue {fo:border-style} {groove} {6} +\mapXMLvalue {fo:border-style} {ridge} {7} +\mapXMLvalue {fo:border-style} {inset} {8} +\mapXMLvalue {fo:border-style} {outset} {9} + +\mapXMLvalue {fo:border-width} {thin} {.25pt} +\mapXMLvalue {fo:border-width} {medium} {.5pt} +\mapXMLvalue {fo:border-width} {thick} {1pt} + +\startsetups fo:regions:check + + \startprocesscommalist[body,before,after,start,end] + + \checkFOborder{fo:region-\currentcommalistitem}{bottom} + \checkFOborder{fo:region-\currentcommalistitem}{top} + \checkFOborder{fo:region-\currentcommalistitem}{left} + \checkFOborder{fo:region-\currentcommalistitem}{right} + + \checkhexcolor[\XMLpar{fo:region-\currentcommalistitem}{border-bottom-color}{}] + \checkhexcolor[\XMLpar{fo:region-\currentcommalistitem}{border-top-color}{}] + \checkhexcolor[\XMLpar{fo:region-\currentcommalistitem}{border-left-color}{}] + \checkhexcolor[\XMLpar{fo:region-\currentcommalistitem}{border-right-color}{}] + \checkhexcolor[\XMLpar{fo:region-\currentcommalistitem}{background-color}{}] + + \checkFOposition{fo:region-\currentcommalistitem}{background} + \checkFOpadding {fo:region-\currentcommalistitem} + \checkFOmargin {fo:region-\currentcommalistitem} + + \stopprocesscommalist + +\stopsetups + +%D Element: fo:flow + +\defineXMLenvironment + [fo:flow] + [\XMLattributeset{fo:inherited}, + flow-name=unknown] + {\beginXMLelement\directsetup{fo:flow:start}} + {\directsetup{fo:flow:stop}\endXMLelement} + +\startsetups fo:flow:start + \begingroup +\stopsetups + +\startsetups fo:flow:stop + \endgroup +\stopsetups + +%D Element: fo:static-content + +% \beginXMLelement \endXMLelement - maybe save with attributes + +\defineXMLenvironmentsave + [fo:static-content] + [flow-name=unknown] + {} + {\directsetup{fo:static-content:process}} + +\startsetups fo:static-content:process + + \gsaveXMLdata{fo:static-content:\XMLop{flow-name}}{fo:static-content} + +\stopsetups + +\newdimen\FOscratchML \newdimen\FOscratchMR \newdimen\FOscratchMT \newdimen\FOscratchMB +\newdimen\FOscratchPB \newdimen\FOscratchPA \newdimen\FOscratchPS \newdimen\FOscratchPE +\newdimen\FOscratchRB \newdimen\FOscratchRA \newdimen\FOscratchRS \newdimen\FOscratchRE + +\mapXMLvalue {fo:background-repeat} {no-repeat} {0} +\mapXMLvalue {fo:background-repeat} {repeat} {1} +\mapXMLvalue {fo:background-repeat} {repeat-x} {2} +\mapXMLvalue {fo:background-repeat} {repeat-y} {3} + +\expanded {\mapXMLvalue {fo:background-location} {left} {0\letterpercent}} +\expanded {\mapXMLvalue {fo:background-location} {right} {100\letterpercent}} +\expanded {\mapXMLvalue {fo:background-location} {top} {0\letterpercent}} +\expanded {\mapXMLvalue {fo:background-location} {bottom} {100\letterpercent}} +\expanded {\mapXMLvalue {fo:background-location} {center} {50\letterpercent}} + +\newdimen\FObgpositionH +\newdimen\FObgpositionV + +\def\FObackgroundimage#1#2#3% + {\doifnot{\XMLpar{fo:#1}{background-image}{none}}{none} + {\setFOimagename{\XMLpar{fo:#1}{background-image}{dummy}}% + \FObgpositionH#2% + \setpercentdimen\FObgpositionH{\XMLpav + {fo:background-location} + {fo:#1} + {background-position-horizontal} + {\XMLpar{fo:#1}{background-position-horizontal}{}}}% + \ifpercentdimendone + \skip0\zeropoint plus \FObgpositionH + \skip2\zeropoint plus \dimexpr(#2-\FObgpositionH)% + \else + \skip0\FObgpositionH + \skip2\zeropoint plus 1fill\relax + \fi + \FObgpositionV#3% + \setpercentdimen\FObgpositionV{\XMLpav + {fo:background-location}{fo:#1}{background-position-vertical} + {\XMLpar{fo:#1}{background-position-vertical}{}}}% + \ifpercentdimendone + \skip4\zeropoint plus \FObgpositionV + \skip6\zeropoint plus \dimexpr(#3-\FObgpositionV)% + \else + \skip4\FObgpositionV + \skip6\zeropoint plus 1fill\relax + \fi + \vbox to #3 \bgroup + \vskip\skip4\relax + \hbox to #2 \bgroup + \hskip\skip0\relax + \backgroundimage + {\XMLpav{fo:background-repeat}{fo:#1}{background-repeat}{}}{#2}{#3}% + {\externalfigure + [\FOimagename] + [width=\XMLpar{fo:#1}{fe:background-width}{}, + height=\XMLpar{fo:#1}{fe:background-height}{}]}% + \hskip\skip2\relax + \egroup + \vskip\skip6\relax + \egroup}} + +\def\checkFOclipping#1% + {\doifsomething{\XMLpar{#1}{clip}{}} + {\analyzefunction{\XMLpar{#1}{clip}{}}% + \doif\functionname{rect} + {\def\postprocessframebox##1% + {\edef\next{\dimen0=\the\wd##1\dimen2=\the\ht##1\dimen4=\the\dp##1}% + \setbox##1\hbox + {\clip % expanded? + [topoffset=-\functionA, + bottomoffset=-\functionC, + leftoffset=-\functionD, + rightoffset=-\functionB] + {\box##1}}% + \next}}}} + +\def\clipFOarea#1% + {\doifsomething{\XMLpar{#1}{clip}{}}% + {\analyzefunction{\XMLpar{#1}{clip}{}}% + \doif\functionname{rect} + {\setbox\scratchbox\hbox{\foregroundbox}% + \edef\next{\dimen0=\the\wd\scratchbox\dimen2=\the\ht\scratchbox\dimen4=\the\dp\scratchbox}% + \setbox\scratchbox\hbox + {\clip % expanded? + [topoffset=-\functionA, + bottomoffset=-\functionC, + leftoffset=-\functionD, + rightoffset=-\functionB] + {\box\scratchbox}}% + \next + \box\scratchbox}}} + +\defineoverlay + [text] + [\clipFOarea{fo:region-body}] + +\setupbackgrounds + [text] + [background=text] + +\def\FOregionbuilder#1#2#3#4#5#6% #1=location #2=preset #3=x #4=y #5=width #6=height + {\writeFOstatus{building region #1}% + \defineoverlay + [image] + [{\framed + [frame=off, + orientation=\XMLpav{fo:reference-orientation}{fo:#1}{reference-orientation}{0}, + offset=overlay, + height=\overlayheight, + width=\overlaywidth] + {\FObackgroundimage{#1}\hsize\vsize}}]% + \setlayerframed + [regions] + [preset=#2,x=\dimexpr(#3),y=\dimexpr(#4)] + [frame=off, + offset=overlay,background={#1-graphic,image,xsl-#1}, + width=\dimexpr(#5),height=\dimexpr(#6)] + {\lrtbbox + {\XMLpar{fo:#1}{padding-left}\zeropoint}% + {\XMLpar{fo:#1}{padding-right}\zeropoint}% + {\XMLpar{fo:#1}{padding-top}\zeropoint}% + {\XMLpar{fo:#1}{padding-bottom}\zeropoint}% + {\checkFOclipping{fo:#1}% + \framed + [frame=off, + offset=overlay, + orientation=\XMLpav{fo:reference-orientation}{fo:#1}{reference-orientation}{0}, + align={\XMLpav{fo:display-align}{fo:#1}{display-align}{high},\XMLpav{fo:align-key}{fo:#1}{text-align}{normal}}, + width=\hsize,height=\vsize] + {\doFObeforeskip{fo:#1}% + \flushXMLelement{fo:static-content:\XMLpar{fo:#1}{region-name}{xsl-#1}}}% + \doFOafterskip{fo:#1}}}} + +\startsetups fo:regions:process + + \directsetup{fo:regions:check} + + \checkFOmargin{fo:simple-page-master-do} + + \FOscratchMT\paperheight \setpercentdimen\FOscratchMT{\XMLpar{fo:simple-page-master-do}{margin-top} \zeropoint} + \FOscratchMB\paperheight \setpercentdimen\FOscratchMB{\XMLpar{fo:simple-page-master-do}{margin-bottom}\zeropoint} + \FOscratchML\paperwidth \setpercentdimen\FOscratchML{\XMLpar{fo:simple-page-master-do}{margin-left} \zeropoint} + \FOscratchMR\paperwidth \setpercentdimen\FOscratchMR{\XMLpar{fo:simple-page-master-do}{margin-right} \zeropoint} + + \doif{\XMLpar{fo:region-body}{fe:z-order}{above}}{below}{\directsetup{fo:regions:process:body}} + + \FOscratchRB\paperheight \setpercentdimen\FOscratchRB{\XMLpar{fo:region-before}{extent}\zeropoint} + \FOscratchRA\paperheight \setpercentdimen\FOscratchRA{\XMLpar{fo:region-after} {extent}\zeropoint} + \FOscratchRS\paperwidth \setpercentdimen\FOscratchRS{\XMLpar{fo:region-start} {extent}\zeropoint} + \FOscratchRE\paperwidth \setpercentdimen\FOscratchRE{\XMLpar{fo:region-end} {extent}\zeropoint} + + \doifelse{\XMLpar{fo:region-before}{precedence}{false}}{true} + {\doifelse{\XMLpar{fo:region-after}{precedence}{false}}{true} + {\directsetup{fo:regions:process:true:true}} + {\directsetup{fo:regions:process:true:false}}} + {\doifelse{\XMLpar{fo:region-after}{precedence}{false}}{true} + {\directsetup{fo:regions:process:false:true}} + {\directsetup{fo:regions:process:false:false}}} + + \doif{\XMLpar{fo:region-body}{fe:z-order}{above}}{above}{\directsetup{fo:regions:process:body}} + +\stopsetups + +\newdimen\FOscratchEB +\newdimen\FOscratchEA + +\chardef\FOregionmode\zerocount + +\startmode[fo-pt] + \chardef\FOregionmode\plusone % fotex mode -) +\stopmode + +\startsetups fo:regions:modes + + \ifcase\FOregionmode + \FOscratchEB\zeropoint + \FOscratchEA\zeropoint + \or + \FOscratchEB\paperheight \setpercentdimen\FOscratchEB{\XMLpar{fo:region-before}{extent}\zeropoint} + \FOscratchEA\paperheight \setpercentdimen\FOscratchEA{\XMLpar{fo:region-after} {extent}\zeropoint} + \else + \FOscratchEB\zeropoint + \FOscratchEA\zeropoint + \fi + +\stopsetups + +\startsetups fo:regions:process:body + + \bgroup + + \FOscratchRB\paperheight \setpercentdimen\FOscratchRB{\XMLpar{fo:region-body}{margin-top} \zeropoint} + \FOscratchRA\paperheight \setpercentdimen\FOscratchRA{\XMLpar{fo:region-body}{margin-bottom}\zeropoint} + \FOscratchRS\paperwidth \setpercentdimen\FOscratchRS{\XMLpar{fo:region-body}{margin-left} \zeropoint} + \FOscratchRE\paperwidth \setpercentdimen\FOscratchRE{\XMLpar{fo:region-body}{margin-right} \zeropoint} + + \FOregionbuilder + {region-body} + {lefttop} + {\FOscratchML+\FOscratchRS} + {\FOscratchMT+\FOscratchRA} + {\paperwidth -\FOscratchML-\FOscratchMR-\FOscratchRS-\FOscratchRE} + {\paperheight-\FOscratchMT-\FOscratchMB-\FOscratchRB-\FOscratchRA} + + \egroup + +\stopsetups + +\startsetups fo:regions:process:true:true + + \directsetup{fo:regions:modes} + + \ifdim\FOscratchRB>\zeropoint \FOregionbuilder + {region-before}{lefttop} + {\FOscratchML}{\FOscratchMT-\FOscratchEB} + {\paperwidth-\FOscratchML-\FOscratchMR}{\FOscratchRB} + \fi \ifdim\FOscratchRA>\zeropoint \FOregionbuilder + {region-after}{leftbottom} + {\FOscratchML}{\FOscratchMB-\FOscratchEA} + {\paperwidth-\FOscratchML-\FOscratchMR}{\FOscratchRA} + \fi \ifdim\FOscratchRS>\zeropoint \FOregionbuilder + {region-start}{lefttop} + {\FOscratchML}{\FOscratchMT+\FOscratchRB} + {\FOscratchRS}{\paperheight-\FOscratchMT-\FOscratchMB-\FOscratchRA-\FOscratchRB} + \fi \ifdim\FOscratchRE>\zeropoint \FOregionbuilder + {region-end}{righttop} + {\FOscratchMR}{\FOscratchMT+\FOscratchRA} + {\FOscratchRE}{\paperheight-\FOscratchMT-\FOscratchMB-\FOscratchRA-\FOscratchRB} + \fi + +\stopsetups + +\startsetups fo:regions:process:false:true + + \directsetup{fo:regions:modes} + + \ifdim\FOscratchRB>\zeropoint \FOregionbuilder + {region-before}{lefttop} + {\FOscratchML+\FOscratchRS}{\FOscratchMT-\FOscratchEB} + {\paperwidth-\FOscratchML-\FOscratchMR-\FOscratchRS-\FOscratchRE}{\FOscratchRB} + \fi \ifdim\FOscratchRA>\zeropoint \FOregionbuilder + {region-after}{leftbottom} + {\FOscratchML}{\FOscratchMB-\FOscratchEA} + {\paperwidth-\FOscratchML-\FOscratchMR}{\FOscratchRA} + \fi \ifdim\FOscratchRS>\zeropoint \FOregionbuilder + {region-start}{lefttop} + {\FOscratchML}{\FOscratchMT} + {\FOscratchRS}{\paperheight-\FOscratchMB-\FOscratchRA-\FOscratchRB} + \fi \ifdim\FOscratchRE>\zeropoint \FOregionbuilder + {region-end}{righttop} + {\FOscratchMR}{\FOscratchMT} + {\FOscratchRE}{\paperheight-\FOscratchMB-\FOscratchRA-\FOscratchRB} + \fi + +\stopsetups + +\startsetups fo:regions:process:true:false + + \directsetup{fo:regions:modes} + + \ifdim\FOscratchRB>\zeropoint \FOregionbuilder + {region-before}{lefttop} + {\FOscratchML}{\FOscratchMT-\FOscratchEB} + {\paperwidth-\FOscratchML-\FOscratchMR}{\FOscratchRB} + \fi \ifdim\FOscratchRA>\zeropoint \FOregionbuilder + {region-after}{leftbottom} + {\FOscratchML+\FOscratchRS}{\FOscratchMB-\FOscratchEA} + {\paperwidth-\FOscratchML-\FOscratchMR-\FOscratchRS-\FOscratchRE}{\FOscratchRA} + \fi \ifdim\FOscratchRS>\zeropoint \FOregionbuilder + {region-start}{lefttop} + {\FOscratchML}{\FOscratchMT+\FOscratchRB} + {\FOscratchRS}{\paperheight-\FOscratchMT-\FOscratchMB-\FOscratchRB} + \fi \ifdim\FOscratchRE>\zeropoint \FOregionbuilder + {region-end}{righttop} + {\FOscratchMR}{\FOscratchMT+\FOscratchRA} + {\FOscratchRE}{\paperheight-\FOscratchMT-\FOscratchMB-\FOscratchRB} + \fi + +\stopsetups + +\startsetups fo:regions:process:false:false + + \directsetup{fo:regions:modes} + + \ifdim\FOscratchRB>\zeropoint \FOregionbuilder + {region-before}{lefttop} + {\FOscratchML+\FOscratchRS}{\FOscratchMT-\FOscratchEB} + {\paperwidth-\FOscratchML-\FOscratchMR-\FOscratchRS-\FOscratchRE}{\FOscratchRB} + \fi \ifdim\FOscratchRA>\zeropoint \FOregionbuilder + {region-after}{leftbottom} + {\FOscratchML+\FOscratchRS}{\FOscratchMB-\FOscratchEA} + {\paperwidth-\FOscratchML-\FOscratchMR-\FOscratchRS-\FOscratchRE}{\FOscratchRA} + \fi \ifdim\FOscratchRS>\zeropoint \FOregionbuilder + {region-start}{lefttop} + {\FOscratchML}{\FOscratchMT} + {\FOscratchRS}{\paperheight-\FOscratchMT-\FOscratchMB} + \fi \ifdim\FOscratchRE>\zeropoint \FOregionbuilder + {region-end}{righttop} + {\FOscratchMR}{\FOscratchMT} + {\FOscratchRE}{\paperheight-\FOscratchMT-\FOscratchMB} + \fi + +\stopsetups + +\startsetups fo:before:each:page + + \writeFOstatus{setting up layout \currentlayout} + \directsetup{layout:\currentlayout} + \directsetup{fo:regions:process} + +\stopsetups + +\prependtoks + \directsetup{fo:before:each:page}% +\to \everybeforepagebody + +%D Element: fo:title + +% \XMLattributeset{fo:aural}, +% color=, +% line-height=, + +\defineXMLignore + [fo:title] + [\XMLattributeset{fo:inherited},\XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:margin-inline}, + visibility=] + +%D Element: fo:block + +\defineXMLenvironment + [fo:block] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fe:tracing}, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:hyphenation}, + \XMLattributeset{fo:margin-block}, + \XMLattributeset{fo:relative-position}, + \XMLattributeset{fo:keeps-and-breaks}, +% text-depth=, +% text-altitude=, + span=, + visibility=] + {\beginXMLelement\directsetup{fo:block:start}} + {\directsetup{fo:block:stop}\endXMLelement} + +\startsetups fo:block:start + + \endgraf + + \writeFOstatus{fo:block in line \the\inputlineno} + +\doif{\XMLpar{fo:block}{span}{}}{all}{\ifinsidecolumns \startcolumnsetspan[fo:set] \fi} + + \begingroup + + \directsetup{fe:setup} + + \directsetup{fo:break-and-space:before} + + \begingroup + + \setFOreference{fo:block} + + \increment\FOblocklevel + + \directsetup{fo:font:setup} + + % \setupinterlinespace % no, interferes with columnset and lineheight + + \directsetup{fo:line-height:setup} + + \directsetup{fo:indent:setup}% hier ? + + \doifsomething{\XMLop{background-color}} + {\checkhexcolor[\XMLop{background-color}] + \doifcolorelse{\XMLop{background-color}} + \donothing + {\setXMLpar{fo:block}{background-color}{}}} + + \doifsomething{\XMLop{color}} + {\checkhexcolor[\XMLop{color}] + \doifcolorelse{\XMLop{color}} + \donothing + {\setXMLpar{fo:block}{color}{}}} + + \doifsomething{\XMLop{background-color}} + {\expanded + {\definetextbackground + [FOattribute-\FOblocklevel] + [location=paragraph, + color=\XMLop{color}, + style=, + before=, + after=, + background=color, + backgroundcolor=\XMLop{background-color}]}} + + \endgraf + + \getvalue{startFOattribute-\FOblocklevel} + + \directsetup{fo:hyphenation:setup} + \directsetup{fo:align:setup} + \directsetup{fo:margin:setup} + + \doif{\XMLop{wrap-option}}{no-wrap} + {\obeylines} + + \doif{\XMLop{white-space-collapse}}{false} + {\obeyspaces} + + % todo : remember old one and do like fonts + + \directsetup{fo:textindent:setup} + +\stopsetups + +\startsetups fo:block:stop + + \endstrut \endgraf + + \getvalue{stopFOattribute-\FOblocklevel} + + \endgraf + + \endgroup + + \directsetup{fo:break-and-space:after} + + \endgroup + + \doif{\XMLpar{fo:block}{span}{}}{all}{\ifinsidecolumns \stopcolumnsetspan \fi} + +\stopsetups + +\startsetups fo:textindent:setup + + \edefXMLinh\xFOtextindent{text-indent} + + \doifsomething\xFOtextindent + {\scratchdimen\hsize + \setpercentdimen\scratchdimen\xFOtextindent + \expanded{\setupindenting[\the\scratchdimen]}} + +\stopsetups + +\indenting[always] % can be zero points + +% todo: map + +\mapXMLvalue {fo:break} {column} {\column} +\mapXMLvalue {fo:break} {page} {\page} +\mapXMLvalue {fo:break} {even-page} {\page[even]} +\mapXMLvalue {fo:break} {odd-page} {\page[odd]} + +% keep-together : either vbox or something \interlinepenalty\maxdimen ? +% +% nasty interference with accumulated skips + +\mapXMLvalue {fo:keep-next} {auto} {} +\mapXMLvalue {fo:keep-next} {always} {\nobreak} + +\mapXMLvalue {fo:keep-prev} {auto} {} +\mapXMLvalue {fo:keep-prev} {always} {\nobreak} + +\mapXMLvalue {fo:keep-start} {auto} {} +\mapXMLvalue {fo:keep-start} {always} {\interlinepenalty\maxdimen} + +\mapXMLvalue {fo:keep-stop} {auto} {} +\mapXMLvalue {fo:keep-stop} {always} {} + +\newskip\FOsavedlastskip + +\startsetups fo:break-and-space:before + + \XMLval{fo:break}{\XMLop{break-before}}{} + + \FOsavedlastskip \lastskip \ifdim\FOsavedlastskip>\zeropoint \vskip-\FOsavedlastskip \fi + + \XMLval{fo:keep-start}{\XMLop{keep-together}}\empty + \XMLval{fo:keep-start}{\XMLop{keep-together.within-column}}\empty + \XMLval{fo:keep-start}{\XMLop{keep-together.within-page}}\empty + + \XMLval{fo:keep-prev} {\XMLop{keep-with-previous}}\empty + \XMLval{fo:keep-prev} {\XMLop{keep-with-previous.within-column}}\empty + \XMLval{fo:keep-prev} {\XMLop{keep-with-previous.within-page}}\empty + + \ifdim\FOsavedlastskip>\zeropoint \vskip\FOsavedlastskip \fi + + \doFObeforeskip\currentXMLelement + +\stopsetups + +\startsetups fo:break-and-space:after + +% \doFOafterskip\currentXMLelement + + \FOsavedlastskip \lastskip \ifdim\FOsavedlastskip>\zeropoint \vskip-\FOsavedlastskip \fi + + \XMLval{fo:keep-stop}{\XMLop{keep-together}}\empty + \XMLval{fo:keep-stop}{\XMLop{keep-together.within-column}}\empty + \XMLval{fo:keep-stop}{\XMLop{keep-together.within-page}}\empty + + \XMLval{fo:keep-next}{\XMLop{keep-with-next}}\empty + \XMLval{fo:keep-next}{\XMLop{keep-with-next.within-column}}\empty + \XMLval{fo:keep-next}{\XMLop{keep-with-next.within-page}}\empty + + \ifdim\FOsavedlastskip>\zeropoint \vskip\FOsavedlastskip \fi + + \doFOafterskip\currentXMLelement + + \XMLval{fo:break}{\XMLop{break-after}}{} + +\stopsetups + +\startsetups fo:space:start + \doFOstartspace\currentXMLelement +\stopsetups + +\startsetups fo:space:end + \doFOendspace\currentXMLelement +\stopsetups + +\startsetups fo:indent:setup + + \doifsomething{\XMLop{start-indent}}{\advance\leftskip \XMLop{start-indent}\relax} + \doifsomething{\XMLop{end-indent}} {\advance\rightskip\XMLop{end-indent} \relax} + +% \FOattributeT +% \FOattributeR +% \FOattributeB +% \FOattributeL + + +\stopsetups + +\mapXMLvalue {fo:align} {center} {\raggedcenter} +\mapXMLvalue {fo:align} {left} {\raggedright} +\mapXMLvalue {fo:align} {right} {\raggedleft} +\mapXMLvalue {fo:align} {begin} {\raggedright} +\mapXMLvalue {fo:align} {start} {\raggedright} +\mapXMLvalue {fo:align} {end} {\raggedleft} + +\mapXMLvalue {fo:align-key} {center} {middle} +\mapXMLvalue {fo:align-key} {left} {flushleft} +\mapXMLvalue {fo:align-key} {right} {flushright} +\mapXMLvalue {fo:align-key} {begin} {flushleft} +\mapXMLvalue {fo:align-key} {start} {flushleft} +\mapXMLvalue {fo:align-key} {end} {flushright} + +\startsetups fo:align:setup + + \XMLval{fo:align}{\XMLop{text-align}}{} + +\stopsetups + +\startsetups fo:margin:setup + + \checkFOmargin{fo:block} + + \FOscratchML \XMLpar{fo:block}{margin-left} \zeropoint + \FOscratchMR \XMLpar{fo:block}{margin-right} \zeropoint + \FOscratchMT \XMLpar{fo:block}{margin-top} \zeropoint + \FOscratchMB \XMLpar{fo:block}{margin-bottom}\zeropoint + + \advance\leftskip \FOscratchML + \advance\rightskip\FOscratchMR + +\stopsetups + +% todo: font-stretch +% +% ultra-condensed +% extra-condensed +% condensed +% semi-condensed +% expanded +% extra-expanded +% ultra-expanded +% +% wider narrower + +\mapXMLvalue {fo:font-size} {xx-small} {\dFOfontsize0.58\dFOfontsize} +\mapXMLvalue {fo:font-size} {x-small} {\dFOfontsize0.69\dFOfontsize} +\mapXMLvalue {fo:font-size} {small} {\dFOfontsize0.83\dFOfontsize} +\mapXMLvalue {fo:font-size} {medium} {\relax} +\mapXMLvalue {fo:font-size} {large} {\dFOfontsize1.20\dFOfontsize} +\mapXMLvalue {fo:font-size} {x-large} {\dFOfontsize1.44\dFOfontsize} +\mapXMLvalue {fo:font-size} {xx-large} {\dFOfontsize1.73\dFOfontsize} + +\mapXMLvalue {fo:font-size} {smaller} {\dFOfontsize0.83\dFOfontsize} +\mapXMLvalue {fo:font-size} {larger} {\dFOfontsize1.20\dFOfontsize} + +\newdimen\dFOfontsize + +% evt class Times Helvetica + +\definefontsynonym [FO:Times] [Times-Roman] +\definefontsynonym [FO:Times:bold] [Times-Bold] +\definefontsynonym [FO:Times:italic] [Times-Italic] +\definefontsynonym [FO:Times:bold:italic] [Times-BoldItalic] + +\definefontsynonym [FO:Times:small-caps] [Times-Roman] +\definefontsynonym [FO:Times:bold:small-caps] [Times-Bold] +\definefontsynonym [FO:Times:italic:small-caps] [Times-Italic] +\definefontsynonym [FO:Times:bold:italic:small-caps] [Times-BoldItalic] + +\definefontsynonym [FO:Helvetica] [Helvetica] +\definefontsynonym [FO:Helvetica:bold] [Helvetica-Bold] +\definefontsynonym [FO:Helvetica:italic] [Helvetica-Italic] +\definefontsynonym [FO:Helvetica:bold:italic] [Helvetica-BoldItalic] + +\definefontsynonym [FO:Helvetica:small-caps] [Helvetica] +\definefontsynonym [FO:Helvetica:bold:small-caps] [Helvetica-Bold] +\definefontsynonym [FO:Helvetica:italic:small-caps] [Helvetica-Italic] +\definefontsynonym [FO:Helvetica:bold:italic:small-caps] [Helvetica-BoldItalic] + +\definefontsynonym [FO:Courier] [Courier] +\definefontsynonym [FO:Courier:bold] [Courier-Bold] +\definefontsynonym [FO:Courier:italic] [Courier-Oblique] +\definefontsynonym [FO:Courier:bold:italic] [Courier-BoldOblique] + +\definefontsynonym [FO:Courier:small-caps] [Courier] +\definefontsynonym [FO:Courier:bold:small-caps] [Courier-Bold] +\definefontsynonym [FO:Courier:italic:small-caps] [Courier-Oblique] +\definefontsynonym [FO:Courier:bold:italic:small-caps] [Courier-BoldOblique] + +\definefontsynonym [FO:Symbol] [ZapfDingbats] + +\definefontsynonym [FO:Computer-Modern-Typewriter] [ComputerModernMono] +\definefontsynonym [FO:Computer-Modern-Typewriter:italic] [ComputerModernMono-Slanted] + +\definefontsynonym [*Times Roman*] [Times] + +% nasty: no FO prefix + +\definefontsynonym [*serif*] [Times] +\definefontsynonym [*sans-serif*] [Helvetica] +\definefontsynonym [*monospace*] [Courier] + +\definefontsynonym [*cursive*] [Times] +\definefontsynonym [*fantasy*] [Helvetica] + +\definefontsynonym [*Arial*] [Helvetica] +\definefontsynonym [*Times Roman*] [Times] +\definefontsynonym [*Wingdings*] [ZapfDingbats] + +% \definefontsynonym [Computer-Modern-Typewriter] [ComputerModernMono] +% \definefontsynonym [monospace] [ComputerModernMono] + +\startsetups fo:fonts:reset + + \dFOfontsize=\bodyfontsize + + \def\FOfontsize {10pt}% {12pt} + \def\FOfontfamily {Times} + \def\FOfontweight {normal} + \def\FOfontstyle {normal} + \def\FOfontvariant {normal} + \def\FOfontsizeadjust{1} + + \def\FOtextdepth {} + \def\FOtextaltitude {} + \def\FOlineheight {} + + \def\FOfontdefinition{} + \def\FOfontname {} + +\stopsetups + +\def\FOfontdefinition{} +\def\FOfontname {} + +\directsetup{fo:fonts:reset} + +% test for \FOfontvariant: normal or else + +\def\setFOfontname + {\edef\xFOfontname{FO:\FOfontfamily:\FOfontweight:\FOfontstyle:\FOfontvariant}% + %\begingroup\infofont\xFOfontname]\endgroup + \doifelsefontsynonym\xFOfontname + {\let\FOfontname\xFOfontname} + {\edef\xFOfontname{FO:\FOfontfamily:\FOfontweight:\FOfontstyle}% + \doifelsefontsynonym\xFOfontname + {\let\FOfontname\xFOfontname} + {\edef\xFOfontname{FO:\FOfontfamily:\FOfontstyle}% + \doifelsefontsynonym\xFOfontname + {\let\FOfontname\xFOfontname} + {\edef\xFOfontname{FO:\FOfontfamily:\FOfontweight}% + \doifelsefontsynonym\xFOfontname + {\let\FOfontname\xFOfontname} + {\edef\xFOfontname{FO:\FOfontfamily}% + \doifelsefontsynonym\xFOfontname + {\let\FOfontname\xFOfontname} + {}}}}}} + +% \unprotected \def\doifelseFOfontsynonym#1#2#3#4#5% family weight style variant default +% {\edef\FOfontname +% {\ifcsname \??ff\fontclass FO:#1:#2:#3:#4\endcsname FO:#1:#2:#3:#4% +% \else\ifcsname\??ff\fontclass FO:#1:#2:#3\endcsname FO:#1:#2:#3% +% \else\ifcsname\??ff\fontclass FO:#1:#3\endcsname FO:#1:#3% +% \else\ifcsname\??ff\fontclass FO:#1:#2\endcsname FO:#1:#2% +% \else\ifcsname\??ff\fontclass FO:#1\endcsname FO:#1% +% \else #5% +% \fi\fi\fi\fi\fi}} + +\startsetups fo:font:family:check + + \doifelsefontsynonym{*\FOfontfamily*} + {\expandfontsynonym\FOfontfamily{*\FOfontfamily*}} + {} + +\stopsetups + +\let\FOfont\empty + +\startsetups fo:font:setup + + % todo: optimize, define fonts first time and do that global + + \edefXMLinh\xFOfont {font} + \edefXMLinh\xFOfontsize {font-size} + \edefXMLinh\xFOfontsizeadjust{font-size-adjust} + \edefXMLinh\xFOfontfamily {font-family} + \edefXMLinh\xFOfontweight {font-weight} + \edefXMLinh\xFOfontstyle {font-style} + \edefXMLinh\xFOfontvariant {font-variant} + +% \edef\xFOfont {\XMLpar{fo}{font}{}} +% \edef\xFOfontsize {\XMLpar{fo}{font-size}{}} +% \edef\xFOfontsizeadjust{\XMLpar{fo}{font-size-adjust}{}} +% \edef\xFOfontfamily {\XMLpar{fo}{font-family}{}} +% \edef\xFOfontweight {\XMLpar{fo}{font-weight}{}} +% \edef\xFOfontstyle {\XMLpar{fo}{font-style}{}} +% \edef\xFOfontvariant {\XMLpar{fo}{font-variant}{}} + + \donefalse + + \ifx\xFOfont\empty \else \ifx\xFOfont\relax \else + \let\FOfont\xFOfont + \checkFOfont\FOfont + \fi \fi + + \ifx\xFOfontsize\empty \else \ifx\xFOfontsize\FOfontsize \else + \let\FOfontsize\xFOfontsize + \doifXMLvalelse{fo:font-size}\FOfontsize + {\XMLval{fo:font-size}\FOfontsize\empty} + {\setpercentdimen\dFOfontsize\FOfontsize} + \fi \fi + + \ifx\xFOfontsizeadjust\empty \else + \doifelse\xFOfontsizeadjust{none} + {\def\FOfontsizeadjust{1}} + {\let\FOfontsizeadjust\xFOfontsizeadjust} + \fi + + \ifx\xFOfontfamily\empty \else \ifx\xFOfontfamily\FOfontfamily \else + \donetrue \let\FOfontfamily\xFOfontfamily \directsetup{fo:font:family:check} + \fi \fi + \ifx\xFOfontweight\empty \else \ifx\xFOfontweight\FOfontweight \else + \donetrue \let\FOfontweight\xFOfontweight + \fi \fi + \ifx\xFOfontstyle\empty \else \ifx\xFOfontstyle\FOfontstyle \else + \donetrue \let\FOfontstyle\xFOfontstyle + \fi \fi + \ifx\xFOfontvariant\empty \else \ifx\xFOfontvariant\FOfontvariant \else + \donetrue \let\FOfontvariant\xFOfontvariant + \fi \fi + + \ifdone + \setFOfontname + \ifx\FOfontname\empty % klopt dit + \edef\xFOfontdefinition{\purefontname{\font} at \the\dimexpr(\FOfontsizeadjust\dFOfontsize)} +% \let\xFOfontdefinition\empty + \else + \edef\xFOfontdefinition{\FOfontname\space at \the\dimexpr(\FOfontsizeadjust\dFOfontsize)} + \fi + \else + \edef\xFOfontdefinition{\purefontname{\font} at \the\dimexpr(\FOfontsizeadjust\dFOfontsize)} + \fi + + \ifx\xFOfontdefinition\empty \else + \ifx\FOfontdefinition\xFOfontdefinition + \else + \let\FOfontdefinition\xFOfontdefinition + \expanded{\definedfont[\FOfontdefinition]} + \fi + \fi + +\stopsetups + +\newdimen\dFOlineheight +\newdimen\dFOdepth +\newdimen\dFOaltitude + +\let\FOlineheight \empty +\let\FOtextdepth \empty +\let\FOtextaltitude\empty + +\startsetups fo:line-height:setup + + \edefXMLinh\xFOtextdepth {text-depth} + \edefXMLinh\xFOtextaltitude{text-altitude} + \edefXMLinh\xFOlineheight {line-height} + +% \edef\xFOtextdepth {\XMLpar{fo}{text-depth}{}} +% \edef\xFOtextaltitude{\XMLpar{fo}{text-altitude}{}} +% \edef\xFOlineheight {\XMLpar{fo}{line-height}{}} + + \ifx\xFOtextdepth\empty \else \ifx\xFOtextdepth\FOtextdepth \else + \let\FOtextdepth\xFOtextdepth + \doifnot\FOtextdepth{use-font-metrics} + {\setstrut \dFOdepth\strutdepth + \setpercentdimen\dFOdepth\FOtextdepth + \setupinterlinespace[mindepth=\dFOdepth]} + \fi \fi + + \ifx\xFOtextaltitude\empty \else \ifx\xFOtextaltitude\FOtextaltitude \else + \let\FOtextaltitude\xFOtextaltitude + \doifnot\FOtextaltitude{use-font-metrics} + {\setstrut \dFOaltitude\strutheight \advance\dFOaltitude\strutdepth + \setpercentdimen\dFOaltitude\FOtextaltitude + \setupinterlinespace[minheight=\dFOaltitude]} + \fi \fi + +\ifinsidecolumns \else + + \ifx\xFOlineheight\empty \else \ifx\xFOlineheight\FOlineheight \else + \let\FOlineheight\xFOlineheight + \doifelse\FOlineheight{normal} + {\dFOlineheight2.8ex + \setupinterlinespace[line=\dFOlineheight]} + {\doifnot\FOlineheight{use-font-metrics} + {\setstrut \dFOlineheight\strutheight \advance\dFOlineheight\strutdepth + \setpercentdimen\dFOlineheight\FOlineheight + \setupinterlinespace[line=\dFOlineheight]}} + \fi \fi + +\fi + +\stopsetups + +\let\orphanpenalty \clubpenalty +\let\orphanpenalties\clubpenalties + +\newcount\FOwidows \FOwidows =2 +\newcount\FOorphans \FOorphans=2 + +\mapXMLvalue {fo:hyphens} {false} {\nohyphens} +\mapXMLvalue {fo:hyphens} {true} {\dohyphens} + +\startsetups fo:hyphenation:setup + + \edefXMLinh\xFOhyphenate {hyphenate} + \edefXMLinh\xFOwidows {widows} + \edefXMLinh\xFOorphans {orphans} + +% \edef\xFOhyphenate {\XMLpar{fo}{hyphenate}{}} +% \edef\xFOwidows {\XMLpar{fo}{widows}{}} +% \edef\xFOorphans {\XMLpar{fo}{orphans}{}} + + \ifx\xFOhyphenate\empty \else + \XMLval{fo:hyphens}{\xFOhyphenate}\empty + \fi + \ifx\xFOwidows\empty \else \ifnum\xFOwidows=\FOwidows \else + \FOwidows\xFOwidows \setpenalties\widowpenalties\FOwidows\maxdimen + \fi \fi + \ifx\xFOorphans\empty \else \ifnum\xFOorphans=\FOorphans \else + \FOorphans\xFOorphans \setpenalties\clubpenalties\FOorphans\maxdimen + \fi \fi + + % hyphenation-character + +\stopsetups + +%D fo:block-container + +% todo: potential optimization: set fonts and spacing at container level + +% display-align=, +% intrusion-displace=, +% reference-orientation=, +% writing-mode=, + +\defineXMLenvironment + [fo:block-container] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fe:tracing}, + \XMLattributeset{fo:absolute-positioning}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-block}, + \XMLattributeset{fo:keeps-and-breaks}, + block-progression-dimension=, + inline-progression-dimension=, + clip=, + height=, + overflow=, + span=, + width=, + z-index=] + {\beginXMLelement\directsetup{fo:block-container:start}} + {\directsetup{fo:block-container:stop}\endXMLelement} + +\mapXMLvalue {fo:block-container:start} {absolute} {\directsetup{fo:block-container:start:pos}} +\mapXMLvalue {fo:block-container:start} {fixed} {\directsetup{fo:block-container:start:pos}} + +\mapXMLvalue {fo:block-container:stop} {absolute} {\directsetup{fo:block-container:stop:pos}} +\mapXMLvalue {fo:block-container:stop} {fixed} {\directsetup{fo:block-container:stop:pos}} + +\startsetups fo:block-container:start + + \XMLval{fo:block-container:start}{\XMLpar{fo:block-container}{absolute-position}{}}{} + + \setFOreference{fo:block-container} + +\stopsetups + +\startsetups fo:block-container:stop + + \XMLval{fo:block-container:stop}{\XMLpar{fo:block-container}{absolute-position}{}}{} + +\stopsetups + +% i need to figure out the details (specs are a bit fuzzy) + +% replaced, see position + +\newdimen\FOcontainerW \newdimen\FOcontainerX \newdimen\FOcontainerL \newdimen\FOcontainerR \newdimen\FOcontainerWW +\newdimen\FOcontainerH \newdimen\FOcontainerY \newdimen\FOcontainerT \newdimen\FOcontainerB \newdimen\FOcontainerHH + +\startsetups fo:block-container:start:pos + + % todo: textwidth -> region dimensions + + \begingroup % \forgetall + + \FOcontainerWW\textwidth + \FOcontainerHH\textheight + \def\FOlayername{\XMLpar{fo:flow}{flow-name}{xsl-region-body}} + + \iftracingFO \tracelayerstrue \fi + + \directsetup{fo:preset:layer} + + \setlayerframed + [\XMLpar{fo:flow}{flow-name}{xsl-region-body}] + [frame=off, + width=\FOcontainerW, + height=\FOcontainerH] + + \bgroup + +\stopsetups + +\startsetups fo:block-container:stop:pos + + \egroup + + \endgroup + +\stopsetups + +%D fo:bidi-override + +% \XMLattributeset{aural}, +% color=, +% direction=, +% letter-spacing=, +% line-height=, +% word-spacing=, + +\defineXMLenvironment + [fo:bidi-override] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:relative-position}, + score-spaces=, + unicode-bidi=] + {\beginXMLelement} + {\endXMLelement} + +% todo + +%D fo:character + +% \XMLattributeset{fo:aural}, +% color=, +% glyph-orientation-horizontal=, +% glyph-orientation-vertical=, +% line-height=, + +\defineXMLsingular + [fo:character] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fe:tracing}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:hyphenation}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:relative-position}, + \XMLattributeset{fo:character}, + alignment-adjust=, + baseline-shift=, + dominant-baseline=, +% text-depth=, +% text-altitude=, + keep-with-next=, + keep-with-previous=, + score-spaces=, + visibility=] + {\directsetup{fo:character:process}} + +\mapXMLvalue {fo:vertical-align} {baseline} {\hbox} +\mapXMLvalue {fo:vertical-align} {sub} {\low} +\mapXMLvalue {fo:vertical-align} {super} {\high} +\mapXMLvalue {fo:vertical-align} {inherit} {\firstofoneargument} + +\startsetups fo:character:process + + % border + % font + % margin + % positioning + % baseline + % color + % depth and altitude + % keep-with + % lineheight + + \dontleavehmode \begingroup + + \directsetup{fe:setup} + \directsetup{fo:font:setup} + + \iftracingFO \ruledhbox \else \hbox \fi \bgroup + + \doifsomethingXMLop{vertical-align} + {\doifXMLvalelse{fo:vertical-align}{\XMLop{vertical-align}} + {\XMLval{fo:vertical-align}{\XMLop{vertical-align}}{}} + {\wordshiftamount\lineheight + \setpercentdimen\wordshiftamount{\XMLop{vertical-align}} + \shiftedword}} + + {\directsetup{fo:character:orient}} + + \egroup \endgroup + +\stopsetups + +\startsetups fo:character:orient + +% \rotate[rotation=-\XMLop{glyph-orientation-horizontal}] + + \doifsomethingXMLop{glyph-orientation-horizontal} + {\rotate[rotation=\XMLval{fo:reference-orientation}{\XMLop{glyph-orientation-horizontal}}{0}]} + {\XMLop{character}} + +\stopsetups + +%D fo:initial-property-set + +% \XMLattributeset{fo:aural}, +% color=, +% letter-spacing=, +% line-height=, +% text-transform=, +% word-spacing=, + +\defineXMLprocess + [fo:initial-property-set] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:relative-position}, + score-spaces=, + text-decoration=, + text-shadow=] + +%D fo:external-graphic + +\useMPlibrary[dum] + +% \XMLattributeset{fo:aural}, +% display-align=, +% height=, +% text-align=, + +\defineXMLenvironmentsave + [fo:external-graphic] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:relative-position}, + alignment-adjust=, + alignment-baseline=, + baseline-shift=, + block-progression-dimension=, + clip=, + content-height=, + content-type=, + content-width=, + dominant-baseline=, + height=, + inline-progression-dimension=, + keep-with-next=, + keep-with-previous=, + overflow=, + scaling=, + scaling-method=, + src=dummy, + width=] + {} + {\directsetup{fo:external-graphic:process}} + +\newdimen\FOgraphicwidth +\newdimen\FOgraphicheight + +\mapXMLvalue {external-graphic:align} {top} {\tbox} +\mapXMLvalue {external-graphic:align} {bottom} {\bbox} +\mapXMLvalue {external-graphic:align} {center} {\cbox} + +\startsetups fo:external-graphic:process + + \doifelsenothing{\XMLop{content-height}} + {\FOgraphicheight\zeropoint} + {\doifelse{\XMLop{content-height}}{scale-to-fit}% is this official ? + {\FOgraphicwidth\zeropoint} + {\doifelse{\XMLop{content-height}}{auto} + {\FOgraphicheight\zeropoint} + {\FOgraphicheight\lineheight + \setpercentdimen\FOgraphicheight{\XMLop{content-height}}}}} + + \doifelsenothing{\XMLop{content-width}} + {\FOgraphicwidth\zeropoint} + {\doifelse{\XMLop{content-width}}{scale-to-fit}% is this official ? + {\FOgraphicwidth\zeropoint} + {\doifelse{\XMLop{content-width}}{auto} + {\FOgraphicwidth\zeropoint} + {\FOgraphicwidth1em + \setpercentdimen\FOgraphicwidth {\XMLop{content-width}}}}} + + % leeg maken vars gaat ook goed, dan een \externalfigure + + % todo : height/width scale-to-fit: factor=... + + \setbox\scratchbox\hbox + {\setFOimagename{\XMLpar{fo:external-graphic}{src}{dummy}} + \ifdim\FOgraphicheight>\zeropoint + \ifdim\FOgraphicwidth>\zeropoint + \externalfigure[\FOimagename][height=\FOgraphicheight,width=\FOgraphicwidth] + \else + \externalfigure[\FOimagename][height=\FOgraphicheight] + \fi + \else + \ifdim\FOgraphicwidth>\zeropoint + \externalfigure[\FOimagename][width=\FOgraphicwidth] + \else + \externalfigure[\FOimagename] + \fi + \fi} + + \dontleavehmode \XMLval{external-graphic:align}{\XMLop{vertical-align}}{}{\box\scratchbox} + +\stopsetups + +%D fo:instream-foreign-object + +% like external-graphic, only no src + +% \XMLattributeset{fo:aural}, +% display-align=, +% line-height=, +% text-align=, + +\defineXMLprocess + [fo:instream-foreign-object] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:relative-position}, + alignment-adjust=, + alignment-baseline=, + baseline-shift=, + block-progression-dimension=, + clip=, + content-height=, + content-type=, + content-width=, + dominant-baseline=, + height=, + inline-progression-dimension=, + keep-with-next=, + keep-with-previous=, + overflow=, + scaling=, + scaling-method=, + width=] + +%D Element: fo:inline + +% \XMLattributeset{fo:aural}, +% line-height=, +% wrap-option=, +% color=, +% keep-together=, + +\defineXMLnestedenvironmentsave + [fo:inline] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:relative-position}, + alignment-adjust=, + alignment-baseline=, + baseline-shift=, + block-progression-dimension=, + dominant-baseline=, + height=, + inline-progression-dimension=, + keep-with-next=, + keep-with-previous=, + text-decoration=, + visibility=, + width=] + {\beginXMLelement} + {\directsetup{fo:inline:process}\endXMLelement} + +\defineXMLsingular + [fo:inline] + {} + +% baseline-shift: baseline sub super % dimen inherit + +\chardef\isolatedwordsmode=1 + +\newdimen\wordshiftamount + +\def\shiftedword{\raise\wordshiftamount\hbox} + +\long\def\shiftedwords#1{\processisolatedwords{#1}\shiftedword} +\long\def\normalwords #1{\processisolatedwords{#1}\hbox} +\long\def\highwords #1{\processisolatedwords{#1}\high} +\long\def\lowwords #1{\processisolatedwords{#1}\low} + +\mapXMLvalue {fo:baseline-shift} {baseline} {\normalwords} +\mapXMLvalue {fo:baseline-shift} {sub} {\lowwords} +\mapXMLvalue {fo:baseline-shift} {super} {\highwords} +\mapXMLvalue {fo:baseline-shift} {inherit} {\firstofoneargument} + +\startsetups fo:inline:process + + \directsetup{fo:position:start} + + \dontleavehmode + + \doFOreference{fo:inline} + + \begingroup + + \directsetup{fe:setup} + \directsetup{fo:space:start} + + \begingroup + + \directsetup{fo:hyphenation:setup} + \directsetup{fo:font:setup} + + \doifelsenothing{\XMLop{baseline-shift}} + {\XMLflushself} + {\doifXMLvalelse{fo:baseline-shift}{\XMLop{baseline-shift}} + {\XMLval{fo:baseline-shift}{\XMLop{baseline-shift}}{}{\XMLflushself}} + {\wordshiftamount\lineheight + \setpercentdimen\wordshiftamount{\XMLop{baseline-shift}} + \shiftedwords{\XMLflushself}}} + + \endgroup + + \directsetup{fo:space:end} + + \endgroup + + \directsetup{fo:position:stop} + +\stopsetups + +\startsetups fo:position:start + \begingroup + \directsetup{fo:position:\XMLop{position}:start} + \begingroup +\stopsetups + +\startsetups fo:position:stop + \endgroup + \directsetup{fo:position:\XMLop{position}:stop} + \endgroup +\stopsetups + +\startsetups fo:position:static:start +\stopsetups + +\startsetups fo:position:static:stop +\stopsetups + +\startsetups fo:position:fixed:start + \FOcontainerWW\paperwidth + \FOcontainerHH\paperheight + \def\FOlayername{regions} + \directsetup{fo:preset:layer} + \setlayer[regions]{\vbox \bgroup \setlocalhsize} +\stopsetups + +\startsetups fo:position:fixed:stop + \egroup +\stopsetups + +\enableparpositions % slows down but who uses fo anyway ... + +\startsetups fo:position:absolute:start + \setbox\FOpositionbox\hbox\bgroup +\stopsetups + +\startsetups fo:position:absolute:stop + \egroup + % evt uitstellen tot otr, zodat text/realfolio is solved + \edef\FOpartag{p:\number\parposcounter} + \edef\FOtxttag{text:\realfolio} + \FOcontainerWW\MPplus\FOpartag{1}{0pt} + \FOcontainerHH\zeropoint % todo: add anchors to each 'object' + \directsetup{fo:preset:position} + \setlayer + [xsl-region-body] + [preset=lefttop, + hoffset=\dimexpr(\MPx\FOtxttag-\MPx\FOpartag), + voffset=\dimexpr(\MPy\FOtxttag+\MPh\FOtxttag-\MPy\FOpartag-\MPh\FOpartag)] + {\iftracingFO \ruledhbox \bgroup \fi + \offset + [method=fixed, + leftoffset=\FOcontainerL, + rightoffset=\FOcontainerR, + topoffset=\FOcontainerT, + bottomoffset=\FOcontainerB] + {\box\FOpositionbox} + \iftracingFO \egroup \fi} +\stopsetups + +\newbox\FOpositionbox + +\startsetups fo:position:relative:start + \setbox\FOpositionbox\hbox\bgroup +\stopsetups + +\startsetups fo:position:relative:stop + \egroup + \FOcontainerWW\wd\FOpositionbox + \FOcontainerHH\dimexpr(\ht\FOpositionbox+\dp\FOpositionbox) + \directsetup{fo:preset:position} + \iftracingFO \ruledhbox \bgroup \fi + \offset + [method=fixed, + leftoffset=\FOcontainerL, + rightoffset=\FOcontainerR, + topoffset=\FOcontainerT, + bottomoffset=\FOcontainerB] + {\box\FOpositionbox} + \iftracingFO \egroup \fi +\stopsetups + +% + +\startsetups fo:preset:position + + \FOcontainerW\zeropoint \FOcontainerL\zeropoint \FOcontainerR\zeropoint + \FOcontainerH\zeropoint \FOcontainerT\zeropoint \FOcontainerB\zeropoint + + \doifnot{\XMLop{left}} {auto}{\FOcontainerL\FOcontainerWW\setpercentdimen\FOcontainerL{\XMLop{left}}} + \doifnot{\XMLop{right}} {auto}{\FOcontainerR\FOcontainerWW\setpercentdimen\FOcontainerR{\XMLop{right}}} + \doifnot{\XMLop{top}} {auto}{\FOcontainerT\FOcontainerHH\setpercentdimen\FOcontainerT{\XMLop{top}}} + \doifnot{\XMLop{bottom}}{auto}{\FOcontainerB\FOcontainerHH\setpercentdimen\FOcontainerB{\XMLop{bottom}}} + + \doifnot{\XMLop{width}} {auto}{\FOcontainerW\FOcontainerWW\setpercentdimen\FOcontainerW{\XMLop{width}}} + \doifnot{\XMLop{height}}{auto}{\FOcontainerH\FOcontainerHH\setpercentdimen\FOcontainerH{\XMLop{height}}} + +\stopsetups + +\startsetups fo:preset:layer + + \directsetup{fo:preset:position} + + \setuplayer + [\FOlayername] + [width=\FOcontainerWW, + height=\FOcontainerHH] + + \ifzeropt\FOcontainerW + \FOcontainerW\dimexpr(\FOcontainerWW-\FOcontainerL-\FOcontainerR) + \fi + \ifzeropt\FOcontainerH + \FOcontainerH\dimexpr(\FOcontainerHH-\FOcontainerT-\FOcontainerB) + \fi + + \ifzeropt\FOcontainerB + \ifzeropt\FOcontainerL + \setuplayer[\FOlayername][preset=righttop, x=\FOcontainerR,y=\FOcontainerT] + \else + \setuplayer[\FOlayername][preset=lefttop, x=\FOcontainerL,y=\FOcontainerT] + \fi + \else + \ifzeropt\FOcontainerL + \setuplayer[\FOlayername][preset=rightbottom,x=\FOcontainerR,y=\FOcontainerB] + \else + \setuplayer[\FOlayername][preset=leftbottom, x=\FOcontainerL,y=\FOcontainerB] + \fi + \fi + +\stopsetups + +%D Element: fo:inline-container + +% display-align=, +% line-height=, +% reference-orientation=, +% writing-mode=, +% keep-together=, + +\defineXMLenvironment + [fo:inline-container] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:relative-position}, + alignment-adjust=, + alignment-baseline=, + baseline-shift=, + block-progression-dimension=, + clip=, + dominant-baseline=, + height=, + inline-progression-dimension=, + keep-with-next=, + keep-with-previous=, + overflow=, + width=] + {\beginXMLelement\begingroup} + {\endgroup\endXMLelement} + +%D Element: fo:leader + +% also a kind of fake fill + +% \XMLattributeset{fo:aural}, +% color=, +% line-height=, +% word-spacing=, + +\defineXMLenvironmentsave + [fo:leader] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:relative-position}, + \XMLattributeset{fo:leader-and-rule}, + alignment-adjust=, + alignment-baseline=, + baseline-shift=, + dominant-baseline=, + % text-depth=, + % text-altitude=, + keep-with-next=, + keep-with-previous=, + letter-spacing=, + text-shadow=, + visibility=] + {\beginXMLelement} + {\directsetup{fo:leader:process}\endXMLelement} + +\mapXMLvalue {fo:leader-pattern} {space} {\hfill} +\mapXMLvalue {fo:leader-pattern} {dots} {.} +\mapXMLvalue {fo:leader-pattern} {rule} {\hrulefill} +\mapXMLvalue {fo:leader-pattern} {use-content} {\XMLflushself} + +% todo: speed up + +\startsetups fo:leader:process + + %tracebackXMLattribute{leader-pattern-width} + + \strut \leaders + %edefXMLinh \FOlepatwd {leader-pattern-width} + \hbox to \XMLinh{leader-pattern-width} + {\hss\XMLval{fo:leader-pattern}{\XMLinh{leader-pattern}}{\hfill}\hss} + \hfill \strut + +\stopsetups + +%D Element: fo:pagenumber + +% \XMLattributeset{fo:aural}, +% line-height=, +% wrap-option=, +% letter-spacing=, +% text-transform=, +% word-spacing=, + +\defineXMLsingular + [fo:page-number] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:relative-position}, + alignment-adjust=, + alignment-baseline=, + baseline-shift=, + dominant-baseline=, + keep-with-next=, + keep-with-previous=, + score-spaces=, +% text-altitude=, + text-decoration=, +% text-depth=, + text-shadow=, + visibility=] + {\directsetup{fo:page-number:process}} + +\newcount\FOpnrefcounter + +\startsetups fo:page-number:process + + \doifelsenothing{\XMLpar{fo:page-sequence}{format}{}} + {\pagenumber} + {\ifinotr + \globallet\FOpnrefnumber\folio + \else + \global\advance\FOpnrefcounter\plusone + \pagereference[pnref:\the\FOpnrefcounter] + \doifreferencefoundelse{pnref:\the\FOpnrefcounter} + {\globallet\FOpnrefnumber\currentfolioreference} + {\globallet\FOpnrefnumber\folio} + \fi + \expanded{\handletokens\XMLpar{fo:page-sequence}{format}{}}\with{\handleFOformat{\FOpnrefnumber}}} + +\stopsetups + +\defineconversion[1][\numbers] + +\long\def\handleFOformat#1#2% + {\defconvertedargument\ascii{#2}% + \doifconversiondefinedelse\ascii{\convertnumber\ascii{#1}}{#2}} + +%D Element: fo:pagenumber-citation + +% same as page-number + +% \XMLattributeset{fo:aural}, +% line-height=, +% wrap-option=, +% letter-spacing=, +% text-transform=, +% word-spacing=, + +\defineXMLsingular + [fo:page-number-citation] + [\XMLattributeset{fo:inherited}, + id=, + ref-id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:font}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:relative-position}, + alignment-adjust=, + alignment-baseline=, + baseline-shift=, + dominant-baseline=, + keep-with-next=, + keep-with-previous=, + score-spaces=, +% text-altitude=, + text-decoration=, +% text-depth=, + text-shadow=, + visibility=] + {\directsetup{fo:page-number-citation:process}} + +\startsetups fo:page-number-citation:process + + \doifreferencefoundelse{\XMLop{ref-id}} + {\globallet\FOpnrefnumber\currentfolioreference + \globallet\FOpnrefformat\currenttextreference} + {\gdef\FOpnrefnumber{?} + \gdef\FOpnrefformat{}} + + \doifelsenothing{\FOpnrefformat} + {\FOpnrefnumber} + {\expanded{\handletokens\FOpnrefformat}\with{\handleFOformat{\FOpnrefnumber}}} + +\stopsetups + +%D Element: fo:table-and-caption + +% \XMLattributeset{fo:aural}, +% text-align=, +% caption-side=, +% intrusion-displace=, +% keep-together=, + +\defineXMLenvironment + [fo:table-and-caption] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-block}, + \XMLattributeset{fo:relative-position}, + break-after=, + break-before=, + keep-with-next=, + keep-with-previous=] + {\beginXMLelement} + {\endXMLelement} + +%D Element: fo:table fo:table-caption fo:table-header fo:table-footer +%D to:table-column fo:table-body fo:table-row fo:table-cell + +% \XMLattributeset{fo:aural}, +% border-collapse=, +% border-separation=, +% intrusion-displace=, +% keep-together=, +% writing-mode=, + +\defineXMLenvironment + [fo:table] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-block}, + \XMLattributeset{fo:relative-position}, + block-progression-dimension=, + border-after-precedence=, + border-before-precedence=, + border-start-precedence=, + border-end-precedence=, + break-after=, + break-before=, + inline-progression-dimension=, + height=, + keep-with-next=, + keep-with-previous=, + table-layout=, + table-omit-footer-at-break=, + table-omit-header-at-break=, +% text-indent=0pt, % yes or no? + width=] + {\beginXMLelement + \bTABLE % [option=stretch] % + \newcounter\FOtablecolumn} + {\eTABLE + \endXMLelement} + +\newdimen\FOtableW +\newdimen\FOtableH + +\defineXMLsingular + [fo:table-column] + [\XMLattributeset{fo:inherited}, + \XMLattributeset{fo:border-padding-background}, % only background, not the rest, make subset + border-after-precedence=, + border-before-precedence=, + border-end-precedence=, + border-start-precedence=, + column-width=, + column-number=, + number-columns-repeated=, + number-columns-spanned=, + visibility=] + {\directsetup{fo:table-column:action}} + +% \XMLattributeset{fo:aural}, +% intrusion-displace=, +% keep-together=, + +\defineXMLprocess + [fo:table-caption] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:relative-position}, + block-progression-dimension=, + height=, + inline-progression-dimension=, + width=] + +% \XMLattributeset{fo:aural}, + +\defineXMLnested + [fo:table-header] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:relative-position}, + border-after-precedence=, + border-before-precedence=, + border-end-precedence=, + border-start-precedence=, + visibility=] + {\beginXMLelement\bTABLEhead} + {\eTABLEhead\endXMLelement} + +% \XMLattributeset{fo:aural}, + +\defineXMLnested + [fo:table-footer] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:relative-position}, + border-after-precedence=, + border-before-precedence=, + border-end-precedence=, + border-start-precedence=, + visibility=] + {\beginXMLelement\bTABLEfoot} + {\eTABLEfoot\endXMLelement} + +% \XMLattributeset{fo:aural}, + +\defineXMLnested + [fo:table-body] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:relative-position}, + border-after-precedence=, + border-before-precedence=, + border-end-precedence=, + border-start-precedence=, + visibility=] + {\beginXMLelement\bTABLEbody} + {\eTABLEbody\endXMLelement} + +% TODO: when stretch and when not + +% \XMLattributeset{fo:aural}, +% keep-together=, + +\defineXMLnested + [fo:table-row] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:relative-position}, + border-after-precedence=, + border-before-precedence=, + border-end-precedence=, + border-start-precedence=, + break-after=, + break-before=, + height=, + keep-with-next=, + keep-with-previous=, + visibility=] + {\beginXMLelement + \directsetup{fo:table-row:start}% + \expanded{\bTR[\the\scratchtoks]}% + \beginXMLelement} + {\endXMLelement + \eTR + \directsetup{fo:table-row:stop} + \endXMLelement} + +\startsetups fo:table-row:start + + \inTABLErowtrue + + \scratchtoks\emptytoks + + \doifsomething{\XMLop{height}} + {\FOtableH\textheight + \setpercentdimen\FOtableH{\XMLop{height}} + \appendetoks + height=\the\FOtableH + \to \scratchtoks} + + \appendetoks + ,extras={\rescanXMLattributes{fo:table-row}} + \to\scratchtoks + +\stopsetups + +\startsetups fo:table-row:stop + + \inTABLErowfalse + +\stopsetups + +% \XMLattributeset{fo:aural}, +% display-align=, +% relative-align=, +% empty-cells=, + +\newif\ifinTABLErow +\newdimen\FOtablecellwidth +\newdimen\FOtablecellheight + +\defineXMLnested + [fo:table-cell] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:relative-position}, + border-after-precedence=, + border-before-precedence=, + border-end-precedence=, + border-start-precedence=, + column-number=, + ends-row=, + height=, + inline-progression-dimension=, + number-columns-spanned=1, + number-rows-spanned=1, + starts-row=, + width=] + {\directsetup{fo:table-cell:start}% + \expanded{\bTD[\the\scratchtoks]}% + \beginXMLelement} + {\endXMLelement + \eTD + \directsetup{fo:table-cell:stop}} + +\startsetups fo:table-column:action + + \doifelsenothing{\XMLop{column-number}} + {\increment\FOtablecolumn} + {\edef\FOtablecolumn{\XMLop{column-number}} + \expanded{\setupTABLE[column][\FOtablecolumn][n=\FOtablecolumn]}} + + \doifsomething{\XMLop{column-width}} + {%\setlocalhsize + %\FOtableW\localhsize + \analyzefunction{\XMLop{column-width}}% + % hm, we need to set localhsize earlier + \doifelse\functionname{proportional-column-width} + {\FOtableW\functionA\textwidth} + {\FOtableW\textwidth + \setpercentdimen\FOtableW{\XMLop{column-width}}}% + \expanded{\setupTABLE[column][\FOtablecolumn][width=\the\FOtableW]}} + + \doif{\XMLop{border-style}}{none} + {\expanded{\setupTABLE[column][\FOtablecolumn][frame=off]}} + + \doifelsenothing{\XMLop{display-align}} + {\doifsomething{\XMLop{text-align}} + {\expanded{\setupTABLE[column][\FOtablecolumn] + [align=\XMLpav{fo:align-key}{fo:table-column}{text-align}{normal}]}}} + {\doifsomething{\XMLop{text-align}} + {\expanded{\setupTABLE[column][\FOtablecolumn] + [align={\XMLpav{fo:display-align}{fo:table-column}{display-align}{high},\XMLpav{fo:align-key}{fo:table-column}{text-align}{normal}}]}} + {\expanded{\setupTABLE[column][\FOtablecolumn] + [align=\XMLpav{fo:display-align}{fo:table-column}{display-align}{high}]}}} + +\expanded{\setupTABLE[column][\FOtablecolumn][extras={\rescanXMLattributes{fo:table-column}}]} + +\stopsetups + +\startsetups fo:table-cell:start + + \doif{\XMLop{starts-row}}{true}{\ifinTABLErow\eTR\inTABLErowfalse\fi} + + \ifinTABLErow\else\bTR\inTABLErowtrue\fi + + \doifelsenothing{\XMLop{background-color}} + {\let\FoTableBG\empty} + {\checkhexcolor[\XMLop{background-color}] + \doifcolorelse{\XMLop{background-color}} + {\def\FoTableBG{color}} + {\setXMLpar{fo:table-cell}{background-color}{} + \let\FoTableBG\empty}} + +% \doifelse{\XMLpar{fo:table-cell}{width}{}}{} +% {\def\pFOtablewidth{fit}} +% {\FOtablecellwidth\textwidth % probably must be localhsize or frozen at an outer level +% \setpercentdimen\FOtablecellwidth{\XMLpar{fo:table-cell}{width}{0pt}}% +% \edef\pFOtablewidth{\the\FOtablecellwidth}}% + +% \doifelse{\XMLpar{fo:table-cell}{height}{}}{} +% {\def\pFOtableheight{fit}} +% {\FOtablecellheight\textheight % probably must be localhsize or frozen at an outer level +% \setpercentdimen\FOtablecellheight{\XMLpar{fo:table-cell}{height}{0pt}}% +% \edef\pFOtableheight{\the\FOtablecellheight}}% + + \scratchtoks\emptytoks \appendetoks +% style=\noexpand\directsetup{fo:font:setup}, % else not expanded + nx=\XMLop{number-columns-spanned}, + ny=\XMLop{number-rows-spanned}, + n=\XMLop{column-number}, + background=\FoTableBG + \to \scratchtoks + + \doifnot{\XMLop{border-style}}{none} + {\appendetoks + ,frame=on + \to\scratchtoks} + + \doifsomething{\XMLop{background-color}} + {\appendetoks + ,backgroundcolor=\XMLop{background-color} + \to \scratchtoks} + + % todo : padding + + \doifsomething{\XMLop{padding}} + {\appendetoks + ,offset=\XMLop{padding} + \to \scratchtoks} + + % todo: interference with presets in column (outer level) -> \setupcolumn[column] ...; + % misschien meerdere align switches + + \doifelsenothing{\XMLop{display-align}} + {\doifsomething{\XMLop{text-align}} + {\appendetoks + ,align=\XMLpav{fo:align-key}{fo:table-cell}{text-align}{normal} + \to \scratchtoks}} + {\doifsomething{\XMLop{text-align}} + {\appendetoks + ,align={\XMLpav{fo:display-align}{fo:table-cell}{display-align}{high},\XMLpav{fo:align-key}{fo:table-cell}{text-align}{normal}}, + \to \scratchtoks} + {\appendetoks + ,align=\XMLpav{fo:display-align}{fo:table-cell}{display-align}{high} + \to \scratchtoks}} + + \appendetoks + ,extras={\rescanXMLattributes{fo:table-cell}} + \to\scratchtoks + +\stopsetups + +% \startsetups fo:table-cell:setup + +% [\XMLpar{fo:table-cell}{text-indent}{}] + +% \edefXMLinhpar\xFOtextindent{fo:table-cell}{text-indent} + +% \doifsomething\xFOtextindent +% {\scratchdimen\hsize +% \setpercentdimen\scratchdimen\xFOtextindent +% \expanded{\setupindenting[\the\scratchdimen]}} + +% \stopsetups + +\startsetups fo:table-cell:stop + + \doif{\XMLop{ends-row}}{true}{\eTR\inTABLErowfalse} + +\stopsetups + +%D Element: fo:list-block fo:list-item fo:list-body fo:list-item-label + +% \XMLattributeset{fo:aural}, +% intrusion-displace=, +% keep-together=, +% provisional-distance-between-starts=24pt, +% provisional-label-separation=6pt, + +\defineXMLenvironment + [fo:list-block] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fe:tracing}, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-block}, + \XMLattributeset{fo:relative-position}, + break-after=, + break-before=, + keep-with-next=, +% space-between-list-rows=, % ? mentioned in bradley +text-indent=0pt, % yes + keep-with-previous=] + {\beginXMLelement\directsetup{fo:list:start}} + {\directsetup{fo:list:stop}\endXMLelement} + +\startsetups fo:list:start + \endgraf + \begingroup + \directsetup{fe:setup} + \disablemode[fo:in-list] + % \forgetall, no! +% \directsetup{fo:break-and-space:before} + \directsetup{fo:indent:setup} + \begingroup +\stopsetups + +\startsetups fo:list:stop + \endgraf + \endgroup +% \directsetup{fo:break-and-space:after} + \endgroup +\stopsetups + +% \XMLattributeset{fo:aural}, +% relative-align=, +% intrusion-displace=, +% keep-together=, + +% The list model is plain stupid. Instead of just defining a few mechanism +% or using some kind of type attribute, a strange mechanism of functions is +% used. Why on the one hand introduce redundant attributes and on the other +% hand safe a few elements. A proper segmentation of the problem would have +% brought better solutions. + +\defineXMLenvironment + [fo:list-item] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fe:tracing}, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-block}, + \XMLattributeset{fo:relative-position}, + break-after=, + break-before=, + keep-with-next=, + keep-with-previous=] + {\beginXMLelement\directsetup{fo:list-item:start}} + {\directsetup{fo:list-item:stop}\endXMLelement} + +% check what is needed + +\newdimen\FOlistitemlabelhsize \newdimen\FOlistitembodyhsize \newdimen\FOlistitemdistance +\newdimen\FOlistitemlabelleftskip \newdimen\FOlistitembodyleftskip +\newdimen\FOlistitemlabelrightskip \newdimen\FOlistitembodyrightskip + +\defineXMLnestedsave + [fo:list-item-body] + [\XMLattributeset{fo:inherited}, + id=, % keep-together=, + \XMLattributeset{fo:accessibility}] + +\defineXMLnestedsave + [fo:list-item-label] + [\XMLattributeset{fo:inherited}, + id=, % keep-together=, + \XMLattributeset{fo:accessibility}] + +\startsetups fo:list-item:start + + \bgroup + +% \startmode[fo:in-list] +% \doifsomething{\XMLpar{fo:list-block}{space-between-list-rows}{}} +% {\vskip\XMLpar{fo:list-block}{space-between-list-rows}{}} % todo ! ! ! ! +% \stopmode + + \enablemode[fo:in-list] + +\stopsetups + +% todo : relative-align in list item + +\newif\ifFOlabelend +\newif\ifFObodystart + +\startsetups fo:list-item:stop + + % 24pt en 6pt in fo:root instellen + + % \tracebackXMLattribute{provisional-distance-between-starts} + + \edefXMLinh \FOprodis {provisional-distance-between-starts} + \edefXMLinh \FOprolab {provisional-label-separation} + +% \edef\FOprodis{\XMLpar{fo}{provisional-distance-between-starts}{}} +% \edef\FOprolab{\XMLpar{fo}{provisional-label-separation}{}} + + \edef\FOprodis{\ifx\FOprodis\empty24pt\else\FOprodis\fi} + \edef\FOprolab{\ifx\FOprolab\empty 6pt\else\FOprolab\fi} + + \setlocalhsize + + \FOlistitemlabelleftskip \zeropoint + \FOlistitemlabelrightskip\zeropoint + \FOlistitembodyleftskip \zeropoint + \FOlistitembodyrightskip \zeropoint + + \doifelse{\XMLpar{fo:list-item-label}{end-indent} {}}{label-end()} \FOlabelendtrue \FOlabelendfalse + \doifelse{\XMLpar{fo:list-item-body} {start-indent}{}}{body-start()}\FObodystarttrue\FObodystartfalse + + \setpercentdimen\FOlistitemlabelleftskip {\XMLpar{fo:list-item-label}{start-indent}{0pt}} + \setpercentdimen\FOlistitembodyrightskip {\XMLpar{fo:list-item-body} {end-indent} {0pt}} + + % maybe i need to implement something configurable + + \ifFObodystart + \ifFOlabelend + \FOlistitemlabelrightskip\dimexpr(\localhsize-\FOlistitemlabelleftskip-\FOprodis+\FOprolab) + \FOlistitembodyleftskip\dimexpr(\FOlistitemlabelleftskip+\FOprodis) + \FOlistitemlabelhsize\dimexpr(\FOprodis-\FOprolab) + \else + \setpercentdimen\FOlistitemlabelrightskip{\XMLpar{fo:list-item-label}{end-indent}{0pt}} + \FOlistitemlabelhsize\dimexpr(\localhsize-\FOlistitemlabelleftskip-\FOlistitemlabelrightskip) + \FOlistitembodyleftskip\dimexpr(\FOlistitemlabelleftskip+\FOlistitemlabelhsize+\FOprolab) + \fi + \FOlistitemdistance \dimexpr(\FOprolab) + \else + \setpercentdimen\FOlistitembodyleftskip{\XMLpar{fo:list-item-body}{start-indent}{0pt}} + \ifFOlabelend + \FOlistitemlabelrightskip\dimexpr(\localhsize-\FOlistitembodyleftskip+\FOprolab) + \FOlistitemlabelhsize\dimexpr(\localhsize-\FOlistitemlabelleftskip-\FOlistitemlabelrightskip) + \FOlistitemdistance \dimexpr(\FOprolab) + \else + \setpercentdimen\FOlistitemlabelrightskip{\XMLpar{fo:list-item-label}{end-indent}{0pt}} + \FOlistitemlabelhsize\dimexpr(\localhsize-\FOlistitemlabelleftskip-\FOlistitemlabelrightskip) + \FOlistitemdistance \dimexpr(\FOlistitembodyleftskip-\FOlistitemlabelleftskip-\FOlistitemlabelhsize) + \fi + \fi + + % is this fall back permitted ? + + \ifzeropt\FOlistitemlabelleftskip \ifzeropt\FOlistitemlabelrightskip + \FOlistitembodyleftskip\FOprodis + \FOlistitemdistance\FOprolab + \FOlistitemlabelhsize\dimexpr(\FOlistitembodyleftskip-\FOlistitemdistance) + \fi \fi + + % + + \FOlistitembodyhsize\localhsize + + \advance\FOlistitembodyhsize-\FOlistitembodyleftskip + \advance\FOlistitembodyhsize-\FOlistitembodyrightskip + + \doifelse{\XMLpar{fo:list-item}{display-align}{}}{center} + {\directsetup{fo:list-item:display}} + {\directsetup{fo:list-item:text}} + + \egroup + +\stopsetups + +% todo: textindent + +\startsetups fo:list-item:display + + \endgraf + + \advance\leftskip \FOlistitemlabelleftskip + \advance\rightskip\FOlistitembodyrightskip + + \dontleavehmode \valign\bgroup\forgetall\vss##\vss\cr + \iftracingFO\ruledvtop\else\vbox\fi{\hsize\FOlistitemlabelhsize\directsetup{fo:list-item-label:setup}\XMLflush{fo:list-item-label}}\cr + \iftracingFO\ruledvtop\else\vbox\fi{\hsize\FOlistitembodyhsize \directsetup{fo:list-item-body:setup}\XMLflush{fo:list-item-body}}\cr + \egroup + +% \dontleavehmode \placesidebyside % or maybe paired boxes (legends) +% {\ruledvtop{\forgetall\hsize\FOlistitemlabelhsize\XMLflush{fo:list-item-label}}} +% {\ruledvtop{\forgetall\hsize\FOlistitembodyhsize \XMLflush{fo:list-item-body}}} + + \endgraf + +\stopsetups + +\newtoks\savedeverypar \savedeverypar\everypar + +\startsetups fo:list-item:text + + \everypar\savedeverypar % \appendtoksonce\insertparagraphintro\to\everypar % hack, binnen footnote ... + + \advance\leftskip \FOlistitembodyleftskip + \advance\rightskip\FOlistitembodyrightskip + + \setupparagraphintro[first][\directsetup{fo:list-item-label:process}] + \setupparagraphintro[next] [\begstrut\resetpenalties\clubpenalties] + \directsetup{fo:list-item-body:setup} + \XMLflush{fo:list-item-body}\endstrut + +\stopsetups + +\startsetups fo:list-item-label:setups + + \edefXMLinhpar\xFOtextindent{fo:item-label}{text-indent} + + \doifsomething\xFOtextindent + {\scratchdimen\hsize + \setpercentdimen\scratchdimen\xFOtextindent + \expanded{\setupindenting[\the\scratchdimen]}} + +\stopsetups + +\startsetups fo:list-item-body:setups + + \edefXMLinh\xFOtextindent{fo:item-body}{text-indent} + + \doifsomething\xFOtextindent + {\scratchdimen\hsize + \setpercentdimen\scratchdimen\xFOtextindent + \expanded{\setupindenting[\the\scratchdimen]}} + +\stopsetups + +\newbox\FOitembox + +\startsetups fo:list-item-label:process + + \setbox \FOitembox \iftracingFO \ruledvtop \else \vtop \fi \bgroup + \forgetall + \postponenotes + \hsize\FOlistitemlabelhsize + \directsetup{fo:list-item-label:setup} + \XMLflush{fo:list-item-label} + \egroup + \getnoflines{\dimexpr(\ht\FOitembox+\dp\FOitembox)} + \setpenalties\clubpenalties\noflines\maxdimen + \strut\llap{\box\FOitembox\hskip\FOlistitemdistance} + +\stopsetups + +% \setlocalhsize \hsize\localhsize + +%D Element: fo:basic-link + +% \XMLattributeset{fo:aural}, +% keep-together=, +% line-height=, + +\defineXMLenvironmentsave + [fo:basic-link] + [\XMLattributeset{fo:inherited}, + id=, + \XMLattributeset{fo:accessibility}, + \XMLattributeset{fo:border-padding-background}, + \XMLattributeset{fo:margin-inline}, + \XMLattributeset{fo:relative-position}, + alignment-adjust=, + alignment-baseline=, + baseline-shift=, + destination-placement-offset=, + dominant-baseline=, + external-destination=, + indicate-destination=, + internal-destination=, + keep-with-next=, + keep-with-previous=, + show-destination=, + target-processing-context=, + target-presentation-context=, + target-stylesheet=] + {} + {\directsetup{fo:basic-link}} + +\startsetups fo:basic-link + + \goto{\XMLflushself}[unknown] + +\stopsetups + +%D Element: fo:multi-switch fo:multi-case fo:multi-toggle fo:multi-properties fo:multi-property-set + +\defineXMLprocess[fo:multi-switch] +\defineXMLprocess[fo:multi-case] +\defineXMLprocess[fo:multi-toggle] +\defineXMLprocess[fo:multi-properties] +\defineXMLprocess[fo:multi-property-set] + +%D Element: fo:float + +\defineXMLenvironmentsave + [fo:float] + [\XMLattributeset{fo:inherited}, + float=before, + clear=] + {} + {\directsetup{fo:float:process}} + +% clear: start end left right both none inherit +% float: before start end left right none + +\mapXMLvalue {fo:float-position} {before} {here} % todo +\mapXMLvalue {fo:float-position} {start} {here} % todo +\mapXMLvalue {fo:float-position} {end} {here} % todo +\mapXMLvalue {fo:float-position} {left} {left} +\mapXMLvalue {fo:float-position} {right} {right} +\mapXMLvalue {fo:float-position} {none} {here} % todo + +\startsetups fo:float:process + + \placefigure + [\XMLval{fo:float-position}{\XMLop{float}},none] + {} + {\XMLflushself} + +\stopsetups + +%D Element: fo:footnote fo:footnote-body + +% Let's assume that 'whatever' contains the number or footnote marker. +% +% <fo:footnote>whatever<fo:footnote-body>note</fo:footnote-body></fo:footnote> + +% todo xsl-footnote area + +\defineXMLprocess + [fo:footnote] + [\XMLattributeset{fo:accessibility}] + +\defineXMLargument + [fo:footnote-body] + [\XMLattributeset{fo:accessibility}] + {\footnote[-]} + +%D Element: fo:wrapper + +\defineXMLenvironment % todo: all inheritable + [fo:wrapper] + [\XMLattributeset{fo:inherited}, + \XMLattributeset{fe:tracing}, + \XMLattributeset{fo:fonts}, + \XMLattributeset{fo:hyphenation}] + {\beginXMLelement\begingroup\directsetup{fo:wrapper}} + {\endgroup\endXMLelement} + +\startsetups fo:wrapper + + \directsetup{fe:setup} + \directsetup{fo:hyphenation:setup} + \directsetup{fo:font:setup} + +\stopsetups + +%D Element: fo:marker fo:retrieve-marker + +% In order to support 'retrieve-boundary' (page, page-sequence, +% document) I need to extend the context mark handler. + +% This object will probably interfere with a too spacy layout since +% it is unaware if its surrounding. + +\defineXMLenvironmentsave + [fo:marker] + [marker-class-name=unknown] + {} + {\directsetup{fo:marker:process}} + +\startsetups fo:marker:process + + \doifelsemarking{fo:\XMLop{marker-class-name}} + {} {\definerawmarking[fo:\XMLop{marker-class-name}]} + + \expanded{\marking[fo:\XMLop{marker-class-name}]{\XMLflushself}} + +\stopsetups + +\defineXMLcommand + [fo:retrieve-marker] + [retrieve-class-name=unknown, + retrieve-position=first-starting-within-page, + retrieve-boundary=] + {\directsetup{fo:retrieve-marker:process}} + +\mapXMLvalue {fo:marker-position} {first-starting-within-page} {first} % first mark +\mapXMLvalue {fo:marker-position} {first-including-carryover} {previous} % top mark +\mapXMLvalue {fo:marker-position} {last-starting-within-page} {first} % dunno +\mapXMLvalue {fo:marker-position} {last-ending-within-page} {last} % bot mark + +\startsetups fo:retrieve-marker:process + + \expanded{\getmarking + [fo:\XMLop{retrieve-class-name}] + [\XMLval{fo:marker-position}{\XMLop{retrieve-position}}{first}]} + +\stopsetups + +%D Auxiliary macros + +\unprotect + +\long\def\noFOchecks#1\od{} + +\def\FOassignskip#1#2#3% + {\edef\!!stringa{\XMLpar{#1}{#2}\empty}% + \edef\!!stringb{\XMLpar{#1}{#2.optimum}\empty}% + \edef\!!stringc{\XMLpar{#1}{#2.minimum}\empty}% + \edef\!!stringd{\XMLpar{#1}{#2.maximum}\empty}% + \dimen0=\ifx\!!stringa\empty\zeropoint\else\!!stringa\fi + \dimen2=\ifx\!!stringb\empty\dimen0 \else\!!stringb\fi + \dimen4=\dimexpr(\ifx\!!stringd\empty\dimen0 \else\!!stringd\fi-\dimen2)\relax + \dimen6=\dimexpr(\ifx\!!stringc\empty\dimen0 \else\!!stringc\fi-\dimen2)\relax + #3=\dimen2 \ifzeropt\dimen4 \else\!!plus\dimen4 \fi\ifzeropt\dimen6 \else\!!minus\dimen6 \fi\relax} + +\mapXMLvalue{fo:space:conditionality} {retain} {\let\next\retainedskip } +\mapXMLvalue{fo:space:conditionality} {discard} {\let\next\discardedskip} +\mapXMLvalue{fo:space:conditionality} {} {\let\next\discardedskip} + +\mapXMLvalue{fo:space:precedence} {force} {\let\next\forcedskip} + +\def\FOdoskip#1#2% + {\begingroup + \iftracingFO\showskips\fi + \FOassignskip{#1}{#2}\scratchskip + \XMLval{fo:space:conditionality}{\XMLpar{#1}{#2.conditionality}\empty}\empty + \XMLval{fo:space:precedence}{\XMLpar{#1}{#2.precedence}\empty}\empty + \ifdim\scratchskip=\zeropoint + \ifdim\gluestretch\scratchskip=\zeropoint + \ifdim\glueshrink\scratchskip=\zeropoint + \let\next\gobbleoneargument + \fi + \fi + \fi + \next\scratchskip + \endgroup} + +\def\doFObeforeskip#1{\FOdoskip{#1}{space-before}} +\def\doFOafterskip #1{\FOdoskip{#1}{space-after}} + +\def\FOassignspace#1#2#3% + {\edef\!!stringa{\XMLpar{#1}{#2}\empty}% + \ifx\!!stringa\empty + #3=\zeropoint + \else + #3=1em% ? + \setpercentdimen#3\!!stringa + \fi + \relax} + +\def\FOdospace#1#2% + {\begingroup + \iftracingFO\showskips\fi + \FOassignspace{#1}{#2}\scratchskip + \ifdim\scratchskip=\zeropoint \else + \hskip\scratchskip + \fi + \endgroup} + +\def\doFOstartspace#1{\FOdospace{#1}{space-start}} +\def\doFOendspace #1{\FOdospace{#1}{space-end}} + +\def\checkFOborder#1#2% + {\edef\FOattribute{\XMLpar{#1}{border-#2}\empty}% + \ifx\FOattribute\empty\else + \edef\FOtag{#1}% + \edef\FOatt{border-#2}% + \expanded{\docheckFOborder\FOattribute\space\relax\space\relax}\od + \fi} + +\def\docheckFOborder#1#2 #3% + {\ifx#1\relax + \expandafter\noFOchecks + \else + \doifhexcolorelse{#1#2} + {\setXMLpar\FOtag{\FOatt-color}{#1#2}} + {\doifelsenothing{\XMLval{fo:border-style}{#1#2}\empty} + {\doifcolorelse{#1#2} + {\setXMLpar\FOtag{\FOatt-color}{#1#2}} + {\setXMLpar\FOtag{\FOatt-width}{#1#2}}} + {\setXMLpar\FOtag{\FOatt-style}{#1#2}}}% + \expandafter\docheckFOborder + \fi#3} + +\def\checkFOposition#1#2% + {\edef\FOattribute{\XMLpar{#1}{#2-position}\empty}% + \ifx\FOattribute\empty\else + \edef\FOtag{#1}% + \edef\FOatt{#2-position}% + \scratchcounter\zerocount + \expanded{\docheckFOposition\FOattribute\space\relax\space\relax}\od + \fi} + +\def\docheckFOposition#1#2 #3% + {\ifx#1\relax + \expandafter\noFOchecks + \else + \advance\scratchcounter\plusone + \ifcase\scratchcounter + \or + \setXMLpar\FOtag{\FOatt-vertical}{#1#2}% + \or + \setXMLpar\FOtag{\FOatt-horizontal}{#1#2}% + \fi + \expandafter\docheckFOposition + \fi#3} + +\def\checkFOpadding{\def\FOatt{padding}\checkFOquadruple} +\def\checkFOmargin {\def\FOatt{margin}\checkFOquadruple} + +\def\checkFOquadruple#1% + {\edef\FOattribute{\XMLpar{#1}\FOatt\empty}% + \ifx\FOattribute\empty\else + \edef\FOtag{#1}% + \scratchcounter\zerocount + \expanded{\docheckFOquadruple\FOattribute\space\relax\space\relax}\od + \ifcase\scratchcounter + \let\FOattributeT\FOattribute + \let\FOattributeR\FOattribute + \let\FOattributeB\FOattribute + \let\FOattributeL\FOattribute + \or % (tblr) + \let\FOattributeT\FOattribute + \let\FOattributeR\FOattribute + \let\FOattributeB\FOattribute + \let\FOattributeL\FOattribute + \or % (tb)(lr) + \let\FOattributeB\FOattributeT + \let\FOattributeL\FOattributeR + \or % (t)(lr)(b) + \let\FOattributeL\FOattributeR + \or % (t)(r)(b)(l) + % already ok + \fi + \letXMLpar\FOtag{\FOatt-top}\FOattributeT + \letXMLpar\FOtag{\FOatt-right}\FOattributeR + \letXMLpar\FOtag{\FOatt-bottom}\FOattributeB + \letXMLpar\FOtag{\FOatt-left}\FOattributeL + \fi} + +\def\docheckFOquadruple#1#2 #3% + {\ifx#1\relax + \expandafter\noFOchecks + \else + \advance\scratchcounter\plusone + \ifcase\scratchcounter + \or + \edef\FOattributeT{#1#2}% + \or + \edef\FOattributeR{#1#2}% + \or + \edef\FOattributeB{#1#2}% + \or + \edef\FOattributeL{#1#2}% + \fi + \expandafter\docheckFOquadruple + \fi#3} + +% \def\setFOimagename#1% +% {\edef\FOimagename{#1}% +% \aftersplitstring \FOimagename\at url('\to\xFOimagename +% \ifx\xFOimagename\empty \else +% \beforesplitstring\xFOimagename\at ')\to\FOimagename +% \fi +% \aftersplitstring \FOimagename\at url("\to\xFOimagename +% \ifx\xFOimagename\empty \else +% \beforesplitstring\xFOimagename\at ")\to\FOimagename +% \fi} +% +% let's overkill: + +\def\setFOimagename#1% + {\analyzefunction{#1}% + \doifelse\functionname{url} + {\edef\FOimagename{\@EA\unstringed\functionA}} + {\ifx\functionname\empty + \def\FOimagename{#1}% + \else + \def\FOimagename{dummy}% + \fi}} + +% font + +\mapXMLvalue {fo:weight} {normal} {} +\mapXMLvalue {fo:weight} {bold} {bold} +\mapXMLvalue {fo:weight} {bolder} {bold} +\mapXMLvalue {fo:weight} {lighter} {normal} +\mapXMLvalue {fo:weight} {100} {normal} +\mapXMLvalue {fo:weight} {200} {normal} +\mapXMLvalue {fo:weight} {300} {normal} +\mapXMLvalue {fo:weight} {400} {normal} +\mapXMLvalue {fo:weight} {500} {normal} +\mapXMLvalue {fo:weight} {600} {normal} +\mapXMLvalue {fo:weight} {700} {normal} +\mapXMLvalue {fo:weight} {800} {normal} +\mapXMLvalue {fo:weight} {900} {normal} + +\mapXMLvalue {fo:variant} {normal} {} +\mapXMLvalue {fo:variant} {small-caps} {small-caps} + +\mapXMLvalue {fo:style} {normal} {normal} +\mapXMLvalue {fo:style} {italic} {italic} +\mapXMLvalue {fo:style} {oblique} {oblique} +\mapXMLvalue {fo:style} {backslant} {normal} + +% we can get crap like: 10pt/1.5 bold "Times Roman" ; i'm really puzzled why an +% otherwise rather verbose coding occasionally packs attributes; a design flaw + +\newtoks\FOfonttoks + +\def\checkFOfontSS#1'{} +\def\checkFOfontDD#1"{} +\def\checkFOfontII#1 {} + +\bgroup +\catcode`\'=\active +\catcode`\"=\active +\catcode`\/=\active +\gdef\setcheckFOfontX + {\catcode`\'=\active + \catcode`\"=\active + \catcode`\/=\active + \def'##1'{\global\FOfonttoks\expandafter{\the\FOfonttoks\def\FOfontfamily{##1}}}% + \def"##1"{\global\FOfonttoks\expandafter{\the\FOfonttoks\def\FOfontfamily{##1}}}% + \def/##1 {}}% todo linespacing +\gdef\setcheckFOfontXX + {\catcode`\'=\active + \catcode`\"=\active + \catcode`\/=\active + \def'##1'{}% + \def"##1"{}% + \def/##1 {}}% todo linespacing +\egroup + +\globallet\xFOattribute\empty + +\def\checkFOfont#1% + {\FOfonttoks\emptytoks + \bgroup + \catcode`\\=\@@escape + \catcode`\{=\@@begingroup + \catcode`\}=\@@endgroup +% \catcode`\:=\@@letter +% \catcode`\-=\@@letter + \setcheckFOfontX + \xdef\xFOattribute{#1 }% + \setbox\scratchbox\hbox{\scantokens\@EA{\xFOattribute}}% + \setcheckFOfontXX + \scantokens\@EA{\@EA\xdef\@EA\xFOattribute\@EA{\xFOattribute}}% + \egroup + \the\FOfonttoks + \ifx\xFOattribute\empty\else + \expanded{\docheckFOfont\xFOattribute\space\relax\space\relax}\od + \fi + \directsetup{fo:font:family:check}} + +\def\docheckFOfont#1#2 #3% + {\ifx#1\relax + \expandafter\noFOchecks + \else + \directsetup{fo:fonts:reset}% + \doifelsefontsynonym{#1#2} + {\def\FOfontfamily{#1#2}} + {\doifelsenothing{\XMLval{fo:weight}{#1#2}{}} + {\doifelsenothing{\XMLval{fo:variant}{#1#2}{}} + {\doifelsenothing{\XMLval{fo:style}{#1#2}{}} + {\setpercentdimen\dFOfontsize{#1#2}} + {\edef\FOfontstyle{\XMLval{fo:style}{#1#2}{}}}} + {\edef\FOfontvariant{\XMLval{fo:variant}{#1#2}{}}}} + {\edef\FOfontweight{\XMLval{fo:weight}{#1#2}{}}}}% + \expandafter\docheckFOfont + \fi#3} + +\protect + +\newtoks\FOreferences + +\def\setFOreference#1% + {\doifsomething{\XMLpar{#1}{id}{}} + {\expanded{\appendtoks + \noexpand\reference[\XMLpar{#1}{id}{}]{\XMLpar{fo:page-sequence}{format}{}}}% + \to\FOreferences}} + +\def\flushFOreferences + {\the\FOreferences + \global\FOreferences\emptytoks} + +\def\doFOreference#1% + {\doifsomething{\XMLpar{#1}{id}{}} + {\expanded{\reference[\XMLpar{#1}{id}{}]{\XMLpar{fo:page-sequence}{format}{}}}}} + +\appendtoks \flushFOreferences \to \everypar +\appendtoks \flushFOreferences \to \neverypar % check ! + +%D Graphics: static frames + +\startMPinclusions + input mp-fobg.mpii ; +\stopMPinclusions + +\def\unknownMPcolor{FoNoColor} + +% todo: combine into one en alleen tweede run, immers toch geen invloed; is +% aangezien de referentiepunten vast liggen + +\def\FoRegionWidth#1% + {\XMLpav + {fo:border-width} + {fo:region-\MPvar{location}} + {border-#1-width} + {FoMedium}} + +\def\FoRegionStyle#1% + {\XMLpav + {fo:border-style} + {fo:region-\MPvar{location}} + {border-#1-style} + {FoNone}} + +\def\FoRegionColor#1% + {\MPcolor{\XMLpar + {fo:region-\MPvar{location}} + {border-#1-color} + {black}}} + +\def\FoRegionBackgroundColor + {\MPcolor{\XMLpar + {fo:region-\MPvar{location}} + {background-color} + {FoNoColor}}} + +% todo: when connected and same color : one draw + +\startuseMPgraphic{region-do} + FoBackgroundColor := \FoRegionBackgroundColor ; + FoLineColor[FoTop] := \FoRegionColor{top} ; + FoLineColor[FoBottom] := \FoRegionColor{bottom} ; + FoLineColor[FoLeft] := \FoRegionColor{left} ; + FoLineColor[FoRight] := \FoRegionColor{right} ; + FoLineStyle[FoTop] := \FoRegionStyle{top} ; + FoLineStyle[FoBottom] := \FoRegionStyle{bottom} ; + FoLineStyle[FoLeft] := \FoRegionStyle{left} ; + FoLineStyle[FoRight] := \FoRegionStyle{right} ; + FoLineWidth[FoTop] := \FoRegionWidth{top} ; + FoLineWidth[FoBottom] := \FoRegionWidth{bottom} ; + FoLineWidth[FoLeft] := \FoRegionWidth{left} ; + FoLineWidth[FoRight] := \FoRegionWidth{right} ; + if FoBackgroundColor <> FoNoColor : + fill OverlayBox + withcolor FoBackgroundColor ; + fi ; + path OverlayFrameBox ; + interim linecap := butt ; + OverlayFrameBox := OverlayBox + topenlarged -.5FoLineWidth[FoTop] + bottomenlarged -.5FoLineWidth[FoBottom] + leftenlarged -.5FoLineWidth[FoLeft] + rightenlarged -.5FoLineWidth[FoRight] ; + DrawFoFrame(FoTop, topboundary OverlayFrameBox) ; + DrawFoFrame(FoBottom, bottomboundary OverlayFrameBox) ; + DrawFoFrame(FoLeft, leftboundary OverlayFrameBox) ; + DrawFoFrame(FoRight, rightboundary OverlayFrameBox) ; +\stopuseMPgraphic + +\startuseMPgraphic{region-body} \includeMPgraphic{region-do} \stopuseMPgraphic +\startuseMPgraphic{region-before} \includeMPgraphic{region-do} \stopuseMPgraphic +\startuseMPgraphic{region-after} \includeMPgraphic{region-do} \stopuseMPgraphic +\startuseMPgraphic{region-start} \includeMPgraphic{region-do} \stopuseMPgraphic +\startuseMPgraphic{region-end} \includeMPgraphic{region-do} \stopuseMPgraphic + +\startnotmode[fo-no-bg] + +\defineoverlay[region-body-graphic] [\useMPgraphic{region-body}{location=body}] +\defineoverlay[region-before-graphic][\useMPgraphic{region-before}{location=before}] +\defineoverlay[region-after-graphic] [\useMPgraphic{region-after}{location=after}] +\defineoverlay[region-start-graphic] [\useMPgraphic{region-start}{location=start}] +\defineoverlay[region-end-graphic] [\useMPgraphic{region-end}{location=end}] + +\stopnotmode + +% more efficient: todo: relocate and move to page background + +% \def\FoRegionWidth#1#2% +% {\XMLpav +% {fo:border-width} +% {fo:region-#2} +% {border-#1-width} +% {FoMedium}} + +% \def\FoRegionStyle#1#2% +% {\XMLpav +% {fo:border-style} +% {fo:region-#2} +% {border-#1-style} +% {FoNone}} + +% \def\FoRegionColor#1#2% +% {\MPcolor{\XMLpar +% {fo:region-#2} +% {border-#1-color} +% {black}}} + +% \def\FoRegionBackgroundColor#1% +% {\MPcolor{\XMLpar +% {fo:region-#1} +% {background-color} +% {FoNoColor}}} + +% \def\combinedFOgraphic#1% +% {FoBackgroundColor := \FoRegionBackgroundColor{#1} ; +% FoLineColor[FoTop] := \FoRegionColor{top}{#1} ; +% FoLineColor[FoBottom] := \FoRegionColor{bottom}{#1} ; +% FoLineColor[FoLeft] := \FoRegionColor{left}{#1} ; +% FoLineColor[FoRight] := \FoRegionColor{right}{#1} ; +% FoLineStyle[FoTop] := \FoRegionStyle{top}{#1} ; +% FoLineStyle[FoBottom] := \FoRegionStyle{bottom}{#1} ; +% FoLineStyle[FoLeft] := \FoRegionStyle{left}{#1} ; +% FoLineStyle[FoRight] := \FoRegionStyle{right}{#1} ; +% FoLineWidth[FoTop] := \FoRegionWidth{top}{#1} ; +% FoLineWidth[FoBottom] := \FoRegionWidth{bottom}{#1} ; +% FoLineWidth[FoLeft] := \FoRegionWidth{left}{#1} ; +% FoLineWidth[FoRight] := \FoRegionWidth{right}{#1} ; +% if FoBackgroundColor <> FoNoColor : +% fill OverlayBox +% withcolor FoBackgroundColor ; +% fi ; +% path OverlayFrameBox ; +% interim linecap := butt ; +% OverlayFrameBox := OverlayBox +% topenlarged -.5FoLineWidth[FoTop] +% bottomenlarged -.5FoLineWidth[FoBottom] +% leftenlarged -.5FoLineWidth[FoLeft] +% rightenlarged -.5FoLineWidth[FoRight] ; +% DrawFoFrame(FoTop, topboundary OverlayFrameBox) ; +% DrawFoFrame(FoBottom, bottomboundary OverlayFrameBox) ; +% DrawFoFrame(FoLeft, leftboundary OverlayFrameBox) ; +% DrawFoFrame(FoRight, rightboundary OverlayFrameBox) ;} + +% \startuseMPgraphic{region-body} +% \combinedFOgraphic{before} +% \combinedFOgraphic{body} +% \combinedFOgraphic{after} +% \combinedFOgraphic{start} +% \combinedFOgraphic{end} +% \stopuseMPgraphic + +% \defineoverlay[region-body-graphic] [\useMPgraphic{region-body}{location=body}] +% \defineoverlay[region-before-graphic][] +% \defineoverlay[region-after-graphic] [] +% \defineoverlay[region-start-graphic] [] +% \defineoverlay[region-end-graphic] [] + +\stopXMLcompiling + +\endinput + +% we can follow two approaches: set the attributes global, using +% +% \defineXML...[tag][prefix][empty] +% +% in that case we trust the fo-file to be correct, i.e. the xslt style +% sheets should not put attributes in the wrong places; however, we need +% to do that with care, since for instance the attributes of some objects +% (regions) are used mixed +% +% \defineXMLprocess [fo:root] [XMLFO] [test=unset] +% +% \defineXMLenvironment [fo:block-container] [XMLFO] +% {\begingroup} +% {\endgroup} +% +% \defineXMLenvironment [fo:block] [XMLFO] +% {\begingroup\getXMLparameters[XMLFO]\begingroup} +% {\endgroup\XMLFOtest\endgraf\endgroup} +% +% \startXMLdata +% <fo:root> +% <fo:block-container test='first'><fo:block test='second'>second:</fo:block></fo:block-container> +% <fo:block>unset:</fo:block> +% <fo:block test='outer'><fo:block test='nested'>nested:</fo:block>outer:</fo:block> +% <fo:block test='last'>last:</fo:block> +% </fo:root> +% \stopXMLdata +% +% the other approach is to set the attributes explicitly for each +% element, which is slower but more robust +% +% A mix is: +% +% \defineXMLenvironment +% [fo:root] +% [test=unset] +% {\beginXMLelement} +% {\endXMLelement} +% +% \defineXMLenvironment +% [fo:block-container] +% [test=\XMLpar\XMLpureparent{test}{}] +% {\beginXMLelement} +% {\endXMLelement} +% +% \defineXMLenvironment +% [fo:block] +% [test=\XMLpar\XMLpureparent{test}{}] +% {\beginXMLelement +% \begingroup} +% {\endgroup +% \XMLpar{fo:block}{test}{} +% \endXMLelement} +% +% \startXMLdata +% <fo:root> +% <fo:block-container test='first'><fo:block test='second'>second:</fo:block></fo:block-container> +% <fo:block>unset:</fo:block> +% <fo:block test='outer'><fo:block test='nested'>nested:</fo:block>outer:</fo:block> +% <fo:block test='last'>last:</fo:block> +% </fo:root> +% \stopXMLdata diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-foxet.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-foxet.mkii new file mode 100644 index 00000000000..d44cf2b7ec7 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-foxet.mkii @@ -0,0 +1,28 @@ +%D \module +%D [ file=x-foxet, +%D version=2004.03.12, % based on earlier experiments +%D title=\FOXET, +%D subtitle=Formatting Objects, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module is just a shortcut for: + +% fo = basic formatting objects +% fe = basic formatting extensions +% fx = extra formatting objects +% fu = user formatting objects +% fs = setup + +\usemodule[fo,fe,fx,fu,fs,mathml] + +\usemodule[fp] % passivetex bonus + +% \autoXMLnamespace[mml,mm,mathml] + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-mathml.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-mathml.mkii new file mode 100644 index 00000000000..ccb9fa05463 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-mathml.mkii @@ -0,0 +1,28 @@ +%D \module +%D [ file=x-mathml, +%D version=1999.12.20, +%D title=\CONTEXT\ XML Modules, +%D subtitle=Loading \MATHML\ Filters, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D We have to make sure that some basic entities are +%D loaded: + +\useXMLfilter[ent] + +%D Then we load the math: + +\useXMLfilter[mml,mmp,mmc] + +%D And we also load the whole bunch of entities: + +% \useXMLfilter[mea,meb,mec,meh,men,meo,mer] +% \useXMLfilter[mxa,mxb,mxc,mxh,mxn,mxo,mxr] + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-mathml.xsd b/Master/texmf-dist/tex/context/modules/mkii/x-mathml.xsd new file mode 100644 index 00000000000..1c29452b06a --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-mathml.xsd @@ -0,0 +1,11 @@ +<?xml version="1.0"?> + +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xds="http://www.w3.org/?"> + +<xsd:schema> + +<xsd:element name="imath" type="mathml:math" /> +<xsd:element name="dmath" type="mathml:math" /> + +</xsd:schema> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-newcml.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-newcml.mkii new file mode 100644 index 00000000000..23c2bf1e2c0 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-newcml.mkii @@ -0,0 +1,456 @@ +%D \module +%D [ file=x-newmml, +%D version=2006.04.09, % reimplementation +%D title=\CONTEXT\ XML Macros, +%D subtitle=ChemML, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This used to be an xtag filter using remapping but the +%D following is nore in sync with the new mathml methods. + +\writestatus{loading}{ConTeXt XML Macros / ChemML} + +\useXMLfilter[stk] + +\unprotect + +\def\setupCMLappearance[#1]{\dodoubleargument\getparameters[@@CML#1]} + +\defineXMLdirective [chemml] \setupCMLappearance + +\defineXMLargument [chem] \automathematics % \rm +\defineXMLargument [ichem] \inlinemathematics % \rm +\defineXMLargument [dchem] \displaymathematics % \rm + +\def\doifnotXMLparzero#1#2#3% + {\ifcase\XMLpar{#1}{#2}{0}\else#3{\XMLpar{#1}{#2}{0}}\fi} + +\defineXMLargument [caption] \doCMLcaption + +\let\CMLtopcaption\empty +\let\CMLbotcaption\empty + +\chardef\CMLcaptionmode\plusone + +\def\doCMLcaption#1% + {\ifcase\CMLcaptionmode + % can't happen + \or + \def\CMLbotcaption{#1}% + \chardef\CMLcaptionmode\plustwo + \or + \def\CMLtopcaption{#1}% + \chardef\CMLcaptionmode\plusthree + \fi} + +\def\resetCMLcaption + {\let\CMLtopcaption\empty + \let\CMLbotcaption\empty + \chardef\CMLcaptionmode\plusone} + +\resetCMLcaption + +\def\doCMLtext#1% + {\ifx\CMLtopcaption\empty + \setbox0\null + \else + \setbox0\hbox{\txx\setstrut\strut\ignorespaces\CMLtopcaption\unskip}% + \fi + \setbox2\hbox{\ignorespaces\strut#1\unskip}% + \ifx\CMLbotcaption\empty + \setbox4\null + \else + \setbox4\hbox{\txx\setstrut\strut\ignorespaces\CMLbotcaption\unskip}% + \fi + \scratchdimen=\wd2\advance\scratchdimen-.5em + \ifdim\wd0>\scratchdimen + \setbox0\hbox spread .5em{\hss\box0\hss}% + \fi + \ifdim\wd4>\scratchdimen + \setbox4\hbox spread .5em{\hss\box4\hss}% + \fi + \setbox6=\vbox + {\offinterlineskip\halign{\hss##\hss\cr\copy0\cr\copy2\cr\copy4\cr}}% + \hbox{\lower\ht4\hbox{\lower\dp2\box6}}} + +\def\CMLscript#1% + {$\scriptscriptstyle\ignorespaces#1\unskip$} + +% \startsetups cml:flush:all +% \ignorespaces +% \XMLallnamed{atom,bond,singlebond,doublebond,triplebond} +% \removeunwantedspaces +% \stopsetups + +\newcounter\currentCMLatom +\newcounter\nofCMLatoms + +\defineXMLenvironmentsave + [atom] + [n=0,weight=0,protons=0,charge=0] + {\directsetup{cml:atom:start}} + {\directsetup{cml:atom:stop}} + +\startsetups cml:atom:start + \removeunwantedspaces +\stopsetups + +\startsetups cml:atom:stop + \increment\currentCMLatom + \resetCMLcaption + \doCMLtext { + \bgroup + \lohi { + \doifnotXMLparzero{atom}{protons}\CMLscript + } { + \doifnotXMLparzero{atom}{weight}\CMLscript + } + \ignorespaces + \XMLflush{atom} + \removeunwantedspaces + \lohi { + \doifnotXMLparzero{atom}{n}\CMLscript + } { + \ifnum\nofCMLatoms=\currentCMLatom\relax + \doifnotXMLparzero{ion}{charge}\CMLscript + \else + \doifnotXMLparzero{atom}{charge}\CMLscript + \fi + } + \egroup + } + \ignorespaces +\stopsetups + +\defineXMLnested % why not environment + [molecule] + [n=0] + {\directsetup{cml:molecule:start}} + {\directsetup{cml:molecule:stop}} + +\startsetups cml:molecule:start + \removeunwantedspaces + \begingroup + \startsavingXMLelements + \ignorespaces +\stopsetups + +\startsetups cml:molecule:stop + \removeunwantedspaces + \stopsavingXMLelements + \resetCMLcaption + \XMLfirstnamed{caption} + \doCMLtext { + \newcounter\currentCMLatom + \newcounter\nofCMLatoms + \doifnotXMLparzero{molecule}{n}\firstofoneargument + \ignorespaces + \XMLallnamed{atom,ion,bond,singlebond,doublebond,triplebond} + \removeunwantedspaces + } + \endgroup + \ignorespaces +\stopsetups + +\setupCMLappearance [ion] [\c!alternative=\v!a] + +\defineXMLnested + [ion] + [n=0,charge=0] + {\directsetup{cml:ion:start}} + {\directsetup{cml:ion:stop}} + +\startsetups cml:ion:start + \begingroup + \startsavingXMLelements +\ignorespaces +\stopsetups + +\startsetups cml:ion:stop + \removeunwantedspaces + \stopsavingXMLelements + \resetCMLcaption + \XMLfirstnamed{caption} + \doCMLtext { + \newcounter\currentCMLatom + \newcounter\nofCMLatoms + \doifnotXMLparzero{ion}{n}\firstofoneargument + \doifelse\@@CMLionalternative\v!b { + [\ignorespaces + \XMLallnamed{atom,bond,singlebond,doublebond,triplebond} + \removeunwantedspaces] + \high { + \doifnotXMLparzero{ion}{charge}\CMLscript + } + } { + \countXMLnamedstack{atom} + \edef\nofCMLatoms{\the\scratchcounter}% todo: \nofXMLchildren + \ignorespaces + \XMLallnamed{atom,bond,singlebond,doublebond,triplebond} + \removeunwantedspaces + } + } + \endgroup + \ignorespaces +\stopsetups + +\let\doCMLsymbol\gobbleoneargument +\let\doCMLarrow \gobblethreearguments + +\defineXMLenvironment + [reaction] + {\directsetup{cml:reaction:start}} + {\directsetup{cml:reaction:stop}} + +\startsetups cml:reaction:start + \begingroup + \let\doCMLsymbol\dodoCMLsymbol + \let\doCMLarrow \dodoCMLarrow +\stopsetups + +\startsetups cml:reaction:stop + \endgroup +\stopsetups + +\defineXMLcommand [plus] {\doCMLsymbol{+}} +\defineXMLcommand [minus] {\doCMLsymbol{-}} +\defineXMLcommand [equal] {\doCMLsymbol{=}} + +\def\dodoCMLsymbol#1% + {\removeunwantedspaces\quad + \mathop{#1}% + \quad\kern\zeropoint\ignorespaces} + +\defineXMLcommand [gives] {\resetCMLcaption\doCMLgives} +\defineXMLcommand [equilibrium] {\resetCMLcaption\doCMLequilibrium} +\defineXMLcommand [mesomeric] {\resetCMLcaption\doCMLmesomeric} + +\def\dodoCMLarrow#1% + {\removeunwantedspaces\quad + \doCMLtext{$\vcenter{\offinterlineskip\halign{##\cr\hskip3em\cr#1\cr}}$}% + \quad\kern\zeropoint\ignorespaces} + +\def\doCMLgives + {\doCMLarrow{\rightarrowfill}} + +\def\doCMLequilibrium + {\doCMLarrow{\rightarrowfill\cr\noalign{\nointerlineskip}\leftarrowfill}} + +\def\doCMLmesomeric + {\doCMLarrow{$\leftarrow\hskip-1em$\rightarrowfill}} + +\defineXMLcommand [bond] [n=1] \doCMLbond +\defineXMLcommand [singlebond] [n=1] \doCMLsinglebond +\defineXMLcommand [doublebond] [n=1] \doCMLdoublebond +\defineXMLcommand [triplebond] [n=1] \doCMLtriplebond + +\def\doCMLbond + {\ifcase\XMLop{n}\relax + \doCMLsinglebond + \or + \doCMLdoublebond + \or + \doCMLtriplebond + \fi} + +\def\doCMLbond + {\removeunwantedspaces + \hrule \!!width \hsize \!!height .1ex\relax % .4pt + \ignorespaces} + +\def\dodoCMLbond#1#2#3% + {\removeunwantedspaces + \begingroup + \setbox\scratchbox\hbox{$M$}% + \vbox to \ht\scratchbox + {\hsize\wd\scratchbox + \vskip.1\wd\scratchbox + #1\vfill#2\vfill#3% + \vskip.1\wd\scratchbox}% + \endgroup + \ignorespaces} + +\def\doCMLsinglebond{\dodoCMLbond\relax \doCMLbond\relax } +\def\doCMLdoublebond{\dodoCMLbond\doCMLbond\relax \doCMLbond} +\def\doCMLtriplebond{\dodoCMLbond\doCMLbond\doCMLbond\doCMLbond} + +% extensions (uses m-chemic, which thenneeds to be loaded) + +% <dchem> +% <structure> +% <component> +% <graphic>SIX,B</graphic> +% <graphic>R135</graphic> +% </component> +% <component> +% <graphic>R246</graphic> +% </component> +% <component> +% <graphic>RZ</graphic> +% <text>A,B,C,D,E,F</text> +% </component> +% <component> +% <graphic>Z</graphic> +% <oxidation n="3">A</oxidation> +% <annotation location="tl"> +% <text>B</text> +% <caption>x</caption> +% </annotation> +% <oxidation n="3" sign="+">C</oxidation> +% <text>D,E,F</text> +% </component> +% </structure> +% <structure> +% <component> +% <graphic>SIX,B</graphic> +% <graphic>r135</graphic> +% </component> +% <component> +% <graphic>R246</graphic> +% </component> +% <component> +% <graphic>RZ</graphic> +% <text>A,B,C,D,E,F</text> +% </component> +% </structure> +% </dchem> + +\ifx\XMLttoks \undefined \newtoks \XMLttoks \fi +\ifx\XMLgtoks \undefined \newtoks \XMLgtoks \fi + +\ifx\startchemical\undefined + \def\startchemical {\hbox{module chemic is not loaded}} + \let\stopchemical \relax + \def\chemical[#1][#2]{} +\fi + +\defineXMLenvironment + [structure] + {\startchemical + \ignorespaces} + {\removeunwantedspaces + \stopchemical} + +\defineXMLenvironment + [component] + {\global\XMLgtoks\emptytoks + \global\XMLttoks\emptytoks + \defineXMLargument[graphic]{\dogetCMLgraphic}% + \defineXMLargument[text] {\dogetCMLtext}% + \ignorespaces} + {\removeunwantedspaces + \expanded{\chemical[\the\XMLgtoks][\the\XMLttoks]}% + \ignorespaces} + +\def\dogetCMLgraphic#1% + {\doifelsenothing{\the\XMLgtoks} + {\uppercase{\doglobal\appendtoks #1\to\XMLgtoks}} + {\uppercase{\doglobal\appendtoks,#1\to\XMLgtoks}}% + \ignorespaces} + +\def\dogetCMLtext#1% + {\doifelsenothing{\the\XMLttoks} + {\uppercase{\doglobal\appendtoks #1\to\XMLttoks}} + {\uppercase{\doglobal\appendtoks,#1\to\XMLttoks}}% + \ignorespaces} + +\defineXMLargument + [oxidation] + [sign=,n=1] + {\doCMLoxidation} + +\def\doCMLoxidation#1% + {\expanded{\dogetCMLtext{\noexpand\chemicaloxidation{\XMLop{sign}}{\XMLop{n}}{#1}}}% + \ignorespaces} + +% \defineXMLenvironment +% [annotation] +% [location=] +% {\defineXMLsave[text]% +% \defineXMLsave[caption]} +% {\removeunwantedspaces +% \processaction +% [\XMLpar{annotation}{location}{r}] +% [ t=>\dodoCMLannotation\chemicaltop, +% b=>\dodoCMLannotation\chemicalbottom, +% l=>\dodoCMLannotation\chemicalleft, +% r=>\dodoCMLannotation\chemicalright, +% lc=>\dodoCMLannotation\chemicalleftcentered, +% rc=>\dodoCMLannotation\chemicalrightcentered, +% tl=>\dodoCMLannotation\chemicaltopleft, +% bl=>\dodoCMLannotation\chemicalbottomleft, +% tr=>\dodoCMLannotation\chemicaltopright, +% br=>\dodoCMLannotation\chemicalbottomright, +% lt=>\dodoCMLannotation\chemicallefttop, +% lb=>\dodoCMLannotation\chemicalleftbottom, +% rt=>\dodoCMLannotation\chemicalrighttop, +% rb=>\dodoCMLannotation\chemicalrightbottom, +% x=>\dodoCMLannotation\chemicaltighttext, +% sl=>\dodoCMLannotation\chemicalsmashedleft, +% sm=>\dodoCMLannotation\chemicalsmashedmiddle, +% sr=>\dodoCMLannotation\chemicalsmashedright]% +% \ignorespaces} + +% todo: generic mapper t -> top etc + +\mapXMLvalue {cml:a:l} {t} {\dodoCMLannotation\chemicaltop} +\mapXMLvalue {cml:a:l} {b} {\dodoCMLannotation\chemicalbottom} +\mapXMLvalue {cml:a:l} {l} {\dodoCMLannotation\chemicalleft} +\mapXMLvalue {cml:a:l} {r} {\dodoCMLannotation\chemicalright} +\mapXMLvalue {cml:a:l} {lc} {\dodoCMLannotation\chemicalleftcentered} +\mapXMLvalue {cml:a:l} {rc} {\dodoCMLannotation\chemicalrightcentered} +\mapXMLvalue {cml:a:l} {tl} {\dodoCMLannotation\chemicaltopleft} +\mapXMLvalue {cml:a:l} {bl} {\dodoCMLannotation\chemicalbottomleft} +\mapXMLvalue {cml:a:l} {tr} {\dodoCMLannotation\chemicaltopright} +\mapXMLvalue {cml:a:l} {br} {\dodoCMLannotation\chemicalbottomright} +\mapXMLvalue {cml:a:l} {lt} {\dodoCMLannotation\chemicallefttop} +\mapXMLvalue {cml:a:l} {lb} {\dodoCMLannotation\chemicalleftbottom} +\mapXMLvalue {cml:a:l} {rt} {\dodoCMLannotation\chemicalrighttop} +\mapXMLvalue {cml:a:l} {rb} {\dodoCMLannotation\chemicalrightbottom} +\mapXMLvalue {cml:a:l} {x} {\dodoCMLannotation\chemicaltighttext} +\mapXMLvalue {cml:a:l} {sl} {\dodoCMLannotation\chemicalsmashedleft} +\mapXMLvalue {cml:a:l} {sm} {\dodoCMLannotation\chemicalsmashedmiddle} +\mapXMLvalue {cml:a:l} {sr} {\dodoCMLannotation\chemicalsmashedright} + +% \mapXMLvalue {cml:a:l} {cl} {\dodoCMLannotation\chemicalleftcentered} +% \mapXMLvalue {cml:a:l} {cr} {\dodoCMLannotation\chemicalrightcentered} +% \mapXMLvalue {cml:a:l} {lt} {\dodoCMLannotation\chemicaltopleft} +% \mapXMLvalue {cml:a:l} {lb} {\dodoCMLannotation\chemicalbottomleft} +% \mapXMLvalue {cml:a:l} {rt} {\dodoCMLannotation\chemicaltopright} +% \mapXMLvalue {cml:a:l} {rb} {\dodoCMLannotation\chemicalbottomright} +% \mapXMLvalue {cml:a:l} {tl} {\dodoCMLannotation\chemicallefttop} +% \mapXMLvalue {cml:a:l} {bl} {\dodoCMLannotation\chemicalleftbottom} +% \mapXMLvalue {cml:a:l} {tr} {\dodoCMLannotation\chemicalrighttop} +% \mapXMLvalue {cml:a:l} {br} {\dodoCMLannotation\chemicalrightbottom} +% \mapXMLvalue {cml:a:l} {ls} {\dodoCMLannotation\chemicalsmashedleft} +% \mapXMLvalue {cml:a:l} {ms} {\dodoCMLannotation\chemicalsmashedmiddle} +% \mapXMLvalue {cml:a:l} {rs} {\dodoCMLannotation\chemicalsmashedright} + +\defineXMLenvironment + [annotation] + [location=] + {\pushXMLmeaning{text}% + \pushXMLmeaning{caption}% + \defineXMLsave[text]% + \defineXMLsave[caption]} + {\removeunwantedspaces + \XMLval{cml:a:l}{\XMLpar{annotation}{location}{r}}{\XMLflush{text}}% + \popXMLmeaning{text}% + \popXMLmeaning{caption}% + \ignorespaces} + +\def\dodoCMLannotation#1% + {\expanded{\dogetCMLtext{\noexpand#1{\XMLflush{caption}}{\XMLflush{text}}}}} + +\defineXMLenvironment + [forever] + {\left[} + {\right]} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-newmme.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-newmme.mkii new file mode 100644 index 00000000000..2e0d4c18969 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-newmme.mkii @@ -0,0 +1,423 @@ +%D \module +%D [ file=m-newmme, +%D version=2005.06.10, % 1999.12.20, +%D title=\CONTEXT\ XML Macros, +%D subtitle=MathML Entities, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt XML Macros / MathML Entities} + +\unprotect + +%D Used in the manual: + +\def\showMMLentity#1% + {\bgroup + \doifXMLentityelse{#1} + {\let\MMLleft\empty\let\MMLright\empty\mathematics{\getXMLentity{#1}{}}} + {\getXMLentity{unknown}}% + \egroup} + +\newbox\unknownXMLentity +\setbox\unknownXMLentity\hbox{\inframed[\c!strut=\v!no,\c!offset=1pt]{\ttx ?}} + +\defineXMLentity [unknown] {\copy\unknownXMLentity} + +%D A (not really needed) precaution: + +\ifx\blackboard\undefined + \def\blackboard{\ifx\Bbb\undefined\else\expandafter\Bbb\fi} +\fi + +%D Basic entities, greek: + +\defineXMLentity [alpha] {\mathematics \alpha} +\defineXMLentity [beta] {\mathematics \beta} +\defineXMLentity [gamma] {\mathematics \gamma} +\defineXMLentity [delta] {\mathematics \delta} +\defineXMLentity [epsilon] {\mathematics \epsilon} +\defineXMLentity [zeta] {\mathematics \zeta} +\defineXMLentity [eta] {\mathematics \eta} +\defineXMLentity [theta] {\mathematics \theta} +\defineXMLentity [iota] {\mathematics \iota} +\defineXMLentity [kappa] {\mathematics \kappa} +\defineXMLentity [lambda] {\mathematics \lambda} +\defineXMLentity [theta] {\mathematics \theta} +\defineXMLentity [mu] {\mathematics \mu} +\defineXMLentity [nu] {\mathematics \nu} +\defineXMLentity [xi] {\mathematics \xi} +\defineXMLentity [pi] {\mathematics \pi} +\defineXMLentity [rho] {\mathematics \rho} +\defineXMLentity [sigma] {\mathematics \sigma} +\defineXMLentity [tau] {\mathematics \tau} +\defineXMLentity [upsilon] {\mathematics \upsilon} +\defineXMLentity [phi] {\mathematics \phi} +\defineXMLentity [chi] {\mathematics \chi} +\defineXMLentity [psi] {\mathematics \psi} +\defineXMLentity [omega] {\mathematics \omega} + +\defineXMLentity [varepsilon] {\mathematics \varepsilon} +\defineXMLentity [vartheta] {\mathematics \vartheta} +\defineXMLentity [varpi] {\mathematics \varpi} +\defineXMLentity [varrho] {\mathematics \varrho} +\defineXMLentity [varsigma] {\mathematics \varsigma} +\defineXMLentity [varphi] {\mathematics \varphi} + +\defineXMLentity [epsilonv] {\mathematics \varepsilon} +\defineXMLentity [thetav] {\mathematics \vartheta} +\defineXMLentity [piv] {\mathematics \varpi} +\defineXMLentity [rhov] {\mathematics \varrho} +\defineXMLentity [sigmav] {\mathematics \varsigma} +\defineXMLentity [phiv] {\mathematics \varphi} + +\defineXMLentity [epsi] {\mathematics \epsilon} +\defineXMLentity [epsiv] {\mathematics \varepsilon} + +\defineXMLentity [Alpha] {A} +\defineXMLentity [Beta] {B} +\defineXMLentity [Gamma] {\mathematics \Gamma} +\defineXMLentity [Delta] {\mathematics \Delta} +\defineXMLentity [Epsilon] {E} +\defineXMLentity [Zeta] {Z} +\defineXMLentity [Eta] {N} +\defineXMLentity [Theta] {\mathematics \Theta} +\defineXMLentity [Iota] {I} +\defineXMLentity [Kappa] {K} +\defineXMLentity [Lambda] {\mathematics \Lambda} +\defineXMLentity [Mu] {M} +\defineXMLentity [Nu] {N} +\defineXMLentity [Xi] {\mathematics \Xi} +\defineXMLentity [Pi] {\mathematics \Pi} +\defineXMLentity [Ro] {R} +\defineXMLentity [Sigma] {\mathematics \Sigma} +\defineXMLentity [Tau] {T} +\defineXMLentity [Upsilon] {\mathematics \Upsilon} +\defineXMLentity [Phi] {\mathematics \Phi} +\defineXMLentity [Chi] {X} +\defineXMLentity [Psi] {\mathematics \Psi} +\defineXMLentity [Omega] {\mathematics \Omega} + +%D Basic entities, hebrew: + +\defineXMLentity [aleph] {\mathematics \aleph} + +%D Basic entities, functions: + +\defineXMLentity [abs] {\mathopnolimits{abs}} +\defineXMLentity [arg] {\mathopnolimits{arg}} +\defineXMLentity [codomain] {\mathopnolimits{codomain}} +\defineXMLentity [curl] {\mathopnolimits{curl}} +\defineXMLentity [determinant] {\mathopnolimits{det}} +\defineXMLentity [divergence] {\mathopnolimits{div}} +\defineXMLentity [domain] {\mathopnolimits{domain}} +\defineXMLentity [false] {\mathopnolimits{false}} +\defineXMLentity [gcd] {\mathopnolimits{gcd}} +\defineXMLentity [grad] {\mathopnolimits{grad}} +\defineXMLentity [identity] {\mathopnolimits{id}} +\defineXMLentity [image] {\mathopnolimits{image}} +\defineXMLentity [lcm] {\mathopnolimits{lcm}} +\defineXMLentity [max] {\mathopnolimits{max}} +\defineXMLentity [median] {\mathopnolimits{median}} +\defineXMLentity [min] {\mathopnolimits{min}} +\defineXMLentity [mode] {\mathopnolimits{mode}} +\defineXMLentity [mod] {\mathopnolimits{mod}} +\defineXMLentity [notanumber] {\mathopnolimits{NaN}} +\defineXMLentity [otherwise] {\mathopnolimits{otherwise}} +\defineXMLentity [true] {\mathopnolimits{true}} +\defineXMLentity [declare] {\mathopnolimits{declare}} +\defineXMLentity [as] {\mathopnolimits{as}} +\defineXMLentity [polar] {\mathopnolimits{Polar}} + +\defineXMLentity [mathematicald] {d} + +\defineXMLentity [imaginaryi] {{\rm i}} +\defineXMLentity [differentiald] {\partial} +\defineXMLentity [exponentiale] {{\rm e}} +\defineXMLentity [capitaldifferentiald] {D} + +\defineXMLentity [ii] {\getXMLentity{imaginaryi}} +\defineXMLentity [dd] {\getXMLentity{differentiald}} +\defineXMLentity [ee] {\getXMLentity{exponentiale}} +\defineXMLentity [DD] {\getMMLentity{capitaldifferentiald}} + +\defineXMLentity [ImaginaryI] {\getXMLentity{imaginaryi}} +\defineXMLentity [DifferentialD] {\getXMLentity{differentiald}} +\defineXMLentity [ExponentialE] {\getXMLentity{exponentiale}} +\defineXMLentity [CapitalDifferentialD] {\getXMLentity{differentiald}} + +\defineXMLentity [NaN] {\getXMLentity{notanumber}} +\defineXMLentity [NotANumber] {\getXMLentity{notanumber}} + +\defineXMLentity [and] {\wedge} +\defineXMLentity [exists] {\exists} +\defineXMLentity [forall] {\forall} +\defineXMLentity [implies] {\Rightarrow} +\defineXMLentity [not] {\neg} +\defineXMLentity [or] {\vee} +\defineXMLentity [xor] {\mathopnolimits{xor}} + +\defineXMLentity [imaginary] {\Im} +\defineXMLentity [real] {\Re} + +\defineXMLentity [lceiling] {\lceil} +\defineXMLentity [rceiling] {\rceil} + +\defineXMLentity [lfloor] {\lfloor} +\defineXMLentity [rfloor] {\rfloor} + +\defineXMLentity [ne] {\neq} +\defineXMLentity [neq] {\neq} +\defineXMLentity [gt] {>} +\defineXMLentity [lt] {<} +\defineXMLentity [ge] {\geq} +\defineXMLentity [geq] {\geq} +\defineXMLentity [le] {\leq} +\defineXMLentity [leq] {\leq} + +\defineXMLentity [equivalent] {\equiv} +\defineXMLentity [equiv] {\equiv} +\defineXMLentity [approx] {\approx} + +\defineXMLentity [factorof] {\mid} +\defineXMLentity [mapsto] {\mapsto} + +\defineXMLentity [int] {\int} +\defineXMLentity [prime] {\prime} +\defineXMLentity [laplacian] {\nabla^2} +\defineXMLentity [partial] {\partial} + +\defineXMLentity [union] {\cup} +\defineXMLentity [intersect] {\cap} +\defineXMLentity [in] {\in} +\defineXMLentity [notin] {\not\in} +\defineXMLentity [subset] {\subset} +\defineXMLentity [prsubset] {\subseteq} +\defineXMLentity [notsubset] {\not\subset} +\defineXMLentity [notprsubset] {\not\subseteq} +\defineXMLentity [setdiff] {\setminus} + +\defineXMLentity [card] {\vert} +\defineXMLentity [cartesianproduct] {\times} + +\defineXMLentity [sum] {\sum} +\defineXMLentity [prod] {\prod} +\defineXMLentity [product] {\prod} +\defineXMLentity [lim] {\lim} + +\defineXMLentity [exp] {\mathopnolimits{exp}} % {\exp} +\defineXMLentity [ln] {\mathopnolimits{ln}} % {\ln} +\defineXMLentity [log] {\mathopnolimits{log}} % {\log} + +\defineXMLentity [sin] {\mathopnolimits{sin}} +\defineXMLentity [arcsin] {\mathopnolimits{arcsin}} +\defineXMLentity [sinh] {\mathopnolimits{sinh}} +\defineXMLentity [arcsinh] {\mathopnolimits{arcsinh}} +\defineXMLentity [cos] {\mathopnolimits{cos}} +\defineXMLentity [arccos] {\mathopnolimits{arccos}} +\defineXMLentity [cosh] {\mathopnolimits{cosh}} +\defineXMLentity [arccosh] {\mathopnolimits{arccosh}} +\defineXMLentity [tan] {\mathopnolimits{tan}} +\defineXMLentity [arctan] {\mathopnolimits{arctan}} +\defineXMLentity [tanh] {\mathopnolimits{tanh}} +\defineXMLentity [arctanh] {\mathopnolimits{arctanh}} +\defineXMLentity [cot] {\mathopnolimits{cot}} +\defineXMLentity [arccot] {\mathopnolimits{arccot}} +\defineXMLentity [coth] {\mathopnolimits{coth}} +\defineXMLentity [arccoth] {\mathopnolimits{arccoth}} +\defineXMLentity [csc] {\mathopnolimits{csc}} +\defineXMLentity [arccsc] {\mathopnolimits{arccsc}} +\defineXMLentity [csch] {\mathopnolimits{csch}} +\defineXMLentity [arccsch] {\mathopnolimits{arccsch}} +\defineXMLentity [sec] {\mathopnolimits{sec}} +\defineXMLentity [arcsec] {\mathopnolimits{arcsec}} +\defineXMLentity [sech] {\mathopnolimits{sech}} +\defineXMLentity [arcsech] {\mathopnolimits{arcsech}} + +\defineXMLentity [transpose] {^{\rm T}} + +\defineXMLentity [plusminus] {\mathematics{\pm}} +\defineXMLentity [minusplus] {\mathematics{\mp}} + +\defineXMLentity [vectorproduct] {\times} +\defineXMLentity [scalarproduct] {\cdot} +\defineXMLentity [outerproduct] {\otimes} + +\defineXMLentity [integers] {\integers} +\defineXMLentity [reals] {\reals} +\defineXMLentity [rationals] {\rationals} +\defineXMLentity [naturalnumbers] {\naturalnumbers} +\defineXMLentity [complexes] {\complexes} +\defineXMLentity [primes] {\primes} + +\defineXMLentity [emptyset] {\emptyset} +\defineXMLentity [pi] {\pi} +\defineXMLentity [eulergamma] {\gamma} +\defineXMLentity [infinity] {\mathematics{\infty}} + +\defineXMLentity [InvisibleTimes] {} +\defineXMLentity [InvisibleComma] {} +\defineXMLentity [ApplyFunction] {} + +\defineXMLentity [it] {\getXMLentity{InvisibleTines}} +\defineXMLentity [ic] {\getXMLentity{InvisibleComma}} +\defineXMLentity [af] {\getXMLentity{ApplyFunction}} + +\defineXMLentity [PlusMinus] {\getXMLentity{plusminus}} + +\defineXMLentity [infin] {\getXMLentity{infinity}} +\defineXMLentity [infty] {\getXMLentity{infinity}} +\defineXMLentity [part] {\getXMLentity{differentiald}} + +\defineXMLentity [RightArrow] {\normalorfiller\rightarrow\rightarrowfill} +\defineXMLentity [LeftArrow] {\normalorfiller\leftarrow\leftarrowfill} +\defineXMLentity [UnderBrace] {\normalorfiller\empty\upbracefill} +\defineXMLentity [OverBrace] {\normalorfiller\empty\downbracefill} +\defineXMLentity [UnderBar] {\normalorfiller\hrule\hrulefill} +\defineXMLentity [OverBar] {\normalorfiller\hrule\hrulefill} +\defineXMLentity [Hat] {\normalorfiller\empty\empty} % todo + +\defineXMLentity [downarrow] {\mathortext\downarrow\empty} +\defineXMLentity [uparrow] {\mathortext\uparrow\empty} + +\defineXMLentity [Tab] {\hskip4em} +\defineXMLentity [NewLine] {\mathortext\empty\crlf} +\defineXMLentity [IndentingNewLine] {\mathortext\empty\crlf} + +\defineXMLentity [NoBreak] {\nobreak} +\defineXMLentity [GoodBreak] {\goodbreak} +\defineXMLentity [BadBreak] {\nobreak} + +\defineXMLentity [Space] {\getXMLentity{MediumSpace}} +\defineXMLentity [NonBreakingSpace] {\getXMLentity{MediumSpace}} +\defineXMLentity [ZeroWidthSpace] {} + +\def\somespaceentity#1#2% + {\mathortext + {\mskip#1mu} + {\ifvmode\dontleavehmode\else\unskip\fi\hskip#2em\strut\hskip\zeropoint\ignorespaces}% + \relax} + +\defineXMLentity [VeryThinSpace] {\somespaceentity {2}{.125}} +\defineXMLentity [ThinSpace] {\somespaceentity {3}{.25}} +\defineXMLentity [MediumSpace] {\somespaceentity {4}{.5}} +\defineXMLentity [ThickSpace] {\somespaceentity {5}{1}} +\defineXMLentity [NegativeVeryThinSpace] {\somespaceentity{-2}{-.125}} +\defineXMLentity [NegativeThinSpace] {\somespaceentity{-3}{-.25}} +\defineXMLentity [NegativeMediumSpace] {\somespaceentity{-4}{-.5}} +\defineXMLentity [NegativeThickSpace] {\somespaceentity{-5}{-1}} + +\defineXMLentity [NegVeryThinSpace] {\getXMLentity{NegativeVeryThinSpace}} +\defineXMLentity [NegThinSpace] {\getXMLentity{NegativeThinSpace}} +\defineXMLentity [NegMediumSpace] {\getXMLentity{NegativeMediumSpace}} +\defineXMLentity [NegThickSpace] {\getXMLentity{NegativeThickSpace}} + +\defineXMLentity [nbsp] {\getXMLentity{NonBreakingSpace}} +\defineXMLentity [thinsp] {\getXMLentity{ThinSpace}} +\defineXMLentity [medsp] {\getXMLentity{MediumSpace}} +\defineXMLentity [thicksp] {\getXMLentity{ThickSpace}} + +\defineXMLentity [larr] {\getXMLentity{LeftArrow}} +\defineXMLentity [rarr] {\getXMLentity{RightArrow}} + +\ifx\MMLleft \undefined \let\MMLleft \firstofoneargument \fi +\ifx\MMLright\undefined \let\MMLright\firstofoneargument \fi + +\defineXMLentity [lbrace] {\normalordelimiter{\{}{\MMLleft \{}} +\defineXMLentity [rbrace] {\normalordelimiter{\}}{\MMLright\}}} +\defineXMLentity [lbracket] {\normalordelimiter{[}{\MMLleft [}} +\defineXMLentity [rbracket] {\normalordelimiter{]}{\MMLright]}} +\defineXMLentity [lparenthesis] {\normalordelimiter{(}{\MMLleft (}} +\defineXMLentity [rparenthesis] {\normalordelimiter{)}{\MMLright)}} +\defineXMLentity [langle] {\normalordelimiter{\langle}{\MMLleft \langle}} +\defineXMLentity [rangle] {\normalordelimiter{\rangle}{\MMLright\rangle}} + +\defineXMLentity [lang] {\getXMLentity{langle}} +\defineXMLentity [rang] {\getXMLentity{rangle}} +\defineXMLentity [lbrack] {\getXMLentity{lbracket}} +\defineXMLentity [rbrack] {\getXMLentity{rbracket}} +\defineXMLentity [lparent] {\getXMLentity{lparenthesis}} +\defineXMLentity [rparent] {\getXMLentity{rparenthesis}} + +\defineXMLentity [\letterleftbrace ] {\getXMLentity{lbrace}} +\defineXMLentity [\letterrightbrace] {\getXMLentity{rbrace}} + +\defineXMLentity [{[}] {\getXMLentity{lbracket}} +\defineXMLentity [{]}] {\getXMLentity{rbracket}} +\defineXMLentity [{(}] {\getXMLentity{lparenthesis}} +\defineXMLentity [{)}] {\getXMLentity{rparenthesis}} + + +\defineXMLentity [times] {\mathematics{\times}} +\defineXMLentity [minus] {\mathematics{-}} +\defineXMLentity [plus] {\mathematics{+}} +\defineXMLentity [plusmn] {\mathematics{\pm}} + +\defineXMLentity [nabla] {\nabla} + +\def\myspecialnormalvert {\mathematics{\vert}} +\def\myspecialstretchvert{\;\vrule\;} + +\defineXMLentity [,] {{,}} +\defineXMLentity [.] {{.}} +\defineXMLentity [+] {+} +\defineXMLentity [-] {-} +\defineXMLentity [|] {\myspecialnormalvert} +\defineXMLentity [/] {/} +\defineXMLentity [*] {\times} +\defineXMLentity [=] {=} + +% \defineXMLentity [(] {(} +% \defineXMLentity [)] {)} +% \defineXMLentity [<] {\mathematics{<}} +% \defineXMLentity [>] {\mathematics{>}} + +% \defineXMLentity [(] {\MMLleft (} +% \defineXMLentity [)] {\MMLright)} + +% \defineXMLentity [{[}] {\MMLleft [} +% \defineXMLentity [{]}] {\MMLright]} + +\defineXMLentity [++] {++} +\defineXMLentity [--] {--} +\defineXMLentity [//] {//} +\defineXMLentity [**] {\times\times} +\defineXMLentity [==] {==} +\defineXMLentity [...] {\cdots} + +\defineXMLentity [quot] {"} + +\defineXMLentity [triangle] {\mathematics\triangle} +\defineXMLentity [otimes] {\mathematics\otimes} +\defineXMLentity [oplus] {\mathematics\oplus} +\defineXMLentity [cup] {\mathematics\cup} +\defineXMLentity [cap] {\mathematics\cap} +\defineXMLentity [sdot] {\mathematics\cdot} +\defineXMLentity [dot] {\mathematics\cdot} +\defineXMLentity [sim] {\mathematics\sim} +\defineXMLentity [circ] {\mathematics\circ} +\defineXMLentity [dagger] {\mathematics\dagger} +\defineXMLentity [cdots] {\mathematics\cdots} + +\defineXMLentity [...] {\getXMLentity{cdots}} +\defineXMLentity [continued] {\getXMLentity{cdots}} + +\defineXMLentity [sub] {\getXMLentity{subset}} +\defineXMLentity [sube] {\getXMLentity{prsubset}} +\defineXMLentity [notprsubset] {\getXMLentity{notprsubset}} + +\defineXMLentity [ndash] {\endash} +\defineXMLentity [mdash] {\emdash} + +\defineXMLentity [tex-bar] {\mathematics{\vert}} +\defineXMLentity [tex-dollar] {\dollar} +\defineXMLentity [tex-backslash] {\backslash} +\defineXMLentity [tex-leftbrace] {\mathematics{\{}} +\defineXMLentity [tex-rightbrace] {\mathematics{\}}} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-newmml.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-newmml.mkii new file mode 100644 index 00000000000..e777edca11c --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-newmml.mkii @@ -0,0 +1,2744 @@ +%D \module +%D [ file=x-newmml, +%D version=2005.06.10, % 1999.12.20, +%D title=\CONTEXT\ XML Macros, +%D subtitle=MathML, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Remark: from now on this is a module and no longer an xtag +%D filter. In due time it will replace the older renderer (which +%D we will keep around for sentimental reasons). This variant has +%D no namespace support yet, but eventually we will use a \MKIV\ +%D version. + +\useXMLfilter[stk] + +\ifx\inlinemathematics\undefined + \def\inlinemathematics {\dontleavehmode\mathematics} % already in kernel + \long\def\inlinemath #1{\dontleavehmode\relax\ifmmode#1\else $#1$\fi} +\fi + +% \defineXMLentity[x000AF]{\normalorfiller{x}\hrulefill} +% CHECK FOR: \xmlrent +% \enablemathpunctuation + +%D Then we start defining the rendering macros: + +\writestatus{loading}{ConTeXt XML Macros / MathML} + +\startmodule [mathml] + +%D First we load the entities: + +\usemodule[newmme] + +% \setupmodule[a=c] +% \setupmodule[a=c] + +\unprotect + +\def\MMLrm{\mr} + +\def\MMLseparator#1{{#1}} % nils space after separator + +%D First we define some general formula elements. + +\defineXMLenvironment [formula] [label=,sublabel=] + {\dostartXMLformula\placeformula} + {\dostopXMLformula} + +\defineXMLenvironment [subformula] [label=,sublabel=] + {\dostartXMLformula\placesubformula} + {\dostopXMLformula} + +\def\dostartXMLformula#1% + {\doifelsenothingXMLop{label} + {\startformula} + {\expanded{#1[\XMLop{label}]{\XMLop{sublabel}}}\startformula}} + +\def\dostopXMLformula + {\stopformula} + +%D Since I only had the draft of MathML 2 as example of +%D rendering, there are probably a lot of omissions and +%D misinterpretations. At least I learned some bits and +%D pieces of math rendering. +%D +%D The main complications were not so much the math, but to +%D find the most efficient way to handle elements without +%D spacing beging messed up. The first implementation was +%D aimed at getting reasonable output, this second +%D implementation is already better in terms of handling +%D nesting, and I will definitely need a third one that has +%D more efficient and less ugly code. +%D +%D The \TEX\ part is not that complicated and once the +%D preprocessor was okay, the rest way just a lot of keying +%D and testing. It all comes down to gobbling, redefining, +%D and not so much to parsing. +%D +%D The second implementation expanded the whole math sequence +%D into an internal \TEX\ representation. This is a rather clean +%D and fast process. Filtering and testing takes place by +%D redefining the internal representation macros. +%D +%D The third implementation may look a bit more messy in some +%D respects. This is because in \TEX\ it's not that trivial to +%D implement a tree handler. We use a stack for the \type {apply} +%D element and other sequential content. Occasionally we need to +%D peek into child elements which involves messy code. This +%D implementation is closer to the normal \XML\ handling in +%D \CONTEXT. + +%D We start with the parent elements and the option handler. + +\defineXMLdirective [mathml] \setupMMLappearance + +\defineXMLargument [math] \automathematics +\defineXMLargument [imath] \inlinemathematics +\defineXMLargument [dmath] \displaymathematics +\defineXMLargument [m] \inlinemathematics + +%D In the styles, options can be set with: + +\def\setupMMLappearance[#1]{\dodoubleargument\getparameters[@@MML#1]} + +\def\startusingMMLarguments % optional maken + {\begingroup + %\expandXMLta % expand entities first + \getXMLta} + +\def\stopusingMMLarguments % optional maken + {\endgroup} + +\def\MMLargumentprefix{@@MML\currentXMLelement} + +%D We will apply inner math to all bits and pieces made up by an +%D \type {apply}. + +\def\MMLmathinner + {\ifinner \expandafter \firstofoneargument \else \expandafter \mathinner \fi} + +%D A few math related macros: + +\let\MMLctempresetlist\empty \def\setMMLcreset{\edef\MMLctempresetlist} + +\newcount\MMLapplydepth \def\MMLcreset{\MMLapplydepth\zerocount} + +% Stack handler + +\startXMLmapping[xmlstack:test] + + \defineXMLnested + [apply] + {\startsavingXMLelements} + {\stopsavingXMLelements} + +\stopXMLmapping + +%D Auxiliary MathML macros: (to be generalized) + +\def\doifelseMMCfunction + {\begingroup + \XMLdoifonstackelse{fn} + {\donetrue} + {\XMLdoifonstackelse{apply} + {\defXMLfirstnamedtext\ascii{apply}% + \startsavingXMLelements % best use a substack so that we do not need to \edef + \ascii + \stopsavingXMLelements} + {}% + \XMLdoifonstackelse{fn} + {\donetrue} + {\defineXMLsave[ci][type=]% + \XMLfirstnamed{ci}% + \doifelse{\XMLpar{ci}{type}{}}{fn} + {\donetrue} + {\donefalse}}}% + \ifdone + \endgroup\expandafter\firstoftwoarguments + \else + \endgroup\expandafter\secondoftwoarguments + \fi} + +\def\doifelseMMCfunctioninapply#1#2% grouped + {\begingroup + \startXMLmapping[xmlstack:test]% take fast alternative + \getXMLstackdata{#1}% + \expanded{\doifinsetelse{\getXMLstackname\plusone}{#2}} + {\stopXMLmapping + \endgroup\firstoftwoarguments } + {\stopXMLmapping + \endgroup\secondoftwoarguments}} + +\def\dodoifelseMMCfunctioninapply#1#2% + {\startXMLmapping[xmlstack:test]% take fast alternative + \getXMLstackdata{#1}% + \expanded{\doifinsetelse{\getXMLstackname\plusone}{#2}} + {\stopXMLmapping + \firstoftwoarguments } + {\stopXMLmapping + \secondoftwoarguments}} + +%D Special features: + +\newtoks \@@postponedMMLactions \setfalse \somepostponedMMLactions + +\def\postponeMMLactions#1% + {\global\settrue\somepostponedMMLactions + \global\@@postponedMMLactions\expandafter{\the\@@postponedMMLactions#1}} + +\def\postponedMMLactions + {\global\setfalse\somepostponedMMLactions + \@EA\global\@EA\@@postponedMMLactions\@EA\emptytoks + \the\@@postponedMMLactions} + +%D A couple of lists: + +\def\MMLcmainresetlist + {times,divide,power,% + lt,gt,eq,leq,geq,% + in,inverse,% + fn,% + floor,ceiling,% + mean,% + selector,% + abs,int,limit,sum,product,% + outerproduct,innerproduct,scalarproduct} + +\def\MMLcfunctionlist + {sin,arcsin,sinh,arcsinh,% + cos,arccos,cosh,arccosh,% + tan,arctan,tanh,arctanh,% + cot,arccot,coth,arccoth,% + csc,arccsc,csch,arccsch,% + sec,arcsec,sech,arcsech,% + ln,exp,log,% + abs,int,limit,sum,product,% + fn} % ? + +\def\MMLcconstructlist + {diff,partialdiff,root} % apply goes wrong on 1/2 * (a_2 + b_3) + +% apply +% +%D We use inner and grouping (begin/end and no b/e) else we +%D get problems with 1/2(1+2) and alike (todo: ask taco). +%D +%D The problem with apply is that we need to take care of +%D several situations, like: +%D +%D \starttyping +%D <apply> <.../> ... +%D <apply> <fn> ... +%D <apply> <apply> <ci> ... +%D <apply> <apply> <fn> <ci> ... +%D \stoptyping +%D +%D Because we translated version 2 of this renderer into +%D version 3 the following definitions may be sub optimal or +%D more complex than actually needed. + +\defineXMLnested % why nested? could be just an environment + [apply] + [open=,close=] + {\setups{mmc:apply:start}} + {\setups{mmc:apply:stop}} + +\startsetups mmc:apply:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:apply:stop + \stopsavingXMLelements + \MMLmathinner { + \expanded{\doifinsetelse{\getXMLstackname\plusone}{\MMLcmainresetlist,\MMLctempresetlist}} + \MMLcreset + \donothing + \ifcase\MMLapplydepth \else + \doifXMLparelse{apply}{open} \donothing{\getXMLarguments{apply}{open="("}}% slow + \doifXMLparelse{apply}{close}\donothing{\getXMLarguments{apply}{close=")"}}% slow + \fi + \doifXMLparelse{apply}{open}{\left\XMLpar{apply}{open}{}}\donothing + \advance\MMLapplydepth\plusone + \begingroup + \let\MMLctempresetlist\empty + \doifelse {\getXMLstackname\plusone} {apply} { + % <apply> <apply> ... </apply> <ci> .. </ci> </apply> + \doifelseMMCfunctioninapply \plusone {plus,minus} { + % yet incomplete and rather untested + % <apply> <apply> <minus/> <tan/> <cos/> </apply> <ci>x</ci> </apply> + } { + \MMLcreset + } + \getXMLstackdata\plusone + \ifconditional\somepostponedMMLactions + \postponedMMLactions + \else + \left(\MMLcreset\getXMLstackdata\plustwo\right) + \fi + } { + \doifelse {\getXMLstackname\plusone} {fn} { + % also postpone + \directsetup{mmc:fn:apply} + } { + \doifelse {\getXMLstackname\plusone} {csymbol} { + % also postpone + \directsetup{mmc:csymbol:apply} + } { + \doifelse {\getXMLstackname\plusone} {ci} { + \getXMLstackdata\plusone + \ifnum\XMLstacklevel>\plusone + \left(\MMLcreset\flushXMLstackwith\plustwo{\MMLseparator,}\right) + \fi + } { + \getXMLstackdata\plusone + } + } + } + } + \endgroup + \advance\MMLapplydepth\minusone + \directsetup{apply:flush} + \doifXMLparelse{apply}{close}{\right\XMLpar{apply}{close}{}}\donothing + } + \endgroup +\stopsetups + +\startsetups apply:flush +\relax + \ifcase\MMLapplydepth + \ifconditional\somepostponedMMLactions + \postponedMMLactions + \ifx\MMLpowerelement\empty\else + ^{\MMLcreset\MMLpowerelement\empty} + \global\let\MMLpowerelement\empty + \fi + \fi + \fi +\stopsetups + +% reln + +\defineXMLnestedenvironmentsave [reln] + {\writestatus{XML}{MathML element "reln" is obsolete}} + {} + +% fn + +\startsetups mmc:fn:plusminus + \ifnum\XMLstacklevel>\plustwo + \MMLcreset + \left(\expandafter\flushXMLstackwith\expandafter\plustwo\expandafter{\XMLfnoperator}\right) + \else + \getXMLstackdata\plustwo + \fi +\stopsetups + +\startsetups mmc:fn:minusplus + \directsetup{mmc:fn:plusminus} +\stopsetups + +\defineXMLnested + [fn] + {\directsetup{mmc:fn:start}} + {\directsetup{mmc:fn:stop}} + +\startsetups mmc:fn:apply + \begingroup + \startsavingXMLelements + \rawXMLstacktext\plusone % still on stack, no check, just fn content + \stopsavingXMLelements + \doifelse {\getXMLstackname\plusone} {ci} { + \flattenXMLcontent{\getXMLstackdata\plusone} + \doifsetupselse{mmc:fn:\flattenedXMLcontent} { + \global\defXMLstackdata\XMLfnoperator\plusone + \expanded{\endgroup\noexpand\directsetup{mmc:fn:\flattenedXMLcontent}} + } { + \endgroup + \MMLcreset + \getXMLstackdata\plusone + \ifnum\XMLstacklevel>\plusone + \getXMLentity{NegThinSpace} + \left(\MMLcreset\flushXMLstackwith\plustwo{\MMLseparator,}\right) + \fi + } + } { + \endgroup + \MMLcreset + \getXMLstackdata\plusone + } +\stopsetups + +\startsetups mmc:fn:start + \ifnum\XMLstacklevel>\plustwo + \def\MMCfnleft {\left(} + \def\MMCfnright{\right)} + \else + \let\MMCfnleft \relax + \let\MMCfnright\relax + \fi + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:fn:stop + \stopsavingXMLelements + \doifelse {\getXMLstackname\plusone} {ci} { + \flattenXMLcontent{\getXMLstackdata\plusone} + \doifsetupselse{mmc:fn:\flattenedXMLcontent} { + \global\defXMLstackdata\XMLfnoperator\plusone + \directsetup{mmc:fn:\flattenedXMLcontent} + } { + \MMLcreset + \getXMLstackdata\plusone + } + \endgroup + } { + \doifelse {\getXMLstackname\plusone} {apply} { + \doifelseMMCfunctioninapply \plusone {plus,minus} { + \left( + \getXMLstackdata\plusone + \right) + } { + \getXMLstackdata\plusone + } + \endgroup + \ifnum\XMLstacklevel>\plusone + \left( + \getXMLstackdata\plustwo + \right) + \fi + } { + \MMLcreset + \getXMLentity{NegThinSpace} + \MMCfnleft + \ifnum\XMLstacklevel=\plustwo\MMLccomma\fi + \flushXMLstackwith\plustwo\MMLccomma + \MMCfnright + \endgroup + } + } +\stopsetups + +% c* + +\defineXMLargument [ci] [type=] {\XMLval{mmc:ci}{\XMLop{type}} {\firstofoneargument}} +\defineXMLargument [cn] [type=,base=] {\XMLval{mmc:cn}{\XMLop{type}} {\firstofoneargument}} +\defineXMLargument [csymbol] [encoding=text] {\XMLval{mmc:cs}{\XMLop{encoding}}{\firstofoneargument}} + +%D The next definition provide a kind of plug-in mechanism (see +%D the open math extension module). + +\defineXMLsingular + [csymbol] + [encoding=text, + definitionURL=] + {\doifsomething{\XMLop{definitionURL}}{\directsetup{mmc:csymbol:apply}}} + +\startsetups mmc:csymbol:apply + \begingroup + \startsavingXMLelements + \rawXMLstacktext\plusone % still on stack, no check, just attr test + \stopsavingXMLelements + % http://www.publishers.com/SomeName + \lowercasestring\XMLpar{csymbol}{definitionURL}{}\to\mmcSymbolURL + \doifsetupselse{mmc:csymbol:} {\mmcSymbolURL} { + \expanded{\endgroup\noexpand\directsetup{mmc:csymbol:\mmcSymbolURL}} + } { + % SomeName (fallback) + \splitfilename{\XMLpar{csymbol}{definitionURL}{}} + \doifsetupselse{mmc:csymbol:\splitoffbase} { + \expanded{\endgroup\noexpand\directsetup{mmc:csymbol:\splitoffbase}} + } { + \endgroup + \XMLval{mmc:cs}{\XMLop{encoding}}{\firstofoneargument} + } + } +\stopsetups + +%D Alternative b will convert periods into comma's: +%D +%D \startbuffer +%D \startXMLdata +%D <imath><apply><cn>1.23</cn></apply></imath> +%D <dmath><apply><cn>1.23</cn></apply></dmath> +%D \stopXMLdata +%D +%D \type{\setupMMLappearance[cn] [alternative=b]} +%D +%D \startXMLdata +%D <imath><apply><cn>1.23</cn></apply></imath> +%D <dmath><apply><cn>1.23</cn></apply></dmath> +%D \stopXMLdata +%D \stopbuffer +%D +%D \start \typebuffer \getbuffer \stop + +\setupMMLappearance[cn] [\c!alternative=\v!a] + +\defineXMLargument[cn][type=,base=]{\MMLdocn} + +\def\MMLdocn#1% + {\begingroup + \doif\@@MMLcnalternative\v!b{\redefinemathcharacter [.][ord][mi]["3B]\relax}% + \XMLval{mmc:cn}{\XMLop{type}}{\firstofoneargument}{#1}% + \endgroup} + +\defineXMLsingular [sep] {\MMLcsep} \def\MMLcsep{\,} + +\setupMMLappearance[polar] [\c!alternative=\v!a] % a|b|c +\setupMMLappearance[float] [\c!symbol=\v!no] % \v!yes|dot +\setupMMLappearance[enotation][\c!symbol=\v!no] % \v!yes|dot +\setupMMLappearance[base] [\c!symbol=\v!numbers] % digits|characters|text|no + +\mapXMLvalue {mmc:ci} {set} {\MMLcCIset} +\mapXMLvalue {mmc:ci} {vector} {\MMLcCIvector} +\mapXMLvalue {mmc:ci} {matrix} {\MMLcCImatrix} +\mapXMLvalue {mmc:ci} {function} {\MMLcCIfunction} +\mapXMLvalue {mmc:ci} {complex-cartesian} {\MMLccartesian} +\mapXMLvalue {mmc:ci} {complex} {\MMLccartesian} +\mapXMLvalue {mmc:ci} {complex-polar} {\MMLcpolar} +\mapXMLvalue {mmc:ci} {polar} {\MMLcpolar} +\mapXMLvalue {mmc:ci} {fn} {\MMLcCIfunction} + +\mapXMLvalue {mmc:cn} {integer} {\MMLcCNinteger} +\mapXMLvalue {mmc:cn} {logical} {\MMLcCNlogical} +\mapXMLvalue {mmc:cn} {rational} {\MMLcCNrational} +\mapXMLvalue {mmc:cn} {complex-cartesian} {\MMLccartesian} +\mapXMLvalue {mmc:cn} {complex} {\MMLccartesian} +\mapXMLvalue {mmc:cn} {complex-polar} {\MMLcpolar} +\mapXMLvalue {mmc:cn} {polar} {\MMLcpolar} +\mapXMLvalue {mmc:cn} {e-notation} {\MMLcenotation} % new +\mapXMLvalue {mmc:cn} {float} {\MMLcfloat} % obsolete +\mapXMLvalue {mmc:cn} {real} {\MMLcfloat} + +\mapXMLvalue {mmc:cs} {text} {\MMLcCStext} + +\def\MMLcpolar#1% + {\doifdefinedelse{MMLcdopolar\@@MMLpolaralternative} + {\getvalue{MMLcdopolar\@@MMLpolaralternative}{#1}} + {#1}} + +\def\MMLcdopolara#1% + {\def\MMLcsep{\MMLseparator,}\getXMLentity{polar}\left(#1\right)} + +\def\MMLcdopolarb#1% + {\def\MMLcsep##1\empty + {\getXMLentity{exponentiale}^{##1\mskip2mu\getXMLentity{imaginaryi}}} + #1\empty} + +\def\MMLcdopolarc#1% + {\def\MMLcsep##1\empty + {\getXMLentity{exp}\left(##1\mskip2mu\getXMLentity{imaginaryi}\right)}% + #1\empty} + +\def\MMLccartesian#1% + {\def\MMLcsep{+}#1\getXMLentity{imaginaryi}} + +% float will be obsolete, and is replace by e-notation + +\def\MMLcfloat#1% + {\doifelse\@@MMLfloatsymbol\v!no +% {{\MMLrm#1}}% make sure that e shows up ok + {\mfunction{#1}}% make sure that e shows up ok + {% we should ignore \entities ! + \beforesplitstring#1\at e\to\first + \aftersplitstring #1\at e\to\last + \ifx\first\empty #1\else + \ifx\last \empty #1\else + \first + \doifelse\@@MMLfloatsymbol{dot}\cdot\times + 10^{\last}% + \fi\fi}} + +% we now have: + +\def\MMLcenotation#1% + {\doifelse\@@MMLenotationsymbol\v!no +% {\def\MMLcsep {\unskip{\MMLrm e}\ignorespaces}} + {\def\MMLcsep {\unskip\mfunction{e}\ignorespaces}} + {\def\MMLcsep##1\empty{\doifelse\@@MMLenotationsymbol{dot}\cdot\times10^{##1}}}% + #1\empty} + +\def\MMLcCIset#1% + {{\bbd#1}} + +\def\widevec#1% + {\vbox{\mathsurround\zeropoint\ialign{##\crcr + \rightarrowfill\crcr\noalign{\nointerlineskip}% + $\hfil\displaystyle{#1}\hfil$\crcr}}} + +\def\MMLcCIvector#1% + {\widevec{#1}} + +\def\MMLcCImatrix#1% + {{\bi#1}} + +\def\MMLcCIfunction#1% + {#1\getXMLentity{NegThinSpace}} + +\def\MMLcCNinteger#1% + {\doifXMLparelse{cn}{base} + {\def\MMLcCNbase{\XMLpar{cn}{base}{}}% + \doifelse\@@MMLbasesymbol\v!no + {\MMLcCNbasedata{#1}} +% {\MMLcCNbasedata{#1}_{\hbox{$\MMLrm\scriptscriptstyle + {\MMLcCNbasedata{#1}_{\mfunction{% + \processaction + [\@@MMLbasesymbol] + [\v!characters=>\MMLcCNbasestring BODH, + \v!text=>\MMLcCNbasestring{BIN}{OCT}{DEC}{HEX}, +% \s!unknown=>\MMLcCNbase]$}}}} + \s!unknown=>\MMLcCNbase]}}}} + {#1}} + +\def\MMLcCNbasedata#1% +% {\ifnum\MMLcCNbase>10{\MMLrm#1}\else#1\fi} + {\ifnum\MMLcCNbase>10\mfunction{#1}\else#1\fi} + +\def\MMLcCNbasestring#1#2#3#4% + {\ifnum\MMLcCNbase= 2 #1\else + \ifnum\MMLcCNbase= 8 #2\else + \ifnum\MMLcCNbase=10 #3\else + \ifnum\MMLcCNbase=16 #4\else + \MMLcCNbase \fi\fi\fi\fi} + +\def\MMLcCNlogical#1% +% {{\MMLrm#1}} + {\mfunction{#1}} + +\bgroup \catcode`\<=\active + + % quick and dirty, best track the stack (todo) + + \gdef\MMLcCNrational#1% + {\ConvertConstantAfter\doifinstringelse{sep}{#1} + {\doMMLcCNrational#1\empty} + {#1}} + + \gdef\doMMLcCNrational#1<sep#2>#3\empty + {\hbox{$\frac{#1}{#3}$}} + +\egroup + +\def\MMLcCStext#1% +% {{\MMLrm#1}} + {\mfunction{#1}} + +% interval + +\defineXMLnested [interval] + [closure=closed] + {\directsetup{mmc:interval:start}} + {\directsetup{mmc:interval:stop}} + +\startsetups mmc:interval:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:interval:stop + \stopsavingXMLelements + \XMLval{mmc:int}{\XMLpar{interval}{closure}{closed}}{error} + \endgroup +\stopsetups + +\startsetups mmc:interval:fetch + \defineXMLnested [interval] + [closure=closed] + {\directsetup{mmc:interval:fetch:start}} + {\directsetup{mmc:interval:fetch:stop}} +\stopsetups + +\startsetups mmc:interval:fetch:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:interval:fetch:stop + \stopsavingXMLelements + \globallet\MMCintervalfrom\empty + \globallet\MMCintervalto \empty + \ifcase\XMLstacklevel + \or + \xdef\MMCintervalfrom{\getXMLstackdata\plusone} + \or + \xdef\MMCintervalfrom{\getXMLstackdata\plusone} + \xdef\MMCintervalto {\getXMLstackdata\plustwo} + \fi + \endgroup +\stopsetups + +\setupMMLappearance[interval][\c!alternative=\v!a,\c!separator={,}] + +\mapXMLvalue {mmc:int} {closed} + {\left[\getXMLstackdata\plusone\MMLseparator\@@MMLintervalseparator\getXMLstackdata\plustwo\right]} + +\mapXMLvalue {mmc:int} {open-closed} + {\doifelse\@@MMLintervalalternative\v!b + {\left<\getXMLstackdata\plusone\MMLseparator\@@MMLintervalseparator\getXMLstackdata\plustwo\right]} + {\left(\getXMLstackdata\plusone\MMLseparator\@@MMLintervalseparator\getXMLstackdata\plustwo\right]}} + +\mapXMLvalue {mmc:int} {closed-open} + {\doifelse\@@MMLintervalalternative\v!b + {\left[\getXMLstackdata\plusone\MMLseparator\@@MMLintervalseparator\getXMLstackdata\plustwo\right>} + {\left[\getXMLstackdata\plusone\MMLseparator\@@MMLintervalseparator\getXMLstackdata\plustwo\right)}} + +\mapXMLvalue {mmc:int} {open} + {\doifelse\@@MMLintervalalternative\v!b + {\left<\getXMLstackdata\plusone\MMLseparator\@@MMLintervalseparator\getXMLstackdata\plustwo\right>} + {\left(\getXMLstackdata\plusone\MMLseparator\@@MMLintervalseparator\getXMLstackdata\plustwo\right)}} + +% inverse + +\defineXMLcommand [inverse] {\directsetup{mmc:inverse}} + +\startsetups mmc:inverse + \ifnum\XMLstacklevel>\plustwo + \getXMLentity{\getXMLstackname\plustwo}^{-1} + \left[\getXMLstackdata\plusthree\right] + \else + \xdef\MMLpowerelement{-1} + \expanded{\postponeMMLactions{\rawXMLstackdata\plustwo}} + \eraseXMLdataonstack\plustwo + \fi +\stopsetups + +% condition + +\defineXMLnested + [condition] + {\directsetup{mmc:condition:start}} + {\directsetup{mmc:condition:stop}} + +\startsetups mmc:condition:start +% \XMLdoifonstackelse{bvar} { +% \XMLfirstnamed{bvar}\mid +% } { } + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:condition:stop + \stopsavingXMLelements + \flushXMLstackfrom\plusone + \endgroup +\stopsetups + +% declare + +\setupMMLappearance[declare][\c!state=\v!start] + +\defineXMLnested + [declare] + {\directsetup{mmc:declare:start}} + {\directsetup{mmc:declare:stop}} + +\startsetups mmc:declare:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:declare:stop + \stopsavingXMLelements + \doif\@@MMLdeclarestate\v!start { + \getXMLentity{declare}\getXMLstackdata\plusone + \ifnum\XMLstacklevel>\plusone + \getXMLentity{ThickSpace} + \getXMLentity{as} + \getXMLentity{ThickSpace} + \fi + \getXMLstackdata\plustwo + } + \endgroup +\stopsetups + +% lambda + +\setupMMLappearance[lambda][\c!alternative=b] + +\defineXMLnested + [lambda] + {\directsetup{mmc:lambda:start}} + {\directsetup{mmc:lambda:stop}} + +\startsetups mmc:lambda:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:lambda:stop + \stopsavingXMLelements + \doifelse\@@MMLlambdaalternative\v!a { + \getXMLentity{lambda}(\flushXMLstackwith\plusone{\MMLseparator,}) + } { + \countXMLnamedstack{bvar} + \ifnum\scratchcounter>\plusone + \left(\flushXMLnamedstackwith\plusone{bvar}{\MMLseparator,}\right) + \else + \XMLfirstnamed{bvar} + \fi + \getXMLentity{mapsto} + \MMLcreset + \XMLfirstnamed{apply,reln,ci,cn} + } + \endgroup +\stopsetups + +\startsetups mmc:lambda:simple + \defineXMLnested + [lambda] + {\directsetup{mmc:lambda:simple:start}} + {\directsetup{mmc:lambda:simple:stop}} +\stopsetups + +\startsetups mmc:lambda:simple:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:lambda:simple:stop + \stopsavingXMLelements + \MMLcreset % new + \XMLfirstnamed{apply} + \endgroup +\stopsetups + +% compose + +\defineXMLcommand [compose] {\directsetup{mmc:compose}} + +\startsetups mmc:compose + \begingroup + \MMLcreset + \let\MMLcCIfunction\firstofoneargument % brrr + \doifelseMMCfunction { + \left(\flushXMLstackwith\plustwo\circ\right) + } { + \flushXMLstackwith\plustwo\circ + } + \endgroup +\stopsetups + +\defineXMLcommand [image] {\directsetup{mmc:image}} + +\startsetups mmc:image + \getXMLentity{image} + \left( + \begingroup + \startlocalsetups [mmc:function] + \getXMLentity\currentXMLelement + \stoplocalsetups + \getXMLstackdata\plustwo + \endgroup + \right) +\stopsetups + +\setupMMLappearance[piece][\c!separator=] + +\def\setMMLcPIECEseparator + {\processaction + [\@@MMLpieceseparator] + [ \v!yes=>\def\theMMLpieceseparator{,\@col@amp@}, + \v!no=>\let\theMMLpieceseparator\@col@amp@, + \s!default=>\let\theMMLpieceseparator\@col@amp@, + \s!unknown=>\def\theMMLpieceseparator{\,\,\hbox{\@@MMLpieceseparator}\,\,}]} + +\defineXMLargument[piecewise] {\cases} + +\defineXMLnested + [piece] + {\directsetup{mmc:piece:start}} + {\directsetup{mmc:piece:stop}} + +\defineXMLenvironmentsave + [otherwise] + {} + {\directsetup{mmc:otherwise}} + +\startsetups mmc:piece:start + \startsavingXMLelements + \setMMLcPIECEseparator +\stopsetups + +\startsetups mmc:piece:stop + \stopsavingXMLelements + \edef\ascii{\getXMLstackdata\plusone} + \@EA\XMLRtoks\@EA{\ascii\theMMLpieceseparator} + \edef\ascii{\getXMLstackdata\plustwo} + \@EA\appendtoks\@EA\mathematics\@EA{\ascii}\to\XMLRtoks + \the\XMLRtoks\crcr +\stopsetups + +\startsetups mmc:otherwise + \XMLflush{otherwise}\MMLcPIECEseparator\@col@amp@\mathematics{\getXMLentity{otherwise}}\crcr +\stopsetups + +\defineXMLcommand [quotient] {\directsetup{mmc:quotient}} + +\startsetups mmc:quotient + \lfloor\getXMLstackdata\plustwo/\getXMLstackdata\plusthree\rfloor +\stopsetups + +\defineXMLcommand [factorial] {\getXMLstackdata\plustwo !} + +\defineXMLcommand [divide] [\MMLargumentprefix] [] {\directsetup{mmc:divide}} % brr not nested + +\setupMMLappearance [divide] [\c!level=\!!maxcard,\c!alternative=\v!a] + +\startsetups mmc:divide + \startusingMMLarguments + \increment\MMLcDIVIDElevel + \doifelse \@@MMLdividealternative\v!b { + \getXMLstackdata\plustwo/\getXMLstackdata\plusthree + } { + \ifnum\MMLcDIVIDElevel>\@@MMLdividelevel\space + \getXMLstackdata\plustwo/\getXMLstackdata\plusthree + \else + \MMLcreset + \frac{\MMLcreset\getXMLstackdata\plustwo}{\MMLcreset\getXMLstackdata\plusthree}% + \fi + } + \decrement\MMLcDIVIDElevel + \stopusingMMLarguments +\stopsetups + +% min max + +\defineXMLcommand [min] {\min\directsetup{mmc:minmax}} +\defineXMLcommand [max] {\max\directsetup{mmc:minmax}} + +\startsetups mmc:minmax + \doifelse{\getXMLstackdata\plustwo}{bvar} { + {}_{\getXMLstackdata\plustwo} + \left\{\flushXMLstackwith\plusthree{\MMLseparator,}\right\} + } { + \left\{\flushXMLstackwith\plustwo {\MMLseparator,}\right\} + } +\stopsetups + +% minus plus + +\defineXMLcommand [minus] {\directsetup{mmc:minus}} +\defineXMLcommand [plus] [\MMLargumentprefix] [] {\directsetup{mmc:plus}} + +\setupMMLappearance [plus] [\c!alternative=\v!a] % b = no sign -> 3 1/4 +\setupMMLappearance [sign] [\c!reduction=\v!yes] + +\startsetups mmc:minus + \doif \@@MMLsignreduction \v!yes { + \setMMLcreset{fn,\MMLcfunctionlist} + } + \ifcase\XMLstacklevel + \or + % self + \or + -\getXMLstackdata\plustwo + \else + \flushXMLstackwith\plustwo- + \fi +\stopsetups + +\startsetups mmc:plus + \startusingMMLarguments + \doifelse \@@MMLsignreduction \v!yes { + \setMMLcreset{fn,plus,minus,\MMLcfunctionlist,\MMLcconstructlist}% was plus/, minus/ + \doifelse{\getXMLstackname\plustwo} {apply} { + % branch needed, else (a-b) + (c-d) goes wrong + % reset check in case of (-x) + 37 + \begingroup + \dodoifelseMMCfunctioninapply \plustwo {minus} { + \ifnum\XMLstacklevel>\plustwo + \endgroup + \else + \endgroup + \MMLcreset + \fi + } { + \endgroup + } + \doifelse \@@MMLplusalternative \v!b { + \getXMLstackdata\plustwo \, + } { + \flushXMLstackwith\plustwo + + } + + } { + \flushXMLstackwith\plustwo { + \doifelse {\getXMLstackname\recurselevel} {apply} { + \begingroup + \dodoifelseMMCfunctioninapply \recurselevel {minus} { + \ifnum\XMLstacklevel>\plustwo +\fi + } { + \doifelse \@@MMLplusalternative \v!b { + \, % maybe 2 1/3 + } { + + + } + } + \endgroup + \MMLcreset + } { + + + } + } + } + } { + \ifcase\XMLstacklevel + \or + % self + \or + +\getXMLstackdata\plustwo + \else + \flushXMLstackwith\plustwo+ + \fi + } + \stopusingMMLarguments +\stopsetups + +% power + +\defineXMLcommand [power] {\directsetup{mmc:power}} + +\setupMMLappearance[power][\c!reduction=\v!yes] + +\let\MMLpowerelement\empty + +\startsetups mmc:power + \doifelse {\getXMLstackname\plustwo} {apply} { + \doifelse\@@MMLpowerreduction\v!yes { + \doifelseMMCfunctioninapply \plustwo \MMLcfunctionlist { + \xdef\MMLpowerelement{\getXMLstackdata\plusthree}% postpone + \MMLcreset\getXMLstackdata\plustwo + } { + \left(\MMLcreset\getXMLstackdata\plustwo\right)^{\MMLcreset\getXMLstackdata\plusthree} + } + } { + \left(\MMLcreset\getXMLstackdata\plustwo\right)^{\MMLcreset\getXMLstackdata\plusthree} + } + } { + \getXMLstackdata\plustwo^{\MMLcreset\getXMLstackdata\plusthree} + } +\stopsetups + +% rem + +\defineXMLcommand [rem] {\flushXMLstackwith\plustwo{\getXMLentity{mod}}} + +\setupMMLappearance [times] [\c!symbol=\v!no,\c!auto=\v!yes] % new, auto catches cn cn cn + +\defineXMLcommand [times] [\MMLargumentprefix] [] {\directsetup{mmc:times}} + +\startsetups mmc:times + \startusingMMLarguments + \setMMLcreset{\MMLcfunctionlist,\MMLcconstructlist}% + \doifelse\@@MMLtimesauto\v!no { + \let\@@MMLtimes@@symbol\@@MMLtimessymbol + } { + \countXMLnamedstack {cn} + \ifnum\scratchcounter>\plusone + \doifinsetelse\@@MMLtimessymbol{\v!yes,\v!no} { + \let\@@MMLtimes@@symbol\v!yes + } { + \let\@@MMLtimes@@symbol\@@MMLtimessymbol + } + \else + \let\@@MMLtimes@@symbol\@@MMLtimessymbol + \fi + } + \doifelse\@@MMLtimes@@symbol\v!yes { + \flushXMLstackwith\plustwo\times + } { + \doifelse\@@MMLtimes@@symbol{dot} { + \flushXMLstackwith\plustwo\cdot + } { + \doifelse\@@MMLtimes@@symbol{times} { + \flushXMLstackwith\plustwo\times + } { + \flushXMLstackwith\plustwo\empty + } + } + } + \stopusingMMLarguments +\stopsetups + +\defineXMLcommand [root] {\directsetup{mmc:root}} + +\setupMMLappearance[root][\c!symbol=\v!yes] + +\startsetups mmc:root + \XMLdoifonstackelse {degree} { + \root + \doifnot\@@MMLrootsymbol\v!no{\MMLcreset\XMLfirstnamed{degree}} + \of + } { + \sqrt + } + {\MMLcreset\XMLfirstnamed{apply,reln,ci,cn}} +\stopsetups + +% gcd + +\defineXMLcommand [gcd] {\gcd\left(\MMLcreset\flushXMLstackwith\plustwo{\MMLseparator,}\right)} + +% and or xor implies + +\defineXMLcommand [and] {\flushXMLstackwith\plustwo{\getXMLentity{and}}} +\defineXMLcommand [or] {\flushXMLstackwith\plustwo{\getXMLentity{or}}} +\defineXMLcommand [xor] {\flushXMLstackwith\plustwo{\getXMLentity{xor}}} +\defineXMLcommand [implies] {\flushXMLstackwith\plustwo{\getXMLentity{implies}}} + +% not + +\defineXMLcommand [not] {\getXMLentity{not}\getXMLstackdata\plustwo} + +% forall exists + +\defineXMLcommand [forall] {\directsetup{mmc:forall}} +\defineXMLcommand [exists] {\directsetup{mmc:exists}} + +%D We need to shift left below rotated A. + +\startsetups mmc:forall + \getXMLentity{forall} + \getXMLentity{NegThinSpace} + \directsetup{mmc:forall-exists} +\stopsetups + +\startsetups mmc:exists + \getXMLentity{exists} + \directsetup{mmc:forall-exists} +\stopsetups + +\startsetups mmc:forall-exists + _{\flushXMLnamedstackwith\plustwo{bvar}{\MMLseparator,}} + \XMLdoifonstackelse {condition} { + \getXMLentity{ThickSpace} + \begingroup + \XMLfirstnamed{condition} + \endgroup + \countXMLnamedstack {apply,reln,ci,cn} + \ifcase\scratchcounter + \or + % == snelle volgende + \left\vert \MMLcreset + \getXMLentity{MediumSpace} + \flushXMLnamedstackwith\plustwo{apply,reln,ci,cn}\empty + \right. + \else + % special case + % \defineXMLignore[condition] + \collectXMLnamedstack{apply,reln,ci,cn}{\hfill\crcr} + \left\vert + \matrix{\the\XMLRtoks} + \right. + \fi + } { + :\XMLfirstnamed{apply,reln,ci,cn} + } +\stopsetups + +\defineXMLcommand [abs] {\left\vert \MMLcreset \flushXMLstackfrom\plustwo \right\vert} +\defineXMLcommand [conjugate] {{\overline{\MMLcreset \flushXMLstackfrom\plustwo}}} % watch extra {} +\defineXMLcommand [arg] {\getXMLentity{arg} \left(\MMLcreset\flushXMLstackfrom\plustwo\right)} +\defineXMLcommand [real] {\getXMLentity{real} \left(\MMLcreset\flushXMLstackfrom\plustwo\right)} +\defineXMLcommand [imaginary] {\getXMLentity{imaginary}\left(\MMLcreset\flushXMLstackfrom\plustwo\right)} +\defineXMLcommand [lcm] {\getXMLentity{lcm} \left(\flushXMLstackwith\plustwo{\MMLseparator,}\right)} +\defineXMLcommand [floor] {\getXMLentity{lfloor} \flushXMLstackfrom\plustwo \getXMLentity{rfloor}} +\defineXMLcommand [ceiling] {\getXMLentity{lceiling} \flushXMLstackfrom\plustwo \getXMLentity{rceiling}} + +% relations + +\defineXMLcommand [eq] [\MMLargumentprefix] [\c!align=] {\MMLcrelation=} +\defineXMLcommand [neq] [\MMLargumentprefix] [\c!align=] {\MMLcrelation\neq} +\defineXMLcommand [gt] [\MMLargumentprefix] [\c!align=] {\MMLcrelation>} +\defineXMLcommand [lt] [\MMLargumentprefix] [\c!align=] {\MMLcrelation<} +\defineXMLcommand [geq] [\MMLargumentprefix] [\c!align=] {\MMLcrelation\geq} +\defineXMLcommand [leq] [\MMLargumentprefix] [\c!align=] {\MMLcrelation\leq} +\defineXMLcommand [equivalent] [\MMLargumentprefix] [\c!align=] {\MMLcrelation\equiv} +\defineXMLcommand [approx] [\MMLargumentprefix] [\c!align=] {\MMLcrelation\approx} +\defineXMLcommand [factorof] [\MMLargumentprefix] [\c!align=] {\MMLcrelation\mid} + +\setupMMLappearance[relation][\c!align=\v!no] + +\def\MMLcrelation + {\startusingMMLarguments + \MMLcreset + \edef\@@MMLrelationalign{\executeifdefined{\MMLargumentprefix\c!align}\@@MMLrelationalign}% + \processaction + [\@@MMLrelationalign] + [\v!last=>\let\next\lastMMLcrelation , + \v!first=>\let\next\firstMMLcrelation, + \v!yes=>\let\next\leftMMLcrelation , + \v!left=>\let\next\leftMMLcrelation , + \v!right=>\let\next\rightMMLcrelation, + \s!default=>\let\next\noMMLcrelation , + \s!unknown=>\let\next\noMMLcrelation ] + \next} + +\def\noMMLcrelation#1% + {\flushXMLstackwith\plustwo{#1} + \stopusingMMLarguments} + +\def\lastMMLcrelation#1% weird, probably bugged + {\XMLRtoks\emptytoks + \dostepwiserecurse\plustwo\XMLstacklevel\plusone + {\appendetoks\noexpand\getXMLstackdata{\recurselevel}\to\XMLRtoks + \ifnum\recurselevel<\numexpr\XMLstacklevel-1\relax + \appendtoks\@col@amp@#1\crcr\to\XMLRtoks + \else\ifnum\recurselevel=\numexpr\XMLstacklevel-1\relax + \appendtoks\@col@amp@#1\to\XMLRtoks + \fi\fi}% + \eqalign{\the\XMLRtoks\crcr}% + \stopusingMMLarguments} + +\def\firstMMLcrelation#1% + {\collectXMLstackrows\plusthree{\crcr\@col@amp@#1}% + \eqalign{\getXMLstackdata\plustwo\@col@amp@#1\the\XMLRtoks}% + \stopusingMMLarguments} + +\def\leftMMLcrelation#1% + {\collectXMLstackrows\plustwo{\@col@amp@#1\crcr}% + \eqalign{\the\XMLRtoks}% + \stopusingMMLarguments} + +\def\rightMMLcrelation#1% + {\collectXMLstackrows\plustwo{\crcr#1{}\@col@amp@}% + \eqalign{\@col@amp@\the\XMLRtoks\crcr}% + \stopusingMMLarguments} + +\defineXMLcommand [becomes] {\MMLcrelation{:=}} + +\addtocommalist{becomes/}\MMLcmainresetlist + +% calculus and vector calculus + +\setupMMLappearance[int][\c!location=\v!top] + +\def\doMMLlimits#1% + {\doifelsevalue{@@MML#1\c!location}\v!top\limits\nolimits} + +\defineXMLnested + [domainofapplication] + {\directsetup{mmc:domainofapplication:start}} + {\directsetup{mmc:domainofapplication:stop}} + +\startsetups mmc:domainofapplication:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:domainofapplication:stop + \stopsavingXMLelements +% \MMLcreset + \flushXMLstackfrom\plusone + \endgroup +\stopsetups + +\defineXMLcommand [int] {\directsetup{mmc:int}} + +\startsetups mmc:int + \MMLcreset + \XMLdoifonstackelse{domainofapplication} { + \int\doMMLlimits{int}_{\XMLfirstnamed{domainofapplication}}\relax + } { + \XMLdoifonstackelse{condition} { + \int\doMMLlimits{int}_{\XMLfirstnamed{condition}}\relax + } { + \XMLdoifonstackelse{lowlimit} { + \int\doMMLlimits{int} + _{\XMLfirstnamed{lowlimit}} + ^{\XMLfirstnamed{uplimit}} + } { + % funny, why do we have lowlimit/uplimit then + \XMLdoifonstackelse{interval} { + \begingroup + \startlocalsetups mmc:interval:start % + \begingroup + \startsavingXMLelements + \stoplocalsetups + \startlocalsetups mmc:interval:stop % + \stopsavingXMLelements + \xdef\MMLfirstelement {\getXMLstackdata\plusone} + \xdef\MMLsecondelement{\getXMLstackdata\plustwo} + \endgroup + \stoplocalsetups + \globallet\MMLfirstelement \empty + \globallet\MMLsecondelement\empty + \XMLfirstnamed{interval} + \endgroup + \int\doMMLlimits{int} + _{\MMLfirstelement} + ^{\MMLsecondelement} + } { + \int + } + } + } + } + \MMLcreset + \XMLdoifonstackelse{apply} { + \doifelseMMCfunction { + \XMLfirstnamed{apply} + } { + % if there are too many () now, we need to be more clever + \left(\XMLfirstnamed{apply}\right) + } + } { + \XMLfirstnamed{ci} + } + \XMLdoifonstackelse{bvar} { + \,% \getXMLentity{ThinSpace}% +% {\MMLrm\getXMLentity{mathematicald}} + \mfunction{\getXMLentity{mathematicald}} + \XMLfirstnamed{bvar} + } { + % nothing + } +\stopsetups + +\setupMMLappearance[diff][\c!location=\v!top,\c!alternative=\v!a] + +\defineXMLcommand [diff] {\directsetup{mmc:diff}} +\defineXMLcommand [partialdiff] {\directsetup{mmc:partialdiff}} + +% \setupMMLappearance[diff][alternative=b] +% +% \startXMLdata +% <math><apply><apply><diff/><bvar><ci>x</ci></bvar><ci>f</ci></apply><ci>a</ci></apply></math> +% <math><apply><apply><diff/><bvar><ci>x</ci></bvar><degree>2</degree><ci>f</ci></apply><ci>a</ci></apply></math> +% \stopXMLdata + +% d^y/dx^2 +% +% \startXMLdata +% <math><apply><diff/> +% <bvar><ci>x</ci><cn type="integer">2</cn></bvar> +% <lambda><bvar><ci>x</ci></bvar><ci>y</ci></lambda> +% </apply></math> +% \stopXMLdata + +\startsetups mmc:diff + \MMLcreset + \doifelse\@@MMLdiffalternative\v!a { + \XMLdoifonstackelse{lambda} { + % a special case (mathadore/openmath) + \begingroup + \defineXMLsave[ci] + \defineXMLsave[cn] + \defineXMLprocess[lambda] + \defineXMLprocess[bvar] + \frac { + d^{\XMLfirstnamed{bvar}\XMLflush{cn}}{\XMLfirstnamed{lambda}\XMLflush{ci}} + } { + d{\XMLfirstnamed{bvar}\XMLflush{ci}}^{\XMLfirstnamed{bvar}\XMLflush{cn}} + } + \endgroup + } { + \XMLdoifonstackelse{bvar} { + \frac { + \XMLdoifonstackelse{degree} { + \collectXMLnamedstack{degree}\empty + } { + \collectXMLnamedstacknamed{bvar}{degree}+ + } + \mfunction{\getXMLentity{mathematicald}} + ^{\the\XMLRtoks} + \doif\@@MMLdifflocation\v!top { + \XMLdoifonstackelse{ci} { + \XMLfirstnamed{ci} + } { + \MMLcreset\XMLfirstnamed{apply} + } + } + } { + \mfunction{\getXMLentity{mathematicald}} + \begingroup + \defineXMLsave[degree] + \XMLfirstnamed{bvar} + \doifXMLdata{degree} { + ^{\XMLflush{degree}} + } + \endgroup + } + \doifnot\@@MMLdifflocation\v!top { + \left(\MMLcreset\XMLfirstnamed{apply,ci}\right) + } + } { + \flushXMLstackfrom\plustwo^\prime + } + } + } { + \MMLcreset + \XMLfirstnamed{apply,ci} + % there can be problems with nested diff's: ^^{} error + % so we add an empty group here + {}^ + { + \XMLdoifonstackelse{degree} { + \defXMLfirstnamedtext\ascii{degree} + \dorecurse\ascii\prime + } { + \prime + } + } + } +\stopsetups + +\startsetups mmc:partialdiff + \XMLdoifonstackelse{list} { + \getXMLentity{capitaldifferentiald}_{ + \begingroup + \setfalse\MMLlistdelimiters + \XMLallnamed{list} + \endgroup + } + \XMLfirstnamed{apply,reln,ci,cn} + } { + \XMLdoifonstackelse{bvar} { + \frac { + \XMLdoifonstackelse{degree} { + \collectXMLnamedstack{degree}\empty + } { + \collectXMLnamedstacknamed{bvar}{degree}+ + } + \getXMLentity{differentiald}^{\the\XMLRtoks} + % \let\MMLcDEGREE\gobbletwoarguments + % \doifelseMMCfunction\MMLcreset\donothing + \MMLcreset + \XMLfirstnamed{apply,reln,ci,cn} + } { + \defineXMLnested[bvar] + {\directsetup{mmc:bvar:diff:start}} + {\directsetup{mmc:bvar:diff:stop}} + \XMLfirstnamed{bvar} + } + } { + \XMLfirstnamed{apply,reln,ci,cn} + } + } +\stopsetups + +\startsetups mmc:bvar:diff:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:bvar:diff:stop + \stopsavingXMLelements + \getXMLentity{differentiald}\XMLfirstnamed{apply,reln,ci,cn} + \XMLdoifonstackelse{degree} { + ^{\XMLfirstnamed{degree}} + } { + % nothing + } + \endgroup +\stopsetups + +\def\subMMLcelement #1#2{_{#2}} +\def\superMMLcelement#1#2{^{#2}} + +\defineXMLprocess [lowlimit] +\defineXMLprocess [uplimit] +\defineXMLprocess [bvar] +\defineXMLprocess [degree] + +% option: +% +% \defineXMLentity [div] {\mathematics{\triangledown\times}} +% \defineXMLentity [curl] {\mathematics{\triangledown .}} +% \defineXMLentity [grad] {\mathematics{\triangledown }} + +\defineXMLcommand [divergence] {\getXMLentity{divergence}\directsetup{mmc:donamedfunction}} +\defineXMLcommand [grad] {\getXMLentity {grad}\directsetup{mmc:donamedfunction}} +\defineXMLcommand [curl] {\getXMLentity {curl}\directsetup{mmc:donamedfunction}} +\defineXMLcommand [laplacian] {\getXMLentity {laplacian}\directsetup{mmc:donamedfunction}} + +\defineXMLcommand [ident] {\getXMLentity {identity}\directsetup{mmc:donamedfunction}} +% \defineXMLcommand [domain] {\getXMLentity {domain}\directsetup{mmc:donamedfunction}} +% \defineXMLcommand [codomain] {\getXMLentity {codomain}\directsetup{mmc:donamedfunction}} + +\defineXMLcommand[domain] {\directsetup{mmc:domain:action}} +\defineXMLcommand[codomain]{\directsetup{mmc:codomain:action}} + +\setupMMLappearance[domain] [symbol=] +\setupMMLappearance[codomain][symbol=] + +\startsetups mmc:domain:action + \doifelsenothing\@@MMLdomainsymbol { + \getXMLentity{domain}\directsetup{mmc:donamedfunction} + } { + \@@MMLdomainsymbol_{\flushXMLstackfrom\plustwo} + } +\stopsetups +\startsetups mmc:codomain:action + \doifelsenothing\@@MMLcodomainsymbol { + \getXMLentity{codomain}\directsetup{mmc:donamedfunction} + } { + \@@MMLcodomainsymbol_{\flushXMLstackfrom\plustwo} + } +\stopsetups + + +\startsetups mmc:donamedfunction +% \left( +% \begingroup + \MMLcreset\flushXMLstackfrom\plustwo +% \endgroup +% \right) +\stopsetups + +% theory of sets + +\defineXMLnested [set] + {\setups{mmc:set:start}} + {\setups{mmc:set:stop}} + +\startsetups mmc:set:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:set:stop + \stopsavingXMLelements + \XMLdoifonstackelse{condition} { + \left\{\XMLfirstnamed{bvar}\,\middle\vert\,\XMLfirstnamed{condition}\right\} + } { + \left\{\flushXMLstackwith\plusone{\MMLseparator,}\right\} + } + \endgroup +\stopsetups + +\defineXMLnested [list] + {\setups{mmc:list:start}} + {\setups{mmc:list:stop}} + +\settrue\MMLlistdelimiters + +\startsetups mmc:list:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:list:stop + \stopsavingXMLelements + \ifconditional\MMLlistdelimiters\left [\fi + \begingroup + \settrue\MMLlistdelimiters + \flushXMLstackwith\plusone{\MMLseparator,} + \endgroup + \ifconditional\MMLlistdelimiters\right]\fi + \endgroup +\stopsetups + +\defineXMLcommand [union] {\MMLcset\cup} +\defineXMLcommand [intersect] {\MMLcset\cap} +\defineXMLcommand [in] {\MMLcset\in} +\defineXMLcommand [notin] {\MMLcset{\not\in}} +\defineXMLcommand [subset] {\MMLcset\subset} +\defineXMLcommand [prsubset] {\MMLcset\subseteq} +\defineXMLcommand [notsubset] {\MMLcset{\not\subset}} +\defineXMLcommand [notprsubset] {\MMLcset{\not\subseteq}} +\defineXMLcommand [setdiff] {\MMLcset\setminus} + +\def\MMLcset#1{\getXMLstackdata\plustwo#1\getXMLstackdata\plusthree} + +\defineXMLcommand [card] {\left\vert\flushXMLstackfrom\plustwo\right\vert} +\defineXMLcommand [cartesianproduct] {\flushXMLstackwith\plustwo\times} + +% sequences and series + +\defineXMLcommand [sum] {\MMLcSUMandPRODUCT{sum}\sum} +\defineXMLcommand [product]{\MMLcSUMandPRODUCT{product}\prod} + +\setupMMLappearance[sum] [\c!location=\v!top] +\setupMMLappearance[product][\c!location=\v!top] + +\def\stackMMLsubscripts#1% + {\vbox + {\baselineskip\zeropoint % hack, taco vragen + \halign{$\scriptstyle\hss##\hss$\cr#1\crcr}}} + +\def\MMLcSUMandPRODUCT#1#2% + {\begingroup + \XMLdoifonstackelse{condition,bvar,lowlimit} + {\def\MMLcSUMlow + {_{\XMLdoifonstackelse{condition} + {\collectXMLnamedstack{condition}{\crcr}% + \stackMMLsubscripts{\the\XMLRtoks}} + {\XMLdoifonstackelse{bvar} + {\XMLfirstnamed{bvar}% + \XMLdoifonstackelse{lowlimit}{=}{}}% + {}% + \XMLfirstnamed{lowlimit}}}}} + {\let\MMLcSUMlow\empty}% + \XMLdoifonstackelse{uplimit} + {\def\MMLcSUMup{^{\XMLfirstnamed{uplimit}}}} + {\let\MMLcSUMup\empty}% + \XMLdoifonstackelse{interval} % open math converter gives this + {\begingroup + \directsetup{mmc:interval:fetch}% + \XMLfirstnamed{interval}% + \endgroup + \ifx\MMCintervalfrom\empty\else + \def\MMLcSUMlow{_{\XMLdoifonstackelse{bvar}{\XMLfirstnamed{bvar}{=}}{}\MMCintervalfrom}}% + \fi + \ifx\MMCintervalto\empty \else + \def\MMLcSUMup{^{\MMCintervalto}}% + \fi} + {}% + \MMLcreset#2\doMMLlimits{#1}\MMLcSUMup\MMLcSUMlow + \directsetup{mmc:lambda:simple}% a bit of open math conversion mess + \MMLcreset\XMLfirstnamed{apply,lambda,ci}% + \endgroup} + +\defineXMLcommand [limit] {\directsetup{mmc:limit}} + +\setupMMLappearance[limit][\c!location=\v!top] + +\startsetups mmc:limit + \MMLcreset \lim + \doMMLlimits{limit}_{ + \MMLcreset + \XMLdoifonstackelse {condition} { + \XMLfirstnamed{condition} + } { + \XMLdoifonstackelse {bvar} { + \XMLfirstnamed{bvar}\rightarrow + } { + } + \XMLfirstnamed{lowlimit} + } + } + \begingroup + \MMLcreset + \directsetup{mmc:lambda:simple}% a bit of open math conversion mess + \XMLfirstnamed{apply,lambda}% lambda needed for openmath + \endgroup +\stopsetups + +\defineXMLcommand [tendsto] [type=default] {\directsetup{mmc:tendsto}} + +\startsetups mmc:tendsto + \MMLcreset \getXMLstackdata\plustwo + \processaction + [\XMLpar{tendsto}{type}{default}] + [ above=>\downarrow, + below=>\uparrow, + unknown=>\rightarrow] + \MMLcreset \getXMLstackdata\plusthree +\stopsetups + +% elementary classical functions + +\defineXMLcommand [exp] {\directsetup{mmc:exp}} +\defineXMLcommand [ln] {\directsetup{mmc:function}} +\defineXMLcommand [log] {\directsetup{mmc:log}} +\defineXMLignore [logbase] + +\setupMMLappearance[log][\c!location=\v!right] + +\startsetups mmc:exp + \getXMLentity{exponentiale}^{\XMLfirstnamed{apply,reln,ci,cn}} +\stopsetups + +\startsetups mmc:log + \XMLdoifonstackelse {logbase} { + \doifelse\@@MMLloglocation\v!left { + \mathop{{}^{{\defineXMLprocess[logbase]\XMLfirstnamed{logbase}}} + \getXMLentity{NegThinSpace} + \getXMLentity{log}} + } { + \getXMLentity{log}_{{\defineXMLprocess[logbase]\XMLfirstnamed{logbase}}} + } + } { + \getXMLentity{log} + } + \MMLcreset + % mmc:function:argument assumes that the apply is second in the row (*1*) + % \removeXMLdatafromstack{logbase} + \directsetup{mmc:function:argument} +\stopsetups + +% statistics + +\defineXMLcommand [mean] {\overline{\getXMLstackdata\plustwo}} +\defineXMLcommand [sdev] {\sigma(\MMLcreset\getXMLstackdata\plustwo)} +\defineXMLcommand [variance] {\sigma(\MMLcreset\getXMLstackdata\plustwo)^2} +\defineXMLcommand [median] {\getXMLentity{median}(\MMLcreset\getXMLstackdata\plustwo)} +\defineXMLcommand [mode] {\getXMLentity{mode}(\MMLcreset\getXMLstackdata\plustwo)} + +% moments + +\defineXMLcommand [moment] {\directsetup{mmc:moment}} +\defineXMLprocess [momentabout] + +\startsetups mmc:moment + \left\langle\XMLfirstnamed{apply,reln,ci,cn}^{\XMLfirstnamed{degree}}\right\rangle + \XMLdoifonstackelse{momentabout} { + _{\XMLfirstnamed{momentabout}} + } { + } +\stopsetups + +% linear algebra + +\defineXMLcommand [vector] {\directsetup{mmc:vector}} % sequence + +\setupMMLappearance [vector] [\c!direction=\v!horizontal,\c!separator={,}] + +\defineXMLnested + [vector] + {\directsetup{mmc:vector:start}} + {\directsetup{mmc:vector:stop}} + +\startsetups mmc:vector:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:vector:stop + \stopsavingXMLelements + \ifnum\XMLstacklevel>\plusone + \doifelse\@@MMLvectordirection\v!horizontal { + \left(\flushXMLstackwith\plusone{\MMLseparator\@@MMLvectorseparator}\right) + } { + \collectXMLstack\crcr + \MMLcreset\left(\matrix{\the\XMLRtoks}\right) + } + \else + \overrightarrow{\charhtstrut\getXMLstackdata\plusone} + \fi + \endgroup +\stopsetups + +\defineXMLnestedenvironmentsave [matrix] {} {\directsetup{mmc:matrix}} +\defineXMLnestedenvironmentsave [matrixrow] {} {\directsetup{mmc:matrixrow}} + +\unexpanded\def\@col@amp@{&} + +\settrue\MMCdelmatrix %( ) when true + +\startsetups mmc:matrix + \begingroup + \MMLcreset + \defineXMLnestedenvironmentsave [matrixrow] {} {\directsetup{mmc:matrixrow:do}} + \ifconditional\MMCdelmatrix + \left(\matrix{\XMLflush{matrix}}\right) + \else + \settrue\MMCdelmatrix + \matrix{\XMLflush{matrix}} + \fi + \endgroup +\stopsetups + +\startsetups mmc:matrixrow + \begingroup + \MMLcreset + \left(\matrix{\directsetup{mmc:matrixrow:do}}\right) + \endgroup +\stopsetups + +\startsetups mmc:matrixrow:do + \begingroup + \startsavingXMLelements + \XMLflush{matrixrow} + \stopsavingXMLelements + \collectXMLstackrows\plusone\@col@amp@ + \edef\ascii{\the\XMLRtoks} + \edef\ascii{\ascii} + \expandafter\endgroup\ascii\crcr +\stopsetups + +\defineXMLcommand [determinant] {\directsetup{mmc:determinant}} +\defineXMLcommand [transpose] {\directsetup{mmc:transpose}} +\defineXMLcommand [selector] {\directsetup{mmc:selector}} + +\startsetups mmc:determinant + \begingroup + \left| + \setfalse\MMCdelmatrix + \getXMLstackdata\plustwo + \right| + \endgroup +\stopsetups + +\startsetups mmc:transpose +% \getXMLstackdata\plustwo^{\MMLrm T} + \getXMLstackdata\plustwo^{\mfunction{T}} +\stopsetups + +\startsetups mmc:selector + \MMLmathinner{\getXMLstackdata\plustwo}_{\MMLcreset\flushXMLstackwith\plusthree{\MMLseparator,}} +\stopsetups + +\defineXMLcommand [vectorproduct] {\getXMLstackdata\plustwo\getXMLentity{vectorproduct}\getXMLstackdata\plusthree} +\defineXMLcommand [scalarproduct] {\getXMLstackdata\plustwo\getXMLentity{scalarproduct}\getXMLstackdata\plusthree} +\defineXMLcommand [outerproduct] {\getXMLstackdata\plustwo\getXMLentity {outerproduct}\getXMLstackdata\plusthree} + +% semantic mapping elements + +\defineXMLnested + [semantics] + {\directsetup{mmc:semantics:start}} + {\directsetup{mmc:semantics:stop}} + +\startsetups mmc:semantics:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:semantics:stop + \stopsavingXMLelements + \XMLdoifonstackelse {annotation} { + \flushXMLnamedstackwith\plusone{annotation}\empty + } { + \flushXMLnamedstackwith\plusone{apply}\empty + } + \endgroup +\stopsetups + +\defineXMLenvironmentsave + [annotation] + [encoding=] + {} + {\directsetup{mmc:annotation}} + +\startsetups mmc:annotation + \expanded{\doifinset{\XMLpar{annotation}{encoding}{}}{TeX,tex,TEX,ConTeXt,context,CONTEXT}} { + \XMLtexdata{annotation} + } +\stopsetups + +\defineXMLignore [annotation-xml] + +% misc + +\defineXMLcommand [integers] {\getXMLentity{integers}} +\defineXMLcommand [reals] {\getXMLentity{reals}} +\defineXMLcommand [rationals] {\getXMLentity{rationals}} +\defineXMLcommand [naturalnumbers] {\getXMLentity{naturalnumbers}} +\defineXMLcommand [complexes] {\getXMLentity{complexes}} +\defineXMLcommand [primes] {\getXMLentity{primes}} +\defineXMLcommand [exponentiale] {\getXMLentity{ExponentialE}} +\defineXMLcommand [imaginaryi] {\getXMLentity{ImaginaryI}} +\defineXMLcommand [notanumber] {\mathop{\mfunction{NaN}}} +\defineXMLcommand [true] {\mathop{\mfunction{true}}} +\defineXMLcommand [false] {\mathop{\mfunction{false}}} +\defineXMLcommand [emptyset] {\mathop{\O}} +\defineXMLcommand [pi] {\pi} +\defineXMLcommand [eulergamma] {\gamma} +\defineXMLcommand [infinity] {\infty} + +% gonio functions + +\defineXMLcommand[sin] {\directsetup{mmc:function}} \defineXMLcommand[arcsin] {\directsetup{mmc:function}} +\defineXMLcommand[sinh]{\directsetup{mmc:function}} \defineXMLcommand[arcsinh]{\directsetup{mmc:function}} +\defineXMLcommand[cos] {\directsetup{mmc:function}} \defineXMLcommand[arccos] {\directsetup{mmc:function}} +\defineXMLcommand[cosh]{\directsetup{mmc:function}} \defineXMLcommand[arccosh]{\directsetup{mmc:function}} +\defineXMLcommand[tan] {\directsetup{mmc:function}} \defineXMLcommand[arctan] {\directsetup{mmc:function}} +\defineXMLcommand[tanh]{\directsetup{mmc:function}} \defineXMLcommand[arctanh]{\directsetup{mmc:function}} +\defineXMLcommand[cot] {\directsetup{mmc:function}} \defineXMLcommand[arccot] {\directsetup{mmc:function}} +\defineXMLcommand[coth]{\directsetup{mmc:function}} \defineXMLcommand[arccoth]{\directsetup{mmc:function}} +\defineXMLcommand[csc] {\directsetup{mmc:function}} \defineXMLcommand[arccsc] {\directsetup{mmc:function}} +\defineXMLcommand[csch]{\directsetup{mmc:function}} \defineXMLcommand[arccsch]{\directsetup{mmc:function}} +\defineXMLcommand[sec] {\directsetup{mmc:function}} \defineXMLcommand[arcsec] {\directsetup{mmc:function}} +\defineXMLcommand[sech]{\directsetup{mmc:function}} \defineXMLcommand[arcsech]{\directsetup{mmc:function}} + +\setupMMLappearance[function][\c!reduction=\v!yes] + +\startsetups mmc:function + \getXMLentity\currentXMLelement + \ifx\MMLpowerelement\empty\else + ^{\MMLcreset\MMLpowerelement\empty} + \getXMLentity{NegThinSpace} + \global\let\MMLpowerelement\empty + \fi + \doif {\getXMLstackname\plusone} {\currentXMLelement} { + % rather fuzzy test; looks like an apply case + \directsetup{mmc:function:argument} + } +\stopsetups + +\startsetups mmc:function:argument + \doifelse\@@MMLfunctionreduction\v!yes { + % \doifelse {\getXMLstackname\plustwo} {apply} { + % \doifelseMMCfunctioninapply \plustwo \MMLcfunctionlist \donefalse \donetrue + % + % best is to grab the apply (independent of order), (*1*), so: + % + \XMLdoifonstackelse {apply} { + \doifelseMMCfunctioninapply \XMLstackposition {\MMLcfunctionlist,divide} \donefalse \donetrue + } { + \donefalse + } + } { + \donetrue + } + % beware, we still flush from 2 up + \ifdone + \left(\MMLcreset\flushXMLstackfrom\plustwo\right) + \else + \MMLcreset\flushXMLstackfrom\plustwo + \fi +\stopsetups + +% presentation mml + +\def\resetMMLseparator + {\newcounter\MMLxxcounter + \let\lastMMLseparator\empty} + +\def\grabMMLseparator#1% + {\increment\MMLxxcounter + \newcounter\MMLyycounter + \expanded{\dograbMMLseparator#1\noexpand\relax}} + +\def\dograbMMLseparator + {\increment\MMLyycounter + \doifnextcharelse\relax + {\lastMMLseparator\gobbleoneargument} + {\doifnextcharelse\xmlrent\grabMMLseparatora\grabMMLseparatorb}} + +\def\grabMMLseparatora#1\xmlrent#2% + {\ifnum\MMLxxcounter=\MMLyycounter\space + \def\lastMMLseparator{\xmlrent{#2}}% + \fi + \dograbMMLseparator} + +\def\grabMMLseparatorb#1% + {\ifnum\MMLxxcounter=\MMLyycounter\space + \doifXMLentityelse{#1} + {\def\lastMMLseparator{\xmlrent{#1}}} + {\def\lastMMLseparator{#1}}% + \fi + \dograbMMLseparator} + +% + +\defineXMLargument [mi] \MMLpMI +\defineXMLargument [mn] \MMLpMN +\defineXMLargument [mo] \MMLpMO + +\def\MMLpMI#1% + {\begingroup + \setMMLpmathstyle{mstyle}% + #1% + \endgroup} + +% \def\MMLpMN#1% +% {\begingroup +% \MMLrm +% \setMMLpmathstyle{mstyle}% +% #1% +% \endgroup} + +\def\MMLpMN#1% + {\mfunction{\setMMLpmathstyle{mstyle}#1}} + +\def\MMLpMO#1% yes or no + {\flattenXMLcontent{#1}% + \doifXMLentityelse\flattenedXMLcontent + {\getXMLentity\flattenedXMLcontent} + {\ConvertConstantAfter\doifinstringelse{\xmlrent}{#1} % TODO ! ! ! ! ! ! ! ! + {#1} + {\hbox + {\setMMLpmathstyle{mstyle}% + \ignorespaces#1\unskip}}}} + +% we need to get rid of spaces: <mo> → </mo> + +\def\MMLpMO#1% yes or no + {\flattenXMLcontent{#1}% + \doifXMLentityelse\flattenedXMLcontent + {\getXMLentity\flattenedXMLcontent} + {\ignorespaces#1\removeunwantedspaces}} + +\def\doMMLleft #1{\pushmacro\left \let\left \empty\normalleft #1\popmacro\left} +\def\doMMLright#1{\pushmacro\right\let\right\empty\normalright#1\popmacro\right} + +\let\MMLpopen \empty +\let\MMLpclose\empty + +\defineXMLnested [mfenced] [open=(,close=),separators=] + {\directsetup{mmp:mfenced:start}} + {\directsetup{mmp:mfenced:stop}} + +\startsetups mmp:mfenced:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:mfenced:stop + \stopsavingXMLelements + \edef\MMLpopen {\XMLpar{mfenced}{open} {}} + \edef\MMLpclose{\XMLpar{mfenced}{close}{}} + \ifx\MMLpopen \space\let\MMLpopen \empty\fi + \ifx\MMLpclose\space\let\MMLpclose\empty\fi + \ifx\MMLpopen\empty + \ifx\MMLpclose\empty + \else + \doMMLleft. + \fi + \else + \doMMLleft\MMLpopen + \fi + \pushmacro\MMLpopen + \pushmacro\MMLpclose + \doifelsenothing{\XMLpar{mfenced}{separators}{}} { + \flushXMLstackfrom\plusone + } { + \resetMMLseparator + \flushXMLstackwith\plusone { + \begingroup + \let\myspecialnormalvert\myspecialstretchvert + \grabMMLseparator{\XMLpar{mfenced}{separators}{}} + \endgroup + } + } + \popmacro\MMLpclose + \popmacro\MMLpopen + \ifx\MMLpclose\empty + \ifx\MMLpopen\empty + \else + \doMMLright. + \fi + \else + \doMMLright\MMLpclose + \fi + \endgroup +\stopsetups + +% \startbuffer +% <math><mfenced separators="" open="(" close=")"><mi>x</mi></mfenced></math> +% <math><mfenced separators="" open="" close=")"><mi>x</mi></mfenced></math> +% <math><mfenced separators="" open="(" close="" ><mi>x</mi></mfenced></math> +% <math><mfenced separators="" open="" close="" ><mi>x</mi></mfenced></math> +% <math><mfenced separators="" open="" close=" "><mi>x</mi></mfenced></math> +% \stopbuffer +% +% \processXMLbuffer + +\defineXMLnestedenvironmentsave [menclose] [notation=] + {\directsetup{mmp:menclose:start}} + {\directsetup{mmp:menclose:stop}} + +\startsetups mmp:menclose:start + \begingroup +\stopsetups + +\startsetups mmp:menclose:stop + \doifelse{\XMLpar{menclose}{notation}{}}{longdiv} { + \overline{)\XMLflush{menclose}} + } { + \XMLflush{menclose} + } + \endgroup +\stopsetups + +\defineXMLnested [mfrac] [linethickness=] + {\directsetup{mmp:mfrac:start}} + {\directsetup{mmp:mfrac:stop}} + +\startsetups mmp:mfrac:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:mfrac:stop + \stopsavingXMLelements + \doifXMLparelse{mfrac}{linethickness} { + \edef\theXMLpar{\XMLpar{mfrac}{linethickness}{1}} + \processaction + [\theXMLpar] + [ thin=>\scratchdimen=.2pt, + medium=>\scratchdimen=.4pt, + thick=>\scratchdimen=.8pt, + unknown=>\setdimensionwithunit\scratchdimen{\theXMLpar}{}] + {{\getXMLstackdata\plusone}\above\scratchdimen{\getXMLstackdata\plustwo}} + } { + \frac{\getXMLstackdata\plusone}{\getXMLstackdata\plustwo} + } + \endgroup +\stopsetups + +\defineXMLargument + [ms] + [lquote=\xmlrent{quot}, + rquote=\xmlrent{quot}, + fontweight=, + fontstyle=, + mathstyle=, + mathvariant=, + background=, + color=] + {\MMLpSTRING} + +\def\MMLpSTRING#1% + {\hbox + {\tf % else encoding problems + \MMLpTEXT{\XMLpar{ms}{lquote}{}% + \doMMPpbackground{ms}{\doMMPpcolor{ms}{\setMMLptextstyle{ms}\ignorespaces#1\removeunwantedspaces}}% + \XMLpar{ms}{rquote}{}}}} + +\defineXMLenvironment + [mstyle] + [fontweight=, + fontstyle=, + mathstyle=, + mathvariant=, + background=, + color=] + {\begingroup} + {\endgroup} + +\defineXMLargument [mtext] [CPA] \MMLpTEXT +\defineXMLargument [merror] [CPA] \MMLpERROR +\defineXMLargument [mphantom] [CPA] \MMLpPHANTOM +\defineXMLargument [mpadded] [CPA] \MMLpPADDED + +\mapXMLvalue{mmp}{normal} {\tf} \mapXMLvalue{mmp}{double-stuck} {\bf} +\mapXMLvalue{mmp}{bolditalic} {\bi} \mapXMLvalue{mmp}{bold-italic} {\bi} +\mapXMLvalue{mmp}{boldslanted}{\bs} \mapXMLvalue{mmp}{bold-slanted} {\bs} +\mapXMLvalue{mmp}{boldnormal} {\bf} \mapXMLvalue{mmp}{bold} {\bf} +\mapXMLvalue{mmp}{slanted} {\sl} \mapXMLvalue{mmp}{normalslanted}{\sl} +\mapXMLvalue{mmp}{italic} {\it} \mapXMLvalue{mmp}{normalitalic} {\it} +\mapXMLvalue{mmp}{fraktur} {\bf} \mapXMLvalue{mmp}{bold-fraktur} {\bf} +\mapXMLvalue{mmp}{script} {\tf} \mapXMLvalue{mmp}{bold-script} {\bf} + +% and all kind of other crappy names + +\def\setMMLptextstyle#1% + {\XMLval{mmp}{\XMLpar{#1}{fontweight}{}\XMLpar{#1}{fontstyle}{}}{}} + +\def\setMMLpmathstyle#1% + {\XMLval{mmp}{\XMLpar{#1}{mathvariant}{}}{}} + +\def\doMMPpcolor#1#2% + {\doifXMLparelse{#1}{color}{\color[\XMLpar{#1}{color}{}]{#2}}{#2}} + +\def\doMMPpbackground#1#2% + {\doifXMLparelse{#1}{background} + {\inframed + [\c!frame=\v!off, + \c!background=\v!color, + \c!backgroundcolor=\XMLpar{#1}{background}{}] + {#2}} + {#2}} + +\def\MMLpTEXT#1% + {\hbox + {\tf % else encoding problems + \doMMPpbackground{ms}{\doMMPpcolor{ms}{\setMMLptextstyle{ms}\ignorespaces#1\removeunwantedspaces}}}} + +\def\MMLpERROR#1% + {\hbox{$\displaystyle#1$}} + +\def\MMLpPHANTOM#1% + {\phantom{\ignorespaces{}#1\unskip}} % watch spacing {} hack + +\def\MMLpPADDED#1% + {#1} + +% mrow + +\defineXMLenvironment [mrow] {\resetMMLbounds} {\finishMMLbounds} + +% \def\MMLleft #1{\increment\MMLboundslevel\left #1} +% \def\MMLright#1{\right#1\decrement\MMLboundslevel} + +% \def\resetMMLbounds +% {\let\MMLboundslevel\!!plusone\left.} + +% \def\finishMMLbounds +% {\dorecurse\MMLboundslevel{\right.}} + +\def\resetMMLbounds + {\pushmacro\MMLboundslevel + \newcounter\MMLboundslevel} + +\def\MMLleft #1% + {\increment\MMLboundslevel + \normalleft#1} + +\def\MMLright#1% + {\ifnum\MMLboundslevel=0 \normalleft.\!\fi + \normalright#1% + \decrement\MMLboundslevel} + +\def\finishMMLbounds + {\ifnum\MMLboundslevel>0 + \normalright.\!% + \decrement\MMLboundslevel + \expandafter\finishMMLbounds + \else + \popmacro\MMLboundslevel + \fi} + +\defineXMLnested [msqrt] {\directsetup{mmp:msqrt:start}} {\directsetup{mmp:msqrt:stop}} +\defineXMLnested [mroot] {\directsetup{mmp:mroot:start}} {\directsetup{mmp:mroot:stop}} + +\startsetups mmp:msqrt:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:msqrt:stop + \stopsavingXMLelements + \sqrt{\flushXMLstackfrom\plusone} + \endgroup +\stopsetups + +\startsetups mmp:mroot:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:mroot:stop + \stopsavingXMLelements + \root{\getXMLstackdata\plustwo}\of{\getXMLstackdata\plusone} + \endgroup +\stopsetups + +\setupMMLappearance[scripts][\c!alternative=\v!a] + +\defineXMLnested [msub] {\directsetup{mmp:msub:start}} {\directsetup{mmp:msub:stop}} +\defineXMLnested [msup] {\directsetup{mmp:msup:start}} {\directsetup{mmp:msup:stop}} +\defineXMLnested [msubsup] {\directsetup{mmp:msbp:start}} {\directsetup{mmp:msbp:stop}} + +\startsetups mmp:msub:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:msub:stop + \stopsavingXMLelements + \doifelse\@@MMLscriptsalternative\v!a { + {\getXMLstackdata\plusone}_{\getXMLstackdata\plustwo} + } { + \getXMLstackdata\plusone_{\getXMLstackdata\plustwo} + } + \endgroup +\stopsetups + +\startsetups mmp:msup:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:msup:stop + \stopsavingXMLelements + \doifelse\@@MMLscriptsalternative\v!a { + {\getXMLstackdata\plusone}^{\getXMLstackdata\plustwo} + } { + \getXMLstackdata\plusone^{\getXMLstackdata\plustwo} + } + \endgroup +\stopsetups + +\startsetups mmp:msbp:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:msbp:stop + \stopsavingXMLelements + \getXMLstackdata\plusone_{\getXMLstackdata\plustwo}^{\getXMLstackdata\plusthree} + \endgroup +\stopsetups + +\defineXMLnested [mover] {\directsetup{mmp:mover:start}} {\directsetup{mmp:mover:stop}} +\defineXMLnested [munder] {\directsetup{mmp:munder:start}} {\directsetup{mmp:munder:stop}} +\defineXMLnested [munderover] {\directsetup{mmp:munderover:start}} {\directsetup{mmp:munderover:stop}} + +\startsetups mmp:mover:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:mover:stop + \stopsavingXMLelements + \mathop{\vbox{\mathsurround\zeropoint\ialign{\hss##\hss\crcr\noalign{\kern3\points}% + \disabledelimiter\doMMLfiller{\getXMLstackdata\plustwo} + \crcr\noalign{\kern3\points\nointerlineskip}% + \disabledelimiter\doMMLfiller{\getXMLstackdata\plusone} + \crcr}}} + \limits + \endgroup +\stopsetups + +\startsetups mmp:munder:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:munder:stop + \stopsavingXMLelements + \mathop{\vtop{\mathsurround\zeropoint\ialign{\hss##\hss\crcr + \disabledelimiter\doMMLfiller{\getXMLstackdata\plusone} + \crcr\noalign{\kern3\points\nointerlineskip}% + \disabledelimiter\doMMLfiller{\getXMLstackdata\plustwo} + \crcr\noalign{\kern3\points}}}} + \limits + \endgroup +\stopsetups + +\startsetups mmp:munderover:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:munderover:stop + \stopsavingXMLelements + \getXMLstackdata\plusone + _{\disablefiller\disabledelimiter\getXMLstackdata\plustwo} + ^{\disablefiller\disabledelimiter\getXMLstackdata\plusthree} + \endgroup +\stopsetups + +\def\doMMLfiller#1% bugged + {\pushmacro\doMMLfiller + \let\doMMLfiller\gobbleoneargument + \gdef\dodoMMLfiller{\disablefiller\mathematics{#1}}% + \hbox + {\def\normalorfiller##1##2% + {\gdef\dodoMMLfiller{\enablefiller#1}% + \let\normalorfiller\gobbletwoarguments}% + $#1$}% + \popmacro\doMMLfiller + \dodoMMLfiller} + +% tables + +% obsolete: \setupMMLappearance[mtable][\c!alternative=\v!a] + +\mapXMLvalue {mmp:mtable} {align:left} {right} +\mapXMLvalue {mmp:mtable} {align:right} {left} +\mapXMLvalue {mmp:mtable} {align:center} {middle} + +\mapXMLvalue {mmp:mtable} {frame:none} {off} +\mapXMLvalue {mmp:mtable} {frame:solid} {on} +\mapXMLvalue {mmp:mtable} {frame:on} {on} + +\defineXMLnested + [mtable] + [columnalign=, + columnspacing=.25ex, + rowspacing=.25ex, + frame=, + color=, + background=] + {\directsetup{mmp:mtable:start}} + {\directsetup{mmp:mtable:stop}} + +\defineXMLnestedargument + [mtr] + {\MMPmtableHANDLEtr} + +\defineXMLnestedargument + [mlabeledtr] + {\MMPmtableHANDLEtr} + +\defineXMLnestedargument + [mtd] + [columnalign=, + columnspacing=.25ex, + rowspacing=.25ex, + frame=, + color=, + background=] + {\MMPmtableHANDLEtd} + +\startsetups mmp:mtable:start + \vcenter \bgroup + \MMLpTABLEsplitter{background} \c!backgroundcolor + \MMLpTABLEsplitter{color} \c!color + \MMLpTABLEmapper {frame} \c!frame + \MMLpTABLEmapper {columnalign}\c!align + \setMMLpunit{\XMLpar{mtable}{rowspacing}\empty}{.25ex} + \let\MMLpTABLEoffset\MMLpunit + \bTABLE[\c!frame=\v!off,\c!background=\v!color,\c!offset=\MMLpTABLEoffset] +\stopsetups + +\startsetups mmp:mtable:stop + \eTABLE + \egroup +\stopsetups + +\long\def\MMPmtableHANDLEtr#1{% + \bTR\ignorespaces#1\removeunwantedspaces\eTR +} + +\long\def\MMPmtableHANDLEtd#1{% + \let\theMMLpTABLEmap\empty + \MMLpTABLEmap{background} \c!backgroundcolor + \MMLpTABLEmap{color} \c!color + \MMLpTABLEmap{frame} \c!frame + \MMLpTABLEmap{columnalign}\c!align + \expanded{\bTD[\theMMLpTABLEmap]}% + $\ignorespaces#1\removeunwantedspaces$\eTD +} + +\def\MMLpTABLEmapper#1#2% + {\doifXMLparelse{mtable}{#1} + {\newcounter\MMLcounter + \def\docommand##1% + {\increment\MMLcounter + \expanded{\setupTABLE[column][\MMLcounter][#2=\XMLval{mmp:mtable}{#2:##1}\empty]}}% + \expanded{\processseparatedlist[\XMLpar{mtable}{#1}\empty]}[ ]\docommand} + {}} + +\def\MMLpTABLEsplitter#1#2% + {\doifXMLparelse{mtable}{#1} + {\newcounter\MMLcounter + \def\docommand##1% + {\increment\MMLcounter + \expanded{\setupTABLE[column][\MMLcounter][#2=##1]}}% + \expanded{\processseparatedlist[\XMLpar{mtable}{#1}\empty]}[ ]\docommand} + {}} + +\def\MMLpTABLEmap#1#2% + {\doifXMLparelse{mtd}{#1} + {\edef\theMMLpTABLEmap{#2=\XMLval{mmp:mtable}{#2:\XMLpar{mtd}{#1}\empty}\empty,\theMMLpTABLEmap}} + {}} + +\defineXMLsingular [mspace] [width=.5em] {\directsetup{mmp:mspace}} + +\startsetups mmp:mspace + \setMMLpunit{\XMLpar{mspace}{width}{}}{.5em} + \hskip\MMLpunit\relax +\stopsetups + +\def\setMMLpunit#1#2% i've forgotten what this means + {\setbox\scratchbox=\hbox + {\edef\ascii{#1}% + \@EA\aftersplitstring\ascii\at.\to\ascii + \scratchcounter=\ifx\ascii\empty#1\else\ascii\fi + \unskip\unskip}% + \ifdim\wd\scratchbox=\zeropoint + \edef\MMLpunit{#1em}% + \else + \edefconvertedargument\ascii{#1}% + \convertasciiafter\doifinstringelse{em}{\ascii}{\edef\MMLpunit{#1}}{% + \convertasciiafter\doifinstringelse{ex}{\ascii}{\edef\MMLpunit{#1}}{% + \convertasciiafter\doifinstringelse{pt}{\ascii}{\edef\MMLpunit{#1}}{% + \edef\MMLpunit{#2}}}}% + \fi} + +% end of tables + +\def\setMMLpunit#1#2% + {\setbox\scratchbox=\hbox + {\edef\ascii{#1}% + \@EA\aftersplitstring\ascii\at.\to\ascii + \scratchcounter=\ifx\ascii\empty#1\else\ascii\fi + \unskip\unskip}% + \ifdim\wd\scratchbox=\zeropoint + \edef\MMLpunit{#1em}% + \else + \edefconvertedargument\ascii{#1}% + \convertasciiafter\doifinstringelse{em}{\ascii}{\edef\MMLpunit{#1}}{% + \convertasciiafter\doifinstringelse{ex}{\ascii}{\edef\MMLpunit{#1}}{% + \convertasciiafter\doifinstringelse{pt}{\ascii}{\edef\MMLpunit{#1}}{% + \edef\MMLpunit{#2}}}}% + \fi} + +\defineXMLsingular [mspace] [width=.5em] {\directsetup{mmp:mspace}} + +\startsetups mmp:mspace + \setMMLpunit{\XMLpar{mspace}{width}{}}{.5em} + \hskip\MMLpunit +\stopsetups + +\defineXMLsingular [mglyph] [fontfamily=,index=1,alt=] {\directsetup{mmp:mglyph}} + +\startsetups mmp:mglyph + \def\MMLpglyph{\XMLpar{mglyph}{fontfamily}{}}% + \doifelsenothing{\MMLpglyph} { + \hbox{\tttf[fontfamily unspecified]} + } { + \doifdefinedelse{\MMLpglyph} { + \hbox{\getvalue{\MMLpglyph}\char0\XMLpar{mglyph}{index}{1}} + } { + \doifelsenothing{\XMLpar{mglyph}{alt}{}} { + \hbox{\tttf[unknown fontfamily \XMLpar{mglyph}{fontfamily}{}]} + } { + \hbox{\tttf\XMLpar{mglyph}{alt}{}} + } + } + } +\stopsetups + +\defineXMLsingular [malignmark] {} +\defineXMLsingular [none] {} +\defineXMLsingular [mprescripts] {} + +\defineXMLnested + [mmultiscripts] + {\setups{mmp:mmultiscripts:start}} + {\setups{mmp:mmultiscripts:stop}} + +\startsetups mmp:mmultiscripts:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmp:mmultiscripts:stop + \stopsavingXMLelements + \donefalse + \scratchcounter\zerocount + \dorecurse\XMLstacklevel { + % watch the extra {}'s + \ifdone + \ifodd\scratchcounter + _{\getXMLstackdata\recurselevel} + \else + ^{\getXMLstackdata\recurselevel}{} + \fi + \else + \doif{\getXMLstackname\recurselevel}{mprescripts}{\donetrue{}} + \fi + \ifdone \advance\scratchcounter\plusone \fi + + } + \donetrue + \scratchcounter\zerocount + \dorecurse\XMLstacklevel { + \ifdone + % watch the extra {}'s + \ifcase\scratchcounter + \getXMLstackdata\recurselevel + \else\ifodd\scratchcounter + _{\getXMLstackdata\recurselevel} + \else + ^{\getXMLstackdata\recurselevel}{} + \fi\fi + \fi + \doif{\getXMLstackname\recurselevel}{mprescripts}{\donefalse} + \ifdone \advance\scratchcounter\plusone \fi + } + \endgroup +\stopsetups + +% experimental patches + +\startmoduletestsection + +\let\MMLdoL\donothing +\let\MMLdoR\donothing + +\startsetups mmc:apply:start + \begingroup + \startsavingXMLelements +\stopsetups + +\startsetups mmc:apply:stop + \stopsavingXMLelements + \MMLmathinner { + \expanded{\doifinsetelse{\getXMLstackname\plusone}{\MMLcmainresetlist,\MMLctempresetlist}} + \MMLcreset + \donothing + \ifcase\MMLapplydepth \else + \doifXMLparelse{apply}{open} \donothing{\getXMLarguments{apply}{open="("}}% slow + \doifXMLparelse{apply}{close}\donothing{\getXMLarguments{apply}{close=")"}}% slow + \fi + \advance\MMLapplydepth\plusone + \begingroup + \doifXMLparelse{apply}{open} % now inside the group + {\edef\MMLdoL{\noexpand\left \XMLpar{apply}{open} {(}} + \edef\MMLdoR{\noexpand\right\XMLpar{apply}{close}{)}}} + {\let\MMLdoL\donothing + \let\MMLdoR\donothing} + \let\MMLctempresetlist\empty + \doifelse {\getXMLstackname\plusone} {apply} { + % <apply> <apply> ... </apply> <ci> .. </ci> </apply> + \doifelseMMCfunctioninapply \plusone {plus,minus} { +% [a] + % yet incomplete and rather untested + % <apply> <apply> <minus/> <tan/> <cos/> </apply> <ci>x</ci> </apply> + } { +% [b] + \MMLcreset + } + \MMLdoL + \getXMLstackdata\plusone + \ifconditional\somepostponedMMLactions + \postponedMMLactions + \else + \left(\MMLcreset\getXMLstackdata\plustwo\right) + \fi + \MMLdoR + } { + \doifelse {\getXMLstackname\plusone} {fn} { +% [c] + % \MMLdoL/R are to be taken care of in the next setup + \directsetup{mmc:fn:apply} + } { + \doifelse {\getXMLstackname\plusone} {csymbol} { + % \MMLdoL/R are to be taken care of in the next setup +% [d] + \directsetup{mmc:csymbol:apply} + } { + \doifelse {\getXMLstackname\plusone} {ci} { +% [e] + % \MMLdoL/R are to be taken care of in the next setup + \directsetup{mmc:ci:apply} + } { +% [f] + \MMLdoL + \getXMLstackdata\plusone + \MMLdoR + } + } + } + } + \endgroup + \advance\MMLapplydepth\minusone + \directsetup{apply:flush} + } + \endgroup +\stopsetups + +\startsetups mmc:fn:apply + \begingroup + \startsavingXMLelements + \rawXMLstacktext\plusone % still on stack, no check, just fn content + \stopsavingXMLelements + \doifelse {\getXMLstackname\plusone} {ci} { + \flattenXMLcontent{\getXMLstackdata\plusone} + \doifsetupselse{mmc:fn:\flattenedXMLcontent} { + % \MMLdoL/MMLdoR to be handled in plugin + \global\defXMLstackdata\XMLfnoperator\plusone + \expanded{\endgroup\noexpand\directsetup{mmc:fn:\flattenedXMLcontent}} + } { + \endgroup + \MMLcreset + \MMLdoL + \getXMLstackdata\plusone + \ifnum\XMLstacklevel>\plusone + \getXMLentity{NegThinSpace} + \left(\MMLcreset\flushXMLstackwith\plustwo{\MMLseparator,}\right) + \fi + \MMLdoR + } + } { + \endgroup + \MMLcreset + \MMLdoL + \getXMLstackdata\plusone + \MMLdoR + } +\stopsetups + +\startsetups mmc:csymbol:apply + \begingroup + \defineXMLsave[csymbol][definitionURL=,encoding=] + \rawXMLstackdata\plusone % was text % still on stack, no check, just attr test + % \MMLdoL/MMLdoR to be handled in plugin + \lowercasestring\XMLpar{csymbol}{definitionURL}{}\to\mmcSymbolURL + \doifsetupselse{mmc:csymbol:\mmcSymbolURL} { + \expanded{\endgroup\noexpand\directsetup{mmc:csymbol:\mmcSymbolURL}} + } { + \endgroup + %\XMLval{mmc:cs}{\XMLop{encoding}}{\firstofoneargument}% fails when no content + \XMLval{mmc:cs}{\XMLop{encoding}}{} + } +\stopsetups + +\defineXMLsingular + [csymbol] + [encoding=text, + definitionURL=] + {\directsetup{mmc:csymbol:apply:singular}} + +\startsetups mmc:csymbol:apply:singular + \lowercasestring\XMLpar{csymbol}{definitionURL}{}\to\mmcSymbolURL + \directsetup{mmc:csymbol:\mmcSymbolURL} +\stopsetups + +\startsetups mmc:ci:apply + \getXMLstackdata\plusone + \ifnum\XMLstacklevel>\plusone + \left(\MMLcreset\flushXMLstackwith\plustwo{\MMLseparator,}\right) + \fi +\stopsetups + +\def\xflushXMLstackwith#1#2#3#4% num bgroup egroup whatever + {\dostepwiserecurse{#1}\XMLstacklevel\plusone + {#2\relax + \ifnum\recurselevel>#1\relax#4\fi + \getXMLstackdata\recurselevel + #3}} + +\def\xflushXMLstackfrom#1#2#3% + {\dostepwiserecurse{#1}\XMLstacklevel\plusone + {#2\getXMLstackdata\recurselevel#3}} + +% <apply><divide/> +% <apply><minus/> +% <apply><minus/><ci>b</ci></apply> +% <apply><minus/><ci>b</ci></apply> +% <apply><root/> <ci>a</ci></apply> +% </apply> +% <apply><minus/> +% <apply><minus/><ci>b</ci><ci>b</ci></apply> +% <apply><minus/><ci>b</ci></apply> +% <apply><root/> <ci>a</ci></apply> +% </apply> +% </apply> + +\startsetups mmc:minus + \doif \@@MMLsignreduction \v!yes { + \setMMLcreset{fn,\MMLcfunctionlist} + } + \ifcase\XMLstacklevel + \or + % self + \or + -\getXMLstackdata\plustwo + \else + \dostepwiserecurse\plustwo\XMLstacklevel\plusone { + \begingroup + \doifelse {\getXMLstackname\recurselevel} {apply} { + \ifnum\recurselevel=\plustwo + \begingroup + \dodoifelseMMCfunctioninapply \recurselevel {minus} { + \ifnum\XMLstacklevel>\plustwo + \endgroup + \else + \endgroup + \MMLcreset + \fi + } { + \endgroup + } + \else + \doifelseMMCfunctioninapply \recurselevel {\MMLcfunctionlist,\MMLcconstructlist} { + \MMLcreset + } { + } + \fi + } { + } + \getXMLstackdata\recurselevel + \ifnum\recurselevel<\XMLstacklevel\relax + - + \fi + \endgroup + } + \fi +\stopsetups + +\stopmoduletestsection + +\stopmodule + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-newmmo.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-newmmo.mkii new file mode 100644 index 00000000000..97fdeb06c0b --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-newmmo.mkii @@ -0,0 +1,210 @@ +%D \module +%D [ file=x-newmmo, +%D version=2006.05.17, +%D title=\CONTEXT\ XML Macros, +%D subtitle=MathML Renderer/Open Math Extensions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Strange things, why not mapped onto normal content MathML and/or +%D onto processing instructions. + +\unprotect + +%D \startbuffer +%D <math xmlns="http://www.w3.org/1998/Math/MathML"> +%D <vector> +%D <apply> +%D <csymbol definitionURL="http://www.openmath.org/cd/nums1#rational"/> +%D <ci>a</ci> +%D <cn type="integer">2</cn> +%D </apply> +%D <ci>a</ci> +%D </vector> +%D </math> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer + +\startsetups mmc:csymbol:http://www.openmath.org/cd/nums1\letterhash rational + \MMLcreset + \getXMLstackdata\plustwo/\getXMLstackdata\plusthree +\stopsetups + +%D \startbuffer +%D <math xmlns="http://www.w3.org/1998/Math/MathML"> +%D <apply> +%D <csymbol definitionURL="http://www.openmath.org/cd/math4all#diffquot"/> +%D <ci>y</ci> +%D <ci>x</ci> +%D </apply> +%D </math> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash diffquot + \MMLcreset + \frac { + \Delta\getXMLstackdata\plustwo + } { + \Delta\getXMLstackdata\plusthree + } +\stopsetups + +%D \startbuffer +%D <math xmlns="http://www.w3.org/1998/Math/MathML"> +%D <apply> +%D <csymbol definitionURL="http://www.openmath.org/cd/math4all#difference"/> +%D <ci>y</ci> +%D </apply> +%D </math> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer +%D +%D \startbuffer +%D <math xmlns="http://www.w3.org/1998/Math/MathML"> +%D <apply> +%D <csymbol definitionURL="http://www.openmath.org/cd/math4all#difference"/> +%D <apply> +%D <eq/> +%D <ci>y</ci> +%D <apply> +%D <minus/> +%D <apply> +%D <ci>f</ci> +%D <ci>x</ci> +%D </apply> +%D <apply> +%D <ci>f</ci> +%D <apply> +%D <minus/> +%D <ci>x</ci> +%D <cn type="integer">1</cn> +%D </apply> +%D </apply> +%D </apply> +%D </apply> +%D </apply> +%D </math> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash difference + \MMLcreset + \Delta\getXMLstackdata\plustwo +\stopsetups + +%D \startbuffer +%D <math xmlns="http://www.w3.org/1998/Math/MathML"> +%D <apply> +%D <csymbol definitionURL="http://www.openmath.org/cd/math4all#diff"/> +%D <ci>s</ci> +%D <ci>t</ci> +%D </apply> +%D </math> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash diff + \MMLcreset + \frac { + \mfunction{\getXMLentity{mathematicald}}\getXMLstackdata\plustwo + } { + \mfunction{\getXMLentity{mathematicald}}\getXMLstackdata\plusthree + } +\stopsetups + +%D A unit mess. + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@second {\mr s}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@minute {\mr m}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@hour {\mr h}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@day {\mr d}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@week {\mr w}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@month {\mr m}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@year {\mr y}\stopsetups + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@meter {\mr m}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@gram {\mr g}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@liter {\mr l}\stopsetups + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@watt {\mr W}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@pascal {\mr P}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@kelvin {\mr K}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@celsius {\mr C}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@newton {\mr N}\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@byte {\mr B}\stopsetups + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@pico {\mr p}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@micro \mu\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@milli {\mr m}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@centi {\mr c}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@deci {\mr d}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@deca {\mr d}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@hecto {\mr h}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@kilo {\mr k}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@mega {\mr m}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@giga {\mr g}\getXMLstackdata\plustwo\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_siprefix1@tera {\mr t}\getXMLstackdata\plustwo\stopsetups + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash procent \procent\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash promille \promille\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash degree ^\circ\stopsetups + +% whatever + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash triangle + \Delta\, +\stopsetups + +% crap + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@degree_celsius + \directsetup{mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@celsius} +\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@degree_kelvin + \directsetup{mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@kelvin} +\stopsetups + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@metre + \directsetup{mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@meter} +\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@gramme + \directsetup{mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@gram} +\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@litre + \directsetup{mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_metric1@liter} +\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@calendar_month + \directsetup{mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@month} +\stopsetups +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@calendar_year + \directsetup{mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash units_time1@year} +\stopsetups + +\startsetups mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash degree_angle + \directsetup{mmc:csymbol:http://www.openmath.org/cd/mathadore\letterhash degree} +\stopsetups + +\defineXMLargument + [ci] + {\checkMMLciSYMBOL} + +\def\checkMMLciSYMBOL#1% + {\defconvertedargument\ascii{#1}% + \executeifdefined{ci:symbol:crap:\ascii}{#1}} + +\setvalue{ci:symbol:crap:alpha}{\alpha} +\setvalue{ci:symbol:crap:beta}{\beta} +\setvalue{ci:symbol:crap:gamma}{\gamma} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-newpml.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-newpml.mkii new file mode 100644 index 00000000000..ea3bae18262 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-newpml.mkii @@ -0,0 +1,250 @@ +%D \module +%D [ file=xtag-pml, +%D version=2001.06.10, +%D title=\CONTEXT\ XML Support, +%D subtitle=Units, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt XML Macros / Units} + +\usemodule[newmml] + +%D Quick and dirty in||line units: +%D +%D \startbuffer +%D <phys> +%D <cn> 10 </cn> +%D <cu> <Newton/> <Square/> <Meter/> <Per/> <Sec/> </cu> +%D </phys> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer +%D +%D A more \MATHML||like unit application: +%D +%D \startbuffer +%D <phys> <apply> <unit/> +%D <cn> 10 </cn> +%D <csymbol> <Square/> <Meter/> <Per/> <Sec/> </csymbol> +%D </apply> </phys> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer +%D +%D A bit more compact: +%D +%D \startbuffer +%D <phys> <apply> <unit/> +%D <cn> 10 </cn> +%D <cu> <Square/> <Meter/> <Per/> <Sec/> </cu> +%D </apply> </phys> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer +%D +%D A bit more complicated: +%D +%D \startbuffer +%D <phys> <apply> <unit/> +%D <apply> <divide/> <ci> a </ci> <cn> 10 </cn> </apply> +%D <cu> <Square/> <Meter/> <Per/> <Sec/> </cu> +%D </apply> </phys> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer +%D +%D An alternative (equivalent) for \type {</cu>}: +%D +%D \startbuffer +%D <phys> <apply> <unit/> +%D <cn> 10 </cn> <cunseq> <Square/> <Meter/> <Per/> <Sec/> </cunseq> +%D </apply> </phys> +%D \stopbuffer +%D +%D \typebuffer \processXMLbuffer + +\usemodule[units] + +\unprotect + +\defineXMLargument [phys] \automathematics +\defineXMLargument [iphys] \inlinemathematics +\defineXMLargument [dphys] \displaymathematics + +\defineXMLcommand [unit] {\directsetup{pml:unit}} + +\startsetups pml:unit + \flushXMLstackwith\plustwo\relax +\stopsetups + +% \defineXMLenvironment +% [unit] +% {\ignorespaces} +% {\removeunwantedspaces} + +\defineXMLsingular + [unit] + [label=] + {\XMLop{label}} + +\defineXMLsingular + [unitmeaning] + [label=] + {\expanded{\unitmeaning{\XMLop{label}}}} + +\let\handlePMLunit\firstofoneargument + +%D All unit commands are remapped in a similar way. + +\defineXMLsingular [Atto] {\handlePMLunit\Atto} +\defineXMLsingular [Femto] {\handlePMLunit\Femto} +\defineXMLsingular [Pico] {\handlePMLunit\Pico} +\defineXMLsingular [Nano] {\handlePMLunit\Nano} +\defineXMLsingular [Micro] {\handlePMLunit\Micro} +\defineXMLsingular [Milli] {\handlePMLunit\Milli} +\defineXMLsingular [Centi] {\handlePMLunit\Centi} +\defineXMLsingular [Deci] {\handlePMLunit\Deci} +\defineXMLsingular [Hecto] {\handlePMLunit\Hecto} +\defineXMLsingular [Kilo] {\handlePMLunit\Kilo} +\defineXMLsingular [Mega] {\handlePMLunit\Mega} +\defineXMLsingular [Giga] {\handlePMLunit\Giga} +\defineXMLsingular [Terra] {\handlePMLunit\Terra} +\defineXMLsingular [Peta] {\handlePMLunit\Peta} +\defineXMLsingular [Exa] {\handlePMLunit\Exa} + +\defineXMLsingular [Times] {\handlePMLunit\Times} +\defineXMLsingular [Solidus] {\handlePMLunit\Solidus} +\defineXMLsingular [Per] {\handlePMLunit\Per} +\defineXMLsingular [OutOf] {\handlePMLunit\OutOf} + +\defineXMLsingular [Linear] {\handlePMLunit\Linear} +\defineXMLsingular [Square] {\handlePMLunit\Square} +\defineXMLsingular [Cubic] {\handlePMLunit\Cubic} + +\defineXMLsingular [Inverse] {\handlePMLunit\Inverse} + +\defineXMLsingular [Degrees] {\handlePMLunit\Degrees} +\defineXMLsingular [Meter] {\handlePMLunit\Meter} +\defineXMLsingular [Liter] {\handlePMLunit\Liter} +\defineXMLsingular [Sec] {\handlePMLunit\Sec} +\defineXMLsingular [Year] {\handlePMLunit\Year} +\defineXMLsingular [Month] {\handlePMLunit\Month} +\defineXMLsingular [Week] {\handlePMLunit\Week} +\defineXMLsingular [Day] {\handlePMLunit\Day} +\defineXMLsingular [Hour] {\handlePMLunit\Hour} +\defineXMLsingular [Min] {\handlePMLunit\Min} +\defineXMLsingular [Minute] {\handlePMLunit\Min} +\defineXMLsingular [Second] {\handlePMLunit\Sec} +\defineXMLsingular [Rad] {\handlePMLunit\Rad} +\defineXMLsingular [Deg] {\handlePMLunit\Deg} +\defineXMLsingular [Hertz] {\handlePMLunit\Hertz} +\defineXMLsingular [RevPerSec] {\handlePMLunit\RevPerSec} +\defineXMLsingular [RevPerMin] {\handlePMLunit\RevPerMin} +\defineXMLsingular [Gram] {\handlePMLunit\Gram} +\defineXMLsingular [Atom] {\handlePMLunit\Atom} +\defineXMLsingular [Newton] {\handlePMLunit\Newton} +\defineXMLsingular [Pascal] {\handlePMLunit\Pascal} +\defineXMLsingular [Joule] {\handlePMLunit\Joule} +\defineXMLsingular [Watt] {\handlePMLunit\Watt} +\defineXMLsingular [Celsius] {\handlePMLunit\Celsius} +\defineXMLsingular [Kelvin] {\handlePMLunit\Kelvin} +\defineXMLsingular [Fahrenheit] {\handlePMLunit\Fahrenheit} +\defineXMLsingular [Mol] {\handlePMLunit\Mol} +\defineXMLsingular [Molair] {\handlePMLunit\Molair} +\defineXMLsingular [Equivalent] {\handlePMLunit\Equivalent} +\defineXMLsingular [Farad] {\handlePMLunit\Farad} +\defineXMLsingular [Ohm] {\handlePMLunit\Ohm} +\defineXMLsingular [Siemens] {\handlePMLunit\Siemens} +\defineXMLsingular [Ampere] {\handlePMLunit\Ampere} +\defineXMLsingular [Coulomb] {\handlePMLunit\Coulomb} +\defineXMLsingular [Volt] {\handlePMLunit\Volt} +\defineXMLsingular [eVolt] {\handlePMLunit\eVolt} +\defineXMLsingular [Tesla] {\handlePMLunit\Tesla} +\defineXMLsingular [VoltAC] {\handlePMLunit\VoltAC} +\defineXMLsingular [VoltDC] {\handlePMLunit\VoltDC} +\defineXMLsingular [Baud] {\handlePMLunit\Baud} +\defineXMLsingular [Bit] {\handlePMLunit\Bit} +\defineXMLsingular [Byte] {\handlePMLunit\Byte} +\defineXMLsingular [Bequerel] {\handlePMLunit\Bequerel} +\defineXMLsingular [Sievert] {\handlePMLunit\Sievert} +\defineXMLsingular [Candela] {\handlePMLunit\Candela} +\defineXMLsingular [Bell] {\handlePMLunit\Bell} +\defineXMLsingular [At] {\handlePMLunit\At} +\defineXMLsingular [Atm] {\handlePMLunit\Atm} +\defineXMLsingular [Bar] {\handlePMLunit\Bar} +\defineXMLsingular [EVolt] {\handlePMLunit\EVolt} +\defineXMLsingular [Foot] {\handlePMLunit\Foot} +\defineXMLsingular [Inch] {\handlePMLunit\Inch} +\defineXMLsingular [Cal] {\handlePMLunit\Cal} +\defineXMLsingular [Force] {\handlePMLunit\Force} +\defineXMLsingular [Lux] {\handlePMLunit\Lux} +\defineXMLsingular [Gray] {\handlePMLunit\Gray} +\defineXMLsingular [Weber] {\handlePMLunit\Weber} +\defineXMLsingular [Henry] {\handlePMLunit\Henry} +\defineXMLsingular [Sterant] {\handlePMLunit\Sterant} +\defineXMLsingular [Angstrom] {\handlePMLunit\Angstrom} +\defineXMLsingular [Gauss] {\handlePMLunit\Gauss} + +\defineXMLsingular [Percent] {\handlePMLunit\Percent} +\defineXMLsingular [Promille] {\handlePMLunit\Promille} +\defineXMLsingular [Permille] {\handlePMLunit\Permille} + +\defineXMLsingular [Unit] {\handlePMLunit\Unit} +\defineXMLsingular [NoUnit] {\handlePMLunit\NoUnit} + +\protect \doifnotmode{demo}{\endinput} + +\starttext + +\startXMLdata +<phys> + <apply> <times/> + <cn> 1 </cn> + <ci><unit><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci> + </apply> +</phys> +\stopXMLdata + +\startXMLdata +<phys> + <apply> <divide/> + <cn> 2 </cn> + <ci> <unit><Unit/><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci> + </apply> +</phys> +\stopXMLdata + +\startXMLdata +<phys> + <apply> <times/> + <cn> 3 </cn> + <ci> <unit> <Milli/> <Sec/> <Per/> <Square/> <Kilo/> <Meter/> </unit> </ci> + </apply> +</phys> +\stopXMLdata + +\startXMLdata +<phys> + <apply> <times/> + <cn> 4 </cn> + <ci> <unit><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci> + </apply> +</phys> +\stopXMLdata + +\startXMLdata +<phys> + <apply> <times/> + <cn> 5 </cn> + <ci> <unit> <Milli/> <Sec/> <Per/> <Square/> <Kilo/> <Meter/> </unit> </ci> + </apply> +</phys> +\stopXMLdata + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-om2cml.xsl b/Master/texmf-dist/tex/context/modules/mkii/x-om2cml.xsl new file mode 100644 index 00000000000..4070d94dcc7 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-om2cml.xsl @@ -0,0 +1,1342 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + This style sheet is used in the Math4All project. This project + will provide an on-line math method for secondary and tertiary + education. In addition to the web-bases content the project + provides high quality typeset output as well. + + This stylesheet is a copy of the one used by the group of Arjeh + Cohen (TU Eindhoven). This steet has multiple authors: David + Carlisle, and Clare M. So and Hans Cuypers (also see notice + below.) + + In due time we may extend this sheet with options needed for the + project (alternative rendering, additional dictionaries). + + Hans Hagen, PRAGMA ADE, Hasselt NL / 2006-04-14 + +--> + +<!-- ********************************************************** --> +<!-- XSL Transform of OpenMath to Content MathML --> +<!-- (Based on initial version by David Carlisle) --> +<!-- --> +<!-- Author: Clare M. So <clare@scl.csd.uwo.ca> --> +<!-- --> +<!-- May to August 2002 --> +<!-- --> +<!-- (Last updated July 9, 2003) --> +<!-- ********************************************************** --> + +<!-- ********************************************************** --> +<!-- CHANGE LOG --> +<!-- ********************************************************** --> +<!-- May 13, 2003 - Add template nthdiff of calculus1 CD --> +<!-- May 14, 2003 - Add templates for moreerrors CD --> +<!-- May 15, 2003 - Split templates for multiset1, set1, --> +<!-- and list1 CDs --> +<!-- Split templates for s_dist1 and s_data1 CDs --> +<!-- June 4, 2003 - Fix bugs in splitting set1, multiset1, and --> +<!-- set1 CDs --> +<!-- - Add templates for transc3 CD --> +<!-- July 9, 2003 - Add template for nthdiff --> + +<!-- Special MathML entities --> + +<!DOCTYPE stylesheet [ +<!ENTITY pi "π"> +<!ENTITY e "𡑾"> +<!ENTITY ee "𡑾"> +<!ENTITY ExponentialE "𡑾"> +<!ENTITY ImaginaryI "ⅈ"> +<!ENTITY ii "ⅈ"> +<!ENTITY gamma "γ"> +<!ENTITY infin "∞"> +<!ENTITY infty "∞"> +<!ENTITY true "󰀂"> +<!ENTITY false "󰀃"> +<!ENTITY NotANumber "󰀁"> +<!ENTITY NaN "󰀁"> +]> + +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:om="http://www.openmath.org/OpenMath" + xmlns="http://www.w3.org/1998/Math/MathML" + exclude-result-prefixes="om" + version="1.0"> + + <!-- xsl:output method="xml" indent="yes"/ --> + <xsl:output method="xml"/> + + <xsl:strip-space elements="*"/> + + <xsl:variable name="defaultOMSpriority">-10</xsl:variable> + + <!-- **************************************************** --> + <!-- ****************** Basic Elements ****************** --> + <!-- **************************************************** --> + + <!-- OMOBJ (D. Carlisle) / adapted by HH --> + +<xsl:template match="om:OMOBJ"> + <xsl:choose> + <xsl:when test="@style='inline'"> + <imath> + <xsl:apply-templates/> + </imath> + </xsl:when> + <xsl:when test="@style='display'"> + <dmath> + <xsl:apply-templates/> + </dmath> + </xsl:when> + <xsl:otherwise> + <math> + <xsl:apply-templates/> + </math> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + <!-- OMI (D. Carlisle) --> + <xsl:template match="om:OMI"> + <cn type="integer"> + <xsl:variable name="x" select="normalize-space(.)"/> + <xsl:choose> + <xsl:when test="contains($x,'x')"> + <xsl:attribute name="base">16</xsl:attribute> + <xsl:value-of select="concat(substring-before($x,'x'),substring-after($x,'x'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$x"/> <!-- default is decimal --> + </xsl:otherwise> + </xsl:choose> + </cn> + </xsl:template> + + <!-- OMV (D. Carlisle) --> + <xsl:template match="om:OMV"> + <ci> + <xsl:value-of select="normalize-space(@name)"/> + </ci> + </xsl:template> + + <!-- OMF (decimal) --> + <xsl:template match="om:OMF[@dec]"> + <cn> + <xsl:value-of select="normalize-space(@dec)"/> + </cn> + </xsl:template> + + <!-- OMF (hex) --> + <xsl:template match="om:OMF[@hex]"> + <cn base="16"> + <xsl:value-of select="normalize-space(@hex)"/> + </cn> + </xsl:template> + + <!-- OMA (D. Carlisle) --> + <xsl:template match="om:OMA"> + <apply> + <xsl:apply-templates/> + </apply> + </xsl:template> + + <!-- OMB --> + <!-- Note: No Content MathML equivalent --> + <xsl:template match="om:OMB"> + <mtext definitionURL="http://www.openmath.org/objects#OMB"> + <xsl:value-of select="."/> + </mtext> + </xsl:template> + + <!-- OMSTR (D. Carlisle) --> + <!-- Note: mtext is a presentational MathML tag --> + <xsl:template match="om:OMSTR"> + <mtext> + <xsl:value-of select="."/> + </mtext> + </xsl:template> + + <!-- ***************************************************** --> + <!-- ****************** MathML group ******************** --> + <!-- ***************************************************** --> + + <!-- Content Dicitionary: alg1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: zero, one --> + + <!-- Trivial cases: none --> + <xsl:template match="om:OMS[@cd='alg1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- zero --> + <xsl:template match="om:OMS[@cd='alg1' and @name='zero']"> + <cn type="integer">0</cn> + </xsl:template> + + <!-- one --> + <xsl:template match="om:OMS[@cd='alg1' and @name='one']"> + <cn type="integer">1</cn> + </xsl:template> + + <!-- Content Dictionary: arith1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD conatains: abs, divide, gcd, lcm, minus, plus, power, product, + root, sum, unary_minus --> + + <!-- Trivial Cases: abs, divide, gcd, lcm, minus, plus --> + <xsl:template match="om:OMS[@cd='arith1']"> + <xsl:element name="{@name}"> + <xsl:choose> + <xsl:when test="@name='times'"> + <xsl:choose> + <xsl:when test="../@style='empty'"> + <xsl:attribute name='symbol'></xsl:attribute> + </xsl:when> + <xsl:when test="../@style='cross'"> + <xsl:attribute name='symbol'>times</xsl:attribute> + </xsl:when> + <xsl:when test="../@style=''"> + <!-- inherit from parent times --> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name='symbol'><xsl:value-of select="../@style"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@name='divide'"> + <xsl:choose> + <xsl:when test="../@style='inline'"> + <xsl:attribute name='alternative'>b</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test="@name='plus'"> + <xsl:choose> + <xsl:when test="../@style='empty'"> + <xsl:attribute name='alternative'>b</xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- forget about it --> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:template> + + <!-- unary_minus --> + <xsl:template match="om:OMS[@cd='arith1' and @name='unary_minus']"> + <minus/> + </xsl:template> + + <!-- root --> + <xsl:template match="om:OMA[om:OMS[@cd='arith1' and @name='root']]"> + <apply> + <root/> + <degree> + <xsl:apply-templates select="*[3]"/> + </degree> + <xsl:apply-templates select="*[2]"/> + </apply> + </xsl:template> + + <!-- sum and product --> + <xsl:template match="om:OMA[om:OMS[@cd='arith1' and (@name='sum' or @name='product')]]"> + <apply> + <xsl:element name="{om:OMS[1]/@name}"/> + <bvar> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="3"/> <!-- the bounded var is in the func --> + </xsl:apply-templates> + </bvar> + <xsl:apply-templates select="*[2]"/> <!-- range of product/summation --> + <xsl:apply-templates select="*[3]"/> + </apply> + </xsl:template> + + <!-- Content Dictionary: bigfloat1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: bigfloat, bigfloatprec --> + + <!-- Trivial cases: none --> + + <!-- bigfloat --> + <xsl:template match="om:OMA[om:OMS[@cd='bigfloat1' and @name='bigfloat']]"> + <apply> + <times/> + <xsl:apply-templates select="*[2]"/> + <apply> + <power/> + <xsl:apply-templates select="*[3]"/> + <xsl:apply-templates select="*[4]"/> + </apply> + </apply> + </xsl:template> + + <!-- bigfloatprec --> + <!-- Note: No Content MathML equivalent --> + <xsl:template match="om:OMS[@cd='bigfloat1' and @name='bigfloatprec']"> + <csymbol encoding="OpenMath" + definitionURL="http://www.openmath.org/cd/bigfloat1#bigfloatprec"/> + </xsl:template> + + <!-- Content Dictionary: calculus1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: defint, diff, int, nthdiff, partialdiff --> + + <!-- Trivial cases: partialdiff --> + <xsl:template match="om:OMS[@cd='calculus1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- diff, int --> + <xsl:template match="om:OMA[om:OMS[@cd='calculus1' and (@name='diff' or @name='int')]]"> + <apply> + <xsl:element name="{om:OMS[1]/@name}"/> + <bvar> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="2"/> + </xsl:apply-templates> + </bvar> + <xsl:apply-templates select="*[2]"/> + </apply> + </xsl:template> + + <!-- defint --> + <xsl:template match="om:OMA[om:OMS[@cd='calculus1' and @name='defint']]"> + <apply> + <int/> <!-- pretty much the same as sum and product... CHECK domainofapp --> + <bvar> <!-- perphaps write a method for the similar parts... --> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="3"/> + </xsl:apply-templates> + </bvar> + <xsl:apply-templates select="*[2]"/> <!-- range of diff --> + <xsl:apply-templates select="*[3]"/> + </apply> + </xsl:template> + + <!-- nthdiff --> + <xsl:template match="om:OMA[om:OMS[@cd='calculus1' and @name='nthdiff']]"> + <apply> + <diff/> + <bvar> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="3"/> + </xsl:apply-templates> + <xsl:apply-templates select="*[2]"/> + </bvar> + <xsl:apply-templates select="*[3]"/> + </apply> + </xsl:template> + + <!-- Content Dictionaries: complex1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: argument, complex_cartesian, complex_polar, conjugate, + imaginary, real --> + + <!-- Trivial cases: conjugate, imaginary, real --> + <xsl:template match="om:OMS[@cd='complex1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- argument --> + <xsl:template match="om:OMS[@cd='complex1' and @name='argument']"> + <arg/> + </xsl:template> + + <!-- complex_cartesian or complex_polar --> + <xsl:template match="om:OMA[om:OMS[@cd='complex1' and (@name='complex_cartesian' or @name='complex_polar')]]"> + <xsl:variable name="type_name" select="translate(om:OMS[1]/@name,'_','-')"/> + <xsl:choose> + <xsl:when test="child::om:OMV or child::om:OMA"> + <apply> + <csymbol definitionURL="{concat('http://www.openmath.org/cd/complex1#',om:OMS[1]/@name)}"/> + <xsl:apply-templates select="*[2]"/> + <xsl:apply-templates select="*[3]"/> + </apply> + </xsl:when> + <xsl:otherwise> + <cn type="{$type_name}"> + <xsl:apply-templates select="*[2]" mode="convert"/> + <sep/> + <xsl:apply-templates select="*[3]" mode="convert"/> + </cn> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Content Dictionary: fns1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: domain, domainofapplication, identity, image, inverse, + lambda, left_compose, left_inverse, right_inverse --> + + <!-- Trivial cases: domain, image, inverse --> + <xsl:template match="om:OMS[@cd='fns1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- domainofapplication --> + <xsl:template match="om:OMA[om:OMS[@cd='fns1' and @name='domainofapplication']]"> + <domainofapplication> + <xsl:apply-templates select="*[2]"/> + </domainofapplication> + </xsl:template> + + <!-- identity --> + <xsl:template match="om:OMS[@cd='fns1' and @name='identity']"> + <ident/> + </xsl:template> + + <!-- lambda --> + <xsl:template match="om:OMBIND[om:OMS[@cd='fns1' and @name='lambda']]"> + <lambda> + <xsl:for-each select="om:OMBVAR/child::om:OMV"> + <bvar> + <xsl:apply-templates select="."/> + </bvar> + </xsl:for-each> + <xsl:apply-templates select="*[3]"/> + </lambda> + </xsl:template> + + <!-- range --> + <xsl:template match="om:OMS[@cd='fns1' and @name='range']"> + <codomain/> + </xsl:template> + + <!-- left_compose --> + <xsl:template match="om:OMS[@cd='fns1' and @name='left_compose']"> + <compose/> + </xsl:template> + + <!-- left_inverse --> + <xsl:template match="om:OMS[@cd='fns1' and @name='left_inverse']"> + <inverse/> + </xsl:template> + + <!-- right_inverse --> + <!-- Note: No Content MathML equivalent --> + <xsl:template match="om:OMS[@cd='fns1' and @name='right_inverse']"> + <inverse encoding="OpenMath" definitionURL="http://www.openmath.org/cd/fns1#right_inverse"/> + </xsl:template> + + <!-- Content Dictionary: integer1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: factorial, factorof, quotient, remainder --> + + <!-- Trivial cases: factorof, factorial, quotient --> + <xsl:template match="om:OMS[@cd='integer1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- remainder --> + <xsl:template match="om:OMS[@cd='integer1' and @name='remainder']"> + <rem/> + </xsl:template> + + <!-- Content Dictionary: interval1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: integer_interval, interval, interval_oo, interval_cc, + interval_oc, interval_co --> + + <!-- Trivial case: none --> + + <!-- (All) --> + <xsl:template match="om:OMA[om:OMS[@cd='interval1']]"> + <interval> + <xsl:choose> + <xsl:when test="om:OMS[1]/@name='interval_oo'"> + <xsl:attribute name='closure'>open</xsl:attribute> + </xsl:when> + <xsl:when test="om:OMS[1]/@name='interval_cc'"> + <xsl:attribute name='closure'>closed</xsl:attribute> + </xsl:when> + <xsl:when test="om:OMS[1]/@name='interval_oc'"> + <xsl:attribute name='closure'>open-closed</xsl:attribute> + </xsl:when> + <xsl:when test="om:OMS[1]/@name='interval_co'"> + <xsl:attribute name='closure'>closed-open</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:apply-templates select="*[2]"/> + <xsl:apply-templates select="*[3]"/> + </interval> + </xsl:template> + + <!-- Content Dictionary: linalg1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: determinant, matrix_selector, outerproduct, + scalarproduct, transpose, vector_selector, vector_product --> + + <!-- Trivial cases: determinant, outerproduct, scalarproduct, transpose, + vectorproduct --> + <xsl:template match="om:OMS[@cd='linalg1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- vector_selector --> + <xsl:template match="om:OMA[om:OMS[@cd='linalg1' and @name='vector_selector']]"> + <apply> + <selector/> + <xsl:apply-templates select="*[3]"/> <!-- the vector --> + <xsl:apply-templates select="*[2]"/> + </apply> + </xsl:template> + + <!-- matrix_selector --> + <xsl:template match="om:OMA[om:OMS[@cd='linalg1' and @name='matrix_selector']]"> + <apply> + <selector/> + <xsl:apply-templates select="*[4]"/> <!-- the matrix --> + <xsl:apply-templates select="*[3]"/> + <xsl:apply-templates select="*[2]"/> + </apply> + </xsl:template> + + <!-- Content Dictionary: linalg2 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: matrix, matrixrow, vector --> + + <!-- Trivial cases: none --> + + <!-- matrixrow, matrix --> + <xsl:template match="om:OMA[om:OMS[@cd='linalg2']]"> + <xsl:element name="{om:OMS[1]/@name}"> + <xsl:apply-templates select="*[position()>1]"/> + </xsl:element> + </xsl:template> + + <!-- (row) vector --> + <xsl:template match="om:OMA[om:OMS[@cd='linalg2' and @name='vector']]"> + <apply> + <transpose/> + <vector> + <xsl:apply-templates select="*[position()>1]"/> + </vector> + </apply> + </xsl:template> + + <!-- Content Dictionary: limit1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: above, below, bothsides, limit, null --> + + <!-- Trivial cases: none --> + + <!-- both_sides, above, below, null --> + <xsl:template match="om:OMA[om:OMS[@cd='limit1']]"> + <apply> + <limit/> + <bvar> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="4"/> + </xsl:apply-templates> + </bvar> + <xsl:choose> + <xsl:when test="om:OMS[2]/@name='null'"> + <lowlimit> + <xsl:apply-templates select="*[2]"/> + </lowlimit> + </xsl:when> + <xsl:otherwise> + <condition> + <apply> + <tendsto> + <xsl:choose> + <xsl:when test="om:OMS[2]/@name='both_sides'"> + <xsl:attribute name="type">all</xsl:attribute> + </xsl:when> + <xsl:when test="om:OMS[2]/@name='above'"> + <xsl:attribute name="type">above</xsl:attribute> + </xsl:when> + <xsl:when test="om:OMS[2]/@name='below'"> + <xsl:attribute name="type">below</xsl:attribute> + </xsl:when> + </xsl:choose> + </tendsto> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="4"/> + </xsl:apply-templates> + <xsl:apply-templates select="*[2]"/> + </apply> + </condition> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="*[4]"/> + </apply> + </xsl:template> + + <!-- Content Dictionary: list1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: list, map, suchthat --> + + <!-- Trivial cases: none --> + + <!-- list --> + <xsl:template match="om:OMA[om:OMS[@cd='list1' and @name='list']]"> + <list> + <xsl:apply-templates select="*[position()>1]"/> + </list> + </xsl:template> + + <!-- map --> + <xsl:template match="om:OMA[om:OMS[@cd='list1' and @name='map']]"> + <list> + <xsl:apply-templates select="." mode="map"/> + </list> + </xsl:template> + + <!-- suchthat --> + <xsl:template match="om:OMA[om:OMS[@cd='list1' and @name='suchthat']]"> + <list> + <xsl:apply-templates select="." mode="suchthat"/> + </list> + </xsl:template> + + <!-- Content Dictionary: logic1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: and, equivalent, false, implies, not, or, true, xor --> + + <!-- Trivial cases: all --> + <xsl:template match="om:OMS[@cd='logic1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- Content Dictionary: mathmltypes --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: complex_cartesian_type, complex_polar_type, constant_type, + fn_type, integer_type, list_type, matrix_type, rational_type, real_type, + set_type, type, vector_type --> + + <!-- (All mathmltypes elements) --> + <xsl:template match="om:OMATTR[om:OMATP[om:OMS[@cd='mathmltypes' and @name='type']]]"> + <xsl:variable name="type_name" select="normalize-space(translate(substring-before(om:OMATP/om:OMS[2]/@name,'_type'),'_','-'))"/> + <xsl:choose> + <xsl:when test="*[2]=om:OMV"> + <ci type="{$type_name}"> + <xsl:value-of select="normalize-space(*[2]/@name)"/> + </ci> + </xsl:when> + <xsl:when test="*[2]=om:OMI"> + <cn type="{$type_name}"> + <xsl:variable name="x" select="normalize-space(*[2])"/> + <xsl:choose> + <xsl:when test="contains($x,'x')"> + <xsl:attribute name="base">16</xsl:attribute> + <xsl:value-of select="concat(substring-before($x,'x'),substring-after($x,'x'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$x"/> <!-- default is decimal --> + </xsl:otherwise> + </xsl:choose> + </cn> + </xsl:when> + <xsl:when test="*[2]=om:OMF[@dec]"> + <cn type="{$type_name}"> + <xsl:value-of select="normalize-space(*[2]/@dec)"/> + </cn> + </xsl:when> + <xsl:when test="*[2]=om:OMF[@hex]"> + <cn type="{$type_name}" base="16"> + <xsl:value-of select="normalize-space(*[2]/@hex)"/> + </cn> + </xsl:when> + <xsl:otherwise> <!-- MathML cannot add type attribute to other objects --> + <xsl:comment> + Content MathML cannot add type <xsl:value-of select="$type_name"/> for the object after this comment. + </xsl:comment> + <xsl:apply-templates select="*[2]"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Content Dictionary: minmax1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: max, min --> + <xsl:template match="om:OMS[@cd='minmax1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- Trivial cases: none --> + + <!-- max, min --> + <xsl:template match="om:OMA[om:OMS[@cd='minmax1']]"> + <apply> + <xsl:element name="{om:OMS/@name}"/> + <xsl:choose> + <xsl:when test="*[2]=om:OMA[om:OMS[@cd='set1' and @name='set']]"> + <xsl:apply-templates select="om:OMA/*[position()>1]"/> + </xsl:when> + <xsl:when test="*[2]=om:OMA[om:OMS[@cd='multiset1' and @name='multiset']]"> + <xsl:apply-templates select="om:OMA/*[position()>1]"/> + </xsl:when> + <xsl:when test="*[2]=om:OMA[om:OMS[@cd='set1' and @name='suchthat']]"> + <xsl:apply-templates select="*[2]" mode="suchthat"/> + </xsl:when> + <xsl:when test="*[2]=om:OMA[om:OMS[@cd='set1' and @name='map']]"> + <xsl:apply-templates select="*[2]" mode="map"/> + </xsl:when> + <xsl:otherwise> + <bvar><ci>x</ci></bvar> + <condition> + <apply> + <in/> + <ci>x</ci> + <xsl:apply-templates select="*[2]"/> + </apply> + </condition> + </xsl:otherwise> + </xsl:choose> + </apply> + </xsl:template> + + <!-- Content Dictionary: multiset1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: cartesian_product, emptyset, in, intersect, multiset, + notin, notprsubset, notsubset, prsubset, setdiff, size, subset, union --> + + <!-- Trivial cases: emptyset, in, interset, notin, notprsubset, notsubset, prsubset, + subset, union --> + <xsl:template match="om:OMS[@cd='multiset1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- cartesian_product --> + <xsl:template match="om:OMS[@cd='multiset1' and @name='cartesian_product']"> + <cartesianproduct/> + </xsl:template> + + + <!-- multiset --> + <xsl:template match="om:OMA[om:OMS[@cd='multiset1' and @name='multiset']]"> + <set type="multiset"> + <xsl:apply-templates select="*[position()>1]"/> + </set> + </xsl:template> + + <!-- size --> + <xsl:template match="om:OMS[@cd='multiset1' and @name='size']"> + <card/> + </xsl:template> + + <!-- Content Dictionary: nums1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains based_integer, e, gamma, i, infinity, NaN, pi, rational --> + + <!-- Trivial cases: pi, infinity --> + <xsl:template match="om:OMS[@cd='nums1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- based_integer --> + <!-- Note: Content MathML does not support base that is represented by a variable --> + <xsl:template match="om:OMA[om:OMS[@cd='nums1' and @name='based_integer']]"> + <xsl:choose> + <xsl:when test="*[2]=om:OMV"> + <apply> + <csymbol encoding="OpenMath" definitionURL="http://www.openmath.org/cd/nums1#based_integer"/> + <xsl:apply-templates select="*[2]"/> + <xsl:apply-templates select="*[3]"/> + </apply> + </xsl:when> + <xsl:otherwise> + <cn type="integer" base="{normalize-space(*[2])}"> + <xsl:value-of select="normalize-space(om:OMSTR)"/> + </cn> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- e --> + <xsl:template match="om:OMS[@cd='nums1' and @name='e']"> + <exponentiale/> + </xsl:template> + + <!-- gamma --> + <xsl:template match="om:OMS[@cd='nums1' and @name='gamma']"> + <eulergamma/> + </xsl:template> + + <!-- i --> + <xsl:template match="om:OMS[@cd='nums1' and @name='i']"> + <imaginaryi/> + </xsl:template> + + <!-- NaN --> + <xsl:template match="om:OMS[@cd='nums1' and @name='NaN']"> + <notanumber/> + </xsl:template> + + <!-- rational --> + <!-- Note: Content MathML does not support rational numbers that are + made up of variables or other mathematical objects --> + <xsl:template match="om:OMA[om:OMS[@cd='nums1' and @name='rational']]"> + <xsl:choose> + <xsl:when test="child::om:OMV or child::om:OMA"> + <apply> + <csymbol definitionURL="http://www.openmath.org/cd/nums1#rational"/> + <xsl:apply-templates select="*[2]"/> + <xsl:apply-templates select="*[3]"/> + </apply> + </xsl:when> + <xsl:otherwise> + <cn type="rational"> + <xsl:apply-templates select="*[2]" mode="convert"/> + <sep/> + <xsl:apply-templates select="*[3]" mode="convert"/> + </cn> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Content Dictionary: piece1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: otherwise, piece, piecewise --> + + <!-- Trivial cases: (All of the OMSs here are almost trivial, except + that these functions are used without "apply" in Content MathML) --> + + <!-- piecewise, piece, otherwise --> + <xsl:template match="om:OMA[om:OMS[@cd='piece1']]"> + <xsl:element name="{om:OMS/@name}"> + <xsl:apply-templates select="*[position()>1]"/> + </xsl:element> + </xsl:template> + + <!-- Content Dictionary: quant1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: forall, exists --> + + <!-- forall,exists --> + <xsl:template match="om:OMBIND[om:OMS[@cd='quant1']]"> + <apply> + <xsl:element name="{om:OMS[1]/@name}"/> + <xsl:for-each select="om:OMBVAR/om:OMV"> + <bvar> + <xsl:apply-templates select="."/> + </bvar> + </xsl:for-each> + <xsl:apply-templates select="*[3]"/> + </apply> + </xsl:template> + + <!-- Content Dictionary: relation1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: approx, eq, geq, gt, leq, lt, neq --> + + <!-- Trivial cases: all --> + + <xsl:template match="om:OMS[@cd='relation1']"> + <xsl:element name="{@name}"> + <xsl:if test="../@style!=''"> + <xsl:attribute name='align'><xsl:value-of select="../@style"/></xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:template> + + <!-- Content Dictionary: setname1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: C, N, P, Q, R, Z --> + + <!-- Trivial cases: none --> + + <!-- P --> + <xsl:template match="om:OMS[@cd='setname1' and @name='P']"> + <primes/> + </xsl:template> + + <!-- N --> + <xsl:template match="om:OMS[@cd='setname1' and @name='N']"> + <naturalnumbers/> + </xsl:template> + + <!-- Z --> + <xsl:template match="om:OMS[@cd='setname1' and @name='Z']"> + <integers/> + </xsl:template> + + <!-- Z --> + <xsl:template match="om:OMS[@cd='setname1' and @name='Q']"> + <rationals/> + </xsl:template> + + <!-- R --> + <xsl:template match="om:OMS[@cd='setname1' and @name='R']"> + <reals/> + </xsl:template> + + <!-- C --> + <xsl:template match="om:OMS[@cd='setname1' and @name='C']"> + <complexes/> + </xsl:template> + + <!-- Content Dictionary: rounding1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: ceiling, floor, round, trunc --> + + <!-- Trivial Cases: ceiling, floor --> + <xsl:template match="om:OMS[@cd='rounding1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- trunc --> + <xsl:template match="om:OMA[om:OMS[@cd='rounding1' and @name='trunc']]"> + <apply> + <quotient/> + <xsl:apply-templates select="*[2]"/> + <cn>1</cn> + </apply> + </xsl:template> + + <!-- round --> + <xsl:template match="om:OMA[om:OMS[@cd='rounding1' and @name='round']]"> + <piecewise> + <piece> + <apply> + <floor/> + <apply> + <plus/> + <cn>0.5</cn> + <xsl:apply-templates select="*[2]"/> + </apply> + </apply> + <apply> + <geq/> + <xsl:apply-templates select="*[2]"/> + <cn>0</cn> + </apply> + </piece> + <piece> + <apply> + <ceiling/> + <apply> + <minus/> + <xsl:apply-templates select="*[2]"/> + <cn>0.5</cn> + </apply> + </apply> + <apply> + <lt/> + <xsl:apply-templates select="*[2]"/> + <cn>0</cn> + </apply> + </piece> + </piecewise> + </xsl:template> + + <!-- Content Dictionary: set1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: cartesian_product, emptyset, in, intersect, map, notin, + notprsubset, notsubset, prsubset, set, setdiff, size, subset, suchthat, union --> + + <!-- Trivial cases: emptyset, in, intersect, notin, notprsubset, notsubset, prsubset + setdiff, subset, union --> + <xsl:template match="om:OMS[@cd='set1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- cartesian_product --> + <xsl:template match="om:OMS[@cd='set1' and @name='cartesian_product']"> + <cartesianproduct/> + </xsl:template> + + <!-- map --> + <xsl:template match="om:OMA[om:OMS[@cd='set1' and @name='map']]"> + <set> + <xsl:apply-templates select="." mode="map"/> + </set> + </xsl:template> + + <!-- size --> + <xsl:template match="om:OMS[@cd='set1' and @name='size']"> + <card/> + </xsl:template> + + <!-- suchthat --> + <xsl:template match="om:OMA[om:OMS[@cd='set1' and @name='suchthat']]"> + <set> + <xsl:apply-templates select="." mode="suchthat"/> + </set> + </xsl:template> + + <!-- Content Dictionary: s_data1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: mean, median, mode, moment, sdev, variance --> + + <!-- Trivial cases: mean, median, mode, sdev, variance --> + <xsl:template match="om:OMS[@cd='s_data1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- moment --> + <xsl:template match="om:OMA[om:OMS[@cd='s_data1' and @name='moment']]"> + <apply> + <moment/> + <degree> + <xsl:apply-templates select="*[2]"/> + </degree> + <momentabout> + <xsl:apply-templates select="*[3]"/> + </momentabout> + <xsl:apply-templates select="*[position()>3]"/> + </apply> + </xsl:template> + + <!-- Content Dictionary: s_dist1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: mean, moment, sdev, variance --> + + <!-- Trivial cases: mean, sdev, variance --> + <xsl:template match="om:OMS[@cd='s_dist1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- moment --> + <xsl:template match="om:OMA[om:OMS[@cd='s_dist1' and @name='moment']]"> + <apply> + <moment/> + <degree> + <xsl:apply-templates select="*[2]"/> + </degree> + <momentabout> + <xsl:apply-templates select="*[3]"/> + </momentabout> + <xsl:apply-templates select="*[position()>3]"/> + </apply> + </xsl:template> + + <!-- Content Dictionary: transc1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: arccos, arccosh, arccot, arccoth, arccsc, + arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, cos, + cosh, cot, coth, csc, csch, exp, ln, log, sec, sech, sin, sinh, + tan, tanh --> + + <!-- Trivial cases: all except log --> + <xsl:template match="om:OMS[@cd='transc1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- log --> + <xsl:template match="om:OMA[om:OMS[@cd='transc1' and @name='log']]"> + <apply> + <log/> + <logbase> + <xsl:apply-templates select="*[2]"/> + </logbase> + <xsl:apply-templates select="*[3]"/> + </apply> + </xsl:template> + + <!-- Content Dictionary: veccalc1 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: curl, divergence, grad, Laplacian --> + + <!-- Trivial cases: all except Laplacian --> + <xsl:template match="om:OMS[@cd='veccalc1']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- Laplacian --> + <!-- Note: Capital "L" --> + <xsl:template match="om:OMS[@cd='veccalc1' and @name='Laplacian']"> + <laplacian/> + </xsl:template> + + <!-- Content Dictionary: altenc --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: TeX_encoding, MathML_encoding --> + + <!-- Trivial cases: none --> + + <!-- (Everything in altenc) --> + <xsl:template match="om:OMATTR[om:OMATP[om:OMS[@cd='altenc']]]"> + <semantics> + <xsl:apply-templates select="*[2]"/> + <xsl:apply-templates select="om:OMATP/child::om:OMS"/> + </semantics> + </xsl:template> + + <!-- MathML_encoding --> + <xsl:template match="om:OMS[@cd='altenc' and @name='MathML_encoding']"> + <annotation-xml encoding="MathML"> + <xsl:value-of select="normalize-space(following-sibling::*[position()=1])"/> <!-- OMXML or OMSTR--> + </annotation-xml> + </xsl:template> + + <!-- TeX_encoding --> + <xsl:template match="om:OMS[@cd='altenc' and @name='TeX_encoding']"> + <annotation encoding="TeX"> + <xsl:value-of select="normalize-space(following::om:OMSTR)"/> + </annotation> + </xsl:template> + + <!-- **************************************************** --> + <!-- ************** Not in MathML group CDs ************* --> + <!-- **************************************************** --> + + <!-- Everything below should not be handled by the Trivial case!) --> + + <!-- Content Dictionary: linalg3 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- (column) vector --> + <xsl:template match="om:OMA[om:OMS[@cd='linalg3' and @name='vector']]"> + <vector> + <xsl:apply-templates select="*[position()>1]"/> + </vector> + </xsl:template> + + <!-- Content Dictionary: arith2 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: inverse, times --> + + <!-- times --> + <!-- Note: This function is n-ary just like MathML! --> + <xsl:template match="om:OMS[@cd='arith2' and @name='times']"> + <times/> + </xsl:template> + + <!-- Content Dictionary: error --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- (all errors) --> + <xsl:template match="om:OME"> + <mtext> + <xsl:text>ERROR:</xsl:text> + <xsl:text> Error Type: </xsl:text><xsl:value-of select="om:OMS[1]/@name"/> + <xsl:text> Error occured in CD: </xsl:text><xsl:value-of select="om:OMS[2]/@cd"/> + <xsl:text> Error occured in symbol: </xsl:text><xsl:value-of select="om:OMS[2]/@name"/> + </mtext> + </xsl:template> + + <!-- Content Dictionary: moreerrors --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: algorithm, asynchronousError, encodingError, limitation, + unexpected --> + + <!-- (all) --> + <xsl:template match="om:OMA[om:OMS[@cd='moreerrors']]"> + <mtext> + <xsl:text>ERROR:</xsl:text> + <xsl:text> Error Type: </xsl:text><xsl:value-of select="normalize-space(om:OMS/@name)"/> + <xsl:text> Description: </xsl:text><xsl:value-of select="normalize-space(om:OMSTR)"/> + </mtext> + </xsl:template> + + <!-- Content Dicitionary: transc3 --> + <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> + + <!-- This CD contains: arccos, arccosh, arccot, arccoth, arccsc, arccsch, + arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, ln, log --> + + <!-- (all except log) --> + <xsl:template match="om:OMS[@cd='transc3']"> + <xsl:element name="{@name}"/> + </xsl:template> + + <!-- log --> + <xsl:template match="om:OMA[om:OMS[@cd='transc3' and @name='log']]"> + <apply> + <log/> + <logbase> + <xsl:apply-templates select="*[3]"/> + </logbase> + <xsl:apply-templates select="*[2]"/> + </apply> + </xsl:template> + + <!-- **************************************************** --> + <!-- **************** EVERYTHING ELSE ******************* --> + <!-- **************************************************** --> + + <!-- Note: Rather than hard code all of the CDs, I just assign the lowest + priority among all templates. --> + + <xsl:template match="om:OMS[@cd and @name]" priority="-10"> + <csymbol> + <xsl:attribute name="definitionURL"> + <xsl:value-of select="concat(concat(concat('http://www.openmath.org/cd/',@cd),'#'),@name)"/> + </xsl:attribute> + </csymbol> + </xsl:template> + + <!-- **************************************************** --> + <!-- **************** HELPER TEMPLATES ****************** --> + <!-- **************************************************** --> + + <!-- All mode "convert" templates are for converting OMSs or OMIs to + numbers including in various cn containing <sep/> --> + + <xsl:template match="om:OMS[@cd='alg1' and @name='zero']" mode="convert">0</xsl:template> + + <xsl:template match="om:OMS[@cd='alg1' and @name='one']" mode="convert">1</xsl:template> + + <xsl:template match="om:OMS" mode="convert"> + <xsl:choose> + <xsl:when test="@name='pi'">π</xsl:when> + <xsl:when test="@name='i'">ⅈ</xsl:when> + <xsl:when test="@name='NaN'">&NaN;</xsl:when> + <xsl:when test="@name='gamma'">γ</xsl:when> + <xsl:when test="@name='e'">ⅇ</xsl:when> + <xsl:when test="@name='true'">&true;</xsl:when> + <xsl:when test="@name='false'">&false;</xsl:when> + <xsl:when test="@name='infinity'">∞</xsl:when> + <xsl:otherwise><xsl:value-of select="normalize-space(.)"/></xsl:otherwise> <!-- for debugging --> + </xsl:choose> + </xsl:template> + + <xsl:template match="om:OMI" mode="convert"> + <xsl:variable name="x" select="normalize-space(.)"/> + <xsl:choose> + <xsl:when test="contains($x,'x')"> + <xsl:value-of select="concat(substring-before($x,'x'),substring-after($x,'x'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$x"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="om:OMF" mode="convert"> + <xsl:value-of select="@*"/> + </xsl:template> + + <!-- The following templates, with mode "map" and "suchthat", are used to contruct sets or lists + without enumerating every element --> + + <xsl:template match="om:OMA" mode="map"> + <bvar> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="2"/> + </xsl:apply-templates> + </bvar> + <condition> + <apply> + <in/> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="2"/> + </xsl:apply-templates> + <xsl:apply-templates select="*[3]"/> + </apply> + </condition> + <xsl:apply-templates select="*[2]"/> + </xsl:template> + + <xsl:template match="om:OMA" mode="suchthat"> + <bvar> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="3"/> + </xsl:apply-templates> + </bvar> + <condition> + <apply> + <and/> + <xsl:apply-templates select="*[3]"/> + <apply> + <in/> + <xsl:apply-templates select="." mode="getVar"> + <xsl:with-param name="NUM" select="3"/> + </xsl:apply-templates> + <xsl:apply-templates select="*[2]"/> + </apply> + </apply> + </condition> + </xsl:template> + + <!-- This template is for getting bound variables (all variables in <OMBIND>) --> + <!-- Note: Default bound variable is "x" --> + + <xsl:template match="om:OMA" mode="getVar"> + <xsl:param name="NUM" select="3"/> + <xsl:choose> + <xsl:when test="*[$NUM]=om:OMBIND"> + <xsl:apply-templates select="*[$NUM]/om:OMBVAR/om:OMV[position()>0]"/> + </xsl:when> + <xsl:otherwise> <!-- default --> + <ci>x</ci> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Added by Hans Hagen --> + + <xsl:template match="om:OMS[@cd='altenc' and @name='TeX_encoding']"> + <annotation encoding="TeX"> + <xsl:value-of select="normalize-space(following::om:OMSTR)"/> + </annotation> + </xsl:template> + + <xsl:template match="om:OMS[(@cd='math4all' or @cd='mathadore' or @cd='m4all') and @name]"> + <csymbol> + <xsl:attribute name="definitionURL"> + <xsl:value-of select="concat(concat('http://www.openmath.org/cd/mathadore','#'),@name)"/> + </xsl:attribute> + </csymbol> + </xsl:template> + +<!-- + <xsl:template match="om:OMS[@cd='mathadore' and @name]"> + <csymbol> + <xsl:attribute name="definitionURL"> + <xsl:value-of select="concat(concat(@cd,'#'),@name)"/> + </xsl:attribute> + </csymbol> + </xsl:template> +--> + + <xsl:template match="om:OMA[om:OMS[@cd='combinat1' and @name='binomial']]"> + <matrix> + <matrixrow><xsl:apply-templates select="*[2]"/></matrixrow> + <matrixrow><xsl:apply-templates select="*[3]"/></matrixrow> + </matrix> + </xsl:template> + + <!-- <OMS cd="units_siprefix1" name="centi" cdbase="mathadore"/> --> + <!-- <OMS cd="units_metric1" name="metre" cdbase="mathadore"/> --> + + <xsl:template match="om:OMS[contains(@cd,'units_')]"> + <csymbol> + <xsl:attribute name="definitionURL"> + <xsl:value-of select="concat(concat(concat(concat( + 'http://www.openmath.org/cd/mathadore','#'),@cd),'@'),@name)"/> + </xsl:attribute> + </csymbol> + </xsl:template> + +</xsl:stylesheet> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-openmath.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-openmath.mkii new file mode 100644 index 00000000000..38474996e1b --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-openmath.mkii @@ -0,0 +1,4 @@ +% This module is yet empty. We assume a transformation using +% x-openmath.xsl. + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-openmath.xsl b/Master/texmf-dist/tex/context/modules/mkii/x-openmath.xsl new file mode 100644 index 00000000000..ffb40493951 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-openmath.xsl @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:output method="xml"/> + + <!-- newline, temp hack, latest texexec handles it okay --> + + <xsl:template match="processing-instruction()"><xsl:copy/><xsl:text> + </xsl:text></xsl:template> + + <!-- xsl:template match="*"><xsl:copy/></xsl:template --> + <!-- xsl:element name="{name(current())}"><xsl:apply-templates/></xsl:element --> + +<!-- + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates/> + </xsl:copy> + </xsl:template> +--> + + <xsl:template match="node()|@*" > + <xsl:copy> + <xsl:apply-templates select = "node()|@*" /> + </xsl:copy> + </xsl:template> + + <xsl:template match="comment"></xsl:template> + + <xsl:variable name='openmath-to-content-mathml'><value-of select='$stylesheet-path'/>/x-openmath.xsl</xsl:variable> + + <xsl:include href="x-om2cml.xsl"/> + +</xsl:stylesheet> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-physml.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-physml.mkii new file mode 100644 index 00000000000..4d9cffe3325 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-physml.mkii @@ -0,0 +1,16 @@ +%D \module +%D [ file=m-physml, +%D version=2001.09.04, +%D title=\CONTEXT\ XML Modules, +%D subtitle=Loading PHYSML Filters, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\usemodule[units] \useXMLfilter[pml,pmu] + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-physml.xsd b/Master/texmf-dist/tex/context/modules/mkii/x-physml.xsd new file mode 100644 index 00000000000..865d88c58ed --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-physml.xsd @@ -0,0 +1,172 @@ +<?xml version="1.0"?> + +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + +<xsd:annotation> + <xsd:documentation xml:lang="en"> + This schema covers (basic presentational) Physics + markup. It combines the power of MathML and the ConTeXt + units engine. + + author: Hans Hagen, copyright: PRAGMA-ADE / Hasselt NL + </xsd:documentation> +</xsd:annotation> + +<xsd:complexType name="unit.power.type"> + <xsd:element name="Inverse" minOccurs="0" maxOccurs="1" /> + <xsd:choice> + <xsd:element name="Linear" /> + <xsd:element name="Square" /> + <xsd:element name="Cubic" /> + </xsd:choice> +</xsd:complexType> + +<xsd:complexType name="unit.prefix.type"> + <xsd:choice> + <xsd:element name="Atto" /> + <xsd:element name="Femto" /> + <xsd:element name="Pico" /> + <xsd:element name="Nano" /> + <xsd:element name="Micro" /> + <xsd:element name="Milli" /> + <xsd:element name="Centi" /> + <xsd:element name="Deci" /> + <xsd:element name="Hecto" /> + <xsd:element name="Kilo" /> + <xsd:element name="Mega" /> + <xsd:element name="Giga" /> + <xsd:element name="Terra" /> + <xsd:element name="Peta" /> + <xsd:element name="Exa" /> + + <xsd:element name="NoUnit" /> + </xsd:choice> +</xsd:complexType> + +<xsd:complexType name="unit.midfix.type"> + <xsd:choice> + <xsd:element name="Per" /> + <xsd:element name="Times" /> + <xsd:element name="Solidus" /> + <xsd:element name="OutOf" /> + </xsd:choice> +</xsd:complexType> + +<xsd:complexType name="unit.suffix.type"> + <xsd:choice> + <xsd:element name="Ampere" /> + <xsd:element name="Angstrom" /> + <xsd:element name="At" /> + <xsd:element name="Atm" /> + <xsd:element name="Atom" /> + <xsd:element name="Bar" /> + <xsd:element name="Baud" /> + <xsd:element name="Bell" /> + <xsd:element name="Bequerel" /> + <xsd:element name="Bit" /> + <xsd:element name="Byte" /> + <xsd:element name="Cal" /> + <xsd:element name="Candela" /> + <xsd:element name="Celsius" /> + <xsd:element name="Coulomb" /> + <xsd:element name="Day" /> + <xsd:element name="Deg" /> + <xsd:element name="Degrees" /> + <xsd:element name="Equivalent" /> + <xsd:element name="EVolt" /> + <xsd:element name="eVolt" /> + <xsd:element name="Fahrenheit" /> + <xsd:element name="Farad" /> + <xsd:element name="Foot" /> + <xsd:element name="Force" /> + <xsd:element name="Gauss" /> + <xsd:element name="Gram" /> + <xsd:element name="Gray" /> + <xsd:element name="Henry" /> + <xsd:element name="Hertz" /> + <xsd:element name="Hour" /> + <xsd:element name="Inch" /> + <xsd:element name="Joule" /> + <xsd:element name="Kelvin" /> + <xsd:element name="Liter" /> + <xsd:element name="Lux" /> + <xsd:element name="Meter" /> + <xsd:element name="Min" /> + <xsd:element name="Mol" /> + <xsd:element name="Molair" /> + <xsd:element name="Month" /> + <xsd:element name="Newton" /> + <xsd:element name="Ohm" /> + <xsd:element name="Pascal" /> + <xsd:element name="Rad" /> + <xsd:element name="RevPerMin" /> + <xsd:element name="RevPerSec" /> + <xsd:element name="Sec" /> + <xsd:element name="Second" /> + <xsd:element name="Siemens" /> + <xsd:element name="Sievert" /> + <xsd:element name="Sterant" /> + <xsd:element name="Tesla" /> + <xsd:element name="Volt" /> + <xsd:element name="VoltAC" /> + <xsd:element name="VoltDC" /> + <xsd:element name="Watt" /> + <xsd:element name="Weber" /> + <xsd:element name="Week" /> + <xsd:element name="Year" /> + + <xsd:element name="Unit" /> + </xsd:choice> +</xsd:complexType> + +<xsd:complexType name="unit.component.type"> + <xsd:sequence> + <xsd:element ref="unit.power.type" minOccurs="0" maxOccurs="1" /> + <xsd:element ref="unit.prefix.type" minOccurs="0" maxOccurs="1" /> + <xsd:element ref="unit.suffix.type" minOccurs="0" maxOccurs="1" /> + </xsd:sequence> +</xsd:complexType> + +<xsd:complexType name="unit.type"> + <xsd:choice> + <xsd:sequence> + <xsd:element ref="unit.component.type" minOccurs="1" maxOccurs="1" /> + </xsd:sequence> + <xsd:sequence> + <xsd:element ref="unit.component.type" minOccurs="1" maxOccurs="1" /> + <xsd:element ref="unit.midfix.type" minOccurs="1" maxOccurs="1" /> + <xsd:element ref="unit.component.type" minOccurs="1" maxOccurs="1" /> + </xsd:sequence> + </xsd:choice> +</xsd:complexType> + +<xsd:element name="unit" type="unit.type" /> + +<xsd:element name="physics.type"> + <choice> + <xsd:element name="apply"> + <xsd:sequence> + <xsd:element name="unit" minOccurs="1" maxOccurs="1" /> + <xsd:element name="some kind of mml result" minOccurs="0" maxOccurs="1" /> + <choice> + <xsd:element name="cu" type=unit.type minOccurs="0" maxOccurs="1" /> + <xsd:element name="cunseq" type=unit.type minOccurs="0" maxOccurs="1" /> + <xsd:element name="csymbol" type=unit.type minOccurs="0" maxOccurs="1" /> + </choice> + </xsd:sequence> + </xsd:element> + <xsd:sequence> + <choice> + <xsd:element name="cn" minOccurs="0" maxOccurs="1" /> + <xsd:element name="ci" minOccurs="0" maxOccurs="1" /> + </choice> + <xsd:element name="cu" type="unit.type" minOccurs="0" maxOccurs="1" /> + </xsd:sequence> + </choice> +</xsd:element> + +<xsd:element name="phys" type="physics.type" /> +<xsd:element name="iphys" type="physics.type" /> +<xsd:element name="dphys" type="physics.type" /> + +</xsd:schema> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-00.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-00.mkii new file mode 100644 index 00000000000..d031e1453ed --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-00.mkii @@ -0,0 +1,67 @@ +%D \module +%D [ file=x-res-00, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Libraries, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +% \defineXMLcommandpush [rl:instance] (todo) +% \rawframed == [frame=off,offset=overlay] + +% resource library + +\defineXMLprocess [rl:figurelibrary] % not to be used any longer +\defineXMLprocess [rl:library] + +% resource library description + +\defineXMLignore [rl:description] + +\defineXMLpush [rl:organization] +\defineXMLpush [rl:product] +\defineXMLpush [rl:project] +\defineXMLpush [rl:collection] + +% resource library entries (better use XMLignore) + +\defineXMLignore [rl:applet] +\defineXMLignore [rl:application] +\defineXMLignore [rl:figure] +\defineXMLignore [rl:movie] +\defineXMLignore [rl:sound] + +\defineXMLpush [rl:type] +\defineXMLpush [rl:state] +\defineXMLpush [rl:width] +\defineXMLpush [rl:height] +\defineXMLpush [rl:file] +\defineXMLpush [rl:label] +\defineXMLpush [rl:original] +\defineXMLpush [rl:title] +\defineXMLpush [rl:alternative] +\defineXMLpush [rl:dummy] +\defineXMLpush [rl:icon] +\defineXMLpush [rl:copyright] +\defineXMLpush [rl:comment] +\defineXMLpush [rl:status] +\defineXMLpush [rl:original] +\defineXMLpush [rl:manipulation] + +% instances + +\defineXMLignore [rl:instance] + +\defineXMLpush [rl:background] +\defineXMLpush [rl:viewport] +\defineXMLpush [rl:dimension] +\defineXMLpush [rl:position] + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-01.mkii new file mode 100644 index 00000000000..41580a0b8ef --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-01.mkii @@ -0,0 +1,487 @@ +%D \module +%D [ file=x-fig-01, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Base Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D See \type {x-fig-00.tex} and \type {x-fig-04.tex} for more +%D information on how to use and generate figure databases. +%D This file loads the file named \type {\jobfilename} +%D (\TEXEXEC\ will set this variable). You can apply this +%D style to a database by saying: +%D +%D \starttyping +%D texexec --pdf --use=fig-make yourfile.xml +%D \stoptyping +%D +%D The following modes are supported: +%D +%D \starttabulate[|lT|l|] +%D \NC letter \NC map the preview on letter size \NC \NR +%D \NC compact \NC use an alternative presentation \NC \NR +%D \NC clipgrid-distance \NC add a copy with grid overlayed \NC \NR +%D \NC clipgrid-steps \NC add a copy with grid overlayed \NC \NR +%D \NC previewpage-A4 \NC show graphic relative to A4 \NC \NR +%D \NC previewpage-letter \NC show graphic relative to letter \NC \NR +%D \NC previewpage-S6 \NC show graphic relative to S6 \NC \NR +%D \stoptabulate +%D +%D The resulting file has the following characteristics: +%D +%D \startitemize[packed] +%D \item the document is split into three sections: first each +%D figure is shown at its own page, then an overview of +%D figures is shown with some data alongside, and +%D finally an index and table of contents shows up +%D \item there is no title page, which means that one can +%D access a figure by page number without offset +%D \item the document is opened at the first overview page, +%D that is, when the viewer supports it +%D \item the graphic is shown 3~times: on a page of its own, +%D scaled to a fixed dimension, and relative to a4 or +%D letter paper size +%D \item the labels can be accessed in an index and list at +%D the end of the document +%D \stopitemize +%D +%D We use named destinations, which means that one can +%D access a figure by name from an external application. + +\usemodule[res-00] + +\autoXMLnamespace[rl] + +\setupoutput[pdftex] \overcomePDFspacefalse + +\setjobfullname {xml} % default suffix + +\doifnothing {\jobfullname} {\end} +\doiffileelse {\jobfullname} {} {\end} + +\definesymbol [attachment] [{\bf\color[darkred]{\jobname.xml}}] +\setupattachments [symbol=attachment] +\useattachment [datafile] [\jobname.xml] + +\def\StartDescription + {\bgroup} + +\def\StopDescription + {\subject {Figure collection} + \starttabulate[|lBe|p|] + \doifXMLdataelse{rl:organization} + {\NC organization \NC \XMLflush{rl:organization} \NC \NR}{} + \doifXMLdataelse{rl:project} + {\NC project \NC \XMLflush{rl:project} \NC \NR}{} + \doifXMLdataelse{rl:product} + {\NC product \NC \XMLflush{rl:product} \NC \NR}{} + \doifXMLdataelse{rl:comment} + {\NC comment \NC \XMLflush{rl:comment} \NC \NR}{} + \NC specification \NC \attachment[datafile] \NC \NR + \stoptabulate + \blank[2*big] + \egroup} + + +\def\localexternalfigurereplacement#1#2#3% hack, no reuse of dummies (yet), todo: pass objname + {\doifelsenothing{\XMLflush{rl:label}} + {\edef\FigureName{\XMLflush{rl:label}}} + {\edef\FigureName{\XMLflush{rl:file}}}% + \doifobjectfoundelse{rl}\FigureName + {} + {\setobject{rl}\FigureName\vbox{\normalexternalfigurereplacement{#1}{#2}{#3}}}% + \getobject{rl}\FigureName} + +\startmode[dummy] + + \useMPlibrary[dum] + + \def\StartFigureA + {\bgroup + \XMLassign{rl:file}{dummy}} + + \let\normalexternalfigurereplacement\externalfigurereplacement + \let\externalfigurereplacement \localexternalfigurereplacement + +\stopmode + +\startnotmode[dummy] + + \def\StartFigureA + {\bgroup + \XMLassign{rl:file}{unknown}} + +\stopnotmode + +\startbuffer[unknown] + \framed + [width=\XMLpar{rl:dummy}{width}{12cm}, + height=\XMLpar{rl:dummy}{height}{8cm}, + background=color, + backgroundcolor=gray, + foregroundcolor=darkred, + align={lohi,middle}, % normal, + frame=off] + {\bf \XMLflush{rl:dummy}} +\stopbuffer + +\useexternalfigure[unknown][unknown][type=buffer,object=no] + +\defineoverlay[page][\overlaybutton{Description}] + +% \def\externalfigurereplacement#1#2#3% +% {\getbuffer[rl-unknown]} + +\def\StopFigureA + {\doglobal\increment\CurrentPage + \setupbackgrounds[page][background=page] + \doifelsenothing{\XMLflush{rl:label}} + {\expanded{\definereference[Description][about:\XMLflush{rl:file}]}% + \expanded{\pagereference[\XMLflush{rl:file}]}} + {\expanded{\definereference[Description][about:\XMLflush{rl:label}]}% + \expanded{\pagereference[\XMLflush{rl:label}]}} + \pagefigure[\XMLflush{rl:file}] + \setupbackgrounds[page][background=] + \egroup} + +\def\StartFigureB + {\StartFigureA} + +\defineregister + [figureindex] + [figureindices] + +\setupregister + [figureindex] + [ownnumber=yes, + criterium=text, + interaction=text, + indicator=no] + +\definelist + [figurelist] + +\setuplist + [figurelist] + [criterium=text, + pagenumber=no, + width=2em, + interaction=all] + +\setupcolors + [state=start] + +\setuptolerance + [verytolerant] + +% Ulgy: + +\startmode[letter] % downward compatible + \enablemode[previewpage-letter] +\stopmode + +\startnotmode[previewpage-letter,previewpage-S6] + \enablemode[previewpage-A4] +\stopnotmode + +\startsetups[paper] +\startmode[previewpage-A4] + \framed + [width=210mm,height=297mm,offset=overlay,frame=off, + background=color,backgroundcolor=white] + {\externalfigure[\XMLflush{rl:file}][reset=yes]} +\stopmode +\startmode[previewpage-letter] + \framed + [width=8.5in,height=11in,offset=overlay,frame=off, + background=color,backgroundcolor=white] + {\externalfigure[\XMLflush{rl:file}][reset=yes]} +\stopmode +\startmode[previewpage-S6] + \framed + [width=600pt,height=450pt,offset=overlay,frame=off, + background=color,backgroundcolor=white] + {\externalfigure[\XMLflush{rl:file}][reset=yes]} +\stopmode +\stopsetups + +\setupbuttons + [offset=10pt, + width=broad, + strut=no, + rulethickness=1pt, + framecolor=darkred] + +\definecolor[XMLRLcolor][white] + +\def\StopFigureB + {\doglobal\increment\CurrentPage + \doifelsenothing{\XMLflush{rl:label}} + {\expanded{\definereference[Figure][\XMLflush{rl:file}]}% + \expanded{\definereference[GridPg][grid:\XMLflush{rl:file}]}} + {\expanded{\definereference[Figure][\XMLflush{rl:label}]}% + \expanded{\definereference[GridPg][grid:\XMLflush{rl:label}]}}% + \button + {\hbox to \hsize + {\forgetall \dontcomplain + \doifelsenothing{\XMLflush{rl:label}} + {\expanded{\pagereference[about:\XMLflush{rl:file}]}} + {\expanded{\pagereference[about:\XMLflush{rl:label}]}}% + % moved here, because descriptions may be absent + \ifnum\CurrentPage=1 \pagereference[begin]\fi + % + \expanded{\writetolist[figurelist]{\CurrentPage}{\XMLflush{rl:label}}}% + \expanded{\figureindex{\CurrentPage}{\XMLflush{rl:label}}}% + \startnotmode[compact]% + \vbox to 100pt + {\hsize30pt + \vskip5pt + \hbox to \hsize{\hss\strut\bf\CurrentPage\hss}% + \vfill}% + \advance\hsize by -30pt + \stopnotmode + \startmode[compact]% + \advance\hsize by -10pt + \hskip10pt + \stopmode + \button % \framed + [width=150pt,height=100pt,offset=10pt,frame=off, + background=color,backgroundcolor=white,color=] + {\externalfigure + [\XMLflush{rl:file}] + %[maxheight=80pt,frame=off,maxwidth=130pt,factor=max]}% + [factor=max]}% + [GridPg]% + \let\FigWid\figurenaturalwidth + \let\FigHei\figurenaturalheight + \advance\hsize by -150pt + \hskip10pt + \advance\hsize by -10pt + \vbox to 100pt + {\hsize40pt + %\externalfigure + % [paper] + % [type=buffer,frame=on, + % framecolor=darkred,rulethickness=.5pt, + % width=40pt,object=no] + \framed + [offset=overlay, + framecolor=darkred, + rulethickness=.5pt] + {\scale[width=40pt]{\setups[paper]}}% + \startmode[compact]% + \vfill + \hbox to \hsize{\hss\strut\bf\CurrentPage\hss}% + \stopmode + \vfill}% + \advance\hsize by -40pt + \hskip10pt + \advance\hsize by -10pt + \vbox to 100pt + {\blank[disable] + \starttabulate[|Bel|p|] + \NC file \NC \XMLflush{rl:file} \NC \NR + \doifXMLdata{rl:label} + {\NC label \NC \XMLflush{rl:label} \NC \NR} + \NC w$\times$h \NC \FigWid$\times$\FigHei \NC \NR + \doifXMLdata{rl:copyright} + {\NC copyright \NC \XMLflush{rl:copyright} \NC \NR} + \doifXMLdata{rl:status} + {\doifelse{\XMLflush{rl:status}}{obsolete} + {\NC status \NC \dontleavehmode \color[darkred]{\bf\XMLflush{rl:status}} \NC \NR} + {\NC status \NC \XMLflush{rl:status} \NC \NR}} + \doifXMLdata{rl:comment} + {\NC comment \NC \XMLflush{rl:comment} \NC \NR} + \stoptabulate + \vfill}}}% + [Figure] + \vskip10pt + \egroup} + +\def\StartFigureC + {\StartFigureA} + +\def\StopFigureC + {\doglobal\increment\NumberOfFigures + \egroup} + +\setuplayout + [topspace=15pt,backspace=15pt, + header=0pt,footer=0pt,bottom=20pt,bottomdistance=10pt, + width=middle,height=fit] + +\setupbackgrounds + [page] + [background=, + backgroundcolor=gray] + +\setupinteractionscreen + [width=max, + height=max] + +\setupcolors + [state=start] + +\setupinteraction + [style=, + color=, + contrastcolor=, + state=start] + +\setuphead + [section] + [style=bfb] + +% \setupbodyfont +% [pos] + +\setupinteractionmenu + [bottom] + [left=\hfill, + middle=\hskip10pt, + frame=off, + style=bold, + background=color, + backgroundcolor=darkred, + foregroundcolor=white] + +\startinteractionmenu[bottom] + \but [begin] begin \\ + \but [index] index \\ + \but [list] list \\ + \but [CloseDocument] close \\ + \but [PreviousJump] go back \\ +\stopinteractionmenu + +\setupinteraction + [openaction=begin] + +\defineXMLenvironment [rl:figurelibrary] \StartLibrary \StopLibrary +\defineXMLenvironment [rl:library] \StartLibrary \StopLibrary + +\starttext + +\def\StartLibrary{\mainlanguage[\XMLpar{rl:library}{language}{en}]} +\def\StopLibrary {} + +\defineXMLignore [rl:description] +\defineXMLenvironment [rl:figure] \StartFigureC \StopFigureC + +\doglobal\newcounter\CurrentPage + +\processXMLfilegrouped{\jobfullname} + +\increment\NumberOfFigures + +\defineXMLignore [rl:description] +\defineXMLenvironment [rl:figure] \StartFigureA \StopFigureA + +\doglobal\newcounter\CurrentPage + +\processXMLfilegrouped{\jobfullname} + +\setuppapersize + [S6][S6] + +\setupbackgrounds + [page] + [background=color] + +\setupinteraction + [menu=on] + +\defineXMLenvironment [rl:description] \StartDescription \StopDescription +\defineXMLenvironment [rl:figure] \StartFigureB \StopFigureB + +\doglobal\newcounter\CurrentPage + +\processXMLfilegrouped{\jobfullname} \page + +\subject [list] {List of figures} + +\placelist[figurelist] \page + +\subject [index] {Index of figures} + +\startcolumns +\placeregister[figureindex] +\stopcolumns + +\doifmodeelse{clipgrid-distance,clipgrid-steps}{\page}{\stoptext} + +\startuniqueMPgraphic{clipgrid}{dx,dy,nx,ny,type} + numeric gdx, gdy, lbx, lby ; + if \MPvar{type}=1 : + gdx := \MPvar{dy} ; + gdy := \MPvar{dx} ; + else : + gdx := OverlayWidth /\MPvar{nx} ; + gdy := OverlayHeight/\MPvar{ny} ; + fi ; + lbx := gdx ; + lby := gdy ; + defaultfont := "\truefontname{Mono}" ; + defaultscale := .5 ; + numeric pen ; pen := .25pt ; + def MyGrid text t = + draw vlingrid (0,OverlayWidth ,gdy,OverlayWidth ,OverlayHeight) t ; + draw hlingrid (0,OverlayHeight,gdx,OverlayHeight,OverlayWidth ) t ; + enddef ; + pickup pencircle scaled pen ; + MyGrid withcolor white ; + MyGrid dashed evenly scaled pen ; + draw OverlayBox withcolor white ; + draw OverlayBox dashed evenly scaled pen ; + draw vlinlabel.bot(0,eps+OverlayWidth /lby,2,OverlayWidth ) ; + draw hlinlabel.lft(0,eps+OverlayHeight/lbx,2,OverlayHeight) ; + setbounds currentpicture to OverlayBox enlarged (2*EmWidth) ; +\stopuniqueMPgraphic + +\presetMPvariable[clipgrid][dx=10pt] +\presetMPvariable[clipgrid][dy=10pt] +\presetMPvariable[clipgrid][nx=10] +\presetMPvariable[clipgrid][ny=10] + +\startmode[clipgrid-distance] + \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=1}] +\stopmode + +\startmode[clipgrid-steps] + \defineoverlay[grid][\uniqueMPgraphic{clipgrid}{type=2}] +\stopmode + +\setupexternalfigures + [background={color,foreground,grid}, + backgroundcolor=white] + +\def\StartFigureD + {\StartFigureA} + +\def\StopFigureD + {\doglobal\increment\CurrentPage + \setupbackgrounds[page][background=page] + \startpagefigure[\XMLflush{rl:file}][offset=20pt]% + \doifelsenothing{\XMLflush{rl:label}} + {\expanded{\definereference[Description][about:\XMLflush{rl:file}]}% + \expanded{\pagereference[grid:\XMLflush{rl:file}]}} + {\expanded{\definereference[Description][about:\XMLflush{rl:label}]}% + \expanded{\pagereference[grid:\XMLflush{rl:label}]}} + \stoppagefigure + %\pagefigure[\XMLflush{rl:file}][offset=20pt] + \setupbackgrounds[page][background=] + \egroup} + +\defineXMLignore [rl:description] +\defineXMLenvironment [rl:figure] \StartFigureD \StopFigureD + +\doglobal\newcounter\CurrentPage + +\processXMLfilegrouped{\jobfullname} \page + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-02.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-02.mkii new file mode 100644 index 00000000000..f8502dbac1c --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-02.mkii @@ -0,0 +1,72 @@ +%D \module +%D [ file=x-res-02, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Base Inclusion (I), +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module enables non||\ConTeXt\ users to access the +%D database. For this, you need to run +%D +%D \starttyping +%D texexec --pdf --use=fig-fake yourfile.xml +%D \stoptyping +%D +%D The resulting file, \type {yourfile.fig}, can be loaded +%D in the normal way. The figures can be accessed with: +%D +%D \starttyping +%D \getfigurefile{label} +%D \getfigurepage{label} +%D \stoptyping +%D +%D A a bonus, the following macro is defined: +%D +%D \starttyping +%D \includefigurefile width 10cm {label} +%D \stoptyping + +\usemodule[res-00] + +\doifnothing {\jobfullname} {\end} +\doiffileelse {\jobfullname} {} {\end} + +\defineXMLenvironment [rl:figurelibrary] \StartLibrary \StopLibrary +\defineXMLenvironment [rl:library] \StartLibrary \StopLibrary +\defineXMLenvironment [rl:figure] \StartFigure \StopFigure + +\def\StartLibrary + {\immediate\openout \scratchwrite=\jobfilename.fig + \immediate\write\scratchwrite{\string\input\space x-fig-03.tex \string\relax} + \immediate\write\scratchwrite{}} + +\def\StopLibrary + {\immediate\write\scratchwrite{} + \immediate\write\scratchwrite{\string\endinput} + \immediate\closeout\scratchwrite} + +\def\StartFigure + {\bgroup} + +\def\StopFigure + {\doglobal\increment\CurrentPage + \immediate\write\scratchwrite + {\string\setfiguredata\space + {\XMLpop{rl:label}} + {\jobfilename} + {\CurrentPage}} + \egroup} + +\doglobal\newcounter\CurrentPage + +\starttext + +\processXMLfilegrouped{\jobfullname} + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-03.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-03.mkii new file mode 100644 index 00000000000..15f2620c1be --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-03.mkii @@ -0,0 +1,44 @@ +%D \module +%D [ file=x-fig-03, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Base Inclusion (II), +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\ifx \undefined \convertMPtoPDF \input supp-pdf.tex \fi +\ifx \undefined \includefigurefile \else \expandafter \endinput \fi + +\gdef\getfigurefile#1% + {\expandafter\ifx\csname x-fig-f-#1\endcsname\relax + \currentfigurefile + \else + \csname x-fig-f-#1\endcsname + \fi} + +\gdef\getfigurepage#1% + {\expandafter\ifx\csname x-fig-p-#1\endcsname\relax + 1% + \else + \csname x-fig-p-#1\endcsname + \fi} + +\gdef\setfiguredata#1#2#3% + {\gdef\currentfigurefile{#2}% + \expandafter\gdef\csname x-fig-f-#1\endcsname{#2}% + \expandafter\gdef\csname x-fig-p-#1\endcsname{#3}} + +\def\includefigurefile#1#% + {\doincludefigurefile{#1}} + +\def\doincludefigurefile#1#2% + {\edef\next{\noexpand\pdfimage + #1 page \getfigurepage{#2} {\getfigurefile{#2}.pdf}}% + \next} + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-04.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-04.mkii new file mode 100644 index 00000000000..b22e9ffa439 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-04.mkii @@ -0,0 +1,336 @@ +%D \module +%D [ file=x-fig-04, +%D version=2001.03.21, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Base Loading, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% hele base laden + +\setXMLfallbackmode3 + +% icon : preview +% caption : \figurebasevariable{caption} +% background : rgb cmyk gray name +% dimensions : width height offset (l,r,t,b) area +% alternative : tag label / evt list +% +% movie +% sound +% applet +% application + +\usemodule[res-00] % basic element definitions + +%D This module implements an interface to a figure database +%D and file. The database is formatted in \XML\ conforming +%D the following \DTD: +%D +%D \typefile{x-fig-00.dtd} +%D +%D A figure base coded this way looks like: +%D +%D \starttyping +%D <!-- texexec --pdf --use=fig-01 figtest.xml --> +%D +%D <?xml version='1.0'?> +%D +%D <rl:library language="nl"> +%D +%D <rl:description> +%D <organization>PRAGMA Advanced Document Engineering</rl:organization> +%D <project>Manuals</rl:project> +%D <product>Beginners Manual</rl:product> +%D <comment>A bunch of figures.</rl:comment> +%D </rl:description> +%D +%D <rl:figure> +%D <rl:file>koe.pdf</rl:file> +%D <rl:label>a dutch cow</rl:label> +%D <rl:copyright>Corel Draw Suite</rl:copyright> +%D <rl:comment>I bet that you've seen this cow before.</rl:comment> +%D </rl:figure> +%D +%D <rl:figure> +%D <rl:dummy width="4cm" height="3cm">non existent</rl:dummy> +%D <rl:label>a european cow</rl:label> +%D <rl:copyright>Nobody</rl:copyright> +%D <rl:comment>When will we talk about European cows?</rl:comment> +%D </rl:figure> +%D +%D </rl:library> +%D \stoptyping +%D +%D You can convert this base into a \PDF\ file using +%D \TEXEXEC\ and another module in this suite. +%D +%D \starttyping +%D texexec --pdf --use=fig-make yourfile.xml +%D \stoptyping +%D +%D You can now select a graphic from this file using the +%D +%D \starttyping +%D \externalfigure[a dutch cow][width=4cm] +%D \stoptyping +%D +%D This module overloads this command so that a figure is +%D it first searched in the list of databases. +%D +%D \starttyping +%D \usemodule [fig-base] +%D \usefigurebases[yourfile] +%D \stoptyping +%D +%D The special keyword \type {reset} can be used to reset +%D this list. + +\startcommands dutch english + german czech + italian romanian + + usefigurebase: gebruikfiguurbestand usefigurebase + usefigurebase usefigurebase + usefigurebase usefigurebase + +\stopcommands + +\unprotect + +\consultutilityfilefalse + +% 0 = no loading +% 1 = selective loading +% 2 = full loading + +\chardef\figurebasemode=1 % 2 + +\newcounter\figurefilepage + +% loading a complete figure base + +\startXMLmapping[rl:load] + +\defineXMLenvironmentsave [rl:figure] + {\bgroup} + {\XMLflush{rl:figure} + \doglobal\increment\figurefilepage + \figbase@savedata{\XMLflush{rl:label}}\figurefilepage + \egroup} + +\stopXMLmapping + +\def\loadfigurebase#1% + {\doifnotflagged{rl:#1} + {\writestatus{figbase}{loading #1 into memory}% + \startnointerference + \autoXMLnamespace[rl] + \startXMLmapping[rl:load] + \doglobal\newcounter\figurefilepage + \processXMLfilegrouped{#1.xml} + \stopXMLmapping + \doglobal\setflag{rl:#1} + \stopnointerference}} + +\def\figbase@savedata#1#2% + {%\writestatus{figbase}{data of #1 loaded}% + \doglobal\saveXMLdatastructure{rl:rl:#1}{record}{page="#2"}{}{rl:figure}{}} + +% locating and if needed loading one figure record + +\startXMLmapping[rl:find] + +\defineXMLenvironment[rl:instance] + {\bgroup} + {\doif\askedlabel{\XMLflush{rl:label}} + {\doglobal\saveXMLdata{rl:g:manipulation}{rl:manipulation}% + \doifXMLdata{rl:original} + {\xdef\askedlabel{\XMLflush{rl:original}}}}% + \egroup} + +\defineXMLenvironmentsave [rl:figure] + {\bgroup} + {\XMLflush{rl:figure} + \doglobal\increment\figurefilepage + %\doshowfigurestate{base : comparing \askedlabel\space with \XMLflush{rl:label}}% + \doif\askedlabel{\XMLflush{rl:label}} + {\doshowfigurestate{base label : found \askedlabel}% + \ifnum\figurebasemode=\plusone % load used ones + \figbase@savedata\askedlabel\figurefilepage + \fi + \doglobal\saveXMLdata{rl:l:manipulation}{rl:manipulation}% + \xdef\figurefilelabel {\XMLflush{rl:label}}% + \xdef\figurefilefile {\XMLflush{rl:file}}% + \xdef\figurefileoriginal{\XMLflush{rl:original}}% + \xdef\figurefilename {\XMLflush{rl:file}} + \endinput}% + \egroup} + +\defineXMLenvironment [rl:record] + {} + {\xdef\figurefilename{\XMLpop{rl:file}} + \xdef\figurefilepage{\XMLop {page}}} + +\stopXMLmapping + +\def\getfigurefilename#1#2% + {\ifnum\figurebasemode=\plustwo \loadfigurebase{#1} \fi + \startnointerference + \traceXMLelementsfalse + \resetfigurefilebase + \doglobal\newcounter\figurefilepage + \autoXMLnamespace[rl] + \startXMLmapping[rl:find] + \xdef\figurefilebase{#1}% + \def\askedlabel{#2}% + \doifelseXMLelement{rl:rl:\askedlabel} + {\enableXMLelements\flushXMLelement{rl:rl:\askedlabel}} + {\doshowfigurestate{base path : \figurepathlist}% + \processcommacommand[\figurepathlist]\dogetfigurefilename}% + \stopXMLmapping + \stopnointerference} + +% todo: niet toegekende naam doorgeven aan calculate en pad +% in padstring + +\def\dogetfigurefilename#1% + {\ifx\figurefilename\empty + \bgroup + \doglobal\newcounter\figurefilepage + \globalletempty\figurefilelabel + \globalletempty\figurefileoriginal + \globalletempty\figurefilefile + \xdef\figurefilebasepath{#1}% + \assignfullfilename{#1}{\figurefilebase}\to\filename + \doiffileelse{\filename.xml} + {\doshowfigurestate{base file : \filename}% + \expanded{\processXMLfilegrouped{\filename.xml}}} + \donothing + \ifx\figurefilename\empty \else +% \global\let\figurefilebase\figurefilebase + \globallet\figurefilebase\filename % hm, bad omen that this is needed + \fi + \egroup + \fi} + +\newtoks\figurebaseresets + +\appendtoks + \globalletempty\figurefilebase + \globalletempty\figurefilename + \globalletempty\figurefilebasepath + \globalletempty\figurefilepage + \globalletempty\figurefilelabel + %\globalletempty\figurefileoriginal + %\globalletempty\figurefilefile +\to\figurebaseresets + +\def\resetfigurefilebase + {\the\figurebaseresets} + +\ifx\doshowfigurestate\undefined \let\doshowfigurestate\gobbleoneargument \fi + +\def\doanalyzefiguredimensionsfromfile + {\ifcase\figurestatus \ifx\figurebaselist\empty \else + \resetfigurefilebase + \doshowfigurestate{base list : \figurebaselist}% + \processcommacommand[\figurebaselist]\dodoanalyzefiguredimensionsfromfile + \ifx\figurefilename\empty + \doshowfigurestate{base warning : no matching name found}% + \else + \doiffileelse{\figurefilebase.pdf} + {\doshowfigurestate{base file : \figurefilebase.pdf}% + \doshowfigurestate{base page : \figurefilepage}% + \let\figurepathlist\figurefilebasepath + \analyzefigurefilename{\figurefilebase.pdf}\wantedfigurelabel + \let\wantedfigurepage\figurefilepage} + {\doshowfigurestate{base missing : \figurefilebase.pdf}} + \fi + \ifcase\figurestatus + \analyzefigurefilename\expandedfigurename\wantedfigurelabel + \fi + \fi \fi} + +\def\dodoanalyzefiguredimensionsfromfile#1% + {\doshowfigurestate{base check : \wantedfigurename\space in #1}% + \getfigurefilename{#1}\wantedfigurename + \ifx\figurefilename\empty\else + \quitcommalist + \fi} + +% management + +% will become \useresourcelibrary + +\def\usefigurebase[#1]% + {\doifelse{#1}\v!reset + {\let\figurebaselist\empty} + {\addtocommalist{#1}\figurebaselist}} + +\let\figurebaselist\empty + +\resetfigurefilebase + +% manipulations / todo: fixed order + +\defineXMLsave [rl:manipulation] + +\defineXMLsingular [rl:background] [r=0,g=0,b=0,s=0,c=0,m=0,y=0,k=0] + {\global\setbox\foundexternalfigure\vbox + {\definecolor + [XMLRLcolor] + [r=\XMLop{r},g=\XMLop{g},b=\XMLop{b},s=\XMLop{s},% + c=\XMLop{c},m=\XMLop{m},y=\XMLop{y},k=\XMLop{k}]% + \framed + [\c!frame=\v!off,\c!offset=\v!overlay, + \c!background=\v!color,\c!backgroundcolor=XMLRLcolor] + {\box\foundexternalfigure}}} + +\defineXMLsingular [rl:viewport] [\??cp] % [] + {\global\setbox\foundexternalfigure\vbox + {\expandXMLta \getXMLta + \clip + [\XMLta] + {\box\foundexternalfigure}}% + \global\setbox\foundexternalfigure\vbox + {\scale + [\c!width=\figurewidth,\c!height=\figureheight] + {\box\foundexternalfigure}}} + +\defineXMLsingular [rl:dimensions] [width=,height=] + {} + +\defineXMLsingular [rl:position] [offset=,width=,height=,hoffset=,voffset=] + {} + +\appendtoks + \doglobal\eraseXMLelement{rl:l:manipulation}% + \doglobal\eraseXMLelement{rl:g:manipulation}% +\to \figurebaseresets + +\appendtoks + \startnointerference + \processXMLelement{rl:l:manipulation}% + \processXMLelement{rl:g:manipulation}% + \stopnointerference +\to \externalfigurepostprocessors + +\protect \doifnotmode{demo}{\endinput} + +\starttext + +\setupcolors[state=start] + +\usefigurebase[d-fig-01] + +\externalfigure[part of a dutch cow][width=3cm,frame=on] +\externalfigure[a simple dutch cow][width=5cm,frame=on] +\externalfigure[another simple dutch cow][width=5cm,frame=on] + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-08.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-08.mkii new file mode 100644 index 00000000000..0805f071fdb --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-08.mkii @@ -0,0 +1,129 @@ +%D \module +%D [ file=x-fig-08, +%D version=2002.06.27, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Reporting, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D TODO: make rlxtools callable from texexec (class), speeds up things. + +%D Experimental module! +%D +%D \starttyping +%D <rl:library> +%D <rl:usage> +%D <rl:type>figure</rl:type> +%D <rl:state>found|missing</rl:state> +%D <rl:name>filename</rl:name> +%D <rl:suffix>filesuffix</rl:suffix> +%D <rl:width>width in pt</rl:width> +%D <rl:height>height in pt</rl:height> +%D <rl:comment>text</rl:comment> +%D </rl:usage> +%D </rl:library> +%D \stoptyping + +\unprotect \doifnotmode{\systemmodeprefix\v!first}{\protect\endinput} + +\def\XMLrlprefix{rl:} + +\newwrite\XMLrllog + +\def\openXMLresourcelog + {\immediate\openout\XMLrllog\jobname.rlg\relax + \immediate\write\XMLrllog{\XMLbanner{standalone='yes'}}% + \immediate\write\XMLrllog{\writtenXMLstart{\XMLrlprefix library}}} + +\def\closeXMLresourcelog + {\immediate\write\XMLrllog{\writtenXMLend{\XMLrlprefix library}}% + \immediate\closeout\XMLrllog} + +\let\figurefilelabel \empty +\let\figurefileoriginal \empty +\let\figurefilefile \empty +\let\figurefilepath \empty +\let\figurefileconversion\empty +\let\figurefileprefix \empty + +\def\XMLfeedbackresource#1#2% + {\begingroup + \defconvertedcommand\currentresourcecomment\currentresourcecomment + \doifnothing\figurefilefile{\edef\figurefilefile{\figurefilename.\figurefiletype}}% + \immediate\write\XMLrllog + {\writtenXMLelement{\XMLrlprefix usage}% + {\writtenXMLelement{\XMLrlprefix type}{#2}% 'figure' not the type in \extenalfigure + \writtenXMLelement{\XMLrlprefix state}{#1}% 'missing' 'found' etc + \ifx\figurefilelabel\empty + \ifx\figurelabel\s!dummy \else % otherwise label equals filename + \writtenXMLelementcs{\XMLrlprefix label}\figurelabel + \fi + \writtenXMLelementcs{\XMLrlprefix file}\figurefilefile % complete name + \writtenXMLelementcs{\XMLrlprefix name}\figurefilename % no suffix + \writtenXMLelementcs{\XMLrlprefix suffix}\figurefiletype + \else + % \figurefilelabel is set in x-res-04 and since + % we fetch from this base using the normal + % \externalfigure macro, the label becomes the + % name of the figurebase + \writtenXMLelementcs{\XMLrlprefix base}\figurefilename + \writtenXMLelementcs{\XMLrlprefix label}\figurefilelabel + \writtenXMLelementcs{\XMLrlprefix file}\figurefilefile + \fi + \writtenXMLelementcs{\XMLrlprefix path}\figurefilepath + \writtenXMLelementcs{\XMLrlprefix original}\figurefileoriginal + \writtenXMLelementcs{\XMLrlprefix conversion}\figurefileconversion + \writtenXMLelementcs{\XMLrlprefix prefix}\figurefileprefix + \writtenXMLelementcs{\XMLrlprefix cache}\figurefilecache + \ifnum\figurefilepage>\zerocount + \writtenXMLelement{\XMLrlprefix page}\figurefilepage + \fi + \writtenXMLelementcs{\XMLrlprefix comment}\currentresourcecomment + \ifconditional\externalfigureflush + \writtenXMLelementcs{\XMLrlprefix width}\figurewidth + \writtenXMLelementcs{\XMLrlprefix height}\figureheight + \fi}}% + \endgroup} + +\def\XMLfeedbackexternalfigure + {\doifmodeelse{*\v!figure}% + {\XMLfeedbackresource{found}}% + {\XMLfeedbackresource{\ifconditional\externalfigureflush missing\else registered\fi}}% + {figure}} + +\setvariables + [rl:manipulate] + [file=rlxtools.rlx] + +% \startsetups[rl:manipulate] +% \doiflocfileelse{\jobname.rlx} +% {\installprogram{texmfstart rlxtools --manipulate kpse:\jobname.rlx \jobname.rlg}} +% {\installprogram{texmfstart rlxtools --manipulate kpse:\getvariabledefault{rl:manipulate}{file}{rlxtools.rlx} \jobname.rlg}} +% \stopsetups +% +% no longer need for \setups[rl:manipulate] + +\ifx\nofconversionfigures\undefined \chardef\nofconversionfigures\plusone \fi + +\appendtoks + \ifcase\nofconversionfigures + \writestatus\m!systems{not registering rlxtools (manipulator)}% + \else + \writestatus\m!systems{registering rlxtools (manipulator)}% + \doiflocfileelse{\jobname.rlx} + {\installprogram{texmfstart rlxtools --manipulate "kpse:\jobname.rlx" "\jobname.rlg"}} + {\installprogram{texmfstart rlxtools --manipulate "kpse:\getvariabledefault{rl:manipulate}{file}{rlxtools.rlx}" "\jobname.rlg"}}% + \fi +\to \everybye % \everylastshipout + +\appendtoks \openXMLresourcelog \to \everystarttext +\appendtoks \closeXMLresourcelog \to \everystoptext + +\let \feedbackexternalfigure \XMLfeedbackexternalfigure + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-09.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-09.mkii new file mode 100644 index 00000000000..e3354e9a422 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-09.mkii @@ -0,0 +1,69 @@ +%D \module +%D [ file=x-fig-09, +%D version=2002.06.27, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Reporting (2), +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\usemodule[res-00] + +\defineXMLenvironment [rl:library] + {\starttext} + {\stoptext} + +\defineXMLenvironment [rl:usage] + {\bgroup} + {\doifnot{\XMLflush{rl:file}}{dummy}{\setups[rl:usage]}% + \egroup} + +\defineXMLsave [rl:base] % base +\defineXMLsave [rl:type] % figure +\defineXMLsave [rl:state] % found|missing +\defineXMLsave [rl:label] % label +\defineXMLsave [rl:file] % filename +\defineXMLsave [rl:suffix] % filesuffix +\defineXMLsave [rl:comment] % text +\defineXMLsave [rl:width] % width in pt +\defineXMLsave [rl:height] % height in pt +\defineXMLsave [rl:page] % page from file + +\def\XMLbpentry#1% + {\PointsToWholeBigPoints{\XMLflush{#1}}\temp\temp bp} + +% \def\XMLrlentry#1#2#3% +% {\doiftextelse{\XMLflush{#2}} +% {\NC\bf#1\NC\XMLflush{#2}\doif{#3}{1}{ (\XMLbpentry{#2})}\NC\NR} +% {}} + +\def\XMLrlentry#1#2#3% + {\tableiftextelse{\XMLflush{#2}} + {\NC\bf#1\NC\XMLflush{#2}\doif{#3}{1}{ (\XMLbpentry{#2})}\NC\NR}{}} + +\startsetups[rl:usage] + +% by using a dedicated tabulation, we permit usage in dutch interface + +\definetabulate[XMLRLG][|lw(4.5em)|p|] + +\startXMLRLG + \XMLrlentry {base} {rl:base} {0} + \XMLrlentry {type} {rl:type} {0} + \XMLrlentry {state} {rl:state} {0} + \XMLrlentry {file} {rl:file} {0} + \XMLrlentry {label} {rl:label} {0} + \XMLrlentry {suffix} {rl:suffix} {0} + \XMLrlentry {page} {rl:page} {0} + \XMLrlentry {width} {rl:width} {1} + \XMLrlentry {height} {rl:height} {1} + \XMLrlentry {comment}{rl:comment}{0} +\stopXMLRLG + +\stopsetups + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-10.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-10.mkii new file mode 100644 index 00000000000..833bce776e1 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-10.mkii @@ -0,0 +1,75 @@ +%D \module +%D [ file=x-fig-10, +%D version=2003.08.02, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Dummy Generation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\usemodule[res-00] + +\defineXMLenvironment [rl:library] + {\starttext} + {\stoptext} + +\defineXMLenvironment [rl:usage] + {\bgroup} + {\doif{\XMLflush{rl:type}-\XMLflush{rl:state}}{figure-missing} + {\doifnot{\XMLflush{rl:file}}{dummy}{\setups[rl:usage]}} + \egroup} + +\defineXMLsave [rl:type] % figure +\defineXMLsave [rl:state] % found|missing +\defineXMLsave [rl:file] % filename + +\defineXMLsavecontent [rl:width] {12cm} % width in pt +\defineXMLsavecontent [rl:height] {9cm} % height in pt + +\useMPlibrary + [dum] + +\setupcolors + [state=start] + +\defineoverlay + [rl:banner] + [\setups{rl:banner}] + +\startsetups[rl:banner] + + \framed [frame=off,offset=none,align={lohi,middle}] + \bgroup + \tt \white \XMLflush{rl:file} + \egroup + +\stopsetups + +\startsetups[rl:usage] + + \startTEXpage + + % \externalfigure + % [\XMLflush{rl:file}] % goes wrong when file present + % [object=no, + % backgroundcolor=green,background={foreground,color,rl:banner}, + % width=\XMLflush{rl:width}, + % height=\XMLflush{rl:height}] + + \def\figurewidth {\XMLflush{rl:width}} + \def\figureheight{\XMLflush{rl:height}} + + \externalfigurereplacement + {\XMLflush{rl:file}} + {\XMLflush{rl:file}} + {\XMLflush{rl:state}} + + \stopTEXpage + +\stopsetups + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-11.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-11.mkii new file mode 100644 index 00000000000..84157be883a --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-11.mkii @@ -0,0 +1,110 @@ +%D \module +%D [ file=x-fig-11, +%D version=2003.02.08, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Reporting (3), +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\usemodule[res-00] + +\defineXMLenvironment [rl:library] + {\starttext + \doiffileelse{\outputfilename.zip}{\setups[rl:attach]}{} + \disablemode[rl:used]} + {\doifnotmode{rl:used}{No images processed.} + \page + \stoptext} + +\defineXMLenvironment [rl:usage] + {\bgroup} + {\doifnot{\XMLflush{rl:file}}{dummy} + {\setups[rl:usage] + \enablemode[rl:used]} + \egroup} + +\defineXMLsave [rl:base] % base +\defineXMLsave [rl:type] % figure +\defineXMLsave [rl:state] % found|missing +\defineXMLsave [rl:label] % label +\defineXMLsave [rl:file] % filename +\defineXMLsave [rl:suffix] % filesuffix +\defineXMLsave [rl:comment] % text +\defineXMLsave [rl:width] % width in pt +\defineXMLsave [rl:height] % height in pt +\defineXMLsave [rl:page] % page from file + +\def\XMLbpentry#1% + {\PointsToWholeBigPoints{\XMLflush{#1}}\temp\temp bp} + +\def\XMLrlentry#1#2#3% + {\tableiftextelse{\XMLflush{#2}} + {\NC\bf#1\NC\XMLflush{#2}\doif{#3}{1}{ (\XMLbpentry{#2})}\NC\NR}{}} + +\unprotect + +\setuplayout[\v!middle] + +\startsetups[rl:figure] + + \externalfigure[\XMLflush{rl:file}][\c!width=4cm] + +\stopsetups + +\startsetups[rl:table] + +% by using a dedicated tabulation, we permit usage in dutch interface + +\definetabulate[XMLRLG][|lw(4.5em)|p|] + +\startXMLRLG + \XMLrlentry {base} {rl:base} {0} + \XMLrlentry {type} {rl:type} {0} + \XMLrlentry {state} {rl:state} {0} + \XMLrlentry {file} {rl:file} {0} + \XMLrlentry {label} {rl:label} {0} + \XMLrlentry {suffix} {rl:suffix} {0} + \XMLrlentry {page} {rl:page} {0} + \XMLrlentry {width} {rl:width} {1} + \XMLrlentry {height} {rl:height} {1} + \XMLrlentry {comment}{rl:comment}{0} +\stopXMLRLG + +\stopsetups + +\startsetups[rl:usage] + + \startfiguretext {\v!none} {\setups[rl:figure]} + \setups[rl:table] + \stopfiguretext + +\stopsetups + +\startsetups[rl:attach] + + \useMPlibrary[nav] + + \setupcolors[\c!state=\v!start] + + \setupinteraction[\c!state=\v!start] + + \useattachment[whatever][\outputfilename.zip] + + \startlocalsetups[rl:attach:button] + + \inframed + [\c!offset=\v!overlay,\c!frame=\v!off] + {\attachment[whatever]} + + \stoplocalsetups + + \setupfootertexts[archive with dummies: \setups{rl:attach:button}] + +\stopsetups + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-12.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-12.mkii new file mode 100644 index 00000000000..81761ae9ad1 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-12.mkii @@ -0,0 +1,53 @@ +%D \module +%D [ file=x-fig-12, +%D version=2005.05.05, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Checking, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module implements the dimension checking using \RLXTOOLS. + +\unprotect + +\chardef\figurerlxmode\plusone % rlx permitted + +\startXMLmapping[rli] + \defineXMLprocess[rl:identify] + \defineXMLsavecontent[rl:width] {\!!zeropoint} + \defineXMLsavecontent[rl:height]{\!!zeropoint} +\stopXMLmapping + +\def\doanalyzefiguredimensionsrlx + {\ifcase\figurestatus \ifcase\figurerlxmode \else + \doifnotfile{\wantedfigurefullname.rli} + {% let's try runtime running first + \doshowfiguremessage6\wantedfigurefullname + \executesystemcommand{texmfstart rlxtools --identify \wantedfigurefullname}}% + \doifnotfile{\wantedfigurefullname.rli} + {% we assume that runtime running failed + \doshowfiguremessage6\wantedfigurefullname + \installprogram{texmfstart rlxtools --identify \wantedfigurefullname}}% + \doiffile{\wantedfigurefullname.rli} + {\global\let\analyzedfigurewidth \!!zeropoint + \global\let\analyzedfigureheight\!!zeropoint + \startnointerference % groups + \startXMLmapping[rli]% + \startXMLignore + \processXMLfile{\wantedfigurefullname.rli}% + \xdef\analyzedfigurewidth {\the\dimexpr\XMLflush{rl:width} \relax}% turn whatever into pt + \xdef\analyzedfigureheight{\the\dimexpr\XMLflush{rl:height}\relax}% turn whatever into pt + \stopXMLignore + \stopXMLmapping + \stopnointerference + \setanalyzedfiguredimensions\!!twelve}% + \fi\fi} + +\let\doanalyzefiguredimensionsexternal\doanalyzefiguredimensionsrlx + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-20.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-20.mkii new file mode 100644 index 00000000000..0bc1358ec41 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-20.mkii @@ -0,0 +1,231 @@ +%D \module +%D [ file=x-res-20, +%D version=2006.08.20, +%D title=\CONTEXT\ Style File, +%D subtitle=Figure Lists, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D For the beginning we have used \TEXUTIL\ to hels us deal with +%D graphics whose dimensions could not be determines and|/|or to +%D provide placeholder info for graphics that were not available. +%D Much of this functionality is now moved to \RLXTOOLS\ and +%D therefore it makes sense to reimplement the code that deals with +%D producing an overview of grapghics as well. At the same time we +%D move some \TEX\ code from \TEXEXEC\ to here. +%D +%D Because the show commands are not used in real documents, but +%D only for special purposed, it does not harm that this +%D functionality is now part of a module. We no longer use the +%D parsing code in \TEXUTIL, but rely on \IMAGEMAGICK's +%D identify functionility. +%D +%D At the end of the file we kept the old code from \type {core-fig}. + +\unprotect + +\startXMLmapping[rlx:list] + + \defineXMLprocess + [rl:identification] + + \defineXMLenvironment + [rl:identify] [name=] + {\bgroup\ignorespaces} + {\removeunwantedspaces\doRLhandlegraphic\egroup} + + \defineXMLsave[rl:size] + \defineXMLsave[rl:path] + \defineXMLsave[rl:width] + \defineXMLsave[rl:height] + +\stopXMLmapping + +\def\showexternalfigures + {\dosingleempty\doshowexternalfigures} + +\let\doRLhandlegraphic\relax +\let\doRLstartgraphics\relax +\let\doRLstopgraphics \relax + +\let\RLfigurewidth \empty +\let\RLfigureheight\empty +\let\RLfiguresize \empty +\let\RLfigurefile \empty + +\def\doRLpresetgraphic + {\edef\RLfigurewidth {\the\dimexpr \XMLflush{rl:width}\relax}% + \edef\RLfigureheight{\the\dimexpr \XMLflush{rl:height}\relax}% + \edef\RLfiguresize {\the\numexpr0\XMLflush{rl:size}\relax}% + \edef\RLfigurefile {\XMLpar{rl:identify}{name}{unknown}}} + +\def\doshowexternalfigures[#1]% + {\bgroup + \dontcomplain + \setupcolors[\c!state=\v!start]% to prevent mps color conversion + \getparameters[\??ex][\c!file=rlxtools.rli,\c!alternative=a,\c!offset=\!!zeropoint,\c!size=,#1]% + \getvalue{\strippedcsname\doRLhandlegraphic\@@exalternative}% + \startXMLmapping[rlx:list]% + \startXMLignore + \doRLstartgraphics + \processXMLfilegrouped{\@@exfile}% \readjobfile\@@exfile\donothing\donothing + \doRLstopgraphics + \stopXMLignore + \stopXMLmapping + \egroup} + +\def\doRLhandlegraphica + {\def\doRLhandlegraphic + {\doRLpresetgraphic + \getvalue{\e!start\v!figure\e!text}[\v!left,\v!none][] + {} + {\hbox + {\externalfigure[\RLfigurefile][\c!frame=\v!on,\c!width=6cm,\c!size=\@@exsize]% + \quad + \framed[\c!width=\figurewidth,\c!height=\figureheight]{}% + \quad}}% + {\hbox{\tt\tfa\setstrut\strut\expanded{\asciistr{\RLfigurefile}}}}% + \blank + \tfx + \starttabulate[|l|l|] + \NC width \EQ \RLfigurewidth \NC \NR + \NC height \EQ \RLfigureheight \NC \NR + \NC size \EQ \RLfiguresize \NC \NR + \stoptabulate + \getvalue{\e!stop\v!figure\e!text}}} + +\def\doRLhandlegraphicb + {\def\doRLhandlegraphic + {\dontleavehmode + \vbox + {\doRLpresetgraphic + \hsize\dimexpr.2\hsize-.8em\relax + \cbox{\externalfigure[\RLfigurefile][\c!frame=\v!on,\c!factor=\v!max,\c!width=\hsize,\c!size=\@@exsize]}% + \vskip.5\lineheight + \midaligned{\tttf\RLfigurefile}}% + \vadjust{\vskip.2\lineheight}% + \quad\allowbreak}} + +\def\doRLhandlegraphicc + {\def\doRLhandlegraphic + {\doRLpresetgraphic + \pagefigure[\RLfigurefile]}} + +\def\doRLhandlegraphicd % this one builds a dimension file for metapost/metafun + {\def\doRLstartgraphics + {\immediate\openout\scratchwrite=mpfigs.mp\relax + \immediate\write\scratchwrite{\letterpercent\space graphic dimension file for metapost/metafun}}% + \def\doRLstopgraphics + {\immediate\closeout\scratchwrite}% + \def\doRLhandlegraphic + {\doRLpresetgraphic + \immediate\write\scratchwrite{registerfigure("\RLfigurefile",\RLfigurewidth,\RLfigureheight);}}} + +% \showexternalfigures[alternative=b] + +\protect \endinput + +%D Old code: + +\def\doshowexternalfigures[#1]% + {\bgroup + \setupcolors[\c!state=\v!start]% to prevent mps color conversion + \getparameters[\??ex][\c!alternative=a,\c!offset=\!!zeropoint,\c!size=,#1]% + \getvalue{\strippedcsname\showexternalfigure\@@exalternative}% + \egroup} + +\def\showexternalfigures + {\dosingleempty\doshowexternalfigures} + +\def\showexternalfigurea + {\bgroup + \dontcomplain + \def\presetfigure[##1][##2]% + {\getvalue{\e!start\v!figure\e!text}[\v!left,\v!none][] + {} + {\hbox + {\externalfigure[##1][\c!frame=\v!on,\c!width=6cm,\c!size=\@@exsize][##2]% + \tfskip + \framed[\c!width=\figurewidth,\c!height=\figureheight]{}}}% + {\tt\tfa\expanded{\asciistr{##1}}}% + \blank + \tfx + \def\docommand####1% + {\beforesplitstring####1\at=\to\asciia + \aftersplitstring ####1\at=\to\asciib + \defconvertedcommand\asciib\asciib + \doifsomething\asciib + {\hsmash{\hbox to .75em{\asciia\hss}: \asciib}\endgraf}}% + \processcommalist[##2]\docommand + \strut + \endgraf + \getvalue{\e!stop\v!figure\e!text}}% + \pushendofline + \readjobfile\@@exfile\donothing\donothing + \popendofline + \egroup} + +\def\showexternalfigureb % instelbaar maken + {\bgroup + \def\total{5}% + \globalletempty\allfigures + \doglobal\newcounter\figurecounter + \dontcomplain + \def\docommand##1{##1&}% + \def\figurecaptions% + {\crcr + \noalign{\nobreak\vskip.5em}% + \@EA\globalprocesscommalist\@EA[\allfigures]\docommand + \globalletempty\allfigures + \crcr + \noalign{\vskip1em\goodbreak}}% + \def\presetfigure[##1][##2]% + {\vbox + {\divide\hsize \total + \advance\hsize -1em + \externalfigure + [##1] + [\c!frame=\v!on,\c!factor=\v!max,\c!width=\hsize,\c!size=\@@exsize][##2]}% + \doglobal\addtocommalist{##1}\allfigures + %\getvalue{\s!figurepreset}% + \doglobal\increment\figurecounter + \ifnum\figurecounter=\total + \doglobal\newcounter\figurecounter + \def\next{\figurecaptions}% + \else + \def\next{&}% + \fi + \next}% + \pushendofline + \tabskip\zeropoint \!!plus 1fill + \halign to \hsize + {&\hss##\hss\cr\readjobfile\@@exfile\donothing\donothing\crcr + \figurecaptions} + \popendofline + \egroup} + +\def\showexternalfigurec + {\bgroup + \def\presetfigure[##1][##2]{\expanded{\pagefigure[##1][\c!size=\@@exsize]}}% else loop + \pushendofline + \readjobfile\@@exfile\donothing\donothing + \popendofline + \egroup} + +\def\showexternalfigured % to be documented; this one builds a dimension file for + {\bgroup % metapost/metafun + \immediate\openout\scratchwrite=mpfigs.mp + \def\presetfigure[##1][##2]% + {\getfiguredimensionsonly[##1]% \pagefigure[##1]% + \immediate\write\scratchwrite + {registerfigure("##1",\figurewidth,\figureheight);}} + \pushendofline + \readjobfile\@@exfile\donothing\donothing + \popendofline + \immediate\closeout\scratchwrite + \egroup} diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-res-50.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-res-50.mkii new file mode 100644 index 00000000000..3c3e758a7d2 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-res-50.mkii @@ -0,0 +1,427 @@ +%D \module +%D [ file=x-res-50, +%D version=2004.02.18, +%D title=\CONTEXT\ Style File, +%D subtitle=Multimedia Presentation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is a preliminary module, using a preliminary xml media format that +%D looks as follows (record is embedded in resource library element): +%D +%D \starttyping +%D <rl:mediaclip label="sample 1"> +%D <rl:name>Sample One</rl:name> +%D <rl:mime>application/x-shockwave-flash</rl:mime> +%D <rl:file>http://localhost/mb.swf</rl:file> +%D <rl:width>8cm</rl:width> +%D <rl:height>6cm</rl:height> +%D <rl:text>Nothing special to be said.</rl:text> +%D <rl:picture>cow.pdf</rl:picture> +%D </rl:mediaclip> +%D +%D <rl:mediaclip label="sample 2"> +%D <rl:name>Sample Two</rl:name> +%D <rl:mime>audio/mpeg</rl:mime> +%D <rl:file>mb.mp3</rl:file> +%D <rl:picture>mb.jpg</rl:picture> +%D </rl:mediaclip> +%D \stoptyping +%D +%D \starttyping +%D texexec --pdf --use=med-show yourfile.xml +%D \stoptyping +%D +%D Bonus: +%D +%D \starttyping +%D --arg="url=http://localhost:8881/e:/media" +%D \stoptyping + +% output=pdftex + +% \nopdfcompression + +% bugs in recognizing embedded stream cq. player +% bugs in layers + hide/vide +% bugs in save javascripts +% bugs all over the place + +% in principe kan menu overal hetzelfde zijn als we via JS per pagina de clip var zetten, +% hoewel, misschien zal het menu gaan afhangen van de soort clip + +% property (eigenschap) aan framed en layer + +\usemodule[meta-dum] \usemodule[contml] \autoXMLnamespace [context] + +\doifelsevariable{environment}{url} + {\setvariables[mediaclip][url=\getvariable{environment}{url}/]} + {\setvariables[mediaclip][url=]} + +\startmode [silent] + + \setvariables[mediaclip:option][start=] + +\stopmode + +\startnotmode [silent] + + \setvariables[mediaclip:option][start=auto] + +\stopnotmode + +\chardef\XMLtokensreduction=1 \dontcomplain % \showframe \pdfcompresslevel=0 + +\setuppapersize + [S6][S6] + +\definemeasure [GapSize] [\dimexpr( 15pt)] +\definemeasure [EdgeWidth] [\dimexpr(100pt)] +\definemeasure [TextWidth] [\dimexpr(.5\textwidth)] +\definemeasure [RenderingWidth] [\dimexpr(\textwidth)] +\definemeasure [RenderingHeight] [\dimexpr(\textheight)] + +% \XMLflush{rl:ratio}\dimexpr(.75\textwidth), + +\setuplayout + [backspace=\measure{GapSize}, + topspace=\measure{GapSize}, + header=0pt, + footer=0pt, + margin=0pt, + edgedistance=2\measure{GapSize}, + rightedge=\measure{EdgeWidth}, + bottomdistance=2\measure{GapSize}, + bottom=2\measure{GapSize}, + height=fit, + width=fit] + +\setupinteraction + [state=start, + color=lightgray, + contrastcolor=lightgray, + openaction=PresetFields, + closeaction=ForgetChanges, + menu=on, + click=no] + +\setupinteractionscreen + [option=max] + +\setupcolors + [state=start] + +\usetypescript + [palatino][texnansi] + +\setupbodyfont + [palatino] + +\definecolor[darkgray] [s=.2] +\definecolor[mediumgray][s=.5] +\definecolor[lightgray] [s=.8] +\definecolor[transgray] [s=1,t=.9,a=1] + +\setupbackgrounds + [page] + [backgroundoffset=\measure{GapSize}, + background={color,pagebutton}, + backgroundcolor=black] + +\definelayer + [main] + [width=\textwidth, + height=\textheight] + +\definelayer + [extra] + [width=\rightedgewidth, + height=\bottomheight] + +\setupbackgrounds + [text] + [backgroundoffset=0pt, + background=main] + +\setupbackgrounds + [bottom][rightedge] + [backgroundoffset=0pt, + background=extra] + +% java scripts + +\startJSpreamble {handy} used now + + function ForgetChanges () + { this.dirty = false } + + function PresetFields () + { this.syncAnnotScan() } + +\stopJSpreamble + +\definereference[PresetFields] [JS(PresetFields)] +\definereference[ForgetChanges][JS(ForgetChanges)] + +% layers + +\defineproperty [menulayer] [layer] [title=menulayer] +\defineproperty [textlayer] [layer] [title=textlayer,state=stop] +\defineproperty [datalayer] [layer] [title=datalayer,state=stop] + +\setupfield + [rollbutton] + [fieldlayer=menulayer] + +\setupfield + [rollbutton] + [option=auto] + +\definepalet + [rollover] + [n=darkgray, + r=lightgray, + d=darkgray] + +% list + +\definelist + [clips] + [expansion=yes, + criterium=text, + alternative=f] + +% navigation + +\defineoverlay[pagebutton][\overlaybutton{HideLayer{textlayer},HideLayer{datalayer},ToggleLayer{menulayer}}] +\defineoverlay[textbutton][\overlaybutton{HideLayer{textlayer},HideLayer{datalayer}}] +\defineoverlay[databutton][\overlaybutton{HideLayer{textlayer},HideLayer{datalayer}}] + +% clips + +\defineXMLenvironment + [rl:mediaclip] + {\setups[mediaclip:start]} + {\setups[mediaclip:stop]} + +\newcounter\MediaClip + +\startsetups[mediaclip:start] + + \bgroup \startXMLignore + + % no \startstandardmakeup here since we need the dsta in the menuconstruction + + \defineXMLsave [rl:name] + \defineXMLsave [rl:visualization] + \defineXMLsave [rl:file] + \defineXMLsave [rl:mime] + \defineXMLsave [rl:picture] [backgroundcolor=lightgray] + + \defineXMLsavecontent [rl:text] {No additional info.} + \defineXMLsavecontent [rl:width] {\measure{RenderingWidth}} + \defineXMLsavecontent [rl:height] {\measure{RenderingHeight}} + \defineXMLsavecontent [rl:aspect] {1} + +\stopsetups + +\startsetups[mediaclip:stop] + + \startstandardmakeup + + \doifXMLdataelse{rl:file} + {\setups[mediaclip:file:yes]} + {} + + \doifXMLdataelse{rl:picture} + {\doifelse{\XMLflush{rl:picture}}{self} + {\setups[mediaclip:picture:self]} + {\setups[mediaclip:picture:yes]}} + {\setups[mediaclip:picture:no]} + + \doifXMLdata{rl:text} + {\setups[mediaclip:text]} + + \setlayerframed + [extra] + [preset=rightbottom] + [frame=off,offset=overlay,width=fit,background=databutton,align=left] + {\startproperty[datalayer]\setups[mediaclip:data]\stopproperty} + + \doifXMLdataelse{rl:name} + {\writetolist[clips]{}{\XMLflush{rl:name}}} + {\writetolist[clips]{}{\XMLpar{rl:mediaclip}{label}{unknown}}} + + \stopstandardmakeup + + \stopXMLignore \egroup + +\stopsetups + +\setuptabulate + [before=, + after=] + +\def\rlCleanupFileName#1% + {\bgroup + \def\cleanup##1##2{\ifnum##1##2=20 \space\else\char\octnumber{##1##2}\fi}% + \defineactivecharacter 37 {\cleanup}% + \scantokens{#1}% + \egroup} + +\startsetups[mediaclip:data] + + \noindent \buttonframed + [framecolor=lightgray, + foregroundcolor=lightgray] + {\bf\expanded{\rlCleanupFileName{\XMLflush{rl:file}}}} + + \vskip.75\measure{GapSize} + + \noindent \buttonframed + [framecolor=lightgray, + foregroundcolor=lightgray] + {\bf\XMLflush{rl:mime}} + +\stopsetups + +\startsetups[mediaclip:picture:self] + + \definerenderingwindow + [mediaclip] + [width=\XMLflush{rl:width}, + height=\XMLflush{rl:height}, + frame=off, + openpageaction=StartCurrentRendering, + closepageaction=StopCurrentRendering] + + \setlayer + [main] + {\placerenderingwindow[mediaclip][mediaclip-\MediaClip]} + +\stopsetups + +\startsetups[mediaclip:picture:yes] + + \setlayer + [main] + {\externalfigure + [\XMLflush{rl:picture}] + [background=color, + backgroundcolor=\XMLpar{rl:picture}{backgroundcolor}{lightgray}, + factor=max, + width=\XMLflush{rl:width}, + height=\XMLflush{rl:height}]} + +\stopsetups + +\startsetups[mediaclip:picture:no] + + \setlayer + [main] + {\externalfigure + [dummy] + [width=\XMLflush{rl:width}, + height=\XMLflush{rl:height}]} + +\stopsetups + +\startsetups[mediaclip:file:yes] + + \doglobal\increment\MediaClip + + \useexternalrendering + [mediaclip-\MediaClip] + [\XMLflush{rl:mime}] + [\getvariable{mediaclip}{url}\XMLflush{rl:file}] + [\getvariable{mediaclip:option}{start}] + +\stopsetups + +\defineinteractionmenu + [navigation] [right] + +\defineinteractionmenu + [control] [bottom] + +\setupinteractionmenu + [navigation,control] + [state=start, + frame=on, + middle=\hskip.5\measure{GapSize}, + inbetween=\vskip.5\measure{GapSize}] + +\setupinteractionmenu + [right,bottom] + [distance=overlay] + +\startinteractionmenu [navigation] + \rob [HideLayer{textlayer},FirstPage] First Page \\ + \rob [HideLayer{textlayer},PreviousPage] Previous Page \\ + \rob [HideLayer{textlayer},NextPage] Next Page \\ + \rob [HideLayer{textlayer},LastPage] Last Page \\ + \rob [HideLayer{textlayer},clips] List Of Clips \\ + \rob [ForgetChanges,CloseDocument] Close Document \\ +\stopinteractionmenu + +\startinteractionmenu [control] + \rob [StartRendering{mediaclip-\MediaClip}] Start \\ + \rob [StopRendering{mediaclip-\MediaClip}] Stop \\ + \rob [PauseRendering{mediaclip-\MediaClip}] Pause \\ + \rob [ResumeRendering{mediaclip-\MediaClip}] Resume \\ + \rob [ToggleLayer{datalayer}] Info \\ + \doifXMLdata{rl:text}{\rob [HideLayer{datalayer},ToggleLayer{textlayer}] Text \\} +\stopinteractionmenu + +\startsetups[mediaclip:text] + + \setlayer + [extra] + [preset=rightbottom] + {\startproperty[textlayer] + \framed + [align=normal, + frame=off, + width=\measure{TextWidth}, + foregroundcolor=darkgray, + background={color,textbutton}, + backgroundcolor=lightgray] + {\XMLflush{rl:text}} + \stopproperty} + +\stopsetups + +\setupcolors[textcolor=lightgray] + +\startsetups [library:start] + + \starttext + + \setupinteractionmenu[control][state=stop] + + \title[clips]{List of Media Clips} + + \placelist[clips] \page + + \setupinteractionmenu[control][state=start] + +\stopsetups + +\startsetups [library:stop] + + \stoptext + +\stopsetups + +\defineXMLenvironment [rl:resourcelibrary] + {\setups[library:start]} + {\setups[library:stop]} + +\doifelsenothing{\inputfilename} + {\processXMLfile{mediaclient.xml}} + {\processXMLfile{\inputfilename}} diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-sch-00.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-sch-00.mkii new file mode 100644 index 00000000000..5b4da0825b3 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-sch-00.mkii @@ -0,0 +1,382 @@ +%D \module +%D [ file=x-sch-00, +%D version=2001.10.02, +%D title=\CONTEXT\ Style File, +%D subtitle=XML Schema Basics, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Schema support was implemented right after euro\TeX\ 2001, +%D when Tobias Burnus send me a schema for the XML figure +%D base. Since it happened that I needed schemata for other +%D projects too, I wrote this mapper. Thanks to Tobias for +%D testing it. + +\newcounter\XSDprefix +\newif\ifXDScomposite + +\definelist [xsd:names] +\defineregister [xsd:index] [xsd:indices] + +\setuplist [xsd:names] [expansion=yes] +\setupregister [xsd:index] [expansion=yes] + +\def\dodoXSDkeyval#1#2#3% + {\framed + [width=\hsize,background=color,backgroundcolor=xsd:0, + framecolor=xsd:0,frame=off,align=right] + {\hbox to 5em % %to 8em % .2\hsize + {\bf + %\doifsomething{#1}{#1 } + \ignorespaces#2\unskip\hss} + %\ignorespaces#2\unskip:}% + \space + \ignorespaces#3\unskip}} + +\def\doXSDkeyval#1#2#3#4% + {\bgroup + \edef\XSDtemp{\XMLpar{#3}{#4}{}}% + \doifsomething{\XSDtemp} + {\def\doXSDtemp{\dodoXSDkeyval{#1}{#2}{\XSDtemp}}% + \def\doXSDtype{\dodoXSDkeyval{#1}{#2}{\XMLtyp{#3}{#4}{}}}% + \setupinteraction[color=,contrastcolor=,style=]% + \processaction + [#4] + [ value=>\doXSDtype, + name=>{\writetolist[xsd:names]{}{\XSDtemp}% + \writetoregister[xsd:index]{\XSDtemp}% + \ifXDScomposite \else + \pagereference[xsd:\XSDprefix:\XSDtemp]% + \fi + \doXSDtemp}, + type=>{\doifinstringelse{xsd:}{\XSDtemp} + {\doXSDtemp} + {\gotobox{\doXSDtemp}[xsd:\XSDprefix:\XSDtemp]}}, + ref=>{\doifinstringelse{xsd:}{\XSDtemp} + {\doXSDtemp} + {\gotobox{\doXSDtemp}[xsd:\XSDprefix:\XSDtemp]}}, + unknown=>\doXSDtemp]}% + \endgraf + \egroup} + +\def\doXSDkeyvals#1#2#3% + {\def\docommand##1{\doXSDkeyval{#1}{##1}{#2}{##1}}% + \processcommalist[#3]\docommand} + +\def\dodoXSDbanner#1% + {\framed + [width=\hsize,framecolor=xsd:0,frame=off, + background=color,backgroundcolor=xsd:0] + {\ignorespaces#1\unskip}} + +\def\doXSDtitle#1#2#3% + {\edef\XSDtemp{\XMLpar{#2}{#3}{}}% + \dodoXSDbanner + {{\bf\ignorespaces#1\unskip}% + \doifsomething{\XSDtemp} + {:\space\ignorespaces\XSDtemp\unskip + \pagereference[xsd:\XSDprefix:\XSDtemp]}}} + +\def\doXSDbanner#1% + {\dodoXSDbanner{\bf#1}} + +%D We use colored backgrounds for meaningful blocks. + +\definecolor [xsd:0] [white] + +\definecolor [xsd:1] [s=.30] +\definecolor [xsd:2] [s=.55] +\definecolor [xsd:3] [s=.70] +\definecolor [xsd:4] [s=.85] + +\definecolor [xsd:5] [r=.6,g=.7,b=.8] +\definecolor [xsd:6] [r=.7,g=.8,b=.6] +\definecolor [xsd:7] [r=1,g=1,b=.6] +\definecolor [xsd:8] [r=.8,g=.7,b=.6] + +\defineframedtext [XSDannotation] [backgroundcolor=xsd:0] + +\defineframedtext [XSDelement] [backgroundcolor=xsd:5] +\defineframedtext [XSDattribute] [backgroundcolor=xsd:6] +\defineframedtext [XSDsimpleType] [backgroundcolor=xsd:7] +\defineframedtext [XSDcomplexType] [backgroundcolor=xsd:8] + +\defineframedtext [XSDcomplexContent] [backgroundcolor=xsd:1] +\defineframedtext [XSDsimpleContent] [backgroundcolor=xsd:1] +\defineframedtext [XSDattributeGroup] [backgroundcolor=xsd:1] + +\defineframedtext [XSDcapsule] [backgroundcolor=xsd:2] +\defineframedtext [XSDsequence] [backgroundcolor=xsd:3] + +\def\XDSstructures% handy for external settings + {XSDannotation, + XSDcomplexType,XSDsimpleType,XSDelement,XSDattribute, + XSDcomplexContent,XSDsimpleContent,XSDattributeGroup, + XSDcapsule,XSDsequence} + +\setupframedtexts + [\XDSstructures] + [width=\hsize, + offset=.5\bodyfontsize, + location=none, + background=color, + framecolor=xsd:0, + before=\ifinframed\else\blank\fi, + after=\ifinframed\else\blank\fi, + depthcorrection=off, + rulethickness=1pt, + strut=no] + +\definesymbol[xsd][{\blackrule[width=4em]}] + +\def\placeXSDlegenda + {\startbaselinecorrection + \starttabulate[|l|l|] + \HL + \NC \bf color \NC \bf meaning \NC \NR + \HL + \NC \color[xsd:1]{\symbol[xsd]} \NC complexContent \unskip\quad + simpleContent \unskip\quad + attributeGroup \NC \NR + \NC \color[xsd:2]{\symbol[xsd]} \NC capsule \NC \NR + \NC \color[xsd:3]{\symbol[xsd]} \NC sequence \NC \NR + \HL + \NC \color[xsd:5]{\symbol[xsd]} \NC element \NC \NR + \NC \color[xsd:6]{\symbol[xsd]} \NC attribute \NC \NR + \NC \color[xsd:7]{\symbol[xsd]} \NC simpleType \NC \NR + \NC \color[xsd:8]{\symbol[xsd]} \NC complexType \NC \NR + \HL + \stoptabulate + \stopbaselinecorrection} + +\defineXMLenvironment [xsd:all] [id=] + {\startXSDcapsule + \doXSDbanner{all} + \doXSDkeyvals{all}{xsd:all}{id} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:annotation] + {\startXSDcapsule + \doXSDbanner{annotation} + \startXSDannotation} + {\stopXSDannotation + \stopXSDcapsule} + +\defineXMLignore [xsd:appInfo] + +\defineXMLenvironment [xsd:attribute] + [id=,name=,ref=,type=,form=,use=,value=] + {\startXSDattribute + \doifelsenothing{\XMLpar{xsd:attribute}{ref}{}} + {\doXSDkeyvals{attribute}{xsd:attribute}{name,type}} + {\doXSDkeyvals{attribute}{xsd:attribute}{ref}} + \doXSDkeyvals{attribute}{xsd:attribute}{id,form,use,value} + \XDScompositetrue} + {\stopXSDattribute} + +\defineXMLenvironment [xsd:attributeGroup] [id=,name=,ref=] + {\startXSDattributeGroup + \doXSDtitle{attribute group}{xsd:attributeGroup}{name} + \doXSDkeyvals{attr group}{xsd:attributeGroup}{id,name,ref} + \XDScompositetrue} + {\stopXSDattributeGroup} + +\defineXMLenvironment [xsd:choice] [id=,minOccurs=,maxOccurs=] + {\startXSDcapsule + \doXSDbanner{choice} + \doXSDkeyvals{choice}{xsd:choice}{id,minOccurs,maxOccurs} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:complexContent] [id=,mixed=] + {\startXSDcomplexContent + \doXSDkeyvals{complex content}{xsd:complexContent}{id,mixed} + \XDScompositetrue} + {\stopXSDcomplexContent} + +\defineXMLenvironment [xsd:complexType] + [id=,abstract=,block=,final=,mixed=,name=] + {\startXSDcomplexType + \doXSDtitle{complex type}{xsd:complexType}{name} + \doXSDkeyvals{complex type}{xsd:complexType}{id,abstract,block,final,mixed} + \XDScompositetrue} + {\stopXSDcomplexType} + +\defineXMLenvironment [xsd:documentation] [source=,xml:lang=] + {\endgraf\bgroup\setupwhitespace[big]} + {\endgraf\egroup} + +\defineXMLenvironment [xsd:element] + [name=,type=,ref=, + abstract=,block=,default=,final=,fixed=,form=,id=, + minOccurs=,maxOccurs=,nullable=,substitutionGroup=] + {\startXSDelement + \doifelsenothing{\XMLpar{xsd:element}{ref}{}} + {\doXSDkeyvals{element}{xsd:element}{name,type}} + {\doXSDkeyvals{element}{xsd:element}{ref}} + \doXSDkeyvals{element}{xsd:element} + {id,abstract,block,default,final,fixed,form, + minOccurs,maxOccurs,nullable,substitutionGroup} + \XDScompositetrue} + {\stopXSDelement} + +\defineXMLenvironment [xsd:extension] [id=,base=] + {\startXSDcapsule + \doXSDbanner{extension} + \doXSDkeyvals{extension}{xsd:extension}{id,base} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:group] + [id=,name=,ref=,minOccurs=,maxOccurs=] + {\startXSDcapsule + \doXSDbanner{group} + \doXSDkeyvals{group}{xsd:group}{id,name,ref,minOccurs,maxOccurs} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:key] [id=,name=] + {\startXSDcapsule + \doXSDbanner{key} + \doXSDkeyvals{key}{xsd:key}{id,name} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:keyref] [id=,name=,refer=] + {\startXSDcapsule + \doXSDbanner{keyref} + \doXSDkeyvals{key ref}{xsd:keyref}{id,name,refer} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:list] [id=,itemType=] + {\startXSDcapsule + \doXSDbanner{list} + \doXSDkeyvals{list}{xsd:list}{id,itemType} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:redefine] [schemaLocation=] + {\startXSDcapsule + \doXSDbanner{redefine} + \doXSDkeyvals{redefine}{xsd:redefine}{schemaLocation} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:restriction] [id=,base=] + {\startXSDcapsule + \doXSDbanner{restriction} + \doXSDkeyvals{restriction}{xsd:restriction}{id,base} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:schema] + [attributeFormDefault=,blockDefault=,elementFormDefault=, + finalDefault=,id=,targetNamespace=,version=] + {\startXSDcapsule + \doglobal\increment\XSDprefix + \doXSDbanner{schema} + \doXSDkeyvals{schema}{xsd:schema} + {attributeFormDefault,blockDefault,elementFormDefault, + finalDefault,id,targetNamespace,version} + \stopXSDcapsule} + {} + +\defineXMLenvironment [xsd:sequence] [id=,minOccurs=,maxOccurs=] + {\startXSDsequence + \doXSDbanner{sequence} + \doXSDkeyvals{sequence}{xsd:sequence}{id,minOccurs,maxOccurs} + \XDScompositetrue} + {\stopXSDsequence} + +\defineXMLenvironment [xsd:simpleContent] [id=] + {\startXSDsimpleContent + \doXSDkeyvals{simple content}{xsd:simpleContent}{id} + \XDScompositetrue} + {\stopXSDsimpleContent} + +\defineXMLenvironment [xsd:simpleType] [id=,name=] + {\startXSDsimpleType + \doXSDtitle{simple type}{xsd:simpleType}{name} + \doXSDkeyvals{simple type}{xsd:simpleType}{id} + \XDScompositetrue} + {\stopXSDsimpleType} + +\defineXMLenvironment [xsd:union] [id=,memberTypes=] + {\startXSDcapsule + \doXSDbanner{union} + \doXSDkeyvals{union}{xsd:union}{id,memberTypes} + \XDScompositetrue} + {\stopXSDcapsule} + +\defineXMLenvironment [xsd:unique] [id=,name=] + {\startXSDcapsule + \doXSDbanner{unique} + \doXSDkeyvals{unique}{xsd:unique}{id,name} + \XDScompositetrue} + {\stopXSDcapsule} + +\def\defineXSDfacet + {\dotripleempty\dodefineXSDfacet} + +\def\dodefineXSDfacet[#1][#2][#3]% + {\defineXMLenvironment[xsd:#1][#2] + {\startXSDcapsule + \doXSDkeyvals{#1}{xsd:#1}{#3} + \XDScompositetrue} + {\stopXSDcapsule} + \defineXMLsingular[xsd:#1][#2] + {\doXSDkeyvals{#1}{xsd:#1}{#3}}} + +\defineXSDfacet [duration] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [encoding] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [enumeration] [id=,value=,fixed=] [id,value,fixed] + +\defineXSDfacet [length] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [minLength] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [maxLength] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [minInclusive] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [maxInclusive] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [minExclusive] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [maxExclusive] [id=,value=,fixed=] [id,value,fixed] + +\defineXSDfacet [pattern] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [period] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [precision] [id=,value=,fixed=] [id,value,fixed] +\defineXSDfacet [scale] [id=,value=,fixed=] [id,value,fixed] + +\defineXSDfacet [field] [id=,xpath=] [id,xpath] +\defineXSDfacet [selector] [id=,xpath=] [id,xpath] + +\defineXSDfacet + [any] + [id=,namespace=,minOccurs=,maxOccurs=,processContents=] + [id,namespace,minOccurs,maxOccurs,processContent] + +\defineXSDfacet + [anyAttribute] + [id=,namespace=,processContents=] + [id,namespace,processContents] + +\defineXSDfacet + [import] + [id=,namespace=,schemaLocation=] + [id,namespace,schemaLocation] + +\defineXSDfacet + [include] + [id=,schemaLocation=] + [id,schemaLocation] + +\defineXSDfacet + [notation] + [id=,name=,public=,system=] + [id,name,public,system] + +\endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-sch-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-sch-01.mkii new file mode 100644 index 00000000000..5bdf088fe71 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-sch-01.mkii @@ -0,0 +1,122 @@ +%D \module +%D [ file=x-sch-01, +%D version=2001.10.04, +%D title=\CONTEXT\ Style File, +%D subtitle=XML Schema Presentation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This style wraps around the core schema visualizer, +%D implemented in \type {x-sch-00}. This is an experimental +%D style, more will follow. +%D +%D \starttyping +%D texexec --use=sch-01 x-fig-00.xsd --pdf +%D \stoptyping + +\doifnothing {\jobfilename} {\end} +\doiffileelse {\jobfilename.xsd} {} {\end} + +\usemodule[sch-00,con-01] + +\remapXMLnamespace [xs] [xsd] + +\setuplayout + [backspace=1.5cm, + topspace=1.5cm, + bottomspace=1cm, + width=middle, + height=middle, + header=1.5cm, + footer=1.5cm] + +\setupcolors + [state=start] + +\setupbackgrounds + [page] + [background=goback] + +\setupbackgrounds + [text] + [background=gonext] + +\defineoverlay + [goback] + [\overlaybutton{PreviousJump}] + +\defineoverlay + [gonext] + [\overlaybutton{nextpage}] + +\setuppagenumbering + [location=footer] + +\usetypescript + [palatino] + [\defaultencoding] + +\setupbodyfont + [palatino,10pt] + +%\setupinteraction +% [state=start, +% color=, +% contrastcolor=, +% style=] + +\setuplist + [xsd:names] + [interaction=all, + width=0pt, + alternative=c] + +\setupregister + [xsd:index] + [interaction=text, + symbol=none] + +\setuphead + [chapter] + [style=\bfd, + header=high] + +\setuphead + [section] + [style=\bfb] + +\lowercasestring \jobfilename \to \lcjobfilename + +\setupheadertexts + [\lcjobfilename] + +\starttext + +\title{Schema \quote{\lcjobfilename.xsd}} + +\subject{Names in order of definition} + +\startcolumns[n=3] + \placelist[xsd:names][criterium=current] +\stopcolumns + +\subject{Names in alphabetic order} + +\startcolumns[n=3] + \placeregister[xsd:index][criterium=current] +\stopcolumns + +\subject{Meaning of background colors} + +\placeXSDlegenda + +\subject{Schema components} + +\processXMLfilegrouped{\jobfilename.xsd} + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-set-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-set-01.mkii new file mode 100644 index 00000000000..814ea5fc6c5 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-set-01.mkii @@ -0,0 +1,79 @@ +%D \module +%D [ file=x-set-01, +%D version=2004.10.31, +%D remark=setupx.tex: 1998.07.20 and later, +%D title=\CONTEXT\ Setup Mappings, +%D subtitle=Macro Definitions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This file is obsolete. + +\endinput + +\unprotect + +\def\SETUPnamespace{xmlns:cd="http://www.pragma-ade.com/commands"} + +\bgroup \catcode`\<=\@@other + +\unexpanded\gdef\dostring#1#2#3% + {\immediate\write\scratchwrite{#1<#2cd:#3>}} + +\gdef\doline#1% + {\immediate\write\scratchwrite{#1}} + +\egroup + +\def\startsetupfile + {\immediate\openout\scratchwrite=keys-\currentlanguage.xml + \doline{\string<?xml version="1.0"?>} + \doline{} + \dostring{}{}{interface \SETUPnamespace\space name="context" language="\currentlanguage" version="\contextversion"}} + +\def\stopsetupfile + {\doline{} + \dostring{}{/}{interface} + \immediate\closeout\scratchwrite} + +\def\interfacecomponenttoxml#1#2#3% + {\doifelse{#3}\nointerfaceobject + {\dostring{\space\space\space\space}{}{#1 name="#2" value="#2"/}} + {\dostring{\space\space\space\space}{}{#1 name="#2" value="#3"/}}} + +\def\setinterfaceconstant{\interfacecomponenttoxml{constant}} +\def\setinterfacevariable{\interfacecomponenttoxml{variable}} +\def\setinterfaceelement {\interfacecomponenttoxml{element}} +\def\setinterfacecommand {\interfacecomponenttoxml{command}} + +\def\startinterfacexmlcomponent{\doline{}\dostring{\space\space}{}} % #1 +\def\stopinterfacexmlcomponent {\dostring{\space\space}{/}} % #1 + +\let\normalstartvariables\startvariables \let\normalstopvariables\stopvariables +\let\normalstartconstants\startconstants \let\normalstopconstants\stopconstants +\let\normalstartcommands \startcommands \let\normalstopcommands \stopcommands +\let\normalstartelements \startelements \let\normalstopelements \stopelements + +\def\startvariables{\startinterfacexmlcomponent{variables}\normalstartvariables} +\def\startconstants{\startinterfacexmlcomponent{constants}\normalstartconstants} +\def\startcommands {\startinterfacexmlcomponent{commands} \normalstartcommands } +\def\startelements {\startinterfacexmlcomponent{elements} \normalstartelements } + +\def\stopvariables{\stopinterfacexmlcomponent{variables}\normalstopvariables} +\def\stopconstants{\stopinterfacexmlcomponent{constants}\normalstopconstants} +\def\stopcommands {\stopinterfacexmlcomponent{commands} \normalstopcommands } +\def\stopelements {\stopinterfacexmlcomponent{elements} \normalstopelements } + +\protect + +\starttext + \startsetupfile + \input mult-con.tex + \input mult-com.tex + \stopsetupfile +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-set-02.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-set-02.mkii new file mode 100644 index 00000000000..7a2cd77016b --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-set-02.mkii @@ -0,0 +1,30 @@ +%D \module +%D [ file=x-set-02, +%D version=2004.10.31, +%D remark=setupx.tex: 1998.07.20 and later, +%D title=\CONTEXT\ Setup Mappings, +%D subtitle=Macro Definitions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect \bgroup \catcode`\<=\@@other + +\def\setinterfacecomponent#1#2#3% + {\setgvalue{\string<#1\string:#2\string>}{#3}} + +\gdef\getinterfacecomponent#1#2% + {\executeifdefined{\string<#1\string:#2\string>}{#2}} + +\def\setinterfaceconstant{\setinterfacecomponent{constant}} % constant +\def\setinterfacevariable{\setinterfacecomponent{variable}} % variable +\def\setinterfaceelement {\setinterfacecomponent{string}} % element +\def\setinterfacecommand {\setinterfacecomponent{string}} % command + +\input mult-\userinterfacetag.mkii + +\egroup \protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-set-11.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-set-11.mkii new file mode 100644 index 00000000000..8c8f614a5b4 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-set-11.mkii @@ -0,0 +1,837 @@ +%D \module +%D [ file=x-set-11, +%D version=2004.10.31, +%D remark=setupx.tex: 1998.07.20 and later, +%D title=\CONTEXT\ Setup Definitions, +%D subtitle=Macro Definitions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% module x-set-02 loads the mapping, after that we can say: +% +% texmfstart texexec --int=nl --pdf --global --result=setup-nl x-set-12 + +\startmessages dutch library: setup + title: setup + formula: formule + number: getal + list: lijst + dimension: maat + mark: markering + reference: verwijzing + command: commando + file: file + name: naam + identifier: naam + text: tekst + section: sectie + singular: naam enkelvoud + plural: naam meervoud + matrix: n*m + see: zie + inherits: erft van + 1: de karakters < en > zijn globaal actief! + 2: -- wordt verwerkt + 3: -- is niet gedefinieerd + 4: -- wordt nogmaals verwerkt + optional: optioneel + displaymath: formule + index: ingang + math: formule + nothing: leeg + file: file + position: positie + reference: verwijzing + csname: naam + destination: bestemming + triplet: triplet + word: woord + content: tekst +\stopmessages + +\startmessages english library: setup + title: setup + formula: formula + number: number + list: list + dimension: dimension + mark: mark + reference: reference + command: command + file: file + name: name + identifier: identifier + text: text + section: section + singular: singular name + plural: plural name + matrix: n*m + see: see + inherits: inherits from + 1: the characters < and > are globally active! + 2: -- is processed + 3: -- is undefined + 4: -- is processed again + optional: optional + displaymath: formula + index: entry + math: formula + nothing: empty + file: file + position: position + reference: reference + csname: name + destination: destination + triplet: triplet + word: word + content: text +\stopmessages + +\startmessages german library: setup + title: Setup + formula: Formel + number: Nummer + list: Liste + dimension: Dimension + mark: Beschriftung + reference: Referenz + command: Befehl + file: Datei + name: Name + identifier: Name + text: Text + section: Abschnitt + singular: singular + plural: plural + matrix: n*m + see: siehe + inherits: inherits from + 1: Die Zeichen < und > gelten global! + 2: -- wird verarbeitet + 3: -- ist undefiniert + 4: -- ist mehrmals verarbeitet + optional: optioneel + displaymath: formula + index: entry + math: formula + nothing: empty + file: file + position: position + reference: reference + csname: name + destination: destination + triplet: triplet + word: word + content: text +\stopmessages + +\startmessages czech library: setup + title: setup + formula: rovnice + number: cislo + list: seznam + dimension: dimenze + mark: znacka + reference: reference + command: prikaz + file: soubor + name: jmeno + identifier: jmeno + text: text + section: sekce + singular: jmeno v singularu + plural: jmeno v pluralu + matrix: n*m + see: viz + inherits: inherits from + 1: znaky < a > jsou globalne aktivni! + 2: -- je zpracovano + 3: -- je nedefinovano + 4: -- je zpracovano znovu + optional: optioneel + displaymath: formula + index: entry + math: formula + nothing: empty + file: file + position: position + reference: reference + csname: name + destination: destination + triplet: triplet + word: word + content: text +\stopmessages + +\startmessages italian library: setup + title: setup + formula: formula + number: number + list: list + dimension: dimension + mark: mark + reference: reference + command: command + file: file + name: name + identifier: name + text: text + section: section + singular: singular name + plural: plural name + matrix: n*m + see: see + inherits: inherits from + 1: the characters < and > are globally active! + 2: -- is processed + 3: -- is undefined + 4: -- is processed again + optional: optioneel + displaymath: formula + index: entry + math: formula + nothing: empty + file: file + position: position + reference: reference + csname: name + destination: destination + triplet: triplet + word: word + content: text +\stopmessages + +\startmessages romanian library: setup + title: setari + formula: formula + number: numar + list: lista + dimension: dimensiune + mark: marcaj + reference: referinta + command: comanda + file: fisier + name: nume + identifier: nume + text: text + section: sectiune + singular: nume singular + plural: nume pluram + matrix: n*m + see: vezi + inherits: inherits from + 1: caracterele < si > sunt active global! + 2: este procesat -- + 3: -- este nedefinit + 4: -- este procesat din nou + optional: optioneel + displaymath: formula + index: entry + math: formula + nothing: empty + file: file + position: position + reference: reference + csname: name + destination: destination + triplet: triplet + word: word + content: text +\stopmessages + +\startmessages french library: setup + title: réglage + formula: formule + number: numéro + list: liste + dimension: dimension + mark: marquage + reference: reference + command: commande + file: fichier + name: nom + identifier: identificateur + text: texte + section: section + singular: nom singulier + plural: nom pluriel + matrix: n*m + see: vois + inherits: herite de + 1: les caractères < et > sont globalement actifs ! + 2: -- est traité + 3: -- n'est pas défini + 4: -- est traité de nouveau + optional: optionel + displaymath: formule + index: entrée + math: formule + nothing: vide + file: fichier + position: position + reference: réference + csname: nom + destination: destination + triplet: triplet + word: mot + content: texte +\stopmessages + +\unprotect + +% general + +\def\setupnumfont {} +\def\setuptxtfont {} +\def\setupintfont#1{\uppercase{#1}} +\def\setupvarfont {\sl} +\def\setupoptfont {\sl} +\def\setupalwcolor {} +\def\setupoptcolor {darkgray} + +\defineXMLenvironmentsave [cd:content] [list=,state=] + {\simpleSETUPargument{content}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\def\c!setup!internal!#1% + {{\setmessagetext{setup}{#1}% + \expanded{\setupintfont{\currentmessagetext}}}} + +\def\c!setup!text!#1% + {{\setmessagetext{setup}{#1}% + \setupvarfont{\currentmessagetext}}} + +\def\c!setup!command!#1% + {{\setupvarfont{\texescape...#1}}} + +\def\??stp{@@stp} + +\defineregister + [texmacro] + [texmacros] + +\definesorting + [texcommand] + [texcommands] + +\setupsorting + [texcommand] + [\c!command=\@@stpcommand, + \c!criterium=\@@stpcriterium] + +\definesorting + [eachtexcommand] + [alltexcommands] + +\setupsorting + [eachtexcommand] + [\c!command=\@@stpcommand, + \c!criterium=\v!all] + +\pushmacro\setuptext + +\defineframedtext + [setuptext] + [\c!width=\hsize, + \c!height=\v!fit, + \c!align=\v!right, + \c!offset=0.75em] + +\popmacro\setuptext + +\newif\ifshortsetup + +\def\doshowsetup + {\dosingleempty\dodoshowsetup} + +\def\dodoshowsetup[#1]% + {\iffirstargument + \doshowsetup{#1}% + \else + \expandafter\doshowsetup + \fi} + +\bgroup \catcode`\<=\active + +\gdef\doshowsetup#1% + {\bgroup + \def<<##1>>{##1}% + \edef\ascii{#1}% + \enableXML + \doifelseXMLelement{stp:\ascii} + {\expanded{\flushXMLelement{stp:\ascii}}} + {\doifelseXMLelement{stp:\ascii:1} + {\expanded{\flushXMLelement{stp:\ascii:1}}} + {\defconvertedargument\ascii{#1}% + \em unknown setup \quote{\ascii}}} + \egroup} + +\egroup + +\def\setup {\shortsetupfalse\doshowsetup} +\def\showsetup {\shortsetupfalse\doshowsetup} +\def\shortsetup{\shortsetuptrue \doshowsetup} +\def\setupsetup{\dodoubleargument\getparameters[\??stp]} + +\setupsetup + [\c!before=, + \c!after=, + \c!command=\setup, + \c!criterium=\v!used] + +% verwijzing: 0 geen verwijzingen plaatsen / wel genereren +% 1 alleen bij zie plaatsen / wel genereren +% 2 alle verwijzingen plaatsen / niet genereren +% 3 bij zie commando klikken / wel genereren + +\setupsetup + [\c!reference=0] + +\def\placesetup + {\bgroup + \getvalue{\e!place\e!listof texcommands}% + \egroup} + +\def\placeallsetups + {\bgroup + \setupsetup[\c!reference=2]% + \setupreferencing[\c!state=\v!stop]% + \getvalue{\e!place\e!listof alltexcommands}% + \egroup} + +\let\placeeverysetup\placeallsetups + +\let\plaatssetup \placesetup +\let\plaatselkesetup\placeallsetups + +% we use :1 as fallback +% +% \setup{setupinterlinespace} +% \setup{setupinterlinespace:1} +% \setup{setupinterlinespace:2} + +% todo: make this proper mkiv xml + +\defineXMLenvironmentsave [cd:define] [name=] + {} + {\setxvalue{cd:def:\XMLop{name}}{\XMLflush{cd:define}}} + +\defineXMLsingular [cd:resolve] [name=] + {\ignorespaces\getvalue{cd:def:\XMLop{name}}\ignorespaces} + +\defineXMLenvironment [cd:command] [name=,type=,generated=,interactive=,variant=] + {} + {\showSETUPrecord} + +\def\showSETUPrecord + {\getvalue{\e!start setuptext} + \tttf + \nohyphens + \veryraggedright + \startXMLmapping [one] + \doglobal\newcounter\currentSETUPargument + \global\let\maximumSETUPargument\currentSETUPargument + \bgroup + \doif{\XMLpar{cd:command}{generated}{}}{yes}{\ttsl}% + \doifelseXMLop{type}{environment} + {\tex{\e!start}}{\tex{}}\ignorespaces + \XMLflush{cd:sequence}\ignorespaces + \egroup + \doifelseXMLempty{cd:arguments} + {} + {\bgroup + \setbox0=\hbox{\XMLflush{cd:arguments}}% + \global\let\maximumSETUPargument\currentSETUPargument + \doglobal\newcounter\currentSETUPargument + \ignorespaces\XMLflush{cd:arguments}% + \doif{\XMLpar{cd:command}{type}{}}{environment} + {\hskip.5em\unknown\hskip.5em + \doif{\XMLpar{cd:command}{generated}{}}{yes}{\ttsl}% + \tex{\e!stop}\ignorespaces\XMLflush{cd:sequence}}% + \endgraf + \egroup + %\bgroup + % \tx + % \doif{\XMLpar{cd:command}{interactive}{}}{yes} {\quad INTERACTIVE}% + % \doif{\XMLpar{cd:command}{interactive}{}}{exclusive}{\quad INTERACTIVE ONLY}% + %\egroup + \startXMLmapping [two] + \bgroup + \doglobal\newcounter\currentSETUPargument + \blank[\v!line] + \switchtobodyfont[small] % kan sneller + \ignorespaces\XMLflush{cd:arguments}\endgraf + \egroup + \stopXMLmapping} + \stopXMLmapping + \getvalue{\e!stop setuptext}} + +\defineXMLenvironmentsave [cd:sequence] \ignorespaces \ignorespaces +\defineXMLenvironmentsave [cd:arguments] \ignorespaces \ignorespaces + +%D This is the first pass; here we generate the top line. + +\newcounter\currentSETUPargument +\def\currentSETUPwidth{0pt} + +% environmentsave ? + +\startXMLmapping [one] + +\defineXMLenvironmentsave [cd:string] [value=] + {\XMLop{value}\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:variable] [value=] + {{\expanded{\setupintfont{\XMLop{value}}}}\ignorespaces} + {\ignorespaces} + +% moet een standaard type worden + +\defineXMLenvironmentsave [cd:assignments] [list=,state=] + {\showSETUPassignment\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:keywords] [list=,state=] + {\showSETUPkeyword\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:content] [list=,state=] + {\showSETUPcontent\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:displaymath] [list=,state=] + {\showSETUPdisplaymath\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:index] [list=,state=] + {\showSETUPindex\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:math] [list=,state=] + {\showSETUPmath\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:nothing] [list=,state=] + {\showSETUPnothing\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:file] [list=,state=] + {\showSETUPfile\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:position] [list=,state=] + {\showSETUPposition\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:reference] [list=,state=] + {\showSETUPreference\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:csname] [list=,state=] + {\showSETUPcsname\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:destination] [list=,state=] + {\showSETUPdestination\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:triplet] [list=,state=] + {\showSETUPtriplet\ignorespaces} {\ignorespaces} + +\defineXMLenvironmentsave [cd:word] [list=,state=] + {\showSETUPword\ignorespaces} {\ignorespaces} + +\stopXMLmapping + +%D This is the second pass; here we generate the table. + +\startXMLmapping [two] + +\def\startfirstSETUPcolumn#1% + {\bgroup + \advance\leftskip 2em + \noindent\llap{\hbox to 2em{#1\hss}}} + +\def\stopfirstSETUPcolumn + {\endgraf + \egroup} + +\def\startsecondSETUPcolumn#1#2% + {\bgroup + \advance\hangindent \currentSETUPwidth + \advance\hangindent 2.5em + \noindent \hbox to \hangindent{#1\hss\hbox to 2.5em{\hss#2\hss}}% + \ignorespaces} + +\def\stopsecondSETUPcolumn + {\endgraf + \egroup} + +\def\secondSETUPcolumn#1#2% + {\startsecondSETUPcolumn{#1}{#2}\stopsecondSETUPcolumn} + +\def\previousSETUPargument{\currentSETUPargument} + +\defineXMLenvironmentsave [cd:assignments] + {} + {\xdef\currentSETUPwidth{0pt}% + \bgroup + \defineXMLenvironment [cd:parameter] [name=] + {\setbox0=\hbox{\potentialXMLentity{\XMLop{name}}}% + \ifdim\wd0>\currentSETUPwidth\xdef\currentSETUPwidth{\the\wd0}\fi}% + {}% + \setbox0=\vbox{\XMLflush{cd:assignments}}% + \egroup + \startfirstSETUPcolumn{\showSETUPnumber}% + \doifelseXMLempty{cd:assignments} + {\secondSETUPcolumn{\c!setup!text!{see} \previousSETUPargument}{}} + {\ignorespaces + \XMLflush{cd:assignments}% + \let\previousSETUPargument\currentSETUPargument}% + \stopfirstSETUPcolumn + \blank[\v!halfline] + \ignorespaces} + +\defineXMLenvironmentsave [cd:keywords] [optional=no] + {} + {\startfirstSETUPcolumn{\showSETUPnumber}% + \doifelseXMLempty{cd:keywords} + {\secondSETUPcolumn{see \previousSETUPargument}{}} + {\ignorespaces + \XMLflush{cd:keywords}% + \let\previousSETUPargument\currentSETUPargument}% + \stopfirstSETUPcolumn + \blank[\v!halfline] + \ignorespaces} + +\defineXMLenvironment [cd:parameter] [name=] + {\startsecondSETUPcolumn{\potentialXMLentity{\XMLop{name}}}{=}% + \ignorespaces} + {\stopsecondSETUPcolumn + \ignorespaces} + +\defineXMLenvironmentsave [cd:constant] [type=,default=] + {\doifXMLop{default}{yes}{\underbar}% + {\potentialXMLentity{\XMLop{type}}}\space\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:variable] [value=] + {\potentialXMLentity{\XMLop{value}}\space\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:inherit] [name=] + {\secondSETUPcolumn{\c!setup!text!{inherits} \tex{}\XMLop{name}}{}\ignorespaces} + {\ignorespaces} + +\def\simpleSETUPargument#1% + {\startfirstSETUPcolumn{\showSETUPnumber}% + \c!setup!internal!{#1}% + \stopfirstSETUPcolumn} + +\defineXMLenvironmentsave [cd:content] [list=,state=] + {\simpleSETUPargument{content}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:displaymath] [list=,state=] + {\simpleSETUPargument{display math}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:index] [list=,state=] + {\simpleSETUPargument{index}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:math] [list=,state=] + {\simpleSETUPargument{math}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:nothing] [list=,state=] + {\simpleSETUPargument{nothing}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:file] [list=,state=] + {\simpleSETUPargument{file name}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:position] [list=,state=] + {\simpleSETUPargument{position}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:reference] [list=,state=] + {\simpleSETUPargument{reference}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:csname] [list=,state=] + {\simpleSETUPargument{csname}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:destination] [list=,state=] + {\simpleSETUPargument{destination}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:triplet] [list=,state=] + {\simpleSETUPargument{triplet}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\defineXMLenvironmentsave [cd:word] [list=,state=] + {\simpleSETUPargument{word}\blank[\v!halfline]\ignorespaces} + {\ignorespaces} + +\stopXMLmapping + +\defineXMLentity [cd:command] {\c!setup!internal!{command}} +\defineXMLentity [cd:dimension] {\c!setup!internal!{dimension}} +\defineXMLentity [cd:file] {\c!setup!internal!{file}} +\defineXMLentity [cd:name] {\c!setup!internal!{identifier}} +\defineXMLentity [cd:character] {\c!setup!internal!{character}} +\defineXMLentity [cd:mark] {\c!setup!internal!{mark}} +\defineXMLentity [cd:number] {\c!setup!internal!{number}} +\defineXMLentity [cd:reference] {\c!setup!internal!{reference}} +\defineXMLentity [cd:plural] {\c!setup!internal!{plural}} +\defineXMLentity [cd:singular] {\c!setup!internal!{singular}} +\defineXMLentity [cd:text] {\c!setup!internal!{text}} +\defineXMLentity [cd:formula] {\c!setup!internal!{formula}} +\defineXMLentity [cd:file] {\c!setup!internal!{file}} +\defineXMLentity [cd:matrix] {\c!setup!internal!{matrix}} +\defineXMLentity [cd:list] {\c!setup!internal!{list}} +\defineXMLentity [cd:section] {\c!setup!internal!{section}} + +\defineXMLentity [cd:noargument] {\c!setup!command!{}} +\defineXMLentity [cd:oneargument] {\c!setup!command!{\#1}} +\defineXMLentity [cd:twoarguments] {\c!setup!command!{\#1\#2}} +\defineXMLentity [cd:threearguments] {\c!setup!command!{\#1\#2\#3}} + +%D Todo: + +\defineXMLprocess [cd:choice] + +%D Auxiliary. + +\unexpanded\def\showSETUP#1#2% + {\bgroup + \doglobal\increment\currentSETUPargument + \setbox0=\hbox + {\doifelseXMLop{list}{yes}{#2}{#1}}% + \setbox2=\hbox to \wd0 + {\hss + \raise1ex\hbox + {\tx\ifcase\maximumSETUPargument\relax + \or*\else\currentSETUPargument + \fi}% + \hss}% + \setbox4=\hbox to \wd0 + {\hss + \lower2ex\hbox + \bgroup + \txx\doifXMLop{optional}{yes}{\c!setup!internal!{optional}}% + \egroup + \hss}% + \ht2\ht\strutbox + \dp4\dp\strutbox + \hskip.5em\hsmash{\box0}\hsmash{\box4}\box2% + \egroup} + +\def\showSETUPnumber + {\doglobal\increment\currentSETUPargument + \hbox to 2em + {\ifcase\maximumSETUPargument\relax + \or*\else\currentSETUPargument + \fi + \hss}} + +\def\showSETUPassignment {\showSETUP + {[.\lower.5ex\hbox{=}.]} + {[..,.\lower.5ex\hbox{=}.,..]}} + +\def\showSETUPkeyword {\showSETUP + {[...]} + {[...,...]}} + +\def\showSETUPargument {\showSETUP + {\leftargument..\rightargument} + {\leftargument..,...,..\rightargument}} + +\def\showSETUPdisplaymath {\showSETUP + {\$\$...\$\$} + {\$\$...\$\$}} + +\def\showSETUPindex {\showSETUP + {\leftargument...\rightargument} + {\leftargument..+...+..\rightargument}} + +\def\showSETUPmath {\showSETUP + {\$...\$} + {\$...\$}} + +\def\showSETUPnothing {\showSETUP + {...} + {}} + +\def\showSETUPfile {\showSETUP + {~...~} + {}} + +\def\showSETUPposition {\showSETUP + {(...)} + {(...,...)}} + +\def\showSETUPreference {\showSETUP + {[...]} + {[...,...]}} + +\def\showSETUPcsname {\showSETUP + {{\c!setup!command!{}}} + {}} + +\def\showSETUPdestination {\showSETUP + {[\leftargument..[ref]\rightargument]} + {[..,\leftargument..[ref,..]\rightargument,..]}} + +\def\showSETUPtriplet {\showSETUP + {[x:y:z=]} + {[x:y:z=,..]}} + +\def\showSETUPword {\showSETUP + {\leftargument...\rightargument} + {\leftargument.. ... ..\rightargument}} + +\def\showSETUPcontent {\showSETUP + {\leftargument...\rightargument} + {\leftargument.. ... ..\rightargument}} + +%\def\c!par!{\c!setup!internal!{endofpar}} +%\def\c!repeat!{\c!opt!{{\setupvarfont n}*}} +%\showSETUP\def\c!par!{\texescape par} +%\showSETUP\def\c!sep!{\texescape\texescape} +%\def\c!par!{\addtypespec{delimiter}{par}} % \par +%\def\c!sep!{\addtypespec{separator}{backslash}} % \\ +%\def\c!repeat!{} +%\def\c!tex!#1{\addtypespec{command}{#1}\doanother{tex}} + +\startXMLmapping[zero] + +\defineXMLenvironmentsave [cd:command] [name=,type=,generated=,interactive=,variant=] + {} + {\doifelseXMLop{type}{environment} + {\edef\currentSETUPname{start\XMLop{name}}} + {\edef\currentSETUPname{\XMLop{name}}}% + \doifsomething{\XMLop{variant}} + {\edef\currentSETUPname{\currentSETUPname:\XMLop{variant}}}% like setupinterlinespace:1 + \doifXMLop{generated}{yes} + {\edef\currentSETUPname{\currentSETUPname*}}% + \doglobal\saveXMLdatainelement{stp:\currentSETUPname}{cd:command}{cd:command}% + \expanded{\eachtexcommand[stp:x:\currentSETUPname]{\currentSETUPname}}% + \expanded{\texcommand [stp:y:\currentSETUPname]{\currentSETUPname}}} + +\stopXMLmapping + +\def\loadsetups{\complexorsimple\loadsetups} + +\def\simpleloadsetups + {\doifnotmode{no-setup-main} + {\complexloadsetups[cont-en.xml]}} + +\def\complexloadsetups[#1]% + {\doifsomething{#1} + {\doifnotmode{no-setup-all} + {\startXMLmapping[zero] + \expanded{\processXMLfilegrouped{#1}}% + \stopXMLmapping}}} + +\defineXMLsingular [cd:include] [file=] + {\complexloadsetups[\XMLop{file}]} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-set-12.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-set-12.mkii new file mode 100644 index 00000000000..c2aa265c3f2 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-set-12.mkii @@ -0,0 +1,258 @@ +%D \module +%D [ file=x-set-12, +%D version=2004.10.31, +%D remark=setupx.tex: 1998.07.20 and later, +%D title=\CONTEXT\ Setup Definitions, +%D subtitle=Macro Definitions, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\usemodule[set-11] + +\unprotect + +% \starttext +% \setup{installlanguage} +% \placesetup +% \stoptext + +\definecolor[TitleColor][r=.375,g=.125,b=.125] +\definecolor[TitleColor][r=.125,g=.375,b=.125] +\definecolor[TitleColor][r=.125,g=.125,b=.375] +\definecolor[TitleColor][r=.375,g=.375,b=.125] +\definecolor[TitleColor][r=.375,g=.125,b=.375] +\definecolor[TitleColor][r=.125,g=.375,b=.375] + +\definecolor[TitleColor][r=.25,g=.20,b=.15] +\definecolor[TitleColor][r=.25,g=.15,b=.20] +\definecolor[TitleColor][r=.20,g=.15,b=.25] +\definecolor[TitleColor][r=.20,g=.25,b=.15] +\definecolor[TitleColor][r=.15,g=.20,b=.25] +\definecolor[TitleColor][r=.15,g=.25,b=.20] + +\startinterface english \loadsetups[cont-en.xml] \stopinterface +\startinterface dutch \loadsetups[cont-nl.xml] \stopinterface +\startinterface german \loadsetups[cont-de.xml] \stopinterface +\startinterface french \loadsetups[cont-fr.xml] \stopinterface +\startinterface italian \loadsetups[cont-it.xml] \stopinterface +\startinterface czech \loadsetups[cont-cs.xml] \stopinterface +\startinterface romanian \loadsetups[cont-ro.xml] \stopinterface + +\startinterface dutch \definecolor[LocalColor][r=.75,g=.25,b=.25] \stopinterface +\startinterface english \definecolor[LocalColor][r=.25,g=.75,b=.25] \stopinterface +\startinterface german \definecolor[LocalColor][r=.25,g=.25,b=.75] \stopinterface +\startinterface french \definecolor[LocalColor][r=.75,g=.75,b=.25] \stopinterface +\startinterface czech \definecolor[LocalColor][r=.75,g=.25,b=.75] \stopinterface +\startinterface italian \definecolor[LocalColor][r=.25,g=.75,b=.75] \stopinterface +\startinterface romanian \definecolor[LocalColor][r=.5,g=.4,b=.3] \stopinterface +% \definecolor[LocalColor][r=.5,g=.3,b=.4] +% \definecolor[LocalColor][r=.4,g=.3,b=.5] +% \definecolor[LocalColor][r=.4,g=.5,b=.3] +% \definecolor[LocalColor][r=.3,g=.4,b=.5] +% \definecolor[LocalColor][r=.3,g=.5,b=.4] + +\startinterface english \definecolor[TitleColor][r=.375,g=.125,b=.125] \stopinterface +\startinterface dutch \definecolor[TitleColor][r=.125,g=.375,b=.125] \stopinterface +\startinterface german \definecolor[TitleColor][r=.125,g=.125,b=.375] \stopinterface +\startinterface french \definecolor[TitleColor][r=.375,g=.375,b=.125] \stopinterface +\startinterface italian \definecolor[TitleColor][r=.375,g=.125,b=.375] \stopinterface +\startinterface czech \definecolor[TitleColor][r=.125,g=.375,b=.375] \stopinterface +\startinterface romanian \definecolor[TitleColor][r=.25,g=.20,b=.15] \stopinterface +% \definecolor[TitleColor][r=.25,g=.15,b=.20] +% \definecolor[TitleColor][r=.20,g=.15,b=.25] +% \definecolor[TitleColor][r=.20,g=.25,b=.15] +% \definecolor[TitleColor][r=.15,g=.20,b=.25] +% \definecolor[TitleColor][r=.15,g=.25,b=.20] + +\definecolor [lightgray] [s=.9] +\definecolor [darkgray] [s=.1] + +\usetypescript[palatino] +\setupbodyfont[palatino,9pt] + +\setupcolors + [\c!state=\v!start] + +\defineoverlay + [cover] + [\hbox to \paperwidth{\hss\reuseMPgraphic{cover+back}}] + +\defineoverlay + [back] + [\hbox to \paperwidth{\reuseMPgraphic{cover+back}\hss}] + +\startreusableMPgraphic{cover+back} + numeric h, w ; path p, q, r ; color f, d ; pair s ; + h := OverlayHeight ; w := 2*OverlayWidth ; + r := unitsquare xyscaled (w,h) ; + fill r withcolor \MPcolor{lightgray} ; + set_grid(w,h,w/8,w/16) ; + forever : + s := center r randomized (w,h) ; + if new_on_grid(xpart s, ypart s) : + s := (dx,dy) ; + p := fullsquare xyscaled(w/4,w/8) ; + q := (-4w,ypart ulcorner p) -- + .5[ulcorner p, urcorner p] -- + (4w,ypart urcorner p) ; + q := q shifted (0,-w/24) ; + p := p randomized (w/40,w/40) ; + q := q randomized (0,w/100) ; + q := q cutafter (p cutafter point 3 of p) ; + q := q cutbefore (p cutbefore point 3 of p) ; + d := .5[\MPcolor{LocalColor},\MPcolor{lightgray}] randomized (.5,.9) ; + f := \MPcolor{lightgray} randomized (.5,.9) ; + pickup pencircle scaled (w/100) ; + fill p shifted s withcolor f ; + draw p shifted s withcolor d ; + draw q shifted s withcolor d ; + fi ; + exitif grid_full ; + endfor ; + setbounds currentpicture to r ; +\stopreusableMPgraphic + +\definelayout + [titlepage] + [\c!backspace=1cm, + \c!topspace=1cm, + \c!width=\v!middle, + \c!height=\v!middle, + \c!header=0pt, + \c!footer=0pt] + +\setuplayout + [\c!backspace=2cm, + \c!topspace=1.5cm, + \c!header=0cm, + \c!footer=0cm, + \c!width=\v!middle, + \c!height=\v!middle] + +\setuppagenumbering + [\c!alternative=\v!doublesided] + +\setupsetup + [\c!criterium=\v!all, + \c!reference=0] + +\setupframedtexts + [setuptext] + [\c!frame=\v!on, + \c!rulethickness=1pt, + \c!framecolor=TitleColor] + +\setupunderbar + [\c!rulethickness=1pt, + \c!rulecolor=TitleColor] + +\starttext + +\setupbackgrounds + [\v!rightpage] + [\c!background=cover] + +\setuplayout + [titlepage] + +\startsetups text:commands + \startinterface dutch \strut commando's \par \stopinterface + \startinterface english \strut commands \par \stopinterface + \startinterface german \strut befehle \par \stopinterface + \startinterface french \strut commandes \par \stopinterface + \startinterface czech \strut p\v{r}ikazy \par \stopinterface + \startinterface italian \strut comandi \par \stopinterface + \startinterface romanian \strut comenzile \par \stopinterface +\stopsetups + +\startsetups text:uppercase + \startinterface dutch NL\stopinterface + \startinterface english EN\stopinterface + \startinterface german DE\stopinterface + \startinterface french FR\stopinterface + \startinterface czech CS\stopinterface + \startinterface italian IT\stopinterface + \startinterface romanian RO\stopinterface +\stopsetups + +\startsetups text:lowercase + \startinterface dutch \strut nl / nederlands \par \stopinterface + \startinterface english \strut en / english \par \stopinterface + \startinterface german \strut de / deutsch \par \stopinterface + \startinterface french \strut fr / fran\c{c}ais \par \stopinterface + \startinterface czech \strut cs / \v{c}esk\'y \par \stopinterface + \startinterface italian \strut it / italiano \par \stopinterface + \startinterface romanian \strut ro / rom\^{a}n\u{a} \par \stopinterface +\stopsetups + +\startmakeup[\v!standard] + \dontcomplain + \setupalign[\v!left] + \startcolor[TitleColor] + \definedfont[RegularBold at 100pt]\setstrut + \strut Con\TeX t \par + \definedfont[RegularBold at 50pt]\setstrut + \setups[text:commands] + \vfill + \definedfont[RegularBold at 150pt]\setstrut + \setups[text:uppercase] + \stopcolor +\stopmakeup + +\setuplayout % needed ? + +\setupbackgrounds + [\v!rightpage] + [\c!background=] + +\startmakeup[\v!standard] + \dontcomplain + \startcolor[TitleColor] + \definedfont[RegularBold at 100pt]\setstrut + \setupalign[\v!left] + \strut Con\TeX t \par + \definedfont[RegularBold at 50pt]\setstrut + \setups[text:commands] + \vfill + \definedfont[RegularBold at 24pt]\setupinterlinespace + \setups[text:lowercase] + \par \strut \currentdate \par + \stopcolor +\stopmakeup + +\protect + +\placeeverysetup + +\unprotect + +\page[\v!yes,\v!blank,\v!right,\v!left] + +\setuplayout + [titlepage] + +\setupbackgrounds + [\v!leftpage] + [\c!background=back] + +\startmakeup[\v!standard][\c!page=] + \dontcomplain + \startcolor[TitleColor] + \definedfont[RegularBold at 24pt]\setupinterlinespace + \setupalign[\v!left] + \vfill + PRAGMA ADE \par + Ridderstraat 27 \par + 8061GH Hasselt NL \par + www.pragma-ade.com \par + \stopcolor +\stopmakeup + +\protect + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-sm2om.xsl b/Master/texmf-dist/tex/context/modules/mkii/x-sm2om.xsl new file mode 100644 index 00000000000..93e1a12c549 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-sm2om.xsl @@ -0,0 +1,233 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + This style sheet is used in the Math4All project. This project + will provide an on-line math method for secondary and tertiary + education. In addition to the web-bases content the project + provides high quality typeset output as well. + + This style converts some elements to open math alternatives and + its sole purpose is to easy the input of inline math. + + <i>x</i> identifier (use <v>x</v> when possible) + <n>5</n> number + <v>5</v> variable + <r>1:2</r> interval (range) + <r>x:y</r> interval (range) using variables + + This style is dedicated to Frits Spijkers, an open minded math + author who patiently tested all the related TeX things. + + Hans Hagen, PRAGMA ADE, Hasselt NL / 2006-04-27 + +--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:output method="xml"/> + + <xsl:template match="processing-instruction()"><xsl:copy/><xsl:text> + </xsl:text></xsl:template> + + <xsl:template match="node()|@*" > + <xsl:copy> + <xsl:apply-templates select = "node()|@*" /> + </xsl:copy> + </xsl:template> + + <xsl:template match="comment"></xsl:template> + + <xsl:variable name='openmath-to-content-mathml'><value-of select='$stylesheet-path'/>/x-openmath.xsl</xsl:variable> + + <xsl:template name='om-minus'> + <OMS cd="arith1" name="unary_minus"/> + </xsl:template> + <xsl:template name='om-infinity'> + <OMS cd="nums1" name="infinity"/> + </xsl:template> + <xsl:template name='om-interval-oo'> + <OMS cd="interval1" name="interval_oo"/> + </xsl:template> + <xsl:template name='om-interval-oc'> + <OMS cd="interval1" name="interval_oc"/> + </xsl:template> + <xsl:template name='om-interval-co'> + <OMS cd="interval1" name="interval_co"/> + </xsl:template> + <xsl:template name='om-interval-cc'> + <OMS cd="interval1" name="interval_cc"/> + </xsl:template> + + <xsl:template name='om-kind-of-data'> + <xsl:param name='arg'/> + <xsl:choose> + <xsl:when test="contains($arg,'/')"> + <xsl:element name="OMA"> + <xsl:element name="OMS"> + <xsl:attribute name="cd">nums1</xsl:attribute> + <xsl:attribute name="name">rational</xsl:attribute> + </xsl:element> + <xsl:call-template name="om-kind-of-data"> + <xsl:with-param name='arg' select="substring-before($arg,'/')"/> + </xsl:call-template> + <xsl:call-template name="om-kind-of-data"> + <xsl:with-param name='arg' select="substring-after($arg,'/')"/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:when test="contains($arg,'.') or contains($arg,',')"> + <xsl:element name="OMF"> + <xsl:attribute name="dec"><xsl:value-of select="$arg"/></xsl:attribute> + </xsl:element> + </xsl:when> + <xsl:when test="number($arg)"> + <xsl:choose> + <xsl:when test="contains($arg,'-')"> + <xsl:element name="OMA"> + <xsl:call-template name='om-minus'/> + <xsl:element name="OMI"> + <xsl:value-of select="substring-after($arg,'-')"/> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:when test="contains($arg,'+')"> + <xsl:element name="OMI"> + <xsl:value-of select="substring-after($arg,'+')"/> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="OMI"> + <xsl:value-of select="$arg"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:element name="OMV"> + <xsl:attribute name="name"><xsl:value-of select="$arg"/></xsl:attribute> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match='i|n'> + <xsl:element name="OMOBJ"> + <xsl:attribute name="style">inline</xsl:attribute> + <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute> + <xsl:attribute name="version">2.0</xsl:attribute> + <xsl:call-template name="om-kind-of-data"> + <xsl:with-param name='arg' select="text()"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + + <xsl:template match='v'> + <xsl:element name="OMOBJ"> + <xsl:attribute name="style">inline</xsl:attribute> + <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute> + <xsl:attribute name="version">2.0</xsl:attribute> + <xsl:element name="OMV"> + <xsl:attribute name="name"><xsl:apply-templates/></xsl:attribute> + </xsl:element> + </xsl:element> + </xsl:template> + + <!-- r a/b split in two parts --> + + <xsl:template match='r'> + <xsl:element name="OMOBJ"> + <xsl:attribute name="style">inline</xsl:attribute> + <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute> + <xsl:attribute name="version">2.0</xsl:attribute> + <xsl:element name="OMA"> + <xsl:variable name='type'> + <xsl:choose> + <xsl:when test="@type=''"> + cc + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@type"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="@type='io'"> + <xsl:call-template name='om-interval-oo'/> + <xsl:element name="OMA"> + <xsl:call-template name='om-minus'/> + <xsl:call-template name='om-infinity'/> + </xsl:element> + <xsl:element name="OMI"> + <xsl:call-template name='om-kind-of-data'> + <xsl:with-param name='arg' select='text()'/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:when test="@type='oi'"> + <xsl:call-template name='om-interval-oo'/> + <xsl:element name="OMI"> + <xsl:call-template name='om-kind-of-data'> + <xsl:with-param name='arg' select='text()'/> + </xsl:call-template> + </xsl:element> + <xsl:call-template name='om-infinity'/> + </xsl:when> + <xsl:when test="@type='ic'"> + <xsl:call-template name='om-interval-oc'/> + <xsl:element name="OMA"> + <xsl:call-template name='om-minus'/> + <xsl:call-template name='om-infinity'/> + </xsl:element> + <xsl:element name="OMI"> + <xsl:call-template name='om-kind-of-data'> + <xsl:with-param name='arg' select='text()'/> + </xsl:call-template> + </xsl:element> + </xsl:when> + <xsl:when test="@type='ci'"> + <xsl:call-template name='om-interval-co'/> + <xsl:element name="OMI"> + <xsl:call-template name='om-kind-of-data'> + <xsl:with-param name='arg' select='text()'/> + </xsl:call-template> + </xsl:element> + <xsl:call-template name='om-infinity'/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="OMS"> + <xsl:attribute name="cd">interval1</xsl:attribute> + <xsl:attribute name="name">interval_<xsl:value-of select="$type"/></xsl:attribute> + </xsl:element> + <xsl:call-template name="om-kind-of-data"> + <xsl:with-param name='arg' select="substring-before(text(),':')"/> + </xsl:call-template> + <xsl:call-template name="om-kind-of-data"> + <xsl:with-param name='arg' select="substring-after(text(),':')"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:element> + </xsl:template> + + <xsl:template match='c'> + <xsl:element name="OMOBJ"> + <xsl:attribute name="style">inline</xsl:attribute> + <xsl:attribute name="xmlns">http://www.openmath.org/OpenMath</xsl:attribute> + <xsl:attribute name="version">2.0</xsl:attribute> + <xsl:element name="OMA"> + <xsl:element name="OMS"> + <xsl:attribute name="cd">linalg3</xsl:attribute> + <xsl:attribute name="name">vector</xsl:attribute> + </xsl:element> + <xsl:call-template name="om-kind-of-data"> + <xsl:with-param name='arg' select="substring-before(text(),':')"/> + </xsl:call-template> + <xsl:call-template name="om-kind-of-data"> + <xsl:with-param name='arg' select="substring-after(text(),':')"/> + </xsl:call-template> + </xsl:element> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-steps.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-steps.mkii new file mode 100644 index 00000000000..47141699a93 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-steps.mkii @@ -0,0 +1,85 @@ +%D \module +%D [ file=m-steps, +%D version=2001.05.28, +%D title=\CONTEXT\ Modules, +%D subtitle=Step Charts \& Tables, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D The \XML\ interface: + +\usemodule[m][steps] + +\unprotect + +\defineXMLdirective [stepchart] [charts] \setupSTEPcharts +\defineXMLdirective [stepchart] [cells] \setupSTEPcells +\defineXMLdirective [stepchart] [texts] \setupSTEPtexts +\defineXMLdirective [stepchart] [lines] \setupSTEPlines + +\defineXMLdirective [steptable] [tables] \setupSTEPtables +\defineXMLdirective [steptable] [cells] \setupSTEPcells +\defineXMLdirective [steptable] [texts] \setupSTEPtexts +\defineXMLdirective [steptable] [lines] \setupSTEPlines + +\defineXMLpickup[stepchart][@@STPC] + {\bgroup + \defineXMLpush[top]% + \defineXMLpush[bot]% + \defineXMLenvironment[lines][@@STEL] + {\expanded{\startlines[\theXMLarguments{@@STEL}]}} + {\stoplines}% + \defineXMLenvironment[cells][@@STEC] + {\XMLerase{top}\XMLerase{bot}} + {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{top}}{\XMLpop{bot}}}}% + \defineXMLenvironment[texts][@@STET] + {\XMLerase{top}\XMLerase{bot}} + {\expanded{\texts[\theXMLarguments{@@STET}]{\XMLpop{top}}{\XMLpop{bot}}}}% + \defineXMLenvironmentpush[cell][@@STEC] + {\XMLerase{cell}} + {\expanded{\cell [\theXMLarguments{@@STEC}]{\XMLpop{cell}}}}% + \defineXMLenvironmentpush [text] [@@STET] + {\XMLerase{text}} + {\expanded{\text [\theXMLarguments{@@STET}]{\XMLpop{text}}}}% + \expanded{\startSTEPchart[\theXMLarguments{@@STPC}]}} + {\stopSTEPchart + \egroup} + +\defineXMLpickup[steptable][@@STPT] + {\bgroup + \defineXMLenvironment[lines][@@STEL] + {\expanded{\startlines[\theXMLarguments{@@STEL}]}} + {\stoplines}% + \defineXMLargument[cell][@@STEC] + {\expanded{\cell[\theXMLarguments{@@STEC}]}}% + \defineXMLargument[text][@@STET] + {\expanded{\text[\theXMLarguments{@@STET}]}}% + \defineXMLargument[prep] + {\prep}% + \expanded{\startSTEPtable[\theXMLarguments{@@STPT}]}} + {\stopSTEPtable + \egroup} + +\defineXMLpickup[stepaligntable][@@STPT] + {\bgroup + \defineXMLenvironment[lines][@@STEL] + {\expanded{\setupSTEPlines[\theXMLarguments{@@STEL}]}} + {}% + \defineXMLpush[c1]\defineXMLpush[c2]\defineXMLpush[c3]% + \defineXMLenvironment[cells][@@STEC] + {\XMLerase{c1}\XMLerase{c1}\XMLerase{c3}} + {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{c1}}{\XMLpop{c2}}{\XMLpop{c3}}}}% + \defineXMLargument[text][@@STET] + {\expanded{\text[\theXMLarguments{@@STET}]}}% + \defineXMLargument[prep] + {\prep}% + \expanded{\startSTEPaligntable[\theXMLarguments{@@STPT}]}} + {\stopSTEPaligntable + \egroup} + +\protect \endinput diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-xml-01.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-xml-01.mkii new file mode 100644 index 00000000000..95ce51fc888 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-xml-01.mkii @@ -0,0 +1,91 @@ +%D \module +%D [ file=x-xml-01, +%D version=2001.10.10, +%D title=\CONTEXT\ XML Style File, +%D subtitle=Formatting X?? files, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% texexec --use=xml-format yourfile.x** [--mode=packed,wide] +% +% pdftotext yourfile.pdf yournewfile.x** + +\doifnothing {\inputfilename} {\end} +\doiffileelse {\inputfilename} {} {\end} + +% The following makes pdftotext too slow: +% +% \definepapersize +% [mine] +% [height=.99\maxdimen, +% width=200cm] +% +% \setuppapersize +% [mine] +% [mine] +% +% \setupbodyfont +% [0.4pt,tt] +% +% this is faster +% +% \setuppapersize +% [A0][A0] +% +% but normal A4 combined with 1 pt font size is the best +% +% An alternative is to use a small size, but this leads to +% too many messages +% +% \setupbodyfont +% [1pt,tt] +% +% so we stick to a more normal alternive. + +\unprotect + +\setuplayout + [\c!backspace=0cm, + \c!topspace=0cm, + %\c!width=40em, + \c!width=\v!middle, + \c!height=\v!middle, + \c!header=0cm, + \c!footer=0cm] + +\setupbodyfont [tt,10pt] +\setuptolerance [\v!verytolerant] +\setupalign [\v!broad,\v!right] +\setupXMLfile [\c!level=2] + +\startmode[wide] + + \setuplayout [\c!width=250cm] + +\stopmode + +\startmode[packed] + +% \setupXMLfile [inbetween=] + \setupXMLfile [\c!tussen=] + +\stopmode + +\protect + +% The main text: + +\def\XMLbannerprocessor#1{\string<\string ?xml #1\string ?\string>\endgraf} + +\defineXMLprocessor [xml] {\XMLbannerprocessor} + +\starttext + + \dontcomplain \showXMLfile{\inputfilename} + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-xml-02.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-xml-02.mkii new file mode 100644 index 00000000000..e33ab9ee4ce --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-xml-02.mkii @@ -0,0 +1,91 @@ +%D \module +%D [ file=x-xml-02, +%D version=2001.10.10, +%D title=\CONTEXT\ XML Style File, +%D subtitle=Pretty Printing, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% texexec --use=xml-pretty yourfile.x** [--mode=letter] + +\doifnothing {\inputfilename} {\end} +\doiffileelse {\inputfilename} {} {\end} + +\startmode[letter] + \setuppapersize[letter][letter] +\stopmode + +\setuplayout + [backspace=1.5cm, + topspace=1.5cm, + bottomspace=1cm, + width=middle, + height=middle, + header=1.5cm, + footer=1.5cm] + +\setupcolors + [state=local] + +\setuppagenumbering + [location=] + +\setuplayout + [style=type] + +\setupbodyfont + [10pt,tt] + +\setuptolerance + [verytolerant] + +\setupalign + [broad,right] + +\lowercasestring\inputfilename \to \lcinputfilename +\defconvertedcommand\lcinputfilename\lcinputfilename % make _ safe + +\setupheadertexts + [\lcinputfilename] + +\setupfootertexts + [\currentdate\space\string| \currenttime\space \string| \pagenumber] + +% let's have a look at the type of content: + +\setupXMLfile + [level=2] + +\startmode[*suffix-xml] + % ok +\stopmode + +\startmode[*suffix-rng] + \showXMLlin[value] +\stopmode + +\startmode[*suffix-rlg] + \showXMLlin + [rl:type,rl:state,rl:name,rl:suffix,rl:label,rl:file,rl:original, + rl:width,rl:height,rl:base,rl:page] +\stopmode + +\startmode[*suffix-exa] + \showXMLlin + [exa:resolve,exa:include] +\stopmode + +\def\XMLbannerprocessor#1{\string<\string ?xml #1\string ?\string>\endgraf} + +\defineXMLprocessor [xml] {\XMLbannerprocessor} + +\starttext + +\showXMLfile{\inputfilename} + +\stoptext diff --git a/Master/texmf-dist/tex/context/modules/mkii/x-xml-11.mkii b/Master/texmf-dist/tex/context/modules/mkii/x-xml-11.mkii new file mode 100644 index 00000000000..047561370e9 --- /dev/null +++ b/Master/texmf-dist/tex/context/modules/mkii/x-xml-11.mkii @@ -0,0 +1,134 @@ +%D \module +%D [ file=x-xml-11, +%D version=2004.09.16, +%D title=\CONTEXT\ XML Style File, +%D subtitle=Formatting X?? files, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% xmltools --analyze yourfile.xml +% texexec --use=xml-analyze yourfile.* + +% \doifnothing {\inputfilename} {\end} +% \doiffileelse {\inputfilename} {} {\end} + +\doifnothing {\jobfullname} {\end} +\doiffileelse {\jobfullname} {} {\end} + +\useXMLfilter[ent] +\useXMLfilter[utf] + +\chardef\XMLtokensreduction\plustwo + +\definehead + [SomeElement] + [subsection] + +\setuphead + [SomeElement] + [ownnumber=yes, + style=\tfb, + numberstyle=\tfxx, + alternative=margin] + +\setuplayout + [width=middle, + height=middle, + backspace=2cm, + cutspace=1cm, + topspace=1cm, + header=0pt] + +\setupfootertexts + [\jobfullname] % [\inputfilename] + +\usetypescript[modern][texnansi] \setupbodyfont[modern,tt,10pt] + +\defineXMLenvironment + [document] + {} + {} + +\defineXMLpickup + [entities][n=0] + {\expanded{\SomeElement{\XMLop{n}}{Entities}} + \starttabulate[|l|l|l|]} + {\stoptabulate} + +\defineXMLcommand % ugly hack (make macro of it) + [entity][name=,n=0] + {\startexpanded + \noexpand \NC \XMLop{name} + \noexpand \NC \XMLop{n} + \noexpand \NC \noexpand\doXMLentity\XMLop{name}; + \noexpand \NC + \noexpand \NR + \stopexpanded} + +\defineXMLpickup + [characters][n=0] + {\expanded{\SomeElement{\XMLop{n}}{Characters}} + \bgroup + \let\nonbreakablespace\empty % messes up the table + \starttabulate[|l|r|r|l|l|l|l|]} + {\stoptabulate + \egroup} + +% todo: narrowtt + +\defineXMLcommand + [character][number=,utf=,n=0,uname=,pname=,cname=] + {\startexpanded + \noexpand \NC \noexpand \unicodehexnumber{\XMLop{number}} + \noexpand \NC \XMLop{number} + \noexpand \NC \XMLop{n} + \noexpand \NC \noexpand \unicodechar {\XMLop{number}} + \noexpand \NC \tx \lowercase\expandafter{\XMLop{uname}} + \noexpand \NC \tx \noexpand \unicodepair {\XMLop{number}} + \noexpand \NC \tx \XMLop{cname} + \noexpand \NC + \noexpand \NR + \stopexpanded} + +\defineXMLenvironment + [elements] + {} + {} + +\newtoks \TabulateToks + +\defineXMLpickup + [element][name=,n=0] + {\expanded{\SomeElement{\XMLop{n}}{\XMLop{name}}} + \TabulateToks\emptytoks} + {\starttabulate[|l|r|p|] + \the\TabulateToks + \stoptabulate} + +\defineXMLenvironment + [attribute][name=] + {\xdef\AttributeName{\XMLop{name}}} + {} + +\defineXMLenvironment + [instance][value=,n=0] + {\appendetoks + \noexpand \NC \AttributeName + \noexpand \NC \XMLop{n} + \noexpand \NC \XMLop{value} + \noexpand \NC + \noexpand \NR + \to \TabulateToks} + {\xdef\AttributeName{}} + +\starttext + +% \processXMLfilegrouped{\inputfilename} +\processXMLfilegrouped{\jobfullname} + +\stoptext |