diff options
author | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-28 22:57:04 +0000 |
---|---|---|
committer | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-28 22:57:04 +0000 |
commit | 3f188c7493724d0cf0660657c90ff9be76d29ddb (patch) | |
tree | 65d4f730463ab70db723009cc976047649fe49a5 /Master/texmf-dist/tex/context/base | |
parent | 9cc6cda737c19f4ca2e6af81ed487ae7e51bdbe6 (diff) |
ConTeXt 2012.05.29 00:12
git-svn-id: svn://tug.org/texlive/trunk@26706 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base')
34 files changed, 500 insertions, 338 deletions
diff --git a/Master/texmf-dist/tex/context/base/chem-str.mkiv b/Master/texmf-dist/tex/context/base/chem-str.mkiv index 197c13bc6a2..e74c268da68 100644 --- a/Master/texmf-dist/tex/context/base/chem-str.mkiv +++ b/Master/texmf-dist/tex/context/base/chem-str.mkiv @@ -49,13 +49,12 @@ \unprotect +\installcorenamespace{chemical} \installcorenamespace{chemicalsymbol} +\installcorenamespace{chemicalframed} +\installcorenamespace{chemicalsize} -\unexpanded\def\setupchemical - {\dosingleempty\dosetupchemical} - -\def\dosetupchemical - {\getparameters[\??cm]} +\installsimplecommandhandler \??chemical {chemical} \??chemical % no \define... \let\setupchemicals\setupchemical @@ -63,72 +62,91 @@ {\dosingleempty\dosetupchemicalframed} \def\dosetupchemicalframed - {\getparameters[\??cm:\c!frame]} - -\def\chemicalparameter#1{\csname\??cm#1\endcsname} + {\getparameters[\??chemicalframed]} -\unexpanded\def\definechemical - {\dosingleargument\dodefinechemical} % global +\unexpanded\def\definechemical % is global (so we don't use the commandhandler) + {\dosingleargument\chem_define} -\def\dodefinechemical[#1]#2% +\def\chem_define[#1]#2% {\startnointerference + \edef\currentdefinedchemical{#1}% + \let\chemical\chem_chemical_nested \ctxlua{chemicals.undefine("#1")}% - \def\chemical{\dodoubleempty\dostructurechemical}% - \def\dostructurechemical[##1][##2]{\ctxlua{chemicals.define("#1",\!!bs##1\!!es,\!!bs\detokenize{##2}\!!es)}}% #2% flush \stopnointerference} +\unexpanded\def\chem_chemical_nested + {\dodoubleempty\chem_chemical_nested_indeed} + +\def\chem_chemical_nested_indeed[#1][#2]% + {\ctxlua{chemicals.define("\currentdefinedchemical",\!!bs#1\!!es,\!!bs\detokenize{#2}\!!es)}} + +% chemical symbols + \unexpanded\def\definechemicalsymbol - {\dodoubleempty\dodefinechemicalsymbol} + {\dodoubleempty\chem_symbol_define} -\def\dodefinechemicalsymbol[#1][#2]% +\def\chem_symbol_define[#1][#2]% {\setvalue{\??chemicalsymbol#1}{#2}} \unexpanded\def\chemicalsymbol[#1]% - {\getvalue{\??chemicalsymbol#1}} + {\csname\??chemicalsymbol\ifcsname\??chemicalsymbol#1\endcsname\s!unknown\else#1\fi\endcsname} -% size (small medium big) +\definechemicalsymbol[\s!unknown][] % empty -\unexpanded\def\dosetchemicaltext - {\dousestyleparameter\@@cmstyle - \dousecolorparameter\@@cmcolor} +% size (small medium big) \edef\chemicaltoplocation{t} \edef\chemicalbotlocation{b} -\def\dochemicaltext#1% in ppchtex we had a more clever alignment - {\dosetchemicaltext\strut#1} % maybe also \setstrut +\def\chem_text#1% in ppchtex we had a more clever alignment + {\usechemicalstyleandcolor\c!style\c!color + \strut + #1} % maybe also \setstrut + +\def\chem_text#1% + {\mathematics + {\usechemicalstyleandcolor\c!style\c!color + \strut + \ifcase\currentxfontsize\or\scriptstyle\or\scriptscriptstyle\fi + #1}} -\def\dochemicaltext#1% - {\mathematics{\dosetchemicaltext\strut\ifcase\currentxfontsize\or\scriptstyle\or\scriptscriptstyle\fi#1}} +\setvalue{\??chemicalsize\v!small }{\txx} +\setvalue{\??chemicalsize\v!medium}{\tx} +\setvalue{\??chemicalsize\v!big }{} +\newtoks \everychemical +\newtoks \everystructurechemical \newconditional\indisplaychemical -\unexpanded\def\startchemical - {\dosingleempty\dostartchemical} +\newtoks \t_chem_every_box +\newbox \b_chem_result +\newconditional\c_chem_some_text +\newdimen \d_chem_width +\newdimen \d_chem_height +\newdimen \d_chem_depth -\setvalue{\??cm:\c!size:\v!small }{\txx} -\setvalue{\??cm:\c!size:\v!medium}{\tx} -\setvalue{\??cm:\c!size:\v!big }{} +\unexpanded\def\startchemical + {\dodoubleempty\chem_start} -\newtoks \everychemical -\newtoks \everystructurechemical -\newtoks \withchemicalbox -\newbox \chemicalbox -\newconditional\somechemicaltext -\newdimen \chemicalwidth -\newdimen \chemicalheight -\newdimen \chemicaldepth - -\def\dostartchemical[#1]% +\def\chem_start[#1][#2]% {\ifmmode\vcenter\else\vbox\fi \bgroup \dontcomplain \settrue\indisplaychemical \forgetall - \getparameters[\??cm][#1]% + \ifsecondargument + \doifassignmentelse{#1} + {\setupcurrentchemical[#1]}% same as \currentchemical + {\edef\currentchemical{#1}% + \setupcurrentchemical[#2]}% + \else\iffirstargument + \doifassignmentelse{#1} + {\setupcurrentchemical[#1]}% same as \currentchemical + {\edef\currentchemical{#1}}% + \fi\fi \the\everystructurechemical - \setbox\chemicalbox\hbox\bgroup + \setbox\b_chem_result\hbox\bgroup \ctxlua{chemicals.start { width = "\chemicalparameter\c!width", height = "\chemicalparameter\c!height", @@ -146,41 +164,41 @@ {\stopnointerference \ctxlua{chemicals.stop()}% \egroup - \chemicalwidth \wd\chemicalbox - \chemicalheight\ht\chemicalbox - \chemicaldepth \dp\chemicalbox - \the\withchemicalbox - \doifelsenothing{\chemicalparameter\c!frame}\handlechemicalframednop\handlechemicalframedyes + \d_chem_width \wd\b_chem_result + \d_chem_height\ht\b_chem_result + \d_chem_depth \dp\b_chem_result + \the\t_chem_every_box + \doifelsenothing{\chemicalparameter\c!frame}\chem_framed_nop\chem_framed_yes \egroup} -\def\handlechemicalframedyes +\def\chem_framed_yes {\localframed% - [\??cm:\c!frame]% - [\c!frame=\chemicalparameter\c!frame,\c!align=\v!normal,\c!strut=\v!no]{\vbox{\box\chemicalbox\vss}}} % remove depth + [\??chemicalframed]% + [\c!frame=\chemicalparameter\c!frame,\c!align=\v!normal,\c!strut=\v!no]{\vbox{\box\b_chem_result\vss}}} % remove depth -\def\handlechemicalframednop +\def\chem_framed_nop {\localframed% - [\??cm:\c!frame]% - [\c!align=\v!normal,\c!strut=\v!no]{\vbox{\box\chemicalbox\vss}}} % remove depth + [\??chemicalframed]% + [\c!align=\v!normal,\c!strut=\v!no]{\vbox{\box\b_chem_result\vss}}} % remove depth \let\startstructurechemical\startchemical \let\stopstructurechemical \stopchemical \unexpanded\def\structurechemical - {\dotripleempty\dostructurechemical} + {\dotripleempty\strc_chem_indeed} \appendtoks \let\chemical\structurechemical \to\everystructurechemical -\def\dostructurechemical +\def\strc_chem_indeed {\ifthirdargument - \expandafter\dostructurechemicalthree + \expandafter\strc_chem_indeed_three \else - \expandafter\dostructurechemicaltwo + \expandafter\strc_chem_indeed_two \fi} -\def\dostructurechemicalthree[#1][#2][#3]% +\def\strc_chem_indeed_three[#1][#2][#3]% {\writestatus\m!chemicals{hyperlinked chemicals not yet supported}% todo reference, for the moment ignored \ctxlua{chemicals.component(\!!bs#2\!!es, \!!bs\detokenize{#3}\!!es, { % maybe also pass first two args this way rulethickness = "\the\dimexpr\chemicalparameter\c!rulethickness\relax", % todo: scaled points @@ -188,7 +206,7 @@ } ) }% \ignorespaces} -\def\dostructurechemicaltwo[#1][#2]% +\def\strc_chem_indeed_two[#1][#2]% {\ctxlua{chemicals.component(\!!bs#1\!!es,\!!bs\detokenize{#2}\!!es, { % maybe also pass first two args this way rulethickness = "\the\dimexpr\chemicalparameter\c!rulethickness\relax", % todo: scaled points rulecolor = "\MPcolor{\chemicalparameter\c!rulecolor}" % we can precalculate this for speedup @@ -196,66 +214,66 @@ \ignorespaces} \appendtoks - \setbox\chemicalbox\hbox{\raise\MPlly\box\chemicalbox}% - \chemicalwidth \wd\chemicalbox - \chemicalheight\ht\chemicalbox - \chemicaldepth \dp\chemicalbox -\to \withchemicalbox + \setbox\b_chem_result\hbox{\raise\MPlly\box\b_chem_result}% + \d_chem_width \wd\b_chem_result + \d_chem_height\ht\b_chem_result + \d_chem_depth \dp\b_chem_result +\to \t_chem_every_box % kind of compatible, but text sizes instead of math sizes (i.e. tx is larger than scriptsize) \appendtoks - \edef\chemicalbodyfont{\chemicalparameter\c!bodyfont}% + \edef\chemicalbodyfont{\chemicalparameter\c!bodyfont}% public? \ifx\chemicalbodyfont\empty \switchtobodyfont[\chemicalbodyfont]% \fi - \getvalue{\??cm:\c!size:\chemicalparameter\c!size}% + \getvalue{\??chemicalsize\chemicalparameter\c!size}% % \to \everystructurechemical \to \everychemical -\def\chemicaltoptext#1{\global\settrue\somechemicaltext\gdef\thetoptext{#1}\ignorespaces} -\def\chemicalbottext#1{\global\settrue\somechemicaltext\gdef\thebottext{#1}\ignorespaces} -\def\chemicalmidtext#1{\global\settrue\somechemicaltext\gdef\themidtext{#1}\ignorespaces} +\def\chemicaltoptext#1{\global\settrue\c_chem_some_text\gdef\m_chem_top_text{#1}\ignorespaces} +\def\chemicalbottext#1{\global\settrue\c_chem_some_text\gdef\m_chem_bot_text{#1}\ignorespaces} +\def\chemicalmidtext#1{\global\settrue\c_chem_some_text\gdef\m_chem_mid_text{#1}\ignorespaces} \appendtoks - \let\toptext\chemicaltoptext \glet\thetoptext\empty - \let\bottext\chemicalbottext \glet\thebottext\empty - \let\midtext\chemicalmidtext \glet\themidtext\empty - \global\setfalse\somechemicaltext + \let\toptext\chemicaltoptext \glet\m_chem_top_text\empty + \let\bottext\chemicalbottext \glet\m_chem_bot_text\empty + \let\midtext\chemicalmidtext \glet\m_chem_mid_text\empty + \global\setfalse\c_chem_some_text \to \everystructurechemical \def\doaddchemicaltexts - {\setbox2\hbox to \chemicalwidth{\strut\hss\hbox{\strut\themidtext}\hss}% - \setbox4\hbox to \chemicalwidth{\strut\hss\hbox{\strut\thetoptext}\hss}% - \setbox6\hbox to \chemicalwidth{\strut\hss\hbox{\strut\thebottext}\hss}% - \setbox\chemicalbox\hbox \bgroup - \box\chemicalbox - \hskip-\chemicalwidth - \raise\chemicalheight\hbox{\lower\ht4\box4}% - \hskip-\chemicalwidth + {\setbox2\hbox to \d_chem_width{\strut\hss\hbox{\strut\m_chem_mid_text}\hss}% + \setbox4\hbox to \d_chem_width{\strut\hss\hbox{\strut\m_chem_top_text}\hss}% + \setbox6\hbox to \d_chem_width{\strut\hss\hbox{\strut\m_chem_bot_text}\hss}% + \setbox\b_chem_result\hbox \bgroup + \box\b_chem_result + \hskip-\d_chem_width + \raise\d_chem_height\hbox{\lower\ht4\box4}% + \hskip-\d_chem_width \lower.5\dimexpr\ht2-\dp2\relax\box2% - \hskip-\chemicalwidth - \lower\chemicaldepth \hbox{\raise\dp6\box6}% + \hskip-\d_chem_width + \lower\d_chem_depth \hbox{\raise\dp6\box6}% \hss \egroup} % text on top of chemicals \appendtoks - \ifconditional\somechemicaltext + \ifconditional\c_chem_some_text \doaddchemicaltexts - \chemicalwidth \wd\chemicalbox - \chemicalheight\ht\chemicalbox - \chemicaldepth \dp\chemicalbox + \d_chem_width \wd\b_chem_result + \d_chem_height\ht\b_chem_result + \d_chem_depth \dp\b_chem_result \fi -\to \withchemicalbox +\to \t_chem_every_box % todo: enspace or emspace \definechemicalsymbol[space] [\enspace\quad\enspace] \definechemicalsymbol[plus] [\enspace+\enspace] \definechemicalsymbol[minus] [\enspace-\enspace] -\definechemicalsymbol[gives] [\dochemicalarrow\xrightarrow] -\definechemicalsymbol[equilibrium] [\dochemicalarrow\xrightoverleftarrow] -\definechemicalsymbol[mesomeric] [\dochemicalarrow\xleftrightarrow] +\definechemicalsymbol[gives] [\chem_arrow_construct\xrightarrow] +\definechemicalsymbol[equilibrium] [\chem_arrow_construct\xrightoverleftarrow] +\definechemicalsymbol[mesomeric] [\chem_arrow_construct\xleftrightarrow] \definechemicalsymbol[opencomplex] [\mathematics{\Bigg[}] % not yet ok \definechemicalsymbol[closecomplex][\mathematics{\Bigg]}] % not yet ok @@ -268,32 +286,30 @@ \definechemicalsymbol[OPENCOMPLEX] [{\chemicalsymbol[opencomplex]}] \definechemicalsymbol[CLOSECOMPLEX][{\chemicalsymbol[closecomplex]}] -\def\dochemicalarrow#1#2#3% +\def\chem_arrow_construct#1#2#3% {\enspace \mathematics{#1% - {\strut\hbox \!!spread 2em{\hss\ctxlua{chemicals.inline(\!!bs#2\!!es)}\hss}}% - {\strut\hbox \!!spread 2em{\hss\ctxlua{chemicals.inline(\!!bs#3\!!es)}\hss}}}% -% {\strut\hbox \!!spread 2em{\hss#2\hss}}% -% {\strut\hbox \!!spread 2em{\hss#3\hss}}}% + {\strut\hbox \!!spread 2\emwidth{\hss\ctxlua{chemicals.inline(\!!bs#2\!!es)}\hss}}% {\strut\hbox \!!spread 2em{\hss#2\hss}}% + {\strut\hbox \!!spread 2\emwidth{\hss\ctxlua{chemicals.inline(\!!bs#3\!!es)}\hss}}}% {\strut\hbox \!!spread 2em{\hss#3\hss}}}% \enspace} % special macros (probably needs some more work) -\def\dochemicaltop#1#2#3#4% +\def\chem_top_construct#1#2#3#4% {\begingroup \setbox0\hbox{\tx\setstrut\strut#3}% \setbox2\hbox{\setstrut\strut\molecule{#4}}% \setbox0\hbox{\raise\dimexpr\dp0+\ht2\relax\hbox to \wd2{#1\box0#2}}% -% no: \smashbox0 + % no: \smashbox0 \hbox{\box0\box2}% \endgroup}% -\def\dochemicalbottom#1#2#3#4% +\def\chem_bottom_construct#1#2#3#4% {\begingroup \setbox0\hbox{\tx\setstrut\strut#3}% \setbox2\hbox{\setstrut\strut#4}% \setbox0\hbox{\lower\dimexpr\dp2+\ht0\relax\hbox to \wd2{#1\box0#2}}% -% no: \smashbox0 + % no: \smashbox0 \hbox{\box0\box2}% \endgroup}% @@ -307,12 +323,12 @@ \hbox{\setstrut\strut#2\rlap{\tx\setstrut\strut#1}}% \endgroup}% -\unexpanded\def\chemicaltop {\dochemicaltop \hss \hss } -\unexpanded\def\chemicallefttop {\dochemicaltop \relax \hss } -\unexpanded\def\chemicalrighttop {\dochemicaltop \hss \relax} -\unexpanded\def\chemicalbottom {\dochemicalbottom \hss \hss } -\unexpanded\def\chemicalleftbottom {\dochemicalbottom \relax \hss } -\unexpanded\def\chemicalrightbottom {\dochemicalbottom \hss \relax} +\unexpanded\def\chemicaltop {\chem_top_construct \hss \hss } +\unexpanded\def\chemicallefttop {\chem_top_construct \relax \hss } +\unexpanded\def\chemicalrighttop {\chem_top_construct \hss \relax} +\unexpanded\def\chemicalbottom {\chem_bottom_construct \hss \hss } +\unexpanded\def\chemicalleftbottom {\chem_bottom_construct \relax \hss } +\unexpanded\def\chemicalrightbottom {\chem_bottom_construct \hss \relax} \unexpanded\def\chemicaltopleft #1{\chemicalleft {\chemicalrighttop {#1}{}}} \unexpanded\def\chemicalbottomleft #1{\chemicalleft {\chemicalrightbottom{#1}{}}} @@ -330,7 +346,7 @@ \unexpanded\def\chemicalalignedtext#1#2#3% {\dontleavehmode \begingroup - \dosetchemicaltext + \usechemicalstyleandcolor\c!style\c!color \hbox to \fontcharwd\font`C{\setstrut\strut#1\molecule{#3}#2}% \endgroup} @@ -347,8 +363,8 @@ \unexpanded\def\chemicaloxidationplus {\dotriplegroupempty\chemicaloxidation{\textplus }} % {} needed! \unexpanded\def\chemicaloxidationminus{\dotriplegroupempty\chemicaloxidation{\textminus}} % {} needed! -\unexpanded\def\chemicalforeveropen {\dotriplegroupempty\chemicalleft {$\big[$}} % {} needed! -\unexpanded\def\chemicalforeverclose {\dotriplegroupempty\chemicalright {$\big]$}} % {} needed! +\unexpanded\def\chemicalforeveropen {\dotriplegroupempty\chemicalleft {$\big[$}} % {} needed! +\unexpanded\def\chemicalforeverclose {\dotriplegroupempty\chemicalright {$\big]$}} % {} needed! \unexpanded\def\chemicaloxidationone {\chemicaloxidation\relax1} \unexpanded\def\chemicaloxidationtwo {\chemicaloxidation\relax2} \unexpanded\def\chemicaloxidationthree{\chemicaloxidation\relax3} @@ -402,14 +418,14 @@ \expandafter\inlinechemical \fi} -\def\displaychemical - {\dotriplegroupempty\dodisplaychemical} +\unexpanded\def\displaychemical + {\dotriplegroupempty\chem_display} -\def\dodisplaychemical#1#2#3% todo: +\def\chem_display#1#2#3% todo: {\the\everychemical \everychemical\emptytoks \quad \vcenter\bgroup - \dosetchemicaltext + \usechemicalstyleandcolor\c!style\c!color \ifthirdargument \ifsecondargument \halign{&\hss##\hss\cr#2\cr\molecule{#1}\cr#3\cr}% @@ -422,10 +438,12 @@ \egroup \quad} -\def\inlinechemical#1% - {\dontleavehmode\hbox{\dosetchemicaltext\ctxlua{chemicals.inline(\!!bs#1\!!es)}}} +\unexpanded\def\inlinechemical#1% + {\dontleavehmode + \hbox{\usechemicalstyleandcolor\c!style\c!color\ctxlua{chemicals.inline(\!!bs#1\!!es)}}} -\def\chemicalbondrule{\hbox{\vrule\!!height.75ex\!!depth-\dimexpr.75ex-\linewidth\relax\!!width1em\relax}} +\unexpanded\def\chemicalbondrule + {\hbox{\vrule\!!height.75ex\!!depth-\dimexpr.75ex-\linewidth\relax\!!width1em\relax}} \definechemicalsymbol[i:space] [\enspace\quad\enspace] \definechemicalsymbol[i:plus] [\enspace\mathematics{+}\enspace] @@ -437,25 +455,25 @@ \definechemicalsymbol[i:tripple] [\hbox{\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}] \definechemicalsymbol[i:double] [\hbox{\chemicalbondrule\hskip-1em\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}] -\def\chemicalsinglebond {\chemicalsymbol[i:single]} -\def\chemicaldoublebond {\chemicalsymbol[i:tripple]} -\def\chemicaltriplebond {\chemicalsymbol[i:double]} -\def\chemicalgives {\chemicalsymbol[i:gives]} -\def\chemicalmesomeric {\chemicalsymbol[i:mesomeric]} -\def\chemicalequilibrium{\chemicalsymbol[i:equilibrium]} -\def\chemicalsplus {\chemicalsymbol[i:plus]} -\def\chemicalsminus {\chemicalsymbol[i:minus]} -\def\chemicalsspace {\chemicalsymbol[i:space]} -\def\chemicalinline #1{#1} +\unexpanded\def\chemicalsinglebond {\chemicalsymbol[i:single]} +\unexpanded\def\chemicaldoublebond {\chemicalsymbol[i:tripple]} +\unexpanded\def\chemicaltriplebond {\chemicalsymbol[i:double]} +\unexpanded\def\chemicalgives {\chemicalsymbol[i:gives]} +\unexpanded\def\chemicalmesomeric {\chemicalsymbol[i:mesomeric]} +\unexpanded\def\chemicalequilibrium{\chemicalsymbol[i:equilibrium]} +\unexpanded\def\chemicalsplus {\chemicalsymbol[i:plus]} +\unexpanded\def\chemicalsminus {\chemicalsymbol[i:minus]} +\unexpanded\def\chemicalsspace {\chemicalsymbol[i:space]} +\unexpanded\def\chemicalinline #1{#1} % display -\newconditional\formulachemicalhastop -\newconditional\formulachemicalhasbot +\newconditional\c_chem_has_top +\newconditional\c_chem_has_bot -\newtoks\formulachemicaltop -\newtoks\formulachemicalmid -\newtoks\formulachemicalbot +\newtoks\t_chem_top +\newtoks\t_chem_mid +\newtoks\t_chem_bot \newif\ifinchemicalformula @@ -465,81 +483,61 @@ \inchemicalformulatrue \the\everychemical \everychemical\emptytoks - \formulachemicaltop\emptytoks % not needed - \formulachemicalmid\emptytoks % not needed - \formulachemicalbot\emptytoks % not needed + \t_chem_top\emptytoks % not needed + \t_chem_mid\emptytoks % not needed + \t_chem_bot\emptytoks % not needed \let\chemical\formulachemical - \setfalse\formulachemicalhastop - \setfalse\formulachemicalhasbot } + \setfalse\c_chem_has_top + \setfalse\c_chem_has_bot} \unexpanded\def\stopchemicalformula {\tabskip1em\relax \nointerlineskip - \ifconditional\formulachemicalhastop - \ifconditional\formulachemicalhasbot - \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% + \ifconditional\c_chem_has_top + \ifconditional\c_chem_has_bot + \halign{&\hss\usechemicalstyleandcolor\c!style\c!color##\hss\cr\the\t_chem_top\cr\the\t_chem_mid\cr\the\t_chem_bot\cr}% \else - \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicaltop\cr\the\formulachemicalmid\cr}% + \halign{&\hss\usechemicalstyleandcolor\c!style\c!color##\hss\cr\the\t_chem_top\cr\the\t_chem_mid\cr}% \fi \else - \ifconditional\formulachemicalhasbot - \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicalmid\cr\the\formulachemicalbot\cr}% + \ifconditional\c_chem_has_bot + \halign{&\hss\usechemicalstyleandcolor\c!style\c!color##\hss\cr\the\t_chem_mid\cr\the\t_chem_bot\cr}% \else - \halign{&\hss\dosetchemicaltext##\hss\cr\the\formulachemicalmid\cr}% + \halign{&\hss\usechemicalstyleandcolor\c!style\c!color##\hss\cr\the\t_chem_mid\cr}% \fi \fi \egroup} \unexpanded\def\formulachemical - {\relax\dotriplegroupempty\doformulachemical} - -% \def\doformulachemical#1#2#3% we could do hboxes and measure -% {\ifthirdargument -% \doifelsenothing{#2}\noformulachemicaltop{\doformulachemicaltop{#2}}% -% \doifelsenothing{#3}\noformulachemicalbot{\doformulachemicalbot{#3}}% -% \else\ifsecondargument -% \noformulachemicaltop -% \doifelsenothing{#2}\noformulachemicalbot{\doformulachemicalbot{#2}}% -% \else -% \noformulachemicaltop -% \noformulachemicalbot -% \fi\fi -% \formulachemicalmid\expandafter{\the\formulachemicalmid\dodochemicalformulamid{#1}&}} -% -% \def\dodochemicalformulamid#1% -% {\ifcsname\??chemicalsymbol\detokenize{#1}\endcsname -% \csname\??chemicalsymbol\detokenize{#1}\expandafter\endcsname{}{}% -% \else -% \molecule{#1}{}{}% -% \fi} - -\def\domidformulachemical#1% - {\csname\??chemicalsymbol\detokenize{#1}\endcsname} + {\relax\dotriplegroupempty\chem_formula} -\def\doformulachemical#1#2#3% we could do hboxes and measure +\def\chem_formula#1#2#3% we could do hboxes and measure {\ifcsname\??chemicalsymbol\detokenize{#1}\endcsname - \formulachemicalmid\expandafter{\the\formulachemicalmid\domidformulachemical{#1}{#2}{#3}}% + \t_chem_mid\expandafter{\the\t_chem_mid\chem_formula_mid{#1}{#2}{#3}}% \else \ifthirdargument - \doifelsenothing{#2}\noformulachemicaltop{\doformulachemicaltop{#2}}% - \doifelsenothing{#3}\noformulachemicalbot{\doformulachemicalbot{#3}}% + \doifelsenothing{#2}\chem_formula_top_nop{\chem_formula_top_yes{#2}}% + \doifelsenothing{#3}\chem_formula_bot_nop{\chem_formula_bot_yes{#3}}% \else\ifsecondargument - \noformulachemicaltop - \doifelsenothing{#2}\noformulachemicalbot{\doformulachemicalbot{#2}}% + \chem_formula_top_nop + \doifelsenothing{#2}\chem_formula_bot_nop{\chem_formula_bot_yes{#2}}% \else - \noformulachemicaltop - \noformulachemicalbot + \chem_formula_top_nop + \chem_formula_bot_nop \fi\fi - \formulachemicalmid\expandafter{\the\formulachemicalmid\molecule{#1}&}% + \t_chem_mid\expandafter{\the\t_chem_mid\molecule{#1}&}% \fi} -\def\noformulachemicaltop {\formulachemicaltop\expandafter{\the\formulachemicaltop&}} -\def\noformulachemicalbot {\formulachemicalbot\expandafter{\the\formulachemicalbot&}} -\def\doformulachemicaltop#1{\formulachemicaltop\expandafter{\the\formulachemicaltop\dodochemicalformulatop{#1}&}\settrue\formulachemicalhastop} -\def\doformulachemicalbot#1{\formulachemicalbot\expandafter{\the\formulachemicalbot\dodochemicalformulabot{#1}&}\settrue\formulachemicalhasbot} +\def\chem_formula_mid#1% + {\csname\??chemicalsymbol\detokenize{#1}\endcsname} + +\def\chem_formula_top_nop {\t_chem_top\expandafter{\the\t_chem_top&}} +\def\chem_formula_bot_nop {\t_chem_bot\expandafter{\the\t_chem_bot&}} +\def\chem_formula_top_yes#1{\t_chem_top\expandafter{\the\t_chem_top\chem_formula_top_indeed{#1}&}\settrue\c_chem_has_top} +\def\chem_formula_bot_yes#1{\t_chem_bot\expandafter{\the\t_chem_bot\chem_formula_bot_indeed{#1}&}\settrue\c_chem_has_bot} -\def\dodochemicalformulatop#1{\strut#1} -\def\dodochemicalformulabot#1{\strut#1} +\def\chem_formula_top_indeed#1{\strut#1} +\def\chem_formula_bot_indeed#1{\strut#1} % gone: state option resolution offset (now frame offset) alternative diff --git a/Master/texmf-dist/tex/context/base/cont-new.mkii b/Master/texmf-dist/tex/context/base/cont-new.mkii index 0fbfda73e74..eddc0890c5e 100644 --- a/Master/texmf-dist/tex/context/base/cont-new.mkii +++ b/Master/texmf-dist/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.05.25 18:21} +\newcontextversion{2012.05.29 00:12} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/Master/texmf-dist/tex/context/base/cont-new.mkiv b/Master/texmf-dist/tex/context/base/cont-new.mkiv index a521479b54f..8c514cbfd61 100644 --- a/Master/texmf-dist/tex/context/base/cont-new.mkiv +++ b/Master/texmf-dist/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.05.25 18:21} +\newcontextversion{2012.05.29 00:12} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/Master/texmf-dist/tex/context/base/context-version.pdf b/Master/texmf-dist/tex/context/base/context-version.pdf Binary files differindex 078cdfb3155..da774042753 100644 --- a/Master/texmf-dist/tex/context/base/context-version.pdf +++ b/Master/texmf-dist/tex/context/base/context-version.pdf diff --git a/Master/texmf-dist/tex/context/base/context-version.png b/Master/texmf-dist/tex/context/base/context-version.png Binary files differindex 2ee0c710da0..821f60efc4f 100644 --- a/Master/texmf-dist/tex/context/base/context-version.png +++ b/Master/texmf-dist/tex/context/base/context-version.png diff --git a/Master/texmf-dist/tex/context/base/context.mkii b/Master/texmf-dist/tex/context/base/context.mkii index 55b4110f12b..5923624a068 100644 --- a/Master/texmf-dist/tex/context/base/context.mkii +++ b/Master/texmf-dist/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.05.25 18:21} +\edef\contextversion{2012.05.29 00:12} %D For those who want to use this: diff --git a/Master/texmf-dist/tex/context/base/context.mkiv b/Master/texmf-dist/tex/context/base/context.mkiv index ccbc64c21d6..f4da94ef16f 100644 --- a/Master/texmf-dist/tex/context/base/context.mkiv +++ b/Master/texmf-dist/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.05.25 18:21} +\edef\contextversion{2012.05.29 00:12} %D For those who want to use this: diff --git a/Master/texmf-dist/tex/context/base/data-sch.lua b/Master/texmf-dist/tex/context/base/data-sch.lua index 6c905942a23..253adb9f6d7 100644 --- a/Master/texmf-dist/tex/context/base/data-sch.lua +++ b/Master/texmf-dist/tex/context/base/data-sch.lua @@ -32,7 +32,7 @@ function cleaners.none(specification) end function cleaners.strip(specification) - return (gsub(specification.original,"[^%a%d%.]+","-")) + return (gsub(specification.original,"[^%a%d%.]+","-")) -- so we keep periods end function cleaners.md5(specification) diff --git a/Master/texmf-dist/tex/context/base/file-res.lua b/Master/texmf-dist/tex/context/base/file-res.lua index 24b0f1cfca5..4687e140e4e 100644 --- a/Master/texmf-dist/tex/context/base/file-res.lua +++ b/Master/texmf-dist/tex/context/base/file-res.lua @@ -24,24 +24,67 @@ local function readfilename(specification,backtrack,treetoo) local name = specification.filename local fnd = name and found[name] if not fnd then - if isfile(name) then + local names + local suffix = file.suffix(name) + if suffix ~= "" then + names = { name } + else + local defaultsuffixes = resolvers.defaultsuffixes + names = { } + for i=1,#defaultsuffixes do + names[i] = name .. "." .. defaultsuffixes[i] + end if trace_files then - report_files("found local: %s",name) + report_files("locating: %s, using default suffixes: %s",name,table.concat(defaultsuffixes," ")) + end + end + for i=1,#names do + local fname = names[i] + if isfile(fname) then + if trace_files then + report_files("found local: %s",name) + end + fnd = fname + break end - fnd = name end if not fnd and backtrack then - local fname = name - for i=1,backtrack,1 do - fname = "../" .. fname - if isfile(fname) then - if trace_files then - report_files("found by backtracking: %s",fname) + for i=1,#names do + local fname = names[i] + for i=1,backtrack,1 do + fname = "../" .. fname + if isfile(fname) then + if trace_files then + report_files("found by backtracking: %s",fname) + end + fnd = fname + break + elseif trace_files then + report_files("not found by backtracking: %s",fname) end - fnd = fname + end + if fnd then break - elseif trace_files then - report_files("not found by backtracking: %s",fname) + end + end + end + if not fnd then + local paths = resolvers.instance.extra_paths + if paths then + for i=1,#paths do + for i=1,#names do + local fname = paths[i] .. "/" .. names[i] + if isfile(fname) then + if trace_files then + report_files("found on extra path: %s",name) + end + fnd = name + break + end + end + if fnd then + break + end end end end diff --git a/Master/texmf-dist/tex/context/base/grph-inc.lua b/Master/texmf-dist/tex/context/base/grph-inc.lua index 8a9fd6b47d2..33dd0766d2b 100644 --- a/Master/texmf-dist/tex/context/base/grph-inc.lua +++ b/Master/texmf-dist/tex/context/base/grph-inc.lua @@ -47,6 +47,8 @@ local contains = table.contains local concat, insert, remove = table.concat, table.insert, table.remove local todimen = string.todimen +local P = lpeg.P + local settings_to_array = utilities.parsers.settings_to_array local settings_to_hash = utilities.parsers.settings_to_hash local allocate = utilities.storage.allocate @@ -133,12 +135,12 @@ figures.defaultdepth = 0 figures.nofprocessed = 0 figures.preferquality = true -- quality over location -figures.existers = allocate() local existers = figures.existers -figures.checkers = allocate() local checkers = figures.checkers -figures.includers = allocate() local includers = figures.includers -figures.converters = allocate() local converters = figures.converters -figures.identifiers = allocate() local identifiers = figures.identifiers -figures.programs = allocate() local programs = figures.programs +local existers = allocate() figures.existers = existers +local checkers = allocate() figures.checkers = checkers +local includers = allocate() figures.includers = includers +local converters = allocate() figures.converters = converters +local identifiers = allocate() figures.identifiers = identifiers +local programs = allocate() figures.programs = programs figures.localpaths = allocate { ".", "..", "../.." @@ -150,13 +152,13 @@ figures.cachepaths = allocate { subpath = ".", } -figures.paths = allocate(table.copy(figures.localpaths)) +figures.paths = allocate(table.copy(figures.localpaths)) figures.order = allocate{ - "pdf", "mps", "jpg", "png", "jp2", "jbig", "svg", "eps", "tif", "gif", "mov", "buffer", "tex", "cld", + "pdf", "mps", "jpg", "png", "jp2", "jbig", "svg", "eps", "tif", "gif", "mov", "buffer", "tex", "cld", "auto", } -figures.formats = allocate{ +local formats = allocate { ["pdf"] = { list = { "pdf" } }, ["mps"] = { patterns = { "mps", "%d+" } }, ["jpg"] = { list = { "jpg", "jpeg" } }, @@ -171,13 +173,43 @@ figures.formats = allocate{ ["buffer"] = { list = { "tmp", "buffer", "buf" } }, ["tex"] = { list = { "tex" } }, ["cld"] = { list = { "cld" } }, + ["auto"] = { list = { "auto" } }, +} + +local magics = allocate { + { format = "png", pattern = P("\137PNG\013\010\026\010") }, -- 89 50 4E 47 0D 0A 1A 0A, + { format = "jpg", pattern = P("\255\216\255") }, -- FF D8 FF + { format = "jp2", pattern = P("\000\000\000\012\106\080\032\032\013\010"), }, -- 00 00 00 0C 6A 50 20 20 0D 0A }, + { format = "gif", pattern = P("GIF") }, + { format = "pdf", pattern = (1 - P("%PDF"))^0 * P("%PDF") }, } -function figures.setlookups() +figures.formats = formats -- frozen +figures.magics = magics -- frozen + +function figures.guess(filename) + local f = io.open(filename,'rb') + if f then + local str = f:read(100) + f:close() + for i=1,#magics do + local pattern = magics[i] + if pattern.pattern:match(str) then + local format = pattern.format + if trace_figures then + report_inclusion("file %q has format %s",filename,format) + end + return format + end + end + end +end + +function figures.setlookups() -- tobe redone .. just set locals local fs, fp = allocate(), allocate() figures.suffixes, figures.patterns = fs, fp for _, format in next, figures.order do - local data = figures.formats[format] + local data = formats[format] local list = data.list if list then for i=1,#list do @@ -204,10 +236,10 @@ function figures.registerresource(t) end local function register(tag,target,what) - local data = figures.formats[target] -- resolver etc + local data = formats[target] -- resolver etc if not data then data = { } - figures.formats[target] = data + formats[target] = data end local d = data[tag] -- list or pattern if d and not contains(d,what) then @@ -439,7 +471,16 @@ local function register(askedname,specification) local oldname = specification.fullname local newpath = file.dirname(oldname) local oldbase = file.basename(oldname) - local newbase = file.removesuffix(oldbase) + -- + -- problem: we can have weird filenames, like a.b.c (no suffix) and a.b.c.gif + -- so we cannot safely remove a suffix (unless we do that for known suffixes) + -- + -- local newbase = file.removesuffix(oldbase) -- assumes a known suffix + -- + -- so we now have (also see *): + -- + local newbase = oldbase + -- local fc = specification.cache or figures.cachepaths.path if fc and fc ~= "" and fc ~= "." then newpath = fc @@ -463,7 +504,19 @@ local function register(askedname,specification) if resolution and resolution ~= "" then -- the order might change newbase = newbase .. "_" .. resolution end - local newbase = file.addsuffix(newbase,newformat) + -- + -- see *, we had: + -- + -- local newbase = file.addsuffix(newbase,newformat) + -- + -- but now have (result of Aditya's web image testing): + -- + -- as a side effect we can now have multiple fetches with different + -- original formats, not that it matters much (apart from older conversions + -- sticking around) + -- + local newbase = newbase .. "." .. newformat + -- local newname = file.join(newpath,newbase) dir.makedirs(newpath) oldname = file.collapsepath(oldname) @@ -578,14 +631,14 @@ local function locate(request) -- name, format, cache end end if format then - local foundname, quitscanning = figures.exists(askedname,format,resolve_too) -- not askedformat + local foundname, quitscanning, forcedformat = figures.exists(askedname,format,resolve_too) -- not askedformat if foundname then return register(askedname, { askedname = askedname, fullname = foundname, -- askedname, - format = format, + format = forcedformat or format, cache = askedcache, ---~ foundname = foundname, + -- foundname = foundname, -- no conversion = askedconversion, resolution = askedresolution, }) @@ -597,12 +650,12 @@ local function locate(request) -- name, format, cache end if askedpath then -- path and type given, todo: strip pieces of path - local foundname = figures.exists(askedname,askedformat,resolve_too) + local foundname, quitscanning, forcedformat = figures.exists(askedname,askedformat,resolve_too) if foundname then return register(askedname, { askedname = askedname, fullname = foundname, -- askedname, - format = askedformat, + format = forcedformat or askedformat, cache = askedcache, conversion = askedconversion, resolution = askedresolution, @@ -616,7 +669,8 @@ local function locate(request) -- name, format, cache local check = path .. "/" .. askedname -- we pass 'true' as it can be an url as well, as the type -- is given we don't waste much time - if figures.exists(check,askedformat,resolve_too) then + local foundname, quitscanning, forcedformat = figures.exists(check,askedformat,resolve_too) + if foundname then return register(check, { askedname = askedname, fullname = check, @@ -648,16 +702,16 @@ local function locate(request) -- name, format, cache local figureorder = figures.order for i=1,#figureorder do local format = figureorder[i] - local list = figures.formats[format].list or { format } + local list = formats[format].list or { format } for j=1,#list do local suffix = list[j] local check = file.addsuffix(askedname,suffix) - local foundname = figures.exists(check,format,resolve_too) + local foundname, quitscanning, forcedformat = figures.exists(check,format,resolve_too) if foundname then return register(askedname, { askedname = askedname, fullname = foundname, -- check, - format = format, + format = forcedformat or format, cache = askedcache, conversion = askedconversion, resolution = askedresolution, @@ -674,7 +728,7 @@ local function locate(request) -- name, format, cache local figureorder = figures.order for j=1,#figureorder do local format = figureorder[j] - local list = figures.formats[format].list or { format } + local list = formats[format].list or { format } for k=1,#list do local suffix = list[k] -- local name = file.replacesuffix(askedbase,suffix) @@ -688,12 +742,12 @@ local function locate(request) -- name, format, cache report_inclusion("warning: skipping path %s",path) end else - local foundname = figures.exists(check,format,true) + local foundname, quitscanning, forcedformat = figures.exists(check,format,true) if foundname then return register(askedname, { askedname = askedname, fullname = foundname, -- check - format = format, + format = forcedformat or format, cache = askedcache, conversion = askedconversion, resolution = askedresolution, @@ -713,16 +767,16 @@ local function locate(request) -- name, format, cache local path = figurepaths[i] for j=1,#figureorder do local format = figureorder[j] - local list = figures.formats[format].list or { format } + local list = formats[format].list or { format } for k=1,#list do local suffix = list[k] local check = path .. "/" .. file.replacesuffix(askedbase,suffix) - local foundname = figures.exists(check,format,resolve_too) + local foundname, quitscanning, forcedformat = figures.exists(check,format,resolve_too) if foundname then return register(askedname, { askedname = askedname, fullname = foudname, -- check, - format = format, + format = forcedformat or format, cache = askedcache, conversion = askedconversion, resolution = askedresolution, @@ -739,7 +793,7 @@ local function locate(request) -- name, format, cache local figureorder = figures.order for j=1,#figureorder do local format = figureorder[j] - local list = figures.formats[format].list or { format } + local list = formats[format].list or { format } for k=1,#list do local suffix = list[k] local check = resolvers.findfile(file.replacesuffix(askedname,suffix)) @@ -1064,6 +1118,22 @@ end includers.buffers = includers.nongeneric +-- -- -- auto -- -- -- + +function existers.auto(askedname) + local name = gsub(askedname, ".auto$", "") + local format = figures.guess(name) + if format then + report_inclusion("format guess for %q: %s",name,format) + else + report_inclusion("format guess for %q is not possible",name) + end + return format and name, true, format +end + +checkers.auto = checkers.generic +includers.auto = includers.generic + -- -- -- cld -- -- -- existers.cld = existers.tex diff --git a/Master/texmf-dist/tex/context/base/l-file.lua b/Master/texmf-dist/tex/context/base/l-file.lua index 48f6a39fe8b..edfbc0f92b5 100644 --- a/Master/texmf-dist/tex/context/base/l-file.lua +++ b/Master/texmf-dist/tex/context/base/l-file.lua @@ -26,8 +26,12 @@ local function basename(name) return match(name,"^.+[/\\](.-)$") or name end +-- local function nameonly(name) +-- return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) +-- end + local function nameonly(name) - return (gsub(match(name,"^.+[/\\](.-)$") or name,"%..*$","")) + return (gsub(match(name,"^.+[/\\](.-)$") or name,"%.[%a%d]+$","")) end local function extname(name,default) diff --git a/Master/texmf-dist/tex/context/base/l-lpeg.lua b/Master/texmf-dist/tex/context/base/l-lpeg.lua index 25d48ee75d7..13294ab0d63 100644 --- a/Master/texmf-dist/tex/context/base/l-lpeg.lua +++ b/Master/texmf-dist/tex/context/base/l-lpeg.lua @@ -15,39 +15,39 @@ local lpeg = require("lpeg") local report = texio and texio.write_nl or print ---~ local lpmatch = lpeg.match ---~ local lpprint = lpeg.print ---~ local lpp = lpeg.P ---~ local lpr = lpeg.R ---~ local lps = lpeg.S ---~ local lpc = lpeg.C ---~ local lpb = lpeg.B ---~ local lpv = lpeg.V ---~ local lpcf = lpeg.Cf ---~ local lpcb = lpeg.Cb ---~ local lpcg = lpeg.Cg ---~ local lpct = lpeg.Ct ---~ local lpcs = lpeg.Cs ---~ local lpcc = lpeg.Cc ---~ local lpcmt = lpeg.Cmt ---~ local lpcarg = lpeg.Carg - ---~ function lpeg.match(l,...) report("LPEG MATCH") lpprint(l) return lpmatch(l,...) end - ---~ function lpeg.P (l) local p = lpp (l) report("LPEG P =") lpprint(l) return p end ---~ function lpeg.R (l) local p = lpr (l) report("LPEG R =") lpprint(l) return p end ---~ function lpeg.S (l) local p = lps (l) report("LPEG S =") lpprint(l) return p end ---~ function lpeg.C (l) local p = lpc (l) report("LPEG C =") lpprint(l) return p end ---~ function lpeg.B (l) local p = lpb (l) report("LPEG B =") lpprint(l) return p end ---~ function lpeg.V (l) local p = lpv (l) report("LPEG V =") lpprint(l) return p end ---~ function lpeg.Cf (l) local p = lpcf (l) report("LPEG Cf =") lpprint(l) return p end ---~ function lpeg.Cb (l) local p = lpcb (l) report("LPEG Cb =") lpprint(l) return p end ---~ function lpeg.Cg (l) local p = lpcg (l) report("LPEG Cg =") lpprint(l) return p end ---~ function lpeg.Ct (l) local p = lpct (l) report("LPEG Ct =") lpprint(l) return p end ---~ function lpeg.Cs (l) local p = lpcs (l) report("LPEG Cs =") lpprint(l) return p end ---~ function lpeg.Cc (l) local p = lpcc (l) report("LPEG Cc =") lpprint(l) return p end ---~ function lpeg.Cmt (l) local p = lpcmt (l) report("LPEG Cmt =") lpprint(l) return p end ---~ function lpeg.Carg (l) local p = lpcarg(l) report("LPEG Carg =") lpprint(l) return p end +-- local lpmatch = lpeg.match +-- local lpprint = lpeg.print +-- local lpp = lpeg.P +-- local lpr = lpeg.R +-- local lps = lpeg.S +-- local lpc = lpeg.C +-- local lpb = lpeg.B +-- local lpv = lpeg.V +-- local lpcf = lpeg.Cf +-- local lpcb = lpeg.Cb +-- local lpcg = lpeg.Cg +-- local lpct = lpeg.Ct +-- local lpcs = lpeg.Cs +-- local lpcc = lpeg.Cc +-- local lpcmt = lpeg.Cmt +-- local lpcarg = lpeg.Carg + +-- function lpeg.match(l,...) report("LPEG MATCH") lpprint(l) return lpmatch(l,...) end + +-- function lpeg.P (l) local p = lpp (l) report("LPEG P =") lpprint(l) return p end +-- function lpeg.R (l) local p = lpr (l) report("LPEG R =") lpprint(l) return p end +-- function lpeg.S (l) local p = lps (l) report("LPEG S =") lpprint(l) return p end +-- function lpeg.C (l) local p = lpc (l) report("LPEG C =") lpprint(l) return p end +-- function lpeg.B (l) local p = lpb (l) report("LPEG B =") lpprint(l) return p end +-- function lpeg.V (l) local p = lpv (l) report("LPEG V =") lpprint(l) return p end +-- function lpeg.Cf (l) local p = lpcf (l) report("LPEG Cf =") lpprint(l) return p end +-- function lpeg.Cb (l) local p = lpcb (l) report("LPEG Cb =") lpprint(l) return p end +-- function lpeg.Cg (l) local p = lpcg (l) report("LPEG Cg =") lpprint(l) return p end +-- function lpeg.Ct (l) local p = lpct (l) report("LPEG Ct =") lpprint(l) return p end +-- function lpeg.Cs (l) local p = lpcs (l) report("LPEG Cs =") lpprint(l) return p end +-- function lpeg.Cc (l) local p = lpcc (l) report("LPEG Cc =") lpprint(l) return p end +-- function lpeg.Cmt (l) local p = lpcmt (l) report("LPEG Cmt =") lpprint(l) return p end +-- function lpeg.Carg (l) local p = lpcarg(l) report("LPEG Carg =") lpprint(l) return p end local type = type local byte, char, gmatch = string.byte, string.char, string.gmatch diff --git a/Master/texmf-dist/tex/context/base/math-dim.lua b/Master/texmf-dist/tex/context/base/math-dim.lua index d245bfb3aaf..a5d7c39639b 100644 --- a/Master/texmf-dist/tex/context/base/math-dim.lua +++ b/Master/texmf-dist/tex/context/base/math-dim.lua @@ -227,6 +227,10 @@ function mathematics.dimensions(dimens) -- beware, dimens get spoiled UpperLimitBaselineRiseMin = t . limit_above_bgap . text_style, UpperLimitGapMin = t . limit_above_vgap . text_style, } + + -- too fragile for tx/px ... even the same values give different results + d.DisplayOperatorMinHeight = nil + -- d.AccentBaseHeight = 0 -- here? still? return d, t -- t only for diagnostics else diff --git a/Master/texmf-dist/tex/context/base/math-vfu.lua b/Master/texmf-dist/tex/context/base/math-vfu.lua index c3f23416622..21b10189471 100644 --- a/Master/texmf-dist/tex/context/base/math-vfu.lua +++ b/Master/texmf-dist/tex/context/base/math-vfu.lua @@ -799,7 +799,7 @@ function vfmath.define(specification,set,goodies) fonts.constructors.assignmathparameters(main,main) -- main.MathConstants = main.mathparameters -- we directly pass it to TeX (bypasses the scaler) so this is needed ---~ inspect(main.MathConstants) +-- inspect(main.MathConstants) -- if trace_virtual or trace_timings then report_virtual("loading and virtualizing font %s at size %s took %0.3f seconds",name,size,os.clock()-start) diff --git a/Master/texmf-dist/tex/context/base/mult-de.mkii b/Master/texmf-dist/tex/context/base/mult-de.mkii index ecc77ea8221..dee614e5ec5 100644 --- a/Master/texmf-dist/tex/context/base/mult-de.mkii +++ b/Master/texmf-dist/tex/context/base/mult-de.mkii @@ -493,6 +493,7 @@ \setinterfacevariable{text}{text} \setinterfacevariable{three}{drei} \setinterfacevariable{thursday}{donnerstag} +\setinterfacevariable{tight}{tight} \setinterfacevariable{title}{titel} \setinterfacevariable{toggle}{toggle} \setinterfacevariable{tolerant}{tolerant} @@ -581,6 +582,7 @@ \setinterfaceconstant{beforehead}{vorkopf} \setinterfaceconstant{beforesection}{beforesection} \setinterfaceconstant{bet}{bet} +\setinterfaceconstant{bidi}{bidi} \setinterfaceconstant{big}{gross} \setinterfaceconstant{blank}{blanko} \setinterfaceconstant{blockway}{blockauf} diff --git a/Master/texmf-dist/tex/context/base/mult-def.lua b/Master/texmf-dist/tex/context/base/mult-def.lua index 4ca05c32831..1a4921a28ca 100644 --- a/Master/texmf-dist/tex/context/base/mult-def.lua +++ b/Master/texmf-dist/tex/context/base/mult-def.lua @@ -6963,6 +6963,9 @@ return { ["pe"]="bet", ["ro"]="bet", }, + ["bidi"]={ + ["en"]="bidi", + }, ["big"]={ ["cs"]="velky", ["de"]="gross", @@ -16098,6 +16101,10 @@ return { ["pe"]="پنجشنبه", ["ro"]="joi", }, + ["tight"]={ + ["en"]="tight", + ["nl"]="krap", + }, ["title"]={ ["cs"]="titul", ["de"]="titel", diff --git a/Master/texmf-dist/tex/context/base/mult-en.mkii b/Master/texmf-dist/tex/context/base/mult-en.mkii index 1aab52a2675..b801ebc5fe4 100644 --- a/Master/texmf-dist/tex/context/base/mult-en.mkii +++ b/Master/texmf-dist/tex/context/base/mult-en.mkii @@ -493,6 +493,7 @@ \setinterfacevariable{text}{text} \setinterfacevariable{three}{three} \setinterfacevariable{thursday}{thursday} +\setinterfacevariable{tight}{tight} \setinterfacevariable{title}{title} \setinterfacevariable{toggle}{wissel} \setinterfacevariable{tolerant}{tolerant} @@ -581,6 +582,7 @@ \setinterfaceconstant{beforehead}{beforehead} \setinterfaceconstant{beforesection}{beforesection} \setinterfaceconstant{bet}{bet} +\setinterfaceconstant{bidi}{bidi} \setinterfaceconstant{big}{big} \setinterfaceconstant{blank}{blank} \setinterfaceconstant{blockway}{blockway} diff --git a/Master/texmf-dist/tex/context/base/mult-fr.mkii b/Master/texmf-dist/tex/context/base/mult-fr.mkii index fd36c4f8b30..5717cf97b19 100644 --- a/Master/texmf-dist/tex/context/base/mult-fr.mkii +++ b/Master/texmf-dist/tex/context/base/mult-fr.mkii @@ -493,6 +493,7 @@ \setinterfacevariable{text}{texte} \setinterfacevariable{three}{trois} \setinterfacevariable{thursday}{jeudi} +\setinterfacevariable{tight}{tight} \setinterfacevariable{title}{titre} \setinterfacevariable{toggle}{toggle} \setinterfacevariable{tolerant}{tolerant} @@ -581,6 +582,7 @@ \setinterfaceconstant{beforehead}{avanttete} \setinterfaceconstant{beforesection}{beforesection} \setinterfaceconstant{bet}{bet} +\setinterfaceconstant{bidi}{bidi} \setinterfaceconstant{big}{grand} \setinterfaceconstant{blank}{vide} \setinterfaceconstant{blockway}{blockway} diff --git a/Master/texmf-dist/tex/context/base/mult-it.mkii b/Master/texmf-dist/tex/context/base/mult-it.mkii index a8f1ff7b646..88a371ac76e 100644 --- a/Master/texmf-dist/tex/context/base/mult-it.mkii +++ b/Master/texmf-dist/tex/context/base/mult-it.mkii @@ -493,6 +493,7 @@ \setinterfacevariable{text}{testo} \setinterfacevariable{three}{tre} \setinterfacevariable{thursday}{giovedi} +\setinterfacevariable{tight}{tight} \setinterfacevariable{title}{titolo} \setinterfacevariable{toggle}{toggle} \setinterfacevariable{tolerant}{tollerante} @@ -581,6 +582,7 @@ \setinterfaceconstant{beforehead}{primaditesta} \setinterfaceconstant{beforesection}{beforesection} \setinterfaceconstant{bet}{bet} +\setinterfaceconstant{bidi}{bidi} \setinterfaceconstant{big}{grande} \setinterfaceconstant{blank}{rigovuoto} \setinterfaceconstant{blockway}{blockway} diff --git a/Master/texmf-dist/tex/context/base/mult-nl.mkii b/Master/texmf-dist/tex/context/base/mult-nl.mkii index b199039dd6d..01f7fa20435 100644 --- a/Master/texmf-dist/tex/context/base/mult-nl.mkii +++ b/Master/texmf-dist/tex/context/base/mult-nl.mkii @@ -493,6 +493,7 @@ \setinterfacevariable{text}{tekst} \setinterfacevariable{three}{drie} \setinterfacevariable{thursday}{donderdag} +\setinterfacevariable{tight}{krap} \setinterfacevariable{title}{titel} \setinterfacevariable{toggle}{toggle} \setinterfacevariable{tolerant}{soepel} @@ -581,6 +582,7 @@ \setinterfaceconstant{beforehead}{kopvoor} \setinterfaceconstant{beforesection}{voorsectie} \setinterfaceconstant{bet}{bet} +\setinterfaceconstant{bidi}{bidi} \setinterfaceconstant{big}{groot} \setinterfaceconstant{blank}{blanko} \setinterfaceconstant{blockway}{blokwijze} diff --git a/Master/texmf-dist/tex/context/base/mult-pe.mkii b/Master/texmf-dist/tex/context/base/mult-pe.mkii index 5f38eb9285d..6dcd2fef6f6 100644 --- a/Master/texmf-dist/tex/context/base/mult-pe.mkii +++ b/Master/texmf-dist/tex/context/base/mult-pe.mkii @@ -493,6 +493,7 @@ \setinterfacevariable{text}{متن} \setinterfacevariable{three}{سه} \setinterfacevariable{thursday}{پنجشنبه} +\setinterfacevariable{tight}{tight} \setinterfacevariable{title}{عنوان} \setinterfacevariable{toggle}{تغییر} \setinterfacevariable{tolerant}{بردبار} @@ -581,6 +582,7 @@ \setinterfaceconstant{beforehead}{قبلازسر} \setinterfaceconstant{beforesection}{beforesection} \setinterfaceconstant{bet}{bet} +\setinterfaceconstant{bidi}{bidi} \setinterfaceconstant{big}{بزرگ} \setinterfaceconstant{blank}{خالی} \setinterfaceconstant{blockway}{راهبلوک} diff --git a/Master/texmf-dist/tex/context/base/mult-ro.mkii b/Master/texmf-dist/tex/context/base/mult-ro.mkii index 4b05da390d9..1eef26e0dd5 100644 --- a/Master/texmf-dist/tex/context/base/mult-ro.mkii +++ b/Master/texmf-dist/tex/context/base/mult-ro.mkii @@ -493,6 +493,7 @@ \setinterfacevariable{text}{text} \setinterfacevariable{three}{trei} \setinterfacevariable{thursday}{joi} +\setinterfacevariable{tight}{tight} \setinterfacevariable{title}{titlu} \setinterfacevariable{toggle}{toggle} \setinterfacevariable{tolerant}{tolerant} @@ -581,6 +582,7 @@ \setinterfaceconstant{beforehead}{inaintetitlu} \setinterfaceconstant{beforesection}{beforesection} \setinterfaceconstant{bet}{bet} +\setinterfaceconstant{bidi}{bidi} \setinterfaceconstant{big}{mare} \setinterfaceconstant{blank}{blanc} \setinterfaceconstant{blockway}{blockway} diff --git a/Master/texmf-dist/tex/context/base/mult-sys.mkiv b/Master/texmf-dist/tex/context/base/mult-sys.mkiv index cdf73b6121c..9b67ab4bad5 100644 --- a/Master/texmf-dist/tex/context/base/mult-sys.mkiv +++ b/Master/texmf-dist/tex/context/base/mult-sys.mkiv @@ -381,7 +381,6 @@ \definesystemconstant {bp} \definesystemconstant {in} \definesystemconstant {pc} -\definesystemconstant {cm} \definesystemconstant {dd} \definesystemconstant {cc} \definesystemconstant {nd} @@ -464,13 +463,11 @@ \definesystemvariable {bp} % BreakPoint \definesystemvariable {bx} % BackendExport \definesystemvariable {cb} % CollectBox -\definesystemvariable {cm} % CheMical \definesystemvariable {cp} % CliP \definesystemvariable {da} % DAte \definesystemvariable {db} % Labels \definesystemvariable {dd} % DoorDefinieren \definesystemvariable {de} % DEel -\definesystemvariable {di} % DIrections \definesystemvariable {dl} % DunneLijnen \definesystemvariable {dn} % DoorNummeren \definesystemvariable {dm} % DefineMeasure diff --git a/Master/texmf-dist/tex/context/base/pack-bck.mkvi b/Master/texmf-dist/tex/context/base/pack-bck.mkvi index 38750f590d8..fbe704fabbc 100644 --- a/Master/texmf-dist/tex/context/base/pack-bck.mkvi +++ b/Master/texmf-dist/tex/context/base/pack-bck.mkvi @@ -97,7 +97,7 @@ \let\pack_backgrounds_stop\relax -\unexpanded\def\pack_backgrounds_stop_indeed +\unexpanded\def\pack_backgrounds_stop_indeed % we shoul duse the fast background variant of framed {\endgraf \removelastskip \egroup @@ -199,17 +199,21 @@ \setupbackground [\c!leftoffset=.5\bodyfontsize, \c!rightoffset=\backgroundparameter\c!leftoffset, - \c!topoffset=\!!zeropoint, + \c!topoffset=\zeropoint, \c!bottomoffset=\backgroundparameter\c!topoffset, \c!state=\v!start, \c!radius=.5\bodyfontsize, \c!corner=\v!rectangular, \c!frame=\v!off, - \c!color=, - \c!depth=\!!zeropoint, - \c!background=\v!screen, - \c!backgroundcolor=\backgroundparameter\c!color, - \c!screen=\@@rsscreen, + \c!depth=\zeropoint, +% \c!color=, +% \c!background=\v!screen, +% \c!backgroundcolor=\backgroundparameter\c!color, +% \c!screen=\@@rsscreen, +% + \c!background=\v!color, + \c!backgroundcolor=lightgray, +% \c!before=, \c!after=] diff --git a/Master/texmf-dist/tex/context/base/pack-rul.mkiv b/Master/texmf-dist/tex/context/base/pack-rul.mkiv index d7e41dd7076..480997919f7 100644 --- a/Master/texmf-dist/tex/context/base/pack-rul.mkiv +++ b/Master/texmf-dist/tex/context/base/pack-rul.mkiv @@ -523,12 +523,12 @@ \newtoks\everybackgroundbox -\let\currentbackground\empty +\let\m_framed_background\empty % we might need a public name \def\pack_framed_process_background - {\ifcsname\??overlaybuiltin\currentbackground\endcsname + {\ifcsname\??overlaybuiltin\m_framed_background\endcsname \pack_framed_process_background_indeed_internal - \else\ifcsname\??overlay\currentbackground\endcsname + \else\ifcsname\??overlay\m_framed_background\endcsname \pack_framed_process_background_indeed_external \fi\fi} @@ -536,10 +536,10 @@ {\bgroup \setbox\b_framed_extra\hbox{%\bgroup \ifzeropt\framedbackgroundoffset - \csname\??overlaybuiltin\currentbackground\endcsname + \csname\??overlaybuiltin\m_framed_background\endcsname \else \kern-\framedbackgroundoffset - \hbox{\csname\??overlaybuiltin\currentbackground\endcsname}% + \hbox{\csname\??overlaybuiltin\m_framed_background\endcsname}% \fi }%\egroup \wd\b_framed_extra\zeropoint @@ -553,10 +553,10 @@ \bgroup \setbox\b_framed_extra\hbox{%\bgroup \ifzeropt\framedbackgroundoffset - \csname\??overlay\currentbackground\endcsname + \csname\??overlay\m_framed_background\endcsname \else \kern-\framedbackgroundoffset - \hbox{\csname\??overlay\currentbackground\endcsname}% + \hbox{\csname\??overlay\m_framed_background\endcsname}% \fi }%\egroup \wd\b_framed_extra\zeropoint @@ -566,8 +566,8 @@ \egroup} \def\pack_framed_process_backgrounds#1,#2% #2 gobbles spaces (we could avoid one catch if we have nextbackground) - {\edef\currentbackground{#1}% - \ifx\currentbackground\s!unknown\else + {\edef\m_framed_background{#1}% + \ifx\m_framed_background\s!unknown\else \pack_framed_process_background \expandafter\pack_framed_process_backgrounds \fi#2} @@ -1208,9 +1208,9 @@ \let\pack_framed_forgetall\relax \forgetall \fi - \edef\framedwidth {\ifdim\d_framed_width >\zeropoint\the\d_framed_width \else\!!zeropoint\fi}% a new feature, visible for user - \edef\framedheight{\ifdim\d_framed_height>\zeropoint\the\d_framed_height\else\!!zeropoint\fi}% a new feature, visible for user - \edef\framedoffset{\the\dimexpr\ifconditional\c_framed_has_offset\localoffset\else\zeropoint\fi}% + \edef\framedwidth {\the\ifdim\d_framed_width >\zeropoint \d_framed_width \else\zeropoint\fi}% public + \edef\framedheight{\the\ifdim\d_framed_height>\zeropoint \d_framed_height\else\zeropoint\fi}% public + \edef\framedoffset{\the\dimexpr\ifconditional\c_framed_has_offset\localoffset \else\zeropoint\fi}% public \ifx\p_framed_orientation\empty \let\pack_framed_stop_orientation\relax \else diff --git a/Master/texmf-dist/tex/context/base/s-mat-11.mkiv b/Master/texmf-dist/tex/context/base/s-mat-11.mkiv index 3939e9f2248..88bfad8ef2a 100644 --- a/Master/texmf-dist/tex/context/base/s-mat-11.mkiv +++ b/Master/texmf-dist/tex/context/base/s-mat-11.mkiv @@ -96,11 +96,11 @@ % \setupbodyfont[lmvirtual,12pt] \showmathfontcharacters % \setupbodyfont[pxvirtual,12pt] \showmathfontcharacters % \setupbodyfont[txvirtual,12pt] \showmathfontcharacters -% \setupbodyfont[palatino, 10pt] \showmathfontcharacters + \setupbodyfont[palatino, 12pt] \showmathfontcharacters % \setupbodyfont[mathtimes,12pt] \showmathfontcharacters % \setupbodyfont[stix, 12pt] \showmathfontcharacters % \setupbodyfont[xits, 12pt] \showmathfontcharacters % \setupbodyfont[lucida, 12pt] \showmathfontcharacters - \setupbodyfont[lucidanova, 12pt] \showmathfontcharacters +% \setupbodyfont[lucidanova, 12pt] \showmathfontcharacters \stoptext diff --git a/Master/texmf-dist/tex/context/base/status-files.pdf b/Master/texmf-dist/tex/context/base/status-files.pdf Binary files differindex 1bb5ecfc7ae..e0233d26221 100644 --- a/Master/texmf-dist/tex/context/base/status-files.pdf +++ b/Master/texmf-dist/tex/context/base/status-files.pdf diff --git a/Master/texmf-dist/tex/context/base/status-lua.pdf b/Master/texmf-dist/tex/context/base/status-lua.pdf Binary files differindex ca099cd41f4..95b9c543ca4 100644 --- a/Master/texmf-dist/tex/context/base/status-lua.pdf +++ b/Master/texmf-dist/tex/context/base/status-lua.pdf diff --git a/Master/texmf-dist/tex/context/base/status-mkiv.lua b/Master/texmf-dist/tex/context/base/status-mkiv.lua index a94080378a3..d7ab099a604 100644 --- a/Master/texmf-dist/tex/context/base/status-mkiv.lua +++ b/Master/texmf-dist/tex/context/base/status-mkiv.lua @@ -315,7 +315,8 @@ return { { filename = "typo-ini", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "will grow", }, { filename = "page-ins", @@ -1106,7 +1107,8 @@ return { { filename = "typo-dir", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "maybe singular setup" }, { filename = "typo-brk", @@ -1323,7 +1325,7 @@ return { { filename = "chem-str", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "typo-scr", diff --git a/Master/texmf-dist/tex/context/base/strc-not.mkvi b/Master/texmf-dist/tex/context/base/strc-not.mkvi index 55bcf6d36a5..0a57ed8788c 100644 --- a/Master/texmf-dist/tex/context/base/strc-not.mkvi +++ b/Master/texmf-dist/tex/context/base/strc-not.mkvi @@ -237,7 +237,9 @@ \edef\currentnote{#1}% \strc_constructions_initialize{#1}% \strc_notes_synchronize - \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel + \ifnotesenabled + \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel + \fi \doifnextoptionalelse\strc_notations_command_yes\strc_notations_command_nop} \unexpanded\def\strc_notations_command_nop#1% @@ -266,7 +268,9 @@ \edef\currentnote{#1}% \strc_constructions_initialize{#1}% \strc_notes_synchronize - \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel + \ifnotesenabled + \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel + \fi \normalexpanded % not that efficient but also not that frequently used {\def\noexpand\strc_pickup_yes[##1]##2\csname\e!stop#2\endcsname{\strc_notations_command_yes[##1]{##2}}% \def\noexpand\strc_pickup_nop ##1\csname\e!stop#2\endcsname{\strc_notations_command_nop {##1}}}% diff --git a/Master/texmf-dist/tex/context/base/strc-ren.mkiv b/Master/texmf-dist/tex/context/base/strc-ren.mkiv index b2d23c1084e..b7b4224cd0d 100644 --- a/Master/texmf-dist/tex/context/base/strc-ren.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-ren.mkiv @@ -147,11 +147,11 @@ \setheadmarking \doresettructureheadnumbercontent \ifconditional\headleaveempty - \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \headreferenceattributes to \zeropoint{}% + \setbox\sectionheadbox\hbox \headreferenceattributes to \zeropoint{}% \makestrutofbox\sectionheadbox \else \docheckheadreference - \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \headreferenceattributes + \setbox\sectionheadbox\hbox \headreferenceattributes {\spac_grids_set_local_snapping{\headparameter\c!internalgrid}% \doresettructureheadnumbercontent \useheadstyleparameter\c!style @@ -165,11 +165,11 @@ \setheadmarking \doiftextelse{\getheadnumber}\dosettructureheadnumbercontent\doresettructureheadnumbercontent \ifconditional\headleaveempty - \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \headreferenceattributes to \zeropoint{}% + \setbox\sectionheadbox\hbox \headreferenceattributes to \zeropoint{}% \makestrutofbox\sectionheadbox \else % = needed \docheckheadreference - \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \headreferenceattributes + \setbox\sectionheadbox\hbox \headreferenceattributes {\spac_grids_set_local_snapping{\headparameter\c!internalgrid}% \useheadstyleparameter\c!style \setinlineheadreferenceattributes diff --git a/Master/texmf-dist/tex/context/base/typo-dir.lua b/Master/texmf-dist/tex/context/base/typo-dir.lua index cdc1427a19e..620862e85a8 100644 --- a/Master/texmf-dist/tex/context/base/typo-dir.lua +++ b/Master/texmf-dist/tex/context/base/typo-dir.lua @@ -437,17 +437,25 @@ end --~ tasks.enableaction("processors","directions.handler") --~ end -function directions.set(n) - if trace_directions then - report_breakpoints("enabling directions handler") +local enabled = false + +function directions.set(n) -- todo: names and numbers + if not enabled then + if trace_directions then + report_breakpoints("enabling directions handler") + end + tasks.enableaction("processors","typesetters.directions.handler") + enabled = true end - tasks.enableaction("processors","typesetters.directions.handler") - function directions.set(n) - texattribute[a_directions] = n == 0 and unsetvalue or n + if not n or n == 0 then + n = unsetvalue + -- maybe tracing end - directions.set(n) + texattribute[a_directions] = n end +commands.setdirection = directions.set + directions.handler = nodes.installattributehandler { name = "directions", namespace = directions, diff --git a/Master/texmf-dist/tex/context/base/typo-dir.mkiv b/Master/texmf-dist/tex/context/base/typo-dir.mkiv index 33f11d9c8be..b46be47631a 100644 --- a/Master/texmf-dist/tex/context/base/typo-dir.mkiv +++ b/Master/texmf-dist/tex/context/base/typo-dir.mkiv @@ -19,37 +19,42 @@ \definesystemattribute[directions][public] -% experimental directions +\installcorenamespace{directions} +\installcorenamespace{directionsbidimode} + +% plural as we can have a combination but maybe better singular + +\installsimplecommandhandler \??directions {directions} \??directions % no \define... yet \unexpanded\def\setdirection[#1]% todo: symbolic names - {\ctxlua{typesetters.directions.set(#1)}} + {\ctxcommand{setdirection(\number#1)}} \unexpanded\def\resetdirection - %{\ctxlua{typesetters.directions.set(0)}} + %{\ctxcommand{setdirection(0)}} {\attribute\directionsattribute\attributeunsetvalue} -\newtoks\everysetupdirections - -\unexpanded\def\setupdirections[#1]% there will be more like setting up directions themselves - {\getparameters[\??di][#1]% - \the\everysetupdirections} - -\newconstant\directionsbidimode +\newconstant\directionsbidimode % this one might become pivate -\letvalue{\??di:bidi:\v!off }\zerocount -\letvalue{\??di:bidi:\v!global}\plusone -\letvalue{\??di:bidi:\v!local }\plustwo -\letvalue{\??di:bidi:\v!on }\plustwo +\letvalue{\??directionsbidimode\v!off }\zerocount +\letvalue{\??directionsbidimode\v!global}\plusone +\letvalue{\??directionsbidimode\v!local }\plustwo +\letvalue{\??directionsbidimode\v!on }\plustwo \appendtoks - \directionsbidimode\executeifdefined{\??di:bidi:\@@dibidi}\zerocount\relax + \directionsbidimode + \ifcsname\??directionsbidimode\directionsparameter\c!bidi\endcsname + \csname\??directionsbidimode\directionsparameter\c!bidi\endcsname + \else + \zerocount + \fi + \relax \ifcase\directionsbidimode \resetdirection - \or + \or % 1 \setdirection[1]% global, chars - \or + \or % 2 \setdirection[2]% local, attributes - \or + \or % else \setdirection[1]% default \fi \to \everysetupdirections @@ -57,9 +62,9 @@ % bidi: local=obey grouping, global=ignore grouping (unicode has no grouping) \setupdirections % maybe start/stop - [bidi=\v!off] + [\c!bidi=\v!off] -\unexpanded\def\bidilre{\utfchar{"0x202A}} +\unexpanded\def\bidilre{\utfchar{"0x202A}} % maybe \edef's \unexpanded\def\bidirle{\utfchar{"0x202B}} \unexpanded\def\bidipop{\utfchar{"0x202C}} \unexpanded\def\bidilro{\utfchar{"0x202D}} diff --git a/Master/texmf-dist/tex/context/base/typo-ini.mkiv b/Master/texmf-dist/tex/context/base/typo-ini.mkiv index d05fcecb09c..1c2d6617a53 100644 --- a/Master/texmf-dist/tex/context/base/typo-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/typo-ini.mkiv @@ -24,20 +24,22 @@ \unprotect -%D \macros -%D {ifvertical} -%D -%D The following switch can be used to signal macros that they -%D should adapt their behaviour. - -\newif\ifvertical % maybe also ifreverse - -%D \macros -%D {vhbox} -%D -%D A stupid but useful macro. - -\def\vhbox{\ifvertical\vbox\else\hbox\fi} +% This will be done differently: +% +% %D \macros +% %D {ifvertical} +% %D +% %D The following switch can be used to signal macros that they +% %D should adapt their behaviour. +% +% \newif\ifvertical % maybe also ifreverse +% +% %D \macros +% %D {vhbox} +% %D +% %D A stupid but useful macro. +% +% \def\vhbox{\ifvertical\vbox\else\hbox\fi} %D \macros %D {everyresettypesetting} |