diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/cont-new.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/base/cont-new.tex | 345 |
1 files changed, 318 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/context/base/cont-new.tex b/Master/texmf-dist/tex/context/base/cont-new.tex index 87d53cb68dc..0cdb791700c 100644 --- a/Master/texmf-dist/tex/context/base/cont-new.tex +++ b/Master/texmf-dist/tex/context/base/cont-new.tex @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\newcontextversion{2006.08.08 21:51} + %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new %D features. @@ -22,8 +24,233 @@ \unprotect +% \setuplabeltext[\s!itemcount1={{I(},{)}}] +% \def\labeledcountervalue#1{\labeltexts{#1}{\countervalue{#1}}} + \writestatus{\m!systems}{beware: some patches loaded from cont-new.tex} +% we need to overhaul the page modules anyway + +\def\settext + {\doquintupleempty\dosettext} + +\def\dosettext[#1][#2][#3][#4][#5]% header text middle text/text + {\iffifthargument + \setvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}% + {\dodoubletexts{\??tk#1}{#2}% + {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}% + {\c!rightstyle\c!rightcolor\c!rightwidth}{#5}}% + \else\iffourthargument + \setvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}% + {\dodoubletexts{\??tk#1}{#2}% + {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}% + {\c!rightstyle\c!rightcolor\c!rightwidth}{#4}}% + \else\ifthirdargument + \setvalue{\??tk#1#2\c!middletext}% + {\dodoubletexts{\??tk#1}{#2}% + {\c!leftstyle \c!leftcolor \c!leftwidth }{#3}% + {\c!rightstyle\c!rightcolor\c!rightwidth}{#3}}% + \fi\fi\fi} + +\def\resettext + {\dotripleempty\doresettext} + +\def\doresettext[#1][#2][#3]% header text middle + {\ifthirdargument + \letvalue{\??tk#1#2\executeifdefined{:\c!text:#3:}\c!middletext}\empty + \else\ifsecondargument + \letvalue{\??tk#1#2\c!lefttext }\empty + \letvalue{\??tk#1#2\c!middletext}\empty + \letvalue{\??tk#1#2\c!righttext }\empty + \fi\fi} + +\setvalue{:\c!middle:\c!text:}{\c!middletext} +\setvalue{:\c!left :\c!text:}{\c!lefttext } +\setvalue{:\c!right :\c!text:}{\c!righttext } + +% \settext[header][text][middle][xxx][yyy] + +%D A nice example of a plugin: +%D +%D \startbuffer +%D \startitemize[a,random,packed] +%D \startitem first \stopitem \startitem second \stopitem +%D \startitem third \stopitem \startitem fourth \stopitem +%D \stopitemize +%D +%D \startitemize[a,random,packed] +%D \startitem first \stopitem \startitem second \stopitem +%D \startitem third \stopitem \startitem fourth \stopitem +%D \stopitemize +%D +%D \startitemize[a,packed] +%D \startitem first \stopitem \startitem second \stopitem +%D \startitem third \stopitem \startitem fourth \stopitem +%D \stopitemize +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +% better collectitems als conditional and a real plugin mechanism (some day) + +\@EA\long\@EA\def\@EA\collectitemgroupitem\@EA#\@EA1\csname\e!stop\v!item\endcsname + {\increment\itemcollectcounter + \long\setvalue{\v!item*\itemcollectcounter}{\item#1\par}} + +\def\flushcollecteditems + {\ifconditional\randomizeitems + \getrandomnumber\itemcollectcounternow\plusone\itemcollectcounter + \else + \increment\itemcollectcounternow + \fi + \doifdefined{\v!item*\itemcollectcounternow} + {\getvalue{\v!item*\itemcollectcounternow}% + \letbeundefined{\v!item*\itemcollectcounternow}% + \increment\itemcollectcounterdone}% + \ifnum\itemcollectcounterdone<\itemcollectcounter\relax + \expandafter\flushcollecteditems + \fi} + +\def\stopcollectitems + {\ifconditional\randomizeitems + \newcounter\itemcollectcounterdone + \ifnum\itemcollectcounter>\zerocount + \@EAEAEA\flushcollecteditems + \fi + \fi} + +\def\startcollectitems + {\ifconditional\randomizeitems + \newcounter\itemcollectcounter + \letvalue{\e!start\v!item}\collectitemgroupitem + \fi} + +% This will move to core-fig asap: +% +% todo: process between runs + +\startXMLmapping[rli] + \defineXMLprocess[rl:identify] + \defineXMLsavecontent[rl:width] {\!!zeropoint} + \defineXMLsavecontent[rl:height]{\!!zeropoint} +\stopXMLmapping + +\let\rliwidth \!!zeropoint +\let\rliheight\!!zeropoint + +\def\getRLIfiguredimensions#1% + {\global\let\rliwidth \!!zeropoint + \global\let\rliheight\!!zeropoint + \doifelsenothing\@@efconversion + {\doiffileelse\@@effilenametype + {\doiffileelse{\@@effilenametype.rli} + {} + {% let's try runtime running first + \writestatus\m!figures{using rlxtools to determine size of \@@effilenametype}% + \executesystemcommand{texmfstart rlxtools --identify \@@effilenametype}}% + \doiffileelse{\@@effilenametype.rli} + {} + {% we assume that runtime running failed + \installprogram{texmfstart rlxtools --identify \@@effilenametype}}% + \startnointerference + \startXMLmapping[rli]% + \startXMLignore + \processXMLfile{\@@effilenametype.rli}% + \xdef\rliwidth {\XMLflush{rl:width}}% + \xdef\rliheight{\XMLflush{rl:height}}% + \stopXMLignore + \stopXMLmapping + \stopnointerference} + {}} + {}} % no rli when rlx conversion is in place + +\def\getfiguredimensionsC + {\ifcase\figurestatus\ifcase\figurefilemode\else + \doifsomething\@@efcurrentpath + {\doifnotinset\@@effiletype{\c!tex,\c!tmp} + {\doiffileelse\@@efcurrentfile + {\@@eftrace{using rlxtools to identify \@@effilenametype}% + \getRLIfiguredimensions{\@@effilenametype}% + \ifdim\rliwidth>\zeropoint \ifdim\rliheight>\zeropoint + \geteparameters % e ! + [\??ep] + [\c!x=\!!zeropoint,\c!y=\!!zeropoint, % brrr, todo: bbox + \c!w=\rliwidth,\c!h=\rliheight]% + \let\@@eftype\@@efcurrenttype + \let\@@effullname\@@efcurrentfile + \chardef\figurestatus\plusfour % todo, message is wrong now + \fi \fi + \@@eftrace{\ifcase\figurestatus not \fi found}} + {}}}% + \fi\fi} + +\let\doanalyzefigurefilesB\relax % obsolete +\let\doanalyzefigurefilesC\relax % obsolete + +\def\environment #1 % at outermost level only (load only once) + {\pushmacro\startenvironment + \pushmacro\stopenvironment + \def\startenvironment ##1 {}% + \let\stopenvironment\relax + \startreadingfile + \doexecutefileonce{#1} + \stopreadingfile + \popmacro\startenvironment + \popmacro\stopenvironment} + +\def\singlewidened #1{\hbox spread 1em{\hss#1\hss}} +\def\complexwidened[#1]#2{\hbox spread #1{\hss#2\hss}} + +\definecomplexorsimple\widened + +% todo +% +% \def\definelocation{\dodoubleargument\dodefinelocation} +% \def\dodefinelocation[#1][#2]{\setvalue{loc:#1}{#2}} +% +% \definelocation[lt] [\v!left\v!top] +% \definelocation[tl] [\v!left\v!top] +% \definelocation[\v!top\v!left][\v!left\v!top] +% +% \def\getlocation#1{\executeifdefined{loc:#1}{#1}} + +\def\convertencodedtokens{\stringifyencodedtokens} + +% test case: +% +% \enableregime[cp1250] +% \mainlanguage[cz] +% +% \starttext +% +% \title{Žluťoučcí koně úpí} +% \placelist[chapter][criterium=all] +% +% \startbuffer +% <chapter> +% <title>Žluťoučcí koně úpí</title> +% </chapter> +% \stopbuffer +% +% \defineXMLenvironment +% [chapter] +% {\defineXMLsave[title]} +% {\expanded{\chapter{\XMLflush{title}}}} +% \processXMLbuffer +% +% \setuphead[chapter][expansion=yes] +% \defineXMLenvironment +% [chapter] +% {\defineXMLsave[title]} +% {\chapter{\XMLflush{title}}} +% \processXMLbuffer +% +% \stoptext + +% just in case we load something from a file (pdfr-ec for instance) + +\prependtoks \restoreendofline \to \everybeforeshipout + % \tracefilestrue % % \unexpanded\def\readfile#1#2#3% @@ -63,9 +290,11 @@ \def\docheckprepfile {\ifcase\preprocessmethod + \iftracefiles\writestatus\m!systems{preprocessing - not needed}\fi % no preprocessing \or % only check for existence + \iftracefiles\writestatus\m!systems{preprocessing - check exitence of \readfilename\preprocesssuffix}\fi \doiffileexistselse{\readfilename\preprocesssuffix} {\chardef\preprocessstate\plusone} \donothing @@ -75,14 +304,21 @@ \splitfilename\readfilename \ifx\splitofftype\empty % saveguard and speed up + \iftracefiles\writestatus\m!systems{preprocessing - no suffix}\fi \egroup \else - \doifdefinedelse{fp..\splitoffname.\splitofftype} + \iftracefiles\writestatus\m!systems{preprocessing - check presence of \readfilename\preprocesssuffix}\fi + \doifdefinedelse{fp..\readfilename} {\egroup \doiffileexistselse{\readfilename\preprocesssuffix} {\chardef\preprocessstate\plusone} {\chardef\preprocessstate\plustwo}}% - {\egroup}% + {\doifdefinedelse{fp..\splitoffname.\splitofftype} + {\egroup + \doiffileexistselse{\readfilename\preprocesssuffix} + {\chardef\preprocessstate\plusone} + {\chardef\preprocessstate\plustwo}}% + {\egroup}}% \fi \fi} @@ -176,9 +412,6 @@ \relax \the\everyafterreadfile} -\def\headparameter#1% to do: everywhere in core-sec - {\csname\??ko\currenthead#1\endcsname} - % The following may be a solution for the fact that one cannot % change catcodes of characters like : and ; inside an environment. @@ -588,7 +821,7 @@ %D \getbuffer[c] \long\def\rescan#1{\scantokens{#1\ignorespaces}} -\long\def\rescanwithsetup#1#2{\bgroup\directsetup{#1}\scantokens{#2\ignorespaces}\egroup} +\long\def\rescanwithsetup#1#2{\begingroup\directsetup{#1}\scantokens{#2\ignorespaces}\endgroup} % In 2005 we will abandon support for font encodings that don't have % the ascii characters { } $ etc in their normal slot, i.e. latin modern @@ -612,6 +845,8 @@ % \egroup % % more generic +% +% IS THIS STILL OK? TO BE CHECKED (UTF AND SUCH) ! ! ! ! \def\XMLexpanded#1% {\bgroup @@ -649,14 +884,73 @@ \installoutput\synchronizeoutput % maybe add pagediscards {\ifvoid\normalpagebox\else \unvbox\normalpagebox - \pagediscards + \pagediscards % maybe not needed ? \fi} % temp hack, else no proper default fall back (like \textmultiply); todo: sync encoding +\def\dealwithmathtextencoding + {\expanded{\everyhbox{\the\everyhbox\noexpand\fastenableencoding{\currentencoding}}}% + \def\dealwithmathtextencoding{\let\characterencoding\nocharacterencoding}% + \dealwithmathtextencoding} \appendtoks - \let\characterencoding\nocharacterencoding + \dealwithmathtextencoding +\to \everymathematics + +\def\dohandlemathtoken#1% + {\csname + \ifmmode + \ifcsname\@mt@\mathcollection:\outerencoding#1\endcsname + \@mt@\mathcollection:\outerencoding + \else\ifcsname\@mt@\mathcollection#1\endcsname + \@mt@\mathcollection + \else\ifcsname\@mt@\nomathcollection#1\endcsname + \@mt@\nomathcollection + \else\ifcsname\characterencoding#1\endcsname + \characterencoding + \else + \nocharacterencoding + \fi\fi\fi\fi + \else + \ifcsname\characterencoding#1\endcsname + \characterencoding + \else\ifcsname\nocharacterencoding#1\endcsname + \nocharacterencoding + \else\ifcsname\@mt@\mathcollection:\outerencoding#1\endcsname + \@mt@\mathcollection:\outerencoding + \else\ifcsname\@mt@\mathcollection#1\endcsname + \strippedcsname\mathematics\expandafter\endcsname\csname\@mt@\mathcollection + \else\ifcsname\@mt@\nomathcollection#1\endcsname + \strippedcsname\mathematics\expandafter\endcsname\csname\@mt@\nomathcollection + \else + \nocharacterencoding + \fi\fi\fi\fi\fi + \fi + #1\endcsname} + +\let\dohandlecommand\dohandlemathtoken + +\let\outerencoding\empty + +\def\checkoutermathencoding + {\ifx\outerencoding\empty + \ifx\outerencoding\s!default\else + \edef\outerencoding{\currentencoding}% + \fi + \fi} + +\prependtoks + \checkoutermathencoding \to \everymathematics + +% \startmathcollection[euler:texnansi] +% \definemathsymbol [breve] [accent] [tf] ["15] +% \stopmathcollection +% \startmathcollection[euler:ec] +% \definemathsymbol [breve] [accent] [tf] ["08] +% \stopmathcollection +% +% $\breve e$ % \separatestring123 456\to\test [\test] @@ -1209,8 +1503,8 @@ \prependtoks \normalenableXML \to \everyXMLinputmode \appendtoks \processingXMLtrue \to \everyXMLinputmode -\def\enableXML {\setinputmode[XML]} -\def\disableXML{\setinputmode[TEX]} +\unexpanded\def\enableXML {\setinputmode[XML]} % \enableXML is used in edef's and marks +\unexpanded\def\disableXML{\setinputmode[TEX]} \beginTEX @@ -1342,7 +1636,8 @@ %\ifgridsnapping \else \baselinecorrection \fi % ! ! ! test test test ! ! ! ! \doplacefloatbox \doinsertfloatinfo - \dochecknextindentation\??bk} + \dochecknextindentation\??bk + \dorechecknextindentation} % todo: switch koppelen aan par scheelt pos @@ -1361,6 +1656,16 @@ % \headsym{xx} test \par test % \stopitemize +% \def\removeunwantedspaces +% {\ifhmode +% \doloop{\ifdim\lastskip>\zeropoint\unskip\else\exitloop\fi}% +% \fi} + +\def\removeunwantedspaces + {\ifhmode \ifdim\lastskip>\zeropoint + \unskip \@EAEAEA\removeunwantedspaces + \fi \fi} + % wait till bugfix in etex is widespead % % \beginETEX \lastnodetype @@ -1420,16 +1725,6 @@ % documentation : \setupregister[alternative=a|b|A|B] -\def\pushXMLmeaning#1% - {\@EA\pushmacro\csname\@@XMLelement:#1/\endcsname - \@EA\pushmacro\csname\@@XMLelement:#1\endcsname - \@EA\pushmacro\csname\@@XMLelement:/#1\endcsname} - -\def\popXMLmeaning#1% - {\@EA\popmacro\csname\@@XMLelement:#1/\endcsname - \@EA\popmacro\csname\@@XMLelement:#1\endcsname - \@EA\popmacro\csname\@@XMLelement:/#1\endcsname} - \def\defineXMLstore {\doquadrupleargument\dodefineXMLstore[\saveXMLasdata]} \def\defineXMLgstore{\doquadrupleargument\dodefineXMLstore[\gsaveXMLasdata]} @@ -2363,7 +2658,7 @@ \snaptogrid\vbox{\box\columnspanbox} \fi \endgraf - \prevdepth\strutdp + \ifvmode\prevdepth\strutdp\fi \egroup} \vbox\bgroup %\topskipcorrection % becomes an option ! @@ -2390,10 +2685,6 @@ \def\stopgeheel {\stoplinecorrection} -%D No more news. - -\protect - %D Next we load a few local optimizations and new features. They %D live on on my machine and are not distributed, but they may end %D up in the distributed files. @@ -2401,4 +2692,4 @@ \readsysfile {cont-loc} {} {} % local improvements, patches, new features \readsysfile {cont-exp} {} {} % experimental features (e.g. local speed-ups) -\endinput +\protect \endinput |