diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-01-26 09:01:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-01-26 09:01:00 +0100 |
commit | 4548239c47a4c08a0d019f370f641902b0b77abe (patch) | |
tree | d35dd55d965ef1f1ebdc906373c01858c1f82f91 /tex | |
parent | a542619e8daa633ef659d2627965dbc98a9f2566 (diff) | |
download | context-4548239c47a4c08a0d019f370f641902b0b77abe.tar.gz |
beta 2011.01.26 09:01
Diffstat (limited to 'tex')
33 files changed, 379 insertions, 344 deletions
diff --git a/tex/context/base/anch-pos.mkiv b/tex/context/base/anch-pos.mkiv index 69d3525c6..888cb60eb 100644 --- a/tex/context/base/anch-pos.mkiv +++ b/tex/context/base/anch-pos.mkiv @@ -154,12 +154,6 @@ \setnewconstant\positionanchormode\plusone -%D The core set macros. - -\let\pospxy \gobblefourarguments -\let\pospxywhd \gobblesevenarguments -\let\pospxyplus\gobbleeightarguments - %D Sometimes we want to trick the position handler a bit: \def\replacepospxywhd#1#2#3#4#5#6#7{\ctxlua{commands.replacepospxywhd('#1',\number#2,"\the\dimexpr#3\relax","\the\dimexpr#4\relax","\the\dimexpr#5\relax","\the\dimexpr#6\relax","\the\dimexpr#7\relax")}} @@ -178,34 +172,26 @@ %D not applicable when the content floats indeed. In such %D situations one can treat positions and graphics local. -\newif\iflocalpositioning +\newif\iflocalpositioning % todo: conditional %D Watch out: sometimes a pagebreak occurs inside a float %D placement, so there we need to disable local mode. \appendtoks - \localpositioningtrue + \localpositioningtrue \to \everyinsidefloat \appendtoks - \localpositioningfalse + \localpositioningfalse \to \everypagebody -%D Since the positional values are to be fully expandable, we -%D need to preload them as soon as possible, which is why we -%D load the data when we start a text. - -% \appendtoks \checkpositions \to \everystarttext - %D \macros %D {MPp, MPx, MPy, MPw, MPh, MPd, %D MPxy, MPll, MPlr, MPur, MPul, MPpos} %D %D Access to the positional information is provided by macros -%D with short names that are clearly meant for \METAPOST. - -% \the\dimexpr\noexpand\lastsavedpositionx\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax -% \the\dimexpr\noexpand\lastsavedpositiony\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax +%D with short names that are clearly meant for \METAPOST\ but +%D nowadays also used for other purposes. \def\MPp #1{\ctxlua{commands.MPp("#1")}} \def\MPx #1{\ctxlua{commands.MPx("#1")}} @@ -250,14 +236,6 @@ \def\MPanchor{\MPpos} -%D \macros -%D {POSp, POSx, POSy, POSh, POSd, POSw} -%D -%D and: - -\def\POSp{\MPp} \def\POSx{\MPx} \def\POSy{\MPy} -\def\POSh{\MPh} \def\POSd{\MPd} \def\POSw{\MPw} - %D There are two low level positioning macros. Both store the %D position as well as execute an action associated with that %D position. @@ -758,7 +736,7 @@ %D doifpositionsonthispageelse} %D %D Instead of letting the user handle fuzzy expansion, we -%D provide a simple test on positione being on the same page. +%D provide a simple test on positions being on the same page. %D %D \starttyping %D \doifpositionsonsamepageelse{point a}{point b} @@ -769,9 +747,11 @@ %D {action when not on this page} %D \stoptyping +% todo: move to lua when we really use it + \def\dododoifpositionsonsamepageelse#1% {\ifcase\scratchcounter - \scratchcounter\MPp{##}\donetrue + \scratchcounter\MPp{#1}\donetrue \else \ifnum\scratchcounter=\MPp{#1}\relax\else\donefalse\fi \fi}% @@ -786,8 +766,8 @@ \endgroup\expandafter\secondoftwoarguments \fi} -\def\doifpositionsonsamepageelse{\dodoifpositionsonsamepageelse\!!zerocount} -\def\doifpositionsonthispageelse{\dodoifpositionsonsamepageelse\realfolio } +\def\doifpositionsonsamepageelse{\dodoifpositionsonsamepageelse\zerocount } +\def\doifpositionsonthispageelse{\dodoifpositionsonsamepageelse\realpageno} %D Plugins: @@ -796,6 +776,11 @@ \let\MPanchor\MPpos +%D \macros +%D {POSp, POSx, POSy, POSh, POSd, POSw} +%D +%D This is obsolete in \MKIV: + \let\POSp\MPp \let\POSx\MPx \let\POSy\MPy \let\POSh\MPh \let\POSd\MPd \let\POSw\MPw diff --git a/tex/context/base/cont-cs.mkii b/tex/context/base/cont-cs.mkii index 82980acc2..714bf9568 100644 --- a/tex/context/base/cont-cs.mkii +++ b/tex/context/base/cont-cs.mkii @@ -11,16 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{czech} +\catcode`\{=1 \catcode`\}=2 -\input context.mkii - -\unprotect +\def\defaultinterface {czech} +\def\defaultlanguagetag{cs} -\setupcurrentlanguage[\s!cs] - -\ifnum\texengine=\luatexengine \else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi +\input context.mkii -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-cs.mkiv b/tex/context/base/cont-cs.mkiv index 552bc5f51..e1805b1c9 100644 --- a/tex/context/base/cont-cs.mkiv +++ b/tex/context/base/cont-cs.mkiv @@ -11,12 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{czech} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {czech} +\def\defaultlanguagetag{cs} -\setupcurrentlanguage[\s!cs] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-de.mkii b/tex/context/base/cont-de.mkii index 3aec10a93..a110f67d2 100644 --- a/tex/context/base/cont-de.mkii +++ b/tex/context/base/cont-de.mkii @@ -11,16 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{german} +\catcode`\{=1 \catcode`\}=2 -\input context.mkii - -\unprotect +\def\defaultinterface {german} +\def\defaultlanguagetag{de} -\setupcurrentlanguage[\s!de] - -\ifnum\texengine=\luatexengine \else - \setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt] -\fi +\input context.mkii -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-de.mkiv b/tex/context/base/cont-de.mkiv index 43251a206..1f4179781 100644 --- a/tex/context/base/cont-de.mkiv +++ b/tex/context/base/cont-de.mkiv @@ -11,12 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{german} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {german} +\def\defaultlanguagetag{de} -\setupcurrentlanguage[\s!de] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-en.mkii b/tex/context/base/cont-en.mkii index 5e91365bd..c3d510f98 100644 --- a/tex/context/base/cont-en.mkii +++ b/tex/context/base/cont-en.mkii @@ -11,18 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{english} +\catcode`\{=1 \catcode`\}=2 -\input context.mkii - -\unprotect - -\setupcurrentlanguage[\s!en] +\def\defaultinterface {english} +\def\defaultlanguagetag{en} -\setupencoding[default=ec] - -\usetypescript[fallback][\defaultencoding] - -\setupbodyfont[rm,12pt] +\input context.mkii -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-en.mkiv b/tex/context/base/cont-en.mkiv index 88724ca8f..1bf182cd8 100644 --- a/tex/context/base/cont-en.mkiv +++ b/tex/context/base/cont-en.mkiv @@ -11,12 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{english} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {english} +\def\defaultlanguagetag{en} -\setupcurrentlanguage[\s!en] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-fr.mkii b/tex/context/base/cont-fr.mkii index aea4cb625..6f1e806ad 100644 --- a/tex/context/base/cont-fr.mkii +++ b/tex/context/base/cont-fr.mkii @@ -11,18 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{french} +\catcode`\{=1 \catcode`\}=2 -\input context.mkii - -\unprotect - -\setupcurrentlanguage[\s!fr] +\def\defaultinterface {french} +\def\defaultlanguagetag{fr} -\setupencoding[default=ec] - -\usetypescript[fallback][\defaultencoding] - -\setupbodyfont[rm,12pt] +\input context.mkii -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-fr.mkiv b/tex/context/base/cont-fr.mkiv index 5de684314..5b0946625 100644 --- a/tex/context/base/cont-fr.mkiv +++ b/tex/context/base/cont-fr.mkiv @@ -11,12 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{french} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {french} +\def\defaultlanguagetag{fr} -\setupcurrentlanguage[\s!fr] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-gb.mkii b/tex/context/base/cont-gb.mkii index 24f52416d..35b7c85a4 100644 --- a/tex/context/base/cont-gb.mkii +++ b/tex/context/base/cont-gb.mkii @@ -11,18 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{english} +\catcode`\{=1 \catcode`\}=2 -\input context.mkii - -\unprotect - -\setupcurrentlanguage[\s!gb] +\def\defaultinterface {english} +\def\defaultlanguagetag{gb} -\setupencoding[default=ec] - -\usetypescript[fallback][\defaultencoding] - -\setupbodyfont[rm,12pt] +\input context.mkii -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-gb.mkiv b/tex/context/base/cont-gb.mkiv index ed4f65b66..3a4ed609b 100644 --- a/tex/context/base/cont-gb.mkiv +++ b/tex/context/base/cont-gb.mkiv @@ -11,12 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{english} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {english} +\def\defaultlanguagetag{gb} -\setupcurrentlanguage[\s!gb] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-it.mkii b/tex/context/base/cont-it.mkii index 5c8163a4e..c594a0659 100644 --- a/tex/context/base/cont-it.mkii +++ b/tex/context/base/cont-it.mkii @@ -11,18 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{italian} +\catcode`\{=1 \catcode`\}=2 -\input context.mkii - -\unprotect - -\setupcurrentlanguage[\s!it] +\def\defaultinterface {italian} +\def\defaultlanguagetag{it} -\setupencoding[default=ec] - -\usetypescript[fallback][\defaultencoding] - -\setupbodyfont[rm,12pt] +\input context.mkii -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-it.mkiv b/tex/context/base/cont-it.mkiv index 02e831891..af7a1149e 100644 --- a/tex/context/base/cont-it.mkiv +++ b/tex/context/base/cont-it.mkiv @@ -11,12 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{italian} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {italian} +\def\defaultlanguagetag{it} -\setupcurrentlanguage[\s!it] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 6a0b1b2c1..fb3fe8419 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.01.25 10:40} +\newcontextversion{2011.01.26 09:01} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 2bac5c141..e68e2b158 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.01.25 10:40} +\newcontextversion{2011.01.26 09:01} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-nl.mkii b/tex/context/base/cont-nl.mkii index f013c0d79..925ec8999 100644 --- a/tex/context/base/cont-nl.mkii +++ b/tex/context/base/cont-nl.mkii @@ -11,18 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{dutch} +\catcode`\{=1 \catcode`\}=2 -\input context.mkii - -\unprotect - -\setupcurrentlanguage[\s!nl] +\def\defaultinterface {dutch} +\def\defaultlanguagetag{nl} -\setupencoding[default=ec] - -\usetypescript[fallback][\defaultencoding] - -\setupbodyfont[rm,12pt] +\input context.mkii -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-nl.mkiv b/tex/context/base/cont-nl.mkiv index 4b64b6aeb..f6d2671e3 100644 --- a/tex/context/base/cont-nl.mkiv +++ b/tex/context/base/cont-nl.mkiv @@ -11,12 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{dutch} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {dutch} +\def\defaultlanguagetag{nl} -\setupcurrentlanguage[\s!nl] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-pe.mkiv b/tex/context/base/cont-pe.mkiv index a6f259ea4..e65ad1328 100644 --- a/tex/context/base/cont-pe.mkiv +++ b/tex/context/base/cont-pe.mkiv @@ -11,12 +11,12 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{persian} \def\messageinterface{english} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {persian} +\def\messageinterface {english} +\def\defaultlanguagetag{pe} -\setupcurrentlanguage[\s!pe] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/cont-ro.mkii b/tex/context/base/cont-ro.mkii index 84c31167b..595613194 100644 --- a/tex/context/base/cont-ro.mkii +++ b/tex/context/base/cont-ro.mkii @@ -11,18 +11,12 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{romanian} +\catcode`\{=1 \catcode`\}=2 -\input context.mkii - -\unprotect - -\setupcurrentlanguage[\s!ro] +\def\defaultinterface {romanian} +\def\defaultlanguagetag{ro} -\setupencoding[default=ec] - -\usetypescript[fallback][\defaultencoding] +\input context.mkii -\setupbodyfont[rm,12pt] +\endinput -\protect \errorstopmode \dump \endinput diff --git a/tex/context/base/cont-ro.mkiv b/tex/context/base/cont-ro.mkiv index d52bd1e3a..90bbc27dc 100644 --- a/tex/context/base/cont-ro.mkiv +++ b/tex/context/base/cont-ro.mkiv @@ -11,12 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{romanian} +\catcode`\{=1 \catcode`\}=2 -\input context.mkiv - -\unprotect +\def\defaultinterface {romanian} +\def\defaultlanguagetag{ro} -\setupcurrentlanguage[\s!ro] +\input context.mkiv -\protect \errorstopmode \dump \endinput +\endinput diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 153cb77aa..31f00884a 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.01.25 10:40} +\edef\contextversion{2011.01.26 09:01} %D For those who want to use this: @@ -44,6 +44,15 @@ %D minimal as possible. \loadmarkfile{syst-ini} + +%D Some checking (more primitives are now defined): + +\ifdefined\defaultinterface \else \def\defaultinterface {english} \fi +%ifdefined\messageinterface \else \let\messageinterface \defaultinterface \fi +\ifdefined\defaultlanguagetag \else \def\defaultlanguagetag{en} \fi + +%D More core code. + \loadmarkfile{syst-pln} \loadmarkfile{norm-tex} @@ -416,3 +425,13 @@ %D \item \type{cont-new}: new macro implementations (for testing) %D \item \type{cont-fil}: filename and module synonyms %D \stopitemize + +\setupcurrentlanguage[\defaultlanguagetag] + +\setupencoding[default=ec] + +\usetypescript[fallback][\defaultencoding] + +\setupbodyfont[rm,12pt] + +\errorstopmode \dump \endinput diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 285e4a98b..dfd67c6a2 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.01.25 10:40} +\edef\contextversion{2011.01.26 09:01} %D For those who want to use this: @@ -45,6 +45,12 @@ \loadmarkfile{syst-ini} +%D Some checking (more primitives are now defined): + +\ifdefined\defaultinterface \else \def\defaultinterface {english} \fi +%ifdefined\messageinterface \else \let\messageinterface \defaultinterface \fi +\ifdefined\defaultlanguagetag \else \def\defaultlanguagetag{en} \fi + %D We just quit if new functionality is expected. \ifnum\luatexversion<60 % also change message @@ -394,9 +400,7 @@ \loadmarkfile{back-exp} -\unprotect - -\setupcurrentlanguage[\s!en] +\setupcurrentlanguage[\defaultlanguagetag] \prependtoks \ctxlua{statistics.starttiming(statistics)}% @@ -410,4 +414,4 @@ \ctxlua{statistics.savefmtstatus("\jobname","\contextversion","context.mkiv")}% can become automatic \to \everydump -\protect \errorstopmode \dump \endinput +\errorstopmode \dump \endinput diff --git a/tex/context/base/context.rme b/tex/context/base/context.rme index 1b1e48902..1ce6b25c0 100644 --- a/tex/context/base/context.rme +++ b/tex/context/base/context.rme @@ -1,85 +1,79 @@ Some Basic information ---------------------- -There are currently three interfaces available: +The first public versions of ConTeXt date from around 1996. There +are currently two versions of ConTeXt: - cont-en the english version - cont-de the german version - cont-nl the dutch version - cont-cz the czech version - cont-ro the romanian version - cont-it the italian version + MkII: to be used with pdfTeX and XeTeX + MkIV: to be used with LuaTeX -One should compile one of these (or all) into a fmt file. -When one uses the main file, +In 2008 at the second ConTeXt conference the decision was made to +freeze MkII. This means that only bugs are fixed and apart from an +occasional addition no active development takes place. This is no +real problem as the engines don't change much either. - context the undefined version +Early 2011 the code base between MkII and MkIV got split completely +and there is no shared code any longer, apart from some styles and +modules. -TeX ask for an interface language as well as a message -language. Here one has to specify the full name (english, -german, dutch, etc.) or use the default (enter). The \ -savest way to update the TeX and MetaPost format files -is to use TeXExec: +The main files context.mkii and context.mkiv are normally not used +directly but instead we use the interface specific formats: -texexec --make --alone en nl metafun + cont-cs czech + cont-de german + cont-en english us + cont-fr french + cont-gb english uk + cont-it italian + cont-nl dutch + cont-pe persian + cont-ro romanian -In the TeXExec manual you can read how to generate a format -with specific fonts and patterns. +A MkII format is made with: -By default only the english hyphenation patterns are loaded, -unless more are enabled in: + texexec --make en nl metafun - cont-usr the typesetting language specifications +A MkIV format is made with: -Furthermore, users can preset commands etc in the file + context --make en nl - cont-sys a system file loaded at runtime +As MetaPost is part of LuaTeX there is no need for a special MetaFun +format. Also, when you update ConTeXt, a new format will be generated +automatically. -For questions and remarks on ConTeXt, one can subscribe to -the list: +You can preset commands etc in the file: - ntg-context@ntg.nl + cont-sys.mkii a system file loaded at runtime + cont-sys.mkiv a system file loaded at runtime -by sending the message - - subscribe ntg-context +In the case of MkII, there is a fallback on cont-sys.tex (backward +compatibility). If no file is found the file cont-sys.rme is loaded +(only for MkII). For MkIV this file is normally not needed. -to the list server: +For questions and remarks on ConTeXt, one can subscribe to the list: - majordomo@ntg.nl + ntg-context@ntg.nl -One can find more info at: - - www.pragma-ade.com +by sending the message -or at the mirror sites mentioned there. + subscribe ntg-context -Don't hesitate to ask questions. ConTeXt can do a lot, and -the manuals are always a bit behind and incomplete. Also take -a look at the files +to the list server: - mreadme.pdf - minstall.pdf - mtexexec.pdf - mtexutil.pdf + majordomo@ntg.nl -The teTeX, fpTeX, and 4TeX distributions demonstrate how -ConTeXt can be integrated in a TeX directory structure. +A good place to get information is the ConTeXt wiki: -------------------------- + contextgarden.net -functionality removed from mkiv: +One can also find more info at: -page-log : layers can do teh same and are more flexible -core-dat : just use lua for database purposes -core-swd : this was a temporary solution + www.pragma-ade.com -functionality changed in mkii and mkiv: +or at the mirror sites mentioned there. -xtag-map : no longer preloaded -xtag-stk : no longer preloaded -xtag-prs : no longer preloaded +Don't hesitate to ask questions. ConTeXt can do a lot, but the manuals +always lag behind and can be incomplete. ------------------------- - Hans Hagen, pragma@wxs.nl diff --git a/tex/context/base/core-env.lua b/tex/context/base/core-env.lua index d0db40b81..5545b5d32 100644 --- a/tex/context/base/core-env.lua +++ b/tex/context/base/core-env.lua @@ -13,6 +13,8 @@ if not modules then modules = { } end modules ['core-env'] = { local csname_id, texcount, create = token.csname_id, tex.count, token.create +local P, C, S, Cc, lpegmatch, patterns = lpeg.P, lpeg.C, lpeg.S, lpeg.Cc, lpeg.match, lpeg.patterns + local undefined = csname_id("*undefined*crap*") local iftrue = create("iftrue")[2] -- inefficient hack @@ -83,3 +85,21 @@ setmetatable(tex.ifs, { return csname_id(k) ~= undefined and create(k)[2] == iftrue -- inefficient, this create, we need a helper end }) + +---- arg = P("{") * C(patterns.nested) * P("}") + Cc("") + +local sep = S("), ") +local str = C((1-sep)^1) +local tag = P("(") * C((1-S(")" ))^1) * P(")") +local arg = P("(") * C((1-S("){"))^1) * P("{") * C((1-P("}"))^0) * P("}") * P(")") + +local pattern = ( + P("lua") * tag / context.luasetup + + P("xml") * arg / context.setupwithargument -- or xmlw as xmlsetup has swapped arguments + + (P("tex") * tag + str) / context.texsetup + + sep^1 +)^1 + +function commands.autosetups(str) + lpegmatch(pattern,str) +end diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv index 250356a35..1b70e983f 100644 --- a/tex/context/base/core-env.mkiv +++ b/tex/context/base/core-env.mkiv @@ -240,6 +240,15 @@ \fi \endcsname\empty} % takes one argument +% We can consider: +% +% \setvalue{\??su->\v!auto}#1{\ctxlua{commands.autosetup("#1")}} +% +% ":\letterpercent" => "->\v!auto" with "\endcsname{#1}" +% +% but it won't work out well with multiple setups (intercepted at the +% lua end) that then get only one argument. + % the next one is meant for \c!setups situations, hence the check for % a shortcut @@ -249,13 +258,25 @@ \dodoprocesslocalsetups \fi} +% \def\dodoprocesslocalsetups +% {\@EA\processcommalist\@EA[\tobeprocessedsetups]\dosetups} + +% setups=S1 +% setups=lua(S2) +% setups=S3 +% setups={S1,lua(S2),xml(test{123}),S3} + \def\dodoprocesslocalsetups - {\@EA\processcommalist\@EA[\tobeprocessedsetups]\dosetups} + {\ctxlua{commands.autosetups("\tobeprocessedsetups")}} + +\def\autosetups#1% + {\ctxlua{commands.autosetups("#1")}} \edef\setupwithargument#1% saves a few expansions {\noexpand\csname\??su:\noexpand\ifcsname\??su:#1\endcsname#1\noexpand\else\letterpercent\noexpand\fi\endcsname} \let\directsetup\dosetups +\let\texsetup \dosetups % nicer than \directsetup and more en par with xmlsetup and luasetup \def\doifsetupselse#1% to be done: grid {\doifdefinedelse{\??su:#1}} % doto: ifcsname diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index c1231fb81..ac7334c10 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -957,14 +957,14 @@ function fonts.definetypeface(name,t) elseif t then if type(t) == "string" then -- "abc", "k=v,..." - t = utilities.parsers.settings_to_hash(name) + t = settings_to_hash(name) else -- "abc", {k=v,...} end t.name = t.name or name else -- "name=abc,k=v,..." - t = utilities.parsers.settings_to_hash(name) + t = settings_to_hash(name) end local p = t.preset and fonts.typefaces[t.preset] or { } local name = t.name or "unknowntypeface" diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index ffd099318..5435de545 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -2093,19 +2093,25 @@ \ctxlua{fonts.definers.resetnullfont()}% in luatex 0.70 this will also do the previous \globallet\resetnullfont\relax} -% \newconditional\fontsareloaded - % \def\preloaddefaultfonts % {\resetpreloadfonts -% \usetypescript[modern]% -% \setuptypeface[modern]% -% %\setupbodyfont[modern]% +% \setupbodyfont[modern,\fontstyle,\fontbody]% % \showmessage\m!fonts6{\normalizedbodyfontsize\normalspace\fontstyle}} \def\preloaddefaultfonts {\resetpreloadfonts \setupbodyfont[modern,\fontstyle,\fontbody]% - \showmessage\m!fonts6{\normalizedbodyfontsize\normalspace\fontstyle}} + \showmessage\m!fonts6{fallback modern \fontstyle\normalspace\normalizedbodyfontsize}} + +\def\preloaddefaultfontsmm + {\writestatus\m!fonts{preloading latin modern fonts (math)}% + \definetypeface[\fontclass][\c!mm][\s!math][modern][\s!default]% + \showmessage\m!fonts6{fallback modern mm \normalizedbodyfontsize}} + +\def\preloaddefaultfontstt + {\writestatus\m!fonts{preloading latin modern fonts (mono)}% + \definetypeface[\fontclass][\c!tt][\s!mono][modern][\s!default]% + \showmessage\m!fonts6{fallback modern tt \normalizedbodyfontsize}} \def\resetpreloadfonts {\global\let\firststagepreloadfonts \relax @@ -2125,12 +2131,29 @@ {\writestatus\m!fonts{preloading latin modern fonts (second stage)}% \preloaddefaultfonts} +% \def\thirdstagepreloadfonts +% {\ifx\fontclass\empty +% \writestatus\m!fonts{preloading latin modern fonts (third stage)}% +% \preloaddefaultfonts +% \else +% \resetpreloadfonts +% \fi} + \def\thirdstagepreloadfonts {\ifx\fontclass\empty \writestatus\m!fonts{preloading latin modern fonts (third stage)}% \preloaddefaultfonts \else \resetpreloadfonts + \pushmacro\fontstyle + \ifcsname\fontclass\c!mm\s!features\endcsname \else + \preloaddefaultfontsmm + \fi + \ifcsname\fontclass\c!tt\s!features\endcsname \else + \preloaddefaultfontstt + \fi + \popmacro\fontstyle + \setupbodyfont[\fontstyle]% \fi} \def\fourthstagepreloadfonts @@ -2150,21 +2173,6 @@ %D handle changes in size as well as returning to the global %D bodyfont size. -% \def\dosetfont#1#2% #1 = set/switch state -% {\doifelse{#2}\v!global -% {\restoreglobalbodyfont} -% {\processcommacommand[#2]{\dodosetfont{#1}}% ##1 get also passed -% \ifproductionrun -% \thirdstagepreloadfonts -% \doswitchpoints[\normalizedbodyfontsize]% -% \doswitchstyle[\fontstyle]% -% \ifx\defaultfontclass\empty -% \let\defaultfontclass\fontclass -% \fi -% \fi}% -% \currentxfontsize\zerocount} - - \def\dosetfont#1#2% #1 = set/switch state {\doifelse{#2}\v!global {\restoreglobalbodyfont} diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua index 7b535d1b1..0d96d8086 100644 --- a/tex/context/base/lpdf-wid.lua +++ b/tex/context/base/lpdf-wid.lua @@ -163,6 +163,23 @@ local nofattachments, attachments, filestreams = 0, { }, { } -- todo: hash and embed once +local function flushembeddedfiles() + if next(filestreams) then + local e = pdfarray() + for name, reference in next, filestreams do + if reference then + e[#e+1] = pdfstring(name) + e[#e+1] = reference -- already a reference + else + -- we can issue a message + end + end + lpdf.addtonames("EmbeddedFiles",pdfreference(pdfflushobject(pdfdictionary{ Names = e }))) + end +end + +lpdf.registerdocumentfinalizer(flushembeddedfiles,"embeddedfiles") + function codeinjections.embedfile(filename) local r = filestreams[filename] if r == false then diff --git a/tex/context/base/pack-obj.mkiv b/tex/context/base/pack-obj.mkiv index 6af439021..3d87f52b5 100644 --- a/tex/context/base/pack-obj.mkiv +++ b/tex/context/base/pack-obj.mkiv @@ -265,49 +265,55 @@ {\globalpopmacro\crossreferenceobject \dododosetobject{#1}{#2}{#3}\egroup}} -% \def\dododosetobject#1#2#3% -% {\begingroup -% \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox -% \scratchdimen\objectoffset -% \@EA\xdef\csname\r!object#2::#3\endcsname -% {\noexpand\dohandleobject{#2}{#3}% -% {\ifhbox\nextbox\hbox\else\vbox\fi}% -% {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% -% {\number\scratchdimen}}% -% \expanded % freeze the dimensions since \dostartobject may use \nextbox -% {\dostartobject{#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% -% \ifcase#1\relax\else \ifdim\objectoffset>\zeropoint -% \setbox\nextbox\vbox spread 2\scratchdimen -% {\forgetall \offinterlineskip -% \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% -% \fi \fi -% \flushnextbox -% \dostopobject -% \endgroup} +\ifnum\luatexversion<66 + + \def\dododosetobject#1#2#3% this is a hack: luatex adds 1bp around each side + {\begingroup + \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox + \ifcase#1\relax + \scratchdimen-\onebasepoint % compensates auto 1 bp + \else\ifdim\objectoffset>\zeropoint + \scratchdimen \objectoffset + \else + \scratchdimen-\onebasepoint % compensates auto 1 bp + \fi\fi + \@EA\xdef\csname\r!object#2::#3\endcsname + {\noexpand\dohandleobject{#2}{#3}% + {\ifhbox\nextbox\hbox\else\vbox\fi}% + {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% + {\number\scratchdimen}}% + \expanded % freeze the dimensions since \dostartobject may use \nextbox + {\dostartobject{#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% + \setbox\nextbox\vbox spread 2\scratchdimen + {\forgetall \offinterlineskip + \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% + \flushnextbox + \dostopobject + \endgroup} + +\else + + \def\dododosetobject#1#2#3% + {\begingroup + \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox + \scratchdimen\objectoffset + \@EA\xdef\csname\r!object#2::#3\endcsname + {\noexpand\dohandleobject{#2}{#3}% + {\ifhbox\nextbox\hbox\else\vbox\fi}% + {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% + {\number\scratchdimen}}% + \expanded % freeze the dimensions since \dostartobject may use \nextbox + {\dostartobject{#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% + \ifcase#1\relax\else \ifdim\objectoffset>\zeropoint + \setbox\nextbox\vbox spread 2\scratchdimen + {\forgetall \offinterlineskip + \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% + \fi \fi + \flushnextbox + \dostopobject + \endgroup} -\def\dododosetobject#1#2#3% this is a hack: luatex adds 1bp around each side - {\begingroup - \dontshowcomposition % rather fuzzy in \setxvalue ... \hbox - \ifcase#1\relax - \scratchdimen-\onebasepoint % compensates auto 1 bp - \else\ifdim\objectoffset>\zeropoint - \scratchdimen \objectoffset - \else - \scratchdimen-\onebasepoint % compensates auto 1 bp - \fi\fi - \@EA\xdef\csname\r!object#2::#3\endcsname - {\noexpand\dohandleobject{#2}{#3}% - {\ifhbox\nextbox\hbox\else\vbox\fi}% - {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% - {\number\scratchdimen}}% - \expanded % freeze the dimensions since \dostartobject may use \nextbox - {\dostartobject{#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% - \setbox\nextbox\vbox spread 2\scratchdimen - {\forgetall \offinterlineskip - \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% - \flushnextbox - \dostopobject - \endgroup} +\fi \def\getobject#1#2% {\begingroup diff --git a/tex/context/base/s-inf-01.mkiv b/tex/context/base/s-inf-01.mkvi index dc55735fe..d32356d69 100644 --- a/tex/context/base/s-inf-01.mkiv +++ b/tex/context/base/s-inf-01.mkvi @@ -13,6 +13,14 @@ %D Some day I will generalize this table mechanism. This list is only %D right when run in the minimals as my machine might have more files. +%D +%D Als, the remaining tex code can proably be lua also which is more +%D consistent. +%D +%D \starttyping +%D context auto:s-inf-01 +%D context auto:s-inf-01 --basepath=t:/texmf/tex/context/base +%D \stoptyping \startluacode local format, gsub, find, match = string.format, string.gsub, string.find, string.match @@ -37,7 +45,7 @@ } local function collect(list,suffix,n) - local path = file.dirname(resolvers.find_file("context.mkiv"),".") + local path = document.arguments.basepath or file.dirname(resolvers.find_file("context.mkiv"),".") local pattern = path .. "/*." .. suffix local texfiles = dir.glob(pattern) for _, name in ipairs(texfiles) do @@ -107,7 +115,7 @@ for k, v in table.sortedpairs(what) do for i=1,5 do if v[i] > max then max = v[i] end end end - return max, what, function(n) return n/max end + return max, what, function(n) return max == 0 and 0 or n/max end end function document.context_state_1(what) @@ -168,49 +176,61 @@ \definecolor[bar:mkvi][middleyellow] \definecolor[bar:lua] [middlegray] -\def\Top#1#2#3#4% - {\hbox to 5em{\hss#3}% - \enspace -% \hbox to #2\dimexpr 20em\relax{#1\ifnum#3=#4\else~#4\rlap{~+}\fi\hss}} - \hbox {#1\ifnum#3=#4\else~#4\rlap{~+}\fi\hss}} - -\def\Bar#1#2#3#4% - {\ifcase#2\else - \hbox to 5em{\hss\ifcase#3\else\llap{-~}\fi#2}% - \enspace - \blackrule[color=bar:#1,width=#4\dimexpr 20em\relax,height=.8\strutht]% - \fi} - \newcount\UpCounter -\def\StartUp#1% - {\dontleavehmode\framed[frame=off,align={middle,low},height=18em]\bgroup - \def\StopUp - {\par\nointerlineskip\blackrule[height=1pt,width=4em,depth=0pt,color=darkgray]% - \par\tttf\strut#1\par - \egroup - \ifnum\UpCounter=17 \par \UpCounter\zerocount\else \kern1em \advance\UpCounter\plusone \fi}} - -\def\Up#1#2% - {\scratchdimen#2\dimexpr 16em\relax - \ifdim\scratchdimen=\zeropoint - \kern1em - \else - \ifdim\scratchdimen<\onepoint \scratchdimen\onepoint \fi - \blackrule[color=bar:#1,height=\scratchdimen,width=1em]% - \fi} - -\def\Show#1#2#3% - {\startTEXpage[offset=1em,width=fit] - \hbox{\tttf\strut\currentdate~-~#1} - \ctxlua{document.context_state_\number#2("#3")} - \stopTEXpage} +\starttexdefinition Top #what#fraction#total#bigones + \hbox to 5em{\hss#total}% + \enspace + \hbox {#what\ifnum#total=#bigones\else~#bigones\rlap{~+}\fi\hss}% +\stoptexdefinition + +\starttexdefinition Bar #color#size#nobigones#fraction + \ifcase#size\else + \hbox to 5em{\hss\ifcase#nobigones\else\llap{-~}\fi#size}% + \enspace + \blackrule[color=bar:#color,width=#fraction\dimexpr 20em\relax,height=.8\strutht]% + \fi +\stoptexdefinition + +\starttexdefinition StartUp #name + \def\UpName{#name}% + \dontleavehmode\framed[frame=off,align={middle,low},height=18em]\bgroup +\stoptexdefinition + +\starttexdefinition StopUp + \par\nointerlineskip\blackrule[height=1pt,width=4em,depth=0pt,color=darkgray] + \par\tttf\strut\UpName\par + \egroup + \ifnum\UpCounter=17 + \par \UpCounter\zerocount + \else + \kern1em \advance\UpCounter\plusone + \fi +\stoptexdefinition + +\starttexdefinition Up #color#width + \scratchdimen#width\dimexpr 16em\relax + \ifdim\scratchdimen=\zeropoint + \kern1em + \else + \ifdim\scratchdimen<\onepoint \scratchdimen\onepoint \fi + \blackrule[color=bar:#color,height=\scratchdimen,width=1em]% + \fi +\stoptexdefinition + +\starttexdefinition Show #title#how#what + \startTEXpage[offset=1em,width=fit] + \hbox{\tttf\strut\currentdate~-~#title} + \par + \ctxlua{document.context_state_\number#how("#what")} + \stopTEXpage +\stoptexdefinition % \doifnotmode{demo}{\endinput} \starttext \Show - {The number of files used in ConTeXt (modules and styles are excluded).} + {The number of files used in ConTeXt (base modules and styles).} {1}{number} \Show {The size of (core) files used in ConTeXt (- indicates exclusion of large data files; + indicates inclusion of large data files; comment and spaces removed.)} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differnew file mode 100644 index 000000000..a5b0a9e30 --- /dev/null +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/type-ini.mkiv b/tex/context/base/type-ini.mkiv index 298618a4a..b6942376e 100644 --- a/tex/context/base/type-ini.mkiv +++ b/tex/context/base/type-ini.mkiv @@ -456,7 +456,7 @@ \else\ifthirdargument \dododefinetypeface[#1][#2]% \getparameters[\??tf#1#2][#3]% - \else + \else % use definitions in lfg file \ctxlua{fonts.definetypeface(\!!bs#1\!!es,\!!bs#2\!!es)}% \fi\fi\fi} diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 7d33e2d05..5ad6a4edf 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 01/25/11 10:40:58 +-- merge date : 01/26/11 09:01:20 do -- begin closure to overcome local limits and interference |