From 60cc55d63b06031c0c852888fddeaff74a209011 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 11 Jul 2001 00:00:00 +0200 Subject: stable 2001.07.11 --- tex/context/base/colo-ini.tex | 26 +- tex/context/base/cont-new.tex | 91 ++++ tex/context/base/cont-sys.ori | 6 +- tex/context/base/context.tex | 2 +- tex/context/base/core-fig.tex | 8 +- tex/context/base/core-lst.tex | 2 +- tex/context/base/core-mis.tex | 168 +++++- tex/context/base/core-ntb.tex | 18 +- tex/context/base/core-pos.tex | 14 +- tex/context/base/core-rul.tex | 5 +- tex/context/base/core-syn.tex | 2 +- tex/context/base/core-sys.tex | 2 +- tex/context/base/lang-ini.tex | 6 + tex/context/base/lang-ita.tex | 3 + tex/context/base/math-ini.tex | 27 +- tex/context/base/math-tex.tex | 24 +- tex/context/base/mult-con.tex | 11 + tex/context/base/mult-sys.tex | 1 + tex/context/base/page-imp.tex | 24 +- tex/context/base/spec-fdf.tex | 9 +- tex/context/base/supp-lan.tex | 73 +++ tex/context/base/symb-eur.tex | 2 + tex/context/base/symb-nav.tex | 4 + tex/context/base/syst-ext.tex | 40 +- tex/context/base/syst-gen.tex | 59 +- tex/context/base/syst-new.tex | 14 +- tex/context/base/type-enc.tex | 39 +- tex/context/base/type-exa.tex | 72 +-- tex/context/base/type-ini.tex | 37 +- tex/context/base/type-map.tex | 51 +- tex/context/base/type-siz.tex | 2 +- tex/context/base/type-syn.tex | 23 +- tex/context/base/x-fig-00.tex | 10 +- tex/context/base/x-fig-01.tex | 32 +- tex/context/base/xtag-ini.tex | 1 + tex/context/base/xtag-ini.tex~ | 1161 ++++++++++++++++++++++++++++++++++++++++ tex/context/user/cont-sys.rme | 6 +- tex/context/user/cont-sys.tex | 96 ++++ 38 files changed, 1954 insertions(+), 217 deletions(-) create mode 100644 tex/context/base/xtag-ini.tex~ create mode 100644 tex/context/user/cont-sys.tex (limited to 'tex') diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex index bb896e0fa..95baa0067 100644 --- a/tex/context/base/colo-ini.tex +++ b/tex/context/base/colo-ini.tex @@ -661,20 +661,18 @@ \beginTEX -\def\colorcsname#1\endcsname - {\csname\??cr - \@EA\ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi - #1\endcsname} - \def\doifcolorelse#1% - {\@EA\ifx\colorcsname#1\endcsname + {\@EA\ifx\csname\??cr\@EA\ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi#1\endcsname\relax \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} \def\getcurrentcolorspecs#1% - {\edef\currentcolorspecs{\colorcsname#1\endcsname}} + {\edef\currentcolorspecs% + {\csname\??cr\@EA + \ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi + #1\endcsname}} \endTEX @@ -1424,18 +1422,15 @@ \newif\ifMPcmyk % \MPcmykfalse -% \def\MPcolor#1% -% {\ifMPgraphics -% \@EA\@EA\@EA\doMPcolor\csname\??cr#1\endcsname:::::\end -% \else -% #1% -% \fi} - \beginTEX \def\MPcolor#1% {\ifMPgraphics - \@EA\@EA\@EA\doMPcolor\colorcsname#1\endcsname:::::\end + \@EA\@EA\@EA\doMPcolor + \csname\??cr\@EA + \ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi + #1\endcsname + :::::\end \else #1% \fi} @@ -1457,7 +1452,6 @@ \endETEX - \def\doMPcolor#1:#2:#3:#4:#5:#6\end {\if #1R(#2,#3,#4)% \else\if#1C\ifMPcmyk cmyk(#2,#3,#4,#5)\else(1-#2-#5,1-#3-#5,1-#4-#5)\fi diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 18e76bf7c..94494cf6e 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -20,6 +20,97 @@ \writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!} +\def\dodousemodules#1#2% + {\setfalse\moduleisloaded + \doifelsenothing{#1} + {\def\next + {\dododousemodules\f!moduleprefix {#2}% + \dododousemodules\f!privateprefix{#2}% + \dododousemodules\f!styleprefix {#2}% + \dododousemodules\f!xstyleprefix {#2}% + \dododousemodules\f!thirdprefix {#2}}} + {\def\next + {\dododousemodules{#1-}{#2}}}% + \next + \ifconditional\moduleisloaded\else + \showmessage{\m!systems}{6}{#2}% + \fi} + +\def\dousemodules[#1][#2]% + {\ifsecondargument + \doifelsenothing{#2} + {\let\next\relax} + {\def\next{\processcommalist[#2]{\dodousemodules{#1}}}}% + \else + \def\next{\usemodules[][#1]}% + \fi + \next} + +\def\usemodules% + {\dodoubleempty\dousemodules} + +\let\usemodule\usemodules + +% \usemodule[t][speech] + +\def\complexTableTB[#1]{\TABLEnoalign{\blanko[#1]}} +\def\simpleTableTB {\TABLEnoalign{\blanko}} + +\def\TabulateTB + {\complexorsimpleTable{TB}} + +\def\doTableinterline% #1 + {\ifnum\currentTABLEcolumn>\maxTABLEcolumn + \chuckTABLEautorow + \else\ifnum\currentTABLEcolumn=0 + \TABLEnoalign + {\global\let\checkTABLEautorow=\empty + \global\let\chuckTABLEautorow=\empty}% + \else + \setTABLEerror\TABLEmissingcolumn + \handleTABLEerror + \fi\fi + \complexorsimpleTable} % {#1} + +\def\TableHL{\doTableinterline{HL}} +\def\TableTB{\doTableinterline{TB}} + +\appendtoks\let\TB\TableTB \to\everytable +\appendtoks\let\TB\TabulateTB\to\everytabulate + +% \starttabulate +% \NC text \NC text \NC \NR +% \TB[small] +% \NC text \NC text \NC \NR +% \TB[4*big] +% \NC text \NC text \NC \NR +% \stoptabulate +% +% \starttable[|||] +% \VL text \VL text \VL \AR +% \TB[small] +% \VL text \VL text \VL \AR +% \TB[4*big] +% \VL text \VL text \VL \AR +% \stoptable + +\def\placefloatlabel + {\dodoublempty\doplacefloatlabel} + +\def\placefloatlabel[#1][#2]#3% + {\doifvalue{\??kj#1\c!nummer}{\v!ja} + {\doglobal\convertargument#3\to\asciititle % \asciititle is global + \verhoognummer[#1]% + \maakhetnummer[#1]% + \dofloatreference + \redofloatorder{#1}% + \doifsomething{#2}{\rawreference{\s!flt}{#2}{{\hetnummer}{\asciititle}}}% + \doschrijfnaarlijst{#1}{\hetnummer}{#3}{#1}% + \doattributes{\??kj#1}\c!kopletter\c!kopkleur + {\labeltexts{#1}{\hetnummer}}% + \doattributes{\??kj#1}\c!letter\c!kleur + {\tfskip#3}}} + \def\checkframedtext% {\ifinsidefloat \localhsize\hsize diff --git a/tex/context/base/cont-sys.ori b/tex/context/base/cont-sys.ori index cbeee6a1e..69483c98d 100644 --- a/tex/context/base/cont-sys.ori +++ b/tex/context/base/cont-sys.ori @@ -16,7 +16,7 @@ % Here you can take care of overloading some (style) % defaults. What goes here, depends on your local system. % -% Set default file name mapping: +% Set default file name mapping (not really needed): % % \usetypescript [ber] % @@ -33,6 +33,10 @@ % \definefontsynonym [gbheisl] [gbsong] % \definefontsynonym [gbheisl] [gbsong] % +% You can let \CONTEXT\ load the map files for \PDFTEX. +% +% \autoloadmapfilestrue +% % Setting up a global figure path (beware, \c!gebied may change): % % \setupexternalfigures diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 7b2610074..b4f2845e6 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -13,7 +13,7 @@ \catcode`\{=1 \catcode`\}=2 -\def\contextversion{2001.7.4} +\def\contextversion{2001.7.11} %D Welcome to the main module. When this module is ran through %D \type{initex} or \type{tex -i} or \type{whatevertex} using diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex index fe53c70fe..2af9525e1 100644 --- a/tex/context/base/core-fig.tex +++ b/tex/context/base/core-fig.tex @@ -563,11 +563,11 @@ \!!doneafalse}}}% \if!!donea \ifdim\figwid>\@@efhsize\relax - \global\fighei=\!!zeropoint\relax - \global\figwid=\@@efhsize\relax + \global\fighei=\zeropoint + \global\figwid=\@@efhsize \else\ifdim\fighei>\@@efvsize\relax - \global\fighei=\@@efvsize\relax - \global\figwid=\!!zeropoint\relax + \global\fighei=\@@efvsize + \global\figwid=\zeropoint \fi\fi \fi} diff --git a/tex/context/base/core-lst.tex b/tex/context/base/core-lst.tex index 698cf8ee2..dd399e460 100644 --- a/tex/context/base/core-lst.tex +++ b/tex/context/base/core-lst.tex @@ -917,7 +917,7 @@ % [left=\hss nog~,right=~ingangen] % % \resetremaininglistlength -% [section][setttings] +% [section][settings] % % \placelist % [section] diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex index 63b6ecd2d..d19ca2326 100644 --- a/tex/context/base/core-mis.tex +++ b/tex/context/base/core-mis.tex @@ -634,8 +634,89 @@ f% \egroup} -\newsignal\quotationsignal -\def\quotationskip{.125em} +% \newsignal\quotationsignal +% \def\quotationskip{.125em} +% +% \def\stelciterenin% +% {\dodoubleargument\getparameters[\??ci]} +% +% \def\stelcitatenin% +% {\stelciterenin} +% +% \def\dostartcitaat[#1]% +% {\bgroup +% \@@civoor +% \doifelsenothing{#1} +% {\let\dostopcitaat=\relax} +% {\startsmaller[#1] +% \let\dostopcitaat=\stopsmaller}% +% \dostartattributes\??ci\c!letter\c!kleur{}% +% \setbox0=\hbox{\getvalue{\??la\currentlanguage\c!leftquotation}}% +% \hskip-\wd0 +% \box0\relax +% \ignorespaces} +% +% \def\stopcitaat% +% {\unskip\hsmash{\getvalue{\??la\currentlanguage\c!rightquotation}}% +% \dostopattributes +% \dostopcitaat +% \@@cina +% \egroup} +% +% \def\startcitaat% +% {\dosingleempty\dostartcitaat} +% +% \def\dohandlequotation#1% +% {\ifdim\lastskip=\quotationsignal +% \unskip\hskip\quotationskip +% \fi +% \ifhmode % else funny pagebeaks +% \penalty\!!tenthousand\hskip\!!zeropoint % == \prewordbreak +% \fi +% \strut % new, needed below +% \getvalue{\??la\currentlanguage#1}% +% \penalty\!!tenthousand\hskip\quotationsignal} % +- \prewordbreak +% +% \unexpanded\def\citaat% +% {\groupedcommand +% {\dohandlequotation\c!leftquotation} +% {\dohandlequotation\c!rightquotation}} +% +% \unexpanded\def\citeer% +% {\doifelse{\@@ciletter}{\v!normaal} +% {\let\next=\doquotedcite} +% {\let\next=\doattributedcite}% +% \next} +% +% \def\doquotedcite% +% {\groupedcommand +% {\dohandlequotation\c!leftquote} +% {\dohandlequotation\c!rightquote}} +% +% \def\doattributedcite% +% {\groupedcommand +% {\dostartattributes\??ci\c!letter\c!kleur} +% {\dostopattributes}} +% +% % The previous one fails in \placefloat[left]{}{}, so instead +% % we use the next alternative, where the first one is handled +% % outside group. Watch the strut. +% +% \unexpanded\def\citaat% +% {\dohandlequotation\c!leftquotation +% \groupedcommand{}{\dohandlequotation\c!rightquotation}} +% +% \def\doquotedcite% +% {\dohandlequotation\c!leftquote +% \groupedcommand{}{\dohandlequotation\c!rightquote}} +% +% \stelciterenin +% [\c!letter=\v!normaal, +% \c!kleur=, +% \c!voor=\startsmaller, +% \c!na=\stopsmaller] + +\newsignal\quotationsignal \def\quotationskip{.125em} \def\stelciterenin% {\dodoubleargument\getparameters[\??ci]} @@ -643,9 +724,12 @@ \def\stelcitatenin% {\stelciterenin} -\def\dostartcitaat[#1]% +\def\startcitaat% {\bgroup - \@@civoor + \dosingleempty\dostartcitaat} + +\def\dostartcitaat[#1]% + {\@@civoor \doifelsenothing{#1} {\let\dostopcitaat=\relax} {\startsmaller[#1] @@ -663,24 +747,23 @@ \@@cina \egroup} -\def\startcitaat% - {\dosingleempty\dostartcitaat} - -\def\dohandlequotation#1% +\def\dohandlequotation#1#2% {\ifdim\lastskip=\quotationsignal - \unskip\hskip\quotationskip + \unskip\hskip\quotationskip + \else + #2% + \fi + \ifhmode % else funny pagebeaks + \penalty\!!tenthousand\hskip\!!zeropoint % == \prewordbreak \fi -\ifhmode % else funny pagebeaks - \penalty\!!tenthousand\hskip\!!zeropoint % == \prewordbreak -\fi \strut % new, needed below \getvalue{\??la\currentlanguage#1}% \penalty\!!tenthousand\hskip\quotationsignal} % +- \prewordbreak \unexpanded\def\citaat% {\groupedcommand - {\dohandlequotation\c!leftquotation} - {\dohandlequotation\c!rightquotation}} + {\dohandlequotation\c!leftquotation\relax} + {\dohandlequotation\c!rightquotation\unskip}} \unexpanded\def\citeer% {\doifelse{\@@ciletter}{\v!normaal} @@ -690,31 +773,70 @@ \def\doquotedcite% {\groupedcommand - {\dohandlequotation\c!leftquote} - {\dohandlequotation\c!rightquote}} + {\dohandlequotation\c!leftquote\relax} + {\dohandlequotation\c!rightquote\unskip}} \def\doattributedcite% {\groupedcommand {\dostartattributes\??ci\c!letter\c!kleur} {\dostopattributes}} -% The previous one fails in \placefloat[left]{}{}, so instead -% we use the next alternative, where the first one is handled -% outside group. Watch the strut. +%D The previous one fails in \placefloat[left]{}{}, so instead +%D we use the next alternative, where the first one is handled +%D outside group. Watch the strut. \unexpanded\def\citaat% - {\dohandlequotation\c!leftquotation - \groupedcommand{}{\dohandlequotation\c!rightquotation}} + {\dohandlequotation\c!leftquotation\relax + \groupedcommand{}{\dohandlequotation\c!rightquotation\unskip}} \def\doquotedcite% - {\dohandlequotation\c!leftquote - \groupedcommand{}{\dohandlequotation\c!rightquote}} + {\dohandlequotation\c!leftquote\relax + \groupedcommand{}{\dohandlequotation\c!rightquote\unskip}} \stelciterenin [\c!letter=\v!normaal, \c!kleur=, \c!voor=\startsmaller, \c!na=\stopsmaller] + +%D The next features was so desperately needed by Giuseppe +%D Bilotta that he made a module for it. Since this is a +%D typical example of core functionality, I decided to extend +%D the low level quotation macros in such a way that a speech +%D feature could be build on top of it. The speech opening and +%D closing symbols are defined per language. Italian is an +%D example of a language that has them set. + +\newcounter\speechlevel \newconditional\insidespeech + +\def\startspeech + {\doglobal\increment\speechlevel\relax + \dohandlequotation\c!leftspeech\relax + \doglobal\settrue\insidespeech + \ignorespaces} + +\def\stopspeech + {\dohandlequotation\c!rightspeech\unskip + \doglobal\decrement\speechlevel\relax + \ifcase\speechlevel\relax \doglobal\setfalse\insidespeech \fi} + +\def\dohandlespeech% + {\relax \ifcase\speechlevel + \or\ifconditional\insidespeech + \dohandlequotation\c!middlespeech\relax + \else + \doglobal\settrue\insidespeech + \fi\fi} + +\unexpanded\def\speech% + {\doglobal\increment\speechlevel\relax + \dohandlequotation\c!leftspeech\relax + \groupedcommand + {\ignorespaces} + {\dohandlequotation\c!rightspeech\unskip + \doglobal\decrement\speechlevel\relax}} + +\appendtoks \dohandlespeech \to \everypar % Tijden horen hier niet thuis en zullen in een aparte % module worden ondergebracht. voorlopig handhaven we ze nog diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex index 83d1c166b..995daf146 100644 --- a/tex/context/base/core-ntb.tex +++ b/tex/context/base/core-ntb.tex @@ -324,6 +324,10 @@ \getparameters [\@@tbl\@@tbl] [\c!uitlijnen={\v!rechts,\v!ruim,\v!hoog},#1]% + \ExpandFirstAfter\processallactionsinset + [\tbltbloptie] + [\v!rek=>\autoTBLspreadtrue]% + \linewidth=\tbltbllijndikte % needs to be frozen \dontcomplain \def\currentcol{0}% \def\maximumrowspan{1}% @@ -514,8 +518,13 @@ \settblaut\colTBL\localwidth \fi}}% \setbox0=\vbox{\the\tbltoks}% -%\ifautoTBLspread -%\else +\ifautoTBLspread + % experimental, stretch non fixed cells to \hsize + \checktblwidthsone % trial run + \checktblwidthstwo % real run + \let\handleTBLcell\dohandleTBLcellB + \setbox\scratchbox=\vbox{\the\tbltoks}% +\else \ifdim\wd0>\hsize \ifautoTBLhsize \checktblwidthsone % trial run @@ -527,7 +536,7 @@ \let\handleTBLcell\dohandleTBLcellC \setbox\scratchbox=\vbox{\the\tbltoks}% \fi\fi\fi -%\fi +\fi \let\handleTBLcell\dohandleTBLcellD \chardef\TBLpass=2 \def\makeTBL##1##2% meer in cellD @@ -738,7 +747,7 @@ \localframed [\@@tbl\@@tbl] [#3,\c!achtergrond=,\c!kader=\v!uit]% 25% faster - {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{##1}{##2}}}% + {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}% \scratchdimen=\gettblwid\colTBL\relax \ifdim\wd\scratchbox>\scratchdimen \settblwid\colTBL{\the\wd\scratchbox}% auto set @@ -838,6 +847,7 @@ \c!strut=\v!nee, \c!karakteruitlijnen=\v!nee, \c!uitlijnkarakter={,}, +\c!optie=, % \v!rek \c!maxbreedte=8em] %D We have already prepared the previous macros for nesting, diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex index 08229e9eb..84e26650a 100644 --- a/tex/context/base/core-pos.tex +++ b/tex/context/base/core-pos.tex @@ -1508,9 +1508,9 @@ %D cells. First we define some framed backgrounds. %D %D \startbuffer -%D \definepositionframed[x][background=color,fillcolor=red] -%D \definepositionframed[y][background=color,fillcolor=green] -%D \definepositionframed[z][background=color,fillcolor=blue] +%D \definepositionframed[x][background=color,backgroundcolor=red] +%D \definepositionframed[y][background=color,backgroundcolor=green] +%D \definepositionframed[z][background=color,backgroundcolor=blue] %D \stopbuffer %D %D \typebuffer @@ -1585,10 +1585,10 @@ %D %D % \haalbuffer -% \definepositionframed[w][background=color,fillcolor=yellow] -% \definepositionframed[x][background=color,fillcolor=red] -% \definepositionframed[y][background=color,fillcolor=green] -% \definepositionframed[z][background=color,fillcolor=blue] +% \definepositionframed[w][background=color,backgroundcolor=yellow] +% \definepositionframed[x][background=color,backgroundcolor=red] +% \definepositionframed[y][background=color,backgroundcolor=green] +% \definepositionframed[z][background=color,backgroundcolor=blue] % % \starttabulate[|c|c|c|] % \NC this is a small \NC table \NC in which we \NC \FR diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex index 85996d5ba..41f5d4577 100644 --- a/tex/context/base/core-rul.tex +++ b/tex/context/base/core-rul.tex @@ -622,7 +622,10 @@ {\bgroup \inframedtrue \edef\@@framed{#1}% - % this piece of pre expansion is needed +% % this piece of pre expansion is needed (sometimes used in frameoffset) +% \doifvaluesomething{\@@framed\c!lijndikte} +% {\linewidth=\getvalue{\@@framed\c!lijndikte}}% + % this piece of pre expansion is needed (sometimes used circular) \scratchdimen\getvalue{\@@framed\c!kaderoffset}% \setevalue{\@@framed\c!kaderoffset}{\the\scratchdimen}% \doifnotvalue{\@@framed\c!achtergrondoffset}{\v!kader} diff --git a/tex/context/base/core-syn.tex b/tex/context/base/core-syn.tex index 65dc1b7a0..190c04b69 100644 --- a/tex/context/base/core-syn.tex +++ b/tex/context/base/core-syn.tex @@ -322,7 +322,7 @@ \def\docomplexsort[#1][#2][#3]#4% {\ifthirdargument - \dodocomplexsort[#2][#1#3]{#4} + \dodocomplexsort[#2][#1#3]{#4}% \else \dowritesort{#2}{#4}{#4}% \fi} diff --git a/tex/context/base/core-sys.tex b/tex/context/base/core-sys.tex index 044fb9a52..bcc3f6173 100644 --- a/tex/context/base/core-sys.tex +++ b/tex/context/base/core-sys.tex @@ -176,7 +176,7 @@ [\getvalue{#1\c!expansie}] [ \v!ja=>{{\honorunexpanded\xdef\@@globalexpanded{#2}% \xdef\@@globalexpanded{\@@globalexpanded}}% - \dodoglobal\convertcommand\@@globalexpanded\to#3}, + \dodoglobal\convertcommand\@@globalexpanded\to#3}, \v!commando=>{\dodoglobal\convertcommand #2\to#3}, \s!default=>{\dodoglobal\convertargument#2\to#3}, \s!unknown=>{\dodoglobal\convertargument#2\to#3}]} diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex index f34e38340..a94b41c5b 100644 --- a/tex/context/base/lang-ini.tex +++ b/tex/context/base/lang-ini.tex @@ -231,6 +231,9 @@ \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, + \c!leftspeech=\getvalue{\??la#1\c!leftquotation}, +\c!middlespeech=, + \c!rightspeech=\getvalue{\??la#1\c!rightquotation}, \c!datum={\v!jaar,\ ,\v!maand,\ ,\v!dag}, \c!status=\v!stop, \c!default=, @@ -253,6 +256,9 @@ \c!rightquote=\languagedefault{#1}\c!rightquote, \c!leftquotation=\languagedefault{#1}\c!leftquotation, \c!rightquotation=\languagedefault{#1}\c!rightquotation, + \c!leftspeech=\languagedefault{#1}\c!leftspeech, +\c!middlespeech=\languagedefault{#1}\c!middlespeech, + \c!rightspeech=\languagedefault{#1}\c!rightspeech, \c!datum=\languagedefault{#1}\c!datum, \s!mapping=\languagedefault{#1}\s!mapping, \s!encoding=\languagedefault{#1}\s!encoding, diff --git a/tex/context/base/lang-ita.tex b/tex/context/base/lang-ita.tex index d933ba005..e4bbd19ab 100644 --- a/tex/context/base/lang-ita.tex +++ b/tex/context/base/lang-ita.tex @@ -72,6 +72,9 @@ \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, + \c!leftspeech=\leftguillemot, + \c!middlespeech=\leftguillemot, + \c!rightspeech=\rightguillemot, \c!datum={\v!dag,\ ,\v!maand,\ ,\v!jaar}, \c!status=\v!stop] diff --git a/tex/context/base/math-ini.tex b/tex/context/base/math-ini.tex index 3a2b17d14..3e02d7dbc 100644 --- a/tex/context/base/math-ini.tex +++ b/tex/context/base/math-ini.tex @@ -37,12 +37,12 @@ \def\@@mathboxcomm #1{\leavevmode\hbox{$\m@th#1$}} \chardef\mathordcode = 0 \let\mathordcomm \mathord -\chardef\mathopcode = 1 \let\mathopcomm \mathop -\chardef\mathbincode = 2 \let\mathbincomm \mathbin +\chardef\mathopcode = 1 \let\mathopcomm \mathop +\chardef\mathbincode = 2 \let\mathbincomm \mathbin \chardef\mathrelcode = 3 \let\mathrelcomm \mathrel -\chardef\mathopencode = 4 \let\mathopencomm \mathopen -\chardef\mathclosecode = 5 \let\mathclosecomm \mathclose -\chardef\mathpunctcode = 6 \let\mathpunctcomm \mathpunct +\chardef\mathopencode = 4 \let\mathopencomm \mathopen +\chardef\mathclosecode = 5 \let\mathclosecomm \mathclose +\chardef\mathpunctcode = 6 \let\mathpunctcomm \mathpunct \chardef\mathalphacode = 7 \let\mathalphacomm \firstofoneargument \chardef\mathinnercode = 0 \let\mathinnercomm \mathinner \chardef\mathnothingcode= 0 \let\mathnothingcomm \firstofoneargument @@ -279,15 +279,20 @@ \fi} \def\definemathcommand% - {\dodoubleempty\dodefinemathcommand} + {\dotripleempty\dodefinemathcommand} -\def\dodefinemathcommand[#1][#2]#3% +\def\dodefinemathcommand[#1][#2][#3]#4% command class args meaning {\unexpanded\setgvalue{#1}{\dohandlemathtoken{#1}}% - \ifsecondargument - \setvalue{\@mt@\mathcollection#1}{\puremathcomm{#2}{#3}}% + \ifthirdargument + \processaction + [#3] + [one=>\setvalue{\@mt@\mathcollection#1}##1{\puremathcomm{#2}{#4{##1}}}, + two=>\setvalue{\@mt@\mathcollection#1}##1##2{\puremathcomm{#2}{#4{##1}{##2}}}]% + \else\ifsecondargument + \setvalue{\@mt@\mathcollection#1}{\puremathcomm{#2}{#4}}% \else - \setvalue{\@mt@\mathcollection#1}{\puremathcomm{nothing}{#3}}% - \fi + \setvalue{\@mt@\mathcollection#1}{\puremathcomm{nothing}{#4}}% + \fi\fi \tracemathcommand{#1}} \def\tracemathcommand#1% diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex index afd60c2fa..2cc88200f 100644 --- a/tex/context/base/math-tex.tex +++ b/tex/context/base/math-tex.tex @@ -436,18 +436,18 @@ \startrawmathcollection [default] -\definemathcommand [bigl] [open] {\big} -\definemathcommand [bigm] [rel] {\big} -\definemathcommand [bigr] [close] {\big} -\definemathcommand [Bigl] [open] {\Big} -\definemathcommand [Bigm] [rel] {\Big} -\definemathcommand [Bigr] [close] {\Big} -\definemathcommand [biggl] [open] {\bigg} -\definemathcommand [biggm] [rel] {\bigg} -\definemathcommand [biggr] [close] {\bigg} -\definemathcommand [Biggl] [open] {\Bigg} -\definemathcommand [Biggm] [rel] {\Bigg} -\definemathcommand [Biggr] [close] {\Bigg} +\definemathcommand [bigl] [open] [one] {\big} +\definemathcommand [bigm] [rel] [one] {\big} +\definemathcommand [bigr] [close] [one] {\big} +\definemathcommand [Bigl] [open] [one] {\Big} +\definemathcommand [Bigm] [rel] [one] {\Big} +\definemathcommand [Bigr] [close] [one] {\Big} +\definemathcommand [biggl] [open] [one] {\bigg} +\definemathcommand [biggm] [rel] [one] {\bigg} +\definemathcommand [biggr] [close] [one] {\bigg} +\definemathcommand [Biggl] [open] [one] {\Bigg} +\definemathcommand [Biggm] [rel] [one] {\Bigg} +\definemathcommand [Biggr] [close] [one] {\Bigg} \definemathcommand [big] {\PLAINbig} \definemathcommand [Big] {\PLAINBig} diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex index 68367053d..bbf1959b5 100644 --- a/tex/context/base/mult-con.tex +++ b/tex/context/base/mult-con.tex @@ -343,6 +343,17 @@ rightsubsentence: rechtersubzin rightsubsentence rechtersubsatz podvetavpravo sottofrasedestra subpropozitiedreapta + + leftspeech: linkeruitspraak leftspeech + leftspeech leftspeech + leftspeech leftspeech %%% + middlespeech: middenuitspraak middlespeech + middlespeech middlespeech + middlespeech middlespeech %%% + rightspeech: rechteruitspraak rightspeech + rightspeech rightspeech + rightspeech rightspeech %%% + datum: datum date datum datum data data diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex index 046ffe2db..7fa91515f 100644 --- a/tex/context/base/mult-sys.tex +++ b/tex/context/base/mult-sys.tex @@ -542,6 +542,7 @@ \definefileconstant {temporaryextension} {tmp} \definefileconstant {patternsextension} {pat} \definefileconstant {hyphensextension} {hyp} +\definefileconstant {fontmapextension} {map} %D These files are loaded at start||up. They may contain system %D specific setups (or calls to other files), old macro's, to diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex index bc08ad440..b013bb917 100644 --- a/tex/context/base/page-imp.tex +++ b/tex/context/base/page-imp.tex @@ -628,19 +628,27 @@ \def\docopypages[#1][#2]% {\bgroup \getfiguredimensions[#1]% - \getparameters[\??ip][\c!n=\noffigurepages,\c!schaal=\!!thousand,\c!offset=\!!zeropoint,#2]% + \getparameters[\??ip] + [\c!n=\noffigurepages, + \c!markering=\v!uit, + \c!schaal=\!!thousand, + \c!offset=\!!zeropoint, + #2]% \dorecurse{\@@ipn} {\vbox to \teksthoogte {\hsize=\tekstbreedte \scratchdimen=\@@ipoffset \centeredbox - {\ifdim\scratchdimen>\!!zeropoint\relax - \advance\vsize by -2\scratchdimen - \advance\hsize by -2\scratchdimen - \externalfigure[#1][\c!pagina=\recurselevel,#2,\c!schaal=,\c!factor=\v!max,\c!offset=\v!overlay]% - \else - \externalfigure[#1][\c!pagina=\recurselevel,#2,\c!offset=\v!overlay]% - \fi}} + {\doifelse{\@@ipmarkering}{\v!aan} + {\let\next\cuthbox}{\let\next\hbox}% + \next + {\ifdim\scratchdimen>\!!zeropoint\relax + \advance\vsize by -2\scratchdimen + \advance\hsize by -2\scratchdimen + \externalfigure[#1][\c!pagina=\recurselevel,#2,\c!schaal=,\c!factor=\v!max,\c!offset=\v!overlay]% + \else + \externalfigure[#1][\c!pagina=\recurselevel,#2,\c!offset=\v!overlay]% + \fi}}} \pagina} \egroup} diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex index cfc3e89ce..590c203bc 100644 --- a/tex/context/base/spec-fdf.tex +++ b/tex/context/base/spec-fdf.tex @@ -23,14 +23,19 @@ %D The \ACROBAT\ programs are not bug free. By setting the next %D switch, we will at least try to prevent problems. -\newif\ifovercomePDFbugs \overcomePDFbugsfalse % true +\newif\ifovercomePDFbugs \overcomePDFbugsfalse % true +\newif\ifovercomePDFspace \overcomePDFspacetrue \def\setPDFdestination#1% {\bgroup \obeylccodes \lccode`\/=`-\lccode`\#=`-\lccode`\<=`-\lccode`\>=`-% \lccode`\[=`-\lccode`\]=`-\lccode`\(=`-\lccode`\)=`-% - \stripcharacter{ }\from#1\to\PDFdestination + \ifovercomePDFspace + \stripcharacter{ }\from#1\to\PDFdestination + \else + \xdef\PDFdestination{#1}% + \fi \@EA\lowercase\@EA{\@EA\xdef\@EA\PDFdestination\@EA {\ifovercomePDFbugs'\fi\PDFdestination\ifovercomePDFbugs'\fi}}% \egroup} diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex index c1f1299a0..eba8e7735 100644 --- a/tex/context/base/supp-lan.tex +++ b/tex/context/base/supp-lan.tex @@ -714,6 +714,79 @@ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \nextnextnext} +%D Since most things in \CONTEXT\ are configurable, we +%D slightly change the previous definition so that we can +%D install new functionality outside this module. + +\def\activedododotextmodediscretionary#1#2% + {\convertargument#2\to\discretionarytoken + \def\textmodediscretionary{\getvalue{textmodediscretionary\string#1}}% + \ifx#1\nextnext % takes care of ||| and +++ and ...... + \prewordbreak\discretionary{\hbox{$#1$}}{}{\hbox{$#1$}}% + \allowbreak\postwordbreak + \def\nextnextnext{\afterassignment\egroup\let\next=}% + \else\ifx\discretionarytoken\empty + \checkafterdiscretionary + \bgroup + \checkbeforediscretionary + \prewordbreak\hbox{\textmodediscretionary\nextnext}\allowbreak\postwordbreak + \egroup + \else\expandafter\ifx\csname @tmd@\discretionarytoken\endcsname\relax + \checkafterdiscretionary + \bgroup + \checkbeforediscretionary + \prewordbreak + \discretionary{\hbox{#2}}{}{\hbox{#2}}% + \allowbreak\postwordbreak + \egroup + \else + \csname @tmd@\discretionarytoken\endcsname + \fi\fi\fi + \nextnextnext} + +\def\definetextmodediscretionary #1 + {\convertargument#1\to\ascii + \setvalue{@tmd@\ascii}} + +\definetextmodediscretionary = + {\prewordbreak\textmodediscretionary} + +\definetextmodediscretionary ~ + {\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak} + +\definetextmodediscretionary _ + {\prewordbreak\discretionary{\textmodediscretionary} + {\textmodediscretionary}{\textmodediscretionary}\prewordbreak} + +\definetextmodediscretionary ( + {\ifdim\lastskip>\zeropoint + (\prewordbreak + \else + \prewordbreak\discretionary{}{(-}{(}\prewordbreak + \fi} + +\definetextmodediscretionary ) + {\ifx\nextnext\blankspace + \prewordbreak)\relax + \else\ifx\nextnext\space + \prewordbreak)\relax + \else + \prewordbreak\discretionary{-)}{}{)}\prewordbreak + \fi\fi} + +\definetextmodediscretionary ' + {\prewordbreak\discretionary{-}{}{'}\postwordbreak} + +\definetextmodediscretionary < + {\beginofsubsentence\prewordbreak\beginofsubsentencespacing} + +\definetextmodediscretionary > + {\endofsubsentencespacing\prewordbreak\endofsubsentence} + +\definetextmodediscretionary ^ + {\prewordbreak\discretionary{\hbox{$|$}}{}{\hbox{$|$}}% + \allowbreak\postwordbreak} + %D Since we don't have to bother about active characters any %D longer, we end up with a pretty simple activating macro: diff --git a/tex/context/base/symb-eur.tex b/tex/context/base/symb-eur.tex index 7b21ffa2e..dafed479f 100644 --- a/tex/context/base/symb-eur.tex +++ b/tex/context/base/symb-eur.tex @@ -32,6 +32,8 @@ \definefontsynonym [EuroMonoBoldItalic] [euromobi] \definefontsynonym [EuroMonoBoldSlanted] [euromobi] +\loadmapfile [original-adobe-euro.map] + \definesymbol [euro] [\getglyph{Euro}{\char160}] \unexpanded\def\euro{\symbol[euro]} diff --git a/tex/context/base/symb-nav.tex b/tex/context/base/symb-nav.tex index ad802f729..2e1bc07e2 100644 --- a/tex/context/base/symb-nav.tex +++ b/tex/context/base/symb-nav.tex @@ -13,6 +13,10 @@ \unprotect +\definefontsynonym [ContextNavigation] [contnav] + +\loadmapfile [original-context-symbol.map] + \def\ContextNavigationGlyph#1{\getglyph{ContextNavigation}{\char#1}} \startsymbolset [navigation 1] diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex index 01a88d803..9b64e25ae 100644 --- a/tex/context/base/syst-ext.tex +++ b/tex/context/base/syst-ext.tex @@ -2032,13 +2032,13 @@ %D Splitting the value and the unit is done by: \def\withoutunit#1#2% - {\bgroup + {\begingroup \dimen0=#1\relax \@EA\convertargument\the\dimen0\to\asciiA \@EA\convertargument#2\to\asciiB \@EA\@EA\@EA\beforesplitstring\@EA\asciiA\@EA\at\asciiB\to\!!stringa% \!!stringa - \egroup} + \endgroup} \def\withoutpt#1% {\withoutunit{#1}{pt}} @@ -2066,11 +2066,11 @@ %D in the following way too. \def\PtToCm#1% - {\bgroup + {\begingroup \scratchdimen=#1\relax \scratchdimen=0.0351459804\scratchdimen % 2.54/72.27 \withoutpt{\the\scratchdimen}cm% - \egroup} + \endgroup} %D We also support: %D @@ -2268,7 +2268,7 @@ {\afterassignment\dodoprocesstokens\let\nextprocessedtoken= } \def\processtokens#1#2#3#4#5% - {\bgroup + {\begingroup \def\lastcharacter{\lastcharacter}% \def\space{ }% \let\\=\space @@ -2278,7 +2278,7 @@ \def\white{#4}% \let\savedbefore\before \doprocesstokens#5\lastcharacter - \egroup} + \endgroup} %D \macros %D {doifvalue,doifnotvalue,doifelsevalue, @@ -2748,7 +2748,7 @@ %D sort. \def\untexsomething% - {\bgroup + {\begingroup \catcode`\{=\@@ignore \catcode`\}=\@@ignore \escapechar=-1 @@ -2756,7 +2756,7 @@ \long\def\dountexsomething#1#2\to#3% {\doglobal#1#2\to\untexedargument - \egroup + \endgroup \let#3=\untexedargument} \def\untexargument% @@ -3138,13 +3138,13 @@ %D This macro is first used in the tabulation macros. \def\processcontent#1% - {\bgroup\@EA\doprocesscontent\csname#1\endcsname} + {\begingroup\@EA\doprocesscontent\csname#1\endcsname} %\beginTEX \def\doprocesscontent#1#2#3% {\long\def\doprocesscontent##1#1% - {\egroup\long\def#2{##1}#3}% + {\endgroup\long\def#2{##1}#3}% \doprocesscontent} %\endTEX @@ -3368,6 +3368,26 @@ {\edef\!!stringa{\the#1}% \ifx\!!stringa\empty#3\else#2\fi} +%D \macros +%D {startstrictinspectnextcharacter} +%D +%D This one if for Taco's bibliography module: + +\let\normalinspectnextcharacter\inspectnextcharacter + +\def\strictinspectnextcharacter% no user macro ! + {\ifx\nexttoken\charactertoken + \expandafter\!!stringa + \else + \expandafter\!!stringb + \fi} + +\def\startstrictinspectnextcharacter + {\let\inspectnextcharacter\strictinspectnextcharacter} + +\def\stopstrictinspectnextcharacter + {\let\inspectnextcharacter\normalinspectnextcharacter} + \protect \endinput diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex index 89d7e9bd3..5ee3299f5 100644 --- a/tex/context/base/syst-gen.tex +++ b/tex/context/base/syst-gen.tex @@ -711,15 +711,15 @@ %D {\doifundefinedelse{#1}{}{#2}} %D %D \def\doifalldefinedelse#1#2#3% -%D {\bgroup +%D {\begingroup %D \donetrue %D \def\checkcommand##1% %D {\doifundefined{##1}{\donefalse}}% %D \processcommalist[#1]\checkcommand %D \ifdone -%D \egroup#2% +%D \endgroup#2% %D \else -%D \egroup#3% +%D \endgroup#3% %D \fi} %D \stoptypen %D @@ -838,7 +838,7 @@ %D \stoptypen %D %D A even more previous version used \type{\bgroup} and -%D \type{\egroup}. In math mode however, \type{$1{x}2$} differs +%D \type {\egroup}. In math mode however, \type{$1{x}2$} differs %D from \type{$1x2$}. This can been seen when one compares the %D output of: %D @@ -848,6 +848,9 @@ %D $\kern10pt\begingroup\showthe\lastkern\endgroup$ %D \stoptypen %D +%D Also in math mode, one can better use \type {\begingroup} +%D and companion instead of \type {\bgroup}. +%D %D When we were developing the scientific units module, we %D encountered different behavior in text and math mode, which %D was due to this grouping subtilities. We therefore decided @@ -1421,13 +1424,13 @@ %D One way of quitting a commalist halfway is: \def\quitcommalist% - {\bgroup\let\doprocesscommaitem\doquitcommalist} + {\begingroup\let\doprocesscommaitem\doquitcommalist} \def\doquitcommalist#1]% - {\egroup} + {\endgroup} \def\quitprevcommalist% - {\bgroup\let\doprocesscommaitem\doquitprevcommalist} + {\begingroup\let\doprocesscommaitem\doquitprevcommalist} \def\doquitprevcommalist#1]% {\let\doprocesscommaitem\doquitcommalist} @@ -1959,9 +1962,9 @@ %D rather dirty one. \long\def\doifnumberelse#1#2#3% - {\bgroup\donefalse + {\begingroup\donefalse \ifcase1#1\or\or\or\or\or\or\or\or\or\else\donetrue\fi - \ifdone\egroup#2\else\egroup#3\fi} + \ifdone\endgroup#2\else\endgroup#3\fi} %D The previous implementation was: %D @@ -2510,7 +2513,7 @@ % {\advance\commalistcounter -1 % \ifcase\commalistcounter % \def\commalistelement{#1}% -% \bgroup\def\doprocesscommaitem##1]{\egroup}% +% \begingroup\def\doprocesscommaitem##1]{\endgroup}% % \fi} \def\p!dogetfromcommalist#1% @@ -3079,11 +3082,11 @@ {\firstargumentfalse\getvalue{\s!complex\nameofcommand}[]}} \def\setnameofcommand#1% - {\bgroup + {\begingroup \escapechar=-1 \globaldefs=0 % pretty important! \xdef\nameofcommand{\string#1}% - \egroup} + \endgroup} %D \macros %D {definecomplexorsimple,definecomplexorsimpleempty} @@ -3212,9 +3215,9 @@ %D \let\expectedarguments\noexpectedarguments %D \def\nextargument{#1\dodogetargument}% %D %\else\ifx\nextargument\lineending % this can be an option -%D % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}% +%D % \def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}% %D %\else\ifx\nextargument\blankspace % but it may never be default -%D % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}% +%D % \def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}% %D \else %D \ifnum\expectedarguments>\noexpectedarguments %D \writestatus @@ -3245,7 +3248,7 @@ \let\normalfi \fi \def\beginrobusttest - {\bgroup + {\begingroup \let\if \relax \let\ifx \relax \let\ifnum \relax @@ -3257,7 +3260,7 @@ \let\else \relax \let\fi \relax} -\let\endrobusttest\egroup +\let\endrobusttest\endgroup % \def\dogetgroupargument#1#2% % {\def\nextnextargument% @@ -3266,9 +3269,9 @@ % \let\expectedarguments\noexpectedarguments % \def\nextargument{#1\dodogetargument}% % %\normalelse\normalifx\nextargument\lineending % this can be an option -% % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}% +% % \def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}% % %\normalelse\normalifx\nextargument\blankspace % but may never be default -% % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}% +% % \def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}% % \normalelse % \endrobusttest % \ifnum\expectedarguments>\noexpectedarguments @@ -3288,9 +3291,9 @@ % \noshowargumenterror % \def\nextargument{#1\dodogetargument}% % %\normalelse\normalifx\nextargument\lineending % this can be an option -% % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}% +% % \def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}% % %\normalelse\normalifx\nextargument\blankspace % but may never be default -% % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}% +% % \def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}% % \normalelse % \endrobusttest % \doshowargumenterror @@ -3317,10 +3320,10 @@ \normalifcase\@@permitspacesbetweengroups \normalifx\nextargument\lineending \endrobusttest - \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}% + \def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}% \normalelse\normalifx\nextargument\blankspace \endrobusttest - \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}% + \def\nextargument{\begingroup\def\\ {\endgroup\dogetgroupargument#1#2}\\}% \normalelse \endrobusttest \doshowargumenterror @@ -3413,9 +3416,9 @@ %D \type{\wait} itself. \def\wait% - {\bgroup + {\begingroup \read16 to \wait - \egroup} + \endgroup} %D \macros %D {writestring,writeline, @@ -3460,13 +3463,13 @@ % \fi} % % \def\writestatus#1#2% -% {\bgroup +% {\begingroup % \let\messagecontentA=\empty % \edef\messagecontentB{#2}% maybe it's \the\scratchcounter % \scratchcounter=0 % \expandafter\dosplitstatus#1?\end % \writestring{\messagecontentA\space:\space\messagecontentB}% -% \egroup} +% \endgroup} \chardef\statuswidth=15 \chardef\statuswrite=16 @@ -3492,7 +3495,7 @@ {} \def\writestatus#1#2% - {\bgroup + {\begingroup \scratchtoks\emptytoks \statuscounter\statuswidth \expandafter\dosplitstatus#1% @@ -3500,7 +3503,7 @@ \space\space\space\space\space\space\space \space\space\space\space\space\space\end \expanded{\writestring{\the\scratchtoks\space:\space#2}}% - \egroup} + \endgroup} %D The next implementation saves only some 10 words of format %D memory, but we hardly gain any speed. diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex index c733145ab..9671d34d9 100644 --- a/tex/context/base/syst-new.tex +++ b/tex/context/base/syst-new.tex @@ -61,10 +61,12 @@ % \afterassignment\dodoifnonzeropositiveelse\scratchcounter=0#1\relax\empty\end} \def\dodoifnonzeropositiveelse#1#2\end#3#4% - {\ifx#1\relax\ifcase\scratchcounter\egroup#4\else\egroup#3\fi\else\egroup#4\fi} + {\ifx#1\relax + \ifcase\scratchcounter\endgroup#4\else\endgroup#3\fi\else\endgroup#4% + \fi} \def\doifnonzeropositiveelse#1% - {\bgroup\afterassignment\dodoifnonzeropositiveelse\scratchcounter=0#1\relax\empty\end} + {\begingroup\afterassignment\dodoifnonzeropositiveelse\scratchcounter=0#1\relax\empty\end} % here ? @@ -217,15 +219,15 @@ \newdimen\dimentoaddto \def\adddimenregister#1\to#2% - {\bgroup - #2=\!!zeropoint - \dimentoaddto\!!zeropoint + {\begingroup + #2=\zeropoint + \dimentoaddto\zeropoint \def\docommando% {\advance#2 by \dimentoaddto \futurelet\next\dodocommando}% \def\dodocommando% {\ifx\next\relax - \expanded{\egroup#2=\the#2}% + \expanded{\endgroup#2=\the#2}% \else \@EA\afterassignment\@EA\docommando\@EA\dimentoaddto \fi}% diff --git a/tex/context/base/type-enc.tex b/tex/context/base/type-enc.tex index 2c62b9955..cb9e14fcc 100644 --- a/tex/context/base/type-enc.tex +++ b/tex/context/base/type-enc.tex @@ -332,6 +332,24 @@ \definefontsynonym [Times-MathSymbol] [mtsy] [skewcharmi='60] \stoptypescript +\starttypescript [math] [tx] [ec] + \definefontsynonym [Times-Roman-Upright] [t1xr] [encoding=ec] + \definefontsynonym [Times-Roman-Italic] [t1xi] [encoding=ec] + \definefontsynonym [Times-Roman-Slanted] [t1xsl] [encoding=ec] + \definefontsynonym [Times-Roman-Caps] [t1xsc] [encoding=ec] + \definefontsynonym [Times-Companion-Upright] [tcxr] + \definefontsynonym [Times-Companion-Italic] [tcxi] + \definefontsynonym [Times-Companion-Slanted] [tcxsl] + \definefontsynonym [Times-Math-Italic] [txmi] + \definefontsynonym [Times-Math-Symbols] [txsy] + \definefontsynonym [Times-Math-Extension] [txex] + \definefontsynonym [Times-Math-SymbolsA] [txsya] + \definefontsynonym [Times-Math-SymbolsB] [txsyb] + \definefontsynonym [Times-Math-SymbolsC] [txsyc] + \definefontsynonym [Times-Math-Italic-A] [txmia] + \definefontsynonym [Times-Math-Extension-A] [txexa] +\stoptypescript + % Lucida Bright \starttypescript [serif] [lucida] [texnansi] @@ -493,13 +511,13 @@ % Palatino -\starttypescript [serif] [palatino] [texnansi] % brrr, wrong files - \definefontsynonym [Palatino] [uplr8t] [encoding=ec] - \definefontsynonym [Palatino-Italic] [uplri8t] [encoding=ec] - \definefontsynonym [Palatino-Slanted] [uplro8t] [encoding=ec] - \definefontsynonym [Palatino-Bold] [uplb8t] [encoding=ec] - \definefontsynonym [Palatino-BoldItalic] [uplbi8t] [encoding=ec] - \definefontsynonym [Palatino-BoldSlanted] [uplbo8t] [encoding=ec] +\starttypescript [serif] [palatino] [texnansi] + \definefontsynonym [Palatino] [p052003l] [encoding=texnansi] + \definefontsynonym [Palatino-Italic] [p052023l] [encoding=texnansi] + \definefontsynonym [Palatino-Slanted] [p052003l] [encoding=texnansi] + \definefontsynonym [Palatino-Bold] [p052004l] [encoding=texnansi] + \definefontsynonym [Palatino-BoldItalic] [p052024l] [encoding=texnansi] + \definefontsynonym [Palatino-BoldSlanted] [p052024l] [encoding=texnansi] \stoptypescript \starttypescript [serif] [palatino] [ec] @@ -511,7 +529,7 @@ \definefontsynonym [Palatino-BoldSlanted] [uplbo8t] [encoding=ec] \stoptypescript -\starttypescript [math] [palatino] [ec] +\starttypescript [math] [px,palatino] [ec] % px now, palatino obsolete ! \definefontsynonym [Palatino-Roman-Upright] [p1xr] [encoding=ec] \definefontsynonym [Palatino-Roman-Italic] [p1xi] [encoding=ec] \definefontsynonym [Palatino-Roman-Slanted] [p1xsl] [encoding=ec] @@ -531,10 +549,9 @@ % Whatever -\starttypescript % once amd for all - \definefontsynonym [ContextNavigation] [contnav] +\starttypescript % once and for all \definefontsynonym [RalfSmithFormalScript] [rsfs10] - \definefontsynonym [ZapfDingbats] [pzd] + \definefontsynonym [ZapfDingbats] [pzd] % TODO \stoptypescript \endinput diff --git a/tex/context/base/type-exa.tex b/tex/context/base/type-exa.tex index e9ce15e63..6ff33d08d 100644 --- a/tex/context/base/type-exa.tex +++ b/tex/context/base/type-exa.tex @@ -68,67 +68,67 @@ \starttypescript [serif] [hanging] [pure] -\setupfontsynonym [Serif] [hanging=pure] -\setupfontsynonym [Serif-Bold] [hanging=pure] -\setupfontsynonym [Serif-Slanted] [hanging=pure] -\setupfontsynonym [Serif-Italic] [hanging=pure] -\setupfontsynonym [Serif-BoldSlanted] [hanging=pure] -\setupfontsynonym [Serif-BoldItalic] [hanging=pure] +\setupfontsynonym [Serif] [handling=pure] +\setupfontsynonym [SerifBold] [handling=pure] +\setupfontsynonym [SerifSlanted] [handling=pure] +\setupfontsynonym [SerifItalic] [handling=pure] +\setupfontsynonym [SerifBoldSlanted] [handling=pure] +\setupfontsynonym [SerifBoldItalic] [handling=pure] \stoptypescript \starttypescript [sans] [hanging] [pure] -\setupfontsynonym [Sans] [hanging=pure] -\setupfontsynonym [Sans-Bold] [hanging=pure] -\setupfontsynonym [Sans-Slanted] [hanging=pure] -\setupfontsynonym [Sans-Italic] [hanging=pure] -\setupfontsynonym [Sans-BoldSlanted] [hanging=pure] -\setupfontsynonym [Sans-BoldItalic] [hanging=pure] +\setupfontsynonym [Sans] [handling=pure] +\setupfontsynonym [SansBold] [handling=pure] +\setupfontsynonym [SansSlanted] [handling=pure] +\setupfontsynonym [SansItalic] [handling=pure] +\setupfontsynonym [SansBoldSlanted] [handling=pure] +\setupfontsynonym [SansBoldItalic] [handling=pure] \stoptypescript \starttypescript [mono] [hanging] [pure] -\setupfontsynonym [Mono] [hanging=pure] -\setupfontsynonym [Mono-Bold] [hanging=pure] -\setupfontsynonym [Mono-Slanted] [hanging=pure] -\setupfontsynonym [Mono-Italic] [hanging=pure] -\setupfontsynonym [Mono-BoldSlanted] [hanging=pure] -\setupfontsynonym [Mono-BoldItalic] [hanging=pure] +\setupfontsynonym [Mono] [handling=pure] +\setupfontsynonym [MonoBold] [handling=pure] +\setupfontsynonym [MonoSlanted] [handling=pure] +\setupfontsynonym [MonoItalic] [handling=pure] +\setupfontsynonym [MonoBoldSlanted] [handling=pure] +\setupfontsynonym [MonoBoldItalic] [handling=pure] \stoptypescript \starttypescript [serif] [hanging] [thanh] -\setupfontsynonym [Serif] [hanging=normal] -\setupfontsynonym [Serif-Bold] [hanging=bold] -\setupfontsynonym [Serif-Slanted] [hanging=slanted] -\setupfontsynonym [Serif-Italic] [hanging=italic] -\setupfontsynonym [Serif-BoldSlanted] [hanging=boldslanted] -\setupfontsynonym [Serif-BoldItalic] [hanging=bolditalic] +\setupfontsynonym [Serif] [handling=normal] +\setupfontsynonym [SerifBold] [handling=bold] +\setupfontsynonym [SerifSlanted] [handling=slanted] +\setupfontsynonym [SerifItalic] [handling=italic] +\setupfontsynonym [SerifBoldSlanted] [handling=boldslanted] +\setupfontsynonym [SerifBoldItalic] [handling=bolditalic] \stoptypescript \starttypescript [sans] [hanging] [thanh] -\setupfontsynonym [Sans] [hanging=normal] -\setupfontsynonym [Sans-Bold] [hanging=bold] -\setupfontsynonym [Sans-Slanted] [hanging=slanted] -\setupfontsynonym [Sans-Italic] [hanging=italic] -\setupfontsynonym [Sans-BoldSlanted] [hanging=boldslanted] -\setupfontsynonym [Sans-BoldItalic] [hanging=bolditalic] +\setupfontsynonym [Sans] [handling=normal] +\setupfontsynonym [SansBold] [handling=bold] +\setupfontsynonym [SansSlanted] [handling=slanted] +\setupfontsynonym [SansItalic] [handling=italic] +\setupfontsynonym [SansBoldSlanted] [handling=boldslanted] +\setupfontsynonym [SansBoldItalic] [handling=bolditalic] \stoptypescript \starttypescript [mono] [hanging] [thanh] -\setupfontsynonym [Mono] [hanging=normal] -\setupfontsynonym [Mono-Bold] [hanging=bold] -\setupfontsynonym [Mono-Slanted] [hanging=slanted] -\setupfontsynonym [Mono-Italic] [hanging=italic] -\setupfontsynonym [Mono-BoldSlanted] [hanging=boldslanted] -\setupfontsynonym [Mono-BoldItalic] [hanging=bolditalic] +\setupfontsynonym [Mono] [handling=normal] +\setupfontsynonym [MonoBold] [handling=bold] +\setupfontsynonym [MonoSlanted] [handling=slanted] +\setupfontsynonym [MonoItalic] [handling=italic] +\setupfontsynonym [MonoBoldSlanted] [handling=boldslanted] +\setupfontsynonym [MonoBoldItalic] [handling=bolditalic] \stoptypescript diff --git a/tex/context/base/type-ini.tex b/tex/context/base/type-ini.tex index 0fbe16289..02a49bb8e 100644 --- a/tex/context/base/type-ini.tex +++ b/tex/context/base/type-ini.tex @@ -30,9 +30,8 @@ \usetypescriptfile[\f!typeprefix spe] % special macros \usetypescriptfile[\f!typeprefix exa] % some examples \usetypescriptfile[\f!typeprefix loc] % local scripts -% [\f!typeprefix pre] % predefined scripts (compatible) - -% \usetypescriptfile[typeface] % project scripts +%usetypescriptfile[\f!typeprefix pre] % predefined scripts (compatible) +%usetypescriptfile[typeface] % project scripts \let\currenttypescripts\empty @@ -141,14 +140,34 @@ % in run time user type scripts \fi\fi} +\let\allfontmapsfiles\empty \newif\ifautoloadmapfiles + \def\loadmapfile[#1]% - {\processcommalist[#1]\doloadmapfile} + {\def\docommando##1% + {\doifinstringelse{.}{#1} + {\doglobal\addtocommalist{#1}\allfontmapsfiles} + {\expanded{\docommando{#1.\f!fontmapmapextension}}}}% + \processcommalist[#1]\docommando} + +\def\doloadfontmapfile#1% will be special + {\ifcase\realpageno + % can't happen + \or + \writestatus{pdftex}{using map file: #1}% + \pdfmapfile{+#1}% + \else + \writestatus{pdftex}{skipping map file: #1}% + \fi} -\def\doloadmapfile#1% will be special - {\ifcase\pdfoutput\else\ifx\pdfmapfile\undefined\else - \doifundefined{map+#1} - {\global\letvalue{map+#1}\empty\pdfmapfile{+#1}}% - \fi\fi} +\def\loadallfontmapfiles + {\ifautoloadmapfiles \ifx\allfontmapsfiles\empty \else + \ifcase\pdfoutput\else \ifx\pdfmapfile\undefined \else + \processcommacommand[\allfontmapsfiles]\doloadfontmapfile + \global\let\allfontmapsfiles\empty + \fi \fi + \fi \fi} + +\appendtoks \loadallfontmapfiles \to \everybeforeshipout % \definetypeface [#1:joke] [#2:rm] % \definetypeface [#1:joke] [#2:rm] [#3:...] diff --git a/tex/context/base/type-map.tex b/tex/context/base/type-map.tex index db9bbb1c3..455ca7abc 100644 --- a/tex/context/base/type-map.tex +++ b/tex/context/base/type-map.tex @@ -11,16 +11,55 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\starttypescript [all] [helvetica] [all] - \loadmapfile[mphv.map] +\starttypescript + \loadmapfile[original-ams-cmr.map] + \loadmapfile[original-ams-euler.map] \stoptypescript -\starttypescript [all] [informal] [all] - \loadmapfile[mpif.map] +\starttypescript [all] [computer-modern,euler,ams] [il2] + \loadmapfile[il2-ams-cmr.map] \stoptypescript -\starttypescript [all] [palatino] [all] - \loadmapfile[pxr.map] +\starttypescript [all] [computer-modern,euler,ams] [pl0] + \loadmapfile[pl0-ams-cmr.map] +\stoptypescript + +\starttypescript [all] [lucida] [texnansi] + \loadmapfile[texnansi-bh-lucida.map] +\stoptypescript + +\starttypescript [all] [times,helvetica,courier] [texnansi] + \loadmapfile[texnansi-adobe-standard.map] +\stoptypescript + +\starttypescript [all] [px] [ec] + \loadmapfile[ec-youngryu-px.map] +\stoptypescript + +\starttypescript [all] [tx] [ec] + \loadmapfile[ec-youngryu-tx.map] +\stoptypescript + +\starttypescript [all] [antykwa-torunska] [texnansi] + \loadmapfile[texnansi-gust-antyktor.map] +\stoptypescript + +\starttypescript [all] [antykwa-poltawskiego] [texnansi] + \loadmapfile[texnansi-gust-antykpol.map] +\stoptypescript + +\starttypescript [all] [palatino] [texnansi] + \loadmapfile[texnansi-urw-palatino.map] +\stoptypescript + +% to do + +\starttypescript [math] [helvetica] [all] + \loadmapfile[original-micropress-helvetica.map] +\stoptypescript + +\starttypescript [serif,math] [informal] [all] + \loadmapfile[original-micropress-informal.map] \stoptypescript \endinput diff --git a/tex/context/base/type-siz.tex b/tex/context/base/type-siz.tex index fdc743cf4..174c4a4f3 100644 --- a/tex/context/base/type-siz.tex +++ b/tex/context/base/type-siz.tex @@ -533,7 +533,7 @@ \starttypescript [math] [ams] [size] \definebodyfont [17.3pt,14.4pt,12pt,11pt,10pt,9pt] [mm] [ma=msam10 sa 1, - mb=msam10 sa 1] + mb=msbm10 sa 1] \definebodyfont [8pt,7pt] [mm] [ma=msam7 sa 1, mb=msbm7 sa 1] diff --git a/tex/context/base/type-syn.tex b/tex/context/base/type-syn.tex index 96ee5a665..b6e22521a 100644 --- a/tex/context/base/type-syn.tex +++ b/tex/context/base/type-syn.tex @@ -176,6 +176,16 @@ \definefontsynonym [SerifCaps] [AntykwaTorunska-Regular] \stoptypescript +\starttypescript [serif] [antykwa-poltawskiego] [name] + \definefontsynonym [Serif] [AntykwaPoltawskiego-Regular] + \definefontsynonym [SerifBold] [AntykwaPoltawskiego-Bold] + \definefontsynonym [SerifItalic] [AntykwaPoltawskiego-Italic] + \definefontsynonym [SerifSlanted] [AntykwaPoltawskiego-Italic] + \definefontsynonym [SerifBoldItalic] [AntykwaPoltawskiego-Bold] + \definefontsynonym [SerifBoldSlanted] [AntykwaPoltawskiego-Bold] + \definefontsynonym [SerifCaps] [AntykwaPoltawskiego-Regular] +\stoptypescript + % Baskerville : \starttypescript [serif] [baskerville] [name] @@ -219,6 +229,15 @@ \definefontsynonym [MathSymbol] [Times-MathSymbol] \stoptypescript +\starttypescript [math] [tx] [name] + \definefontsynonym [MathRoman] [Times-Roman-Upright] + \definefontsynonym [MathExtension] [Times-Math-Extension] + \definefontsynonym [MathItalic] [Times-Math-Italic] + \definefontsynonym [MathSymbol] [Times-Math-Symbols] + \definefontsynonym [MathAlpha] [Times-Math-SymbolsA] + \definefontsynonym [MathBeta] [Times-Math-SymbolsB] +\stoptypescript + % Helvetica : \starttypescript [sans] [helvetica] [name] @@ -250,7 +269,7 @@ \definefontsynonym [MonoCaps] [Courier] \stoptypescript -% Palatino : Hermann Zapf +% Palatino : Hermann Zapf / UWR \starttypescript [serif] [palatino] [name] \definefontsynonym [Serif] [Palatino] @@ -259,7 +278,7 @@ \definefontsynonym [SerifSlanted] [Palatino-Slanted] \definefontsynonym [SerifBoldItalic] [Palatino-BoldItalic] \definefontsynonym [SerifBoldSlanted] [Palatino-BoldSlanted] - \definefontsynonym [SerifCaps] [Palatino] + \definefontsynonym [SerifCaps] [Palatino] % -Caps \stoptypescript \starttypescript [math] [palatino] [name] diff --git a/tex/context/base/x-fig-00.tex b/tex/context/base/x-fig-00.tex index f5ab3e963..38e0edbfa 100644 --- a/tex/context/base/x-fig-00.tex +++ b/tex/context/base/x-fig-00.tex @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% 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: @@ -98,6 +100,8 @@ \stopXMLnamespace +\newcounter\figurefilepage + \def\figbase@StartFigure% {\bgroup} @@ -148,13 +152,15 @@ \fi \fi} -\let\figurebaselist\empty - \def\usefigurebase[#1]% {\doifelse{#1}{\v!reset} {\let\figurebaselist\empty} {\appendtocommalist{#1}\figurebaselist}} +\let\figurebaselist\empty + +\resetfigurefilebase + \protect \endinput \usefigurebase[figtest] diff --git a/tex/context/base/x-fig-01.tex b/tex/context/base/x-fig-01.tex index b64992a6f..72a808504 100644 --- a/tex/context/base/x-fig-01.tex +++ b/tex/context/base/x-fig-01.tex @@ -45,9 +45,14 @@ %D \som the labels can be accessed in an index and list at %D the end of the document %D \stopopsomming +%D +%D We use named destinations, which means that one can +%D access a figure by name from an external application. \usemodule[fig-00] +\overcomePDFspacefalse + \doifnothing {\inputfilename} {\end} \doiffileelse {\inputfilename.xml} {} {\end} @@ -83,7 +88,7 @@ \defineXMLpush[comment] \defineXMLpush[status]} -\defineoverlay[page][\overlaybutton{to:\CurrentPage}] +\defineoverlay[page][\overlaybutton{Description}] \startbuffer \framed @@ -99,7 +104,11 @@ \def\StopFigureA% {\doglobal\increment\CurrentPage \setupbackgrounds[page][background=page] - \pagereference[from:\CurrentPage] + \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} @@ -161,10 +170,15 @@ \def\StopFigureB% {\par \doglobal\increment\CurrentPage + \doifelsenothing{\XMLpop{label}} + {\expanded{\definereference[Figure][\XMLpop{file}]}} + {\expanded{\definereference[Figure][\XMLpop{label}]}}% \button {\hbox to \hsize {\forgetall \dontcomplain - \pagereference[to:\CurrentPage]% + \doifelsenothing{\XMLpop{label}} + {\pagereference[about: \XMLpop{file}]} + {\pagereference[about: \XMLpop{label}]}% \expanded{\writetolist[figurelist]{\CurrentPage}{\XMLpop{label}}}% \expanded{\figureindex{\CurrentPage}{\XMLpop{label}}}% \startnotmode[compact]% @@ -203,14 +217,8 @@ \stopmode \vfill}% \advance\hsize by -40pt -% \startnotmode[compact]% -% \hskip20pt -% \advance\hsize by -20pt -% \stopnotmode -% \startmode[compact]% - \hskip10pt - \advance\hsize by -10pt -% \stopmode + \hskip10pt + \advance\hsize by -10pt \vbox to 100pt {\blank[disable] \starttabulate[|Bel|p|] @@ -232,7 +240,7 @@ {} \stoptabulate \vfill}}}% - [from:\CurrentPage] + [Figure] \vskip10pt \egroup} diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index fed3e7c2b..fa61cca94 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -186,6 +186,7 @@ .gdef.enableXML* B.catcode`.!=.@@other* + .catcode`."=.@@other* .catcode`.?=.@@other* .catcode`.&=.@@active .let&=.doXMLentity* .catcode`.<=.@@active .unexpanded.def} was converted into +%D \type {\begSGML[command]} and optional parameters were +%D passed. +%D +%D A second method is to use a \PERL\ or \XSL\ transformation +%D script that produces \CONTEXT\ commands. This method is +%D much slower, mainly because the whole document is read into +%D memory and a document tree is to be build. The advantage is +%D that processing of the resulting document is fast. +%D +%D The third method uses a basic parser written in the \TEX\ +%D language, and apart from a few pitfalls, this method is +%D clean and efficient, but not always robust. Because errors +%D in the input are not catched on forhand, processing in +%D \TEX\ may fail due to errors. But, given that a document +%D can be validated on forehand, this is no big problem. +%D +%D Each method has it's advantage, but especially the third +%D method puts some demands on \CONTEXT, since no interference +%D between the parser and the core commands may occur. What +%D method is used, depends on the situation. +%D +%D All three methods introduce some problems in interfacing to +%D core \CONTEXT\ functionality. This is due to the fact that +%D sometimes we want to typeset content directly, while on +%D other cases we just want to pick up data for later usage, +%D either or not using delimited arguments. And, when moving +%D data around, there is always the expansion problem to deal +%D with. +%D +%D In order to be able to incorporate \XML\ style definitions +%D into basic \TEX\ styles, we will provide some basic +%D functionality in the core itself. + +%D We will be dealing with elements, which means that we have +%D to take care of \type {} and \type {}, but +%D also with \type {} and \type {}. In due time +%D this module will deal with all these animals in a +%D convenient way. In some cases the upper and lowercase +%D alternatives need to be dealt with, although this is not +%D realy needed since XML is case sensitive. +%D +%D We also have to handle entities, like \type {&you;} and +%D \type {&me;}. These are quite easy to deal with and need to +%D be hooked into the encoding and abbreviation mechanisms. +%D +%D And then there are the parameters to be taken care of. Here +%D we meet \type {key="value"} but also \type {key='eulav'} +%D and even the spacy \typ {key = "value"}. +%D +%D Since we have to handlers for each element and entity, we +%D will create a few namespaces. Special care has to be +%D given to preformated code. + +\unprotect + +\def\@@XML {XML:} +\def\@@XMLentity {\@@XML ent} +\def\@@XMLelement {\@@XML ele} +\def\@@XMLvariable {\@@XML var} +\def\@@XMLvalue {\@@XML val} +\def\@@XMLpars {\@@XML par} +\def\@@XMLdata {\@@XML dat} +\def\@@XMLcode {\@@XML cod} +\def\@@XMLinstruction {\@@XML ins} +\def\@@XMLmap {\@@XML map} +\def\@@XMLlist {\@@XML lst} + +\newtoks\XMLtoks +\newtoks\XMLresetlist + +\chardef\XMLargumentmode=0 + +\newif\ifignoreXMLcase +\newif\ifignoreXMLspaces +\newif\iffixedXMLfont + +%D \macros +%D {compound} +%D +%D We will overload the already active \type {|} so we have +%D to save its meaning in order to be able to use this handy +%D macro. +%D +%D \starttypen +%D so test\compound{}test can be used instead of test||test +%D \stoptypen + +\let\docompound=| \def\compound#1{\docompound#1|} + +%D We will implement the parser by making a few characters +%D active. For that reason we also have to save their +%D original meaning. The core handlers are \type +%D {\doXMLentity} and \type {\doXMLelement}. + +%D \macros +%D {enableXML} +%D +%D The macro \type {\enableXML} will be used to turn on the +%D parser. This means that after that, \TEX\ commands starting +%D with a backslash will not longer be read as such. There is +%D a way around this, but for convenience \TEXEXEC\ will take +%D care of processing raw \XML\ files in a transparant way. + +\bgroup +\catcode`\*=\@@comment +\catcode`\.=\@@escape +.catcode`.B=.@@begingroup +.catcode`.E=.@@endgroup + +.catcode`.&=.@@active .gdef.letterampersand B.string&E +.catcode`.<=.@@active .gdef.letterless B.string=.@@other* + .catcode`.#=.@@active .def#B&tex-hash;E* + .catcode`.$=.@@active .def$B&tex-dollar;E* + .catcode`.%=.@@active .def%B&tex-percent;E* + .catcode`.\=.@@active .def\B&tex-backslash;E* + .catcode`.^=.@@active .def^B&tex-hat;E* + .catcode`._=.@@active .def_B&tex-underscore;E* + .catcode`.{=.@@active .def{B&tex-leftbrace;E* + .catcode`.}=.@@active .def}B&tex-rightbrace;E* + .catcode`.|=.@@active .def|B&tex-bar;E* + .catcode`.~=.@@other* active .def~B&tex-tilde;E* + .relax* needed for successive .if's + E + +.gdef.enableXMLelements* + B.catcode`.<=.@@active .unexpanded.def=.@@other* + .relax* needed for successive .if's + E + +.egroup + +%D An element can be singular or paired. A singular element is +%D called an empty element. The following definitions are +%D equivalent: +%D +%D \starttypen +%D +%D \stoptypen +%D +%D Empty elements can have arguments too. Conforming the +%D standard, each key must have a value. These are separated +%D by an \type {=} sign and the value is delimited by either +%D \type {"} or \type {'}. There may be spaces around the +%D equal sign. +%D +%D \starttypen +%D +%D \stoptypen +%D +%D Officially the following definition is not valid: +%D +%D \starttypen +%D some text +%D \stoptypen +%D +%D Although we can handle both cases independently, this is +%D seldom needed. +%D +%D Processing instructions are identified by a~\type {?} and are +%D like empty elements. +%D +%D \starttypen +%D +%D \stoptypen +%D +%D Comment is formatted as follows. +%D +%D \starttypen +%D +%D \stoptypen +%D +%D Verbatim code inits purest form is called \type {CDATA} and +%D is embedded in the following ugly and therefore recognizable +%D way: +%D +%D \starttypen +%D +%D \stoptypen + +%D The parser is implemented as a multi||step macro. Because +%D \type {!} and \type {?} should be picked up correctly, we +%D need to define a few macros in unprotected mode! +%D +%D Because \XML\ is defined with some restrictions in mind, +%D parsing the elements is not that complicated. First we have +%D to determine if we're dealing with a comment or processing +%D instruction. We need a bit of grouping because we have to +%D mess up with catcodes. We probably have to treat a few +%D more catcode and first character cases. We need to use +%D \type {\begingroup} here, otherwise we get funny spaces in +%D math. + +\protect + +\long\def\doXMLelement#1% + {\begingroup % maybe tab and space needs some treatment too: \catcode`\ =10 % \@@space + \catcode`\^^M=10 + \if#1!\let\next \xdoXMLelement \else + \if#1?\let\next \ydoXMLelement \else + \let\next \zdoXMLelement \fi\fi + \next#1} + +%D By using a few {\expandafter}'s we can us a \type {\next} +%D construction. We could speed the first char test up a bit +%D by using an installer and something \typ {\getvalue +%D {#1doXMLelement}} (todo). + +\long\def\doXMLelement#1% + {\begingroup % maybe tab and space needs some treatment too: \catcode`\ =10 % \@@space + \catcode`\^^M=10\relax + \if#1!\expandafter \xdoXMLelement \else + \if#1?\expandafter\expandafter\expandafter \ydoXMLelement \else + \expandafter\expandafter\expandafter \zdoXMLelement \fi\fi + #1} + +%D The (yet experimental) \type {CDATA} parser is implemented +%D on top of the verbatim environment. + +\long\def\xdoXMLelement !#1 % !-- --> or !xyz > + {\endgroup + \doifelse{#1}{--} + {\long\def\nextelement{\gobbleuntil{-->}}} + {\doifelse{#1}{[CDATA[} + {\long\def\nextelement{\skipfirstverbatimlinefalse + \processtaggeddisplayverbatim{]]>}}} + {\long\def\nextelement{\gobbleuntil{>}}}}% + \nextelement} + +%D In our case, processing instructions are only needed if +%D we want specific \CONTEXT\ support. This may be useful in +%D applications where the data is generated by an +%D application. We will implement a \CONTEXT\ code handler +%D later. + +\long\def\ydoXMLelement#1 #2?>% ?target ?> + {\endgroup\dodoXMLprocessor{#1}{#2}} + +%D The normal elements are handled by \type {\dodoXMLelement}. + +\long\def\zdoXMLelement#1>% + {\endgroup\dodoXMLelement#1 >} + +%D Now we switch to unprotected mode again. + +\unprotect + +%D The processing instructions handler is implemented as +%D follows. + +\long\def\dodoXMLprocessor#1% + {\ifundefined{\@@XMLinstruction:#1}% + \let\next\gobbleoneargument + \else + \def\next{\getvalue{\@@XMLinstruction:#1}}% + \fi + \next} + +\long\def\defineXMLprocessor[#1]#2% watch the ? + {\long\setvalue{\@@XMLinstruction:?#1}{#2}} + +%D As an example, we implement a \CONTEXT\ code handler: + +\defineXMLprocessor[context] {\contextXMLcommand} +\defineXMLprocessor[context-command]{\contextXMLcommand} + +\def\contextXMLcommand#1% + {\def\disableXML{\global\let\afterXMLprocessor\empty}% + \global\let\afterXMLprocessor\enableXML + \setnormalcatcodes\scantokens{#1}\afterXMLprocessor} + +\defineXMLprocessor[context-directive]{\contextXMLdirective} + +\def\contextXMLdirective#1% + {\docontextXMLdirective#1 dummy dummy dummy\end} + +\def\docontextXMLdirective#1 #2 #3 #4\end% class var value + {\setvalue{\@@XMLvariable:#1:#2}{#3}} + +\defineXMLprocessor[context-message]{\contextXMLmessage} + +\def\contextXMLmessage#1% + {\writestatus{xml}{#1}} + +\def\setnormalcatcodes% + {\catcode`\!=\@@other \catcode`\?=\@@other + \catcode`\&=\@@alignment \catcode`\<=\@@other + \catcode`\#=\@@parameter \catcode`\$=\@@mathshift + \catcode`\%=\@@comment \catcode`\\=\@@escape + \catcode`\^=\@@superscript \catcode`\_=\@@subscript + %\catcode`\|=\@@active \catcode`\~=\@@active + \catcode`\{=\@@begingroup \catcode`\}=\@@endgroup} + +%D Given the previous definition, and given that \ETEX\ is +%D used, we can now say: +%D +%D \starttypen +%D +%D \stoptypen +%D +%D A non||\ETEX\ solution is also possible, using buffers, +%D but for the moment we assume that \ETEX\ is used. + +%D Next we will implement the normal element handler. + +\let\currentXMLarguments\empty +\let\currentXMLelement \empty + +\newtoks\everyXMLelement + +\long\def\dodoXMLelement#1 #2>% + {\def\!!stringa{#2}% + \def\!!stringb{/ }% + \ifx\!!stringa\empty + \let\currentXMLarguments\empty + \def\currentXMLelement{#1}% + \the\everyXMLelement + \else\ifx\!!stringa\!!stringb + \let\currentXMLarguments\empty + \def\currentXMLelement{#1/}% + \the\everyXMLelement + \else + \def\currentXMLelement{#1}% + \def\currentXMLarguments{#2}% + \the\everyXMLelement + %\getXMLarguments\currentXMLelement{#2}% + \dogetXMLarguments\currentXMLelement#2>% + \fi \fi + \executeXMLelement\currentXMLelement} + +\def\executeXMLelement#1% + {\getvalue{\@@XMLelement:#1}} + +\newif\ifXMLrawentities + +% \bgroup +% +% \catcode`<=\@@active +% +% \gdef\defineXMLentity[#1]#2% +% {\unspaceargument#1\to\ascii +% \long\setvalue{\@@XMLelement:ent:\@EA\firstofoneargument\ascii/}{#2}} +% +% \gdef\doXMLentity#1;% +% {\ifXMLrawentities#1\else\executeXMLentity{#1}\fi} +% +% \gdef\executeXMLentity#1% +% {} +% +% \gdef\getXMLentity#1% +% {\getvalue{\@@XMLelement:ent:#1/}} +% +% \gdef\doifXMLentityelse#1#2#3% +% {\ifundefined{\@@XMLelement:ent:#1/}#3\else#2\fi} +% +% \egroup + +\gdef\defineXMLentity[#1]#2% + {\unspaceargument#1\to\ascii + \long\setvalue{\@@XMLentity:\@EA\firstofoneargument\ascii}{#2}} + +% we need to be able to do: +% +% \defineXMLentity[amp] {\FunnyAmp} \def\FunnyAmp#1;{\getXMLentity{#1}} +% +% \defineXMLentity [pound] {(why not use euro's?)} +% +% \startXMLdata +% test &pound; test +% \stopXMLdata +% +% so we need an ifless implementation of: + +\gdef\doXMLentity#1;% + {\ifXMLrawentities + \expandafter\firstofoneargument + \else + \expandafter\executeXMLentity + \fi{#1}} + +\def\executeXMLentity#1% internal ! ! ! + {\getXMLentity{#1}} + +\def\expandedXMLentity#1% + {\getvalue{\@@XMLentity:#1}} + +\unexpanded\def\getXMLentity#1% + {\getvalue{\@@XMLentity:#1}} + +\gdef\doifXMLentityelse#1#2#3% + {\ifundefined{\@@XMLentity:#1}#3\else#2\fi} + +% \long\def\getXMLarguments#1#2% +% {\dogetXMLarguments{#1}#2>} +% +% \long\def\dogetXMLarguments#1% +% {\XMLtoks\emptytoks +% \def\@@XMLclass{#1}% +% \let\dodoparseXMLarguments\doparseXMLarguments +% \doparseXMLarguments} +% +% \def\dosetXMLargument#1% +% {\setvalue{\@@XMLvariable:\@@XMLclass:\@@XMLname}{#1}% +% %\message{[\@@XMLname=#1]}% +% \let\dodoparseXMLarguments\doparseXMLarguments +% \dodoparseXMLarguments} + +% see \defineXML... commands: +% +% [key=val] => \presetXMLarguments{element} => default key/vals +% [blabla] => \theXMLarguments{blabla} => user key/vals +% [blabla] [key=val] => \presetXMLarguments{element} => default key/vals +% \theXMLarguments{blabla} => user key/vals +% +% stored in case of [blabla] else set as \XMLpar +% +% see m-steps for an example of usage + +\long\def\getXMLarguments#1#2% + {\dogetXMLarguments{#1}#2>} + +\long\def\dogetXMLarguments#1% + {\XMLtoks\emptytoks + \ifcsname\@@XMLmap:#1\endcsname + \let\dosetXMLargument\dosetXMLargumentB + \else + \def\@@XMLclass{#1}% + \let\dosetXMLargument\dosetXMLargumentA + \fi + \let\dodoparseXMLarguments\doparseXMLarguments + \doparseXMLarguments} + +\def\dosetXMLargumentA#1% + {\setvalue{\@@XMLvariable:\@@XMLclass:\@@XMLname}{#1}% + \let\dodoparseXMLarguments\doparseXMLarguments + %\message{[\@@XMLclass][\@@XMLname=#1]}\wait + \dodoparseXMLarguments} + +\def\dosetXMLargumentB#1% + {\setevalue{\@@XMLmap:\@@XMLmapmap}% + {\@EA\ifx\csname\@@XMLmap:\@@XMLmapmap\endcsname\empty\else + \csname\@@XMLmap:\@@XMLmapmap\endcsname,% + \fi + \@@XMLname=#1}% + \let\dodoparseXMLarguments\doparseXMLarguments + %\message{[\@@XMLprefix][\@@XMLname=#1]}\wait + \dodoparseXMLarguments} + +\appendtoks + \resetXMLarguments\currentXMLelement +\to \everyXMLelement + +\def\resetXMLarguments#1% + {\ifcsname\@@XMLmap:#1\endcsname + \@EA\let\@EA\@@XMLmapmap\csname\@@XMLmap:#1\endcsname + \@EA\let\csname\@@XMLmap:\@@XMLmapmap\endcsname\empty + \fi} + +\def\theXMLarguments#1% + {\ifcsname\@@XMLmap:#1\endcsname\csname\@@XMLmap:#1\endcsname\fi} + +\long\def\doparseXMLarguments#1% space goes ok + {\if#1>% + \let\dodoparseXMLarguments\empty + \else\if#1=% + \edef\@@XMLname{\the\XMLtoks}% + \XMLtoks\emptytoks + \else\if#1"% + \let\dodoparseXMLarguments\dodoparseXMLargumentsD + \else\if#1'% + \let\dodoparseXMLarguments\dodoparseXMLargumentsS + \else\if#1/% + \edef\currentXMLelement{\currentXMLelement/}% + \else + \@EA\XMLtoks\@EA{\the\XMLtoks#1}% + \fi\fi\fi\fi\fi + \dodoparseXMLarguments} + +\def\dodoparseXMLargumentsD#1"{\dosetXMLargument{#1}} +\def\dodoparseXMLargumentsS#1'{\dosetXMLargument{#1}} + +%D The previous macros were the basic parser and their working +%D is left to the imagination of the reader. These macros +%D will be improved. + +\bgroup + +\catcode`<=\@@active + +\long\gdef\dododefineXMLsingular#1#2% + {\long\setvalue{\@@XMLelement:#1/}{#2}} + +\long\gdef\dododefineXMLcommand#1#2% + {\long\setvalue{\@@XMLelement:#1/}{#2}% + \long\setvalue{\@@XMLelement:#1}{#2}} + +\long\gdef\dododefineXMLgrouped#1#2% + {\long\setvalue{\@@XMLelement:#1}{\groupedcommand{#2}{}\bgroup}% + \long\setvalue{\@@XMLelement:/#1}{\egroup}} + +\long\gdef\dododefineXMLargument#1#2% watch the {} around ##1 + {\long\setvalue{\@@XMLelement:#1/}{#2{}}% + \long\setvalue{\@@XMLelement:#1}##1{#2{##1}}} + +\long\gdef\dododefineXMLignore#1% + {\long\setvalue{\@@XMLelement:#1/}{}% + \long\setvalue{\@@XMLelement:#1}##1{}} + +\long\gdef\dododefineXMLpickup#1#2#3% + {\long\setvalue{\@@XMLelement:#1/}{#2#3}% + \long\setvalue{\@@XMLelement:#1}##1{#2##1#3}} + +\long\gdef\dododefineXMLenvironment#1#2#3% + {\long\setvalue{\@@XMLelement:#1/}{#2#3}% % genereert evt relax + \long\setvalue{\@@XMLelement:#1}{#2}% + \long\setvalue{\@@XMLelement:/#1}{#3}} + +\long\gdef\dododefineXMLpush#1% + {\long\setvalue{\@@XMLelement:#1/}{\long\setvalue{\@@XMLdata:#1}{}}% + \long\setvalue{\@@XMLelement:#1}##1{\long\setvalue{\@@XMLdata:#1}{##1}}} + +\long\gdef\dododefineXMLenvironmentpush#1#2#3% + {\long\setvalue{\@@XMLelement:#1/}{#2\long\setvalue{\@@XMLdata:#1}{}#3}% + \long\setvalue{\@@XMLelement:#1}##1{#2\long\setvalue{\@@XMLdata:#1}{##1}#3}} + +\long\gdef\dododefineXMLprocess#1% + {\long\setvalue{\@@XMLelement:#1/}{}% + \long\setvalue{\@@XMLelement:#1}{}% + \long\setvalue{\@@XMLelement:/#1}{}} + +\long\gdef\dododefineXMLnestedenvironment#1#2#3% + {\long\setvalue{\@@XMLelement:#1}{\getXMLgroupedenvironment{#1}{#2}{#3}}} + +\long\gdef\dododefineXMLnestedargument#1#2% + {\long\setvalue{\@@XMLelement:#1}{\getXMLgroupedargument{#1}{#2}}} + +\egroup + +%D The high level definition macros. + +\def\defineXMLsingular {\dotripleempty\dodefineXMLsingular} +\def\defineXMLcommand {\dotripleempty\dodefineXMLcommand} +\def\defineXMLgrouped {\dotripleempty\dodefineXMLgrouped} +\def\defineXMLargument {\dotripleempty\dodefineXMLargument} +\def\defineXMLignore {\dotripleempty\dodefineXMLignore} +\def\defineXMLpickup {\dotripleempty\dodefineXMLpickup} +\def\defineXMLenvironment {\dotripleempty\dodefineXMLenvironment} +\def\defineXMLpush {\dotripleempty\dodefineXMLpush} +\def\defineXMLenvironmentpush{\dotripleempty\dodefineXMLenvironmentpush} +\def\defineXMLprocess {\dotripleempty\dodefineXMLprocess} + +% goes for all types + +\def\defineXMLnested {\dotripleempty\dodefineXMLnestedenvironment} +\def\defineXMLnestedenvironment{\dotripleempty\dodefineXMLnestedenvironment} +\def\defineXMLnestedargument {\dotripleempty\dodefineXMLnestedargument} + +\long\def\dodefineXMLsingular[#1][#2][#3]#4% + {\defineXMLmethod\dododefineXMLsingular{#1}{#2}{#3}{#4}{}} + +\long\def\dodefineXMLcommand[#1][#2][#3]#4% + {\defineXMLmethod\dododefineXMLcommand{#1}{#2}{#3}{#4}{}} + +\long\def\dodefineXMLgrouped[#1][#2][#3]#4% + {\defineXMLmethod\dododefineXMLgrouped{#1}{#2}{#3}{#4}{}} + +\long\def\dodefineXMLargument[#1][#2][#3]#4% + {\defineXMLmethod\dododefineXMLargument{#1}{#2}{#3}{#4}{}} + +\long\def\dodefineXMLignore[#1][#2][#3]% + {\defineXMLmethod\dododefineXMLignore{#1}{#2}{#3}{}{}} + +\long\def\dodefineXMLpickup[#1][#2][#3]#4#5% + {\defineXMLmethod\dododefineXMLpickup{#1}{#2}{#3}{#4}{#5}} + +\long\def\dodefineXMLenvironment[#1][#2][#3]#4#5% + {\defineXMLmethod\dododefineXMLenvironment{#1}{#2}{#3}{#4}{#5}} + +\long\def\dodefineXMLpush[#1][#2][#3]% + {\defineXMLmethod\dododefineXMLpush{#1}{#2}{#3}{}{}} + +\long\def\dodefineXMLenvironmentpush[#1][#2][#3]#4#5% + {\defineXMLmethod\dododefineXMLenvironmentpush{#1}{#2}{#3}{#4}{#5}} + +\long\def\dodefineXMLprocess[#1][#2][#3]% + {\defineXMLmethod\dododefineXMLprocess{#1}{#2}{#3}{}{}} + +\long\def\dodefineXMLnestedenvironment[#1][#2][#3]#4#5% + {\defineXMLmethod\dododefineXMLnestedenvironment{#1}{#2}{#3}{#4}{#5}} + +\long\def\dodefineXMLnestedargument[#1][#2][#3]#4% + {\defineXMLmethod\dododefineXMLnestedargument{#1}{#2}{#3}{#4}{}} + +% [key=val] => \presetXMLarguments{element} => default key/vals +% [blabla] => \theXMLarguments{blabla} => user key/vals +% [blabla] [key=val] => \presetXMLarguments{element} => default key/vals +% \theXMLarguments{blabla} => user key/vals + +\long\def\defineXMLmethod#1#2#3#4#5#6% command element [map] [parlst] begin end + {\ifsecondargument + \setXMLarguments{#2}{#3}{#4}% + \fi + \ifignoreXMLcase + \lowercasestring#2\to\ascii \@EA#1\@EA{\ascii}{#5}{#6}% + \uppercasestring#2\to\ascii \@EA#1\@EA{\ascii}{#5}{#6}% + \else + #1{#2}{#5}{#6}% + \fi} + +\def\setXMLarguments#1#2#3% element [tag] settings + {\doifassignmentelse{#2} + {\setvalue{\@@XMLpars:#1}{\getrawparameters[\@@XMLvariable:#1:][#2]}} + {\setvalue{\@@XMLmap :#1}{#2}% later we can init vars by this name + \doifsomething{#3}{\setvalue{\@@XMLpars:#1}{\getrawparameters[#2][#3]}}}} + +\def\presetXMLarguments#1% + {\getvalue{\@@XMLpars:#1}} + +\prependtoks + \presetXMLarguments\currentXMLelement +\to \everyXMLelement + +\def\doifXMLdataelse#1#2#3% % \relax too, so no etex +% wrong +% {\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax +% slow +% {\ifundefined{\@@XMLdata:#1}% +% etex + {\unless\ifcsname\@@XMLdata:#1\endcsname + #3% + \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\empty + #3% + \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax + #3% + \else + #2% + \fi\fi\fi} + +\def\XMLpop#1% one level +% wrong +% {\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax\else +% \csname\@@XMLdata:#1\endcsname +% \fi} +% slow, hm was not commented +% {\ifundefined{\@@XMLdata:#1}\else\getvalue{\@@XMLdata:#1}\fi} +% etex + {\ifcsname\@@XMLdata:#1\endcsname\csname\@@XMLdata:#1\endcsname\fi} + +\def\XMLpopdata#1% see m-steps for usage + {\unless\ifcsname\@@XMLdata:#1\endcsname + \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\empty + \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax + \else + \@EA\@EA\@EA\XMLdata\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}% + \fi\fi\fi} + +\def\XMLappend#1#2% + {\edef\!!stringa{\@@XMLdata:#1}% + \doifXMLdataelse{#1}% + {\@EA\@EA\@EA\setvalue\@EA\@EA\@EA\!!stringa\@EA\@EA\@EA + {\csname\!!stringa\endcsname#2}} + {\setvalue\!!stringa{#2}}} + +\def\XMLprepend#1#2% + {\edef\!!stringa{\@@XMLdata:#1}% + \doifXMLdataelse{#1}% + {\@EA\@EA\@EA\setvalue\@EA\@EA\@EA\!!stringa\@EA\@EA\@EA + {#2\csname\!!stringa\endcsname}} + {\setvalue\!!stringa{#2}}} + +\def\XMLerase#1% + {\letvalue{\@@XMLdata:#1}\empty} + +\def\XMLassign#1% + {\setvalue{\@@XMLdata:#1}} + +\def\defXMLstring#1#2% +% {\@EA\convertcommand\csname\@@XMLdata:#2\endcsname\to#1} + {\bgroup + \let\getXMLentity\firstofoneargument + \xdef\@@XML@@string{\csname\@@XMLdata:#2\endcsname}% + \egroup + \@EA\convertcommand\@@XML@@string\to#1} + +\def\XMLshow#1% + {\showvalue{\@@XMLdata:#1\endcsname}} + +\def\XMLunspace#1% + {\ifcsname\@@XMLdata:#1\endcsname + \setevalue{\@@XMLdata:#1}% + {\@EA\@EA\@EA\dounspaced\csname\@@XMLdata:#1\endcsname\end}% + \fi} + +\def\defXMLlowerclean#1% lowercase ! evt tzt upper too + {\bgroup + \lccode`\#=32\lccode`\$=32\lccode`\%=32\lccode`\\=32\lccode`\^=32 + \lccode`\_=32\lccode`\{=32\lccode`\}=32\lccode`\|=32\lccode`\~=32 + \@EA\lowercase\@EA{\@EA\xdef\@EA#1\@EA{#1}}% + \egroup} + +\def\processXMLparelse#1#2#3#4% + {\processaction + [\XMLpar{#1}{#2}{}] + [#3,\s!unknown=>{#4},\s!default={#4}]} + +%D We can pick up key|/|value pairs, but we still need a way +%D to process these. + +\def\mapXMLvalue#1#2#3% td align center -> middle + {\setvalue{\@@XMLvalue:#1:#2:#3}} + +% \def\XMLvar#1#2#3% td align center +% {\ifundefined{\@@XMLvariable:#1:#2}% +% \XMLval{#1}{#2}{#3}% +% \else +% \XMLval{#1}{#2}{\getvalue{\@@XMLvariable:#1:#2}}% +% \fi} +% +% \def\XMLval#1#2#3% +% {\ifundefined{\@@XMLvalue:#1:#2}% +% #3% +% \else +% \getvalue{\@@XMLvalue:#1:#2}% +% \fi} +% +% \def\XMLpar#1#2#3% +% {\ifundefined{\@@XMLvariable:#1:#2}% +% #3% +% \else +% \getvalue{\@@XMLvariable:#1:#2}% +% \fi} +% +% speedup + +\def\XMLvar#1#2#3% td align center + {\ifcsname\@@XMLvariable:#1:#2\endcsname + \XMLval{#1}{#2}{\csname\@@XMLvariable:#1:#2\endcsname}% + \else + \XMLval{#1}{#2}{#3}% evt inline code + \fi} + +\def\XMLval#1#2#3% + {\ifcsname\@@XMLvalue:#1:#2\endcsname + \csname\@@XMLvalue:#1:#2\endcsname + \else + #3% + \fi} + +\def\XMLpar#1#2#3% + {\ifcsname\@@XMLvariable:#1:#2\endcsname + \csname\@@XMLvariable:#1:#2\endcsname + \else + #3% + \fi} + +% so far for speedup + +\defineXMLsingular [begingroup] {\begingroup} +\defineXMLsingular [endgroup] {\endgroup} + +\def\XMLstr#1% + {{\enableXML\scantokens{#1}\unskip}} + +\def\XMLstr#1% test + {\scantokens{\begingroup\enableXML#1}} + +%\def\XMLstrpar#1#2#3% +% {{\enableXML +% \ifundefined{\@@XMLvariable:#1:#2}% +% \scantokens{#3}% +% \else +% \scantokens\@EA\@EA\@EA +% {\csname\@@XMLvariable:#1:#2\endcsname}\unskip +% \fi}} + +\def\XMLstrpar#1#2#3% test + {\ifundefined{\@@XMLvariable:#1:#2}% + \scantokens{\begingroup\enableXML#3}% + \else + \scantokens\@EA\@EA\@EA{\@EA\begingroup\@EA\enableXML + \csname\@@XMLvariable:#1:#2\endcsname}% + \fi} + +\def\doifXMLvarelse#1#2#3#4% geen etex, \relax too + {\expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\relax#4\else + \expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\empty#4\else#3\fi\fi} + +\def\doifXMLvalelse#1#2#3#4% geen etex, \relax too + {\expandafter\ifx\csname\@@XMLvalue:#1:#2\endcsname\relax#4\else + \expandafter\ifx\csname\@@XMLvalue:#1:#2\endcsname\empty#4\else#3\fi\fi} + +\let\doifXMLparelse\doifXMLvarelse + +\def\dogotoXML% + {\ifx\nexttoken<% + \expandafter\nexttoken + \else + \expandafter\gotoXML + \fi} + +\def\gotoXML% + {\afterassignment\dogotoXML\let\nexttoken=} + +%D Saves tokens and typing. + +\def\XMLownvar {\XMLvar \currentXMLelement} +\def\XMLownval {\XMLval \currentXMLelement} +\def\XMLownpar {\XMLpar \currentXMLelement} +\def\XMLownstrpar {\XMLstrpar \currentXMLelement} +\def\doifXMLownvarelse{\doifXMLvarelse\currentXMLelement} +\def\doifXMLownvalelse{\doifXMLvalelse\currentXMLelement} +\def\doifXMLownparelse{\doifXMLparelse\currentXMLelement} + +%D + +\long\def\startXMLcode[#1] #2 \stopXMLcode + {\setgvalue{\@@XMLcode:#1}{\startXMLdata#2\stopXMLdata}} + +\def\getXMLcode[#1]% \expandXMLcode + {\getvalue{\@@XMLcode:#1}} + +% \long\def\startXMLdata#1\stopXMLdata% +% {\begingroup\enableXML\scantokens{#1}\endgroup} +% +% \defineXMLentity[tex-backslash] {\catchXMLpar} +% +% \def\catchXMLpar#1#2#3 +% {\if#1p\if#2a\if#3r\ifmmode\else\endgraf\fi +% \else\texescape\fi\else\texescape\fi\else\texescape\fi} + +\long\def\startXMLdata + {\begingroup + \catcode`\^^I=\@@space + \catcode`\^^M=\@@space + \catcode`\^^L=\@@space + \dostartXMLdata} + +% \long\def\dostartXMLdata#1\stopXMLdata +% {\enableXML\scantokens{#1}\endgroup} + +\long\def\dostartXMLdata#1\stopXMLdata + {\enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi\endgroup} + +\unexpanded\def\XMLdata#1% % \unexpanded added 22/5/2001 + {\begingroup + \enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi + \endgroup} + +\unexpanded\def\XMLdata#1% % grouping changed 20/5/2001 + {\scantokens{\begingroup\enableXML#1}} + +%D + +\def\bXMLs{\ifignoreXMLspaces\ignorespaces\fi} +\def\eXMLs{\ifignoreXMLspaces\ifhmode\unskip\fi\fi} + +\protect + +% \defineXMLcommand{placeindex/} +% {\placeindex[criterium=all]} +% +% \defineXMLargument{index} +% {\index[\XMLvar{index}{key}{}]} + +%D Here we implement the handling of preformatted code. + +\unprotect + +\def\startXMLpreformatted#1% + {\startpacked + #1% + \fixedXMLfonttrue + \obeylines + \obeyspaces + \setbox\scratchbox=\hbox{x}% + \edef\obeyedspace{\noindent\noexpand\kern\the\wd\scratchbox}} + +\def\stopXMLpreformatted#1% + {\stoppacked} + +%D + +\def\XMLinput{\enableXML\input} \global\let\inputXML\XMLinput + +% options + +\def\processXMLfile #1{\enableXML\processfile{#1}} +\def\processXMLfilegrouped#1{{\enableXML\processfile{#1}\relax\ifmmode\else\par\fi}} + +% partially defined here + +\fetchruntimecommand\showXMLfile {\f!xtagprefix\s!run} +\fetchruntimecommand\showXMLbuffer{\f!xtagprefix\s!run} + +\fetchruntimecommand\showXMLtxt {\f!xtagprefix\s!run} +\fetchruntimecommand\showXMLpar {\f!xtagprefix\s!run} +\fetchruntimecommand\showXMLlin {\f!xtagprefix\s!run} +\fetchruntimecommand\showXMLwrd {\f!xtagprefix\s!run} +\fetchruntimecommand\showXMLemp {\f!xtagprefix\s!run} + +%D \type +%D {processXMLbuffer} +%D +%D For illustrative purposes, we need to be able to reuse +%D definitions, which is why we implement a buffer processor +%D here. The macro \type {\processXMLbuffer} behaves like +%D any buffer processor. + +\def\processXMLbuffer% + {\dosingleempty\doprocessXMLbuffer} + +\def\doprocessXMLbuffer[#1]% + {\doifelsenothing{#1} + {\doprocessXMLbuffer[\jobname]} + {\begingroup + \def\dodoprocessXMLbuffer##1% + {\enableXML\processXMLfile{\TEXbufferfile{##1}}}% + \processcommalist[#1]\dodoprocessXMLbuffer + \endgroup}} + +%D Loading specific modules takes place with \type +%D {\useXMLfilters}. + +\def\useXMLfilter[#1]% + {\processcommalist[#1]\douseXMLfilter} + +\def\douseXMLfilter#1% + {\doifundefined{\c!file\f!xtagprefix#1} + {\setvalue{\c!file\f!xtagprefix#1}{}% + \makeshortfilename[\f!xtagprefix#1]% + \writestatus{xml}{loading module #1}% will be \showmessage + \startreadingfile + \readsysfile{\shortfilename}{}{}% + \stopreadingfile}} + +%D Temporarily here. + +\newtoks\groupedtoks + +\bgroup + +\catcode`\<=\@@active + +\long\unexpanded\gdef\getXMLgrouped#1#2#3% + {\groupedtoks\emptytoks + \convertargument<#1>\to\xxascii + \convertargument<#1 \to\yyascii + \newcounter\groupedlevel + \long\def\dogetgrouped##1% + {\appendtoks##1\to\groupedtoks + \convertargument##1\to\ascii + \doloop + {\@EA\@EA\@EA\aftersplitstring\@EA\ascii\@EA\at\xxascii\to\ascii + \ifx\ascii\empty + \exitloop + \else + \increment\groupedlevel + \fi}% + \convertargument##1\to\ascii + \doloop + {\@EA\@EA\@EA\aftersplitstring\@EA\ascii\@EA\at\yyascii\to\ascii + \ifx\ascii\empty + \exitloop + \else + \increment\groupedlevel + \fi}% + \ifnum\groupedlevel>0 + \decrement\groupedlevel + \appendtoks\to\groupedtoks + \else + \edef\dogetgrouped{\noexpand#2\the\groupedtoks\noexpand#3}% + \fi + \dogetgrouped}% + \dogetgrouped} + +%D Cleaner but hardly faster unless big strings are passed. + +\long\gdef\docountXMLgrouped#1\end#2\end + {\long\def\dosplitstring##1#2##2@@##3\end% + {\def\ascii{##2}% + \ifx\ascii\empty \else + \advance\scratchcounter 1 + \dosplitstring##2@@#2@@\end + \fi}% + \dosplitstring#1@@#2@@\end} + +\long\unexpanded\gdef\getXMLgrouped#1#2#3% + {\groupedtoks\emptytoks + \scratchcounter=0 + \long\def\dogetgrouped##1% + {\appendtoks##1\to\groupedtoks + \docountXMLgrouped##1\end<#1>\end + \docountXMLgrouped##1\end<#1 \end + \ifcase\scratchcounter + \def\dogetgrouped{\@EA#2\the\groupedtoks#3}% + \else + \advance\scratchcounter -1 + \appendtoks\to\groupedtoks + \fi + \dogetgrouped}% + \dogetgrouped} + +%D More versatile. + +\long\unexpanded\gdef\getXMLgroupedenvironment#1#2#3% + {\def\dodogetgrouped{\@EA#2\the\groupedtoks#3}% + \getXMLgrouped{#1}} + +\long\unexpanded\gdef\getXMLgroupedargument#1#2% + {\def\dodogetgrouped{\@EA#2\@EA{\the\groupedtoks}}% + \getXMLgrouped{#1}} + +\long\unexpanded\gdef\getXMLgrouped#1% + {\groupedtoks\emptytoks + \scratchcounter=0 + \long\def\dogetgrouped##1% + {\appendtoks##1\to\groupedtoks + \docountXMLgrouped##1\end<#1>\end + \docountXMLgrouped##1\end<#1 \end + \ifcase\scratchcounter + \let\dogetgrouped\dodogetgrouped + \else + \advance\scratchcounter -1 + \appendtoks\to\groupedtoks + \fi + \dogetgrouped}% + \dogetgrouped} + +\egroup + +% {pre}{pos}{before}{after} +% +%\unexpanded\def\getgrouped#1#2#3#4% +% {\groupedtoks\emptytoks +% \convertargument#1\to\xxascii +% \newcounter\groupedlevel +% \def\dogetgrouped##1#2% +% {\appendtoks##1\to\groupedtoks +% \convertargument##1\to\ascii +% \doloop +% {\@EA\@EA\@EA\aftersplitstring\@EA\ascii\@EA\at\xxascii\to\ascii +% \ifx\ascii\empty +% \exitloop +% \else +% \increment\groupedlevel +% \fi}% +% \ifnum\groupedlevel>0 +% \decrement\groupedlevel +% \appendtoks#2\to\groupedtoks +% \else +% \edef\dogetgrouped{\noexpand#3\the\groupedtoks\noexpand#4}% +% \fi +% \dogetgrouped}% +% \dogetgrouped} + +% interesting and fully expandable + +\def\XMLifequalelse#1#2#3#4#5% + {\ifundefined{\@@XMLvariable:#1:#2}% + #5% + \else + \@EA\@EA\@EA\@@ifequal\csname\@@XMLvariable:#1:#2\endcsname + \relax\@@and#3\relax\@@then#4\@@else#5\@@fi + \fi} + +\def\expifequalelse#1#2#3#4% + {\@@ifequal#1\relax\relax\@@and#2\relax\relax\@@then#3\@@else#4\@@fi} + +\def\@@ifequal#1#2\@@and#3#4\@@then#5\@@else#6\@@fi% + {\ifx#1\relax + \ifx#3\relax#5\else#6\fi + \else + \ifx#3\relax#6\else\@@ifequal#2\@@and#4\@@then#5\@@else#6\@@fi\fi + \fi} + +\protect \endinput diff --git a/tex/context/user/cont-sys.rme b/tex/context/user/cont-sys.rme index cbeee6a1e..69483c98d 100644 --- a/tex/context/user/cont-sys.rme +++ b/tex/context/user/cont-sys.rme @@ -16,7 +16,7 @@ % Here you can take care of overloading some (style) % defaults. What goes here, depends on your local system. % -% Set default file name mapping: +% Set default file name mapping (not really needed): % % \usetypescript [ber] % @@ -33,6 +33,10 @@ % \definefontsynonym [gbheisl] [gbsong] % \definefontsynonym [gbheisl] [gbsong] % +% You can let \CONTEXT\ load the map files for \PDFTEX. +% +% \autoloadmapfilestrue +% % Setting up a global figure path (beware, \c!gebied may change): % % \setupexternalfigures diff --git a/tex/context/user/cont-sys.tex b/tex/context/user/cont-sys.tex new file mode 100644 index 000000000..69483c98d --- /dev/null +++ b/tex/context/user/cont-sys.tex @@ -0,0 +1,96 @@ +%D \module +%D [ file=cont-sys, +%D version=1995.10.10, +%D title=\CONTEXT\ Miscellaneous Macros, +%D subtitle=System Specific Setups, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%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 + +% Here you can take care of overloading some (style) +% defaults. What goes here, depends on your local system. +% +% Set default file name mapping (not really needed): +% +% \usetypescript [ber] +% +% Overload Lucida by Adobe-15: +% +% \definetypescriptsynonym [lbr] [pos] +% +% Compensate for missing files: +% +% \definefontsynonym [Courier-Bold] [Courier] +% \definefontsynonym [Courier-BoldOblique] [Courier] +% +% \definefontsynonym [gbhei] [gbsong] +% \definefontsynonym [gbheisl] [gbsong] +% \definefontsynonym [gbheisl] [gbsong] +% +% You can let \CONTEXT\ load the map files for \PDFTEX. +% +% \autoloadmapfilestrue +% +% Setting up a global figure path (beware, \c!gebied may change): +% +% \setupexternalfigures +% [\c!gebied={e:/fig/eps,t:/pragma/metapost/symbols}] +% +% Loading a specific special driver: +% +% \setupoutput +% [dviwindo] +% +% Enabling \CONTEXT\ navigation symbols as well as \euro's. + +\usesymbols + [nav,eur] + +\setupsymbolset + [navigation 1] + +\setupinteraction + [\c!symboolset=navigation 1] + +% Changing language defaults: +% +% \setuplanguage +% [nl] +% [\c!leftquote=\upperleftsinglesixquote, +% \c!leftquotation=\upperleftdoublesixquote] +% +% So far for the settings. + +% Loading local preferences: +% +% \input prag-gen % company styles +% \input prag-log % more company styles +% +% Enabling run time \METAPOST\ (also enable \write18 in texmf.cnf): + + \runMPgraphicstrue +\runMPTEXgraphicstrue + \recycleMPslotstrue +\useMETAFUNformattrue + +% Enabling nested pretty printing: + + \newprettytrue + +% Protect filenames: + + \protectbufferstrue + +% not really needed + +% \runutilityfiletrue + +% So far. + +\protect \endinput -- cgit v1.2.3