From cb58eea8a8460f4288c8ba9279bcd1a4d9333f74 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 13 Jul 2006 22:26:00 +0200 Subject: stable 2006.07.13 22:26 --- tex/context/base/colo-ini.tex | 23 +- tex/context/base/cont-new.tex | 71 ++++- tex/context/base/context.tex | 7 +- tex/context/base/core-con.tex | 15 + tex/context/base/core-des.tex | 15 +- tex/context/base/core-lst.tex | 2 +- tex/context/base/core-mak.tex | 18 -- tex/context/base/core-mat.tex | 12 +- tex/context/base/core-ntb.tex | 444 ++++++++++++-------------- tex/context/base/core-ref.tex | 14 +- tex/context/base/core-reg.tex | 18 +- tex/context/base/core-rul.tex | 75 +++-- tex/context/base/core-sec.tex | 172 +++------- tex/context/base/core-spa.tex | 115 ++++--- tex/context/base/core-tab.tex | 379 ++++++---------------- tex/context/base/core-tbl.tex | 169 ++++++---- tex/context/base/core-tsp.tex | 451 +++++++++++++++++++++++++++ tex/context/base/core-uti.tex | 7 +- tex/context/base/font-ini.tex | 78 +++-- tex/context/base/lang-all.xml | 2 +- tex/context/base/lang-ini.tex | 2 +- tex/context/base/lang-ita.tex | 2 +- tex/context/base/m-database.tex | 286 ++++++++++++----- tex/context/base/m-r.tex | 83 ++++- tex/context/base/m-streams.tex | 26 +- tex/context/base/m-tryout.tex | 4 + tex/context/base/m-units.tex | 2 +- tex/context/base/math-cow.tex | 30 ++ tex/context/base/math-eul.tex | 106 +++---- tex/context/base/math-ext.tex | 199 ++++++++++++ tex/context/base/meta-ini.tex | 51 +++ tex/context/base/meta-pdf.tex | 197 ++++++++---- tex/context/base/meta-tex.tex | 205 ++++++++++++ tex/context/base/mult-con.tex | 10 +- tex/context/base/mult-ini.tex | 16 +- tex/context/base/page-bck.tex | 24 +- tex/context/base/page-flt.tex | 177 ++++------- tex/context/base/page-imp.tex | 2 +- tex/context/base/page-ini.tex | 13 +- tex/context/base/page-lay.tex | 16 +- tex/context/base/page-log.tex | 2 +- tex/context/base/page-lyr.tex | 2 + tex/context/base/page-mak.tex | 11 +- tex/context/base/page-mar.tex | 2 +- tex/context/base/page-num.tex | 18 +- tex/context/base/page-one.tex | 106 +++---- tex/context/base/page-run.tex | 2 +- tex/context/base/page-set.tex | 2 +- tex/context/base/page-spr.tex | 2 +- tex/context/base/s-abr-01.tex | 6 +- tex/context/base/s-pre-30.tex | 13 + tex/context/base/s-pre-50.tex | 28 +- tex/context/base/supp-lan.tex | 34 +- tex/context/base/supp-mis.tex | 38 ++- tex/context/base/supp-mps.tex | 26 +- tex/context/base/symb-cow.tex | 104 +++++++ tex/context/base/syst-gen.tex | 8 +- tex/context/base/type-cow.tex | 83 +++++ tex/context/base/type-gyr.tex | 36 +++ tex/context/base/type-syn.tex | 20 ++ tex/context/base/verb-c.tex | 11 +- tex/context/base/x-fe.tex | 2 +- tex/context/base/x-set-11.tex | 13 +- tex/context/base/x-set-12.tex | 57 ++-- tex/context/base/xtag-run.tex | 4 +- tex/context/bib/bibl-ams.tex | 2 +- tex/context/bib/bibl-apa-de.tex | 2 +- tex/context/bib/bibl-apa-fr.tex | 2 +- tex/context/bib/bibl-apa.tex | 5 +- tex/context/bib/bibl-aps.tex | 2 +- tex/context/bib/bibl-num-fr.tex | 2 +- tex/context/bib/bibl-num.tex | 8 +- tex/context/bib/bibl-ssa.tex | 2 +- tex/context/bib/t-bib.tex | 638 +++++++++++++++++++++++++++----------- tex/context/bib/t-bibltx.tex | 75 +++++ tex/context/interface/cont-cz.xml | 13 + tex/context/interface/cont-de.xml | 13 + tex/context/interface/cont-en.xml | 13 + tex/context/interface/cont-fr.xml | 13 + tex/context/interface/cont-it.xml | 13 + tex/context/interface/cont-nl.xml | 13 + tex/context/interface/cont-ro.xml | 13 + tex/context/interface/keys-cz.xml | 3 +- tex/context/interface/keys-de.xml | 3 +- tex/context/interface/keys-en.xml | 3 +- tex/context/interface/keys-fr.xml | 3 +- tex/context/interface/keys-it.xml | 3 +- tex/context/interface/keys-nl.xml | 3 +- tex/context/interface/keys-ro.xml | 3 +- tex/context/interface/t-bib.xml | 13 + 90 files changed, 3407 insertions(+), 1624 deletions(-) create mode 100644 tex/context/base/core-tsp.tex create mode 100644 tex/context/base/math-cow.tex create mode 100644 tex/context/base/math-ext.tex create mode 100644 tex/context/base/meta-tex.tex create mode 100644 tex/context/base/symb-cow.tex create mode 100644 tex/context/base/type-cow.tex create mode 100644 tex/context/base/type-gyr.tex create mode 100644 tex/context/bib/t-bibltx.tex (limited to 'tex') diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex index 007629620..70e19b914 100644 --- a/tex/context/base/colo-ini.tex +++ b/tex/context/base/colo-ini.tex @@ -1360,19 +1360,22 @@ \ifx\initializemaintextcolor\undefined -% \def\initializemaintextcolor -% {\doifsomething\@@cltekstkleur -% {\appendtoks\starttextcolor[\@@cltekstkleur]\to\everystarttext -% \appendtoks\stoptextcolor \to\everystoptext -% \let\initializemaintextcolor\relax}} - - % global ? + \let\@@clprevcolor\empty \def\initializemaintextcolor - {\doifelsenothing\@@cltextcolor + {% saveguard for setting text color to empty after + % it has been set + \doifnothing\@@cltextcolor + {\ifx\@@clprevcolor\empty\else + \let\@@cltextcolor\defaulttextcolor + \fi}% + \doifelsenothing\@@cltextcolor {\let\maintextcolor\empty} - {\let\maintextcolor\@@themaintextcolor - \definecolor[\@@themaintextcolor][\@@cltextcolor]% + {\edef\@@clprevcolor{\@@cltextcolor}% + \let\maintextcolor\@@themaintextcolor + \doifelsenothing\@@cltextcolor % another saveguard + {\definecolor[\@@themaintextcolor][\defaulttextcolor]}% + {\definecolor[\@@themaintextcolor][\@@cltextcolor]}% \doinitializemaintextcolor}} \def\doinitializemaintextcolor diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 69ebcd593..c41d99953 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2006.06.09 13:05} +\newcontextversion{2006.07.13 22:26} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new @@ -24,6 +24,9 @@ \unprotect +% \setuplabeltext[\s!itemcount1={{I(},{)}}] +% \def\labeledcountervalue#1{\labeltexts{#1}{\countervalue{#1}}} + \writestatus{\m!systems}{beware: some patches loaded from cont-new.tex} %D A nice example of a plugin: @@ -849,11 +852,65 @@ {\expanded{\everyhbox{\the\everyhbox\noexpand\fastenableencoding{\currentencoding}}}% \def\dealwithmathtextencoding{\let\characterencoding\nocharacterencoding}% \dealwithmathtextencoding} - \appendtoks \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] % \def\separatestring#1\to#2% @@ -1558,6 +1615,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 diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 8deeb434c..2780c21b8 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -31,7 +31,7 @@ %D 2004.8.30 the low level interface is english. Watch out and adapt %D your styles an modules. -\def\contextversion{2006.06.09 13:05} +\def\contextversion{2006.07.13 22:26} %D For those who want to use this: @@ -242,13 +242,14 @@ \input core-vis.tex %input core-con.tex \input core-rul.tex +\input core-num.tex +\input core-tsp.tex % splitter \input core-tab.tex \input core-nav.tex \input core-ref.tex \input core-obj.tex \input core-buf.tex \input core-lst.tex -\input core-num.tex \input core-itm.tex \input core-des.tex \input core-mat.tex @@ -334,12 +335,14 @@ \input type-ini.tex \input type-def.tex +\input meta-tex.tex % we need fonts \input prop-ini.tex \input prop-lay.tex % needs core-ref.tex \input prop-mis.tex \input math-ini.tex % needs enco-ini.tex +\input math-ext.tex %D Now we're ready for more core modules. diff --git a/tex/context/base/core-con.tex b/tex/context/base/core-con.tex index ca2bb7a86..98837ec6d 100644 --- a/tex/context/base/core-con.tex +++ b/tex/context/base/core-con.tex @@ -20,6 +20,21 @@ %D one and a core one, but to keep things simple as well as %D preserve the overview, I decided against splitting. +\let\spr\firstofoneargument % separator +\let\stp\firstofoneargument % stopper + +% cleaner, some day: +% +% \def\isolateseparators % etex only, even works with list separator overloading +% {\unexpanded\def\spr##1{{##1}}% +% \unexpanded\def\stp##1{{##1}}} + +% needed for arab : + +\def\isolateseparators % even works with list separator overloading + {\def\spr##1{{##1}}% + \def\stp##1{{##1}}} + %D \macros %D {numbers} %D diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex index 2f5dafd31..195bb01b7 100644 --- a/tex/context/base/core-des.tex +++ b/tex/context/base/core-des.tex @@ -508,23 +508,23 @@ \setvalue{showdn\v!sub\c!number}% {\getvalue{showdn\c!number}% - \descriptionparameter\c!separator + \spr{\descriptionparameter\c!separator}% \convertednumber[\v!sub\currentdescriptionnumber]} \setvalue{showdn\v!sub\v!sub\c!number}% {\getvalue{showdn\v!sub\c!number}% - \descriptionparameter\c!separator + \spr{\descriptionparameter\c!separator}% \convertednumber[\v!sub\v!sub\currentdescriptionnumber]} \setvalue{showdn\v!sub\v!sub\v!sub\c!number}% {\getvalue{showdn\v!sub\v!sub\c!number}% - \descriptionparameter\c!separator + \spr{\descriptionparameter\c!separator}% \convertednumber[\v!sub\v!sub\v!sub\currentdescriptionnumber]} \def\domakednnumber {\descriptionparameter\c!left \strut\doshowdnnumber - \descriptionparameter\c!stopper + % \descriptionparameter\c!stopper \descriptionparameter\c!right} \setvalue{\??dd\s!set\v!sub\s!sub\s!sub\c!number}#1% @@ -706,7 +706,8 @@ {\getvalue{\??ds#1\c!width}} {\doattributes {\??ds#1}\c!headstyle\c!headcolor - {\getvalue{\??ds#1\c!sample}\getvalue{\??ds#1\c!separator}}} + {\getvalue{\??ds#1\c!sample}% + \spr{\getvalue{\??ds#1\c!separator}}}} {\getvalue{\??ds#1\c!distance}}% \advance\!!widtha \getvalue{\??ds#1\c!distance}% \setbox2\hbox to \!!widtha @@ -715,7 +716,7 @@ {\strut \getvalue{\??ds#1\c!text}% \hss - \getvalue{\??ds#1\c!separator}% + \spr{\getvalue{\??ds#1\c!separator}}% \hskip\getvalue{\??ds#1\c!distance}}}% \parindent\zeropoint \hskip#2\!!widtha\indent\box2% @@ -811,7 +812,7 @@ \c!conversion=, % to be upward compatible \c!way=\v!by\v!text, \c!sectionnumber=\v!yes, - \c!separator=., + \c!separator=\@@koseparator, % per 2006.06.23, was . \c!stopper=, \c!number=, \c!command=] diff --git a/tex/context/base/core-lst.tex b/tex/context/base/core-lst.tex index 74a6e34d7..2d45282c2 100644 --- a/tex/context/base/core-lst.tex +++ b/tex/context/base/core-lst.tex @@ -404,7 +404,7 @@ {\let\splitlistsymbol\currentlistnumber}}% geen \edef ivm enz \doif{\listparameter\c!label}\v!yes{\leftlabeltext\currentlist}% \strut - \def\numberseparator{\listparameter\c!separator}% + \def\numberseparator{\listparameter\c!separator}% overloaded, todo \@EA\dohandlelistnumber\@EA{\splitlistsymbol}% \listparameter\c!stopper \doif{\listparameter\c!label}\v!yes{\rightlabeltext\currentlist}} diff --git a/tex/context/base/core-mak.tex b/tex/context/base/core-mak.tex index 68315ea57..761f83156 100644 --- a/tex/context/base/core-mak.tex +++ b/tex/context/base/core-mak.tex @@ -48,24 +48,6 @@ \def\doplacement {\dodoubleempty\dodoplacement} -% \def\dodoplacement[#1][#2]% correctie moet mooier -% {\bgroup -% \dowithnextbox -% {\setlocalhsize -% \getparameters[#1][#2]% -% \getvalue{#1\c!voor}% -% \doifvalue{#1\c!regelcorrectie}\v!aan \startbaselinecorrection -% \doifinset{\getvalue{#1\c!marge}}{\v!standaard,\v!ja}\noindent -% \hbox to \localhsize -% {\getvalue{#1\c!links}% -% \flushnextbox -% \getvalue{#1\c!rechts}}% -% \doifvalue{#1\c!dieptecorrectie}\v!aan\baselinecorrection -% \doifvalue{#1\c!regelcorrectie }\v!aan\stopbaselinecorrection -% \getvalue{#1\c!na}% -% \egroup} -% \vbox} - \def\dodoplacement[#1][#2]% correctie moet mooier {\bgroup \dowithnextboxcontent diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex index b80c9cc09..2170c44c7 100644 --- a/tex/context/base/core-mat.tex +++ b/tex/context/base/core-mat.tex @@ -155,7 +155,8 @@ [\c!text=\v!formula, \c!way=\@@fmway, \c!blockway=\@@fmblockway, - \c!location=\v!intext] + \c!location=\v!intext, + \c!conversion=\@@fmconversion] \def\setupformulas {\dodoubleargument\getparameters[\??fm]} @@ -244,6 +245,7 @@ [\c!way=\@@nrway, \c!blockway=, \c!sectionnumber=\@@nrsectionnumber, + \c!conversion=\v!numbers, \c!location=\v!right, \c!left=(, \c!right=), @@ -441,9 +443,9 @@ %\forgetall % otherwise backgrounds fail \ifdim\lastskip<\zeropoint\else \par - \ifvmode \ifdim\parskip>\zeropoint\relax - \whitespace \vskip-\parskip % kind of forces and cancels again - \fi \fi + \ifvmode \ifdim\parskip>\zeropoint\relax + \whitespace \vskip-\parskip % kind of forces and cancels again + \fi \fi \fi \doif\displaygridcorrection{-\v!top}{\kern-\strutht}% new, currently only option/default \beforedisplayspace @@ -700,7 +702,7 @@ \def\stopformula {\normalstopformula\egroup$\hss}% #1% \egroup - \stopdisplaymath + \stopdisplaymath \egroup} \def\dispplaceformula[#1]#2$$#3$$% diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex index 2e424c2b7..f50d785f8 100644 --- a/tex/context/base/core-ntb.tex +++ b/tex/context/base/core-ntb.tex @@ -61,14 +61,41 @@ %D However, the next alternative also takes care of preceding %D and following white space. +% \def\bTBLCELL % why not \doinhibitblank +% {\inhibitblank\doconvertfont\tbltblstyle\empty\everypar{\delayedbegstrut}} + +% \def\eTBLCELL +% {\ifhmode +% \delayedendstrut +% \par % added 13/4/2006 +% \else +% \par +% \ifdim\prevdepth<\zeropoint % =-1000pt ? +% \vskip-\strutdp +% \else +% \removebottomthings +% \fi +% \fi} + +%D \startbuffer +%D \bTABLE[left={(},right={)},top=\startnarrower,bottom=\stopnarrower] +%D \bTR \bTD something \eTD \eTR +%D \eTABLE +%D +%D \typebuffer \getbuffer + \def\bTBLCELL % why not \doinhibitblank - {\inhibitblank\doconvertfont\tbltblstyle\empty\everypar{\delayedbegstrut}} + {\inhibitblank + \doconvertfont\tbltblstyle\empty + \everypar{\tbltblleft\delayedbegstrut}} \def\eTBLCELL {\ifhmode \delayedendstrut + \tbltblright \par % added 13/4/2006 \else + % not sure yet:\tbltblright \par \ifdim\prevdepth<\zeropoint % =-1000pt ? \vskip-\strutdp @@ -226,57 +253,15 @@ \let\setupTBLsection\relax -% \def\setupTBLcell#1#2% cell over col over row -% {\setupTBLsection % already forgotten -% \getvalue{\@@tblprefix\v!each\v!each}% -% \getvalue{\@@tblprefix\c!y\v!each}% -% \getvalue{\@@tblprefix\c!x\v!each}% -% \getvalue{\@@tblprefix\c!y\v!oddeven{#1}}% -% \getvalue{\@@tblprefix\c!x\v!oddeven{#2}}% -% \getvalue{\@@tblprefix\c!x\v!oddeven{#2}\c!y\v!oddeven{#1}}% -% \ifnum#1=\plusone -% \getvalue{\@@tblprefix\c!y\v!first}% -% \executeifdefined{\@@tblprefix\c!x#2\c!y\v!first}\donothing -% \fi -% \ifnum#2=\plusone -% \getvalue{\@@tblprefix\c!x\v!first}% -% \executeifdefined{\@@tblprefix\c!x\v!first\c!y#1}\donothing -% \fi -% \ifnum#1=\maximumrow\relax -% \getvalue{\@@tblprefix\c!y\v!last}% -% \executeifdefined{\@@tblprefix\c!x#2\c!y\v!last}\donothing -% \fi -% \ifnum#2=\maximumcol\relax -% \getvalue{\@@tblprefix\c!x\v!last}% -% \executeifdefined{\@@tblprefix\c!x\v!last\c!y#1}\donothing -% \fi -% \ifnum#1=\maximumrow\relax\ifnum#2=\maximumcol\relax -% \getvalue{\@@tblprefix\c!x\v!last\c!y\v!last}% -% \fi\fi -% \ifnum#1=\plusone \ifnum#2=\plusone -% \getvalue{\@@tblprefix\c!x\v!first\c!y\v!first}% -% \fi\fi -% \ifnum#1>\noftblhdnxlines\else -% \executeifdefined{\@@tblprefix\v!header\v!each}\donothing -% \executeifdefined{\@@tblprefix\v!header#2}\donothing -% \fi -% \executeifdefined{\@@tblprefix\c!y#1}\donothing -% \getvalue{\@@tbl\@@tbl\c!extras}\letvalue{\@@tbl\@@tbl\c!extras}\relax % new, see x-fo -% \executeifdefined{\@@tblprefix\c!x#2}\donothing -% \getvalue{\@@tbl\@@tbl\c!extras}\letvalue{\@@tbl\@@tbl\c!extras}\relax % new, see x-fo -% \executeifdefined{\@@tblprefix\c!x#2\c!y#1}\donothing -% \global\letcscsname\@@tblsplitafter\csname\@@tbl\@@tbl\c!after\endcsname -% \relax} - \def\setupTBLcell#1#2% cell over col over row {\setupTBLsection % already forgotten -\edef\positiverow{\number#1}% -\edef\positivecol{\number#2}% -\scratchcounter-\maximumrow\advance\scratchcounter#1\advance\scratchcounter\minusone -\edef\negativerow{\number\scratchcounter}% -\scratchcounter-\maximumcol\advance\scratchcounter#2\advance\scratchcounter\minusone -\edef\negativecol{\number\scratchcounter}% + \edef\positiverow{\number#1}% + \edef\positivecol{\number#2}% + \scratchcounter-\maximumrow\advance\scratchcounter#1\advance\scratchcounter\minusone + \edef\negativerow{\number\scratchcounter}% + \scratchcounter-\maximumcol\advance\scratchcounter#2\advance\scratchcounter\minusone + \edef\negativecol{\number\scratchcounter}% \getvalue{\@@tblprefix\v!each\v!each}% \getvalue{\@@tblprefix\c!y\v!each}% \getvalue{\@@tblprefix\c!x\v!each}% @@ -310,13 +295,13 @@ \executeifdefined{\@@tblprefix\v!header\positivecol}\donothing \fi \executeifdefined{\@@tblprefix\c!y\positiverow}\donothing -\executeifdefined{\@@tblprefix\c!y\negativerow}\donothing + \executeifdefined{\@@tblprefix\c!y\negativerow}\donothing \getvalue{\@@tbl\@@tbl\c!extras}\letvalue{\@@tbl\@@tbl\c!extras}\relax % new, see x-fo \executeifdefined{\@@tblprefix\c!x\positivecol}\donothing -\executeifdefined{\@@tblprefix\c!x\negativecol}\donothing + \executeifdefined{\@@tblprefix\c!x\negativecol}\donothing \getvalue{\@@tbl\@@tbl\c!extras}\letvalue{\@@tbl\@@tbl\c!extras}\relax % new, see x-fo \executeifdefined{\@@tblprefix\c!x\positivecol\c!y\positiverow}\donothing -\executeifdefined{\@@tblprefix\c!x\negativecol\c!y\negativerow}\donothing + \executeifdefined{\@@tblprefix\c!x\negativecol\c!y\negativerow}\donothing \global\letcscsname\@@tblsplitafter\csname\@@tbl\@@tbl\c!after\endcsname \relax} @@ -543,7 +528,8 @@ \processaction [\tbltblsplit] [ \v!yes=>\enableTBLbreaktrue, - \v!repeat=>\enableTBLbreaktrue\multipleTBLheadstrue]% + \v!repeat=>\enableTBLbreaktrue\multipleTBLheadstrue, + \v!auto=>\ifinsidesplitfloat\enableTBLbreaktrue\fi] \processaction [\tbltblheader] [\v!repeat=>\multipleTBLheadstrue]% @@ -966,97 +952,100 @@ \donetrue \fi\fi \ifdone - \executeifdefined{splittblbox\tbltblsplitmethod}\splittblboxa{#1}% + \executeifdefined{dosplittblbox\tbltblsplitmethod}\dosplittblbox{#1}% \else \notsplittblbox{#1}% \fi} \newbox\TABLEsplitbox % public, don't change -% todo: mode: first|next (of niets) +\let\extratblsplitheight\zeropoint % additional space taken by before/afterTABLEsplitbox -\def\splittblboxa#1% spacing between rows gets lost in split - {\setbox\TABLEsplitbox\vbox{#1}% - \setbox8\vbox{\doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}}% - \ifmultipleTBLheads - \setbox2\vbox{}% - \setbox4\vbox{}% - \dorecurse\noftblheadlines - {\setbox0\vsplit\TABLEsplitbox to \lineheight - \setbox2\vbox{\unvcopy2\unvcopy0}}% - \dorecurse\noftblnextlines - {\setbox0\vsplit\TABLEsplitbox to \lineheight - \setbox4\vbox{\unvcopy4\unvcopy0}}% - \ifcase\noftblheadlines\else - \ifdim\pagegoal<\maxdimen - \dimen0\ht2 - \advance\dimen0\ht8 - \advance\dimen0\pagetotal\relax - \ifdim\dimen0>\pagegoal - \bgroup\page\egroup % make sure that local vars are kept - \fi - \fi - \unvcopy2 - \ifcase\noftblnextlines\else - \setbox2\box4 - \fi - \fi - \fi - \donefalse - \!!doneafalse - \doloop - {\setbox0\vsplit\TABLEsplitbox to \lineheight - \if!!donea - \ifdim\pagegoal<\maxdimen - \setbox0\vbox{\unvbox0}% - \ifdim\ht0>\zeropoint - \dimen0\ht0 - \advance\dimen0\ht8 - \advance\dimen0\pagetotal\relax - \ifdim\dimen0>\pagegoal - \bgroup\page\egroup % make sure that local vars are kept - \ifmultipleTBLheads - \ifcase\noftblheadlines\else\unvcopy2\fi - \fi - \fi - \fi - \fi - \fi - \!!doneatrue - \ifdone - \doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}% - \fi - \unvbox0 - %\allowbreak - \bgroup - % todo: what if tblnextlines ? - \scratchcounter\recurselevel - \ifmultipleTBLheads - \advance\scratchcounter\noftblheadlines - \fi - \setupTBLcell{\number\scratchcounter}1 - \ifx\@@tblsplitafter\relax - \allowbreak - \else - \doifelsenothing\@@tblsplitafter - \allowbreak - {\scratchcounter\realpageno - \@@tblsplitafter - \ifmultipleTBLheads - \ifnum\scratchcounter<\realpageno - \ifcase\noftblheadlines\else\unvcopy2\fi - \fi - \fi}% - \fi - \egroup - \ifvoid\TABLEsplitbox \exitloop \else \donetrue \fi}} +% todo: mode: first|next (of niets) -\let\extratblsplitheight\zeropoint % additional space taken by before/afterTABLEsplitbox +% \def\dosplittblboxa#1% spacing between rows gets lost in split +% {\setbox\TABLEsplitbox\vbox{#1}% +% \setbox8\vbox{\doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}}% +% \ifmultipleTBLheads +% \setbox2\vbox{}% +% \setbox4\vbox{}% +% \dorecurse\noftblheadlines +% {\setbox0\vsplit\TABLEsplitbox to \lineheight +% \setbox2\vbox{\unvcopy2\unvcopy0}}% +% \dorecurse\noftblnextlines +% {\setbox0\vsplit\TABLEsplitbox to \lineheight +% \setbox4\vbox{\unvcopy4\unvcopy0}}% +% \ifcase\noftblheadlines\else +% \ifdim\pagegoal<\maxdimen +% \dimen0\ht2 +% \advance\dimen0\ht8 +% \advance\dimen0\pagetotal\relax +% \ifdim\dimen0>\pagegoal +% \bgroup\page\egroup % make sure that local vars are kept +% \fi +% \fi +% \unvcopy2 +% \ifcase\noftblnextlines\else +% \setbox2\box4 +% \fi +% \fi +% \fi +% \donefalse +% \!!doneafalse +% \doloop +% {\setbox0\vsplit\TABLEsplitbox to \lineheight +% \if!!donea +% \ifdim\pagegoal<\maxdimen +% \setbox0\vbox{\unvbox0}% +% \ifdim\ht0>\zeropoint +% \dimen0\ht0 +% \advance\dimen0\ht8 +% \advance\dimen0\pagetotal\relax +% \ifdim\dimen0>\pagegoal +% \bgroup\page\egroup % make sure that local vars are kept +% \ifmultipleTBLheads +% \ifcase\noftblheadlines\else\unvcopy2\fi +% \fi +% \fi +% \fi +% \fi +% \fi +% \!!doneatrue +% \ifdone +% \doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}% +% \fi +% \unvbox0 +% %\allowbreak +% \bgroup +% % todo: what if tblnextlines ? +% \scratchcounter\recurselevel +% \ifmultipleTBLheads +% \advance\scratchcounter\noftblheadlines +% \fi +% \setupTBLcell{\number\scratchcounter}1 +% \ifx\@@tblsplitafter\relax +% \allowbreak +% \else +% \doifelsenothing\@@tblsplitafter +% \allowbreak +% {\scratchcounter\realpageno +% \@@tblsplitafter +% \ifmultipleTBLheads +% \ifnum\scratchcounter<\realpageno +% \ifcase\noftblheadlines\else\unvcopy2\fi +% \fi +% \fi}% +% \fi +% \egroup +% \ifvoid\TABLEsplitbox \exitloop \else \donetrue \fi}} -% \def\splittblboxb#1% -% {\testpage[2]% quite save since a row is > 1 lineheight and we don't want one-liners +% \def\dosplittblboxb#1% +% {\scratchdimen-\extratblsplitheight +% \advance\scratchdimen-\tbltblsplitoffset +% \expanded{\testpage[2][\the\scratchdimen]}% quite save since a row is > 1 lineheight and we don't want one-liners % \setbox\TABLEsplitbox\vbox{#1}% % \setbox8\vbox{\doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}}% +% \dimen8\ht8\advance\dimen8\dp8 % \ifmultipleTBLheads % \setbox2\vbox{}% % \setbox4\vbox{}% @@ -1072,33 +1061,57 @@ % {\ifdim\pagegoal<\maxdimen % \scratchdimen\pagegoal % \advance\scratchdimen-\pagetotal +% \!!donecfalse % \else % \scratchdimen\textheight +% \!!donectrue % \fi -% \ifmultipleTBLheads -% \ifcase\noftblheadlines\else -% \advance\scratchdimen-\ht2 -% \fi -% \fi -% \advance\scratchdimen-\ht8 -% \getnoflines\scratchdimen -% \ifdim\noflines\lineheight>\scratchdimen -% \advance\scratchdimen-\lineheight -% \fi +% \advance\scratchdimen-\dimen8 % \advance\scratchdimen-\extratblsplitheight +% \advance\scratchdimen-\tbltblsplitoffset % \setbox\finaltblbox\vbox % {\ifmultipleTBLheads % \ifcase\noftblheadlines\else -% \unvcopy2 -% \doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}% +% \unvcopy2 \doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}% % \fi -% \fi -% \setbox0\vsplit\TABLEsplitbox to\scratchdimen -% \unvbox0}% +% \fi}% % \if!!donea\else\ifcase\noftblnextlines\else % \setbox2\box4 % \fi\fi % \!!doneatrue +% % alternatively we could use a kind of balancing like splitter +% % first to scratchdimen and then smaller etc; more code and copy -) +% \!!counta\zerocount +% \doloop +% {\setbox\scratchbox\vsplit\TABLEsplitbox to \onepoint +% \setbox\scratchbox\vbox{\unvbox\scratchbox}% +% \bgroup +% \advance\scratchdimen-\ht\scratchbox +% \advance\scratchdimen-\dp\scratchbox +% \advance\scratchdimen-\ht\finaltblbox +% \advance\scratchdimen-\dp\finaltblbox\relax +% \ifdim\scratchdimen>\zeropoint +% \egroup +% \setbox\finaltblbox\vbox +% {\unvbox\finaltblbox +% \unvbox\scratchbox}% +% \ifvoid\TABLEsplitbox \exitloop \fi +% \else\if!!donec +% % we have text height available, but the (one) cell is too +% % large to fit, so, in order to avoid loops/deadcycles we do: +% \egroup +% \setbox\finaltblbox\vbox +% {\unvbox\finaltblbox +% \unvbox\scratchbox}% +% \exitloop +% \else +% \egroup +% \setbox\TABLEsplitbox\vbox +% {\unvbox\scratchbox +% \ifvoid\TABLEsplitbox\else\unvbox\TABLEsplitbox\allowbreak\fi}% +% \exitloop +% \fi\fi}% +% % % \postprocessTABLEsplitbox\finaltblbox % \ifvoid\TABLEsplitbox % \beforeTABLEsplitbox @@ -1107,116 +1120,42 @@ % \@@tblsplitafter % \exitloop % \else -% % hack -% \scratchdimen\pagegoal -% \ifdim\scratchdimen<\maxdimen +% % hack +% \ifdim\pagegoal<\maxdimen +% \scratchdimen\pagegoal % \advance\scratchdimen \lineheight % \global\pagegoal\scratchdimen % \fi % % brrr -% \beforeTABLEsplitbox -% \box\finaltblbox -% \afterTABLEsplitbox -% \@@tblsplitafter +% \ifdim\ht\finaltblbox>\zeropoint +% \beforeTABLEsplitbox +% \box\finaltblbox +% \afterTABLEsplitbox +% \@@tblsplitafter +% \fi % \page % \fi}} -\def\splittblboxb#1% - {\scratchdimen-\extratblsplitheight - \advance\scratchdimen-\tbltblsplitoffset - \expanded{\testpage[2][\the\scratchdimen]}% quite save since a row is > 1 lineheight and we don't want one-liners - \setbox\TABLEsplitbox\vbox{#1}% - \setbox8\vbox{\doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}}% - \dimen8\ht8\advance\dimen8\dp8 +\def\dosplittblbox#1% + {\resettsplit + \def\tsplitminimumfreelines{2}% + \def\tsplitminimumfreespace{\dimexpr\extratblsplitheight+\tbltblsplitoffset\relax}% + \def\tsplitbeforeresult {\beforeTABLEsplitbox}% + \def\tsplitafterresult {\afterTABLEsplitbox}% + \def\tsplitafter {\@@tblsplitafter}% + \setbox\tsplitcontent\vbox{#1}% \the\tbltoks \ifmultipleTBLheads - \setbox2\vbox{}% - \setbox4\vbox{}% \dorecurse\noftblheadlines - {\setbox0\vsplit\TABLEsplitbox to \lineheight - \setbox2\vbox{\unvcopy2\unvcopy0}}% + {\setbox\scratchbox\vsplit\tsplitcontent to \lineheight + \setbox\tsplithead\vbox{\unvcopy\tsplithead\unvcopy\scratchbox}}% \dorecurse\noftblnextlines - {\setbox0\vsplit\TABLEsplitbox to \lineheight - \setbox4\vbox{\unvcopy4\unvcopy0}}% + {\setbox\scratchbox\vsplit\tsplitcontent to \lineheight + \setbox\tsplitnext\vbox{\unvcopy\tsplitnext\unvcopy\scratchbox}}% \fi - \!!doneafalse - \doloop - {\ifdim\pagegoal<\maxdimen - \scratchdimen\pagegoal - \advance\scratchdimen-\pagetotal - \!!donecfalse - \else - \scratchdimen\textheight - \!!donectrue - \fi - \advance\scratchdimen-\dimen8 - \advance\scratchdimen-\extratblsplitheight - \advance\scratchdimen-\tbltblsplitoffset - \setbox\finaltblbox\vbox - {\ifmultipleTBLheads - \ifcase\noftblheadlines\else - \unvcopy2 \doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}% - \fi - \fi}% - \if!!donea\else\ifcase\noftblnextlines\else - \setbox2\box4 - \fi\fi - \!!doneatrue - % alternatively we could use a kind of balancing like splitter - % first to scratchdimen and then smaller etc; more code and copy -) - \!!counta\zerocount - \doloop - {\setbox\scratchbox\vsplit\TABLEsplitbox to \onepoint - \setbox\scratchbox\vbox{\unvbox\scratchbox}% - \bgroup - \advance\scratchdimen-\ht\scratchbox - \advance\scratchdimen-\dp\scratchbox - \advance\scratchdimen-\ht\finaltblbox - \advance\scratchdimen-\dp\finaltblbox\relax - \ifdim\scratchdimen>\zeropoint - \egroup - \setbox\finaltblbox\vbox - {\unvbox\finaltblbox - \unvbox\scratchbox}% - \ifvoid\TABLEsplitbox \exitloop \fi - \else\if!!donec - % we have text height available, but the (one) cell is too - % large to fit, so, in order to avoid loops/deadcycles we do: - \egroup - \setbox\finaltblbox\vbox - {\unvbox\finaltblbox - \unvbox\scratchbox}% - \exitloop - \else - \egroup - \setbox\TABLEsplitbox\vbox - {\unvbox\scratchbox - \ifvoid\TABLEsplitbox\else\unvbox\TABLEsplitbox\allowbreak\fi}% - \exitloop - \fi\fi}% - % - \postprocessTABLEsplitbox\finaltblbox - \ifvoid\TABLEsplitbox - \beforeTABLEsplitbox - \box\finaltblbox - \afterTABLEsplitbox - \@@tblsplitafter - \exitloop - \else - % hack - \ifdim\pagegoal<\maxdimen - \scratchdimen\pagegoal - \advance\scratchdimen \lineheight - \global\pagegoal\scratchdimen - \fi - % brrr - \ifdim\ht\finaltblbox>\zeropoint - \beforeTABLEsplitbox - \box\finaltblbox - \afterTABLEsplitbox - \@@tblsplitafter - \fi - \page - \fi}} + \doifsomething\tbltblspaceinbetween + {\def\tsplitinbetween{\blank[\tbltblspaceinbetween]}}% + \def\postprocesstsplit{\postprocessTABLEsplitbox{\box\tsplitresult}}% + \handletsplit} % ! ! ! ! TODO: naast \postprocessTABLEsplitbox ook evt \postprocessTABLEbox voor niet split @@ -1235,9 +1174,14 @@ {\iftraceTABLE\showtblwids{B#1}\fi \!!dimena\hsize \!!counta\zerocount +% test, dunno yet +\advance\!!dimena-\tbltblleftmargindistance +\advance\!!dimena-\tbltblrightmargindistance +\advance\!!dimena-\tbltblcolumndistance \dorecurse\maximumcol {\scratchdimen\gettblaut\recurselevel\relax -% test: \advance\!!dimena-\gettbldis\recurselevel\relax +% test, seems to work ok +\advance\!!dimena-\gettbldis\recurselevel\relax \ifdim\scratchdimen>\zeropoint\relax \advance\!!dimena -\scratchdimen \else @@ -1498,12 +1442,14 @@ \c!spaceinbetween=, \c!maxwidth=8em, \c!textwidth=\hsize, - \c!split=\v!no, + \c!split=\v!auto, \c!splitoffset=0pt, \c!distance=\zeropoint, % individual column \c!columndistance=\zeropoint, % each column (whole table) \c!leftmargindistance=\zeropoint, % whole table \c!rightmargindistance=\zeropoint,% whole table + \c!left=, + \c!right=, \c!splitmethod=a] %D We have already prepared the previous macros for nesting, diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex index f3224d94d..0876ba13d 100644 --- a/tex/context/base/core-ref.tex +++ b/tex/context/base/core-ref.tex @@ -198,8 +198,9 @@ \the\everyreference \makesectionformat \writereference{#2} - {\sectionformat\sectionseparator\sectionseparator\noexpand\pagenumber} - {\noexpand\realfolio}{#3}% + {\sectionformat\sectionseparator\sectionseparator\noexpand\pagenumber}% + {\noexpand\realfolio}% + {#3}% \egroup} \def\rawpagereference#1#2% @@ -207,15 +208,18 @@ \the\everyreference \makesectionformat \writereference{#2} - {\sectionformat\sectionseparator\sectionseparator\noexpand\pagenumber} - {\noexpand\realfolio}{}% + {\sectionformat\sectionseparator\sectionseparator\noexpand\pagenumber}% + {\noexpand\realfolio}% + {}% \egroup} \def\rawtextreference#1#2#3% {\bgroup \the\everyreference \writereference{#2} - {}{\noexpand\realfolio}{#3}% + {}% + {\noexpand\realfolio}% + {#3}% \egroup} diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex index a192c6526..ebc743af1 100644 --- a/tex/context/base/core-reg.tex +++ b/tex/context/base/core-reg.tex @@ -423,12 +423,13 @@ \def\doregistercharacter[#1]#2% {\global\firstregisterentrytrue - \doifelsevalue{\??id#1\c!indicator}\v!yes - {\executeifdefined - {\strippedcsname\doregistercharacter\getvalue{\??id#1\c!alternative}}% - \doregistercharactera - [#1]{#2}} - {\noregistercharacter[#1]{#2}}} + \doifsomething{#2} + {\doifelsevalue{\??id#1\c!indicator}\v!yes + {\executeifdefined + {\strippedcsname\doregistercharacter\getvalue{\??id#1\c!alternative}}% + \doregistercharactera + [#1]{#2}} + {\noregistercharacter[#1]{#2}}}} \def\noregistercharacter[#1]#2% {\getvalue{\??id#1\c!before}% @@ -465,8 +466,9 @@ % {\pagereference[#1:#2]}} \def\doregisterreference[#1]#2% - {\doifvalue{\??id#1\c!referencing}\v!on - {\pagereference[#1:\strippedcsname#2]}} + {\doifsomething{#2} + {\doifvalue{\??id#1\c!referencing}\v!on + {\pagereference[#1:\strippedcsname#2]}}} \def\dosetpageregisterletter#1#2% {\gdef\c!entryreference diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex index c7c480c1b..83d1800d8 100644 --- a/tex/context/base/core-rul.tex +++ b/tex/context/base/core-rul.tex @@ -641,7 +641,7 @@ \def\copylocalframed[#1]#2[#3]% {\copyparameters[#1][#3]% - [\c!width,\c!height,\c!offset,\c!empty,\c!rulethickness,% + [\c!width,\c!height,\c!autowidth,\c!offset,\c!empty,\c!rulethickness,% \c!radius,\c!corner,\c!depth,\c!frame,\c!framecolor,% \c!foregroundstyle,\c!foregroundcolor,\c!lines,\c!orientation,% \c!topframe,\c!bottomframe,\c!leftframe,\c!rightframe,% @@ -741,6 +741,8 @@ \edef\@@locallocation {\framedparameter\c!location}% \edef\@@localorientation{\framedparameter\c!orientation}% % + \edef\@@localautowidth {\framedparameter\c!autowidth}% + % \ifx\@@localframing\v!overlay % no frame, no offset, no framewidth \boxhasframefalse \let\localoffset\v!overlay @@ -1035,14 +1037,21 @@ {\dontshowcomposition \@@stopframedorientation \ifboxhasformat - \ifx\localwidth\v!fit + \ifx\@@localautowidth\v!force \ifreshapeframebox\doreshapeframedbox\fi \boxhaswidthfalse - \else\ifx\localwidth\v!fixed - \boxhaswidthfalse \else - \resetshapeframebox - \fi\fi + \ifx\localwidth\v!fit + \ifx\@@localautowidth\v!yes + \ifreshapeframebox\doreshapeframedbox\fi + \fi + \boxhaswidthfalse + \else\ifx\localwidth\v!fixed + \boxhaswidthfalse + \else + \resetshapeframebox + \fi\fi + \fi \else \resetshapeframebox \fi @@ -1490,10 +1499,38 @@ %D or free widths and heights. Each combination gets its own %D macro. +%D The following code handles one-liners: \type{align={line,flushright}}. +%D Beware, since we entered a group and either or not grab the next +%D bgroup token, we need to finish the group in the oneliner mode. + +\ifx\raggedoneliner\undefined \chardef\raggedoneliner\zerocount \fi + +\def\doformatonelinerbox % beware: assumes explicit preceding bgroup + {\ifcase\raggedoneliner + \expandafter\nodoformatonelinerbox + \else + \expandafter\dodoformatonelinerbox + \fi} + +\def\dodoformatonelinerbox + {\dowithnextboxcontent + {\ignorespaces} + {\hbox to \hsize + {\ifcase\raggedstatus\or\hss\or\hss\fi + \unhbox\nextbox \removeunwantedspaces + \ifcase\raggedstatus\or \or\hss\or\hss\fi}% + \egroup} + \hbox} + +\def\nodoformatonelinerbox % grabs { + {\let\next=} + +%D The handlers: + \def\doformatboxSomeFormat {\vbox to \!!heighta \bgroup - \let\postprocessframebox\relax + \let\postprocessframebox\relax \forgetall \oninterlineskip \hsize\!!widtha @@ -1503,16 +1540,15 @@ \dobeforeframedbox \bgroup \localbegstrut - \@@handleoneliner \aftergroup\localendstrut \aftergroup\doafterframedbox \aftergroup\egroup - \let\next=} + \doformatonelinerbox} \def\doformatboxNoFormat {\vbox to \!!heighta \bgroup - \let\postprocessframebox\relax + \let\postprocessframebox\relax \forgetall \oninterlineskip \hsize\!!widtha @@ -1522,11 +1558,10 @@ \vss \bgroup \localbegstrut - \@@handleoneliner \aftergroup\localendstrut \aftergroup\vss \aftergroup\egroup - \let\next=} + \doformatonelinerbox} \def\doformatboxHeight {\vbox to \!!heighta @@ -1542,8 +1577,7 @@ \aftergroup\vss \aftergroup\egroup \localbegstrut - \@@handleoneliner - \let\next=} + \doformatonelinerbox} \def\doformatboxWidth {\vbox @@ -1557,11 +1591,10 @@ \dobeforeframedbox \bgroup \localbegstrut - \@@handleoneliner \aftergroup\localendstrut \aftergroup\doafterframedbox \aftergroup\egroup - \let\next=} + \doformatonelinerbox} \def\doformatboxVSize {\vbox to \!!heighta @@ -1578,8 +1611,7 @@ \bgroup \aftergroup\egroup \localstrut - \@@handleoneliner - \let\next=} + \doformatonelinerbox} \def\doformatboxHSize {\hbox to \!!widtha @@ -1589,11 +1621,10 @@ \doframedsetups \hss \localstrut - \@@handleoneliner \bgroup \aftergroup\hss \aftergroup\egroup - \let\next=} + \doformatonelinerbox} \def\doformatboxNoSize {\hbox @@ -1601,8 +1632,7 @@ \let\postprocessframebox\relax \doframedsetups \localstrut - \@@handleoneliner - \let\next=} + \doformatonelinerbox} \let\doframedsetups\relax @@ -3349,6 +3379,7 @@ \c!autostrut=\v!yes, \c!location=\v!normal, \c!orientation=, + \c!autowidth=\v!yes, \c!setups=] \setupscreens diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex index 30ceeed2e..b94ceee70 100644 --- a/tex/context/base/core-sec.tex +++ b/tex/context/base/core-sec.tex @@ -79,25 +79,25 @@ % and postprocessed on demand \def\numberseparator {.} % reasonable default -\def\sectionseparator{:} % was : but is now - +\def\sectionseparator{-} % was : but is now - -\def\@@filterfirstpart [#1::#2]{#1} -\def\@@filtersecondpart [#1::#2]{#2} +\def\@@filterfirstpart [#1--#2]{#1} +\def\@@filtersecondpart [#1--#2]{#2} -\def\@@filterblockpart [#1::#2::#3]{#1} -\def\@@filternumberpart [#1::#2::#3]{#2} -\def\@@filterpagepart [#1::#2::#3]{#3} -\def\@@filterblocknumberpart[#1::#2::#3]{#1::#2} +\def\@@filterblockpart [#1--#2--#3]{#1} +\def\@@filternumberpart [#1--#2--#3]{#2} +\def\@@filterpagepart [#1--#2--#3]{#3} +\def\@@filterblocknumberpart[#1--#2--#3]{#1--#2} -\def\@@filterheadpart[#1]{\@EA\@@dofilterheadpart\@EA[#1:0]} -\def\@@filtertailpart[#1]{\@EA\@@dofiltertailpart\@EA[#1:0]} +\def\@@filterheadpart[#1]{\@EA\@@dofilterheadpart\@EA[#1-0]} +\def\@@filtertailpart[#1]{\@EA\@@dofiltertailpart\@EA[#1-0]} -\def\@@dofilterheadpart[#1:#2]{#1} -\def\@@dofiltertailpart[#1:#2]{#2} +\def\@@dofilterheadpart[#1-#2]{#1} +\def\@@dofiltertailpart[#1-#2]{#2} -\def\@@filterlevelpart[#1::#2::#3]{\@@dofilterlevelpart[#2:0:0:0:0]} +\def\@@filterlevelpart[#1--#2--#3]{\@@dofilterlevelpart[#2-0-0-0-0]} -\def\@@dofilterlevelpart[#1:0:0:0:#2]{#1} +\def\@@dofilterlevelpart[#1-0-0-0-#2]{#1} \def\gobbleuntilrelax#1\relax{} @@ -174,6 +174,8 @@ \def\rawsectionnumber#1% {\countervalue{\??se#1}} +\def\precedingseparator{\@@koseparator} % brrr + \def\domakeprecedingsectionnumber[#1]% will become ugly after speed up {\bgroup % added \globallet\precedingsectionnumber\empty @@ -189,7 +191,8 @@ \doifnot\currentsection\zerosection {\doifnot{\@@sectionvalue\currentsection}{0} {\xdef\precedingsectionnumber% - {\getvalue{\currentsection\c!number}.}}}% + {\getvalue{\currentsection\c!number}% + \spr{\precedingseparator}}}}% \fi}% \fi \egroup} @@ -219,29 +222,21 @@ {\precedingsectionnumber\convertednumber[#1]}% \egroup} -% \def\preparethenumber#1#2#3% {\??id#1} \number \result -% {\doifelsevaluenothing{#1\c!separator} -% {\let\numberseparator\empty -% \let#3#2} -% {% was \unexpanded \edef, but we need it unexpanded ! -% \edef\numberseparator{\getvalue{#1\c!separator}}% -% \edef#3{\@EA\separatednumber\@EA{#2}\getvalue{#1\c!stopper}}}} % hm, etex - \def\preparethenumber#1#2#3% {\??id#1} \number \result {\doifelsevaluenothing{#1\c!separator} {\let\numberseparator\empty \let#3#2} {% was \unexpanded \edef, but we need it unexpanded ! - \edef\numberseparator{\getvalue{#1\c!separator}}% + \edef\numberseparator{\spr{\getvalue{#1\c!separator}}}% \doifelsenothing{\executeifdefined{#1\c!suffix}\empty} {\edef#3% {\@EA\separatednumber\@EA{#2}% - \getvalue{#1\c!stopper}}} + }}%\stp{\getvalue{#1\c!stopper}}}} {\edef#3% {\@EA\separatednumber\@EA{#2}% - \getvalue{#1\c!separator}% + \spr{\getvalue{#1\c!separator}}% \getvalue{#1\c!suffix}% - \getvalue{#1\c!stopper}}}}} + \stp{\getvalue{#1\c!stopper}}}}}} \def\sectionnumberonly[#1]% {\makesectionnumber[#1]% @@ -268,19 +263,19 @@ \makecounter{\??se\v!text} \letvalueempty{\??se\v!text\c!before} -\letvalueempty{\??se\v!text\c!after } +\letvalueempty{\??se\v!text\c!after } \setvalue {\v!text\c!number}{0} \letvalueempty{\v!text\s!format} \letvalueempty{\??sk\v!text} -\letvalueempty{\??sk } +\letvalueempty{\??sk } -\letvalue{\??by }\v!text -\letvalue{\??by\v!text }\v!text -\letvalue{\??by\v!all }\v!text -\letvalue{\??by\v!by }\v!text -\letvalue{\??by\v!by\v!text }\v!text +\letvalue{\??by }\v!text +\letvalue{\??by\v!text }\v!text +\letvalue{\??by\v!all }\v!text +\letvalue{\??by\v!by }\v!text +\letvalue{\??by\v!by\v!text}\v!text \letvalue{\??by\v!by\v!all }\v!text \letvalue{\??by\v!by\v!page}\v!text % see footnotes @@ -294,16 +289,6 @@ {\dodosetupsection[#1]}% {\dodosetupsection[\sectionofhead{#1}]}} -% \def\dosetupsection[#1][#2][#3]% -% {\ifthirdargument -% \getparameters[\??se#1#2][#3]% -% \else -% \getparameters[\??se#1][#2]% -% \fi -% \doifelsevalue{\??se#1\c!previousnumber}\v!yes -% {\setvalue{#1\c!number}{\@@longsectionnumber {#1}}} -% {\setvalue{#1\c!number}{\@@shortsectionnumber{#1}}}} - \def\dodosetupsection[#1][#2][#3]% {\doifdefined{\??se#1} {\ifthirdargument @@ -333,29 +318,6 @@ \def\decouplemarking[#1]% {\couplemarking[#1][]} -% \def\definesection[#1]% -% {\doifundefined{\??se#1} -% {\doifelsenothing\firstsection -% {\def\firstsection{#1}% -% \setevalue{\??se#1\c!before}{\v!text}% -% \setevalue{\??se\v!text\c!after}{#1}} -% {\setevalue{\??se\commalistelement\c!after}{#1}% -% \setevalue{\??se#1\c!before}{\lastsection}% -% \setevalue{\??se\lastsection\c!after}{#1}}% -% \advance\nofsections \plusone -% \setevalue{\??se#1\c!level}{\the\nofsections}% -% \letvalue{\??se#1\c!after}\empty -% \setvalue{\e!next#1}{\@@nextsectionnumber{#1}}% -% \setvalue{#1\c!number}{\@@longsectionnumber{#1}}% -% \setvalue{#1\s!format}{\@@longformatnumber{#1}}% -% \setevalue{\??by#1}{#1}% -% \setevalue{\??by\v!by#1}{#1}% -% \makecounter{\??se#1}% -% \edef\lastsection{#1}% -% \setvalue{\??sk#1}{#1}% -% \letvalue{\??se#1\c!marking}\empty -% \setupsection[#1][\c!previousnumber=\v!yes]}}% - \def\definesection[#1]% {\doifundefined{\??se#1} {\doifelsenothing\firstsection @@ -395,12 +357,6 @@ \fi \fi} -% \def\@@setsectionnumber#1#2% -% {\letgvalueempty{\??se#1\s!start}% signal i.p.v. boolean -% \setcounter{\??se#1}{#2}% -% \ifconditional\@@resetsubheadnumbers\resetsectioncounters{#1}\fi -% \checkpagecounter} - \def\@@setsectionnumber#1#2% {\letgvalueempty{\??se#1\s!start}% signal i.p.v. boolean \setcounter{\??se#1}{#2}% @@ -408,12 +364,6 @@ \resetsectioncounters{#1}% \checkpagecounter} -% \def\@@nextsectionnumber#1% -% {\letgvalueempty{\??se#1\s!start}% signal i.p.v. boolean -% \pluscounter{\??se#1}% -% \ifconditional\@@resetsubheadnumbers\resetsectioncounters{#1}\fi -% \checkpagecounter} - \def\@@nextsectionnumber#1% patched by GB {\letgvalueempty{\??se#1\s!start}% signal i.p.v. boolean \ifnum\countervalue{\??se\v!last#1}>\zerocount @@ -428,24 +378,8 @@ \def\@@sectionvalue#1% % nog niet overal doorgevoerd {\countervalue{\??se#1}} % zoeken op \??se -% \def\@@sectionconversion#1% -% {\getvalue{\??cv\getvalue{\??se#1\@@sectionblock\c!conversion}}} - % suited for chinese too: -% \def\@@sectionconversion#1#2% a doublure with \@@shortsectionnumber -% {\ifnum#2=0 0\else % else troubles with \uchar -% \@EA\ifx\csname\??se#1\@@sectionblock\c!conversion\endcsname\relax -% \@EA\ifx\csname\??se#1\c!conversion\endcsname\relax -% #2% -% \else -% \getvalue{\??cv\getvalue{\??se#1\c!conversion}}{#2}% -% \fi -% \else -% \getvalue{\??cv\getvalue{\??se#1\@@sectionblock\c!conversion}}{#2}% -% \fi -% \fi} - \def\@@sectionconversion#1#2% a doublure with \@@shortsectionnumber {\ifnum#2=0 0\else % else troubles with \uchar \@EA\ifx\csname\??se#1\@@sectionblock\c!conversion\endcsname\relax @@ -459,8 +393,11 @@ \fi \fi} +% \def\@@sectionlevel#1% +% {\ifundefined{\??se#1\c!level}0\else\getvalue{\??se#1\c!level}\fi} + \def\@@sectionlevel#1% - {\ifundefined{\??se#1\c!level}0\else\getvalue{\??se#1\c!level}\fi} + {\executeifdefined{\??se#1\c!level}0} % Omdat een markering kan worden herdefinieerd moeten we % eerst testen of er wel een keten||afhankelijkheid is. @@ -1183,6 +1120,8 @@ {\expanded{\setupalign[\getvalue{\??ko#1\c!align}]}}% \doifvaluesomething{\??ko#1\c!tolerance} % wordt al expanded in spa {\expanded{\setuptolerance[\getvalue{\??ko#1\c!tolerance}]}}% + \doifvalue{\??ko#1\c!strut}\v!no % wordt al expanded in spa + {\setnostrut}% new \def\\{\crlf\strut\ignorespaces}} \def\localkopsetup{\localheadsetup} % kan tzt weg @@ -1273,33 +1212,6 @@ \setupheadnumber[#1][\foundsectionnumber]% \setupheadnumber[#1][-1]} -% \def\setsomeheadconversion#1#2% -% {\someheadconversionfalse -% \doifelsevalue{\??ko#1\c!eigennummer}\v!ja -% {\def\someheadconversion{#2}} -% {\bepaalkopnummer[#1]% -% \@EA\ifx\csname\??se\@@sectie\@@sectionblock\c!kopconversie\endcsname\relax -% \@EA\ifx\csname\??se\@@sectie\c!kopconversie\endcsname\relax -% \def\someheadconversion{#2}% -% \else -% \@EA\ifx\csname\??se\@@sectie\c!kopconversie\endcsname\empty -% \def\someheadconversion{#2}% -% \else -% \someheadconversiontrue -% \def\someheadconversion% -% {\fullsectionnumber{#1}{\getvalue{\??se\@@sectie\c!kopconversie}}{#2}}% -% \fi -% \fi -% \else -% \@EA\ifx\csname\??se\@@sectie\@@sectionblock\c!kopconversie\endcsname\empty -% \def\someheadconversion{#2}% -% \else -% \someheadconversiontrue -% \def\someheadconversion% -% {\fullsectionnumber{#1}{\getvalue{\??se\@@sectie\@@sectionblock\c!kopconversie}}{#2}}% -% \fi -% \fi}} -% % deal with eigennummer \def\setsomeheadconversion#1#2% @@ -1405,7 +1317,7 @@ {\def\currenthead{#1}% dus #1 overal vervangen \let\finalsectionnumber\dofinalsectionnumber % overloaded ungrouped -) \unexpanded\def\\{\space}% - \def\numberseparator{\getvalue{\??ko\currenthead\c!separator}}% + \edef\numberseparator{\spr{\getvalue{\??ko\currenthead\c!separator}}}% \flushingcolumnfloatsfalse % {number} can be \finalsectionnumber \someheadconversionfalse \let\fullsectionnumber\limitedfullsectionnumber @@ -2144,9 +2056,11 @@ {\vbox {\localheadsetup \begstrut % use one \strut here! + \dontleavehmode % in case there is no strut, else side effects with llap \ifheadnumbercontent - \llap{\hbox to 5em{\hfill{#1}% - \hskip\localheadskip\hskip\leftmargindistance}}% + \llap{\hbox to 5em{\hfill{#1}\hskip\localheadskip\hskip\leftmargindistance}}% introduces whitespace + % maybe better: + % \inleftmargin{\hbox{\hss{#1}\hskip\localheadskip}}% \fi {#2}}} @@ -2170,7 +2084,7 @@ \def\placeheadlohi#1#2#3% {\ifheadnumbercontent \setbox0\hbox{#2} - \setbox2#1{\localheadsetup\advance\hsize-\wd0\relax#3}% + \setbox2=#1{\localheadsetup\advance\hsize-\wd0\relax#3}% \hbox{\box0\hskip\numberheaddistance\box2}% \else #1{\localheadsetup\noindent#3}% @@ -2228,6 +2142,7 @@ \c!aligntitle=\@@koaligntitle, \c!tolerance=\@@kotolerance, \c!indentnext=\@@koindentnext, + \c!strut=\@@kostrut, \c!hang=\@@kohang, \c!file=, \c!expansion=, @@ -2246,7 +2161,7 @@ % new per 20/03/3002 (o-pbu-l) / was too confusing % \c!numberstyle,\c!textstyle,\c!expansion, % again too confusing - \c!align,\c!aligntitle,\c!tolerance,\c!grid,\c!hang, + \c!align,\c!aligntitle,\c!tolerance,\c!grid,\c!hang,\c!strut, \c!numbercommand,\c!textcommand,\c!margintext,\c!margin]}}% \getparameters[\??ko#1][#2]% \doifsomething{\getvalue{\??ko#1\c!section}} @@ -2270,7 +2185,7 @@ % new per 20/03/3002 (o-pbu-l) / was too confusing % \c!numberstyle,\c!textstyle,\c!expansion, % again too confusing - \c!align,\c!aligntitle,\c!tolerance,\c!grid,\c!hang, + \c!align,\c!aligntitle,\c!tolerance,\c!grid,\c!hang,\c!strut, \c!numbercommand,\c!textcommand,\c!margintext,\c!margin]% \getparameters[\??ko#1][\c!expansion=]% iig een value, rather fuzzy \definemarking[#1][#2]% @@ -2331,6 +2246,7 @@ \c!align=, \c!aligntitle=, \c!tolerance=, + \c!strut=, \c!indentnext=\v!no, \c!margin=\zeropoint, \c!hang=\v!none, diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index 4e53a6dcf..b5d743b8f 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -2271,30 +2271,33 @@ % \edef\strutdepth{\the\strutdimen}% % \dosetstrut} +% interesting, strudepth is 4.05064pt vs 4.05066pt depending on grid +% nasty rounding problem + \def\setstrut {% height \strutdimen\normallineheight -\ifdim\minimumstrutheight>\zeropoint - \strutdimen\minimumstrutheight -\else - \strutdimen\strutheightfactor\strutdimen -\fi + \ifdim\minimumstrutheight>\zeropoint + \strutdimen\minimumstrutheight + \else + \strutdimen\strutheightfactor\strutdimen + \fi \strutdimen\spacingfactor\strutdimen \edef\strutheight{\the\strutdimen}% % depth \strutdimen\normallineheight \ifgridsnapping -\ifdim\minimumstrutdepth>\zeropoint - \strutdimen\minimumstrutdepth -\else - \advance\strutdimen-\strutheight -\fi + \ifdim\minimumstrutdepth>\zeropoint + \strutdimen\minimumstrutdepth + \else + \advance\strutdimen-\strutheight + \fi \else -\ifdim\minimumstrutdepth>\zeropoint - \strutdimen\minimumstrutdepth -\else - \strutdimen\strutdepthfactor\strutdimen -\fi + \ifdim\minimumstrutdepth>\zeropoint + \strutdimen\minimumstrutdepth + \else + \strutdimen\strutdepthfactor\strutdimen + \fi \strutdimen\spacingfactor\strutdimen \fi \edef\strutdepth{\the\strutdimen}% @@ -2456,7 +2459,8 @@ {\setbox\strutbox\copy\nostrutbox \let\strut\empty \let\endstrut\empty - \let\begstrut\empty} + \let\begstrut\empty + \let\crlfplaceholder\empty} % unsave: % @@ -2639,17 +2643,19 @@ \adjdemerits \zerocount} \def\setdefaultpenalties - {\setups[\systemsetupsprefix\s!default]} + {\directsetup{\systemsetupsprefix\s!default}} -\startsetups [\systemsetupsprefix\v!reset] +\startsetups [\systemsetupsprefix\s!reset] \resetpenalties\widowpenalties \resetpenalties\clubpenalties \resetpenalties\interlinepenalties \stopsetups +% we use \directsetup because it's faster and we know there is no csl + \startsetups [\systemsetupsprefix\s!default] - \setups[\systemsetupsprefix\s!reset] + \directsetup{\systemsetupsprefix\s!reset} \widowpenalty\defaultwidowpenalty \clubpenalty \defaultclubpenalty @@ -2658,7 +2664,7 @@ \startsetups [\v!grid] [\systemsetupsprefix\s!default] - \setups[\systemsetupsprefix\v!reset] + \directsetup{\systemsetupsprefix\s!reset} \widowpenalty\defaultgridwidowpenalty \clubpenalty \defaultgridclubpenalty @@ -2669,7 +2675,7 @@ \startsetups [\systemsetupsprefix\v!strict] - \setups[\v!reset] + \directsetup{\systemsetupsprefix\s!reset} \setpenalties\widowpenalties2\maxdimen \setpenalties\clubpenalties 2\maxdimen @@ -2915,33 +2921,44 @@ {\getvalue{\@@ragged@@command\v!left}} {\getvalue{\@@ragged@@command\v!right}}} +% compare: +% +% \framed[width=4cm,align=no] {\hfil xxx} +% \framed[width=4cm,align=disable]{\hfil xxx} + +\setvalue{\@@ragged@@command\v!disable}% for one liners + {\appendtoks\raggedright\parfillskip\zeropoint\to\everyraggedcommand} + \chardef\raggedoneliner\zerocount \setvalue{\@@ragged@@command\v!line}% {\chardef\raggedoneliner\plusone} -\def\@@startraggedoneliner - {\ifcase\raggedoneliner\else - \dontleavehmode\hbox\bgroup - \ifcase\raggedstatus\or\hss\or\hss\fi - \ignorespaces - \bgroup - \aftergroup\removeunwantedspaces - \fi} +%D Unofficial, may disappear. Now handled directly in the +%D core-rul module. -\def\@@stopraggedoneliner - {\ifcase\raggedoneliner\else - \egroup - \ifcase\raggedstatus\or\hss\or\or\hss\fi - \egroup - \ignorespaces - \fi} +% \def\@@startraggedoneliner +% {\ifcase\raggedoneliner\else +% \dontleavehmode\hbox to \hsize \bgroup % hsize added, else useless +% \ifcase\raggedstatus\or\hss\or\hss\fi +% \ignorespaces +% \bgroup +% \aftergroup\removeunwantedspaces +% \fi} -\def\@@handleoneliner - {\ifcase\raggedoneliner\else - \@@startraggedoneliner - \aftergroup\@@stopraggedoneliner - \fi} +% \def\@@stopraggedoneliner +% {\ifcase\raggedoneliner\else +% \egroup +% \ifcase\raggedstatus\or\or\hss\or\hss\fi +% \egroup +% \ignorespaces % ? ? ? +% \fi} + +% \def\@@handleoneliner +% {\ifcase\raggedoneliner\else +% \@@startraggedoneliner +% \aftergroup\@@stopraggedoneliner +% \fi} % Nodig i.v.m. inspringen eerste alineas @@ -3346,13 +3363,13 @@ % % \def\setraggedparagraphmode#1#2% combineren met \ifrightpage % {\ifinpagebody -% \ifdubbelzijdig +% \ifdoublesided % \ifodd\realpageno\relax#1\else#2\fi % \else % #2\relax % \fi % \else\ifinner -% \ifdubbelzijdig +% \ifdoublesided % \gettwopassdata\s!paragraph % \iftwopassdatafound % \ifodd\twopassdata\relax#1\else#2\fi @@ -3370,7 +3387,7 @@ % \def\doifrightpageelse % watch out: other default ! ! ! % {\ifinpagebody % % optimalisation ? -% \ifdubbelzijdig +% \ifdoublesided % \ifodd\realpageno\relax % \twopassdatafoundtrue \else \twopassdatafoundfalse % \fi @@ -3378,7 +3395,7 @@ % \twopassdatafoundtrue % \fi % \else -% \ifdubbelzijdig +% \ifdoublesided % \gettwopassdata\s!paragraph % \iftwopassdatafound % \ifodd\twopassdata\relax @@ -3400,7 +3417,7 @@ % \fi} % % \def\signalrightpage -% {\ifdubbelzijdig \ifinpagebody \else +% {\ifdoublesided \ifinpagebody \else % \doparagraphreference % \fi \fi} @@ -3412,7 +3429,7 @@ \chardef \frozenpagestate \zerocount \def\dotrackpagestate#1#2% - {\ifdubbelzijdig \ifinpagebody \else + {\ifdoublesided \ifinpagebody \else \doforcedtrackpagestate{#1}{#2}% \fi \fi} @@ -3432,14 +3449,14 @@ \pagestatemismatchfalse \let\realpagestateno\realfolio \ifinpagebody - \ifdubbelzijdig + \ifdoublesided \ifodd\realpageno\relax \twopassdatafoundtrue \else \twopassdatafoundfalse \fi \else \twopassdatafoundtrue \fi - \else\ifdubbelzijdig + \else\ifdoublesided \findtwopassdata{#1}{#2:}% \iftwopassdatafound \let\realpagestateno\twopassdata diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex index c23619cb2..e14dc12dd 100644 --- a/tex/context/base/core-tab.tex +++ b/tex/context/base/core-tab.tex @@ -305,16 +305,6 @@ \newif \ifTABLEgraydone % gray line executed \newtoks \TABLEgraytoks % gray line specification -%D A third major extension, besides spacing and color support, -%D concerns splitting tables over pages. We don't give -%D examples here, because its a waste of space. - -\newdimen\TABLEheight % These can be \newskimens -\newdimen\TABLEmaxheight % given a few \relax's when -\newdimen\TABLEheadheight % testing them with \ifdim. -\newdimen\TABLEtailheight -\newdimen\TABLEcaptionheight - \newif\ifTABLEinbreak %D Nog vervangen: @@ -371,39 +361,6 @@ \newif\ifForgetTableBarAndQuote \ForgetTableBarAndQuotetrue -% Old crappy code (live has changed): -% -% \bgroup -% -% \catcode`\|=\@@active -% \catcode`\"=\@@active -% -% \gdef\pushouterbarandquote -% {\ifForgetTableBarAndQuote -% \ifnum\catcode`\|=\@@active \else -% \catcode`\|=\@@active -% \def|{\ifmmode\vert\else\char`\|\fi}% -% \fi -% \let\outertablebar=|% -% \ifnum\catcode`\"=\@@active \else -% \catcode`\"=\@@active -% \def"{\char`\"}% -% \fi -% \let\outertablequote="% -% \fi} -% -% \gdef\popouterbarandquote -% {\ifForgetTableBarAndQuote -% \let|\outertablebar -% \let"\outertablequote -% \else -% \redefinetablebarandquote -% \fi} -% -% \egroup -% -% probably better (untested): - \bgroup \catcode`\|=\@@active @@ -500,7 +457,7 @@ %D \ReadFormatKeys} %D \stoptyping -\newdimen\TABLEparheight +% \newdimen\TABLEparheight \def\BeginTableParBox#1% {\setbox\scratchbox\vtop\bgroup % \setbox added @@ -526,10 +483,10 @@ \else % of paragraphs \egroup \fi - \getboxheight\scratchdimen\of\box\scratchbox\relax% compensate for - \ifdim\scratchdimen>\TABLEparheight % funny depth of - \global\TABLEparheight\scratchdimen % multi-line box - \fi % i.e. vtop +% \getboxheight\scratchdimen\of\box\scratchbox\relax% compensate for +% \ifdim\scratchdimen>\TABLEparheight % funny depth of +% \global\TABLEparheight\scratchdimen % multi-line box +% \fi % i.e. vtop \box\scratchbox} % We also need to patch away the interfering math switch: @@ -852,26 +809,6 @@ \let\TABLEbeforebar\empty \let\TABLEafterbar \empty -% \def\!ttInsertVrule -% {\hfil -% \TABLEbeforebar % added -% \startglobalTABLEcolor % added -% \vrule \!thWidth -% \ifnum\!tgCode=\plusone -% \ifx\!tgValue\empty -% \LineThicknessFactor -% \else -% \!tgValue -% \fi -% \LineThicknessUnit -% \else -% \!tgValue -% \fi -% \stopglobalTABLEcolor % added -% \TABLEafterbar % added -% \hfil -% &} - \def\@VLn{1} \def\@VLd{.125em} @@ -957,7 +894,7 @@ \def\!ttuse#1% {\ifnum#1>\plusone \omit -\global\TABLEdivisionfalse + \global\TABLEdivisionfalse \scratchcounter\currentTABLEcolumn % added \advance\scratchcounter #1% % added \advance\scratchcounter \minusone % added @@ -1025,16 +962,31 @@ %D %D \showsetup{starttable} +\newconditional\tablerepeathead +\newconditional\tablerepeattail + \def\starttable {\bgroup - \doifelsenothing\@@tiframe - {\ifinsidefloat\else\startbaselinecorrection\fi} - {\startframedcontent[\@@tiframe]}% - \postponefootnotes - \firststagestartTABLE} + \doif\@@tisplit\v!auto + {\ifinsidesplitfloat\let\@@tisplit\v!yes\fi}% + \doifelse\@@tisplit\v!yes + {\def\stoptable{\stoptables}% + \setfalse\tablerepeathead + \setfalse\tablerepeattail + \starttables} + {\doifelse\@@tisplit\v!repeat + {\def\stoptable{\stoptables}% + \settrue\tablerepeathead + \settrue\tablerepeattail + \starttables} + {\doifelsenothing\@@tiframe + {\ifinsidefloat\else\startbaselinecorrection\fi} + {\startframedcontent[\@@tiframe]}% + \postponefootnotes + \firststagestartTABLE}}} \def\stoptable - {\TABLEtail + {\insertTABLEtail \globalletempty\@@TABLEhead \globalletempty\@@TABLEtail \finishTABLE @@ -1078,17 +1030,6 @@ %D The implementation of the definition macro is not that %D complicated: -%\def\dodefinetabletemplate[#1][#2]% -% {\setgvalue{\c!Table#1}{\complexsecondstagestartTABLE[#2]}% -% \egroup} -% -%\def\definetabletemplate% -% {\bgroup -% \catcode`\|=\@@other -% \dodoubleargument\dodefinetabletemplate} - -% \TABLEnoalign{\page}\TABLEhead is valid - \def\douseTABLEtemplate#1#2#3% {\gdef\TABLEhead{\getvalue{@@TABLEhead#2}}% \gdef\TABLEtail{\getvalue{@@TABLEtail#3}}% @@ -1129,35 +1070,36 @@ %D The second half of the next macro prepares table %D splitting. -% \def\complexsecondstagestartTABLE#1[#2]% -% {\convertargument|\to\asciiA -% \convertargument#2\to\asciiB -% \doifinstringelse{\asciiA}{\asciiB} -% {\gdef\restartTABLE{\thirdstagestartTABLE{#2}}} -% {\doifdefinedelse{\c!Table#2} -% {\gdef\restartTABLE{\getvalue{\c!Table#2}}} -% {\gdef\restartTABLE{\getvalue{#2}}}}% -% \prepareTABLEsplitting -% \restartTABLE -% \TABLEhead} +\def\insertTABLEhead + {\TABLEnoalign{\global\settrue \preventTABLEbreak \global\setfalse\someTABLEhead}% + \TABLEhead + \TABLEnoalign{\global\setfalse\preventTABLEbreak}} + +\def\insertTABLEtail + {\TABLEnoalign{\global\settrue \preventTABLEbreak \global\setfalse\someTABLEtail}% + \TABLEtail + \TABLEnoalign{\global\setfalse\preventTABLEbreak}} + +\def\dorestartTABLE#1% + {\gdef\restartTABLE{#1}% + \restartTABLE + \insertTABLEhead + \ifsplittables \ifconditional \tablerepeattail + \TABLEnoalign{\goodbreak}% + \insertTABLEtail + \TABLEnoalign{\goodbreak}% + \fi \fi} \def\complexsecondstagestartTABLE#1[#2]% {\convertargument|\to\asciiA \convertargument#2\to\asciiB + \global\setfalse\someTABLEhead + \global\setfalse\someTABLEtail \doifinstringelse\asciiA\asciiB - {\gdef\restartTABLE - {\gdef\restartTABLE{\thirdstagestartTABLE{#2}}% - \prepareTABLEsplitting - \restartTABLE - \TABLEhead}} + {\gdef\restartTABLE{\dorestartTABLE{\thirdstagestartTABLE{#2}}}} {\doifdefinedelse{\c!Table#2} - {\gdef\restartTABLE - {\getvalue{\c!Table#2}}} - {\gdef\restartTABLE - {\gdef\restartTABLE{\getvalue{#2}}% - \prepareTABLEsplitting - \restartTABLE - \TABLEhead}}}% + {\gdef\restartTABLE{\getvalue{\c!Table#2}}} + {\gdef\restartTABLE{\dorestartTABLE{\getvalue{#2}}}}}% \restartTABLE} %D The third stage involves a lot of (re)sets, which we will @@ -1212,45 +1154,6 @@ \global\intablefalse \egroup} -%D The preparation for split columns concerns some -%D calculations. Although not explicitly needed, one can -%D predefine a tablehead as well as a tail. Each table fragment -%D is preceded by such a head and ends with a tail. This means -%D that, in order to determine the available height, we have to -%D take the head and tail into account. Because we want to -%D support captions too, we will also reserve some space for -%D those later on. - -\def\prepareTABLEsplitting - {\global\TABLEheight\zeropoint - \ifsplittables - \ifx\TABLEhead\empty - \global\TABLEheadheight\zeropoint - \else - \setbox0\vbox - \bgroup - \def\doEndOfTableLine##1##2##3{\normalTABLElineformat##2##3}% - \restartTABLE\TABLEhead - \finishTABLE - \global\TABLEheadheight\ht0 - \fi - \ifx\TABLEtail\empty - \global\TABLEtailheight\zeropoint - \else - \setbox0\vbox - \bgroup - \def\doEndOfTableLine##1##2##3{\normalTABLElineformat##2##3}% - \restartTABLE\TABLEtail - \finishTABLE - \global\TABLEtailheight\ht0 - \fi - \else - \global\TABLEheadheight\zeropoint - \global\TABLEtailheight\zeropoint - \fi - \global\TABLEheight\zeropoint - \calculatemaxTABLEheight\docalculatemaxTABLEheight} - %D \macros %D {starttables} %D @@ -1272,27 +1175,45 @@ %D \stoptables %D \stoptyping +\newbox\tablecontentbox + \def\starttables {\bgroup - \ifinsidefloat\else - \baselinecorrection - \flushnotes - \topbaselinecorrection - \fi - \forgetall - \globallet\absmaxTABLEheight\zeropoint \splittablestrue + \flushnotes + \setbox\tablecontentbox\vbox\bgroup + \forgetall \global\TABLEinbreakfalse \firststagestartTABLE} \def\stoptables - {\TABLEtail + {\ifconditional\tablerepeattail\else\insertTABLEtail\fi \finishTABLE + \egroup + \dosplittablebox\tablecontentbox + \flushnotes + \egroup} + +\newdimen\TABLEcaptionheight % obsolete + +\def\dosplittablebox#1% + {\resettsplit + \def\tsplitminimumfreelines{2}% + \def\tsplitminimumfreespace{\TABLEcaptionheight}% + \setbox\tsplitcontent\box#1% + \ifconditional\tablerepeathead \ifconditional\someTABLEhead + \setbox\tsplithead\vsplit\tsplitcontent to \lineheight + \setbox\tsplithead\vbox{\unvbox\tsplithead}% + \fi \fi + \ifconditional\tablerepeattail \ifconditional\someTABLEtail + \setbox\tsplittail\vsplit\tsplitcontent to \lineheight + \setbox\tsplittail\vbox{\unvbox\tsplittail}% + \fi \fi \ifinsidefloat\else - \flushnotes - \botbaselinecorrection + \def\tsplitbeforeresult{\startbaselinecorrection}% + \def\tsplitafterresult {\stopbaselinecorrection}% \fi - \egroup} + \handletsplit} %D When the table in the previous example is split across %D pages, only the first gets a head. We could have said @@ -1344,90 +1265,21 @@ \def\setTABLEhead{\dodoubleempty\dosetTABLEhead} \def\setTABLEtail{\dodoubleempty\dosetTABLEtail} -\def\dosetTABLEhead[#1][#2]#3\end{\setvalue{@@TABLEhead#1}{#3}} -\def\dosetTABLEtail[#1][#2]#3\end{\setvalue{@@TABLEtail#1}{#3}} +\newconditional\preventTABLEbreak +\newconditional\someTABLEhead + +\def\dosetTABLEhead[#1][#2]#3\end{\setvalue{@@TABLEhead#1}{\TABLEnoalign{\global\settrue\someTABLEhead}#3}} +\def\dosetTABLEtail[#1][#2]#3\end{\setvalue{@@TABLEtail#1}{\TABLEnoalign{\global\settrue\someTABLEtail}#3}} %D Redudant \type{\HL}'s are removed automatically, so %D mid||lines can be used without problems. -%D When calculating the available height of a split table, we -%D try to handle multi||column mode as good as possible. This -%D algoritm evolved during the development of the split option -%D and will probably be improved bit by bit. - -\def\docalculatemaxTABLEheight - {\ifinsidecolumns - \getcolumnstatus\column\scratchcounter\total\dimen0\goal\dimen2\\% - \else - \ifdim\pagegoal<\maxdimen - \dimen0\pagetotal - \dimen2\pagegoal - \else - \dimen0\zeropoint - \dimen2\textheight - \fi - \fi - \advance\dimen2 -\dimen0 - \global\TABLEmaxheight\dimen2 - \global\advance\TABLEmaxheight -\strutdp - \ifdim\prevdepth<\maxdimen\ifdim\prevdepth>\zeropoint - \global\advance\TABLEmaxheight -\strutdp - \global\advance\TABLEmaxheight -\parskip - \fi\fi} - -\def\nocalculatemaxTABLEheight - {\ifinsidecolumns - \getcolumnstatus\column\scratchcounter\total\dimen0\goal\dimen2\\% - \else - \dimen0\zeropoint - \dimen2\textheight - \fi - \advance\dimen2 -\dimen0 - \global\TABLEmaxheight\dimen2 - \global\advance\TABLEmaxheight -\strutdp} - -\def\calculatemaxTABLEheight#1% - {\ifsplittables - #1\relax - \ifdim\TABLEmaxheight<3\baselineskip \relax % instelbaar maken - \ifinsidecolumns - \nobreak - \kern\dimen2 - \goodbreak - \else - \goodbreak % \page - \fi - \removeTABLEtopskip - \nocalculatemaxTABLEheight - \fi - \ifdim\TABLEmaxheight<\absmaxTABLEheight % forces equal columns - \global\TABLEmaxheight\absmaxTABLEheight - \else - \xdef\absmaxTABLEheight{\the\TABLEmaxheight}% - \fi - \global\TABLEheight\zeropoint - \else - \global\TABLEmaxheight\maxdimen - \fi} - -%D When splitting tables, we have to remove the top skip when -%D we're in the main vertical list, else we remove whatever -%D skip \TEX\ adds. - -\def\removeTABLEtopskip - {\ifinsidefloat - \verticalstrut\kern-\struttotal - \else - \hbox{}\kern-\topskip - \fi} - %D We need an alternative for the normal complex or simple %D commands, because assignments in these system commands %D conflict with \type{\noalign}. This alternative is about %D as efficient as possible. \def\complexorsimpleTable#1#2% -% {\getvalue{\if[\noexpand#2\s!complex\else\s!simple\fi\c!Table#1}#2} {\csname\if[\noexpand#2\s!complex\else\s!simple\fi\c!Table#1\endcsname#2} %D The next one is used in \type{\VL} cum suis and honours @@ -1702,57 +1554,8 @@ %D we repeat the table head. \def\handleTABLEbreak#1#2% - {\ifsplittables - \setbox0\hbox{\AugmentedTableStrut{#1}{#2}}% - \getboxheight\dimen0\of\box0\relax - \ifdim\TABLEparheight>\dimen0 % new - \advance\dimen0-\lineheight % newer - \ifdim\dimen0<\zeropoint % newer - \dimen2\zeropoint % newer - \fi % newer - \advance\dimen0 \TABLEparheight % new - \global\TABLEparheight\zeropoint % new - \fi % new - \ifTABLEgrayline \else - \global\advance\TABLEheight\dimen0 - \fi - \ifTABLEinbreak - \globalletempty\beforeTABLEline - \gdef\afterTABLEline{\TABLEnoalign{\nobreak}}% - \else - \dimen2=\TABLEheight - \advance\dimen2 \strutdp - \advance\dimen2 \TABLEtailheight - \advance\dimen2 \TABLEcaptionheight - \advance\dimen2 \lineheight % we're ahead - \ifdim\dimen2>\TABLEmaxheight - \gdef\beforeTABLEline - {\setTABLEforce\TABLEforcelastrow}% - \gdef\afterTABLEline - {\TABLEnoalign - {\nobreak - \global\TABLEinbreaktrue}% - \TABLEtail - \TABLEnoalign - {\goodbreak - \calculatemaxTABLEheight\nocalculatemaxTABLEheight - \removeTABLEtopskip - \setTABLEaction\TABLEunknown - \setTABLEforce \TABLEunknown}% - \TABLEhead - \TABLEnoalign - {\nobreak - \global\TABLEinbreakfalse - \setTABLEforce\TABLEforcefirstrow}}% - \else - \globalletempty\beforeTABLEline - \gdef\afterTABLEline{\TABLEnoalign{\nobreak}}% - \fi - \fi - \else - \globalletempty\beforeTABLEline - \gdef\afterTABLEline{\TABLEnoalign{\nobreak}}% - \fi} + {\globalletempty\beforeTABLEline + \gdef\afterTABLEline{\TABLEnoalign{\ifconditional\preventTABLEbreak\nobreak\else\goodbreak\fi}}} %D When tables are split, the spacing before and after a %D horizontal rule is corrected according to what we expect. @@ -1770,7 +1573,6 @@ ->% \fi \color[#1]{\string#3}% - \ifsplittables\space\the\TABLEmaxheight/\the\TABLEheight\fi \ifx\TABLEgraylineerror\empty \space\TABLEgraylinestatus \else @@ -2027,7 +1829,6 @@ {\TABLEnoalign {\nobreak \setbox0\vbox{\blank[\@@tiNL]}% - \global\advance\TABLEheight \ht0 \vskip\ht0 \nobreak}} @@ -2167,8 +1968,7 @@ \setTABLEaction\TABLErule}} \def\accountTABLElinewidth - {\scratchdimen\LineThicknessUnit - \global\advance\TABLEheight \@@tiHLheight\scratchdimen} + {\scratchdimen\LineThicknessUnit} %D \startitemize[3*ruim] %D \sym{\type{\BC}} @@ -2649,7 +2449,8 @@ \c!commands=, \c!background=\v!screen, \c!backgroundscreen=\@@rsscreen, - \c!backgroundcolor=] + \c!backgroundcolor=, + \c!split=\v!auto] \def\ifintabel{\ifintable} % upward compatible diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex index 4c2f238da..a3d245066 100644 --- a/tex/context/base/core-tbl.tex +++ b/tex/context/base/core-tbl.tex @@ -755,27 +755,35 @@ \chardef\tabulatepass=0 +\def\tabulateparameter#1{\csname\??tt\currenttabulate#1\endcsname} + \def\dofinalstarttabulate[#1][#2][#3]% identifier sub preamble {\edef\currenttabulate{#1::#2}% \ifinsidefloat \else \whitespace - \getvalue{\??tt\currenttabulate\c!before}% + \tabulateparameter\c!before \fi \bgroup \resetcharacteralign % todo: spacing around tabulate when bodyfont is set % expansion en test needed ? + \splittabulatefalse + \processaction + [\tabulateparameter\c!split] + [ \v!yes=>\splittabulatetrue, + % \v!repeat=>\splittabulatetrue, % todo, default yes + \v!auto=>\ifinsidesplitfloat\splittabulatetrue\fi]% \doifelsevalue{\??tt\currenttabulate\c!split}\v!yes - \splittabulatetrue\splittabulatefalse + \doifvaluesomething{\??tt\currenttabulate\c!bodyfont} {\expanded{\switchtobodyfont - [\getvalue{\??tt\currenttabulate\c!bodyfont}]}}% + [\tabulateparameter\c!bodyfont]}}% \postponefootnotes % new, to be tested / will be configurable \chardef\tabulatepass\plusone \widowpenalty\zerocount % otherwise lines are not broken \clubpenalty \zerocount % but overlap in funny ways \the\everytabulate - \getvalue{\??tt\currenttabulate\c!inner}% + \tabulateparameter\c!inner \scratchdimen\leftskip \advance\scratchdimen \hangindent \doifvalue{\??tt\currenttabulate\c!indenting}\v!yes @@ -817,7 +825,7 @@ \newif\iftabulatefirstflushed \def\tabulateEQ - {\iftabulatefirstflushed\else\getvalue{\??tt\currenttabulate EQ}\fi + {\iftabulatefirstflushed\else\tabulateparameter{EQ}\fi \global\tabulateequalfalse} % \def\tabulatenormalcolumn#1% @@ -856,7 +864,7 @@ \let\factor\!!plusone \scratchskip\strutdp \ExpandFirstAfter\processallactionsinset - [\getvalue{\??tt\currenttabulate\c!distance}] + [\tabulateparameter\c!distance] [ \v!blank=>\scratchskip\bigskipamount, \v!depth=>\scratchskip\strutdp, \v!small=>\def\factor{.25}, @@ -869,18 +877,10 @@ \ifconditional\tabulatesomeamble\kern\else\vskip\fi\scratchdimen % new \egroup} -% \def\dotabulaterule -% {\color -% [\getvalue{\??tt\currenttabulate\c!lijnkleur}] -% {\scratchdimen\getvalue{\??tt\currenttabulate\c!lijndikte}% -% \hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax -% \doifvalue{\??tt\currenttabulate\c!afstand}\v!grid -% {\kern-\scratchdimen}}} % experimental tm-prikkels - \def\dodotabulaterule#1% {\color - [\getvalue{\??tt\currenttabulate\c!rulecolor}] - {\scratchdimen\getvalue{\??tt\currenttabulate\c!rulethickness}#1}} + [\tabulateparameter\c!rulecolor] + {\scratchdimen\tabulateparameter\c!rulethickness#1}} \def\dotabulaterule {\dodotabulaterule @@ -891,7 +891,7 @@ \def\dotabulatelinerule {\multispan\totaltabulatecolumns % \multispan is a plain macro % for the moment this one - \strut\hskip\getvalue{\??tt\currenttabulate\c!margin}% + \strut\hskip\tabulateparameter\c!margin % neg values are ok ! \hskip\tabulateindent % new august 2003 \dodotabulaterule @@ -955,12 +955,12 @@ \chardef\tabulaterepeathead\zerocount \def\processtabulate[|#1|]% in the process of optimizing - {\tabulateunit\getvalue{\??tt\currenttabulate\c!unit}% + {\tabulateunit\tabulateparameter\c!unit \checkfulltabulatecontent \globallet\tabulateruledepth \!!zeropoint \globallet\tabulateruleheight\!!zeropoint \ExpandFirstAfter\processaction % use \setalignmentswitch instead - [\getvalue{\??tt\currenttabulate\c!align}] + [\tabulateparameter\c!align] [ \v!normal=>\def\@@tabulatealign{0},% = default value \v!right=>\def\@@tabulatealign{1},% chardefs gebruiken \v!left=>\def\@@tabulatealign{2},% @@ -977,9 +977,16 @@ \global\tabulatepwidth\zeropoint \global\tabulateequalfalse \resettabulatepheight - \ifinsidefloat \else + \ifinsidesplitfloat + \donetrue + \else\ifinsidefloat + \donefalse + \else + \donetrue + \fi\fi + \ifdone \processaction - [\getvalue{\??tt\currenttabulate\c!header}] + [\tabulateparameter\c!header] [\v!repeat=>\chardef\tabulaterepeathead\plusone, \v!text=>\chardef\tabulaterepeathead\plustwo]% \fi @@ -1033,9 +1040,9 @@ \global\let\flushtabulated\empty \let\savedbar|\let|\nexttabulate \tabskip\zeropoint - \ifdim\getvalue{\??tt\currenttabulate\c!margin}>\zeropoint + \ifdim\tabulateparameter\c!margin>\zeropoint \!!toksa{&\flushtabulateindent\strut##% - \tabskip\getvalue{\??tt\currenttabulate\c!margin}\strut + \tabskip\tabulateparameter\c!margin\strut &##\tabskip\zeropoint}% \else \!!toksa{&\flushtabulateindent\strut##% @@ -1248,7 +1255,7 @@ \ifnum\noftabulatelines>\plusone \ifnum\noftabulatelines<\minusnoftabulatelines \vskip\topskip\allowbreak\vskip-\topskip - \vskip-\getvalue{\??tt\currenttabulate\c!rulethickness}% + \vskip-\tabulateparameter\c!rulethickness \dotabulaterule \fi \fi @@ -1267,7 +1274,11 @@ \chardef\tabulatepass\plustwo % \ifcase\tabulaterepeathead - \startframedcontent[\getvalue{\??tt\currenttabulate\c!frame}]% + \ifinsidesplitfloat + \setbox\tabulatebox\vbox \bgroup + \else + \startframedcontent[\tabulateparameter\c!frame]% + \fi \else \setbox\tabulatebox\vbox \bgroup \fi @@ -1278,14 +1289,18 @@ {\vskip-\strutdp}% experimental tm-prikkels % \ifcase\tabulaterepeathead - \stopframedcontent + \ifinsidesplitfloat + \egroup \splittabulatebox\tabulatebox + \else + \stopframedcontent + \fi \else \egroup \splittabulatebox\tabulatebox \fi % \egroup \ifinsidefloat \else - \getvalue{\??tt\currenttabulate\c!after}% + \tabulateparameter\c!after \fi \egroup} @@ -1304,47 +1319,69 @@ % \NC test \NC \input tufte \relax \NC \NR % \stoptabulate +% \def\splittabulatebox#1% #1 <> 0/2 / derived from the one in core-ntb.tex +% {\ifinsidefloat +% \unvbox#1% +% \else +% \ifcase\tabulaterepeathead\or +% \setbox2\copy#1% +% \setbox2\vsplit2 to \lineheight +% \setbox2\vbox{\unvbox2}% +% \fi +% \doloop +% {\setbox0\vsplit#1 to \onepoint % \lineheight +% \ifdim\pagegoal<\maxdimen +% \donetrue +% \else\ifdim\pagetotal=\zeropoint +% \donetrue +% \else +% \donefalse +% \fi\fi +% \ifdone +% \setbox0\vbox{\unvbox0}% +% \dimen0\pagetotal +% \advance\dimen0\dp0 +% \advance\dimen0\ht0 +% \ifdim\dimen0>\pagegoal +% \bgroup \page \egroup % make sure that local vars are kept +% \ifcase\tabulaterepeathead\or +% \unvcopy2 +% \or +% \hbox{\strut\tabulateparameter\c!title}% +% \fi +% \fi +% \fi +% % test this on icare checklists / quite hacky ! ! ! +% \ifdim\ht0>\tabulateparameter\c!rulethickness\else +% \kern-2\ht0 % brrrr +% \fi +% % +% \unvbox0 +% \allowbreak +% \ifvoid#1 \exitloop \fi}% +% \fi} + \def\splittabulatebox#1% #1 <> 0/2 / derived from the one in core-ntb.tex - {\ifinsidefloat + {\ifinsidesplitfloat + \dosplittabulatebox#1% + \else\ifinsidefloat \unvbox#1% \else - \ifcase\tabulaterepeathead\or - \setbox2\copy#1% - \setbox2\vsplit2 to \lineheight - \setbox2\vbox{\unvbox2}% - \fi - \doloop - {\setbox0\vsplit#1 to \onepoint % \lineheight - \ifdim\pagegoal<\maxdimen - \donetrue - \else\ifdim\pagetotal=\zeropoint - \donetrue - \else - \donefalse - \fi\fi - \ifdone - \setbox0\vbox{\unvbox0}% - \dimen0\pagetotal - \advance\dimen0\dp0 - \advance\dimen0\ht0 - \ifdim\dimen0>\pagegoal - \bgroup \page \egroup % make sure that local vars are kept - \ifcase\tabulaterepeathead\or - \unvcopy2 - \or - \hbox{\strut\getvalue{\??tt\currenttabulate\c!title}}% - \fi - \fi - \fi - % test this on icare checklists / quite hacky ! ! ! - \ifdim\ht0>\getvalue{\??tt\currenttabulate\c!rulethickness}\else - \kern-2\ht0 % brrrr - \fi - % - \unvbox0 - \allowbreak - \ifvoid#1 \exitloop \fi}% - \fi} + \dosplittabulatebox#1% + \fi\fi} + +\def\dosplittabulatebox#1% + {\resettsplit + \def\tsplitminimumfreelines{2}% + \def\tsplitminimumfreespace{0pt}% + \setbox\tsplitcontent\box#1% + \ifcase\tabulaterepeathead\or + \setbox\tsplithead\vsplit\tsplitcontent to \lineheight + \setbox\tsplithead\vbox{\unvbox\tsplithead}% + \or + \setbox\tsplithead\vbox{\hbox{\strut\tabulateparameter\c!title}}% + \fi + \handletsplit} %D \starttyping %D \setuptabulate[split=no,rule=line] @@ -1425,7 +1462,7 @@ \c!distance={\v!depth,\v!medium}, \c!align=\v!normal, \c!margin=\!!zeropoint, - \c!split=\v!yes, + \c!split=\v!auto, \c!header=\v!yes, \c!title=, \c!indenting=\v!no] diff --git a/tex/context/base/core-tsp.tex b/tex/context/base/core-tsp.tex new file mode 100644 index 000000000..4568a38a1 --- /dev/null +++ b/tex/context/base/core-tsp.tex @@ -0,0 +1,451 @@ +%D \module +%D [ file=core-tsp, +%D version=2000.10.20, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Splitting Tables, +%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. + +\writestatus{loading}{Context OTR Macros / Floating Bodies} + +\beginTEX + \expandafter \endinput +\endTEX + +%D The code in this file is move here from other places. + +\unprotect + +% only to be used with single tokens (will be prim) + +\ifx\htdp\undefined + \def\htdp#1{\dimexpr\ht#1+\dp#1\relax} +\fi + +%D Although the name resembles floats, and therefore this should be +%D a page module, we decided to make it core functionality because the +%D table code depends on it. Othrwise there would be too much +%D overloading afterwards involved. Actually, the float part is rather +%D generic and not that related to floats. + +% \splitfloat [settings] {\placetable[optional args]{test}} {content} + +\definenumber + [\??si] + [\c!way=\v!by\v!text, + \c!conversion=\@@siconversion] + +\def\setupfloatsplitting + {\dodoubleargument\getparameters[\??si]} + +\newif\ifinsidesplitfloat % will become chardef + +\newtoks \everysplitfloatsetup + +\def\splitfloat + {\dosingleempty\dosplitfloat} + +% \def\dosplitfloat[#1]#2% nog dubbele refs +% {\ifinsidecolumns % tzt ook nog figuren splitten +% % not yet supported +% \else +% \bgroup +% \insidefloattrue +% \insidesplitfloattrue +% \getparameters[\??si][#1]% +% \resetnumber[\??si]% +% \def\floatcaptionsuffix{\convertednumber[\??si]}% +% % \TABLEcaptionheight\@@silines\lineheight% brrr +% % todo: auto == \getnoflines\captionheight +% \let\extrasplitfloatlines\@@silines +% \the\everysplitfloatsetup +% \simplifypagebreak % \page becomes \goodbreak, no fails misserably +% % todo: a preceding float does not count yet +% % so we need a better predictor +% \dowithnextbox +% {\forgetall +% \dontcomplain +% \chardef\nodelocationmode\zerocount +% \doloop +% {\setbox2\vsplit\nextbox to \lineheight +% \setbox2\vbox{\unvbox2} +% \ifdim\ht2>\lineheight +% \incrementnumber[\??si]% +% \ifcase\rawnumber[\??si]\or \ifdim\nextboxht=\zeropoint +% \let\floatcaptionsuffix\empty +% \fi \fi +% \bgroup +% #2{\unvbox2} +% \egroup +% \ifdim\nextboxht>\zeropoint +% \page +% \decrementnumber[\floatcaptionnumber]% +% \fi +% \fi +% \ifdim\nextboxht>\zeropoint +% \page +% \else +% \expandafter\exitloop +% \fi}% +% \egroup} +% \vbox +% \fi} + +\ifx\floatcaptionsuffix\undefined \else + \let\floatcaptionsuffix\empty % will become \splitfloatcaptionsuffix +\fi + +\def\extrasplitfloatlines{0} + +\def\dosplitfloat[#1]#2% nog dubbele refs + {\bgroup + \insidefloattrue + \insidesplitfloattrue + \getparameters[\??si][#1]% + \resetnumber[\??si]% + \def\floatcaptionsuffix{\convertednumber[\??si]}% + \let\extrasplitfloatlines\@@silines + \the\everysplitfloatsetup + \def\splitfloatcommand{#2}% + \global\settrue \onlyonesplitofffloat + \global\setfalse\somenextplitofffloat + \dopushsavedfloats + \@@sibefore + \let\next} % \bgroup + +\settrue \onlyonesplitofffloat +\setfalse\somenextplitofffloat + +%D When \type {inbetween} is made empty instead of the +%D default \type {\page}, we will get delayed flushing +%D and text may continue below the graphic. +%D +%D \starttyping +%D \dorecurse{2}{\input tufte } +%D +%D \splitfloat[lines=auto,inbetween=] +%D {\placetable{\dorecurse{5}{test\recurselevel\endgraf}}} +%D {\bTABLE[split=yes] +%D \bTR \bTD 11 \eTD \bTD \input tufte \eTD \eTR +%D \bTR \bTD 12 \eTD \bTD \input zapf \eTD \eTR +%D \bTR \bTD 13 \eTD \bTD \input bryson \eTD \eTR +%D \bTR \bTD 14 \eTD \bTD test \eTD \eTR +%D \bTR \bTD 21 \eTD \bTD \input tufte \eTD \eTR +%D \bTR \bTD 22 \eTD \bTD \input zapf \eTD \eTR +%D \bTR \bTD 23 \eTD \bTD \input bryson \eTD \eTR +%D \bTR \bTD 24 \eTD \bTD test \eTD \eTR +%D \bTR \bTD 31 \eTD \bTD \input tufte \eTD \eTR +%D \bTR \bTD 32 \eTD \bTD \input zapf \eTD \eTR +%D \bTR \bTD 33 \eTD \bTD \input bryson \eTD \eTR +%D \bTR \bTD 34 \eTD \bTD test \eTD \eTR +%D \eTABLE} +%D +%D \dorecurse{10}{\input tufte } +%D \stoptyping + +\def\dodowithsplitofffloat + {\dowithnextbox + {\forgetall + \dontcomplain + \chardef\nodelocationmode\zerocount % bypass auto-renumbering + \incrementnumber[\??si]% + \ifcase\rawnumber[\??si]\or \ifconditional\onlyonesplitofffloat + \let\floatcaptionsuffix\empty + \fi \fi + \bgroup + \ifconditional\somenextplitofffloat + \settrue\retainfloatnumber + \else + \setfalse\retainfloatnumber + \fi + \splitfloatcommand{\box\nextbox}% + \egroup + \ifconditional\somenextplitofffloat + \doifelsenothing\@@siinbetween + {\ifconditional\tsplitfirstdone\else\page\fi} + \@@siinbetween + \else + \@@siafter + \dopopsavedfloats + \doflushsavedfloats + \fi + \global\settrue\tsplitfirstdone}% + \vbox} + +\def\nodowithsplitofffloat + {\dowithnextbox + {\forgetall + \dontcomplain + \box\nextbox % maybe an option to unvbox + \global\settrue\tsplitfirstdone}% + \vbox} + +\def\dochecksplitofffloat#1% box + {\ifinsidesplitfloat + \ifdim\ht#1=\zeropoint + \global\setfalse\somenextplitofffloat + \else + \global\settrue \somenextplitofffloat + \global\setfalse\onlyonesplitofffloat + \fi + \fi} + +\def\analyzesplitfloatcaption#1% depend son page-flt + {\doif\extrasplitfloatlines\v!auto + {\bgroup + \settrue\retainfloatnumber + \chardef\nodelocationmode\zerocount + \forcelocalfloats + \setuplocalfloats[\c!before=,\c!after=,\c!inbetween=]% + \splitfloatcommand{\hbox to \wd#1{\strut}}% dummy line + \setbox\scratchbox\vbox{\flushlocalfloats}% + \getnoflines{\ht\scratchbox}% + \resetlocalfloats + \advance\noflines\minusone % compensate dummy line + \expanded{\egroup\noexpand\edef\noexpand\extrasplitfloatlines{\the\noflines}}}} + +% \def\analyzesplitfloatcaption#1% +% {\edef\extrasplitfloatlines{11}} + +\def\dowithsplitofffloat % nextbox + {\ifinsidesplitfloat + \expandafter\dodowithsplitofffloat + \else + \expandafter\nodowithsplitofffloat + \fi} + +\def\doifnotinsidesplitfloat + {\ifinsidesplitfloat\expandafter\gobbleoneargument\fi} + +%D Some defaults: + +\setupfloatsplitting + [\c!conversion=\v!character, % \v!romannumerals + \c!lines=3, + \c!before=, + \c!inbetween=\page, + \c!after=] + +%D Table splitter, on top of previous code: + +\newbox\tsplitcontent +\newbox\tsplitresult +\newbox\tsplithead +\newbox\tsplitnext +\newbox\tsplittail + +\def\resettsplit + {\def\tsplitminimumfreelines{0}% + \def\tsplitminimumfreespace{0pt}% + \setbox\tsplitcontent \vbox{}% + \setbox\tsplitresult \vbox{}% + \setbox\tsplithead \vbox{}% + \setbox\tsplitnext \vbox{}% + \setbox\tsplittail \vbox{}% + \let\tsplitbeforeresult\donothing + \let\tsplitafterresult \donothing + \let\tsplitinbetween \donothing + \let\tsplitbefore \donothing + \let\tsplitafter \donothing + \let\postprocesstsplit \donothing} + +\resettsplit + +% todo: keep tail to rest, so we need a lookahead + +\newconditional\tsplitfirstdone + +\def\handletsplit + {\analyzesplitfloatcaption\tsplitcontent + \global\setfalse\tsplitfirstdone + \testpage + [\tsplitminimumfreelines] + [\dimexpr\tsplitminimumfreespace+\extrasplitfloatlines\lineheight\relax]% + \setbox\scratchbox\vbox{\tsplitinbetween}% + \edef\tsplitinbetweenheight{\the\htdp\scratchbox}% etex + \!!doneafalse + \doloop + {\ifinsidecolumns + % brrr, assumes empty columns + \global\setfalse\tsplitfirstdone + \scratchdimen\textheight + \!!donectrue + \else + \ifconditional\tsplitfirstdone + \scratchdimen\textheight + \!!donectrue + \else\ifdim\pagegoal<\maxdimen + \scratchdimen\dimexpr\pagegoal-\pagetotal\relax + \!!donecfalse + \else + \scratchdimen\textheight + \!!donectrue + \fi\fi + \fi + \scratchdimen\dimexpr\scratchdimen-\tsplitinbetweenheight-\tsplitminimumfreespace-\extrasplitfloatlines\lineheight\relax + \ifdim\htdp\tsplittail>\zeropoint + \advance\scratchdimen-\htdp\tsplittail + \fi + \setbox\tsplitresult\vbox + {\ifdim\ht\tsplithead>\zeropoint + \unvcopy\tsplithead + \tsplitinbetween + \fi}% + \if!!donea\else\ifdim\ht\tsplitnext>\zeropoint + \setbox\tsplithead\box\tsplitnext + \fi\fi + \!!doneatrue + \ifdim\ht\tsplitresult>\zeropoint + \!!donedtrue % table head + \else + \!!donedfalse % no tablehead + \fi + \doloop + {\setbox\scratchbox\vsplit\tsplitcontent to \onepoint % \lineheight + \setbox\scratchbox\vbox{\unvbox\scratchbox}% + \ifdim\dimexpr\scratchdimen-\htdp\scratchbox-\htdp\tsplitresult\relax>\zeropoint + \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvbox\scratchbox}% + \ifvoid\tsplitcontent \exitloop \fi + \else\if!!doned + % we only have a tablehead so far + \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvbox\scratchbox}% + \exitloop + \else\if!!donec + % we have text height available, but the (one) cell is too + % large to fit, so, in order to avoid loops/deadcycles we do: + \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvbox\scratchbox}% + \exitloop + \else + \setbox\tsplitcontent\vbox + {\unvbox\scratchbox + \ifvoid\tsplitcontent\else\unvbox\tsplitcontent\fi}% + \exitloop + \fi\fi\fi + \!!donedfalse + \!!donecfalse}% + \postprocesstsplit + \dochecksplitofffloat\tsplitcontent + \ifvoid\tsplitcontent + \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvcopy\tsplittail}% + \dowithsplitofffloat{\tsplitbeforeresult\box\tsplitresult\tsplitafterresult}% + \doifnotinsidesplitfloat\tsplitafter + \endgraf + \exitloop + \else + % hack + \ifdim\pagegoal<\maxdimen + \global\pagegoal\dimexpr\pagegoal+\lineheight\relax % etex + \fi + % brrr + \ifdim\ht\tsplitresult>\zeropoint + \setbox\tsplitresult\vbox{\unvbox\tsplitresult\unvcopy\tsplittail}% + \dowithsplitofffloat{\tsplitbeforeresult\box\tsplitresult\tsplitafterresult}% + \doifnotinsidesplitfloat\tsplitafter + \endgraf + \fi + \ifinsidecolumns + \doifnotinsidesplitfloat\goodbreak + \else + \doifnotinsidesplitfloat\page + \fi + \fi}} + +\protect \endinput + +% test cases + +% \setupTABLE[split=repeat] +% +% \input tufte \endgraf +% \splitfloat[lines=11] +% {\placetable{\dorecurse{10}{test\recurselevel\endgraf}}} +% {\bTABLE\dorecurse{100}{\bTR \bTD test \eTD \eTR}\eTABLE} +% \input tufte \page +% +% \input tufte \endgraf +% \splitfloat[lines=0] +% {} +% {\bTABLE\dorecurse{100}{\bTR \bTD test \eTD \eTR}\eTABLE} +% \input tufte \endgraf \page +% +% \input tufte \endgraf +% \bTABLE\dorecurse{100}{\bTR \bTD test \eTD \eTR}\eTABLE +% \input tufte \page + +% \setuptabulate[split=yes] +% +% \input tufte \endgraf +% \splitfloat[lines=11] +% {\placetable{\dorecurse{10}{test\recurselevel\endgraf}}} +% {\starttabulate\dorecurse{200}{\NC test \NC test \NC \NR}\stoptabulate} +% \input tufte \page +% +% \input tufte \endgraf +% \splitfloat[lines=0] +% {} +% {\starttabulate\dorecurse{200}{\NC test \NC test \NC \NR}\stoptabulate} +% \input tufte \page +% +% \input tufte \endgraf +% \starttabulate\dorecurse{200}{\NC test \NC test \NC \NR}\stoptabulate +% \input tufte \page + +% \setuptables[split=yes] +% +% \newtoks\TestToks +% +% \TestToks\emptytoks +% \appendtoks\starttablehead\to\TestToks +% \dorecurse{3}{\appendtoks\VL head \VL head \VL \SR\to\TestToks} +% \appendtoks\stoptablehead\to\TestToks +% \appendtoks\starttabletail\to\TestToks +% \dorecurse{3}{\appendtoks\VL tail \VL tail \VL \SR\to\TestToks} +% \appendtoks\stoptabletail\to\TestToks +% \appendtoks\starttables[|c|c|]\to\TestToks +% \dorecurse{100}{\appendtoks\VL test \VL test \VL \SR\to\TestToks} +% \appendtoks\stoptables\to\TestToks +% +% \input tufte \endgraf +% \splitfloat[lines=auto] % [lines=11] +% {\placetable{\dorecurse{10}{test\recurselevel\endgraf}}} +% {\the\TestToks} +% \input tufte \page +% +% \input tufte \endgraf +% \splitfloat[lines=0] +% {} +% {\the\TestToks} +% \input tufte \page +% +% \input tufte \endgraf +% \the\TestToks +% \input tufte \page +% +% multiple floats +% +% \starttext +% \dorecurse{3}{\input tufte } \endgraf +% \dorecurse{5}{\placefigure{}{\framed[height=.5\textheight]{}}} +% \splitfloat[lines=auto,inbetween=] +% {\placetable{\dorecurse{5}{test\recurselevel\endgraf}}} +% {\bTABLE[split=yes] +% \bTR \bTD 11 \eTD \bTD \input tufte \eTD \eTR +% \bTR \bTD 12 \eTD \bTD \input zapf \eTD \eTR +% \bTR \bTD 13 \eTD \bTD \input bryson \eTD \eTR +% \bTR \bTD 14 \eTD \bTD test \eTD \eTR +% \bTR \bTD 21 \eTD \bTD \input tufte \eTD \eTR +% \bTR \bTD 22 \eTD \bTD \input zapf \eTD \eTR +% \bTR \bTD 23 \eTD \bTD \input bryson \eTD \eTR +% \bTR \bTD 24 \eTD \bTD test \eTD \eTR +% \bTR \bTD 31 \eTD \bTD \input tufte \eTD \eTR +% \bTR \bTD 32 \eTD \bTD \input zapf \eTD \eTR +% \bTR \bTD 33 \eTD \bTD \input bryson \eTD \eTR +% \bTR \bTD 34 \eTD \bTD test \eTD \eTR +% \eTABLE} +% \dorecurse{10}{\input tufte } +% \stoptext diff --git a/tex/context/base/core-uti.tex b/tex/context/base/core-uti.tex index 680de0f7a..66b5b46df 100644 --- a/tex/context/base/core-uti.tex +++ b/tex/context/base/core-uti.tex @@ -31,6 +31,7 @@ \edef\utilityversion{1998.07.07} % was: 1996.03.15 % status variables \edef\utilityversion{1998.12.20} % was: 1998.07.07 % index attributes \edef\utilityversion{2003.07.19} % was: 1998.12.20 % object pages +\edef\utilityversion{2006.06.23} % was: 2003.07.19 % -- instead of : % Bepaalde commando's worden als string weggeschreven. Deze % zijn aan het eind van deze file gedefinieerd. @@ -56,10 +57,10 @@ {\checksectionseparator} {\@@utilityerrormessage\resetutilities\endinput}} -\def\checksectionseparator % catches backward compatibility conflict - {\doifnot\sectionseparator:\endinput} % this dependency may go in a few years +\def\checksectionseparator % catches backward compatibility conflict + {}% \doifnot\sectionseparator:\endinput} % this dependency may go in a few years -\def\dosplitofffoliopart[#1::#2::#3]{#3} +\def\dosplitofffoliopart[#1--#2--#3]{#3} \def\thisissectionseparator#1% {\bgroup diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex index 75c59605b..f6c1b9904 100644 --- a/tex/context/base/font-ini.tex +++ b/tex/context/base/font-ini.tex @@ -1048,21 +1048,21 @@ \def\dodosetmathfamily#1#2% {\@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\relax - \@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \relax - \@EA\ifx \csname\fontclass\fontbody\backfamily\fontsize\endcsname \relax - \@EA\ifx \csname\fontclass\fontbody\backfamily\endcsname \relax + \@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily \endcsname\relax + \@EA\ifx \csname\fontclass\fontbody \backfamily\fontsize\endcsname\relax + \@EA\ifx \csname\fontclass\fontbody \backfamily \endcsname\relax \@EA\ifx \csname \fontbody\c!mm\fontfamily\fontsize\endcsname\relax - \@EA\ifx \csname \fontbody\c!mm\fontfamily\endcsname \relax - \@EA\ifx \csname \fontbody\backfamily\fontsize\endcsname \relax - \@EA\ifx \csname \fontbody\backfamily\endcsname \relax - \autofontsizetrue \nullfont \else - \autofontsizetrue \csname \fontbody\backfamily\endcsname \fi \else - \autofontsizefalse \csname \fontbody\backfamily\fontsize\endcsname \fi \else - \autofontsizetrue \csname \fontbody\c!mm\fontfamily\endcsname \fi \else + \@EA\ifx \csname \fontbody\c!mm\fontfamily \endcsname\relax + \@EA\ifx \csname \fontbody \backfamily\fontsize\endcsname\relax + \@EA\ifx \csname \fontbody \backfamily \endcsname\relax + \autofontsizetrue \nullfont \else + \autofontsizetrue \csname \fontbody \backfamily \endcsname\fi \else + \autofontsizefalse \csname \fontbody \backfamily\fontsize\endcsname\fi \else + \autofontsizetrue \csname \fontbody\c!mm\fontfamily \endcsname\fi \else \autofontsizefalse \csname \fontbody\c!mm\fontfamily\fontsize\endcsname\fi \else - \autofontsizetrue \csname\fontclass\fontbody\backfamily\endcsname \fi \else - \autofontsizefalse \csname\fontclass\fontbody\backfamily\fontsize\endcsname \fi \else - \autofontsizetrue \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \fi \else + \autofontsizetrue \csname\fontclass\fontbody \backfamily \endcsname\fi \else + \autofontsizefalse \csname\fontclass\fontbody \backfamily\fontsize\endcsname\fi \else + \autofontsizetrue \csname\fontclass\fontbody\c!mm\fontfamily \endcsname\fi \else \autofontsizefalse \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\fi #1#2\font} @@ -1103,12 +1103,12 @@ \def\dodosetmathfamilyA#1#2% {\ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse \csname \fontbody\c!mm\fontfamily\fontsize\endcsname \else - \ifcsname \fontbody\c!mm\fontfamily\endcsname \autofontsizetrue - \csname \fontbody\c!mm\fontfamily\endcsname \else - \ifcsname \fontbody\backfamily\fontsize\endcsname \autofontsizefalse - \csname \fontbody\backfamily\fontsize\endcsname \else - \ifcsname \fontbody\backfamily\endcsname \autofontsizetrue - \csname \fontbody\backfamily\endcsname \else + \ifcsname \fontbody\c!mm\fontfamily \endcsname \autofontsizetrue + \csname \fontbody\c!mm\fontfamily \endcsname \else + \ifcsname \fontbody \backfamily\fontsize\endcsname \autofontsizefalse + \csname \fontbody \backfamily\fontsize\endcsname \else + \ifcsname \fontbody \backfamily \endcsname \autofontsizetrue + \csname \fontbody \backfamily \endcsname \else \nullfont \autofontsizetrue \fi\fi\fi\fi #1#2\font} @@ -1116,12 +1116,12 @@ \def\dodosetmathfamilyB#1#2% {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else - \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue - \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else - \ifcsname\fontclass\fontbody\backfamily\fontsize\endcsname \autofontsizefalse - \csname\fontclass\fontbody\backfamily\fontsize\endcsname \else - \ifcsname\fontclass\fontbody\backfamily\endcsname \autofontsizetrue - \csname\fontclass\fontbody\backfamily\endcsname \else + \ifcsname\fontclass\fontbody\c!mm\fontfamily \endcsname \autofontsizetrue + \csname\fontclass\fontbody\c!mm\fontfamily \endcsname \else + \ifcsname\fontclass\fontbody \backfamily\fontsize\endcsname \autofontsizefalse + \csname\fontclass\fontbody \backfamily\fontsize\endcsname \else + \ifcsname\fontclass\fontbody \backfamily \endcsname \autofontsizetrue + \csname\fontclass\fontbody \backfamily \endcsname \else \dodosetmathfamilyA#1#2% \fi\fi\fi\fi #1#2\font} @@ -1610,6 +1610,9 @@ % % \testfeatureonce{5000}{\definefontsynonym[somefont][somename]} \end + +\def\classfont#1#2{#1#2} % \definefont[whatever][\classfont{xx}{yy} at 10pt] + \def\definefontsynonym[#1]#2[#3]% {\edef\@@fontfile{#3}% \@EA\let\csname\??ff\fontclass#1\endcsname\@@fontfile @@ -4320,15 +4323,30 @@ \let\thedefinedfont\relax -\def\symbolicscaledfont#1#2% - {\scaledfont\fontbody - \scaledfont#1\scaledfont - \font\thedefinedfont\truefontname{\glyphfontfile{#2}} at +% \def\symbolicscaledfont#1#2% +% {\scaledfont\fontbody +% \scaledfont#1\scaledfont +% \font\thedefinedfont\truefontname{\glyphfontfile{#2}} at +% \currentfontbodyscale\scaledfont +% \thedefinedfont} +% +% \unexpanded\def\symbolicfont +% {\symbolicscaledfont\plusone} +% +% even more control (needed for mthsqrt etc) + +\def\symbolicsizedfont#1#2#3% + {\scaledfont#1% + \scaledfont#2\scaledfont + \font\thedefinedfont\truefontname{\glyphfontfile{#3}} at \currentfontbodyscale\scaledfont \thedefinedfont} +\def\symbolicscaledfont + {\symbolicsizedfont\fontbody} + \unexpanded\def\symbolicfont - {\symbolicscaledfont\plusone} + {\symbolicsizedfont\fontbody\plusone} \unexpanded\def\getglyph#1#2% slow, faster, much faster %{{\definefont[\s!dummy][\glyphfontfile{#1} sa \currentfontscale]\dummy#2}} diff --git a/tex/context/base/lang-all.xml b/tex/context/base/lang-all.xml index 0d5ea936b..486ef5d08 100644 --- a/tex/context/base/lang-all.xml +++ b/tex/context/base/lang-all.xml @@ -11,7 +11,7 @@ 1991 Julio Sanchez (jsanchez@gmv.es) These patterns have been derived from "On Word Division in Spanish" - Jos'e A. Ma~nas + Jos'e A. Ma~nas 1997 diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex index 469e90c53..a031a32ed 100644 --- a/tex/context/base/lang-ini.tex +++ b/tex/context/base/lang-ini.tex @@ -95,7 +95,7 @@ \stopmessages \startmessages norwegian library: linguals - title: sprk + title: sprøk 1: orddelingsmønster -- for -- er lest inn (n=--,e=--,m=--) 2: ingen orddelingsmønster -- for -- (n=--,e=--,m=--) (--,--) 3: orddelingsdefinisjon -- for -- er lest inn (n=--,e=--,m=--) diff --git a/tex/context/base/lang-ita.tex b/tex/context/base/lang-ita.tex index 776078118..950f87344 100644 --- a/tex/context/base/lang-ita.tex +++ b/tex/context/base/lang-ita.tex @@ -23,7 +23,7 @@ %D %D \starttabulate[|lB|l|] %D \NC Italian \NC Giuseppe Bilotta \NC \NR -%D \NC Rumanian \NC Dan Seracu \NC \NR +%D \NC Romanian \NC Dan Seracu \NC \NR %D \NC Portuguese \NC Pedro F. M. Mendon\c a \NC \NR %D \stoptabulate diff --git a/tex/context/base/m-database.tex b/tex/context/base/m-database.tex index a657e38c3..b707a8ecc 100644 --- a/tex/context/base/m-database.tex +++ b/tex/context/base/m-database.tex @@ -3,15 +3,15 @@ %D version=2006.04.23, %D title=\CONTEXT\ Modules, %D subtitle=Database Thingies, -%D author=Hans Hagen, +%D author=Hans Hagen\& Taco Hoekwater, %D date=\currentdate, %D copyright=PRAGMA +%D ] %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. - \unprotect % % % to be added to mult-* files @@ -19,26 +19,100 @@ % % % todo: \dontcollectseparatedlist via k/v \definesystemvariable{ls} -\def\c!first{first} -\def\c!last {last} + +\def\c!first {first} +\def\c!last {last} +\def\c!quotechar {quotechar} + +\let\@NX\noexpand + +%D {processquotedlist} +%D +%D An even more general list processing macro is the +%D following one: +%D +%D \starttyping +%D \processquotedlist{beginsym}{endsym}{separator}\docommando list +%D \stoptyping +%D +%D This one supports arbitrary open and close symbols as well +%D as user defined separators. +%D +%D \starttyping +%D \processquotedlist(){,}{"}\docommando(a=>b=>c=>d) +%D \stoptyping + +\def\processquotedlist#1#2#3#4#5% + {\def\csvquotechar{#4}% + \edef\doconvertcsvquoteditem#4##1#4##2% + {\@NX\ifx##2#3% + \let\@NX\next\@NX\doconvertcsvlist + \def\@NX\arg{#3}% + \edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\else + \let\@NX\next\@NX\redoconvertcsvquoteditem + \def\@NX\arg{##1\@NX\csvquotechar}% + \@NX\fi + \@NX\expandafter\@NX\next\@NX\arg}% + \edef\redoconvertcsvquoteditem##1#4##2% + {\@NX\ifx##2#3% + \let\@NX\next\@NX\doconvertcsvlist + \def\@NX\arg{#3}% + \edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\else + \let\@NX\next\@NX\redoconvertcsvquoteditem + \def\@NX\arg{##1\@NX\csvquotechar}% + \@NX\fi + \@NX\expandafter\@NX\next\@NX\arg}% + \edef\doconvertcsvitem##1#3% + {\edef\@NX\temp{##1}% + \@NX\expanded{\@NX#5{\@NX\temp}}% + \@NX\doconvertcsvlist#3}% + \edef\doconvertcsvlist#3##1% + {\@NX\ifx##1\@NX#2% + \let\@NX\next \@NX\gobbleoneargument + \@NX\else\@NX\ifx##1#4% + \let\@NX\next \@NX\doconvertcsvquoteditem + \@NX\else + \let\@NX\next \@NX\doconvertcsvitem + \@NX\fi\@NX\fi \@NX\next##1}% + \doconvertcsvitem} + +\gdef\doprocessseparatedquoteditem#1% + {\appendseparatedlistparameter\c!left% + \appendseparatedlistcontent{#1}% + \appendseparatedlistparameter\c!right} + % % % so far -% \long\def\processseplist#1#2#3\end -% {\def\doprocessseplist####1####2\end -% {\ifx\end####1% -% \expandafter\gobbleoneargument +% \def\dodefineprocessseplist#1#2% separator \docommand +% {\def\dodoprocessseplist##1##2#1% +% {\ifx\relax##1% +% \expandafter\nodoprocessseplist +% \else\ifx##1#1% +% #2{}% +% #2{##2}% +% \expandafter\expandafter\expandafter\dodoprocessseplist % \else -% #2{####1####2}% -% \fi -% \doprocessseplist}% -% \dodoprocessseplist#3\end} +% #2{##1##2}% +% \expandafter\expandafter\expandafter\dodoprocessseplist +% \fi\fi}% +% \def\doprocessseplist##1\relax +% {\dodoprocessseplist##1#1\relax#1\relax\relax\end}} +% +% a version more robust with regard to {a a} b c d situations + +\def\edef@relax{\relax} \def\dodefineprocessseplist#1#2% separator \docommand {\def\dodoprocessseplist##1##2#1% - {\ifx\relax##1% + {\edef\!!stringa{##1}% + \ifx\edef@relax\!!stringa \expandafter\nodoprocessseplist - \else\ifx##1#1% + \else\ifx\!!stringa#1% #2{}% #2{##2}% \expandafter\expandafter\expandafter\dodoprocessseplist @@ -46,13 +120,13 @@ #2{##1##2}% \expandafter\expandafter\expandafter\dodoprocessseplist \fi\fi}% - \def\doprocessseplist##1\relax - {\dodoprocessseplist##1#1\relax#1\relax\relax\end}} + \def\doprocessseplist##1\relax + {\dodoprocessseplist##1#1\relax#1\relax\relax\end}} \def\nodoprocessseplist#1\end {} -\long\def\processseplist#1#2#3\relax +\long\def\processseplist#1#2#3\relax raw version {\dodefineprocessseplist{#1}{#2}% \dodoprocessseplist#3#1\relax#1\relax\relax\end} @@ -98,90 +172,128 @@ \chardef\separatedlistmode\zerocount -\bgroup \obeylines +\def\setcurrentlistseparator + {\edef\currentlistseparator + {\executeifdefined + {\??ls::\csname\??ls\currentseparatedlist\c!separator\endcsname}% + {\csname\??ls\currentseparatedlist\c!separator\endcsname}}% + \doifvalue{\??ls\currentseparatedlist\c!separator}{tab} + {\catcode`\^^I=12\relax}% + \ifx\currentlistseparator\empty\def\currentlistseparator{,}\fi} + +\bgroup \catcode`\^^I=12 + \setgvalue{\??ls::tab}{ } + \setgvalue{\??ls::space}{ } + \setgvalue{\??ls::comma}{,} +\egroup -\gdef\doprocessseparatedfileline% - {\ifeof\scratchread% - \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi% - \immediate\closein\scratchread% - \expandafter\flushseparatedlistdata% - \else\ifx\line\empty% +\def\doprocessseparatedfileline + {\ifeof\scratchread + \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi + \immediate\closein\scratchread + \expandafter\flushseparatedlistdata + \else\ifx\line\empty % skip, can be comment - \read\scratchread to\line% - \@EA\dodoprocessseparatedfileline% + \read\scratchread to\line + \@EA\dodoprocessseparatedfileline \else \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% - \expandafter\doprocessseplist\line\relax% - \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi% - \read\scratchread to\line% - \@EAEAEA\dodoprocessseparatedfileline% + \ifx\currentlistquotechar\empty% + \expandafter\doprocessseplist\line\relax + \else + \expanded{\processquotedlist{}{\noexpand\end}% + {\currentlistseparator}{\currentlistquotechar}% + \noexpand\doprocessseparatedquoteditem \line\currentlistseparator\noexpand\end}% + \fi + \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi + \read\scratchread to\line + \@EAEAEA\dodoprocessseparatedfileline \fi\fi} -\gdef\dodoprocessseparatedfileline% +\def\dodoprocessseparatedfileline {\doprocessseparatedfileline} -\gdef\doprocessseparatedfile[#1][#2]% - {\bgroup% +\def\doprocessseparatedfile[#1][#2]% + {\bgroup \edef\currentseparatedlist{#1}% \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% - \edef\currentlistseparator{\csname\??ls\currentseparatedlist\c!separator\endcsname}% - \ifx\currentlistseparator\empty\def\currentlistseparator{,}\fi% - \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem% - \initializeseparatedlistdata% + \setcurrentlistseparator + \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% + \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem + \initializeseparatedlistdata \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% - \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi% - \endlinechar\minusone% - \ignorelines% + \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi + \endlinechar\minusone + \ignorelines \catcode`\#\@@comment - \immediate\openin\scratchread=#2\relax% todo: \doopenin - \read\scratchread to\line% + \immediate\openin\scratchread=#2\relax % todo: \doopenin + \read\scratchread to\line \doprocessseparatedfileline} -\gdef\dostartseparatedlist#1[#2]% - {\bgroup% +\def\dostartseparatedlist#1[#2]% + {\bgroup \edef\currentseparatedlist{#2}% \doifdefined{\??ls\currentseparatedlist\c!command}{\chardef\separatedlistmode\plusone}% - \obeylines% - \let#1\relax% + \obeylines + \let#1\relax \def\separateslistend{#1}% - \edef\currentlistseparator{\csname\??ls\currentseparatedlist\c!separator\endcsname}% - \ifx\currentlistseparator\empty\def\currentlistseparator{,}\fi% - \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem% + \setcurrentlistseparator + \edef\currentlistquotechar{\csname\??ls\currentseparatedlist\c!quotechar\endcsname}% + \expandafter\dodefineprocessseplist\expandafter{\currentlistseparator}\doprocessseparateditem \directsetup{\currentseparatedlist:\executeifdefined{\??ls\currentseparatedlist\c!setups}\s!default}% - \initializeseparatedlistdata% - \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi% + \initializeseparatedlistdata + \ifcase\separatedlistmode\appendseparatedlistparameter\c!before\fi \dodostartseparatedlist} -\gdef\dodostartseparatedlist#1 - {\doprocessseparatedline} - -\gdef\doprocessseparatedline#1 +\def\redoprocessseparatedline#1% {\def\!!stringa{#1}% - \ifx\!!stringa\separateslistend% - \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi% - \expandafter\flushseparatedlistdata% + \ifx\!!stringa\separateslistend + \ifcase\separatedlistmode\appendseparatedlistparameter\c!after\fi + \expandafter\flushseparatedlistdata \else% \appendseparatedlistparameter{\ifcase\separatedlistmode\c!first\else\c!command\fi}% - \expandafter\doprocessseplist#1\relax% - \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi% - \expandafter\dodoprocessseparatedline% + \ifx\currentlistquotechar\empty% + \doprocessseplist#1\relax + \else% + \convertargument#1\to\csvdata% + \expanded{\processquotedlist{}{\noexpand\end}% + {\currentlistseparator}{\currentlistquotechar}% + \noexpand\doprocessseparatedquoteditem \csvdata\currentlistseparator\noexpand\end}% + \fi + \ifcase\separatedlistmode\appendseparatedlistparameter\c!last\fi + \expandafter\dodoprocessseparatedline \fi} -\gdef\dodoprocessseparatedline% +\def\doprocessseparatedline + {\doifnextcharelse\bgroup\xdoprocessseparatedline\ydoprocessseparatedline} + +\def\dodoprocessseparatedline {\doprocessseparatedline} -\gdef\doprocessseparateditem#1% +\def\doprocessseparateditem#1% {\ifcase\separatedlistmode - \appendseparatedlistparameter\c!left% + \appendseparatedlistparameter\c!left \appendseparatedlistcontent{#1}% \appendseparatedlistparameter\c!right \else \appendseparatedlistcontent{{#1}}% \fi} + +\bgroup \obeylines + + \gdef\dodostartseparatedlist#1 + {\doprocessseparatedline} + + \gdef\xdoprocessseparatedline#1#2 + {\redoprocessseparatedline{{{#1}}#2}} + + \gdef\ydoprocessseparatedline#1 + {\redoprocessseparatedline{#1}} + \egroup -\startsetups CVS:unix +\startsetups CSV:unix \catcode`\#=\@@comment \stopsetups @@ -193,6 +305,7 @@ \getparameters [\??ls#1] [\c!separator=, + \c!quotechar=, \c!first=, \c!left=, \c!before=, @@ -202,63 +315,70 @@ % \c!command=, #2]} +\def\setupseparatedlist + {\dodoubleempty\dosetupseparatedlist} + +\def\dosetupseparatedlist[#1]% [#2] + {\getparameter[\??ls#1]} % [#2] + \def\startseparatedlist[#1]% {\dostartseparatedlist\stopseparatedlist[#1]} \def\processseparatedfile {\dodoubleargument\doprocessseparatedfile} -\protect \endinput +\protect \doifnotmode{demo}{\endinput} \defineseparatedlist - [CVS] + [CSV] [separator={,}, first=\bTR,last=\eTR, left=\bTD,right=\eTD, before=\bTABLE,after=\eTABLE] -\startseparatedlist[CVS] +\startseparatedlist[CSV] a,b,c d,e,f \stopseparatedlist -\startCVS +\startCSV a,b,c d,e,f -\stopCVS +\stopCSV \defineseparatedlist - [CVS] + [CSV] [separator={,}, + quotechar={"}, first=\NC,last=\NR, left=,right=\NC, before={\starttabulate[|l|l|l|]},after=\stoptabulate] -\startCVS -a,b,c -d,e,f -\stopCVS +\startCSV +a,b,"c,d" +d,"""",f +\stopCSV \defineseparatedlist - [CVS] + [CSV] [separator={ }, first=\NC,last=\NR, left=,right=\NC, before={\starttabulate[|l|l|l|]},after=\stoptabulate] -\startCVS +\startCSV a b c d e f -\stopCVS +\stopCSV \defineseparatedlist - [CVS] + [CSV] [setups=unix, first=\NC,last=\NR, left=,right=\NC, before={\starttabulate[|l|l|l|]},after=\stoptabulate] -% \startsetups CVS:unix +% \startsetups CSV:unix % \catcode`\#=\@@comment % \stopsetups @@ -267,10 +387,10 @@ d e f % # 4,5,6 % 4,5,6 -\processseparatedfile[CVS][test.dat] +\processseparatedfile[CSV][test.dat] \defineseparatedlist - [CVSX] + [CSVX] [command=\Whatever, separator={,}, first=\bTR,last=\eTR, @@ -279,7 +399,7 @@ d e f \def\Whatever#1#2#3{[#1][#2][#3]\endgraf} -\startseparatedlist[CVSX] +\startseparatedlist[CSVX] a,b,c d,e,f \stopseparatedlist diff --git a/tex/context/base/m-r.tex b/tex/context/base/m-r.tex index fe208cf75..244b62c36 100644 --- a/tex/context/base/m-r.tex +++ b/tex/context/base/m-r.tex @@ -84,35 +84,62 @@ \def\stopRhidden {\doifmode{*\v!first}\runR} +% \def\runR % " " needed to preserve < > +% {\executesystemcommand{texmfstart +% --ifchanged=\Rfile\space --direct R +% "-q --save --restore < \Rfile\space > \Rfile.out"}} + \def\runR {\executesystemcommand{texmfstart -% --ifchanged=\Rfile\space bin:R --ifchanged=\Rfile\space --direct R - "-q --save --restore < \Rfile\space > \Rfile.out"}} + CMD BATCH -q --save --restore \Rfile\space \Rfile.out}} \protect \doifnotmode{demo}{\endinput} % Johan's test file: +\usemodule[r] + +\def\R{R} + +\setupcolors[state=start] + +\setuptyping + [Rtype] + [color=darkgreen] + \starttext +First a test of whether the workspace is persistent: +bla + \startR a <- "bla" b <- "blabla" ls() \stopR -bla bla +One \R run ends, another begins. + +\startR +ls() +\stopR + +Now follows a hidden \R run which cleans the R workspace \startRhidden rm(list=ls()) save.image() \stopRhidden -more bla +What is in the workspace now? \startR ls() +\stopR + +Then a small test of generating a graphic, in this case a pdf +\startR ushape <- c(rexp(500000), 12-rexp(500000)) pdf("ushape.pdf") par(mfrow=c(1,2)) @@ -121,7 +148,12 @@ plot(density(ushape), main="Density") dev.off() \stopR -\input tufte \par \input knuth +The graphic \type{ushape.pdf} can be included in the standard \CONTEXT\ way +\startbuffer +\placefigure{An ugly distribution}{\externalfigure[ushape]} +\stopbuffer +\typebuffer +\getbuffer \startR x <- rnorm(900) @@ -135,25 +167,50 @@ xyplot(y~x|f) dev.off() \stopR -\placefigure{}{\externalfigure[lattice]} -\placefigure{}{\externalfigure[ushape]} +With \type{Sweave} lattice graphics calls must be enclosed in +\type{print()} statements but that is not necessary here. -\input tufte +\startbuffer +\placefigure[here]{Lattice graphics}{\externalfigure[lattice]} +\stopbuffer +\typebuffer +\getbuffer +A test string with nasty characters. In \R, the result of a statement +is not printed by default. Enclosing the statement in parentheses, +however causes the parser to see only the value of the statement and +applying the \type{print()} method. \startR -(test <- ".*\\\\ []{}=?!+%#|<|>@$") +(test <- ".*\\\\ [[{[{]{[{[{}\]\}=?!+%#|<|>@$") cat(test) \stopR -\input bryson \par \input knuth +A combination +\startbuffer +\placefigure{A combination of two previously used graphics}{ +\startcombination[2*1] + {\externalfigure[ushape][width=.4\textwidth]}{The first graphic, rescaled} + {\externalfigure[lattice][width=.4\textwidth]}{The second graphic, rescaled}} +\stopcombination +\stopbuffer +\typebuffer +\getbuffer + +Testing a function definition. \startR a.df <- data.frame(a=1:2, b=rnorm(2)) a.df$a testfunction <- function(a=NULL, ...) { - for(i in 1:length(a)) { - gsub(a[[i]], "([a-r]|[A-R])", "bla")} - print(a)} + for(i in 1:length(a)) { + gsub(a[[i]], "([a-r]|[A-R])", "bla")} + print(a)} +\stopR + +What is in the workspace now? + +\startR +ls() \stopR \stoptext diff --git a/tex/context/base/m-streams.tex b/tex/context/base/m-streams.tex index fd93f2655..181c82d33 100644 --- a/tex/context/base/m-streams.tex +++ b/tex/context/base/m-streams.tex @@ -1,3 +1,16 @@ +%D \module +%D [ file=m-streams, +%D version=2006.03.21, +%D title=\CONTEXT\ Modules, +%D subtitle=Streams, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + %D First we implement a simple left||right synchronization %D mechanism, which we may perfect and extend over time. @@ -107,6 +120,18 @@ {\outputstreambox[\currentstreamlayer]}% \stopsetups +\startsetups streamlayer:default:copy + \setlayer + [\currentstreamlayer] + [\c!preset=\v!left\v!top] + {\outputstreamcopy[\currentstreamlayer]}% +\stopsetups + + +\startsetups streamlayer:default:reset + \outputstreambox[\currentstreamlayer] +\stopsetups + \startsetups streamlayer:default:flush \tightlayer[\currentstreamlayer] \stopsetups @@ -268,7 +293,6 @@ %D \stoptext %D \stoptyping - \def\starttextstreamlayer {\startstreamlayer} diff --git a/tex/context/base/m-tryout.tex b/tex/context/base/m-tryout.tex index ef6c502ba..89ffc4678 100644 --- a/tex/context/base/m-tryout.tex +++ b/tex/context/base/m-tryout.tex @@ -24,6 +24,10 @@ \startmode[activecolon] +\endinput + +% this is now default + \gdef\sectionseparator{-} \gdef\@@filterfirstpart [#1--#2]{#1} diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.tex index 89dd71e77..0a42862f1 100644 --- a/tex/context/base/m-units.tex +++ b/tex/context/base/m-units.tex @@ -646,7 +646,7 @@ \setuplabeltext [\s!en] [u:vac=alternating current, - u:vdc=different current] + u:vdc=direct current] \setuplabeltext [\s!de] diff --git a/tex/context/base/math-cow.tex b/tex/context/base/math-cow.tex new file mode 100644 index 000000000..016221f2d --- /dev/null +++ b/tex/context/base/math-cow.tex @@ -0,0 +1,30 @@ +%D \module +%D [ file=math-cow, +%D version=2006.06.23, +%D title=\CONTEXT\ Math Macros, +%D subtitle=Cow Math, +%D author={Hans Hagen \& Taco Hoekwater}, +%D date=\currentdate, +%D copyright=\PRAGMA] +%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 + +\let\COWsqrt\mthsqrt +\let\COWfrac\mthfrac + +\startmathcollection [cow] + % todo +\stopmathcollection + +\startrawmathcollection[cow] + \definemathcommand [frac] {\COWfrac} + \definemathcommand [sqrt] {\COWsqrt} + %definemathcommand [r@@t] {\COWroot} + %definemathcommand [matrix] {\COWmatrix} +\stoprawmathcollection + +\protect \endinput diff --git a/tex/context/base/math-eul.tex b/tex/context/base/math-eul.tex index f89b54125..6acc33356 100644 --- a/tex/context/base/math-eul.tex +++ b/tex/context/base/math-eul.tex @@ -89,59 +89,59 @@ \startmathcollection [eul] % Ugh. no way around this to keep it compact in the font defs. -\definemathcharacter [a] [nothing] [mr] ["61] -\definemathcharacter [b] [nothing] [mr] ["62] -\definemathcharacter [c] [nothing] [mr] ["63] -\definemathcharacter [d] [nothing] [mr] ["64] -\definemathcharacter [e] [nothing] [mr] ["65] -\definemathcharacter [f] [nothing] [mr] ["66] -\definemathcharacter [g] [nothing] [mr] ["67] -\definemathcharacter [h] [nothing] [mr] ["68] -\definemathcharacter [i] [nothing] [mr] ["69] -\definemathcharacter [j] [nothing] [mr] ["6A] -\definemathcharacter [k] [nothing] [mr] ["6B] -\definemathcharacter [l] [nothing] [mr] ["6C] -\definemathcharacter [m] [nothing] [mr] ["6D] -\definemathcharacter [n] [nothing] [mr] ["6E] -\definemathcharacter [o] [nothing] [mr] ["6F] -\definemathcharacter [p] [nothing] [mr] ["70] -\definemathcharacter [q] [nothing] [mr] ["71] -\definemathcharacter [r] [nothing] [mr] ["72] -\definemathcharacter [s] [nothing] [mr] ["73] -\definemathcharacter [t] [nothing] [mr] ["74] -\definemathcharacter [u] [nothing] [mr] ["75] -\definemathcharacter [v] [nothing] [mr] ["76] -\definemathcharacter [w] [nothing] [mr] ["77] -\definemathcharacter [x] [nothing] [mr] ["78] -\definemathcharacter [y] [nothing] [mr] ["79] -\definemathcharacter [z] [nothing] [mr] ["7A] - -\definemathcharacter [A] [nothing] [mr] ["41] -\definemathcharacter [B] [nothing] [mr] ["42] -\definemathcharacter [C] [nothing] [mr] ["43] -\definemathcharacter [D] [nothing] [mr] ["44] -\definemathcharacter [E] [nothing] [mr] ["45] -\definemathcharacter [F] [nothing] [mr] ["46] -\definemathcharacter [G] [nothing] [mr] ["47] -\definemathcharacter [H] [nothing] [mr] ["48] -\definemathcharacter [I] [nothing] [mr] ["49] -\definemathcharacter [J] [nothing] [mr] ["4A] -\definemathcharacter [K] [nothing] [mr] ["4B] -\definemathcharacter [L] [nothing] [mr] ["4C] -\definemathcharacter [M] [nothing] [mr] ["4D] -\definemathcharacter [N] [nothing] [mr] ["4E] -\definemathcharacter [O] [nothing] [mr] ["4F] -\definemathcharacter [P] [nothing] [mr] ["50] -\definemathcharacter [Q] [nothing] [mr] ["51] -\definemathcharacter [R] [nothing] [mr] ["52] -\definemathcharacter [S] [nothing] [mr] ["53] -\definemathcharacter [T] [nothing] [mr] ["54] -\definemathcharacter [U] [nothing] [mr] ["55] -\definemathcharacter [V] [nothing] [mr] ["56] -\definemathcharacter [W] [nothing] [mr] ["57] -\definemathcharacter [X] [nothing] [mr] ["58] -\definemathcharacter [Y] [nothing] [mr] ["59] -\definemathcharacter [Z] [nothing] [mr] ["5A] +\definemathcharacter [a] [alpha] [mr] ["61] +\definemathcharacter [b] [alpha] [mr] ["62] +\definemathcharacter [c] [alpha] [mr] ["63] +\definemathcharacter [d] [alpha] [mr] ["64] +\definemathcharacter [e] [alpha] [mr] ["65] +\definemathcharacter [f] [alpha] [mr] ["66] +\definemathcharacter [g] [alpha] [mr] ["67] +\definemathcharacter [h] [alpha] [mr] ["68] +\definemathcharacter [i] [alpha] [mr] ["69] +\definemathcharacter [j] [alpha] [mr] ["6A] +\definemathcharacter [k] [alpha] [mr] ["6B] +\definemathcharacter [l] [alpha] [mr] ["6C] +\definemathcharacter [m] [alpha] [mr] ["6D] +\definemathcharacter [n] [alpha] [mr] ["6E] +\definemathcharacter [o] [alpha] [mr] ["6F] +\definemathcharacter [p] [alpha] [mr] ["70] +\definemathcharacter [q] [alpha] [mr] ["71] +\definemathcharacter [r] [alpha] [mr] ["72] +\definemathcharacter [s] [alpha] [mr] ["73] +\definemathcharacter [t] [alpha] [mr] ["74] +\definemathcharacter [u] [alpha] [mr] ["75] +\definemathcharacter [v] [alpha] [mr] ["76] +\definemathcharacter [w] [alpha] [mr] ["77] +\definemathcharacter [x] [alpha] [mr] ["78] +\definemathcharacter [y] [alpha] [mr] ["79] +\definemathcharacter [z] [alpha] [mr] ["7A] + +\definemathcharacter [A] [alpha] [mr] ["41] +\definemathcharacter [B] [alpha] [mr] ["42] +\definemathcharacter [C] [alpha] [mr] ["43] +\definemathcharacter [D] [alpha] [mr] ["44] +\definemathcharacter [E] [alpha] [mr] ["45] +\definemathcharacter [F] [alpha] [mr] ["46] +\definemathcharacter [G] [alpha] [mr] ["47] +\definemathcharacter [H] [alpha] [mr] ["48] +\definemathcharacter [I] [alpha] [mr] ["49] +\definemathcharacter [J] [alpha] [mr] ["4A] +\definemathcharacter [K] [alpha] [mr] ["4B] +\definemathcharacter [L] [alpha] [mr] ["4C] +\definemathcharacter [M] [alpha] [mr] ["4D] +\definemathcharacter [N] [alpha] [mr] ["4E] +\definemathcharacter [O] [alpha] [mr] ["4F] +\definemathcharacter [P] [alpha] [mr] ["50] +\definemathcharacter [Q] [alpha] [mr] ["51] +\definemathcharacter [R] [alpha] [mr] ["52] +\definemathcharacter [S] [alpha] [mr] ["53] +\definemathcharacter [T] [alpha] [mr] ["54] +\definemathcharacter [U] [alpha] [mr] ["55] +\definemathcharacter [V] [alpha] [mr] ["56] +\definemathcharacter [W] [alpha] [mr] ["57] +\definemathcharacter [X] [alpha] [mr] ["58] +\definemathcharacter [Y] [alpha] [mr] ["59] +\definemathcharacter [Z] [alpha] [mr] ["5A] \stopmathcollection diff --git a/tex/context/base/math-ext.tex b/tex/context/base/math-ext.tex new file mode 100644 index 000000000..1091cd5ff --- /dev/null +++ b/tex/context/base/math-ext.tex @@ -0,0 +1,199 @@ +%D \module +%D [ file=math-ext, +%D version=2006.01.14, +%D title=\CONTEXT\ Math Macros, +%D subtitle=Extra Macros, +%D author={Hans Hagen \& Taco Hoekwater \& Adity Mahajan}, +%D date=\currentdate, +%D copyright=\PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D These will be generalized! + +\def\exmthfont#1{\symbolicsizedfont#1\plusone{MathExtension}} + +\def\domthfrac#1#2#3#4% + {\begingroup + \mathsurround\zeropoint + \setbox0\hbox{$#1 #3$}% + \setbox2\hbox{$#1 #4$}% + \dimen0\wd0 + \ifdim\wd2>\dimen0 \dimen0\wd2 \fi + \setbox4\hbox to \dimen0{\exmthfont#2\char"77\leaders\hbox{\char"75}\hss\char"76}% + \mathord{\vcenter{{\offinterlineskip + \hbox to \dimen0{\hss\box0\hss}% + \kern \ht4% + \hbox to \dimen0{\hss\copy4\hss}% + \kern \ht4% + \hbox to \dimen0{\hss\box2\hss}}}}% + \endgroup} + +\def\domthsqrt#1#2#3% + {\begingroup + \mathsurround\zeropoint + \setbox0\hbox{$#1 #3$}% + \dimen0\wd0 + \setbox4\hbox to \dimen0{\exmthfont#2\leaders\hbox{\char"75}\hfill\char"76}% + \setbox2\hbox{\exmthfont#2\char"70}% + \ifdim\dimexpr\dp0+\ht0+\ht2\relax>\dp2 \setbox2\hbox{\exmthfont#2\char"71}\fi + \ifdim\dimexpr\dp0+\ht0+\ht2\relax>\dp2 \setbox2\hbox{\exmthfont#2\char"72}\fi + \ifdim\dimexpr\dp0+\ht0+\ht2\relax>\dp2 \setbox2\hbox{\exmthfont#2\char"73}\fi + \ifdim\dimexpr\dp0+\ht0+\ht2\relax>\dp2 \setbox2\hbox{\exmthfont#2\char"74}\fi + \mathord{\vcenter{\hbox{% + \raise\dimexpr\dp2-.5\ht2\relax\hbox{\copy2\rlap{\copy4}}% + \raise\dp0 \copy0}}}% + \endgroup} + +\def\mthfrac#1#2{\mathchoice + {\domthfrac\displaystyle \textface {#1}{#2}} + {\domthfrac\textstyle \textface {#1}{#2}} + {\domthfrac\scriptstyle \scriptface {#1}{#2}} + {\domthfrac\scriptscriptstyle\scriptscriptface{#1}{#2}}} + +\def\mthsqrt#1{\mathchoice + {\domthsqrt\displaystyle \textface {#1}} + {\domthsqrt\textstyle \textface {#1}} + {\domthsqrt\scriptstyle \scriptface {#1}} + {\domthsqrt\scriptscriptstyle\scriptscriptface{#1}}} + +% temp here + +\def\mtharrfactor{1} +\def\mtharrextra {0} + +\def\domthxarr#1#2#3#4#5% hm, looks like we do a double mathrel + {\begingroup + \def\mtharrfactor{1}% + \def\mtharrextra {0}% + \processaction[#1] % will be sped up + [ \v!none=>\def\mtharrfactor{0}, + \v!small=>\def\mtharrextra{10}, + \v!medium=>\def\mtharrextra{15}, + \v!big=>\def\mtharrextra{20}, + \v!normal=>, + \v!default=>, + \v!unknown=>\doifnumberelse{#1}{\def\mtharrextra{#1}}\donothing]% + \mathsurround\zeropoint + \muskip0=\thirdoffourarguments #2mu + \muskip2=\fourthoffourarguments #2mu + \muskip4=\firstoffourarguments #2mu + \muskip6=\secondoffourarguments #2mu + \muskip0=\mtharrfactor\muskip0 \advance\muskip0 \mtharrextra mu + \muskip2=\mtharrfactor\muskip2 \advance\muskip2 \mtharrextra mu + \setbox0\hbox{$\scriptstyle + \mkern\muskip4\relax + \mkern\muskip0\relax + #5\relax + \mkern\muskip2\relax + \mkern\muskip6\relax + $}% + \setbox4\hbox{#3}% + \dimen0\wd0 + \ifdim\wd4>\dimen0 \dimen0\wd4 \fi + \setbox2\hbox{$\scriptstyle + \mkern\muskip4\relax + \mkern\muskip0\relax + #4\relax + \mkern\muskip2\relax + \mkern\muskip6\relax + $}% + \ifdim\wd2>\dimen0 \dimen0\wd2 \fi + \setbox4\hbox to \dimen0{#3}% + \mathrel{\mathop{\hbox to \dimen0{\hss\copy4\hss}}\limits^{\box0}_{\box2}} + \endgroup} + +\let\domthxarrsingle\domthxarr + +\def\domthxarrdouble#1#2#3#4#5#6#7% opt l r sp rs top bot + {\mathrel + {\scratchdimen.22ex\relax + \setbox0\hbox{$\domthxarr{#1}{#2}{#4}{\phantom{#6}}{#7}$}% + \setbox2\hbox{$\domthxarr{#1}{#3}{#5}{#6}{\phantom{#7}}$}% + \raise\scratchdimen\box0 + \kern-\wd2 + \lower\scratchdimen\box2}} + +\def\definematharrow + {\doquadrupleargument\dodefinematharrow} + +\def\dodefinematharrow[#1][#2][#3][#4]% name type[none|both] template command + {\iffourthargument + \executeifdefined{dodefine#2arrow}\gobblethreearguments{#1}{#3}{#4}% + \else\ifthirdargument + \dodefinebotharrow{#1}{#2}{#3}% + \fi\fi} + +\def\dodefinebotharrow#1#2#3% + {\setvalue{#1}{\dotripleempty\xmtharrow[#2][#3]}} + +\def\xmtharrow[#1][#2][#3]% #3 == optional arg + {\def\doxmtharrow{\dodoxmtharrow[#1,\empty,\empty][#2,\empty,\empty][#3]}% {##1}{##2} + \dodoublegroupempty\doxmtharrow} + +\def\dodoxmtharrow[#1,#2,#3][#4,#5,#6][#7]#8#9% [3] is the optional arg + {\ifx#2\empty + \mathrel{\domthxarrsingle{#7}{#1}{#4}{#8}{#9}}% + \else + \mathrel{\domthxarrdouble{#7}{#1}{#2}{#4}{#5}{#8}{#9}}% + \fi} + +% Adapted from amsmath. + +\def\mtharrowfill#1#2#3% + {$\m@th\thickmuskip0mu\medmuskip\thickmuskip\thinmuskip\thickmuskip + \relax#1\mkern-7mu% + \cleaders\hbox{$\mkern-2mu#2\mkern-2mu$}\hfill + \mkern-7mu#3$} + +% Maybe redefine leftarrowfill and rightarrowfill using arrowfill + +\def\rightarrowfill {\mtharrowfill \relbar \relbar \rightarrow } +\def\leftarrowfill {\mtharrowfill \leftarrow \relbar \relbar } +\def\equalfill {\mtharrowfill \Relbar \Relbar \Relbar } +\def\Rightarrowfill {\mtharrowfill \Relbar \Relbar \Rightarrow } +\def\Leftarrowfill {\mtharrowfill \Leftarrow \Relbar \Relbar } +\def\Leftrightarrowfill {\mtharrowfill \Leftarrow \Relbar \Rightarrow } +\def\leftrightarrowfill {\mtharrowfill \leftarrow \relbar \rightarrow } +\def\mapstofill {\mtharrowfill{\mapstochar\relbar}\relbar \rightarrow } +\def\twoheadrightarrowfill{\mtharrowfill \relbar \relbar \twoheadrightarrow} +\def\twoheadleftarrowfill {\mtharrowfill \twoheadleftarrow \relbar \relbar } +\def\rightharpoondownfill {\mtharrowfill \relbar \relbar \rightharpoondown } +\def\rightharpoonupfill {\mtharrowfill \relbar \relbar \rightharpoonup } +\def\leftharpoondownfill {\mtharrowfill \leftharpoondown \relbar \relbar } +\def\leftharpoonupfill {\mtharrowfill \leftharpoonup \relbar \relbar } + +% From amsmath.sty, extarrows.sty, extpfel.sty and mathtools.sty(ams) + +\definematharrow [xrightarrow] [0359] [\rightarrowfill] +\definematharrow [xleftarrow] [3095] [\leftarrowfill] +\definematharrow [xequal] [0099] [\equalfill] +\definematharrow [xRightarrow] [0359] [\Rightarrowfill] +\definematharrow [xLeftarrow] [3095] [\Leftarrowfill] +\definematharrow [xLeftrightarrow] [0099] [\Leftrightarrowfill] +\definematharrow [xleftrightarrow] [0099] [\leftrightarrowfill] +\definematharrow [xmapsto] [0599] [\mapstofill] +\definematharrow [xtwoheadrightarrow] [5009] [\twoheadrightarrowfill] +\definematharrow [xtwoheadleftarrow] [0590] [\twoheadleftarrowfill] +\definematharrow [xrightharpoondown] [0359] [\rightharpoondownfill] +\definematharrow [xrightharpoonup] [0359] [\rightharpoonupfill] +\definematharrow [xleftharpoondown] [3095] [\leftharpoondownfill] +\definematharrow [xleftharpoonup] [3095] [\leftharpoonupfill] + +\definematharrow [xleftrightharpoons] [3095,0359] [\leftharpoonupfill,\rightharpoondownfill] +\definematharrow [xrightleftharpoons] [3095,0359] [\rightharpoonupfill,\leftharpoondownfill] + +% \startformula \xrightarrow{}{stuff on top}\stopformula +% \startformula \xrightarrow{stuff below}{}\stopformula +% \startformula \xrightarrow{stuff below}{stuff on top}\stopformula + +% \startformula \xleftarrow [none]{stuff below}{stuff on top}\stopformula +% \startformula \xleftarrow [small]{stuff below}{stuff on top}\stopformula +% \startformula \xleftarrow [medium]{stuff below}{stuff on top}\stopformula +% \startformula \xleftarrow [big]{stuff below}{stuff on top}\stopformula + +\protect \endinput diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex index 38c3ec3bd..0fa99aa5c 100644 --- a/tex/context/base/meta-ini.tex +++ b/tex/context/base/meta-ini.tex @@ -1015,6 +1015,57 @@ %D \ruledhbox{\flushlayer[mp]} %D \stoptyping +%D \macros +%D {startstaticMPfigure,useMPstaticfigure} +%D +%D Static figures are processed only when there has been +%D something changed. Here is Aditya Mahajan's testcase: +%D +%D \startbuffer +%D \startstaticMPfigure{circle} +%D fill fullcircle scaled 1cm withcolor blue; +%D \stopstaticMPfigure +%D +%D \startstaticMPfigure{axis} +%D drawarrow (0,0)--(2cm,0) ; +%D drawarrow (0,0)--(0,2cm) ; +%D label.llft(textext("(0,0)") ,origin) ; +%D \stopstaticMPfigure +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +\def\usestaticMPfigure[#1]% + {\dodoubleempty\externalfigure[\jobname-#1.pdf]} + +\def\startstaticMPfigure + {\begingroup + \obeyMPlines + \dostartstaticMPfigure} + +\def\dostartstaticMPfigure#1#2\stopstaticMPfigure + {\startstaticMPgraphic{\jobname-#1}#2\stopstaticMPgraphic + \doifmode{*\v!first}{\executesystemcommand + {texmfstart --ifchanged=\MPgraphicfile.mp texexec --mpgraphic \MPgraphicfile.mp}}% + \endgroup} + +% faster, but more tricky +% +% \def\startstaticMPfigure +% {\doifmodeelse{*\v!first} +% {\begingroup +% \obeyMPlines +% \dostartstaticMPfigure} +% {\gobbleuntil\stopstaticMPfigure}} +% +% \def\dostartstaticMPfigure#1#2\stopstaticMPfigure +% {\startMPstaticgraphic{\jobname-#1}#2\stopMPstaticgraphic +% \executesystemcommand +% {texmfstart --ifchanged=\MPgraphicfile.mp texexec --mpgraphic \MPgraphicfile.mp}% +% % dirty trick, don't register, so no second main run of texexec: +% \global\advance\nofMPgraphics \minusone +% \endgroup}} + %D New: % \appendtoks \closeMPgraphicfiles \to \everystoptext diff --git a/tex/context/base/meta-pdf.tex b/tex/context/base/meta-pdf.tex index 1c76075a9..49dc4df38 100644 --- a/tex/context/base/meta-pdf.tex +++ b/tex/context/base/meta-pdf.tex @@ -14,10 +14,12 @@ %D In due time this file will replace \type {supp-pdf} and %D \type {supp-mpe}. -\input supp-pdf -\input supp-mpe +% \input supp-pdf +% \input supp-mpe +% +% \endinput -\endinput +% we're going to experiment a bit with new code %D To be tested: texopt.rb on this file. @@ -703,53 +705,89 @@ \let\MPfshowcommand\empty +% \def\dohandleMPfshow +% {\bgroup +% \setbox\scratchbox\hbox +% {\obeyMPspecials +% \let\ \relax % mp breaks long lines and appends a \ +% \edef\size{\gMPa\nofMParguments}% +% \ifx\size\PSnfont % round font size (to pt) +% \advance\nofMParguments \minusone +% \expandafter\scratchdimen\gMPa\nofMParguments\onepoint\relax +% \ifdim\scratchdimen<\onepoint +% \def\size{1pt}% +% \else +% \advance\scratchdimen .5\onepoint +% \def\size##1.##2\relax{\def\size{##1pt}}% +% \expandafter\size\the\scratchdimen\relax +% \fi +% \else +% \edef\size{\size bp}% +% \fi +% \advance\nofMParguments \minusone +% %\font\temp=\gMPa\nofMParguments\space at \size +% \let\temp\relax % to be sure +% \setMPfshowfont{\gMPa\nofMParguments}\size +% \advance\nofMParguments \minusone +% \temp +% \MPfshowcommand +% {\ifnum\nofMParguments=\plusone +% \def\do(##1){##1}% +% \dogMPa1% +% \else +% % we need to catch ( a ) (a a a) (\123 \123 \123) etc +% \scratchcounter\plusone +% \def\dodo##1% Andreas Fieger's bug: (\304...) +% {\edef\!!stringa{##1\empty\empty}% and another one: ( 11) -> \ifx 11 +% \ifx\!!stringa\MPspacechar\MPspacechar\else\expandafter##1\fi}% +% \def\do(##1{\dodo{##1}}% +% \dogMPa\scratchcounter\MPspacechar +% \let\do\relax +% \loop +% \advance\scratchcounter \plusone +% \ifnum\scratchcounter<\nofMParguments\relax +% \gMPa\scratchcounter\MPspacechar +% \repeat +% \def\do##1){\dodo{##1}}% +% \dogMPa\scratchcounter +% \fi +% \unskip}}% +% % +% % this fails in some versions of pdftex +% % +% % \dimen0=\lastMPmoveY bp +% % \advance\dimen0 by \ht0 +% % \ScaledPointsToBigPoints{\number\dimen0}\lastMPmoveY +% % \PDFcode{n q 1 0 0 1 \lastMPmoveX\space\lastMPmoveY\space cm}% +% % \dimen0=\ht0 +% % \advance\dimen0 by \dp0 +% % \box0 +% % \vskip-\dimen0 +% % \PDFcode{Q}% +% % \egroup} +% % +% \setbox\scratchbox\hbox +% {\hskip\lastMPmoveX\onebasepoint\raise\lastMPmoveY\onebasepoint\box\scratchbox}% +% \ht\scratchbox\zeropoint +% \dp\scratchbox\zeropoint +% \wd\scratchbox\zeropoint +% \box\scratchbox +% \egroup} +% +% \let\handleMPfshow\dohandleMPfshow % so we can overload this one later +% +% we will support plug-ins: + \def\dohandleMPfshow - {\bgroup - \setbox\scratchbox\hbox + {\setbox\scratchbox\hbox {\obeyMPspecials - \let\ \relax % mp breaks long lines and appends a \ - \edef\size{\gMPa\nofMParguments}% - \ifx\size\PSnfont % round font size (to pt) - \advance\nofMParguments \minusone - \expandafter\scratchdimen\gMPa\nofMParguments\onepoint\relax - \ifdim\scratchdimen<\onepoint - \def\size{1pt}% - \else - \advance\scratchdimen .5\onepoint - \def\size##1.##2\relax{\def\size{##1pt}}% - \expandafter\size\the\scratchdimen\relax - \fi - \else - \edef\size{\size bp}% - \fi - \advance\nofMParguments \minusone - %\font\temp=\gMPa\nofMParguments\space at \size - \let\temp\relax % to be sure - \setMPfshowfont{\gMPa\nofMParguments}\size - \advance\nofMParguments \minusone - \temp - \MPfshowcommand - {\ifnum\nofMParguments=\plusone - \def\do(##1){##1}% - \dogMPa1% - \else - % we need to catch ( a ) (a a a) (\123 \123 \123) etc - \scratchcounter\plusone - \def\dodo##1% Andreas Fieger's bug: (\304...) - {\edef\!!stringa{##1\empty\empty}% and another one: ( 11) -> \ifx 11 - \ifx\!!stringa\MPspacechar\MPspacechar\else\expandafter##1\fi}% - \def\do(##1{\dodo{##1}}% - \dogMPa\scratchcounter\MPspacechar - \let\do\relax - \loop - \advance\scratchcounter \plusone - \ifnum\scratchcounter<\nofMParguments\relax - \gMPa\scratchcounter\MPspacechar - \repeat - \def\do##1){\dodo{##1}}% - \dogMPa\scratchcounter - \fi - \unskip}}% + \edef\MPtextsize{\gMPa\nofMParguments}% + \def\do(##1){##1}% + \edef\MPtextdata{\dogMPa1}% beware, stack can have more + \handleMPtext}% + \setbox\scratchbox\hbox + {\hskip\lastMPmoveX\onebasepoint\raise\lastMPmoveY\onebasepoint + \box\scratchbox}% % % this fails in some versions of pdftex % @@ -764,15 +802,68 @@ % \PDFcode{Q}% % \egroup} % - \setbox\scratchbox\hbox - {\hskip\lastMPmoveX\onebasepoint\raise\lastMPmoveY\onebasepoint\box\scratchbox}% \ht\scratchbox\zeropoint \dp\scratchbox\zeropoint \wd\scratchbox\zeropoint - \box\scratchbox - \egroup} + \box\scratchbox} + +\def\handleMPtext {\handleMPtextnormal} % so we can overload this one later +\def\handleMPfshow{\dohandleMPfshow } % so we can overload this one later + +\def\handleMPtext + {\ifnum\nofMParguments>\plusthree + \handleMPtextnormal + \else + \convertcommand\MPtextdata\to\MPtextdata + \expanded{\splitstring\MPtextdata}\at::::\to\MPtexttag\and\MPtextnumber + \executeifdefined{handleMPtext\MPtexttag}\handleMPtextnormal + \fi} + +% elsewhere we will implement \handleMPtextmptxt -\let\handleMPfshow\dohandleMPfshow % so we can overload this one later +\def\handleMPtextnormal + {\let\ \relax % mp breaks long lines and appends a \ + \ifx\MPtextsize\PSnfont % round font size (to pt) + \advance\nofMParguments \minusone + \expandafter\scratchdimen\gMPa\nofMParguments\onepoint\relax + \ifdim\scratchdimen<\onepoint + \def\MPtextsize{1pt}% + \else + \advance\scratchdimen .5\onepoint + \def\MPtextsize##1.##2\relax{\def\MPtextsize{##1pt}}% + \expandafter\MPtextsize\the\scratchdimen\relax + \fi + \else + \edef\MPtextsize{\MPtextsize bp}% + \fi + \advance\nofMParguments \minusone + \font\temp=\gMPa\nofMParguments\space at \MPtextsize + \let\temp\relax % to be sure + \setMPfshowfont{\gMPa\nofMParguments}\MPtextsize + \advance\nofMParguments \minusone + \temp + \MPfshowcommand + {\ifnum\nofMParguments=\plusone + \def\do(##1){##1}% + \dogMPa1% + \else + % we need to catch ( a ) (a a a) (\123 \123 \123) etc + \scratchcounter\plusone + \def\dodo##1% Andreas Fieger's bug: (\304...) + {\edef\!!stringa{##1\empty\empty}% and another one: ( 11) -> \ifx 11 + \ifx\!!stringa\MPspacechar\MPspacechar\else\expandafter##1\fi}% + \def\do(##1{\dodo{##1}}% + \dogMPa\scratchcounter\MPspacechar + \let\do\relax + \loop + \advance\scratchcounter \plusone + \ifnum\scratchcounter<\nofMParguments\relax + \gMPa\scratchcounter\MPspacechar + \repeat + \def\do##1){\dodo{##1}}% + \dogMPa\scratchcounter + \fi + \unskip}} %D You could consider the following definition to be the most %D natural one. diff --git a/tex/context/base/meta-tex.tex b/tex/context/base/meta-tex.tex new file mode 100644 index 000000000..8008ae6c4 --- /dev/null +++ b/tex/context/base/meta-tex.tex @@ -0,0 +1,205 @@ +%D \module +%D [ file=meta-tex, +%D version=2006.06.07, +%D title=\CONTEXT\ Support Macros, +%D subtitle=\METAPOST\ fast text insertion, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=\PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Many thanks to Fabrice Popineau and Taco Hoekwater in helping me +%D figure out some aspects of the text inclusion method implemented +%D here. The following code is derived from a more advanced (and to +%D be used) mechanism where \TEX, \METAPOST\ and \LUA\ play together. + +%D Much of this mechanism was written with running live DVD's of +%D the Dave Matthews band in the background (or the corner of my +%D screen). + +\unprotect + +\newwrite\TeXtextwrite + +\def\openTeXtexts {\immediate\openout \TeXtextwrite=\currentTeXtext.mpb\relax} +\def\closeTeXtexts{\immediate\closeout\TeXtextwrite} + +\def\currentTeXtext{\jobname-mpgraph} + +\initializeboxstack\currentTeXtext + +\newtoks\collectedmptexts + +\long\def\startTeXtexts#1\stopTeXtexts + {\global\collectedmptexts\expandafter{\the\collectedmptexts#1}} + +\def\dostartTeXtexts + {\global\setfalse\TeXtextdone + \startnointerference + \the\everyMPTEXgraphic + \openTeXtexts + \ifrunMPgraphics + \initializeboxstack\currentTeXtext + \else + \global\let\openTeXtexts\relax + \global\let\finishTeXtexts\closeTeXtexts + \fi} + +\def\dostopTeXtexts + {\ifrunMPgraphics + \closeTeXtexts + \fi + \stopnointerference} + +\let\finishTeXtexts\relax + +\appendtoks + \finishTeXtexts +\to \everystoptext + +\newconditional\TeXtextdone + +% \long\def\TeXtext#1% +% {\dowithnextboxcontent +% {\setnormalcatcodes} +% {\global\settrue\TeXtextdone +% \immediate\write\TeXtextwrite{savetxt(#1,\the\wd\nextbox,\the\ht\nextbox,\the\dp\nextbox);}% +% \savebox\currentTeXtext{#1}{\box\nextbox}} +% \hbox} + +\long\def\TeXtext + {\dosingleempty\doTeXtext} + +\long\def\doTeXtext[#1]#2#3% + {\begingroup + \setbox\nextbox\hbox + {\setnormalcatcodes + \newlinechar=`\^^M + \everyeof\emptytoks + %\def\ascii{#3}% + %\scantokens\expandafter{\ascii}}% + \scantokens{#3}}% + \global\settrue\TeXtextdone + \edef\currenttextxt{\number#2}% + \executeifdefined{textext::#1}{\getvalue{textext::depth}}% + \savebox\currentTeXtext\currenttextxt{\box\nextbox}% + \endgroup} + +\setvalue{textext::depth}{\immediate\write\TeXtextwrite{savetxt(\currenttextxt,\the\nextboxwd,\the\nextboxht,\the\nextboxdp) shifted (0,-\the\nextboxdp);}} +\setvalue{textext::nodepth}{\immediate\write\TeXtextwrite{savetxt(\currenttextxt,\the\nextboxwd,\the\nextboxht,\the\nextboxdp);}} + +\setvalue{textext::d}{\getvalue{textext::depth}} +\setvalue{textext::n}{\getvalue{textext::nodepth}} + +\newbox\mptextbox + +\definefontsynonym[MPtxtfont][texnansi-lmtt10] \loadmapfile[lm-texnansi.map] + +\definefont[localMPtxtfont][MPtxtfont at 10bp] + +\ifx\getTeXtext\undefined + + % this took a while to figure out + + % \def\getTeXtext + % {\localMPtxtfont + % \setbox\mptextbox\hbox{\foundbox\currentTeXtext{\number\nofTeXtexts}}% + % \setbox\scratchbox\hbox{\MPtextdata}% + % \edef\mpwd{\the\dimexpr\MPtextsize\dimexpr\wd\scratchbox/10\relax\relax}% + % \edef\mpht{\the\dimexpr\MPtextsize\dimexpr\ht\scratchbox/10\relax\relax}% + % \setbox\mptextbox\hbox{\raise\dp\mptextbox\box\mptextbox}% + % \dp\mptextbox\zeropoint + % \scale[\c!width=\mpwd,\c!height=\mpht]{\box\mptextbox}}% + + \def\getTeXtext + {\localMPtxtfont + \setbox\mptextbox\hbox{\foundbox\currentTeXtext{\number\nofTeXtexts}}% + \setbox\scratchbox\hbox{\MPtextdata}% + \edef\mpwd{\the\dimexpr\MPtextsize\dimexpr\wd\scratchbox/10\relax\relax}% + \edef\mpht{\the\dimexpr\MPtextsize\dimexpr\ht\scratchbox/10\relax\relax}% + \setbox\mptextbox\hbox{\raise\dp\mptextbox\box\mptextbox}% + \dp\mptextbox\zeropoint + \scale[\c!width=\mpwd,\c!height=\mpht]{\box\mptextbox}} + +\fi + +\setvalue{handleMPtext00001}% only height in tag (00001) + {\setbox\scratchbox\hbox + {\obeyMPspecials + \edef\nofTeXtexts{\number\MPtextnumber}% + \getTeXtext}% + \setbox\scratchbox\hbox + {\hskip\lastMPmoveX\onebasepoint\raise\lastMPmoveY\onebasepoint + \box\scratchbox}% + \ht\scratchbox\zeropoint + \dp\scratchbox\zeropoint + \wd\scratchbox\zeropoint + \box\scratchbox} + +\startMPextensions + string txtfile ; txtfile := "\currentTeXtext.mpb" ; + string txtfont ; txtfont := "\truefontname{MPtxtfont}" ; + string txtpref ; txtpref := "00001::::" ; +\stopMPextensions + +% \long\def\filtersometxt#1\sometxt#2#3#4% +% {\ifx#3\empty +% \else +% \increment\txtcounter +% \TeXtext\txtcounter{#2}% +% \expandafter\filtersometxt +% \fi#3#4} + +\long\def\dodofiltersometxt#1#2#3% + {\ifx#2\empty + \else + \increment\txtcounter + \TeXtext\txtcounter{#1}% + \expandafter\filtersometxt + \fi#2#3} + +\long\def\redofiltersometxt[#1]#2% + {\increment\txtcounter + \TeXtext[#1]\txtcounter{#2}% + \filtersometxt} + +\long\def\filtersometxt#1\sometxt + {\doifnextcharelse[\redofiltersometxt\dodofiltersometxt} + +% \filtersometxt abc\sometxt{def};hij\sometxt{klm};\sometxt{}\empty\relax + +\long\def\flushTeXtexts#1% + {\newcounter\txtcounter + \dostartTeXtexts + \the\collectedmptexts + \filtersometxt#1\sometxt{}\empty\relax + \dostopTeXtexts + \ifconditional\TeXtextdone + \immediate\write\MPwrite{loadtxts ; txtnext := 0 ;}% + \global\collectedmptexts\emptytoks + \fi + \newcounter\txtcounter} + +% \long\def\sometxt#1{sometxt(nexttxt)} % to be used in mp definitions, no ; here + +\long\def\sometxt #1#{\dosometxt} % grab optional [args] +\long\def\dosometxt#1{sometxt(nexttxt)} % to be used in mp definitions, no ; here + +% we redefine the writer: + +\long\def\writecheckedMPgraphic#1% + {\ifforceMPTEXgraphic + \global\MPTEXgraphictrue + \else + \global\MPTEXgraphicfalse + \edef\ascii{#1}\convertcommand\ascii\to\MPascii + \the\MPTEXgraphicchecks\relax % \relax is end condition! + \fi + \flushMPTEXgraphic% % verbatimtex etc + \flushTeXtexts{#1}% added + \writeMPgraphic{#1}} % potential optimization: pass \ascii + +\protect \endinput diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex index ec2e1ac11..84c956e26 100644 --- a/tex/context/base/mult-con.tex +++ b/tex/context/base/mult-con.tex @@ -13,10 +13,6 @@ %D In this rather large definition file we are going to tell %D \CONTEXT\ which constants, variables and elements we use. -%D -%D The German translations were provided by Tobias Burnus, -%D the Czech ones by Tom Hudec, the Italian ones by Giuseppe -%D Bilotta. \writestatus{loading}{Context Multilingual Macros / Constants} @@ -756,6 +752,10 @@ subsubsubsubsubsubject: subsubsubsubsubonderwerp subsubsubsubsub breite sirka ampiezza latime largeur + autowidth: autobreedte autowidth + autobreite autosirka + autoampiezza autolatime + autolargeur maxwidth: maxbreedte maxwidth maxbreite maxsirka ampiezzamax latimemaxima @@ -2966,7 +2966,7 @@ subsubsubsubsubsubject: subsubsubsubsubonderwerp subsubsubsubsub random: willekeurig random zufaellig nahodny casuale aleator - alatoire + aleatoire white: wit white weiss bily bianco alb diff --git a/tex/context/base/mult-ini.tex b/tex/context/base/mult-ini.tex index 1e3f378df..667a9352e 100644 --- a/tex/context/base/mult-ini.tex +++ b/tex/context/base/mult-ini.tex @@ -17,13 +17,15 @@ %D supported: %D %D \starttabulate[|l|l|c|c|] -%D \NC\bf language\NC\bf translator \NC\bf messages\NC\bf interface\NC\NR -%D \NC dutch \NC Hans Hagen \NC yes \NC yes \NC\NR -%D \NC english \NC Hans Hagen \NC yes \NC yes \NC\NR -%D \NC german \NC Tobias Burnus \NC yes \NC yes \NC\NR -%D \NC czech \NC Tom Hudec \NC yes \NC yes \NC\NR -%D \NC italian \NC Giuseppe Bilotta \NC yes \NC yes \NC\NR -%D \NC norwegian \NC Hans Fredrik Nordhaug\NC yes \NC no \NC\NR +%D \NC\bf language\NC\bf translator \NC\bf messages\NC \bf interface\NC\NR +%D \NC dutch \NC Hans Hagen \NC yes \NC yes \NC\NR +%D \NC english \NC Hans Hagen \& SPQR \NC yes \NC yes \NC\NR +%D \NC german \NC Tobias Burnus \NC yes \NC yes \NC\NR +%D \NC czech \NC Tom Hudec \NC yes \NC yes \NC\NR +%D \NC italian \NC Giuseppe Bilotta \NC yes \NC yes \NC\NR +%D \NC french \NC Renaud Aubin \NC yes \NC yes \NC\NR +%D \NC romanian \NC .... \NC yes \NC yes \NC\NR +%D \NC norwegian \NC Hans Fredrik Nordhaug \NC yes \NC no \NC\NR %D \stoptabulate \writestatus{loading}{Context Multilingual Macros / Initialization} diff --git a/tex/context/base/page-bck.tex b/tex/context/base/page-bck.tex index 9dcc920ad..2054be5fb 100644 --- a/tex/context/base/page-bck.tex +++ b/tex/context/base/page-bck.tex @@ -225,7 +225,7 @@ % \def\setbackgroundboxes % {\showmessage\m!layouts8\empty % \setbackgroundbox\leftbackground\relax -% \ifdubbelzijdig +% \ifdoublesided % \setbackgroundbox\rightbackground\doswapmargins % \fi % \doifnot\@@mastatus\v!herhaal{\global\newbackgroundfalse}} @@ -590,19 +590,35 @@ \resetglobal \expandafter\gobbleoneargument \fi} +% \def\doaddlocalbackground#1% +% {\edef\next +% {\noexpand\redoglobal\wd#1\the\wd#1% +% \noexpand\redoglobal\ht#1\the\ht#1% +% \noexpand\dodoglobal\dp#1\the\dp#1}% +% \dodoglobal\setbox#1\hbox +% {\fastlocalframed +% [\??ma\v!local] +% [\c!component=local,\c!frame=\v!off,\c!offset=\v!overlay,\c!setups=,% +% \c!width=\wd#1,\c!height=\ht#1,% no \c!depth=\dp#1 in cont-exp.tex, to be checked ! +% \c!background=\localbackground]% +% {\registerMPlocaltextarea{\box#1}}}% +% \next +% \doglobal\increment\localpositionnumber\relax} % afterwards ! + \def\doaddlocalbackground#1% {\edef\next {\noexpand\redoglobal\wd#1\the\wd#1% \noexpand\redoglobal\ht#1\the\ht#1% - \noexpand\dodoglobal\dp#1\the\dp#1}% - \dodoglobal\setbox#1\hbox + \noexpand\redoglobal\dp#1\the\dp#1}% + \redoglobal\setbox#1\hbox {\fastlocalframed [\??ma\v!local] [\c!component=local,\c!frame=\v!off,\c!offset=\v!overlay,\c!setups=,% - \c!width=\wd#1,hoogte=\ht#1,% no diepte=\dp#1 in cont-exp.tex, to be checked ! + \c!width=\wd#1,\c!height=\ht#1,% no \c!depth=\dp#1 in cont-exp.tex, to be checked ! \c!background=\localbackground]% {\registerMPlocaltextarea{\box#1}}}% \next + \resetglobal \doglobal\increment\localpositionnumber\relax} % afterwards ! % Test how previous macro behaves with depth: diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex index 30a337443..eb1311512 100644 --- a/tex/context/base/page-flt.tex +++ b/tex/context/base/page-flt.tex @@ -13,9 +13,6 @@ \writestatus{loading}{Context OTR Macros / Floating Bodies} -%D This module is currently a mess, due to splitting float -%D handlers over specific otr's. Consider it work in progress. - %D Some of the sidefloat settings should move to page-sid; now it's quite %D fuzzy the way the variables are set/reset. @@ -412,7 +409,7 @@ %\to \everyinsidefloat %\def\doifrightpagefloatelse % watch out: other default ! ! ! -% {\ifdubbelzijdig +% {\ifdoublesided % \ifodd\purenumber\twopassfloatdata\space % \@EAEAEA\firstoftwoarguments % \else @@ -423,8 +420,8 @@ % \fi} \def\doifrightpagefloatelse - {\ifdubbelzijdig - \ifenkelzijdig + {\ifdoublesided + \ifsinglesided \@EAEAEA\firstoftwoarguments \else \@EAEAEA\doifoddfloatpageelse @@ -819,10 +816,14 @@ {\checkfloatracer{\v!float#1}% will go \tagnodelocation{\v!float#1}}} +\newconditional\retainfloatnumber + \def\preparefloatnumber#1% - {\doifelse\@@bknumbering\v!nocheck + {\xdef\floatcaptionnumber{#1}% + \doifelse\@@bknumbering\v!nocheck {\incrementnumber[#1]% - \makesectionnumber[#1]} + \makesectionnumber[#1]% + \ifconditional\retainfloatnumber\decrementnumber[#1]\fi} {\ifinsidecolumns \chardef\nodelocationmode\zerocount % to be perfected: @@ -831,6 +832,7 @@ \ifcase\nodelocationmode \incrementnumber[#1]% \makesectionnumber[#1]% + \ifconditional\retainfloatnumber\decrementnumber[#1]\fi \else % force check, so that we get a proper way-sync and % can use the accumulated number @@ -995,6 +997,8 @@ \global\somefloatwaitingtrue \dosavefloatinfo} +% better (todo): \savednofsavedfloats + \def\dosavefloatstatus {\global\setbox\savedfloatlist\copy\floatlist \global\setbox\savedfloatbox \copy\floatbox @@ -1008,6 +1012,45 @@ \ifx\doflushfloats\undefined \let\doflushfloats\relax \fi \ifx\flushfloatbox\undefined \let\flushfloatbox\relax \fi +% needed in the splitter: + +\newcount\savedsavednoffloats + +\let\dopopsavedfloats\relax + +\def\dopushsavedfloats + {\global\setbox\savedfloatlist\box\floatlist + \global\savedsavednoffloats\savednoffloats + \global\savednoffloats\savednoffloats + \global\somefloatwaitingfalse + \gdef\dopopsavedfloats + {\global\advance\savednoffloats\savedsavednoffloats + \global\setbox\floatlist\vbox\bgroup + \ifvoid\floatlist \else\unvbox\floatlist \fi + \ifvoid\savedfloatlist\else\unvbox\savedfloatlist\fi + \egroup + \global\ifcase\savednoffloats + \somefloatwaitingfalse\else\somefloatwaitingtrue\fi + \globallet\dopopsavedfloats\relax}} + +\def\doflushsavedfloats % simplified \OTRONEdodoflushfloats + {\doloop + {\ifsomefloatwaiting + \dogetfloat + \dofloatflushedinfo + \docheckiffloatfits + \ifroomforfloat + \doplacefloatbox + \else + \doreversesavefloat + \exitloop + \fi + \else + \exitloop + \fi}} + +% top and bottom + \newif\iftopofinsert \newif\iftestfloatbox \newif\ifcenterfloatbox \centerfloatboxtrue @@ -1317,35 +1360,6 @@ \def\setfloatcaption % \dosetfloatcaption already in use {\dodoubleempty\dodosetfloatcaption} % beware, name clash -% \def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii -% {\ifnofloatnumber % also handle trialtypesetting -% \letgvalue{@fl@r@#1}\relax -% \letgvalue{@fl@t@#1}\relax -% \else -% \incrementnumber[#1]% -% \makesectionnumber[#1]% -% % \globallet\flcomposedsectionnumber\composedsectionnumber % beware, not unique should be done on a per class base -% \letgvalue{@fl@n@#1}\composedsectionnumber -% % indirect macro can be more efficient -% \setgvalue{@fl@r@#1}% -% {\dofloatreference -% \redofloatorder{#1}% -% % \dowritetolist{#1}{\flcomposedsectionnumber}{#3}{#1}% -% \dowritetolist{#1}{\getvalue{@fl@n@#1}}{#3}{#1}% -% \doglobal\convertargument#3\to\flasciititle % \asciititle is global -% % \doifsomething{#2}{\rawreference\s!flt{#2}{{\flcomposedsectionnumber}{\flasciititle}}}% -% \doifsomething{#2}{\rawreference\s!flt{#2}{{\getvalue{@fl@n@#1}}{\flasciititle}}}% -% \letgvalue{@fl@r@#1}\relax}% nils -% \setgvalue{@fl@t@#1}% -% % {\preparethenumber{\??kj#1}\flcomposedsectionnumber\preparednumber -% {\preparethenumber{\??kj#1}{\getvalue{@fl@n@#1}}\preparednumber -% \doattributes{\??kj#1}\c!style\c!color -% {\doattributes{\??kj#1}\c!headstyle\c!headcolor -% {\labeltexts{#1}{\preparednumber}}% -% \doattributes{\??kj#1}\c!textstyle\c!textcolor -% {\dotfskip{\getvalue{\??kj#1\c!distance}}#3}}}% -% \fi} - \def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii {\ifnofloatnumber % also handle trialtypesetting \letgvalue{@fl@r@#1}\relax @@ -1396,7 +1410,7 @@ {\noindent % \xdef\lastcaptiontag{\strut#2\floatcaptionsuffix}% \xdef\lastcaptiontag{\strut#2}% - \xdef\floatcaptionnumber{#1}% +% \xdef\floatcaptionnumber{#1}% \dostartattributes{\??kj#1}\c!style\c!color\empty \ifnofloatnumber \else @@ -2195,89 +2209,6 @@ \dostartbuffer[pbuf-\nofpostponedblocks]% [\e!start\v!postponing][\e!stop\v!postponing]} -\definenumber - [\??si] - [\c!way=\v!by\v!text, - \c!conversion=\@@siconversion] - -\def\setupfloatsplitting - {\dodoubleargument\getparameters[\??si]} - -% ook (continued) - -\newif\ifinsidesplitfloat % will become chardef - -\def\dosplitfloat[#1]#2% nog dubbele refs - {\ifinsidecolumns % tzt ook nog figuren splitten - % not yet supported - \else - \bgroup - \insidefloattrue - \insidesplitfloattrue - \getparameters[\??si][#1]% - \resetnumber[\??si]% - \def\floatcaptionsuffix{\convertednumber[\??si]}% - % \TABLEcaptionheight\@@silines\lineheight% brrr -% todo: auto == \getnoflines\captionheight -\let\extrasplitfloatlines\@@silines -\the\everysplitfloatsetup - \simplifypagebreak % \page becomes \goodbreak -% todo: a preceding float does not count yet -% so we need a better predictor - \dowithnextbox - {\forgetall - \dontcomplain -\chardef\nodelocationmode\zerocount - \doloop - {\setbox2\vsplit\nextbox to \lineheight - \setbox2\vbox{\unvbox2} - \ifdim\ht2>\lineheight - \incrementnumber[\??si]% - \ifcase\rawnumber[\??si]\or \ifdim\nextboxht=\zeropoint - \let\floatcaptionsuffix\empty - \fi \fi - \bgroup - #2{\unvbox2} - \egroup - \ifdim\nextboxht>\zeropoint - \page - \fi - \fi - \ifdim\nextboxht>\zeropoint -\decrementnumber[\floatcaptionnumber] -%\setupnumber[\floatcaptionnumber][\c!state=\v!stop]% - \else - \expandafter\exitloop - \fi}% - \egroup} - \vbox - \fi} - -\def\splitfloat - {\dosingleempty\dosplitfloat} - -\newtoks \everysplitfloatsetup - -% will move to core-tab - -\appendtoks - \TABLEcaptionheight\extrasplitfloatlines\lineheight -\to \everysplitfloatsetup - -% will move to core-ntb - -\appendtoks - \def\extratblsplitheight{\extrasplitfloatlines\lineheight}% -\to \everysplitfloatsetup - -% todo in core-tbl - -\appendtoks - % set extra -\to \everysplitfloatsetup - -% \splitfloat [settings] {\placetable[optional args]{test}} {content} - \def\dooutput{\sidefloatoutput} % redefinition of \dooutput \setupmarginblocks @@ -2376,10 +2307,6 @@ \c!local=, \c!default=\v!figure, \c!numbering=\v!yes] - -\setupfloatsplitting - [\c!conversion=\v!character, % \v!romannumerals - \c!lines=3] % float strategy, replaces some of the above macros diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex index bb8247e63..b64a543cf 100644 --- a/tex/context/base/page-imp.tex +++ b/tex/context/base/page-imp.tex @@ -922,7 +922,7 @@ \def\dofilterpage#1#2% {\hbox to \textwidth - {\ifdubbelzijdig\ifdim\@@ipwidth>\zeropoint\relax\ifodd\realpageno\else + {\ifdoublesided\ifdim\@@ipwidth>\zeropoint\relax\ifodd\realpageno\else \hfill \def\dowithfigure{\hskip-\@@ipwidth}% \fi\fi\fi diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex index ee62d92bb..b7cbfc9c3 100644 --- a/tex/context/base/page-ini.tex +++ b/tex/context/base/page-ini.tex @@ -938,7 +938,7 @@ \def\eject {\par\ifvmode\penalty\ejectpenalty\fi\resetpagebreak} % == {\par\break} % plain \def\supereject {\par\ifvmode\penalty\superpenalty\fi\resetpagebreak} % also plain -\def\doejectpage {\par\ifvmode\ifdim\pagetotal>\pagegoal\else\normalvfil\fi\fi} +\def\doejectpage {\par\ifvmode\ifdim\pagetotal>\pagegoal\else\normalvfil\fi\fi} % pg set to \textheight \def\ejectpage {\doejectpage\eject} \def\superejectpage{\doejectpage\supereject} @@ -1570,6 +1570,9 @@ \def\simplifypagebreak {\def\dopagebreak[##1]{\goodbreak}} +\def\disablepagebreaks + {\def\dopagebreak[##1]{}} + \def\executepagebreakhandler#1% {\edef\@@pagespecification{#1}% \doifdefinedelse{\??pe:\@@pagespecification} @@ -1701,7 +1704,7 @@ \gotonextpageX % will become \gotonextpage \doifbothsidesoverruled \orsideone - \resetcurrentsectionmarks + \resetcurrentsectionmarks % sic \ejectdummypage \orsidetwo \od} @@ -1712,7 +1715,7 @@ \doifbothsidesoverruled \orsideone \orsidetwo - \resetcurrentsectionmarks + \resetcurrentsectionmarks % sic \ejectdummypage \od} @@ -1725,7 +1728,7 @@ \doifoddpageelse\donothing{\resetcurrentsectionmarks\ejectdummypage}} \installpagebreakhandler \v!quadruple % not yet ok inside columnsets - {\ifdubbelzijdig + {\ifdoublesided \!!counta\realpageno \!!countb\realpageno \divide\!!counta 4 @@ -1753,7 +1756,7 @@ \installpagebreakhandler \v!lastpage % handy for backpage preceded by empty pages {\executepagebreakhandler\v!yes - \ifdubbelzijdig + \ifdoublesided \executepagebreakhandler\v!left \executepagebreakhandler\v!empty \executepagebreakhandler\v!empty diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex index 89768922b..20d9e6686 100644 --- a/tex/context/base/page-lay.tex +++ b/tex/context/base/page-lay.tex @@ -863,7 +863,7 @@ \def\orientpagebodybox#1#2#3% {\ifnum#2#3>\zerocount \setbox#1\vbox - {\edef\somerotation{\ifdubbelzijdig\ifodd\realpageno#2\else#3\fi\else#2\fi}% + {\edef\somerotation{\ifdoublesided\ifodd\realpageno#2\else#3\fi\else#2\fi}% \dorotatebox\somerotation\hbox{\box#1}}% \fi} @@ -940,8 +940,8 @@ \ifnum\verticalcutmarks >2 \chardef\colormarkoffset4 \fi #1{#2}} -\newif\ifdubbelzijdig \dubbelzijdigfalse -\newif\ifenkelzijdig \enkelzijdigtrue +\newif\ifdoublesided \doublesidedfalse +\newif\ifsinglesided \singlesidedtrue % NOG EENS NAGAAN WANNEER NU GLOBAL EN WANNEER NIET @@ -1036,15 +1036,15 @@ % what are those \relax'es doing there? \def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od - {\ifdubbelzijdig + {\ifdoublesided \doifoddpageelse{#2}{#3}\relax \else #1\relax \fi} \def\doifbothsides#1\orsideone#2\orsidetwo#3\od - {\ifdubbelzijdig - \ifenkelzijdig + {\ifdoublesided + \ifsinglesided #1\relax \else \doifoddpageelse{#2}{#3}\relax @@ -1084,8 +1084,8 @@ \the\everyswapmargins} \def\rightorleftpageaction - {\ifdubbelzijdig - \ifenkelzijdig + {\ifdoublesided + \ifsinglesided \@EAEAEA\firstoftwoarguments \else \@EAEAEA\doifoddpageelse diff --git a/tex/context/base/page-log.tex b/tex/context/base/page-log.tex index d124fdd3d..53984eefd 100644 --- a/tex/context/base/page-log.tex +++ b/tex/context/base/page-log.tex @@ -135,7 +135,7 @@ \def\setlogoboxes {\showmessage\m!layouts7\empty \dosetlogobox\leftlogos\relax - \ifdubbelzijdig + \ifdoublesided \dosetlogobox\rightlogos\doswapmargins \fi} diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex index 48ea1e3c2..e92f12052 100644 --- a/tex/context/base/page-lyr.tex +++ b/tex/context/base/page-lyr.tex @@ -435,6 +435,8 @@ %D efficient in \ETEX\ since there testing for an undefined %D macro does not takes hash space. +% todo: setups before flush, handy hook + \unexpanded\def\flushlayer[#1]% {\doifelsevalue{\??ll#1\c!state}\v!next {\global\letvalue{\??ll#1\c!state}\v!start} % dangerous, stack-built-up diff --git a/tex/context/base/page-mak.tex b/tex/context/base/page-mak.tex index 70530ba87..807d77fc0 100644 --- a/tex/context/base/page-mak.tex +++ b/tex/context/base/page-mak.tex @@ -167,13 +167,20 @@ \def\doshipoutmakeup {\globalpushmacro\@@pnstate % new \makeupparameter\c!before - \vbox{\hbox{\color[\makeupparameter\c!color]{\box\makeupbox}}}% + \setbox\makeupbox\vbox{\hbox{\color[\makeupparameter\c!color]{\box\makeupbox}}}% + % \ifgridsnapping + % new per 22/6/2006 + \ifdim\ht\makeupbox>\vsize + \ht\makeupbox\vsize + \fi + % \fi + \box\makeupbox \setuppagenumber[\c!state=\makeupparameter\c!pagestate]% \setupmakeuplayout \page \makeupparameter\c!after \relax % voor fi - \ifdubbelzijdig \ifodd\realpageno\else + \ifdoublesided \ifodd\realpageno\else \processaction [\makeupparameter\c!doublesided] [ \v!yes=>\null diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex index d05ece78c..6a251f0d0 100644 --- a/tex/context/base/page-mar.tex +++ b/tex/context/base/page-mar.tex @@ -574,7 +574,7 @@ \v!right=>\let\next\dorightmarginblock, % no swapping \v!inner=>\def\next{\doinmarginswapped\dorightmarginblock\doleftmarginblock }, \v!outer=>\def\next{\doinmarginswapped\doleftmarginblock \dorightmarginblock}, - \s!unknown=>\ifdubbelzijdig + \s!unknown=>\ifdoublesided \doifcommonelse{+,-}{#4} {\def\next{\doinmarginswapped\dorightmarginblock\doleftmarginblock }} {\def\next{\doinmarginswapped\doleftmarginblock \dorightmarginblock}}% diff --git a/tex/context/base/page-num.tex b/tex/context/base/page-num.tex index a684eb7ef..b5a90fe6b 100644 --- a/tex/context/base/page-num.tex +++ b/tex/context/base/page-num.tex @@ -346,7 +346,7 @@ {\checknumber[\s!page]} % \getpagestatus -% \ifrightpage als odd/enkelzijdig +% \ifrightpage als odd/singlesided \newif\ifrightpage \rightpagetrue @@ -365,7 +365,7 @@ \writepagref} \def\getpagestatus % hierboven gebruiken - {\ifdubbelzijdig + {\ifdoublesided \gettwopassdata\s!page \iftwopassdatafound \else \let\twopassdata\realpageno @@ -402,8 +402,8 @@ \v!right=>\dododosetpagenumberlocation{\v!text\c!righttext}, \v!inleft=>\dododosetpagenumberlocation{\v!margin\c!lefttext}, \v!inright=>\dododosetpagenumberlocation{\v!margin\c!righttext}, - \v!inmargin=>\dododosetpagenumberlocation{\v!margin\ifdubbelzijdig\c!margintext\else\c!righttext\fi}, - \v!margin=>\dododosetpagenumberlocation{\v!margin\ifdubbelzijdig\c!margintext\else\c!righttext\fi}, + \v!inmargin=>\dododosetpagenumberlocation{\v!margin\ifdoublesided\c!margintext\else\c!righttext\fi}, + \v!margin=>\dododosetpagenumberlocation{\v!margin\ifdoublesided\c!margintext\else\c!righttext\fi}, \v!atmargin=>\dododosetpagenumberlocation{\v!text\c!marginedgetext}, \v!marginedge=>\dododosetpagenumberlocation{\v!text\c!marginedgetext}]% \ifdone \else @@ -419,14 +419,14 @@ \def\dosetuppagenumbering[#1]% {\getparameters[\??nm][#1]% \preparepageprefix\??nm - \enkelzijdigfalse - \dubbelzijdigfalse + \singlesidedfalse + \doublesidedfalse \ExpandFirstAfter\processallactionsinset [\@@nmalternative] - [ \v!singlesided=>\enkelzijdigtrue, - \v!doublesided=>\dubbelzijdigtrue]% + [ \v!singlesided=>\singlesidedtrue, + \v!doublesided=>\doublesidedtrue]% \ifx\trackingmarginnotestrue\undefined\else - \ifdubbelzijdig + \ifdoublesided \trackingmarginnotestrue \else \trackingmarginnotesfalse diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex index a52196c59..b1931dd1e 100644 --- a/tex/context/base/page-one.tex +++ b/tex/context/base/page-one.tex @@ -125,16 +125,48 @@ #1% \fi} +% \chardef\kindofpagetextareas\plusone + +\def\doOTRONEregisteredtextareaA#1% + {\ifregistertextareas + \xypos{pbd:\realfolio:b}% we could save bytes by only saving the y + \endgraf + \begingroup + \scratchdimen\MPy{pbd:\realfolio:b}% + \advance\scratchdimen-\MPy{pbd:\realfolio:e}% + \setbox\scratchbox\null + \wd\scratchbox\makeupwidth + \ht\scratchbox\scratchdimen + \vsmash{\registeredtextarea00\scratchbox}% + \endgroup + #1% + \endgraf + \xypos{pbd:\realfolio:e}% + \else + #1% + \fi} + +\def\doOTRONEregisteredtextareaB#1% + {\ifregistertextareas + \setbox0\vbox{#1}% + \wd0\makeupwidth % somehow a space creeps in + \vbox{\registeredtextarea000}% + \else + #1% + \fi} + \let\OTRONEregisteredtextareaA\firstofoneargument \let\OTRONEregisteredtextareaB\firstofoneargument \def\OTRONEdopagecontents#1#2% \box \unvbox {\bgroup % niet breedte zetten, kan fractie zijn! \ifcase\kindofpagetextareas - \or % partial page - \let\OTRONEregisteredtextareaA\OTRONEregisteredtextarea - \or % whole page - \let\OTRONEregisteredtextareaB\OTRONEregisteredtextarea + \or % partial page (experimental) + \let\OTRONEregisteredtextareaA\doOTRONEregisteredtextareaA + \or % whole page (default) + \let\OTRONEregisteredtextareaB\doOTRONEregisteredtextareaB + \or % partial page (only works well with no stretch!) + \let\OTRONEregisteredtextareaA\doOTRONEregisteredtextareaB \fi \setbox0\vbox \ifbottomnotes to \textheight \fi {\edef\currentpagedepth{\the\dp#2}% still to be derived from #1 @@ -309,16 +341,6 @@ \OTRONEdosetbotinserts \fi} -% \def\OTRONEdotopinsertions -% {\ifvoid\topins\else -% \ifgridsnapping -% \box\topins % not \topsnaptogrid{\box\topins}% -% \else -% \unvbox\topins -% \fi -% \fi -% \global\topinserted\zeropoint} - \def\OTRONEdotopinsertions {\ifvoid\topins\else \ifgridsnapping @@ -359,16 +381,6 @@ \fi \fi \snaptogrid\hbox{\iftestfloatbox\ruledhbox\fi{\copy\floatbox}}} -% \def\OTRONEdodoflushfloats % moet nog beter: als precies passend, niet onder baseline -% {\ifsomefloatwaiting -% \bgroup % \box\floatbox can be in use! -% \dogetfloat -% \doplacefloatbox -% \egroup -% \dofloatflushedinfo -% \expandafter\OTRONEdodoflushfloats -% \fi} - \def\OTRONEdodoflushfloats % much in common with OTRSET {\ifsomefloatwaiting \ifpackflushedfloats @@ -424,52 +436,6 @@ \expandafter\OTRONEdodoflushfloats \fi} -% \def\OTRONEdocheckiffloatfits % vervangen ivm downward comp -% {\ifnofloatpermitted -% \global\roomforfloatfalse -% \else -% \dimen0 \pagetotal -% \advance\dimen0 \ht\floatbox -% \advance\dimen0 \dp\floatbox -% \advance\dimen0 \floattopskip -% % \advance\dimen0 -\pageshrink % toegevoegd -% %\message{c:\the\mofcolumns,t:\the\pagetotal,g:\the\pagegoal}%\wait -% \ifdim\dimen0>\pagegoal -% \global\roomforfloatfalse -% \else -% \global\roomforfloattrue -% \fi -% \fi} - -% \def\OTRONEdocheckiffloatfits % vervangen ivm downward comp -% {\ifnofloatpermitted -% \global\roomforfloatfalse -% \else -% \dimen0 \pagetotal -% \advance\dimen0 \ht\floatbox -% \advance\dimen0 \dp\floatbox -% \advance\dimen0 \floattopskip -% \advance\dimen0 -\pageshrink % toegevoegd -% %\message{c:\the\mofcolumns,t:\the\pagetotal,g:\the\pagegoal}%\wait -% \dimen2\pagegoal -% \relax % needed -% \ifcase\textfloatmethod -% % method 0 : raw -% \or -% % method 1 : safe -% \dimen2 .99\pagegoal -% \or -% % method 2 : tight -% \advance\dimen0 -\onepoint -% \fi -% \relax % really needed ! ! ! ! -% \ifdim\dimen0>\dimen2 -% \global\roomforfloatfalse -% \else -% \global\roomforfloattrue -% \fi -% \fi} - \def\OTRONEdocheckiffloatfits % vervangen ivm downward comp {\ifnofloatpermitted \global\roomforfloatfalse diff --git a/tex/context/base/page-run.tex b/tex/context/base/page-run.tex index b44662d3c..302a1b5a0 100644 --- a/tex/context/base/page-run.tex +++ b/tex/context/base/page-run.tex @@ -32,7 +32,7 @@ [\c!offset=\v!overlay,\c!strut=\v!no, \c!width=\paperwidth,\c!height=\paperheight] {\ss ABC\par DEF}}% - \dubbelzijdigfalse + \doublesidedfalse \def\cutmarklength{.5em}% \addpagecutmarks0% \replicatepagebox0% diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex index 1c31f6a10..9c553167b 100644 --- a/tex/context/base/page-set.tex +++ b/tex/context/base/page-set.tex @@ -2711,7 +2711,7 @@ \advance\!!widthb -\!!countc\textwidth \ifodd\realpageno \else % tricky, assumes that we keep there \ifcase\!!countc\else - % nog niet ok voor enkel/dubbelzijdig + % nog niet ok voor enkel/doublesided \advance\!!widtha \namedlayoutparameter\v!even\c!backspace \advance\!!widtha \namedlayoutparameter\v!odd \c!backspace \advance\!!widthb \namedlayoutparameter\v!even\c!backspace diff --git a/tex/context/base/page-spr.tex b/tex/context/base/page-spr.tex index c90e9cf0f..53d508752 100644 --- a/tex/context/base/page-spr.tex +++ b/tex/context/base/page-spr.tex @@ -60,7 +60,7 @@ \def\startspread {\bgroup - \ifdubbelzijdig + \ifdoublesided \page[\v!left]% %\setsystemmode{spread}% \inspreadtrue diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex index 63861acf8..54e5d6f97 100644 --- a/tex/context/base/s-abr-01.tex +++ b/tex/context/base/s-abr-01.tex @@ -82,8 +82,8 @@ \logo [FREEBSD] {FreeBSD} \logo [FOXET] {foXet} \logo [FTP] {ftp} -\logo [GHOSTSCRIPT]{Ghost\-Script} -\logo [GHOSTVIEW] {Ghost\-View} +\logo [GHOSTSCRIPT]{Ghost\-script} +\logo [GHOSTVIEW] {Ghost\-view} \logo [GIF] {gif} \logo [GNU] {gnu} \logo [GS] {Ghost\-Script} @@ -198,7 +198,7 @@ \logo [TUGNEWS] {Tug\-News} \logo [TUG] {tug} \logo [UNICODE] {Uni\-code} -\logo [UNIX] {unix} +\logo [UNIX] {Unix} \logo [URI] {uri} \logo [URL] {url} \logo [USA] {usa} diff --git a/tex/context/base/s-pre-30.tex b/tex/context/base/s-pre-30.tex index 2f983e51b..2a3899c92 100644 --- a/tex/context/base/s-pre-30.tex +++ b/tex/context/base/s-pre-30.tex @@ -196,6 +196,19 @@ \page \stopsetups +\startsetups show-usage-lines + \subject{usage} + \typebuffer + \startstreamlayer[resultstream] + \subject{result} + \startlines + \getbuffer + \stoplines + \stopstreamlayer + \placestreamlayer[resultstream] + \page +\stopsetups + \startsetups show-contents \startcolumns[n=3] \placelist[section][criterium=text] diff --git a/tex/context/base/s-pre-50.tex b/tex/context/base/s-pre-50.tex index 0332001ab..782f6aea1 100644 --- a/tex/context/base/s-pre-50.tex +++ b/tex/context/base/s-pre-50.tex @@ -8,29 +8,29 @@ %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. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. %D When my mailbox started to overflow with messages about %D problems with the presentation step mechanism, I looked up %D old presentaton, hacked a bit and cooked up an alternative -%D that is less dependent on \PDF\ trickery. +%D that is less dependent on \PDF\ trickery. %D -%D Consider it a cheap trick and prelude to a couple of new -%D presentation styles. (At the time of writing this, I -%D still have some 10 of those styles to clean up and -%D document.) You can give it a try: +%D Consider it a cheap trick and prelude to a couple of new +%D presentation styles. (At the time of writing this, I +%D still have some 10 of those styles to clean up and +%D document.) You can give it a try: %D -%D \starttyping -%D texexec --pdf --mode=demo s-pre-50 -%D \stoptyping +%D \starttyping +%D texexec --pdf --mode=demo s-pre-50 +%D \stoptyping % Basic definitions. \defineframedtext [horizontal] [width=\textwidth, - frame=off, + frame=off, strut=no, height=fit, align={right,lohi}, @@ -50,7 +50,7 @@ \setupcollector [contribution] [voffset=-.25\bodyfontsize] - + \setupframedtexts [horizontal] [background=color, @@ -59,7 +59,7 @@ \stopmode -%D Structure and trick. +%D Structure and trick. \def\StartSteps {\checkutilities} @@ -74,7 +74,7 @@ \flushcollector[contribution] \page} -%D Trick. +%D Trick. Nowadays we can use streams. \installoutput\FlushStep {\StartStep\unvbox\normalpagebox\StopStep} diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex index cab3f0bec..83ab14df0 100644 --- a/tex/context/base/supp-lan.tex +++ b/tex/context/base/supp-lan.tex @@ -1475,27 +1475,27 @@ \flushurl\splitbefore\#% \else\ifnum\catcode`#1=4 \flushurl\splitbefore\&% - \else\if#1\lettertilde + \else\expandafter\if\string#1\lettertilde \flushurl\splitbefore\~% - \else\if#1\letterpercent + \else\expandafter\if\string#1\letterpercent \flushurl\splitbefore\%% - \else\if#1\letterunderscore + \else\expandafter\if\string#1\letterunderscore \flushurl\splitbefore\_% - \else\if#1\letterquestionmark + \else\expandafter\if\string#1\letterquestionmark \flushurl\splitafter\letterquestionmark - \else\if#1\letterat + \else\expandafter\if\string#1\letterat \flushurl\splitafter\letterat - \else\if#1\letterslash + \else\expandafter\if\string#1\letterslash \edef\savedurl{\savedurl\letterslash}% - \else\if#1+% + \else\expandafter\if\string#1+% \flushurl\splitafter+% - \else\if#1:% + \else\expandafter\if\string#1:% \flushurl\splitafter:% - \else\if#1.% + \else\expandafter\if\string#1.% \flushurl\splitafter.% - \else\if#1(% + \else\expandafter\if\string#1(% \flushurl\splitbefore(% - \else\if#1)% + \else\expandafter\if\string#1)% \flushurl\splitafter)% \else \ifx\savedurl\empty\else @@ -1503,12 +1503,12 @@ \let\savedurl\empty \fi \ifcase\urlhyphenmethod - #1% + \string#1% \else \ifnum\scratchcounter>\plusthree % so, \http: will not break - \edef\savedurl{#1}% + \edef\savedurl{\string#1}% \else - #1% + \string#1% \fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} @@ -1522,6 +1522,12 @@ % \hsize1pt\gotoURL{http://www.physik.fu-berlin.de/SomeVeryVeryVeryLongDirectory/And/AQuiteLongFileName.html} % \stoptext +% \useencoding[ffr] +% \mainlanguage[fr] +% \starttext +% \hyphenatedurl{http://somewhere.to/go} +% \stoptext + %D When Joop Susan asked (on the \CONTEXT\ mailing list) how %D to handle url's passed as argument, the following solutions %D came to my mind: diff --git a/tex/context/base/supp-mis.tex b/tex/context/base/supp-mis.tex index 9ab55142f..d2105e34c 100644 --- a/tex/context/base/supp-mis.tex +++ b/tex/context/base/supp-mis.tex @@ -20,18 +20,36 @@ %D Because \LATEX\ has no safe package loading mechanism, we %D need to take care of possible interference. +% \def\StartLatexHack +% {\edef\StopLatexHack +% {\catcode`\noexpand/=\the\catcode`/ +% \catcode`\noexpand-=\the\catcode`- +% \catcode`\noexpand:=\the\catcode`: +% \catcode`\noexpand;=\the\catcode`; +% \catcode`\noexpand"=\the\catcode`" +% \catcode`\noexpand<=\the\catcode`< +% \catcode`\noexpand>=\the\catcode`>}% +% \catcode`/=12 \catcode`-=12 +% \catcode`:=12 \catcode`;=12 +% \catcode`"=12 \catcode`<=12 \catcode`>=12 } + +%D Adapted conform request from morten.hoegholm@latex-project.org, +%D i.e. untested by me; using strings makes Babel more happy. + \def\StartLatexHack {\edef\StopLatexHack - {\catcode`\noexpand/=\the\catcode`/ - \catcode`\noexpand-=\the\catcode`- - \catcode`\noexpand:=\the\catcode`: - \catcode`\noexpand;=\the\catcode`; - \catcode`\noexpand"=\the\catcode`" - \catcode`\noexpand<=\the\catcode`< - \catcode`\noexpand>=\the\catcode`>}% - \catcode`/=12 \catcode`-=12 - \catcode`:=12 \catcode`;=12 - \catcode`"=12 \catcode`<=12 \catcode`>=12 } + {\catcode\string`\noexpand/=\the\catcode\string`/ + \catcode\string`\noexpand-=\the\catcode\string`- + \catcode\string`\noexpand:=\the\catcode\string`: + \catcode\string`\noexpand;=\the\catcode\string`; + \catcode\string`\noexpand"=\the\catcode\string`" + \catcode\string`\noexpand<=\the\catcode\string`< + \catcode\string`\noexpand>=\the\catcode\string`> + \catcode\string`\noexpand`=\the\catcode\string``}% + \catcode\string`/=12 \catcode\string`-=12 + \catcode\string`:=12 \catcode\string`;=12 + \catcode\string`"=12 \catcode\string`<=12 + \catcode\string`>=12 \catcode\string``=12 } %D This hack is needed especially for \LATEX\ users who use %D the Babel package. The Germans have active \type {"}'s, the diff --git a/tex/context/base/supp-mps.tex b/tex/context/base/supp-mps.tex index b89483a5c..9005b5736 100644 --- a/tex/context/base/supp-mps.tex +++ b/tex/context/base/supp-mps.tex @@ -1000,7 +1000,7 @@ \deallocateMPslot\currentMPgraphic \egroup} -\long\def\startuseMPgraphic#1% +\long\def\startuseMPgraphic {\blabelgroup \obeyMPlines \dostartuseMPgraphic} @@ -1009,7 +1009,7 @@ {\long\setgvalue{\@@MPG#1}{\handleuseMPgraphic{#1}{#2}}% \elabelgroup} -\long\def\startusableMPgraphic#1% +\long\def\startusableMPgraphic {\blabelgroup \obeyMPlines \dostartusableMPgraphic} @@ -1111,8 +1111,7 @@ \def\MPOSTbatchswitch {-int=batchmode} \def\MPOSTnonstopswitch {-int=nonstopmode} -% \def\MPOSTformatswitch {-progname=mpost -mem=} - \def\MPOSTformatswitch {-mem=} + \def\MPOSTformatswitch {-progname=metafun -mem=} \def\MPOSTdriver {dvips} \def\executeMPOST#1% direct call @@ -1962,7 +1961,24 @@ \let\stopMPcode \relax % so that we can use it in \expanded -%D Special for \XETEX\ (problem with newlines): +%D \macros +%D {startstaticMPgraphic} +%D +%D Dedicated to Aditya Mahajan. See meta-ini for usage. + +\long\def\startstaticMPgraphic#1#2\stopstaticMPgraphic + {\setMPrandomseedfalse + \def\MPgraphicfile{#1}% no \jobname here + \let\allocateMPslot \gobbleoneargument + \let\deallocateMPslot\gobbleoneargument + \let\runMPgraphic \gobbleoneargument + \runMPgraphicstrue + \currentMPgraphic\plusone % hack, else no close + \startMPgraphic#2\stopMPgraphic} + +%D Special for \XETEX\ (problem with newlines). This will go +%D away once the version supporting \type {--8bit} is +%D widespread. \beginXETEX \let\obeyMPlines\relax diff --git a/tex/context/base/symb-cow.tex b/tex/context/base/symb-cow.tex new file mode 100644 index 000000000..427e0af32 --- /dev/null +++ b/tex/context/base/symb-cow.tex @@ -0,0 +1,104 @@ +%D \module +%D [ file=symb-cow, +%D version=2006.06.23, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Cow Symbols, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=\PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\loadmapfile[koeieletters.map] + +\definefontsynonym [Cows] [koeielett] +\definefontsynonym [CowsContour] [koeielett-contour] +\definefontsynonym [CowsLogo] [koeielogos] +\definefontsynonym [CowsLogoContour] [koeielogos-contour] + +\definecolor [lsky] [r=.6,g=.6,b=1] +\definecolor [dsky] [r=.1,g=.1,b=1] +\definecolor [lground] [r=.3,g=.9,b=.3] +\definecolor [dground] [r=0,g=.5,b=0] +\definecolor [cspots] [r=.33,g=.1,b=0] + +\definecolor [tlsky] [t=.5,a=1,r=.6,g=.6,b=1] +\definecolor [tdsky] [t=.5,a=1,r=.1,g=.1,b=1] +\definecolor [tlground] [t=.5,a=1,r=.3,g=.9,b=.3] +\definecolor [tdground] [t=.5,a=1,r=0,g=.5,b=0] +\definecolor [tcspots] [t=.5,a=1,r=.33,g=.1,b=0] + +\definepalet + [cow] + [normal=lground, + contour=dground] + +\def\ScaledCowOverlay#1#2% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\definedfont[CowsContour sa #1]#2}}% + \color[cow:normal] {\definedfont[Cows sa #1]#2}}} + +\def\CowOverlay#1% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\getglyph{CowsContour}{#1}}}% + \color[cow:normal] {\getglyph{Cows} {#1}}}} + +\def\CowContour#1% + {\dontleavehmode\hbox + {\color[cow:contour]{\hsmash{\getglyph{CowsLogoContour}{#1}}}% + \color[cow:normal] {\getglyph{CowsLogo} {#1}}}} + +\def\CowLogo#1% + {\getglyph{CowsLogo}{\char#1\relax}} + +\startsymbolset[cownormal] + +\definesymbol[CowPragma] [\CowLogo{1}] +\definesymbol[CowConTeXt] [\CowLogo{2}] +\definesymbol[CowConTeXtComplete][\CowLogo{3}] +\definesymbol[CowConTeXtShadow] [\CowLogo{4}] +\definesymbol[CowConTeXtContour] [\CowLogo{5}] +\definesymbol[CowConTeXtOutline] [\CowLogo{6}] +\definesymbol[CowConTeXtDots] [\CowLogo{7}] +\definesymbol[CowMP] [\CowLogo{8}] +\definesymbol[CowMPComplete] [\CowLogo{9}] +\definesymbol[CowTeX] [\CowLogo{10}] +\definesymbol[CowTeXComplete] [\CowLogo{11}] +\definesymbol[CowBoo] [\CowLogo{12}] +\definesymbol[CowCow] [\CowLogo{13}] +\definesymbol[CowExampleComplete][\CowLogo{14}] +\definesymbol[CowFoxetComplete] [\CowLogo{15}] +\definesymbol[CowMetafun] [\CowLogo{16}] +\definesymbol[CowMetafunComplete][\CowLogo{17}] +\definesymbol[CowTEX] [\CowLogo{18}] +\definesymbol[CowWiki] [\CowLogo{19}] + +\stopsymbolset + +\startsymbolset[cowcontour] + +\definesymbol[CowPragma] [\CowContour{1}] +\definesymbol[CowConTeXt] [\CowContour{2}] +\definesymbol[CowConTeXtComplete][\CowContour{3}] +\definesymbol[CowConTeXtShadow] [\CowContour{4}] +\definesymbol[CowConTeXtContour] [\CowContour{5}] +\definesymbol[CowConTeXtOutline] [\CowContour{6}] +\definesymbol[CowConTeXtDots] [\CowContour{7}] +\definesymbol[CowMP] [\CowContour{8}] +\definesymbol[CowMPComplete] [\CowContour{9}] +\definesymbol[CowTeX] [\CowContour{10}] +\definesymbol[CowTeXComplete] [\CowContour{11}] +\definesymbol[CowBoo] [\CowContour{12}] +\definesymbol[CowCow] [\CowContour{13}] +\definesymbol[CowExampleComplete][\CowContour{14}] +\definesymbol[CowFoxetComplete] [\CowContour{15}] +\definesymbol[CowMetafun] [\CowContour{16}] +\definesymbol[CowMetafunComplete][\CowContour{17}] +\definesymbol[CowTEX] [\CowContour{18}] +\definesymbol[CowWiki] [\CowContour{19}] + +\stopsymbolset + +\endinput diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex index 9d4d9fd2e..a2beceac9 100644 --- a/tex/context/base/syst-gen.tex +++ b/tex/context/base/syst-gen.tex @@ -405,7 +405,9 @@ %D \type{\unprotect}, one can use \type{\@EA} as equivalent %D of \type{\expandafter}. -\let\@EA =\expandafter +\let\@NX\noexpand +\let\@EA\expandafter + \def\@EAEA {\expandafter\expandafter} \def\@EAEAEA{\expandafter\expandafter\expandafter} @@ -3818,10 +3820,10 @@ \processcommalist[##1]\dodododoublewithset}}% #1\dododoublewithset}% -\def\dodoubleemptywithset% +\def\dodoubleemptywithset {\dodoublewithset\dodoubleempty} -\def\dodoubleargumentwithset% +\def\dodoubleargumentwithset {\dodoublewithset\dodoubleargument} \def\dotriplewithset#1#2% diff --git a/tex/context/base/type-cow.tex b/tex/context/base/type-cow.tex new file mode 100644 index 000000000..027f6b6b7 --- /dev/null +++ b/tex/context/base/type-cow.tex @@ -0,0 +1,83 @@ +%D \module +%D [ file=type-cow, +%D version=2006.06.23, +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=Cow Fonts, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D The cow fonts are a project of Duane Bibby, Hans Hagen and Taco +%D Hoekwater. + +\starttypescriptcollection[cow] + +\starttypescript [math,serif] [cow,sheep] [default] + \setups[font:fallback:serif] + \usemathcollection[cow] + \loadmapfile[koeieletters.map] + \definefontsynonym [Serif] [Cows] [encoding=\typescriptthree] + \definefontsynonym [SerifContour] [CowsContour] [encoding=\typescriptthree] + \definefontsynonym [SerifLogo] [CowsLogo] [encoding=\typescriptthree] + \definefontsynonym [SerifLogoContour][CowsLogoContour] [encoding=\typescriptthree] + \definefontsynonym [MathRoman] [CowsMathRoman] [encoding=\typescriptthree] + \definefontsynonym [MathItalic] [CowsMathItalic] [encoding=\typescriptthree] + \definefontsynonym [MathSymbol] [CowsMathSymbol] [encoding=\typescriptthree] + \definefontsynonym [MathExtension] [CowsMathExtensions][encoding=\typescriptthree] +\stoptypescript + +\starttypescript [math,serif] [sheep] [default] + \setups[font:fallback:serif] + \usemathcollection[cow] + \loadmapfile[koeieletters.map] + \definefontsynonym [Serif] [Sheep] [encoding=\typescriptthree] + \definefontsynonym [SerifContour] [SheepContour] [encoding=\typescriptthree] + \definefontsynonym [SerifLogo] [SheepLogo] [encoding=\typescriptthree] + \definefontsynonym [SerifLogoContour][SheepLogoContour] [encoding=\typescriptthree] + \definefontsynonym [MathRoman] [SheepMathRoman] [encoding=\typescriptthree] + \definefontsynonym [MathItalic] [SheepMathItalic] [encoding=\typescriptthree] + \definefontsynonym [MathSymbol] [SheepMathSymbol] [encoding=\typescriptthree] + \definefontsynonym [MathExtension] [SheepMathExtensions][encoding=\typescriptthree] +\stoptypescript + +\starttypescript [all] [cow,sheep] [default] + \definefontsynonym [Cows] [koeielett] + \definefontsynonym [CowsContour] [koeielett-contour] + \definefontsynonym [CowsLogo] [koeielogos] + \definefontsynonym [CowsLogoContour] [koeielogos-contour] + \definefontsynonym [CowsMathRoman] [koeielett] + \definefontsynonym [CowsMathItalic] [koeieletter-mi] + \definefontsynonym [CowsMathSymbol] [koeieletter-sy] + \definefontsynonym [CowsMathExtensions][koeieletter-ex] +\stoptypescript + +\starttypescript [all] [sheep] [default] + \definefontsynonym [Sheep] [koeielett] + \definefontsynonym [SheepContour] [koeielett-contour] + \definefontsynonym [SheepLogo] [koeielogos] + \definefontsynonym [SheepLogoContour] [koeielogos-contour] + \definefontsynonym [SheepMathRoman] [koeielettx] + \definefontsynonym [SheepMathItalic] [koeieletter-mi] + \definefontsynonym [SheepMathSymbol] [koeieletter-syx] + \definefontsynonym [SheepMathExtensions][koeieletter-ex] +\stoptypescript + +\starttypescript [cow] [default] + \definetypeface [cow] [ss][serif][cow] [default][encoding=default] + \definetypeface [cow] [mm][math] [cow] [default][encoding=default] + \definetypeface [cow] [tt][mono] [modern][default][encoding=default,rscale=.85] +\stoptypescript + +\starttypescript [sheep] [default] + \definetypeface [sheep][ss][serif][sheep] [default][encoding=default] + \definetypeface [sheep][mm][math] [sheep] [default][encoding=default] + \definetypeface [sheep][tt][mono] [modern][default][encoding=default,rscale=.85] +\stoptypescript + +\stoptypescriptcollection + +\endinput diff --git a/tex/context/base/type-gyr.tex b/tex/context/base/type-gyr.tex new file mode 100644 index 000000000..b5063201d --- /dev/null +++ b/tex/context/base/type-gyr.tex @@ -0,0 +1,36 @@ +%D \module +%D [ file=type-gyr, +%D version=2006.06.28, +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=TeXGyre Collection, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\starttypescriptcollection[gyre] + +% TeXGyrePagella +% +% qplr TeXGyrePagella-Regular +% qplri TeXGyrePagella-Italic +% qplb TeXGyrePagella-Bold +% qplbi TeXGyrePagella-BoldItalic + +\starttypescript [serif] [palatino] [texnansi,ec,8r,t5,qx] + \loadmapfile[\typescriptthree-qpl.map] + + \definefontsynonym [Palatino] [\typescriptthree-qplr] [encoding=\typescriptthree] + \definefontsynonym [Palatino-Italic] [\typescriptthree-qplri] [encoding=\typescriptthree] + \definefontsynonym [Palatino-Bold] [\typescriptthree-qplb] [encoding=\typescriptthree] + \definefontsynonym [Palatino-BoldItalic] [\typescriptthree-qplbi] [encoding=\typescriptthree] + + \definefontsynonym [Palatino-Slanted] [Palatino-Italic] + \definefontsynonym [Palatino-BoldSlanted] [Palatino-BoldItalic] + \definefontsynonym [Palatino-Caps] [Palatino] +\stoptypescript + +\stoptypescriptcollection diff --git a/tex/context/base/type-syn.tex b/tex/context/base/type-syn.tex index e5967d2f0..0470622fb 100644 --- a/tex/context/base/type-syn.tex +++ b/tex/context/base/type-syn.tex @@ -510,6 +510,26 @@ \definefontsynonym [SansBoldItalic] [Iwona-CapsHeavyItalic] [encoding=\typescriptthree] \stoptypescript +\starttypescript [sans] [iwona-heavy] [name] + \setups[font:fallback:sans] + \definefontsynonym [Sans] [Iwona-Heavy] [encoding=\typescriptthree] + \definefontsynonym [SansItalic] [Iwona-HeavyItalic] [encoding=\typescriptthree] + \definefontsynonym [SansBold] [Iwona-Heavy] [encoding=\typescriptthree] + \definefontsynonym [SansBoldItalic] [Iwona-HeavyItalic] [encoding=\typescriptthree] + \definefontsynonym [SansCaps] [Iwona-CapsHeavy] [encoding=\typescriptthree] + \definefontsynonym [SansItalicCaps] [Iwona-CapsHeavyItalic] [encoding=\typescriptthree] + \definefontsynonym [SansBoldCaps] [Iwona-CapsHeavy] [encoding=\typescriptthree] + \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsHeavyItalic] [encoding=\typescriptthree] +\stoptypescript + +\starttypescript [sans] [iwona-heavy-caps] [name] + \setups[font:fallback:sans] + \definefontsynonym [SansCaps] [Iwona-CapsHeavy] [encoding=\typescriptthree] + \definefontsynonym [SansItalicCaps] [Iwona-CapsHeavyItalic] [encoding=\typescriptthree] + \definefontsynonym [SansBoldCaps] [Iwona-CapsHeavy] [encoding=\typescriptthree] + \definefontsynonym [SansBoldItalicCaps] [Iwona-CapsHeavyItalic] [encoding=\typescriptthree] +\stoptypescript + \starttypescript [sans] [iwona-light-cond] [name] \setups[font:fallback:sans] \definefontsynonym [Sans] [Iwona-CondLight] [encoding=\typescriptthree] diff --git a/tex/context/base/verb-c.tex b/tex/context/base/verb-c.tex index a7a041c7e..d2f708a8d 100644 --- a/tex/context/base/verb-c.tex +++ b/tex/context/base/verb-c.tex @@ -39,7 +39,7 @@ \ifcontinueCsinglelinecomment \continueCsinglelinecommentfalse \else - \egroup + \tttf \endofpretty \global\inCsinglelinecommentfalse \global\inCcommentfalse @@ -200,7 +200,7 @@ \next{#1}#2} \gdef\Cstartcomment#1#2% - {\beginofpretty[\!!prettyfourthree]\bgroup\ttsl\getpretties{#1}{#2}} + {\beginofpretty[\!!prettyfourthree]\ttsl\getpretties{#1}{#2}} \gdef\dodoCtypefourthree% #1% {\endCtypesix @@ -215,7 +215,7 @@ \else \global\inCcommenttrue \global\inCsinglelinecommenttrue - \def\next{\beginofpretty[\!!prettyfourthree]\bgroup\ttsl\getpretties{#1}{#2}}% + \def\next{\beginofpretty[\!!prettyfourthree]\ttsl\getpretties{#1}{#2}}% \expandafter\next \fi} @@ -235,7 +235,7 @@ \expandafter#2% \else\ifnum\prettytype=43 \getpretties{#1}{#2}% - \egroup + \tttf \endofpretty \global\inCcommentfalse \global\inCmultilinecommentfalse @@ -265,7 +265,7 @@ \endCtypesix \global\inCcommenttrue \global\inCsinglelinecommenttrue - \def\next{\beginofpretty[\!!prettyfourthree]\bgroup\ttsl\getpretty{#1}}% + \def\next{\beginofpretty[\!!prettyfourthree]\ttsl\getpretty{#1}}% \expandafter\next \fi\fi\fi} @@ -481,3 +481,4 @@ [\c!icommand=\tttf] \protect \endinput + diff --git a/tex/context/base/x-fe.tex b/tex/context/base/x-fe.tex index 6e24417ac..8562b1d52 100644 --- a/tex/context/base/x-fe.tex +++ b/tex/context/base/x-fe.tex @@ -104,7 +104,7 @@ \defineXMLargument [fe:trace] [attribute=,option=] - {\showXMLinh{\XMLop{attribute}}% + {\showXMLinh[\XMLop{attribute}]% \XMLval{fe:trace}{\XMLop{option}}{}} \mapXMLvalue diff --git a/tex/context/base/x-set-11.tex b/tex/context/base/x-set-11.tex index 37de793bc..537148b43 100644 --- a/tex/context/base/x-set-11.tex +++ b/tex/context/base/x-set-11.tex @@ -400,7 +400,7 @@ {\showSETUPrecord} \def\showSETUPrecord - {\getvalue{startsetuptext} + {\getvalue{\e!start setuptext} \tttf \nohyphens \veryraggedright @@ -439,7 +439,7 @@ \egroup \stopXMLmapping} \stopXMLmapping - \getvalue{stopsetuptext}} + \getvalue{\e!stop setuptext}} \defineXMLenvironmentsave [cd:sequence] \ignorespaces \ignorespaces \defineXMLenvironmentsave [cd:arguments] \ignorespaces \ignorespaces @@ -785,9 +785,14 @@ \stopXMLmapping -\def\loadsetups +\def\loadsetups{\complexorsimple\loadsetups} + +\def\simpleloadsetups + {\complexloadsetups[cont-en.xml]} + +\def\complexloadsetups[#1]% {\startXMLmapping[zero] - \processXMLfilegrouped{cont-en.xml} + \processXMLfilegrouped{#1} \stopXMLmapping} \protect \endinput diff --git a/tex/context/base/x-set-12.tex b/tex/context/base/x-set-12.tex index d7ff8fd18..93055b860 100644 --- a/tex/context/base/x-set-12.tex +++ b/tex/context/base/x-set-12.tex @@ -32,7 +32,6 @@ \definecolor[TitleColor][r=.15,g=.20,b=.25] \definecolor[TitleColor][r=.15,g=.25,b=.20] - \startinterface dutch \definecolor[LocalColor][r=.75,g=.25,b=.25] \stopinterface \startinterface english \definecolor[LocalColor][r=.25,g=.75,b=.25] \stopinterface \startinterface german \definecolor[LocalColor][r=.25,g=.25,b=.75] \stopinterface @@ -150,22 +149,17 @@ \setuplayout [titlepage] -\startmakeup[\v!standard] - \dontcomplain - \startcolor[TitleColor] - \definedfont[RegularBold at 100pt]\setstrut - \setupalign[\v!left] - \strut Con\TeX t \par - \definedfont[RegularBold at 50pt]\setstrut +\startsetups text:commands \startinterface dutch \strut commando's \par \stopinterface \startinterface english \strut commands \par \stopinterface \startinterface german \strut befehle \par \stopinterface - \startinterface french \strut ....... \par \stopinterface - \startinterface czech \strut prikaz\'y \par \stopinterface + \startinterface french \strut commandes \par \stopinterface + \startinterface czech \strut p\v{r}ikazy \par \stopinterface \startinterface italian \strut comandi \par \stopinterface \startinterface romanian \strut comenzile \par \stopinterface - \vfill - \definedfont[RegularBold at 150pt]\setstrut +\stopsetups + +\startsetups text:uppercase \startinterface dutch NL\stopinterface \startinterface english EN\stopinterface \startinterface german DE\stopinterface @@ -173,6 +167,29 @@ \startinterface czech CZ\stopinterface \startinterface italian IT\stopinterface \startinterface romanian RO\stopinterface +\stopsetups + +\startsetups text:lowercase + \startinterface dutch \strut nl / nederlands \par \stopinterface + \startinterface english \strut en / english \par \stopinterface + \startinterface german \strut de / deutsch \par \stopinterface + \startinterface french \strut fr / fran\c{c}ais \par \stopinterface + \startinterface czech \strut cz / \v{c}esk\'y \par \stopinterface + \startinterface italian \strut it / italiano \par \stopinterface + \startinterface romanian \strut ro / rom\^{a}n\u{a} \par \stopinterface +\stopsetups + +\startmakeup[\v!standard] + \dontcomplain + \startcolor[TitleColor] + \definedfont[RegularBold at 100pt]\setstrut + \setupalign[\v!left] + \strut Con\TeX t \par + \definedfont[RegularBold at 50pt]\setstrut + \setups[text:commands] + \vfill + \definedfont[RegularBold at 150pt]\setstrut + \setups[text:uppercase] \stopcolor \stopmakeup @@ -189,22 +206,10 @@ \setupalign[\v!left] \strut Con\TeX t \par \definedfont[RegularBold at 50pt]\setstrut - \startinterface dutch \strut commando's \par \stopinterface - \startinterface english \strut commands \par \stopinterface - \startinterface german \strut befehle \par \stopinterface - \startinterface french \strut ....... \par \stopinterface - \startinterface czech \strut prikaz\'y \par \stopinterface - \startinterface italian \strut comandi \par \stopinterface - \startinterface romanian \strut comenzile \par \stopinterface + \setups[text:commands] \vfill \definedfont[RegularBold at 24pt]\setupinterlinespace - \startinterface dutch \strut nl / nederlands \par \stopinterface - \startinterface english \strut en / english \par \stopinterface - \startinterface german \strut de / deutsch \par \stopinterface - \startinterface french \strut fr / fran\,c ais \par \stopinterface - \startinterface czech \strut cz / \^cesk\'y \par \stopinterface - \startinterface italian \strut it / italiano \par \stopinterface - \startinterface romanian \strut ro / rom\^{a}n\u{a} \par \stopinterface + \setups[text:lowercase] \par \strut \currentdate \par \stopcolor \stopmakeup diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex index 6d1d3078d..face9f0b0 100644 --- a/tex/context/base/xtag-run.tex +++ b/tex/context/base/xtag-run.tex @@ -172,7 +172,7 @@ {\def\docommando##1{#1[##1]#2#3\letvalue{\@@XMLshow:##1}\empty}% \processcommalist[#4]\docommando} -\gdef\showXMLinh[#1]% +\gdef\showXMLign[#1]% {\setXMLshow\defineXMLignore \relax\relax[#1]% \setXMLshow\defineXMLsingular \relax\relax[#1]} @@ -305,7 +305,7 @@ \fi}% \egroup} -\gdef\showXMLinh#1% +\gdef\showXMLinh[#1]% {\doifsomething{#1} {\bgroup\infofont[% \dorecurse\XMLdepth diff --git a/tex/context/bib/bibl-ams.tex b/tex/context/bib/bibl-ams.tex index 1c5a9fd1c..ddfe927c3 100644 --- a/tex/context/bib/bibl-ams.tex +++ b/tex/context/bib/bibl-ams.tex @@ -45,7 +45,7 @@ \c!right={)}] \setupcite - [key,serial,page,short,type,doi,url] + [key,serial,authornum,page,short,type,doi,url] [\c!andtext={ and }, \c!otherstext={ et al.}, \c!pubsep={, }, diff --git a/tex/context/bib/bibl-apa-de.tex b/tex/context/bib/bibl-apa-de.tex index 71996926d..8ab1f48ff 100644 --- a/tex/context/bib/bibl-apa-de.tex +++ b/tex/context/bib/bibl-apa-de.tex @@ -47,7 +47,7 @@ \c!right={)}] \setupcite - [key,serial,page,short,type,doi,url] + [key,serial,authornum,page,short,type,doi,url] [\c!andtext={ und }, \c!otherstext={ et al.}, \c!pubsep={, }, diff --git a/tex/context/bib/bibl-apa-fr.tex b/tex/context/bib/bibl-apa-fr.tex index 68eac13c2..d2a1efb8a 100644 --- a/tex/context/bib/bibl-apa-fr.tex +++ b/tex/context/bib/bibl-apa-fr.tex @@ -45,7 +45,7 @@ \c!right={)}] \setupcite - [key,serial,page,short,type,doi,url] + [key,serial,authornum,page,short,type,doi,url] [\c!andtext={ et }, \c!otherstext={ et al.}, \c!pubsep={, }, diff --git a/tex/context/bib/bibl-apa.tex b/tex/context/bib/bibl-apa.tex index c3d11911a..8e2e9e842 100644 --- a/tex/context/bib/bibl-apa.tex +++ b/tex/context/bib/bibl-apa.tex @@ -45,7 +45,7 @@ \c!right={)}] \setupcite - [key,serial,page,short,type,doi,url] + [key,serial,authornum,page,short,type,doi,url] [\c!andtext={ and }, \c!otherstext={ et al.}, \c!pubsep={, }, @@ -66,6 +66,7 @@ \c!left={[}, \c!right={]}] + \setuppublications[% \c!sorttype=, \c!criterium=, @@ -386,4 +387,4 @@ \insertnote{ }{.}{}% } -\protect \ No newline at end of file +\protect diff --git a/tex/context/bib/bibl-aps.tex b/tex/context/bib/bibl-aps.tex index 6d9e8db12..39d3bd7d4 100644 --- a/tex/context/bib/bibl-aps.tex +++ b/tex/context/bib/bibl-aps.tex @@ -45,7 +45,7 @@ \c!right={)}] \setupcite - [key,serial,page,short,type,doi,url] + [key,serial,authornum,page,short,type,doi,url] [\c!andtext={ and }, \c!otherstext={ et al.}, \c!pubsep={, }, diff --git a/tex/context/bib/bibl-num-fr.tex b/tex/context/bib/bibl-num-fr.tex index ca634a3da..c4271fb7f 100644 --- a/tex/context/bib/bibl-num-fr.tex +++ b/tex/context/bib/bibl-num-fr.tex @@ -49,7 +49,7 @@ \c!right={)}] \setupcite - [key,serial,page,short,type,doi,url] + [key,serial,authornum,page,short,type,doi,url] [\c!andtext={ et }, \c!otherstext={ et al.}, \c!pubsep={, }, diff --git a/tex/context/bib/bibl-num.tex b/tex/context/bib/bibl-num.tex index ff7cfe7a5..45d527f77 100644 --- a/tex/context/bib/bibl-num.tex +++ b/tex/context/bib/bibl-num.tex @@ -1,6 +1,6 @@ %D \module %D [ file=bibl-num, -%D version=2005.12.31, +%D version=2006.07.01, %D title=Numeric bibliography style, %D subtitle=Publications, %D author={Taco Hoekwater}, @@ -49,7 +49,7 @@ \c!right={)}] \setupcite - [key,serial,page,short,type,doi,url] + [key,serial,authornum,page,short,type,doi,url] [\c!andtext={ and }, \c!otherstext={ et al.}, \c!pubsep={, }, @@ -184,7 +184,7 @@ {}% \insertpublisher { }% - {\insertedition{, }{ edition}{} + {\insertedition{, }{ edition}{}% \insertpubyear{, }{.}{.}}% {\insertedition{, }{ edition}{}% \insertpubyear{, }{.}{.}}% @@ -318,7 +318,7 @@ \insertchap{\unskip, }{ }{ }% \insertpages {\unskip, pages~} - {\insertcity{, }{}{} + {\insertcity{, }{}{}% \insertpubyear{\unskip, }{. }{. }}% {\unskip \insertpubyear{\unskip, }{. }{. }}% diff --git a/tex/context/bib/bibl-ssa.tex b/tex/context/bib/bibl-ssa.tex index 2e3341328..b93bd1b68 100644 --- a/tex/context/bib/bibl-ssa.tex +++ b/tex/context/bib/bibl-ssa.tex @@ -46,7 +46,7 @@ \c!right={)}] \setupcite - [key,serial,page,short,type,doi,url] + [key,serial,authornum,page,short,type,doi,url] [\c!andtext={ and }, \c!otherstext={ et al.}, \c!pubsep={, }, diff --git a/tex/context/bib/t-bib.tex b/tex/context/bib/t-bib.tex index dbb5df612..719991255 100644 --- a/tex/context/bib/t-bib.tex +++ b/tex/context/bib/t-bib.tex @@ -1,6 +1,6 @@ %D \module %D [ file=t-bib, -%D version=2006.04.11, +%D version=2006.07.12, %D title=\CONTEXT\ Publication Module, %D subtitle=Publications, %D author=Taco Hoekwater, @@ -49,6 +49,33 @@ %D \item Destroy interactivity in labels of the publication list (13/03/2006) %D \item fix multi-cite list compression (11/4/2006) %D \item fix \type{\getcitedata} (11/4/2006) +%D \item magic for chapter bibs (18-25/4/2006) +%D \item language setting (25/4/2006) +%D \item use \type{\hyphenatedurl} for \type{\inserturl} (25/4/2006) +%D \item Add \type{\docitation} to \type{\nocite}(26/4/2006) +%D \item patents can have numbers, added to bst files (26/4/2006) +%D \item \type{\docitation} needs a \type{\iftrialtypesetting} (27/4/2006) +%D \item \type{\filllocalpublist}'s loop is bound by definedness, not resolvedness (27/4/2006) +%D \item \type{\setuppublications[monthconversion=]} added (15/5/2006) +%D \item use \type{\undefinedreference} instead of bare question marks (15/5/2006) +%D \item add grouping around \type{\placepublications} commands (16/5/2006) +%D \item fix a bug in \type{\cite{}} (17/5/2006) +%D \item support \type{\cite[authornum]} (18/5/2006) +%D \item make \type{\cite} unexpandable (20/6/2006) +%D \item allow hyperlinks in author\&year combo's +%D (cite list compression has to be off) (20/6/2006) +%D \item fix duplicate labels for per-chapter style (20/6/2006) +%D \item allow \type{\setupcite[interaction=(start|stop)]} +%D \item fix the item number in the publication list with 'numbering=yes' (22/6/2006) +%D \item make the default criterium for \type{\placepublications} be \type{previous} (23/6/2006) +%D \item fix \type{\normalauthor} and \type{\normalshortauthor} spacing (29/6/2006) +%D \item do not typeset empty arguments to \type{\typesetapublication} (29/6/2006) +%D \item add \type{symbol=none} to \type{\setuplist} in unnumbered +%D mode to prevent typesetting of bare numbers (29/6/2006) +%D \item remove two incorrect spaces from bibl-num.tex (1/7/2006) +%D \item reset font styles within \type{\cite}, so that font switches +%D in \type{left} stay in effect (12/7/2006) +%D \item guard added against loading bbl files multiple times (13/7/2006) %D \stopitemize %D %D \subject{WISHLIST} @@ -66,6 +93,7 @@ \definesystemvariable {pv} % PublicationVariable \definesystemvariable {pb} % PuBlication + \definemessageconstant {bib} \definefileconstant {bibextension} {bbl} @@ -148,11 +176,11 @@ \stopvariables +\def\biblistname{pubs} % for compatibility + %D how to load the references. There is some new stuff here %D to support Idris' (incorrect :-)) use of projects -\def\biblistname{pubs} - \let\preloadbiblist\relax @@ -186,26 +214,24 @@ % \fi \fi \fi -\expanded{\definelist[\biblistname]} +\definelist[pubs] +\setuplist[pubs][\c!width=] + %D The text string for the publication list header -\setupheadtext[en][\biblistname=References] -\setupheadtext[nl][\biblistname=Literatuur] -\setupheadtext[de][\biblistname=Literatur] -\setupheadtext[it][\biblistname=Bibliografia] -\setupheadtext[sl][\biblistname=Literatura] -\setupheadtext[fr][\biblistname=Bibliographie] +\setupheadtext[en][pubs=References] +\setupheadtext[nl][pubs=Literatuur] +\setupheadtext[de][pubs=Literatur] +\setupheadtext[it][pubs=Bibliografia] +\setupheadtext[sl][pubs=Literatura] +\setupheadtext[fr][pubs=Bibliographie] %D \macros{bibdoif,bibdoifnot,bibdoifelse} %D %D Here are a few small helpers that are used a lot %D in all the typesetting commands %D (\type{\insert...}) we will encounter later. -%D -%D TH: Hans, don't replace these! It is vital that -%D there is a precisly one level of expansion of -%D the argument. \long\def\bibdoifelse#1% {\@EA\def\@EA\!!stringa\@EA{#1}% @@ -312,9 +338,10 @@ [\??pb] [\c!alternative=,#1]% \doifsomething\@@pbalternative - {\readsysfile{bibl-\@@pbalternative.tex} - {\showmessage\m!bib{6}{bibl-\@@pbalternative}\let\@@pbalternative\empty} - {\showmessage\m!bib{1}{bibl-\@@pbalternative}\let\@@pbalternative\empty}}% + {\readsysfile + {bibl-\@@pbalternative.tex} + {\showmessage\m!bib{6}{bibl-\@@pbalternative}\let\@@pbalternative\empty} + {\showmessage\m!bib{1}{bibl-\@@pbalternative}\let\@@pbalternative\empty}}% \getparameters [\??pb] [#1]% @@ -359,9 +386,11 @@ {\usereferences[#1]\processcommalist[#1]\dousepublications} \def\dousepublications#1% - {\readfile{#1.\f!bibextension} - {\showmessage\m!bib{4}{#1.\f!bibextension}} - {\showmessage\m!bib{2}{#1.\f!bibextension}}} + {\doonlyonce + {#1.\f!bibextension} + {\readfile{#1.\f!bibextension} + {\showmessage\m!bib{4}{#1.\f!bibextension}} + {\showmessage\m!bib{2}{#1.\f!bibextension}}}} %D \macros{setuppublicationlist} %D @@ -380,15 +409,14 @@ {\dosingleempty\dosetuppublicationlist} \def\dosetuppublicationlist[#1]% - {\getparameters - [@@pvdata] - [\c!samplesize={AA99},\c!totalnumber={99},#1]% for sample & totalnumber & firstnamesep etc. + {\getparameters[\??pv data][#1]% \setuplist - [\biblistname] - [\c!alternative=a,\c!interaction=,\c!pagenumber=\v!no,#1]} + [pubs] + [\c!samplesize={AA99},\c!totalnumber={99}, + \c!alternative=a,\c!interaction=,\c!pagenumber=\v!no,#1]} \def\setuppublicationlayout[#1]#2% - {\setvalue{@@pvdata#1}{#2\unskip}} + {\setvalue{\??pv data#1}{#2\unskip}} %D \macros{bibalternative} %D @@ -428,18 +456,27 @@ }} \def\bibcommandlist - {arttitle, title, journal, notes, volume, issue, pubname, city, - country, bibtype, organization, series, thekey, edition, month, - pubyear, note, annotate, pages, keyword, keywords, comment, - abstract, names, size, issn, isbn, chapter, eprint, doi, - howpublished, biburl, lastchecked, - % ieee - nationality, assignee, bibnumber, day, dayfiled, monthfiled, - yearfiled, revision} + {abstract, annotate, arttitle, assignee, bibnumber, bibtype, biburl, chapter, city, + comment, country, day, dayfiled, doi, edition, eprint, howpublished, isbn, issn, + issue, journal, keyword, keywords, lastchecked, month, monthfiled, names, nationality, + note, notes, organization, pages, pubname, pubyear, revision, series, size, thekey, + title, volume, yearfiled} \processcommacommand[\bibcommandlist]\simplebibdef +\def\insertbiburl#1#2#3% + {{\bibdoifelse{\@@pb@biburl}% + {\edef\ascii{\@EA\detokenize\@EA{\@@pb@biburl}}% + #1\@EA\hyphenatedurl\@EA{\ascii}#2}{#3}}} + +\def\insertmonth#1#2#3% + {\bibdoifelse{\@@pb@month}% + {#1\doifnumberelse{\@@pb@month}% + {\doifconversiondefinedelse\@@pbmonthconversion + {\convertnumber\@@pbmonthconversion{\@@pb@month}}{\@@pb@month}}% + {\@@pb@month}#2}{#3}} + \let\inserturl \insertbiburl % for backward compat. \let\inserttype\insertbibtype % for backward compat. @@ -487,8 +524,6 @@ %D \specialbibinsert{author}{\author@num}{}{}{} %D \stoptyping -% hh: use a context counter instead, more options - \def\complexbibdef#1% {\@EA\newcounter\csname #1@num\endcsname \@EA\def\csname bib@#1\endcsname[##1]##2[##3]##4##5% @@ -526,7 +561,7 @@ \def\specialbibinsert#1#2#3#4#5% {\bgroup \ifnum#2>\zerocount - \letcscsname\tempa\csname @@pvdata#1\endcsname + \letcscsname\tempa\csname \??pv data#1\endcsname \def\tempb{\@EA\tempa}% \etallimitcounter =0\bibalternative{#1etallimit}\relax \etaldisplaycounter=0\bibalternative{#1etaldisplay}\relax @@ -594,14 +629,14 @@ \def\normalauthor#1#2#3#4#5% {\bibdoif{#1}{#1\bibalternative\c!firstnamesep}% \bibdoif{#2}{#2\bibalternative\c!vonsep}% - #3\bibalternative\c!surnamesep - \bibdoif{#5}{#5\unskip}} + #3% + \bibdoif{#5}{\bibalternative\c!surnamesep#5\unskip}} \def\normalshortauthor#1#2#3#4#5% {\bibdoif{#4}{#4\bibalternative\c!firstnamesep}% \bibdoif{#2}{#2\bibalternative\c!vonsep}% - #3\bibalternative\c!surnamesep - \bibdoif{#5}{#5\unskip}} + #3% + \bibdoif{#5}{\bibalternative\c!surnamesep#5\unskip}} \def\invertedauthor#1#2#3#4#5% {\bibdoif{#2}{#2\bibalternative\c!vonsep}% @@ -698,68 +733,186 @@ \newif\ifinpublist -\let\@@pvdatawidth\empty +% from Hans + +\def\ignoresectionconversion + {\let\@@sectionconversion\secondoftwoarguments} + +\let\normaldosetfilterlevel\dosetfilterlevel + +\def\patcheddosetfilterlevel#1#2% beware: this one is \let + {\bgroup + \ignoresectionconversion + \edef\askedlevel{#1}% + \edef\askedfilter{#2}% +% \message{ASKD: \meaning\askedlevel}% +% \message{PREV: \meaning\v!previous}% + \ifx\askedlevel\v!current + \dosetcurrentlevel\askedlevel + \else\ifx\askedlevel\v!previous + \dosetpreviouslevel\askedlevel + \else\ifx\askedlevel\v!all + \global\chardef\alltoclevels\plusone + \else\ifx\askedlevel\v!text + \global\chardef\alltoclevels\plusone + \else + \edef\byaskedlevel{\csname\??by\askedlevel\endcsname}% + \ifx\byaskedlevel\v!text + \dosettextlevel\askedlevel + \else + \dosetotherlevel\askedlevel + \fi + \fi\fi\fi\fi + % experiment + \ifx\askedfilter\empty \else + \xdef\currentlevel{\currentlevel\sectionseparator\askedfilter}% + \fi + \egroup} + + +\unless\ifcsname currentlocationrefence\endcsname -\def\preinitializepubslist - {\let\bibcounter\!!zerocount +\let\currentlocationreference\empty + +\def\dogetreferenceelements#1#2#3#4#5% + {\chardef\currentreferencetype=\ifx#1\relax0\else#1\fi\relax + \ifnum\currentreferencetype<2 + \edef\currentpagereference{#2}% + \let \currentdatareference\empty + \edef\currentlocationreference{#2}% + \ifx\currentpagereference \empty + \let\currentfolioreference\folio + \else + \def \currentpagereference {\referencepagenumber[#2]}% + \edef\currentfolioreference{\dosplitofffoliopart[#2]}% + \fi + \edef\currentrealreference{#3}% + \settextreferences#4\end + \ifnum0#5<\crossreferencenumber + \forwardreferencetrue + \else + \forwardreferencefalse + \fi + \else + \let \currentlocationreference\empty + \edef\currentrealreference {#3}% + \def \currentdatareference {#2}% + \let \currentfolioreference\folio + \settextreferences#4\end + \forwardreferencefalse + \fi + \ifodd\currentreferencetype + \realreferencepagefalse + \else + \docheckrealreferencepage\currentrealreference + \ifrealreferencepage \else + \docheckrealreferencepage\currentdatareference + \fi + \fi} + +\fi + +\def\filllocalpublist% + {\let\dosetfilterlevel\patcheddosetfilterlevel + \dosettoclevel\??li{pubs}% + \let\dosetfilterlevel\normaldosetfilterlevel + \global\let\glocalpublist\empty + \doloop + {\doifdefinedelse + {\r!cross cite-\jobname-\recurselevel} + {\doifreferencefoundelse + {cite-\jobname-\recurselevel} + {\@EA\doifreglevelelse\@EA[\currentlocationreference] + {\@EA\doglobal\@EA\addtocommalist\@EA + {\currenttextreference}\glocalpublist}{}} + {}}% + {\exitloop}}% + \let\localpublist\glocalpublist} + +% +\def\typesetpubslist + {\dobeginoflist + \edef\askedlevel{\csname \??li pubs\c!criterium\endcsname}% + \ifx\askedlevel\v!all + \def\bibrefprefix{}% + \else % + \preparebibrefprefix + \fi \ifsortbycite - \processcommacommand[\publist]\sortwritepublist - \glet\publist\empty + \filllocalpublist \iftypesetall - \processcommacommand[\allrefs]\writepublist + \let\localallrefs\allrefs + \processcommacommand[\localpublist]\typesetapublication + \def\removefromallrefs##1% + {\removefromcommalist{##1}\localallrefs }% + \processcommacommand[\localpublist]\removefromallrefs + \processcommacommand[\localallrefs]\typesetapublication + \else + \processcommacommand[\localpublist]\typesetapublication \fi \else \iftypesetall - \processcommacommand[\allrefs]\writepublist + \processcommacommand[\allrefs]\typesetapublication \else - \processcommacommand[\allrefs]\writereferredpublist + % + \filllocalpublist + \processcommacommand[\allrefs]\maybetypesetapublication \fi - \fi} + \fi + \doendoflist } + +\newif\ifinpublist +\def\maybetypesetapublication#1% + {\global\inpublistfalse + \def\test{#1}% + \def\runtest##1% + {\def\tempa{##1}\ifx \test\tempa \global\inpublisttrue \fi}% + \processcommacommand[\localpublist]\runtest + \ifinpublist \typesetapublication{#1}\fi} \def\initializepubslist {\edef\@@pbnumbering{\@@pbnumbering}% \ifautohang \ifx\@@pbnumbering\v!short - \setbox\scratchbox\hbox{\@@pbnumbercommand{\csname @@pvdata\c!samplesize\endcsname}}% + \setbox\scratchbox\hbox{\@@pbnumbercommand{\getvalue{\??li pubs\c!samplesize}}}% \else\iftypesetall - \setbox\scratchbox\hbox{\@@pbnumbercommand{\csname @@pvdata\c!totalnumber\endcsname}}% + \setbox\scratchbox\hbox{\@@pbnumbercommand{\getvalue{\??li pubs\c!totalnumber}}}% \else \setbox\scratchbox\hbox{\@@pbnumbercommand{\numreferred}}% \fi\fi \edef\samplewidth{\the\wd\scratchbox}% - \setuplist[\biblistname][\c!width=\samplewidth,\c!distance=0pt]% + \setuplist[pubs][\c!width=\samplewidth,\c!distance=0pt]% \def\@@pblimitednumber##1{\hbox to \samplewidth{\@@pbnumbercommand{##1}}}% \else \doifemptyelse - {\@@pvdatawidth} + {\getvalue{\??li pubs\c!width}} {\def\@@pblimitednumber##1{\hbox{\@@pbnumbercommand{##1}}}}% - {\def\@@pblimitednumber##1{\hbox to \@@pvdatawidth{\@@pbnumbercommand{##1}}}}% + {\def\@@pblimitednumber##1{\hbox to \getvalue{\??li pubs\c!width}{\@@pbnumbercommand{##1}}}}% \fi \ifx\@@pbnumbering\v!no - \setuplist[\biblistname][\c!numbercommand=,\c!textcommand=\outdented] + \setuplist[pubs][\c!numbercommand=,\c!symbol=\v!none,\c!textcommand=\outdented] \else - \setuplist[\biblistname][\c!numbercommand=\@@pblimitednumber]% + \setuplist[pubs][\c!numbercommand=\@@pblimitednumber]% \fi \forgetall % bugfix 2005/03/18 } + \def\outdented#1% move to supp-box ? {\hskip -\hangindent #1} + %D The full list of publications \def\completepublications {\dosingleempty\docompletepublications} \def\docompletepublications[#1]% - {\preinitializepubslist - \ifcase\bibcounter\else - \initializepubslist - \let\bibcounter\!!zerocount - \inpublisttrue - \completelist[\biblistname][\c!criterium=\v!current,#1]% - \inpublistfalse - \fi} + {%\getparameters[\??pv data][#1]% + \begingroup + \setuplist[pubs][\c!criterium=\v!previous,#1] + \expanded{\systemsuppliedtitle[pubs]{\noexpand\headtext{pubs}}}% + \dodoplacepublications } %D And the portion with the entries only. @@ -767,49 +920,28 @@ {\dosingleempty\doplacepublications} \def\doplacepublications[#1]% - {\preinitializepubslist - \ifcase\bibcounter\else - \initializepubslist - \let\bibcounter\!!zerocount - \inpublisttrue - \placelist[\biblistname][\c!criterium=\v!current,#1]% - \inpublistfalse - \fi} - -\def\dowritebiblist#1#2% - {\makepbkvalue{#2}% - \edef\pbnumbercommand{\@@pbinumbercommand{#1}}% - \@EA\dodowritebiblist\@EA{\pbnumbercommand}{\typesetapublication{#2}}} - -\def\dodowritebiblist - {\writetolist[\biblistname]} + {%\getparameters[\??pv data][#1] + \begingroup + \setuplist[pubs][\c!criterium=\v!previous,#1] + \dodoplacepublications }% -\def\writepublist#1% - {\doifnotempty{#1} - {\increment\bibcounter - \@EA\dowritebiblist\@EA{\bibcounter}{#1}}} +\def\dodoplacepublications% + {\initializepubslist + \global\let\bibcounter\!!zerocount + \inpublisttrue + \typesetpubslist + \inpublistfalse + \endgroup } -\def\writereferredpublist#1% - {\doifnotempty{#1} - {\doifreferredelse{#1} - {\increment\bibcounter - \@EA\dowritebiblist\@EA{\bibcounter}{#1}}{}}} - -\def\sortwritepublist#1% - {\doifnotempty{#1} - {\removefromcommalist{#1}\allrefs - \increment\bibcounter - \@EA\dowritebiblist\@EA{\bibcounter}{#1}}} %D \subsubject{What's in a publication} %D -\unexpanded\def\typesetapublication - {\doglobal\increment\bibcounter - \dotypesetapublication} - -%D quick hack to make sure stuff isn't typeset twice: - +\unexpanded\def\typesetapublication#1% + {\doifsomething{#1}{\doglobal\increment\bibcounter + \dodolistelement{pubs}{}{\bibcounter}% + {\expanded{\reference[\bibrefprefix#1]{\bibcounter}}% + \strut \dotypesetapublication{#1}\strut }{}{}}} \def\dotypesetapublication#1% {\bgroup @@ -819,22 +951,10 @@ \processcommalist [artauthor,author,editor]\clearbibitemtwo \processcommacommand[\bibcommandlist]\bibitemdefs \processcommalist [artauthor,author,editor,crossref]\bibitemdefs - \ifinpublist - \@EA\ifx\csname #1-is-typeset\endcsname \relax - \setgvalue{#1-is-typeset}{1}% - \expanded{\reference[#1]{\bibcounter}}% - \getvalue{pbdd-#1}% - \strut \ifcsname pbdt-#1\endcsname \bibalternative{\getvalue{pbdt-#1}}\fi\strut - \else - \endgraf - \setbox0=\lastbox \unskip - \fi - \else - \getvalue{pbdd-#1}% execute data - %\bibalternative{\getvalue{pbdt-#1}}% do typesetting - \ifcsname pbdt-#1\endcsname \bibalternative{\getvalue{pbdt-#1}}\fi - \fi - \egroup} + \let\biblanguage\empty + \getvalue{pbdd-#1}% + \ifcsname pbdt-#1\endcsname \bibalternative{\getvalue{pbdt-#1}}\fi + \egroup } %D An afterthought @@ -847,7 +967,14 @@ %D This is the result of bibtex's `language' field. -\def\lang#1{} +\def\setbiblanguage#1#2{\setvalue{\??pb @lang@#1}{#2}} + +\def\lang#1% + {\def\biblanguage{#1}% + \ifcsname \??pb @lang@#1\endcsname + \expanded{\language[\getvalue{\??pb @lang@#1}]}% + \fi \ignorespaces} + %D \subject{Citations} @@ -857,7 +984,7 @@ %D \type{\cite} commands with a braced argument (these might appear %D in included data from the \type{.bib} file). -\def\cite +\unexpanded\def\cite {\doifnextcharelse{[} {\dodocite} {\dobibref}} @@ -873,54 +1000,60 @@ \stopstrictinspectnextcharacter \docite[#1][#2]} -\def\docite#1[#2]#3[#4]% +\def\docite[#1][#2]% {\begingroup + \setupinteraction[\c!style=]% + \edef\temp{#2}% + \ifx\empty\temp \secondargumentfalse + \else \secondargumenttrue \fi \ifsecondargument - \doifassignmentelse - {#2}% - {\getparameters[LO][\c!alternative=,\c!extras=,#2]% + \processcommalist[#2]\docitation + \doifassignmentelse + {#1}% + {\getparameters[LO][\c!alternative=,\c!extras=,#1]% \edef\@@currentalternative{\LOalternative}% \ifx\@@currentalternative\empty \edef\@@currentalternative{\@@citedefault}% \fi \ifx\LOextras\empty - \setupcite[\@@currentalternative][#2]% + \setupcite[\@@currentalternative][#1]% \else \expandafter\ifx\csname LOright\endcsname \relax \edef\LOextras{{\LOextras\bibalternative\c!right}}% \else \edef\LOextras{{\LOextras\LOright}}% \fi - \expanded{\setupcite[\@@currentalternative][#2,\c!right=\LOextras]}% + \expanded{\setupcite[\@@currentalternative][#1,\c!right=\LOextras]}% \fi }% - {\def\@@currentalternative{#2}}% + {\def\@@currentalternative{#1}}% \expanded{% \processaction[\csname @@pv\@@currentalternative compress\endcsname]} [ \v!yes=>\bibcitecompresstrue, \v!no=>\bibcitecompressfalse, \s!default=>\bibcitecompresstrue, \s!unknown=>\bibcitecompresstrue]% - \getvalue{bib\@@currentalternative ref}[#4]% + \getvalue{bib\@@currentalternative ref}[#2]% \else + \processcommalist[#1]\docitation \expanded{\processaction[\csname @@pv\@@citedefault compress\endcsname]} [ \v!yes=>\bibcitecompresstrue, \v!no=>\bibcitecompressfalse, \s!default=>\bibcitecompresstrue, \s!unknown=>\bibcitecompresstrue]% \edef\@@currentalternative{\@@citedefault}% - \getvalue{bib\@@citedefault ref}[#2]% + \getvalue{bib\@@citedefault ref}[#1]% \fi \endgroup} %D \macros{nocite} \def\nocite[#1]% - {\processcommalist[#1]\addthisref} + {\processcommalist[#1]\addthisref + \processcommalist[#1]\docitation } %D \macros{setupcite} - \def\setupcite{\dodoubleempty\dosetupcite} \def\dosetupcite[#1][#2]% @@ -952,6 +1085,17 @@ \processcommalist [artauthor,author,editor,crossref]\bibitemdefs \getvalue{pbdd-#1}} +%D This new version writes a reference out to the tui file for every +%D \type{\cite}. This will allow backlinking + +\newcounter\citationnumber + +\def\docitation#1{% + \iftrialtypesetting \else + \doglobal\increment\citationnumber + \expanded{\rawreference{}{cite-\jobname-\citationnumber}{#1}}% + \fi} + %D \macros{numreferred,doifreferredelse,addthisref,publist} %D @@ -967,10 +1111,11 @@ \long\def\doifreferredelse#1{\doifdefinedelse{pbr-#1}} \def\addthisref#1% - {\doifundefined{pbr-#1} - {\setgvalue{pbr-#1}{a}% + {\doifundefinedelse{pbr-#1} + {\setxvalue{pbr-#1}{\citationnumber}% \doglobal\increment\numreferred - \appended\gdef\publist{,#1}}} + \ifx\publist\empty \gdef\publist{#1}\else\appended\gdef\publist{,#1}\fi} + {\setxvalue{pbr-#1}{\getvalue{pbr-#1},\citationnumber}}} \let\publist\empty @@ -1009,8 +1154,6 @@ %D %D In `normal' \TeX, of course there are expansion problems again. -\def\gobbledef#1{\def#1##1{##1}} - \def\ixbibauthoryear#1#2#3#4% {\bgroup \gdef\ixlastcommand {#4}% @@ -1043,7 +1186,7 @@ \edef\wantednumber{\the\scratchcounter}% \getfromcommacommand[\thebibyears][\wantednumber]% \@EA\def\@EA\currentbibyear\@EA{\commalistelement}% - \def\@currentbibauthor{#1}% brr + \setcurrentbibauthor{#1}% \ifnum\scratchcounter=\plusone \ixfirstcommand \else\ifnum \scratchcounter=\commalistsize\relax @@ -1052,23 +1195,25 @@ \ixsecondcommand \fi\fi} -\def\currentbibauthor% - {\getcommacommandsize[\@currentbibauthor]% +\def\setcurrentbibauthor#1% + {\getcommacommandsize[#1]% \ifcase\commalistsize % anonymous? + \def\currentbibauthor{}% \or - \@currentbibauthor + \def\currentbibauthor{#1}% \or - \expanded{\docurrentbibauthor\@currentbibauthor}% + \expanded{\docurrentbibauthor#1}% \else % this can't happen/ + \def\currentbibauthor{}% \fi } \def\docurrentbibauthor#1,#2% {\doifemptyelse{#2} - {#1\bibalternative{otherstext}} - {#1\bibalternative{andtext}#2}} + {\def\currentbibauthor{#1\bibalternative{otherstext}}} + {\def\currentbibauthor{#1\bibalternative{andtext}#2}}} %D This is not the one Hans made for me, because I need a global %D edef, and the \type{\robustdoifinsetelse} doesn't listen to @@ -1164,7 +1309,6 @@ \def\findmatchingyear {\edef\wantednumber{\the\bibitemwanted}% -% \message{year needed: \wantednumber (\thebibyears)}% \getfromcommacommand[\thebibyears][\wantednumber]% \ifx\commalistelement\empty \edef\myyear{{\myyear}}% @@ -1172,46 +1316,156 @@ \edef\myyear{{\commalistelement, \myyear}}% \fi \edef\newcommalistelement{\myyear}% -% \message{bibyears \wantednumber = \newcommalistelement}% \doglobal\replaceincommalist \thebibyears \wantednumber} + +%D \macros{preparebibrefprefix} +%D +%D The reference list only writes bare references when the criterium +%D is `all'. Otherwise, a prefix is added to make sure that pdfTeX +%D does not encounter duplicate named references. On the generation +%D side, this is not a big problem. \type{\preparebibrefprefix} +%D creates a suitable string to prepend if a prefix is needed. + +\def\preparebibrefprefix + {\let\dosetfilterlevel\patcheddosetfilterlevel + \dosettoclevel\??li{pubs}% + \let\dosetfilterlevel\normaldosetfilterlevel + \edef\bibrefprefix{\@@sectiontype\currentlevel\sectionseparator}}% + +%D \macros{preparebibreflist} +%D +%D But this optional prefixing is a bit of a problem on the +%D other side. We would like to do \type{\goto{}[article-full]} +%D but can't do it like that, because the actual label may be +%D \type{1:2:0:3:4:article-full]} or so. The problem is solved +%D by building a commalist that looks like this: +%D \starttyping +%D \def\bibreflist% +%D {1:2:0:3:4:article-full, +%D 1:2:0:3:article-full, +%D 1:2:0:article-full, +%D 1:2:article-full, +%D 1:article-full, +%D article-full} +%D \stoptyping + +\def\preparebibreflist#1% + {\let\bibreflist\empty + \def\storeitem##1% + {\ifx\bibreflist\empty + \edef\prefix{##1\sectionseparator}% + \edef\bibreflist{\prefix#1,#1}% + \else + \edef\prefix{\prefix##1\sectionseparator}% + \edef\bibreflist{\prefix#1,\bibreflist}% + \fi}% + \expanded{\processseparatedlist[\bibrefprefix][\sectionseparator]}\storeitem } + +%D \macros{gotobiblink,inbiblink,atbiblink} +%D +%D The final task is looping over that list until a match is found. + +\newif\ifbibreffound + +\def\gotobiblink#1[#2]% + {\bgroup + \preparebibrefprefix + \preparebibreflist{#2}% + \global\bibreffoundfalse + \def\setuplink##1% + {\ifbibreffound\else + \doifreferencefoundelse + {##1} + {\global\bibreffoundtrue \goto{#1}[##1]}% + {}\fi}% + \processcommacommand[\bibreflist]\setuplink + \ifbibreffound \else \unknownreference{#2}\fi + \egroup } + +\def\atbiblink[#1]% + {\bgroup + \preparebibrefprefix + \preparebibreflist{#1}% + \global\bibreffoundfalse + \def\setuplink##1% + {\ifbibreffound\else + \doifreferencefoundelse + {##1} + {\global\bibreffoundtrue \at[##1]}% + {}\fi}% + \processcommacommand[\bibreflist]\setuplink + \ifbibreffound \else \unknownreference{#1}\fi + \egroup } + +\def\inbiblink[#1]% + {\bgroup + \preparebibrefprefix + \preparebibreflist{#1}% + \global\bibreffoundfalse + \def\setuplink##1% + {\ifbibreffound\else + \doifreferencefoundelse + {##1} + {\global\bibreffoundtrue \in[##1]}% + {}\fi}% + \processcommacommand[\bibreflist]\setuplink + \ifbibreffound \else \unknownreference{#1}\fi + \egroup } + %D \macros{bibauthoryearref,bibauthoryearsref,bibauthorref,bibyearref} %D %D Now that all the hard work has been done, these are simple. %D \type{\ixbibauthoryearref} stores the data in the macros %D \type{\currentbibauthor} and \type{\currentbibyear}. +\def\ifbibinteractionelse% + {\edef\test{\bibalternative\c!interaction}% + \ifx\test\v!stop + \expandafter\secondoftwoarguments + \else + \expandafter\firstoftwoarguments + \fi} + +\def\bibmaybeinteractive#1#2% + {\ifbibcitecompress #2\else + \ifbibinteractionelse{\gotobiblink{#2}[#1]}{#2}\fi } + \def\bibauthoryearref[#1]% {\ixbibauthoryear{#1}% - {{\currentbibauthor}\bibalternative\c!inbetween - \bibalternative\v!left{\currentbibyear}\bibalternative\v!right} - {\bibalternative\c!pubsep{\currentbibauthor}\bibalternative\c!inbetween - \bibalternative\v!left {\currentbibyear}\bibalternative\v!right} - {\bibalternative\c!lastpubsep{\currentbibauthor}\bibalternative\c!inbetween - \bibalternative\v!left {\currentbibyear}\bibalternative\v!right}} + {\bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween + \bibalternative\v!left{\currentbibyear}\bibalternative\v!right}} + {\bibalternative\c!pubsep + \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween + \bibalternative\v!left {\currentbibyear}\bibalternative\v!right}} + {\bibalternative\c!lastpubsep + \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween + \bibalternative\v!left {\currentbibyear}\bibalternative\v!right}}} \def\bibauthoryearsref[#1]% {\bibalternative\v!left \ixbibauthoryear{#1} - {{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}} - {\bibalternative\c!pubsep {\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}% - {\bibalternative\c!lastpubsep{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}% + {\bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}} + {\bibalternative\c!pubsep + \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}} + {\bibalternative\c!lastpubsep + \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}}% \bibalternative\v!right} \def\bibauthorref[#1]% {\bibalternative\v!left \ixbibauthoryear{#1}% - {{\currentbibauthor}} - {\bibalternative\c!pubsep {\currentbibauthor}} - {\bibalternative\c!lastpubsep{\currentbibauthor}}% + {\bibmaybeinteractive{#1}{{\currentbibauthor}}} + {\bibalternative\c!pubsep \bibmaybeinteractive{#1}{{\currentbibauthor}}} + {\bibalternative\c!lastpubsep\bibmaybeinteractive{#1}{{\currentbibauthor}}}% \bibalternative\v!right} \def\bibyearref[#1]% {\bibalternative\v!left \ixbibauthoryear{#1}% - {{\currentbibyear}} - {\bibalternative\c!pubsep {\currentbibyear}} - {\bibalternative\c!lastpubsep{\currentbibyear}}% + {\bibmaybeinteractive{#1}{{\currentbibyear}}} + {\bibalternative\c!pubsep \bibmaybeinteractive{#1}{{\currentbibyear}}} + {\bibalternative\c!lastpubsep\bibmaybeinteractive{#1}{{\currentbibyear}}}% \bibalternative\v!right} %D ML problems: @@ -1234,7 +1488,8 @@ \def\dobibshortref#1% {\addthisref{#1}\refsep - \doifbibreferencefoundelse{#1}{\goto{\getvalue{pbds-#1}}[#1]}{??}} + \doifbibreferencefoundelse{#1}{\gotobiblink{\getvalue{pbds-#1}}[#1]} + {\unknownreference{#1}}} \def\bibserialref[#1]% @@ -1244,7 +1499,8 @@ \def\dobibserialref#1% {\addthisref{#1}\refsep - \doifbibreferencefoundelse{#1}{\getvalue{pbdn-#1}}{??}} + \doifbibreferencefoundelse{#1}{\gotobiblink{\getvalue{pbdn-#1}}[#1]} + {\unknownreference{#1}}} \def\bibkeyref[#1]% {\bibalternative\v!left @@ -1252,9 +1508,12 @@ \bibalternative\v!right} \def\dobibkeyref#1% - {\addthisref{#1}\refsep#1} + {\addthisref{#1}\refsep\gotobiblink{#1}[#1]} -\def\gotoDOI#1#2{\useURL[bibfoo#1][http://dx.doi.org/#2]\goto{\url[bibfoo#1]}[url(bibfoo#1)]} +\def\gotoDOI#1#2% + {\ifbibinteractionelse + {\useURL[bibfoo#1][http://dx.doi.org/#2]\goto{\url[bibfoo#1]}[url(bibfoo#1)]} + {\hyphenatedurl{#2}}} \def\bibdoiref[#1]% {\bibalternative\v!left @@ -1263,7 +1522,8 @@ \def\dobibdoiref#1% {\addthisref{#1}\refsep - \doifbibreferencefoundelse{#1}{\expanded{\gotoDOI{#1}{\getvalue{pbdo-#1}}}}{??}} + \doifbibreferencefoundelse{#1}{\expanded{\gotoDOI{#1}{\getvalue{pbdo-#1}}}} + {\unknownreference{#1}}} \def\biburlref[#1]% @@ -1271,11 +1531,15 @@ \firstreftrue\processcommalist[#1]\dobiburlref \bibalternative\v!right} -\def\gotoURL#1#2{\useURL[bibfoo#1][#2]\goto{\url[bibfoo#1]}[url(bibfoo#1)]} +\def\gotoURL#1#2% + {\ifbibinteractionelse + {\useURL[bibfoo#1][#2]\goto{\url[bibfoo#1]}[url(bibfoo#1)]} + {\hyphenatedurl{#2}}} \def\dobiburlref#1% {\addthisref{#1}\refsep - \doifbibreferencefoundelse{#1}{\expanded{\gotoURL{#1}{\getvalue{pbdu-#1}}}}{??}} + \doifbibreferencefoundelse{#1}{\expanded{\gotoURL{#1}{\getvalue{pbdu-#1}}}} + {\unknownreference{#1}}} \def\bibtyperef[#1]% {\bibalternative\v!left @@ -1284,7 +1548,8 @@ \def\dobibtyperef#1% {\addthisref{#1}\refsep - \doifbibreferencefoundelse{#1}{\getvalue{pbdt-#1}}{??}} + \doifbibreferencefoundelse{#1}{\gotobiblink{\getvalue{pbdt-#1}}[#1]} + {\unknownreference{#1}}} \def\bibpageref[#1]% {\bibalternative\v!left @@ -1292,7 +1557,8 @@ \bibalternative\v!right} \def\dobibpageref#1% - {\addthisref{#1}\refsep\at[#1]} + {\addthisref{#1}\refsep + \ifbibinteractionelse{\atbiblink[#1]}{{\referencingfalse\at[#1]}}} \def\bibdataref[#1]% {\bibalternative\v!left @@ -1301,7 +1567,8 @@ \def\dobibdata#1% {\addthisref{#1}\refsep - \doifbibreferencefoundelse{#1}{\dotypesetapublication{#1}}{??}} + \doifbibreferencefoundelse{#1}{\dotypesetapublication{#1}} + {\unknownreference{#1}}} \let\bibnoneref\nocite @@ -1345,22 +1612,41 @@ \fi \bibalternative\v!right} -\def\dosimplebibnumref #1{\refsep\in[#1]} +\def\dosimplebibnumref #1% + {\refsep\ifbibinteractionelse{\inbiblink[#1]}{{\referencingfalse\in[#1]}}} + \def\verysimplebibnumref#1{\doverysimplebibnumref#1} \def\doverysimplebibnumref#1#2% {\refsep - \ifcase#1\relax ??\else + \ifcase#1\relax \unknownreference{#1}\else \def\tempa{#2}\ifx\empty\tempa#1\else#1\bibalternative\c!inbetween#2\fi \fi} -%D And some defaults are loaded from bibl-apa: +%D By request from Sanjoy. This makes it easier to implement +%D \type{\citeasnoun}. + +\def\bibauthornumref[#1]% + {\getcommalistsize[#1] + \global\bibitemcounter\commalistsize + \firstreftrue + \processcommalist[#1]\dobibauthornumref } -% hh: shouldn't those bibl files be made international ? +\def\dobibauthornumref#1% + {\addthisref{#1}\refsep + \doifbibreferencefoundelse{#1} + {\getvalue{pbda-#1}% + \bibalternative\c!inbetween + \bibalternative\v!left + \ifbibinteractionelse{\inbiblink[#1]}{{\referencingfalse\in[#1]}}% + \bibalternative\v!right} + {\unknownreference{#1}}} + +%D And some defaults are loaded from bibl-apa: \setuppublications - [\c!alternative=apa] + [\v!month\v!conversion=,\c!alternative=apa] \preloadbiblist -\protect \endinput +\protect \endinput \ No newline at end of file diff --git a/tex/context/bib/t-bibltx.tex b/tex/context/bib/t-bibltx.tex new file mode 100644 index 000000000..cb9e787ad --- /dev/null +++ b/tex/context/bib/t-bibltx.tex @@ -0,0 +1,75 @@ +%D \module +%D [ file=t-bibltx, +%D version=2005.01.04, +%D title=\CONTEXT\ Publication Module, +%D subtitle=Publications, +%D author={Taco Hoekwater}, +%D date=\currentdate, +%D copyright={Public Domain}] +%C +%C Donated to the public domain. + +%D \macros{newcommand} +%D +%D Just about all databases define something that uses +%D \type {\newcommand}. This fake version does not cover +%D everything \type {\newcommand} does, but it should be +%D enough for simple definitions like the ones found in +%D \BIBTEX\ files. + +\unprotect + +\def\@star@or@long#1% + {\doifnextcharelse*{\afterassignment#1\let\next=}{#1}} + +\def\newcommand + {\@star@or@long\new@command} + +\def\new@command#1% + {\@testopt{\@newcommand#1}0} + +\def\@newcommand#1[#2]% + {\doifnextcharelse[{\@xargdef#1[#2]}{\@argdef#1[#2]}} + +\long\def\@argdef#1[#2]#3% + {\@yargdef#1\@ne{#2}{#3}} + +\long\def\@xargdef#1[#2][#3]#4% + {\@EA\def\@EA#1\@EA{\@EA\do@testopt\@EA#1\csname\string#1\endcsname{#3}}% + \@EA\@yargdef\csname\string#1\endcsname\tw@{#2}{#4}} + +\def\@testopt#1#2% + {\doifnextcharelse[{#1}{#1[#2]}} + +\def\do@testopt#1% + {\expandafter\@testopt} + +\long\def\@yargdef#1#2#3% + {\!!counta#3\relax + \advance \!!counta \@ne + \let\@hash@\relax + \edef\!!tempa{\ifx#2\tw@ [\@hash@1]\fi}% + \!!countb #2% + \loop + \ifnum\!!countb <\!!counta + \edef\!!tempa{\!!tempa\@hash@\the\!!countb}% + \advance\!!countb \@ne + \repeat + \let\@hash@##% + \long\@EA\def\@EA#1\!!tempa} + +\long\def\@reargdef#1[#2]% + {\@yargdef#1\@ne{#2}} + +%D Something like the following is needed to support the +%D average \LATEX-based \BIBTEX\ databases. +%D +%D \starttyping +%D \let\textsc\kap +%D \def\emph#1{{\em#1}} +%D \let\sf\ss +%D \stoptyping +%D +%D But we happily leave that to the user. + +\protect \endinput diff --git a/tex/context/interface/cont-cz.xml b/tex/context/interface/cont-cz.xml index ce881ea6d..4d2b4fb34 100644 --- a/tex/context/interface/cont-cz.xml +++ b/tex/context/interface/cont-cz.xml @@ -1615,6 +1615,11 @@ + + + + + @@ -5247,6 +5252,14 @@ + + + + + + + + diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index 0859070b7..a316ab0a6 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -1615,6 +1615,11 @@ + + + + + @@ -5247,6 +5252,14 @@ + + + + + + + + diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index f118229aa..2b39cefa2 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -1615,6 +1615,11 @@ + + + + + @@ -5247,6 +5252,14 @@ + + + + + + + + diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index 7e9ad66a9..115df8b2a 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -1615,6 +1615,11 @@ + + + + + @@ -5247,6 +5252,14 @@ + + + + + + + + diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index 480b6098a..0a3ba26cc 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -1615,6 +1615,11 @@ + + + + + @@ -5247,6 +5252,14 @@ + + + + + + + + diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index e74915152..92e6899b9 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -1615,6 +1615,11 @@ + + + + + @@ -5247,6 +5252,14 @@ + + + + + + + + diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index 5a69366bb..967d0a9e9 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -1615,6 +1615,11 @@ + + + + + @@ -5247,6 +5252,14 @@ + + + + + + + + diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml index a4b077bae..5f31bdce3 100644 --- a/tex/context/interface/keys-cz.xml +++ b/tex/context/interface/keys-cz.xml @@ -1,6 +1,6 @@ - + @@ -183,6 +183,7 @@ + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 8e9d30ff2..0c2b50ec2 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -1,6 +1,6 @@ - + @@ -183,6 +183,7 @@ + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 0fe262c0e..155e84be6 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -1,6 +1,6 @@ - + @@ -183,6 +183,7 @@ + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index f8156e14e..5c590c261 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -1,6 +1,6 @@ - + @@ -183,6 +183,7 @@ + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 6e281b78a..0c1c4c367 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -1,6 +1,6 @@ - + @@ -183,6 +183,7 @@ + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index f780a39d2..9a119e474 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -1,6 +1,6 @@ - + @@ -183,6 +183,7 @@ + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index a1d740f38..98f5bc8ac 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -1,6 +1,6 @@ - + @@ -183,6 +183,7 @@ + diff --git a/tex/context/interface/t-bib.xml b/tex/context/interface/t-bib.xml index 526e2fdf6..02af330a0 100644 --- a/tex/context/interface/t-bib.xml +++ b/tex/context/interface/t-bib.xml @@ -22,6 +22,7 @@ + @@ -53,6 +54,9 @@ + + + @@ -330,6 +334,15 @@ + + + + + + + + + -- cgit v1.2.3