diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-06-12 18:46:32 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-06-12 18:46:32 +0200 |
commit | 2686f6014d16c6a1d059ebe579894f804a5b3c4c (patch) | |
tree | 66a904a7d3c63dcbf3e756796d6ac07b4841bc11 /tex | |
parent | 8fb5c26bd2f15104a6db9945299d3ca2c75db2d6 (diff) | |
download | context-2686f6014d16c6a1d059ebe579894f804a5b3c4c.tar.gz |
2020-06-12 17:42:00
Diffstat (limited to 'tex')
21 files changed, 737 insertions, 227 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 5c6a2ec10..5b09f46e1 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2020.06.11 21:26} +\newcontextversion{2020.06.12 17:40} %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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index bf4e8407f..5c836566a 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2020.06.11 21:26} +\edef\contextversion{2020.06.12 17:40} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 5f62f3ebc..5eecc1675 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,16 +13,20 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2020.06.11 21:26} +\newcontextversion{2020.06.12 17:40} -%D This file is loaded at runtime, thereby providing an excellent place for -%D hacks, patches, extensions and new features. +%D This file is loaded at runtime, thereby providing an excellent place for hacks, +%D patches, extensions and new features. There can be local overloads in cont-loc +%D (which has always been the case) and experimental code in cont-exp (which is also +%D so old that I need to remind myself to check it occasionally, so here is the +%D reminder). \unprotect \writestatus\m!system{beware: some patches loaded from cont-new.mkiv} -% math-ini.mkiv +%D I need to verify if this indeed will make it into \type {math-ini.mkiv}, that is: +%D does Alan use it? \ifdefined\t \else \unexpanded\def\t{\mathortext\text\mathtext} \fi \ifdefined\w \else \unexpanded\def\w{\mathortext\word\mathword} \fi @@ -32,8 +36,6 @@ \let\w\mathword \to \everymathematics -% \let\assumelongusagecs\relax % todo: fails on legends-001.tex - -% done +%D We're done. \protect \endinput diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index e59b015f4..54ec96ca5 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.06.11 21:26} +\edef\contextversion{2020.06.12 17:40} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index 28322d492..f309e7803 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.06.11 21:26} +\edef\contextversion{2020.06.12 17:40} \edef\contextkind {beta} %D Kind of special: @@ -231,7 +231,7 @@ \loadmarkfile{pack-cut} -\loadmarkfile{lang-mis} +\loadmkxlfile{lang-mis} % LMTX \loadmarkfile{lang-url} \loadmarkfile{lang-def} diff --git a/tex/context/base/mkiv/grph-trf.lua b/tex/context/base/mkiv/grph-trf.lua index f476ec692..b152a54db 100644 --- a/tex/context/base/mkiv/grph-trf.lua +++ b/tex/context/base/mkiv/grph-trf.lua @@ -114,7 +114,8 @@ interfaces.implement { name = "analyzerotate", actions = analyzerotate, arguments = { - "integer", +-- "integer", + "number", "dimension", "dimension", "dimension", diff --git a/tex/context/base/mkiv/lang-mis.mkxl b/tex/context/base/mkiv/lang-mis.mkxl new file mode 100644 index 000000000..c01a3eada --- /dev/null +++ b/tex/context/base/mkiv/lang-mis.mkxl @@ -0,0 +1,563 @@ +%D \module +%D [ file=lang-mis, +%D version=1997.03.20, % used to be supp-lan.tex +%D title=\CONTEXT\ Language Macros, +%D subtitle=Compounds, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This one will be updated stepwise to \LMTX. See lang-mis.mkiv for previous +%D implementations and removed code. + +\writestatus{loading}{ConTeXt Language Macros / Compounds} + +%D More or less replaced. + +%D \gdef\starttest#1\stoptest{\starttabulate[|l|l|p|]#1\stoptabulate} +%D \gdef\test #1{\NC\detokenize{#1}\NC\hyphenatedword{#1}\NC#1\NC\NR} + +\unprotect + +%D One of \TEX's strong points in building paragraphs is the way hyphenations are +%D handled. Although for real good hyphenation of non||english languages some +%D extensions to the program are needed, fairly good results can be reached with the +%D standard mechanisms and an additional macro, at least in Dutch. +%D +%D \CONTEXT\ originates in the wish to typeset educational materials, especially in +%D a technical environment. In production oriented environments, a lot of compound +%D words are used. Because the Dutch language poses no limits on combining words, we +%D often favor putting dashes between those words, because it facilitates reading, +%D at least for those who are not that accustomed to it. +%D +%D In \TEX\ compound words, separated by a hyphen, are not hyphenated at all. In +%D spite of the multiple pass paragraph typesetting this can lead to parts of words +%D sticking into the margin. The solution lays in saying \type +%D {spoelwater||terugwinunit} instead of \type {spoelwater-terugwinunit}. By using a +%D one character command like \type {|}, delimited by the same character \type {|}, +%D we get ourselves both a decent visualization (in \TEXEDIT\ and colored verbatim +%D we color these commands yellow) and an efficient way of combining words. +%D +%D The sequence \type{||} simply leads to two words connected by a hyphen. Because +%D we want to distinguish such a hyphen from the one inserted when \TEX\ hyphenates +%D a word, we use a bit longer one. +%D +%D \hyphenation {spoel-wa-ter te-rug-win-unit} +%D +%D \starttest +%D \test {spoelwater||terugwinunit} +%D \stoptest +%D +%D As we already said, the \type{|} is a command. This commands accepts an optional +%D argument before it's delimiter, which is also a \type{|}. +%D +%D \hyphenation {po-ly-meer che-mie} +%D +%D \starttest +%D \test {polymeer|*|chemie} +%D \stoptest +%D +%D Arguments like \type{*} are not interpreted and inserted directly, in contrary to +%D arguments like: +%D +%D \starttest +%D \test {polymeer|~|chemie} +%D \test {|(|polymeer|)|chemie} +%D \test {polymeer|(|chemie|)| } +%D \stoptest +%D +%D Although such situations seldom occur |<|we typeset thousands of pages before we +%D encountered one that forced us to enhance this mechanism|>| we also have to take +%D care of comma's. +%D +%D \hyphenation {uit-stel-len} +%D +%D \starttest +%D \test {op||, in|| en uitstellen} +%D \stoptest +%D +%D The next special case (concerning quotes) was brought to my attention by Piet +%D Tutelaers, one of the driving forces behind rebuilding hyphenation patterns for +%D the dutch language.\footnote{In 1996 the spelling of the dutch language has been +%D slightly reformed which made this topic actual again.} We'll also take care of +%D this case. +%D +%D \starttest +%D \test {AOW|'|er} +%D \test {cd|'|tje} +%D \test {ex|-|PTT|'|er} +%D \test {rock|-|'n|-|roller} +%D \stoptest +%D +%D Tobias Burnus pointed out that I should also support something like +%D +%D \starttest +%D \test {well|_|known} +%D \stoptest +%D +%D to stress the compoundness of hyphenated words. +%D +%D Of course we also have to take care of the special case: +%D +%D \starttest +%D \test {text||color and ||font} +%D \stoptest + +%D \macros +%D {installdiscretionaries} +%D +%D The mechanism described here is one of the older inner parts of \CONTEXT. The +%D most recent extensions concerns some special cases as well as the possibility to +%D install other characters as delimiters. The prefered way of specifying compound +%D words is using \type{||}, which is installed by: +%D +%D \starttyping +%D \installdiscretionary | - +%D \stoptyping +%D +%D Some alternative definitions are: +%D +%D \startbuffer +%D \installdiscretionary * - +%D \installdiscretionary + - +%D \installdiscretionary / - +%D \installdiscretionary ~ - +%D \stopbuffer +%D +%D \typebuffer +%D +%D after which we can say: +%D +%D \start \getbuffer +%D \starttest +%D \test {test**test**test} +%D \test {test++test++test} +%D \test {test//test//test} +%D \test {test~~test~~test} +%D \stoptest +%D \stop + +%D \macros +%D {compoundhyphen} +%D +%D Now let's go to the macros. First we define some variables. In the main \CONTEXT\ +%D modules these can be tuned by a setup command. Watch the (maybe) better looking +%D compound hyphen. + +% hm why ex + +\ifx\compoundhyphen \undefined + \unexpanded\def\compoundhyphen {\hbox{-\kern-.10775\emwidth-}} % .25\exheight +\fi + +%D The last two variables are needed for subsentences |<|like this one|>| which we +%D did not yet mention. We want to enable breaking but at the same time don't want +%D compound characters like |-| or || to be separated from the words. \TEX\ hackers +%D will recognise the next two macro's: + +\ifx\prewordbreak \undefined \unexpanded\def\prewordbreak {\penalty\plustenthousand\hskip\zeropoint\relax} \fi +\ifx\postwordbreak\undefined \unexpanded\def\postwordbreak {\penalty\zerocount \hskip\zeropoint\relax} \fi +\ifx\hspaceamount \undefined \def\hspaceamount#1#2{.16667\emwidth} \fi % language specific + +%unexpanded\def\permithyphenation{\ifhmode\prewordbreak\fi} % doesn't remove spaces +\unexpanded\def\permithyphenation{\ifhmode\wordboundary\fi} % doesn't remove spaces + +%D \macros +%D {beginofsubsentence,endofsubsentence, +%D beginofsubsentencespacing,endofsubsentencespacing} +%D +%D In the previous macros we provided two hooks which can be used to support nested +%D sub||sentences. In \CONTEXT\ these hooks are used to insert a small space when +%D needed. + +%D The following piece of code is a torture test compound handling. The \type +%D {\relax} before the \type {\ifmmode} is needed because of the alignment scanner +%D (in \ETEX\ this problem is not present because there a protected macro is not +%D expanded. Thanks to Tobias Burnus for providing this example. +%D +%D \startformula +%D \left|f(x_n)-{1\over2}\right| = +%D {\cases{|{1\over2}-x_n| &for $0\le x_n < {1\over2}$\cr +%D |x_n-{1\over2}| &for ${1\over2}<x_n\le1$ \cr}} +%D \stopformula + +\installcorenamespace{discretionaryaction} +\installcorenamespace{discretionarytext} +\installcorenamespace{discretionarymath} +\installcorenamespace{discretionaryboth} +\installcorenamespace{discretionarymode} + +\unexpanded\def\installdiscretionary#1#2% + {\setevalue{\??discretionarymath\detokenize{#1}}{\detokenize{#1}}% ? + \setvalue {\??discretionarytext\detokenize{#1}}{#2}% + \setvalue {\??discretionaryboth\detokenize{#1}}{\lang_discretionaries_command#1}% + \scratchcounter\expandafter`\detokenize{#1}% + \expandafter\uedcatcodecommand\expandafter\ctxcatcodes\expandafter\scratchcounter\csname\??discretionaryboth\detokenize{#1}\endcsname} + +\unexpanded\def\handlemathmodediscretionary#1{\ifcsname\??discretionarymath\detokenize{#1}\endcsname\lastnamedcs} +\unexpanded\def\handletextmodediscretionary#1{\ifcsname\??discretionarytext\detokenize{#1}\endcsname\lastnamedcs} + +\unexpanded\def\installdiscretionaries#1#2{\writestatus\m!system{use \string \installdiscretionary}} % obsolete + +\setnewconstant\discretionarymode\plusone + +\unexpanded\def\ignorediscretionaries{\discretionarymode\zerocount} +\unexpanded\def\obeydiscretionaries {\discretionarymode\plusone} + +\def\lang_discretionaries_command + {% if direct if, we need \relax for lookahead in math mode + \csname\??discretionarymode + \ifcase\discretionarymode + n% + \else\ifmmode + m% + \else + t% + \fi\fi + \endcsname} + +\setvalue{\??discretionarymode n}#1% + {\detokenize{#1}} + +%D The macro \type{\lang_discretionaries_check_before} takes care of loners like +%D \type{||word}, while it counterpart \type {\lang_discretionaries_check_after} is +%D responsible for handling the comma. + +\newsignal\compoundbreakpoint + +\newconditional\punctafterdiscretionary +\newconditional\spaceafterdiscretionary + +\def\lang_discretionaries_check_before %i sused grouped + {\ifvmode + \dontleavehmode + \fi + \ifhmode + %\begingroup + %\setbox\scratchbox\lastbox + %\ifzeropt\wd\scratchbox + % \box\scratchbox\relax + % \endgroup + % \let\postwordbreak\prewordbreak + %\else + % \box\scratchbox\relax + % \endgroup + %\fi + \fi} + +\def\lang_discretionaries_check_after + {\setfalse\punctafterdiscretionary + \setfalse\spaceafterdiscretionary + \ifx\blankspace\nextnext \settrue \spaceafterdiscretionary \orelse + \ifx\space \nextnext \settrue \spaceafterdiscretionary \orelse + \ifx .\nextnext \settrue \punctafterdiscretionary \orelse + \ifx ,\nextnext \settrue \punctafterdiscretionary \orelse + \ifx :\nextnext \settrue \punctafterdiscretionary \orelse + \ifx ;\nextnext \settrue \punctafterdiscretionary \fi} + +\letvalue{\??discretionarymode m}\handlemathmodediscretionary + +\setvalue{\??discretionarymode t}#1% + {\bgroup + \let\nextnextnext\egroup + \def\next##1#1% + {\def\next{\activedododotextmodediscretionary#1{##1}}% + \futurelet\nextnext\next}% + \next} + +\let\discretionarytoken \relax +\let\textmodediscretionary\relax + +\unexpanded\def\activedododotextmodediscretionary#1#2% + {\edef\discretionarytoken{\detokenize{#2}}% + \def\textmodediscretionary{\handletextmodediscretionary{#1}}% + \lang_discretionaries_check_after + \ifx\discretionarytoken\empty + \ifx#1\nextnext % takes care of ||| and +++ and ...... + \ifcsname\??discretionaryaction\string#1\endcsname + \lastnamedcs + \orelse\ifconditional\spaceafterdiscretionary + %\prewordbreak\hbox{\string#1}\relax + \wordboundary\hbox{\string#1}\relax + \orelse\ifconditional\punctafterdiscretionary + %\prewordbreak\hbox{\string#1}\relax + \wordboundary\hbox{\string#1}\wordboundary + \else + %\prewordbreak\hbox{\string#1}\prewordbreak + \wordboundary\hbox{\string#1}\wordboundary + \fi + \def\nextnextnext{\afterassignment\egroup\let\next=}% + \else + \lang_discretionaries_check_before + % the next line has been changed (20050203) + % \prewordbreak\hbox{\textmodediscretionary\nextnext}\postwordbreak + % but an hbox blocks a possible \discretionary + \ifcsname\??discretionaryaction\endcsname + \lastnamedcs + \orelse\ifconditional\spaceafterdiscretionary + %\prewordbreak\textmodediscretionary\relax + \wordboundary\textmodediscretionary\relax + \orelse\ifconditional\punctafterdiscretionary + %\prewordbreak\textmodediscretionary\relax + \wordboundary\textmodediscretionary\relax + \else + %\prewordbreak\textmodediscretionary\prewordbreak + \wordboundary\textmodediscretionary\wordboundary + \fi + \fi + \orelse\ifcsname\??discretionaryaction\discretionarytoken\endcsname + \lastnamedcs + \else + \lang_discretionaries_check_before + \ifconditional\spaceafterdiscretionary + %\prewordbreak\hbox{#2}\relax + \wordboundary\hbox{#2}\relax + \orelse\ifconditional\punctafterdiscretionary + %\prewordbreak\hbox{#2}\relax + \wordboundary\hbox{#2}\relax + \else + %\prewordbreak\discretionary{\hbox{#2}}{}{\hbox{#2}}\postwordbreak + \wordboundary\discretionary{\hbox{#2}}{}{\hbox{#2}}\wordboundary + \fi + \fi + \nextnextnext} + +%D \macros +%D {directdiscretionary} +%D +%D In those situations where the nature of characters is less predictable, we can +%D use the more direct approach: + +\unexpanded\def\directdiscretionary + {\csname\??discretionarymode + \ifcase\discretionarymode + n% + \else + d% + \fi + \endcsname} + +\unexpanded\def\indirectdiscretionary + {\csname\??discretionarymode + \ifcase\discretionarymode + n% + \else + i% + \fi + \endcsname} + +\setuvalue{\??discretionarymode d}#1% + {\edef\discretionarytoken{\detokenize{#1}}% + \let\textmodediscretionary\compoundhyphen + \ifcsname\??discretionaryaction\discretionarytoken\endcsname + \expandafter\lastnamedcs + \else + \expandafter\indirectdiscretionary + \fi{#1}} + +\setuvalue{\??discretionarymode i}#1% + %{\prewordbreak\discretionary{\hbox{#1}}{}{\hbox{#1}}\postwordbreak} + {\wordboundary\discretionary{\hbox{#1}}{}{\hbox{#1}}\wordboundary} + +\unexpanded\def\definetextmodediscretionary #1 + {\setvalue{\??discretionaryaction\detokenize{#1}}} + +% \start \hsize 1mm +% test |||test test|||, test\blank +% test test|-|, test|-| and test|-|test\blank +% test test|_|, test|_| and test|_|test\blank +% test cd|'|tje\blank +% test |(|test test|)|, test\blank +% test test test|x|, test\blank +% test|~|test +% test|^|test +% \stop + +% x\discretionary{1}{2}{3}xxxxxxx +% xxxxxxx\discretionary{1}{2}{3}x +% +% xxx3xxx +% xxx1<newline>2xxx + +\def\lang_discretionaries_hyphen_like#1#2% + {\ifconditional\spaceafterdiscretionary + %prewordbreak\hbox{#1}\relax + \wordboundary\hbox{#1}\relax + \else\ifconditional\punctafterdiscretionary + %prewordbreak\hbox{#1}\relax + \wordboundary\hbox{#1}\relax + \else + %\prewordbreak#2\postwordbreak % was prewordbreak + \wordboundary#2\wordboundary + \fi\fi} + +\definetextmodediscretionary {} + {\lang_discretionaries_hyphen_like\textmodehyphen\textmodehyphendiscretionary} + +\definetextmodediscretionary - + {\lang_discretionaries_hyphen_like\normalhyphen\normalhyphendiscretionary} + +\definetextmodediscretionary _ + {\lang_discretionaries_hyphen_like\composedhyphen\composedhyphendiscretionary} + +\definetextmodediscretionary ) + {\lang_discretionaries_hyphen_like{)}{\discretionary{-)}{}{)}}} + +\definetextmodediscretionary ( + {\ifdim\lastskip>\zeropoint + %(\prewordbreak + (\wordboundary + \else + %\prewordbreak\discretionary{}{(-}{(}\prewordbreak + \wordboundary\discretionary{}{(-}{(}\wordboundary + \fi} + +\definetextmodediscretionary ~ + %{\prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak} + {\wordboundary\discretionary{-}{}{\thinspace}\wordboundary} + +\definetextmodediscretionary ' + %{\prewordbreak\discretionary{-}{}{'}\postwordbreak} + {\wordboundary\discretionary{-}{}{'}\wordboundary} + +\definetextmodediscretionary ^ + %{\prewordbreak\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}% + % \postwordbreak} % bugged + {\wordboundary\discretionary{\hbox{\normalstartimath|\normalstopimath}}{}{\hbox{\normalstartimath|\normalstopimath}}% + \wordboundary} % bugged + +\definetextmodediscretionary < + %{\beginofsubsentence\prewordbreak\beginofsubsentencespacing + {\beginofsubsentence\wordboundary\beginofsubsentencespacing + \aftergroup\ignorespaces} % tricky, we need to go over the \nextnextnext + +\definetextmodediscretionary > + {\removeunwantedspaces + %\endofsubsentencespacing\prewordbreak\endofsubsentence} + \endofsubsentencespacing\wordboundary\endofsubsentence} + +\definetextmodediscretionary = + {\removeunwantedspaces + %\prewordbreak\midsentence\prewordbreak + \wordboundary\midsentence\wordboundary + \aftergroup\ignorespaces} + +% french + +%definetextmodediscretionary : {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:} +%definetextmodediscretionary ; {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};} +%definetextmodediscretionary ? {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?} +%definetextmodediscretionary ! {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!} + +\definetextmodediscretionary : {\removeunwantedspaces\wordboundary\kern\hspaceamount\empty{:}:} +\definetextmodediscretionary ; {\removeunwantedspaces\wordboundary\kern\hspaceamount\empty{;};} +\definetextmodediscretionary ? {\removeunwantedspaces\wordboundary\kern\hspaceamount\empty{?}?} +\definetextmodediscretionary ! {\removeunwantedspaces\wordboundary\kern\hspaceamount\empty{!}!} + +%definetextmodediscretionary * {\prewordbreak\discretionary{-}{}{\kern.05\emwidth}\prewordbreak} +\definetextmodediscretionary * {\wordboundary\discretionary{-}{}{\kern.05\emwidth}\wordboundary} + +% spanish + +%definetextmodediscretionary ?? {\prewordbreak\questiondown} +%definetextmodediscretionary !! {\prewordbreak\exclamdown} + +\definetextmodediscretionary ?? {\wordboundary\questiondown} +\definetextmodediscretionary !! {\wordboundary\exclamdown} + +%D \installdiscretionary | + +%D \installdiscretionary + = + +\def\defaultdiscretionaryhyphen{\compoundhyphen} + +\installdiscretionary | \defaultdiscretionaryhyphen % installs in ctx and prt will fall back on it + +%D \macros +%D {fakecompoundhyphen} +%D +%D In headers and footers as well as in active pieces of text we need a dirty hack. +%D Try to imagine what is needed to savely break the next text across a line and at +%D the same time make the words interactive. +%D +%D \starttyping +%D \goto{Some||Long||Word} +%D \stoptyping + +\unexpanded\def\fakecompoundhyphen + {\def\|{\mathortext\vert\lang_compounds_fake_hyphen}} + +\def\lang_compounds_fake_hyphen + {\def##1|% + {\doifelsenothing{##1}\compoundhyphen{##1}% + \kern\compoundbreakpoint\allowbreak}} + +%D \macros +%D {midworddiscretionary} +%D +%D If needed, one can add a discretionary hyphen using \type +%D {\midworddiscretionary}. This macro does the same as \PLAIN\ \TEX's \type {\-}, +%D but, like the ones implemented earlier, this one also looks ahead for spaces and +%D grouping tokens. + +\unexpanded\def\midworddiscretionary + {\futurelet\nexttoken\lang_discretionaries_mid_word} + +\def\lang_discretionaries_mid_word + {\ifx\nexttoken\blankspace\orelse + \ifx\nexttoken\bgroup \orelse + \ifx\nexttoken\egroup \orelse + \discretionary{-}{}{}% + \fi} + +\let\ignorecompoundcharacter\relax + +%D \macros +%D {disablediscretionaries,disablecompoundcharacter} +%D +%D Occasionally we need to disable this mechanism. For the moment we assume that +%D \type {|} is used. + +\let\disablediscretionaries \ignorediscretionaries +\let\disablecompoundcharacters\ignorecompoundcharacter + +%D \macros +%D {normalcompound} +%D +%D Handy in for instance XML. (Kind of obsolete) + +\ifdefined\normalcompound \else \let\normalcompound=| \fi + +%D \macros +%D {compound} +%D +%D We will overload the already active \type {|} so we have to save its meaning in +%D order to be able to use this handy macro. +%D +%D \starttyping +%D so test\compound{}test can be used instead of test||test +%D \stoptyping + +\bgroup + + \catcode\barasciicode\activecatcode + + \unexpanded\gdef\compound#1{|#1|} + + \doglobal \appendtoks + \def|#1|{\ifx#1\empty\empty-\else#1\fi}% + \to \everysimplifycommands + +\egroup + +%D Here we hook some code into the clean up mechanism needed for verbatim data. + +\appendtoks + %\disablecompoundcharacters + \disablediscretionaries +\to \everycleanupfeatures + +\protect \endinput diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv index f624f8bc6..918238fd2 100644 --- a/tex/context/base/mkiv/math-ini.mkiv +++ b/tex/context/base/mkiv/math-ini.mkiv @@ -1760,7 +1760,7 @@ \setupmathematics [\v!autopunctuation=\v!no] % no | yes | all | comma | yes,semicolon | all,semicolon -%D The consequences of settign this are as follows: +%D The consequences of setting this are as follows: %D %D \def\TestA#1#2#3% %D {\ifnum#1=0 \type{#2}\else\setupmathematics[autopunctuation={#2}]$#3$\fi} diff --git a/tex/context/base/mkiv/math-ini.mkxl b/tex/context/base/mkiv/math-ini.mkxl index 41b4e5d53..910337e22 100644 --- a/tex/context/base/mkiv/math-ini.mkxl +++ b/tex/context/base/mkiv/math-ini.mkxl @@ -1652,6 +1652,8 @@ \setnewconstant\c_math_semicolon"003B \setnewconstant\c_math_special "8000 +% todo: use \Umathclass\c_math_comma\mathpunctcode etc for temporary switching + \def\math_set_o_comma {\Umathcode\c_math_comma \mathordcode \zerocount\c_math_comma} \def\math_set_p_comma {\Umathcode\c_math_comma \mathpunctcode\zerocount\c_math_comma} \def\math_set_o_period {\Umathcode\c_math_period \mathordcode \zerocount\c_math_period} @@ -1666,6 +1668,8 @@ \unexpanded\def\math_punctuation_nop_period {\begingroup\math_set_o_period .\endgroup} \unexpanded\def\math_punctuation_nop_semicolon{\begingroup\math_set_p_semicolon;\endgroup} +% todo: use new lookahead stuff + \unexpanded\def\math_punctuation_all_comma {\futurelet\nexttoken\math_punctuation_comma_next} \unexpanded\def\math_punctuation_all_period {\futurelet\nexttoken\math_punctuation_period_next} \unexpanded\def\math_punctuation_all_semicolon{\futurelet\nexttoken\math_punctuation_semicolon_next} diff --git a/tex/context/base/mkiv/math-rad.mkvi b/tex/context/base/mkiv/math-rad.mkvi index c279c3526..5d7dd1474 100644 --- a/tex/context/base/mkiv/math-rad.mkvi +++ b/tex/context/base/mkiv/math-rad.mkvi @@ -30,7 +30,7 @@ \unexpanded\def\sqrt{\doifelsenextoptionalcs\rootwithdegree\rootwithoutdegree} -\ifcase \contextlmtxmode +% \ifcase \contextlmtxmode \unexpanded\def\styledrootradical#1#2% so that \text works ok ... \rootradical behaves somewhat weird {\normalexpanded{\rootradical @@ -38,12 +38,12 @@ {\noexpand\triggermathstyle{\number\normalmathstyle}% \normalunexpanded{#2}}}} -\else % experimental new keyword: (maybe keywords should come after the symbol) - - \unexpanded\def\styledrootradical#1#2% so that \text works ok ... \rootradical behaves somewhat weird - {\Uroot style \normalmathstyle "0 "221A {#1}{#2}} - -\fi +% \else % experimental new keyword: (maybe keywords should come after the symbol) +% +% \unexpanded\def\styledrootradical#1#2% so that \text works ok ... \rootradical behaves somewhat weird +% {\Uroot style \normalmathstyle "0 "221A {#1}{#2}} +% +% \fi \unexpanded\def\rootwithdegree[#1]{\rootradical{#1}} \unexpanded\def\rootwithoutdegree {\rootradical {}} diff --git a/tex/context/base/mkiv/spac-lin.mkiv b/tex/context/base/mkiv/spac-lin.mkiv index d862f6d81..870e85954 100644 --- a/tex/context/base/mkiv/spac-lin.mkiv +++ b/tex/context/base/mkiv/spac-lin.mkiv @@ -101,7 +101,7 @@ \let\obeyedline\spac_lines_obeyed_line \activatespacehandler{\linesparameter\c!space}% \dostarttagged\t!line\empty - \GotoPar} % this will become a nice lowercased helper + \ignorepars} % this will become a nice lowercased helper % we could have states instead and handle option in there diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 2a2a4781c..4c69b8810 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex ae6c11e6c..ce6328518 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-des.mkvi b/tex/context/base/mkiv/strc-des.mkvi index 76f878f5f..5ae4c25eb 100644 --- a/tex/context/base/mkiv/strc-des.mkvi +++ b/tex/context/base/mkiv/strc-des.mkvi @@ -221,8 +221,8 @@ {\csname\??constructionstophandler \v!construction\endcsname\endgroup}} \unexpanded\setvalue{\??constructionstarthandler\v!description}% - {\BeforePar{\csname\??constructionstarthandler\v!construction\endcsname}% - \GotoPar} + {\dogotopar + {\csname\??constructionstarthandler\v!construction\endcsname}} \unexpanded\setvalue{\??constructionstophandler\v!description}% {\csname\??constructionstophandler\v!construction\endcsname diff --git a/tex/context/base/mkiv/strc-sec.mkiv b/tex/context/base/mkiv/strc-sec.mkiv index 0e30d92fa..a1f02b740 100644 --- a/tex/context/base/mkiv/strc-sec.mkiv +++ b/tex/context/base/mkiv/strc-sec.mkiv @@ -998,9 +998,9 @@ % ignorespaces prevents spaces creeping in when after=\dontleavehmode \dostarttagged\t!sectioncontent\empty \ifconditional\headisdisplay - \ignorespaces + \expandafter\ignorespaces \else - \expandafter\GotoPar + \expandafter\ignorepars \fi} % typesetting (the getters are public) diff --git a/tex/context/base/mkiv/supp-box.lua b/tex/context/base/mkiv/supp-box.lua index 353562344..a39bf392f 100644 --- a/tex/context/base/mkiv/supp-box.lua +++ b/tex/context/base/mkiv/supp-box.lua @@ -76,6 +76,7 @@ local getdimensions = nuts.dimensions local hpack = nuts.hpack local vpack = nuts.vpack local traverse_id = nuts.traverse_id +local traverse = nuts.traverse local free = nuts.free local findtail = nuts.tail @@ -835,7 +836,7 @@ implement { if CONTEXTLMTXMODE > 0 then - interfaces.implement { + implement { name = "widthuptohere", public = true, protected = true, @@ -855,7 +856,7 @@ if CONTEXTLMTXMODE > 0 then end -interfaces.implement { +implement { name = "doifelseindented", public = true, protected = true, @@ -882,3 +883,25 @@ interfaces.implement { commands.doifelse(b) end, } + +implement { + name = "noflinesinbox", + public = true, + protected = false, + arguments = "integer", + actions = function(n) + local c = 0 + local b = getbox(n) + if b then + b = getlist(b) + if b then + for n, id in traverse(b) do + if id == hlist_code or id == vlist_code then + c = c + 1 + end + end + end + end + context(c) + end, +} diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv index 35b400b09..f5e8af4cc 100644 --- a/tex/context/base/mkiv/supp-box.mkiv +++ b/tex/context/base/mkiv/supp-box.mkiv @@ -541,13 +541,16 @@ %D \determinenoflines{\definedfont[Sans at 40pt]test\\test} %D \stoptyping -\def\syst_boxes_determine_noflines % can be mkiv'd - {\beginofshapebox - \unvbox\nextbox - \endofshapebox - \globalscratchcounter\zerocount - \reshapebox{\global\advance\globalscratchcounter\plusone}% - \expandafter\egroup\expandafter\noflines\the\globalscratchcounter\relax} +% \def\syst_boxes_determine_noflines % can be mkiv'd +% {\beginofshapebox +% \unvbox\nextbox +% \endofshapebox +% \globalscratchcounter\zerocount +% \reshapebox{\global\advance\globalscratchcounter\plusone}% +% \expandafter\egroup\expandafter\noflines\the\globalscratchcounter\relax} + +\def\syst_boxes_determine_noflines + {\expandafter\egroup\expandafter\noflines\noflinesinbox\nextbox\relax} \unexpanded\def\determinenoflines {\bgroup diff --git a/tex/context/base/mkiv/supp-box.mkxl b/tex/context/base/mkiv/supp-box.mkxl index bb3c71aaa..b081f83b0 100644 --- a/tex/context/base/mkiv/supp-box.mkxl +++ b/tex/context/base/mkiv/supp-box.mkxl @@ -503,13 +503,16 @@ %D \determinenoflines{\definedfont[Sans at 40pt]test\\test} %D \stoptyping -\def\syst_boxes_determine_noflines % can be mkiv'd - {\beginofshapebox - \unvbox\nextbox - \endofshapebox - \globalscratchcounter\zerocount - \reshapebox{\global\advance\globalscratchcounter\plusone}% - \expandafter\egroup\expandafter\noflines\the\globalscratchcounter\relax} +% \def\syst_boxes_determine_noflines % can be mkiv'd +% {\beginofshapebox +% \unvbox\nextbox +% \endofshapebox +% \globalscratchcounter\zerocount +% \reshapebox{\global\advance\globalscratchcounter\plusone}% +% \expandafter\egroup\expandafter\noflines\the\globalscratchcounter\relax} + +\def\syst_boxes_determine_noflines + {\expandafter\egroup\expandafter\noflines\noflinesinbox\nextbox\relax} \unexpanded\def\determinenoflines {\bgroup diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 5e02a8fa0..d268f2fb6 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -5347,24 +5347,28 @@ \newtoks\BeforePar \newtoks\AfterPar -\def\redowithpar\par +\unexpanded\def\redowithpar\par {\doifelsenextchar\par\redowithpar\dodowithpar}% -\def\dowithpar#1#2% +\unexpanded\def\dowithpar#1#2% {\def\dodowithpar##1\par{#1##1#2}% \redowithpar\par} -\def\redogotopar\par +\unexpanded\def\redogotopar\par {\doifelsenextchar\par\redogotopar\dodogotopar}% -\def\dogotopar#1% +\unexpanded\def\dogotopar#1% {\def\dodogotopar{#1}% \redogotopar\par} -\def\dogotoparcs#1% +\unexpanded\def\dogotoparcs#1% {\let\dodogotopar#1% \redogotopar\par} +\ifdefined \ignorepars \else + \unexpanded\def\ignorepars{\dogotoparcs\relax} +\fi + \unexpanded\def\GetPar {\expanded {\dowithpar diff --git a/tex/context/base/mkiv/syst-aux.mkxl b/tex/context/base/mkiv/syst-aux.mkxl index d78a7b307..8188577e6 100644 --- a/tex/context/base/mkiv/syst-aux.mkxl +++ b/tex/context/base/mkiv/syst-aux.mkxl @@ -50,10 +50,11 @@ \let\startlmtxmode\relax \let\stoplmtxmode \relax -\def\startmkivmode#1\stopmkivmode{} +\def\startmkivmode#-\stopmkivmode{} \let\stopmkivmode \relax -%D As we don't have namespace definers yet, we use a special one: +%D As we don't have namespace definers yet, we use a special one. Later we will +%D do a better job. \ifdefined\c_syst_helpers_n_of_namespaces @@ -79,7 +80,7 @@ %D \macros %D {normalspace} %D -%D There is already \type{\space} but just to be sure we also provide: +%D There is already \type{\space} but just to be sure we also provide this one: \def\normalspace{ } @@ -88,7 +89,8 @@ %D !!width, !!height, !!depth, !!string, !!done} %D %D We define some more \COUNTERS\ and \DIMENSIONS. We also define some shortcuts to -%D the local scatchregisters~0, 2, 4, 6 and~8. +%D the local scatchregisters~0, 2, 4, 6 and~8. These are kind of obsolete and +%D eventually they might get dropped! \newcount\!!counta \newtoks\!!toksa \newdimen\!!dimena \newbox\!!boxa \newcount\!!countb \newtoks\!!toksb \newdimen\!!dimenb \newbox\!!boxb @@ -137,7 +139,8 @@ %D %D To save memory, we use constants (sometimes called variables). Redefining these %D constants can have disastrous results. Of course, expanding them costs time, so -%D that's the price to pay. +%D that's the price to pay. More are defined elsewhere. Of course we later pay a +%D price when they need to be expanded. \def\v!prefix! {v!} \def\c!prefix! {c!} @@ -158,9 +161,8 @@ \def\s!empty {empty} -%D Sometimes we pass macros as arguments to commands that don't expand them -%D before interpretation. Such commands can be enclosed with \type {\expanded}, -%D like: +%D Sometimes we pass macros as arguments to commands that don't expand them before +%D interpretation. Such commands can be enclosed with \type {\expanded}, like: %D %D \starttyping %D \expanded{\setupsomething[\alfa]} @@ -183,7 +185,9 @@ \let\stopexpanded\relax %D Recent \TEX\ engines have a primitive \type {\expanded} and we will use that when -%D possible. After all, we can make not expandable macros now. +%D possible. After all, we can make not expandable macros now. The name clash is an +%D unfortunate fact and in retrospect I should nto have agreed to a primitive having +%D that same name. % We cannot use the next variant as first we need to adapt \type {##}'s in callers: % @@ -199,23 +203,7 @@ %D The next set of macros just do nothing, except that they get rid of a number of %D arguments. These zero references prevent intermediate storage. In principle that %D is more efficient but it probably won't be noticed. It's anyway cheaper on memory -%D access. - -% \def\gobbleoneargument #0{} -% \def\gobbletwoarguments #0#0{} -% \def\gobblethreearguments #0#0#0{} -% \def\gobblefourarguments #0#0#0#0{} -% \def\gobblefivearguments #0#0#0#0{} -% \def\gobblesixarguments #0#0#0#0{} -% \def\gobblesevenarguments #0#0#0#0#0{} -% \def\gobbleeightarguments #0#0#0#0#0#0{} -% \def\gobbleninearguments #0#0#0#0#0#0#0{} -% -% \def\gobbleoneoptional [#0]{} -% \def\gobbletwooptionals [#0][#0]{} -% \def\gobblethreeoptionals[#0][#0][#0]{} -% \def\gobblefouroptionals [#0][#0][#0][#0]{} -% \def\gobblefiveoptionals [#0][#0][#0][#0][#0]{} +%D access. We use versions that don't even store the arguments. \def\gobbleoneargument #-{} \def\gobbletwoarguments #-#-{} @@ -253,8 +241,8 @@ %D use more code and can be find in the \MKIV\ and \MKII\ files. \let\next \relax -\let\nextnext \relax -\let\nextnextnext \relax +\let\nextnext \relax % kind of obsolete +\let\nextnextnext \relax % kind of obsolete \let\nexttoken \relax \let\m_syst_action_yes\relax @@ -274,7 +262,11 @@ %D Because we will mostly use this macro for testing if the next character is \type %D {[}, we also make a slightly faster variant as it is not uncommon to have tens of %D thousands of calls to this test in a run. Of course it also is more convenient to -%D read a trace then. +%D read a trace then. Here we use a lookahead primitive that ignores (blank) spaces +%D which makes for less tracing clutter than the original definition. It's also +%D faster bit that will probably go unnoticed. Of course, hard||core \TEX ies whose +%D reputations depends on understanding obscure macro definitions will love the more +%D low level variants. \unexpanded\def\doifelsenextoptional#1#2% {\def\m_syst_action_yes{#1}% @@ -345,20 +337,24 @@ %D \egroup %D \stoptyping %D -%D The original kind of clumsy but working version is now replaced by a -%D simple macro. It's probably never really used anyway. And it can be -%D even less code in \LUAMETATEX: +%D The original kind of clumsy but working version is now replaced by a simple +%D macro. And it can be even less code in \LUAMETATEX: -%unexpanded\def\assumelongusagecs#1{\futureexpandisap\relax#1#1} \let\assumelongusagecs\expandafterpars +%D It's used to skip over empty lines in some constructs that we like to set up +%D spacy. We already permit par tokens (and equivalents) in math and some other +%D places visa engine features. And, \type {\long} stuff has been dropped for a long +%D time already (it is still optional in \lUATEX). But the \quote {long} in the +%D name kind of stuck. + %D \macros %D {blankspace} %D -%D Here is how this works. The \type {\let} primitive first picks up the to be -%D let name. Then it scans for an optional equal and when that is found it will -%D skip the next space, which is why we need an extra one to achieve our goal. -%D Such a \type {\blankspace} has the meaning \typ {blank space}. +%D Here is how this works. The \type {\let} primitive first picks up the to be let +%D name. Then it scans for an optional equal and when that is found it will skip the +%D next space, which is why we need an extra one to achieve our goal. Such a \type +%D {\blankspace} has the meaning \typ {blank space}. A typical \TEX ie definition: \normalexpanded{\let\noexpand\blankspace=\space\space} @@ -447,7 +443,8 @@ %D things that I remember being discussed in the perspective of \ETEX\ but it was %D rejected because it was not considered useful. Well, in \LUATEX\ we can surpress %D it and that is what we do in \MKIV. We're probably the only macro package that -%D needs it. That kind of configuration happens elsewhere. +%D needs it. That kind of configuration happens elsewhere. These macros are (mostly +%D for historic reasons) fully expandable. \def\doifelseundefined#1% {\ifcsname#1\endcsname @@ -480,7 +477,7 @@ %D {\undefined}! In \ETEX\ we have \type {\ifcsname} and that way of testing on %D existance is not the same as the one described here. Therefore we introduce: -\unexpanded\def\letbeundefined#1% potential stack buildup when used \global +\unexpanded\def\letbeundefined#1% {\expandafter\let\csname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue \unexpanded\def\localundefine#1% conditional @@ -566,8 +563,8 @@ %D \doifemptyelse {string} {then ...} {else ...} %D \stoptyping %D -%D This time, the string is not expanded, but we use the dedicated empty -%D checker here. +%D This time, the string is not expanded, but we use the dedicated empty checker +%D here. \unexpanded\def\doifelseempty#1% {\def\m_syst_string_one{#1}% @@ -794,7 +791,10 @@ %D \stoptyping %D %D Commands that are part of the list are expanded, so the use of this macro has its -%D limits. +%D limits. We use a new \LUAMETATEX\ feature that intercepts invalid macro arguments +%D by quitting when \type {\ignorearguments} is seen. That's why we act on the +%D arguments state. Again it permits leaner and meaner macro definitions with a bit +%D less clutter in tracing. \unexpanded\def\syst_helpers_process_comma_item#1,% {\ifarguments @@ -933,7 +933,8 @@ %D In the meantime we follow a different approach, often somewhat more heavy on the %D number of control sequences used, but that is no lomger a real issue. The code %D has been simplified and nwo uses the macro stack mechanism. If needed I can make -%D this more hip and a bit faster now but \unknown\ it's seldom used. +%D this more hip and a bit faster now but \unknown\ it's seldom used nowadays as we +%D have better ways now. \unexpanded\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% {\edef\m_syst_string_two{#1}% @@ -1201,7 +1202,11 @@ %D {doifnumberelse,doifnumber,doifnotnumber} %D %D The next macro executes a command depending of the outcome of a test on numerals. -%D We now use a \LUATEX\ feature but you might want to take a look at the originals +%D We now use a \LUATEX\ feature that permits a more robust checking, but you might +%D want to take a look at the originals. It's typically one of these new features +%D that probably only \CONTEXT\ will use, which is probably true for more such +%D features that no one ever asked for (but they are pretty generic in nature +%D anyway). \def\doifelsenumber#1% {\ifchknum#1\or @@ -1266,7 +1271,7 @@ %D %D Spaces embedded in the list, for instance after commas, spoil the search process. %D The gain in speed depends on the length of the argument (the longer the argument, -%D the less we gain). +%D the less we gain). The question is: do we still need these raw variants? \unexpanded\def\makerawcommalist[#1]#2% use \processnext ... here {\scratchtoks\emptytoks @@ -1353,9 +1358,6 @@ \fi \fi} -% \def\syst_helpers_raw_process_action_gobble#0\ignorearguments -% {} - \def\syst_helpers_raw_process_action_gobble#-\ignorearguments {} @@ -1541,11 +1543,6 @@ \def\syst_helpers_grab_parameter_next {\expandafterspaces\syst_helpers_grab_parameter} -% \unexpanded\def\dogetparameters#1[#2]#0[#4]% -% {\def\m_syst_parameter_n{#2}% -% \let\m_syst_parameter_s#1% -% \expandafterspaces\syst_helpers_grab_parameter#4\ignorearguments\ignorearguments} - \unexpanded\def\dogetparameters#1[#2]#-[#3]% {\def\m_syst_parameter_n{#2}% \let\m_syst_parameter_s#1% @@ -1602,7 +1599,8 @@ {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}% \normalexpanded{\processassignmentlist[#1]}\currentassignmentlistcommand} -%D \macros{currentvalue} +%D \macros +%D {currentvalue} %D %D Just in case a \type{\getparameter} argument itself ends up inside a \type %D {\write} or other expandable location, our new macro needs a default value. @@ -1644,10 +1642,10 @@ %D By using \type {\docopyvalue} we've prepared this command for use in a %D multi||lingual environment. -\unexpanded\def\copyparameters[#1]#2[#3]#4[#5]% - {\doifnot{#1}{#3} - {\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#3}}% ##1 - \processcommalist[#5]\syst_helpers_copy_parameter}} +\unexpanded\def\copyparameters[#1]#-[#2]#-[#3]% + {\doifnot{#1}{#2} + {\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#2}}% ##1 + \processcommalist[#3]\syst_helpers_copy_parameter}} %D \macros %D {ifparameters,checkparameters} @@ -1707,14 +1705,6 @@ \unexpanded\def\getcommalistsize[% {\futureexpand]\syst_helpers_get_comma_list_size_nop\syst_helpers_get_comma_list_size_yes} -% \def\syst_helpers_get_comma_list_size_yes -% {\syst_helpers_get_comma_list_size_yes_indeed\relax} -% -% \def\syst_helpers_get_comma_list_size_yes_indeed#1]% -% {\commalistcounter\zerocount -% \syst_helpers_get_comma_list_size #1,\ignorearguments\ignorearguments -% \edef\commalistsize{\the\commalistcounter}} - \def\syst_helpers_get_comma_list_size_yes#+]% {\commalistcounter\zerocount \syst_helpers_get_comma_list_size #1,\ignorearguments\ignorearguments @@ -1890,6 +1880,8 @@ %D Depending of the generousity of the user. Afterwards one can use the \type %D {\if...argument} boolean. For novice: watch the stepwise doubling of \type {#}'s. +%D NB : experimental versions in cont-exp.mkiv + %D Common: \newtoks\t_syst_aux @@ -1905,8 +1897,7 @@ %D Single: \unexpanded\def\dosingleempty#1% - {%syst_helpers_argument_reset - \t_syst_aux{#1}% + {\t_syst_aux{#1}% \futureexpand[\syst_helpers_single_empty_one_yes\syst_helpers_single_empty_one_nop} \def\syst_helpers_single_empty_one_nop @@ -1916,8 +1907,7 @@ %D Double \unexpanded\def\dodoubleempty#1% - {%syst_helpers_argument_reset - \t_syst_aux{#1}% + {\t_syst_aux{#1}% \futureexpand[\syst_helpers_double_empty_one_yes\syst_helpers_double_empty_one_nop} \def\syst_helpers_double_empty_one_yes[#1]% @@ -1937,8 +1927,7 @@ % Triple \unexpanded\def\dotripleempty#1% - {%syst_helpers_argument_reset - \t_syst_aux{#1}% + {\t_syst_aux{#1}% \futureexpand[\syst_helpers_triple_empty_one_yes\syst_helpers_triple_empty_one_nop} \def\syst_helpers_triple_empty_one_yes[#1]% @@ -1969,8 +1958,7 @@ %D Quadruple: \unexpanded\def\doquadrupleempty#1% - {%syst_helpers_argument_reset - \t_syst_aux{#1}% + {\t_syst_aux{#1}% \futureexpand[\syst_helpers_quadruple_empty_one_yes\syst_helpers_quadruple_empty_one_nop} \def\syst_helpers_quadruple_empty_one_yes[#1]% @@ -2013,8 +2001,7 @@ %D Quintuple: \unexpanded\def\doquintupleempty#1% - {%syst_helpers_argument_reset - \t_syst_aux{#1}% + {\t_syst_aux{#1}% \futureexpand[\syst_helpers_quintuple_empty_one_yes\syst_helpers_quintuple_empty_one_nop} \def\syst_helpers_quintuple_empty_one_yes[#1]% @@ -2070,8 +2057,7 @@ %D Sixtuple: \unexpanded\def\dosixtupleempty#1% - {%syst_helpers_argument_reset - \t_syst_aux{#1}% + {\t_syst_aux{#1}% \futureexpand[\syst_helpers_sixtuple_empty_one_yes\syst_helpers_sixtuple_empty_one_nop} \def\syst_helpers_sixtuple_empty_one_yes[#1]% @@ -2141,8 +2127,7 @@ %D Seventuple: \unexpanded\def\doseventupleempty#1% - {%syst_helpers_argument_reset - \t_syst_aux{#1}% + {\t_syst_aux{#1}% \futureexpand[\syst_helpers_seventuple_empty_one_yes\syst_helpers_seventuple_empty_one_nop} \def\syst_helpers_seventuple_empty_one_yes[#1]% @@ -2245,9 +2230,6 @@ %D %D This expands to \type{\ifsomething}. -% \def\strippedcsname -% {\expandafter\gobbleoneargument\string} - \let\strippedcsname\csstring %D \macros @@ -2290,14 +2272,12 @@ %D versatile (more object oriented) ones using the \type {\get..argument} commands. \unexpanded\def\complexorsimple#1% - {% \relax % prevents lookahead, brrr - \doifelsenextoptional + {\doifelsenextoptional {\firstargumenttrue \csname\s!complex\csstring#1\endcsname} {\firstargumentfalse\csname\s!simple \csstring#1\endcsname}} \unexpanded\def\complexorsimpleempty#1% - {% \relax % prevents lookahead, brrr - \doifelsenextoptional + {\doifelsenextoptional {\firstargumenttrue \csname\s!complex\csstring#1\endcsname} {\firstargumentfalse\csname\s!complex\csstring#1\endcsname[]}} @@ -2367,6 +2347,8 @@ %D \type {conditional} token. Okay, these macros are not called that often but it %D saves crap when tracing. +%D NB: experimental code in cont-exp.mkiv + \unexpanded\def\dosinglegroupempty#1% {\t_syst_aux{#1}% \futureexpand\bgroup\syst_helpers_single_empty_one_yes\syst_helpers_single_group_empty_one_nop} @@ -2544,60 +2526,6 @@ %D The next six macros (dedicated to Taco) can conveniently used to select %D arguments. Their names explain their functionality. -% \def\firstofoneargument #1{#1} -% -% \def\firstoftwoarguments #1#2{#1} -% \def\secondoftwoarguments #1#2{#2} -% -% \def\firstofthreearguments #1#2#3{#1} -% \def\secondofthreearguments #1#2#3{#2} -% \def\thirdofthreearguments #1#2#3{#3} -% -% \def\firstoffourarguments #1#2#3#4{#1} -% \def\secondoffourarguments #1#2#3#4{#2} -% \def\thirdoffourarguments #1#2#3#4{#3} -% \def\fourthoffourarguments #1#2#3#4{#4} -% -% \def\firstoffivearguments #1#2#3#4#5{#1} -% \def\secondoffivearguments #1#2#3#4#5{#2} -% \def\thirdoffivearguments #1#2#3#4#5{#3} -% \def\fourthoffivearguments #1#2#3#4#5{#4} -% \def\fifthoffivearguments #1#2#3#4#5{#5} -% -% \def\firstofsixarguments #1#2#3#4#5#6{#1} -% \def\secondofsixarguments#1#2#3#4#5#6{#2} -% \def\thirdofsixarguments #1#2#3#4#5#6{#3} -% \def\fourthofsixarguments#1#2#3#4#5#6{#4} -% \def\fifthofsixarguments #1#2#3#4#5#6{#5} -% \def\sixthofsixarguments #1#2#3#4#5#6{#6} - -% \def\firstofoneargument #1{#1} -% -% \def\firstoftwoarguments #1#0{#1} -% \def\secondoftwoarguments #0#2{#2} -% -% \def\firstofthreearguments #1#0#0{#1} -% \def\secondofthreearguments #0#2#0{#2} -% \def\thirdofthreearguments #0#0#3{#3} -% -% \def\firstoffourarguments #1#0#0#0{#1} -% \def\secondoffourarguments #0#2#0#0{#2} -% \def\thirdoffourarguments #0#0#3#0{#3} -% \def\fourthoffourarguments #0#0#0#4{#4} -% -% \def\firstoffivearguments #1#0#0#0#0{#1} -% \def\secondoffivearguments #0#2#0#0#0{#2} -% \def\thirdoffivearguments #0#0#3#0#0{#3} -% \def\fourthoffivearguments #0#0#0#4#0{#4} -% \def\fifthoffivearguments #0#0#0#0#5{#5} -% -% \def\firstofsixarguments #1#0#0#0#0#0{#1} -% \def\secondofsixarguments#0#2#0#0#0#0{#2} -% \def\thirdofsixarguments #0#0#3#0#0#0{#3} -% \def\fourthofsixarguments#0#0#0#4#0#0{#4} -% \def\fifthofsixarguments #0#0#0#0#5#0{#5} -% \def\sixthofsixarguments #0#0#0#0#0#6{#6} - \def\firstofoneargument #1{#1} \def\firstoftwoarguments #1#-{#1} @@ -2625,24 +2553,6 @@ \def\fifthofsixarguments #-#-#-#-#1#-{#1} \def\sixthofsixarguments #-#-#-#-#-#1{#1} -% \unexpanded\def\firstofoneunexpanded #1{#1} -% -% \unexpanded\def\firstoftwounexpanded #1#2{#1} -% \unexpanded\def\secondoftwounexpanded #1#2{#2} -% -% \unexpanded\def\firstofthreeunexpanded #1#2#3{#1} -% \unexpanded\def\secondofthreeunexpanded#1#2#3{#2} -% \unexpanded\def\thirdofthreeunexpanded #1#2#3{#3} - -% \unexpanded\def\firstofoneunexpanded #1{#1} -% -% \unexpanded\def\firstoftwounexpanded #1#0{#1} -% \unexpanded\def\secondoftwounexpanded #0#2{#2} -% -% \unexpanded\def\firstofthreeunexpanded #1#0#0{#1} -% \unexpanded\def\secondofthreeunexpanded#0#2#0{#2} -% \unexpanded\def\thirdofthreeunexpanded #0#0#3{#3} - \unexpanded\def\firstofoneunexpanded #1{#1} \unexpanded\def\firstoftwounexpanded #1#-{#1} @@ -2745,11 +2655,6 @@ \def\syst_helpers_grab_raw_parameter_next {\expandafterspaces\syst_helpers_grab_raw_parameter} -% \unexpanded\def\rawgetparameters#1[#2]#0[#4]% -% {\def\m_syst_parameter_n{#2}% -% %\expandafterspaces\syst_helpers_grab_raw_parameter#4\ignorearguments\ignorearguments} -% \expandafter\expandafterspaces\expandafter\syst_helpers_grab_raw_parameter#4\ignorearguments\ignorearguments} - \unexpanded\def\rawgetparameters#1[#2]#-[#3]% {\def\m_syst_parameter_n{#2}% %\expandafterspaces\syst_helpers_grab_raw_parameter#3\ignorearguments\ignorearguments} @@ -4078,26 +3983,28 @@ %D \type {\GotoPar}. This one leaves \type {\par} unchanged and is therefore more %D robust. On the other hand, \type {\AfterPar} is not supported. -\newtoks\BeforePar -\newtoks\AfterPar +\let\syst_helpers_par_before\relax +\let\syst_helpers_par_around\relax + +\unexpanded\def\dowithpar#1#2% + {\globalpushmacro\syst_helpers_par_around + \def\syst_helpers_par_around##1\par{#1##1#2\globalpopmacro\syst_helpers_par_around}% + \expandafter\syst_helpers_par_around\ignorepars} -\def\redowithpar\par - {\doifelsenextchar\par\redowithpar\dodowithpar}% +\unexpanded\def\dogotopar#1% + {\globalpushmacro\syst_helpers_par_before + \def\syst_helpers_par_before{#1\globalpopmacro\syst_helpers_par_before}% + \expandafter\syst_helpers_par_before\ignorepars} -\def\dowithpar#1#2% - {\def\dodowithpar##1\par{#1##1#2}% - \redowithpar\par} +\let\dogotoparcs\dogotopar -\def\redogotopar\par - {\doifelsenextchar\par\redogotopar\dodogotopar}% +\unexpanded\def\dogotoparstart + {\ignorepars} -\def\dogotopar#1% - {\def\dodogotopar{#1}% - \redogotopar\par} +%D This is old and kind of obsolete: -\def\dogotoparcs#1% - {\let\dodogotopar#1% - \redogotopar\par} +\newtoks\BeforePar +\newtoks\AfterPar \unexpanded\def\GetPar {\expanded diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c2128e8c3..0c71a68e8 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2020-06-11 21:26 +-- merge date : 2020-06-12 17:40 do -- begin closure to overcome local limits and interference |