summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2023-05-27 12:37:50 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2023-05-27 12:37:50 +0200
commit32381f97e98465953bfde24b4436093e70fbe70f (patch)
tree1f585cf7af509e76c64aca108cecd23acd6fb437
parentbb8ae12f4f94189fd1540b201e2aea78f485de97 (diff)
downloadcontext-32381f97e98465953bfde24b4436093e70fbe70f.tar.gz
2023-05-27 12:16:00
-rw-r--r--context-readme.txt51
-rw-r--r--context/data/scite/context/lexers/data/scite-context-data-context.lua4
-rw-r--r--context/data/scite/context/lexers/data/scite-context-data-tex.lua4
-rw-r--r--context/data/scite/context/scite-context-data-context.properties394
-rw-r--r--context/data/scite/context/scite-context-data-tex.properties270
-rw-r--r--doc/context/documents/general/manuals/lowlevel-accuracy.pdfbin0 -> 42897 bytes
-rw-r--r--doc/context/documents/general/manuals/lowlevel-paragraphs.pdfbin296768 -> 299328 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-de.pdfbin845580 -> 845187 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-en.pdfbin848669 -> 848873 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-fr.pdfbin843783 -> 843810 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-it.pdfbin844753 -> 844906 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-de.pdfbin319913 -> 319172 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-en.pdfbin317685 -> 316827 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-fr.pdfbin321113 -> 320303 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-it.pdfbin319712 -> 318817 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-mapping-nl.pdfbin319146 -> 318196 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-nl.pdfbin840670 -> 840853 bytes
-rw-r--r--doc/context/scripts/mkiv/mtx-install-modules.html6
-rw-r--r--doc/context/scripts/mkiv/mtx-install-modules.man6
-rw-r--r--doc/context/scripts/mkiv/mtx-install-modules.xml8
-rw-r--r--doc/context/sources/general/manuals/lowlevel/lowlevel-accuracy.tex304
-rw-r--r--doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex24
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-building.tex4
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex24
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex.tex2
-rw-r--r--scripts/context/lua/mtx-install-modules.lua155
-rw-r--r--scripts/context/lua/mtxrun.lua53
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua53
-rw-r--r--scripts/context/stubs/source/readme.txt80
-rw-r--r--scripts/context/stubs/unix/mtxrun53
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua53
-rw-r--r--source/luametatex/CMakeLists.txt528
-rw-r--r--source/luametatex/build.txt86
-rw-r--r--source/luametatex/source/libraries/avl/readme.txt44
-rw-r--r--source/luametatex/source/libraries/libcerf/readme-luametatex.txt52
-rw-r--r--source/luametatex/source/libraries/miniz/readme.txt14
-rw-r--r--source/luametatex/source/libraries/pplib/ppapi.h2
-rw-r--r--source/luametatex/source/libraries/pplib/ppcrypt.c7
-rw-r--r--source/luametatex/source/libraries/pplib/ppcrypt.h1
-rw-r--r--source/luametatex/source/libraries/pplib/readme.txt6
-rw-r--r--source/luametatex/source/libraries/readme.txt72
-rw-r--r--source/luametatex/source/license.txt362
-rw-r--r--source/luametatex/source/lua/lmtcallbacklib.c13
-rw-r--r--source/luametatex/source/lua/lmtcallbacklib.h4
-rw-r--r--source/luametatex/source/lua/lmtinterface.c14
-rw-r--r--source/luametatex/source/lua/lmtinterface.h7
-rw-r--r--source/luametatex/source/lua/lmtnodelib.c71
-rw-r--r--source/luametatex/source/lua/lmtstatuslib.c2
-rw-r--r--source/luametatex/source/lua/lmttexlib.c27
-rw-r--r--source/luametatex/source/lua/lmttokenlib.c50
-rw-r--r--source/luametatex/source/luacore/lua54/originals/patches.txt22
-rw-r--r--source/luametatex/source/luacore/lua54/readme.txt16
-rw-r--r--source/luametatex/source/luacore/luapeg/readme.txt16
-rw-r--r--source/luametatex/source/luacore/readme.txt66
-rw-r--r--source/luametatex/source/luametatex.h2
-rw-r--r--source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt214
-rw-r--r--source/luametatex/source/luaoptional/readme.txt60
-rw-r--r--source/luametatex/source/mp/mpc/mpmath.c34
-rw-r--r--source/luametatex/source/mp/mpw/mpmath.w34
-rw-r--r--source/luametatex/source/mp/mpw/mpmathdouble.w2
-rw-r--r--source/luametatex/source/mp/readme.txt26
-rw-r--r--source/luametatex/source/readme.txt1126
-rw-r--r--source/luametatex/source/tex/texadjust.c2
-rw-r--r--source/luametatex/source/tex/texalign.c4
-rw-r--r--source/luametatex/source/tex/texbuildpage.c11
-rw-r--r--source/luametatex/source/tex/texcommands.c25
-rw-r--r--source/luametatex/source/tex/texcommands.h19
-rw-r--r--source/luametatex/source/tex/texconditional.c27
-rw-r--r--source/luametatex/source/tex/texconditional.h3
-rw-r--r--source/luametatex/source/tex/texdumpdata.h2
-rw-r--r--source/luametatex/source/tex/texequivalents.c2
-rw-r--r--source/luametatex/source/tex/texequivalents.h18
-rw-r--r--source/luametatex/source/tex/texexpand.c20
-rw-r--r--source/luametatex/source/tex/texinputstack.c7
-rw-r--r--source/luametatex/source/tex/texinserts.c2
-rw-r--r--source/luametatex/source/tex/texlinebreak.c1310
-rw-r--r--source/luametatex/source/tex/texlinebreak.h8
-rw-r--r--source/luametatex/source/tex/texlocalboxes.c4
-rw-r--r--source/luametatex/source/tex/texmaincontrol.c106
-rw-r--r--source/luametatex/source/tex/texmaincontrol.h2
-rw-r--r--source/luametatex/source/tex/texmath.c156
-rw-r--r--source/luametatex/source/tex/texmath.h2
-rw-r--r--source/luametatex/source/tex/texmlist.c54
-rw-r--r--source/luametatex/source/tex/texnodes.c52
-rw-r--r--source/luametatex/source/tex/texnodes.h57
-rw-r--r--source/luametatex/source/tex/texpackaging.c122
-rw-r--r--source/luametatex/source/tex/texprimitive.c6
-rw-r--r--source/luametatex/source/tex/texprinting.c3
-rw-r--r--source/luametatex/source/tex/texrules.c196
-rw-r--r--source/luametatex/source/tex/texrules.h5
-rw-r--r--source/luametatex/source/tex/texscanning.c29
-rw-r--r--source/luametatex/source/tex/texscanning.h3
-rw-r--r--source/luametatex/source/tex/textoken.c68
-rw-r--r--source/luametatex/source/tex/textypes.h1
-rw-r--r--source/luametatex/source/utilities/auxposit.h12
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/char-def.lua8
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-oup.lua4
-rw-r--r--tex/context/base/mkiv/lang-imp-simpleascii-data.lgzbin0 -> 554570 bytes
-rw-r--r--tex/context/base/mkiv/lang-imp-simpleascii.lua114
-rw-r--r--tex/context/base/mkiv/lang-rep.lua2
-rw-r--r--tex/context/base/mkiv/mult-low.lua10
-rw-r--r--tex/context/base/mkiv/mult-prm.lua23
-rw-r--r--tex/context/base/mkiv/publ-imp-apa.mkvi59
-rw-r--r--tex/context/base/mkiv/publ-ini.mkiv5
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24652 -> 24659 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin271456 -> 270690 bytes
-rw-r--r--tex/context/base/mkiv/util-zip.lua55
-rw-r--r--tex/context/base/mkxl/buff-ini.lmt29
-rw-r--r--tex/context/base/mkxl/buff-ini.mkxl2
-rw-r--r--tex/context/base/mkxl/buff-ver.lmt970
-rw-r--r--tex/context/base/mkxl/buff-ver.mkxl3
-rw-r--r--tex/context/base/mkxl/chem-str.mkxl14
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl31
-rw-r--r--tex/context/base/mkxl/driv-shp.lmt2
-rw-r--r--tex/context/base/mkxl/file-job.mklx2
-rw-r--r--tex/context/base/mkxl/font-ctx.lmt13
-rw-r--r--tex/context/base/mkxl/font-dsp.lmt926
-rw-r--r--tex/context/base/mkxl/font-ini.mklx2
-rw-r--r--tex/context/base/mkxl/font-ogr.lmt7
-rw-r--r--tex/context/base/mkxl/lang-rep.lmt91
-rw-r--r--tex/context/base/mkxl/lang-rep.mkxl18
-rw-r--r--tex/context/base/mkxl/lang-tra.lmt5
-rw-r--r--tex/context/base/mkxl/lang-tra.mkxl174
-rw-r--r--tex/context/base/mkxl/math-acc.mklx18
-rw-r--r--tex/context/base/mkxl/math-act.lmt233
-rw-r--r--tex/context/base/mkxl/math-ali.mkxl357
-rw-r--r--tex/context/base/mkxl/math-frc.mkxl12
-rw-r--r--tex/context/base/mkxl/math-ini.mkxl41
-rw-r--r--tex/context/base/mkxl/math-map.lmt4
-rw-r--r--tex/context/base/mkxl/math-spa.lmt106
-rw-r--r--tex/context/base/mkxl/mult-aux.mkxl15
-rw-r--r--tex/context/base/mkxl/mult-sys.mkxl2
-rw-r--r--tex/context/base/mkxl/node-ini.lmt7
-rw-r--r--tex/context/base/mkxl/node-nut.lmt1
-rw-r--r--tex/context/base/mkxl/node-ref.lmt2
-rw-r--r--tex/context/base/mkxl/node-res.lmt12
-rw-r--r--tex/context/base/mkxl/pack-cut.mkxl17
-rw-r--r--tex/context/base/mkxl/pack-rul.mkxl10
-rw-r--r--tex/context/base/mkxl/page-com.mkxl18
-rw-r--r--tex/context/base/mkxl/page-imp.mkxl8
-rw-r--r--tex/context/base/mkxl/page-mix.mkxl12
-rw-r--r--tex/context/base/mkxl/page-mrk.mkxl8
-rw-r--r--tex/context/base/mkxl/page-pcl.mkxl2
-rw-r--r--tex/context/base/mkxl/publ-ini.mkxl6
-rw-r--r--tex/context/base/mkxl/spac-ali.mkxl47
-rw-r--r--tex/context/base/mkxl/spac-hor.mkxl2
-rw-r--r--tex/context/base/mkxl/spac-ver.mkxl8
-rw-r--r--tex/context/base/mkxl/strc-mat.mkxl366
-rw-r--r--tex/context/base/mkxl/strc-ref.lmt8
-rw-r--r--tex/context/base/mkxl/strc-sec.mkxl6
-rw-r--r--tex/context/base/mkxl/syst-con.lmt113
-rw-r--r--tex/context/base/mkxl/syst-con.mkxl15
-rw-r--r--tex/context/base/mkxl/syst-ini.mkxl8
-rw-r--r--tex/context/base/mkxl/tabl-ltb.mkxl4
-rw-r--r--tex/context/base/mkxl/tabl-ntb.mkxl6
-rw-r--r--tex/context/base/mkxl/toks-aux.lmt1
-rw-r--r--tex/context/base/mkxl/toks-ini.lmt2
-rw-r--r--tex/context/base/mkxl/toks-scn.lmt2
-rw-r--r--tex/context/base/mkxl/trac-tex.lmt113
-rw-r--r--tex/context/base/mkxl/trac-tex.mkxl39
-rw-r--r--tex/context/base/mkxl/trac-vis.lmt20
-rw-r--r--tex/context/base/mkxl/typo-brk.lmt4
-rw-r--r--tex/context/base/mkxl/typo-brk.mkxl10
-rw-r--r--tex/context/base/mkxl/typo-del.mkxl2
-rw-r--r--tex/context/base/mkxl/typo-itm.mkxl2
-rw-r--r--tex/context/base/mkxl/typo-mar.mkxl2
-rw-r--r--tex/context/fonts/mkiv/modern-math.lfg2
-rw-r--r--tex/context/fonts/mkiv/newcomputermodern-math.lfg2
-rw-r--r--tex/context/interface/mkiv/context-en.xml2
-rw-r--r--tex/context/interface/mkiv/i-align.xml2
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin848669 -> 848873 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin24624 -> 24428 bytes
-rw-r--r--tex/context/modules/mkxl/s-math-show.mkxl138
-rw-r--r--tex/context/modules/mkxl/s-text-tests.mkxl22
-rw-r--r--tex/context/modules/third/mtx-install-imp-modules.lua18
-rw-r--r--tex/context/sample/common/knuthmath.tex3
-rw-r--r--tex/context/sample/common/samples.tex7
-rw-r--r--tex/context/sample/math/math-knuth-dt.tex13
-rw-r--r--tex/context/sample/math/math-kontinuitet-sv.tex8
-rw-r--r--tex/context/sample/third/alfredsson-sv.tex6
-rw-r--r--tex/context/sample/third/falstaff-sv.tex5
-rw-r--r--tex/context/sample/third/lansburgh-letterspacing-sv.tex6
-rw-r--r--tex/context/sample/third/readme.txt23
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua6
-rw-r--r--web2c/readme.txt10
190 files changed, 7288 insertions, 4101 deletions
diff --git a/context-readme.txt b/context-readme.txt
new file mode 100644
index 000000000..9c0540ac8
--- /dev/null
+++ b/context-readme.txt
@@ -0,0 +1,51 @@
+Welcome to context,
+
+The standalone context distribution has the following structure. Installations
+like texlive use a different organization.
+
+ tex/texmf-context : the files in this tree (zip)
+ tex/texmf-<platform>/bin : the tex binaries and runners
+ tex/texmf-modules : optional user installed modules
+ tex/texmf-project : user project files
+ tex/texmf-fonts/data/<collection> : user installed fonts
+
+There is only one binary: luametatex, two if you also have luatex, so the amount
+of binary code is rather small. The mtxrun and context runners (stubs) are links
+but when that doesn't work you can make copies luametatex (which is not that
+large anyway). Because luametatex is also its own runner, there are no
+dependencies on other binaries.
+
+ luametatex[.exe] : the main tex binary, also runner [around 3MB]
+
+ mtxrun[.exe] : a (sym)link to luametatex
+ context[.exe] : a (sym)link to luametatex
+
+ mtxrun.lua : the main runner code
+ context.lua : the context runner code
+
+ luatex[.exe] : optional
+
+The lua files have to be alongside its runner. Wrapping a runner in some launcher
+makes no sense and is not supported. The whole idea is to have one single
+independent framework that is the same on all main platforms (windows, linux,
+osx). The mtxrun runner also handles the other mtx-* scripts that are in the
+context tree, which is why we have only a few files in the binary path. It also
+reduces the risk for clashes in binary names.
+
+An installation can be done using the installer but also by unzipping the archive
+or fetching from github (contextgarden). You can, if needed, compile the binary
+yourself from the includes source code.
+
+All tex resources (smacros, styles, fonts, patterns, etc.) are located relative
+to the binary path so you only need to make sure that the binary is in the path.
+
+The project and font trees can be shared (using links) and are untouched by the
+installers. By keeping fonts in the tree you retain stability, By using the
+project tree you can make sure that your styles are found when you process files
+outside the tex tree.
+
+After installing you need to run 'mtxrun --generate' so that a successive
+'context' run can find the files it needs.
+
+You can get help and more information on the context garden, mailing lists and user
+forums cq. platforms.
diff --git a/context/data/scite/context/lexers/data/scite-context-data-context.lua b/context/data/scite/context/lexers/data/scite-context-data-context.lua
index 4979056d6..76af1ab81 100644
--- a/context/data/scite/context/lexers/data/scite-context-data-context.lua
+++ b/context/data/scite/context/lexers/data/scite-context-data-context.lua
@@ -1,4 +1,4 @@
return {
- ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "pluseleven", "plustwelve", "plussixteen", "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "maxiterator", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "centeringskip", "stretchingskip", "shrinkingskip", "centeringfillskip", "stretchingfillskip", "shrinkingfillskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "binaryshiftedten", "binaryshiftedtwenty", "binaryshiftedthirty", "thickermuskip", "directionlefttoright", "directionrighttoleft", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "prerollrun", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "contextformat", "contextversion", "contextlmtxmode", "contextmark", "mksuffix", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "statuswrite", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "rlncatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "commaasciicode", "spaceasciicode", "periodasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "semicolonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "leftparentasciicode", "rightparentasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "percentasciicode", "leftbracketasciicode", "rightbracketasciicode", "hsizefrozenparcode", "skipfrozenparcode", "hangfrozenparcode", "indentfrozenparcode", "parfillfrozenparcode", "adjustfrozenparcode", "protrudefrozenparcode", "tolerancefrozenparcode", "stretchfrozenparcode", "loosenessfrozenparcode", "lastlinefrozenparcode", "linepenaltyfrozenparcode", "clubpenaltyfrozenparcode", "widowpenaltyfrozenparcode", "displaypenaltyfrozenparcode", "brokenpenaltyfrozenparcode", "demeritsfrozenparcode", "shapefrozenparcode", "linefrozenparcode", "hyphenationfrozenparcode", "shapingpenaltyfrozenparcode", "orphanpenaltyfrozenparcode", "allfrozenparcode", "mathpenaltyfrozenparcode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", "markautomigrationcode", "insertautomigrationcode", "adjustautomigrationcode", "preautomigrationcode", "postautomigrationcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", "applyverticalitalickernmathcontrolcode", "applyordinaryitalickernmathcontrolcode", "applycharitalickernmathcontrolcode", "reboxcharitalickernmathcontrolcode", "applyboxeditalickernmathcontrolcode", "staircasekernmathcontrolcode", "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", "ignoreflataccentsmathcontrolcode", "extendaccentsmathcontrolcode", "extenddelimitersmathcontrolcode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", "noitaliccorrectionglyphoptioncode", "islargeoperatorglyphoptioncode", "hasitalicshapeglyphoptioncode", "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", "noalignparcontextcode", "spanparcontextcode", "resetparcontextcode", "leftoriginlistanchorcode", "leftheightlistanchorcode", "leftdepthlistanchorcode", "rightoriginlistanchorcode", "rightheightlistanchorcode", "rightdepthlistanchorcode", "centeroriginlistanchorcode", "centerheightlistanchorcode", "centerdepthlistanchorcode", "halfwaytotallistanchorcode", "halfwayheightlistanchorcode", "halfwaydepthlistanchorcode", "halfwayleftlistanchorcode", "halfwayrightlistanchorcode", "negatexlistsigncode", "negateylistsigncode", "negatelistsigncode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "mathexheight", "mathemwidth", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathaxisheight", "muquad", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifelsemode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startlocalcomponent", "stoplocalcomponent", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "unexpandeddocumentvariable", "setupdocument", "presetdocument", "doifelsedocumentvariable", "doifdocumentvariableelse", "doifdocumentvariable", "doifnotdocumentvariable", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "everystoptext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "definemode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordinarycode", "mathordcode", "mathoperatorcode", "mathopcode", "mathbinarycode", "mathbincode", "mathrelationcode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctuationcode", "mathpunctcode", "mathovercode", "mathundercode", "mathinnercode", "mathradicalcode", "mathfractioncode", "mathmiddlecode", "mathaccentcode", "mathfencedcode", "mathghostcode", "mathvariablecode", "mathactivecode", "mathvcentercode", "mathconstructcode", "mathwrappedcode", "mathbegincode", "mathendcode", "mathexplicitcode", "mathdivisioncode", "mathfactorialcode", "mathdimensioncode", "mathexperimentalcode", "mathtextpunctuationcode", "mathimaginarycode", "mathdifferentialcode", "mathexponentialcode", "mathellipsiscode", "mathfunctioncode", "mathdigitcode", "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", "mathnumbergroupcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "lrm", "rlm", "bidilre", "bidirle", "bidipop", "bidilro", "bidirlo", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "autoinsertedspace", "Ux", "eUx", "parfillleftskip", "parfillrightskip", "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode", "wildcardsymbol", "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", "normalizelinenormalizecode", "parindentskipnormalizecode", "swaphangindentnormalizecode", "swapparsshapenormalizecode", "breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode", "discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode", "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "nopreslackclassoptioncode", "nopostslackclassoptioncode", "lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode", "lookaheadforendclassoptioncode", "noitaliccorrectionclassoptioncode", "defaultmathclassoptions", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", "operatoritaliccorrectionclassoptioncode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noitaliccorrectionglyphoptioncode", "nokerningcode", "noligaturingcode", "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", "ordmathflattencode", "binmathflattencode", "relmathflattencode", "punctmathflattencode", "innermathflattencode", "normalworddiscoptioncode", "preworddiscoptioncode", "postworddiscoptioncode", "continueifinputfile", "continuewhenlmtxmode", "continuewhenmkivmode" },
- ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "startcontextdefinitioncode", "stopcontextdefinitioncode", "texdefinition", "doifelsesetups", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "fastsetup", "copysetups", "resetsetups", "doifelsecommandhandler", "doifcommandhandlerelse", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "globalsetmode", "globalresetmode", "globalsetsystemmode", "globalresetsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newfloat", "newlanguage", "newfamily", "newfam", "newhelp", "newinteger", "newdimension", "newgluespec", "newmugluespec", "newposit", "aliasinteger", "aliasdimension", "aliasposit", "then", "begcsname", "autorule", "strippedcsname", "checkedstrippedcsname", "nofarguments", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthargumenttrue", "sixthargumentfalse", "sixthargumenttrue", "seventhargumentfalse", "seventhargumenttrue", "vkern", "hkern", "vpenalty", "hpenalty", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "untraceddonothing", "dontcomplain", "moreboxtracing", "lessboxtracing", "noboxtracing", "forgetall", "donetrue", "donefalse", "foundtrue", "foundfalse", "inlineordisplaymath", "indisplaymath", "forcedisplaymath", "startforceddisplaymath", "stopforceddisplaymath", "startpickupmath", "stoppickupmath", "reqno", "forceinlinemath", "mathortext", "thebox", "htdp", "unvoidbox", "hfilll", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "hsplit", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilll", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "normalhfilllneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilll", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "normalvfilllneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruleddbox", "ruledvcenter", "ruledmbox", "ruledhpack", "ruledvpack", "ruledtpack", "ruleddpack", "ruledvsplit", "ruledtsplit", "ruleddsplit", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", "scratchstring", "scratchstringone", "scratchstringtwo", "tempstring", "scratchcounter", "globalscratchcounter", "privatescratchcounter", "scratchfloat", "globalscratchfloat", "privatescratchfloat", "scratchdimen", "globalscratchdimen", "privatescratchdimen", "scratchskip", "globalscratchskip", "privatescratchskip", "scratchmuskip", "globalscratchmuskip", "privatescratchmuskip", "scratchtoks", "globalscratchtoks", "privatescratchtoks", "scratchbox", "globalscratchbox", "privatescratchbox", "scratchmacro", "scratchmacroone", "scratchmacrotwo", "scratchconditiontrue", "scratchconditionfalse", "ifscratchcondition", "scratchconditiononetrue", "scratchconditiononefalse", "ifscratchconditionone", "scratchconditiontwotrue", "scratchconditiontwofalse", "ifscratchconditiontwo", "globalscratchcounterone", "globalscratchcountertwo", "globalscratchcounterthree", "groupedcommand", "groupedcommandcs", "triggergroupedcommand", "triggergroupedcommandcs", "simplegroupedcommand", "simplegroupedcommandcs", "pickupgroupedcommand", "pickupgroupedcommandcs", "mathgroupedcommandcs", "usedbaselineskip", "usedlineskip", "usedlineskiplimit", "availablehsize", "localhsize", "setlocalhsize", "distributedhsize", "hsizefraction", "next", "nexttoken", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "flushnextbox", "boxisempty", "boxtostring", "contentostring", "prerolltostring", "givenwidth", "givenheight", "givendepth", "scangivendimensions", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchtotal", "scratchitalic", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchcounterfour", "scratchcounterfive", "scratchcountersix", "scratchfloatone", "scratchfloattwo", "scratchfloatthree", "scratchfloatfour", "scratchfloatfive", "scratchfloatsix", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchdimenfour", "scratchdimenfive", "scratchdimensix", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchskipfour", "scratchskipfive", "scratchskipsix", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchmuskipfour", "scratchmuskipfive", "scratchmuskipsix", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchtoksfour", "scratchtoksfive", "scratchtokssix", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchboxfour", "scratchboxfive", "scratchboxsix", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchunicode", "scratchmin", "scratchmax", "pfsin", "pfcos", "pftan", "pfasin", "pfacos", "pfatan", "pfsinh", "pfcosh", "pftanh", "pfasinh", "pfacosh", "pfatanh", "pfsqrt", "pflog", "pfexp", "pfceil", "pffloor", "pfround", "pfabs", "pfrad", "pfdeg", "pfatantwo", "pfpow", "pfmod", "pfrem", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "doif", "doifnot", "doifelse", "firstinset", "doifinset", "doifnotinset", "doifelseinset", "doifinsetelse", "doifelsenextchar", "doifnextcharelse", "doifelsenextcharcs", "doifnextcharcselse", "doifelsenextoptional", "doifnextoptionalelse", "doifelsenextoptionalcs", "doifnextoptionalcselse", "doifelsefastoptionalcheck", "doiffastoptionalcheckelse", "doifelsefastoptionalcheckcs", "doiffastoptionalcheckcselse", "doifelsenextbgroup", "doifnextbgroupelse", "doifelsenextbgroupcs", "doifnextbgroupcselse", "doifelsenextparenthesis", "doifnextparenthesiselse", "doifelseundefined", "doifundefinedelse", "doifelsedefined", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifnothingelse", "doifelsesomething", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifvaluenothingelse", "doifelsedimension", "doifdimensionelse", "doifelsenumber", "doifnumberelse", "doifnumber", "doifnotnumber", "doifelsecommon", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifelseinstring", "doifinstringelse", "doifelseassignment", "doifassignmentelse", "docheckassignment", "doifelseassignmentcs", "doifassignmentelsecs", "validassignment", "novalidassignment", "doiftext", "doifelsetext", "doiftextelse", "doifnottext", "quitcondition", "truecondition", "falsecondition", "tracingall", "tracingnone", "loggingall", "tracingcatcodes", "showluatokens", "aliasmacro", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "emspace", "charspace", "nbsp", "crlf", "obeyspaces", "obeylines", "obeytabs", "obeypages", "obeyedspace", "obeyedline", "obeyedtab", "obeyedpage", "normalspace", "naturalspace", "controlspace", "normalspaces", "ignoretabs", "ignorelines", "ignorepages", "ignoreeofs", "setcontrolspaces", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "removepunctuation", "ignoreparskip", "forcestrutdepth", "onlynonbreakablespace", "wait", "writestatus", "define", "defineexpandable", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "measured", "directmeasure", "setquantity", "setequantity", "setgquantity", "setxquantity", "definequantity", "freezequantity", "quantity", "quantitied", "directquantity", "installcorenamespace", "getvalue", "getuvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "udef", "ugdef", "uedef", "uxdef", "checked", "unique", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "setexpandeddummyparameter", "resetdummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "firstoftwounexpanded", "secondoftwounexpanded", "firstofthreeunexpanded", "secondofthreeunexpanded", "thirdofthreeunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "fastloopindex", "fastloopfinal", "dowith", "doloopovermatch", "doloopovermatched", "doloopoverlist", "newconstant", "setnewconstant", "setconstant", "setconstantvalue", "newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue", "setconditional", "newmacro", "setnewmacro", "newfraction", "newsignal", "newboundary", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "permitspacesbetweengroups", "dontpermitspacesbetweengroups", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "onlypdfobjectcompression", "nopdfobjectcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doifelsefirstchar", "doiffirstcharelse", "mathclassvalue", "startnointerference", "stopnointerference", "twodigits", "threedigits", "leftorright", "offinterlineskip", "oninterlineskip", "nointerlineskip", "strut", "halfstrut", "quarterstrut", "depthstrut", "halflinestrut", "noheightstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "strutgap", "begstrut", "endstrut", "lineheight", "leftboundary", "rightboundary", "signalcharacter", "aligncontentleft", "aligncontentmiddle", "aligncontentright", "shiftbox", "vpackbox", "hpackbox", "vpackedbox", "hpackedbox", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "normalsuperscript", "normalsubscript", "normalnosuperscript", "normalnosubscript", "normalprimescript", "superscript", "subscript", "nosuperscript", "nosubscript", "primescript", "superprescript", "subprescript", "nosuperprescript", "nosubsprecript", "uncramped", "cramped", "mathstyletrigger", "triggermathstyle", "triggeredmathstyle", "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette", "mathstylehbox", "mathstylevbox", "mathstylevcenter", "mathstylevcenteredhbox", "mathstylevcenteredvbox", "mathtext", "setmathsmalltextbox", "setmathtextbox", "pushmathstyle", "popmathstyle", "triggerdisplaystyle", "triggertextstyle", "triggerscriptstyle", "triggerscriptscriptstyle", "triggeruncrampedstyle", "triggercrampedstyle", "triggersmallstyle", "triggeruncrampedsmallstyle", "triggercrampedsmallstyle", "triggerbigstyle", "triggeruncrampedbigstyle", "triggercrampedbigstyle", "luaexpr", "expelsedoif", "expdoif", "expdoifnot", "expdoifelsecommon", "expdoifcommonelse", "expdoifelseinset", "expdoifinsetelse", "ctxdirectlua", "ctxlatelua", "ctxsprint", "ctxwrite", "ctxcommand", "ctxdirectcommand", "ctxlatecommand", "ctxreport", "ctxlua", "luacode", "lateluacode", "directluacode", "registerctxluafile", "ctxloadluafile", "luaversion", "luamajorversion", "luaminorversion", "ctxluacode", "luaconditional", "luaexpanded", "ctxluamatch", "startluaparameterset", "stopluaparameterset", "luaparameterset", "definenamedlua", "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction", "stopctxfunction", "ctxfunction", "startctxfunctiondefinition", "stopctxfunctiondefinition", "installctxfunction", "installprotectedctxfunction", "installprotectedctxscanner", "installctxscanner", "resetctxscanner", "cldprocessfile", "cldloadfile", "cldloadviafile", "cldcontext", "cldcommand", "carryoverpar", "freezeparagraphproperties", "defrostparagraphproperties", "setparagraphfreezing", "forgetparagraphfreezing", "updateparagraphproperties", "updateparagraphpenalties", "updateparagraphdemerits", "updateparagraphshapes", "updateparagraphlines", "lastlinewidth", "assumelongusagecs", "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", "leftorrighthbox", "leftorrightvbox", "leftorrightvtop", "lefttoright", "righttoleft", "checkedlefttoright", "checkedrighttoleft", "synchronizelayoutdirection", "synchronizedisplaydirection", "synchronizeinlinedirection", "dirlre", "dirrle", "dirlro", "dirrlo", "rtltext", "ltrtext", "lesshyphens", "morehyphens", "nohyphens", "dohyphens", "dohyphencollapsing", "nohyphencollapsing", "compounddiscretionary", "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath", "break", "nobreak", "allowbreak", "goodbreak", "nospace", "nospacing", "dospacing", "naturalhbox", "naturalvbox", "naturalvtop", "naturalhpack", "naturalvpack", "naturaltpack", "reversehbox", "reversevbox", "reversevtop", "reversehpack", "reversevpack", "reversetpack", "hcontainer", "vcontainer", "tcontainer", "frule", "compoundhyphenpenalty", "start", "stop", "unsupportedcs", "openout", "closeout", "write", "openin", "closein", "read", "readline", "readfromterminal", "boxlines", "boxline", "setboxline", "copyboxline", "boxlinewd", "boxlineht", "boxlinedp", "boxlinenw", "boxlinenh", "boxlinend", "boxlinels", "boxliners", "boxlinelh", "boxlinerh", "boxlinelp", "boxlinerp", "boxlinein", "boxrangewd", "boxrangeht", "boxrangedp", "bitwiseset", "bitwiseand", "bitwiseor", "bitwisexor", "bitwisenot", "bitwisenil", "ifbitwiseand", "bitwise", "bitwiseshift", "bitwiseflip", "textdir", "linedir", "pardir", "boxdir", "prelistbox", "postlistbox", "prelistcopy", "postlistcopy", "setprelistbox", "setpostlistbox", "noligaturing", "nokerning", "noexpansion", "noprotrusion", "noleftkerning", "noleftligaturing", "norightkerning", "norightligaturing", "noitaliccorrection", "futureletnexttoken", "defbackslashbreak", "letbackslashbreak", "pushoverloadmode", "popoverloadmode", "pushrunstate", "poprunstate", "suggestedalias", "showboxhere", "discoptioncodestring", "flagcodestring", "frozenparcodestring", "glyphoptioncodestring", "groupcodestring", "hyphenationcodestring", "mathcontrolcodestring", "mathflattencodestring", "normalizecodestring", "parcontextcodestring", "newlocalcount", "newlocaldimen", "newlocalskip", "newlocalmuskip", "newlocaltoks", "newlocalbox", "newlocalwrite", "newlocalread", "setnewlocalcount", "setnewlocaldimen", "setnewlocalskip", "setnewlocalmuskip", "setnewlocaltoks", "setnewlocalbox", "ifexpression" },
+ ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "pluseleven", "plustwelve", "plussixteen", "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "maxiterator", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "centeringskip", "stretchingskip", "shrinkingskip", "centeringfillskip", "stretchingfillskip", "shrinkingfillskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "binaryshiftedten", "binaryshiftedtwenty", "binaryshiftedthirty", "thickermuskip", "directionlefttoright", "directionrighttoleft", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "prerollrun", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "contextformat", "contextversion", "contextlmtxmode", "contextmark", "mksuffix", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "statuswrite", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "rlncatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "commaasciicode", "spaceasciicode", "periodasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "semicolonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "leftparentasciicode", "rightparentasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "percentasciicode", "leftbracketasciicode", "rightbracketasciicode", "hsizefrozenparcode", "skipfrozenparcode", "hangfrozenparcode", "indentfrozenparcode", "parfillfrozenparcode", "adjustfrozenparcode", "protrudefrozenparcode", "tolerancefrozenparcode", "stretchfrozenparcode", "loosenessfrozenparcode", "lastlinefrozenparcode", "linepenaltyfrozenparcode", "clubpenaltyfrozenparcode", "widowpenaltyfrozenparcode", "displaypenaltyfrozenparcode", "brokenpenaltyfrozenparcode", "demeritsfrozenparcode", "shapefrozenparcode", "linefrozenparcode", "hyphenationfrozenparcode", "shapingpenaltyfrozenparcode", "orphanpenaltyfrozenparcode", "allfrozenparcode", "mathpenaltyfrozenparcode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", "markautomigrationcode", "insertautomigrationcode", "adjustautomigrationcode", "preautomigrationcode", "postautomigrationcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", "applyverticalitalickernmathcontrolcode", "applyordinaryitalickernmathcontrolcode", "applycharitalickernmathcontrolcode", "reboxcharitalickernmathcontrolcode", "applyboxeditalickernmathcontrolcode", "staircasekernmathcontrolcode", "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", "ignoreflataccentsmathcontrolcode", "extendaccentsmathcontrolcode", "extenddelimitersmathcontrolcode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", "noitaliccorrectionglyphoptioncode", "islargeoperatorglyphoptioncode", "hasitalicshapeglyphoptioncode", "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", "noalignparcontextcode", "spanparcontextcode", "resetparcontextcode", "leftoriginlistanchorcode", "leftheightlistanchorcode", "leftdepthlistanchorcode", "rightoriginlistanchorcode", "rightheightlistanchorcode", "rightdepthlistanchorcode", "centeroriginlistanchorcode", "centerheightlistanchorcode", "centerdepthlistanchorcode", "halfwaytotallistanchorcode", "halfwayheightlistanchorcode", "halfwaydepthlistanchorcode", "halfwayleftlistanchorcode", "halfwayrightlistanchorcode", "negatexlistsigncode", "negateylistsigncode", "negatelistsigncode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "mathexheight", "mathemwidth", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathaxisheight", "muquad", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifelsemode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startlocalcomponent", "stoplocalcomponent", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "unexpandeddocumentvariable", "setupdocument", "presetdocument", "doifelsedocumentvariable", "doifdocumentvariableelse", "doifdocumentvariable", "doifnotdocumentvariable", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "everystoptext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "definemode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordinarycode", "mathordcode", "mathoperatorcode", "mathopcode", "mathbinarycode", "mathbincode", "mathrelationcode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctuationcode", "mathpunctcode", "mathovercode", "mathundercode", "mathinnercode", "mathradicalcode", "mathfractioncode", "mathmiddlecode", "mathaccentcode", "mathfencedcode", "mathghostcode", "mathvariablecode", "mathactivecode", "mathvcentercode", "mathconstructcode", "mathwrappedcode", "mathbegincode", "mathendcode", "mathexplicitcode", "mathdivisioncode", "mathfactorialcode", "mathdimensioncode", "mathexperimentalcode", "mathtextpunctuationcode", "mathimaginarycode", "mathdifferentialcode", "mathexponentialcode", "mathellipsiscode", "mathfunctioncode", "mathdigitcode", "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", "mathnumbergroupcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "lrm", "rlm", "bidilre", "bidirle", "bidipop", "bidilro", "bidirlo", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "autoinsertedspace", "Ux", "eUx", "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode", "wildcardsymbol", "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", "normalizelinenormalizecode", "parindentskipnormalizecode", "swaphangindentnormalizecode", "swapparsshapenormalizecode", "breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode", "discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode", "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "limitprevgrafnormalizeparcode", "nopreslackclassoptioncode", "nopostslackclassoptioncode", "lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode", "lookaheadforendclassoptioncode", "noitaliccorrectionclassoptioncode", "defaultmathclassoptions", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", "operatoritaliccorrectionclassoptioncode", "shortinlineclassoptioncode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noitaliccorrectionglyphoptioncode", "nokerningcode", "noligaturingcode", "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", "ordmathflattencode", "binmathflattencode", "relmathflattencode", "punctmathflattencode", "innermathflattencode", "normalworddiscoptioncode", "preworddiscoptioncode", "postworddiscoptioncode", "continueifinputfile", "continuewhenlmtxmode", "continuewhenmkivmode" },
+ ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "startcontextdefinitioncode", "stopcontextdefinitioncode", "texdefinition", "doifelsesetups", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "fastsetup", "copysetups", "resetsetups", "doifelsecommandhandler", "doifcommandhandlerelse", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "globalsetmode", "globalresetmode", "globalsetsystemmode", "globalresetsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newfloat", "newlanguage", "newfamily", "newfam", "newhelp", "newinteger", "newdimension", "newgluespec", "newmugluespec", "newposit", "aliasinteger", "aliasdimension", "aliasposit", "then", "begcsname", "autorule", "tobits", "tohexa", "strippedcsname", "checkedstrippedcsname", "nofarguments", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthargumenttrue", "sixthargumentfalse", "sixthargumenttrue", "seventhargumentfalse", "seventhargumenttrue", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "untraceddonothing", "dontcomplain", "moreboxtracing", "lessboxtracing", "noboxtracing", "forgetall", "donetrue", "donefalse", "foundtrue", "foundfalse", "inlineordisplaymath", "indisplaymath", "forcedisplaymath", "startforceddisplaymath", "stopforceddisplaymath", "startpickupmath", "stoppickupmath", "reqno", "forceinlinemath", "mathortext", "thebox", "htdp", "unvoidbox", "hfilll", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "hsplit", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilll", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "normalhfilllneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilll", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "normalvfilllneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruleddbox", "ruledvcenter", "ruledmbox", "ruledhpack", "ruledvpack", "ruledtpack", "ruleddpack", "ruledvsplit", "ruledtsplit", "ruleddsplit", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", "scratchstring", "scratchstringone", "scratchstringtwo", "tempstring", "scratchcounter", "globalscratchcounter", "privatescratchcounter", "scratchfloat", "globalscratchfloat", "privatescratchfloat", "scratchdimen", "globalscratchdimen", "privatescratchdimen", "scratchskip", "globalscratchskip", "privatescratchskip", "scratchmuskip", "globalscratchmuskip", "privatescratchmuskip", "scratchtoks", "globalscratchtoks", "privatescratchtoks", "scratchbox", "globalscratchbox", "privatescratchbox", "scratchmacro", "scratchmacroone", "scratchmacrotwo", "scratchconditiontrue", "scratchconditionfalse", "ifscratchcondition", "scratchconditiononetrue", "scratchconditiononefalse", "ifscratchconditionone", "scratchconditiontwotrue", "scratchconditiontwofalse", "ifscratchconditiontwo", "globalscratchcounterone", "globalscratchcountertwo", "globalscratchcounterthree", "groupedcommand", "groupedcommandcs", "triggergroupedcommand", "triggergroupedcommandcs", "simplegroupedcommand", "simplegroupedcommandcs", "pickupgroupedcommand", "pickupgroupedcommandcs", "mathgroupedcommandcs", "usedbaselineskip", "usedlineskip", "usedlineskiplimit", "availablehsize", "localhsize", "setlocalhsize", "distributedhsize", "hsizefraction", "next", "nexttoken", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "flushnextbox", "boxisempty", "boxtostring", "contentostring", "prerolltostring", "givenwidth", "givenheight", "givendepth", "scangivendimensions", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchtotal", "scratchitalic", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchcounterfour", "scratchcounterfive", "scratchcountersix", "scratchfloatone", "scratchfloattwo", "scratchfloatthree", "scratchfloatfour", "scratchfloatfive", "scratchfloatsix", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchdimenfour", "scratchdimenfive", "scratchdimensix", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchskipfour", "scratchskipfive", "scratchskipsix", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchmuskipfour", "scratchmuskipfive", "scratchmuskipsix", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchtoksfour", "scratchtoksfive", "scratchtokssix", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchboxfour", "scratchboxfive", "scratchboxsix", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchunicode", "scratchmin", "scratchmax", "pfsin", "pfcos", "pftan", "pfasin", "pfacos", "pfatan", "pfsinh", "pfcosh", "pftanh", "pfasinh", "pfacosh", "pfatanh", "pfsqrt", "pflog", "pfexp", "pfceil", "pffloor", "pfround", "pfabs", "pfrad", "pfdeg", "pfatantwo", "pfpow", "pfmod", "pfrem", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "doif", "doifnot", "doifelse", "firstinset", "doifinset", "doifnotinset", "doifelseinset", "doifinsetelse", "doifelsenextchar", "doifnextcharelse", "doifelsenextcharcs", "doifnextcharcselse", "doifelsenextoptional", "doifnextoptionalelse", "doifelsenextoptionalcs", "doifnextoptionalcselse", "doifelsefastoptionalcheck", "doiffastoptionalcheckelse", "doifelsefastoptionalcheckcs", "doiffastoptionalcheckcselse", "doifelsenextbgroup", "doifnextbgroupelse", "doifelsenextbgroupcs", "doifnextbgroupcselse", "doifelsenextparenthesis", "doifnextparenthesiselse", "doifelseundefined", "doifundefinedelse", "doifelsedefined", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifnothingelse", "doifelsesomething", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifvaluenothingelse", "doifelsedimension", "doifdimensionelse", "doifelsenumber", "doifnumberelse", "doifnumber", "doifnotnumber", "doifelsecommon", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifelseinstring", "doifinstringelse", "doifelseassignment", "doifassignmentelse", "docheckassignment", "doifelseassignmentcs", "doifassignmentelsecs", "validassignment", "novalidassignment", "doiftext", "doifelsetext", "doiftextelse", "doifnottext", "quitcondition", "truecondition", "falsecondition", "tracingall", "tracingnone", "loggingall", "tracingcatcodes", "showluatokens", "aliasmacro", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "emspace", "charspace", "nbsp", "crlf", "obeyspaces", "obeylines", "obeytabs", "obeypages", "obeyedspace", "obeyedline", "obeyedtab", "obeyedpage", "normalspace", "naturalspace", "controlspace", "normalspaces", "ignoretabs", "ignorelines", "ignorepages", "ignoreeofs", "setcontrolspaces", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "removepunctuation", "ignoreparskip", "forcestrutdepth", "onlynonbreakablespace", "wait", "writestatus", "define", "defineexpandable", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "measured", "directmeasure", "setquantity", "setequantity", "setgquantity", "setxquantity", "definequantity", "freezequantity", "quantity", "quantitied", "directquantity", "installcorenamespace", "getvalue", "getuvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "udef", "ugdef", "uedef", "uxdef", "checked", "unique", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "setexpandeddummyparameter", "resetdummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "firstoftwounexpanded", "secondoftwounexpanded", "firstofthreeunexpanded", "secondofthreeunexpanded", "thirdofthreeunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "fastloopindex", "fastloopfinal", "dowith", "doloopovermatch", "doloopovermatched", "doloopoverlist", "newconstant", "setnewconstant", "setconstant", "setconstantvalue", "newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue", "setconditional", "newmacro", "setnewmacro", "newfraction", "newsignal", "newboundary", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "permitspacesbetweengroups", "dontpermitspacesbetweengroups", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "onlypdfobjectcompression", "nopdfobjectcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doifelsefirstchar", "doiffirstcharelse", "mathclassvalue", "startnointerference", "stopnointerference", "twodigits", "threedigits", "leftorright", "offinterlineskip", "oninterlineskip", "nointerlineskip", "strut", "halfstrut", "quarterstrut", "depthstrut", "halflinestrut", "noheightstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "strutgap", "begstrut", "endstrut", "lineheight", "leftboundary", "rightboundary", "signalcharacter", "aligncontentleft", "aligncontentmiddle", "aligncontentright", "shiftbox", "vpackbox", "hpackbox", "vpackedbox", "hpackedbox", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "normalsuperscript", "normalsubscript", "normalnosuperscript", "normalnosubscript", "normalprimescript", "superscript", "subscript", "nosuperscript", "nosubscript", "primescript", "superprescript", "subprescript", "nosuperprescript", "nosubsprecript", "uncramped", "cramped", "mathstyletrigger", "triggermathstyle", "triggeredmathstyle", "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette", "mathstylehbox", "mathstylevbox", "mathstylevcenter", "mathstylevcenteredhbox", "mathstylevcenteredvbox", "mathtext", "setmathsmalltextbox", "setmathtextbox", "pushmathstyle", "popmathstyle", "triggerdisplaystyle", "triggertextstyle", "triggerscriptstyle", "triggerscriptscriptstyle", "triggeruncrampedstyle", "triggercrampedstyle", "triggersmallstyle", "triggeruncrampedsmallstyle", "triggercrampedsmallstyle", "triggerbigstyle", "triggeruncrampedbigstyle", "triggercrampedbigstyle", "luaexpr", "expelsedoif", "expdoif", "expdoifnot", "expdoifelsecommon", "expdoifcommonelse", "expdoifelseinset", "expdoifinsetelse", "ctxdirectlua", "ctxlatelua", "ctxsprint", "ctxwrite", "ctxcommand", "ctxdirectcommand", "ctxlatecommand", "ctxreport", "ctxlua", "luacode", "lateluacode", "directluacode", "registerctxluafile", "ctxloadluafile", "luaversion", "luamajorversion", "luaminorversion", "ctxluacode", "luaconditional", "luaexpanded", "ctxluamatch", "startluaparameterset", "stopluaparameterset", "luaparameterset", "definenamedlua", "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction", "stopctxfunction", "ctxfunction", "startctxfunctiondefinition", "stopctxfunctiondefinition", "installctxfunction", "installprotectedctxfunction", "installprotectedctxscanner", "installctxscanner", "resetctxscanner", "cldprocessfile", "cldloadfile", "cldloadviafile", "cldcontext", "cldcommand", "carryoverpar", "freezeparagraphproperties", "defrostparagraphproperties", "setparagraphfreezing", "forgetparagraphfreezing", "updateparagraphproperties", "updateparagraphpenalties", "updateparagraphdemerits", "updateparagraphshapes", "updateparagraphlines", "lastlinewidth", "assumelongusagecs", "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", "leftorrighthbox", "leftorrightvbox", "leftorrightvtop", "lefttoright", "righttoleft", "checkedlefttoright", "checkedrighttoleft", "synchronizelayoutdirection", "synchronizedisplaydirection", "synchronizeinlinedirection", "dirlre", "dirrle", "dirlro", "dirrlo", "rtltext", "ltrtext", "lesshyphens", "morehyphens", "nohyphens", "dohyphens", "dohyphencollapsing", "nohyphencollapsing", "compounddiscretionary", "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath", "break", "nobreak", "allowbreak", "goodbreak", "nospace", "nospacing", "dospacing", "naturalhbox", "naturalvbox", "naturalvtop", "naturalhpack", "naturalvpack", "naturaltpack", "reversehbox", "reversevbox", "reversevtop", "reversehpack", "reversevpack", "reversetpack", "hcontainer", "vcontainer", "tcontainer", "frule", "compoundhyphenpenalty", "start", "stop", "unsupportedcs", "openout", "closeout", "write", "openin", "closein", "read", "readline", "readfromterminal", "boxlines", "boxline", "setboxline", "copyboxline", "boxlinewd", "boxlineht", "boxlinedp", "boxlinenw", "boxlinenh", "boxlinend", "boxlinels", "boxliners", "boxlinelh", "boxlinerh", "boxlinelp", "boxlinerp", "boxlinein", "boxrangewd", "boxrangeht", "boxrangedp", "bitwiseset", "bitwiseand", "bitwiseor", "bitwisexor", "bitwisenot", "bitwisenil", "ifbitwiseand", "bitwise", "bitwiseshift", "bitwiseflip", "textdir", "linedir", "pardir", "boxdir", "prelistbox", "postlistbox", "prelistcopy", "postlistcopy", "setprelistbox", "setpostlistbox", "noligaturing", "nokerning", "noexpansion", "noprotrusion", "noleftkerning", "noleftligaturing", "norightkerning", "norightligaturing", "noitaliccorrection", "futureletnexttoken", "defbackslashbreak", "letbackslashbreak", "pushoverloadmode", "popoverloadmode", "pushrunstate", "poprunstate", "suggestedalias", "showboxhere", "discoptioncodestring", "flagcodestring", "frozenparcodestring", "glyphoptioncodestring", "groupcodestring", "hyphenationcodestring", "mathcontrolcodestring", "mathflattencodestring", "normalizecodestring", "parcontextcodestring", "newlocalcount", "newlocaldimen", "newlocalskip", "newlocalmuskip", "newlocaltoks", "newlocalbox", "newlocalwrite", "newlocalread", "setnewlocalcount", "setnewlocaldimen", "setnewlocalskip", "setnewlocalmuskip", "setnewlocaltoks", "setnewlocalbox", "ifexpression" },
} \ No newline at end of file
diff --git a/context/data/scite/context/lexers/data/scite-context-data-tex.lua b/context/data/scite/context/lexers/data/scite-context-data-tex.lua
index 4ed203784..5cec3520c 100644
--- a/context/data/scite/context/lexers/data/scite-context-data-tex.lua
+++ b/context/data/scite/context/lexers/data/scite-context-data-tex.lua
@@ -1,9 +1,9 @@
return {
["aleph"]={ "Alephminorversion", "Alephrevision", "Alephversion" },
["etex"]={ "botmarks", "clubpenalties", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "detokenize", "dimexpr", "displaywidowpenalties", "everyeof", "firstmarks", "fontchardp", "fontcharht", "fontcharic", "fontcharwd", "glueexpr", "glueshrink", "glueshrinkorder", "gluestretch", "gluestretchorder", "gluetomu", "ifcsname", "ifdefined", "iffontchar", "interactionmode", "interlinepenalties", "lastlinefit", "lastnodetype", "marks", "muexpr", "mutoglue", "numexpr", "pagediscards", "parshapedimen", "parshapeindent", "parshapelength", "predisplaydirection", "protected", "savinghyphcodes", "savingvdiscards", "scantokens", "showgroups", "showifs", "showtokens", "splitbotmarks", "splitdiscards", "splitfirstmarks", "topmarks", "tracingassigns", "tracinggroups", "tracingifs", "tracingnesting", "unexpanded", "unless", "widowpenalties" },
- ["luatex"]={ "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelimited", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaccentbasedepth", "Umathaccentbaseheight", "Umathaccentbottomovershoot", "Umathaccentbottomshiftdown", "Umathaccentextendmargin", "Umathaccentsuperscriptdrop", "Umathaccentsuperscriptpercent", "Umathaccenttopovershoot", "Umathaccenttopshiftup", "Umathaccentvariant", "Umathadapttoleft", "Umathadapttoright", "Umathaxis", "Umathbottomaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharslot", "Umathclass", "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", "Umathdelimiterextendmargin", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", "Umathdelimiterundervariant", "Umathdenominatorvariant", "Umathdict", "Umathdictdef", "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", "Umathextrasubspace", "Umathextrasuppreshift", "Umathextrasupprespace", "Umathextrasupshift", "Umathextrasupspace", "Umathflattenedaccentbasedepth", "Umathflattenedaccentbaseheight", "Umathflattenedaccentbottomshiftdown", "Umathflattenedaccenttopshiftup", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathfractionvariant", "Umathhextensiblevariant", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathlimits", "Umathnoaxis", "Umathnolimits", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathnumeratorvariant", "Umathopenupdepth", "Umathopenupheight", "Umathoperatorsize", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervariant", "Umathoverdelimitervgap", "Umathoverlayaccentvariant", "Umathoverlinevariant", "Umathphantom", "Umathpresubshiftdistance", "Umathpresupshiftdistance", "Umathprimeraise", "Umathprimeraisecomposed", "Umathprimeshiftdrop", "Umathprimeshiftup", "Umathprimespaceafter", "Umathprimevariant", "Umathprimewidth", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalextensibleafter", "Umathradicalextensiblebefore", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", "Umathradicalvgap", "Umathruledepth", "Umathruleheight", "Umathskeweddelimitertolerance", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathsource", "Umathspaceafterscript", "Umathspacebeforescript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvariant", "Umathstackvgap", "Umathsubscriptvariant", "Umathsubshiftdistance", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsuperscriptvariant", "Umathsupshiftdistance", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervariant", "Umathunderdelimitervgap", "Umathunderlinevariant", "Umathuseaxis", "Umathvextensiblevariant", "Umathvoid", "Umathxscale", "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uoperator", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uprimescript", "Uradical", "Uright", "Uroot", "Urooted", "Ushiftedsubprescript", "Ushiftedsubscript", "Ushiftedsuperprescript", "Ushiftedsuperscript", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustartmathmode", "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", "Ustretched", "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "aligncontent", "alignmark", "alignmentcellsource", "alignmentwrapsource", "aligntab", "allcrampedstyles", "alldisplaystyles", "allmainstyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", "allunsplitstyles", "amcode", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "autoparagraphmode", "begincsname", "beginlocalcontrol", "beginmathgroup", "beginsimplegroup", "boundary", "boxadapt", "boxanchor", "boxanchors", "boxattribute", "boxdirection", "boxfreeze", "boxgeometry", "boxorientation", "boxrepack", "boxshift", "boxsource", "boxtarget", "boxtotal", "boxvadjust", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "cdef", "cdefcsname", "cfcode", "clearmarks", "constant", "copymathatomrule", "copymathparent", "copymathspacing", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csactive", "csstring", "currentloopiterator", "currentloopnesting", "currentmarks", "dbox", "defcsname", "deferred", "detokenized", "dimensiondef", "dimexpression", "directlua", "dpack", "dsplit", "edefcsname", "efcode", "endlocalcontrol", "endmathgroup", "endsimplegroup", "enforced", "etoks", "etoksapp", "etokspre", "eufactor", "everybeforepar", "everymathatom", "everytab", "exceptionpenalty", "expand", "expandactive", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandedafter", "expandedloop", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "float", "floatdef", "floatexpr", "flushmarks", "fontcharba", "fontcharta", "fontid", "fontmathcontrol", "fontspecdef", "fontspecid", "fontspecifiedname", "fontspecifiedsize", "fontspecscale", "fontspecxscale", "fontspecyscale", "fonttextcontrol", "formatname", "frozen", "futurecsname", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gdefcsname", "gleaders", "glet", "gletcsname", "glettonothing", "gluespecdef", "glyph", "glyphdatafield", "glyphoptions", "glyphscale", "glyphscriptfield", "glyphscriptscale", "glyphscriptscriptscale", "glyphstatefield", "glyphtextscale", "glyphxoffset", "glyphxscale", "glyphxscaled", "glyphyoffset", "glyphyscale", "glyphyscaled", "gtoksapp", "gtokspre", "hccode", "hjcode", "hmcode", "holdingmigrations", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsfloat", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchkdimension", "ifchknum", "ifchknumber", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimexpression", "ifdimval", "ifempty", "ifflags", "iffloat", "ifhaschar", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifinsert", "ifmathparameter", "ifmathstyle", "ifnumexpression", "ifnumval", "ifparameter", "ifparameters", "ifrelax", "iftok", "ifzerodim", "ifzerofloat", "ifzeronum", "ignorearguments", "ignoredepthcriterium", "ignorepars", "immediate", "immutable", "indexofcharacter", "indexofregister", "inherited", "initcatcodetable", "insertbox", "insertcopy", "insertdepth", "insertdistance", "insertheight", "insertheights", "insertlimit", "insertmaxdepth", "insertmode", "insertmultiplier", "insertpenalty", "insertprogress", "insertstorage", "insertstoring", "insertunbox", "insertuncopy", "insertwidth", "instance", "integerdef", "lastarguments", "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", "lastleftclass", "lastloopiterator", "lastnamedcs", "lastnodesubtype", "lastpageextra", "lastparcontext", "lastrightclass", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letmathatomrule", "letmathparent", "letmathspacing", "letprotected", "lettonothing", "linebreakcriterium", "linedirection", "localbrokenpenalty", "localcontrol", "localcontrolled", "localcontrolledloop", "localinterlinepenalty", "localleftbox", "localleftboxbox", "localmiddlebox", "localmiddleboxbox", "localrightbox", "localrightboxbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathaccent", "mathatom", "mathatomglue", "mathatomskip", "mathbackwardpenalties", "mathbeginclass", "mathbinary", "mathcheckfencesmode", "mathclose", "mathdictgroup", "mathdictproperties", "mathdirection", "mathdisplaymode", "mathdisplayskipmode", "mathdoublescriptmode", "mathendclass", "matheqnogapstep", "mathfenced", "mathfontcontrol", "mathforwardpenalties", "mathfraction", "mathghost", "mathgluemode", "mathgroupingmode", "mathinner", "mathleftclass", "mathlimitsmode", "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathopen", "mathoperator", "mathordinary", "mathoverline", "mathpenaltiesmode", "mathpunctuation", "mathradical", "mathrelation", "mathrightclass", "mathrulesfam", "mathrulesmode", "mathscale", "mathscriptsmode", "mathslackmode", "mathspacingmode", "mathstackstyle", "mathstyle", "mathstylefontid", "mathsurroundmode", "mathsurroundskip", "maththreshold", "mathunderline", "meaningasis", "meaningful", "meaningfull", "meaningles", "meaningless", "mugluespecdef", "mutable", "noaligned", "noatomruling", "noboundary", "nohrule", "norelax", "normalizelinemode", "normalizeparmode", "nospaces", "novrule", "numericscale", "numexpression", "orelse", "orphanpenalties", "orphanpenalty", "orunless", "outputbox", "overloaded", "overloadmode", "overshoot", "pageboundary", "pageextragoal", "pagevsize", "parametercount", "parametermark", "parattribute", "pardirection", "permanent", "pettymuskip", "positdef", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "preinlinepenalty", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitloop", "quitvmode", "resetmathspacing", "retokenized", "rightmarginkern", "rpcode", "savecatcodetable", "scaledemwidth", "scaledexheight", "scaledextraspace", "scaledfontdimen", "scaledinterwordshrink", "scaledinterwordspace", "scaledinterwordstretch", "scaledmathstyle", "scaledslantperpoint", "scantextokens", "semiexpand", "semiexpanded", "semiprotected", "setdefaultmathcodes", "setfontid", "setmathatomrule", "setmathdisplaypostpenalty", "setmathdisplayprepenalty", "setmathignore", "setmathoptions", "setmathpostpenalty", "setmathprepenalty", "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", "snapshotpar", "srule", "supmarkmode", "swapcsvalues", "tabsize", "textdirection", "thewithoutunit", "tinymuskip", "todimension", "tohexadecimal", "tointeger", "tokenized", "toksapp", "tokspre", "tolerant", "tomathstyle", "toscaled", "tosparsedimension", "tosparsescaled", "tpack", "tracingadjusts", "tracingalignments", "tracingexpressions", "tracingfonts", "tracingfullboxes", "tracinghyphenation", "tracinginserts", "tracinglevels", "tracinglists", "tracingmarks", "tracingmath", "tracingnodes", "tracingpenalties", "tsplit", "uleaders", "undent", "unexpandedloop", "unhpack", "unletfrozen", "unletprotected", "untraced", "unvpack", "variablefam", "virtualhrule", "virtualvrule", "vpack", "wordboundary", "wrapuppar", "xdefcsname", "xtoks", "xtoksapp", "xtokspre" },
+ ["luatex"]={ "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelimited", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaccentbasedepth", "Umathaccentbaseheight", "Umathaccentbottomovershoot", "Umathaccentbottomshiftdown", "Umathaccentextendmargin", "Umathaccentsuperscriptdrop", "Umathaccentsuperscriptpercent", "Umathaccenttopovershoot", "Umathaccenttopshiftup", "Umathaccentvariant", "Umathadapttoleft", "Umathadapttoright", "Umathaxis", "Umathbottomaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharslot", "Umathclass", "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", "Umathdelimiterextendmargin", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", "Umathdelimiterundervariant", "Umathdenominatorvariant", "Umathdict", "Umathdictdef", "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", "Umathextrasubspace", "Umathextrasuppreshift", "Umathextrasupprespace", "Umathextrasupshift", "Umathextrasupspace", "Umathflattenedaccentbasedepth", "Umathflattenedaccentbaseheight", "Umathflattenedaccentbottomshiftdown", "Umathflattenedaccenttopshiftup", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathfractionvariant", "Umathhextensiblevariant", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathlimits", "Umathnoaxis", "Umathnolimits", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathnumeratorvariant", "Umathopenupdepth", "Umathopenupheight", "Umathoperatorsize", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervariant", "Umathoverdelimitervgap", "Umathoverlayaccentvariant", "Umathoverlinevariant", "Umathphantom", "Umathpresubshiftdistance", "Umathpresupshiftdistance", "Umathprimeraise", "Umathprimeraisecomposed", "Umathprimeshiftdrop", "Umathprimeshiftup", "Umathprimespaceafter", "Umathprimevariant", "Umathprimewidth", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalextensibleafter", "Umathradicalextensiblebefore", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", "Umathradicalvgap", "Umathruledepth", "Umathruleheight", "Umathskeweddelimitertolerance", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathsource", "Umathspaceafterscript", "Umathspacebeforescript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvariant", "Umathstackvgap", "Umathsubscriptvariant", "Umathsubshiftdistance", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsuperscriptvariant", "Umathsupshiftdistance", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervariant", "Umathunderdelimitervgap", "Umathunderlinevariant", "Umathuseaxis", "Umathvextensiblevariant", "Umathvoid", "Umathxscale", "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uoperator", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uprimescript", "Uradical", "Uright", "Uroot", "Urooted", "Ushiftedsubprescript", "Ushiftedsubscript", "Ushiftedsuperprescript", "Ushiftedsuperscript", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustartmathmode", "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", "Ustretched", "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "advanceby", "afterassigned", "aftergrouped", "aliased", "aligncontent", "alignmark", "alignmentcellsource", "alignmentwrapsource", "aligntab", "allcrampedstyles", "alldisplaystyles", "allmainstyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", "allunsplitstyles", "amcode", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "autoparagraphmode", "begincsname", "beginlocalcontrol", "beginmathgroup", "beginsimplegroup", "boundary", "boxadapt", "boxanchor", "boxanchors", "boxattribute", "boxdirection", "boxfreeze", "boxgeometry", "boxorientation", "boxrepack", "boxshift", "boxsource", "boxtarget", "boxtotal", "boxvadjust", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "cdef", "cdefcsname", "cfcode", "clearmarks", "constant", "copymathatomrule", "copymathparent", "copymathspacing", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csactive", "csstring", "currentloopiterator", "currentloopnesting", "currentmarks", "dbox", "defcsname", "deferred", "detokened", "detokenized", "dimensiondef", "dimexpression", "directlua", "divideby", "dpack", "dsplit", "edefcsname", "efcode", "endlocalcontrol", "endmathgroup", "endsimplegroup", "enforced", "etoks", "etoksapp", "etokspre", "eufactor", "everybeforepar", "everymathatom", "everytab", "exceptionpenalty", "expand", "expandactive", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandedafter", "expandedloop", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "float", "floatdef", "floatexpr", "flushmarks", "fontcharba", "fontcharta", "fontid", "fontmathcontrol", "fontspecdef", "fontspecid", "fontspecifiedname", "fontspecifiedsize", "fontspecscale", "fontspecxscale", "fontspecyscale", "fonttextcontrol", "formatname", "frozen", "futurecsname", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gdefcsname", "gleaders", "glet", "gletcsname", "glettonothing", "gluespecdef", "glyph", "glyphdatafield", "glyphoptions", "glyphscale", "glyphscriptfield", "glyphscriptscale", "glyphscriptscriptscale", "glyphstatefield", "glyphtextscale", "glyphxoffset", "glyphxscale", "glyphxscaled", "glyphyoffset", "glyphyscale", "glyphyscaled", "gtoksapp", "gtokspre", "hccode", "hjcode", "hmcode", "holdingmigrations", "hpack", "hpenalty", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsfloat", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchkdimension", "ifchknum", "ifchknumber", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimexpression", "ifdimval", "ifempty", "ifflags", "iffloat", "ifhaschar", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifinsert", "ifintervaldim", "ifintervalfloat", "ifintervalnum", "ifmathparameter", "ifmathstyle", "ifnumexpression", "ifnumval", "ifparameter", "ifparameters", "ifrelax", "iftok", "ifzerodim", "ifzerofloat", "ifzeronum", "ignorearguments", "ignoredepthcriterium", "ignorepars", "immediate", "immutable", "indexofcharacter", "indexofregister", "inherited", "initcatcodetable", "insertbox", "insertcopy", "insertdepth", "insertdistance", "insertheight", "insertheights", "insertlimit", "insertmaxdepth", "insertmode", "insertmultiplier", "insertpenalty", "insertprogress", "insertstorage", "insertstoring", "insertunbox", "insertuncopy", "insertwidth", "instance", "integerdef", "lastarguments", "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", "lastleftclass", "lastloopiterator", "lastnamedcs", "lastnodesubtype", "lastpageextra", "lastparcontext", "lastrightclass", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letmathatomrule", "letmathparent", "letmathspacing", "letprotected", "lettonothing", "linebreakcriterium", "linedirection", "localbrokenpenalty", "localcontrol", "localcontrolled", "localcontrolledloop", "localinterlinepenalty", "localleftbox", "localleftboxbox", "localmiddlebox", "localmiddleboxbox", "localrightbox", "localrightboxbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathaccent", "mathatom", "mathatomglue", "mathatomskip", "mathbackwardpenalties", "mathbeginclass", "mathbinary", "mathcheckfencesmode", "mathclose", "mathdictgroup", "mathdictproperties", "mathdirection", "mathdisplaymode", "mathdisplayskipmode", "mathdoublescriptmode", "mathendclass", "matheqnogapstep", "mathfenced", "mathfontcontrol", "mathforwardpenalties", "mathfraction", "mathghost", "mathgluemode", "mathgroupingmode", "mathinner", "mathleftclass", "mathlimitsmode", "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathopen", "mathoperator", "mathordinary", "mathoverline", "mathpenaltiesmode", "mathpunctuation", "mathradical", "mathrelation", "mathrightclass", "mathrulesfam", "mathrulesmode", "mathscale", "mathscriptsmode", "mathslackmode", "mathspacingmode", "mathstackstyle", "mathstyle", "mathstylefontid", "mathsurroundmode", "mathsurroundskip", "maththreshold", "mathunderline", "meaningasis", "meaningful", "meaningfull", "meaningles", "meaningless", "mugluespecdef", "multiplyby", "mutable", "noaligned", "noatomruling", "noboundary", "nohrule", "norelax", "normalizelinemode", "normalizeparmode", "nospaces", "novrule", "numericscale", "numexpression", "orelse", "orphanpenalties", "orphanpenalty", "orunless", "outputbox", "overloaded", "overloadmode", "overshoot", "pageboundary", "pageextragoal", "pagevsize", "parametercount", "parametermark", "parattribute", "pardirection", "parfillleftskip", "parfillrightskip", "parinitleftskip", "parinitrightskip", "permanent", "pettymuskip", "positdef", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", "postshortinlinepenalty", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "preinlinepenalty", "prerelpenalty", "preshortinlinepenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitloop", "quitvmode", "resetmathspacing", "retokenized", "rightmarginkern", "rpcode", "savecatcodetable", "scaledemwidth", "scaledexheight", "scaledextraspace", "scaledfontdimen", "scaledinterwordshrink", "scaledinterwordspace", "scaledinterwordstretch", "scaledmathstyle", "scaledslantperpoint", "scantextokens", "semiexpand", "semiexpanded", "semiprotected", "setdefaultmathcodes", "setfontid", "setmathatomrule", "setmathdisplaypostpenalty", "setmathdisplayprepenalty", "setmathignore", "setmathoptions", "setmathpostpenalty", "setmathprepenalty", "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", "snapshotpar", "srule", "supmarkmode", "swapcsvalues", "tabsize", "textdirection", "thewithoutunit", "tinymuskip", "todimension", "tohexadecimal", "tointeger", "tokenized", "toksapp", "tokspre", "tolerant", "tomathstyle", "toscaled", "tosparsedimension", "tosparsescaled", "tpack", "tracingadjusts", "tracingalignments", "tracingexpressions", "tracingfonts", "tracingfullboxes", "tracinghyphenation", "tracinginserts", "tracinglevels", "tracinglists", "tracingmarks", "tracingmath", "tracingnodes", "tracingpenalties", "tsplit", "uleaders", "undent", "unexpandedloop", "unhpack", "unletfrozen", "unletprotected", "untraced", "unvpack", "variablefam", "virtualhrule", "virtualvrule", "vpack", "vpenalty", "wordboundary", "wrapuppar", "xdefcsname", "xtoks", "xtoksapp", "xtokspre" },
["omega"]={ "Omegaminorversion", "Omegarevision", "Omegaversion" },
["pdftex"]={ "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfeachlinedepth", "pdfeachlineheight", "pdfendlink", "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfignoreunknownimages", "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinfoomitdate", "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmajorversion", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfomitcharset", "pdfomitcidset", "pdfomitinfodict", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkfixeddpi", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrecompress", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdfsuppressoptionalinfo", "pdfsuppressptexinfo", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage" },
- ["tex"]={ " ", "-", "/", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "advanceby", "afterassignment", "aftergroup", "atop", "atopwithdelims", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "botmark", "box", "boxmaxdepth", "brokenpenalty", "catcode", "char", "chardef", "cleaders", "clubpenalty", "copy", "count", "countdef", "cr", "crcr", "csname", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "dimen", "dimendef", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalty", "displaywidth", "divide", "divideby", "doublehyphendemerits", "dp", "dump", "edef", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "fam", "fi", "finalhyphendemerits", "firstmark", "floatingpenalty", "font", "fontdimen", "fontname", "futurelet", "gdef", "global", "globaldefs", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifcase", "ifcat", "ifdim", "iffalse", "ifhbox", "ifhmode", "ifinner", "ifmmode", "ifnum", "ifodd", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignorespaces", "indent", "input", "inputlineno", "insert", "insertpenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastpenalty", "lastskip", "lccode", "leaders", "left", "lefthyphenmin", "leftskip", "leqno", "let", "limits", "linepenalty", "lineskip", "lineskiplimit", "long", "looseness", "lower", "lowercase", "mark", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathcode", "mathop", "mathord", "mathpunct", "mathrel", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "multiply", "multiplyby", "muskip", "muskipdef", "newlinechar", "noalign", "noexpand", "noindent", "nolimits", "nonscript", "nonstopmode", "nulldelimiterspace", "nullfont", "number", "omit", "or", "outer", "output", "outputpenalty", "over", "overfullrule", "overline", "overwithdelims", "pagedepth", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageshrink", "pagestretch", "pagetotal", "par", "parfillleftskip", "parfillskip", "parindent", "parinitleftskip", "parinitrightskip", "parshape", "parskip", "patterns", "pausing", "penalty", "postdisplaypenalty", "predisplaypenalty", "predisplaysize", "pretolerance", "prevdepth", "prevgraf", "radical", "raise", "relax", "relpenalty", "right", "righthyphenmin", "rightskip", "romannumeral", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setlanguage", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showlists", "shownodedetails", "showthe", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "splitbotmark", "splitfirstmark", "splitmaxdepth", "splittopskip", "string", "tabskip", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "toks", "toksdef", "tolerance", "topmark", "topskip", "tracingcommands", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingstats", "uccode", "uchyph", "unboundary", "underline", "unhbox", "unhcopy", "unkern", "unpenalty", "unskip", "unvbox", "unvcopy", "uppercase", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalty", "xdef", "xleaders", "xspaceskip", "year" },
+ ["tex"]={ " ", "-", "/", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "afterassignment", "aftergroup", "atop", "atopwithdelims", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "botmark", "box", "boxmaxdepth", "brokenpenalty", "catcode", "char", "chardef", "cleaders", "clubpenalty", "copy", "count", "countdef", "cr", "crcr", "csname", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "dimen", "dimendef", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalty", "displaywidth", "divide", "doublehyphendemerits", "dp", "dump", "edef", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "fam", "fi", "finalhyphendemerits", "firstmark", "floatingpenalty", "font", "fontdimen", "fontname", "futurelet", "gdef", "global", "globaldefs", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "hkern", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifcase", "ifcat", "ifdim", "iffalse", "ifhbox", "ifhmode", "ifinner", "ifmmode", "ifnum", "ifodd", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignorespaces", "indent", "input", "inputlineno", "insert", "insertpenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastpenalty", "lastskip", "lccode", "leaders", "left", "lefthyphenmin", "leftskip", "leqno", "let", "limits", "linepenalty", "lineskip", "lineskiplimit", "long", "looseness", "lower", "lowercase", "mark", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathcode", "mathop", "mathord", "mathpunct", "mathrel", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "multiply", "muskip", "muskipdef", "newlinechar", "noalign", "noexpand", "noindent", "nolimits", "nonscript", "nonstopmode", "nulldelimiterspace", "nullfont", "number", "omit", "or", "outer", "output", "outputpenalty", "over", "overfullrule", "overline", "overwithdelims", "pagedepth", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageshrink", "pagestretch", "pagetotal", "par", "parfillskip", "parindent", "parshape", "parskip", "patterns", "pausing", "penalty", "postdisplaypenalty", "predisplaypenalty", "predisplaysize", "pretolerance", "prevdepth", "prevgraf", "radical", "raise", "relax", "relpenalty", "right", "righthyphenmin", "rightskip", "romannumeral", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setlanguage", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showlists", "shownodedetails", "showthe", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "splitbotmark", "splitfirstmark", "splitmaxdepth", "splittopskip", "string", "tabskip", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "toks", "toksdef", "tolerance", "topmark", "topskip", "tracingcommands", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingstats", "uccode", "uchyph", "unboundary", "underline", "unhbox", "unhcopy", "unkern", "unpenalty", "unskip", "unvbox", "unvcopy", "uppercase", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "vkern", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalty", "xdef", "xleaders", "xspaceskip", "year" },
["xetex"]={ "XeTeXversion" },
} \ No newline at end of file
diff --git a/context/data/scite/context/scite-context-data-context.properties b/context/data/scite/context/scite-context-data-context.properties
index 209870c3d..c23e2e3a7 100644
--- a/context/data/scite/context/scite-context-data-context.properties
+++ b/context/data/scite/context/scite-context-data-context.properties
@@ -99,20 +99,20 @@ ideographicspace ideographichalffillspace twoperemspace threeperemspace fourpere
fiveperemspace sixperemspace figurespace punctuationspace hairspace \
enquad emquad zerowidthspace zerowidthnonjoiner zerowidthjoiner \
zwnj zwj optionalspace asciispacechar softhyphen \
-autoinsertedspace Ux eUx parfillleftskip parfillrightskip \
-startlmtxmode stoplmtxmode startmkivmode stopmkivmode wildcardsymbol \
-normalhyphenationcode automatichyphenationcode explicithyphenationcode syllablehyphenationcode uppercasehyphenationcode \
-collapsehyphenationcode compoundhyphenationcode strictstarthyphenationcode strictendhyphenationcode automaticpenaltyhyphenationcode \
-explicitpenaltyhyphenationcode permitgluehyphenationcode permitallhyphenationcode permitmathreplacehyphenationcode forcecheckhyphenationcode \
-lazyligatureshyphenationcode forcehandlerhyphenationcode feedbackcompoundhyphenationcode ignoreboundshyphenationcode partialhyphenationcode \
-completehyphenationcode normalizelinenormalizecode parindentskipnormalizecode swaphangindentnormalizecode swapparsshapenormalizecode \
-breakafterdirnormalizecode removemarginkernsnormalizecode clipwidthnormalizecode flattendiscretionariesnormalizecode discardzerotabskipsnormalizecode \
-flattenhleadersnormalizecode normalizeparnormalizeparcode flattenvleadersnormalizeparcode nopreslackclassoptioncode nopostslackclassoptioncode \
-lefttopkernclassoptioncode righttopkernclassoptioncode leftbottomkernclassoptioncode rightbottomkernclassoptioncode lookaheadforendclassoptioncode \
-noitaliccorrectionclassoptioncode defaultmathclassoptions checkligatureclassoptioncode checkitaliccorrectionclassoptioncode checkkernpairclassoptioncode \
-flattenclassoptioncode omitpenaltyclassoptioncode unpackclassoptioncode raiseprimeclassoptioncode carryoverlefttopkernclassoptioncode \
-carryoverleftbottomkernclassoptioncode carryoverrighttopkernclassoptioncode carryoverrightbottomkernclassoptioncode preferdelimiterdimensionsclassoptioncode autoinjectclassoptioncode \
-removeitaliccorrectionclassoptioncode operatoritaliccorrectionclassoptioncode noligaturingglyphoptioncode nokerningglyphoptioncode noleftligatureglyphoptioncode \
+autoinsertedspace Ux eUx startlmtxmode stoplmtxmode \
+startmkivmode stopmkivmode wildcardsymbol normalhyphenationcode automatichyphenationcode \
+explicithyphenationcode syllablehyphenationcode uppercasehyphenationcode collapsehyphenationcode compoundhyphenationcode \
+strictstarthyphenationcode strictendhyphenationcode automaticpenaltyhyphenationcode explicitpenaltyhyphenationcode permitgluehyphenationcode \
+permitallhyphenationcode permitmathreplacehyphenationcode forcecheckhyphenationcode lazyligatureshyphenationcode forcehandlerhyphenationcode \
+feedbackcompoundhyphenationcode ignoreboundshyphenationcode partialhyphenationcode completehyphenationcode normalizelinenormalizecode \
+parindentskipnormalizecode swaphangindentnormalizecode swapparsshapenormalizecode breakafterdirnormalizecode removemarginkernsnormalizecode \
+clipwidthnormalizecode flattendiscretionariesnormalizecode discardzerotabskipsnormalizecode flattenhleadersnormalizecode normalizeparnormalizeparcode \
+flattenvleadersnormalizeparcode limitprevgrafnormalizeparcode nopreslackclassoptioncode nopostslackclassoptioncode lefttopkernclassoptioncode \
+righttopkernclassoptioncode leftbottomkernclassoptioncode rightbottomkernclassoptioncode lookaheadforendclassoptioncode noitaliccorrectionclassoptioncode \
+defaultmathclassoptions checkligatureclassoptioncode checkitaliccorrectionclassoptioncode checkkernpairclassoptioncode flattenclassoptioncode \
+omitpenaltyclassoptioncode unpackclassoptioncode raiseprimeclassoptioncode carryoverlefttopkernclassoptioncode carryoverleftbottomkernclassoptioncode \
+carryoverrighttopkernclassoptioncode carryoverrightbottomkernclassoptioncode preferdelimiterdimensionsclassoptioncode autoinjectclassoptioncode removeitaliccorrectionclassoptioncode \
+operatoritaliccorrectionclassoptioncode shortinlineclassoptioncode noligaturingglyphoptioncode nokerningglyphoptioncode noleftligatureglyphoptioncode \
noleftkernglyphoptioncode norightligatureglyphoptioncode norightkernglyphoptioncode noexpansionglyphoptioncode noprotrusionglyphoptioncode \
noitaliccorrectionglyphoptioncode nokerningcode noligaturingcode frozenflagcode tolerantflagcode \
protectedflagcode primitiveflagcode permanentflagcode noalignedflagcode immutableflagcode \
@@ -138,187 +138,187 @@ newmarks newinsert newattribute newif newfloat \
newlanguage newfamily newfam newhelp newinteger \
newdimension newgluespec newmugluespec newposit aliasinteger \
aliasdimension aliasposit then begcsname autorule \
-strippedcsname checkedstrippedcsname nofarguments firstargumentfalse firstargumenttrue \
-secondargumentfalse secondargumenttrue thirdargumentfalse thirdargumenttrue fourthargumentfalse \
-fourthargumenttrue fifthargumentfalse fifthargumenttrue sixthargumentfalse sixthargumenttrue \
-seventhargumentfalse seventhargumenttrue vkern hkern vpenalty \
-hpenalty doglobal dodoglobal redoglobal resetglobal \
-donothing untraceddonothing dontcomplain moreboxtracing lessboxtracing \
-noboxtracing forgetall donetrue donefalse foundtrue \
-foundfalse inlineordisplaymath indisplaymath forcedisplaymath startforceddisplaymath \
-stopforceddisplaymath startpickupmath stoppickupmath reqno forceinlinemath \
-mathortext thebox htdp unvoidbox hfilll \
-vfilll mathbox mathlimop mathnolop mathnothing \
-mathalpha currentcatcodetable defaultcatcodetable catcodetablename newcatcodetable \
-startcatcodetable stopcatcodetable startextendcatcodetable stopextendcatcodetable pushcatcodetable \
-popcatcodetable restorecatcodes setcatcodetable letcatcodecommand defcatcodecommand \
-uedcatcodecommand hglue vglue hfillneg vfillneg \
-hfilllneg vfilllneg hsplit ruledhss ruledhfil \
-ruledhfill ruledhfilll ruledhfilneg ruledhfillneg normalhfillneg \
-normalhfilllneg ruledvss ruledvfil ruledvfill ruledvfilll \
-ruledvfilneg ruledvfillneg normalvfillneg normalvfilllneg ruledhbox \
-ruledvbox ruledvtop ruleddbox ruledvcenter ruledmbox \
-ruledhpack ruledvpack ruledtpack ruleddpack ruledvsplit \
-ruledtsplit ruleddsplit ruledhskip ruledvskip ruledkern \
-ruledmskip ruledmkern ruledhglue ruledvglue normalhglue \
-normalvglue ruledpenalty filledhboxb filledhboxr filledhboxg \
-filledhboxc filledhboxm filledhboxy filledhboxk scratchstring \
-scratchstringone scratchstringtwo tempstring scratchcounter globalscratchcounter \
-privatescratchcounter scratchfloat globalscratchfloat privatescratchfloat scratchdimen \
-globalscratchdimen privatescratchdimen scratchskip globalscratchskip privatescratchskip \
-scratchmuskip globalscratchmuskip privatescratchmuskip scratchtoks globalscratchtoks \
-privatescratchtoks scratchbox globalscratchbox privatescratchbox scratchmacro \
-scratchmacroone scratchmacrotwo scratchconditiontrue scratchconditionfalse ifscratchcondition \
-scratchconditiononetrue scratchconditiononefalse ifscratchconditionone scratchconditiontwotrue scratchconditiontwofalse \
-ifscratchconditiontwo globalscratchcounterone globalscratchcountertwo globalscratchcounterthree groupedcommand \
-groupedcommandcs triggergroupedcommand triggergroupedcommandcs simplegroupedcommand simplegroupedcommandcs \
-pickupgroupedcommand pickupgroupedcommandcs mathgroupedcommandcs usedbaselineskip usedlineskip \
-usedlineskiplimit availablehsize localhsize setlocalhsize distributedhsize \
-hsizefraction next nexttoken nextbox dowithnextbox \
-dowithnextboxcs dowithnextboxcontent dowithnextboxcontentcs flushnextbox boxisempty \
-boxtostring contentostring prerolltostring givenwidth givenheight \
-givendepth scangivendimensions scratchwidth scratchheight scratchdepth \
-scratchoffset scratchdistance scratchtotal scratchitalic scratchhsize \
-scratchvsize scratchxoffset scratchyoffset scratchhoffset scratchvoffset \
-scratchxposition scratchyposition scratchtopoffset scratchbottomoffset scratchleftoffset \
-scratchrightoffset scratchcounterone scratchcountertwo scratchcounterthree scratchcounterfour \
-scratchcounterfive scratchcountersix scratchfloatone scratchfloattwo scratchfloatthree \
-scratchfloatfour scratchfloatfive scratchfloatsix scratchdimenone scratchdimentwo \
-scratchdimenthree scratchdimenfour scratchdimenfive scratchdimensix scratchskipone \
-scratchskiptwo scratchskipthree scratchskipfour scratchskipfive scratchskipsix \
-scratchmuskipone scratchmuskiptwo scratchmuskipthree scratchmuskipfour scratchmuskipfive \
-scratchmuskipsix scratchtoksone scratchtokstwo scratchtoksthree scratchtoksfour \
-scratchtoksfive scratchtokssix scratchboxone scratchboxtwo scratchboxthree \
-scratchboxfour scratchboxfive scratchboxsix scratchnx scratchny \
-scratchmx scratchmy scratchunicode scratchmin scratchmax \
-pfsin pfcos pftan pfasin pfacos \
-pfatan pfsinh pfcosh pftanh pfasinh \
-pfacosh pfatanh pfsqrt pflog pfexp \
-pfceil pffloor pfround pfabs pfrad \
-pfdeg pfatantwo pfpow pfmod pfrem \
-scratchleftskip scratchrightskip scratchtopskip scratchbottomskip doif \
-doifnot doifelse firstinset doifinset doifnotinset \
-doifelseinset doifinsetelse doifelsenextchar doifnextcharelse doifelsenextcharcs \
-doifnextcharcselse doifelsenextoptional doifnextoptionalelse doifelsenextoptionalcs doifnextoptionalcselse \
-doifelsefastoptionalcheck doiffastoptionalcheckelse doifelsefastoptionalcheckcs doiffastoptionalcheckcselse doifelsenextbgroup \
-doifnextbgroupelse doifelsenextbgroupcs doifnextbgroupcselse doifelsenextparenthesis doifnextparenthesiselse \
-doifelseundefined doifundefinedelse doifelsedefined doifdefinedelse doifundefined \
-doifdefined doifelsevalue doifvalue doifnotvalue doifnothing \
-doifsomething doifelsenothing doifnothingelse doifelsesomething doifsomethingelse \
-doifvaluenothing doifvaluesomething doifelsevaluenothing doifvaluenothingelse doifelsedimension \
-doifdimensionelse doifelsenumber doifnumberelse doifnumber doifnotnumber \
-doifelsecommon doifcommonelse doifcommon doifnotcommon doifinstring \
-doifnotinstring doifelseinstring doifinstringelse doifelseassignment doifassignmentelse \
-docheckassignment doifelseassignmentcs doifassignmentelsecs validassignment novalidassignment \
-doiftext doifelsetext doiftextelse doifnottext quitcondition \
-truecondition falsecondition tracingall tracingnone loggingall \
-tracingcatcodes showluatokens aliasmacro removetoks appendtoks \
-prependtoks appendtotoks prependtotoks to endgraf \
-endpar reseteverypar finishpar empty null \
-space quad enspace emspace charspace \
-nbsp crlf obeyspaces obeylines obeytabs \
-obeypages obeyedspace obeyedline obeyedtab obeyedpage \
-normalspace naturalspace controlspace normalspaces ignoretabs \
-ignorelines ignorepages ignoreeofs setcontrolspaces executeifdefined \
-singleexpandafter doubleexpandafter tripleexpandafter dontleavehmode removelastspace \
-removeunwantedspaces keepunwantedspaces removepunctuation ignoreparskip forcestrutdepth \
-onlynonbreakablespace wait writestatus define defineexpandable \
-redefine setmeasure setemeasure setgmeasure setxmeasure \
-definemeasure freezemeasure measure measured directmeasure \
-setquantity setequantity setgquantity setxquantity definequantity \
-freezequantity quantity quantitied directquantity installcorenamespace \
-getvalue getuvalue setvalue setevalue setgvalue \
-setxvalue letvalue letgvalue resetvalue undefinevalue \
-ignorevalue setuvalue setuevalue setugvalue setuxvalue \
-globallet udef ugdef uedef uxdef \
-checked unique getparameters geteparameters getgparameters \
-getxparameters forgetparameters copyparameters getdummyparameters dummyparameter \
-directdummyparameter setdummyparameter letdummyparameter setexpandeddummyparameter resetdummyparameter \
-usedummystyleandcolor usedummystyleparameter usedummycolorparameter processcommalist processcommacommand \
-quitcommalist quitprevcommalist processaction processallactions processfirstactioninset \
-processallactionsinset unexpanded expanded startexpanded stopexpanded \
-protect unprotect firstofoneargument firstoftwoarguments secondoftwoarguments \
-firstofthreearguments secondofthreearguments thirdofthreearguments firstoffourarguments secondoffourarguments \
-thirdoffourarguments fourthoffourarguments firstoffivearguments secondoffivearguments thirdoffivearguments \
-fourthoffivearguments fifthoffivearguments firstofsixarguments secondofsixarguments thirdofsixarguments \
-fourthofsixarguments fifthofsixarguments sixthofsixarguments firstofoneunexpanded firstoftwounexpanded \
-secondoftwounexpanded firstofthreeunexpanded secondofthreeunexpanded thirdofthreeunexpanded gobbleoneargument \
-gobbletwoarguments gobblethreearguments gobblefourarguments gobblefivearguments gobblesixarguments \
-gobblesevenarguments gobbleeightarguments gobbleninearguments gobbletenarguments gobbleoneoptional \
-gobbletwooptionals gobblethreeoptionals gobblefouroptionals gobblefiveoptionals dorecurse \
-doloop exitloop dostepwiserecurse recurselevel recursedepth \
-dofastloopcs fastloopindex fastloopfinal dowith doloopovermatch \
-doloopovermatched doloopoverlist newconstant setnewconstant setconstant \
-setconstantvalue newconditional settrue setfalse settruevalue \
-setfalsevalue setconditional newmacro setnewmacro newfraction \
-newsignal newboundary dosingleempty dodoubleempty dotripleempty \
-doquadrupleempty doquintupleempty dosixtupleempty doseventupleempty dosingleargument \
-dodoubleargument dotripleargument doquadrupleargument doquintupleargument dosixtupleargument \
-doseventupleargument dosinglegroupempty dodoublegroupempty dotriplegroupempty doquadruplegroupempty \
-doquintuplegroupempty permitspacesbetweengroups dontpermitspacesbetweengroups nopdfcompression maximumpdfcompression \
-normalpdfcompression onlypdfobjectcompression nopdfobjectcompression modulonumber dividenumber \
-getfirstcharacter doifelsefirstchar doiffirstcharelse mathclassvalue startnointerference \
-stopnointerference twodigits threedigits leftorright offinterlineskip \
-oninterlineskip nointerlineskip strut halfstrut quarterstrut \
-depthstrut halflinestrut noheightstrut setstrut strutbox \
-strutht strutdp strutwd struthtdp strutgap \
-begstrut endstrut lineheight leftboundary rightboundary \
-signalcharacter aligncontentleft aligncontentmiddle aligncontentright shiftbox \
-vpackbox hpackbox vpackedbox hpackedbox normalreqno \
-startimath stopimath normalstartimath normalstopimath startdmath \
-stopdmath normalstartdmath normalstopdmath normalsuperscript normalsubscript \
-normalnosuperscript normalnosubscript normalprimescript superscript subscript \
-nosuperscript nosubscript primescript superprescript subprescript \
-nosuperprescript nosubsprecript uncramped cramped mathstyletrigger \
-triggermathstyle triggeredmathstyle mathstylefont mathsmallstylefont mathstyleface \
-mathsmallstyleface mathstylecommand mathpalette mathstylehbox mathstylevbox \
-mathstylevcenter mathstylevcenteredhbox mathstylevcenteredvbox mathtext setmathsmalltextbox \
-setmathtextbox pushmathstyle popmathstyle triggerdisplaystyle triggertextstyle \
-triggerscriptstyle triggerscriptscriptstyle triggeruncrampedstyle triggercrampedstyle triggersmallstyle \
-triggeruncrampedsmallstyle triggercrampedsmallstyle triggerbigstyle triggeruncrampedbigstyle triggercrampedbigstyle \
-luaexpr expelsedoif expdoif expdoifnot expdoifelsecommon \
-expdoifcommonelse expdoifelseinset expdoifinsetelse ctxdirectlua ctxlatelua \
-ctxsprint ctxwrite ctxcommand ctxdirectcommand ctxlatecommand \
-ctxreport ctxlua luacode lateluacode directluacode \
-registerctxluafile ctxloadluafile luaversion luamajorversion luaminorversion \
-ctxluacode luaconditional luaexpanded ctxluamatch startluaparameterset \
-stopluaparameterset luaparameterset definenamedlua obeylualines obeyluatokens \
-startluacode stopluacode startlua stoplua startctxfunction \
-stopctxfunction ctxfunction startctxfunctiondefinition stopctxfunctiondefinition installctxfunction \
-installprotectedctxfunction installprotectedctxscanner installctxscanner resetctxscanner cldprocessfile \
-cldloadfile cldloadviafile cldcontext cldcommand carryoverpar \
-freezeparagraphproperties defrostparagraphproperties setparagraphfreezing forgetparagraphfreezing updateparagraphproperties \
-updateparagraphpenalties updateparagraphdemerits updateparagraphshapes updateparagraphlines lastlinewidth \
-assumelongusagecs righttolefthbox lefttorighthbox righttoleftvbox lefttorightvbox \
-righttoleftvtop lefttorightvtop rtlhbox ltrhbox rtlvbox \
-ltrvbox rtlvtop ltrvtop autodirhbox autodirvbox \
-autodirvtop leftorrighthbox leftorrightvbox leftorrightvtop lefttoright \
-righttoleft checkedlefttoright checkedrighttoleft synchronizelayoutdirection synchronizedisplaydirection \
-synchronizeinlinedirection dirlre dirrle dirlro dirrlo \
-rtltext ltrtext lesshyphens morehyphens nohyphens \
-dohyphens dohyphencollapsing nohyphencollapsing compounddiscretionary Ucheckedstartdisplaymath \
-Ucheckedstopdisplaymath break nobreak allowbreak goodbreak \
-nospace nospacing dospacing naturalhbox naturalvbox \
-naturalvtop naturalhpack naturalvpack naturaltpack reversehbox \
-reversevbox reversevtop reversehpack reversevpack reversetpack \
-hcontainer vcontainer tcontainer frule compoundhyphenpenalty \
-start stop unsupportedcs openout closeout \
-write openin closein read readline \
-readfromterminal boxlines boxline setboxline copyboxline \
-boxlinewd boxlineht boxlinedp boxlinenw boxlinenh \
-boxlinend boxlinels boxliners boxlinelh boxlinerh \
-boxlinelp boxlinerp boxlinein boxrangewd boxrangeht \
-boxrangedp bitwiseset bitwiseand bitwiseor bitwisexor \
-bitwisenot bitwisenil ifbitwiseand bitwise bitwiseshift \
-bitwiseflip textdir linedir pardir boxdir \
-prelistbox postlistbox prelistcopy postlistcopy setprelistbox \
-setpostlistbox noligaturing nokerning noexpansion noprotrusion \
-noleftkerning noleftligaturing norightkerning norightligaturing noitaliccorrection \
-futureletnexttoken defbackslashbreak letbackslashbreak pushoverloadmode popoverloadmode \
-pushrunstate poprunstate suggestedalias showboxhere discoptioncodestring \
-flagcodestring frozenparcodestring glyphoptioncodestring groupcodestring hyphenationcodestring \
-mathcontrolcodestring mathflattencodestring normalizecodestring parcontextcodestring newlocalcount \
-newlocaldimen newlocalskip newlocalmuskip newlocaltoks newlocalbox \
-newlocalwrite newlocalread setnewlocalcount setnewlocaldimen setnewlocalskip \
-setnewlocalmuskip setnewlocaltoks setnewlocalbox ifexpression
+tobits tohexa strippedcsname checkedstrippedcsname nofarguments \
+firstargumentfalse firstargumenttrue secondargumentfalse secondargumenttrue thirdargumentfalse \
+thirdargumenttrue fourthargumentfalse fourthargumenttrue fifthargumentfalse fifthargumenttrue \
+sixthargumentfalse sixthargumenttrue seventhargumentfalse seventhargumenttrue doglobal \
+dodoglobal redoglobal resetglobal donothing untraceddonothing \
+dontcomplain moreboxtracing lessboxtracing noboxtracing forgetall \
+donetrue donefalse foundtrue foundfalse inlineordisplaymath \
+indisplaymath forcedisplaymath startforceddisplaymath stopforceddisplaymath startpickupmath \
+stoppickupmath reqno forceinlinemath mathortext thebox \
+htdp unvoidbox hfilll vfilll mathbox \
+mathlimop mathnolop mathnothing mathalpha currentcatcodetable \
+defaultcatcodetable catcodetablename newcatcodetable startcatcodetable stopcatcodetable \
+startextendcatcodetable stopextendcatcodetable pushcatcodetable popcatcodetable restorecatcodes \
+setcatcodetable letcatcodecommand defcatcodecommand uedcatcodecommand hglue \
+vglue hfillneg vfillneg hfilllneg vfilllneg \
+hsplit ruledhss ruledhfil ruledhfill ruledhfilll \
+ruledhfilneg ruledhfillneg normalhfillneg normalhfilllneg ruledvss \
+ruledvfil ruledvfill ruledvfilll ruledvfilneg ruledvfillneg \
+normalvfillneg normalvfilllneg ruledhbox ruledvbox ruledvtop \
+ruleddbox ruledvcenter ruledmbox ruledhpack ruledvpack \
+ruledtpack ruleddpack ruledvsplit ruledtsplit ruleddsplit \
+ruledhskip ruledvskip ruledkern ruledmskip ruledmkern \
+ruledhglue ruledvglue normalhglue normalvglue ruledpenalty \
+filledhboxb filledhboxr filledhboxg filledhboxc filledhboxm \
+filledhboxy filledhboxk scratchstring scratchstringone scratchstringtwo \
+tempstring scratchcounter globalscratchcounter privatescratchcounter scratchfloat \
+globalscratchfloat privatescratchfloat scratchdimen globalscratchdimen privatescratchdimen \
+scratchskip globalscratchskip privatescratchskip scratchmuskip globalscratchmuskip \
+privatescratchmuskip scratchtoks globalscratchtoks privatescratchtoks scratchbox \
+globalscratchbox privatescratchbox scratchmacro scratchmacroone scratchmacrotwo \
+scratchconditiontrue scratchconditionfalse ifscratchcondition scratchconditiononetrue scratchconditiononefalse \
+ifscratchconditionone scratchconditiontwotrue scratchconditiontwofalse ifscratchconditiontwo globalscratchcounterone \
+globalscratchcountertwo globalscratchcounterthree groupedcommand groupedcommandcs triggergroupedcommand \
+triggergroupedcommandcs simplegroupedcommand simplegroupedcommandcs pickupgroupedcommand pickupgroupedcommandcs \
+mathgroupedcommandcs usedbaselineskip usedlineskip usedlineskiplimit availablehsize \
+localhsize setlocalhsize distributedhsize hsizefraction next \
+nexttoken nextbox dowithnextbox dowithnextboxcs dowithnextboxcontent \
+dowithnextboxcontentcs flushnextbox boxisempty boxtostring contentostring \
+prerolltostring givenwidth givenheight givendepth scangivendimensions \
+scratchwidth scratchheight scratchdepth scratchoffset scratchdistance \
+scratchtotal scratchitalic scratchhsize scratchvsize scratchxoffset \
+scratchyoffset scratchhoffset scratchvoffset scratchxposition scratchyposition \
+scratchtopoffset scratchbottomoffset scratchleftoffset scratchrightoffset scratchcounterone \
+scratchcountertwo scratchcounterthree scratchcounterfour scratchcounterfive scratchcountersix \
+scratchfloatone scratchfloattwo scratchfloatthree scratchfloatfour scratchfloatfive \
+scratchfloatsix scratchdimenone scratchdimentwo scratchdimenthree scratchdimenfour \
+scratchdimenfive scratchdimensix scratchskipone scratchskiptwo scratchskipthree \
+scratchskipfour scratchskipfive scratchskipsix scratchmuskipone scratchmuskiptwo \
+scratchmuskipthree scratchmuskipfour scratchmuskipfive scratchmuskipsix scratchtoksone \
+scratchtokstwo scratchtoksthree scratchtoksfour scratchtoksfive scratchtokssix \
+scratchboxone scratchboxtwo scratchboxthree scratchboxfour scratchboxfive \
+scratchboxsix scratchnx scratchny scratchmx scratchmy \
+scratchunicode scratchmin scratchmax pfsin pfcos \
+pftan pfasin pfacos pfatan pfsinh \
+pfcosh pftanh pfasinh pfacosh pfatanh \
+pfsqrt pflog pfexp pfceil pffloor \
+pfround pfabs pfrad pfdeg pfatantwo \
+pfpow pfmod pfrem scratchleftskip scratchrightskip \
+scratchtopskip scratchbottomskip doif doifnot doifelse \
+firstinset doifinset doifnotinset doifelseinset doifinsetelse \
+doifelsenextchar doifnextcharelse doifelsenextcharcs doifnextcharcselse doifelsenextoptional \
+doifnextoptionalelse doifelsenextoptionalcs doifnextoptionalcselse doifelsefastoptionalcheck doiffastoptionalcheckelse \
+doifelsefastoptionalcheckcs doiffastoptionalcheckcselse doifelsenextbgroup doifnextbgroupelse doifelsenextbgroupcs \
+doifnextbgroupcselse doifelsenextparenthesis doifnextparenthesiselse doifelseundefined doifundefinedelse \
+doifelsedefined doifdefinedelse doifundefined doifdefined doifelsevalue \
+doifvalue doifnotvalue doifnothing doifsomething doifelsenothing \
+doifnothingelse doifelsesomething doifsomethingelse doifvaluenothing doifvaluesomething \
+doifelsevaluenothing doifvaluenothingelse doifelsedimension doifdimensionelse doifelsenumber \
+doifnumberelse doifnumber doifnotnumber doifelsecommon doifcommonelse \
+doifcommon doifnotcommon doifinstring doifnotinstring doifelseinstring \
+doifinstringelse doifelseassignment doifassignmentelse docheckassignment doifelseassignmentcs \
+doifassignmentelsecs validassignment novalidassignment doiftext doifelsetext \
+doiftextelse doifnottext quitcondition truecondition falsecondition \
+tracingall tracingnone loggingall tracingcatcodes showluatokens \
+aliasmacro removetoks appendtoks prependtoks appendtotoks \
+prependtotoks to endgraf endpar reseteverypar \
+finishpar empty null space quad \
+enspace emspace charspace nbsp crlf \
+obeyspaces obeylines obeytabs obeypages obeyedspace \
+obeyedline obeyedtab obeyedpage normalspace naturalspace \
+controlspace normalspaces ignoretabs ignorelines ignorepages \
+ignoreeofs setcontrolspaces executeifdefined singleexpandafter doubleexpandafter \
+tripleexpandafter dontleavehmode removelastspace removeunwantedspaces keepunwantedspaces \
+removepunctuation ignoreparskip forcestrutdepth onlynonbreakablespace wait \
+writestatus define defineexpandable redefine setmeasure \
+setemeasure setgmeasure setxmeasure definemeasure freezemeasure \
+measure measured directmeasure setquantity setequantity \
+setgquantity setxquantity definequantity freezequantity quantity \
+quantitied directquantity installcorenamespace getvalue getuvalue \
+setvalue setevalue setgvalue setxvalue letvalue \
+letgvalue resetvalue undefinevalue ignorevalue setuvalue \
+setuevalue setugvalue setuxvalue globallet udef \
+ugdef uedef uxdef checked unique \
+getparameters geteparameters getgparameters getxparameters forgetparameters \
+copyparameters getdummyparameters dummyparameter directdummyparameter setdummyparameter \
+letdummyparameter setexpandeddummyparameter resetdummyparameter usedummystyleandcolor usedummystyleparameter \
+usedummycolorparameter processcommalist processcommacommand quitcommalist quitprevcommalist \
+processaction processallactions processfirstactioninset processallactionsinset unexpanded \
+expanded startexpanded stopexpanded protect unprotect \
+firstofoneargument firstoftwoarguments secondoftwoarguments firstofthreearguments secondofthreearguments \
+thirdofthreearguments firstoffourarguments secondoffourarguments thirdoffourarguments fourthoffourarguments \
+firstoffivearguments secondoffivearguments thirdoffivearguments fourthoffivearguments fifthoffivearguments \
+firstofsixarguments secondofsixarguments thirdofsixarguments fourthofsixarguments fifthofsixarguments \
+sixthofsixarguments firstofoneunexpanded firstoftwounexpanded secondoftwounexpanded firstofthreeunexpanded \
+secondofthreeunexpanded thirdofthreeunexpanded gobbleoneargument gobbletwoarguments gobblethreearguments \
+gobblefourarguments gobblefivearguments gobblesixarguments gobblesevenarguments gobbleeightarguments \
+gobbleninearguments gobbletenarguments gobbleoneoptional gobbletwooptionals gobblethreeoptionals \
+gobblefouroptionals gobblefiveoptionals dorecurse doloop exitloop \
+dostepwiserecurse recurselevel recursedepth dofastloopcs fastloopindex \
+fastloopfinal dowith doloopovermatch doloopovermatched doloopoverlist \
+newconstant setnewconstant setconstant setconstantvalue newconditional \
+settrue setfalse settruevalue setfalsevalue setconditional \
+newmacro setnewmacro newfraction newsignal newboundary \
+dosingleempty dodoubleempty dotripleempty doquadrupleempty doquintupleempty \
+dosixtupleempty doseventupleempty dosingleargument dodoubleargument dotripleargument \
+doquadrupleargument doquintupleargument dosixtupleargument doseventupleargument dosinglegroupempty \
+dodoublegroupempty dotriplegroupempty doquadruplegroupempty doquintuplegroupempty permitspacesbetweengroups \
+dontpermitspacesbetweengroups nopdfcompression maximumpdfcompression normalpdfcompression onlypdfobjectcompression \
+nopdfobjectcompression modulonumber dividenumber getfirstcharacter doifelsefirstchar \
+doiffirstcharelse mathclassvalue startnointerference stopnointerference twodigits \
+threedigits leftorright offinterlineskip oninterlineskip nointerlineskip \
+strut halfstrut quarterstrut depthstrut halflinestrut \
+noheightstrut setstrut strutbox strutht strutdp \
+strutwd struthtdp strutgap begstrut endstrut \
+lineheight leftboundary rightboundary signalcharacter aligncontentleft \
+aligncontentmiddle aligncontentright shiftbox vpackbox hpackbox \
+vpackedbox hpackedbox normalreqno startimath stopimath \
+normalstartimath normalstopimath startdmath stopdmath normalstartdmath \
+normalstopdmath normalsuperscript normalsubscript normalnosuperscript normalnosubscript \
+normalprimescript superscript subscript nosuperscript nosubscript \
+primescript superprescript subprescript nosuperprescript nosubsprecript \
+uncramped cramped mathstyletrigger triggermathstyle triggeredmathstyle \
+mathstylefont mathsmallstylefont mathstyleface mathsmallstyleface mathstylecommand \
+mathpalette mathstylehbox mathstylevbox mathstylevcenter mathstylevcenteredhbox \
+mathstylevcenteredvbox mathtext setmathsmalltextbox setmathtextbox pushmathstyle \
+popmathstyle triggerdisplaystyle triggertextstyle triggerscriptstyle triggerscriptscriptstyle \
+triggeruncrampedstyle triggercrampedstyle triggersmallstyle triggeruncrampedsmallstyle triggercrampedsmallstyle \
+triggerbigstyle triggeruncrampedbigstyle triggercrampedbigstyle luaexpr expelsedoif \
+expdoif expdoifnot expdoifelsecommon expdoifcommonelse expdoifelseinset \
+expdoifinsetelse ctxdirectlua ctxlatelua ctxsprint ctxwrite \
+ctxcommand ctxdirectcommand ctxlatecommand ctxreport ctxlua \
+luacode lateluacode directluacode registerctxluafile ctxloadluafile \
+luaversion luamajorversion luaminorversion ctxluacode luaconditional \
+luaexpanded ctxluamatch startluaparameterset stopluaparameterset luaparameterset \
+definenamedlua obeylualines obeyluatokens startluacode stopluacode \
+startlua stoplua startctxfunction stopctxfunction ctxfunction \
+startctxfunctiondefinition stopctxfunctiondefinition installctxfunction installprotectedctxfunction installprotectedctxscanner \
+installctxscanner resetctxscanner cldprocessfile cldloadfile cldloadviafile \
+cldcontext cldcommand carryoverpar freezeparagraphproperties defrostparagraphproperties \
+setparagraphfreezing forgetparagraphfreezing updateparagraphproperties updateparagraphpenalties updateparagraphdemerits \
+updateparagraphshapes updateparagraphlines lastlinewidth assumelongusagecs righttolefthbox \
+lefttorighthbox righttoleftvbox lefttorightvbox righttoleftvtop lefttorightvtop \
+rtlhbox ltrhbox rtlvbox ltrvbox rtlvtop \
+ltrvtop autodirhbox autodirvbox autodirvtop leftorrighthbox \
+leftorrightvbox leftorrightvtop lefttoright righttoleft checkedlefttoright \
+checkedrighttoleft synchronizelayoutdirection synchronizedisplaydirection synchronizeinlinedirection dirlre \
+dirrle dirlro dirrlo rtltext ltrtext \
+lesshyphens morehyphens nohyphens dohyphens dohyphencollapsing \
+nohyphencollapsing compounddiscretionary Ucheckedstartdisplaymath Ucheckedstopdisplaymath break \
+nobreak allowbreak goodbreak nospace nospacing \
+dospacing naturalhbox naturalvbox naturalvtop naturalhpack \
+naturalvpack naturaltpack reversehbox reversevbox reversevtop \
+reversehpack reversevpack reversetpack hcontainer vcontainer \
+tcontainer frule compoundhyphenpenalty start stop \
+unsupportedcs openout closeout write openin \
+closein read readline readfromterminal boxlines \
+boxline setboxline copyboxline boxlinewd boxlineht \
+boxlinedp boxlinenw boxlinenh boxlinend boxlinels \
+boxliners boxlinelh boxlinerh boxlinelp boxlinerp \
+boxlinein boxrangewd boxrangeht boxrangedp bitwiseset \
+bitwiseand bitwiseor bitwisexor bitwisenot bitwisenil \
+ifbitwiseand bitwise bitwiseshift bitwiseflip textdir \
+linedir pardir boxdir prelistbox postlistbox \
+prelistcopy postlistcopy setprelistbox setpostlistbox noligaturing \
+nokerning noexpansion noprotrusion noleftkerning noleftligaturing \
+norightkerning norightligaturing noitaliccorrection futureletnexttoken defbackslashbreak \
+letbackslashbreak pushoverloadmode popoverloadmode pushrunstate poprunstate \
+suggestedalias showboxhere discoptioncodestring flagcodestring frozenparcodestring \
+glyphoptioncodestring groupcodestring hyphenationcodestring mathcontrolcodestring mathflattencodestring \
+normalizecodestring parcontextcodestring newlocalcount newlocaldimen newlocalskip \
+newlocalmuskip newlocaltoks newlocalbox newlocalwrite newlocalread \
+setnewlocalcount setnewlocaldimen setnewlocalskip setnewlocalmuskip setnewlocaltoks \
+setnewlocalbox ifexpression
diff --git a/context/data/scite/context/scite-context-data-tex.properties b/context/data/scite/context/scite-context-data-tex.properties
index c1d632957..a6cec5877 100644
--- a/context/data/scite/context/scite-context-data-tex.properties
+++ b/context/data/scite/context/scite-context-data-tex.properties
@@ -53,95 +53,98 @@ Uskewed Uskewedwithdelims Ustack Ustartdisplaymath Ustartmath \
Ustartmathmode Ustopdisplaymath Ustopmath Ustopmathmode Ustretched \
Ustretchedwithdelims Ustyle Usubprescript Usubscript Usuperprescript \
Usuperscript Uunderdelimiter Uvextensible adjustspacing adjustspacingshrink \
-adjustspacingstep adjustspacingstretch afterassigned aftergrouped aliased \
-aligncontent alignmark alignmentcellsource alignmentwrapsource aligntab \
-allcrampedstyles alldisplaystyles allmainstyles allmathstyles allscriptscriptstyles \
-allscriptstyles allsplitstyles alltextstyles alluncrampedstyles allunsplitstyles \
-amcode atendofgroup atendofgrouped attribute attributedef \
-automaticdiscretionary automatichyphenpenalty automigrationmode autoparagraphmode begincsname \
-beginlocalcontrol beginmathgroup beginsimplegroup boundary boxadapt \
-boxanchor boxanchors boxattribute boxdirection boxfreeze \
-boxgeometry boxorientation boxrepack boxshift boxsource \
-boxtarget boxtotal boxvadjust boxxmove boxxoffset \
-boxymove boxyoffset catcodetable cdef cdefcsname \
-cfcode clearmarks constant copymathatomrule copymathparent \
-copymathspacing crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle \
-csactive csstring currentloopiterator currentloopnesting currentmarks \
-dbox defcsname deferred detokenized dimensiondef \
-dimexpression directlua dpack dsplit edefcsname \
-efcode endlocalcontrol endmathgroup endsimplegroup enforced \
-etoks etoksapp etokspre eufactor everybeforepar \
-everymathatom everytab exceptionpenalty expand expandactive \
-expandafterpars expandafterspaces expandcstoken expanded expandedafter \
-expandedloop expandtoken explicitdiscretionary explicithyphenpenalty firstvalidlanguage \
-float floatdef floatexpr flushmarks fontcharba \
-fontcharta fontid fontmathcontrol fontspecdef fontspecid \
-fontspecifiedname fontspecifiedsize fontspecscale fontspecxscale fontspecyscale \
-fonttextcontrol formatname frozen futurecsname futuredef \
-futureexpand futureexpandis futureexpandisap gdefcsname gleaders \
-glet gletcsname glettonothing gluespecdef glyph \
-glyphdatafield glyphoptions glyphscale glyphscriptfield glyphscriptscale \
-glyphscriptscriptscale glyphstatefield glyphtextscale glyphxoffset glyphxscale \
-glyphxscaled glyphyoffset glyphyscale glyphyscaled gtoksapp \
-gtokspre hccode hjcode hmcode holdingmigrations \
-hpack hyphenationmin hyphenationmode ifabsdim ifabsfloat \
-ifabsnum ifarguments ifboolean ifchkdim ifchkdimension \
-ifchknum ifchknumber ifcmpdim ifcmpnum ifcondition \
-ifcstok ifdimexpression ifdimval ifempty ifflags \
-iffloat ifhaschar ifhastok ifhastoks ifhasxtoks \
-ifincsname ifinsert ifmathparameter ifmathstyle ifnumexpression \
-ifnumval ifparameter ifparameters ifrelax iftok \
-ifzerodim ifzerofloat ifzeronum ignorearguments ignoredepthcriterium \
-ignorepars immediate immutable indexofcharacter indexofregister \
-inherited initcatcodetable insertbox insertcopy insertdepth \
-insertdistance insertheight insertheights insertlimit insertmaxdepth \
-insertmode insertmultiplier insertpenalty insertprogress insertstorage \
-insertstoring insertunbox insertuncopy insertwidth instance \
-integerdef lastarguments lastatomclass lastboundary lastchkdim \
-lastchknum lastleftclass lastloopiterator lastnamedcs lastnodesubtype \
-lastpageextra lastparcontext lastrightclass leftmarginkern letcharcode \
-letcsname letfrozen letmathatomrule letmathparent letmathspacing \
-letprotected lettonothing linebreakcriterium linedirection localbrokenpenalty \
-localcontrol localcontrolled localcontrolledloop localinterlinepenalty localleftbox \
-localleftboxbox localmiddlebox localmiddleboxbox localrightbox localrightboxbox \
-lpcode luabytecode luabytecodecall luacopyinputnodes luadef \
-luaescapestring luafunction luafunctioncall luatexbanner luatexrevision \
-luatexversion mathaccent mathatom mathatomglue mathatomskip \
-mathbackwardpenalties mathbeginclass mathbinary mathcheckfencesmode mathclose \
-mathdictgroup mathdictproperties mathdirection mathdisplaymode mathdisplayskipmode \
-mathdoublescriptmode mathendclass matheqnogapstep mathfenced mathfontcontrol \
-mathforwardpenalties mathfraction mathghost mathgluemode mathgroupingmode \
-mathinner mathleftclass mathlimitsmode mathmainstyle mathmiddle \
-mathnolimitsmode mathopen mathoperator mathordinary mathoverline \
-mathpenaltiesmode mathpunctuation mathradical mathrelation mathrightclass \
-mathrulesfam mathrulesmode mathscale mathscriptsmode mathslackmode \
-mathspacingmode mathstackstyle mathstyle mathstylefontid mathsurroundmode \
-mathsurroundskip maththreshold mathunderline meaningasis meaningful \
-meaningfull meaningles meaningless mugluespecdef mutable \
-noaligned noatomruling noboundary nohrule norelax \
-normalizelinemode normalizeparmode nospaces novrule numericscale \
-numexpression orelse orphanpenalties orphanpenalty orunless \
-outputbox overloaded overloadmode overshoot pageboundary \
-pageextragoal pagevsize parametercount parametermark parattribute \
-pardirection permanent pettymuskip positdef postexhyphenchar \
-posthyphenchar postinlinepenalty prebinoppenalty predisplaygapfactor preexhyphenchar \
-prehyphenchar preinlinepenalty prerelpenalty protrudechars protrusionboundary \
-pxdimen quitloop quitvmode resetmathspacing retokenized \
-rightmarginkern rpcode savecatcodetable scaledemwidth scaledexheight \
-scaledextraspace scaledfontdimen scaledinterwordshrink scaledinterwordspace scaledinterwordstretch \
-scaledmathstyle scaledslantperpoint scantextokens semiexpand semiexpanded \
-semiprotected setdefaultmathcodes setfontid setmathatomrule setmathdisplaypostpenalty \
-setmathdisplayprepenalty setmathignore setmathoptions setmathpostpenalty setmathprepenalty \
-setmathspacing shapingpenaltiesmode shapingpenalty snapshotpar srule \
-supmarkmode swapcsvalues tabsize textdirection thewithoutunit \
-tinymuskip todimension tohexadecimal tointeger tokenized \
-toksapp tokspre tolerant tomathstyle toscaled \
-tosparsedimension tosparsescaled tpack tracingadjusts tracingalignments \
-tracingexpressions tracingfonts tracingfullboxes tracinghyphenation tracinginserts \
-tracinglevels tracinglists tracingmarks tracingmath tracingnodes \
-tracingpenalties tsplit uleaders undent unexpandedloop \
-unhpack unletfrozen unletprotected untraced unvpack \
-variablefam virtualhrule virtualvrule vpack wordboundary \
+adjustspacingstep adjustspacingstretch advanceby afterassigned aftergrouped \
+aliased aligncontent alignmark alignmentcellsource alignmentwrapsource \
+aligntab allcrampedstyles alldisplaystyles allmainstyles allmathstyles \
+allscriptscriptstyles allscriptstyles allsplitstyles alltextstyles alluncrampedstyles \
+allunsplitstyles amcode atendofgroup atendofgrouped attribute \
+attributedef automaticdiscretionary automatichyphenpenalty automigrationmode autoparagraphmode \
+begincsname beginlocalcontrol beginmathgroup beginsimplegroup boundary \
+boxadapt boxanchor boxanchors boxattribute boxdirection \
+boxfreeze boxgeometry boxorientation boxrepack boxshift \
+boxsource boxtarget boxtotal boxvadjust boxxmove \
+boxxoffset boxymove boxyoffset catcodetable cdef \
+cdefcsname cfcode clearmarks constant copymathatomrule \
+copymathparent copymathspacing crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle \
+crampedtextstyle csactive csstring currentloopiterator currentloopnesting \
+currentmarks dbox defcsname deferred detokened \
+detokenized dimensiondef dimexpression directlua divideby \
+dpack dsplit edefcsname efcode endlocalcontrol \
+endmathgroup endsimplegroup enforced etoks etoksapp \
+etokspre eufactor everybeforepar everymathatom everytab \
+exceptionpenalty expand expandactive expandafterpars expandafterspaces \
+expandcstoken expanded expandedafter expandedloop expandtoken \
+explicitdiscretionary explicithyphenpenalty firstvalidlanguage float floatdef \
+floatexpr flushmarks fontcharba fontcharta fontid \
+fontmathcontrol fontspecdef fontspecid fontspecifiedname fontspecifiedsize \
+fontspecscale fontspecxscale fontspecyscale fonttextcontrol formatname \
+frozen futurecsname futuredef futureexpand futureexpandis \
+futureexpandisap gdefcsname gleaders glet gletcsname \
+glettonothing gluespecdef glyph glyphdatafield glyphoptions \
+glyphscale glyphscriptfield glyphscriptscale glyphscriptscriptscale glyphstatefield \
+glyphtextscale glyphxoffset glyphxscale glyphxscaled glyphyoffset \
+glyphyscale glyphyscaled gtoksapp gtokspre hccode \
+hjcode hmcode holdingmigrations hpack hpenalty \
+hyphenationmin hyphenationmode ifabsdim ifabsfloat ifabsnum \
+ifarguments ifboolean ifchkdim ifchkdimension ifchknum \
+ifchknumber ifcmpdim ifcmpnum ifcondition ifcstok \
+ifdimexpression ifdimval ifempty ifflags iffloat \
+ifhaschar ifhastok ifhastoks ifhasxtoks ifincsname \
+ifinsert ifintervaldim ifintervalfloat ifintervalnum ifmathparameter \
+ifmathstyle ifnumexpression ifnumval ifparameter ifparameters \
+ifrelax iftok ifzerodim ifzerofloat ifzeronum \
+ignorearguments ignoredepthcriterium ignorepars immediate immutable \
+indexofcharacter indexofregister inherited initcatcodetable insertbox \
+insertcopy insertdepth insertdistance insertheight insertheights \
+insertlimit insertmaxdepth insertmode insertmultiplier insertpenalty \
+insertprogress insertstorage insertstoring insertunbox insertuncopy \
+insertwidth instance integerdef lastarguments lastatomclass \
+lastboundary lastchkdim lastchknum lastleftclass lastloopiterator \
+lastnamedcs lastnodesubtype lastpageextra lastparcontext lastrightclass \
+leftmarginkern letcharcode letcsname letfrozen letmathatomrule \
+letmathparent letmathspacing letprotected lettonothing linebreakcriterium \
+linedirection localbrokenpenalty localcontrol localcontrolled localcontrolledloop \
+localinterlinepenalty localleftbox localleftboxbox localmiddlebox localmiddleboxbox \
+localrightbox localrightboxbox lpcode luabytecode luabytecodecall \
+luacopyinputnodes luadef luaescapestring luafunction luafunctioncall \
+luatexbanner luatexrevision luatexversion mathaccent mathatom \
+mathatomglue mathatomskip mathbackwardpenalties mathbeginclass mathbinary \
+mathcheckfencesmode mathclose mathdictgroup mathdictproperties mathdirection \
+mathdisplaymode mathdisplayskipmode mathdoublescriptmode mathendclass matheqnogapstep \
+mathfenced mathfontcontrol mathforwardpenalties mathfraction mathghost \
+mathgluemode mathgroupingmode mathinner mathleftclass mathlimitsmode \
+mathmainstyle mathmiddle mathnolimitsmode mathopen mathoperator \
+mathordinary mathoverline mathpenaltiesmode mathpunctuation mathradical \
+mathrelation mathrightclass mathrulesfam mathrulesmode mathscale \
+mathscriptsmode mathslackmode mathspacingmode mathstackstyle mathstyle \
+mathstylefontid mathsurroundmode mathsurroundskip maththreshold mathunderline \
+meaningasis meaningful meaningfull meaningles meaningless \
+mugluespecdef multiplyby mutable noaligned noatomruling \
+noboundary nohrule norelax normalizelinemode normalizeparmode \
+nospaces novrule numericscale numexpression orelse \
+orphanpenalties orphanpenalty orunless outputbox overloaded \
+overloadmode overshoot pageboundary pageextragoal pagevsize \
+parametercount parametermark parattribute pardirection parfillleftskip \
+parfillrightskip parinitleftskip parinitrightskip permanent pettymuskip \
+positdef postexhyphenchar posthyphenchar postinlinepenalty postshortinlinepenalty \
+prebinoppenalty predisplaygapfactor preexhyphenchar prehyphenchar preinlinepenalty \
+prerelpenalty preshortinlinepenalty protrudechars protrusionboundary pxdimen \
+quitloop quitvmode resetmathspacing retokenized rightmarginkern \
+rpcode savecatcodetable scaledemwidth scaledexheight scaledextraspace \
+scaledfontdimen scaledinterwordshrink scaledinterwordspace scaledinterwordstretch scaledmathstyle \
+scaledslantperpoint scantextokens semiexpand semiexpanded semiprotected \
+setdefaultmathcodes setfontid setmathatomrule setmathdisplaypostpenalty setmathdisplayprepenalty \
+setmathignore setmathoptions setmathpostpenalty setmathprepenalty setmathspacing \
+shapingpenaltiesmode shapingpenalty snapshotpar srule supmarkmode \
+swapcsvalues tabsize textdirection thewithoutunit tinymuskip \
+todimension tohexadecimal tointeger tokenized toksapp \
+tokspre tolerant tomathstyle toscaled tosparsedimension \
+tosparsescaled tpack tracingadjusts tracingalignments tracingexpressions \
+tracingfonts tracingfullboxes tracinghyphenation tracinginserts tracinglevels \
+tracinglists tracingmarks tracingmath tracingnodes tracingpenalties \
+tsplit uleaders undent unexpandedloop unhpack \
+unletfrozen unletprotected untraced unvpack variablefam \
+virtualhrule virtualvrule vpack vpenalty wordboundary \
wrapuppar xdefcsname xtoks xtoksapp xtokspre
keywordclass.tex.omega=\
@@ -175,48 +178,47 @@ pdfxformmargin pdfxformname pdfxformresources pdfximage
keywordclass.tex.tex=\
- / above \
abovedisplayshortskip abovedisplayskip abovewithdelims accent adjdemerits \
-advance advanceby afterassignment aftergroup atop \
-atopwithdelims badness baselineskip batchmode begingroup \
-belowdisplayshortskip belowdisplayskip binoppenalty botmark box \
-boxmaxdepth brokenpenalty catcode char chardef \
-cleaders clubpenalty copy count countdef \
-cr crcr csname day deadcycles \
-def defaulthyphenchar defaultskewchar delcode delimiter \
-delimiterfactor delimitershortfall dimen dimendef discretionary \
-displayindent displaylimits displaystyle displaywidowpenalty displaywidth \
-divide divideby doublehyphendemerits dp dump \
-edef else emergencystretch end endcsname \
-endgroup endinput endlinechar eqno errhelp \
-errmessage errorcontextlines errorstopmode escapechar everycr \
-everydisplay everyhbox everyjob everymath everypar \
-everyvbox exhyphenchar exhyphenpenalty expandafter fam \
-fi finalhyphendemerits firstmark floatingpenalty font \
-fontdimen fontname futurelet gdef global \
-globaldefs halign hangafter hangindent hbadness \
-hbox hfil hfill hfilneg hfuzz \
-holdinginserts hrule hsize hskip hss \
-ht hyphenation hyphenchar hyphenpenalty if \
-ifcase ifcat ifdim iffalse ifhbox \
-ifhmode ifinner ifmmode ifnum ifodd \
-iftrue ifvbox ifvmode ifvoid ifx \
-ignorespaces indent input inputlineno insert \
-insertpenalties interlinepenalty jobname kern language \
-lastbox lastkern lastpenalty lastskip lccode \
-leaders left lefthyphenmin leftskip leqno \
-let limits linepenalty lineskip lineskiplimit \
-long looseness lower lowercase mark \
-mathbin mathchar mathchardef mathchoice mathcode \
-mathop mathord mathpunct mathrel mathsurround \
-maxdeadcycles maxdepth meaning medmuskip message \
-middle mkern month moveleft moveright \
-mskip multiply multiplyby muskip muskipdef \
-newlinechar noalign noexpand noindent nolimits \
-nonscript nonstopmode nulldelimiterspace nullfont number \
-omit or outer output outputpenalty \
-over overfullrule overline overwithdelims pagedepth \
-pagefilllstretch pagefillstretch pagefilstretch pagegoal pageshrink \
-pagestretch pagetotal par parfillleftskip parfillskip \
-parindent parinitleftskip parinitrightskip parshape parskip \
+advance afterassignment aftergroup atop atopwithdelims \
+badness baselineskip batchmode begingroup belowdisplayshortskip \
+belowdisplayskip binoppenalty botmark box boxmaxdepth \
+brokenpenalty catcode char chardef cleaders \
+clubpenalty copy count countdef cr \
+crcr csname day deadcycles def \
+defaulthyphenchar defaultskewchar delcode delimiter delimiterfactor \
+delimitershortfall dimen dimendef discretionary displayindent \
+displaylimits displaystyle displaywidowpenalty displaywidth divide \
+doublehyphendemerits dp dump edef else \
+emergencystretch end endcsname endgroup endinput \
+endlinechar eqno errhelp errmessage errorcontextlines \
+errorstopmode escapechar everycr everydisplay everyhbox \
+everyjob everymath everypar everyvbox exhyphenchar \
+exhyphenpenalty expandafter fam fi finalhyphendemerits \
+firstmark floatingpenalty font fontdimen fontname \
+futurelet gdef global globaldefs halign \
+hangafter hangindent hbadness hbox hfil \
+hfill hfilneg hfuzz hkern holdinginserts \
+hrule hsize hskip hss ht \
+hyphenation hyphenchar hyphenpenalty if ifcase \
+ifcat ifdim iffalse ifhbox ifhmode \
+ifinner ifmmode ifnum ifodd iftrue \
+ifvbox ifvmode ifvoid ifx ignorespaces \
+indent input inputlineno insert insertpenalties \
+interlinepenalty jobname kern language lastbox \
+lastkern lastpenalty lastskip lccode leaders \
+left lefthyphenmin leftskip leqno let \
+limits linepenalty lineskip lineskiplimit long \
+looseness lower lowercase mark mathbin \
+mathchar mathchardef mathchoice mathcode mathop \
+mathord mathpunct mathrel mathsurround maxdeadcycles \
+maxdepth meaning medmuskip message middle \
+mkern month moveleft moveright mskip \
+multiply muskip muskipdef newlinechar noalign \
+noexpand noindent nolimits nonscript nonstopmode \
+nulldelimiterspace nullfont number omit or \
+outer output outputpenalty over overfullrule \
+overline overwithdelims pagedepth pagefilllstretch pagefillstretch \
+pagefilstretch pagegoal pageshrink pagestretch pagetotal \
+par parfillskip parindent parshape parskip \
patterns pausing penalty postdisplaypenalty predisplaypenalty \
predisplaysize pretolerance prevdepth prevgraf radical \
raise relax relpenalty right righthyphenmin \
@@ -234,9 +236,9 @@ tracingstats uccode uchyph unboundary underline \
unhbox unhcopy unkern unpenalty unskip \
unvbox unvcopy uppercase vadjust valign \
vbadness vbox vcenter vfil vfill \
-vfilneg vfuzz vrule vsize vskip \
-vsplit vss vtop wd widowpenalty \
-xdef xleaders xspaceskip year
+vfilneg vfuzz vkern vrule vsize \
+vskip vsplit vss vtop wd \
+widowpenalty xdef xleaders xspaceskip year
keywordclass.tex.xetex=\
XeTeXversion
diff --git a/doc/context/documents/general/manuals/lowlevel-accuracy.pdf b/doc/context/documents/general/manuals/lowlevel-accuracy.pdf
new file mode 100644
index 000000000..cdeb62fd0
--- /dev/null
+++ b/doc/context/documents/general/manuals/lowlevel-accuracy.pdf
Binary files differ
diff --git a/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf b/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf
index 11c70780f..ddd7a3281 100644
--- a/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf
+++ b/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf
index 0da977ac5..376c18b26 100644
--- a/doc/context/documents/general/qrcs/setup-de.pdf
+++ b/doc/context/documents/general/qrcs/setup-de.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf
index ee5d4853c..0a88e801a 100644
--- a/doc/context/documents/general/qrcs/setup-en.pdf
+++ b/doc/context/documents/general/qrcs/setup-en.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf
index 3a591a593..2789cbecb 100644
--- a/doc/context/documents/general/qrcs/setup-fr.pdf
+++ b/doc/context/documents/general/qrcs/setup-fr.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf
index 2c0b57b92..3d249de41 100644
--- a/doc/context/documents/general/qrcs/setup-it.pdf
+++ b/doc/context/documents/general/qrcs/setup-it.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf
index 0cdae12ff..8f41b3565 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf
index 9a9f8ae71..ad70efa10 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
index 272ec4b15..bc5c4b275 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf
index c81c8a05b..9807d106c 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
index d5728f047..5bb2d68af 100644
--- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
+++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf
index af3e99f3f..2962780a1 100644
--- a/doc/context/documents/general/qrcs/setup-nl.pdf
+++ b/doc/context/documents/general/qrcs/setup-nl.pdf
Binary files differ
diff --git a/doc/context/scripts/mkiv/mtx-install-modules.html b/doc/context/scripts/mkiv/mtx-install-modules.html
index b75ed4b42..c8430e57b 100644
--- a/doc/context/scripts/mkiv/mtx-install-modules.html
+++ b/doc/context/scripts/mkiv/mtx-install-modules.html
@@ -40,7 +40,9 @@
<tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr>
<tr><th/><td/><td/></tr>
<tr><th>--list</th><td></td><td>list modules</td></tr>
+ <tr><th>--installed</th><td></td><td>list installed modules</td></tr>
<tr><th>--install</th><td></td><td>install modules</td></tr>
+ <tr><th>--uninstall</th><td></td><td>uninstall modules</td></tr>
<tr><th>--module</th><td></td><td>install (zip) file(s)</td></tr>
</table>
<br/>
@@ -49,7 +51,9 @@
<br/><br/><tt>mtxrun --script install-modules --install filter letter</tt>
<br/><tt>mtxrun --script install-modules --install tikz</tt>
<br/><tt>mtxrun --script install-modules --install --all</tt>
-<br/><br/><tt>mtxrun --script install-modules --install --module t-letter.zip</tt>
+<br/><br/><tt>mtxrun --script install-modules --install --module t-letter.zip</tt>
+<br/><tt>mtxrun --script install-modules --uninstall --module t-letter.zip</tt>
+<br/><br/><tt>mtxrun --script install-modules --installed</tt>
<br/><br/> </div>
</div>
</body>
diff --git a/doc/context/scripts/mkiv/mtx-install-modules.man b/doc/context/scripts/mkiv/mtx-install-modules.man
index cd83aea54..b6bd07f1b 100644
--- a/doc/context/scripts/mkiv/mtx-install-modules.man
+++ b/doc/context/scripts/mkiv/mtx-install-modules.man
@@ -14,9 +14,15 @@
.B --list
list modules
.TP
+.B --installed
+list installed modules
+.TP
.B --install
install modules
.TP
+.B --uninstall
+uninstall modules
+.TP
.B --module
install (zip) file(s)
.SH AUTHOR
diff --git a/doc/context/scripts/mkiv/mtx-install-modules.xml b/doc/context/scripts/mkiv/mtx-install-modules.xml
index 872c1d64e..cee53e912 100644
--- a/doc/context/scripts/mkiv/mtx-install-modules.xml
+++ b/doc/context/scripts/mkiv/mtx-install-modules.xml
@@ -9,7 +9,9 @@
<category name="basic">
<subcategory>
<flag name="list"><short>list modules</short></flag>
+ <flag name="installed"><short>list installed modules</short></flag>
<flag name="install"><short>install modules</short></flag>
+ <flag name="uninstall"><short>uninstall modules</short></flag>
<flag name="module"><short>install (zip) file(s)</short></flag>
</subcategory>
</category>
@@ -26,7 +28,11 @@
<example><command>mtxrun --script install-modules --install --all</command></example>
</subcategory>
<subcategory>
- <example><command>mtxrun --script install-modules --install --module t-letter.zip</command></example>
+ <example><command>mtxrun --script install-modules --install --module t-letter.zip</command></example>
+ <example><command>mtxrun --script install-modules --uninstall --module t-letter.zip</command></example>
+ </subcategory>
+ <subcategory>
+ <example><command>mtxrun --script install-modules --installed</command></example>
</subcategory>
</category>
</examples>
diff --git a/doc/context/sources/general/manuals/lowlevel/lowlevel-accuracy.tex b/doc/context/sources/general/manuals/lowlevel/lowlevel-accuracy.tex
new file mode 100644
index 000000000..0048bb075
--- /dev/null
+++ b/doc/context/sources/general/manuals/lowlevel/lowlevel-accuracy.tex
@@ -0,0 +1,304 @@
+% language=us runpath=texruns:manuals/lowlevel
+
+\environment lowlevel-style
+
+\startdocument
+ [title=accuracy,
+ color=darkgray]
+
+\startsectionlevel[title=Introduction]
+
+When you look at \TEX\ and \METAPOST\ output the accuracy of the rendering stands
+out, unless of course you do a sloppy job on design and interfere badly with the
+system. Much has to do with the fact that calculations are very precise,
+especially given the time when \TEX\ was written. Because \TEX\ doesn't rely on
+(at that time non|-|portable) floating point calculations, it does all with 32
+bit integers, except in the backend where glue calculations are used for
+finalizing the glue values. It all changed a bit when we added \LUA\ because
+there we mix integers and doubles but in practice it works out okay.
+
+When looking at floating point (and posits) one can end up in discussions about
+which one is better, what the flaws fo each are, etc. Here we're only interested
+in the fact that posits are more accurate in the ranges where \TEX\ and
+\METAPOST\ operate, as well as the fact that we only have 32 bits for floats in
+\TEX, unless we patch more heavily. So, it is also very much about storage.
+
+When you work with dimensions like points, they get converted to an integer
+number (the \type {sp} unit) and from that it's just integer calculations. The
+maximum dimension is \the\maxdimen, which already shows a rounding issue. Of
+course when one goes precise for sure there is some loss, but on the average
+we're okay. So, in the next example the two last rows are equivalent:
+
+\starttabulate[|Tr|r|r|]
+\NC .1pt \NC \the\dimexpr.1pt \relax \NC \number\dimexpr.1pt \relax sp \NC \NR
+\NC .2pt \NC \the\dimexpr.2pt \relax \NC \number\dimexpr.2pt \relax sp \NC \NR
+\NC .3pt \NC \the\dimexpr.3pt \relax \NC \number\dimexpr.3pt \relax sp \NC \NR
+\NC .1pt + .2pt \NC \the\dimexpr.1pt+.2pt\relax \NC \number\dimexpr.1pt+.2pt\relax sp \NC \NR
+\stoptabulate
+
+When we're at the \LUA\ end things are different, there numbers are mapped onto
+64 bit floating point variables (doubles) and not all numbers map well. This is
+what we get when we work with doubles in \LUA:
+
+\starttabulate[|Tr|r|]
+\NC .1 \NC \luaexpr{.1 } \NC \NR
+\NC .2 \NC \luaexpr{.2 } \NC \NR
+\NC .3 \NC \luaexpr{.3 } \NC \NR
+\NC .1 + .2 \NC \luaexpr{.1+.2} \NC \NR
+\stoptabulate
+
+The serialization looks as if all is okay but when we test for equality there
+is a problem:
+
+\starttabulate[|Tr|l|]
+\NC .3 == .3 \NC \luaexpr{tostring( .3 == .3)} \NC \NR
+\NC .1 + .2 == .3 \NC \luaexpr{tostring(.1 + .2 == .3)} \NC \NR
+\stoptabulate
+
+This means that a test like this can give false positives or negatives unless one
+tests the difference against the accuracy (in \METAPOST\ we have the {eps}
+variable for that). In \TEX\ clipping of the decimal fraction influences equality.
+
+\starttabulate[|Tr|l|]
+\NC \type{\iflua { .3 == .3 } Y\else N\fi} \NC \iflua{ .3 == .3} equal\else different\fi \NC \NR
+\NC \type{\iflua { .1 + .2 == .3 } Y\else N\fi} \NC \iflua{.1 + .2 == .3} equal\else different\fi \NC \NR
+\stoptabulate
+
+The serialization above misguides us because the number of digits displayed is
+limited. Actually, when we would compare serialized strings the equality holds,
+definitely within the accuracy of \TEX. But here is reality:
+
+\startluacode
+ local a = 0.1
+ local b = 0.2
+ local c = 0.3
+ local d = a + b
+ local NC, NR = context.NC, context.NR
+ local function show(f)
+ context.NC() context(context.escaped(f))
+ context.NC() context(f,c)
+ context.NC() context(f,d)
+ context.NC() context.NR()
+ end
+ context.starttabulate { "|T|l|l|" }
+ context.NC()
+ context.NC() context(".3")
+ context.NC() context(".1 + .2")
+ context.NC() context.NR()
+ -- show("%0.05g",c)
+ show("%0.10g",c)
+ show("%0.17g",c)
+ show("%0.20g",c)
+ show("%0.25g",c)
+ context.stoptabulate()
+\stopluacode
+
+The above examples use $0.1$, $0.2$ and $0.3$ and on a 32 bit float that actually
+works out okay, but \LUAMETATEX\ is 64 bit. Is this really important in practice?
+There are indeed cases where we are bitten by this. At the \LUA\ end we seldom
+test for equality on calculated values but it might impact check for less or
+greater then. At the \TEX\ end there are a few cases where we have issues but
+these also relate to the limited precision. It is not uncommon to loose a few
+scaled points so that has to be taken into account then. So how can we deal with
+this? In the next section(s) an alternative approach is discussed. It is not so
+much the solution for all problems but who knows.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Posits]
+
+% TODO: don't check for sign (1+2)
+
+The next table shows the same as what we started with but with a different
+serialization.
+
+\starttabulate[|Tr|r|]
+\NC .1 \NC \positunum{.1 } \NC \NR
+\NC .2 \NC \positunum{.2 } \NC \NR
+\NC .3 \NC \positunum{.3 } \NC \NR
+\NC .1 + .2 \NC \positunum{.1 + .2} \NC \NR
+\stoptabulate
+
+And here we get equality in both cases:
+
+\starttabulate[|Tr|l|]
+\NC .3 == .3 \NC \positunum{ .3 == .3} \NC \NR
+\NC .1 + .2 == .3 \NC \positunum{.1 + .2 == .3} \NC \NR
+\stoptabulate
+
+The next table shows what we actually are dealing with. The \type {\if}|-|test is
+not a primitive but provided by \CONTEXT.
+
+\starttabulate[|Tr|l|]
+\NC \type{\ifpositunum { .3 == .3 } Y\else N\fi} \NC \ifpositunum{ .3 == .3} equal\else different\fi \NC \NR
+\NC \type{\ifpositunum { .1 + .2 == .3 } Y\else N\fi} \NC \ifpositunum{.1 + .2 == .3} equal\else different\fi \NC \NR
+\stoptabulate
+
+And what happens when we do more complex calculations:
+
+\starttabulate[|Tr|l|]
+\NC \type {math .sin(0.1 + 0.2) == math .sin(0.3)} \NC \luaexpr{tostring(math.sin(0.1 + 0.2) == math.sin(0.3))} \NC \NR
+\NC \type {posit.sin(0.1 + 0.2) == posit.sin(0.3)} \NC \positunum{sin(0.1 + 0.2) == sin(0.3)} \NC \NR
+\stoptabulate
+
+Of course other numbers might work out differently! I just took the simple tests
+that came to mind.
+
+So what are these posits? Here it's enough to know that they are a different way
+to store numbers with fractions. They still can loose precision but a bit less on
+smaller values and often we have relative small values in \TEX. Here are some links:
+
+\starttyping
+https://www.johngustafson.net/pdfs/BeatingFloatingPoint.pdf
+https://posithub.org/conga/2019/docs/14/1130-FlorentDeDinechin.pdf
+\stoptyping
+
+There are better explanations out there than I can provide (if at all). When I
+first read about these unums (a review of the 2015 book \quotation {The End of
+Error Unum Computing}) I was intrigued and when in 2023 I read something about it
+in relation to RISCV I decided to just add this playground for the users. After
+all we also have decimal support. And interval based solutions might actually be
+good for \METAPOST, so that is why we have it as extra number model. There we
+need to keep in mind that \METAPOST\ in non scaled models also apply some of the
+range checking and clipping that happens in scaled (these magick 4096 tricks).
+
+For now it is enough to know that it's an alternative for floats that {\em could}
+work better in some cases but not all. The presentation mentioned above gives
+some examples of physics constants where 32 posits are not good enough for
+encoding the extremely large or small constants, but for $\pi$ it's all fine.
+\footnote {Are 64 bit posits actually being worked on in softposit? There are
+some commented sections. We also need to patch some unions to make it compile as
+C.} In double mode we actually have quite good precision compared to 32 bit
+posits but with 32 bit floats we gain some. Very small numbers and very large
+numbers are less precise, but around 1 we gain: the next value after 1 is
+1.0000001 for a float and 1.000000008 for a posit (both 32 bit). So, currently
+for \METAPOST\ there is no real gain but if we'd add posits to \TEX\ we could
+gain some because there a halfword (used for storing data) is 32 bit.
+
+But how about \TEX ? Per April 2023 the \LUAMETATEX\ engine has native support
+for floats (this in addition to \LUA\ based floats that we already had in
+\CONTEXT). How that works can be demonstrated with some examples. The float
+related commands are similar to those for numbers and dimensions: \typ
+{\floatdef}, \typ {\float}, \typ {\floatexpr}, \typ {\iffloat}, \typ
+{\ifzerofloat} and \typ {\ifintervalfloat}. That means that we also have them as
+registers. The \typ {\positdef} primitive is similar to \typ {\dimensiondef}.
+When a float (posit) is seen in a dimension context it will be interpreted as
+points, and in an integer context it will be a rounded number. As with other
+registers we have a \typ {\newfloat} macro. The \typ {\advance}, \typ
+{\multiply} and \typ {\divide} primitives accept floats.
+
+\startbuffer[reset]
+\scratchdimen=1.23456pt
+\scratchfloat=1.23456
+\stopbuffer
+
+\typebuffer[reset] \getbuffer[reset]
+
+We now use these two variables in an example:
+
+\startbuffer[dimensions]
+\setbox0\hbox to \scratchdimen {x}\the\wd0
+\scratchdimen \dimexpr \scratchdimen * 2\relax
+\setbox0\hbox to \scratchdimen {x}\the\wd0
+\advance \scratchdimen \scratchdimen
+\setbox0\hbox to \scratchdimen {x}\the\wd0
+\multiply\scratchdimen by 2
+\setbox0\hbox to \scratchdimen {x}\the\wd0
+\stopbuffer
+
+\typebuffer[dimensions] \startlines\darkblue\tttf\getbuffer[reset,dimensions]\stoplines
+
+When we use floats we get this:
+
+\startbuffer[floats]
+\setbox0\hbox to \scratchfloat {x}\the\wd0
+\scratchfloat \floatexpr \scratchfloat * 2\relax
+\setbox0\hbox to \scratchfloat {x}\the\wd0
+\advance \scratchfloat \scratchfloat
+\setbox0\hbox to \scratchfloat {x}\the\wd0
+\multiply\scratchfloat by 2
+\setbox0\hbox to \scratchfloat {x}\the\wd0
+\stopbuffer
+
+\typebuffer[floats] \startlines\darkblue\tttf\getbuffer[reset,floats]\stoplines
+
+So which approach is more accurate? At first sight you might think that the
+dimensions are better because in the last two lines they indeed duplicate.
+However, the next example shows that with dimensions we lost some between steps.
+
+\startbuffer[noboxes]
+ \the\scratchfloat
+\scratchfloat \floatexpr \scratchfloat * 2\relax \the\scratchfloat
+\advance \scratchfloat \scratchfloat \the\scratchfloat
+\multiply\scratchfloat by 2 \the\scratchfloat
+\stopbuffer
+
+\typebuffer[noboxes] \startlines\darkblue\tttf\getbuffer[reset,noboxes]\stoplines
+
+One problem with accuracy is that it can build up. So when one eventually does
+some comparison the expectations can be wrong.
+
+\startbuffer
+\dimen0=1.2345pt
+\dimen2=1.2345pt
+
+\ifdim \dimen0=\dimen2 S\else D\fi \space +0sp: [dim]
+\ifintervaldim0sp\dimen0 \dimen2 O\else D\fi \space +0sp: [0sp]
+
+\advance\dimen2 1sp
+
+\ifdim \dimen0=\dimen2 S\else D\fi \space +1sp: [dim]
+\ifintervaldim 1sp \dimen0 \dimen2 O\else D\fi \space +1sp: [1sp]
+\ifintervaldim 1sp \dimen2 \dimen0 O\else D\fi \space +1sp: [1sp]
+\ifintervaldim 2sp \dimen0 \dimen2 O\else D\fi \space +1sp: [2sp]
+\ifintervaldim 2sp \dimen2 \dimen0 O\else D\fi \space +1sp: [2sp]
+
+\advance\dimen2 1sp
+
+\ifintervaldim 1sp \dimen0\dimen2 O\else D\fi \space +2sp: [1sp]
+\ifintervaldim 1sp \dimen2\dimen0 O\else D\fi \space +2sp: [1sp]
+\ifintervaldim 5sp \dimen0\dimen2 O\else D\fi \space +2sp: [5sp]
+\ifintervaldim 5sp \dimen2\dimen0 O\else D\fi \space +2sp: [5sp]
+\stopbuffer
+
+\typebuffer
+
+Here we show a test for overlap in values, the same can be done with integer
+numbers (counts) and floats. This interval checking is an experiment and we'll
+see it if gets used.
+
+\startpacked\darkblue \tttf \getbuffer \stoppacked
+
+There are also \typ {\ifintervalfloat} and \typ{\ifintervalnum}. Because I have
+worked around these few scaled point rounding issues for decades, it might
+actually take some time before we see the interval tests being used in \CONTEXT.
+After all, there is no reason to touch somewhat tricky mechanism without reason
+(read: users complaining).
+
+To come back to posits, just to be clear, we use 32 bit posits and not 32 bit
+floats, which we could have but that way we gain some accuracy because less bits
+are used by default for the exponential.
+
+In \CONTEXT\ we also provide a bunch of pseudo primitives. These take one float:
+\type {\pfsin}, \type {\pfcos}, \type {\pftan}, \type {\pfasin}, \type {\pfacos},
+\type {\pfatan}, \type {\pfsinh}, \type {\pfcosh}, \type {\pftanh}, \type
+{\pfasinh}, \type {\pfacosh}, \type {\pfatanh}, \type {\pfsqrt}, \type {\pflog},
+\type {\pfexp}, \type {\pfceil}, \type {\pffloor}, \type {\pfround}, \type
+{\pfabs}, \type {\pfrad} and \type {\pfdeg}, whiel these expect two floats: \type
+{\pfatantwo}, \type {\pfpow}, \type {\pfmod} and \type {\pfrem}.
+
+% \pageextragoal = 5sp
+
+\stopsectionlevel
+
+\startsectionlevel[title=\METAPOST]
+
+In addition to the instances \typ {metafun} (double in \LMTX), \typ {scaledfun},
+\typ {doublefun}, \typ {decimalfun} we now also have \typ {positfun}. Because we
+currently use 32 bit posits in the new number system there is no real gain over
+the already present 64 bit doubles. When 64 bit posits show up we might move on
+to that.
+
+\stopsectionlevel
+
+\stopdocument
diff --git a/doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex b/doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex
index 6543c0795..3412a740f 100644
--- a/doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex
+++ b/doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex
@@ -1247,7 +1247,7 @@ that a negative depth of more than 1000 point made no sense at all. The last
depth on a vertical list is registered in the \type {\prevdepth} variable. This
is basically a reference into the current list. In order to illustrate some
interesting side effects of setting this \type {\prevdepth} and especially when
-we set it to -1000pt. In order to illustrate this this special value can be set
+we set it to $\tf -1000pt$. In order to illustrate this this special value can be set
to a different value in \LUAMETATEX. However, as dealing with the property is
somewhat special in the engine you should not set it unless you know that the
macro package is ware of it.
@@ -1307,21 +1307,23 @@ coded dimension. We now give a more extensive example:
\egroup
\stopbuffer
-In this example we set \type {\ignoredepthcriterium} to $\tf-50.0pt$ instead of the
+\typebuffer[example][option=TEX]
+
+In this example we set \type {\ignoredepthcriterium} to $\tf -50.0pt$ instead of the
normal $\tf -1000pt$. The helper is defined as:
-\typebuffer[option=TEX][definitions-1]
+\typebuffer[definition-1][option=TEX]
or
-\typebuffer[option=TEX][definitions-2]
+\typebuffer[definition-2][option=TEX]
-The result of the following example is shown in \in {figures} [fig:prevdepth-1]
-\in {and} [fig:prevdepth-2]. The first case is what we normally have in text and
-we haven't set \type {prevdepth} explicitly between lines so \TEX\ will just look
-at the depth of the lines. In the second case the depth is ignored when less than
-the criterium which is why, when we set the depth of the box to a negative value
-we get somewhat interesting skips.
+The result is shown in \in {figures} [fig:prevdepth-1] \in {and}
+[fig:prevdepth-2]. The first case is what we normally have in text and we haven't
+set \type {prevdepth} explicitly between lines so \TEX\ will just look at the
+depth of the lines. In the second case the depth is ignored when less than the
+criterium which is why, when we set the depth of the box to a negative value we
+get somewhat interesting skips.
\startplacefigure[reference=fig:prevdepth-1]
\showmakeup[line]
@@ -1355,6 +1357,8 @@ we get with positive values:
\egroup
\stopbuffer
+\typebuffer[example][option=TEX]
+
\startplacefigure[reference=fig:prevdepth-3]
\showmakeup[line]
\ignoredepthcriterium50pt
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-building.tex b/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
index 277d39251..9068bbc0c 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-building.tex
@@ -457,10 +457,10 @@ up such that it can adapt itself:
\hbox to 3cm {x\leaders\hrule\hfil x}
\hbox{x \vrule width 4cm \relax x}
\hbox{x \srule width 4cm \relax x}
-\hbox{x \vrule font \font char `( width 4cm \relax x}
\hbox{x \srule font \font char `( width 4cm \relax x}
\hbox{$x \srule fam \fam char `( width 4cm \relax x$}
-\hbox{$x \vrule fam \fam char `( width 4cm \relax x$}
+% \hbox{x \vrule font \font char `( width 4cm \relax x}
+% \hbox{$x \vrule fam \fam char `( width 4cm \relax x$}
\stopbuffer
\typebuffer
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex b/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
index 46d986bfb..ba320440b 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
@@ -1767,6 +1767,30 @@ else \quote {last} has been seen.
\stopsection
+\startsection[title=Kerns and penalties]
+
+\startsubsection[title=\prm {hkern} and \prm {vkern}]
+
+\topicindex {kerns}
+
+These two primitives complement \prm {hskip} and \prm {vskip} and force the right
+mode when issued. Contrary to the skips, internally we still have a common kern
+command code but that is not something the user has to worry about.
+
+\stopsubsection
+
+\startsubsection[title=\prm {hpenalty} and \prm {vpenalty}]
+
+\topicindex {penalties}
+
+As the kern and skip related primitives mentioned in the in the previous section
+these two primitives are there fort consistency: they force the right (related)
+mode. (Sometimes being a bit more explicit is cleaner.)
+
+\stopsubsection
+
+\stopsection
+
\startsection[title=Scanning]
\startsubsection[title=Keywords]
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex.tex b/doc/context/sources/general/manuals/luametatex/luametatex.tex
index e75053972..a86846628 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex.tex
@@ -108,7 +108,7 @@
% End Feburari 2023 I observed 8.2 seconds for 360 pages and making a format needed
% 1.9 seconds instead if the usual 2.1 but that can be a side effect of the terminal
% because the amount of output which is sensitive for refresh delays set. The new
-% target is nwo 50 pages per second for this manual but on this laptop that is
+% target is now 50 pages per second for this manual but on this laptop that is
% unlikely to happen any time soon. With tabulateusesize and tabulatesparseskips
% experiments enabled we needed 8.1 second and 44.3 pps.
diff --git a/scripts/context/lua/mtx-install-modules.lua b/scripts/context/lua/mtx-install-modules.lua
index 2073cf6e1..63b892966 100644
--- a/scripts/context/lua/mtx-install-modules.lua
+++ b/scripts/context/lua/mtx-install-modules.lua
@@ -29,6 +29,8 @@ if not modules then modules = { } end modules ['mtx-install-modules'] = {
-- Maybe some day we can get the modules from ctan but then we need a consistent
-- names and such.
+local find = string.find
+
local helpinfo = [[
<?xml version="1.0"?>
<application>
@@ -41,7 +43,9 @@ local helpinfo = [[
<category name="basic">
<subcategory>
<flag name="list"><short>list modules</short></flag>
+ <flag name="installed"><short>list installed modules</short></flag>
<flag name="install"><short>install modules</short></flag>
+ <flag name="uninstall"><short>uninstall modules</short></flag>
<flag name="module"><short>install (zip) file(s)</short></flag>
</subcategory>
</category>
@@ -58,14 +62,17 @@ local helpinfo = [[
<example><command>mtxrun --script install-modules --install --all</command></example>
</subcategory>
<subcategory>
- <example><command>mtxrun --script install-modules --install --module t-letter.zip</command></example>
+ <example><command>mtxrun --script install-modules --install --module t-letter.zip</command></example>
+ <example><command>mtxrun --script install-modules --uninstall --module t-letter.zip</command></example>
+ </subcategory>
+ <subcategory>
+ <example><command>mtxrun --script install-modules --installed</command></example>
</subcategory>
</category>
</examples>
</application>
]]
-
local application = logs.application {
name = "mtx-install-modules",
banner = "ConTeXt Module Installer 1.00",
@@ -97,11 +104,22 @@ end or function(str)
return data
end
+-- We use some abstraction:
+
local urls = {
ctan = "https://mirrors.ctan.org/install",
modules = "https://modules.contextgarden.net/dl"
}
+-- Some package this in the root which is asking for conflicts.
+
+-- local badones = {
+-- -- "LICENSE",
+-- -- "README",
+-- -- "README.md",
+-- -- "VERSION",
+-- }
+
local tmpzipfile = "temp.zip"
local checkdir = "texmf-context"
local targetdir = "texmf-modules"
@@ -149,35 +167,69 @@ local function loadlists()
else
report("base file %a is not found",basefile)
end
+ report()
end
- report()
end
-local function install(list)
- if type(list) ~= "table"then
+local function validate(n)
+ return not (
+ find(n,"latex")
+ -- or find(n,"lualatex")
+ or find(n,"plain")
+ or find(n,"optex")
+ or find(n,"luatex")
+ or find(n,"pdftex")
+ )
+end
+
+local function install(list,wipe)
+ if type(list) ~= "table" then
report("unknown specification")
end
- local zips = list.zips
- local wipes = list.wipes
+ local zips = list.zips
+ local wipes = list.wipes
if type(zips) ~= "table" then
report("incomplete specification")
else
- report("installing into %a",targetdir)
+ -- report("installing into %a",targetdir)
for i=1,#zips do
- local where = urls[list.url] .. "/" .. zips[i]
- local data = fetched(where)
- if string.find(data,"^PK") then
- io.savedata(tmpzipfile,data)
- report("from %a",where)
- report("into %a",targetdir)
- utilities.zipfiles.unzipdir {
- zipname = tmpzipfile,
- path = ".",
- verbose = "steps",
- }
- os.remove(tmpzipfile)
- else
- report("unknown %a",where)
+ local remote = list.url
+ local where = zips[i]
+ local hash = file.addsuffix(sha2.HASH256(where),"tma")
+ local data = table.load(hash)
+ if data then
+ local name = data.name
+ local list = data.list
+ if name and list then
+ report()
+ report("removing %i old files for %a",#list,name)
+ report()
+ for i=1,#list do
+ os.remove(list[i])
+ end
+ end
+ end
+ if not wipe then
+ if remote then
+ where = (urls[remote] or remote) .. "/" .. where
+ end
+ local data = fetched(where)
+ if string.find(data,"^PK") then
+ io.savedata(tmpzipfile,data)
+ report("from %a",where)
+ report("into %a",targetdir)
+ local done = utilities.zipfiles.unzipdir {
+ zipname = tmpzipfile,
+ path = ".",
+ verbose = "steps",
+ collect = true,
+ validate = validate,
+ }
+ table.save(hash,{ name = where, list = done })
+ os.remove(tmpzipfile)
+ else
+ report("unknown %a",where)
+ end
end
end
@@ -209,7 +261,23 @@ function scripts.modules.list()
end
end
-function scripts.modules.install()
+function scripts.modules.installed()
+ local files = dir.glob(targetdir .. "/*.tma")
+ if files then
+ for i=1,#files do
+ local data = table.load(files[i])
+ if data then
+ local name = data.name
+ local list = data.list
+ if name and list then
+ report("%4i : %s",#list,name)
+ end
+ end
+ end
+ end
+end
+
+function scripts.modules.install(wipe)
local curdir = dir.current()
local done = false
if not lfs.isdir(checkdir) then
@@ -219,14 +287,18 @@ function scripts.modules.install()
elseif not lfs.chdir(targetdir) then
report("unable to go into %a",targetdir)
elseif environment.argument("module") or environment.argument("modules") then
- loadlists()
local files = environment.files
if #files == 0 then
report("no archive names provided")
else
for i=1,#files do
local name = files[i]
- install { url = "modules", zips = { file.addsuffix(name,"zip") } }
+ if url.hasscheme(name) then
+ install({ url = false, zips = { file.addsuffix(name,"zip") } }, wipe)
+ else
+ loadlists()
+ install({ url = "modules", zips = { file.addsuffix(name,"zip") } }, wipe)
+ end
end
done = files
end
@@ -237,15 +309,36 @@ function scripts.modules.install()
report("no module names provided")
else
for i=1,#files do
- local list = lists[files[i]]
+ local name = files[i]
+ local list = lists[name]
if list then
- install(list)
+ install(list,wipe)
end
end
done = files
end
end
if done then
+ --
+ -- for i=1,#badones do
+ -- os.remove(badones[i])
+ -- end
+ local okay = false
+ local files = dir.glob("*")
+ for i=1,#files do
+ local name = files[i]
+ if file.suffix(name) == "tma" then
+ -- keep it
+ else
+ if not okay then
+ report()
+ okay = true
+ end
+ report("removed %a",name)
+ os.remove(name)
+ end
+ end
+ --
report()
report("renewing file database")
report()
@@ -258,10 +351,18 @@ function scripts.modules.install()
lfs.chdir(curdir)
end
+function scripts.modules.uninstall()
+ scripts.modules.install(true)
+end
+
if environment.argument("list") then
scripts.modules.list()
+elseif environment.argument("installed") then
+ scripts.modules.installed()
elseif environment.argument("install") then
scripts.modules.install()
+elseif environment.argument("uninstall") then
+ scripts.modules.uninstall()
elseif environment.argument("exporthelp") then
application.export(environment.argument("exporthelp"),environment.files[1])
else
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 27c2e6cb0..ad39c4579 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-zip"] = package.loaded["util-zip"] or true
--- original size: 32353, stripped down to: 16001
+-- original size: 33051, stripped down to: 16324
if not modules then modules={} end modules ['util-zip']={
version=1.001,
@@ -16301,8 +16301,10 @@ if xzip then
closezip(zipf)
end
end
- local function unzipdir(zipname,path,verbose)
+ local function unzipdir(zipname,path,verbose,collect,validate)
if type(zipname)=="table" then
+ validate=zipname.validate
+ collect=zipname.collect
verbose=zipname.verbose
path=zipname.path
zipname=zipname.zipname
@@ -16323,34 +16325,47 @@ if xzip then
local done=0
local steps=verbose=="steps"
local time=steps and osclock()
+ if collect then
+ collect={}
+ else
+ collect=false
+ end
for i=1,count do
local l=list[i]
local n=l.filename
- local d=unzipfile(z,n)
- if d then
- local p=filejoin(path,n)
- if mkdirs(dirname(p)) then
- if steps then
- total=total+#d
- done=done+1
- if done>=step then
- done=0
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ if not validate or validate(n) then
+ local d=unzipfile(z,n)
+ if d then
+ local p=filejoin(path,n)
+ if mkdirs(dirname(p)) then
+ if steps then
+ total=total+#d
+ done=done+1
+ if done>=step then
+ done=0
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ end
+ elseif verbose then
+ logwriter(n)
+ end
+ savedata(p,d)
+ if collect then
+ collect[#collect+1]=p
end
- elseif verbose then
- logwriter(n)
end
- savedata(p,d)
+ else
+ logwriter(format("problem with file %s",n))
end
else
- logwriter(format("problem with file %s",n))
end
end
if steps then
logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time))
end
closezipfile(z)
- return true
+ if collect then
+ return collect
+ end
else
closezipfile(z)
end
@@ -26188,8 +26203,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1046208
--- stripped bytes : 415601
+-- original bytes : 1046906
+-- stripped bytes : 415976
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 27c2e6cb0..ad39c4579 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-zip"] = package.loaded["util-zip"] or true
--- original size: 32353, stripped down to: 16001
+-- original size: 33051, stripped down to: 16324
if not modules then modules={} end modules ['util-zip']={
version=1.001,
@@ -16301,8 +16301,10 @@ if xzip then
closezip(zipf)
end
end
- local function unzipdir(zipname,path,verbose)
+ local function unzipdir(zipname,path,verbose,collect,validate)
if type(zipname)=="table" then
+ validate=zipname.validate
+ collect=zipname.collect
verbose=zipname.verbose
path=zipname.path
zipname=zipname.zipname
@@ -16323,34 +16325,47 @@ if xzip then
local done=0
local steps=verbose=="steps"
local time=steps and osclock()
+ if collect then
+ collect={}
+ else
+ collect=false
+ end
for i=1,count do
local l=list[i]
local n=l.filename
- local d=unzipfile(z,n)
- if d then
- local p=filejoin(path,n)
- if mkdirs(dirname(p)) then
- if steps then
- total=total+#d
- done=done+1
- if done>=step then
- done=0
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ if not validate or validate(n) then
+ local d=unzipfile(z,n)
+ if d then
+ local p=filejoin(path,n)
+ if mkdirs(dirname(p)) then
+ if steps then
+ total=total+#d
+ done=done+1
+ if done>=step then
+ done=0
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ end
+ elseif verbose then
+ logwriter(n)
+ end
+ savedata(p,d)
+ if collect then
+ collect[#collect+1]=p
end
- elseif verbose then
- logwriter(n)
end
- savedata(p,d)
+ else
+ logwriter(format("problem with file %s",n))
end
else
- logwriter(format("problem with file %s",n))
end
end
if steps then
logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time))
end
closezipfile(z)
- return true
+ if collect then
+ return collect
+ end
else
closezipfile(z)
end
@@ -26188,8 +26203,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1046208
--- stripped bytes : 415601
+-- original bytes : 1046906
+-- stripped bytes : 415976
-- end library merge
diff --git a/scripts/context/stubs/source/readme.txt b/scripts/context/stubs/source/readme.txt
index 72892ee2f..4eae76a1e 100644
--- a/scripts/context/stubs/source/readme.txt
+++ b/scripts/context/stubs/source/readme.txt
@@ -1,40 +1,40 @@
-Copyright:
-
-The originally 'runscript' program was written by in 2009 by T.M.Trzeciak and is
-public domain. This derived mtxrun program is an adapted version by Hans Hagen and
-Luigi Scarso.
-
-Comment:
-
-In ConTeXt MkIV we have two core scripts: luatools.lua and mtxrun.lua where the
-second one is used to launch other scripts. The mtxrun.exe program calls luatex.exe.
-
-Normally a user will use a call like:
-
- mtxrun --script font --reload
-
-Here mtxrun is a lua script. In order to avoid the usage of a cmd file on windows this
-runner will start texlua directly. In TeXlive a runner is added for each cmd file but
-we don't want that overhead (and extra files). By using an exe we can call these
-scripts in batch files without the need for using call.
-
-The mtxrun.exe file can be copied to a mtxrunjit.exe file in which case luajittex.exe
-is called.
-
- mtxrunjit --script font --reload
-
-We also don't want to use other runners, like those that use kpse to locate the script
-as this is exactly what mtxrun itself is doing already. Therefore the runscript program
-is adapted to a more direct approach suitable for mtxrun.
-
-Compilation:
-
-with gcc (size optimized):
-
- gcc -Os -s -shared -o mtxrun.dll mtxrun_dll.c
- gcc -Os -s -o mtxrun.exe mtxrun_exe.c -L./ -lmtxrun
-
-with tcc (ver. 0.9.24), extra small size
-
- tcc -shared -o runscript.dll runscript_dll.c
- tcc -o runscript.exe runscript_exe.c runscript.def
+Copyright:
+
+The originally 'runscript' program was written by in 2009 by T.M.Trzeciak and is
+public domain. This derived mtxrun program is an adapted version by Hans Hagen and
+Luigi Scarso.
+
+Comment:
+
+In ConTeXt MkIV we have two core scripts: luatools.lua and mtxrun.lua where the
+second one is used to launch other scripts. The mtxrun.exe program calls luatex.exe.
+
+Normally a user will use a call like:
+
+ mtxrun --script font --reload
+
+Here mtxrun is a lua script. In order to avoid the usage of a cmd file on windows this
+runner will start texlua directly. In TeXlive a runner is added for each cmd file but
+we don't want that overhead (and extra files). By using an exe we can call these
+scripts in batch files without the need for using call.
+
+The mtxrun.exe file can be copied to a mtxrunjit.exe file in which case luajittex.exe
+is called.
+
+ mtxrunjit --script font --reload
+
+We also don't want to use other runners, like those that use kpse to locate the script
+as this is exactly what mtxrun itself is doing already. Therefore the runscript program
+is adapted to a more direct approach suitable for mtxrun.
+
+Compilation:
+
+with gcc (size optimized):
+
+ gcc -Os -s -shared -o mtxrun.dll mtxrun_dll.c
+ gcc -Os -s -o mtxrun.exe mtxrun_exe.c -L./ -lmtxrun
+
+with tcc (ver. 0.9.24), extra small size
+
+ tcc -shared -o runscript.dll runscript_dll.c
+ tcc -o runscript.exe runscript_exe.c runscript.def
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 27c2e6cb0..ad39c4579 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-zip"] = package.loaded["util-zip"] or true
--- original size: 32353, stripped down to: 16001
+-- original size: 33051, stripped down to: 16324
if not modules then modules={} end modules ['util-zip']={
version=1.001,
@@ -16301,8 +16301,10 @@ if xzip then
closezip(zipf)
end
end
- local function unzipdir(zipname,path,verbose)
+ local function unzipdir(zipname,path,verbose,collect,validate)
if type(zipname)=="table" then
+ validate=zipname.validate
+ collect=zipname.collect
verbose=zipname.verbose
path=zipname.path
zipname=zipname.zipname
@@ -16323,34 +16325,47 @@ if xzip then
local done=0
local steps=verbose=="steps"
local time=steps and osclock()
+ if collect then
+ collect={}
+ else
+ collect=false
+ end
for i=1,count do
local l=list[i]
local n=l.filename
- local d=unzipfile(z,n)
- if d then
- local p=filejoin(path,n)
- if mkdirs(dirname(p)) then
- if steps then
- total=total+#d
- done=done+1
- if done>=step then
- done=0
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ if not validate or validate(n) then
+ local d=unzipfile(z,n)
+ if d then
+ local p=filejoin(path,n)
+ if mkdirs(dirname(p)) then
+ if steps then
+ total=total+#d
+ done=done+1
+ if done>=step then
+ done=0
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ end
+ elseif verbose then
+ logwriter(n)
+ end
+ savedata(p,d)
+ if collect then
+ collect[#collect+1]=p
end
- elseif verbose then
- logwriter(n)
end
- savedata(p,d)
+ else
+ logwriter(format("problem with file %s",n))
end
else
- logwriter(format("problem with file %s",n))
end
end
if steps then
logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time))
end
closezipfile(z)
- return true
+ if collect then
+ return collect
+ end
else
closezipfile(z)
end
@@ -26188,8 +26203,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1046208
--- stripped bytes : 415601
+-- original bytes : 1046906
+-- stripped bytes : 415976
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 27c2e6cb0..ad39c4579 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -15876,7 +15876,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-zip"] = package.loaded["util-zip"] or true
--- original size: 32353, stripped down to: 16001
+-- original size: 33051, stripped down to: 16324
if not modules then modules={} end modules ['util-zip']={
version=1.001,
@@ -16301,8 +16301,10 @@ if xzip then
closezip(zipf)
end
end
- local function unzipdir(zipname,path,verbose)
+ local function unzipdir(zipname,path,verbose,collect,validate)
if type(zipname)=="table" then
+ validate=zipname.validate
+ collect=zipname.collect
verbose=zipname.verbose
path=zipname.path
zipname=zipname.zipname
@@ -16323,34 +16325,47 @@ if xzip then
local done=0
local steps=verbose=="steps"
local time=steps and osclock()
+ if collect then
+ collect={}
+ else
+ collect=false
+ end
for i=1,count do
local l=list[i]
local n=l.filename
- local d=unzipfile(z,n)
- if d then
- local p=filejoin(path,n)
- if mkdirs(dirname(p)) then
- if steps then
- total=total+#d
- done=done+1
- if done>=step then
- done=0
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ if not validate or validate(n) then
+ local d=unzipfile(z,n)
+ if d then
+ local p=filejoin(path,n)
+ if mkdirs(dirname(p)) then
+ if steps then
+ total=total+#d
+ done=done+1
+ if done>=step then
+ done=0
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ end
+ elseif verbose then
+ logwriter(n)
+ end
+ savedata(p,d)
+ if collect then
+ collect[#collect+1]=p
end
- elseif verbose then
- logwriter(n)
end
- savedata(p,d)
+ else
+ logwriter(format("problem with file %s",n))
end
else
- logwriter(format("problem with file %s",n))
end
end
if steps then
logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time))
end
closezipfile(z)
- return true
+ if collect then
+ return collect
+ end
else
closezipfile(z)
end
@@ -26188,8 +26203,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1046208
--- stripped bytes : 415601
+-- original bytes : 1046906
+-- stripped bytes : 415976
-- end library merge
diff --git a/source/luametatex/CMakeLists.txt b/source/luametatex/CMakeLists.txt
index 2fffa9ecb..e33b76aee 100644
--- a/source/luametatex/CMakeLists.txt
+++ b/source/luametatex/CMakeLists.txt
@@ -1,264 +1,264 @@
-cmake_minimum_required(VERSION 3.9)
-
-project(luametatex VERSION 2.10 LANGUAGES C)
-
-set(CMAKE_C_STANDARD 11)
-# set(CMAKE_CXX_STANDARD 17)
-
-# https://sourceforge.net/p/predef/wiki/OperatingSystems/
-# https://sourceforge.net/p/predef/wiki/Architectures/
-
-include(GNUInstallDirs)
-
-# Optionals (maybe have a LMT_*_TOO for each of them). We might start out with only a very few
-# optionals at some time, but for now we enable them (there is not not much code involved). The
-# idea behind thes eoptionals is that we have very simple (!) interfaces, delegating as much as
-# possible to Lua. We will *not* add interfaces with many bindings because that will introduce
-# dependencies (and looking at e.g. LuaTeX build updates shows that clearly: a no-go).
-
-set(LMT_KPSE_TOO 1) # In case we want to manage MKII scripts (etc) with mtxrun.
-set(LMT_HB_TOO 1) # Maybe handy for Idris' font development (old converted ffi stuff)
-
-# When set, because we're sparse we also strip the binary. Because we only gain some 1-2% on
-# runtime, enabling it makes not much sense:
-
-# set(LMT_OPTIMIZE 1)
-
-if (MSVC)
-
- if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
-
- add_compile_options(
- -Wall
- -O2
-
- -Wcast-align
- -Wcast-qual
-
- -Wno-unknown-pragmas
- -fno-strict-aliasing
-
- -Wno-pedantic
- -Wno-deprecated-declarations
- -Wno-missing-noreturn
- -Wno-shadow
- )
-
- add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-
- add_definitions(-DLMT_COMPILER_USED="clang")
-
- else()
-
- add_compile_options(
- /Wall
-
- /wd4127 # constant conditional expression
- /wd4131 # old style declarator
- /wd4152 # function pointer cast
- /wd4201 # nonstandard extension used: nameless struct/union
- /wd4244 # assignment in conditional expression
- /wd4456 # local vars with same name as outer variable
- /wd4457 # local vars with same function parameter
- /wd4464 # relative include path
- /wd4668 # missing defines
- /wd4702 # unreachable code
- /wd4710 # inlining
- /wd4711 # inlining
- /wd4774 # sprint argument 2 warning
- /wd4777 # format argument 2 warning
- /wd4820 # local vars with same name as outer variable
- /wd4996 # strdup etc warnings
- /wd5045 # spectre
-
- # /GL # whole program link optimization
- # /Gw # whole program data optimization (a little smaller bin)
-
- # /Ob3 # more agressive inline, much larger bin, no gain
-
- /wd4061 # enumerator * in switch * is not explicitly handles (mp)
- /wd4701 # potentially unitialized local variable (lua)
- /wd4255 # no function prototype given
-
- /wd5105 # macro expansion producing 'defined' has undefined behavior
-
- /wd4548 # expression before comma has no effect; expected expression with side-effect
-
- # indeed a bit faster but also a much larger binary:
-
- # /fp:fast
-
- # okay for amd processors too but no difference in size so probably no gain:
-
- # /favor:INTEL64
- # /fsanitize:address
- # /std:c17
-
- )
-
- # We always optimize ... symbols are not in the binary anyway so there is no advantage
- # (like when accessing Lua api functions). We could have an additional luametatex-lua.dll
- # but that also creates a dependency (possible conflict).
-
- # if (DEFINED LMT_OPTIMIZE)
- add_compile_options(
- /GL # whole program link optimization
- /Gw # whole program data optimization (a little smaller bin)
- )
- # endif()
-
- add_definitions(-DLMT_COMPILER_USED="msvc")
-
- endif()
-
- else()
-
- if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
-
- # why not -03
-
- add_compile_options(
- -O2
- )
-
- add_definitions(-DLMT_COMPILER_USED="clang")
-
- else()
-
- add_compile_options(
- -O3
- # -g0
- # -mtune=nocona # fails on arm so more testing needed
- )
-
- add_definitions(-DLMT_COMPILER_USED="gcc")
-
- # add_compile_options(-pg)
- # add_link_options(-pg)
-
- endif()
-
- add_compile_options(
- -Wall
-
- -Wcast-align
- -Wcast-qual
-
- -Wno-unknown-pragmas
- -Wno-unused-result
- -fno-strict-aliasing
- )
-
- # for c17
- #
- # add_definitions(-D__STDC_WANT_LIB_EXT2__=1)
-
- if (DEFINED LMT_OPTIMIZE)
- if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
- set(CMAKE_EXE_LINKER_FLAGS "-s")
- endif()
- endif()
-
-endif()
-
-if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
-
- add_compile_options(
- -Wno-unknown-warning-option
- -Wno-nonportable-include-path
- -Wno-nonportable-system-include-path
- -Wno-newline-eof
- -Wno-extra-semi-stmt
- -Wno-sign-conversion
- -Wno-unused-macros
- -Wno-reserved-id-macro
- -Wno-comma
- -Wno-switch-enum
- -Wno-shadow
- -Wno-missing-noreturn
- -Wno-implicit-fallthrough
- # -Wno-format
- -Wno-reserved-identifier
- -Wno-date-time
- -Wno-format-nonliteral
- -Wno-float-equal
- )
-
-endif()
-
-# Not that tested (converted ffi originals):
-
-if ((DEFINED LMT_KPSE_TOO))
- add_definitions(-DLMT_KPSE_TOO=1)
-endif()
-if ((DEFINED LMT_HB_TOO))
- add_definitions(-DLMT_HB_TOO=1)
-endif()
-
-# This needs cmake >= 3.9 and produces a 60K smaller mingw binary but it take quite a bit of
-# runtime to get there so it should become an option (apart from testing on all builders).
-
-if (DEFINED LMT_OPTIMIZE)
-
- include(CheckIPOSupported)
- check_ipo_supported(RESULT ipo_supported OUTPUT ipo_message)
-
- if (ipo_supported)
- #
- # We only have one program so we do it global (can become an -- option)
- #
- # set_property(TARGET luametatex PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
- #
- # mingw64: 2865664, nocona: 2819584, lto: 2835968 (around 1% gain on manual)
- #
- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
- #
- else()
- # No message needed, just accept the fact.
- endif()
-
-endif()
-
-# Mimalloc is still under development, so we only support it on a few platforms. By the time it is
-# stable we can probably remove some of the following tests. A bit of a hack:
-#
-# When the old osx version is dropped and armhf is upgraded we can enable unix except solaris which
-# fails. So, only osx 10.6 and rpi 32 fail. But we will probably drop 32 bit in the future anyway.
-
-# CMAKE_HOST_SYSTEM_PROCESSOR arm64 x86_64
-
-if (CMAKE_HOST_SOLARIS)
- # fails
-elseif (MSVC)
- set(luametatex_use_mimalloc 1)
-elseif (CMAKE_HOST_APPLE AND NOT (${CMAKE_C_COMPILER} MATCHES "arm"))
- # fails on the osx intel
-elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l")
- # fails on the rpi 32 bit
-else()
- set(luametatex_use_mimalloc 1)
-endif()
-
-include_directories(${CMAKE_ROOT}/source)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/source)
-
-if ((DEFINED luametatex_use_mimalloc))
- add_definitions(-DLUAMETATEX_USE_MIMALLOC=1)
- # add_definitions(-DMIMALLOC_RESET_DELAY=250)
- # set(luametatex_use_mimalloc 1)
- include(cmake/mimalloc.cmake)
-endif()
-
-include(cmake/tex.cmake)
-include(cmake/lua.cmake)
-include(cmake/mp.cmake)
-
-include(cmake/luarest.cmake)
-include(cmake/luasocket.cmake)
-include(cmake/luaoptional.cmake)
-
-include(cmake/pplib.cmake)
-include(cmake/miniz.cmake)
-include(cmake/softposit.cmake)
-
-include(cmake/luametatex.cmake)
+cmake_minimum_required(VERSION 3.9)
+
+project(luametatex VERSION 2.10 LANGUAGES C)
+
+set(CMAKE_C_STANDARD 11)
+# set(CMAKE_CXX_STANDARD 17)
+
+# https://sourceforge.net/p/predef/wiki/OperatingSystems/
+# https://sourceforge.net/p/predef/wiki/Architectures/
+
+include(GNUInstallDirs)
+
+# Optionals (maybe have a LMT_*_TOO for each of them). We might start out with only a very few
+# optionals at some time, but for now we enable them (there is not not much code involved). The
+# idea behind thes eoptionals is that we have very simple (!) interfaces, delegating as much as
+# possible to Lua. We will *not* add interfaces with many bindings because that will introduce
+# dependencies (and looking at e.g. LuaTeX build updates shows that clearly: a no-go).
+
+set(LMT_KPSE_TOO 1) # In case we want to manage MKII scripts (etc) with mtxrun.
+set(LMT_HB_TOO 1) # Maybe handy for Idris' font development (old converted ffi stuff)
+
+# When set, because we're sparse we also strip the binary. Because we only gain some 1-2% on
+# runtime, enabling it makes not much sense:
+
+# set(LMT_OPTIMIZE 1)
+
+if (MSVC)
+
+ if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+
+ add_compile_options(
+ -Wall
+ -O2
+
+ -Wcast-align
+ -Wcast-qual
+
+ -Wno-unknown-pragmas
+ -fno-strict-aliasing
+
+ -Wno-pedantic
+ -Wno-deprecated-declarations
+ -Wno-missing-noreturn
+ -Wno-shadow
+ )
+
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+
+ add_definitions(-DLMT_COMPILER_USED="clang")
+
+ else()
+
+ add_compile_options(
+ /Wall
+
+ /wd4127 # constant conditional expression
+ /wd4131 # old style declarator
+ /wd4152 # function pointer cast
+ /wd4201 # nonstandard extension used: nameless struct/union
+ /wd4244 # assignment in conditional expression
+ /wd4456 # local vars with same name as outer variable
+ /wd4457 # local vars with same function parameter
+ /wd4464 # relative include path
+ /wd4668 # missing defines
+ /wd4702 # unreachable code
+ /wd4710 # inlining
+ /wd4711 # inlining
+ /wd4774 # sprint argument 2 warning
+ /wd4777 # format argument 2 warning
+ /wd4820 # local vars with same name as outer variable
+ /wd4996 # strdup etc warnings
+ /wd5045 # spectre
+
+ # /GL # whole program link optimization
+ # /Gw # whole program data optimization (a little smaller bin)
+
+ # /Ob3 # more agressive inline, much larger bin, no gain
+
+ /wd4061 # enumerator * in switch * is not explicitly handles (mp)
+ /wd4701 # potentially unitialized local variable (lua)
+ /wd4255 # no function prototype given
+
+ /wd5105 # macro expansion producing 'defined' has undefined behavior
+
+ /wd4548 # expression before comma has no effect; expected expression with side-effect
+
+ # indeed a bit faster but also a much larger binary:
+
+ # /fp:fast
+
+ # okay for amd processors too but no difference in size so probably no gain:
+
+ # /favor:INTEL64
+ # /fsanitize:address
+ # /std:c17
+
+ )
+
+ # We always optimize ... symbols are not in the binary anyway so there is no advantage
+ # (like when accessing Lua api functions). We could have an additional luametatex-lua.dll
+ # but that also creates a dependency (possible conflict).
+
+ # if (DEFINED LMT_OPTIMIZE)
+ add_compile_options(
+ /GL # whole program link optimization
+ /Gw # whole program data optimization (a little smaller bin)
+ )
+ # endif()
+
+ add_definitions(-DLMT_COMPILER_USED="msvc")
+
+ endif()
+
+ else()
+
+ if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+
+ # why not -03
+
+ add_compile_options(
+ -O2
+ )
+
+ add_definitions(-DLMT_COMPILER_USED="clang")
+
+ else()
+
+ add_compile_options(
+ -O3
+ # -g0
+ # -mtune=nocona # fails on arm so more testing needed
+ )
+
+ add_definitions(-DLMT_COMPILER_USED="gcc")
+
+ # add_compile_options(-pg)
+ # add_link_options(-pg)
+
+ endif()
+
+ add_compile_options(
+ -Wall
+
+ -Wcast-align
+ -Wcast-qual
+
+ -Wno-unknown-pragmas
+ -Wno-unused-result
+ -fno-strict-aliasing
+ )
+
+ # for c17
+ #
+ # add_definitions(-D__STDC_WANT_LIB_EXT2__=1)
+
+ if (DEFINED LMT_OPTIMIZE)
+ if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
+ set(CMAKE_EXE_LINKER_FLAGS "-s")
+ endif()
+ endif()
+
+endif()
+
+if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+
+ add_compile_options(
+ -Wno-unknown-warning-option
+ -Wno-nonportable-include-path
+ -Wno-nonportable-system-include-path
+ -Wno-newline-eof
+ -Wno-extra-semi-stmt
+ -Wno-sign-conversion
+ -Wno-unused-macros
+ -Wno-reserved-id-macro
+ -Wno-comma
+ -Wno-switch-enum
+ -Wno-shadow
+ -Wno-missing-noreturn
+ -Wno-implicit-fallthrough
+ # -Wno-format
+ -Wno-reserved-identifier
+ -Wno-date-time
+ -Wno-format-nonliteral
+ -Wno-float-equal
+ )
+
+endif()
+
+# Not that tested (converted ffi originals):
+
+if ((DEFINED LMT_KPSE_TOO))
+ add_definitions(-DLMT_KPSE_TOO=1)
+endif()
+if ((DEFINED LMT_HB_TOO))
+ add_definitions(-DLMT_HB_TOO=1)
+endif()
+
+# This needs cmake >= 3.9 and produces a 60K smaller mingw binary but it take quite a bit of
+# runtime to get there so it should become an option (apart from testing on all builders).
+
+if (DEFINED LMT_OPTIMIZE)
+
+ include(CheckIPOSupported)
+ check_ipo_supported(RESULT ipo_supported OUTPUT ipo_message)
+
+ if (ipo_supported)
+ #
+ # We only have one program so we do it global (can become an -- option)
+ #
+ # set_property(TARGET luametatex PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
+ #
+ # mingw64: 2865664, nocona: 2819584, lto: 2835968 (around 1% gain on manual)
+ #
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
+ #
+ else()
+ # No message needed, just accept the fact.
+ endif()
+
+endif()
+
+# Mimalloc is still under development, so we only support it on a few platforms. By the time it is
+# stable we can probably remove some of the following tests. A bit of a hack:
+#
+# When the old osx version is dropped and armhf is upgraded we can enable unix except solaris which
+# fails. So, only osx 10.6 and rpi 32 fail. But we will probably drop 32 bit in the future anyway.
+
+# CMAKE_HOST_SYSTEM_PROCESSOR arm64 x86_64
+
+if (CMAKE_HOST_SOLARIS)
+ # fails
+elseif (MSVC)
+ set(luametatex_use_mimalloc 1)
+elseif (CMAKE_HOST_APPLE AND NOT (${CMAKE_C_COMPILER} MATCHES "arm"))
+ # fails on the osx intel
+elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l")
+ # fails on the rpi 32 bit
+else()
+ set(luametatex_use_mimalloc 1)
+endif()
+
+include_directories(${CMAKE_ROOT}/source)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/source)
+
+if ((DEFINED luametatex_use_mimalloc))
+ add_definitions(-DLUAMETATEX_USE_MIMALLOC=1)
+ # add_definitions(-DMIMALLOC_RESET_DELAY=250)
+ # set(luametatex_use_mimalloc 1)
+ include(cmake/mimalloc.cmake)
+endif()
+
+include(cmake/tex.cmake)
+include(cmake/lua.cmake)
+include(cmake/mp.cmake)
+
+include(cmake/luarest.cmake)
+include(cmake/luasocket.cmake)
+include(cmake/luaoptional.cmake)
+
+include(cmake/pplib.cmake)
+include(cmake/miniz.cmake)
+include(cmake/softposit.cmake)
+
+include(cmake/luametatex.cmake)
diff --git a/source/luametatex/build.txt b/source/luametatex/build.txt
index aa81254e6..40d8553eb 100644
--- a/source/luametatex/build.txt
+++ b/source/luametatex/build.txt
@@ -1,43 +1,43 @@
-Hi,
-
-The build script produce efficient static binaries with only a couple of system libraries as
-dependency. ConTeXt will not depend on anything else than provided here. Lua is the extension
-language to be used and that has worked well for quite a while now.
-
-The build script that is provided will compile under ./build so you might want to make a copy
-of the source tree to a suitable place that you can wipe after the job is done. The script
-accepts only a few command line arguments.
-
- build.sh :
-
- --native build/native meant for unix (linux, freebsd, openbsd, osx, arm)
- --mingw-32 build/mingw-32 meant for 32 bit windows (crosscompiled)
- --mingw-64 build/mingw-64 meant for 64 bit windows (crosscompiled)
-
-I develop LuaMetaTeX on Windows and use WLS (with OpenSuse) for cross compilation as well as
-native Linux binaries. Editing is done in Visual Studio with the exception of the MetaPost
-CWeb files for which I use SciTE.
-
-Because we use CMake, you can compile using the MSVC compiler as well as CLang. Currently the
-MingW crosscompiled binaries are slightly faster, next come the native ones, but till now
-CLang lags behind. The native compiler produces the smallest binaries and compiles fastest.
-
- build.cmd :
-
- --x64 build/msvc-cmd-x64 meant for 64 bit windows using intel/amd chips
- --x32 build/msvc-cmd-x86 meant for 32 bit windows using intel/amd chips
- --arm64 build/msvc-cmd-arm64 meant for 64 bit windows using arm chips
-
-Alternatively you can run a build job from Visual Studio. Of course it only works well if you
-have the right compilers installed which is easy to do from the user interface. All settings
-happen in CMakeLists.txt so you have to load that one.
-
-Support for LuaMetaTeX and ConTeXt is provided at the (dev-)context mailing lists and at the
-ConTeXt Wiki. Binaries are available at:
-
- https://build.contextgarden.net/#/waterfall?tags=c.luametatex
- https://dl.contextgarden.net/build/luametatex
-
-The first link shows the status, the second link is where the binaries can be downloaded.
-
-Hans Hagen
+Hi,
+
+The build script produce efficient static binaries with only a couple of system libraries as
+dependency. ConTeXt will not depend on anything else than provided here. Lua is the extension
+language to be used and that has worked well for quite a while now.
+
+The build script that is provided will compile under ./build so you might want to make a copy
+of the source tree to a suitable place that you can wipe after the job is done. The script
+accepts only a few command line arguments.
+
+ build.sh :
+
+ --native build/native meant for unix (linux, freebsd, openbsd, osx, arm)
+ --mingw-32 build/mingw-32 meant for 32 bit windows (crosscompiled)
+ --mingw-64 build/mingw-64 meant for 64 bit windows (crosscompiled)
+
+I develop LuaMetaTeX on Windows and use WLS (with OpenSuse) for cross compilation as well as
+native Linux binaries. Editing is done in Visual Studio with the exception of the MetaPost
+CWeb files for which I use SciTE.
+
+Because we use CMake, you can compile using the MSVC compiler as well as CLang. Currently the
+MingW crosscompiled binaries are slightly faster, next come the native ones, but till now
+CLang lags behind. The native compiler produces the smallest binaries and compiles fastest.
+
+ build.cmd :
+
+ --x64 build/msvc-cmd-x64 meant for 64 bit windows using intel/amd chips
+ --x32 build/msvc-cmd-x86 meant for 32 bit windows using intel/amd chips
+ --arm64 build/msvc-cmd-arm64 meant for 64 bit windows using arm chips
+
+Alternatively you can run a build job from Visual Studio. Of course it only works well if you
+have the right compilers installed which is easy to do from the user interface. All settings
+happen in CMakeLists.txt so you have to load that one.
+
+Support for LuaMetaTeX and ConTeXt is provided at the (dev-)context mailing lists and at the
+ConTeXt Wiki. Binaries are available at:
+
+ https://build.contextgarden.net/#/waterfall?tags=c.luametatex
+ https://dl.contextgarden.net/build/luametatex
+
+The first link shows the status, the second link is where the binaries can be downloaded.
+
+Hans Hagen
diff --git a/source/luametatex/source/libraries/avl/readme.txt b/source/luametatex/source/libraries/avl/readme.txt
index 90ff0949b..9b4708248 100644
--- a/source/luametatex/source/libraries/avl/readme.txt
+++ b/source/luametatex/source/libraries/avl/readme.txt
@@ -1,23 +1,23 @@
-Remark
-
-Usage of the avl library (irr) showed up in pdfTeX when Hartmut added some functionality. It therefore
-also ended up in being used in LuaTeX. The two files avl.c and avl.h come from pyavl and are in the
-public domain:
-
- license: this package, pyavl, is donated to the public domain
- author : Richard McGraw
- email : dasnar@fastmail.fm
-
-In the pdfTeX/LuaTeX the files were just there but I could track them down to
-
- https://github.com/pankajp/pyavl
-
-where the dates indicate that nothing has changed in the meantime. In the copies used here I added the
-information mentioned above. The files had some (experimental) code as well as optional testing on NULL
-values. As I don't expect updates (the code has been okay for quite a while) I made the tests mandate
-and removed the experimental code.
-
-We can strip this library and save some 10K on the binary because we don't need that much of it. That
-might happen at some point.
-
+Remark
+
+Usage of the avl library (irr) showed up in pdfTeX when Hartmut added some functionality. It therefore
+also ended up in being used in LuaTeX. The two files avl.c and avl.h come from pyavl and are in the
+public domain:
+
+ license: this package, pyavl, is donated to the public domain
+ author : Richard McGraw
+ email : dasnar@fastmail.fm
+
+In the pdfTeX/LuaTeX the files were just there but I could track them down to
+
+ https://github.com/pankajp/pyavl
+
+where the dates indicate that nothing has changed in the meantime. In the copies used here I added the
+information mentioned above. The files had some (experimental) code as well as optional testing on NULL
+values. As I don't expect updates (the code has been okay for quite a while) I made the tests mandate
+and removed the experimental code.
+
+We can strip this library and save some 10K on the binary because we don't need that much of it. That
+might happen at some point.
+
Hans Hagen \ No newline at end of file
diff --git a/source/luametatex/source/libraries/libcerf/readme-luametatex.txt b/source/luametatex/source/libraries/libcerf/readme-luametatex.txt
index bb552f263..4ba0240e1 100644
--- a/source/luametatex/source/libraries/libcerf/readme-luametatex.txt
+++ b/source/luametatex/source/libraries/libcerf/readme-luametatex.txt
@@ -1,26 +1,26 @@
-LS,
-
-In the following files you can find the comment below. We don't want to bother or burden the
-original authors with our problems. The cerf code is mostly used in MetaFun macros (by Alan
-Braslau). The c.h and cpp.h files are gone.
-
- defs.h
- cerf.h
-
----------------------------------------------------------------------------------------------
-This file is patched by Mojca Miklavec and Hans Hagen for usage in LuaMetaTeX where we use
-only C and also want to compile with the Microsoft compiler. So, when updating this library
-one has to check for changes. Not that we expect many as this is a rather stable library.
-
-In the other files there are a few macros used that deal with the multiplication and addition
-of complex and real nmbers. Of course the original code is kept as-is.
----------------------------------------------------------------------------------------------
-
-So, when updating the library you need to diff for the changes that are needed in order to
-compile the files with the Microsoft compiler.
-
-At some point I might patch the files so that we can intercept error messages in a way that
-permits recovery and also plugs them into our normal message handlers. Maybe I should also
-merge the code into just one file because it doesn't change.
-
-Hans
+LS,
+
+In the following files you can find the comment below. We don't want to bother or burden the
+original authors with our problems. The cerf code is mostly used in MetaFun macros (by Alan
+Braslau). The c.h and cpp.h files are gone.
+
+ defs.h
+ cerf.h
+
+---------------------------------------------------------------------------------------------
+This file is patched by Mojca Miklavec and Hans Hagen for usage in LuaMetaTeX where we use
+only C and also want to compile with the Microsoft compiler. So, when updating this library
+one has to check for changes. Not that we expect many as this is a rather stable library.
+
+In the other files there are a few macros used that deal with the multiplication and addition
+of complex and real nmbers. Of course the original code is kept as-is.
+---------------------------------------------------------------------------------------------
+
+So, when updating the library you need to diff for the changes that are needed in order to
+compile the files with the Microsoft compiler.
+
+At some point I might patch the files so that we can intercept error messages in a way that
+permits recovery and also plugs them into our normal message handlers. Maybe I should also
+merge the code into just one file because it doesn't change.
+
+Hans
diff --git a/source/luametatex/source/libraries/miniz/readme.txt b/source/luametatex/source/libraries/miniz/readme.txt
index 8a5e6979e..4527133d7 100644
--- a/source/luametatex/source/libraries/miniz/readme.txt
+++ b/source/luametatex/source/libraries/miniz/readme.txt
@@ -1,8 +1,8 @@
-Remark
-
-Conform the recommendation we use the official merged files (release) not the github files. Also, we
-only use part of that single file because we do all file handling ourselves because we operate within
-the file name regime of LuaMetaTeX that is aware of operating system specifics like wide filenames on
-MSWindows). We don't drop in updates without careful checking them first for potential clashes.\\
-
+Remark
+
+Conform the recommendation we use the official merged files (release) not the github files. Also, we
+only use part of that single file because we do all file handling ourselves because we operate within
+the file name regime of LuaMetaTeX that is aware of operating system specifics like wide filenames on
+MSWindows). We don't drop in updates without careful checking them first for potential clashes.\\
+
release url: https://github.com/richgel999/miniz/releases \ No newline at end of file
diff --git a/source/luametatex/source/libraries/pplib/ppapi.h b/source/luametatex/source/libraries/pplib/ppapi.h
index e9ced5718..56137f8f2 100644
--- a/source/luametatex/source/libraries/pplib/ppapi.h
+++ b/source/luametatex/source/libraries/pplib/ppapi.h
@@ -8,7 +8,7 @@
#include "ppconf.h"
-#define pplib_version "v2.1"
+#define pplib_version "v2.2"
#define pplib_author "p.jackowski@gust.org.pl"
/* types */
diff --git a/source/luametatex/source/libraries/pplib/ppcrypt.c b/source/luametatex/source/libraries/pplib/ppcrypt.c
index ce63e7cab..832e8c327 100644
--- a/source/luametatex/source/libraries/pplib/ppcrypt.c
+++ b/source/luametatex/source/libraries/pplib/ppcrypt.c
@@ -137,7 +137,7 @@ static int ppcrypt_password_encoding (uint8_t *password, size_t *passwordlength)
{
uint8_t *p, newpassword[PPCRYPT_MAX_PASSWORD], *n;
const uint8_t *e;
- uint32_t unicode;
+ uint32_t unicode = 0;
for (n = &newpassword[0], p = &password[0], e = p + *passwordlength; p < e; ++n)
{
@@ -398,7 +398,10 @@ static ppcrypt_status ppcrypt_authenticate_permissions (ppcrypt *crypt, ppstring
aes_decode_data(perms->data, perms->size, permsdata, crypt->filekey, crypt->filekeylength, nulliv, AES_NULL_PADDING);
if (permsdata[9] != 'a' || permsdata[10] != 'd' || permsdata[11] != 'b')
- return PPCRYPT_FAIL;
+ { /* if we get here, the password hash is correct, we don't need to fail because of unreadable perms (found such docs) */
+ crypt->flags |= PPCRYPT_UNREADABLE_PERMISSIONS;
+ return PPCRYPT_DONE;
+ }
/* do not check/update permissions flags here; they might be different inside crypt string */
if (0)
diff --git a/source/luametatex/source/libraries/pplib/ppcrypt.h b/source/luametatex/source/libraries/pplib/ppcrypt.h
index 9fa52d878..a7131adbb 100644
--- a/source/luametatex/source/libraries/pplib/ppcrypt.h
+++ b/source/luametatex/source/libraries/pplib/ppcrypt.h
@@ -46,6 +46,7 @@ typedef struct {
#define PPCRYPT_STRING_RC4 (1<<4)
#define PPCRYPT_STREAM_AES (1<<5)
#define PPCRYPT_STRING_AES (1<<6)
+#define PPCRYPT_UNREADABLE_PERMISSIONS (1<<7)
#define PPCRYPT_STREAM (PPCRYPT_STREAM_AES|PPCRYPT_STREAM_RC4)
#define PPCRYPT_STRING (PPCRYPT_STRING_AES|PPCRYPT_STRING_RC4)
diff --git a/source/luametatex/source/libraries/pplib/readme.txt b/source/luametatex/source/libraries/pplib/readme.txt
index ee5d141dc..550367a28 100644
--- a/source/luametatex/source/libraries/pplib/readme.txt
+++ b/source/luametatex/source/libraries/pplib/readme.txt
@@ -1,3 +1,3 @@
-This is (to be) added to util/utilflate.c:
-
-# include "../../utilities/auxzlib.h"
+This is (to be) added to util/utilflate.c:
+
+# include "../../utilities/auxzlib.h"
diff --git a/source/luametatex/source/libraries/readme.txt b/source/luametatex/source/libraries/readme.txt
index f249eae99..a4ccbfc0b 100644
--- a/source/luametatex/source/libraries/readme.txt
+++ b/source/luametatex/source/libraries/readme.txt
@@ -1,37 +1,37 @@
-Nota bene,
-
-The currently embedded libcerf library might become an optional one as soon as we decide to provide
-it as such. It doesn't put a dent in filesize but as it's used rarely (and mostly as complement to
-the complex math support) that makes sense. The library was added because some users wanted it as
-companion the other math libraries and because TeX is often about math it sort of feels okay. But
-it looks like there will never be support for the MSVC compiler. Mojca and I (Hans) adapted the
-sources included here to compile out of the box, but that didn't make it back into the original.
-
-The pplib library has a few patches with respect to memory allocation and zip compression so that
-we can hook in the minizip and mimalloc alternatives.
-
-The avl and hnj libraries are adapted to Lua(Meta)TeX and might get some more adaptations depending
-on our needs. The decnumber library that is also used in mplib is unchanged.
-
-In mimalloc we need to patch init.c: #if defined(_M_X64) || defined(_M_ARM64) to get rid of a link
-error as well as in options.c some snprint issue with the mingw64 cross compiler:
-
-/* HH */ snprintf(tprefix, sizeof(tprefix), "%sthread 0x%x: ", prefix, (unsigned) _mi_thread_id()); /* HH: %z is unknown */
-
-In decNumber.c this got added:
-
-# include "../../utilities/auxmemory.h"
-# define malloc lmt_memory_malloc
-# define free lmt_memory_free
-
-In softposit/source/include/softposit_types.h we have to comment the initializations in the unions
-bcause the compiler complains about it (we're not using c++). So:
-
-uint32_t ui; // =0; // patched by HH because the compilers don't like this
-uint64_t ui[2]; // ={0,0}; // idem
-uint64_t ui[8]; // ={0,0,0,0, 0,0,0,0}; // idme
-uint64_t ui[8]; // ={0,0,0,0, 0,0,0,0}; // idem
-uint64_t ui[8]; // ={0,0,0,0, 0,0,0,0}; // idem
-
-
+Nota bene,
+
+The currently embedded libcerf library might become an optional one as soon as we decide to provide
+it as such. It doesn't put a dent in filesize but as it's used rarely (and mostly as complement to
+the complex math support) that makes sense. The library was added because some users wanted it as
+companion the other math libraries and because TeX is often about math it sort of feels okay. But
+it looks like there will never be support for the MSVC compiler. Mojca and I (Hans) adapted the
+sources included here to compile out of the box, but that didn't make it back into the original.
+
+The pplib library has a few patches with respect to memory allocation and zip compression so that
+we can hook in the minizip and mimalloc alternatives.
+
+The avl and hnj libraries are adapted to Lua(Meta)TeX and might get some more adaptations depending
+on our needs. The decnumber library that is also used in mplib is unchanged.
+
+In mimalloc we need to patch init.c: #if defined(_M_X64) || defined(_M_ARM64) to get rid of a link
+error as well as in options.c some snprint issue with the mingw64 cross compiler:
+
+/* HH */ snprintf(tprefix, sizeof(tprefix), "%sthread 0x%x: ", prefix, (unsigned) _mi_thread_id()); /* HH: %z is unknown */
+
+In decNumber.c this got added:
+
+# include "../../utilities/auxmemory.h"
+# define malloc lmt_memory_malloc
+# define free lmt_memory_free
+
+In softposit/source/include/softposit_types.h we have to comment the initializations in the unions
+bcause the compiler complains about it (we're not using c++). So:
+
+uint32_t ui; // =0; // patched by HH because the compilers don't like this
+uint64_t ui[2]; // ={0,0}; // idem
+uint64_t ui[8]; // ={0,0,0,0, 0,0,0,0}; // idme
+uint64_t ui[8]; // ={0,0,0,0, 0,0,0,0}; // idem
+uint64_t ui[8]; // ={0,0,0,0, 0,0,0,0}; // idem
+
+
Hans \ No newline at end of file
diff --git a/source/luametatex/source/license.txt b/source/luametatex/source/license.txt
index f98c98819..31f70ac1c 100644
--- a/source/luametatex/source/license.txt
+++ b/source/luametatex/source/license.txt
@@ -1,181 +1,181 @@
-------------------------------------------------------------------------------------------
-PREAMBLE
-------------------------------------------------------------------------------------------
-
-The LuaMetaTeX program is a light weight variant of LuaTeX. This program finds its origin
-in parts of TeX (the original program, eTeX (some extensions), pdfTeX (more extensions)
-Aleph (based on Omega, directions) and of course LuaTeX (lots of things).
-
-So, basically we follow up on LuaTeX which itself is a follow up on TeX, eTeX, pdfTeX and
-Aleph. The actual starting point (in 2005) was a special Lua enhanced version of pdfTeX
-by Hartmut Henkel that we experimented with and triggered a follow up. However, the code
-base is no longer Pascal (which then gets converted to C) but regular C code instead. That
-conversion was done by Taco Hoekwater as part of the Oriental TeX project.
-
-There are many articles (presentations and documents) that discuss the development history.
-These articles and documents describing the projects shed more light on what functionality
-showed up when and why. As these projects closely relate to ConTeXt development you can
-find those documents in the ConTeXt distribution.
-
-After this conversion quite some implementation details changed over the decade that
-followed: memory management was adapted, string handling became dynamic, managing the
-table of equivalents was tuned to the mix, callbacks were added. The opening up resulted in
-some adaption of the internals too. Font handling changed, math support for opentype math
-has been introduced. Hyphenation handling, ligature building and kerning are clearly
-separated and language support has been rewritten from scratch. In addition to Lua, the
-TeX engine is also complemented by the MetaPost library. Luigi Scarso added support for
-LuaJIT and ffi and over time makes sure that the code works out okay in the regular
-TeXLive build too.
-
-In 2018-2019 the conversion from LuaTeX to LuaMetaTeX was done by Hans Hagen as part of
-an attempt to simplify the build and get rid of code that might have been useful when we
-started but no longer makes sense. Because the LuaTeX interfaces had to stabelize, this
-follow up also provides us a new testbed. The LuaMetaTeX source code is distributed as
-part of the ConTeXt distribution which is also used for testing and development. Most
-tests are done by those involved in ConTeXt development, so issues should be reported to
-the mailing lists related to this macro package.
-
-In the process the code base has been adapted substantially, although the decade of
-LuaTeX development already prepared for that. This also leads occasionally instable
-setups. We're grateful to ConTeXt community for their patience in testing these continuous
-developments.
-
-The license below is from LuaTeX and also applies to LuaMetaTeX. Although other team
-members contribute(d) to the code, we stick to this description. The --credits option
-provides more information.
-
-------------------------------------------------------------------------------------------
-EXCUSE
-------------------------------------------------------------------------------------------
-
-Although some code comes from pdfTeX and Aleph, the majority comes from good old TeX and
-eTeX or is completely new. Original TeX is a well documented program written in WEB and
-those building upon it have added comments. In LuaMetaTeX we use plain C files but the
-comments are still mostly present. When you read them you really need to keep in mind that
-some refer to good old TeX! The nice comments come from Don Knuth, the bad and fuzzy ones
-originate at us. We appologize to Don for this.
-
-------------------------------------------------------------------------------------------
-CREDITS
-------------------------------------------------------------------------------------------
-
-LuaMetaTeX builds upon the code from LuaTeX which comes from:
-
- tex : Donald Knuth
- etex : Peter Breitenlohner, Phil Taylor and friends
-
-The expansion and protrusion code is derived from:
-
- pdftex : Han The Thanh and friends
-
-Some of the bidirectional text flow model is taken from:
-
- omega : John Plaice and Yannis Haralambous
- aleph : Giuseppe Bilotta
-
-Graphic support is provided by:
-
- metapost : John Hobby, Taco Hoekwater, Luigi Scarso, Hans Hagen and friends
-
-All this is opened up with:
-
- lua : Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de Figueiredo
- lpeg : Roberto Ierusalimschy
-
-A few libraries are embedded, of which we mention:
-
- avl : Richard McGraw (adapted)
- decnumber : Mike Cowlishaw (IBM)
- libcerf : Joachim Wuttke (adapted to msvc)
- md5 : Peter Deutsch (with partial code from pplib libraries)
- pplib : Paweł Jackowski (with partial code from libraries)
- sha2 : Aaron D. Gifford (with partial code from pplib libraries)
- socket : Diego Nehab (partial and adapted)
- # zlib : Jean-loup Gailly and Mark Adler
- miniz : Rich Geldreich etc.
- mimalloc : Daan Leijen (Microsoft Research)
-
-The code base contains more names and references. Some libraries are partially adapted. We
-use an adapted version of the lfs from the Kepler Project. Also, MetaPost used decNumber
-for decimal number mode.
-
-Depending on demand a few optional libraries can be used, for instance curl, imagemagick,
-lz4, lzo, mujs, mysql, sqlite and zint but there are no dependencies and only very limited
-interfaces are provided (ConTeXt provides \LUA\ layers on top).
-
-------------------------------------------------------------------------------------------
-TEAM
-------------------------------------------------------------------------------------------
-
-LuaTeX : Hans Hagen, Hartmut Henkel, Taco Hoekwater, Luigi Scarso
-LuaMetaTeX : Hans Hagen, Wolfgang Schuster, Mojca Miklavec, Alan Braslau
-
-------------------------------------------------------------------------------------------
-MAIN LICENSE (consider it part of each file that refers to this file)
-------------------------------------------------------------------------------------------
-
-Copyright Taco Hoekwater & Hans Hagen & Wolfgang Schuster
-
-This file is part of LuaMetaTeX.
-
-LuaMetaTeX is free software; you can redistribute it and/or modify it under the terms of
-the GNU General Public License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-LuaMetaTeX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-See the GNU Lesser General Public License for more details.
-
-You could have received a copy of the GNU General Public License along with LuaMetaTeX; if
-not, see <http://www.gnu.org/licenses/>.
-
-------------------------------------------------------------------------------------------
-REMARK
-------------------------------------------------------------------------------------------
-
-The Lua(Meta)TeX team can always decide to relicense to a variant licence in the future,
-but please don't start one of these religious licence discussions with us. We like what
-we're doing, we permits others to use it, and that is the bottomline.
-
-------------------------------------------------------------------------------------------
-OTHER LICENSES
-------------------------------------------------------------------------------------------
-
-The files taken from elsewhere have their own license information at the top of the files
-or in a file their path. It's a mixed bag but basically all permit usage and extensions.
-
-------------------------------------------------------------------------------------------
-BUILD | FARM | REPOSITORIES
-------------------------------------------------------------------------------------------
-
-Mojca Miklavec, Hans Hagen, Alan Braslau
-
-------------------------------------------------------------------------------------------
-CONTEXT MKII | MKIV | LMTX
-------------------------------------------------------------------------------------------
-
-Hans Hagen, Wolfgang Schuster, etc
-
-------------------------------------------------------------------------------------------
-WEBSITE
-------------------------------------------------------------------------------------------
-
-http://www.luatex.org
-http://contextgarden.net
-http://www.pragma-ade.com / http://www.pragma-nl.com
-
-------------------------------------------------------------------------------------------
-SUPPORT
-------------------------------------------------------------------------------------------
-
-http://www.ntg.nl/mailman/listinfo/ntg-context
-http://www.ntg.nl/mailman/listinfo/dev-context
-
-------------------------------------------------------------------------------------------
-MORE LINKS
-------------------------------------------------------------------------------------------
-
-http://www.ntg.nl
-http://www.tug.org
-
-------------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------------
+PREAMBLE
+------------------------------------------------------------------------------------------
+
+The LuaMetaTeX program is a light weight variant of LuaTeX. This program finds its origin
+in parts of TeX (the original program, eTeX (some extensions), pdfTeX (more extensions)
+Aleph (based on Omega, directions) and of course LuaTeX (lots of things).
+
+So, basically we follow up on LuaTeX which itself is a follow up on TeX, eTeX, pdfTeX and
+Aleph. The actual starting point (in 2005) was a special Lua enhanced version of pdfTeX
+by Hartmut Henkel that we experimented with and triggered a follow up. However, the code
+base is no longer Pascal (which then gets converted to C) but regular C code instead. That
+conversion was done by Taco Hoekwater as part of the Oriental TeX project.
+
+There are many articles (presentations and documents) that discuss the development history.
+These articles and documents describing the projects shed more light on what functionality
+showed up when and why. As these projects closely relate to ConTeXt development you can
+find those documents in the ConTeXt distribution.
+
+After this conversion quite some implementation details changed over the decade that
+followed: memory management was adapted, string handling became dynamic, managing the
+table of equivalents was tuned to the mix, callbacks were added. The opening up resulted in
+some adaption of the internals too. Font handling changed, math support for opentype math
+has been introduced. Hyphenation handling, ligature building and kerning are clearly
+separated and language support has been rewritten from scratch. In addition to Lua, the
+TeX engine is also complemented by the MetaPost library. Luigi Scarso added support for
+LuaJIT and ffi and over time makes sure that the code works out okay in the regular
+TeXLive build too.
+
+In 2018-2019 the conversion from LuaTeX to LuaMetaTeX was done by Hans Hagen as part of
+an attempt to simplify the build and get rid of code that might have been useful when we
+started but no longer makes sense. Because the LuaTeX interfaces had to stabelize, this
+follow up also provides us a new testbed. The LuaMetaTeX source code is distributed as
+part of the ConTeXt distribution which is also used for testing and development. Most
+tests are done by those involved in ConTeXt development, so issues should be reported to
+the mailing lists related to this macro package.
+
+In the process the code base has been adapted substantially, although the decade of
+LuaTeX development already prepared for that. This also leads occasionally instable
+setups. We're grateful to ConTeXt community for their patience in testing these continuous
+developments.
+
+The license below is from LuaTeX and also applies to LuaMetaTeX. Although other team
+members contribute(d) to the code, we stick to this description. The --credits option
+provides more information.
+
+------------------------------------------------------------------------------------------
+EXCUSE
+------------------------------------------------------------------------------------------
+
+Although some code comes from pdfTeX and Aleph, the majority comes from good old TeX and
+eTeX or is completely new. Original TeX is a well documented program written in WEB and
+those building upon it have added comments. In LuaMetaTeX we use plain C files but the
+comments are still mostly present. When you read them you really need to keep in mind that
+some refer to good old TeX! The nice comments come from Don Knuth, the bad and fuzzy ones
+originate at us. We appologize to Don for this.
+
+------------------------------------------------------------------------------------------
+CREDITS
+------------------------------------------------------------------------------------------
+
+LuaMetaTeX builds upon the code from LuaTeX which comes from:
+
+ tex : Donald Knuth
+ etex : Peter Breitenlohner, Phil Taylor and friends
+
+The expansion and protrusion code is derived from:
+
+ pdftex : Han The Thanh and friends
+
+Some of the bidirectional text flow model is taken from:
+
+ omega : John Plaice and Yannis Haralambous
+ aleph : Giuseppe Bilotta
+
+Graphic support is provided by:
+
+ metapost : John Hobby, Taco Hoekwater, Luigi Scarso, Hans Hagen and friends
+
+All this is opened up with:
+
+ lua : Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de Figueiredo
+ lpeg : Roberto Ierusalimschy
+
+A few libraries are embedded, of which we mention:
+
+ avl : Richard McGraw (adapted)
+ decnumber : Mike Cowlishaw (IBM)
+ libcerf : Joachim Wuttke (adapted to msvc)
+ md5 : Peter Deutsch (with partial code from pplib libraries)
+ pplib : Paweł Jackowski (with partial code from libraries)
+ sha2 : Aaron D. Gifford (with partial code from pplib libraries)
+ socket : Diego Nehab (partial and adapted)
+ # zlib : Jean-loup Gailly and Mark Adler
+ miniz : Rich Geldreich etc.
+ mimalloc : Daan Leijen (Microsoft Research)
+
+The code base contains more names and references. Some libraries are partially adapted. We
+use an adapted version of the lfs from the Kepler Project. Also, MetaPost used decNumber
+for decimal number mode.
+
+Depending on demand a few optional libraries can be used, for instance curl, imagemagick,
+lz4, lzo, mujs, mysql, sqlite and zint but there are no dependencies and only very limited
+interfaces are provided (ConTeXt provides \LUA\ layers on top).
+
+------------------------------------------------------------------------------------------
+TEAM
+------------------------------------------------------------------------------------------
+
+LuaTeX : Hans Hagen, Hartmut Henkel, Taco Hoekwater, Luigi Scarso
+LuaMetaTeX : Hans Hagen, Wolfgang Schuster, Mojca Miklavec, Alan Braslau
+
+------------------------------------------------------------------------------------------
+MAIN LICENSE (consider it part of each file that refers to this file)
+------------------------------------------------------------------------------------------
+
+Copyright Taco Hoekwater & Hans Hagen & Wolfgang Schuster
+
+This file is part of LuaMetaTeX.
+
+LuaMetaTeX is free software; you can redistribute it and/or modify it under the terms of
+the GNU General Public License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+LuaMetaTeX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU Lesser General Public License for more details.
+
+You could have received a copy of the GNU General Public License along with LuaMetaTeX; if
+not, see <http://www.gnu.org/licenses/>.
+
+------------------------------------------------------------------------------------------
+REMARK
+------------------------------------------------------------------------------------------
+
+The Lua(Meta)TeX team can always decide to relicense to a variant licence in the future,
+but please don't start one of these religious licence discussions with us. We like what
+we're doing, we permits others to use it, and that is the bottomline.
+
+------------------------------------------------------------------------------------------
+OTHER LICENSES
+------------------------------------------------------------------------------------------
+
+The files taken from elsewhere have their own license information at the top of the files
+or in a file their path. It's a mixed bag but basically all permit usage and extensions.
+
+------------------------------------------------------------------------------------------
+BUILD | FARM | REPOSITORIES
+------------------------------------------------------------------------------------------
+
+Mojca Miklavec, Hans Hagen, Alan Braslau
+
+------------------------------------------------------------------------------------------
+CONTEXT MKII | MKIV | LMTX
+------------------------------------------------------------------------------------------
+
+Hans Hagen, Wolfgang Schuster, etc
+
+------------------------------------------------------------------------------------------
+WEBSITE
+------------------------------------------------------------------------------------------
+
+http://www.luatex.org
+http://contextgarden.net
+http://www.pragma-ade.com / http://www.pragma-nl.com
+
+------------------------------------------------------------------------------------------
+SUPPORT
+------------------------------------------------------------------------------------------
+
+http://www.ntg.nl/mailman/listinfo/ntg-context
+http://www.ntg.nl/mailman/listinfo/dev-context
+
+------------------------------------------------------------------------------------------
+MORE LINKS
+------------------------------------------------------------------------------------------
+
+http://www.ntg.nl
+http://www.tug.org
+
+------------------------------------------------------------------------------------------
diff --git a/source/luametatex/source/lua/lmtcallbacklib.c b/source/luametatex/source/lua/lmtcallbacklib.c
index a971b5e57..ec9788c13 100644
--- a/source/luametatex/source/lua/lmtcallbacklib.c
+++ b/source/luametatex/source/lua/lmtcallbacklib.c
@@ -54,6 +54,7 @@ static const char *callbacklib_names[total_callbacks] = {
"show_warning_message",
"hpack_quality",
"vpack_quality",
+ "show_break",
"insert_par",
"append_line_filter",
"build_page_insert",
@@ -307,7 +308,7 @@ static int callbacklib_aux_run(lua_State *L, int id, int special, const char *va
return tex_formatted_error("callback", "string expected, not: %s\n", lua_typename(L, t));
}
break;
- case callback_result_key:
+ case callback_result_s_key:
switch (t) {
case LUA_TNIL:
*va_arg(vl, int *) = 0;
@@ -342,6 +343,16 @@ static int callbacklib_aux_run(lua_State *L, int id, int special, const char *va
return tex_formatted_error("callback", "string, false or nil expected, not: %s\n", lua_typename(L, t));
}
break;
+ case callback_result_i_key:
+ switch (t) {
+ case LUA_TNUMBER:
+ *va_arg(vl, int *) = lmt_tointeger(L, nres);
+ break;
+ default:
+ /* *va_arg(vl, int *) = 0; */ /*tex We keep the value! */
+ break;
+ }
+ break;
default:
return tex_formatted_error("callback", "invalid value type returned\n");
}
diff --git a/source/luametatex/source/lua/lmtcallbacklib.h b/source/luametatex/source/lua/lmtcallbacklib.h
index 7801e1a70..50b1cb4d1 100644
--- a/source/luametatex/source/lua/lmtcallbacklib.h
+++ b/source/luametatex/source/lua/lmtcallbacklib.h
@@ -40,6 +40,7 @@ typedef enum callback_callback_types {
show_warning_message_callback,
hpack_quality_callback,
vpack_quality_callback,
+ show_break_callback,
insert_par_callback,
append_line_filter_callback,
build_page_insert_callback,
@@ -80,7 +81,8 @@ typedef enum callback_keys {
callback_lstring_key = 'L', /*tex a \LUA\ string (struct) */
callback_node_key = 'N', /*tex a \TEX\ node (halfword) */
callback_string_key = 'S', /*tex a \CCODE\ string */
- callback_result_key = 'R', /*tex a string (return value) but nil is also okay */
+ callback_result_s_key = 'R', /*tex a string (return value) but nil is also okay */
+ callback_result_i_key = 'r', /*tex a number (return value) but nil is also okay */
} callback_keys;
inline static int lmt_callback_defined (int a) { return lmt_callback_state.values[a]; }
diff --git a/source/luametatex/source/lua/lmtinterface.c b/source/luametatex/source/lua/lmtinterface.c
index 2c94feb6f..5132606de 100644
--- a/source/luametatex/source/lua/lmtinterface.c
+++ b/source/luametatex/source/lua/lmtinterface.c
@@ -174,6 +174,20 @@ void lmt_initialize_interface(void)
set_alignment_context_value(package_pass_alignment_context, package);
set_alignment_context_value(wrapup_pass_alignment_context, wrapup);
+ lmt_interface.break_context_values = lmt_aux_allocate_value_info(wrapup_show_breaks_context);
+
+ # define set_break_context_value(n,k) lmt_interface.break_context_values[n] = (value_info) { .lua = lua_key_index(k), .name = lua_key(k), .id = n }
+
+ set_break_context_value(initialize_show_breaks_context, initialize);
+ set_break_context_value(start_show_breaks_context, start);
+ set_break_context_value(list_show_breaks_context, list);
+ set_break_context_value(stop_show_breaks_context, stop);
+ set_break_context_value(collect_show_breaks_context, collect);
+ set_break_context_value(line_show_breaks_context, line);
+ set_break_context_value(delete_show_breaks_context, delete);
+ set_break_context_value(report_show_breaks_context, report);
+ set_break_context_value(wrapup_show_breaks_context, wrapup);
+
lmt_interface.par_begin_values = lmt_aux_allocate_value_info(vrule_char_par_begin);
# define set_par_begin_value(n,k) lmt_interface.par_begin_values[n] = (value_info) { .lua = lua_key_index(k), .name = lua_key(k), .id = n }
diff --git a/source/luametatex/source/lua/lmtinterface.h b/source/luametatex/source/lua/lmtinterface.h
index 47460acac..ea6ead4ab 100644
--- a/source/luametatex/source/lua/lmtinterface.h
+++ b/source/luametatex/source/lua/lmtinterface.h
@@ -341,6 +341,7 @@ typedef struct lmt_interface_info {
value_info *page_context_values;
value_info *append_line_context_values;
value_info *alignment_context_values;
+ value_info *break_context_values;
value_info *par_begin_values;
value_info *par_mode_values;
value_info *math_style_name_values;
@@ -540,6 +541,7 @@ make_lua_key(L, clubpenalty);\
make_lua_key(L, cmd);\
make_lua_key(L, cmdname);\
make_lua_key(L, collapse);\
+make_lua_key(L, collect);\
make_lua_key(L, combine_toks);\
make_lua_key(L, command);\
make_lua_key(L, comment);\
@@ -576,6 +578,7 @@ make_lua_key(L, define_font);\
make_lua_key(L, define_lua_call);\
make_lua_key(L, degree);\
make_lua_key(L, degreevariant);\
+make_lua_key(L, delete);\
make_lua_key(L, delimited);\
make_lua_key(L, DelimitedSubFormulaMinHeight);\
make_lua_key(L, delimiter);\
@@ -762,6 +765,7 @@ make_lua_key(L, index);\
make_lua_key(L, info);\
make_lua_key(L, Info);\
make_lua_key(L, inherited);\
+make_lua_key(L, initialize);\
make_lua_key(L, inner);\
make_lua_key(L, innerlocation);\
make_lua_key(L, innerxoffset);\
@@ -1113,6 +1117,7 @@ make_lua_key(L, relax);\
make_lua_key(L, remove_item);\
make_lua_key(L, repeat);\
make_lua_key(L, replace);\
+make_lua_key(L, report);\
make_lua_key(L, reserved);\
make_lua_key(L, reset);\
make_lua_key(L, rhmin);\
@@ -1170,6 +1175,7 @@ make_lua_key(L, shrink);\
make_lua_key(L, shrinkorder);\
make_lua_key(L, simple);\
make_lua_key(L, size);\
+make_lua_key(L, single);\
make_lua_key(L, skewchar);\
make_lua_key(L, SkewedDelimiterTolerance);\
make_lua_key(L, skeweddelimitertolerance);\
@@ -1222,6 +1228,7 @@ make_lua_key(L, stackvgap);\
make_lua_key(L, start);\
make_lua_key(L, state);\
make_lua_key(L, step);\
+make_lua_key(L, stop);\
make_lua_key(L, stretch);\
make_lua_key(L, stretchorder);\
make_lua_key(L, StretchStackBottomShiftDown);\
diff --git a/source/luametatex/source/lua/lmtnodelib.c b/source/luametatex/source/lua/lmtnodelib.c
index 7896eff65..ba2d0f0ba 100644
--- a/source/luametatex/source/lua/lmtnodelib.c
+++ b/source/luametatex/source/lua/lmtnodelib.c
@@ -548,7 +548,7 @@ static int nodelib_direct_setfont(lua_State *L)
case rule_node:
tex_set_rule_font(n, lmt_tohalfword(L, 2));
if (lua_type(L, 3) == LUA_TNUMBER) {
- rule_character(n) = lmt_tohalfword(L, 3);
+ rule_strut_character(n) = lmt_tohalfword(L, 3);
}
break;
case glue_node:
@@ -617,7 +617,7 @@ static int nodelib_direct_getchar(lua_State *L)
lua_pushinteger(L, glyph_character(n));
break;
case rule_node:
- lua_pushinteger(L, rule_character(n));
+ lua_pushinteger(L, rule_strut_character(n));
break;
case math_char_node:
case math_text_char_node:
@@ -646,7 +646,7 @@ static int nodelib_direct_setchar(lua_State *L)
glyph_character(n) = lmt_tohalfword(L, 2);
break;
case rule_node:
- rule_character(n) = lmt_tohalfword(L, 2);
+ rule_strut_character(n) = lmt_tohalfword(L, 2);
break;
case math_char_node:
case math_text_char_node:
@@ -674,7 +674,7 @@ static int nodelib_direct_getcharspec(lua_State *L)
lua_pushinteger(L, glyph_font(n));
return 2;
case rule_node:
- lua_pushinteger(L, rule_character(n));
+ lua_pushinteger(L, rule_strut_character(n));
lua_pushinteger(L, tex_get_rule_font(n, text_style));
break;
case simple_noad:
@@ -1489,8 +1489,8 @@ static int nodelib_direct_getoffsets(lua_State *L)
case rule_node:
lua_pushinteger(L, rule_x_offset(n));
lua_pushinteger(L, rule_y_offset(n));
- lua_pushinteger(L, rule_left(n));
- lua_pushinteger(L, rule_right(n));
+ lua_pushinteger(L, tex_get_rule_left(n));
+ lua_pushinteger(L, tex_get_rule_right(n));
return 4;
}
}
@@ -1537,10 +1537,10 @@ static int nodelib_direct_setoffsets(lua_State *L)
rule_y_offset(n) = (halfword) lmt_roundnumber(L, 3);
}
if (lua_type(L, 4) == LUA_TNUMBER) {
- rule_left(n) = (halfword) lmt_roundnumber(L, 4);
+ tex_set_rule_left(n, (halfword) lmt_roundnumber(L, 4));
}
if (lua_type(L, 5) == LUA_TNUMBER) {
- rule_right(n) = (halfword) lmt_roundnumber(L, 5);
+ tex_set_rule_right(n, (halfword) lmt_roundnumber(L, 5));
}
break;
}
@@ -1610,10 +1610,10 @@ static int nodelib_direct_addmargins(lua_State *L)
break;
case rule_node:
if (lua_type(L, 2) == LUA_TNUMBER) {
- rule_left(n) += (halfword) lmt_roundnumber(L, 2);
+ tex_set_rule_left(n, tex_get_rule_left(n) + (halfword) lmt_roundnumber(L, 2));
}
if (lua_type(L, 3) == LUA_TNUMBER) {
- rule_right(n) += (halfword) lmt_roundnumber(L, 3);
+ tex_set_rule_right(n, tex_get_rule_right(n) + (halfword) lmt_roundnumber(L, 3));
}
break;
}
@@ -2907,9 +2907,9 @@ static int nodelib_direct_getruledimensions(lua_State *L)
halfword n = nodelib_valid_direct_from_index(L, 1);
if (n && node_type(n) == rule_node) {
if (node_subtype(n) == virtual_rule_subtype) {
- lua_pushinteger(L, rule_data(n));
- lua_pushinteger(L, rule_left(n));
- lua_pushinteger(L, rule_right(n));
+ lua_pushinteger(L, rule_virtual_width(n));
+ lua_pushinteger(L, rule_virtual_height(n));
+ lua_pushinteger(L, rule_virtual_depth(n));
lua_pushboolean(L, 1);
} else {
lua_pushinteger(L, rule_width(n));
@@ -2923,6 +2923,32 @@ static int nodelib_direct_getruledimensions(lua_State *L)
}
}
+static int nodelib_direct_setruledimensions(lua_State *L)
+{
+ halfword n = nodelib_valid_direct_from_index(L, 1);
+ if (n && node_type(n) == rule_node) {
+ scaled wd = (scaled) lmt_roundnumber(L, 2);
+ scaled ht = (scaled) lmt_roundnumber(L, 3);
+ scaled dp = (scaled) lmt_roundnumber(L, 4);
+ if (node_subtype(n) == virtual_rule_subtype) {
+ rule_virtual_width(n) = wd;
+ rule_virtual_height(n) = ht;
+ rule_virtual_depth(n) = dp;
+ rule_width(n) = 0;
+ rule_height(n) = 0;
+ rule_depth(n) = 0;
+ } else {
+ rule_width(n) = wd;
+ rule_height(n) = ht;
+ rule_depth(n) = dp;
+ }
+ if (lua_type(L, 5) == LUA_TNUMBER) {
+ rule_data(n) = (halfword) lmt_roundnumber(L, 5);
+ }
+ }
+ return 0;
+}
+
/* node.direct.getlist */
static int nodelib_direct_getlist(lua_State *L)
@@ -6577,21 +6603,21 @@ static int nodelib_common_getfield(lua_State *L, int direct, halfword n)
} else if (lua_key_eq(s, total)) {
lua_pushinteger(L, rule_total(n));
} else if (lua_key_eq(s, xoffset)) {
- lua_pushinteger(L,rule_x_offset(n));
+ lua_pushinteger(L, rule_x_offset(n));
} else if (lua_key_eq(s, yoffset)) {
- lua_pushinteger(L,rule_y_offset(n));
+ lua_pushinteger(L, rule_y_offset(n));
} else if (lua_key_eq(s, left)) {
- lua_pushinteger(L,rule_left(n));
+ lua_pushinteger(L, tex_get_rule_left(n));
} else if (lua_key_eq(s, right)) {
- lua_pushinteger(L,rule_right(n));
+ lua_pushinteger(L, tex_get_rule_right(n));
} else if (lua_key_eq(s, data)) {
- lua_pushinteger(L,rule_data(n));
+ lua_pushinteger(L, rule_data(n));
} else if (lua_key_eq(s, font)) {
lua_pushinteger(L, tex_get_rule_font(n, text_style));
} else if (lua_key_eq(s, fam)) {
lua_pushinteger(L, tex_get_rule_font(n, text_style));
} else if (lua_key_eq(s, char)) {
- lua_pushinteger(L, rule_character(n));
+ lua_pushinteger(L, rule_strut_character(n));
} else {
lua_pushnil(L);
}
@@ -7262,9 +7288,9 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n)
} else if (lua_key_eq(s, yoffset)) {
rule_y_offset(n) = (halfword) lmt_roundnumber(L, 3);
} else if (lua_key_eq(s, left)) {
- rule_left(n) = (halfword) lmt_roundnumber(L, 3);
+ tex_set_rule_left(n, (halfword) lmt_roundnumber(L, 3));
} else if (lua_key_eq(s, right)) {
- rule_right(n) = (halfword) lmt_roundnumber(L, 3);
+ tex_set_rule_right(n, (halfword) lmt_roundnumber(L, 3));
} else if (lua_key_eq(s, data)) {
rule_data(n) = lmt_tohalfword(L, 3);
} else if (lua_key_eq(s, font)) {
@@ -7272,7 +7298,7 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n)
} else if (lua_key_eq(s, fam)) {
tex_set_rule_family(n, lmt_tohalfword(L, 3));
} else if (lua_key_eq(s, char)) {
- rule_character(n) = lmt_tohalfword(L, 3);
+ rule_strut_character(n) = lmt_tohalfword(L, 3);
} else {
goto CANTSET;
}
@@ -9809,6 +9835,7 @@ static const struct luaL_Reg nodelib_direct_function_list[] = {
{ "getkerndimension", nodelib_direct_getkerndimension },
{ "getlistdimensions", nodelib_direct_getlistdimensions },
{ "getruledimensions", nodelib_direct_getruledimensions },
+ { "setruledimensions", nodelib_direct_setruledimensions },
{ "patchattributes", nodelib_direct_patchattributes },
{ "remove", nodelib_direct_remove },
{ "removefromlist", nodelib_direct_remove_from_list },
diff --git a/source/luametatex/source/lua/lmtstatuslib.c b/source/luametatex/source/lua/lmtstatuslib.c
index ee785e806..2613115da 100644
--- a/source/luametatex/source/lua/lmtstatuslib.c
+++ b/source/luametatex/source/lua/lmtstatuslib.c
@@ -356,6 +356,8 @@ static int statslib_getconstants(lua_State *L)
lua_set_integer_by_key(L, "assumed_math_control", assumed_math_control);
lua_set_integer_by_key(L, "undefined_math_parameter", undefined_math_parameter);
+
+ lua_set_integer_by_key(L, "max_calculated_badness", max_calculated_badness);
return 1;
}
diff --git a/source/luametatex/source/lua/lmttexlib.c b/source/luametatex/source/lua/lmttexlib.c
index 39afd94fb..1bfd2c38c 100644
--- a/source/luametatex/source/lua/lmttexlib.c
+++ b/source/luametatex/source/lua/lmttexlib.c
@@ -2782,6 +2782,7 @@ static int texlib_aux_convert(lua_State *L, int cur_code)
case cs_active_code: /* arg token */
/* case cs_lastname_code: */ /* arg token */
case detokenized_code: /* arg token */
+ case detokened_code: /* arg cs or {} */
case meaning_code: /* arg token */
case to_mathstyle_code:
break;
@@ -5016,7 +5017,7 @@ static int texlib_getglyphoptionvalues(lua_State *L)
static int texlib_getnoadoptionvalues(lua_State *L)
{
- lua_createtable(L, 2, 36);
+ lua_createtable(L, 2, 37);
lua_push_key_at_index(L, axis, noad_option_axis);
lua_push_key_at_index(L, noaxis, noad_option_no_axis);
lua_push_key_at_index(L, exact, noad_option_exact);
@@ -5058,6 +5059,7 @@ static int texlib_getnoadoptionvalues(lua_State *L)
lua_push_key_at_index(L, center, noad_option_center);
lua_push_key_at_index(L, scale, noad_option_scale);
lua_push_key_at_index(L, keepbase, noad_option_keep_base);
+ lua_push_key_at_index(L, single, noad_option_single);
// lua_set_string_by_index(L, noad_option_keep_base, "keepbase");
return 1;
@@ -5158,7 +5160,7 @@ static int texlib_getspecialmathclassvalues(lua_State *L)
static int texlib_getmathclassoptionvalues(lua_State *L)
{
- lua_createtable(L, 2, 19);
+ lua_createtable(L, 2, 20);
lua_set_string_by_index(L, no_pre_slack_class_option, "nopreslack");
lua_set_string_by_index(L, no_post_slack_class_option, "nopostslack");
lua_set_string_by_index(L, left_top_kern_class_option, "lefttopkern");
@@ -5185,6 +5187,7 @@ static int texlib_getmathclassoptionvalues(lua_State *L)
lua_set_string_by_index(L, auto_inject_class_option, "autoinject");
lua_set_string_by_index(L, remove_italic_correction_class_option, "removeitaliccorrection");
lua_set_string_by_index(L, operator_italic_correction_class_option, "operatoritaliccorrection");
+ lua_set_string_by_index(L, short_inline_class_option, "shortinline");
return 1;
}
@@ -5209,6 +5212,7 @@ static int texlib_getnormalizeparvalues(lua_State *L)
lua_createtable(L, 2, 0);
lua_set_string_by_index(L, normalize_par_mode, "normalizepar");
lua_set_string_by_index(L, flatten_v_leaders_mode, "flattenvleaders");
+ lua_set_string_by_index(L, limit_prev_graf_mode, "limitprevgraf");
return 1;
}
@@ -5397,6 +5401,11 @@ static int texlib_getalignmentcontextvalues(lua_State *L)
return lmt_push_info_values(L, lmt_interface.alignment_context_values);
}
+static int texlib_getbreakcontextvalues(lua_State *L)
+{
+ return lmt_push_info_values(L, lmt_interface.break_context_values);
+}
+
static int texlib_getparbeginvalues(lua_State *L)
{
return lmt_push_info_values(L, lmt_interface.par_begin_values);
@@ -5481,6 +5490,18 @@ static int texlib_gettextcontrolvalues(lua_State *L)
return 1;
}
+static int texlib_getfitnessvalues(lua_State *L)
+{
+ lua_createtable(L, 5, 1);
+ lua_set_string_by_index(L, very_loose_fit, "veryloose");
+ lua_set_string_by_index(L, loose_fit, "loose");
+ lua_set_string_by_index(L, semi_loose_fit, "semiloose");
+ lua_set_string_by_index(L, decent_fit, "decent");
+ lua_set_string_by_index(L, semi_tight_fit, "semitight");
+ lua_set_string_by_index(L, tight_fit, "tight");
+ return 1;
+}
+
static int texlib_getfillvalues(lua_State *L)
{
return lmt_push_info_values(L, lmt_interface.node_fill_values);
@@ -5772,12 +5793,14 @@ static const struct luaL_Reg texlib_function_list[] = {
/* {"getmathflattenvalues", texlib_getmathflattenvalues }, */
{ "getmathcontrolvalues", texlib_getmathcontrolvalues },
{ "gettextcontrolvalues", texlib_gettextcontrolvalues },
+ { "getfitnessvalues", texlib_getfitnessvalues },
{ "getpacktypevalues", texlib_getpacktypevalues },
{ "getgroupvalues", texlib_getgroupvalues },
{ "getparcontextvalues", texlib_getparcontextvalues },
{ "getpagecontextvalues", texlib_getpagecontextvalues },
{ "getappendlinecontextvalues", texlib_getappendlinecontextvalues },
{ "getalignmentcontextvalues", texlib_getalignmentcontextvalues },
+ { "getbreakcontextvalues", texlib_getbreakcontextvalues },
{ "getparbeginvalues", texlib_getparbeginvalues },
{ "getparmodevalues", texlib_getparmodevalues },
{ "getautomigrationvalues", texlib_getautomigrationvalues },
diff --git a/source/luametatex/source/lua/lmttokenlib.c b/source/luametatex/source/lua/lmttokenlib.c
index c8f7f9039..fd3b95b0f 100644
--- a/source/luametatex/source/lua/lmttokenlib.c
+++ b/source/luametatex/source/lua/lmttokenlib.c
@@ -213,7 +213,6 @@ void lmt_tokenlib_initialize(void)
lmt_interface.command_names[convert_cmd] = (command_item) { .id = convert_cmd, .lua = lua_key_index(convert), .name = lua_key(convert), .kind = regular_command_item, .min = 0, .max = last_convert_code, .base = 0, .fixedvalue = 0 };
lmt_interface.command_names[the_cmd] = (command_item) { .id = the_cmd, .lua = lua_key_index(the), .name = lua_key(the), .kind = regular_command_item, .min = 0, .max = last_the_code, .base = 0, .fixedvalue = 0 };
lmt_interface.command_names[get_mark_cmd] = (command_item) { .id = get_mark_cmd, .lua = lua_key_index(get_mark), .name = lua_key(get_mark), .kind = regular_command_item, .min = 0, .max = last_get_mark_code, .base = 0, .fixedvalue = 0 };
- /* lmt_interface.command_names[string_cmd] = (command_item) { .id = string_cmd, .lua = lua_key_index(string), .name = lua_key(string), .kind = regular_command_item, .min = ignore_entry, .max = max_integer, .base = 0, .fixedvalue = 0 }; */
lmt_interface.command_names[call_cmd] = (command_item) { .id = call_cmd, .lua = lua_key_index(call), .name = lua_key(call), .kind = token_command_item, .min = ignore_entry, .max = ignore_entry, .base = ignore_entry, .fixedvalue = 0 };
lmt_interface.command_names[protected_call_cmd] = (command_item) { .id = protected_call_cmd, .lua = lua_key_index(protected_call), .name = lua_key(protected_call), .kind = token_command_item, .min = ignore_entry, .max = ignore_entry, .base = ignore_entry, .fixedvalue = 0 };
lmt_interface.command_names[semi_protected_call_cmd] = (command_item) { .id = semi_protected_call_cmd, .lua = lua_key_index(semi_protected_call), .name = lua_key(protected_call), .kind = token_command_item, .min = ignore_entry, .max = ignore_entry, .base = ignore_entry, .fixedvalue = 0 };
@@ -1431,6 +1430,54 @@ static int tokenlib_scan_tokenlist(lua_State *L)
return 1;
}
+static int tokenlib_scan_detokened(lua_State *L)
+{
+ saved_tex_scanner texstate = tokenlib_aux_save_tex_scanner();
+ int expand = lua_toboolean(L, 1);
+ halfword defref = lmt_input_state.def_ref;
+ halfword result = null;
+ int macro = 0;
+ tokenlib_aux_goto_first_candidate(); /*tex We don't expand the next token! */
+ switch (cur_cmd) {
+ case left_brace_cmd:
+ result = expand ? tex_scan_toks_expand(1, NULL, 0) : tex_scan_toks_normal(1, NULL);
+ break;
+ case call_cmd:
+ case protected_call_cmd:
+ case semi_protected_call_cmd:
+ case tolerant_call_cmd:
+ case tolerant_protected_call_cmd:
+ case tolerant_semi_protected_call_cmd:
+ result = cur_chr;
+ macro = 1;
+ break;
+ default:
+ tex_back_input(cur_tok);
+ break;
+ }
+ tokenlib_aux_unsave_tex_scanner(texstate);
+ lmt_input_state.def_ref = defref;
+ if (result) {
+ if (token_link(result)) {
+ tex_detokenize_list(token_link(result));
+ if (lmt_string_pool_state.string_temp && lmt_string_pool_state.string_temp_top) {
+ lua_pushlstring(L, (char *) lmt_string_pool_state.string_temp, lmt_string_pool_state.string_temp_top);
+ } else {
+ lua_pushliteral(L,"");
+ }
+ tex_reset_cur_string();
+ } else {
+ lua_pushliteral(L,"");
+ }
+ if (! macro) {
+ tex_flush_token_list(result);
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
+}
+
/* todo: other call_cmd */
static int tokenlib_scan_string(lua_State *L)
@@ -3630,6 +3677,7 @@ static const struct luaL_Reg tokenlib_function_list[] = {
{ "scancsname", tokenlib_scan_csname },
{ "scantoken", tokenlib_scan_token }, /* expands next token if needed */
{ "scanbox", tokenlib_scan_box },
+ { "scandetokened", tokenlib_scan_detokened },
{ "isnextchar", tokenlib_is_next_char },
/* writers */
{ "putnext", tokenlib_put_next },
diff --git a/source/luametatex/source/luacore/lua54/originals/patches.txt b/source/luametatex/source/luacore/lua54/originals/patches.txt
index 8a3fc4363..ebd644527 100644
--- a/source/luametatex/source/luacore/lua54/originals/patches.txt
+++ b/source/luametatex/source/luacore/lua54/originals/patches.txt
@@ -1,11 +1,11 @@
---------------------------------------------------------------------------------------
-lctype.h : no longer needed as we dan use -DLUA_UCID now
---------------------------------------------------------------------------------------
-
-/* lislalpha(c) testprop(c, MASK(ALPHABIT)) */
-/* lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) */
-
-# define lislalpha(c) (testprop(c, MASK(ALPHABIT)) || (c) > 0x7f)
-# define lislalnum(c) (testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) || (c) > 0x7f)
-
---------------------------------------------------------------------------------------
+--------------------------------------------------------------------------------------
+lctype.h : no longer needed as we dan use -DLUA_UCID now
+--------------------------------------------------------------------------------------
+
+/* lislalpha(c) testprop(c, MASK(ALPHABIT)) */
+/* lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) */
+
+# define lislalpha(c) (testprop(c, MASK(ALPHABIT)) || (c) > 0x7f)
+# define lislalnum(c) (testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) || (c) > 0x7f)
+
+--------------------------------------------------------------------------------------
diff --git a/source/luametatex/source/luacore/lua54/readme.txt b/source/luametatex/source/luacore/lua54/readme.txt
index 5637f04ae..5b3ad4918 100644
--- a/source/luametatex/source/luacore/lua54/readme.txt
+++ b/source/luametatex/source/luacore/lua54/readme.txt
@@ -1,8 +1,8 @@
-This is Lua 5.4 as taken from: https://github.com/lua/lua.git (intermediate releases). For
-installation instructions, license details, and further information about Lua, see the
-documentation of LUA.
-
-There is a pitfall in using release candidates: when the bytecode organization changes
-we can get crashes. At some point the luac version became an integer so we could encode
-a subnumber but that was reverted to a byte. This means that we again can get crashes
-(unless we mess a bit with that byte). It makes usage a bit fragile but so be it.
+This is Lua 5.4 as taken from: https://github.com/lua/lua.git (intermediate releases). For
+installation instructions, license details, and further information about Lua, see the
+documentation of LUA.
+
+There is a pitfall in using release candidates: when the bytecode organization changes
+we can get crashes. At some point the luac version became an integer so we could encode
+a subnumber but that was reverted to a byte. This means that we again can get crashes
+(unless we mess a bit with that byte). It makes usage a bit fragile but so be it.
diff --git a/source/luametatex/source/luacore/luapeg/readme.txt b/source/luametatex/source/luacore/luapeg/readme.txt
index 17b6b404d..d8ba6b709 100644
--- a/source/luametatex/source/luacore/luapeg/readme.txt
+++ b/source/luametatex/source/luacore/luapeg/readme.txt
@@ -1,9 +1,9 @@
-Commented line in lptypes.h:
-
- # include <assert.h>
-
-Added line in lptypes.h:
-
- # define assert(condition) ((void)0)
-
+Commented line in lptypes.h:
+
+ # include <assert.h>
+
+Added line in lptypes.h:
+
+ # define assert(condition) ((void)0)
+
Maybe some day lua_assert will be used in lpeg. \ No newline at end of file
diff --git a/source/luametatex/source/luacore/readme.txt b/source/luametatex/source/luacore/readme.txt
index 23eb77311..5156e1047 100644
--- a/source/luametatex/source/luacore/readme.txt
+++ b/source/luametatex/source/luacore/readme.txt
@@ -1,34 +1,34 @@
-About luasocket and luasec:
-
-Till mid 2021 we had the luasec code in the source tree but it was not used yet. It requires
-openssl which is pretty large and we need a bunch of header files. In order to compile luasec
-we need openssl headers and unfortunately there are a few included files that one need to
-make. This create a dependency unless we make a few simple ones; after all we only need it for
-a few platforms. I couldn't locate a neutral header set so it never came to compilation (I
-started making a set myself but could not motivate myself to finish it). We could use it as
-optional library (which then demands a bit different interface). But, no matter what we
-decide, we definitely don't want to compile openssl and include it in the binary. One problem
-with these additional libraries is that they add more code than luametatex itself has so that
-makes no sense.
-
-For the record, an alternative is to use the more lightweight armmbed or polarssl library but
-then I need either to make wrappers or adapt the luasec code.
-
-Anyway, when we consider secure http we also enter the endless updating of protocols because
-the internet is more and more wrapped in security due to lack of control over bad behaviour
-and abuse around it. Plugging holes is not among the objectives of this project also because
-it conflicts with long term stability of what basically is a typesetting engine.
-
-On a positive note, when we use sockets to serve http we can hide behind a proxy, for instance
-nginx is easy to set up and Lua(Meta)TeX happily sits behind it. When downloading something we
-need to cache anyway so then we can as well use libcurl for which we have interfaces built in
-already. If installing openssl is considered a valid option, then libcurl can hardly be seen
-as a hurdle. We probably need that anyway some day in the installer and updater.
-
-The basic socket library is quite stable. In ConTeXt the Lua files already have been 'redone'
-to fit it the lot. In the code base some C files have been removed (serial and unix specific
-stuff) and at some point I might decide to strip away the files and functionality that we
-don't need. Occasionally there are updates to the library but in general it's rather long
-term stable.
-
+About luasocket and luasec:
+
+Till mid 2021 we had the luasec code in the source tree but it was not used yet. It requires
+openssl which is pretty large and we need a bunch of header files. In order to compile luasec
+we need openssl headers and unfortunately there are a few included files that one need to
+make. This create a dependency unless we make a few simple ones; after all we only need it for
+a few platforms. I couldn't locate a neutral header set so it never came to compilation (I
+started making a set myself but could not motivate myself to finish it). We could use it as
+optional library (which then demands a bit different interface). But, no matter what we
+decide, we definitely don't want to compile openssl and include it in the binary. One problem
+with these additional libraries is that they add more code than luametatex itself has so that
+makes no sense.
+
+For the record, an alternative is to use the more lightweight armmbed or polarssl library but
+then I need either to make wrappers or adapt the luasec code.
+
+Anyway, when we consider secure http we also enter the endless updating of protocols because
+the internet is more and more wrapped in security due to lack of control over bad behaviour
+and abuse around it. Plugging holes is not among the objectives of this project also because
+it conflicts with long term stability of what basically is a typesetting engine.
+
+On a positive note, when we use sockets to serve http we can hide behind a proxy, for instance
+nginx is easy to set up and Lua(Meta)TeX happily sits behind it. When downloading something we
+need to cache anyway so then we can as well use libcurl for which we have interfaces built in
+already. If installing openssl is considered a valid option, then libcurl can hardly be seen
+as a hurdle. We probably need that anyway some day in the installer and updater.
+
+The basic socket library is quite stable. In ConTeXt the Lua files already have been 'redone'
+to fit it the lot. In the code base some C files have been removed (serial and unix specific
+stuff) and at some point I might decide to strip away the files and functionality that we
+don't need. Occasionally there are updates to the library but in general it's rather long
+term stable.
+
So to summarize: luasocket stayed and luasec is no longer considered as a built-in. \ No newline at end of file
diff --git a/source/luametatex/source/luametatex.h b/source/luametatex/source/luametatex.h
index 2e3b53e71..2a99867e8 100644
--- a/source/luametatex/source/luametatex.h
+++ b/source/luametatex/source/luametatex.h
@@ -92,7 +92,7 @@
# define luametatex_version 210
# define luametatex_revision 9
# define luametatex_version_string "2.10.09"
-# define luametatex_development_id 20230508
+# define luametatex_development_id 20230525
# define luametatex_name_camelcase "LuaMetaTeX"
# define luametatex_name_lowercase "luametatex"
diff --git a/source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt b/source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt
index cfe2ee2bf..83b6b48ac 100644
--- a/source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt
+++ b/source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt
@@ -1,107 +1,107 @@
-# This file is made by Mojca and Hans and is subjected to changes
-# as we proceed with luametatex and the contextgarden compile farm.
-
-cmake_minimum_required(VERSION 3.7)
-
-# Lucky us: only normal C is used:
-
-project (mujs
- VERSION 1.0.6
- DESCRIPTION "MuJS embeddable Javascript interpreter"
- LANGUAGES C)
-
-# The jsrepr.c is not needed and depends on utf.c as well has some function
-# pointer cast issue (accessing unknown name field).
-
-set (mujs_sources
- jsarray.c
- jsboolean.c
- jsbuiltin.c
- jscompile.c
- jsdate.c
- jsdtoa.c
- jsdump.c
- jserror.c
- jsfunction.c
- jsgc.c
- jsintern.c
- jslex.c
- jsmath.c
- jsnumber.c
- jsobject.c
- json.c
- jsparse.c
- jsproperty.c
- jsregexp.c
-# jsrepr.c
- jsrun.c
- jsstate.c
- jsstring.c
- jsvalue.c
- regexp.c
- utf.c
- utftype.c
-)
-
-set (mujs_headers
- jsbuiltin.h
- jscompile.h
- jsi.h
- jslex.h
- jsparse.h
- jsrun.h
- jsvalue.h
- mujs.h
- regexp.h
- utf.h
-)
-
-# We need this in order for msvc to export the symbols (which is default on
-# gcc). Otherwise we need this dllexport stuff.
-
-set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
-
-# The previous one has to come before the next one!
-
-if (MSVC)
-
- add_library(mujs SHARED ${mujs_headers} ${mujs_sources} )
-
-else()
-
- # Is this hack still needed or does the above work ok.?
-
- add_library(mujs SHARED ${mujs_headers} one.c)
-
-endif()
-
-# As per make file.
-
-set_property(TARGET mujs PROPERTY C_STANDARD 99)
-
-# We want consistent and predictable names:
-
-set_target_properties(mujs PROPERTIES OUTPUT_NAME "libmujs")
-
-# Some options based on what's in upstream's make file.
-
-if (NOT MSVC)
-
- target_compile_options(mujs
- PRIVATE
- -pedantic
- -Wall
- -Wextra
- -Wno-unused-parameter
- )
-
- if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
-
- target_compile_options(mujs
- PRIVATE
- -Wunreachable-code
- )
-
- endif()
-
-endif()
+# This file is made by Mojca and Hans and is subjected to changes
+# as we proceed with luametatex and the contextgarden compile farm.
+
+cmake_minimum_required(VERSION 3.7)
+
+# Lucky us: only normal C is used:
+
+project (mujs
+ VERSION 1.0.6
+ DESCRIPTION "MuJS embeddable Javascript interpreter"
+ LANGUAGES C)
+
+# The jsrepr.c is not needed and depends on utf.c as well has some function
+# pointer cast issue (accessing unknown name field).
+
+set (mujs_sources
+ jsarray.c
+ jsboolean.c
+ jsbuiltin.c
+ jscompile.c
+ jsdate.c
+ jsdtoa.c
+ jsdump.c
+ jserror.c
+ jsfunction.c
+ jsgc.c
+ jsintern.c
+ jslex.c
+ jsmath.c
+ jsnumber.c
+ jsobject.c
+ json.c
+ jsparse.c
+ jsproperty.c
+ jsregexp.c
+# jsrepr.c
+ jsrun.c
+ jsstate.c
+ jsstring.c
+ jsvalue.c
+ regexp.c
+ utf.c
+ utftype.c
+)
+
+set (mujs_headers
+ jsbuiltin.h
+ jscompile.h
+ jsi.h
+ jslex.h
+ jsparse.h
+ jsrun.h
+ jsvalue.h
+ mujs.h
+ regexp.h
+ utf.h
+)
+
+# We need this in order for msvc to export the symbols (which is default on
+# gcc). Otherwise we need this dllexport stuff.
+
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
+# The previous one has to come before the next one!
+
+if (MSVC)
+
+ add_library(mujs SHARED ${mujs_headers} ${mujs_sources} )
+
+else()
+
+ # Is this hack still needed or does the above work ok.?
+
+ add_library(mujs SHARED ${mujs_headers} one.c)
+
+endif()
+
+# As per make file.
+
+set_property(TARGET mujs PROPERTY C_STANDARD 99)
+
+# We want consistent and predictable names:
+
+set_target_properties(mujs PROPERTIES OUTPUT_NAME "libmujs")
+
+# Some options based on what's in upstream's make file.
+
+if (NOT MSVC)
+
+ target_compile_options(mujs
+ PRIVATE
+ -pedantic
+ -Wall
+ -Wextra
+ -Wno-unused-parameter
+ )
+
+ if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+
+ target_compile_options(mujs
+ PRIVATE
+ -Wunreachable-code
+ )
+
+ endif()
+
+endif()
diff --git a/source/luametatex/source/luaoptional/readme.txt b/source/luametatex/source/luaoptional/readme.txt
index 31b489da9..579433d61 100644
--- a/source/luametatex/source/luaoptional/readme.txt
+++ b/source/luametatex/source/luaoptional/readme.txt
@@ -1,30 +1,30 @@
-Nota bene,
-
-This is the directory where optional module support ends up. Optional modules have an interface but
-are not (nor will be) part of the binary. We might ship some at the context garden (like zint and
-mujs) but the large one (read: with many dependencies or written in c++) have to come from the
-operating system because if you use a library that is what you want: the external black box thing.
-No sources end up in the distribution either, athough we will archive some.
-
-There will be no user modules here, just those interfaces that we provide and maintain as part of
-standard ConTeXt LMTX. What users add themselves is up to them, including (long time !) support. So,
-this is the canonnical version of optional.
-
-We might at some point add some safeguards so that we can be sure that ConTeXt is run with the
-right binary because we want to prevent side effects (of any kind) resulting from a binary being
-used with the same name and different features ... just because one of the objective is to have
-a long term stable binary / macro package combination. Of course, what users do on their machines
-is up to them.
-
-It might take a while before the interfaces and way we do this is stable. Also, keep in mind that
-regular users never deal with these matters directly and only use the interfaces at the TeX and
-Lua end.
-
-PS. The socket library (and maybe cerf) are also candidates for optional although cerf needs to be
-compiled for windows which is not supported out of the box and sockets are way to large. We only
-do optional libs that add little to the binary, a few KB at most! I'll definitely try to stick to
-this principle!
-
-PS. Todo: move function pointers into state structures.
-
-Hans
+Nota bene,
+
+This is the directory where optional module support ends up. Optional modules have an interface but
+are not (nor will be) part of the binary. We might ship some at the context garden (like zint and
+mujs) but the large one (read: with many dependencies or written in c++) have to come from the
+operating system because if you use a library that is what you want: the external black box thing.
+No sources end up in the distribution either, athough we will archive some.
+
+There will be no user modules here, just those interfaces that we provide and maintain as part of
+standard ConTeXt LMTX. What users add themselves is up to them, including (long time !) support. So,
+this is the canonnical version of optional.
+
+We might at some point add some safeguards so that we can be sure that ConTeXt is run with the
+right binary because we want to prevent side effects (of any kind) resulting from a binary being
+used with the same name and different features ... just because one of the objective is to have
+a long term stable binary / macro package combination. Of course, what users do on their machines
+is up to them.
+
+It might take a while before the interfaces and way we do this is stable. Also, keep in mind that
+regular users never deal with these matters directly and only use the interfaces at the TeX and
+Lua end.
+
+PS. The socket library (and maybe cerf) are also candidates for optional although cerf needs to be
+compiled for windows which is not supported out of the box and sockets are way to large. We only
+do optional libs that add little to the binary, a few KB at most! I'll definitely try to stick to
+this principle!
+
+PS. Todo: move function pointers into state structures.
+
+Hans
diff --git a/source/luametatex/source/mp/mpc/mpmath.c b/source/luametatex/source/mp/mpc/mpmath.c
index 0a848b23e..d58d4f00f 100644
--- a/source/luametatex/source/mp/mpc/mpmath.c
+++ b/source/luametatex/source/mp/mpc/mpmath.c
@@ -5,7 +5,7 @@
# include "mpmath.h"
# include "mpstrings.h"
-# define coef_bound 04525252525
+# define coef_bound 0x25555555
# define fraction_threshold 2685
# define half_fraction_threshold 1342
# define scaled_threshold 8
@@ -18,9 +18,9 @@
# define three (3*unity)
# define half_unit (unity/2)
# define three_quarter_unit (3*(unity/4))
-# define EL_GORDO 0x7fffffff
+# define EL_GORDO 0x7FFFFFFF
# define negative_EL_GORDO (-EL_GORDO)
-# define one_third_EL_GORDO 05252525252
+# define one_third_EL_GORDO 0x2AAAAAAA
# define TWEXP31 2147483648.0
# define TWEXP28 268435456.0
# define TWEXP16 65536.0
@@ -602,7 +602,7 @@ static char *mp_string_scaled (MP mp, int s)
scaled_string[i++] = '.';
do {
if (delta > unity) {
- s = s + 0100000 - (delta / 2);
+ s = s + 0x8000 - (delta / 2);
}
scaled_string[i++] = '0' + (s / unity);
s = 10 * (s % unity);
@@ -646,7 +646,7 @@ static int mp_make_fraction (MP mp, int p, int q)
return EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((q > 0 ? -q : q) & 077777) * (((i & 037777) << 1) - 1) & 04000) != 0) {
+ if (d == (double) i && (((q > 0 ? -q : q) & 0x7FFF) * (((i & 0x3FFF) << 1) - 1) & 0x800) != 0) {
--i;
}
return i;
@@ -658,7 +658,7 @@ static int mp_make_fraction (MP mp, int p, int q)
return -negative_EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((q > 0 ? q : -q) & 077777) * (((i & 037777) << 1) + 1) & 04000) != 0) {
+ if (d == (double) i && (((q > 0 ? q : -q) & 0x7FFF) * (((i & 0x3FFF) << 1) + 1) & 0x800) != 0) {
++i;
}
return i;
@@ -678,13 +678,13 @@ int mp_take_fraction (MP mp, int p, int q)
if ((p ^ q) >= 0) {
d += 0.5;
if (d >= TWEXP31) {
- if (d != TWEXP31 || (((p & 077777) * (q & 077777)) & 040000) == 0) {
+ if (d != TWEXP31 || (((p & 0x7FFF) * (q & 0x7FFF)) & 040000) == 0) {
mp->arith_error = 1;
}
return EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((p & 077777) * (q & 077777)) & 040000) != 0) {
+ if (d == (double) i && (((p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) != 0) {
--i;
}
return i;
@@ -692,13 +692,13 @@ int mp_take_fraction (MP mp, int p, int q)
} else {
d -= 0.5;
if (d <= -TWEXP31) {
- if (d != -TWEXP31 || ((-(p & 077777) * (q & 077777)) & 040000) == 0) {
+ if (d != -TWEXP31 || ((-(p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) == 0) {
mp->arith_error = 1;
}
return -negative_EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && ((-(p & 077777) * (q & 077777)) & 040000) != 0) {
+ if (d == (double) i && ((-(p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) != 0) {
++i;
}
return i;
@@ -717,13 +717,13 @@ static int mp_take_scaled (MP mp, int p, int q)
if ((p ^ q) >= 0) {
d += 0.5;
if (d >= TWEXP31) {
- if (d != TWEXP31 || (((p & 077777) * (q & 077777)) & 040000) == 0) {
+ if (d != TWEXP31 || (((p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) == 0) {
mp->arith_error = 1;
}
return EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((p & 077777) * (q & 077777)) & 040000) != 0) {
+ if (d == (double) i && (((p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) != 0) {
--i;
}
return i;
@@ -731,13 +731,13 @@ static int mp_take_scaled (MP mp, int p, int q)
} else {
d -= 0.5;
if (d <= -TWEXP31) {
- if (d != -TWEXP31 || ((-(p & 077777) * (q & 077777)) & 040000) == 0) {
+ if (d != -TWEXP31 || ((-(p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) == 0) {
mp->arith_error = 1;
}
return -negative_EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && ((-(p & 077777) * (q & 077777)) & 040000) != 0) {
+ if (d == (double) i && ((-(p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) != 0) {
++i;
}
return i;
@@ -764,7 +764,7 @@ int mp_make_scaled (MP mp, int p, int q)
return EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((q > 0 ? -q : q) & 077777) * (((i & 037777) << 1) - 1) & 04000) != 0) {
+ if (d == (double) i && (((q > 0 ? -q : q) & 0x7FFF) * (((i & 0x3FFF) << 1) - 1) & 0x800) != 0) {
--i;
}
return i;
@@ -776,7 +776,7 @@ int mp_make_scaled (MP mp, int p, int q)
return -negative_EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((q > 0 ? q : -q) & 077777) * (((i & 037777) << 1) + 1) & 04000) != 0) {
+ if (d == (double) i && (((q > 0 ? q : -q) & 0x7FFF) * (((i & 0x3FFF) << 1) + 1) & 0x800) != 0) {
++i;
}
return i;
@@ -1239,7 +1239,7 @@ void mp_m_exp (MP mp, mp_number *ret, mp_number *x_orig)
} else {
if (x <= 0) {
z = -8 * x;
- y = 04000000;
+ y = 0x100000;
} else {
if (x <= 127919879) {
z = 1023359037 - 8 * x;
diff --git a/source/luametatex/source/mp/mpw/mpmath.w b/source/luametatex/source/mp/mpw/mpmath.w
index 5e9592fc7..7b43da72b 100644
--- a/source/luametatex/source/mp/mpw/mpmath.w
+++ b/source/luametatex/source/mp/mpw/mpmath.w
@@ -107,7 +107,7 @@ static char *mp_number_tostring (MP mp, mp_number *n);
static char *mp_string_scaled (MP mp, int s);
@
-@d coef_bound 04525252525 /* |fraction| approximation to 7/3 */
+@d coef_bound 0x25555555 /* |fraction| approximation to 7/3 */ /* 04525252525 */
@d fraction_threshold 2685 /* a |fraction| coefficient less than this is zeroed */
@d half_fraction_threshold 1342 /* half of |fraction_threshold| */
@d scaled_threshold 8 /* a |scaled| coefficient less than this is zeroed */
@@ -125,9 +125,9 @@ from the right end of a binary computer word.
@d three (3*unity) /* $2^{17}+2^{16}$, represents 3.00000 */
@d half_unit (unity/2) /* $2^{15}$, represents 0.50000 */
@d three_quarter_unit (3*(unity/4)) /* $3\cdot2^{14}$, represents 0.75000 */
-@d EL_GORDO 0x7fffffff /* $2^{31}-1$, the largest value that \MP\ likes */
+@d EL_GORDO 0x7FFFFFFF /* $2^{31}-1$, the largest value that \MP\ likes */
@d negative_EL_GORDO (-EL_GORDO)
-@d one_third_EL_GORDO 05252525252
+@d one_third_EL_GORDO 0x2AAAAAAA /* 05252525252 */
@ We need these preprocessor values
@@ -685,7 +685,7 @@ static char *mp_string_scaled (MP mp, int s)
do {
/* round the final digit */
if (delta > unity) {
- s = s + 0100000 - (delta / 2);
+ s = s + 0x8000 - (delta / 2);
}
scaled_string[i++] = '0' + (s / unity);
s = 10 * (s % unity);
@@ -769,7 +769,7 @@ static int mp_make_fraction (MP mp, int p, int q)
return EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((q > 0 ? -q : q) & 077777) * (((i & 037777) << 1) - 1) & 04000) != 0) {
+ if (d == (double) i && (((q > 0 ? -q : q) & 0x7FFF) * (((i & 0x3FFF) << 1) - 1) & 0x800) != 0) {
--i;
}
return i;
@@ -781,7 +781,7 @@ static int mp_make_fraction (MP mp, int p, int q)
return -negative_EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((q > 0 ? q : -q) & 077777) * (((i & 037777) << 1) + 1) & 04000) != 0) {
+ if (d == (double) i && (((q > 0 ? q : -q) & 0x7FFF) * (((i & 0x3FFF) << 1) + 1) & 0x800) != 0) {
++i;
}
return i;
@@ -811,13 +811,13 @@ int mp_take_fraction (MP mp, int p, int q)
if ((p ^ q) >= 0) {
d += 0.5;
if (d >= TWEXP31) {
- if (d != TWEXP31 || (((p & 077777) * (q & 077777)) & 040000) == 0) {
+ if (d != TWEXP31 || (((p & 0x7FFF) * (q & 0x7FFF)) & 040000) == 0) {
mp->arith_error = 1;
}
return EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((p & 077777) * (q & 077777)) & 040000) != 0) {
+ if (d == (double) i && (((p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) != 0) {
--i;
}
return i;
@@ -825,13 +825,13 @@ int mp_take_fraction (MP mp, int p, int q)
} else {
d -= 0.5;
if (d <= -TWEXP31) {
- if (d != -TWEXP31 || ((-(p & 077777) * (q & 077777)) & 040000) == 0) {
+ if (d != -TWEXP31 || ((-(p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) == 0) {
mp->arith_error = 1;
}
return -negative_EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && ((-(p & 077777) * (q & 077777)) & 040000) != 0) {
+ if (d == (double) i && ((-(p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) != 0) {
++i;
}
return i;
@@ -860,13 +860,13 @@ static int mp_take_scaled (MP mp, int p, int q)
if ((p ^ q) >= 0) {
d += 0.5;
if (d >= TWEXP31) {
- if (d != TWEXP31 || (((p & 077777) * (q & 077777)) & 040000) == 0) {
+ if (d != TWEXP31 || (((p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) == 0) {
mp->arith_error = 1;
}
return EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((p & 077777) * (q & 077777)) & 040000) != 0) {
+ if (d == (double) i && (((p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) != 0) {
--i;
}
return i;
@@ -874,13 +874,13 @@ static int mp_take_scaled (MP mp, int p, int q)
} else {
d -= 0.5;
if (d <= -TWEXP31) {
- if (d != -TWEXP31 || ((-(p & 077777) * (q & 077777)) & 040000) == 0) {
+ if (d != -TWEXP31 || ((-(p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) == 0) {
mp->arith_error = 1;
}
return -negative_EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && ((-(p & 077777) * (q & 077777)) & 040000) != 0) {
+ if (d == (double) i && ((-(p & 0x7FFF) * (q & 0x7FFF)) & 0x4000) != 0) {
++i;
}
return i;
@@ -914,7 +914,7 @@ int mp_make_scaled (MP mp, int p, int q)
return EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((q > 0 ? -q : q) & 077777) * (((i & 037777) << 1) - 1) & 04000) != 0) {
+ if (d == (double) i && (((q > 0 ? -q : q) & 0x7FFF) * (((i & 0x3FFF) << 1) - 1) & 0x800) != 0) {
--i;
}
return i;
@@ -926,7 +926,7 @@ int mp_make_scaled (MP mp, int p, int q)
return -negative_EL_GORDO;
} else {
int i = (int) d;
- if (d == (double) i && (((q > 0 ? q : -q) & 077777) * (((i & 037777) << 1) + 1) & 04000) != 0) {
+ if (d == (double) i && (((q > 0 ? q : -q) & 0x7FFF) * (((i & 0x3FFF) << 1) + 1) & 0x800) != 0) {
++i;
}
return i;
@@ -1575,7 +1575,7 @@ void mp_m_exp (MP mp, mp_number *ret, mp_number *x_orig)
} else {
if (x <= 0) {
z = -8 * x;
- y = 04000000; /* $y=2^{20}$ */
+ y = 0x100000; /* $y=2^{20}$ */
} else {
if (x <= 127919879) {
z = 1023359037 - 8 * x;
diff --git a/source/luametatex/source/mp/mpw/mpmathdouble.w b/source/luametatex/source/mp/mpw/mpmathdouble.w
index f5a91df75..c836fc4bb 100644
--- a/source/luametatex/source/mp/mpw/mpmathdouble.w
+++ b/source/luametatex/source/mp/mpw/mpmathdouble.w
@@ -23,7 +23,7 @@ math_data *mp_initialize_double_math (MP mp);
@* Math initialization.
-First, here are some very important constants.
+First, here are some very important constants. We can have some more (see velocity).
@d PI 3.1415926535897932384626433832795028841971
@d fraction_multiplier 4096.0
diff --git a/source/luametatex/source/mp/readme.txt b/source/luametatex/source/mp/readme.txt
index c48e19a89..bb98005de 100644
--- a/source/luametatex/source/mp/readme.txt
+++ b/source/luametatex/source/mp/readme.txt
@@ -1,14 +1,14 @@
-Remark
-
-When a CWEB file is adapted we need to convert to C. This is normally done with the tangle
-program but as we want to be independent of other tools (which themselves can result in a
-chain of dependencies) we use a Lua script which happens to be run with LuaMetaTeX.
-
-Of course there is a chicken egg issue here but at some point we started with C files so
-now we only need to update.
-
-The script is located in the "tools" path alongside the "source" path and it is run in its
-own directory (which for me means: hit the run key when the document is open). As we always
-ship the C files, there is no need for a user to run the script.
-
+Remark
+
+When a CWEB file is adapted we need to convert to C. This is normally done with the tangle
+program but as we want to be independent of other tools (which themselves can result in a
+chain of dependencies) we use a Lua script which happens to be run with LuaMetaTeX.
+
+Of course there is a chicken egg issue here but at some point we started with C files so
+now we only need to update.
+
+The script is located in the "tools" path alongside the "source" path and it is run in its
+own directory (which for me means: hit the run key when the document is open). As we always
+ship the C files, there is no need for a user to run the script.
+
Hans Hagen \ No newline at end of file
diff --git a/source/luametatex/source/readme.txt b/source/luametatex/source/readme.txt
index 2471f32b3..c045119ed 100644
--- a/source/luametatex/source/readme.txt
+++ b/source/luametatex/source/readme.txt
@@ -1,563 +1,563 @@
---------------------------------------------------------------------------------
-welcome
---------------------------------------------------------------------------------
-
-There is not much information here. I normally keep track of developments in
-articles or chapters in the history documents. These can (sometimes with a delay
-when it's an article) be found in the ConTeXt distribution. The history and
-development of LuaTeX is also documented there, often with examples or usage.
-
-The ideas behind this project are discussed in documents in the regular ConTeXt
-distribution. A short summary is: in order to make sure ConTeXt will work as
-intended, we distribute an engine with it. That way we can control stability,
-performance and features. It also permits experiments without the danger of
-interference with the engines used in other macro packages. Also, we don't want
-dependencies on large subsystems so we have a well defined set of libraries: we
-want to stay lean and mean. Eventually the same applies as to original TeX: we
-fix bugs and don't add all kind of stuff we don't (want or) need. Just that.
-
---------------------------------------------------------------------------------
-codebase
---------------------------------------------------------------------------------
-
-This codebase is a follow up on LuaTeX. It all started with a merge of files
-that came from the Pascal to C converter (CWEB) plus some C libraries. That code
-base evolved over time and there were the usual side effects of the translation
-and merge of (also other engine) code, plus successive extensions as well as Lua
-interfaces. In LuaMetaTeX I tried to smooth things a bit. The idea was to stay
-close to the original (which in the end is TeX itself) so that is why many
-variables, functions etc are named the way they are. Of course I reshuffled, and
-renamed but I also tried to stay close to the original naming. More work needs
-to be done to get it all right but it happens stepwise as I don't want to
-introduce bugs. In the meantime the LuaTeX and LuaMetaTeX code bases differ
-substantially but apart from some new features and stripping away backend and
-font code, the core should work the same.
-
-tex etex pdftex aleph:
-
-Of course the main body of code comes from its ancestors. We started with pdfTeX
-which has its frontend taken from standard TeX, later extended with the eTeX
-additions. Some additional features from pdfTeX were rewritten to become core
-functionality. We also took some from Aleph (Omega) but only some (in the
-meantime adapted) r2l code is left (so we're not compatible).
-
-mp:
-
-The maintainance of MetaPost was delegated to the same people who do luaTeX and
-as a step indevelopment a library was written. This library is used in
-LuaMetaTeX but has been adapted a bit for it. In principle some of the additions
-can be backported, but that is yet undecided.
-
-lua:
-
-This is the third major component of LuaMetaTeX. In LuaTeX a slightly patched
-version has been used but here we use an unchanged version, although the version
-number of the bytecode blob is adapted so that we can use intermediate versions
-of lua 5.4 that expect different bytecode without crashing on existing bytecode;
-this trick has been dropped but I hope at some point Lua will add a define for
-this.
-
-For the record: when we started with LuaTeX I'd gone through a pascal, modula 2,
-perl, ruby with respect to the management helpers for ConTeXt, like dealing with
-indexes, managing metapost subruns, and all kind of goodies that evolved over time.
-I ran into Lua in the SciTE editor and the language and the concept of a small and
-efficient embedded language. The language orginates in academia and is not under
-the influence of (company and commercial driven) marketing. A lot of effort goes
-into stepwise evolution. The authors are clear about the way they work on the
-language:
-
- http://lua-users.org/lists/lua-l/2008-06/msg00407.html
-
-which fits nicely in our philosophy. Just in case one wonders if other scripting
-languages were considered the answer is: no, they were not. The alternatives all
-are large and growing and come with large ecosystems (read: dependencies) and some
-had (seemingly) drastic changes in the design over time. Of course Lua also evolves
-but that is easy to deal with. And in the meantime also the performance of Lua made
-it clear that it was the right choice.
-
-avl:
-
-This library has been in use in the backend code of LuaTeX but is currently only
-used in the MP library. I'm not sure to what extend this (originally meant for
-Python) module has been adapted for pdfTeX/LuaTeX but afaiks it has been stable
-for a long time. It won't be updated but I might adapt it for instance wrt error
-messages so that it fits in.
-
-decnumber:
-
-This is used in one of the additional number models that the mp library supports.
-In LuaMetaTeX there is no support for the binary model. No one uses it and it
-would add quite a bit to the codebase.
-
-hnj:
-
-This GPL licensed module is used in the hyphenation machinery. It has been
-slightly adapted so that error messages and such fit in. I don't expect it to
-change much in the future.
-
-pplib:
-
-This library is made for Lua(Meta)TeX and provides an efficient PDF parser in
-pure C. In LuaTeX it was introduced a replacement for a larger library that
-was overkill for our purpose, depended on C++ and kept changing. This library
-itself uses libraries but that code is shipped with it. We use some of that
-for additional Lua modules (like md5, sha2 and decoding).
-
-lz4 | lzo | zstd:
-
-For years this library was in the code base and even interfaced but not enabled
-by default. When I played with zstd support as optional libary I decided that
-these two should move out of the code base and also be done the optional way. The
-amount of code was not that large, but the binary grew by some 10%. I also played
-with the foreign module and zstd and there is no real difference in peformance. The
-optionals are actually always enabled, but foreign is controlled by the command
-line option that enables loading libraries, and it al;so depends on libffi.
-
-zlib | miniz:
-
-I started with the code taken from LuaTeX, which itself was a copy that saw some
-adaptions over time (irr there were border case issues, like dealing with zero
-length streams and so). It doesn't change so in due time I might strip away some
-unused code. For a while libdeflate was used but because pplib also depends on
-zlib and because libdeflate doesn't do streams that was abandoned (it might come
-back as it is very nice and clean code.). One issue with (de)compression libraries
-is that they use tricks that can be architecture dependent and we stay away from
-that. I try to stay away from those and prefer to let the compiler sort things out.
-
-Early 2021 we switched to miniz. One reason is that the codebase is smaller because
-it doesn't deal with very old or rare platforms and architectures. Its performance
-is comparable, definitely for our purpose, and sometimes even a bit better. I looked
-at other alternatives but as soon as processor specific tricks are used, we end up
-with architecture specific header files and code so it's a no-go for a presumed
-long term stable and easy to compile program like luametatex. There is no gain in it
-anyway.
-
-complex:
-
-There is a complex number interface inspired by the complex number lua module by
-lhf. It also wraps libcerf usage.
-
-lfs:
-
-In LuaTeX we use a patched version of this library. In LuaMetaTeX I rewrote the
-code because too many patches were needed to deal with mswindows properly.
-
-socket:
-
-The core library is used. The library is seldom adapted but I keep an eye on it.
-We used to have a patched version in LuaTeX, but here we stay closer. I might
-eventually do some rewrite (less code) or decide to make it an external library.
-The related Lua code is not in the binary and context uses its own (derived)
-variant so that it uses our helpers as well as fits in the reporting system. I
-need to keep an eye on improvements upstream. We also need to keep an eye on
-copas as we use that code in context.
-
-luasec:
-
-This is not used but here as a reference for a possible future use (maybe as
-library).
-
-curl, ghostscript, graphicmagick, zint, mujs, mysql, postgress, sqlite, ...:
-
-The optional module mechamism supports some external libraries but we don't keep
-their code in the luametatex codebase. We might come up with a separate source
-tree for that, but only for some smaller ones. The large ones, those depending
-on other libraries, or c++, or whatever resources, will just be taken from the
-system.
-
-libcerf:
-
-This library might become external but is now in use as a plug into the complex
-number support that itself is meant for MetaPost use. The code here has been
-adapted to support the Microsoft compiler. I will keep an eye on what happens
-upstream and I reconsider matters later. (There is no real need to bloat the
-LuaMetaTeX binary with something that is rarely used.)
-
-kpse:
-
-There is optional library support for the KPSE library used in WEB2C. Although
-it does provide the methods that make sense, it is not meant for usage in
-ConTeXt, but more as a toolkit to identify issues and conflicts with parallel
-installations like TeXLive.
-
-hb:
-
-I have a module that works the same as the ffi variant from a couple of years
-ago and I might add it when it's needed (for oriental tex font development
-checking purposes, but then I also need to cleanup and add some test styles for
-that purpose). Looking at the many LuaTeX subversion checkins it looks a bit
-like a moving target. It's also written in C++ which we don't (want to) use in
-LuaMetaTeX. But the library comes with other programs so it's likely you can
-find it on you system someplace.
-
-general:
-
-It's really nice to see all these libraries popping up on the web but in the
-perspective of something like TeX one should be careful. Quite often what is hip
-today is old fashioned tomorrow. And quite often the selling point of the new
-thing comes with bashing the old, which can be a sign of something being a
-temporary thing or itself something ot be superseded soon. Now, get me right:
-TeX in itself is great, and so are successors. In that sense LuaMetaTeX is just
-a follow up with no claims made for it being better. It just makes things easier
-for ConTeXt. You can kick in libraries but be aware of the fact that they can
-change, so if you have long running projects, make sure you save them. Or run a
-virtual machine that can last forever. TeX systems can run for ages that way. We
-might eventually add support for generating libs to the compile farm. The older
-a library gets, the bigger the change that its api is stable. Compression
-libraries are great examples, while libraries that deal with images, conversion
-and rendering are more moving (and have way more dependencies too). Actually,
-for the later category, in ConTeXt we prefer to call the command line variants
-instead of using libraries, also because it seldom influences performance.
-
-licenses:
-
-Most files contain some notice about a the license and most are quite liberal.
-I had to add some (notes) that were missing from LuaTeX. There is an occasional
-readme file that tells a bit more.
-
-explanations:
-
-The TeX derived source code contains many comments that came with the code when
-it was moved from "Pascal Web" to "C Web" (with web2c) to "C plus comments" (by
-Taco). These comments are mostly from Don Knuth as they were part of TeX The
-Program. However, some comments were added (or changed) in the perspective of
-eTeX, pdfTeX, Aleph, etc. We also added some in LuaTeX and LuaMetaTeX. So, in
-the meantime it's a mix. It us who made the mess, not Don! In due time I hope
-to go over all the comments and let them fit the (extended) code.
-
-dependencies:
-
-Often the files here include more h files than needed but given the speed of
-compilation that is no problem. It also helps to identify potential name clashes
-and such.
-
-legacy:
-
-Occasionally there is a file texlegacy.c that has some older (maybe reworked)
-code but I move it to another place when It gets too large and its code no
-longer can be retrofit. For me is shows a bit what got done in the (many)
-intermediate steps.
-
---------------------------------------------------------------------------------
-documentation
---------------------------------------------------------------------------------
-
-The code will be stepwise cleaned up a it (removing the web2c side effects),
-making the many branches stand out etc so that some aspects can be documented
-a bit better (in due time). All this will take time (and already quite some time
-went into it.) The official interface of LuaMetaTeX is described in the manual
-and examples of usage can be seen in ConTeXt. Of course TeX behaves as such.
-
-The organization of files, names of functions can change as we progress but when
-possible the knuthian naming is followed so that the documentation of "TeX The
-Program" still (mostly) applies. Some of the improvements in LuaMetaTeX can
-eventually trickle back into LuaTeX although we need to guard stability. The
-files here can *not* be dropped into the LuaTeX source tree!
-
---------------------------------------------------------------------------------
-reboot
---------------------------------------------------------------------------------
-
-I'll experiment with a reboot engine option but for sure that also interferes
-with a macro package initialization so it's a long term experiment. Quite
-certainly it will not pay off anyway so it might never happen. But there are
-some pending ideas so ...
-
---------------------------------------------------------------------------------
-libraries | ffi | luajit
---------------------------------------------------------------------------------
-
-We use optional libraries instead of ffi which is not supported because it is
-cpu and platform bound and the project that the code was taken from seems to
-be orphaned. Also luajit is not supported as that projects is stalled and uses
-an old lua.
-
---------------------------------------------------------------------------------
-cmake
---------------------------------------------------------------------------------
-
-We (Mojca and Hans) try to make the build as simple as possible with a minimum
-of depencies. There are some differences with respect to unix and windows (we
-support msvc, crosscompiled mingw and clang). The code of libraries that we use
-is included, apart from optional libraries. It can only get better.
-
-We really try to make all compilers happy and minimize the number of messages,
-even if that makes the code a bit less nice. It's a bit unfortunate that over
-time the demands and default change a bit (what was needed before triggers a
-warning later).
-
---------------------------------------------------------------------------------
-experiments
---------------------------------------------------------------------------------
-
-I've done quite some experiments but those that in the end didn't make sense, or
-complicated the code, or where nice but not that useful after all were simply
-deleted so that no traces are left that can clutter the codebase. I'll probably
-for get (and for sure already have forgotten) about most of them so maybe some
-day they will show up as (different) experiments. We'll see how that goes.
-
--- miniz : smaller pdf files, less code, similar performance
--- mimalloc : especially faster for the lua subsystem
-
---------------------------------------------------------------------------------
-performance
---------------------------------------------------------------------------------
-
-By now the codebase is different from the LuaTeX one and as a consequence the
-performance can also differ. But it's hard to measure in ConTeXt because much
-more has to be done in Lua and that comes at a price. The native LuaTeX backend
-is for instance much faster (last time meausred the penalty can be up to 20%).
-On the Internet one can run into complaints about performance of LuaTeX with
-other macro packages, so one might wonder why we made this move but speed is
-not everything. On the average ConTeXt has not become less efficient, or
-at least I don't see its users complain much about it, so we just moved on.
-
-The memory footprint at the engine end is somewhat smaller but of course that
-gets compensated by memory consumption at the Lua end. We also sacrifice the
-significate gain of the faster LuaJIT virtual machine (although at some point
-supporting that variant makes not much sense any more as it lacks some Lua
-features). Because, contrary to other TeX's the Lua(Meta)TeX frontend code
-is split up in separate units, compilers can probably do less optimization,
-although we use large compilations units that are mostly independent of each
-other.
-
-Eventually, in a next stage, I might be able to compentate it but don't expect
-miracles: I already explored all kind of variations. Buying a faster machine is
-always an option. Multiple cores don't help, faster memory and caching of files
-does. Already early in the LuaTeX development we found that a CPU cache matters
-but (definitely on server with many a virtual machines) there LuaMetaTeX has to
-compete.
-
-So, at this point my objective is not so much to make LuaMetaTeX run faster but
-more to make sure that it keeps the same performance, even if more functionality
-gets added to the TeX, MetaPost and/or Lua parts. Also keep in mind that in the
-end inefficient macros and styles play a bigger role that the already pretty
-fast engine.
-
---------------------------------------------------------------------------------
-rapid development cycle
---------------------------------------------------------------------------------
-
-Because I don't want to divert too much (and fast) from the way traditional TeX
-is coded, the transition is a stepwise process. This also means that much code
-that first has been abstracted and cleaned up, later goes. The extra work that
-is involved, combined with a fast test cycle with the help of ConTeXt users
-ensures that we keep a working ConTeXt although there occasionally are periods
-with issues, especially when fundamentals change or are extended. However, the
-number of temporary bugs is small compared to the number of changes and
-extensions and worth the risk. The alternative is to have long periods where we
-don't update the engine, but that makes testing the related changes in ConTeXt
-rather cumbersome. After all, the engine targets at ConTeXt. But of course it is
-kind of a pity that no one sees what steps were used to get there.
-
---------------------------------------------------------------------------------
-api
---------------------------------------------------------------------------------
-
-Although some symbols can be visible due to the fact that we maek them extern as
-past of a code splitup, there is no api at all. Don't expect the names of the
-functions and variables that this applies to to remain the same. Blame yourself
-for abusing this partial exposure. The abstraction is in the \LUA\ interface and
-when possible that one stays the same. Adding more and more access (callbacks)
-won't happen because it has an impact on performance.
-
-Because we want to stay close to original TeX in many aspects, the names of
-functions try to match those in ttp. However, because we're now in pure C, we
-have more functions (and less macros). The compiler will inline many of them,
-but plenty will show up in the symbols table, when exposed. For that reason we
-prefix all functions in categories so that they at least show up in groups. It
-is also the reason why in for instance the optional modules code we collect all
-visible locals in structs. It's all a stepwise process.
-
-The split in tex* modules is mostly for convenience. The original program is
-monolithic (you can get an idea when you look at mp.c) so in a sense they should
-all be seen as a whole. As a consequence we have tex_run_* as externals as well
-as locals. It's just an on-purpose side effect, not a matter of inconsistency:
-there is no tex api.
-
---------------------------------------------------------------------------------
-todo (ongoing)
---------------------------------------------------------------------------------
-
-- All errors and warnings (lua|tex|fatal) have to be checked; what is critital
- and what not.
-- I need to figure out why filetime differs between msvc and mingw (daylight
- correction probably).
-- Nested runtime measurement is currently not working on unix (but it works ok
- on microsoft windows).
-- I will check the manual for obsolete, removed and added functionality. This
- is an ongoing effort.
-- Eventually I might do some more cleanup of the mp*.w code. For now we keep
- w files, but who knows ...
-- A bit more reshuffling of functions to functional units is possible but that
- happens stepwise as it's easy to introduce bug(let)s. I will occasionally go
- over all code.
-- I might turn some more macros into functions (needs some reshuffling too)
- because it's nicer wrt tracing issues. When we started with LuaTeX macros
- made more sense but compilers got better. In the meantime whole program
- optimization works okay, but we cannot do that when one also wants to load
- modules.
-- A side track of the lack of stripping (see previous note) is that we need to
- namespace locals more agressive ... most is done.
-- We can clean up the dependency chain i.e. header files and such but this is
- a long term activity. It's also not that important.
-- Maybe nodememoryword vs tokenmemoryword so that the compiler can warn for a
- mixup.
-- Remove some more (also cosmetic) side effects of mp library conversion.
-- Replace some more of the print* chains by the more compact print_format call
- (no hurry with that one).
-- The naming between modules (token, tex, node) of functions is (historically)
- a bit inconsistent (getfoo, get_foo etc) so I might make that better. It does
- have some impact on compatibility but one can alias (we can provide a file).
-- Some more interface related code might get abstracted (much already done).
-- I don't mention other (either or not already rejected) ideas and experiments
- here (like pushing/popping pagebuilder states which is messy and also demands
- too much from the macro package end.)
-- Stepwise I'll make the complete split of command codes (chr) and subtypes.
- This is mostly done but there are some leftovers. It also means that we no
- longer are completely in sync with the internal original \TEX\ naming but I'll
- try to remain close.
-- The glyph and math scale features do not yet check for overflow of maxdimen
- but I'll add some more checks and/or impose some limitations on the scale
- values. We have to keep in mind that TeX itself also hapilly accepts some
- wrap around because it doesn't really crash the engine; it just can have side
- effects.
-
---------------------------------------------------------------------------------
-todo (second phase)
---------------------------------------------------------------------------------
-
-Ideally we'd like to see more local variables (like some cur_val and such) but
-it's kind of tricky because these globals are all over the place and sometimes
-get saved and restored (so that needs careful checking), and sometimes such a
-variable is expected to be set in a nested call. It also spoils the (still
-mostly original) documentation. So, some will happen, some won't. I actually
-tested some rather drastic localization and even with tripple checking there
-were side effects, so I reverted that. (We probably end up with a mix that
-shows the intention.)
-
-Anyway, there are (and will be) some changes (return values instead of accessing
-global) that give a bit less code on the one hand (and therefore look somewhat
-cleaner) but are not always more efficient. It's all a matter of taste.
-
-I'm on and off looking at the files and their internal documentation and in the
-process rename some variables, do some extra checking, and remove unused code.
-This is a bit random activity that I started doing pending the first official
-release.
-
-Now that the math engine has been partly redone the question is: should we keep
-the font related control options? They might go away at some point and even
-support for traditional eight bit fonts might be dropped. We'll see about that.
-
-That is: we saw about it. End 2021 and beginning of 2022 Mikael Sundqvist and I
-spent quite a few months on playing around with new features: more classes, inter
-atom spacing, inter atom penalties, atom rules, a few more FontParameters, a bit
-more control on top of what we already had, etc. In the end some of the control
-already present became standardized in a way that now prefers OpenType fonts.
-Persistent issues with fonts are now dealt with on a per font basis in ConteXt
-using existing as well as new tweaking features. We started talking micro math
-typography. Old fonts are still supported but one has to configure the engine
-with respecty to the used technology. Another side effect is that we now store
-math character specifications in nodes instead of a number.
-
-It makes sense to simplify delimiters (just make them a mathchar) and get rid of
-the large family and char. These next in size and extensibles are to be related
-anyway so one can always make a (runtime) virtual font. The main problem is that
-we then need to refactor some tex (format) code too becuase we no longer have
-delimiters there too.
-
---------------------------------------------------------------------------------
-dependencies
---------------------------------------------------------------------------------
-
-There are no depencies on code outside this tree and we keep it that way. If you
-follow the TeXLive (LuaTeX) source update you'll notice that there are quite
-often updates of libraries and sometimes they give (initial) issues when being
-compiled, also because there can be further dependencies on compilers as well as
-libraries specific to a (version of) an operating system. This is not something
-that users should be bothered with.
-
-Optional libraries are really optional and although an API can change we will
-not include related code in the formal LuaMetaTeX code base. We might offer some
-in the build farm (for building libraries) but that is not a formal dependency.
-We will of course adapt code to changes in API's but also never provide more
-than a minimal interface: use Lua when more is needed.
-
-We keep in sync with Lua development, also because we consider LuaMetaTeX to be
-a nice test case. We never really have issues with Lua anyway. Maybe at some
-point I will replace the socket related code. The mimalloc libraries used gives
-a performance boost but we could do without. The build cerf library might be
-replaced by an optional but it also depends on the complex datatype being more
-mature: there is now a fundamental difference between compilers so we have a
-patched version; the code doesn't change anyway, so maybe it can be stripped.
-
-In practice there have been hardly any updates to the libraries that we do use:
-most changes are in auxiliary programs and make files anyway. When there is an
-update (most are on github) this is what happens:
-
--- check out code
--- compare used subset (like /src) with working copy
--- merge with working copy if it makes sense (otherwise delay)
--- test for a while (local compilation etc.)
--- compare used subset again, this time with local repository
--- merge with local repository
--- push update to the build farm
-
-So, each change is checked twice which in practice doesn't take much time but
-gives a good idea of the kind of changes. So far we never had to roll back.
-
-We still use CWEB formatting for MetaPost which then involves a conversion to C
-code but the C code is included. This removes a depedency on the WEB toolchain.
-The Lua based converter that is part of this source tree works quite well for
-our purpose (and also gives nicer code).
-
-We don't do any architecture (CPU) or operating system specific optimizations,
-simply because there is no real gain for LuaMetaTeX. It would only introduce
-issues, a more complex build, dependencies on assembly generators, etc. which
-is a no-go.
-
---------------------------------------------------------------------------------
-team / responsibilities
---------------------------------------------------------------------------------
-
-The LuaTeX code base is part of the ConTeXt code base. That way we can guarantee
-its working with the ConTeXt macro package and also experiment as much as we
-like without harming this package. The ConTeXt code is maintained by Hans Hagen
-and Wolfgang Schuster with of course help and input from others (those who are
-on the mailing list will have no problem identifying who). Because we see the
-LuaMetaTeX code as part of that effort, starting with its more or less official
-release (version 2.05, early 2020), Hans and Wolfgang will be responsible for
-the code (knowing that we can always fall back on Taco) and explore further
-possibilities. Mojca Miklavec handles the compile farm, coordinates the
-distributions, deals with integration in TeXLive, etc. Alan Braslau is the first
-line tester so that in an early stage we can identify issues with for TeX,
-MetaPost, Lua and compilation on the different platforms that users have.
-
-If you run into problems with LuaMetaTeX, the ConTeXt mailing list is the place
-to go to: ntg-context@ntg.nl. Of course you can also communicate LuaTeX problems
-there, especially when you suspect that both engines share it, but for specific
-LuaTeX issues there is dev-luatex@ntg.nl where the LuaTeX team can help you
-further.
-
-This (mid 2018 - begin 2020) is the first stage of the development. Before we
-move on, we (read: users) will first test the current implementation more
-extensively over a longer period of time, something that is really needed because
-there are lots of accumulated changes, and I would not be surprised if subtle
-issues have been introduced. In the meantime we will discuss how to follow up.
-
-The version in the distribution is always tested with the ConteXt test suite,
-which hopefully uncovers issues before users notice.
-
-Stay tuned!
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
-ConTeXt websites : http://contextgarden.net http://www.pragma-ade.nl
-Development list : dev-context@ntg.nl
-Support list : context@ntg.nl
-User groups : http://ntg.nl http://tug.org etc
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
-Hans Hagen : j.hagen@xs4all.nl
---------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+welcome
+--------------------------------------------------------------------------------
+
+There is not much information here. I normally keep track of developments in
+articles or chapters in the history documents. These can (sometimes with a delay
+when it's an article) be found in the ConTeXt distribution. The history and
+development of LuaTeX is also documented there, often with examples or usage.
+
+The ideas behind this project are discussed in documents in the regular ConTeXt
+distribution. A short summary is: in order to make sure ConTeXt will work as
+intended, we distribute an engine with it. That way we can control stability,
+performance and features. It also permits experiments without the danger of
+interference with the engines used in other macro packages. Also, we don't want
+dependencies on large subsystems so we have a well defined set of libraries: we
+want to stay lean and mean. Eventually the same applies as to original TeX: we
+fix bugs and don't add all kind of stuff we don't (want or) need. Just that.
+
+--------------------------------------------------------------------------------
+codebase
+--------------------------------------------------------------------------------
+
+This codebase is a follow up on LuaTeX. It all started with a merge of files
+that came from the Pascal to C converter (CWEB) plus some C libraries. That code
+base evolved over time and there were the usual side effects of the translation
+and merge of (also other engine) code, plus successive extensions as well as Lua
+interfaces. In LuaMetaTeX I tried to smooth things a bit. The idea was to stay
+close to the original (which in the end is TeX itself) so that is why many
+variables, functions etc are named the way they are. Of course I reshuffled, and
+renamed but I also tried to stay close to the original naming. More work needs
+to be done to get it all right but it happens stepwise as I don't want to
+introduce bugs. In the meantime the LuaTeX and LuaMetaTeX code bases differ
+substantially but apart from some new features and stripping away backend and
+font code, the core should work the same.
+
+tex etex pdftex aleph:
+
+Of course the main body of code comes from its ancestors. We started with pdfTeX
+which has its frontend taken from standard TeX, later extended with the eTeX
+additions. Some additional features from pdfTeX were rewritten to become core
+functionality. We also took some from Aleph (Omega) but only some (in the
+meantime adapted) r2l code is left (so we're not compatible).
+
+mp:
+
+The maintainance of MetaPost was delegated to the same people who do luaTeX and
+as a step indevelopment a library was written. This library is used in
+LuaMetaTeX but has been adapted a bit for it. In principle some of the additions
+can be backported, but that is yet undecided.
+
+lua:
+
+This is the third major component of LuaMetaTeX. In LuaTeX a slightly patched
+version has been used but here we use an unchanged version, although the version
+number of the bytecode blob is adapted so that we can use intermediate versions
+of lua 5.4 that expect different bytecode without crashing on existing bytecode;
+this trick has been dropped but I hope at some point Lua will add a define for
+this.
+
+For the record: when we started with LuaTeX I'd gone through a pascal, modula 2,
+perl, ruby with respect to the management helpers for ConTeXt, like dealing with
+indexes, managing metapost subruns, and all kind of goodies that evolved over time.
+I ran into Lua in the SciTE editor and the language and the concept of a small and
+efficient embedded language. The language orginates in academia and is not under
+the influence of (company and commercial driven) marketing. A lot of effort goes
+into stepwise evolution. The authors are clear about the way they work on the
+language:
+
+ http://lua-users.org/lists/lua-l/2008-06/msg00407.html
+
+which fits nicely in our philosophy. Just in case one wonders if other scripting
+languages were considered the answer is: no, they were not. The alternatives all
+are large and growing and come with large ecosystems (read: dependencies) and some
+had (seemingly) drastic changes in the design over time. Of course Lua also evolves
+but that is easy to deal with. And in the meantime also the performance of Lua made
+it clear that it was the right choice.
+
+avl:
+
+This library has been in use in the backend code of LuaTeX but is currently only
+used in the MP library. I'm not sure to what extend this (originally meant for
+Python) module has been adapted for pdfTeX/LuaTeX but afaiks it has been stable
+for a long time. It won't be updated but I might adapt it for instance wrt error
+messages so that it fits in.
+
+decnumber:
+
+This is used in one of the additional number models that the mp library supports.
+In LuaMetaTeX there is no support for the binary model. No one uses it and it
+would add quite a bit to the codebase.
+
+hnj:
+
+This GPL licensed module is used in the hyphenation machinery. It has been
+slightly adapted so that error messages and such fit in. I don't expect it to
+change much in the future.
+
+pplib:
+
+This library is made for Lua(Meta)TeX and provides an efficient PDF parser in
+pure C. In LuaTeX it was introduced a replacement for a larger library that
+was overkill for our purpose, depended on C++ and kept changing. This library
+itself uses libraries but that code is shipped with it. We use some of that
+for additional Lua modules (like md5, sha2 and decoding).
+
+lz4 | lzo | zstd:
+
+For years this library was in the code base and even interfaced but not enabled
+by default. When I played with zstd support as optional libary I decided that
+these two should move out of the code base and also be done the optional way. The
+amount of code was not that large, but the binary grew by some 10%. I also played
+with the foreign module and zstd and there is no real difference in peformance. The
+optionals are actually always enabled, but foreign is controlled by the command
+line option that enables loading libraries, and it al;so depends on libffi.
+
+zlib | miniz:
+
+I started with the code taken from LuaTeX, which itself was a copy that saw some
+adaptions over time (irr there were border case issues, like dealing with zero
+length streams and so). It doesn't change so in due time I might strip away some
+unused code. For a while libdeflate was used but because pplib also depends on
+zlib and because libdeflate doesn't do streams that was abandoned (it might come
+back as it is very nice and clean code.). One issue with (de)compression libraries
+is that they use tricks that can be architecture dependent and we stay away from
+that. I try to stay away from those and prefer to let the compiler sort things out.
+
+Early 2021 we switched to miniz. One reason is that the codebase is smaller because
+it doesn't deal with very old or rare platforms and architectures. Its performance
+is comparable, definitely for our purpose, and sometimes even a bit better. I looked
+at other alternatives but as soon as processor specific tricks are used, we end up
+with architecture specific header files and code so it's a no-go for a presumed
+long term stable and easy to compile program like luametatex. There is no gain in it
+anyway.
+
+complex:
+
+There is a complex number interface inspired by the complex number lua module by
+lhf. It also wraps libcerf usage.
+
+lfs:
+
+In LuaTeX we use a patched version of this library. In LuaMetaTeX I rewrote the
+code because too many patches were needed to deal with mswindows properly.
+
+socket:
+
+The core library is used. The library is seldom adapted but I keep an eye on it.
+We used to have a patched version in LuaTeX, but here we stay closer. I might
+eventually do some rewrite (less code) or decide to make it an external library.
+The related Lua code is not in the binary and context uses its own (derived)
+variant so that it uses our helpers as well as fits in the reporting system. I
+need to keep an eye on improvements upstream. We also need to keep an eye on
+copas as we use that code in context.
+
+luasec:
+
+This is not used but here as a reference for a possible future use (maybe as
+library).
+
+curl, ghostscript, graphicmagick, zint, mujs, mysql, postgress, sqlite, ...:
+
+The optional module mechamism supports some external libraries but we don't keep
+their code in the luametatex codebase. We might come up with a separate source
+tree for that, but only for some smaller ones. The large ones, those depending
+on other libraries, or c++, or whatever resources, will just be taken from the
+system.
+
+libcerf:
+
+This library might become external but is now in use as a plug into the complex
+number support that itself is meant for MetaPost use. The code here has been
+adapted to support the Microsoft compiler. I will keep an eye on what happens
+upstream and I reconsider matters later. (There is no real need to bloat the
+LuaMetaTeX binary with something that is rarely used.)
+
+kpse:
+
+There is optional library support for the KPSE library used in WEB2C. Although
+it does provide the methods that make sense, it is not meant for usage in
+ConTeXt, but more as a toolkit to identify issues and conflicts with parallel
+installations like TeXLive.
+
+hb:
+
+I have a module that works the same as the ffi variant from a couple of years
+ago and I might add it when it's needed (for oriental tex font development
+checking purposes, but then I also need to cleanup and add some test styles for
+that purpose). Looking at the many LuaTeX subversion checkins it looks a bit
+like a moving target. It's also written in C++ which we don't (want to) use in
+LuaMetaTeX. But the library comes with other programs so it's likely you can
+find it on you system someplace.
+
+general:
+
+It's really nice to see all these libraries popping up on the web but in the
+perspective of something like TeX one should be careful. Quite often what is hip
+today is old fashioned tomorrow. And quite often the selling point of the new
+thing comes with bashing the old, which can be a sign of something being a
+temporary thing or itself something ot be superseded soon. Now, get me right:
+TeX in itself is great, and so are successors. In that sense LuaMetaTeX is just
+a follow up with no claims made for it being better. It just makes things easier
+for ConTeXt. You can kick in libraries but be aware of the fact that they can
+change, so if you have long running projects, make sure you save them. Or run a
+virtual machine that can last forever. TeX systems can run for ages that way. We
+might eventually add support for generating libs to the compile farm. The older
+a library gets, the bigger the change that its api is stable. Compression
+libraries are great examples, while libraries that deal with images, conversion
+and rendering are more moving (and have way more dependencies too). Actually,
+for the later category, in ConTeXt we prefer to call the command line variants
+instead of using libraries, also because it seldom influences performance.
+
+licenses:
+
+Most files contain some notice about a the license and most are quite liberal.
+I had to add some (notes) that were missing from LuaTeX. There is an occasional
+readme file that tells a bit more.
+
+explanations:
+
+The TeX derived source code contains many comments that came with the code when
+it was moved from "Pascal Web" to "C Web" (with web2c) to "C plus comments" (by
+Taco). These comments are mostly from Don Knuth as they were part of TeX The
+Program. However, some comments were added (or changed) in the perspective of
+eTeX, pdfTeX, Aleph, etc. We also added some in LuaTeX and LuaMetaTeX. So, in
+the meantime it's a mix. It us who made the mess, not Don! In due time I hope
+to go over all the comments and let them fit the (extended) code.
+
+dependencies:
+
+Often the files here include more h files than needed but given the speed of
+compilation that is no problem. It also helps to identify potential name clashes
+and such.
+
+legacy:
+
+Occasionally there is a file texlegacy.c that has some older (maybe reworked)
+code but I move it to another place when It gets too large and its code no
+longer can be retrofit. For me is shows a bit what got done in the (many)
+intermediate steps.
+
+--------------------------------------------------------------------------------
+documentation
+--------------------------------------------------------------------------------
+
+The code will be stepwise cleaned up a it (removing the web2c side effects),
+making the many branches stand out etc so that some aspects can be documented
+a bit better (in due time). All this will take time (and already quite some time
+went into it.) The official interface of LuaMetaTeX is described in the manual
+and examples of usage can be seen in ConTeXt. Of course TeX behaves as such.
+
+The organization of files, names of functions can change as we progress but when
+possible the knuthian naming is followed so that the documentation of "TeX The
+Program" still (mostly) applies. Some of the improvements in LuaMetaTeX can
+eventually trickle back into LuaTeX although we need to guard stability. The
+files here can *not* be dropped into the LuaTeX source tree!
+
+--------------------------------------------------------------------------------
+reboot
+--------------------------------------------------------------------------------
+
+I'll experiment with a reboot engine option but for sure that also interferes
+with a macro package initialization so it's a long term experiment. Quite
+certainly it will not pay off anyway so it might never happen. But there are
+some pending ideas so ...
+
+--------------------------------------------------------------------------------
+libraries | ffi | luajit
+--------------------------------------------------------------------------------
+
+We use optional libraries instead of ffi which is not supported because it is
+cpu and platform bound and the project that the code was taken from seems to
+be orphaned. Also luajit is not supported as that projects is stalled and uses
+an old lua.
+
+--------------------------------------------------------------------------------
+cmake
+--------------------------------------------------------------------------------
+
+We (Mojca and Hans) try to make the build as simple as possible with a minimum
+of depencies. There are some differences with respect to unix and windows (we
+support msvc, crosscompiled mingw and clang). The code of libraries that we use
+is included, apart from optional libraries. It can only get better.
+
+We really try to make all compilers happy and minimize the number of messages,
+even if that makes the code a bit less nice. It's a bit unfortunate that over
+time the demands and default change a bit (what was needed before triggers a
+warning later).
+
+--------------------------------------------------------------------------------
+experiments
+--------------------------------------------------------------------------------
+
+I've done quite some experiments but those that in the end didn't make sense, or
+complicated the code, or where nice but not that useful after all were simply
+deleted so that no traces are left that can clutter the codebase. I'll probably
+for get (and for sure already have forgotten) about most of them so maybe some
+day they will show up as (different) experiments. We'll see how that goes.
+
+-- miniz : smaller pdf files, less code, similar performance
+-- mimalloc : especially faster for the lua subsystem
+
+--------------------------------------------------------------------------------
+performance
+--------------------------------------------------------------------------------
+
+By now the codebase is different from the LuaTeX one and as a consequence the
+performance can also differ. But it's hard to measure in ConTeXt because much
+more has to be done in Lua and that comes at a price. The native LuaTeX backend
+is for instance much faster (last time meausred the penalty can be up to 20%).
+On the Internet one can run into complaints about performance of LuaTeX with
+other macro packages, so one might wonder why we made this move but speed is
+not everything. On the average ConTeXt has not become less efficient, or
+at least I don't see its users complain much about it, so we just moved on.
+
+The memory footprint at the engine end is somewhat smaller but of course that
+gets compensated by memory consumption at the Lua end. We also sacrifice the
+significate gain of the faster LuaJIT virtual machine (although at some point
+supporting that variant makes not much sense any more as it lacks some Lua
+features). Because, contrary to other TeX's the Lua(Meta)TeX frontend code
+is split up in separate units, compilers can probably do less optimization,
+although we use large compilations units that are mostly independent of each
+other.
+
+Eventually, in a next stage, I might be able to compentate it but don't expect
+miracles: I already explored all kind of variations. Buying a faster machine is
+always an option. Multiple cores don't help, faster memory and caching of files
+does. Already early in the LuaTeX development we found that a CPU cache matters
+but (definitely on server with many a virtual machines) there LuaMetaTeX has to
+compete.
+
+So, at this point my objective is not so much to make LuaMetaTeX run faster but
+more to make sure that it keeps the same performance, even if more functionality
+gets added to the TeX, MetaPost and/or Lua parts. Also keep in mind that in the
+end inefficient macros and styles play a bigger role that the already pretty
+fast engine.
+
+--------------------------------------------------------------------------------
+rapid development cycle
+--------------------------------------------------------------------------------
+
+Because I don't want to divert too much (and fast) from the way traditional TeX
+is coded, the transition is a stepwise process. This also means that much code
+that first has been abstracted and cleaned up, later goes. The extra work that
+is involved, combined with a fast test cycle with the help of ConTeXt users
+ensures that we keep a working ConTeXt although there occasionally are periods
+with issues, especially when fundamentals change or are extended. However, the
+number of temporary bugs is small compared to the number of changes and
+extensions and worth the risk. The alternative is to have long periods where we
+don't update the engine, but that makes testing the related changes in ConTeXt
+rather cumbersome. After all, the engine targets at ConTeXt. But of course it is
+kind of a pity that no one sees what steps were used to get there.
+
+--------------------------------------------------------------------------------
+api
+--------------------------------------------------------------------------------
+
+Although some symbols can be visible due to the fact that we maek them extern as
+past of a code splitup, there is no api at all. Don't expect the names of the
+functions and variables that this applies to to remain the same. Blame yourself
+for abusing this partial exposure. The abstraction is in the \LUA\ interface and
+when possible that one stays the same. Adding more and more access (callbacks)
+won't happen because it has an impact on performance.
+
+Because we want to stay close to original TeX in many aspects, the names of
+functions try to match those in ttp. However, because we're now in pure C, we
+have more functions (and less macros). The compiler will inline many of them,
+but plenty will show up in the symbols table, when exposed. For that reason we
+prefix all functions in categories so that they at least show up in groups. It
+is also the reason why in for instance the optional modules code we collect all
+visible locals in structs. It's all a stepwise process.
+
+The split in tex* modules is mostly for convenience. The original program is
+monolithic (you can get an idea when you look at mp.c) so in a sense they should
+all be seen as a whole. As a consequence we have tex_run_* as externals as well
+as locals. It's just an on-purpose side effect, not a matter of inconsistency:
+there is no tex api.
+
+--------------------------------------------------------------------------------
+todo (ongoing)
+--------------------------------------------------------------------------------
+
+- All errors and warnings (lua|tex|fatal) have to be checked; what is critital
+ and what not.
+- I need to figure out why filetime differs between msvc and mingw (daylight
+ correction probably).
+- Nested runtime measurement is currently not working on unix (but it works ok
+ on microsoft windows).
+- I will check the manual for obsolete, removed and added functionality. This
+ is an ongoing effort.
+- Eventually I might do some more cleanup of the mp*.w code. For now we keep
+ w files, but who knows ...
+- A bit more reshuffling of functions to functional units is possible but that
+ happens stepwise as it's easy to introduce bug(let)s. I will occasionally go
+ over all code.
+- I might turn some more macros into functions (needs some reshuffling too)
+ because it's nicer wrt tracing issues. When we started with LuaTeX macros
+ made more sense but compilers got better. In the meantime whole program
+ optimization works okay, but we cannot do that when one also wants to load
+ modules.
+- A side track of the lack of stripping (see previous note) is that we need to
+ namespace locals more agressive ... most is done.
+- We can clean up the dependency chain i.e. header files and such but this is
+ a long term activity. It's also not that important.
+- Maybe nodememoryword vs tokenmemoryword so that the compiler can warn for a
+ mixup.
+- Remove some more (also cosmetic) side effects of mp library conversion.
+- Replace some more of the print* chains by the more compact print_format call
+ (no hurry with that one).
+- The naming between modules (token, tex, node) of functions is (historically)
+ a bit inconsistent (getfoo, get_foo etc) so I might make that better. It does
+ have some impact on compatibility but one can alias (we can provide a file).
+- Some more interface related code might get abstracted (much already done).
+- I don't mention other (either or not already rejected) ideas and experiments
+ here (like pushing/popping pagebuilder states which is messy and also demands
+ too much from the macro package end.)
+- Stepwise I'll make the complete split of command codes (chr) and subtypes.
+ This is mostly done but there are some leftovers. It also means that we no
+ longer are completely in sync with the internal original \TEX\ naming but I'll
+ try to remain close.
+- The glyph and math scale features do not yet check for overflow of maxdimen
+ but I'll add some more checks and/or impose some limitations on the scale
+ values. We have to keep in mind that TeX itself also hapilly accepts some
+ wrap around because it doesn't really crash the engine; it just can have side
+ effects.
+
+--------------------------------------------------------------------------------
+todo (second phase)
+--------------------------------------------------------------------------------
+
+Ideally we'd like to see more local variables (like some cur_val and such) but
+it's kind of tricky because these globals are all over the place and sometimes
+get saved and restored (so that needs careful checking), and sometimes such a
+variable is expected to be set in a nested call. It also spoils the (still
+mostly original) documentation. So, some will happen, some won't. I actually
+tested some rather drastic localization and even with tripple checking there
+were side effects, so I reverted that. (We probably end up with a mix that
+shows the intention.)
+
+Anyway, there are (and will be) some changes (return values instead of accessing
+global) that give a bit less code on the one hand (and therefore look somewhat
+cleaner) but are not always more efficient. It's all a matter of taste.
+
+I'm on and off looking at the files and their internal documentation and in the
+process rename some variables, do some extra checking, and remove unused code.
+This is a bit random activity that I started doing pending the first official
+release.
+
+Now that the math engine has been partly redone the question is: should we keep
+the font related control options? They might go away at some point and even
+support for traditional eight bit fonts might be dropped. We'll see about that.
+
+That is: we saw about it. End 2021 and beginning of 2022 Mikael Sundqvist and I
+spent quite a few months on playing around with new features: more classes, inter
+atom spacing, inter atom penalties, atom rules, a few more FontParameters, a bit
+more control on top of what we already had, etc. In the end some of the control
+already present became standardized in a way that now prefers OpenType fonts.
+Persistent issues with fonts are now dealt with on a per font basis in ConteXt
+using existing as well as new tweaking features. We started talking micro math
+typography. Old fonts are still supported but one has to configure the engine
+with respecty to the used technology. Another side effect is that we now store
+math character specifications in nodes instead of a number.
+
+It makes sense to simplify delimiters (just make them a mathchar) and get rid of
+the large family and char. These next in size and extensibles are to be related
+anyway so one can always make a (runtime) virtual font. The main problem is that
+we then need to refactor some tex (format) code too becuase we no longer have
+delimiters there too.
+
+--------------------------------------------------------------------------------
+dependencies
+--------------------------------------------------------------------------------
+
+There are no depencies on code outside this tree and we keep it that way. If you
+follow the TeXLive (LuaTeX) source update you'll notice that there are quite
+often updates of libraries and sometimes they give (initial) issues when being
+compiled, also because there can be further dependencies on compilers as well as
+libraries specific to a (version of) an operating system. This is not something
+that users should be bothered with.
+
+Optional libraries are really optional and although an API can change we will
+not include related code in the formal LuaMetaTeX code base. We might offer some
+in the build farm (for building libraries) but that is not a formal dependency.
+We will of course adapt code to changes in API's but also never provide more
+than a minimal interface: use Lua when more is needed.
+
+We keep in sync with Lua development, also because we consider LuaMetaTeX to be
+a nice test case. We never really have issues with Lua anyway. Maybe at some
+point I will replace the socket related code. The mimalloc libraries used gives
+a performance boost but we could do without. The build cerf library might be
+replaced by an optional but it also depends on the complex datatype being more
+mature: there is now a fundamental difference between compilers so we have a
+patched version; the code doesn't change anyway, so maybe it can be stripped.
+
+In practice there have been hardly any updates to the libraries that we do use:
+most changes are in auxiliary programs and make files anyway. When there is an
+update (most are on github) this is what happens:
+
+-- check out code
+-- compare used subset (like /src) with working copy
+-- merge with working copy if it makes sense (otherwise delay)
+-- test for a while (local compilation etc.)
+-- compare used subset again, this time with local repository
+-- merge with local repository
+-- push update to the build farm
+
+So, each change is checked twice which in practice doesn't take much time but
+gives a good idea of the kind of changes. So far we never had to roll back.
+
+We still use CWEB formatting for MetaPost which then involves a conversion to C
+code but the C code is included. This removes a depedency on the WEB toolchain.
+The Lua based converter that is part of this source tree works quite well for
+our purpose (and also gives nicer code).
+
+We don't do any architecture (CPU) or operating system specific optimizations,
+simply because there is no real gain for LuaMetaTeX. It would only introduce
+issues, a more complex build, dependencies on assembly generators, etc. which
+is a no-go.
+
+--------------------------------------------------------------------------------
+team / responsibilities
+--------------------------------------------------------------------------------
+
+The LuaTeX code base is part of the ConTeXt code base. That way we can guarantee
+its working with the ConTeXt macro package and also experiment as much as we
+like without harming this package. The ConTeXt code is maintained by Hans Hagen
+and Wolfgang Schuster with of course help and input from others (those who are
+on the mailing list will have no problem identifying who). Because we see the
+LuaMetaTeX code as part of that effort, starting with its more or less official
+release (version 2.05, early 2020), Hans and Wolfgang will be responsible for
+the code (knowing that we can always fall back on Taco) and explore further
+possibilities. Mojca Miklavec handles the compile farm, coordinates the
+distributions, deals with integration in TeXLive, etc. Alan Braslau is the first
+line tester so that in an early stage we can identify issues with for TeX,
+MetaPost, Lua and compilation on the different platforms that users have.
+
+If you run into problems with LuaMetaTeX, the ConTeXt mailing list is the place
+to go to: ntg-context@ntg.nl. Of course you can also communicate LuaTeX problems
+there, especially when you suspect that both engines share it, but for specific
+LuaTeX issues there is dev-luatex@ntg.nl where the LuaTeX team can help you
+further.
+
+This (mid 2018 - begin 2020) is the first stage of the development. Before we
+move on, we (read: users) will first test the current implementation more
+extensively over a longer period of time, something that is really needed because
+there are lots of accumulated changes, and I would not be surprised if subtle
+issues have been introduced. In the meantime we will discuss how to follow up.
+
+The version in the distribution is always tested with the ConteXt test suite,
+which hopefully uncovers issues before users notice.
+
+Stay tuned!
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+ConTeXt websites : http://contextgarden.net http://www.pragma-ade.nl
+Development list : dev-context@ntg.nl
+Support list : context@ntg.nl
+User groups : http://ntg.nl http://tug.org etc
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+Hans Hagen : j.hagen@xs4all.nl
+--------------------------------------------------------------------------------
diff --git a/source/luametatex/source/tex/texadjust.c b/source/luametatex/source/tex/texadjust.c
index 11d2da6ad..775fd546d 100644
--- a/source/luametatex/source/tex/texadjust.c
+++ b/source/luametatex/source/tex/texadjust.c
@@ -161,7 +161,7 @@ void tex_run_vadjust(void)
void tex_finish_vadjust_group(void)
{
- if (! tex_wrapped_up_paragraph(vadjust_par_context)) {
+ if (! tex_wrapped_up_paragraph(vadjust_par_context, 0)) {
halfword box, adjust, target; /*tex for short-term use */
tex_end_paragraph(vadjust_group, vadjust_par_context);
tex_unsave();
diff --git a/source/luametatex/source/tex/texalign.c b/source/luametatex/source/tex/texalign.c
index 7a1045fea..e82a9eaae 100644
--- a/source/luametatex/source/tex/texalign.c
+++ b/source/luametatex/source/tex/texalign.c
@@ -837,7 +837,7 @@ static int tex_aux_nested_no_align(void)
void tex_finish_no_alignment_group(void)
{
- if (! tex_wrapped_up_paragraph(no_align_par_context)) { /* needs testing */
+ if (! tex_wrapped_up_paragraph(no_align_par_context, 0)) { /* needs testing */
tex_end_paragraph(no_align_group, no_align_par_context);
tex_aux_trace_no_align("leaving");
--lmt_alignment_state.no_align_level;
@@ -2091,7 +2091,7 @@ void tex_run_alignment_end_template(void)
} else if (lmt_input_state.input_stack[lmt_input_state.base_ptr].state != token_list_state) {
tex_alignment_interwoven_error(4);
} else if (cur_group == align_group) {
- if (! tex_wrapped_up_paragraph(align_par_context)) { /* needs testing */
+ if (! tex_wrapped_up_paragraph(align_par_context, 0)) { /* needs testing */
tex_end_paragraph(align_group, align_par_context);
if (tex_aux_finish_column()) {
tex_aux_finish_row();
diff --git a/source/luametatex/source/tex/texbuildpage.c b/source/luametatex/source/tex/texbuildpage.c
index be75042eb..5079e926e 100644
--- a/source/luametatex/source/tex/texbuildpage.c
+++ b/source/luametatex/source/tex/texbuildpage.c
@@ -363,6 +363,7 @@ void tex_build_page(void)
do {
halfword current = node_next(contribute_head);
halfword type = node_type(current);
+ halfword subtype = node_subtype(current);
/*tex Update the values of |last_glue|, |last_penalty|, and |last_kern|. */
if (lmt_page_builder_state.last_glue != max_halfword) {
tex_flush_node(lmt_page_builder_state.last_glue);
@@ -372,7 +373,7 @@ void tex_build_page(void)
lmt_page_builder_state.last_kern = 0;
lmt_page_builder_state.last_boundary = 0;
lmt_page_builder_state.last_node_type = type;
- lmt_page_builder_state.last_node_subtype = node_subtype(current);
+ lmt_page_builder_state.last_node_subtype = subtype;
lmt_page_builder_state.last_extra_used = 0;
switch (type) {
case glue_node:
@@ -385,7 +386,9 @@ void tex_build_page(void)
lmt_page_builder_state.last_kern = kern_amount(current);
break;
case boundary_node:
- lmt_page_builder_state.last_boundary = boundary_data(current);
+ if (subtype == page_boundary) {
+ lmt_page_builder_state.last_boundary = boundary_data(current);
+ }
break;
}
/*tex
@@ -725,9 +728,9 @@ void tex_build_page(void)
}
}
if (badness >= awful_bad) {
- criterium = badness;
+ criterium = badness; /* trigger fireup */
} else if (penalty <= eject_penalty) {
- criterium = penalty;
+ criterium = penalty; /* trigger fireup */
} else if (badness < infinite_bad) {
criterium = badness + penalty + lmt_page_builder_state.insert_penalties;
} else {
diff --git a/source/luametatex/source/tex/texcommands.c b/source/luametatex/source/tex/texcommands.c
index 3529f24d2..ddc57f0bd 100644
--- a/source/luametatex/source/tex/texcommands.c
+++ b/source/luametatex/source/tex/texcommands.c
@@ -87,10 +87,11 @@ void tex_initialize_commands(void)
tex_primitive(tex_command, "tabskip", internal_glue_cmd, tab_skip_code, internal_glue_base);
tex_primitive(tex_command, "spaceskip", internal_glue_cmd, space_skip_code, internal_glue_base);
tex_primitive(tex_command, "xspaceskip", internal_glue_cmd, xspace_skip_code, internal_glue_base);
- tex_primitive(tex_command, "parfillleftskip", internal_glue_cmd, par_fill_left_skip_code, internal_glue_base);
- tex_primitive(tex_command, "parfillskip", internal_glue_cmd, par_fill_right_skip_code, internal_glue_base);
- tex_primitive(tex_command, "parinitleftskip", internal_glue_cmd, par_init_left_skip_code, internal_glue_base);
- tex_primitive(tex_command, "parinitrightskip", internal_glue_cmd, par_init_right_skip_code, internal_glue_base);
+ tex_primitive(tex_command, "parfillskip", internal_glue_cmd, par_fill_right_skip_code, internal_glue_base); /*tex This is more like an alias now. */
+ tex_primitive(luatex_command, "parfillleftskip", internal_glue_cmd, par_fill_left_skip_code, internal_glue_base);
+ tex_primitive(luatex_command, "parfillrightskip", internal_glue_cmd, par_fill_right_skip_code, internal_glue_base);
+ tex_primitive(luatex_command, "parinitleftskip", internal_glue_cmd, par_init_left_skip_code, internal_glue_base);
+ tex_primitive(luatex_command, "parinitrightskip", internal_glue_cmd, par_init_right_skip_code, internal_glue_base);
tex_primitive(luatex_command, "mathsurroundskip", internal_glue_cmd, math_skip_code, internal_glue_base);
tex_primitive(luatex_command, "maththreshold", internal_glue_cmd, math_threshold_code, internal_glue_base);
@@ -164,6 +165,8 @@ void tex_initialize_commands(void)
tex_primitive(tex_command, "predisplaypenalty", internal_int_cmd, pre_display_penalty_code, internal_int_base);
tex_primitive(luatex_command, "postinlinepenalty", internal_int_cmd, post_inline_penalty_code, internal_int_base);
tex_primitive(luatex_command, "preinlinepenalty", internal_int_cmd, pre_inline_penalty_code, internal_int_base);
+ tex_primitive(luatex_command, "postshortinlinepenalty", internal_int_cmd, post_short_inline_penalty_code, internal_int_base);
+ tex_primitive(luatex_command, "preshortinlinepenalty", internal_int_cmd, pre_short_inline_penalty_code, internal_int_base);
tex_primitive(tex_command, "pretolerance", internal_int_cmd, pre_tolerance_code, internal_int_base);
tex_primitive(tex_command, "relpenalty", internal_int_cmd, post_relation_penalty_code, internal_int_base); /*tex For old times sake. */
tex_primitive(tex_command, "righthyphenmin", internal_int_cmd, right_hyphen_min_code, internal_int_base);
@@ -344,7 +347,9 @@ void tex_initialize_commands(void)
tex_primitive(luatex_command, "pageboundary", boundary_cmd, page_boundary, 0);
/* tex_primitive(luatex_command, "parboundary", boundary_cmd, par_boundary, 0); */
- tex_primitive(tex_command, "penalty", penalty_cmd, normal_code, 0);
+ tex_primitive(tex_command, "penalty", penalty_cmd, normal_penalty_code, 0);
+ tex_primitive(luatex_command, "hpenalty", penalty_cmd, h_penalty_code, 0);
+ tex_primitive(luatex_command, "vpenalty", penalty_cmd, v_penalty_code, 0);
tex_primitive(tex_command, "char", char_number_cmd, char_number_code, 0);
tex_primitive(luatex_command, "glyph", char_number_cmd, glyph_number_code, 0);
@@ -659,7 +664,6 @@ void tex_initialize_commands(void)
tex_primitive(luatex_command, "meaningasis", convert_cmd, meaning_asis_code, 0); /* for manuals and articles */
tex_primitive(luatex_command, "meaningful", convert_cmd, meaning_ful_code, 0); /* full as in fil */
tex_primitive(luatex_command, "meaningles", convert_cmd, meaning_les_code, 0); /* less as in fil, can't be less than this */
- /*tex Maybe some day also |meaningonly| (no macro: in front). */
tex_primitive(tex_command, "number", convert_cmd, number_code, 0);
tex_primitive(luatex_command, "tointeger", convert_cmd, to_integer_code, 0);
tex_primitive(luatex_command, "tohexadecimal", convert_cmd, to_hexadecimal_code, 0);
@@ -675,6 +679,7 @@ void tex_initialize_commands(void)
tex_primitive(luatex_command, "csactive", convert_cmd, cs_active_code, 0);
/* tex_primitive(luatex_command, "csnamestring", convert_cmd, cs_lastname_code, 0); */
tex_primitive(luatex_command, "detokenized", convert_cmd, detokenized_code, 0);
+ tex_primitive(luatex_command, "detokened", convert_cmd, detokened_code, 0);
tex_primitive(luatex_command, "expanded", convert_cmd, expanded_code, 0);
tex_primitive(luatex_command, "semiexpanded", convert_cmd, semi_expanded_code, 0);
tex_primitive(luatex_command, "formatname", convert_cmd, format_name_code, 0);
@@ -713,6 +718,9 @@ void tex_initialize_commands(void)
tex_primitive(luatex_command, "ifincsname", if_test_cmd, if_in_csname_code, 0); /* This is obsolete and might be dropped. */
tex_primitive(luatex_command, "ifabsnum", if_test_cmd, if_abs_int_code, 0);
tex_primitive(luatex_command, "ifabsdim", if_test_cmd, if_abs_dim_code, 0);
+ tex_primitive(luatex_command, "ifintervalnum", if_test_cmd, if_interval_int_code, 0); /* playground */
+ tex_primitive(luatex_command, "ifintervaldim", if_test_cmd, if_interval_dim_code, 0); /* playground */
+ tex_primitive(luatex_command, "ifintervalfloat", if_test_cmd, if_interval_posit_code, 0); /* playground */
tex_primitive(luatex_command, "iffloat", if_test_cmd, if_posit_code, 0);
tex_primitive(luatex_command, "ifabsfloat", if_test_cmd, if_abs_posit_code, 0);
tex_primitive(luatex_command, "ifzeronum", if_test_cmd, if_zero_int_code, 0);
@@ -832,8 +840,8 @@ void tex_initialize_commands(void)
tex_primitive(luatex_command, "hjcode", hyphenation_cmd, hjcode_code, 0);
tex_primitive(tex_command, "kern", kern_cmd, normal_kern_code, 0);
- /* tex_primitive(tex_command, "hkern", kern_cmd, h_kern_code, 0); */
- /* tex_primitive(tex_command, "vkern", kern_cmd, v_kern_code, 0); */
+ tex_primitive(tex_command, "hkern", kern_cmd, h_kern_code, 0);
+ tex_primitive(tex_command, "vkern", kern_cmd, v_kern_code, 0);
/* tex_primitive(tex_command, "nonzerowidthkern", kern_cmd, non_zero_width_kern_code, 0); */ /* maybe */
tex_primitive(luatex_command, "localleftbox", local_box_cmd, local_left_box_code, 0);
@@ -1026,7 +1034,6 @@ void tex_initialize_commands(void)
tex_primitive(tex_command, "muskipdef", shorthand_def_cmd, mu_skip_def_code, 0);
tex_primitive(tex_command, "skipdef", shorthand_def_cmd, skip_def_code, 0);
tex_primitive(tex_command, "toksdef", shorthand_def_cmd, toks_def_code, 0);
- /* tex_primitive(luatex_command, "stringdef", shorthand_def_cmd, string_def_code, 0); */
tex_primitive(luatex_command, "Umathchardef", shorthand_def_cmd, math_xchar_def_code, 0);
tex_primitive(luatex_command, "Umathdictdef", shorthand_def_cmd, math_dchar_def_code, 0);
tex_primitive(luatex_command, "attributedef", shorthand_def_cmd, attribute_def_code, 0);
diff --git a/source/luametatex/source/tex/texcommands.h b/source/luametatex/source/tex/texcommands.h
index d90456f25..372066049 100644
--- a/source/luametatex/source/tex/texcommands.h
+++ b/source/luametatex/source/tex/texcommands.h
@@ -55,6 +55,7 @@
*/
/*tex
+
Some commands are shared, for instance |car_ret_cmd| is never seen in a token list so it can be
used for signaling a parameter: |out_param_cmd| in a macro body. These constants relate to the
21 bit shifting in token properties!
@@ -89,6 +90,8 @@
easier to extend alignments when we're at it because it brings some code and logic together (of
course the principles are the same, but there can be slight differences in the way errors are
reported).
+
+ Comment: experimental |string_cmd| has been removed, as we now have |\constant| flagged macros.
*/
@@ -230,7 +233,6 @@ typedef enum tex_command_code {
mathspec_cmd,
fontspec_cmd,
register_cmd, /*tex internal register (|\count|, |\dimen|, etc.) */
- /* string_cmd, */ /*tex discarded experiment but maybe ... */
combine_toks_cmd, /*tex the |toksapp| and similar token (list) combiners */
/*tex
That was the last command that could follow |\the|.
@@ -260,7 +262,6 @@ typedef enum tex_command_code {
convert_cmd, /*tex convert to text (|\number|, |\string|, etc.) */
the_cmd, /*tex expand an internal quantity (|\the| or |\unexpanded|, |\detokenize|) */
get_mark_cmd, /*tex inserted mark (|\topmark|, etc.) */
- /* string_cmd, */
/*tex
These refer to macros. We might at some point promote the tolerant ones to have their own
cmd codes. Protected macros were done with an initial token signaling that property but
@@ -459,6 +460,7 @@ typedef enum convert_codes {
cs_active_code, /*tex command code for |\csactive| */
/* cs_lastname_code, */ /*tex command code for |\cslastname| */
detokenized_code, /*tex command code for |\detokenized| */
+ detokened_code, /*tex command code for |\detokened| */
roman_numeral_code, /*tex command code for |\romannumeral| */
meaning_code, /*tex command code for |\meaning| */
meaning_full_code, /*tex command code for |\meaningfull| */
@@ -702,7 +704,6 @@ typedef enum shorthand_def_codes {
skip_def_code, /*tex |\skipdef| */
mu_skip_def_code, /*tex |\muskipdef| */
toks_def_code, /*tex |\toksdef| */
- /* string_def_code, */
lua_def_code, /*tex |\luadef| */
integer_def_code,
posit_def_code,
@@ -1199,13 +1200,21 @@ typedef enum remove_item_codes {
typedef enum kern_codes {
normal_kern_code,
- h_kern_code, /* maybe */
- v_kern_code, /* maybe */
+ h_kern_code,
+ v_kern_code,
non_zero_width_kern_code, /* maybe */
} kern_codes;
# define last_kern_code normal_kern_code
+typedef enum penalty_codes {
+ normal_penalty_code,
+ h_penalty_code,
+ v_penalty_code,
+} penalty_codes;
+
+# define last_penalty_code normal_penalty_code
+
typedef enum tex_mskip_codes {
normal_mskip_code,
atom_mskip_code,
diff --git a/source/luametatex/source/tex/texconditional.c b/source/luametatex/source/tex/texconditional.c
index b2219e2ab..b4541f342 100644
--- a/source/luametatex/source/tex/texconditional.c
+++ b/source/luametatex/source/tex/texconditional.c
@@ -578,6 +578,15 @@ void tex_conditional_if(halfword code, int unless)
case if_zero_int_code:
result = tex_scan_int(0, NULL) == 0;
goto RESULT;
+ case if_interval_int_code:
+ {
+ scaled n0 = tex_scan_int(0, NULL);
+ scaled n1 = tex_scan_int(0, NULL);
+ scaled n2 = tex_scan_int(0, NULL);
+ result = n1 - n2;
+ result = result == 0 ? 1 : (result > 0 ? result <= n0 : -result <= n0);
+ }
+ goto RESULT;
case if_abs_posit_code:
case if_posit_code:
{
@@ -608,6 +617,15 @@ void tex_conditional_if(halfword code, int unless)
case if_zero_posit_code:
result = tex_posit_eq_zero(tex_scan_posit(0));
goto RESULT;
+ case if_interval_posit_code:
+ {
+ halfword n0 = tex_scan_posit(0);
+ halfword n1 = tex_scan_posit(0);
+ halfword n2 = tex_scan_posit(0);
+ result = tex_posit_sub(n1, n2);
+ result = tex_posit_eq_zero(result) ? 1 : (tex_posit_gt_zero(result) ? tex_posit_le(result, n0) : tex_posit_le(tex_posit_neg(result), n0));
+ }
+ goto RESULT;
case if_abs_dim_code:
case if_dim_code:
{
@@ -638,6 +656,15 @@ void tex_conditional_if(halfword code, int unless)
case if_zero_dim_code:
result = tex_scan_dimen(0, 0, 0, 0, NULL) == 0;
goto RESULT;
+ case if_interval_dim_code:
+ {
+ scaled n0 = tex_scan_dimen(0, 0, 0, 0, NULL);
+ scaled n1 = tex_scan_dimen(0, 0, 0, 0, NULL);
+ scaled n2 = tex_scan_dimen(0, 0, 0, 0, NULL);
+ result = n1 - n2;
+ result = result == 0 ? 1 : (result > 0 ? result <= n0 : -result <= n0);
+ }
+ goto RESULT;
case if_odd_code:
result = odd(tex_scan_int(0, NULL));
goto RESULT;
diff --git a/source/luametatex/source/tex/texconditional.h b/source/luametatex/source/tex/texconditional.h
index 41b33dc36..0790d86f9 100644
--- a/source/luametatex/source/tex/texconditional.h
+++ b/source/luametatex/source/tex/texconditional.h
@@ -55,12 +55,15 @@ typedef enum if_test_codes {
if_int_code, /*tex |\ifnum| */
if_abs_int_code, /*tex |\ifabsnum| */
if_zero_int_code, /*tex |\ifzeronum|*/
+ if_interval_int_code,
if_posit_code,
if_abs_posit_code,
if_zero_posit_code,
+ if_interval_posit_code,
if_dim_code, /*tex |\ifdim| */
if_abs_dim_code, /*tex |\ifabsdim| */
if_zero_dim_code, /*tex |\ifzerodim| */
+ if_interval_dim_code,
if_odd_code, /*tex |\ifodd| */
if_vmode_code, /*tex |\ifvmode| */
if_hmode_code, /*tex |\ifhmode| */
diff --git a/source/luametatex/source/tex/texdumpdata.h b/source/luametatex/source/tex/texdumpdata.h
index e21177713..be45c0045 100644
--- a/source/luametatex/source/tex/texdumpdata.h
+++ b/source/luametatex/source/tex/texdumpdata.h
@@ -55,7 +55,7 @@
*/
-# define luametatex_format_fingerprint 689
+# define luametatex_format_fingerprint 690
/* These end up in the string pool. */
diff --git a/source/luametatex/source/tex/texequivalents.c b/source/luametatex/source/tex/texequivalents.c
index c3cbf087d..4f8f789b7 100644
--- a/source/luametatex/source/tex/texequivalents.c
+++ b/source/luametatex/source/tex/texequivalents.c
@@ -1542,9 +1542,7 @@ void tex_unsave(void)
}
tex_local_control(1);
}
-
unsave_attribute_state_before();
-
tex_unsave_math_codes(cur_level);
tex_unsave_cat_codes(cat_code_table_par, cur_level);
tex_unsave_text_codes(cur_level);
diff --git a/source/luametatex/source/tex/texequivalents.h b/source/luametatex/source/tex/texequivalents.h
index a2ea8762d..5ecf73ee0 100644
--- a/source/luametatex/source/tex/texequivalents.h
+++ b/source/luametatex/source/tex/texequivalents.h
@@ -435,6 +435,8 @@ typedef enum int_codes {
post_display_penalty_code, /*tex penalty for breaking just after a displayed formula */
pre_inline_penalty_code, /*tex penalty for breaking just before an inlined formula */
post_inline_penalty_code, /*tex penalty for breaking just after an inlined formula */
+ pre_short_inline_penalty_code, /*tex penalty for breaking just before a single character inlined formula */
+ post_short_inline_penalty_code, /*tex penalty for breaking just after a single character inlined formula */
inter_line_penalty_code, /*tex additional penalty between lines */
double_hyphen_demerits_code, /*tex demerits for double hyphen break */
final_hyphen_demerits_code, /*tex demerits for final hyphen break */
@@ -1050,6 +1052,19 @@ typedef enum tex_alignment_context_codes {
wrapup_pass_alignment_context,
} tex_alignment_context_codes;
+
+typedef enum tex_breaks_context_codes {
+ initialize_show_breaks_context,
+ start_show_breaks_context,
+ list_show_breaks_context,
+ stop_show_breaks_context,
+ collect_show_breaks_context,
+ line_show_breaks_context,
+ delete_show_breaks_context,
+ report_show_breaks_context,
+ wrapup_show_breaks_context,
+} tex_breaks_context_codes;
+
typedef enum tex_page_context_codes {
box_page_context,
end_page_context,
@@ -1392,6 +1407,8 @@ extern void tex_forced_word_define (int g, halfword p, singleword flag, halfword
# define post_display_penalty_par count_parameter(post_display_penalty_code)
# define pre_inline_penalty_par count_parameter(pre_inline_penalty_code)
# define post_inline_penalty_par count_parameter(post_inline_penalty_code)
+# define pre_short_inline_penalty_par count_parameter(pre_short_inline_penalty_code)
+# define post_short_inline_penalty_par count_parameter(post_short_inline_penalty_code)
# define local_interline_penalty_par count_parameter(local_interline_penalty_code)
# define local_broken_penalty_par count_parameter(local_broken_penalty_code)
@@ -1664,6 +1681,7 @@ typedef enum normalize_line_mode_bits {
typedef enum normalize_par_mode_bits {
normalize_par_mode = 0x0001,
flatten_v_leaders_mode = 0x0002, /* used to be 0x200 */
+ limit_prev_graf_mode = 0x0004,
} normalize_par_mode_bits;
# define normalize_line_mode_permitted(a,b) ((a & b) == b)
diff --git a/source/luametatex/source/tex/texexpand.c b/source/luametatex/source/tex/texexpand.c
index 706972bfe..d0de0c9f1 100644
--- a/source/luametatex/source/tex/texexpand.c
+++ b/source/luametatex/source/tex/texexpand.c
@@ -535,14 +535,6 @@ void tex_expand_current_token(void)
}
break;
}
- /*
- case string_cmd:
- {
- halfword head = str_toks(str_lstring(cs_offset_value + cur_chr), NULL);
- begin_inserted_list(head);
- break;
- }
- */
default:
/* Maybe ... or maybe an option */
// if (lmt_expand_state.cs_name_level == 0) {
@@ -636,21 +628,13 @@ static int tex_aux_collect_cs_tokens(halfword *p, int *n)
case spacer_cmd:
case letter_cmd:
case other_char_cmd:
- case active_char_cmd: /* new */
- // cur_tok = token_val(cur_cmd, cur_chr);
- // *p = tex_store_new_token(*p, cur_tok);
+ case active_char_cmd: /* new, here we don't expand */
*p = tex_store_new_token(*p, token_val(cur_cmd, cur_chr));
*n += 1;
break;
/* case comment_cmd: */
/* case invalid_char_cmd: */
- /*
- case string_cmd:
- cur_tok = token_val(cur_cmd, cur_chr);
- *p = store_new_token(*p, cur_tok);
- *n += str_length(cs_offset_value + cur_chr);
- break;
- */
+ /* break; */
case call_cmd:
case tolerant_call_cmd:
if (get_token_reference(cur_chr) == max_token_reference) { // ! get_token_parameters(cur_chr)) {
diff --git a/source/luametatex/source/tex/texinputstack.c b/source/luametatex/source/tex/texinputstack.c
index 7780c17bc..92a9c8a0c 100644
--- a/source/luametatex/source/tex/texinputstack.c
+++ b/source/luametatex/source/tex/texinputstack.c
@@ -184,8 +184,15 @@ static int tex_aux_room_on_parameter_stack(void) /* quite similar to save_stack
void tex_copy_to_parameter_stack(halfword *pstack, int n)
{
if (tex_aux_room_on_parameter_stack()) {
+if (n == 1) {
+ lmt_input_state.parameter_stack[lmt_input_state.parameter_stack_data.ptr++] = pstack[0];
+//} else if (n == 2) {
+// lmt_input_state.parameter_stack[lmt_input_state.parameter_stack_data.ptr++] = pstack[0];
+// lmt_input_state.parameter_stack[lmt_input_state.parameter_stack_data.ptr++] = pstack[1];
+} else {
memcpy(&lmt_input_state.parameter_stack[lmt_input_state.parameter_stack_data.ptr], pstack, n * sizeof(halfword));
lmt_input_state.parameter_stack_data.ptr += n;
+}
}
}
diff --git a/source/luametatex/source/tex/texinserts.c b/source/luametatex/source/tex/texinserts.c
index 15d4b8c53..5a76ebaad 100644
--- a/source/luametatex/source/tex/texinserts.c
+++ b/source/luametatex/source/tex/texinserts.c
@@ -456,7 +456,7 @@ void tex_run_insert(void)
void tex_finish_insert_group(void)
{
- if (! tex_wrapped_up_paragraph(insert_par_context)) {
+ if (! tex_wrapped_up_paragraph(insert_par_context, 0)) {
halfword p, q; /*tex for short-term use */
scaled d; /*tex holds |split_max_depth| in |insert_group| */
halfword f; /*tex holds |floating_penalty| in |insert_group| */
diff --git a/source/luametatex/source/tex/texlinebreak.c b/source/luametatex/source/tex/texlinebreak.c
index af60f1c40..e009d3e50 100644
--- a/source/luametatex/source/tex/texlinebreak.c
+++ b/source/luametatex/source/tex/texlinebreak.c
@@ -53,6 +53,14 @@
understand. (Remark for myself: the lua variant that i use for playing around occasionally is
not in sync with the code here!)
+ I played a bit with prerolling: make a copy, run the par builder, afterwards collect the
+ result in a box that then can be consulted: wd, ht, dp, quality, hyphens, and especially
+ shape fitting (which was the reason, because |\hangafter| assumes lines and esp with math a
+ line is somewhat unpredictable so we get bad fitting). In the end we decided that it was kind
+ of useless because of the unlikely usage scenario. But I might pick up on it. Of course it can
+ be done in \LUA\ but we don't want the associated performance hit (management overhead) and
+ dealing with (progressive) solution oscillating is also an issue.
+
*/
linebreak_state_info lmt_linebreak_state = {
@@ -859,12 +867,14 @@ static halfword tex_aux_clean_up_the_memory(halfword p)
halfword q = node_next(active_head);
while (q != active_head) {
p = node_next(q);
+ // tex_free_node(q, get_node_size(node_type(q))); // less overhead & testing
tex_flush_node(q);
q = p;
}
q = lmt_linebreak_state.passive;
while (q) {
p = node_next(q);
+ // tex_free_node(q, get_node_size(node_type(q))); // less overhead & testing
tex_flush_node(q);
q = p;
}
@@ -907,12 +917,13 @@ inline static void tex_aux_reset_disc_target(halfword adjust_spacing, scaled *ta
inline static void tex_aux_set_target_to_source(halfword adjust_spacing, scaled target[], const scaled source[])
{
+ // memcpy(&target[total_glue_amount], &source[total_glue_amount], font_shrink_amount * sizeof(halfword));
for (int i = total_glue_amount; i <= total_shrink_amount; i++) {
target[i] = source[i];
}
if (adjust_spacing) {
- target[font_shrink_amount] = source[font_shrink_amount];
target[font_stretch_amount] = source[font_stretch_amount];
+ target[font_shrink_amount] = source[font_shrink_amount];
}
}
@@ -1040,7 +1051,7 @@ static void tex_aux_add_to_widths(halfword s, int adjust_spacing, int adjust_spa
while (s) {
switch (node_type(s)) {
case glyph_node:
- widths[total_glue_amount] += tex_glyph_width(s);
+ widths[total_glue_amount] += tex_glyph_width_ex(s); // ex
if (adjust_spacing && ! tex_has_glyph_option(s, glyph_option_no_expansion) && tex_aux_check_expand_pars(adjust_spacing_step, glyph_font(s))) {
lmt_packaging_state.previous_char_ptr = s;
widths[font_stretch_amount] += tex_char_stretch(s);
@@ -1056,7 +1067,7 @@ static void tex_aux_add_to_widths(halfword s, int adjust_spacing, int adjust_spa
break;
case glue_node:
widths[total_glue_amount] += glue_amount(s);
- widths[2 + glue_stretch_order(s)] += glue_stretch(s);
+ widths[total_stretch_amount + glue_stretch_order(s)] += glue_stretch(s);
widths[total_shrink_amount] += glue_shrink(s);
break;
case kern_node:
@@ -1093,7 +1104,7 @@ static void tex_aux_sub_from_widths(halfword s, int adjust_spacing, int adjust_s
/*tex Subtract the width of node |s| from |break_width|; */
switch (node_type(s)) {
case glyph_node:
- widths[total_glue_amount] -= tex_glyph_width(s);
+ widths[total_glue_amount] -= tex_glyph_width_ex(s); // ex
if (adjust_spacing && ! tex_has_glyph_option(s, glyph_option_no_expansion) && tex_aux_check_expand_pars(adjust_spacing_step, glyph_font(s))) {
lmt_packaging_state.previous_char_ptr = s;
widths[font_stretch_amount] -= tex_char_stretch(s);
@@ -1108,9 +1119,9 @@ static void tex_aux_sub_from_widths(halfword s, int adjust_spacing, int adjust_s
widths[total_glue_amount] -= rule_width(s);
break;
case glue_node:
- widths[total_glue_amount] -= glue_amount(s);
- widths[2 + glue_stretch_order(s)] -= glue_stretch(s);
- widths[total_shrink_amount] -= glue_shrink(s);
+ widths[total_glue_amount] -= glue_amount(s);
+ widths[total_stretch_amount + glue_stretch_order(s)] -= glue_stretch(s);
+ widths[total_shrink_amount] -= glue_shrink(s);
break;
case kern_node:
widths[total_glue_amount] -= kern_amount(s);
@@ -1205,7 +1216,7 @@ static void tex_aux_compute_break_width(int break_type, int adjust_spacing, int
case glue_node:
/*tex Subtract glue from |break_width|; */
lmt_linebreak_state.break_width[total_glue_amount] -= glue_amount(s);
- lmt_linebreak_state.break_width[2 + glue_stretch_order(s)] -= glue_stretch(s);
+ lmt_linebreak_state.break_width[total_stretch_amount + glue_stretch_order(s)] -= glue_stretch(s);
lmt_linebreak_state.break_width[total_shrink_amount] -= glue_shrink(s);
break;
case penalty_node:
@@ -1222,7 +1233,7 @@ static void tex_aux_compute_break_width(int break_type, int adjust_spacing, int
lmt_linebreak_state.break_width[total_glue_amount] -= math_surround(s);
} else {
lmt_linebreak_state.break_width[total_glue_amount] -= math_amount(s);
- lmt_linebreak_state.break_width[2 + math_stretch_order(s)] -= math_stretch(s);
+ lmt_linebreak_state.break_width[total_stretch_amount + math_stretch_order(s)] -= math_stretch(s);
lmt_linebreak_state.break_width[total_shrink_amount] -= math_shrink(s);
}
break;
@@ -1233,30 +1244,94 @@ static void tex_aux_compute_break_width(int break_type, int adjust_spacing, int
}
}
-static void tex_aux_print_break_node(halfword q, halfword fit_class, halfword break_type, halfword cur_p, const line_break_properties *properties)
+static void tex_aux_initialize_show_break_node(int callback_id)
+{
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "d->", initialize_show_breaks_context);
+}
+
+static void tex_aux_start_show_break_node(int callback_id, int pass)
+{
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "dd->", start_show_breaks_context, pass);
+}
+
+static void tex_aux_stop_show_break_node(int callback_id)
+{
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "d->", stop_show_breaks_context);
+}
+
+static void tex_aux_collect_show_break_node(int callback_id)
+{
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "d->", collect_show_breaks_context);
+}
+
+static void tex_aux_line_show_break_node(int callback_id)
+{
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "dNdddd->", line_show_breaks_context,
+ lmt_linebreak_state.just_box, lmt_packaging_state.last_badness, lmt_packaging_state.last_overshoot,
+ lmt_packaging_state.total_shrink[normal_glue_order], lmt_packaging_state.total_stretch[normal_glue_order]
+ );
+}
+
+static void tex_aux_delete_break_node(halfword active, halfword passive, int callback_id)
+{
+ (void) active;
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "dd->", delete_show_breaks_context,
+ passive_serial(passive)
+ );
+}
+
+static void tex_aux_wrapup_show_break_node(int callback_id)
+{
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "d->", wrapup_show_breaks_context);
+}
+
+static void tex_aux_show_break_node(halfword active, halfword passive, int callback_id, int pass, halfword *demerits)
+{
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "ddddddddNdd->r", report_show_breaks_context,
+ pass,
+ passive_serial(passive),
+ passive_prev_break(passive) ? passive_serial(passive_prev_break(passive)) : 0,
+ active_line_number(active) - 1,
+ node_type(active),
+ active_fitness(active),
+ active_total_demerits(active), /* demerits */
+ passive_cur_break(passive),
+ lmt_linebreak_state.do_last_line_fit ? active_short(active) : 0,
+ lmt_linebreak_state.do_last_line_fit ? active_glue(active) : 0,
+ demerits /* optionally changed */
+ );
+}
+
+static void tex_aux_list_break_node(halfword passive, int callback_id)
+{
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "dd->", list_show_breaks_context,
+ passive_serial(passive)
+ );
+}
+
+static void tex_aux_print_break_node(halfword active, halfword passive)
{
- (void) properties;
/*tex Print a symbolic description of the new break node. */
tex_print_format(
"%l[break: serial %i, line %i.%i,%s demerits %i, ",
- passive_serial(lmt_linebreak_state.passive),
- active_line_number(q) - 1,
- fit_class,
- break_type == hyphenated_node ? " hyphenated, " : "",
- active_total_demerits(q)
+ passive_serial(passive),
+ active_line_number(active) - 1,
+ active_fitness(active),
+ node_type(active) == hyphenated_node ? " hyphenated, " : "",
+ active_total_demerits(active)
);
if (lmt_linebreak_state.do_last_line_fit) {
/*tex Print additional data in the new active node. */
tex_print_format(
" short %D, %s %D, ",
- active_short(q), pt_unit,
- cur_p ? "glue" : "active",
- active_glue(q), pt_unit
+ active_short(active), pt_unit,
+ passive_cur_break(passive) ? "glue" : "active",
+ active_glue(active), pt_unit
);
}
tex_print_format(
"previous %i]",
- passive_prev_break(lmt_linebreak_state.passive) ? passive_serial(passive_prev_break(lmt_linebreak_state.passive)) : 0
+ passive_prev_break(passive) ? passive_serial(passive_prev_break(passive)) : null
);
}
@@ -1303,9 +1378,6 @@ static void tex_aux_print_feasible_break(halfword cur_p, halfword r, halfword b,
);
}
-# define total_font_stretch cur_active_width[font_stretch_amount]
-# define total_font_shrink cur_active_width[font_shrink_amount]
-
/*tex We implement this one later on. */
/*
@@ -1313,7 +1385,7 @@ static void tex_aux_print_feasible_break(halfword cur_p, halfword r, halfword b,
trickery depending on it.
*/
-static void tex_aux_post_line_break(const line_break_properties *properties, halfword line_break_dir);
+static void tex_aux_post_line_break(const line_break_properties *properties, halfword line_break_dir, int callback_id);
/*tex
@@ -1363,28 +1435,52 @@ static void tex_aux_post_line_break(const line_break_properties *properties, hal
good estimates from Don Knuth here, it would be pretentious to suggest that I really did
research this fuzzy topic (if it was worth the effort at all).
+ Here |large_width_excess| is 110.32996pt while |small_stretchability| equals 25.38295pt.
+
+*/
+
+/*tex
+ Around 2023-05-24 Mikael Sundqvist and I did numerous tests with the badness function below in
+ comparison with the variant mentioned in Digital Typography (DEK) and we observed that indeed
+ both functions behave pretty close (emulations with lua, mathematica etc). In practice one can
+ get different badness values (especially low numbers). We ran some test on documents and on
+ hundreds of pages one can get a few different decisions. The main reason for looking into this
+ was that we were exploring a bit more visual approach to deciding on what penalties to use in
+ the math inter-atom spacing in \CONTEXT\ (where we use a more granular class model). In the end
+ the magic criteria became even more magic (and impressive). BTW, indeed we could get these 1095
+ different badness cases with as maximum calculated one 8189.
*/
halfword tex_badness(scaled t, scaled s)
{
- /*tex Approximation to $\alpha t/s$, where $\alpha^3\approx 100\cdot2^{18}$ */
+ /*tex Approximation to $\alpha t/s$, where $\alpha^3 \approx 100 \cdot 2^{18}$ */
if (t == 0) {
return 0;
} else if (s <= 0) {
return infinite_bad;
} else {
- /*tex $297^3=99.94\times2^{18}$ */
- if (t <= large_width_excess) {
- t = (t * 297) / s;
- } else if (s >= small_stretchability) {
- t = t / (s / 297);
- }
- if (t > 1290) {
- /*tex $1290^3<2^{31}<1291^3$ */
+ /*tex $297^3 = 99.94 \times 2^{18}$ */
+ if (t <= large_width_excess) {
+ t = (t * 297) / s; /* clipping by integer division */
+ } else if (s >= small_stretchability) {
+ t = t / (s / 297); /* clipping by integer division */
+ } else {
+ /*tex
+ When we end up here |t| is pretty large so we can as well save a test and return
+ immediately. (HH & MS: we tested this while cheating a bit because this function
+ is seldom entered with values that make us end up here.)
+ */
+ return infinite_bad;
+ }
+ if (t > 1290) {
+ /*tex As $1290^3 < 2^{31} < 1291^3$ we catch an overflow here. */ /* actually badness 8189 */
return infinite_bad;
} else {
- /*tex This is $t^3/2^{18}$, rounded to the nearest integer. */
- return ((t * t * t + 0400000) / 01000000);
+ /*tex 297*297*297 == 26198073 / 100 => 261981 */
+ /*tex This is $t^3 / 2^{18}$, rounded to the nearest integer */
+ return (t * t * t + 0400000) / 01000000; /* 0400000/01000000 == 1/2 */
+ // return (t * t * t + 0x20000) / 0x40000;
+ // return (t * t * t + 131072) / 262144;
}
}
}
@@ -1410,13 +1506,6 @@ inline static void tex_split_line_break_criterium(halfword criterium, halfword *
inline static halfword tex_normalized_loose_badness(halfword b, halfword loose, halfword semi_loose, halfword decent)
{
- // if (b > loose_criterium) {
- // return very_loose_fit;
- // } else if (b > decent_criterium) {
- // return loose_fit;
- // } else {
- // return decent_fit;
- // }
if (b > loose) {
return very_loose_fit;
} else if (b > semi_loose) {
@@ -1430,11 +1519,6 @@ inline static halfword tex_normalized_loose_badness(halfword b, halfword loose,
inline static halfword tex_normalized_tight_badness(halfword b, halfword decent, halfword semi_tight)
{
- // if (b > decent_criterium) {
- // return tight_fit;
- // } else {
- // return decent_fit;
- // }
if (b > semi_tight) {
return semi_tight_fit;
} else if (b > decent) {
@@ -1444,78 +1528,134 @@ inline static halfword tex_normalized_tight_badness(halfword b, halfword decent,
}
}
+static void tex_check_protrusion_shortfall(halfword r, halfword first_p, halfword cur_p, halfword *shortfall)
+{
+ // if (line_break_dir == dir_righttoleft) {
+ // /*tex Not now, we need to keep more track. */
+ // } else {
+ halfword o = null;
+ halfword l = active_break_node(r) ? passive_cur_break(active_break_node(r)) : first_p;
+ if (cur_p) {
+ o = node_prev(cur_p);
+ if (node_next(o) != cur_p) {
+ tex_normal_error("linebreak", "the node list is messed up");
+ }
+ }
+ /*tex
+
+ The last characters (hyphenation character) if these two list should always be
+ the same anyway, so we just look at |pre_break|. Let's look at the right margin
+ first.
+
+ */
+ if (cur_p && node_type(cur_p) == disc_node && disc_pre_break_head(cur_p)) {
+ /*tex
+ A |disc_node| with non-empty |pre_break|, protrude the last char of
+ |pre_break|:
+ */
+ o = disc_pre_break_tail(cur_p);
+ } else {
+ o = tex_aux_find_protchar_right(l, o);
+ }
+ if (o && node_type(o) == glyph_node) {
+ shortfall += tex_char_protrusion(o, right_margin_kern_subtype);
+ // char_pw_kern(o, right_margin_kern, &margin_kern_stretch, &margin_kern_shrink);
+ }
+ /*tex now the left margin */
+ if (l && (node_type(l) == disc_node) && (disc_post_break_head(l))) {
+ /*tex The first char could be a disc! Protrude the first char. */
+ o = disc_post_break_head(l);
+ } else {
+ o = tex_aux_find_protchar_left(l, 1);
+ }
+ if (o && node_type(o) == glyph_node) {
+ shortfall += tex_char_protrusion(o, left_margin_kern_subtype);
+ // char_pw_kern(o, left_margin_kern, &margin_kern_stretch, &margin_kern_shrink);
+ }
+ // }
+}
+
static void tex_aux_try_break(
const line_break_properties *properties,
- halfword pi, /* a penalty */
+ halfword penalty,
halfword break_type,
halfword first_p,
- halfword cur_p
+ halfword cur_p,
+ int callback_id,
+ int pass
)
{
- /*tex runs through the active list */
- halfword r;
/*tex stays a step behind |r| */
halfword prev_r = active_head;
/*tex a step behind |prev_r|, if |type(prev_r) = delta_node| */
halfword prev_prev_r = null;
+ /*tex distance from current active node */
+ scaled cur_active_width[n_of_glue_amounts] = { 0 };
+ /*tex
+ These status arrays are global to the main loop and will be initialized as we go.
+ */
+ halfword best_place[n_of_finess_values];
+ halfword best_place_line[n_of_finess_values];
+ scaled best_place_short[n_of_finess_values];
+ scaled best_place_glue[n_of_finess_values];
+ /*
+ These are more local but we keep them here because of readability.
+ */
+ /*tex badness of test line */
+ halfword badness = 0;
+ /*tex demerits of test line */
+ int demerits = 0;
+ /*tex glue stretch or shrink of test line, adjustment for last line */
+ scaled glue = 0;
+ /*tex used in badness calculations */
+ scaled shortfall = 0;
/*tex maximum line number in current equivalence class of lines */
- halfword old_l = 0;
+ halfword old_line = 0;
/*tex have we found a feasible break at |cur_p|? */
int no_break_yet = 1;
- /*tex line number of current active node */
- halfword l;
/*tex should node |r| remain in the active list? */
int node_r_stays_active;
- /*tex the current line will be justified to this width */
- scaled line_width = 0;
/*tex possible fitness class of test line */
halfword fit_class;
- /*tex badness of test line */
- halfword b;
- /*tex demerits of test line */
- int d;
/*tex has |d| been forced to zero? */
int artificial_demerits;
- /*tex used in badness calculations */
- scaled shortfall = 0;
- /*tex glue stretch or shrink of test line, adjustment for last line */
- scaled g = 0;
- /*tex distance from current active node */
- scaled cur_active_width[10] = { 0 };
- halfword best_place[n_of_finess_values];
- halfword best_place_line[n_of_finess_values];
- scaled best_place_short[n_of_finess_values];
- scaled best_place_glue[n_of_finess_values];
- /*tex Experiment */
+ /*tex the current line will be justified to this width */
+ scaled line_width = 0;
+ /*tex line number of current active node */
+ halfword line = 0;
+ /*tex
+ We have added an extra category, just as experiment. In practice there is very little
+ to gain here as it becomes kind of fuzzy and DEK values are quite okay.
+ */
halfword semi_tight, decent, semi_loose, loose;
- /* in par node */
+ /*tex in par node */
tex_split_line_break_criterium(line_break_criterium_par, &semi_tight, &decent, &semi_loose, &loose);
/*tex Make sure that |pi| is in the proper range; */
- if (pi >= infinite_penalty) {
+ if (penalty >= infinite_penalty) {
/*tex this breakpoint is inhibited by infinite penalty */
return;
- } else if (pi <= -infinite_penalty) {
+ } else if (penalty <= -infinite_penalty) {
/*tex this breakpoint will be forced */
- pi = eject_penalty;
+ penalty = eject_penalty;
}
tex_aux_set_target_to_source(properties->adjust_spacing, cur_active_width, lmt_linebreak_state.active_width);
while (1) {
- r = node_next(prev_r);
+ /*tex Here |r| runs through the active list: */
+ halfword r = node_next(prev_r);
/*tex
If node |r| is of type |delta_node|, update |cur_active_width|, set |prev_r| and
|prev_prev_r|, then |goto continue|. The following code uses the fact that |type
(active) <> delta_node|.
- Here we get: |unhyphenated_node|, |hyphenated_node, |delta_node|, |passive_node|
-
*/
if (node_type(r) == delta_node) {
- /*tex implicit */
tex_aux_add_to_target_from_delta(properties->adjust_spacing, cur_active_width, r);
prev_prev_r = prev_r;
prev_r = r;
continue;
+ } else {
+ /*tex We have an |unhyphenated_node| or |hyphenated_node|. */
}
/*tex
@@ -1528,10 +1668,10 @@ static void tex_aux_try_break(
that |r = active| and |line_number (active) > old_l|.
*/
- l = active_line_number(r);
- if (l > old_l) {
- /*tex now we are no longer in the inner loop */
- if ((lmt_linebreak_state.minimum_demerits < awful_bad) && ((old_l != lmt_linebreak_state.easy_line) || (r == active_head))) {
+ line = active_line_number(r);
+ if (line > old_line) {
+ /*tex Now we are no longer in the inner loop (well ...). */
+ if ((lmt_linebreak_state.minimum_demerits < awful_bad) && ((old_line != lmt_linebreak_state.easy_line) || (r == active_head))) {
/*tex
Create new active nodes for the best feasible breaks just found. It is not
@@ -1578,53 +1718,55 @@ static void tex_aux_try_break(
Insert a new active node from |best_place [fit_class]| to |cur_p|. When
we create an active node, we also create the corresponding passive node.
+ In the passive node we also keep track of the subparagraph penalties.
*/
- halfword q = tex_new_node(passive_node, (quarterword) very_loose_fit);
- node_next(q) = lmt_linebreak_state.passive;
- lmt_linebreak_state.passive = q;
- passive_cur_break(q) = cur_p;
- ++lmt_linebreak_state.pass_number;
- passive_serial(q) = lmt_linebreak_state.pass_number;
- passive_prev_break(q) = best_place[fit_class];
- /*tex
-
- Here we keep track of the subparagraph penalties in the break nodes.
-
- */
- passive_pen_inter(q) = lmt_linebreak_state.internal_penalty_interline;
- passive_pen_broken(q) = lmt_linebreak_state.internal_penalty_broken;
- passive_last_left_box(q) = lmt_linebreak_state.internal_left_box;
- passive_last_left_box_width(q) = lmt_linebreak_state.internal_left_box_width;
- if (passive_prev_break(q)) {
- passive_left_box(q) = passive_last_left_box(passive_prev_break(q));
- passive_left_box_width(q) = passive_last_left_box_width(passive_prev_break(q));
+ halfword passive = tex_new_node(passive_node, (quarterword) very_loose_fit);
+ halfword active = tex_new_node((quarterword) break_type, (quarterword) fit_class);
+ halfword prev_break = best_place[fit_class];
+ /*tex Initialize the passive node: */
+ passive_cur_break(passive) = cur_p;
+ passive_serial(passive) = ++lmt_linebreak_state.pass_number;
+ passive_prev_break(passive) = prev_break;
+ passive_pen_inter(passive) = lmt_linebreak_state.internal_penalty_interline;
+ passive_pen_broken(passive) = lmt_linebreak_state.internal_penalty_broken;
+ passive_last_left_box(passive) = lmt_linebreak_state.internal_left_box;
+ passive_last_left_box_width(passive) = lmt_linebreak_state.internal_left_box_width;
+ if (prev_break) {
+ passive_left_box(passive) = passive_last_left_box(prev_break);
+ passive_left_box_width(passive) = passive_last_left_box_width(prev_break);
} else {
- passive_left_box(q) = lmt_linebreak_state.init_internal_left_box;
- passive_left_box_width(q) = lmt_linebreak_state.init_internal_left_box_width;
+ passive_left_box(passive) = lmt_linebreak_state.init_internal_left_box;
+ passive_left_box_width(passive) = lmt_linebreak_state.init_internal_left_box_width;
}
- passive_right_box(q) = lmt_linebreak_state.internal_right_box;
- passive_right_box_width(q) = lmt_linebreak_state.internal_right_box_width;
- passive_middle_box(q) = lmt_linebreak_state.internal_middle_box;
- q = tex_new_node((quarterword) break_type, (quarterword) fit_class);
- active_break_node(q) = lmt_linebreak_state.passive;
- active_line_number(q) = best_place_line[fit_class] + 1;
- active_total_demerits(q) = lmt_linebreak_state.minimal_demerits[fit_class];
+ passive_right_box(passive) = lmt_linebreak_state.internal_right_box;
+ passive_right_box_width(passive) = lmt_linebreak_state.internal_right_box_width;
+ passive_middle_box(passive) = lmt_linebreak_state.internal_middle_box;
+ /*tex Initialize the active node: */
+ active_break_node(active) = passive;
+ active_line_number(active) = best_place_line[fit_class] + 1;
+ active_total_demerits(active) = lmt_linebreak_state.minimal_demerits[fit_class];
+ // active_reserved(active) = lmt_linebreak_state.pass_number;
if (lmt_linebreak_state.do_last_line_fit) {
- /*tex
-
- Store additional data in the new active node. Here we save these
- data in the active node representing a potential line break.
-
- */
- active_short(q) = best_place_short[fit_class];
- active_glue(q) = best_place_glue[fit_class];
+ /*tex Store additional data in the new active node. */
+ active_short(active) = best_place_short[fit_class];
+ active_glue(active) = best_place_glue[fit_class];
+ }
+ /*tex Append the passive node. */
+ node_next(passive) = lmt_linebreak_state.passive;
+ lmt_linebreak_state.passive = passive;
+ /*tex Append the active node. */
+ node_next(active) = r;
+ node_next(prev_r) = active;
+ prev_r = active;
+ /* */
+ if (callback_id) {
+ halfword demerits = active_total_demerits(active);
+ tex_aux_show_break_node(active, passive, callback_id, pass, &demerits);
+ active_total_demerits(active) = demerits;
}
- node_next(q) = r;
- node_next(prev_r) = q;
- prev_r = q;
if (properties->tracing_paragraphs > 0) {
- tex_aux_print_break_node(q, fit_class, break_type, cur_p, properties);
+ tex_aux_print_break_node(active, passive);
}
}
lmt_linebreak_state.minimal_demerits[fit_class] = awful_bad;
@@ -1638,12 +1780,12 @@ static void tex_aux_try_break(
*/
if (r != active_head) {
- halfword q = tex_new_node(delta_node, (quarterword) very_loose_fit);
- node_next(q) = r;
- tex_aux_set_delta_from_difference(properties->adjust_spacing, q, cur_active_width, lmt_linebreak_state.break_width);
- node_next(prev_r) = q;
+ halfword delta = tex_new_node(delta_node, (quarterword) very_loose_fit);
+ node_next(delta) = r;
+ tex_aux_set_delta_from_difference(properties->adjust_spacing, delta, cur_active_width, lmt_linebreak_state.break_width);
+ node_next(prev_r) = delta;
prev_prev_r = prev_r;
- prev_r = q;
+ prev_r = delta;
}
}
/*tex
@@ -1657,17 +1799,17 @@ static void tex_aux_try_break(
*/
if (r == active_head) {
return;
- } else if (l > lmt_linebreak_state.easy_line) {
- old_l = max_halfword - 1;
+ } else if (line > lmt_linebreak_state.easy_line) {
+ old_line = max_halfword - 1;
line_width = lmt_linebreak_state.second_width;
} else {
- old_l = l;
+ old_line = line;
/* if (properties->par_shape && specification_repeat(properties->par_shape)) {
line_width = get_specification_width(properties->par_shape, l);
- } else */ if (l > lmt_linebreak_state.last_special_line) {
+ } else */ if (line > lmt_linebreak_state.last_special_line) {
line_width = lmt_linebreak_state.second_width;
} else if (properties->par_shape) {
- line_width = tex_get_specification_width(properties->par_shape, l);
+ line_width = tex_get_specification_width(properties->par_shape, line);
} else {
line_width = lmt_linebreak_state.first_width;
}
@@ -1694,49 +1836,7 @@ static void tex_aux_try_break(
// halfword margin_kern_stretch = 0;
// halfword margin_kern_shrink = 0;
if (properties->protrude_chars) {
- // if (line_break_dir == dir_righttoleft) {
- // /*tex Not now, we need to keep more track. */
- // } else {
- halfword o = null;
- halfword l1 = active_break_node(r) ? passive_cur_break(active_break_node(r)) : first_p;
- if (cur_p) {
- o = node_prev(cur_p);
- if (node_next(o) != cur_p) {
- tex_normal_error("linebreak", "the node list is messed up");
- }
- }
- /*tex
-
- The last characters (hyphenation character) if these two list should always be
- the same anyway, so we just look at |pre_break|. Let's look at the right margin
- first.
-
- */
- if (cur_p && node_type(cur_p) == disc_node && disc_pre_break_head(cur_p)) {
- /*tex
- A |disc_node| with non-empty |pre_break|, protrude the last char of
- |pre_break|:
- */
- o = disc_pre_break_tail(cur_p);
- } else {
- o = tex_aux_find_protchar_right(l1, o);
- }
- if (o && node_type(o) == glyph_node) {
- shortfall += tex_char_protrusion(o, right_margin_kern_subtype);
- // char_pw_kern(o, right_margin_kern, &margin_kern_stretch, &margin_kern_shrink);
- }
- /*tex now the left margin */
- if (l1 && (node_type(l1) == disc_node) && (disc_post_break_head(l1))) {
- /*tex The first char could be a disc! Protrude the first char. */
- o = disc_post_break_head(l1);
- } else {
- o = tex_aux_find_protchar_left(l1, 1);
- }
- if (o && node_type(o) == glyph_node) {
- shortfall += tex_char_protrusion(o, left_margin_kern_subtype);
- // char_pw_kern(o, left_margin_kern, &margin_kern_stretch, &margin_kern_shrink);
- }
- // }
+ tex_check_protrusion_shortfall(r, first_p, cur_p, &shortfall);
}
/*tex
The only reason why we have a shared ratio is that we need to calculate the shortfall
@@ -1745,8 +1845,8 @@ static void tex_aux_try_break(
if (shortfall == 0) {
/*tex We're okay. */
} else if (shortfall > 0) {
- halfword total_stretch = total_font_stretch;
- // halfword total_stretch = total_font_stretch + margin_kern_stretch;
+ halfword total_stretch = cur_active_width[font_stretch_amount];
+ // halfword total_stretch = cur_active_width[font_stretch_amount] + margin_kern_stretch;
if (total_stretch > 0) {
if (total_stretch > shortfall) {
shortfall = (total_stretch / (lmt_linebreak_state.max_stretch_ratio / lmt_linebreak_state.current_font_step)) / 2;
@@ -1755,11 +1855,11 @@ static void tex_aux_try_break(
}
}
} else if (shortfall < 0) {
- halfword total_shrink = total_font_shrink;
- // halfword total_shrink = total_font_shrink + margin_kern_shrink;
+ halfword total_shrink = cur_active_width[font_shrink_amount];
+ // halfword total_shrink = cur_active_width[font_shrink_amount] + margin_kern_shrink;
if (total_shrink > 0) {
if (total_shrink > -shortfall) {
- shortfall = - (total_shrink / (lmt_linebreak_state.max_shrink_ratio / lmt_linebreak_state.current_font_step)) / 2;
+ shortfall = - (total_shrink / (lmt_linebreak_state.max_shrink_ratio / lmt_linebreak_state.current_font_step)) / 2;
} else {
shortfall += total_shrink;
}
@@ -1809,23 +1909,23 @@ static void tex_aux_try_break(
goto NOT_FOUND;
}
if (active_short(r) > 0) {
- g = cur_active_width[total_stretch_amount];
+ glue = cur_active_width[total_stretch_amount];
} else {
- g = cur_active_width[total_shrink_amount];
+ glue = cur_active_width[total_shrink_amount];
}
- if (g <= 0) {
+ if (glue <= 0) {
/*tex No finite stretch resp.\ no shrink. */
goto NOT_FOUND;
}
lmt_scanner_state.arithmic_error = 0;
- g = tex_fract(g, active_short(r), active_glue(r), max_dimen);
+ glue = tex_fract(glue, active_short(r), active_glue(r), max_dimen);
if (properties->last_line_fit < 1000) {
- g = tex_fract(g, properties->last_line_fit, 1000, max_dimen);
+ glue = tex_fract(glue, properties->last_line_fit, 1000, max_dimen);
}
if (lmt_scanner_state.arithmic_error) {
- g = (active_short(r) > 0) ? max_dimen : -max_dimen;
+ glue = (active_short(r) > 0) ? max_dimen : -max_dimen;
}
- if (g > 0) {
+ if (glue > 0) {
/*tex
Set the value of |b| to the badness of the last line for stretching,
@@ -1834,44 +1934,44 @@ static void tex_aux_try_break(
algorithm, with the adjustment amount |g| replacing the |shortfall|.
*/
- if (g > shortfall) {
- g = shortfall;
+ if (glue > shortfall) {
+ glue = shortfall;
}
- if (g > large_width_excess && (cur_active_width[total_stretch_amount] < small_stretchability)) {
- b = infinite_bad;
+ if (glue > large_width_excess && (cur_active_width[total_stretch_amount] < small_stretchability)) {
+ badness = infinite_bad;
fit_class = very_loose_fit;
- goto FOUND;
+ } else {
+ badness = tex_badness(glue, cur_active_width[total_stretch_amount]);
+ fit_class = tex_normalized_loose_badness(badness, loose, semi_loose, decent);
}
- b = tex_badness(g, cur_active_width[total_stretch_amount]);
- fit_class = tex_normalized_loose_badness(b, loose, semi_loose, decent);
goto FOUND;
- } else if (g < 0) {
+ } else if (glue < 0) {
/*tex
Set the value of |b| to the badness of the last line for shrinking,
compute the corresponding |fit_class, and |goto found||.
*/
- if (-g > cur_active_width[total_shrink_amount]) {
- g = -cur_active_width[total_shrink_amount];
+ if (-glue > cur_active_width[total_shrink_amount]) {
+ glue = -cur_active_width[total_shrink_amount];
}
- b = tex_badness(-g, cur_active_width[total_shrink_amount]);
- fit_class = tex_normalized_tight_badness(b, decent, semi_tight);
+ badness = tex_badness(-glue, cur_active_width[total_shrink_amount]);
+ fit_class = tex_normalized_tight_badness(badness, decent, semi_tight);
goto FOUND;
}
}
NOT_FOUND:
shortfall = 0;
}
- b = 0;
+ badness = 0;
/*tex Infinite stretch. */
fit_class = decent_fit;
} else if (shortfall > large_width_excess && cur_active_width[total_stretch_amount] < small_stretchability) {
- b = infinite_bad;
+ badness = infinite_bad;
fit_class = very_loose_fit;
} else {
- b = tex_badness(shortfall, cur_active_width[total_stretch_amount]);
- fit_class = tex_normalized_loose_badness(b, loose, semi_loose, decent);
+ badness = tex_badness(shortfall, cur_active_width[total_stretch_amount]);
+ fit_class = tex_normalized_loose_badness(badness, loose, semi_loose, decent);
}
} else {
/*tex
@@ -1883,27 +1983,27 @@ static void tex_aux_try_break(
*/
if (-shortfall > cur_active_width[total_shrink_amount]) {
- b = infinite_bad + 1;
+ badness = infinite_bad + 1;
} else {
- b = tex_badness(-shortfall, cur_active_width[total_shrink_amount]);
+ badness = tex_badness(-shortfall, cur_active_width[total_shrink_amount]);
}
- fit_class = tex_normalized_tight_badness(b, decent, semi_tight);
+ fit_class = tex_normalized_tight_badness(badness, decent, semi_tight);
}
if (lmt_linebreak_state.do_last_line_fit) {
/*tex Adjust the additional data for last line; */
if (! cur_p) {
shortfall = 0;
- g = 0;
+ glue = 0;
} else if (shortfall > 0) {
- g = cur_active_width[total_stretch_amount];
+ glue = cur_active_width[total_stretch_amount];
} else if (shortfall < 0) {
- g = cur_active_width[total_shrink_amount];
+ glue = cur_active_width[total_shrink_amount];
} else {
- g = 0;
+ glue = 0;
}
}
FOUND:
- if ((b > infinite_bad) || (pi == eject_penalty)) {
+ if ((badness > infinite_bad) || (penalty == eject_penalty)) {
/*tex
Prepare to deactivate node~|r|, and |goto deactivate| unless there is a reason to
@@ -1916,17 +2016,16 @@ static void tex_aux_try_break(
changes here.
*/
- if (lmt_linebreak_state.final_pass && (lmt_linebreak_state.minimum_demerits == awful_bad) &&
- (node_next(r) == active_head) && (prev_r == active_head)) {
+ if (lmt_linebreak_state.final_pass && (lmt_linebreak_state.minimum_demerits == awful_bad) && (node_next(r) == active_head) && (prev_r == active_head)) {
/*tex Set demerits zero, this break is forced. */
artificial_demerits = 1;
- } else if (b > lmt_linebreak_state.threshold) {
+ } else if (badness > lmt_linebreak_state.threshold) {
goto DEACTIVATE;
}
node_r_stays_active = 0;
} else {
prev_r = r;
- if (b > lmt_linebreak_state.threshold) {
+ if (badness > lmt_linebreak_state.threshold) {
continue;
} else {
node_r_stays_active = 1;
@@ -1942,27 +2041,27 @@ static void tex_aux_try_break(
*/
if (artificial_demerits) {
- d = 0;
+ demerits = 0;
} else {
/*tex Compute the demerits, |d|, from |r| to |cur_p|. */
- d = properties->line_penalty + b;
- if (abs(d) >= 10000) {
- d = 100000000;
+ demerits = properties->line_penalty + badness;
+ if (abs(demerits) >= 10000) {
+ demerits = 100000000;
} else {
- d = d * d;
+ demerits = demerits * demerits;
}
- if (pi != 0) {
- if (pi > 0) {
- d += (pi * pi);
- } else if (pi > eject_penalty) {
- d -= (pi * pi);
+ if (penalty != 0) {
+ if (penalty > 0) {
+ demerits += (penalty * penalty);
+ } else if (penalty > eject_penalty) {
+ demerits -= (penalty * penalty);
}
}
if (break_type == hyphenated_node && node_type(r) == hyphenated_node) {
if (cur_p) {
- d += properties->double_hyphen_demerits;
+ demerits += properties->double_hyphen_demerits;
} else {
- d += properties->final_hyphen_demerits;
+ demerits += properties->final_hyphen_demerits;
}
}
/*tex
@@ -1972,18 +2071,18 @@ static void tex_aux_try_break(
used.
*/
if (abs(fit_class - (halfword) active_fitness(r)) > 1) {
- d = d + properties->adj_demerits;
+ demerits = demerits + properties->adj_demerits;
}
}
if (properties->tracing_paragraphs > 0) {
- tex_aux_print_feasible_break(cur_p, r, b, pi, d, artificial_demerits, properties);
+ tex_aux_print_feasible_break(cur_p, r, badness, penalty, demerits, artificial_demerits, properties);
}
/*tex This is the minimum total demerits from the beginning to |cur_p| via |r|. */
- d += active_total_demerits(r);
- if (d <= lmt_linebreak_state.minimal_demerits[fit_class]) {
- lmt_linebreak_state.minimal_demerits[fit_class] = d;
+ demerits += active_total_demerits(r);
+ if (demerits <= lmt_linebreak_state.minimal_demerits[fit_class]) {
+ lmt_linebreak_state.minimal_demerits[fit_class] = demerits;
best_place[fit_class] = active_break_node(r);
- best_place_line[fit_class] = l;
+ best_place_line[fit_class] = line;
if (lmt_linebreak_state.do_last_line_fit) {
/*tex
@@ -1992,10 +2091,10 @@ static void tex_aux_try_break(
*/
best_place_short[fit_class] = shortfall;
- best_place_glue[fit_class] = g;
+ best_place_glue[fit_class] = glue;
}
- if (d < lmt_linebreak_state.minimum_demerits) {
- lmt_linebreak_state.minimum_demerits = d;
+ if (demerits < lmt_linebreak_state.minimum_demerits) {
+ lmt_linebreak_state.minimum_demerits = demerits;
}
}
/*tex Record a new feasible break. */
@@ -2013,6 +2112,9 @@ static void tex_aux_try_break(
*/
node_next(prev_r) = node_next(r);
+ if (callback_id) {
+ tex_aux_delete_break_node(r, active_break_node(r), callback_id);
+ }
tex_flush_node(r);
if (prev_r == active_head) {
/*tex
@@ -2054,9 +2156,10 @@ static halfword tex_aux_inject_orphan_penalty(halfword current, halfword amount)
halfword penalty = tex_new_penalty_node(amount, orphan_penalty_subtype);
tex_couple_nodes(previous, penalty);
tex_couple_nodes(penalty, current);
- current = previous;
+ return previous;
+ } else {
+ return current;
}
- return current;
}
inline static int tex_aux_valid_glue_break(halfword p)
@@ -2065,13 +2168,47 @@ inline static int tex_aux_valid_glue_break(halfword p)
return (prv && prv != temp_head && (node_type(prv) == glyph_node || precedes_break(prv) || precedes_kern(prv) || precedes_dir(prv)));
}
+inline static halfword tex_aux_upcoming_penalty(halfword p) {
+ halfword n = node_next(p);
+ return (n && node_type(n) == math_node && node_subtype(n) == begin_inline_math) ? math_penalty(n) : 0;
+}
+
+/*tex
+
+ I played a bit with a height driven hanging indentation. One can store |cur_p| in the active
+ node and progressively calculate the height + depth and then act on that but in the end
+ interline space, adjustsm etc. also have to be taken into account and that all happens later
+ so in the end it makes no sense. There are valdi reasons why \TEX\ can't do some things
+ reliable: user demands are unpredictable.
+
+*/
+
+/*tex
+
+ Here we pickup the line number from |prev_graf| which relates to display math inside a
+ paragraph. A display formula is then considered to span three lines. Of course this also
+ assume a constant baseline distance with lines heigths not exceeding that amount. It also
+ assumes that the shape and hang are not reset. We check the prevgraf for a large value
+ because when we're close to |max_integer| we can wrap around due to addition beyond that
+ and negative values has side effects (see musings-sideffects) but it's optional so that we
+ can actually use these side effects.
+
+*/
+
+# define max_prev_graf (max_integer/2)
+
void tex_do_line_break(line_break_properties *properties)
{
/*tex Miscellaneous nodes of temporary interest. */
- halfword cur_p, l, r;
int line_break_dir = properties->paragraph_dir;
+ int callback_id = lmt_callback_defined(show_break_callback);
int force_check_hyphenation = hyphenation_permitted(properties->hyphenation_mode, force_check_hyphenation_mode);
(void) (properties->inter_line_penalties); /* avoid not used message */
+ /*tex Fix a buglet that probably is a feature. */
+ if ((cur_list.prev_graf > max_prev_graf || cur_list.prev_graf < 0) && normalize_par_mode_permitted(normalize_par_mode_par, limit_prev_graf_mode)) {
+ tex_formatted_warning("tex", "clipping prev_graf %i to %i", cur_list.prev_graf, max_prev_graf);
+ cur_list.prev_graf = max_prev_graf;
+ }
/*tex Get ready to start */
lmt_linebreak_state.fewest_demerits = 0;
lmt_linebreak_state.actual_looseness = 0;
@@ -2228,17 +2365,19 @@ void tex_do_line_break(line_break_properties *properties)
lmt_linebreak_state.easy_line = max_halfword;
}
lmt_linebreak_state.no_shrink_error_yet = 1;
- l = properties->left_skip;
- r = properties->right_skip;
- lmt_linebreak_state.background[total_glue_amount] = glue_amount(l) + glue_amount(r);
- lmt_linebreak_state.background[total_stretch_amount] = 0;
- lmt_linebreak_state.background[total_fi_amount] = 0;
- lmt_linebreak_state.background[total_fil_amount] = 0;
- lmt_linebreak_state.background[total_fill_amount] = 0;
- lmt_linebreak_state.background[total_filll_amount] = 0;
- lmt_linebreak_state.background[total_stretch_amount + glue_stretch_order(l)] = glue_stretch(l);
- lmt_linebreak_state.background[total_stretch_amount + glue_stretch_order(r)] += glue_stretch(r);
- lmt_linebreak_state.background[total_shrink_amount] = tex_aux_checked_shrink(l) + tex_aux_checked_shrink(r);
+ {
+ halfword l = properties->left_skip;
+ halfword r = properties->right_skip;
+ lmt_linebreak_state.background[total_glue_amount] = glue_amount(l) + glue_amount(r);
+ lmt_linebreak_state.background[total_stretch_amount] = 0;
+ lmt_linebreak_state.background[total_fi_amount] = 0;
+ lmt_linebreak_state.background[total_fil_amount] = 0;
+ lmt_linebreak_state.background[total_fill_amount] = 0;
+ lmt_linebreak_state.background[total_filll_amount] = 0;
+ lmt_linebreak_state.background[total_stretch_amount + glue_stretch_order(l)] = glue_stretch(l);
+ lmt_linebreak_state.background[total_stretch_amount + glue_stretch_order(r)] += glue_stretch(r);
+ lmt_linebreak_state.background[total_shrink_amount] = tex_aux_checked_shrink(l) + tex_aux_checked_shrink(r);
+ }
if (properties->adjust_spacing) {
lmt_linebreak_state.background[font_stretch_amount] = 0;
lmt_linebreak_state.background[font_shrink_amount] = 0;
@@ -2283,7 +2422,6 @@ void tex_do_line_break(line_break_properties *properties)
tex_short_display(node_next(temp_head));
tex_end_diagnostic();
}
-
if (lmt_linebreak_state.threshold >= 0) {
if (properties->tracing_paragraphs > 0) {
tex_begin_diagnostic();
@@ -2299,354 +2437,373 @@ void tex_do_line_break(line_break_properties *properties)
tex_begin_diagnostic();
}
}
- while (1) {
- halfword first_p, q;
- halfword nest_stack[10];
- int nest_index = 0;
- if (lmt_linebreak_state.threshold > infinite_bad) {
- lmt_linebreak_state.threshold = infinite_bad;
- }
- /*tex Create an active breakpoint representing the beginning of the paragraph. */
- q = tex_new_node(unhyphenated_node, (quarterword) decent_fit);
- node_next(q) = active_head;
- active_break_node(q) = null;
- active_line_number(q) = cur_list.prev_graf + 1;
- active_total_demerits(q) = 0;
- active_short(q) = 0;
- active_glue(q) = 0;
- node_next(active_head) = q; /* we create a cycle */
- tex_aux_set_target_to_source(properties->adjust_spacing, lmt_linebreak_state.active_width, lmt_linebreak_state.background);
- lmt_linebreak_state.passive = null;
- lmt_linebreak_state.printed_node = temp_head;
- lmt_linebreak_state.pass_number = 0;
- lmt_print_state.font_in_short_display = null_font;
- /*tex Create an active breakpoint representing the beginning of the paragraph. */
- /* lmt_linebreak_state.auto_breaking = 1; */ /* gone */
- cur_p = node_next(temp_head);
- /*tex Initialize with first (or current) |par| node. */
- if (cur_p && node_type(cur_p) == par_node) {
- node_prev(cur_p) = temp_head;
- lmt_linebreak_state.internal_penalty_interline = tex_get_local_interline_penalty(cur_p);
- lmt_linebreak_state.internal_penalty_broken = tex_get_local_broken_penalty(cur_p);
- lmt_linebreak_state.init_internal_left_box = par_box_left(cur_p);
- lmt_linebreak_state.init_internal_left_box_width = tex_get_local_left_width(cur_p);
- lmt_linebreak_state.internal_right_box = par_box_right(cur_p);
- lmt_linebreak_state.internal_right_box_width = tex_get_local_right_width(cur_p);
- lmt_linebreak_state.internal_middle_box = par_box_middle(cur_p);
- } else {
- lmt_linebreak_state.internal_penalty_interline = 0;
- lmt_linebreak_state.internal_penalty_broken = 0;
- lmt_linebreak_state.init_internal_left_box = null;
- lmt_linebreak_state.init_internal_left_box_width = 0;
- lmt_linebreak_state.internal_right_box = null;
- lmt_linebreak_state.internal_right_box_width = 0;
- lmt_linebreak_state.internal_middle_box = null;
- }
- lmt_linebreak_state.internal_left_box = lmt_linebreak_state.init_internal_left_box;
- lmt_linebreak_state.internal_left_box_width = lmt_linebreak_state.init_internal_left_box_width;
- lmt_packaging_state.previous_char_ptr = null;
- first_p = cur_p;
- /*tex
+ if (callback_id) {
+ tex_aux_initialize_show_break_node(callback_id);
+ }
+ {
+ halfword cur_p = null;
+ int pass = 0;
+ while (++pass) {
+ halfword first_p = node_next(temp_head);
+ cur_p = first_p;
+ if (lmt_linebreak_state.threshold > infinite_bad) {
+ lmt_linebreak_state.threshold = infinite_bad;
+ }
+ if (callback_id) {
+ tex_aux_start_show_break_node(callback_id, pass);
+ }
+ /*tex Create an active breakpoint representing the beginning of the paragraph. */
+ {
+ halfword initial = tex_new_node(unhyphenated_node, (quarterword) decent_fit);
+ node_next(initial) = active_head;
+ active_break_node(initial) = null;
+ active_line_number(initial) = cur_list.prev_graf + 1;
+ active_total_demerits(initial) = 0; // default
+ active_short(initial) = 0; // default
+ active_glue(initial) = 0; // default
+ // active_reserved(initial) = 0; // default
+ node_next(active_head) = initial;
+ }
+ /*tex We now have created a cycle. */
+ tex_aux_set_target_to_source(properties->adjust_spacing, lmt_linebreak_state.active_width, lmt_linebreak_state.background);
+ lmt_linebreak_state.passive = null;
+ lmt_linebreak_state.printed_node = temp_head;
+ lmt_linebreak_state.pass_number = 0;
+ lmt_print_state.font_in_short_display = null_font;
+ /*tex Create an active breakpoint representing the beginning of the paragraph. */
+ /* lmt_linebreak_state.auto_breaking = 1; */ /* gone */
+ // cur_p = node_next(temp_head);
+ /*tex Initialize with first (or current) |par| node. */
+ if (cur_p && node_type(cur_p) == par_node) {
+ node_prev(cur_p) = temp_head;
+ lmt_linebreak_state.internal_penalty_interline = tex_get_local_interline_penalty(cur_p);
+ lmt_linebreak_state.internal_penalty_broken = tex_get_local_broken_penalty(cur_p);
+ lmt_linebreak_state.init_internal_left_box = par_box_left(cur_p);
+ lmt_linebreak_state.init_internal_left_box_width = tex_get_local_left_width(cur_p);
+ lmt_linebreak_state.internal_right_box = par_box_right(cur_p);
+ lmt_linebreak_state.internal_right_box_width = tex_get_local_right_width(cur_p);
+ lmt_linebreak_state.internal_middle_box = par_box_middle(cur_p);
+ } else {
+ lmt_linebreak_state.internal_penalty_interline = 0;
+ lmt_linebreak_state.internal_penalty_broken = 0;
+ lmt_linebreak_state.init_internal_left_box = null;
+ lmt_linebreak_state.init_internal_left_box_width = 0;
+ lmt_linebreak_state.internal_right_box = null;
+ lmt_linebreak_state.internal_right_box_width = 0;
+ lmt_linebreak_state.internal_middle_box = null;
+ }
+ lmt_linebreak_state.internal_left_box = lmt_linebreak_state.init_internal_left_box;
+ lmt_linebreak_state.internal_left_box_width = lmt_linebreak_state.init_internal_left_box_width;
+ lmt_packaging_state.previous_char_ptr = null;
+ // first_p = cur_p;
+ /*tex
- To access the first node of paragraph as the first active node has |break_node = null|.
+ To access the first node of paragraph as the first active node has |break_node = null|.
- Determine legal breaks: As we move through the hlist, we need to keep the |active_width|
- array up to date, so that the badness of individual lines is readily calculated by
- |try_break|. It is convenient to use the short name |active_width [1]| for the component
- of active width that represents real width as opposed to glue.
+ Determine legal breaks: As we move through the hlist, we need to keep the |active_width|
+ array up to date, so that the badness of individual lines is readily calculated by
+ |try_break|. It is convenient to use the short name |active_width [1]| for the component
+ of active width that represents real width as opposed to glue.
- Advance |cur_p| to the node following the present string of characters. The code that
- passes over the characters of words in a paragraph is part of \TEX's inner loop, so it
- has been streamlined for speed. We use the fact that |\parfillskip| glue appears at the
- end of each paragraph; it is therefore unnecessary to check if |vlink (cur_p) = null|
- when |cur_p| is a character node.
+ Advance |cur_p| to the node following the present string of characters. The code that
+ passes over the characters of words in a paragraph is part of \TEX's inner loop, so it
+ has been streamlined for speed. We use the fact that |\parfillskip| glue appears at the
+ end of each paragraph; it is therefore unnecessary to check if |vlink (cur_p) = null|
+ when |cur_p| is a character node.
- */
- while (cur_p && (node_next(active_head) != active_head)) { /* we check the cycle */
- switch (node_type(cur_p)) {
- case glyph_node:
- lmt_linebreak_state.active_width[total_glue_amount] += tex_glyph_width_ex(cur_p);
- if (properties->adjust_spacing && tex_aux_check_expand_pars(properties->adjust_spacing_step, glyph_font(cur_p))) {
- lmt_packaging_state.previous_char_ptr = cur_p;
- lmt_linebreak_state.active_width[font_stretch_amount] += tex_char_stretch(cur_p);
- lmt_linebreak_state.active_width[font_shrink_amount] += tex_char_shrink(cur_p);
- }
- break;
- case hlist_node:
- case vlist_node:
- lmt_linebreak_state.active_width[total_glue_amount] += box_width(cur_p);
- break;
- case rule_node:
- lmt_linebreak_state.active_width[total_glue_amount] += rule_width(cur_p);
- break;
- case dir_node:
- /*tex Adjust the dir stack for the |line_break| routine. */
- line_break_dir = tex_update_dir_state(cur_p, properties->paragraph_dir);
- break;
- case par_node:
- /*tex Advance past a |par| node. */
- lmt_linebreak_state.internal_penalty_interline = tex_get_local_interline_penalty(cur_p);
- lmt_linebreak_state.internal_penalty_broken = tex_get_local_broken_penalty(cur_p);
- lmt_linebreak_state.internal_left_box = par_box_left(cur_p);
- lmt_linebreak_state.internal_left_box_width = tex_get_local_left_width(cur_p);
- lmt_linebreak_state.internal_right_box = par_box_right(cur_p);
- lmt_linebreak_state.internal_right_box_width = tex_get_local_right_width(cur_p);
- lmt_linebreak_state.internal_middle_box = par_box_middle(cur_p);
- break;
- case glue_node:
- /*tex
+ */
+ while (cur_p && (node_next(active_head) != active_head)) { /* we check the cycle */
+ switch (node_type(cur_p)) {
+ case glyph_node:
+ /* why ex here and not in add/sub disc glyphs */
+ lmt_linebreak_state.active_width[total_glue_amount] += tex_glyph_width_ex(cur_p); // ex
+ if (properties->adjust_spacing && tex_aux_check_expand_pars(properties->adjust_spacing_step, glyph_font(cur_p))) {
+ lmt_packaging_state.previous_char_ptr = cur_p;
+ lmt_linebreak_state.active_width[font_stretch_amount] += tex_char_stretch(cur_p);
+ lmt_linebreak_state.active_width[font_shrink_amount] += tex_char_shrink(cur_p);
+ }
+ break;
+ case hlist_node:
+ case vlist_node:
+ lmt_linebreak_state.active_width[total_glue_amount] += box_width(cur_p);
+ break;
+ case rule_node:
+ lmt_linebreak_state.active_width[total_glue_amount] += rule_width(cur_p);
+ break;
+ case dir_node:
+ /*tex Adjust the dir stack for the |line_break| routine. */
+ line_break_dir = tex_update_dir_state(cur_p, properties->paragraph_dir);
+ break;
+ case par_node:
+ /*tex Advance past a |par| node. */
+ lmt_linebreak_state.internal_penalty_interline = tex_get_local_interline_penalty(cur_p);
+ lmt_linebreak_state.internal_penalty_broken = tex_get_local_broken_penalty(cur_p);
+ lmt_linebreak_state.internal_left_box = par_box_left(cur_p);
+ lmt_linebreak_state.internal_left_box_width = tex_get_local_left_width(cur_p);
+ lmt_linebreak_state.internal_right_box = par_box_right(cur_p);
+ lmt_linebreak_state.internal_right_box_width = tex_get_local_right_width(cur_p);
+ lmt_linebreak_state.internal_middle_box = par_box_middle(cur_p);
+ break;
+ case glue_node:
+ /*tex
- If node |cur_p| is a legal breakpoint, call |try_break|; then update the
- active widths by including the glue in |glue_ptr(cur_p)|.
+ If node |cur_p| is a legal breakpoint, call |try_break|; then update the
+ active widths by including the glue in |glue_ptr(cur_p)|.
- When node |cur_p| is a glue node, we look at the previous to see whether or
- not a breakpoint is legal at |cur_p|, as explained above.
+ When node |cur_p| is a glue node, we look at the previous to see whether
+ or not a breakpoint is legal at |cur_p|, as explained above.
- We only break after certain nodes (see texnodes.h), a font related kern and
- a dir node when |\breakafterdirmode = 1|.
+ We only break after certain nodes (see texnodes.h), a font related kern
+ and a dir node when |\breakafterdirmode = 1|.
- */
- if (tex_has_glue_option(cur_p, glue_option_no_auto_break)) {
- /*tex Glue in math is not a valid breakpoint. */
- } else if (tex_is_par_init_glue(cur_p)) {
- /*tex Of course we don't break here. */
- } else if (tex_aux_valid_glue_break(cur_p)) {
- tex_aux_try_break(properties, 0, unhyphenated_node, first_p, cur_p);
- }
- lmt_linebreak_state.active_width[total_glue_amount] += glue_amount(cur_p);
- lmt_linebreak_state.active_width[2 + glue_stretch_order(cur_p)] += glue_stretch(cur_p);
- lmt_linebreak_state.active_width[total_shrink_amount] += tex_aux_checked_shrink(cur_p);
- break;
- case kern_node:
- switch (node_subtype(cur_p)) {
- case explicit_kern_subtype:
- case italic_kern_subtype:
- {
- /* there used to a ! is_char_node(node_next(cur_p)) test */
- halfword nxt = node_next(cur_p);
- if (nxt && node_type(nxt) == glue_node && ! tex_has_glue_option(nxt, glue_option_no_auto_break)) {
- tex_aux_try_break(properties, 0, unhyphenated_node, first_p, cur_p);
+ */
+ if (tex_has_glue_option(cur_p, glue_option_no_auto_break)) {
+ /*tex Glue in math is not a valid breakpoint, unless we permit it. */
+ } else if (tex_is_par_init_glue(cur_p)) {
+ /*tex Of course we don't break here. */
+ } else if (tex_aux_valid_glue_break(cur_p)) {
+ tex_aux_try_break(properties, tex_aux_upcoming_penalty(cur_p), unhyphenated_node, first_p, cur_p, callback_id, pass);
+ }
+ lmt_linebreak_state.active_width[total_glue_amount] += glue_amount(cur_p);
+ lmt_linebreak_state.active_width[total_stretch_amount + glue_stretch_order(cur_p)] += glue_stretch(cur_p);
+ lmt_linebreak_state.active_width[total_shrink_amount] += tex_aux_checked_shrink(cur_p);
+ break;
+ case kern_node:
+ switch (node_subtype(cur_p)) {
+ case explicit_kern_subtype:
+ case italic_kern_subtype:
+ {
+ /* there used to a ! is_char_node(node_next(cur_p)) test */
+ halfword nxt = node_next(cur_p);
+ if (nxt && node_type(nxt) == glue_node && ! tex_has_glue_option(nxt, glue_option_no_auto_break)) {
+ tex_aux_try_break(properties, 0, unhyphenated_node, first_p, cur_p, callback_id, pass);
+ }
}
- }
- break;
- case font_kern_subtype:
- if (properties->adjust_spacing == adjust_spacing_full) {
- lmt_linebreak_state.active_width[font_stretch_amount] += tex_kern_stretch(cur_p);
- lmt_linebreak_state.active_width[font_shrink_amount] += tex_kern_shrink(cur_p);
- }
- break;
- }
- lmt_linebreak_state.active_width[total_glue_amount] += kern_amount(cur_p);
- break;
- case disc_node:
- /*tex
-
- Try to break after a discretionary fragment, then |goto done5|. The
- following code knows that discretionary texts contain only character
- nodes, kern nodes, box nodes, and rule nodes. This branch differs a bit
- from older engines because in \LUATEX\ we already have hyphenated the list.
- This means that we need to skip automatic disc nodes. Or better, we need
- to treat discretionaries and explicit hyphens always, even in the first
- pass.
-
- We used to have |init_disc| followed by |select disc| variants where the
- |select_disc|s were handled by the leading |init_disc|. The question is: should
- we bother about select nodes? Knuth indicates in the original source that only
- a very few cases need hyphenation so the exceptional case of >2 char ligatures
- having hyphenation points in between is rare. We'd better have proper compound
- word handling. Keep in mind that these (old) init and select subtypes always
- came in isolated pairs and that they only were meant for the simple (enforced)
- hyphenation discretionaries.
-
- Therefore, this feature has been dropped from \LUAMETATEX. It not only makes
- the code simpler, it also avoids having code on board for border cases that
- even when dealt with are suboptimal. It's better to have nothing that something
- fuzzy. It also makes dealing with (intermediate) node lists easier. If I want
- something like this it should be okay for any situation.
-
- */
- if (force_check_hyphenation || lmt_linebreak_state.second_pass || (node_subtype(cur_p) != syllable_discretionary_code)) {
- halfword actual_penalty = disc_penalty(cur_p);
- halfword s = disc_pre_break_head(cur_p);
- tex_aux_reset_disc_target(properties->adjust_spacing, lmt_linebreak_state.disc_width);
- if (s) {
- tex_aux_add_to_widths(s, properties->adjust_spacing, properties->adjust_spacing_step, lmt_linebreak_state.disc_width);
- tex_aux_add_disc_source_to_target(properties->adjust_spacing, lmt_linebreak_state.active_width, lmt_linebreak_state.disc_width);
- tex_aux_try_break(properties, actual_penalty, hyphenated_node, first_p, cur_p);
- tex_aux_sub_disc_target_from_source(properties->adjust_spacing, lmt_linebreak_state.active_width, lmt_linebreak_state.disc_width);
- } else {
- /*tex trivial pre-break */
- tex_aux_try_break(properties, actual_penalty, hyphenated_node, first_p, cur_p);
+ break;
+ case font_kern_subtype:
+ if (properties->adjust_spacing == adjust_spacing_full) {
+ lmt_linebreak_state.active_width[font_stretch_amount] += tex_kern_stretch(cur_p);
+ lmt_linebreak_state.active_width[font_shrink_amount] += tex_kern_shrink(cur_p);
+ }
+ break;
}
- }
- tex_aux_add_to_widths(disc_no_break_head(cur_p), properties->adjust_spacing, properties->adjust_spacing_step, lmt_linebreak_state.active_width);
- break;
- case penalty_node:
- tex_aux_try_break(properties, penalty_amount(cur_p), unhyphenated_node, first_p, cur_p);
- break;
- case math_node:
- {
- /* there used to a ! is_char_node(node_next(cur_p)) test */
- int finishing = node_subtype(cur_p) == end_inline_math;
- // lmt_linebreak_state.auto_breaking = finishing;
- if (tex_math_glue_is_zero(cur_p) || tex_ignore_math_skip(cur_p)) {
- /*tex
- When we end up here we assume |\mathsurround| but we only check for
- a break when we're ending math. Maybe this is something we need to
- open up. The math specific penalty only kicks in when we break.
- */
- if (finishing && node_type(node_next(cur_p)) == glue_node) {
- tex_aux_try_break(properties, math_penalty(cur_p), unhyphenated_node, first_p, cur_p);
+ lmt_linebreak_state.active_width[total_glue_amount] += kern_amount(cur_p);
+ break;
+ case disc_node:
+ /*tex
+
+ Try to break after a discretionary fragment, then |goto done5|. The
+ following code knows that discretionary texts contain only character
+ nodes, kern nodes, box nodes, and rule nodes. This branch differs a bit
+ from older engines because in \LUATEX\ we already have hyphenated the list.
+ This means that we need to skip automatic disc nodes. Or better, we need
+ to treat discretionaries and explicit hyphens always, even in the first
+ pass.
+
+ We used to have |init_disc| followed by |select disc| variants where the
+ |select_disc|s were handled by the leading |init_disc|. The question is: should
+ we bother about select nodes? Knuth indicates in the original source that only
+ a very few cases need hyphenation so the exceptional case of >2 char ligatures
+ having hyphenation points in between is rare. We'd better have proper compound
+ word handling. Keep in mind that these (old) init and select subtypes always
+ came in isolated pairs and that they only were meant for the simple (enforced)
+ hyphenation discretionaries.
+
+ Therefore, this feature has been dropped from \LUAMETATEX. It not only makes
+ the code simpler, it also avoids having code on board for border cases that
+ even when dealt with are suboptimal. It's better to have nothing that something
+ fuzzy. It also makes dealing with (intermediate) node lists easier. If I want
+ something like this it should be okay for any situation.
+
+ */
+ if (force_check_hyphenation || lmt_linebreak_state.second_pass || (node_subtype(cur_p) != syllable_discretionary_code)) {
+ halfword actual_penalty = disc_penalty(cur_p);
+ halfword pre = disc_pre_break_head(cur_p);
+ tex_aux_reset_disc_target(properties->adjust_spacing, lmt_linebreak_state.disc_width);
+ if (pre) {
+ tex_aux_add_to_widths(pre, properties->adjust_spacing, properties->adjust_spacing_step, lmt_linebreak_state.disc_width);
+ tex_aux_add_disc_source_to_target(properties->adjust_spacing, lmt_linebreak_state.active_width, lmt_linebreak_state.disc_width);
+ tex_aux_try_break(properties, actual_penalty, hyphenated_node, first_p, cur_p, callback_id, pass);
+ tex_aux_sub_disc_target_from_source(properties->adjust_spacing, lmt_linebreak_state.active_width, lmt_linebreak_state.disc_width);
+ } else {
+ /*tex trivial pre-break */
+ tex_aux_try_break(properties, actual_penalty, hyphenated_node, first_p, cur_p, callback_id, pass);
}
- lmt_linebreak_state.active_width[total_glue_amount] += math_surround(cur_p);
- } else {
- /*tex
- This one does quite some testing, is that still needed?
- */
- if (finishing && tex_aux_valid_glue_break(cur_p)) {
- tex_aux_try_break(properties, math_penalty(cur_p), unhyphenated_node, first_p, cur_p);
+ }
+ tex_aux_add_to_widths(disc_no_break_head(cur_p), properties->adjust_spacing, properties->adjust_spacing_step, lmt_linebreak_state.active_width);
+ break;
+ case penalty_node:
+ tex_aux_try_break(properties, penalty_amount(cur_p), unhyphenated_node, first_p, cur_p, callback_id, pass);
+ break;
+ case math_node:
+ {
+ /* there used to a ! is_char_node(node_next(cur_p)) test */
+ int finishing = node_subtype(cur_p) == end_inline_math;
+ // lmt_linebreak_state.auto_breaking = finishing;
+ if (tex_math_glue_is_zero(cur_p) || tex_ignore_math_skip(cur_p)) {
+ /*tex
+ When we end up here we assume |\mathsurround| but we only check for
+ a break when we're ending math. Maybe this is something we need to
+ open up. The math specific penalty only kicks in when we break.
+ */
+ if (finishing && node_type(node_next(cur_p)) == glue_node) {
+ tex_aux_try_break(properties, math_penalty(cur_p), unhyphenated_node, first_p, cur_p, callback_id, pass);
+ }
+ lmt_linebreak_state.active_width[total_glue_amount] += math_surround(cur_p);
+ } else {
+ /*tex
+ This one does quite some testing, is that still needed?
+ */
+ if (finishing && tex_aux_valid_glue_break(cur_p)) {
+ tex_aux_try_break(properties, math_penalty(cur_p), unhyphenated_node, first_p, cur_p, callback_id, pass);
+ }
+ lmt_linebreak_state.active_width[total_glue_amount] += math_amount(cur_p);
+ lmt_linebreak_state.active_width[total_stretch_amount + math_stretch_order(cur_p)] += math_stretch(cur_p);
+ lmt_linebreak_state.active_width[total_shrink_amount] += tex_aux_checked_shrink(cur_p);
}
- lmt_linebreak_state.active_width[total_glue_amount] += math_amount(cur_p);
- lmt_linebreak_state.active_width[2 + math_stretch_order(cur_p)] += math_stretch(cur_p);
- lmt_linebreak_state.active_width[total_shrink_amount] += tex_aux_checked_shrink(cur_p);
}
- }
- break;
- case boundary_node:
- case whatsit_node:
- case mark_node:
- case insert_node:
- case adjust_node:
- /*tex Advance past these nodes in the |line_break| loop. */
- break;
- default:
- tex_formatted_error("parbuilder", "weird node %d in paragraph", node_type(cur_p));
- }
- cur_p = node_next(cur_p);
- while (! cur_p && nest_index > 0) {
- cur_p = nest_stack[--nest_index];
+ break;
+ case boundary_node:
+ case whatsit_node:
+ case mark_node:
+ case insert_node:
+ case adjust_node:
+ /*tex Advance past these nodes in the |line_break| loop. */
+ break;
+ default:
+ tex_formatted_error("parbuilder", "weird node %d in paragraph", node_type(cur_p));
+ }
+ cur_p = node_next(cur_p);
}
- }
- if (! cur_p) {
- /*tex
-
- Try the final line break at the end of the paragraph, and |goto done| if the desired
- breakpoints have been found.
-
- The forced line break at the paragraph's end will reduce the list of breakpoints so
- that all active nodes represent breaks at |cur_p = null|. On the first pass, we
- insist on finding an active node that has the correct \quote {looseness.} On the
- final pass, there will be at least one active node, and we will match the desired
- looseness as well as we can.
+ if (! cur_p) {
+ /*tex
- The global variable |best_bet| will be set to the active node for the best way to
- break the paragraph, and a few other variables are used to help determine what is
- best.
+ Try the final line break at the end of the paragraph, and |goto done| if the desired
+ breakpoints have been found.
- */
- tex_aux_try_break(properties, eject_penalty, hyphenated_node, first_p, cur_p);
- if (node_next(active_head) != active_head) {
- /*tex Find an active node with fewest demerits. */
- r = node_next(active_head);
- lmt_linebreak_state.fewest_demerits = awful_bad;
- do {
- if ((node_type(r) != delta_node) && (active_total_demerits(r) < lmt_linebreak_state.fewest_demerits)) {
- lmt_linebreak_state.fewest_demerits = active_total_demerits(r);
- lmt_linebreak_state.best_bet = r;
- }
- r = node_next(r);
- } while (r != active_head);
- lmt_linebreak_state.best_line = active_line_number(lmt_linebreak_state.best_bet);
- /*tex Find an active node with fewest demerits. */
- if (properties->looseness == 0) {
- goto DONE;
- } else {
- /*tex
+ The forced line break at the paragraph's end will reduce the list of breakpoints so
+ that all active nodes represent breaks at |cur_p = null|. On the first pass, we
+ insist on finding an active node that has the correct \quote {looseness.} On the
+ final pass, there will be at least one active node, and we will match the desired
+ looseness as well as we can.
- Find the best active node for the desired looseness. The adjustment for a
- desired looseness is a slightly more complicated version of the loop just
- considered. Note that if a paragraph is broken into segments by displayed
- equations, each segment will be subject to the looseness calculation,
- independently of the other segments.
+ The global variable |best_bet| will be set to the active node for the best way to
+ break the paragraph, and a few other variables are used to help determine what is
+ best.
- */
- r = node_next(active_head); // can be local
- lmt_linebreak_state.actual_looseness = 0;
+ */
+ tex_aux_try_break(properties, eject_penalty, hyphenated_node, first_p, cur_p, callback_id, pass);
+ if (node_next(active_head) != active_head) {
+ /*tex Find an active node with fewest demerits. */
+ halfword r = node_next(active_head);
+ lmt_linebreak_state.fewest_demerits = awful_bad;
do {
- if (node_type(r) != delta_node) {
- lmt_linebreak_state.line_difference = active_line_number(r) - lmt_linebreak_state.best_line;
- if (((lmt_linebreak_state.line_difference < lmt_linebreak_state.actual_looseness) && (properties->looseness <= lmt_linebreak_state.line_difference))
- || ((lmt_linebreak_state.line_difference > lmt_linebreak_state.actual_looseness) && (properties->looseness >= lmt_linebreak_state.line_difference))) {
- lmt_linebreak_state.best_bet = r;
- lmt_linebreak_state.actual_looseness = lmt_linebreak_state.line_difference;
- lmt_linebreak_state.fewest_demerits = active_total_demerits(r);
- } else if ((lmt_linebreak_state.line_difference == lmt_linebreak_state.actual_looseness) && (active_total_demerits(r) < lmt_linebreak_state.fewest_demerits)) {
- lmt_linebreak_state.best_bet = r;
- lmt_linebreak_state.fewest_demerits = active_total_demerits(r);
- }
+ if ((node_type(r) != delta_node) && (active_total_demerits(r) < lmt_linebreak_state.fewest_demerits)) {
+ lmt_linebreak_state.fewest_demerits = active_total_demerits(r);
+ lmt_linebreak_state.best_bet = r;
}
r = node_next(r);
} while (r != active_head);
lmt_linebreak_state.best_line = active_line_number(lmt_linebreak_state.best_bet);
- /*tex
- Find the best active node for the desired looseness.
- */
- if ((lmt_linebreak_state.actual_looseness == properties->looseness) || lmt_linebreak_state.final_pass) {
+ /*tex Find an active node with fewest demerits. */
+ if (properties->looseness == 0) {
goto DONE;
+ } else {
+ /*tex
+
+ Find the best active node for the desired looseness. The adjustment for a
+ desired looseness is a slightly more complicated version of the loop just
+ considered. Note that if a paragraph is broken into segments by displayed
+ equations, each segment will be subject to the looseness calculation,
+ independently of the other segments.
+
+ */
+ r = node_next(active_head); // can be local
+ lmt_linebreak_state.actual_looseness = 0;
+ do {
+ if (node_type(r) != delta_node) {
+ lmt_linebreak_state.line_difference = active_line_number(r) - lmt_linebreak_state.best_line;
+ if (((lmt_linebreak_state.line_difference < lmt_linebreak_state.actual_looseness) && (properties->looseness <= lmt_linebreak_state.line_difference))
+ || ((lmt_linebreak_state.line_difference > lmt_linebreak_state.actual_looseness) && (properties->looseness >= lmt_linebreak_state.line_difference))) {
+ lmt_linebreak_state.best_bet = r;
+ lmt_linebreak_state.actual_looseness = lmt_linebreak_state.line_difference;
+ lmt_linebreak_state.fewest_demerits = active_total_demerits(r);
+ } else if ((lmt_linebreak_state.line_difference == lmt_linebreak_state.actual_looseness) && (active_total_demerits(r) < lmt_linebreak_state.fewest_demerits)) {
+ lmt_linebreak_state.best_bet = r;
+ lmt_linebreak_state.fewest_demerits = active_total_demerits(r);
+ }
+ }
+ r = node_next(r);
+ } while (r != active_head);
+ lmt_linebreak_state.best_line = active_line_number(lmt_linebreak_state.best_bet);
+ /*tex
+ Find the best active node for the desired looseness.
+ */
+ if ((lmt_linebreak_state.actual_looseness == properties->looseness) || lmt_linebreak_state.final_pass) {
+ goto DONE;
+ }
}
}
+ } else {
+ /*tex So we have cycled: |node_next(active_head) == active_head|. */
+ }
+ /*tex Clean up the memory by removing the break nodes. */
+ cur_p = tex_aux_clean_up_the_memory(cur_p);
+ if (! lmt_linebreak_state.second_pass) {
+ if (properties->tracing_paragraphs > 0) {
+ tex_print_format("%l[linebreak: second pass]"); /* @secondpass */;
+ }
+ lmt_linebreak_state.threshold = properties->tolerance;
+ lmt_linebreak_state.second_pass = 1;
+ lmt_linebreak_state.final_pass = (properties->emergency_stretch <= 0);
+ } else {
+ /*tex If at first you do not succeed, then: */
+ if (properties->tracing_paragraphs > 0) {
+ tex_print_format("%l[linebreak: emergency pass]"); /* @emergencypass */
+ }
+ lmt_linebreak_state.background[total_stretch_amount] += properties->emergency_stretch;
+ lmt_linebreak_state.final_pass = 1;
}
- }
- /*tex Clean up the memory by removing the break nodes. */
- cur_p = tex_aux_clean_up_the_memory(cur_p);
- if (! lmt_linebreak_state.second_pass) {
- if (properties->tracing_paragraphs > 0) {
- tex_print_str("%l[linebreak: second pass]"); /* @secondpass */;
+ if (callback_id) {
+ tex_aux_stop_show_break_node(callback_id);
}
- lmt_linebreak_state.threshold = properties->tolerance;
- lmt_linebreak_state.second_pass = 1;
- lmt_linebreak_state.final_pass = (properties->emergency_stretch <= 0);
- } else {
- /*tex If at first you do not succeed, then: */
- if (properties->tracing_paragraphs > 0) {
- tex_print_str("%l[linebreak: emergency pass]"); /* @emergencypass */
+ }
+ DONE:
+ if (properties->tracing_paragraphs > 0) {
+ tex_end_diagnostic();
+ /*tex
+ This is a bit weird, as only here: |normalize_selector()| while we have diagnostics
+ all over the place.
+ */
+ }
+ if (lmt_linebreak_state.do_last_line_fit) {
+ /*tex
+ Adjust the final line of the paragraph; here we either reset |do_last_line_fit| or
+ adjust the |par_fill_skip| glue.
+ */
+ if (active_short(lmt_linebreak_state.best_bet) == 0) {
+ lmt_linebreak_state.do_last_line_fit = 0;
+ } else {
+ glue_amount(lmt_linebreak_state.last_line_fill) += (active_short(lmt_linebreak_state.best_bet) - active_glue(lmt_linebreak_state.best_bet));
+ glue_stretch(lmt_linebreak_state.last_line_fill) = 0;
}
- lmt_linebreak_state.background[total_stretch_amount] += properties->emergency_stretch;
- lmt_linebreak_state.final_pass = 1;
}
- }
- DONE:
- if (properties->tracing_paragraphs > 0) {
- tex_end_diagnostic();
/*tex
- This is a bit weird, as only here: |normalize_selector()| while we have diagnostics
- all over the place.
+ Break the paragraph at the chosen. Once the best sequence of breakpoints has been found
+ (hurray), we call on the procedure |post_line_break| to finish the remainder of the work.
+ By introducing this subprocedure, we are able to keep |line_break| from getting extremely
+ long. The first thing |ext_post_line_break| does is reset |dir_ptr|.
*/
+ tex_flush_node_list(lmt_linebreak_state.dir_ptr);
+ lmt_linebreak_state.dir_ptr = null;
+ /*tex Here we still have a temp node as head. */
+ tex_aux_post_line_break(properties, line_break_dir, callback_id);
+ /*tex Clean up memory by removing the break nodes (maybe: |tex_flush_node_list(cur_p);|). */
+ tex_aux_clean_up_the_memory(cur_p);
}
- if (lmt_linebreak_state.do_last_line_fit) {
- /*tex
- Adjust the final line of the paragraph; here we either reset |do_last_line_fit| or
- adjust the |par_fill_skip| glue.
- */
- if (active_short(lmt_linebreak_state.best_bet) == 0) {
- lmt_linebreak_state.do_last_line_fit = 0;
- } else {
- glue_amount(lmt_linebreak_state.last_line_fill) += (active_short(lmt_linebreak_state.best_bet) - active_glue(lmt_linebreak_state.best_bet));
- glue_stretch(lmt_linebreak_state.last_line_fill) = 0;
- }
+ if (callback_id) {
+ tex_aux_wrapup_show_break_node(callback_id);
}
- /*tex
- Break the paragraph at the chosen. Once the best sequence of breakpoints has been found
- (hurray), we call on the procedure |post_line_break| to finish the remainder of the work.
- By introducing this subprocedure, we are able to keep |line_break| from getting extremely
- long. The first thing |ext_post_line_break| does is reset |dir_ptr|.
- */
- tex_flush_node_list(lmt_linebreak_state.dir_ptr);
- lmt_linebreak_state.dir_ptr = null;
- /*tex Here we still have a temp node as head. */
- tex_aux_post_line_break(properties, line_break_dir);
- /*tex Clean up the memory by removing the break nodes. */
- cur_p = tex_aux_clean_up_the_memory(cur_p);
}
void tex_get_linebreak_info(int *f, int *a)
@@ -2698,7 +2855,7 @@ static void tex_aux_trace_penalty(const char *what, int line, int index, halfwor
}
}
-static void tex_aux_post_line_break(const line_break_properties *properties, halfword line_break_dir)
+static void tex_aux_post_line_break(const line_break_properties *properties, halfword line_break_dir, int callback_id)
{
/*tex temporary registers for list manipulation */
halfword q, r;
@@ -2733,6 +2890,9 @@ static void tex_aux_post_line_break(const line_break_properties *properties, hal
and having |next_break| fields. Node |r| is the passive node being moved from stack to
stack.
*/
+ if (callback_id) {
+ tex_aux_collect_show_break_node(callback_id);
+ }
q = active_break_node(lmt_linebreak_state.best_bet);
do {
r = q;
@@ -2740,6 +2900,13 @@ static void tex_aux_post_line_break(const line_break_properties *properties, hal
passive_next_break(r) = cur_p;
cur_p = r;
} while (q);
+ if (callback_id) {
+ halfword p = cur_p;
+ while (p) {
+ tex_aux_list_break_node(p, callback_id);
+ p = passive_next_break(p);
+ }
+ }
/*tex prevgraf + 1 */
cur_line = cur_list.prev_graf + 1;
do {
@@ -3310,6 +3477,9 @@ static void tex_aux_post_line_break(const line_break_properties *properties, hal
}
/*tex Call the packaging subroutine, setting |just_box| to the justified box. */
node_subtype(lmt_linebreak_state.just_box) = line_list;
+ if (callback_id) {
+ tex_aux_line_show_break_node(callback_id);
+ }
/*tex Pending content (callback). */
if (node_next(contribute_head)) {
if (! lmt_page_builder_state.output_active) {
@@ -3504,6 +3674,10 @@ static void tex_aux_post_line_break(const line_break_properties *properties, hal
while (1) {
q = node_next(r);
if (node_type(q) == math_node) {
+ if (node_subtype(q) == begin_inline_math) {
+ /*tex We keep it for tracing. */
+ break;
+ }
/*tex begin mathskip code */
math_surround(q) = 0 ;
tex_reset_math_glue_to_zero(q);
@@ -3517,7 +3691,7 @@ static void tex_aux_post_line_break(const line_break_properties *properties, hal
/*tex Keep it. Can be tricky after a |\break| with no follow up (loops). */
break;
} else if (node_type(q) == par_node && node_subtype(q) == local_box_par_subtype) {
- /*tex weird, in the middle somewhere .. these local penalties do this */
+ /*tex Weird, in the middle somewhere .. these local penalties do this. */
break; /* if not we leak, so maybe this needs more testing */
} else if (non_discardable(q)) {
break;
diff --git a/source/luametatex/source/tex/texlinebreak.h b/source/luametatex/source/tex/texlinebreak.h
index 789101999..850d98da0 100644
--- a/source/luametatex/source/tex/texlinebreak.h
+++ b/source/luametatex/source/tex/texlinebreak.h
@@ -79,10 +79,10 @@ typedef struct linebreak_state_info {
halfword pass_number;
/* int auto_breaking; */ /* is gone */
/* int math_level; */ /* was never used */
- scaled active_width[10];
- scaled background[10];
- scaled break_width[10];
- scaled disc_width[10];
+ scaled active_width[n_of_glue_amounts];
+ scaled background[n_of_glue_amounts];
+ scaled break_width[n_of_glue_amounts];
+ scaled disc_width[n_of_glue_amounts];
scaled fill_width[4];
halfword internal_penalty_interline;
halfword internal_penalty_broken;
diff --git a/source/luametatex/source/tex/texlocalboxes.c b/source/luametatex/source/tex/texlocalboxes.c
index 0def018d4..1bcc25bc0 100644
--- a/source/luametatex/source/tex/texlocalboxes.c
+++ b/source/luametatex/source/tex/texlocalboxes.c
@@ -295,19 +295,23 @@ void tex_set_local_right_width(halfword p, scaled width)
halfword tex_get_local_interline_penalty(halfword p)
{
return par_penalty_interline(p);
+ // return par_inter_line_penalty(p);
}
halfword tex_get_local_broken_penalty(halfword p)
{
return par_penalty_broken(p);
+ // return par_broken_penalty(p);
}
void tex_set_local_interline_penalty(halfword p, halfword penalty)
{
par_penalty_interline(p) = penalty;
+ // par_inter_line_penalty(p) = penalty;
}
void tex_set_local_broken_penalty(halfword p, halfword penalty)
{
par_penalty_broken(p) = penalty;
+ // par_broken_penalty(p) = penalty;
}
diff --git a/source/luametatex/source/tex/texmaincontrol.c b/source/luametatex/source/tex/texmaincontrol.c
index 3989dfff0..0489b67ac 100644
--- a/source/luametatex/source/tex/texmaincontrol.c
+++ b/source/luametatex/source/tex/texmaincontrol.c
@@ -1161,9 +1161,9 @@ static void tex_aux_run_par_boundary(void) {
{
halfword n = tex_scan_int(0, NULL);
if (lmt_nest_state.nest_data.ptr == 0 && ! lmt_page_builder_state.output_active) {
- halfword n = tex_new_node(boundary_node, (quarterword) cur_chr);
- boundary_data(n) = n;
- tex_tail_append(n);
+ halfword boundary = tex_new_node(boundary_node, page_boundary);
+ boundary_data(boundary) = n;
+ tex_tail_append(boundary);
if (cur_list.mode == vmode) {
if (! lmt_page_builder_state.output_active) {
tex_page_boundary_message("callback triggered", n);
@@ -1182,9 +1182,9 @@ static void tex_aux_run_par_boundary(void) {
/*tex Not yet, first I need a proper use case. */ /*
case par_boundary:
{
- halfword n = tex_new_node(boundary_node, (quarterword) cur_chr);
- boundary_data(n) = tex_scan_int(0, NULL);
- tex_tail_append(n);
+ halfword boundary = tex_new_node(boundary_node, par_boundary);
+ boundary_data(boundary) = tex_scan_int(0, NULL);
+ tex_tail_append(boundary);
break;
}
*/
@@ -1196,20 +1196,20 @@ static void tex_aux_run_par_boundary(void) {
}
static void tex_aux_run_text_boundary(void) {
- halfword n = tex_new_node(boundary_node, (quarterword) cur_chr);
+ halfword boundary = tex_new_node(boundary_node, (quarterword) cur_chr);
switch (cur_chr) {
case user_boundary:
case protrusion_boundary:
- boundary_data(n) = tex_scan_int(0, NULL);
+ boundary_data(boundary) = tex_scan_int(0, NULL);
break;
case page_boundary:
- /* or maybe force vmode */
+ /*tex Maybe we should force vmode? For now we just ignore the value. */
tex_scan_int(0, NULL);
break;
default:
break;
}
- tex_tail_append(n);
+ tex_tail_append(boundary);
}
static void tex_aux_run_math_boundary(void) {
@@ -1223,6 +1223,7 @@ static void tex_aux_run_math_boundary(void) {
}
case protrusion_boundary:
case page_boundary:
+ /*tex We just ignore the values. */
tex_scan_int(0, NULL);
break;
}
@@ -1248,7 +1249,7 @@ static void tex_aux_run_paragraph_end_vmode(void) {
/*tex We could pass the group and context here if needed and set some parameter. */
-int tex_wrapped_up_paragraph(int context) {
+int tex_wrapped_up_paragraph(int context, int final) {
halfword par = tex_find_par_par(cur_list.head);
lmt_main_control_state.last_par_context = context;
if (par) {
@@ -1263,14 +1264,14 @@ int tex_wrapped_up_paragraph(int context) {
tex_delete_token_reference(eop);
done = 1;
}
- // if (end_of_par_par) {
- // if (! done) {
- // back_input(cur_tok);
- // }
- // begin_token_list(end_of_par_par, end_paragraph_text);
- // update_tex_end_of_par(null);
- // done = 1;
- // }
+ if (final && end_of_group_par) {
+ if (! done) {
+ tex_back_input(cur_tok);
+ }
+ tex_begin_token_list(end_of_group_par, end_paragraph_text);
+ update_tex_end_of_group(null);
+ done = 1;
+ }
return done;
} else {
return 0;
@@ -1278,7 +1279,7 @@ int tex_wrapped_up_paragraph(int context) {
}
static void tex_aux_run_paragraph_end_hmode(void) {
- if (! tex_wrapped_up_paragraph(normal_par_context)) {
+ if (! tex_wrapped_up_paragraph(normal_par_context, 0)) {
if (lmt_input_state.align_state < 0) {
/*tex This tries to recover from an alignment that didn't end properly. */
tex_off_save();
@@ -1585,7 +1586,7 @@ int tex_main_control(void)
return lmt_main_state.run_state == initializing_state && cur_chr == dump_code;
}
/*tex
- Give diagnostic information, if requested When a new token has just been fetched at
+ Give diagnostic information, if requested. When a new token has just been fetched at
|big_switch|, we have an ideal place to monitor \TEX's activity.
*/
if (tracing_commands_par > 0) {
@@ -2499,7 +2500,8 @@ inline static void tex_aux_finish_adjusted_hbox(void)
inline static void tex_aux_finish_vbox(void)
{
- if (! tex_wrapped_up_paragraph(vbox_par_context)) {
+
+ if (! tex_wrapped_up_paragraph(vbox_par_context, 1)) {
tex_end_paragraph(vbox_group, vbox_par_context);
tex_package(vbox_code);
}
@@ -2507,7 +2509,7 @@ inline static void tex_aux_finish_vbox(void)
inline static void tex_aux_finish_vtop(void)
{
- if (! tex_wrapped_up_paragraph(vtop_par_context)) {
+ if (! tex_wrapped_up_paragraph(vtop_par_context, 1)) {
tex_end_paragraph(vtop_group, vtop_par_context);
tex_package(vtop_code);
}
@@ -2515,7 +2517,7 @@ inline static void tex_aux_finish_vtop(void)
inline static void tex_aux_finish_dbox(void)
{
- if (! tex_wrapped_up_paragraph(dbox_par_context)) {
+ if (! tex_wrapped_up_paragraph(dbox_par_context, 1)) {
tex_end_paragraph(dbox_group, dbox_par_context);
tex_package(dbox_code);
}
@@ -2975,7 +2977,7 @@ static void tex_aux_run_kern(void)
{
halfword code = cur_chr;
switch (code) {
- /* not yet enabled and maybe it never will be */
+ /*tex Finally enabled: */
case h_kern_code:
if (cur_mode == vmode) {
tex_back_input(token_val(kern_cmd, normal_kern_code));
@@ -3072,13 +3074,35 @@ void tex_end_paragraph(int group, int context)
static void tex_aux_run_penalty(void)
{
- halfword value = tex_scan_int(0, NULL);
- tex_tail_append(tex_new_penalty_node(value, user_penalty_subtype));
- if (cur_list.mode == vmode) {
- if (! lmt_page_builder_state.output_active) {
- lmt_page_filter_callback(penalty_page_context, 0);
+ halfword code = cur_chr;
+ switch (code) {
+ /*tex Finally enabled: */
+ case h_penalty_code:
+ if (cur_mode == vmode) {
+ tex_back_input(token_val(penalty_cmd, normal_penalty_code));
+ tex_back_input(token_val(begin_paragraph_cmd, quitvmode_par_code));
+ return;
+ } else {
+ break;
+ }
+ case v_penalty_code:
+ if (cur_mode == hmode) {
+ tex_back_input(token_val(penalty_cmd, normal_penalty_code));
+ tex_back_input(token_val(end_paragraph_cmd, normal_end_paragraph_code));
+ return;
+ } else {
+ break;
+ }
+ }
+ {
+ halfword value = tex_scan_int(0, NULL);
+ tex_tail_append(tex_new_penalty_node(value, user_penalty_subtype));
+ if (cur_list.mode == vmode) {
+ if (! lmt_page_builder_state.output_active) {
+ lmt_page_filter_callback(penalty_page_context, 0);
+ }
+ tex_build_page();
}
- tex_build_page();
}
}
@@ -4259,7 +4283,7 @@ static void tex_aux_set_shorthand_def(int a, int force)
switch (code) {
case char_def_code:
{
- halfword chr = tex_scan_char_number(0); /* maybe 1 */
+ halfword chr = tex_scan_char_number(0);
tex_define_again(a, p, char_given_cmd, chr);
break;
}
@@ -4377,16 +4401,6 @@ static void tex_aux_set_shorthand_def(int a, int force)
tex_define(a, p, fontspec_cmd, v);
}
break;
- /*
- case string_def_code:
- {
- halfword t = scan_toks_expand(0, NULL);
- halfword s = tokens_to_string(t);
- define(a, p, string_cmd, s - cs_offset_value);
- flush_list(t);
- break;
- }
- */
default:
tex_confusion("shorthand definition");
break;
@@ -6403,8 +6417,8 @@ inline static void tex_aux_big_switch(int mode, int cmd)
switch (cmd) {
case arithmic_cmd:
- case internal_int_cmd :
- case register_int_cmd :
+ case internal_int_cmd:
+ case register_int_cmd:
case internal_attribute_cmd:
case register_attribute_cmd:
case internal_posit_cmd:
@@ -6692,6 +6706,10 @@ void tex_initialize_variables(void)
math_end_class_par = math_end_class;
math_left_class_par = unset_noad_class;
math_right_class_par = unset_noad_class;
+ pre_inline_penalty_par = max_integer;
+ post_inline_penalty_par = max_integer;
+ pre_short_inline_penalty_par = max_integer;
+ post_short_inline_penalty_par = max_integer;
variable_family_par = -1,
ignore_depth_criterium_par = ignore_depth;
aux_get_date_and_time(&time_par, &day_par, &month_par, &year_par, &lmt_engine_state.utc_time);
diff --git a/source/luametatex/source/tex/texmaincontrol.h b/source/luametatex/source/tex/texmaincontrol.h
index 558db148f..f5c79bfdc 100644
--- a/source/luametatex/source/tex/texmaincontrol.h
+++ b/source/luametatex/source/tex/texmaincontrol.h
@@ -42,7 +42,7 @@ extern int tex_main_control (void);
extern void tex_normal_paragraph (int context);
extern void tex_begin_paragraph (int doindent, int context);
extern void tex_end_paragraph (int group, int context);
-extern int tex_wrapped_up_paragraph (int context);
+extern int tex_wrapped_up_paragraph (int context, int final);
extern void tex_insert_paragraph_token (void);
diff --git a/source/luametatex/source/tex/texmath.c b/source/luametatex/source/tex/texmath.c
index 00e67942c..a4ec71e5d 100644
--- a/source/luametatex/source/tex/texmath.c
+++ b/source/luametatex/source/tex/texmath.c
@@ -300,6 +300,16 @@ int tex_math_has_class_option(halfword cls, int option)
return (value & option) == option;
}
+int tex_math_has_class_parent(halfword cls)
+{
+ halfword value = count_parameter(first_math_options_code + cls);
+ if (value == no_class_options) {
+ unsigned parent = (unsigned) count_parameter(first_math_parent_code + cls);
+ return (parent >> 16) & 0xFF;
+ }
+ return 0;
+}
+
static void tex_aux_unsave_math(void)
{
tex_unsave();
@@ -2363,11 +2373,23 @@ static void tex_aux_math_math_component(halfword target, int append)
}
break;
case 's': case 'S':
- if (tex_scan_mandate_keyword("source", 1)) {
- noad_source(target) = tex_scan_int(0, NULL);
+ switch (tex_scan_character("ioIO", 0, 0, 0)) {
+ case 'i': case 'I':
+ if (tex_scan_mandate_keyword("single", 2)) {
+ noad_options(target) |= noad_option_single;
+ }
+ break;
+ case 'o': case 'O':
+ if (tex_scan_mandate_keyword("source", 2)) {
+ noad_source(target) = tex_scan_int(0, NULL);
+ }
+ break;
+ default:
+ tex_aux_show_keyword_error("single|source");
+ goto DONE;
}
break;
- case 't': case 'T':
+ case 't': case 'T':
if (tex_scan_mandate_keyword("textfont", 1)) {
usetextfont = math_atom_text_font_option;
}
@@ -2928,6 +2950,7 @@ void tex_run_math_accent(void)
halfword code = cur_chr;
halfword accent = tex_new_node(accent_noad, bothflexible_accent_subtype);
quarterword subtype = ordinary_noad_subtype;
+ halfword mathclass = accent_noad_subtype;
halfword attrlist = null;
if (cur_cmd == accent_cmd) {
tex_handle_error(
@@ -2945,15 +2968,48 @@ void tex_run_math_accent(void)
case math_uaccent_code:
/*tex |\Umathaccent| */
while (1) {
- switch (tex_scan_character("abcnsftokABCNSFTOK", 0, 1, 0)) {
+ switch (tex_scan_character("abcensftokABCENSFTOK", 0, 1, 0)) {
case 'a': case 'A':
- if (tex_scan_mandate_keyword("attr", 1)) {
- attrlist = tex_scan_attribute(attrlist);
+ switch (tex_scan_character("txTX", 0, 0, 0)) {
+ case 't': case 'T':
+ if (tex_scan_mandate_keyword("attr", 2)) {
+ attrlist = tex_scan_attribute(attrlist);
+ }
+ break;
+ // case 'x': case 'X':
+ // if (tex_scan_mandate_keyword("axis", 2)) {
+ // noad_options(accent) |= noad_option_axis;
+ // }
+ // break;
+ default:
+ // tex_aux_show_keyword_error("attr|axis");
+ tex_aux_show_keyword_error("attr");
+ goto DONE;
}
break;
case 'c': case 'C':
- if (tex_scan_mandate_keyword("center", 1)) {
- noad_options(accent) |= noad_option_center;
+ switch (tex_scan_character("elEL", 0, 0, 0)) {
+ case 'e': case 'E':
+ if (tex_scan_mandate_keyword("center", 2)) {
+ noad_options(accent) |= noad_option_center;
+ }
+ break;
+ case 'l': case 'L':
+ if (tex_scan_mandate_keyword("class", 2)) {
+ halfword c = (quarterword) tex_scan_math_class_number(0);
+ if (valid_math_class_code(c)) {
+ mathclass = c;
+ }
+ }
+ break;
+ default:
+ tex_aux_show_keyword_error("center|class");
+ goto DONE;
+ }
+ break;
+ case 'e': case 'E':
+ if (tex_scan_mandate_keyword("exact", 1)) {
+ noad_options(accent) |= noad_option_exact;
}
break;
case 's': case 'S':
@@ -3104,6 +3160,7 @@ void tex_run_math_accent(void)
noad_nucleus(accent) = n;
tex_aux_scan_math(n, tex_math_style_variant(cur_list.math_style, math_parameter_accent_variant), 0, 0, 0, 0, unset_noad_class, unset_noad_class);
}
+ set_noad_main_class(accent, mathclass);
}
/*tex
@@ -4704,6 +4761,34 @@ static void tex_aux_finish_displayed_math(int atleft, halfword eqnumber, halfwor
*/
+static inline int tex_aux_class_from_glyph(halfword n) {
+ return node_subtype(n) - (node_subtype(n) > glyph_math_extra_subtype ? glyph_math_extra_subtype : glyph_math_ordinary_subtype);
+}
+
+static int tex_aux_short_math(halfword m)
+{
+ // tex_show_node_list(m,10000,10000);
+ if (m) {
+ /* kern[] glyph[subtype -> class] vlist[scripts] kern[] */
+ if (node_type(m) == kern_node) {
+ m = node_next(m);
+ }
+ if (m && node_type(m) == glyph_node && tex_math_has_class_option(tex_aux_class_from_glyph(m), short_inline_class_option)) {
+ m = node_next(m);
+ } else {
+ return 0;
+ }
+ if (m && node_type(m) == vlist_node && node_subtype(m) == math_scripts_list) {
+ m = node_next(m);
+ }
+ if (m && node_type(m) == kern_node) {
+ m = node_next(m);
+ }
+ return ! m;
+ }
+ return 0;
+}
+
void tex_run_math_shift(void)
{
switch (cur_group) {
@@ -4719,7 +4804,7 @@ void tex_run_math_shift(void)
int mode = cur_list.mode;
int mathmode = cur_list.math_mode;
/*tex this pops the nest, the formula */
- halfword p = tex_aux_finish_math_list(null);
+ halfword mathlist = tex_aux_finish_math_list(null);
int mathleft = cur_list.math_begin;
int mathright = cur_list.math_end;
if (cur_cmd == math_shift_cs_cmd) {
@@ -4745,7 +4830,7 @@ void tex_run_math_shift(void)
tex_aux_check_display_math_end();
break;
}
- tex_run_mlist_to_hlist(p, 0, text_style, unset_noad_class, unset_noad_class);
+ tex_run_mlist_to_hlist(mathlist, 0, text_style, unset_noad_class, unset_noad_class);
eqnumber = tex_hpack(node_next(temp_head), 0, packing_additional, direction_unknown, holding_none_option);
attach_current_attribute_list(eqnumber);
tex_aux_unsave_math();
@@ -4754,7 +4839,7 @@ void tex_run_math_shift(void)
if (saved_type(saved_equation_number_item_location) == equation_number_location_save_type) {
atleft = saved_value(saved_equation_number_item_location) == left_location_code;
mode = cur_list.mode;
- p = tex_aux_finish_math_list(null);
+ mathlist = tex_aux_finish_math_list(null);
} else {
tex_confusion("after math");
}
@@ -4769,7 +4854,9 @@ void tex_run_math_shift(void)
the space above that display.
*/
- halfword math = tex_new_node(math_node, begin_inline_math);
+ halfword beginmath = tex_new_node(math_node, begin_inline_math);
+ halfword endmath = tex_new_node(math_node, end_inline_math);
+ halfword shortmath = 0;
if (mathmode) {
switch (cur_cmd) {
case math_shift_cs_cmd:
@@ -4784,68 +4871,81 @@ void tex_run_math_shift(void)
} else if (cur_cmd == math_shift_cs_cmd) {
tex_aux_check_inline_math_end();
}
- tex_tail_append(math);
- math_penalty(math) = pre_inline_penalty_par;
+ tex_tail_append(beginmath);
+ if (pre_inline_penalty_par != max_integer) {
+ math_penalty(beginmath) = pre_inline_penalty_par;
+ }
/*tex begin mathskip code */
switch (math_skip_mode_par) {
case math_skip_surround_when_zero:
if (! tex_glue_is_zero(math_skip_par)) {
- tex_copy_glue_values(math, math_skip_par);
+ tex_copy_glue_values(beginmath, math_skip_par);
} else {
- math_surround(math) = math_surround_par;
+ math_surround(beginmath) = math_surround_par;
}
break ;
case math_skip_always_left:
case math_skip_always_both:
case math_skip_only_when_skip:
- tex_copy_glue_values(math, math_skip_par);
+ tex_copy_glue_values(beginmath, math_skip_par);
break ;
case math_skip_always_right:
case math_skip_ignore:
break ;
case math_skip_always_surround:
default:
- math_surround(math) = math_surround_par;
+ math_surround(beginmath) = math_surround_par;
break;
}
/*tex end mathskip code */
if (cur_list.math_dir) {
tex_tail_append(tex_new_dir(normal_dir_subtype, math_direction_par));
}
- tex_run_mlist_to_hlist(p, cur_list.mode > nomode, is_valid_math_style(cur_list.math_main_style) ? cur_list.math_main_style : text_style, cur_list.math_begin, cur_list.math_end);
+ tex_run_mlist_to_hlist(mathlist, cur_list.mode > nomode, is_valid_math_style(cur_list.math_main_style) ? cur_list.math_main_style : text_style, cur_list.math_begin, cur_list.math_end);
+ shortmath = tex_aux_short_math(node_next(temp_head));
tex_try_couple_nodes(cur_list.tail, node_next(temp_head));
cur_list.tail = tex_tail_of_node_list(cur_list.tail);
if (cur_list.math_dir) {
tex_tail_append(tex_new_dir(cancel_dir_subtype, math_direction_par));
}
cur_list.math_dir = 0;
- math = tex_new_node(math_node, end_inline_math);
- tex_tail_append(math);
- math_penalty(math) = post_inline_penalty_par;
+ tex_tail_append(endmath);
+ /* */
+ if (post_inline_penalty_par != max_integer) {
+ math_penalty(endmath) = post_inline_penalty_par;
+ }
/*tex begin mathskip code */
switch (math_skip_mode_par) {
case math_skip_surround_when_zero :
if (! tex_glue_is_zero(math_skip_par)) {
- tex_copy_glue_values(math, math_skip_par);
- math_surround(math) = 0;
+ tex_copy_glue_values(endmath, math_skip_par);
+ math_surround(endmath) = 0;
} else {
- math_surround(math) = math_surround_par;
+ math_surround(endmath) = math_surround_par;
}
break;
case math_skip_always_right:
case math_skip_always_both:
case math_skip_only_when_skip:
- tex_copy_glue_values(math, math_skip_par);
+ tex_copy_glue_values(endmath, math_skip_par);
break;
case math_skip_always_left:
case math_skip_ignore:
break;
case math_skip_always_surround:
default:
- math_surround(math) = math_surround_par;
+ math_surround(endmath) = math_surround_par;
break;
}
/*tex end mathskip code */
+ if (shortmath) {
+ if (pre_short_inline_penalty_par != max_integer) {
+ math_penalty(beginmath) = pre_short_inline_penalty_par;
+ }
+ if (post_short_inline_penalty_par != max_integer) {
+ math_penalty(endmath) = post_short_inline_penalty_par;
+ }
+ }
cur_list.space_factor = default_space_factor;
mathleft = cur_list.math_begin;
mathright = cur_list.math_end;
@@ -4858,7 +4958,7 @@ void tex_run_math_shift(void)
tex_aux_check_display_math_end();
}
}
- tex_run_mlist_to_hlist(p, 0, display_style, cur_list.math_begin, cur_list.math_end);
+ tex_run_mlist_to_hlist(mathlist, 0, display_style, cur_list.math_begin, cur_list.math_end);
mathleft = cur_list.math_begin;
mathright = cur_list.math_end;
tex_aux_finish_displayed_math(atleft, eqnumber, node_next(temp_head));
diff --git a/source/luametatex/source/tex/texmath.h b/source/luametatex/source/tex/texmath.h
index ba02e8373..65f706a3c 100644
--- a/source/luametatex/source/tex/texmath.h
+++ b/source/luametatex/source/tex/texmath.h
@@ -272,10 +272,12 @@ typedef enum math_class_options {
auto_inject_class_option = 0x0100000,
remove_italic_correction_class_option = 0x0200000,
operator_italic_correction_class_option = 0x0400000,
+ short_inline_class_option = 0x0800000,
no_class_options = 0xF000000,
} math_class_options;
extern int tex_math_has_class_option(halfword cls, int option);
+extern int tex_math_has_class_parent(halfword cls);
typedef enum math_atom_font_options {
math_atom_no_font_option = 0,
diff --git a/source/luametatex/source/tex/texmlist.c b/source/luametatex/source/tex/texmlist.c
index c5613d90a..69de1c8c6 100644
--- a/source/luametatex/source/tex/texmlist.c
+++ b/source/luametatex/source/tex/texmlist.c
@@ -542,12 +542,10 @@ inline static int tex_aux_checked_left_kern_fnt_chr(halfword fnt, halfword chr,
halfword hastop = (state & prime_script_state) || (state & post_super_script_state);
halfword hasbot = state & post_sub_script_state;
if (hastop && tex_math_has_class_option(subtype, left_top_kern_class_option)) {
-// top = tex_char_top_left_kern_from_font(fnt, chr);
-top = tex_aux_math_x_size_scaled(fnt, tex_char_top_left_kern_from_font(fnt, chr), size);
+ top = tex_aux_math_x_size_scaled(fnt, tex_char_top_left_kern_from_font(fnt, chr), size);
}
if (hasbot && tex_math_has_class_option(subtype, left_bottom_kern_class_option)) {
-// bot = tex_char_bottom_left_kern_from_font(fnt, chr);
-bot = tex_aux_math_x_size_scaled(fnt, tex_char_bottom_left_kern_from_font(fnt, chr), size);
+ bot = tex_aux_math_x_size_scaled(fnt, tex_char_bottom_left_kern_from_font(fnt, chr), size);
}
if (hastop && hasbot) {
return top > bot ? top : bot;
@@ -574,12 +572,10 @@ inline static int tex_aux_checked_right_kern_fnt_chr(halfword fnt, halfword chr,
halfword hastop = state & pre_super_script_state;
halfword hasbot = state & pre_sub_script_state;
if (hastop && tex_math_has_class_option(subtype, right_top_kern_class_option)) {
-// top = tex_char_top_right_kern_from_font(fnt, chr);
-top = tex_aux_math_x_size_scaled(fnt, tex_char_top_right_kern_from_font(fnt, chr), size);
+ top = tex_aux_math_x_size_scaled(fnt, tex_char_top_right_kern_from_font(fnt, chr), size);
}
if (hasbot && tex_math_has_class_option(subtype, right_bottom_kern_class_option)) {
-// bot = tex_char_bottom_right_kern_from_font(fnt, chr);
-bot = tex_aux_math_x_size_scaled(fnt, tex_char_bottom_right_kern_from_font(fnt, chr), size);
+ bot = tex_aux_math_x_size_scaled(fnt, tex_char_bottom_right_kern_from_font(fnt, chr), size);
}
if (hastop && hasbot) {
return top < bot ? bot : top;
@@ -783,7 +779,7 @@ static halfword tex_aux_fraction_rule(scaled width, scaled height, halfword att,
if (! rule) {
if (math_rules_mode_par) {
rule = tex_new_rule_node(ruletype);
- rule_data(rule) = tex_fam_fnt(fam, size);
+ rule_data(rule) = tex_fam_fnt(fam, size); // we have font/fam/chr fields, why not use these
} else {
rule = tex_new_rule_node(normal_rule_subtype);
}
@@ -3154,7 +3150,14 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal
}
} else { /* if (flags & overlay_accent_code) { */
/*tex Center the accent vertically around base: */
- delta = tex_half_scaled(box_total(accent) + box_total(base));
+ if (has_noad_option_exact(target)) {
+ delta = box_height(base) + box_depth(accent);
+ } else {
+ delta = tex_half_scaled(box_total(accent) + box_total(base));
+ }
+ // if (has_noad_option_axis(target)) {
+ // delta -= tex_aux_math_axis(size);
+ // }
}
if (accenttotal) {
*accenttotal = box_total(accent);
@@ -3175,7 +3178,11 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal
baseheight = box_height(base);
}
/*tex The top accents of both characters are aligned. */
- {
+ if (flags & overlay_accent_code) {
+ /* We ignore overshoot here, at leats for now. */
+ box_shift_amount(accent) = tex_half_scaled(basewidth - box_width(accent));
+ box_width(accent) = 0; /* in gyre zero anyway */
+ } else {
halfword accentwidth = box_width(accent);
if (accentwidth > basewidth && has_noad_option_nooverflow(target)) {
/*tex
@@ -3201,9 +3208,9 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal
} else {
/*tex When we scale we center. */
if (flags & top_accent_code) {
- anchor = tex_char_unchecked_top_anchor_from_font(accentfnt, accentchr); /* no bot accent key */
+ anchor = tex_char_unchecked_top_anchor_from_font(accentfnt, accentchr);
} else if (flags & bot_accent_code) {
- anchor = tex_char_unchecked_bottom_anchor_from_font(accentfnt, accentchr); /* no bot accent key */
+ anchor = tex_char_unchecked_bottom_anchor_from_font(accentfnt, accentchr);
} else {
anchor = INT_MIN;
}
@@ -5070,12 +5077,18 @@ static void tex_aux_make_scripts(halfword target, halfword kernel, scaled italic
shift_down = 0;
break;
default:
- /*tex Used for optimizing accents. */
- kernelsize.ht -= supdrop;
- /*tex These parameters are only applied in an assembly (and often some 0.5 .. 1.5 pt on 12pt). */
- prime_up = kernelsize.ht - tex_get_math_y_parameter_default(style, math_parameter_prime_shift_drop, 0);
- shift_up = kernelsize.ht - tex_get_math_y_parameter_checked(style, math_parameter_superscript_shift_drop);
- shift_down = kernelsize.dp + tex_get_math_y_parameter_checked(style, math_parameter_subscript_shift_drop);
+ if (has_noad_option_single(target)) {
+ prime_up = 0;
+ shift_up = 0;
+ shift_down = 0;
+ } else {
+ /*tex Used for optimizing accents. */
+ kernelsize.ht -= supdrop;
+ /*tex These parameters are only applied in an assembly (and often some 0.5 .. 1.5 pt on 12pt). */
+ prime_up = kernelsize.ht - tex_get_math_y_parameter_default(style, math_parameter_prime_shift_drop, 0);
+ shift_up = kernelsize.ht - tex_get_math_y_parameter_checked(style, math_parameter_superscript_shift_drop);
+ shift_down = kernelsize.dp + tex_get_math_y_parameter_checked(style, math_parameter_subscript_shift_drop);
+ }
break;
}
/*tex
@@ -6965,7 +6978,8 @@ static void tex_mlist_to_hlist_finalize_list(mliststate *state)
break;
case accent_noad:
current_type = simple_noad; /*tex Same kind of fields. */
- current_subtype = accent_noad_subtype;
+ // current_subtype = accent_noad_subtype;
+ current_subtype = get_noad_main_class(current);
current_left_slack = noad_left_slack(current);
current_right_slack = noad_right_slack(current);
break;
diff --git a/source/luametatex/source/tex/texnodes.c b/source/luametatex/source/tex/texnodes.c
index 63cf9e4c3..39dedb97f 100644
--- a/source/luametatex/source/tex/texnodes.c
+++ b/source/luametatex/source/tex/texnodes.c
@@ -157,12 +157,14 @@ void lmt_nodelib_initialize(void) {
set_value_entry_key(subtypes_glue, g_leaders, gleaders)
set_value_entry_key(subtypes_glue, u_leaders, uleaders)
- subtypes_boundary = lmt_aux_allocate_value_info(word_boundary);
+ subtypes_boundary = lmt_aux_allocate_value_info(par_boundary);
set_value_entry_key(subtypes_boundary, cancel_boundary, cancel)
set_value_entry_key(subtypes_boundary, user_boundary, user)
set_value_entry_key(subtypes_boundary, protrusion_boundary, protrusion)
set_value_entry_key(subtypes_boundary, word_boundary, word)
+ set_value_entry_key(subtypes_boundary, page_boundary, page)
+ set_value_entry_key(subtypes_boundary, par_boundary, par)
subtypes_penalty = lmt_aux_allocate_value_info(equation_number_penalty_subtype);
@@ -2724,11 +2726,38 @@ void tex_show_node_list(halfword p, int threshold, int max)
if (rule_depth(p)) {
tex_print_format(", depth %R", rule_depth(p));
}
- if (rule_left(p)) {
- tex_print_format(", left / top %R", rule_left(p));
- }
- if (rule_right(p)) {
- tex_print_format(", right / bottom %R", rule_right(p));
+ switch (node_subtype(p)) {
+ case virtual_rule_subtype:
+ if (rule_virtual_width(p)) {
+ tex_print_format(", virtual width %R", rule_virtual_width(p));
+ }
+ if (rule_virtual_height(p)) {
+ tex_print_format(", virtual height %R", rule_virtual_height(p));
+ }
+ if (rule_virtual_depth(p)) {
+ tex_print_format(", virtual depth %R", rule_virtual_depth(p));
+ }
+ break;
+ case strut_rule_subtype:
+ if (rule_strut_font(p)) {
+ if (rule_strut_font(p) >= rule_font_fam_offset) {
+ tex_print_format(", family %i", rule_strut_font(p) - rule_font_fam_offset);
+ } else {
+ tex_print_format(", font %F", rule_strut_font(p) < 0 ? 0 : rule_strut_font(p));
+ }
+ }
+ if (rule_strut_character(p)) {
+ tex_print_format(", character %U", rule_strut_character(p));
+ }
+ /* fall through */
+ default:
+ if (rule_left(p)) {
+ tex_print_format(", left / top %R", rule_left(p));
+ }
+ if (rule_right(p)) {
+ tex_print_format(", right / bottom %R", rule_right(p));
+ }
+ break;
}
if (rule_x_offset(p)) {
tex_print_format(", xoffset %R", rule_x_offset(p));
@@ -2736,15 +2765,8 @@ void tex_show_node_list(halfword p, int threshold, int max)
if (rule_y_offset(p)) {
tex_print_format(", yoffset %R", rule_y_offset(p));
}
- if (rule_font(p)) {
- if (rule_font(p) >= rule_font_fam_offset) {
- tex_print_format(", family %i", rule_font(p) - rule_font_fam_offset);
- } else {
- tex_print_format(", font %F", rule_font(p) < 0 ? 0 : rule_font(p));
- }
- }
- if (rule_character(p)) {
- tex_print_format(", character %U", rule_character(p));
+ if (rule_data(p)) {
+ tex_print_format(", data %R", rule_data(p));
}
break;
case insert_node:
diff --git a/source/luametatex/source/tex/texnodes.h b/source/luametatex/source/tex/texnodes.h
index 7fa050428..9e7d3ef13 100644
--- a/source/luametatex/source/tex/texnodes.h
+++ b/source/luametatex/source/tex/texnodes.h
@@ -140,7 +140,9 @@ typedef enum node_types {
/*tex These two are active nodes. */
unhyphenated_node,
hyphenated_node,
+ /*tex This one can also be in the active list. */
delta_node,
+ /*tex While this is an indirect one carrying data. */
passive_node,
} node_types;
@@ -631,9 +633,9 @@ inline static int tex_is_par_init_glue(halfword n)
typedef enum kern_subtypes {
font_kern_subtype,
- explicit_kern_subtype, /*tex |subtype| of kern nodes from |\kern| and |\/| */
+ explicit_kern_subtype, /*tex |subtype| of kern nodes from |\kern| */
accent_kern_subtype, /*tex |subtype| of kern nodes from accents */
- italic_kern_subtype,
+ italic_kern_subtype, /*tex |subtype| of kern nodes from |\/| */
left_margin_kern_subtype,
right_margin_kern_subtype,
explicit_math_kern_subtype,
@@ -1001,10 +1003,18 @@ typedef enum rule_codes {
# define rule_y_offset(a) vinfo(a,3)
# define rule_height(a) vlink(a,4)
# define rule_data(a) vinfo(a,4)
-# define rule_left(a) vinfo(a,5)
-# define rule_right(a) vlink(a,5)
-# define rule_font(a) vinfo(a,6)
-# define rule_character(a) vlink(a,6)
+# define rule_left(a) vinfo(a,5) /* depends on subtype */
+# define rule_right(a) vlink(a,5) /* depends on subtype */
+# define rule_extra_1(a) vinfo(a,6) /* depends on subtype */
+# define rule_extra_2(a) vlink(a,6) /* depends on subtype */
+
+# define rule_strut_font rule_extra_1
+# define rule_strut_character rule_extra_2
+
+# define rule_virtual_width rule_left
+# define rule_virtual_height rule_right
+# define rule_virtual_depth rule_extra_1
+# define rule_virtual_unused rule_extra_2
# define rule_total(a) (rule_height(a) + rule_depth(a))
@@ -1160,6 +1170,8 @@ typedef enum glyph_subtypes {
glyph_math_accent_subtype,
glyph_math_fenced_subtype,
glyph_math_ghost_subtype,
+ /* bogus subtype */
+ glyph_math_vcenter_subtype,
/* extra math, user classes, set but anonymous */
glyph_math_extra_subtype = 31,
} glyph_subtypes;
@@ -1793,6 +1805,7 @@ typedef enum noad_options {
# define noad_option_center (uint64_t) 0x04000000000
# define noad_option_scale (uint64_t) 0x08000000000
# define noad_option_keep_base (uint64_t) 0x10000000000
+# define noad_option_single (uint64_t) 0x20000000000
# define has_option(a,b) (((a) & (b)) == (b))
# define unset_option(a,b) ((a) & ~(b))
@@ -1856,6 +1869,7 @@ inline static int has_noad_no_script_option(halfword n, halfword option)
# define has_noad_option_auto_base(a) (has_option(noad_options(a), noad_option_auto_base))
# define has_noad_option_scale(a) (has_option(noad_options(a), noad_option_scale))
# define has_noad_option_keep_base(a) (has_option(noad_options(a), noad_option_keep_base))
+# define has_noad_option_single(a) (has_option(noad_options(a), noad_option_single))
/*tex
In the meantime the codes and subtypes are in sync. The variable component does not really
@@ -2118,7 +2132,7 @@ typedef enum math_kernel_options {
typedef enum boundary_subtypes {
cancel_boundary,
user_boundary,
- protrusion_boundary,
+ protrusion_boundary, /* 1=left, 2=right, 3=both */
word_boundary,
page_boundary,
par_boundary,
@@ -2283,7 +2297,7 @@ static int par_category_to_codes[] = {
/*tex
Todo: make the fields 6+ into a par_state node so that local box ones can be
small. Also, penalty and broken fields now are duplicate. Do we need to keep
- these?
+ these?
*/
# define par_node_size 28
@@ -2312,12 +2326,12 @@ static int par_category_to_codes[] = {
# define par_looseness(a) vinfo(a,13)
# define par_last_line_fit(a) vlink(a,13)
# define par_line_penalty(a) vinfo(a,14)
-# define par_inter_line_penalty(a) vlink(a,14)
+# define par_inter_line_penalty(a) vlink(a,14) /* */
# define par_club_penalty(a) vinfo(a,15)
# define par_widow_penalty(a) vlink(a,15)
# define par_display_widow_penalty(a) vinfo(a,16)
# define par_orphan_penalty(a) vlink(a,16)
-# define par_broken_penalty(a) vinfo(a,17)
+# define par_broken_penalty(a) vinfo(a,17) /* */
# define par_adj_demerits(a) vlink(a,17)
# define par_double_hyphen_demerits(a) vinfo(a,18)
# define par_final_hyphen_demerits(a) vlink(a,18)
@@ -2338,7 +2352,15 @@ static int par_category_to_codes[] = {
# define par_shaping_penalties_mode(a) vinfo(a,26)
# define par_shaping_penalty(a) vlink(a,26)
# define par_par_init_left_skip(a) vlink(a,27)
-# define par_par_init_right_skip(a) vinfo(a,27)
+# define par_par_init_right_skip(a) vinfo(a,27)
+
+/*
+ At some point we will have this (array with double values), depends on the outcome of an
+ experiment but I want to reserve this. We then also patch |texlocalboxes.c| line 295+.
+*/
+
+// define par_lousyness(a) vinfo(a,2) /* par_penalty_interline */
+// define par_reserved(a) vlink(a,2) /* par_penalty_broken */
typedef enum par_subtypes {
vmode_par_par_subtype,
@@ -2403,15 +2425,19 @@ inline static int tex_par_to_be_set (halfword state, halfword what) { re
spot.
*/
-/* is vinfo(a,2) used? it not we can have fitness there and hyphenated/unyphenates as subtype */
+/*tex
+ We can use vinfo(a,2) for fitness instead the subtype field. But then we also need to set
+ it explicitly because now that happens in the allocator.
+*/
# define active_node_size 4 /*tex |hyphenated_node| or |unhyphenated_node| */
# define active_fitness node_subtype /*tex |very_loose_fit..tight_fit| on final line for this break */
# define active_break_node(a) vlink(a,1) /*tex pointer to the corresponding passive node */
# define active_line_number(a) vinfo(a,1) /*tex line that begins at this breakpoint */
# define active_total_demerits(a) vlink(a,2) /*tex the quantity that \TEX\ minimizes */
-# define active_short(a) vinfo(a,3) /*tex |shortfall| of this line */
+# define active_reserved(a) vinfo(a,2)
# define active_glue(a) vlink(a,3) /*tex corresponding glue stretch or shrink */
+# define active_short(a) vinfo(a,3) /*tex |shortfall| of this line */
# define passive_node_size 7
# define passive_cur_break(a) vlink(a,1) /*tex in passive node, points to position of this breakpoint */
@@ -2670,6 +2696,11 @@ typedef enum glue_amounts {
total_shrink_amount = 7, // 2 //
font_stretch_amount = 8, // 8 //
font_shrink_amount = 9, // 9 //
+ /* */
+ max_height_amount = 10,
+ max_depth_amount = 11,
+ /* */
+ n_of_glue_amounts = 12,
} glue_amounts;
# define min_glue_order normal_glue_order
diff --git a/source/luametatex/source/tex/texpackaging.c b/source/luametatex/source/tex/texpackaging.c
index ad1db455c..dbc569246 100644
--- a/source/luametatex/source/tex/texpackaging.c
+++ b/source/luametatex/source/tex/texpackaging.c
@@ -641,7 +641,7 @@ scaled tex_right_marginkern(halfword p)
/*tex
Character protrusion is something we inherited from \PDFTEX\ and the next helper calculates
- the extend.
+ the extend. Is this |last_*_char| logic still valid?
*/
@@ -1488,40 +1488,40 @@ halfword tex_hpack(halfword p, scaled w, int m, singleword pack_direction, int r
box_glue_sign(r) = normal_glue_sign;
box_glue_set(r) = 0.0;
}
- if ((lmt_packaging_state.total_shrink[o] < -x) && (o == normal_glue_order) && (box_list(r))) {
- int overshoot = -x - lmt_packaging_state.total_shrink[normal_glue_order];
- lmt_packaging_state.last_badness = 1000000;
- lmt_packaging_state.last_overshoot = overshoot;
- /*tex Use the maximum shrinkage */
- box_glue_set(r) = 1.0;
- /*tex Report an overfull hbox and |goto common_ending|, if this box is sufficiently bad. */
- if ((overshoot > hfuzz_par) || (hbadness_par < 100)) {
- int callback_id = lmt_callback_defined(hpack_quality_callback);
- halfword rule = null;
- if (callback_id > 0) {
- lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "SdNddS->N",
- "overfull",
- overshoot,
- r,
- abs(lmt_packaging_state.pack_begin_line),
- lmt_input_state.input_line,
- tex_current_input_file_name(),
- &rule);
- } else if (q && overfull_rule_par > 0) {
- rule = tex_new_rule_node(normal_rule_subtype);
- rule_width(rule) = overfull_rule_par;
- }
- if (rule && rule != r) {
- tex_aux_append_diagnostic_rule(r, rule);
- }
- if (callback_id == 0) {
- tex_print_nlp();
- tex_print_format("%l[package: overfull \\hbox (%D too wide)", overshoot, pt_unit);
- goto COMMON_ENDING;
+ if (o == normal_glue_order && box_list(r)) {
+ if (lmt_packaging_state.total_shrink[o] < -x) {
+ int overshoot = -x - lmt_packaging_state.total_shrink[normal_glue_order];
+ lmt_packaging_state.last_badness = 1000000;
+ lmt_packaging_state.last_overshoot = overshoot;
+ /*tex Use the maximum shrinkage */
+ box_glue_set(r) = 1.0;
+ /*tex Report an overfull hbox and |goto common_ending|, if this box is sufficiently bad. */
+ if ((overshoot > hfuzz_par) || (hbadness_par < 100)) {
+ int callback_id = lmt_callback_defined(hpack_quality_callback);
+ halfword rule = null;
+ if (callback_id > 0) {
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "SdNddS->N",
+ "overfull",
+ overshoot,
+ r,
+ abs(lmt_packaging_state.pack_begin_line),
+ lmt_input_state.input_line,
+ tex_current_input_file_name(),
+ &rule);
+ } else if (q && overfull_rule_par > 0) {
+ rule = tex_new_rule_node(normal_rule_subtype);
+ rule_width(rule) = overfull_rule_par;
+ }
+ if (rule && rule != r) {
+ tex_aux_append_diagnostic_rule(r, rule);
+ }
+ if (callback_id == 0) {
+ tex_print_nlp();
+ tex_print_format("%l[package: overfull \\hbox (%D too wide)", overshoot, pt_unit);
+ goto COMMON_ENDING;
+ }
}
- }
- } else if (o == normal_glue_order) {
- if (box_list(r)) {
+ } else {
/*tex Report a tight hbox and |goto common_ending|, if this box is sufficiently bad. */
lmt_packaging_state.last_badness = tex_badness(-x, lmt_packaging_state.total_shrink[normal_glue_order]);
if (lmt_packaging_state.last_badness > hbadness_par) {
@@ -2232,33 +2232,33 @@ halfword tex_vpack(halfword p, scaled h, int m, scaled l, singleword pack_direct
box_glue_sign(r) = normal_glue_sign;
box_glue_set(r) = 0.0;
}
- if ((lmt_packaging_state.total_shrink[o] < -x) && (o == normal_glue_order) && (box_list(r))) {
- int overshoot = -x - lmt_packaging_state.total_shrink[normal_glue_order];
- lmt_packaging_state.last_badness = 1000000;
- lmt_packaging_state.last_overshoot = overshoot;
- /*tex Use the maximum shrinkage */
- box_glue_set(r) = 1.0;
- /*tex Report an overfull vbox and |goto common_ending|, if this box is sufficiently bad. */
- if ((overshoot > vfuzz_par) || (vbadness_par < 100)) {
- int callback_id = lmt_callback_defined(vpack_quality_callback);
- if (callback_id > 0) {
- lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "SdNddS->",
- "overfull",
- overshoot,
- r,
- abs(lmt_packaging_state.pack_begin_line),
- lmt_input_state.input_line,
- tex_current_input_file_name()
- );
- goto EXIT;
- } else {
- tex_print_nlp();
- tex_print_format("%l[package: overfull \\vbox (%D too high)", - x - lmt_packaging_state.total_shrink[normal_glue_order], pt_unit);
- goto COMMON_ENDING;
+ if (o == normal_glue_order && box_list(r)) {
+ if (lmt_packaging_state.total_shrink[o] < -x) {
+ int overshoot = -x - lmt_packaging_state.total_shrink[normal_glue_order];
+ lmt_packaging_state.last_badness = 1000000;
+ lmt_packaging_state.last_overshoot = overshoot;
+ /*tex Use the maximum shrinkage */
+ box_glue_set(r) = 1.0;
+ /*tex Report an overfull vbox and |goto common_ending|, if this box is sufficiently bad. */
+ if ((overshoot > vfuzz_par) || (vbadness_par < 100)) {
+ int callback_id = lmt_callback_defined(vpack_quality_callback);
+ if (callback_id > 0) {
+ lmt_run_callback(lmt_lua_state.lua_instance, callback_id, "SdNddS->",
+ "overfull",
+ overshoot,
+ r,
+ abs(lmt_packaging_state.pack_begin_line),
+ lmt_input_state.input_line,
+ tex_current_input_file_name()
+ );
+ goto EXIT;
+ } else {
+ tex_print_nlp();
+ tex_print_format("%l[package: overfull \\vbox (%D too high)", - x - lmt_packaging_state.total_shrink[normal_glue_order], pt_unit);
+ goto COMMON_ENDING;
+ }
}
- }
- } else if (o == normal_glue_order) {
- if (box_list(r)) {
+ } else {
/*tex Report a tight vbox and |goto common_ending|, if this box is sufficiently bad. */
lmt_packaging_state.last_badness = tex_badness(-x, lmt_packaging_state.total_shrink[normal_glue_order]);
if (lmt_packaging_state.last_badness > vbadness_par) {
@@ -2382,7 +2382,7 @@ void tex_run_vcenter(void)
void tex_finish_vcenter_group(void)
{
- if (! tex_wrapped_up_paragraph(vcenter_par_context)) {
+ if (! tex_wrapped_up_paragraph(vcenter_par_context, 1)) {
halfword p;
tex_end_paragraph(vcenter_group, vcenter_par_context);
tex_package(vbox_code); /* todo: vcenter_code */
diff --git a/source/luametatex/source/tex/texprimitive.c b/source/luametatex/source/tex/texprimitive.c
index 027f62d23..54ef9b1b1 100644
--- a/source/luametatex/source/tex/texprimitive.c
+++ b/source/luametatex/source/tex/texprimitive.c
@@ -899,12 +899,6 @@ void tex_print_cmd_chr(singleword cmd, halfword chr)
/*tex Kind of special. */
tex_print_str_esc("notexpanded");
break;
- /*
- case string_cmd:
- print_str("string:->");
- print(cs_offset_value + chr);
- break;
- */
case internal_box_reference_cmd:
tex_print_str_esc("hiddenlocalbox");
break;
diff --git a/source/luametatex/source/tex/texprinting.c b/source/luametatex/source/tex/texprinting.c
index 9e502fbdf..518f1cf43 100644
--- a/source/luametatex/source/tex/texprinting.c
+++ b/source/luametatex/source/tex/texprinting.c
@@ -223,6 +223,8 @@ void tex_print_char(int s)
*/
+/* no_print terminal | logfile | terminal_and_logfile | pseudo | new_string | luabuffer */
+
static void tex_aux_uprint(int s)
{
/*tex We're not sure about this so it's disabled for now! */
@@ -235,7 +237,6 @@ static void tex_aux_uprint(int s)
*/
if (s == new_line_char_par && lmt_print_state.selector < pseudo_selector_code) {
tex_print_ln();
- return;
} else if (s <= 0x7F) {
tex_print_char(s);
} else if (s <= 0x7FF) {
diff --git a/source/luametatex/source/tex/texrules.c b/source/luametatex/source/tex/texrules.c
index db993585b..560ca73df 100644
--- a/source/luametatex/source/tex/texrules.c
+++ b/source/luametatex/source/tex/texrules.c
@@ -67,25 +67,41 @@ halfword tex_aux_scan_rule_spec(rule_types type, halfword code)
}
break;
case 'l': case 'L':
- if (tex_scan_mandate_keyword("left", 1)) {
- rule_left(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
+ if (node_subtype(rule) != virtual_rule_subtype) {
+ if (tex_scan_mandate_keyword("left", 1)) {
+ rule_left(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
+ }
+ break;
+ } else {
+ goto DONE;
}
- break;
case 'r': case 'R':
- if (tex_scan_mandate_keyword("right", 1)) {
- rule_right(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
+ if (node_subtype(rule) != virtual_rule_subtype) {
+ if (tex_scan_mandate_keyword("right", 1)) {
+ rule_right(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
+ }
+ break;
+ } else {
+ goto DONE;
}
- break;
case 't': case 'T': /* just because it's nicer */
- if (tex_scan_mandate_keyword("top", 1)) {
- rule_left(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
+ if (node_subtype(rule) != virtual_rule_subtype) {
+ if (tex_scan_mandate_keyword("top", 1)) {
+ rule_left(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
+ }
+ break;
+ } else {
+ goto DONE;
}
- break;
case 'b': case 'B': /* just because it's nicer */
- if (tex_scan_mandate_keyword("bottom", 1)) {
- rule_right(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
+ if (node_subtype(rule) != virtual_rule_subtype) {
+ if (tex_scan_mandate_keyword("bottom", 1)) {
+ rule_right(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
+ }
+ break;
+ } else {
+ goto DONE;
}
- break;
case 'x': case 'X':
if (tex_scan_mandate_keyword("xoffset", 1)) {
rule_x_offset(rule) = tex_scan_dimen(0, 0, 0, 0, NULL);
@@ -97,44 +113,56 @@ halfword tex_aux_scan_rule_spec(rule_types type, halfword code)
}
break;
case 'f': case 'F':
- switch (tex_scan_character("aoAO", 0, 0, 0)) {
- case 'o': case 'O':
- if (tex_scan_mandate_keyword("font", 2)) {
- tex_set_rule_font(rule, tex_scan_font_identifier(NULL));
- }
- break;
- case 'a': case 'A':
- if (tex_scan_mandate_keyword("fam", 2)) {
- tex_set_rule_family(rule, tex_scan_math_family_number());
- }
- break;
- default:
- tex_aux_show_keyword_error("font|fam");
- goto DONE;
+ if (node_subtype(rule) != virtual_rule_subtype) {
+ switch (tex_scan_character("aoAO", 0, 0, 0)) {
+ case 'o': case 'O':
+ if (tex_scan_mandate_keyword("font", 2)) {
+ tex_set_rule_font(rule, tex_scan_font_identifier(NULL));
+ }
+ break;
+ case 'a': case 'A':
+ if (tex_scan_mandate_keyword("fam", 2)) {
+ tex_set_rule_family(rule, tex_scan_math_family_number());
+ }
+ break;
+ default:
+ tex_aux_show_keyword_error("font|fam");
+ goto DONE;
+ }
+ break;
+ } else {
+ goto DONE;
}
- break;
case 'c': case 'C':
- if (tex_scan_mandate_keyword("char", 1)) {
- rule_character(rule) = tex_scan_char_number(0);
+ if (node_subtype(rule) != virtual_rule_subtype) {
+ if (tex_scan_mandate_keyword("char", 1)) {
+ rule_strut_character(rule) = tex_scan_char_number(0);
+ }
+ break;
+ } else {
+ goto DONE;
}
- break;
default:
goto DONE;
}
}
DONE:
node_attr(rule) = attr;
- if (type == v_rule_type && code == strut_rule_code) {
- tex_aux_check_text_strut_rule(rule, text_style);
- }
- if (code == virtual_rule_code) {
- rule_data(rule) = rule_width(rule);
- rule_left(rule) = rule_height(rule);
- rule_right(rule) = rule_depth(rule);
- rule_width(rule) = 0;
- rule_height(rule) = 0;
- rule_depth(rule) = 0;
- node_subtype(rule) = virtual_rule_subtype;
+ switch (code) {
+ case strut_rule_code:
+ if (type == v_rule_type) {
+ tex_aux_check_text_strut_rule(rule, text_style);
+ }
+ break;
+ case virtual_rule_code:
+ rule_virtual_width(rule) = rule_width(rule);
+ rule_virtual_height(rule) = rule_height(rule);
+ rule_virtual_depth(rule) = rule_depth(rule);
+ rule_width(rule) = 0;
+ rule_height(rule) = 0;
+ rule_depth(rule) = 0;
+ node_subtype(rule) = virtual_rule_subtype;
+ break;
}
return rule;
}
@@ -163,7 +191,7 @@ void tex_aux_check_math_strut_rule(halfword rule, halfword style)
scaled dp = rule_depth(rule);
if (ht == null_flag || dp == null_flag) {
halfword fnt = tex_get_rule_font(rule, style);
- halfword chr = rule_character(rule);
+ halfword chr = rule_strut_character(rule);
if (fnt > 0 && chr && tex_char_exists(fnt, chr)) {
if (ht == null_flag) {
ht = tex_math_font_char_ht(fnt, chr, style);
@@ -192,7 +220,7 @@ void tex_aux_check_text_strut_rule(halfword rule, halfword style)
scaled dp = rule_depth(rule);
if (ht == null_flag || dp == null_flag) {
halfword fnt = tex_get_rule_font(rule, style);
- halfword chr = rule_character(rule);
+ halfword chr = rule_strut_character(rule);
if (fnt > 0 && chr && tex_char_exists(fnt, chr)) {
scaledwhd whd = tex_char_whd_from_font(fnt, chr);
if (ht == null_flag) {
@@ -208,47 +236,81 @@ void tex_aux_check_text_strut_rule(halfword rule, halfword style)
halfword tex_get_rule_font(halfword n, halfword style)
{
- halfword fnt = rule_font(n);
- if (fnt >= rule_font_fam_offset) {
- halfword fam = fnt - rule_font_fam_offset;
- if (fam_par_in_range(fam)) {
- fnt = tex_fam_fnt(fam, tex_size_of_style(style));
+ if (node_subtype(n) == virtual_rule_subtype) {
+ halfword fnt = rule_strut_font(n);
+ if (fnt >= rule_font_fam_offset) {
+ halfword fam = fnt - rule_font_fam_offset;
+ if (fam_par_in_range(fam)) {
+ fnt = tex_fam_fnt(fam, tex_size_of_style(style));
+ }
+ }
+ if (fnt < 0 || fnt >= max_n_of_fonts) {
+ return null_font;
+ } else {
+ return fnt;
}
- }
- if (fnt < 0 || fnt >= max_n_of_fonts) {
+ } else {
return null_font;
- } else {
- return fnt;
}
}
halfword tex_get_rule_family(halfword n)
{
- halfword fnt = rule_font(n);
- if (fnt >= rule_font_fam_offset) {
- halfword fam = fnt - rule_font_fam_offset;
- if (fam_par_in_range(fam)) {
- return fam;
+ if (node_subtype(n) == virtual_rule_subtype) {
+ halfword fnt = rule_strut_font(n);
+ if (fnt >= rule_font_fam_offset) {
+ halfword fam = fnt - rule_font_fam_offset;
+ if (fam_par_in_range(fam)) {
+ return fam;
+ }
}
- }
- return 0;
+ }
+ return 0;
}
void tex_set_rule_font(halfword n, halfword fnt)
{
- if (fnt < 0 || fnt >= rule_font_fam_offset) {
- rule_font(n) = 0;
- } else {
- rule_font(n) = fnt;
+ if (node_subtype(n) == virtual_rule_subtype) {
+ if (fnt < 0 || fnt >= rule_font_fam_offset) {
+ rule_strut_font(n) = 0;
+ } else {
+ rule_strut_font(n) = fnt;
+ }
}
}
void tex_set_rule_family(halfword n, halfword fam)
{
- if (fam < 0 || fam >= max_n_of_math_families) {
- rule_font(n) = rule_font_fam_offset;
- } else {
- rule_font(n) = rule_font_fam_offset + fam;
+ if (node_subtype(n) == virtual_rule_subtype) {
+ if (fam < 0 || fam >= max_n_of_math_families) {
+ rule_strut_font(n) = rule_font_fam_offset;
+ } else {
+ rule_strut_font(n) = rule_font_fam_offset + fam;
+ }
+ }
+}
+
+halfword tex_get_rule_left(halfword n)
+{
+ return node_subtype(n) == virtual_rule_subtype ? 0 : rule_left(n);
+}
+
+halfword tex_get_rule_right(halfword n)
+{
+ return node_subtype(n) == virtual_rule_subtype ? 0 : rule_right(n);
+}
+
+void tex_set_rule_left(halfword n, halfword value)
+{
+ if (node_subtype(n) != virtual_rule_subtype) {
+ rule_left(n) = value;
+ }
+}
+
+void tex_set_rule_right(halfword n, halfword value)
+{
+ if (node_subtype(n) != virtual_rule_subtype) {
+ rule_right(n) = value;
}
}
diff --git a/source/luametatex/source/tex/texrules.h b/source/luametatex/source/tex/texrules.h
index 8a01ac847..444c6d645 100644
--- a/source/luametatex/source/tex/texrules.h
+++ b/source/luametatex/source/tex/texrules.h
@@ -24,4 +24,9 @@ extern halfword tex_get_rule_family (halfword n);
extern void tex_set_rule_font (halfword n, halfword fnt);
extern void tex_set_rule_family (halfword n, halfword fam);
+extern halfword tex_get_rule_left (halfword n);
+extern halfword tex_get_rule_right (halfword n);
+extern void tex_set_rule_left (halfword n, halfword value);
+extern void tex_set_rule_right (halfword n, halfword value);
+
# endif
diff --git a/source/luametatex/source/tex/texscanning.c b/source/luametatex/source/tex/texscanning.c
index 675186681..9559a4040 100644
--- a/source/luametatex/source/tex/texscanning.c
+++ b/source/luametatex/source/tex/texscanning.c
@@ -1513,7 +1513,7 @@ static halfword tex_aux_scan_something_internal(halfword cmd, halfword chr, int
case math_parameter_set_atom_rule:
case math_parameter_let_atom_rule:
case math_parameter_copy_atom_rule:
- case math_parameter_let_parent:
+ // case math_parameter_let_parent:
case math_parameter_copy_parent:
case math_parameter_set_defaults:
{
@@ -1521,6 +1521,15 @@ static halfword tex_aux_scan_something_internal(halfword cmd, halfword chr, int
// cur_val_level = int_val_level;
break;
}
+ case math_parameter_let_parent:
+ {
+ halfword mathclass = tex_scan_math_class_number(0);
+ if (valid_math_class_code(mathclass)) {
+ cur_val = tex_math_has_class_parent(mathclass);
+ cur_val_level = int_val_level;
+ }
+ break;
+ }
case math_parameter_set_pre_penalty:
case math_parameter_set_post_penalty:
case math_parameter_set_display_pre_penalty:
@@ -1893,16 +1902,6 @@ static halfword tex_aux_scan_something_internal(halfword cmd, halfword chr, int
}
break;
/*
- case string_cmd:
- {
- halfword head = str_toks(str_lstring(cs_offset_value + chr), NULL);
- begin_inserted_list(head);
- cur_val = 0;
- cur_val_level = no_val_level;
- break;
- }
- */
- /*
case special_box_cmd:
switch (chr) {
case left_box_code:
@@ -3292,6 +3291,14 @@ halfword tex_the_value_toks(int code, halfword *tail, halfword property) /* mayb
return null;
}
+void tex_detokenize_list(halfword head)
+{
+ int saved_selector;
+ push_selector;
+ tex_show_token_list(head, 0);
+ pop_selector;
+}
+
halfword tex_the_detokenized_toks(halfword *tail)
{
halfword head = tex_scan_general_text(tail);
diff --git a/source/luametatex/source/tex/texscanning.h b/source/luametatex/source/tex/texscanning.h
index 34e118d93..ed11b8f4c 100644
--- a/source/luametatex/source/tex/texscanning.h
+++ b/source/luametatex/source/tex/texscanning.h
@@ -131,7 +131,8 @@ extern halfword tex_scan_bytecode_reference (int optional_equal);
extern halfword tex_the_value_toks (int unit, halfword *tail, halfword property); /* returns head */
extern halfword tex_the_toks (int code, halfword *tail); /* returns head */
-extern halfword tex_the_detokenized_toks (halfword *head);
+extern halfword tex_the_detokenized_toks (halfword *tail);
+extern void tex_detokenize_list (halfword head);
extern strnumber tex_the_scanned_result (void);
extern void tex_set_font_dimen (void);
diff --git a/source/luametatex/source/tex/textoken.c b/source/luametatex/source/tex/textoken.c
index e3aa90c0f..7580d72d3 100644
--- a/source/luametatex/source/tex/textoken.c
+++ b/source/luametatex/source/tex/textoken.c
@@ -2942,6 +2942,7 @@ void tex_run_convert_tokens(halfword code)
break;
*/
case detokenized_code:
+ /*tex Sort of like |\meaningles| but without the explanationart text. */
{
int saved_selector;
int saved_scanner_status = lmt_input_state.scanner_status;
@@ -2956,6 +2957,60 @@ void tex_run_convert_tokens(halfword code)
pop_selector;
break;
}
+ case detokened_code:
+ /*tex Takes a control sequence or token list. Probably a bad name but so be it. */
+ {
+ int saved_selector;
+ int saved_scanner_status = lmt_input_state.scanner_status;
+ halfword list = null;
+ lmt_input_state.scanner_status = scanner_is_normal;
+ tex_get_token();
+ lmt_input_state.scanner_status = saved_scanner_status;
+ switch (cur_cmd) {
+ case call_cmd:
+ case protected_call_cmd:
+ case semi_protected_call_cmd:
+ case tolerant_call_cmd:
+ case tolerant_protected_call_cmd:
+ case tolerant_semi_protected_call_cmd:
+ if (cur_chr) {
+ /* We only serialize macros with no arguments. */
+ list = token_link(cur_chr);
+ break;
+ } else {
+ goto WHATEVER;
+ }
+ case internal_toks_cmd:
+ case register_toks_cmd:
+ list = token_link(eq_value(cur_chr));
+ break;
+ case register_cmd:
+ if (cur_chr == tok_val_level) {
+ halfword n = tex_scan_toks_register_number();
+ list = token_link(toks_register(n));
+ break;
+ } else {
+ goto WHATEVER;
+ }
+ break;
+ default:
+ WHATEVER:
+ {
+ halfword t = tex_get_available_token(cur_tok);
+ push_selector;
+ tex_show_token_list(t, 0);
+ pop_selector;
+ tex_put_available_token(t);
+ }
+ break;
+ }
+ if (list) {
+ push_selector;
+ tex_show_token_list(list, 2);
+ pop_selector;
+ }
+ break;
+ }
case roman_numeral_code:
{
int saved_selector;
@@ -3304,7 +3359,7 @@ char *tex_tokenlist_to_tstring(int pp, int inhibit_par, int *siz, int skippreamb
} else {
int infop = token_info(p);
if (infop < 0) {
- /* unlikely, will go after checking */
+ /*tex Unlikely, will go after checking (maybe \LUA\ user mess up). */
tex_aux_append_str_to_buffer(error_string_bad(32));
} else if (infop < cs_token_flag) {
/*tex We nearly always end up here because otherwise we have an error. */
@@ -3370,7 +3425,7 @@ char *tex_tokenlist_to_tstring(int pp, int inhibit_par, int *siz, int skippreamb
}
break;
case end_match_cmd:
- if (skippreamble ==2) {
+ if (skippreamble == 2) {
goto EXIT;
} else if (chr == 0) {
if (! skip) {
@@ -3380,15 +3435,6 @@ char *tex_tokenlist_to_tstring(int pp, int inhibit_par, int *siz, int skippreamb
skip = 0 ;
}
break;
- /*
- case string_cmd:
- c = c + cs_offset_value;
- do_make_room((int) str_length(c));
- for (int i = 0; i < str_length(c); i++) {
- token_state.buffer[token_state.bufloc++] = str_string(c)[i];
- }
- break;
- */
case end_paragraph_cmd:
if (! inhibit_par && (auto_paragraph_mode(auto_paragraph_text))) {
tex_aux_append_esc_to_buffer("par");
diff --git a/source/luametatex/source/tex/textypes.h b/source/luametatex/source/tex/textypes.h
index d2bb77972..1e83a975f 100644
--- a/source/luametatex/source/tex/textypes.h
+++ b/source/luametatex/source/tex/textypes.h
@@ -170,6 +170,7 @@ extern halfword tex_badness(
# define semi_loose_criterium 12 /* same as |decent_criterium| */
# define decent_criterium 12
# define semi_tight_criterium 12 /* same as |decent_criterium| */
+# define max_calculated_badness 8189
# define default_rule 26214 /*tex 0.4pt */
# define ignore_depth -65536000 /*tex The magic dimension value to mean \quote {ignore me}: -1000pt */
diff --git a/source/luametatex/source/utilities/auxposit.h b/source/luametatex/source/utilities/auxposit.h
index 6abeae2c9..3975bafb7 100644
--- a/source/luametatex/source/utilities/auxposit.h
+++ b/source/luametatex/source/utilities/auxposit.h
@@ -47,6 +47,11 @@ typedef posit32_t *posit;
# define posit_is_NaR isNaRP32UI
# define posit_eq_zero(a) (a.v == 0)
+# define posit_le_zero(a) (a.v <= 0)
+# define posit_lt_zero(a) (a.v < 0)
+# define posit_gt_zero(a) (a.v > 0)
+# define posit_ge_zero(a) (a.v >= 0)
+# define posit_ne_zero(a) (a.v != 0)
inline static posit_t posit_neg(posit_t a) { posit_t p ; p.v = -a.v & 0xFFFFFFFF; return p; }
inline static posit_t posit_abs(posit_t a) { posit_t p ; int mask = a.v >> 31; p.v = ((a.v + mask) ^ mask) & 0xFFFFFFFF; return p; }
@@ -119,7 +124,12 @@ typedef posit32_t tex_posit;
# define tex_posit_is_NaR(p) posit_is_NaR((tex_posit) { .v = (uint32_t) p })
-# define tex_posit_eq_zero(p) posit_eq_zero((tex_posit) { .v = (uint32_t) p })
+# define tex_posit_eq_zero(p) posit_eq_zero((tex_posit) { .v = (uint32_t) p })
+# define tex_posit_le_zero(p) posit_le_zero((tex_posit) { .v = (uint32_t) p })
+# define tex_posit_lt_zero(p) posit_lt_zero((tex_posit) { .v = (uint32_t) p })
+# define tex_posit_gt_zero(p) posit_gt_zero((tex_posit) { .v = (uint32_t) p })
+# define tex_posit_ge_zero(p) posit_ge_zero((tex_posit) { .v = (uint32_t) p })
+# define tex_posit_ne_zero(p) posit_ne_zero((tex_posit) { .v = (uint32_t) p })
inline static halfword tex_posit_neg(halfword a)
{
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 3175dd98a..35e9fb615 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{2023.05.08 17:36}
+\newcontextversion{2023.05.27 12:11}
%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 ba1b29308..8737d7c70 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{2023.05.08 17:36}
+\edef\contextversion{2023.05.27 12:11}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua
index 1d4c130e9..de3ded98b 100644
--- a/tex/context/base/mkiv/char-def.lua
+++ b/tex/context/base/mkiv/char-def.lua
@@ -67014,7 +67014,7 @@ characters.data={
description="NABLA",
direction="on",
linebreak="ai",
- mathclass="ordinary",
+ mathclass="differential",
mathname="nabla",
synonyms={ "backward difference", "del" },
unicodeslot=0x2207,
@@ -234204,6 +234204,7 @@ characters.data={
description="MATHEMATICAL BOLD NABLA",
direction="l",
linebreak="al",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D6C1,
visual="bf",
@@ -234727,7 +234728,7 @@ characters.data={
description="MATHEMATICAL ITALIC NABLA",
direction="l",
linebreak="al",
- mathclass="ordinary",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D6FB,
visual="it",
@@ -235256,6 +235257,7 @@ characters.data={
description="MATHEMATICAL BOLD ITALIC NABLA",
direction="l",
linebreak="al",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D735,
visual="bi",
@@ -235779,6 +235781,7 @@ characters.data={
description="MATHEMATICAL SANS-SERIF BOLD NABLA",
direction="l",
linebreak="al",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D76F,
visual="bf",
@@ -236302,6 +236305,7 @@ characters.data={
description="MATHEMATICAL SANS-SERIF BOLD ITALIC NABLA",
direction="l",
linebreak="al",
+ mathclass="differential",
specials={ "font", 0x2207 },
unicodeslot=0x1D7A9,
visual="bi",
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index d262c380f..596dd0299 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2023.05.08 17:36}
+\newcontextversion{2023.05.27 12:11}
%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
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index e6522ec5c..c5be65048 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -49,7 +49,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2023.05.08 17:36}
+\edef\contextversion{2023.05.27 12:11}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 198e62bee..0d1f9d6a6 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -945,7 +945,9 @@ local function unifyglyphs(fontdata,usenames)
if colors then
for i=1,#colors do
local c = colors[i]
- c.slot = indices[c.slot]
+ if c then -- safeguard
+ c.slot = indices[c.slot]
+ end
end
end
end
diff --git a/tex/context/base/mkiv/lang-imp-simpleascii-data.lgz b/tex/context/base/mkiv/lang-imp-simpleascii-data.lgz
new file mode 100644
index 000000000..9bbcc6afc
--- /dev/null
+++ b/tex/context/base/mkiv/lang-imp-simpleascii-data.lgz
Binary files differ
diff --git a/tex/context/base/mkiv/lang-imp-simpleascii.lua b/tex/context/base/mkiv/lang-imp-simpleascii.lua
new file mode 100644
index 000000000..8fe664a27
--- /dev/null
+++ b/tex/context/base/mkiv/lang-imp-simpleascii.lua
@@ -0,0 +1,114 @@
+-- The data is taken from:
+--
+-- https://github.com/anyascii/anyascii/blob/master/table.tsv
+--
+-- by Hunter WB under the ISC License (2020-2023).
+--
+-- Updating:
+--
+-- -- copy table.tsv to lang-imp-simpleascii-data.tsv
+-- -- mtxrun --script lang-imp-simpleascii
+-- -- copy lang-imp-simpleascii-data.lgz over old file
+--
+-- Usage:
+--
+-- \usetransliteration[simpleascii]
+--
+-- \definetransliteration
+-- [simpleascii]
+-- [color=blue,
+-- vector={simple ascii}]
+--
+-- \settransliteration[simpleascii]
+--
+-- \starttext
+--
+-- \startchapter[title={深圳 ଗଜପତି Blöße}]
+-- 深圳 ଗଜପତି Blöße\par
+-- 深圳 ଗଜପତି Blöße\par
+-- 深圳 ଗଜପତି Blöße\par
+-- 深圳 ଗଜପତି Blöße\par
+-- \stopchapter
+--
+-- \stoptext
+
+local textfile = "lang-imp-simpleascii-data.tsv" -- a copy of table.tsv
+local datafile = "lang-imp-simpleascii-data.lua" -- for tracing
+local compfile = "lang-imp-simpleascii-data.lgz" -- idem in distribution
+
+local verbose = false -- when true, saved uncompressed file for tracing
+local report = logs.reporter("simpleascii")
+
+if not context and lfs.isfile(textfile) then
+
+ -- We save it in the local path so we need to move it explicitly into
+ -- the tree which prevents errors.
+
+ local data = io.loaddata(textfile)
+ if data and data ~= "" then
+ local mapping = { }
+ for k, v in string.gmatch(data,"(%S+)[\t]*([^\n\r]-)[\n\r]") do
+ if k ~= "" and v ~= "" and k ~= v then
+ mapping[k] = v
+ end
+ end
+ if verbose then
+ table.save(datafile,mapping)
+ else
+ mapping = gzip.compress(table.fastserialize(mapping)) -- zlib.compress(d,9)
+ datafile = compfile
+ io.savedata(compfile,mapping)
+ end
+ report("data from %a saved in %a",textfile,datafile)
+ else
+ report("no data file %a",textfile)
+ end
+
+else
+
+ local mapping = false
+
+ if not verbose then
+ mapping = io.loaddata(resolvers.findfile(compfile) or "")
+ if mapping then
+ mapping = table.deserialize(gzip.decompress(mapping)) -- zlib.decompress(d)
+ if mapping then
+ datafile = compfile
+ else
+ report("data file %a is corrupt",compfile)
+ end
+ end
+ end
+ if not mapping then
+ mapping = table.load(resolvers.findfile(datafile) or "")
+ end
+
+ if mapping then
+
+ report("data file %a loaded",datafile)
+
+ -- for i = 0, 127 do
+ -- mapping[utfchar(i)] = utfchar(i) -- not needed
+ -- end
+
+ return {
+
+ name = "simple ascii",
+ version = "1.00",
+ comment = "Unicode to ASCII transliteration",
+ author = "Jairo A. del Rio & Hans Hagen",
+ copyright = "ConTeXt development team & whoever made this list",
+
+ transliterations = {
+ ["simple ascii"] = {
+ mapping = mapping
+ },
+ }
+
+ }
+
+ else
+ report("no data file %a",datafile)
+ end
+
+end
diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua
index d2c47f5ba..a07524a93 100644
--- a/tex/context/base/mkiv/lang-rep.lua
+++ b/tex/context/base/mkiv/lang-rep.lua
@@ -266,7 +266,7 @@ local function replace(head,first,last,final,hasspace,overload)
current = getnext(current)
end
end
- current = getnext(final)
+ -- current = getnext(final) -- some left over? no next!
elseif oldlength < newlength then
for i=1,newlength-oldlength do
local n = copy_node(current)
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index a250fdefd..d57c686a2 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -193,7 +193,7 @@ return {
--
"Ux", "eUx",
--
- "parfillleftskip", "parfillrightskip",
+ -- "parfillleftskip", "parfillrightskip",
--
"startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode",
--
@@ -209,7 +209,7 @@ return {
"breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode",
"discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode",
--
- "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode",
+ "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "limitprevgrafnormalizeparcode",
--
"nopreslackclassoptioncode", "nopostslackclassoptioncode",
"lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode",
@@ -219,7 +219,7 @@ return {
"flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode",
"carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode",
"preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode",
- "operatoritaliccorrectionclassoptioncode",
+ "operatoritaliccorrectionclassoptioncode", "shortinlineclassoptioncode",
--
"noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode",
"noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode",
@@ -270,6 +270,8 @@ return {
--
"autorule",
--
+ "tobits", "tohexa",
+ --
"strippedcsname","checkedstrippedcsname",
--
"nofarguments",
@@ -281,7 +283,7 @@ return {
"sixthargumentfalse", "sixthargumenttrue",
"seventhargumentfalse", "seventhargumenttrue",
--
- "vkern", "hkern", "vpenalty", "hpenalty",
+ -- "vkern", "hkern", "vpenalty", "hpenalty", -- native in mkxl
--
"doglobal", "dodoglobal", "redoglobal", "resetglobal",
--
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 37779ec57..cf83244cf 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -249,6 +249,7 @@ return {
"adjustspacingshrink",
"adjustspacingstep",
"adjustspacingstretch",
+ "advanceby",
"afterassigned",
"aftergrouped",
"aliased",
@@ -320,10 +321,12 @@ return {
"dbox",
"defcsname",
"deferred",
+ "detokened",
"detokenized",
"dimensiondef",
"dimexpression",
"directlua",
+ "divideby",
"dpack",
"dsplit",
"edefcsname",
@@ -403,6 +406,7 @@ return {
"hmcode",
"holdingmigrations",
"hpack",
+ "hpenalty",
"hyphenationmin",
"hyphenationmode",
"ifabsdim",
@@ -429,6 +433,9 @@ return {
"ifhasxtoks",
"ifincsname",
"ifinsert",
+ "ifintervaldim",
+ "ifintervalfloat",
+ "ifintervalnum",
"ifmathparameter",
"ifmathstyle",
"ifnumexpression",
@@ -571,6 +578,7 @@ return {
"meaningles",
"meaningless",
"mugluespecdef",
+ "multiplyby",
"mutable",
"noaligned",
"noatomruling",
@@ -598,18 +606,24 @@ return {
"parametermark",
"parattribute",
"pardirection",
+ "parfillleftskip",
+ "parfillrightskip",
+ "parinitleftskip",
+ "parinitrightskip",
"permanent",
"pettymuskip",
"positdef",
"postexhyphenchar",
"posthyphenchar",
"postinlinepenalty",
+ "postshortinlinepenalty",
"prebinoppenalty",
"predisplaygapfactor",
"preexhyphenchar",
"prehyphenchar",
"preinlinepenalty",
"prerelpenalty",
+ "preshortinlinepenalty",
"protrudechars",
"protrusionboundary",
"pxdimen",
@@ -691,6 +705,7 @@ return {
"virtualhrule",
"virtualvrule",
"vpack",
+ "vpenalty",
"wordboundary",
"wrapuppar",
"xdefcsname",
@@ -829,7 +844,6 @@ return {
"accent",
"adjdemerits",
"advance",
- "advanceby",
"afterassignment",
"aftergroup",
"atop",
@@ -874,7 +888,6 @@ return {
"displaywidowpenalty",
"displaywidth",
"divide",
- "divideby",
"doublehyphendemerits",
"dp",
"dump",
@@ -923,6 +936,7 @@ return {
"hfill",
"hfilneg",
"hfuzz",
+ "hkern",
"holdinginserts",
"hrule",
"hsize",
@@ -1000,7 +1014,6 @@ return {
"moveright",
"mskip",
"multiply",
- "multiplyby",
"muskip",
"muskipdef",
"newlinechar",
@@ -1031,11 +1044,8 @@ return {
"pagestretch",
"pagetotal",
"par",
- "parfillleftskip",
"parfillskip",
"parindent",
- "parinitleftskip",
- "parinitrightskip",
"parshape",
"parskip",
"patterns",
@@ -1125,6 +1135,7 @@ return {
"vfill",
"vfilneg",
"vfuzz",
+ "vkern",
"vrule",
"vsize",
"vskip",
diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi
index 65f33fa9f..bfbc97a57 100644
--- a/tex/context/base/mkiv/publ-imp-apa.mkvi
+++ b/tex/context/base/mkiv/publ-imp-apa.mkvi
@@ -941,8 +941,6 @@
\btxlabeltext{apa:Translator}
\btxrightparenthesis
}
- \btxperiod
- % TODO: this period may NOT be wanted, as in: Title (2nd ed.).
}
\stoptexdefinition
@@ -951,7 +949,7 @@
\resetmode{btx:apa:title-placed}
} {
\btxdoif {title} {
- \btxspace
+ \btxperiod
\texdefinition {btx:apa:title}
}
}
@@ -1087,7 +1085,6 @@
\btxrightparenthesis
}
% outside of interaction
- \btxperiod
\doif {\btxfoundname{author}} {title} {
\setmode{btx:apa:title-placed}
}
@@ -1095,6 +1092,7 @@
\starttexdefinition mutable protected btx:apa:editor-in
\btxdoif {booktitle} {
+ \btxperiod
\btxlabeltext{In}
\btxspace
\doifnot {\btxfoundname{author}} {editor} {
@@ -1104,7 +1102,6 @@
}
}
\texdefinition{btx:apa:composed-title}{booktitle}
- \btxperiod
}
\stoptexdefinition
@@ -1118,9 +1115,6 @@
}
\stoptexdefinition
-% TODO: The title is terminated with period. However,
-% we probably don't want this before the parenthesis.
-
\starttexdefinition mutable protected btx:apa:leftparenthesis-or-comma
\doifelsemode {btx:apa:editionset-is-empty} {
\btxleftparenthesis
@@ -1180,8 +1174,9 @@
\btxflush{pages}
}
\doifnotmode {btx:apa:editionset-is-empty} {
- \btxrightparenthesisperiod
+ \btxrightparenthesis
}
+ \btxperiod
\stoptexdefinition
\starttexdefinition mutable protected btx:apa:journal
@@ -1275,36 +1270,26 @@
\btxperiod
\stoptexdefinition
-\definebreakpoints[doi]
-\definebreakpoint [doi][:][nleft=3,type=1]
-\definebreakpoint [doi][/][nleft=3,type=1]
-\definebreakpoint [doi][-][nleft=3,type=1]
-\definebreakpoint [doi][.][nleft=3,type=1]
-
% use \btxentry here?
+\sethyphenatedurlafter{:./-_} % question of taste
+
\starttexdefinition mutable protected btx:apa:url
- \begingroup
- \setbreakpoints[doi]
- \texdefinition {btx:format:goto} {
- url(\btxflush{url})
- } {
- \hyphenatedurl{\btxflush{url}}
- }
- \endgroup
+ \texdefinition {btx:format:goto} {
+ url(\btxflush{url})
+ } {
+ \hyphenatedurl{\btxflush{url}}
+ }
\stoptexdefinition
% use \btxentry here?
\starttexdefinition mutable protected btx:apa:doi
- \begingroup
- \setbreakpoints[doi]
- \texdefinition {btx:format:goto} {
- url(http://dx.doi.org/\btxflush{doi})
- } {
- \hyphenatedurl{doi:\btxflush{doi}}
- }
- \endgroup
+ \texdefinition {btx:format:goto} {
+ url(http://dx.doi.org/\btxflush{doi})
+ } {
+ \hyphenatedurl{doi:\btxflush{doi}}
+ }
\stoptexdefinition
\starttexdefinition mutable protected btx:apa:note
@@ -1326,13 +1311,14 @@
\btxspace
\texdefinition{btx:apa:doi}
}
+ % should the following be hyperlinks? To where?
\btxdoif {issn} {
\btxspace
- issn\colon\btxflush{issn}
+ \hyphenatedurl{issn:\btxflush{issn}}
}
\btxdoif {isbn} {
\btxspace
- isbn\colon\btxflush{isbn}
+ \hyphenatedurl{isbn:\btxflush{isbn}}
}
\texdefinition{btx:apa:note}
\removeunwantedspaces
@@ -1342,7 +1328,7 @@
\btxdoif {type} {
\btxleftbracket
\btxflush{type}
- \btxrightbracketperiod
+ \btxrightbracket
}
\stoptexdefinition
@@ -1357,6 +1343,7 @@
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}
\texdefinition{btx:apa:type}
+ \btxperiod
\texdefinition{btx:apa:journal-volume-number-pages}
\texdefinition{btx:apa:url-doi-note}
\stopsetups
@@ -1394,6 +1381,7 @@
\startsetups btx:apa:list:standard
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}
+ \btxperiod
\texdefinition{btx:apa:url-doi-note}
\stopsetups
@@ -1636,10 +1624,10 @@
}
\doifnot {\btxfoundname{title}} {album} {
\btxdoif {album} {
+ \btxperiod
\btxlabeltext{In}
\btxspace
\btxflush{album}
- \btxperiod
}
}
\texdefinition{btx:apa:type}
@@ -1662,6 +1650,7 @@
\startsetups btx:apa:list:misc
\texdefinition{btx:apa:authoryear}
\texdefinition{btx:apa:title-if-not-placed}
+ \btxperiod
\btxdoif {howpublished} {
\btxspace
\btxflush{howpublished}
diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv
index d75006b18..9410e007d 100644
--- a/tex/context/base/mkiv/publ-ini.mkiv
+++ b/tex/context/base/mkiv/publ-ini.mkiv
@@ -420,6 +420,7 @@
\unexpanded\def\btxcommabreak {\removeunwantedspaces,\hskip\zeropoint plus .5\emwidth\relax}
\unexpanded\def\btxcolon {\removeunwantedspaces:\space}
\unexpanded\def\btxsemicolon {\removeunwantedspaces;\space}
+\unexpanded\def\btxhyphen {\removeunwantedspaces-}
\unexpanded\def\btxlparent {\removeunwantedspaces\space(} % obsolete
\unexpanded\def\btxrparent {\removeunwantedspaces)\space} % obsolete
\unexpanded\def\btxleftparenthesis {\removeunwantedspaces\space(}
@@ -1995,9 +1996,9 @@
\c!otherstext={\btxspace et al.},
\c!separator:firstnames={\btxspace},
\c!separator:juniors={\btxspace},
- \c!separator:vons={\btxspace},
+ \c!separator:vons={\btxnobreakspace},
\c!separator:initials={\btxspace},
- \c!connector:initials={-},
+ \c!connector:initials={\btxhyphen},
\c!stopper:initials={.},
%\c!surnamesep={\btxcomma}, % is this used anywhere?
\c!separator:invertedinitials={\btxcomma},
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index dad92835c..dff0084d6 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 25fae18e2..3c16a859d 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/util-zip.lua b/tex/context/base/mkiv/util-zip.lua
index 84539492c..404b39713 100644
--- a/tex/context/base/mkiv/util-zip.lua
+++ b/tex/context/base/mkiv/util-zip.lua
@@ -619,11 +619,13 @@ if xzip then -- flate then do
end
end
- local function unzipdir(zipname,path,verbose)
+ local function unzipdir(zipname,path,verbose,collect,validate)
if type(zipname) == "table" then
- verbose = zipname.verbose
- path = zipname.path
- zipname = zipname.zipname
+ validate = zipname.validate
+ collect = zipname.collect
+ verbose = zipname.verbose
+ path = zipname.path
+ zipname = zipname.zipname
end
if not zipname or zipname == "" then
return
@@ -641,34 +643,49 @@ if xzip then -- flate then do
local done = 0
local steps = verbose == "steps"
local time = steps and osclock()
+ -- local skip = 0
+ if collect then
+ collect = { }
+ else
+ collect = false
+ end
for i=1,count do
local l = list[i]
local n = l.filename
- local d = unzipfile(z,n) -- true for check
- if d then
- local p = filejoin(path,n)
- if mkdirs(dirname(p)) then
- if steps then
- total = total + #d
- done = done + 1
- if done >= step then
- done = 0
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ if not validate or validate(n) then
+ local d = unzipfile(z,n) -- true for check
+ if d then
+ local p = filejoin(path,n)
+ if mkdirs(dirname(p)) then
+ if steps then
+ total = total + #d
+ done = done + 1
+ if done >= step then
+ done = 0
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ end
+ elseif verbose then
+ logwriter(n)
+ end
+ savedata(p,d)
+ if collect then
+ collect[#collect+1] = p
end
- elseif verbose then
- logwriter(n)
end
- savedata(p,d)
+ else
+ logwriter(format("problem with file %s",n))
end
else
- logwriter(format("problem with file %s",n))
+ -- skip = skip + 1
end
end
if steps then
logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",count,count,total,osclock()-time))
end
closezipfile(z)
- return true
+ if collect then
+ return collect
+ end
else
closezipfile(z)
end
diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt
index 9f5535638..39c7ee655 100644
--- a/tex/context/base/mkxl/buff-ini.lmt
+++ b/tex/context/base/mkxl/buff-ini.lmt
@@ -828,7 +828,7 @@ end
-- moved here:
-function buffers.samplefile(name)
+function buffers.samplefile(name,before,after,inbetween)
if not exists(name) then
assign(name,io.loaddata(resolvers.findfile(name)))
end
@@ -837,10 +837,37 @@ end
implement {
name = "samplefile", -- bad name, maybe rename to injectbuffercontent
+ public = true,
+ protected = true,
actions = buffers.samplefile,
arguments = "string"
}
+function buffers.splitsamplefile(name,before,after,inbetween)
+ local data = io.loaddata(resolvers.findfile(name)) or ""
+ local split = string.split(utilities.strings.striplines(data,"prune and collapse"),lpeg.patterns.whitespace^1)
+ local size = #split
+ local before = tonumber(before) or 1
+ local after = tonumber(after) or 1
+ if before + after < size then
+ table.move(split,size-after,size,before+1)
+ if inbetween and inbetween ~= "" then
+ split[before+1] = inbetween
+ end
+ data = concat(split, " ",1,before+after+1)
+ end
+ assign(name,data)
+ getbuffer(name)
+end
+
+implement {
+ name = "splitsamplefile", -- bad name, maybe rename to injectbuffercontent
+ public = true,
+ protected = true,
+ actions = buffers.splitsamplefile,
+ arguments = "4 strings",
+}
+
-- A somewhat strange place (for now) so the *.log definitions might move someplace
-- else (if useful at all).
diff --git a/tex/context/base/mkxl/buff-ini.mkxl b/tex/context/base/mkxl/buff-ini.mkxl
index 0bc4d665f..ce185d70f 100644
--- a/tex/context/base/mkxl/buff-ini.mkxl
+++ b/tex/context/base/mkxl/buff-ini.mkxl
@@ -96,7 +96,7 @@
% \expandafter\relax\string} % dirty trick
\scratchcounterone
% better than \string but still a dirty trick to avoid \par mess in blocks
- \expandafter\scratchcountertwo\detokenized}
+ \expandafter\scratchcountertwo\detokenized} % the bare token (so not \detokened !)
\protected\def\buff_stop#1%
{\endgroup % (3 & 4 & 5 & 6)
diff --git a/tex/context/base/mkxl/buff-ver.lmt b/tex/context/base/mkxl/buff-ver.lmt
new file mode 100644
index 000000000..25d92618e
--- /dev/null
+++ b/tex/context/base/mkxl/buff-ver.lmt
@@ -0,0 +1,970 @@
+if not modules then modules = { } end modules ['buff-ver'] = {
+ version = 1.001,
+ comment = "companion to buff-ver.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- The default visualizers have reserved names starting with buff-imp-*. Users are
+-- supposed to use different names for their own variants.
+--
+-- todo: skip=auto
+--
+-- todo: update to match context scite lexing
+
+local type, next, rawset, rawget, setmetatable, getmetatable, tonumber = type, next, rawset, rawget, setmetatable, getmetatable, tonumber
+local lower, upper,match, find, sub = string.lower, string.upper, string.match, string.find, string.sub
+local splitlines = string.splitlines
+local concat = table.concat
+local C, P, R, S, V, Carg, Cc, Cs = lpeg.C, lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Carg, lpeg.Cc, lpeg.Cs
+local patterns, lpegmatch, is_lpeg = lpeg.patterns, lpeg.match, lpeg.is_lpeg
+
+local trace_visualize = false trackers.register("buffers.visualize", function(v) trace_visualize = v end)
+local report_visualizers = logs.reporter("buffers","visualizers")
+
+local allocate = utilities.storage.allocate
+
+visualizers = visualizers or { }
+local specifications = allocate()
+visualizers.specifications = specifications
+
+local context = context
+local commands = commands
+local implement = interfaces.implement
+
+local formatters = string.formatters
+
+local tabtospace = utilities.strings.tabtospace
+local variables = interfaces.variables
+local settings_to_array = utilities.parsers.settings_to_array
+local variables = interfaces.variables
+local findfile = resolvers.findfile
+local addsuffix = file.addsuffix
+
+local v_yes = variables.yes
+local v_no = variables.no
+local v_last = variables.last
+local v_all = variables.all
+local v_absolute = variables.absolute
+----- v_inline = variables.inline -- not !
+----- v_display = variables.display -- not !
+
+-- beware, all macros have an argument:
+
+local ctx_inlineverbatimnewline = context.doinlineverbatimnewline
+local ctx_inlineverbatimbeginline = context.doinlineverbatimbeginline
+local ctx_inlineverbatimemptyline = context.doinlineverbatimemptyline
+local ctx_inlineverbatimstart = context.doinlineverbatimstart
+local ctx_inlineverbatimstop = context.doinlineverbatimstop
+
+local ctx_displayverbatiminitialize = context.dodisplayverbatiminitialize -- the number of arguments might change over time
+local ctx_displayverbatimnewline = context.dodisplayverbatimnewline
+local ctx_displayverbatimbeginline = context.dodisplayverbatimbeginline
+local ctx_displayverbatimemptyline = context.dodisplayverbatimemptyline
+local ctx_displayverbatimstart = context.dodisplayverbatimstart
+local ctx_displayverbatimstop = context.dodisplayverbatimstop
+
+local ctx_verbatim = context.verbatim
+local ctx_verbatimspace = context.doverbatimspace
+
+local CargOne = Carg(1)
+
+local function f_emptyline(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimemptyline()
+ else
+ ctx_displayverbatimemptyline()
+ end
+end
+
+local function f_beginline(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimbeginline()
+ else
+ ctx_displayverbatimbeginline()
+ end
+end
+
+local function f_newline(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimnewline()
+ else
+ ctx_displayverbatimnewline()
+ end
+end
+
+local function f_start(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimstart()
+ else
+ ctx_displayverbatimstart()
+ end
+end
+
+local function f_stop(s,settings)
+ if settings and settings.nature == "inline" then
+ ctx_inlineverbatimstop()
+ else
+ ctx_displayverbatimstop()
+ end
+end
+
+local function f_default(s) -- (s,settings)
+ ctx_verbatim(s)
+end
+
+local function f_space() -- (s,settings)
+ ctx_verbatimspace()
+end
+
+local function f_signal() -- (s,settings)
+ -- we use these for special purposes
+end
+
+local signal = "\000"
+
+visualizers.signal = signal
+visualizers.signalpattern = P(signal)
+
+local functions = {
+ __index = {
+ emptyline = f_emptyline,
+ newline = f_newline,
+ default = f_default,
+ beginline = f_beginline,
+ space = f_space,
+ start = f_start,
+ stop = f_stop,
+ signal = f_signal,
+ }
+}
+
+local handlers = { }
+
+function visualizers.newhandler(name,data)
+ local tname = type(name)
+ local tdata = type(data)
+ if tname == "table" then -- (data)
+ setmetatable(name,getmetatable(name) or functions)
+ return name
+ elseif tname == "string" then
+ if tdata == "string" then -- ("name","parent")
+ local result = { }
+ setmetatable(result,getmetatable(handlers[data]) or functions)
+ handlers[name] = result
+ return result
+ elseif tdata == "table" then -- ("name",data)
+ setmetatable(data,getmetatable(data) or functions)
+ handlers[name] = data
+ return data
+ else -- ("name")
+ local result = { }
+ setmetatable(result,functions)
+ handlers[name] = result
+ return result
+ end
+ else -- ()
+ local result = { }
+ setmetatable(result,functions)
+ return result
+ end
+end
+
+function visualizers.newgrammar(name,t)
+ name = lower(name)
+ t = t or { }
+ local g = visualizers.specifications[name]
+ g = g and g.grammar
+ if g then
+ if trace_visualize then
+ report_visualizers("cloning grammar %a",name)
+ end
+ for k,v in next, g do
+ if not t[k] then
+ t[k] = v
+ end
+ if is_lpeg(v) then
+ t[name..":"..k] = v
+ end
+ end
+ end
+ return t
+end
+
+local function getvisualizer(method,nature)
+ method = lower(method)
+ local m = specifications[method] or specifications.default
+ if nature then
+ if trace_visualize then
+ report_visualizers("getting visualizer %a with nature %a",method,nature)
+ end
+ return m and (m[nature] or m.parser) or nil
+ else
+ if trace_visualize then
+ report_visualizers("getting visualizer %a",method)
+ end
+ return m and m.parser or nil
+ end
+end
+
+local ctx_fallback = ctx_verbatim
+
+local function makepattern(visualizer,replacement,pattern)
+ if not pattern then
+ report_visualizers("error in visualizer %a",replacement)
+ return patterns.alwaystrue
+ else
+ if type(visualizer) == "table" and type(replacement) == "string" then
+ replacement = visualizer[replacement] or ctx_fallback
+ else
+ replacement = ctx_fallback
+ end
+ return (C(pattern) * CargOne) / replacement
+ end
+end
+
+local function makenested(handler,how,start,stop)
+ local b, e, f = P(start), P(stop), how
+ if type(how) == "string" then
+ f = function(s) getvisualizer(how,"direct")(s) end
+ end
+ return makepattern(handler,"name",b)
+ * ((1-e)^1/f)
+ * makepattern(handler,"name",e)
+end
+
+visualizers.pattern = makepattern
+visualizers.makepattern = makepattern
+visualizers.makenested = makenested
+
+function visualizers.load(name)
+ name = lower(name)
+ if rawget(specifications,name) == nil then
+ name = lower(name)
+ local impname = "buff-imp-"..name
+ local texname = findfile(addsuffix(impname,"mkiv"))
+ local luaname = findfile(addsuffix(impname,"lua"))
+ if texname == "" or luaname == "" then
+ -- assume a user specific file
+ luaname = findfile(addsuffix(name,"mkiv"))
+ texname = findfile(addsuffix(name,"lua"))
+ end
+ if texname == "" or luaname == "" then
+ if trace_visualize then
+ report_visualizers("unknown visualizer %a",name)
+ end
+ else
+ if trace_visualize then
+ report_visualizers("loading visualizer %a",name)
+ end
+ lua.registercode(luaname) -- only used here, end up in format
+ context.input(texname)
+ end
+ if rawget(specifications,name) == nil then
+ rawset(specifications,name,false)
+ end
+ end
+end
+
+function visualizers.register(name,specification)
+ name = lower(name)
+ if trace_visualize then
+ report_visualizers("registering visualizer %a",name)
+ end
+ specifications[name] = specification
+ local parser = specification.parser
+ local handler = specification.handler
+ local displayparser = specification.display or parser
+ local inlineparser = specification.inline or parser
+ local isparser = is_lpeg(parser)
+ local start, stop
+ if isparser then
+ start = makepattern(handler,"start",patterns.alwaysmatched)
+ stop = makepattern(handler,"stop", patterns.alwaysmatched)
+ end
+ if handler then
+ if isparser then
+ specification.display = function(content,settings)
+ if handler.startdisplay then handler.startdisplay(settings) end
+ lpegmatch(start * displayparser * stop,content,1,settings)
+ if handler.stopdisplay then handler.stopdisplay(settings) end
+ end
+ specification.inline = function(content,settings)
+ if handler.startinline then handler.startinline(settings) end
+ lpegmatch(start * inlineparser * stop,content,1,settings)
+ if handler.stopinline then handler.stopinline(settings) end
+ end
+ specification.direct = function(content,settings)
+ lpegmatch(parser,content,1,settings)
+ end
+ elseif parser then
+ specification.display = function(content,settings)
+ if handler.startdisplay then handler.startdisplay(settings) end
+ parser(content,settings)
+ if handler.stopdisplay then handler.stopdisplay(settings) end
+ end
+ specification.inline = function(content,settings)
+ if handler.startinline then handler.startinline(settings) end
+ parser(content,settings)
+ if handler.stopinline then handler.stopinline(settings) end
+ end
+ specification.direct = parser
+ end
+ elseif isparser then
+ specification.display = function(content,settings)
+ lpegmatch(start * displayparser * stop,content,1,settings)
+ end
+ specification.inline = function(content,settings)
+ lpegmatch(start * inlineparser * stop,content,1,settings)
+ end
+ specification.direct = function(content,settings)
+ lpegmatch(parser,content,1,settings)
+ end
+ elseif parser then
+ specification.display = parser
+ specification.inline = parser
+ specification.direct = parser
+ end
+ return specification
+end
+
+function visualizers.getspecification(name)
+ return specifications[lower(name)]
+end
+
+local escapepatterns = allocate()
+visualizers.escapepatterns = escapepatterns
+
+local function texmethod(s)
+ context.bgroup()
+ context(s)
+ context.egroup()
+end
+
+local function texcommand(s)
+ context[s]()
+end
+
+local function defaultmethod(s,settings)
+ lpegmatch(getvisualizer("default"),lower(s),1,settings)
+end
+
+-- we can consider using a nested instead
+
+local space_pattern = patterns.space^0
+local name_pattern = R("az","AZ")^1
+
+-- the hack is needed in order to retain newlines when an escape happens at the
+-- at the begin of a line; it also ensures proper line numbering; a bit messy
+
+local function hack(pattern)
+ return Cs(pattern * Cc(signal))
+end
+
+local split_processor = typesetters.processors.split
+local apply_processor = typesetters.processors.apply
+
+-- todo: { before = b, after = a, processor = p }, ...
+
+function visualizers.registerescapepattern(name,befores,afters,normalmethod,escapemethod,processors)
+ local escapepattern = escapepatterns[name]
+ if not escapepattern then
+ if type(befores) ~= "table" then befores = { befores } end
+ if type(afters) ~= "table" then afters = { afters } end
+ if type(processors) ~= "table" then processors = { processors } end
+ for i=1,#befores do
+ local before = befores[i]
+ local after = afters[i]
+ local processor = processors[i]
+ if trace_visualize then
+ report_visualizers("registering escape pattern, name %a, index %a, before %a, after %a, processor %a",
+ name,i,before,after,processor or "default")
+ end
+ before = P(before) * space_pattern
+ after = space_pattern * P(after)
+ local action
+ if processor then
+ action = function(s) apply_processor(processor,s) end
+ else
+ action = escapemethod or texmethod
+ end
+ local ep = (before / "") * ((1 - after)^0 / action) * (after / "")
+ if escapepattern then
+ escapepattern = escapepattern + ep
+ else
+ escapepattern = ep
+ end
+ end
+ escapepattern = (
+ escapepattern
+ + hack((1 - escapepattern)^1) / (normalmethod or defaultmethod)
+ )^0
+ escapepatterns[name] = escapepattern
+ end
+ return escapepattern
+end
+
+function visualizers.registerescapeline(name,befores,normalmethod,escapemethod,processors)
+ local escapepattern = escapepatterns[name]
+ if not escapepattern then
+ if type(befores) ~= "table" then befores = { befores } end
+ if type(processors) ~= "table" then processors = { processors } end
+ for i=1,#befores do
+ local before = befores[i]
+ local processor = processors[i]
+ if trace_visualize then
+ report_visualizers("registering escape line pattern, name %a, before %a, after <<newline>>",name,before)
+ end
+ before = P(before) * space_pattern
+ after = space_pattern * P("\n")
+ local action
+ if processor then
+ action = function(s) apply_processor(processor,s) end
+ else
+ action = escapemethod or texmethod
+ end
+ local ep = (before / "") * ((1 - after)^0 / action) * (space_pattern / "")
+ if escapepattern then
+ escapepattern = escapepattern + ep
+ else
+ escapepattern = ep
+ end
+ end
+ escapepattern = (
+ escapepattern
+ + hack((1 - escapepattern)^1) / (normalmethod or defaultmethod)
+ )^0
+ escapepatterns[name] = escapepattern
+ end
+ return escapepattern
+end
+
+function visualizers.registerescapecommand(name,token,normalmethod,escapecommand,processor)
+ local escapepattern = escapepatterns[name]
+ if not escapepattern then
+ if trace_visualize then
+ report_visualizers("registering escape token, name %a, token %a",name,token)
+ end
+ token = P(token)
+ local notoken = hack((1 - token)^1)
+ local cstoken = Cs(name_pattern * (space_pattern/""))
+ escapepattern = (
+ (token / "")
+ * (cstoken / (escapecommand or texcommand))
+ + (notoken / (normalmethod or defaultmethod))
+ )^0
+ escapepatterns[name] = escapepattern
+ end
+ return escapepattern
+end
+
+local escapedvisualizers = { }
+local f_escapedvisualizer = formatters["%s : %s"]
+
+local function visualize(content,settings) -- maybe also method in settings
+ if content and content ~= "" then
+ local method = lower(settings.method or "default")
+ local m = specifications[method] or specifications.default
+ local e = settings.escape
+ if e and e ~= "" and not m.handler.noescape then
+ local newname = f_escapedvisualizer(method,e)
+ local newspec = specifications[newname]
+ if newspec then
+ m = newspec
+ else
+ local starts, stops, processors = { }, { }, { }
+ if e == v_yes then
+ starts[1] = "/BTEX"
+ stops [1] = "/ETEX"
+ else
+ local s = settings_to_array(e,true)
+ for i=1,#s do
+ local si = s[i]
+ local processor, pattern = split_processor(si)
+ si = processor and pattern or si
+ local start, stop = match(si,"^(.-),(.-)$")
+ if start then
+ local n = #starts + 1
+ starts[n] = start
+ stops [n] = stop or ""
+ processors[n] = processor
+ end
+ end
+ end
+ local oldm = m
+ local oldparser = oldm.direct
+ local newhandler = oldm.handler
+ local newparser = oldm.parser -- nil
+ if starts[1] and stops[1] ~= "" then
+ newparser = visualizers.registerescapepattern(newname,starts,stops,oldparser,nil,processors)
+ elseif starts[1] then
+ newparser = visualizers.registerescapeline(newname,starts,oldparser,nil,processors)
+ else -- for old times sake: /em
+ newparser = visualizers.registerescapecommand(newname,e,oldparser,nil,processors)
+ end
+ m = visualizers.register(newname, {
+ parser = newparser,
+ handler = newhandler,
+ })
+ end
+ else
+ m = specifications[method] or specifications.default
+ end
+ local nature = settings.nature or "display"
+ local n = m and m[nature]
+ if n then
+ if trace_visualize then
+ report_visualizers("visualize using method %a and nature %a",method,nature)
+ end
+ n(content,settings)
+ else
+ if trace_visualize then
+ report_visualizers("visualize using method %a",method)
+ end
+ ctx_fallback(content,1,settings)
+ end
+ end
+end
+
+visualizers.visualize = visualize
+visualizers.getvisualizer = getvisualizer
+
+local fallbacks = { } table.setmetatableindex(fallbacks,function(t,k) local v = { nature = k } t[k] = v return v end)
+
+local function checkedsettings(settings,nature)
+ if not settings then
+ -- let's avoid dummy tables as much as possible
+ return fallbacks[nature]
+ else
+ if not settings.nature then
+ settings.nature = nature
+ end
+ return settings
+ end
+end
+
+function visualizers.visualizestring(content,settings)
+ visualize(content,checkedsettings(settings,"inline"))
+end
+
+function visualizers.visualizefile(name,settings)
+ visualize(resolvers.loadtexfile(name),checkedsettings(settings,"display"))
+end
+
+function visualizers.visualizebuffer(name,settings)
+ visualize(buffers.getcontent(name),checkedsettings(settings,"display"))
+end
+
+-- --
+
+local space = C(patterns.space) * CargOne / f_space
+local newline = C(patterns.newline) * CargOne / f_newline
+local emptyline = C(patterns.emptyline) * CargOne / f_emptyline
+local beginline = C(patterns.beginline) * CargOne / f_beginline
+local anything = C(patterns.somecontent) * CargOne / f_default
+
+----- verbosed = (space + newline * (emptyline^0) * beginline + anything)^0
+local verbosed = (space + newline * (emptyline^0) * beginline + newline * emptyline + newline + anything)^0
+
+local function write(s,settings) -- bad name
+ lpegmatch(verbosed,s,1,settings or false)
+end
+
+visualizers.write = write
+visualizers.writenewline = f_newline
+visualizers.writeemptyline = f_emptyline
+visualizers.writespace = f_space
+visualizers.writedefault = f_default
+
+function visualizers.writeargument(...)
+ context("{") -- If we didn't have tracing then we could
+ write(...) -- use a faster print to tex variant for the
+ context("}") -- { } tokens as they always have ctxcatcodes.
+end
+
+-- helpers
+
+local function realign(lines,strip) -- "yes", <number>
+ local n
+ if strip == v_yes then
+ n = 0xFFFF
+ for i=1, #lines do
+ local spaces = find(lines[i],"%S") -- can be lpeg
+ if not spaces then
+ -- empty line
+ elseif spaces == 0 then
+ n = 0
+ break
+ elseif spaces < n then
+ n = spaces
+ end
+ end
+ n = n - 1
+ else
+ n = tonumber(strip)
+ end
+ if n and n > 0 then
+ local copy = { }
+ for i=1,#lines do
+ copy[i] = sub(lines[i],n+1)
+ end
+ return copy
+ end
+ return lines
+end
+
+local onlyspaces = S(" \t\f\n\r")^0 * P(-1)
+
+local function getstrip(lines,first,last)
+ if not first then
+ first = 1
+ end
+ if not last then
+ last = #lines
+ end
+ for i=first,last do
+ local li = lines[i]
+ if #li == 0 or lpegmatch(onlyspaces,li) then
+ first = first + 1
+ else
+ break
+ end
+ end
+ for i=last,first,-1 do
+ local li = lines[i]
+ if #li == 0 or lpegmatch(onlyspaces,li) then
+ last = last - 1
+ else
+ break
+ end
+ end
+ return first, last, last - first + 1
+end
+
+-- we look for text (todo):
+--
+-- "foo" : start after line with "foo"
+-- "=" : ignore first blob
+-- "=foo" : start at "foo"
+-- "!foo" : maybe a not "foo"
+
+-- % - # lines start a comment
+
+local comment = "^[%%%-#]"
+
+local function getrange(lines,first,last,range) -- 1,3 1,+3 fromhere,tothere
+ local noflines = #lines
+ local first = first or 1
+ local last = last or noflines
+ if last < 0 then
+ last = noflines + last
+ end
+ local what = settings_to_array(range) -- maybe also n:m
+ local r_first = what[1]
+ local r_last = what[2]
+ local f = tonumber(r_first)
+ local l = tonumber(r_last)
+ if r_first then
+ if f then
+ if f > first then
+ first = f
+ end
+ elseif r_first == "=" then
+ for i=first,last do
+ if find(lines[i],comment) then
+ first = i + 1
+ else
+ break
+ end
+ end
+ elseif r_first ~= "" then
+ local exact, r_first = match(r_first,"^([=]?)(.*)")
+ for i=first,last do
+ if find(lines[i],r_first) then
+ if exact == "=" then
+ first = i
+ else
+ first = i + 1
+ end
+ break
+ else
+ first = i
+ end
+ end
+ end
+ end
+ if r_last then
+ if l then
+ if l < 0 then
+ l = noflines + l
+ end
+ if find(r_last,"^[%+]") then -- 1,+3
+ l = first + l
+ end
+ if l < last then
+ last = l
+ end
+ elseif r_first == "=" then
+ for i=first,last do
+ if find(lines[i],comment) then
+ break
+ else
+ last = i
+ end
+ end
+ elseif r_last ~= "" then
+ local exact, r_last = match(r_last,"^([=]?)(.*)")
+ for i=first,last do
+ if find(lines[i],r_last) then
+ if exact == "=" then
+ last = i
+ end
+ break
+ else
+ last = i
+ end
+ end
+ end
+ end
+ return first, last
+end
+
+local tablength = 7
+
+local function dotabs(content,settings)
+ local tab = settings.tab
+ tab = tab and (tab == v_yes and tablength or tonumber(tab))
+ if tab then
+ return tabtospace(content,tab)
+ else
+ return content
+ end
+end
+
+local function filter(lines,settings) -- todo: inline or display in settings
+ local strip = settings.strip
+ -- if strip and strip == "" then
+ if strip ~= v_no and strip ~= false then
+ lines = realign(lines,strip)
+ end
+ local line = 0
+ local n = 0
+ local range = settings.range
+ local first, last, m = getstrip(lines)
+ if range then
+ first, last = getrange(lines,first,last,range)
+ first, last = getstrip(lines,first,last)
+ end
+ -- \r is \endlinechar but \n would is more generic so this choice is debatable
+ local content = concat(lines,(settings.nature == "inline" and " ") or "\n",first,last)
+ return content, m
+end
+
+local getlines = buffers.getlines
+
+-- local decodecomment = resolvers.macros.decodecomment -- experiment
+
+local function typebuffer(settings)
+ local lines = getlines(settings.name)
+ if lines then
+ ctx_displayverbatiminitialize(#lines)
+ local content, m = filter(lines,settings)
+ if content and content ~= "" then
+ -- content = decodecomment(content)
+ content = dotabs(content,settings)
+ visualize(content,checkedsettings(settings,"display"))
+ end
+ end
+end
+
+local function processbuffer(settings)
+ local lines = getlines(settings.name)
+ if lines then
+ local content, m = filter(lines,settings)
+ if content and content ~= "" then
+ content = dotabs(content,settings)
+ visualize(content,checkedsettings(settings,"direct"))
+ end
+ end
+end
+
+-- not really buffers but it's closely related
+
+-- A string.gsub(str,"(\\.-) +$","%1") is faster than an lpeg when there is a
+-- match but slower when there is no match. But anyway, we need a more clever
+-- parser so we use lpeg.
+--
+-- [[\text ]] [[\text{}]] [[\foo\bar .tex]] [[\text \text ]] [[\text \\ \text ]]
+--
+-- needed in e.g. tabulate (manuals)
+
+local fences = S([[[{]])
+local symbols = S([[!#"$%&'*()+,-./:;<=>?@[]^_`{|}~0123456789]]) -- digits added but maybe split it
+local space = S([[ ]])
+local backslash = S([[\]])
+local nospace = space^1/""
+local endstring = P(-1)
+
+local compactors = {
+ [v_all] = Cs((backslash * (1-backslash-space)^1 * nospace * (endstring + fences + #backslash) + 1)^0),
+ [v_absolute] = Cs((backslash * (1-symbols -space)^1 * nospace * (symbols + backslash ) + 1)^0),
+ [v_last] = Cs((space^1 * endstring/"" + 1)^0),
+}
+
+local function typestring(settings)
+ local content = settings.data
+ if content and content ~= "" then
+ local compact = settings.compact
+ local compactor = compact and compactors[compact]
+ if compactor then
+ content = lpegmatch(compactor,content) or content
+ end
+ -- content = decodecomment(content)
+ -- content = dotabs(content,settings)
+ visualize(content,checkedsettings(settings,"inline"))
+ end
+end
+
+local function typefile(settings)
+ local filename = settings.name
+ local foundname = resolvers.findtexfile(filename)
+ if foundname and foundname ~= "" then
+ local str = resolvers.loadtexfile(foundname)
+ if str and str ~= "" then
+ local regime = settings.regime
+ if regime and regime ~= "" then
+ str = regimes.translate(str,regime)
+ end
+ if str and str~= "" then
+ -- content = decodecomment(content)
+ local lines = splitlines(str)
+ local content, m = filter(lines,settings)
+ if content and content ~= "" then
+ content = dotabs(content,settings)
+ visualize(content,checkedsettings(settings,"display"))
+ end
+ end
+ end
+ end
+end
+
+implement {
+ name = "type",
+ actions = typestring,
+ arguments = {
+ {
+ { "data" },
+-- { "data", "detokened" },
+ { "tab" },
+ { "method" },
+ { "compact" },
+ { "nature" },
+ { "escape" },
+ }
+ }
+}
+
+-- implement {
+-- name = "type_x",
+-- actions = typestring,
+-- arguments = {
+-- {
+-- { "data", "verbatim" },
+-- { "tab" },
+-- { "method" },
+-- { "compact" },
+-- { "nature" },
+-- { "escape" },
+-- }
+-- }
+-- }
+
+-- local function typestring_y(settings)
+-- local content = tex.toks[settings.n]
+-- if content and content ~= "" then
+-- local compact = settings.compact
+-- local compactor = compact and compactors[compact]
+-- if compactor then
+-- content = lpegmatch(compactor,content)
+-- end
+-- -- content = decodecomment(content)
+-- -- content = dotabs(content,settings)
+-- visualize(content,checkedsettings(settings,"inline"))
+-- end
+-- end
+
+-- implement {
+-- name = "type_y",
+-- actions = typestring_y,
+-- arguments = {
+-- {
+-- { "n", "integer" },
+-- { "tab" },
+-- { "method" },
+-- { "compact" },
+-- { "nature" },
+-- { "escape" },
+-- }
+-- }
+-- }
+
+implement {
+ name = "processbuffer",
+ actions = processbuffer,
+ arguments = {
+ {
+ { "name" },
+ { "strip" },
+ { "tab" },
+ { "method" },
+ { "nature" },
+ }
+ }
+}
+
+implement {
+ name = "typebuffer",
+ actions = typebuffer,
+ arguments = {
+ {
+ { "name" },
+ { "strip" },
+ { "range" },
+ { "regime" },
+ { "tab" },
+ { "method" },
+ { "escape" },
+ { "nature" },
+ }
+ }
+}
+
+implement {
+ name = "typefile",
+ actions = typefile,
+ arguments = {
+ {
+ { "name" },
+ { "strip" },
+ { "range" },
+ { "regime" },
+ { "tab" },
+ { "method" },
+ { "escape" },
+ { "nature" },
+ }
+ }
+}
+
+implement {
+ name = "doifelsevisualizer",
+ actions = { visualizers.getspecification, commands.doifelse },
+ arguments = "string"
+}
+
+implement {
+ name = "loadvisualizer",
+ actions = visualizers.load,
+ arguments = "string"
+}
diff --git a/tex/context/base/mkxl/buff-ver.mkxl b/tex/context/base/mkxl/buff-ver.mkxl
index 8c42694a3..145613877 100644
--- a/tex/context/base/mkxl/buff-ver.mkxl
+++ b/tex/context/base/mkxl/buff-ver.mkxl
@@ -15,7 +15,7 @@
\writestatus{loading}{ConTeXt Buffer Macros / Verbatim}
-\registerctxluafile{buff-ver}{}
+\registerctxluafile{buff-ver}{autosuffix}
\unprotect
@@ -310,6 +310,7 @@
\dostarttaggedchained\t!verbatim\currenttype\??type
\clf_type
data {\detokenize{#1}}%
+% data {#1}%
tab {\typeparameter\c!tab}%
method {\p_buff_option}%
compact {\typeparameter\c!compact}% % none | all | last (all needed in tabulate etc for manuals)
diff --git a/tex/context/base/mkxl/chem-str.mkxl b/tex/context/base/mkxl/chem-str.mkxl
index a4a974de1..227f98c4b 100644
--- a/tex/context/base/mkxl/chem-str.mkxl
+++ b/tex/context/base/mkxl/chem-str.mkxl
@@ -273,11 +273,11 @@
\setbox\scratchboxthree\hpack to \d_chem_width{\strut\hss\hbox{\strut\m_chem_bot_text}\hss}%
\setbox\b_chem_result\hpack \bgroup
\box\b_chem_result
- \hskip-\d_chem_width
+ \kern-\d_chem_width
\raise\d_chem_height\hpack{\lower\ht\scratchboxtwo\box\scratchboxtwo}%
- \hskip-\d_chem_width
+ \kern-\d_chem_width
\lower.5\dimexpr\ht\scratchboxone-\dp\scratchboxone\relax\box\scratchboxone
- \hskip-\d_chem_width
+ \kern-\d_chem_width
\lower\d_chem_depth\hpack{\raise\dp\scratchboxthree\box\scratchboxthree}%
\hss
\egroup} % text on top of chemicals
@@ -544,8 +544,8 @@
\definechemicalsymbol[i:equilibrium] [\enspace\mathematics{\xrightoverleftarrow{}{}}\enspace]
\definechemicalsymbol[i:mesomeric] [\enspace\mathematics{\xleftrightarrow{}{}}\enspace]
\definechemicalsymbol[i:single] [\chemicalbondrule]
-\definechemicalsymbol[i:double] [\hpack{\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
-\definechemicalsymbol[i:triple] [\hpack{\chemicalbondrule\hskip-1em\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
+\definechemicalsymbol[i:double] [\hpack{\lower.5ex\chemicalbondrule\kern-\emwidth\raise.5\exheight\chemicalbondrule}]
+\definechemicalsymbol[i:triple] [\hpack{\chemicalbondrule\kern-\emwidth\lower.5\exheight\chemicalbondrule\kern-\emwidth\raise.5\exheight\chemicalbondrule}]
\permanent\protected\def\chemicalsinglebond {\chemicalsymbol[i:single]}
\permanent\protected\def\chemicaldoublebond {\chemicalsymbol[i:double]}
@@ -614,8 +614,8 @@
\definechemicalsymbol[d:equilibrium] [\cleftarrow]
\definechemicalsymbol[d:mesomeric] [\crightoverleftarrow]
\definechemicalsymbol[d:single] [\chemicalbondrule]
-\definechemicalsymbol[d:double] [\hpack{\lower.5\exheight\chemicalbondrule\hskip-\emwidth\raise.5\exheight\chemicalbondrule}]
-\definechemicalsymbol[d:triple] [\hpack{\chemicalbondrule\hskip-\emwidth\lower.5\exheight\chemicalbondrule\hskip-\emwidth\raise.5\exheight\chemicalbondrule}]
+\definechemicalsymbol[d:double] [\hpack{\lower.5\exheight\chemicalbondrule\kern-\emwidth\raise.5\exheight\chemicalbondrule}]
+\definechemicalsymbol[d:triple] [\hpack{\chemicalbondrule\kern-\emwidth\lower.5\exheight\chemicalbondrule\kern-\emwidth\raise.5\exheight\chemicalbondrule}]
\definechemicalsymbol[d:opencomplex] [\mathematics{\Bigg[}] % not yet ok
\definechemicalsymbol[d:closecomplex][\mathematics{\Bigg]}] % not yet ok
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index b8b8f8562..fb9c31af8 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2023.05.08 17:36}
+\newcontextversion{2023.05.27 12:11}
%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
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 3f878c72c..73864fbe6 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2023.05.08 17:36}
+\immutable\edef\contextversion{2023.05.27 12:11}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -655,8 +655,7 @@
%
% % luat-bas.mkxl l-macro-imp-optimize % this is no longer used
-% c:/data/develop/context/sources/buff-par.lua
-% c:/data/develop/context/sources/buff-ver.lua
+% c:/data/develop/context/sources/buff-par.lua % parallel
%
% c:/data/develop/context/sources/buff-imp-default.lua % shared
% c:/data/develop/context/sources/buff-imp-escaped.lua % shared
@@ -758,7 +757,7 @@
% c:/data/develop/context/sources/luat-iop.lua
% c:/data/develop/context/sources/luat-mac.lua % will become lmt
-% c:/data/develop/context/sources/lxml-aux.lua % the xml interfcace is rather stable
+% c:/data/develop/context/sources/lxml-aux.lua % the xml interface is rather stable
% c:/data/develop/context/sources/lxml-css.lua % and is also provided/used in lua so
% c:/data/develop/context/sources/lxml-dir.lua % might as well share these because they
% c:/data/develop/context/sources/lxml-ent.lua % are unlikely to change
@@ -787,17 +786,17 @@
% c:/data/develop/context/sources/page-mix.lua
% c:/data/develop/context/sources/page-pst.lua
-% c:/data/develop/context/sources/publ-aut.lua % shared
-% c:/data/develop/context/sources/publ-dat.lua % shared
-% c:/data/develop/context/sources/publ-fnd.lua % shared
-% c:/data/develop/context/sources/publ-inc.lua % shared
-% c:/data/develop/context/sources/publ-ini.lua % shared
-% c:/data/develop/context/sources/publ-jrn.lua % shared
-% c:/data/develop/context/sources/publ-oth.lua % shared
-% c:/data/develop/context/sources/publ-reg.lua % shared
-% c:/data/develop/context/sources/publ-sor.lua % shared
-% c:/data/develop/context/sources/publ-tra.lua % shared
-% c:/data/develop/context/sources/publ-usr.lua % shared
+% c:/data/develop/context/sources/publ-aut.lua % These files are shared and it makes
+% c:/data/develop/context/sources/publ-dat.lua % no sense to make lmtx variants (yet),
+% c:/data/develop/context/sources/publ-fnd.lua %
+% c:/data/develop/context/sources/publ-inc.lua %
+% c:/data/develop/context/sources/publ-ini.lua %
+% c:/data/develop/context/sources/publ-jrn.lua %
+% c:/data/develop/context/sources/publ-oth.lua %
+% c:/data/develop/context/sources/publ-reg.lua %
+% c:/data/develop/context/sources/publ-sor.lua %
+% c:/data/develop/context/sources/publ-tra.lua %
+% c:/data/develop/context/sources/publ-usr.lua %
% c:/data/develop/context/sources/scrn-but.lua
% c:/data/develop/context/sources/scrn-fld.lua
@@ -822,9 +821,7 @@
% c:/data/develop/context/sources/strc-usr.lua
% c:/data/develop/context/sources/syst-cmp.lua -- nothing
-% c:/data/develop/context/sources/syst-con.lua
% c:/data/develop/context/sources/trac-ctx.lua
% c:/data/develop/context/sources/trac-lmx.lua
% c:/data/develop/context/sources/trac-par.lua
-% c:/data/develop/context/sources/trac-tex.lua
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index be156affb..48fbe1ad6 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -392,7 +392,6 @@ local flush_character do
if v and v ~= 0 then
pos_v = pos_v + v * sy
end
-print("6>",fnt)
flushchar(fnt,c,csx,csy)
pos_h = ph
pos_v = pv
@@ -524,7 +523,6 @@ print("6>",fnt)
local okay = fonts and fonts[index]
if okay then
fnt = okay.id or fnt -- or maybe just return
-print("7>",fnt)
end
elseif command == "lua" then
local code = packet[2]
diff --git a/tex/context/base/mkxl/file-job.mklx b/tex/context/base/mkxl/file-job.mklx
index 1c57a832d..b7883ddcd 100644
--- a/tex/context/base/mkxl/file-job.mklx
+++ b/tex/context/base/mkxl/file-job.mklx
@@ -355,7 +355,7 @@
% \fi
% \lastnamedcs}
-\permanent\protected\def\samplefile#1{\clf_samplefile{#1}}
+% \permanent\protected\def\samplefile#1{\clf_samplefile{#1}} % defined at the lua end
% \adddefaultsuffix[foo,{},crap]
% \adddefaultsuffix[{}]
diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt
index 113cade52..af4bf919a 100644
--- a/tex/context/base/mkxl/font-ctx.lmt
+++ b/tex/context/base/mkxl/font-ctx.lmt
@@ -1601,13 +1601,14 @@ do -- else too many locals
-- here
- local infofont = 0
+ local infofont = table.setmetatableindex(function(t,k)
+ local v = define { name = "dejavusansmono", size = texsp("6pt") }
+ t[k] = v
+ return v
+ end)
- function fonts.infofont()
- if infofont == 0 then
- infofont = define { name = "dejavusansmono", size = texsp("6pt") }
- end
- return infofont
+ function fonts.infofont(small)
+ return infofont[small == true and "3pt" or "6pt"]
end
-- abstract interfacing : we could actually do a runmacro or so
diff --git a/tex/context/base/mkxl/font-dsp.lmt b/tex/context/base/mkxl/font-dsp.lmt
index a1bf6f641..8746f4712 100644
--- a/tex/context/base/mkxl/font-dsp.lmt
+++ b/tex/context/base/mkxl/font-dsp.lmt
@@ -755,8 +755,8 @@ local function readposition(f,format,mainoffset,getdelta)
local Y = (format & 0x20) ~= 0 and skipshort(f) or 0
local H = (format & 0x40) ~= 0 and skipshort(f) or 0
local V = (format & 0x80) ~= 0 and skipshort(f) or 0
- -- local s = skips[extract(format,4,4)]
- local s = skips[(format >> 4) & 0xF]
+ -- local s = skips[extract(format,4,4)]
+ local s = skips[(format >> 4) & 0xF]
if s > 0 then
skipshort(f,s)
end
@@ -3145,9 +3145,18 @@ do
local linesdata -- for the moment verbose, will be just indexed
local affinedata -- for the moment verbose, will be just indexed
+local layerlistoffset
+local layeroffset
+
+local paintindex
+
local function getpaintoffset(f,offset)
- offset = offset + readuoffset(f)
- return paintdata[offset] and offset or nil
+ local o = readuoffset(f)
+ if o == 0 then
+ --
+ else
+ return paintdata[offset+o] -- and offset or nil
+ end
end
local function getlinesoffset(f,offset,var)
@@ -3166,138 +3175,138 @@ do
return offset
end
- paintreaders = {
+ local paintreaders = {
-- uint8 numLayers Number of offsets to paint tables to read from LayerList.
-- uint32 firstLayerIndex Index (base 0) into the LayerList.
- [1] = function(f,format)
- return {
- format = format,
- name = "PaintColrLayers",
- count = readuinteger(f),
- index = readulong(f),
- list = false,
- }
- end,
- -- uint16 paletteIndex Index for a CPAL palette entry.
- -- F2DOT14 alpha Alpha value.
- [2] = function(f,format)
- return {
- format = format,
- name = "Paintsolid",
- palette = readushort(f),
- alpha = read2dot14(f),
- }
- end,
- -- uint16 paletteIndex Index for a CPAL palette entry.
- -- F2DOT14 alpha Alpha value. For variation, use varIndexBase + 0.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [3] = function(f,format)
- return {
- format = format,
- name = "Paintsolid",
- palette = readushort(f),
- alpha = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 colorLineOffset Offset to VarColorLine table.
- -- FWORD x0 Start point (p₀) x coordinate. For variation, use varIndexBase + 0.
- -- FWORD y0 Start point (p₀) y coordinate. For variation, use varIndexBase + 1.
- -- FWORD x1 End point (p₁) x coordinate. For variation, use varIndexBase + 2.
- -- FWORD y1 End point (p₁) y coordinate. For variation, use varIndexBase + 3.
- -- FWORD x2 Rotation point (p₂) x coordinate. For variation, use varIndexBase + 4.
- -- FWORD y2 Rotation point (p₂) y coordinate. For variation, use varIndexBase + 5.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [4] = function(f,format,offset)
- return {
- format = format,
- name = "PaintLinearGradient",
- color = getlinesoffset(f,offset,false),
- x0 = readfword(f),
- y0 = readfword(f),
- x1 = readfword(f),
- y1 = readfword(f),
- x2 = readfword(f),
- y2 = readfword(f),
- }
- end,
- [5] = function(f,format,offset)
- return {
- format = format,
- name = "PaintLinearGradient",
- color = getlinesoffset(f,offset,true),
- x0 = readfword(f),
- y0 = readfword(f),
- x1 = readfword(f),
- y1 = readfword(f),
- x2 = readfword(f),
- y2 = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 colorLineOffset Offset to VarColorLine table.
- -- FWORD x0 Start circle center x coordinate. For variation, use varIndexBase + 0.
- -- FWORD y0 Start circle center y coordinate. For variation, use varIndexBase + 1.
- -- UFWORD radius0 Start circle radius. For variation, use varIndexBase + 2.
- -- FWORD x1 End circle center x coordinate. For variation, use varIndexBase + 3.
- -- FWORD y1 End circle center y coordinate. For variation, use varIndexBase + 4.
- -- UFWORD radius1 End circle radius. For variation, use varIndexBase + 5.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [6] = function(f,format)
- return {
- format = format,
- name = "PaintRadialGradient",
- color = getlinesoffset(f,offset,false),
- x0 = readfword(f),
- y0 = readfword(f),
- radius0 = readfword(f),
- x1 = readfword(f),
- y1 = readfword(f),
- radius1 = readfword(f),
- }
- end,
- [7] = function(f,format)
- return {
- format = format,
- name = "PaintRadialGradient",
- color = getlinesoffset(f,offset,true),
- x0 = readfword(f),
- y0 = readfword(f),
- radius0 = readfword(f),
- x1 = readfword(f),
- y1 = readfword(f),
- radius1 = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 colorLineOffset Offset to VarColorLine table.
- -- FWORD centerX Center x coordinate. For variation, use varIndexBase + 0.
- -- FWORD centerY Center y coordinate. For variation, use varIndexBase + 1.
- -- F2DOT14 startAngle Start of the angular range of the gradient, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 2.
- -- F2DOT14 endAngle End of the angular range of the gradient, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 3.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [8] = function(f,format)
- return {
- format = format,
- name = "PaintSweepGradient",
- color = getlinesoffset(f,offset,false),
- centerx = readfword(f),
- centery = readfword(f),
- startangle = read2dot14(f),
- endangle = read2dot14(f),
- }
- end,
- [9] = function(f,format)
- return {
- format = format,
- name = "PaintSweepGradient",
- color = getlinesoffset(f,offset,true),
- centerx = readfword(f),
- centery = readfword(f),
- startangle = read2dot14(f),
- endangle = read2dot14(f),
- varbase = readulong(f),
- }
+ [1] = function(f,format)
+ return {
+ format = format,
+ name = "PaintColrLayers",
+ count = readuinteger(f),
+ index = readulong(f),
+ list = false,
+ }
+ end,
+ -- uint16 paletteIndex Index for a CPAL palette entry.
+ -- F2DOT14 alpha Alpha value.
+ [2] = function(f,format)
+ return {
+ format = format,
+ name = "Paintsolid",
+ palette = readushort(f),
+ alpha = read2dot14(f),
+ }
+ end,
+ -- uint16 paletteIndex Index for a CPAL palette entry.
+ -- F2DOT14 alpha Alpha value. For variation, use varIndexBase + 0.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [3] = function(f,format)
+ return {
+ format = format,
+ name = "Paintsolid",
+ palette = readushort(f),
+ alpha = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 colorLineOffset Offset to VarColorLine table.
+ -- FWORD x0 Start point (p₀) x coordinate. For variation, use varIndexBase + 0.
+ -- FWORD y0 Start point (p₀) y coordinate. For variation, use varIndexBase + 1.
+ -- FWORD x1 End point (p₁) x coordinate. For variation, use varIndexBase + 2.
+ -- FWORD y1 End point (p₁) y coordinate. For variation, use varIndexBase + 3.
+ -- FWORD x2 Rotation point (p₂) x coordinate. For variation, use varIndexBase + 4.
+ -- FWORD y2 Rotation point (p₂) y coordinate. For variation, use varIndexBase + 5.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [4] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintLinearGradient",
+ color = getlinesoffset(f,offset,false),
+ x0 = readfword(f),
+ y0 = readfword(f),
+ x1 = readfword(f),
+ y1 = readfword(f),
+ x2 = readfword(f),
+ y2 = readfword(f),
+ }
+ end,
+ [5] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintLinearGradient",
+ color = getlinesoffset(f,offset,true),
+ x0 = readfword(f),
+ y0 = readfword(f),
+ x1 = readfword(f),
+ y1 = readfword(f),
+ x2 = readfword(f),
+ y2 = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 colorLineOffset Offset to VarColorLine table.
+ -- FWORD x0 Start circle center x coordinate. For variation, use varIndexBase + 0.
+ -- FWORD y0 Start circle center y coordinate. For variation, use varIndexBase + 1.
+ -- UFWORD radius0 Start circle radius. For variation, use varIndexBase + 2.
+ -- FWORD x1 End circle center x coordinate. For variation, use varIndexBase + 3.
+ -- FWORD y1 End circle center y coordinate. For variation, use varIndexBase + 4.
+ -- UFWORD radius1 End circle radius. For variation, use varIndexBase + 5.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [6] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRadialGradient",
+ color = getlinesoffset(f,offset,false),
+ x0 = readfword(f),
+ y0 = readfword(f),
+ radius0 = readfword(f),
+ x1 = readfword(f),
+ y1 = readfword(f),
+ radius1 = readfword(f),
+ }
+ end,
+ [7] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRadialGradient",
+ color = getlinesoffset(f,offset,true),
+ x0 = readfword(f),
+ y0 = readfword(f),
+ radius0 = readfword(f),
+ x1 = readfword(f),
+ y1 = readfword(f),
+ radius1 = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 colorLineOffset Offset to VarColorLine table.
+ -- FWORD centerX Center x coordinate. For variation, use varIndexBase + 0.
+ -- FWORD centerY Center y coordinate. For variation, use varIndexBase + 1.
+ -- F2DOT14 startAngle Start of the angular range of the gradient, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 2.
+ -- F2DOT14 endAngle End of the angular range of the gradient, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 3.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [8] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSweepGradient",
+ color = getlinesoffset(f,offset,false),
+ centerx = readfword(f),
+ centery = readfword(f),
+ startangle = read2dot14(f),
+ endangle = read2dot14(f),
+ }
+ end,
+ [9] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSweepGradient",
+ color = getlinesoffset(f,offset,true),
+ centerx = readfword(f),
+ centery = readfword(f),
+ startangle = read2dot14(f),
+ endangle = read2dot14(f),
+ varbase = readulong(f),
+ }
end,
-- Offset24 paintOffset Offset to a Paint table.
-- uint16 glyphID Glyph ID for the source outline.
@@ -3310,269 +3319,273 @@ do
}
end,
-- uint16 glyphID Glyph ID for a BaseGlyphList base glyph.
- [11] = function(f,format)
- return {
- format = format,
- name = "PaintColrGlyph",
- glyph = readushort(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- Offset24 transformOffset Offset to an (Var)Affine2x3 table.
- [12] = function(f,format,offset)
- return {
- format = format,
- name = "PaintTransform",
- affine = getaffineoffset(f,offset,false),
- paint = getpaintoffset(f,offset),
- }
- end,
- [13] = function(f,format,offset)
- return {
- format = format,
- name = "PaintTransform",
- affine = getaffineoffset(f,offset,true),
- paint = getpaintoffset(f,offset),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- FWORD dx Translation in x direction. For variation, use varIndexBase + 0.
- -- FWORD dy Translation in y direction. For variation, use varIndexBase + 1.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [14] = function(f,format,offset)
- return {
- format = format,
- name = "PaintTranslate",
- paint = getpaintoffset(f,offset),
- dx = readfword(f),
- dy = readfword(f),
- }
- end,
- [15] = function(f,format,offset)
- return {
- format = format,
- name = "PaintTranslate",
- paint = getpaintoffset(f,offset),
- dx = readfword(f),
- dy = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 scaleX Scale factor in x direction. For variation, use varIndexBase + 0.
- -- F2DOT14 scaleY Scale factor in y direction. For variation, use varIndexBase + 1.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [16] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scalex = read2dot14(f),
- scaley = read2dot14(f),
- }
- end,
- [17] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scalex = read2dot14(f),
- scaley = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 scaleX Scale factor in x direction. For variation, use varIndexBase + 0.
- -- F2DOT14 scaleY Scale factor in y direction. For variation, use varIndexBase + 1.
- -- FWORD centerX x coordinate for the center of scaling. For variation, use varIndexBase + 2.
- -- FWORD centerY y coordinate for the center of scaling. For variation, use varIndexBase + 3.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [18] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scalex = read2dot14(f),
- scaley = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- }
- end,
- [19] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scalex = read2dot14(f),
- scaley = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 scale Scale factor in x and y directions. For variation, use varIndexBase + 0.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [20] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scale = read2dot14(f),
- }
- end,
- [21] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scale = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 scale Scale factor in x and y directions. For variation, use varIndexBase + 0.
- -- FWORD centerX x coordinate for the center of scaling. For variation, use varIndexBase + 1.
- -- FWORD centerY y coordinate for the center of scaling. For variation, use varIndexBase + 2.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [22] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scale = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- }
- end,
- [23] = function(f,format,offset)
- return {
- format = format,
- name = "PaintScale",
- paint = getpaintoffset(f,offset),
- scale = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 angle Rotation angle, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [24] = function(f,format,offset)
- return {
- format = format,
- angle = read2dot14(f),
- paint = getpaintoffset(f,offset),
- name = "PaintRotate",
- }
- end,
- [25] = function(f,format,offset)
- return {
- format = format,
- name = "PaintRotate",
- paint = getpaintoffset(f,offset),
- angle = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 angle Rotation angle, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
- -- FWORD centerX x coordinate for the center of rotation. For variation, use varIndexBase + 1.
- -- FWORD centerY y coordinate for the center of rotation. For variation, use varIndexBase + 2.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [26] = function(f,format,offset)
- return {
- format = format,
- name = "PaintRotate",
- paint = getpaintoffset(f,offset),
- centerx = readfword(f),
- centery = readfword(f),
- }
- end,
- [27] = function(f,format,offset)
- return {
- format = format,
- name = "PaintRotate",
- paint = getpaintoffset(f,offset),
- centerx = read2dot14(f),
- centery = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 xSkewAngle Angle of skew in the direction of the x-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
- -- F2DOT14 ySkewAngle Angle of skew in the direction of the y-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 1.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [28] = function(f,format,offset)
- return {
- format = format,
- name = "PaintSkew",
- paint = getpaintoffset(f,offset),
- xangle = read2dot14(f),
- yangle = read2dot14(f),
- }
- end,
- [29] = function(f,format,offset)
- return {
- format = format,
- name = "PaintSkew",
- paint = getpaintoffset(f,offset),
- xangle = read2dot14(f),
- yangle = read2dot14(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 paintOffset Offset to a Paint subtable.
- -- F2DOT14 xSkewAngle Angle of skew in the direction of the x-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
- -- F2DOT14 ySkewAngle Angle of skew in the direction of the y-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 1.
- -- FWORD centerX x coordinate for the center of rotation. For variation, use varIndexBase + 2.
- -- FWORD centerY y coordinate for the center of rotation. For variation, use varIndexBase + 3.
- -- uint32 varIndexBase Base index into DeltaSetIndexMap.
- [30] = function(f,format,offset)
- return {
- format = format,
- name = "PaintSkew",
- paint = getpaintoffset(f,offset),
- xangle = read2dot14(f),
- yangle = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- }
- end,
- [31] = function(f,format,offset)
- return {
- format = format,
- name = "PaintSkew",
- paint = getpaintoffset(f,offset),
- xangle = read2dot14(f),
- yangle = read2dot14(f),
- centerx = readfword(f),
- centery = readfword(f),
- varbase = readulong(f),
- }
- end,
- -- Offset24 sourcePaintOffset Offset to a source Paint table.
- -- uint8 compositeMode A CompositeMode enumeration value.
- -- Offset24 backdropaintOffset Offset to a backdrop Paint table.
- [32] = function(f,format,offset)
- return {
- format = format,
- name = "PaintComposite",
- source = getpaintoffset(f,offset),
- mode = readuinteger(f),
- backdrop = getpaintoffset(f,offset),
- }
- end,
+ [11] = function(f,format)
+ return {
+ format = format,
+ name = "PaintColrGlyph",
+ glyph = readushort(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- Offset24 transformOffset Offset to an (Var)Affine2x3 table.
+ [12] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintTransform",
+ affine = getaffineoffset(f,offset,false),
+ paint = getpaintoffset(f,offset),
+ }
+ end,
+ [13] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintTransform",
+ affine = getaffineoffset(f,offset,true),
+ paint = getpaintoffset(f,offset),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- FWORD dx Translation in x direction. For variation, use varIndexBase + 0.
+ -- FWORD dy Translation in y direction. For variation, use varIndexBase + 1.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [14] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintTranslate",
+ paint = getpaintoffset(f,offset),
+ dx = readfword(f),
+ dy = readfword(f),
+ }
+ end,
+ [15] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintTranslate",
+ paint = getpaintoffset(f,offset),
+ dx = readfword(f),
+ dy = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 scaleX Scale factor in x direction. For variation, use varIndexBase + 0.
+ -- F2DOT14 scaleY Scale factor in y direction. For variation, use varIndexBase + 1.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [16] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scalex = read2dot14(f),
+ scaley = read2dot14(f),
+ }
+ end,
+ [17] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scalex = read2dot14(f),
+ scaley = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 scaleX Scale factor in x direction. For variation, use varIndexBase + 0.
+ -- F2DOT14 scaleY Scale factor in y direction. For variation, use varIndexBase + 1.
+ -- FWORD centerX x coordinate for the center of scaling. For variation, use varIndexBase + 2.
+ -- FWORD centerY y coordinate for the center of scaling. For variation, use varIndexBase + 3.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [18] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scalex = read2dot14(f),
+ scaley = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ }
+ end,
+ [19] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scalex = read2dot14(f),
+ scaley = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 scale Scale factor in x and y directions. For variation, use varIndexBase + 0.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [20] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scale = read2dot14(f),
+ }
+ end,
+ [21] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scale = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 scale Scale factor in x and y directions. For variation, use varIndexBase + 0.
+ -- FWORD centerX x coordinate for the center of scaling. For variation, use varIndexBase + 1.
+ -- FWORD centerY y coordinate for the center of scaling. For variation, use varIndexBase + 2.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [22] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scale = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ }
+ end,
+ [23] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintScale",
+ paint = getpaintoffset(f,offset),
+ scale = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 angle Rotation angle, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [24] = function(f,format,offset)
+ return {
+ format = format,
+ angle = read2dot14(f),
+ paint = getpaintoffset(f,offset),
+ name = "PaintRotate",
+ }
+ end,
+ [25] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRotate",
+ paint = getpaintoffset(f,offset),
+ angle = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 angle Rotation angle, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
+ -- FWORD centerX x coordinate for the center of rotation. For variation, use varIndexBase + 1.
+ -- FWORD centerY y coordinate for the center of rotation. For variation, use varIndexBase + 2.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [26] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRotate",
+ paint = getpaintoffset(f,offset),
+ centerx = readfword(f),
+ centery = readfword(f),
+ }
+ end,
+ [27] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintRotate",
+ paint = getpaintoffset(f,offset),
+ centerx = read2dot14(f),
+ centery = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 xSkewAngle Angle of skew in the direction of the x-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
+ -- F2DOT14 ySkewAngle Angle of skew in the direction of the y-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 1.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [28] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSkew",
+ paint = getpaintoffset(f,offset),
+ xangle = read2dot14(f),
+ yangle = read2dot14(f),
+ }
+ end,
+ [29] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSkew",
+ paint = getpaintoffset(f,offset),
+ xangle = read2dot14(f),
+ yangle = read2dot14(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 paintOffset Offset to a Paint subtable.
+ -- F2DOT14 xSkewAngle Angle of skew in the direction of the x-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 0.
+ -- F2DOT14 ySkewAngle Angle of skew in the direction of the y-axis, 180° in counter-clockwise degrees per 1.0 of value. For variation, use varIndexBase + 1.
+ -- FWORD centerX x coordinate for the center of rotation. For variation, use varIndexBase + 2.
+ -- FWORD centerY y coordinate for the center of rotation. For variation, use varIndexBase + 3.
+ -- uint32 varIndexBase Base index into DeltaSetIndexMap.
+ [30] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSkew",
+ paint = getpaintoffset(f,offset),
+ xangle = read2dot14(f),
+ yangle = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ }
+ end,
+ [31] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintSkew",
+ paint = getpaintoffset(f,offset),
+ xangle = read2dot14(f),
+ yangle = read2dot14(f),
+ centerx = readfword(f),
+ centery = readfword(f),
+ varbase = readulong(f),
+ }
+ end,
+ -- Offset24 sourcePaintOffset Offset to a source Paint table.
+ -- uint8 compositeMode A CompositeMode enumeration value.
+ -- Offset24 backdropaintOffset Offset to a backdrop Paint table.
+ [32] = function(f,format,offset)
+ return {
+ format = format,
+ name = "PaintComposite",
+ source = getpaintoffset(f,offset),
+ mode = readuinteger(f),
+ backdrop = getpaintoffset(f,offset),
+ }
+ end,
}
local unsupported = function()
- return nil
+ return false
end
setmetatableindex(paintreaders,function(t,format)
- report("unsupported colr type 2 paint format %i",format)
- t[format] = unsupported
+ if format then
+ report("unsupported colr type 2 paint format %S",format)
+ t[format] = unsupported -- problem: we don't know what to skip, so maybe best is to quit
+ else
+ report("possible error reading colr type 2 paint format")
+ end
return unsupported
end)
@@ -3595,10 +3608,12 @@ do
local glyphs = fontdata.glyphs
local nofglyphs = readushort(f)
local baseoffset = readulong(f)
- local layeroffset = readulong(f)
+-- local layeroffset = readulong(f)
+layeroffset = readulong(f)
local noflayers = readushort(f)
local glyphlistoffset = 0
- local layerlistoffset = 0
+-- local layerlistoffset = 0
+layerlistoffset = 0
local cliplistoffset = 0
local varindexmapoffset = 0
local variationoffset = 0
@@ -3614,7 +3629,7 @@ do
-- The special value 0xFFFF is foreground (but we index from 1). It
-- more looks like indices into a palette so 'class' is a better name
-- than 'palette'.
- if layeroffset > 0 then
+ if layeroffset > 0 and noflayers > 0 then
setposition(f,tableoffset + layeroffset)
for i=1,noflayers do
local slot = readushort(f)
@@ -3632,7 +3647,7 @@ do
end
end
fontdata.maxcolorclass = maxclass
- if baseoffset > 0 then
+ if baseoffset > 0 and nofglyphs > 0 then
setposition(f,tableoffset + baseoffset)
for i=0,nofglyphs-1 do
local glyphindex = readushort(f)
@@ -3645,66 +3660,84 @@ do
glyphs[glyphindex].colors = t
end
end
-if next(layerrecords) then
- report("table version %a of %a is %s supported for font %s",version,"colr","partially",fontdata.filename)
- return
-end
+ if next(layerrecords) then
+ report("table version %a of %a is %s supported for font %s",version,"colr","partially",fontdata.filename)
+ return
+ end
-- if not (CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0) then
-- return
-- end
if layerlistoffset > 0 and glyphlistoffset > 0 then
local layers = { }
local paints = { }
- local count, offset
- --
- setposition(f,tableoffset + layerlistoffset)
- count = readulong(f)
- -- layers = readcardinaltable(f,count,uoffset)
- for i=1,count do -- zero ?
+layeroffset = tableoffset + layerlistoffset
+ setposition(f,layeroffset)
+ local layercount = readulong(f)
+ -- layers = readcardinaltable(f,layercount,uoffset)
+ for i=1,layercount do -- zero ?
layers[i] = readulong(f) -- offsets to painttable
end
--
- offset = tableoffset + glyphlistoffset
- setposition(f,offset)
- count = readulong(f)
- for i=1,count do
+ glyphoffset = tableoffset + glyphlistoffset
+ setposition(f,glyphoffset)
+ local glyphcount = readulong(f)
+ for i=1,glyphcount do
-- glyph index -> paintrecord
paints[readushort(f)] = readulong(f) -- paintrecord offset (32 formats)
end
paintdata = setmetatableindex(function(t,k)
+ local p = getposition(f)
setposition(f,k)
local format = readuinteger(f)
local v = paintreaders[format](f,format,k)
+ setposition(f,p)
t[k] = v
return v
end)
linesdata = { }
affinedata = { }
+ for i=1,layercount do -- zero ?
+ local o = layeroffset + layers[i]
+ local l = paintdata[o]
+ if not l then
+ report("color table in font %a has an invalid layer entry %i, offset %i",i,layers[i])
+ end
+ layers[i] = l
+ end
+-- io.savedata("e:/tmp/oeps.lua",table.serialize({ root = paintdata }))
+-- io.savedata("e:/tmp/oeps.lua",table.serialize(layers))
for k, v in next, paints do
- local o = offset + v
+ local o = glyphoffset + v - layeroffset
if paintdata[o] then
paints[k] = o -- first paint
end
end
-- expand format 1
- offset = tableoffset + layerlistoffset
for k, v in next, paints do
v = paintdata[v]
- local format = v.format
- if format == 1 then
- -- name
- local count = v.count
- local index = v.index
- local list = { }
- v.count = nil
- v.index = nil
- v.list = list
- for i=1,count do
- local o = offset + layers[index+i]
- if paintdata[o] then
- list[i] = o
+ if v then
+ local format = v.format
+ if format == 1 then
+ -- name
+ local count = v.count
+ if count then
+ local index = v.index + 1
+ local list = { }
+ v.count = nil
+ v.index = nil
+ v.list = list
+ for i=1,count do
+-- local o = layeroffset + layers[index+i]
+-- if paintdata[o] then
+ list[i] = layers[index]
+ index = index + 1
+ end
+ else
+ -- already done
end
end
+ else
+ -- missing
end
end
--
@@ -3732,18 +3765,27 @@ end
local extend = readuinteger(f)
local count = readushort(f)
local stops = { }
- for i=1,count do
- stops[i] = {
- stop = read2dot14(f),
- pallette = readushort(f),
- alpha = read2dot14(f),
- varbase = v and readulong(f) or nil,
+ if count then
+ for i=1,count do
+ stops[i] = {
+ stop = read2dot14(f),
+ pallette = readushort(f),
+ alpha = read2dot14(f),
+ varbase = v and readulong(f) or nil,
+ }
+ end
+ linesdata[k] = {
+ extend = readuinteger(f),
+ stops = stops,
+ }
+ else
+ report("running out of linedata in colr reading")
+ linesdata[k] = {
+ extend = 0,
+ stops = stops,
}
+ break
end
- linesdata[k] = {
- extend = readuinteger(f),
- stops = stops,
- }
end
--
for k, v in next, affinedata do
@@ -3775,6 +3817,9 @@ end
local lhash, ldata = rehash(linesdata)
local ahash, adata = rehash(affinedata)
for k, v in next, paintdata do
+if not v then
+ print("todo",k,v)
+else
local c = v.color
if c then
v.color = lhash[c]
@@ -3801,6 +3846,7 @@ end
v.backdrop = phash[v.backdrop]
-- goto done
end
+end
::done::
end
paintdata = pdata
@@ -3815,16 +3861,21 @@ end
local paint = paintdata[v]
local format = paint.format
if format == 1 then
- local list = paint.list
- local done = { }
+ local list = paint.list
+ local done = { }
+ local count = 0
for i=1,#list do
local p = paintdata[list[i]]
local f = p.format
if f == 10 or f == 11 then
- done[i] = {
+ count = count + 1
+ done[count] = {
slot = p.glyph,
class = i,
}
+ else
+ -- print(f)
+ -- missing
end
end
glyphs[k].colors = done
@@ -3837,6 +3888,7 @@ end
-- fontdata.coloraffinedata = affinedata
end
end
+ ::done::
fontdata.hascolor = true
end
diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx
index ea727bde4..ff9e45243 100644
--- a/tex/context/base/mkxl/font-ini.mklx
+++ b/tex/context/base/mkxl/font-ini.mklx
@@ -608,7 +608,7 @@
\def\font_basics_define_fontstyle_indeed#style#command%
{\defcsname\??fontshortstyle#command\endcsname{#style}%
- \defcsname\??fontstyle #command\endcsname{\csname#style\endcsname}}
+ \defcsname\??fontstyle #command\endcsname{\csname#style\endcsname}} % we could pre-expand
\permanent\protected\def\definefontsize[#size]%
{\ifcsname\??fontsizeknown#size\endcsname \else
diff --git a/tex/context/base/mkxl/font-ogr.lmt b/tex/context/base/mkxl/font-ogr.lmt
index 3b4f9f867..a36ee88b4 100644
--- a/tex/context/base/mkxl/font-ogr.lmt
+++ b/tex/context/base/mkxl/font-ogr.lmt
@@ -531,7 +531,12 @@ local initializeoverlay do
-- todo: use extender
local u = { "use", 0 }
for i=1,#colorlist do
- u[i+2] = colorlist[i].slot
+ local c = colorlist[i]
+ if c then
+ u[i+2] = c.slot
+ else
+ -- some error
+ end
end
v.commands = { u, slotcommand[slot][idx] }
-- hack to prevent that type 3 also gets 'use' flags .. todo
diff --git a/tex/context/base/mkxl/lang-rep.lmt b/tex/context/base/mkxl/lang-rep.lmt
index fcaff523a..1f1c1e417 100644
--- a/tex/context/base/mkxl/lang-rep.lmt
+++ b/tex/context/base/mkxl/lang-rep.lmt
@@ -111,28 +111,48 @@ lists[v_reset].attribute = unsetvalue -- so we discard 0
-- todo: glue kern attr
local function add(root,word,replacement)
- local processor, replacement = splitprocessor(replacement,true) -- no check
- replacement = lpegmatch(stripper,replacement) or replacement
- local list = utfsplit(word) -- ,true)
- local size = #list
- for i=1,size do
- local l = utfbyte(list[i])
- if not root[l] then
- root[l] = { }
+ if type(replacement) == "function" then
+ local list = utfsplit(word) -- ,true)
+ local size = #list
+ for i=1,size do
+ local l = utfbyte(list[i])
+ if not root[l] then
+ root[l] = { }
+ end
+ if i == size then
+ root[l].final = {
+ word = word,
+ replacer = replacement,
+ processor = processor,
+ oldlength = size,
+ }
+ end
+ root = root[l]
end
- if i == size then
- local special = find(replacement,"{",1,true)
- local newlist = lpegmatch(splitter,replacement)
- root[l].final = {
- word = word,
- replacement = replacement,
- processor = processor,
- oldlength = size,
- newcodes = newlist,
- special = special,
- }
+ else
+ local processor, replacement = splitprocessor(replacement,true) -- no check
+ replacement = lpegmatch(stripper,replacement) or replacement
+ local list = utfsplit(word) -- ,true)
+ local size = #list
+ for i=1,size do
+ local l = utfbyte(list[i])
+ if not root[l] then
+ root[l] = { }
+ end
+ if i == size then
+ local special = find(replacement,"{",1,true)
+ local newlist = lpegmatch(splitter,replacement)
+ root[l].final = {
+ word = word,
+ replacement = replacement,
+ processor = processor,
+ oldlength = size,
+ newcodes = newlist,
+ special = special,
+ }
+ end
+ root = root[l]
end
- root = root[l]
end
end
@@ -192,16 +212,29 @@ local ispunctuation = characters.is_punctuation
-- for punctuation was added.
local function replace(head,first,last,final,hasspace,overload)
- local current = first
- local prefirst = getprev(first) or head
- local postlast = getnext(last)
- local oldlength = final.oldlength
- local newcodes = final.newcodes
+ local current = first
+ local prefirst = getprev(first) or head
+ local postlast = getnext(last)
+ local oldlength = final.oldlength
+ local newcodes = final.newcodes
+ local word = final.word
+ local replacement = final.replacement
+ local replacer = final.replacer
+ local special = final.special
+ if type(replacer) == "function" then
+ replacement = replacer(word)
+ if type(replacement) == "string" then
+ special = find(replacement,"{",1,true)
+ newcodes = lpegmatch(splitter,replacement)
+ else
+ return
+ end
+ end
local newlength = newcodes and #newcodes or 0
if trace_replacements then
- report_replacement("replacing word %a by %a",final.word,final.replacement)
+ report_replacement("replacing word %a by %a",word,replacement)
end
- if hasspace or final.special then
+ if hasspace or special then
-- It's easier to delete and insert so we do just that. On the todo list is
-- turn injected spaces into glue but easier might be to let the char break
-- handler do that ...
@@ -271,13 +304,13 @@ local function replace(head,first,last,final,hasspace,overload)
elseif newlength == 0 then
-- we overload
elseif oldlength == newlength then
- if final.word ~= final.replacement then
+ if word ~= replacement then
for i=1,newlength do
setchar(current,newcodes[i])
current = getnext(current)
end
end
- current = getnext(final)
+ -- current = getnext(final) -- some left over? no next!
elseif oldlength < newlength then
for i=1,newlength-oldlength do
local n = copy_node(current)
diff --git a/tex/context/base/mkxl/lang-rep.mkxl b/tex/context/base/mkxl/lang-rep.mkxl
index 03b761bb7..f13e2ec7b 100644
--- a/tex/context/base/mkxl/lang-rep.mkxl
+++ b/tex/context/base/mkxl/lang-rep.mkxl
@@ -23,6 +23,7 @@
\definesystemattribute[replacements][public,global]
+%D \starttyping
%D \startluacode
%D
%D -- todo: other nodes (prelude to more experiments with auto dropped caps)
@@ -43,12 +44,27 @@
%D \replaceword[more][---][—]
%D \replaceword[basics][special][veryspe{>>>}{<<<}{=}cial]
%D
-%D \starttyping
%D \start \setreplacements[basics] What the heck, it's now or never, isn't it new? \par \stop
%D \start \setreplacements[more] Do we --- {\it really} --- need this kind of crap? \par \stop
%D \start \setreplacements[basics] All kinds of special thingies! \par \stop
%D \start \setreplacements[basics] \hsize1mm special \par \stop
%D \stoptyping
+%D
+%D Only in \LUA, functions:
+%D
+%D \startluacode
+%D languages.replacements.add("basics", {
+%D ["one"] = "cool",
+%D ["two"] = function(s)
+%D return "warm"
+%D end
+%D })
+%D \stopluacode
+%D
+%D \starttyping
+%D \start \setreplacements[basics] It's one in here! \stop \par
+%D \start \setreplacements[basics] It's two in here! \stop \par
+%D \stoptyping
\permanent\protected\def\setreplacements[#1]%
{\clf_setreplacements{#1}}
diff --git a/tex/context/base/mkxl/lang-tra.lmt b/tex/context/base/mkxl/lang-tra.lmt
index 259165928..28a534dc3 100644
--- a/tex/context/base/mkxl/lang-tra.lmt
+++ b/tex/context/base/mkxl/lang-tra.lmt
@@ -87,13 +87,14 @@ local converters = {
-- end,
["mapping"] = function(m)
local t_mapping = m.mapping
+-- inspect(t_mapping)
if t_mapping then
local t_exceptions = m.exceptions
local p = Cs ( (
utfchartabletopattern(t_mapping) / t_mapping
+ C(utfcharacterpattern)
)^0 )
- -- lpeg.print(p)
+-- lpeg.print(p)
return function(s,e)
return (e and e[s]) or t_exceptions[s] or lpegmatch(p,s) or s
end
@@ -114,7 +115,7 @@ function transliteration.use(library)
if lib == nil then
-- todo: use library loader
local data = require("lang-imp-" .. library)
- if data then
+ if type(data) == "table" then
local transliterations = data.transliterations
if transliterations then
for name, d in table.sortedhash(transliterations) do
diff --git a/tex/context/base/mkxl/lang-tra.mkxl b/tex/context/base/mkxl/lang-tra.mkxl
index 66a020a14..402251f36 100644
--- a/tex/context/base/mkxl/lang-tra.mkxl
+++ b/tex/context/base/mkxl/lang-tra.mkxl
@@ -87,53 +87,163 @@
\protect \endinput
-% \setupbodyfont[dejavu]
+% \starttext
+%
+% \switchtobodyfont[shobhika]
+%
+% \usetransliteration[indic]
+%
+% \definetransliteration
+% [MyDeva]
+% [color=blue,
+% vector={iast to deva}]
+%
+% \definetransliteration
+% [MyDevaB]
+% [MyDeva]
+% [color=green]
+%
+% \transliterationexception[iast to deva]{kauśika}{whoever}
+% \transliterationexception[MyDeva] {kauśika}{hans}
+% \transliterationexception[MyDevaB] {kauśika}{knuth}
%
-% \input lang-tra.mkiv
+% \starttransliteration[MyDeva]
+% idaṁ adbhutam kauśika tisraḥ garuḍavāhanan%
+% \stoptransliteration
%
-% \definetransliteration[serbian][serbian to latin]
+% \starttransliteration[MyDevaB]
+% idaṁ adbhutam kauśika tisraḥ garuḍavāhanan%
+% \stoptransliteration
+%
+% \stoptext
+%
+% \setupbodyfont[dejavu]
+%
+% \setupalign[tolerant,stretch]
%
% \starttext
%
-% \settransliteration[serbian to latin]
+% % \enabletrackers[languages.transliteration]
%
-% \startchapter[title={АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}]
-% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \start
-% \settransliteration[serbian to latin]
-% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \stop
-% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \stopchapter
+% \usetransliteration[serbian] %at some point we can preload
%
-% \resettransliteration
+% \definetransliteration
+% [MySerbian]
+% [color=red,
+% language=en,
+% vector={serbian to latin}]
%
-% \startchapter[title={АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}]
+% \definetransliteration
+% [MySerbianX]
+% [MySerbian]
+% [color=blue]
+%
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
+% \start
+% \settransliteration[serbian to latin]
% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \start
-% \settransliteration[serbian to latin]
-% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \stop
+% \stop
+% \starttransliteration[MySerbian]%
% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
-% \stopchapter
+% \stoptransliteration
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
+% \transliteration[MySerbianX]{АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
+% \starttransliteration[MySerbian][color=green]%
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
+% \stoptransliteration
+% АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ
%
-% \definehead[ChapterA][chapter]
-% \definehead[ChapterB][chapter]
+% \switchtobodyfont[rachana]
%
-% \startsetups s-to-l
-% \settransliteration[serbian to latin]
-% \red
-% \stopsetups
+% \usetransliteration[indic]
+%
+% \definebuffer[passage]
+% \startbuffer[passage]
+% तिस्रः खलु विधेर्विधाः – अपूर्वविधिः नियमविधिः परिसङ्ख्याविधिश्च इति। तत्र
+% कालत्रयेऽपि कथमप्यप्राप्तस्य प्राप्तिफलको विधिराद्यः। यथा ‘व्रीहीन् प्रोक्षति’
+% ...
+% तदनुनिष्पादिन्या अविधेयगतत्वेन विप्रकृष्टाया इतरनिवृत्तेः सन्निकृष्टफलसम्भवे
+% फलत्वानौचित्यात् ।
+% \stopbuffer
+%
+% \language[sa]
+%
+% \definedfont[file:arialuni.ttf*devanagari-two at 12pt]
+%
+% \definedfont[file:shobhika-regular.otf*devanagari-two at 12pt]
+%
+% \getbuffer[passage]
+%
+% % \page
+% % {\settransliteration[deva to mlym]\getbuffer[passage]}
+%
+% \page
+%
+% \startlines
+% \transliterate[deva to iast]{आनन्दः}
+% \transliterate[deva to iast]{अक्षयं}
+% \transliterate[deva to iast]{अवप्लुतं}
+% \transliterate[deva to iast]{त्रैयी}
+% \transliterate[deva to iast]{वार्त्तां}
+% \transliterate[deva to iast]{सान्द्रानन्दावबोधात्मकं}
+% \transliterate[deva to iast]{गरुडवाहनन्}
+% \stoplines
+%
+% \page
%
-% % maybe we need a setups key for this
-% % hm, \definesetups [xxx] [aa,bb,cc]
+% \startlines
+% \transliterate[iast to deva]{ānandaḥ}
+% \transliterate[iast to deva]{ati}
+% \transliterate[iast to deva]{ānandaḥ}
+% \transliterate[iast to deva]{ati}
+% \transliterate[iast to deva]{krauñca}
+% \transliterate[iast to deva]{krodhaṁ}
+% \transliterate[iast to deva]{kruddhaṁ}
+% \transliterate[iast to deva]{upahvarāyi}
+% \transliterate[iast to deva]{hārdika}
+% \transliterate[iast to deva]{śaunaśśepaḥ}
+% \transliterate[iast to deva]{tiśṣitaḥ}
+% \transliterate[iast to deva]{agryīṁ}
+% \transliterate[iast to deva]{saṅkulam}
+% \transliterate[iast to deva]{śrīrāman}
+% \transliterate[iast to deva]{niścitavantaḥ}
+% \transliterate[iast to deva]{idam adbhutama ai kr}
+% \transliterate[iast to deva]{kr saṁdhi}
+% \transliterate[iast to deva]{a}
+% \transliterate[iast to deva]{akr}
+% \transliterate[iast to deva]{āhriyate iast}
+% \transliterate[iast to deva]{utkaṁpita iast}
+% \transliterate[iast to deva]{śagdhyūṣū}
+% \transliterate[iast to deva]{tretā}
+% \transliterate[iast to deva]{ati}
+% \transliterate[iast to deva]{"ai"}
+% \transliterate[iast to deva]{dhavaḻa}
+% \transliterate[iast to deva]{śrīrāman}
+% \transliterate[iast to deva]{ś}
+% \transliterate[iast to deva]{śra}
+% \transliterate[iast to deva]{​arkau}
+% \transliterate[iast to deva]{kāvikrato}
+% \transliterate[iast to deva]{saṅkulam}
+% \transliterate[iast to deva]{sundaraṁ}
+% \transliterate[iast to deva]{bhirarkiṇaḥ}
+% \transliterate[iast to deva]{bhirarkkiṇaḥ}
+% \transliterate[iast to deva]{karkki khārkki}
+% \transliterate[iast to deva]{cacchā}
+% \transliterate[iast to deva]{karkki khakhārkki "kr"}
+% \transliterate[iast to deva]{i‍​ast śrotṝn}
+% \transliterate[iast to deva]{test ati krarkkṛ au}
+% \stoplines
%
-% \setuphead[ChapterB][commandbefore=\setups{s-to-l}]
+% सङ्कुलम्​ श्रीरामन् निश्चितवन्तः इदम् अद्भुतम् ऐ
%
-% \startChapterA[title={АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}]
-% \stopChapterA
+% \transliterate [deva to iast] {सौन्दर्य सुन्दर सुंदर सौंदर्य आनन्दः कर्तृत्त्व
+% सिद्धम् सिद्धं बद्धैः भकार शब्दः बभ्रूवाहन गरुडवाहनन् सान्द्रानन्दावबोधात्मकं।
+% auṣadhi madhumattamaḥ इअस्त षट्त्रिंशत् तीर्थास्पदं शिवविरिञ्चिनुतं शरण्यं
+% ऐन्द्र पर्व अभ्यर्च्चैर चँद्रम् सदाऽत्मा, "तेस्त"
%
-% \startChapterB[title={АБВ ГДЕ ЖЗИЙ КЛМНОП РСТУ ФХЦЧ ШЩЪЬ ЮЯ}]
-% \stopChapterB
+% अ॒ग्निमी᳚ळे पुरोहि॑तम्
+% खखार्क्कि क्रर्क्कृ
+% }
%
% \stoptext
diff --git a/tex/context/base/mkxl/math-acc.mklx b/tex/context/base/mkxl/math-acc.mklx
index 2201ed886..4dc70055a 100644
--- a/tex/context/base/mkxl/math-acc.mklx
+++ b/tex/context/base/mkxl/math-acc.mklx
@@ -308,6 +308,24 @@
\aliased\let\mathring\ring % for a while
+% \permanent\protected\def\not#1{\Umathaccent class \mathordinarycode exact overlay 0 0 "338 {#1}}
+% \permanent\protected\def\not#1{\Umathaccent class \mathrelationcode exact overlay 0 0 "338 {#1}}
+% \permanent\protected\def\not#1{\Umathaccent class \mathbinarycode exact overlay 0 0 "338 {#1}}
+%
+% \definemathcommand[slashD][ordinary]{\Umathaccent class \mathordinarycode exact overlay 0 0 "338 {D}}
+% \definemathcommand[slashD][ordinary]{\Umathaccent class \mathordinarycode center overlay 0 0 "338 {D}}
+
+\permanent\tolerant\protected\def\slashed[#1]#:#2%
+ {\Umathaccent
+ \s!class \mathcodechecked{#1}%
+ \s!center \space
+ \s!overlay\space
+ \zerocount \zerocount \forwardslashasciicode
+ {#2}} % exact when =
+
+% \definemathcommand[slashD]{\slashed[ordinary]{D}}
+% \definemathcommand[slashD]{\slashed{D}}
+
\popoverloadmode
\protect \endinput
diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt
index a5ad102ec..b0243719e 100644
--- a/tex/context/base/mkxl/math-act.lmt
+++ b/tex/context/base/mkxl/math-act.lmt
@@ -73,6 +73,17 @@ local d_scratchrightoffset = texisdimen("scratchrightoffset")
local use_math_goodies = true directives.register("math.nogoodies", function(v) use_math_goodies = not v end)
local checkitalics = false trackers .register("math.checkitalics", function(v) checkitalics = v end)
+local function registerdone(done,unicode)
+ if not trace_tweaking then
+ done = true
+ elseif done then
+ done[unicode] = true
+ else
+ done = { [unicode] = true }
+ end
+ return done
+end
+
local mathfontparameteractions = sequencers.new {
name = "mathparameters",
arguments = "target,original",
@@ -789,13 +800,7 @@ do
end
ori.parts = prt
end
- if not trace_tweaking then
- done = true
- elseif done then
- done[k] = true
- else
- done = { [k] = true }
- end
+ done = registerdone(done,k)
end
end
feedback_tweak("wipevariants",target,original,done)
@@ -875,13 +880,7 @@ do
local t = mathgaps[nn] or nn
if t then
kerns[t] = vv * width
- if not trace_tweaking then
- done = true
- elseif done then
- done[t] = true
- else
- done = { [t] = true }
- end
+ done = registerdone(done,t)
end
end)
end
@@ -1108,13 +1107,7 @@ end
-- if a and a > 0 then
-- v.topanchor = a * factor
-- count = count + 1
--- if not trace_tweaking then
--- done = true
--- elseif done then
--- done[u] = true
--- else
--- done = { [u] = true }
--- end
+-- done = registerdone(done,u)
-- end
-- end
-- end
@@ -1189,13 +1182,7 @@ do
end
end
v.mathkerns = nil
- if not trace_tweaking then
- done = true
- elseif done then
- done[u] = true
- else
- done = { [u] = true }
- end
+ done = registerdone(done,u)
end
end
feedback_tweak("simplifykerns",target,original,done)
@@ -1271,13 +1258,7 @@ c.bottomanchor = width/2 -- maybe optional
okay = true
end
if okay then
- if not trace_tweaking then
- done = true
- elseif done then
- done[u] = true
- else
- done = { [u] = true }
- end
+ done = registerdone(done,u)
else
goto smaller
end
@@ -1371,16 +1352,7 @@ do
local w = c.width
if w and w ~= 0 then
c.topanchor = v * w
- if trace_tweaking then
- -- todo
- end
- if not trace_tweaking then
- done = true
- elseif done then
- done[u] = true
- else
- done = { [u] = true }
- end
+ done = registerdone(done,u)
end
end
end
@@ -1489,13 +1461,7 @@ do
local k = data.topright ; if k and k ~= 0 then chardata.topright = k * width end
local k = data.bottomleft ; if k and k ~= 0 then chardata.bottomleft = k * width end
local k = data.bottomright ; if k and k ~= 0 then chardata.bottomright = k * width end
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
end
local unicode = detail(characters,uc)
@@ -1534,13 +1500,7 @@ do
local k = data.right ; if k and k ~= 0 then chardata.rightmargin = k * width end
local k = data.top ; if k and k ~= 0 then chardata.topmargin = k * total end
local k = data.bottom ; if k and k ~= 0 then chardata.bottommargin = k * total end
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
end
for unicode, data in next, margins do
@@ -1778,15 +1738,17 @@ do
function mathtweaks.addrules(target,original,parameters)
local characters = target.characters
local thickness = target.mathparameters.OverbarRuleThickness
- local width = target.parameters.emwidth / 2
local width = target.parameters.emwidth / 3
--- local step = 0.8 * width
- local step = 0.5 * width
+ local step = width / 2
+ local quarter = thickness / 4
+ local half = thickness / 2
+ local double = thickness * 2
+ local done = false
characters[0x203E] = { -- middle used for all kind
width = width,
- height = thickness / 2,
- depth = thickness / 2,
- yoffset = - thickness / 2,
+ height = half,
+ depth = half,
+ yoffset = - half,
unicode = 0x203E,
commands = { { "rule", thickness, width } },
parts = {
@@ -1802,7 +1764,7 @@ do
local right = rightarrow.parts
if left and right then
local leftline = right[1].glyph
- local rightline = left [#left].glyph
+ local rightline = left[#left].glyph
local leftdata = characters[leftline]
local rightdata = characters[rightline]
local leftwidth = leftdata.width
@@ -1827,6 +1789,7 @@ do
{ advance = rightwidth, glyph = rightline, ["end"] = .1*leftwidth, start = .9*rightwidth, extender = 1 },
}
result.partsorientation = "horizontal"
+ done = registerdone(done,target)
end
end
end
@@ -1835,63 +1798,79 @@ do
--
-- lucida lacks them ...
--
- local half = thickness / 2
- local double = thickness * 2
- --
if not characters[0x23B4] then
+ local depth = 0
+ local height = 5 * thickness
local tpiece = addprivate(target,"bracket-piece-top",{
width = thickness,
- height = half,
- depth = double,
- yoffset = - double,
- commands = { { "rule", thickness * 2.5, thickness } },
+ height = height,
+ depth = depth,
+ commands = { upcommand[thickness], { "rule", 4 * thickness, thickness } },
+ })
+ local mpiece = addprivate(target,"bracket-piece-top-middle",{
+ width = width,
+ height = height,
+ depth = depth,
+ commands = { upcommand[4*thickness], { "rule", thickness, width } },
})
characters[0x23B4] = { -- over
--- width = width,
- width = 2*thickness+width,
- height = half,
- depth = double,
+ width = double + width,
+ height = height,
+ depth = depth,
unicode = 0x23B4,
+extensible = false,
commands = {
slotcommand[0][tpiece],
- slotcommand[0][0x203E],
+ slotcommand[0][mpiece],
slotcommand[0][tpiece],
},
parts = {
- { advance = thickness, glyph = tpiece, ["end"] = 0, start = half },
- { advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 },
+ { advance = thickness, glyph = tpiece, ["end"] = 0, start = half },
+ { advance = width, glyph = mpiece, ["end"] = step, start = step, extender = 1 },
{ advance = thickness, glyph = tpiece, ["end"] = half, start = 0 },
},
partsorientation = "horizontal",
}
+ done = registerdone(done,0x23B4)
end
if not characters[0x23B5] then
+ local depth = 0
+ local height = 5 * thickness
local bpiece = addprivate(target,"bracket-piece-bottom",{
width = thickness,
- height = double,
- depth = half,
- yoffset = - half,
- commands = { { "rule", thickness * 2.5, thickness } },
+ height = height,
+ depth = depth,
+ yoffset = depth,
+ commands = { { "rule", 4 * thickness, thickness } },
+ })
+ local mpiece = addprivate(target,"bracket-piece-bottom-middle",{
+ width = width,
+ height = height,
+ depth = depth,
+ commands = { { "rule", thickness, width } },
})
characters[0x23B5] = { -- under
- width = 2*thickness+width,
- height = double,
- depth = half,
+ width = double + width,
+ height = height,
+ depth = depth,
unicode = 0x23B5,
+extensible = false,
commands = {
slotcommand[0][bpiece],
- slotcommand[0][0x203E],
+ slotcommand[0][mpiece],
slotcommand[0][bpiece],
},
parts = {
- { advance = thickness, glyph = bpiece, ["end"] = 0, start = half },
- { advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 },
+ { advance = thickness, glyph = bpiece, ["end"] = 0, start = half },
+ { advance = width, glyph = mpiece, ["end"] = step, start = step, extender = 1 },
{ advance = thickness, glyph = bpiece, ["end"] = half, start = 0 },
},
partsorientation = "horizontal",
}
+ done = registerdone(done,0x23B5)
end
--
+ feedback_tweak("rules",target,original,done)
end
-- vfmath.builders.extension(target)
@@ -2587,13 +2566,7 @@ do
depth = 0,
unicode = unicode,
}
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
feedback_tweak("wipecues",target,original,done)
end
@@ -2616,13 +2589,7 @@ do
local weirdone = characters[weird]
if normalone and weirdone and not normalone.next then
normalone.next = weirdone.next
- -- if not trace_tweaking then
- -- done = true
- -- elseif done then
- -- done[normal] = true
- -- else
- -- done = { [normal] = true }
- -- end
+ -- done = registerdone(done,normal)
end
weirdone = copytable(normalone)
characters[weird] = weirdone
@@ -2700,13 +2667,7 @@ else
stretchingdata.topanchor = topanchor
stretchingdata.commands = { rightcommand[width + topanchor], charcommand[stretching] }
end
- if not trace_tweaking then
- done = true
- elseif done then
- done[stretching] = true
- else
- done = { [stretching] = true }
- end
+ done = registerdone(done,stretching)
end
end
feedback_tweak("fixaccents",target,original,done)
@@ -2728,6 +2689,7 @@ end
local llx = b[1] * factor
local urx = b[3] * factor
-- if topanchor < 0 then
+data.advance = data.width
if true then
-- width = - topanchor
width = 2 * (topanchor - llx)
@@ -2739,7 +2701,6 @@ if true then
data.xoffset = -llx
else
width = urx - llx
- -- data.advance = urx
data.commands = {
leftcommand[llx],
slotcommand[0][unicode]
@@ -2749,13 +2710,7 @@ end
data.topanchor = width/2
data.bottomanchor = width/2
end
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
end
end
@@ -2799,13 +2754,7 @@ end
cnt = cnt + 1
end
if okay then
- if not trace_tweaking then
- done = true
- elseif done then
- done[stretching] = true
- else
- done = { [stretching] = true }
- end
+ done = registerdone(done,stretching)
end
end
end
@@ -2852,13 +2801,7 @@ characters[slot] = {
-- end
last.flataccent = slot
- if not trace_tweaking then
- done = true
- elseif done then
- done[stretching] = true
- else
- done = { [stretching] = true }
- end
+ done = registerdone(done,stretching)
end
code = last.next
if code then
@@ -2891,13 +2834,7 @@ characters[slot] = {
-- unicode = stretching, -- when we alias to combiners
unicode = alias, -- when we keep the original
}
- if not trace_tweaking then
- done = true
- elseif done then
- done[stretching] = true
- else
- done = { [stretching] = true }
- end
+ done = registerdone(done,stretching)
end
end
end
@@ -2917,13 +2854,7 @@ characters[slot] = {
local chardata = characters[unicode]
if chardata then
chardata.keepbase = true
- if not trace_tweaking then
- done = true
- elseif done then
- done[unicode] = true
- else
- done = { [unicode] = true }
- end
+ done = registerdone(done,unicode)
end
end
else
@@ -3814,13 +3745,7 @@ do
local data = characters[unicode]
if data then
data.topovershoot = top * (quad or data.width or 0)
- if not trace_tweaking then
- done = true
- elseif done then
- done[r] = true
- else
- done = { [r] = true }
- end
+ done = registerdone(done,r)
end
end
end
diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl
index 7b61fd234..7fc95ac4b 100644
--- a/tex/context/base/mkxl/math-ali.mkxl
+++ b/tex/context/base/mkxl/math-ali.mkxl
@@ -44,6 +44,8 @@
\else
\displaywidth
\fi
+ -\leftskip
+ -\rightskip
\relax}
\permanent\def\maximizeddisplaywidth % larger than zero but within hsize
@@ -55,6 +57,8 @@
\else
\displaywidth
\fi
+ -\leftskip
+ -\rightskip
\relax}
%D \macros
@@ -698,21 +702,21 @@
\newconditional\c_math_alignment_local_number % not used but when true puts in front (todo)
\def\math_number_right_of_eqalign
- {\ifcase\wd\b_strc_formulas_number\else
+ {\ifcase\d_strc_formulas_number\else
\ifconditional\c_math_alignment_local_number
\ifcase\c_strc_math_number_location\or\or
- \box\b_strc_formulas_number
+ \strc_math_flush_number_box
\fi
\else
- \box\b_strc_formulas_number
+ \strc_math_flush_number_box
\fi
\fi}
\def\math_number_left_of_eqalign
- {\ifcase\wd\b_strc_formulas_number\else
+ {\ifcase\d_strc_formulas_number\else
\ifconditional\c_math_alignment_local_number
\ifcase\c_strc_math_number_location\or
- \box\b_strc_formulas_number
+ \strc_math_flush_number_box
\fi
\fi
\fi}
@@ -1021,12 +1025,12 @@
\ifmmode\stopimath\fi
\hfil
\aligntab
- \kern\mathcasesparameter\c!distance\relax % hskip
+ \kern\mathcasesparameter\c!distance\relax
\math_cases_strut % looks better
\aligncontent
\hfil
\aligntab
- \kern\mathcasesparameter\c!numberdistance\relax % hskip
+ \kern\mathcasesparameter\c!numberdistance\relax
\span\math_text_in_eqalign{\aligncontent}%
\crcr} % todo: number
@@ -1323,7 +1327,7 @@
\aligntab
\aligntab
\math_matrix_anchor
- \kern.5\d_math_eqalign_distance % hskip
+ \kern.5\d_math_eqalign_distance
\aligncontent
\aligntab
\global\advanceby\c_math_eqalign_column\plusone
@@ -1462,14 +1466,14 @@
\relax
\ifnum#1>\plusone
\localcontrolledloop\plustwo#1\plusone
- {\kern.125\d_math_eqalign_distance % hskip
+ {\kern.125\d_math_eqalign_distance
\hrule
\s!attr \mathalignmentvruleattribute\plusthree
\s!height\scratchdimen
\s!depth \scratchdimen
\relax}%
\kern-2\scratchdimen
- \kern-.125\d_math_eqalign_distance % hskip
+ \kern-.125\d_math_eqalign_distance
\fi
\scratchdistance\mathmatrixparameter\c!boffset\relax
\ifdim\scratchdistance>\zeropoint
@@ -1569,10 +1573,10 @@
% \permanent\tolerant\protected\def\math_matrix_VL[#1]#*%
% {\span\omit
% \ifconditional\c_math_matrix_first\else
-% \kern.5\d_math_eqalign_distance % hskip
+% \kern.5\d_math_eqalign_distance
% \fi
% \math_matrix_vertical_rule_yes{#1}%
-% \kern.5\d_math_eqalign_distance % hskip
+% \kern.5\d_math_eqalign_distance
% \global\setfalse\c_math_matrix_first
% \aligntab
% \boundary\c_math_matrix_vl_boundary
@@ -1582,11 +1586,11 @@
\def\math_matrix_VL_indeed#1#2%%
{\span\omit
\ifconditional\c_math_matrix_first\else
- \kern.5\d_math_eqalign_distance % hskip
+ \kern.5\d_math_eqalign_distance
\fi
\math_matrix_vertical_rule_yes{#2}%
\localcontrolledloop\plustwo#1\plusone
- {\kern.125\d_math_eqalign_distance % hskip
+ {\kern.125\d_math_eqalign_distance
\math_matrix_vertical_rule_yes{#2}}%
\kern.5\d_math_eqalign_distance
\global\setfalse\c_math_matrix_first
@@ -1601,10 +1605,10 @@
\permanent\tolerant\protected\def\math_matrix_NL[#1]#*%
{\span\omit
\ifconditional\c_math_matrix_first\else
- \kern.5\d_math_eqalign_distance % hskip
+ \kern.5\d_math_eqalign_distance
\fi
\math_matrix_vertical_rule_nop{#1}%
- \kern.5\d_math_eqalign_distance % hskip
+ \kern.5\d_math_eqalign_distance
\global\setfalse\c_math_matrix_first
\aligntab
\boundary\c_math_matrix_vl_boundary
@@ -1613,9 +1617,9 @@
\permanent\protected\def\math_matrix_NL_NR
{\ifnum\lastboundary=\c_math_matrix_vl_boundary
\ifconditional \c_math_matrix_sl_seen
- \kern-1.5\d_math_eqalign_distance % hskip
+ \kern-1.5\d_math_eqalign_distance
\else
- \kern-.5\d_math_eqalign_distance % hskip
+ \kern-.5\d_math_eqalign_distance
\fi
\fi
\math_matrix_anchor_last
@@ -2255,7 +2259,10 @@
{\defcsname\??mathinnerstart#1\endcsname{#2}%
\defcsname\??mathinnerstop #1\endcsname{#3}}
-\def\strc_math_flush_number_box{\box\b_strc_formulas_number}
+\def\strc_math_flush_number_box_normal{\box\b_strc_formulas_number}
+\def\strc_math_flush_number_box_visual{\ruledhbox{\box\b_strc_formulas_number}}
+
+\let\strc_math_flush_number_box\strc_math_flush_number_box_normal
% \newdimension \d_strc_math_display_width
% \newdimension \d_strc_math_indent
@@ -2283,7 +2290,7 @@
\def\strc_math_flush_aligned_boxed_direct_yes
{\dontleavehmode
\box\b_strc_math_display
- \llap{\box\b_strc_formulas_number}}
+ \llap{\strc_math_flush_number_box}}
\def\strc_math_flush_aligned_boxed_direct_nop
{\dontleavehmode
@@ -2291,119 +2298,217 @@
\def\strc_math_flush_aligned_left_number_indeed
{\ifvoid\b_strc_formulas_number\else
- \scratchwidth\wd\b_strc_formulas_number
- \setbox\b_strc_formulas_number\hbox to \displaywidth{\hss\hbox{\box\b_strc_formulas_number}}%
+ \setbox\b_strc_formulas_number\hbox to \displaywidth\bgroup
+ \hss
+ \hbox{\strc_math_flush_number_box}%
+ \egroup
\ifcase\c_strc_math_number_location\or
- \boxxoffset\b_strc_formulas_number\dimexpr-\displaywidth+\scratchwidth\relax
+ \boxxoffset\b_strc_formulas_number\dimexpr-\displaywidth+\d_strc_formulas_number+\s_strc_formulas_margin_left\relax % brrrrr
\boxyoffset\b_strc_formulas_number-\d_strc_math_first_height
\htdp\b_strc_formulas_number\zeropoint
- \box\b_strc_formulas_number % left
+ \strc_math_flush_number_box % left
\fi
\fi}
\def\strc_math_flush_aligned_right_number_indeed
{\ifvoid\b_strc_formulas_number\else
- \scratchwidth\wd\b_strc_formulas_number
- \setbox\b_strc_formulas_number\hbox to \displaywidth{\hss\hbox{\box\b_strc_formulas_number}}%
+ \setbox\b_strc_formulas_number\hbox to \displaywidth\bgroup
+ \hss
+ \hbox{\strc_math_flush_number_box}%
+ \egroup
\ifcase\c_strc_math_number_location\or\else
+ \boxxoffset\b_strc_formulas_number\dimexpr-\s_strc_formulas_margin_right\relax % brrrrr
\boxyoffset\b_strc_formulas_number\d_strc_math_last_depth
\htdp\b_strc_formulas_number\zeropoint
- \box\b_strc_formulas_number % right
+ \strc_math_flush_number_box % right
\fi
\fi}
-\protected\def\strc_math_flush_aligned_indeed
- {\ifcase\c_strc_math_ragged_status
- % align: error
- \strc_math_flush_aligned_boxed_direct_yes
- \or
- % align: flushleft, number right
- \strc_math_flush_aligned_boxed_direct_yes
- \or
- % align: middle
- \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
- \leftskip \zeropoint
- \rightskip\zeropoint
- \strc_math_flush_aligned_boxed_direct_yes
- \orelse\ifnum\c_strc_math_split_mode=\c_strc_math_wrap_mode
- \dontleavehmode
- \vbox\bgroup
- \strc_math_flush_aligned_left_number_indeed
- \unvbox\b_strc_math_display
- \strc_math_flush_aligned_right_number_indeed
- \egroup
- \orelse\ifhmode
- % untested
- \dontleavehmode
- \strc_math_flush_aligned_left_number_indeed
- \box\b_strc_math_display
- \strc_math_flush_aligned_right_number_indeed
- \orelse\ifvbox\b_strc_math_display
+% \settrue\c_strc_math_ignore_number
+
+% cleanup timestamp: tales of time, joe bonamassa (live blu-ray in loop mode, 2023)
+
+\dimensiondef\d_strc_math_number_eps 5\scaledpoint
+
+% line mode
+
+\def\strc_math_flush_line_mode
+ {\ifcase\c_strc_math_ragged_status\or\or\hfill\or\hfill\fi
+ \box\b_strc_math_display
+ \ifcase\c_strc_math_ragged_status\or\hfill\or\hfill\or\fi}
+
+% wrap mode
+
+\def\strc_math_flush_wrap_mode
+ {\strc_math_setup_align_auto
+ \bgroup
+ \leftskip \zeropoint\relax
+ \rightskip\zeropoint\relax
+ \global\c_strc_math_positioning\plustwo
+ \dontleavehmode
+ \vbox\bgroup
\strc_math_flush_aligned_left_number_indeed
\unvbox\b_strc_math_display
\strc_math_flush_aligned_right_number_indeed
- \else
- % untested
- \dontleavehmode
- \strc_math_flush_aligned_left_number_indeed
- \box\b_strc_math_display
- \strc_math_flush_aligned_right_number_indeed
+ \egroup
+ \egroup
+ \ifvmode
+ \nointerlineskip
+ \fi}
+
+% flow mode
+
+\def\strc_math_flush_v_box_bottom
+ {\ifdone
+ \global\c_strc_math_positioning\number\plusfour2\relax
+ \unvbox\b_strc_math_display
+ \strc_math_flush_number_box
+ \else
+ \global\c_strc_math_positioning\number\plusfour3\relax
+ \unvbox\b_strc_math_display
+ \nointerlineskip
+ \ht\b_strc_formulas_number\zeropoint
+ \dp\b_strc_formulas_number\zeropoint
+ \boxyoffset\b_strc_formulas_number\d_strc_math_last_depth
+ \strc_math_flush_number_box % right
+ \prevdepth\d_strc_math_last_depth
+ \fi}
+
+\def\strc_math_flush_v_box_top
+ {\ifdone
+ \global\c_strc_math_positioning\number\plusfour5\relax
+ \dontleavehmode
+ \strc_math_flush_number_box
+ \unvbox\b_strc_math_display
+ \else
+ \scratchdepth\dp\b_strc_formulas_number
+ \global\c_strc_math_positioning\number\plusfour6\relax
+ \ht\b_strc_formulas_number\strutht
+ \dp\b_strc_formulas_number\strutdp
+ \dontleavehmode
+ \strc_math_flush_number_box % left
+ \vkern-\dimexpr\d_strc_math_first_height+\scratchdepth\relax
+ \unvbox\b_strc_math_display
+ \fi}
+
+\def\strc_math_flush_v_box_right
+ {\ifconditional\c_strc_math_ignore_number
+ \d_strc_formulas_number\zeropoint
+ \fi
+ \strc_formulas_start_side_box
+ \ifzeropt\d_strc_formulas_number
+ \global\c_strc_math_positioning\number\plusfour1\relax
+ \unvbox\b_strc_math_display
+ \else
+ % better verbose than compact so some overlap in code here
+ \ifcase\c_strc_math_number_variant\or
+ \s_strc_formulas_margin_right\zeropoint
\fi
- \or
- % align: flushright
- % packaged, number (kind of ugly as we now stick in the margin)
- \ifcase\c_strc_math_n_of_lines\or
- \dontleavehmode
- \kern-\wd\b_strc_formulas_number
- \box\b_strc_math_display
- \ifcase\c_strc_math_n_of_lines\or
- \box\b_strc_formulas_number
+ \setbox\b_strc_formulas_number\hbox to \displaywidth\bgroup
+ \hss
+ \strc_math_flush_number_box
+ \kern\s_strc_formulas_margin_right
+ \egroup
+ \ifcstok{\formulaparameter\c!order}\v!reverse
+ \ifdim\dimexpr\d_strc_math_first_right-\s_strc_formulas_margin_right\relax<\dimexpr\d_strc_formulas_number-\d_strc_math_number_eps\relax
+ \donetrue
\else
- \llap{\box\b_strc_formulas_number}%
+ \donefalse
\fi
- \orelse\iftrue % can become option
- \ifdim\d_strc_math_last_width>\wd\b_strc_formulas_number
- \ifdim\d_strc_math_max_width<\d_strc_math_last_width
- \strc_math_flush_aligned_boxed_direct_yes
- \else
- \dontleavehmode
- \kern-\wd\b_strc_formulas_number
- \box\b_strc_math_display
- \box\b_strc_formulas_number
- \fi
+ \strc_math_flush_v_box_top
+ \else
+ \ifdim\dimexpr\d_strc_math_last_right-\s_strc_formulas_margin_right\relax<\dimexpr\d_strc_formulas_number-\d_strc_math_number_eps\relax
+ \donetrue
+ \else
+ \donefalse
+ \fi
+ \strc_math_flush_v_box_bottom
+ \fi
+ \fi
+ \strc_formulas_stop_side_box}
+
+\def\strc_math_flush_v_box_left
+ {\ifconditional\c_strc_math_ignore_number
+ \d_strc_formulas_number\zeropoint
+ \fi
+ \strc_formulas_start_side_box
+ \ifzeropt\d_strc_formulas_number
+ \global\c_strc_math_positioning\number\plusfour4\relax
+ \unvbox\b_strc_math_display
+ \else
+ % better verbose than compact so some overlap in code here
+ \ifcase\c_strc_math_number_variant\or
+ \s_strc_formulas_margin_left\zeropoint
+ \fi
+ \setbox\b_strc_formulas_number\hbox to \displaywidth\bgroup
+ \kern\s_strc_formulas_margin_left
+ \strc_math_flush_number_box
+ \hss
+ \egroup
+ \ifcstok{\formulaparameter\c!order}\v!reverse
+ \ifdim\dimexpr\d_strc_math_last_left-\s_strc_formulas_margin_left\relax<\dimexpr\d_strc_formulas_number-\d_strc_math_number_eps\relax
+ \donetrue
\else
- % delay number till later
- \strc_math_flush_aligned_boxed_direct_nop
+ \donefalse
\fi
+ \strc_math_flush_v_box_bottom
\else
- % delay number till later
- \strc_math_flush_aligned_boxed_direct_nop
+ \ifdim\dimexpr\d_strc_math_first_left-\s_strc_formulas_margin_left\relax<\dimexpr\d_strc_formulas_number-\d_strc_math_number_eps\relax
+ \donetrue
+ \else
+ \donefalse
+ \fi
+ \strc_math_flush_v_box_top
\fi
\fi
+ \strc_formulas_stop_side_box}
+
+\def\strc_math_flush_h_mode
+ {\global\c_strc_math_positioning\plusthree
+ \dontleavehmode
+ \strc_math_flush_aligned_left_number_indeed
+ \box\b_strc_math_display
+ \strc_math_flush_aligned_right_number_indeed}
+
+\def\strc_math_flush_h_box
+ {\global\c_strc_math_positioning\plusfive
+ \dontleavehmode
+ \strc_math_flush_aligned_left_number_indeed
+ \box\b_strc_math_display
+ \strc_math_flush_aligned_right_number_indeed}
+
+\def\strc_math_flush_text_mode
+ {\strc_math_setup_align_auto
+ \bgroup
+ \leftskip \zeropoint\relax
+ \rightskip\zeropoint\relax
+ \ifhmode
+ % nil the tracing
+ \strc_math_flush_h_mode
+ \orelse\ifvbox\b_strc_math_display
+ \ifnum\c_strc_math_number_location=\plusone
+ \strc_math_flush_v_box_left
+ \else
+ \strc_math_flush_v_box_right
+ \fi
+ \else
+ % nil the tracing, might never happen
+ \strc_math_flush_h_box
+ \fi
+ \egroup
\ifvmode
- \nointerlineskip
+ \nointerlineskip
\fi}
-\protected\def\strc_math_flush_aligned_simple
- {\ifcase\c_strc_math_ragged_status\or\or\hfill\or\hfill\fi
- \box\b_strc_math_display
- \ifcase\c_strc_math_ragged_status\or\hfill\or\hfill\or\fi}
+% all modes:
\protected\def\strc_math_flush_aligned
{\ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
- \strc_math_flush_aligned_simple
- \orelse\ifconditional\c_strc_math_indent
- % in this case the already set text align is overloaded
- \strc_math_setup_align_auto
- \strc_math_flush_aligned_indeed
+ \strc_math_flush_line_mode
+ \orelse\ifnum\c_strc_math_split_mode=\c_strc_math_wrap_mode
+ \strc_math_flush_wrap_mode
\else
- % normally we don't end up here
- \strc_math_setup_spacing_aligned\mathalignmentparameter
- \begingroup
- \forgetall
- \unhbox\b_strc_math_display
- \par
- \endgroup
+ \strc_math_flush_text_mode
\fi}
\def\strc_math_flush_box_normal
@@ -2566,9 +2671,9 @@
\protected\def\d_strc_math_total_display_width
{\dimexpr
- \d_strc_math_display_width+\wd\b_strc_formulas_number
+ \d_strc_math_display_width+\d_strc_formulas_number
\ifconditional\c_strc_formulas_overlay_number
- \ifcase\c_strc_math_ragged_status\or\or+\wd\b_strc_formulas_number\or\fi
+ \ifcase\c_strc_math_ragged_status\or\or+\d_strc_formulas_number\or\fi
\fi
\relax}
@@ -2598,9 +2703,9 @@
\fi
% still ok?
\ifnum\c_strc_math_ragged_status=\plustwo
- \d_strc_math_framed_width\dimexpr\displaywidth-2\wd\b_strc_formulas_number\relax
+ \d_strc_math_framed_width\dimexpr\displaywidth-2\d_strc_formulas_number\relax
\else
- \d_strc_math_framed_width\dimexpr\displaywidth- \wd\b_strc_formulas_number\relax
+ \d_strc_math_framed_width\dimexpr\displaywidth- \d_strc_formulas_number\relax
\fi}
\let\strc_math_number_check_inside\strc_math_number_check_outside
@@ -2638,17 +2743,27 @@
\defcsname\??mathboxlocation\v!left \endcsname
{\c_strc_math_number_location\plusone}
-\defcsname\??mathboxlocation\v!flushright\endcsname
- {\c_strc_math_number_location\plusone}
\defcsname\??mathboxlocation\v!right\endcsname
{\c_strc_math_number_location\plustwo}
-\defcsname\??mathboxlocation\v!flushleft\endcsname
- {\c_strc_math_number_location\plustwo}
+
+\defcsname\??mathboxlocation\v!atleftmargin\endcsname
+ {\c_strc_math_number_location\plusone
+ \ifzeropt\s_strc_formulas_margin_left
+ % this can be a helper as now mixed in math-ali
+ \parinitleftskip\zeropoint
+ \else
+ \c_strc_math_number_variant \plusone
+ \fi}
\defcsname\??mathboxlocation\v!atrightmargin\endcsname
{\c_strc_math_number_location\plustwo
- \c_strc_math_number_variant \plusone}
+ \ifzeropt\s_strc_formulas_margin_right
+ % this can be a helper as now mixed in math-ali
+ \parfillrightskip\zeropoint
+ \else
+ \c_strc_math_number_variant \plusone
+ \fi}
\protected\def\strc_math_box_start#1%
{\c_strc_math_ragged_status#1\relax % already set
@@ -2687,24 +2802,28 @@
\hbox to \displaywidth \bgroup
\else
\bgroup
- \strc_math_show_margins
\fi
\ifcase\c_strc_math_number_location
\strc_math_flush_box
\or % number left
- \ifzeropt\wd\b_strc_formulas_number
+ \ifzeropt\d_strc_formulas_number
\strc_math_flush_number_no
\else
\strc_math_flush_number_left
\fi
\else % number right
- \ifzeropt\wd\b_strc_formulas_number
+ \ifzeropt\d_strc_formulas_number
\strc_math_flush_number_no
\else
\strc_math_flush_number_right
\fi
\fi
- \egroup}
+ \egroup
+ \ifnum\c_strc_math_split_mode=\c_strc_math_flow_mode
+ \ifhmode \else
+ \strc_math_show_margins
+ \fi
+ \fi}
\defineinnermathhandler\v!left {\strc_math_box_start\plusthree}{\strc_math_box_stop}
\defineinnermathhandler\v!flushright{\strc_math_box_start\plusthree}{\strc_math_box_stop}
@@ -2762,7 +2881,7 @@
\fi
\fi
\else
- % \box\b_strc_formulas_number
+ % \strc_math_flush_number_box
% \hfill
\strc_math_flush_aligned % we flush in here, otherwise wrong positioning of number (we need to unvbox)
\fi}
@@ -2789,7 +2908,7 @@
\else
\strc_math_flush_aligned
% \hfill
- % \box\b_strc_formulas_number % we flush in here
+ % \strc_math_flush_number_box % we flush in here
\fi}
%D Some inline math tweak.
@@ -2821,8 +2940,8 @@
\setupmathematics
[\c!textdistance=\zeropoint]
-%D This is an experiment. No fancy spacing and alignments here. If we ever
-%D go that route it might result in incompatible rendering.
+%D This is an experiment. No fancy spacing and alignments here. If we ever go that
+%D route it might result in incompatible rendering.
\permanent\protected\def\startsplitformula
{\ifhmode
@@ -2972,7 +3091,7 @@
\ifzeropt\scratchdimen\else\kern\scratchdimen\fi
\setbox\scratchbox\hbox{\mathsimplealignparameter\c!text}%
\ifvoid\scratchbox\else
- \kern\mathsimplealignparameter\c!textdistance % hskip
+ \kern\mathsimplealignparameter\c!textdistance
\vcenter{\box\scratchbox}%
\fi
\egroup
diff --git a/tex/context/base/mkxl/math-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl
index 7e6f7c5ce..b7d2e2902 100644
--- a/tex/context/base/mkxl/math-frc.mkxl
+++ b/tex/context/base/mkxl/math-frc.mkxl
@@ -716,12 +716,12 @@
\defcsname\??mathalignsimple\v!split:\v!flushleft\endcsname#1%
{#1%
- \ifchkdim\mathfractionparameter\c!distance\or\hskip\lastchkdim\fi
+ \ifchkdim\mathfractionparameter\c!distance\or\hkern\lastchkdim\fi
\hfill}
\defcsname\??mathalignsimple\v!split:\v!flushright\endcsname#1%
{\hfill
- \ifchkdim\mathfractionparameter\c!distance\or\hskip\lastchkdim\fi
+ \ifchkdim\mathfractionparameter\c!distance\or\hkern\lastchkdim\fi
\mathatom \s!class \mathordcode \s!unroll {}% prevents +/- seen as sign, unroll prevents empty box
#1}
@@ -860,7 +860,7 @@
% \raise
% \Umathskewedfractionvgap\textstyle
% \hbox\bgroup
-% $\scriptstyle#1\hskip\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax$%
+% $\scriptstyle#1\hkern\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax$%
% \egroup
% \hbox to \zeropoint\bgroup
% \hss$\textstyle/$\hss
@@ -868,7 +868,7 @@
% \lower
% \Umathskewedfractionvgap\textstyle
% \hbox\bgroup
-% $\hskip\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax\scriptstyle#2$%
+% $\hkern\dimexpr\Umathskewedfractionhgap\scriptstyle/2\relax\scriptstyle#2$%
% \egroup
% }
%
@@ -876,7 +876,7 @@
% \raise
% \Umathskewedfractionvgap\textstyle
% \hbox\bgroup
-% $\scriptstyle#1\hskip\dimexpr\Umathskewedfractionhgap\textstyle/2\relax$%
+% $\scriptstyle#1\hkern\dimexpr\Umathskewedfractionhgap\textstyle/2\relax$%
% \egroup
% \hbox to \zeropoint\bgroup
% \hss$\textstyle/$\hss
@@ -884,7 +884,7 @@
% \lower
% \Umathskewedfractionvgapskewedfractionvgap\textstyle
% \hbox\bgroup
-% $\hskip\dimexpr\Umathskewedfractionhgap\textstyle/2\relax\scriptstyle#2$%
+% $\hkern\dimexpr\Umathskewedfractionhgap\textstyle/2\relax\scriptstyle#2$%
% \egroup
% }
%
diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl
index f9b733d9c..eb3801a9b 100644
--- a/tex/context/base/mkxl/math-ini.mkxl
+++ b/tex/context/base/mkxl/math-ini.mkxl
@@ -55,12 +55,22 @@
\newdimension \mathstrutdp
\newinteger \mathnestinglevel
+\newcount \c_math_strc_hangafter
+\newdimen \d_math_strc_hangindent
+
\newcount \c_strc_math_n_of_lines
-\newdimension \d_strc_math_max_width
-\newdimension \d_strc_math_first_width
-\newdimension \d_strc_math_last_width
+
+\newdimension \d_strc_math_max_right
+\newdimension \d_strc_math_first_right
+\newdimension \d_strc_math_last_right
+
+\newdimension \d_strc_math_max_left
+\newdimension \d_strc_math_first_left
+\newdimension \d_strc_math_last_left
+
\newdimension \d_strc_math_first_height
\newdimension \d_strc_math_last_depth
+
\newdimension \d_strc_math_display_width
\newdimension \d_strc_math_indent
\newconditional\c_strc_math_indent
@@ -519,11 +529,17 @@
% +\preferdelimiterdimensionsclassoptioncode
\relax
+% \showmakeup[penalty]
+%
+% \preinlinepenalty 23 \postinlinepenalty 56 x$xx$x\par x$x$x\par x$x^2$x\par x$!$x\par
+% \preshortinlinepenalty 123 \postshortinlinepenalty456 x$xx$x\par x$x$x\par x$x^2$x\par x$!$x\par
+
\setmathoptions\mathordinarycode\numexpr
\noitaliccorrectionclassoptioncode
% +\checkligatureclassoptioncode
+\checkkernpairclassoptioncode
% +\flattenclassoptioncode
+ +\shortinlineclassoptioncode
\relax
\setmathoptions\mathoperatorcode\numexpr
@@ -671,6 +687,24 @@
+\preferdelimiterdimensionsclassoptioncode
\relax
+% MS will check
+
+\setmathoptions\mathexponentialcode\numexpr
+ \shortinlineclassoptioncode
+\relax
+
+\setmathoptions\mathimaginarycode\numexpr
+ \shortinlineclassoptioncode
+\relax
+
+\setmathoptions\mathdifferentialcode\numexpr
+ \shortinlineclassoptioncode
+\relax
+
+\setmathoptions\mathdigitcode\numexpr
+ \shortinlineclassoptioncode
+\relax
+
% test case for \lefttopkernclassoptioncode and \leftbottomkernclassoptioncode in cambria close:
%
% \setupbodyfont[cambria]
@@ -1990,6 +2024,7 @@
\edef\p_limits{\mathfunctionparameter\c!mathlimits}%
\mathatom
mathfont
+ single % behave like a character
class \mathfunctioncode
\ifx\p_limits\v!no
nolimits
diff --git a/tex/context/base/mkxl/math-map.lmt b/tex/context/base/mkxl/math-map.lmt
index 0bd75d748..8c1459ace 100644
--- a/tex/context/base/mkxl/math-map.lmt
+++ b/tex/context/base/mkxl/math-map.lmt
@@ -10,9 +10,7 @@ if not modules then modules = { } end modules ['math-map'] = {
-- persian: we will also provide mappers for other scripts
-- todo : alphabets namespace
-- maybe : script/scriptscript dynamic,
--- check : (U+2202,U+1D715) : upright
--- (U+2202,U+1D715) : italic
--- (U+2202,U+1D715) : upright
+-- check : (U+2202,U+1D715) : upright / italic
-- add them to the regular vectors below so that they honor \it etc
local type, next = type, next
diff --git a/tex/context/base/mkxl/math-spa.lmt b/tex/context/base/mkxl/math-spa.lmt
index a575b1714..6cd3b467e 100644
--- a/tex/context/base/mkxl/math-spa.lmt
+++ b/tex/context/base/mkxl/math-spa.lmt
@@ -18,8 +18,8 @@ local glue_code = nodes.nodecodes.glue
local line_code = nodes.listcodes.line
local ghost_code = nodes.listcodes.ghost
local middle_code = nodes.listcodes.middle
-local leftskip_code = nodes.gluecodes.leftskip
-local rightskip_code = nodes.gluecodes.rightskip
+----- leftskip_code = nodes.gluecodes.leftskip
+----- rightskip_code = nodes.gluecodes.rightskip
local nuts = nodes.nuts
local tonut = nodes.tonut
@@ -64,16 +64,19 @@ local stages = { }
local initial = { }
local c_strc_math_n_of_lines = texiscount("c_strc_math_n_of_lines")
-local d_strc_math_max_width = texisdimen("d_strc_math_max_width")
-local d_strc_math_first_width = texisdimen("d_strc_math_first_width")
-local d_strc_math_last_width = texisdimen("d_strc_math_last_width")
+local d_strc_math_max_right = texisdimen("d_strc_math_max_right")
+local d_strc_math_first_right = texisdimen("d_strc_math_first_right")
+local d_strc_math_last_right = texisdimen("d_strc_math_last_right")
+local d_strc_math_max_left = texisdimen("d_strc_math_max_left")
+local d_strc_math_first_left = texisdimen("d_strc_math_first_left")
+local d_strc_math_last_left = texisdimen("d_strc_math_last_left")
local d_strc_math_first_height = texisdimen("d_strc_math_first_height")
local d_strc_math_last_depth = texisdimen("d_strc_math_last_depth")
local d_strc_math_indent = texisdimen("d_strc_math_indent")
local report = logs.reporter("mathalign")
-local trace = false trackers.register("mathalign",function(v) trace = v end )
+local trace = false trackers.register("math.align",function(v) trace = v end )
local function moveon(s)
for n, id, subtype in nextnode, getnext(s) do
@@ -134,7 +137,8 @@ stages[1] = function(specification,stage)
local p = n
while p do
if getid(p) == penalty_code and getpenalty(p) == -10000 then
- local d = distance + getdimensions(p,n)
+ local w = getdimensions(p,n)
+ local d = distance + w
f[2] = d
f[3] = p
if d > max then
@@ -150,7 +154,7 @@ stages[1] = function(specification,stage)
local w = f[2]
local d = i == 1 and (max-w) or -w
local k = newkern(d)
- local r = newstrutrule(0,2*65536,2*65536)
+ local r = newstrutrule(0,2*65536,2*65536) -- hm, this adds height and depth !
local s = moveon(f[3])
if trace then
report("row %i, width %p, delta %p",i,w,d)
@@ -185,15 +189,49 @@ end
stages[2] = function(specification,stage)
local head = getlist(getbox(specification.box))
local align = specification.alignstate
- local maxwidth = false
local cnt = 0
- local lastwidth = 0
+local maxwidth = false
+local firstwidth = 0
+local lastwidth = 0
+ local maxright = false
+ local firstright = false
+ local lastright = false
+ local maxleft = false
+ local firstleft = false
+ local lastleft = false
local firstheight = 0
local lastdepth = 0
+ local linenumber = 0
+ local rightmargin = specification.rightmargin
+ if trace then
+ report("stage 2")
+ end
for n, id, subtype, list in nextlist, head do
if subtype == line_code then
local t = getnormalizedline(n)
- local m = t.rightskip + t.parfillrightskip
+ -- local m = t.rightskip + t.parfillrightskip
+ local l = t.leftskip + t.lefthangskip + t.parinitleftskip + t.parfillleftskip + t.indent
+ local r = t.rightskip + t.righthangskip + t.parinitrightskip + t.parfillrightskip
+ local w = getwidth(n)
+ local m = r
+ linenumber = linenumber + 1
+ if trace then
+ report("line %i, width %p, left %p, right %p, used %p",linenumber,w,l,r,w-l-r)
+ end
+ if not maxleft or m > maxleft then
+ maxleft = l
+ end
+ if not maxright or m > maxright then
+ maxright = r
+ end
+ if not firstleft then
+ firstleft = l
+ end
+ if not firstright then
+ firstright = r
+ end
+ lastleft = l
+ lastright = r
if not maxwidth then
maxwidth = m
firstheight = getheight(n)
@@ -206,25 +244,43 @@ stages[2] = function(specification,stage)
lastdepth = getdepth(n)
end
end
- if stage == 2 and (align == 2 or align == 3) then
+ local position = 0
+ if align == 1 then -- flushleft
+ if trace then
+ report("reposition %p, %s",0, "flush left")
+ -- todo
+ end
+ elseif align == 2 then -- middle
+ position = (maxwidth-rightmargin)/2
+ if trace then
+ report("reposition %p, %s",position, "center")
+ end
+ elseif align == 3 then -- flushright
+ position = maxwidth
+ if trace then
+ report("reposition %p, %s",maxwidth, "flush right")
+ end
+ end
+ if stage == 2 and position ~= 0 then
for n, id, subtype, list in nextlist, head do
- if subtype == line_code then
- if align == 1 then -- flushleft
- -- todo
- elseif align == 2 then -- middle
- reposition(n,maxwidth/2)
- elseif align == 3 then -- flushright
- reposition(n,maxwidth)
- end
- end
+ reposition(n,position)
end
+ firstleft = firstleft + position
+ lastleft = lastleft + position
+ maxleft = maxleft + position
+ firstright = firstright - position
+ lastright = lastright - position
+ maxright = maxright - position
end
texsetcount("global",c_strc_math_n_of_lines,cnt)
- texsetdimen("global",d_strc_math_max_width,maxwidth)
- texsetdimen("global",d_strc_math_first_width,firstwidth)
- texsetdimen("global",d_strc_math_last_width,lastwidth)
texsetdimen("global",d_strc_math_first_height,firstheight)
texsetdimen("global",d_strc_math_last_depth,lastdepth)
+ texsetdimen("global",d_strc_math_first_left,firstleft)
+ texsetdimen("global",d_strc_math_first_right,firstright)
+ texsetdimen("global",d_strc_math_last_left,lastleft)
+ texsetdimen("global",d_strc_math_last_right,lastright)
+ texsetdimen("global",d_strc_math_max_left,maxleft)
+ texsetdimen("global",d_strc_math_max_right,maxright)
end
stages[3] = stages[2]
@@ -249,6 +305,8 @@ interfaces.implement {
{ "height", "dimension" },
{ "depth", "dimension" },
{ "splitmethod" },
+ { "leftmargin", "dimension" },
+ { "rightmargin", "dimension" },
}
},
actions = function(specification)
diff --git a/tex/context/base/mkxl/mult-aux.mkxl b/tex/context/base/mkxl/mult-aux.mkxl
index 08d75a5b3..4940aaa04 100644
--- a/tex/context/base/mkxl/mult-aux.mkxl
+++ b/tex/context/base/mkxl/mult-aux.mkxl
@@ -65,10 +65,6 @@
%
% There can be less {} in the following definitions if we assume \??aa and \c!somecs
%
-% todo: \def\detokenized...parameter#1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2\endcsname}} % always root
-%
-% it might be more efficient to do this at the lua and
-%
% watch the push/pop and predefinition of current .. this is needed for nested
% definitions and overloaded defines using the predefined one
@@ -274,14 +270,15 @@
%D pre-expansion can be a bit faster but handly any effect on a normal run so let's
%D go for saving some memory.
-\def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter}
+%def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter}
\protected\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9%
{\frozen\def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}%
\frozen\def#4##1##2{\ifcsname##1:##2\endcsname##1:##2\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}%
\frozen\edef#5##1##2{\noexpand\ifrelax##1\??empty\noexpand\else\noexpand#4##1{##2}\noexpand\fi}% is {} needed around ##1 ?
\frozen\def#6##1##2{\csname\ifcsname#1##1:##2\endcsname#1##1:##2\else\expandafter#5\csname#1##1:\s!parent\endcsname{##2}\fi\endcsname}%
- \frozen\def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2:##1\endcsname}}% always root, no backtrack
+ %\frozen\def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2:##1\endcsname}}% always root, no backtrack
+ \frozen\def#7##1{\expandafter\detokened\csname#1#2:##1\endcsname}% always root, no backtrack
\frozen\def#8##1{\begincsname#1#2:##1\endcsname}%
% TODO
\frozen\def#9##1##2{\expandafter\let\expandafter##1\csname\ifcsname#1#2:##2\endcsname#1#2:##2\else\expandafter#5\csname#1#2:\s!parent\endcsname{##2}\fi\endcsname}}
@@ -301,7 +298,8 @@
\expandafter\noexpand\csname letfrom#2parameter\endcsname}} % strict#2parameter is gone
\protected\def\mult_interfaces_install_root_parameter_handler#1#2#3%
- {\frozen\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}% always root
+ %{\frozen\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}% always root
+ {\frozen\def#2##1{\expandafter\detokened\csname#1:##1\endcsname}% always root
\frozen\def#3##1{\begincsname#1:##1\endcsname}}
\permanent\protected\def\installrootparameterhandler#1#2%
@@ -672,7 +670,8 @@
\protected\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5%
{\frozen\def#3##1{\begincsname#1##1\endcsname}%
- \frozen\def#4##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}%
+ %\frozen\def#4##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}%
+ \frozen\def#4##1{\expandafter\detokened\csname#1##1\endcsname}%
\frozen\def#5##1{\begincsname#1##1\endcsname}}
\permanent\protected\def\installdirectparameterhandler#1#2%
diff --git a/tex/context/base/mkxl/mult-sys.mkxl b/tex/context/base/mkxl/mult-sys.mkxl
index b0df8703b..f40282cbd 100644
--- a/tex/context/base/mkxl/mult-sys.mkxl
+++ b/tex/context/base/mkxl/mult-sys.mkxl
@@ -326,6 +326,7 @@
\definesystemconstant {ordinary}
\definesystemconstant {orientation}
\definesystemconstant {otr}
+\definesystemconstant {overlay}
\definesystemconstant {pagefloat}
\definesystemconstant {page}
\definesystemconstant {paragraph}
@@ -625,6 +626,7 @@
\definefileconstant {page_run} {s-layout-show}
\definefileconstant {symb_run} {s-symbols-show}
\definefileconstant {publ_tra} {s-publications-show}
+\definefileconstant {math_run} {s-math-show}
%D For figure inclusion we need(ed):
diff --git a/tex/context/base/mkxl/node-ini.lmt b/tex/context/base/mkxl/node-ini.lmt
index 435f3bf7e..e0f92a930 100644
--- a/tex/context/base/mkxl/node-ini.lmt
+++ b/tex/context/base/mkxl/node-ini.lmt
@@ -53,6 +53,13 @@ local function simplified(t)
return r
end
+-- if environment.initex then
+-- local texintegerdef = tex.integerdef
+-- for i=1,#nodecodes do
+-- texintegerdef(nodecodes[i] .. "nodecode",i,"immutable")
+-- end
+-- end
+
-- local noadoptions = allocate {
-- set = 0x08,
-- unused_1 = 0x00 + 0x08,
diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt
index f17c5ce7a..4f7370e70 100644
--- a/tex/context/base/mkxl/node-nut.lmt
+++ b/tex/context/base/mkxl/node-nut.lmt
@@ -139,6 +139,7 @@ local nuts = {
getrightdelimiter = direct.getrightdelimiter,
getruledata = direct.getdata, -- obsolete when we have the split
getruledimensions = direct.getruledimensions,
+ setruledimensions = direct.setruledimensions,
getscale = direct.getscale,
getscales = direct.getscales,
getscript = direct.getscript,
diff --git a/tex/context/base/mkxl/node-ref.lmt b/tex/context/base/mkxl/node-ref.lmt
index 18bda16e9..0fb7836da 100644
--- a/tex/context/base/mkxl/node-ref.lmt
+++ b/tex/context/base/mkxl/node-ref.lmt
@@ -450,7 +450,7 @@ local colorize, justadd do
local typesetters = nuts.typesetters
if typesetters then
local hashes = fonts.hashes
- local infofont = fonts.infofont()
+ local infofont = fonts.infofont(true) -- small
local emwidth = hashes.emwidths [infofont]
local exheight = hashes.exheights[infofont]
if what == "reference" then
diff --git a/tex/context/base/mkxl/node-res.lmt b/tex/context/base/mkxl/node-res.lmt
index b514a3568..cb60e9915 100644
--- a/tex/context/base/mkxl/node-res.lmt
+++ b/tex/context/base/mkxl/node-res.lmt
@@ -70,11 +70,12 @@ local setwidth = nuts.setwidth
local setsubtype = nuts.setsubtype
local setleader = nuts.setleader
local setclass = nuts.setclass
-
local setdata = nuts.setdata
local setoffsets = nuts.setoffsets
local setvalue = nuts.setvalue
+local setruledimensions = nuts.setruledimensions
+
local copy_nut = nuts.copyonly
local new_nut = nuts.new
local flush_nut = nuts.flush
@@ -356,6 +357,8 @@ function nutpool.emptyrule(width,height,depth) -- w/h/d == nil will let them ada
return n
end
+-- data left right
+
function nutpool.strutrule(width,height,depth) -- w/h/d == nil will let them adapt
local n = copy_nut(strutrule)
if width or height or depth then
@@ -399,11 +402,10 @@ function nutpool.boxrule(width,height,depth) -- w/h/d == nil will let them adapt
return n
end
-function nutpool.virtualrule(width,height,depth) -- w/h/d == nil will let them adapt
+function nutpool.virtualrule(width,height,depth,data)
local n = copy_nut(virtualrule)
- if width or height or depth then
- setdata(n,width)
- setoffsets(n,nil,nil,height,depth)
+ if width or height or depth or data then
+ setruledimensions(n,width,height,depth,data)
end
return n
end
diff --git a/tex/context/base/mkxl/pack-cut.mkxl b/tex/context/base/mkxl/pack-cut.mkxl
index 772b2ba64..02347312e 100644
--- a/tex/context/base/mkxl/pack-cut.mkxl
+++ b/tex/context/base/mkxl/pack-cut.mkxl
@@ -96,11 +96,12 @@
\scratchskip \ifempty\cutmarkhoffset\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi
\vss
\hbox to \d_pack_cutmarks_width
- {\llap{\copy\scratchbox\hskip\scratchskip}%
- \hskip\scratchdimen\hss
+ {\llap{\copy\scratchbox\kern\scratchskip}%
+ \kern\scratchdimen\hss
\infofont#1%
- \hss\hskip\scratchdimen
- \rlap{\hskip\scratchskip\copy\scratchbox}}%
+ \hss
+ \kern\scratchdimen
+ \rlap{\kern\scratchskip\copy\scratchbox}}%
\vss}%
\hss}}
@@ -122,18 +123,18 @@
\hpack to \d_pack_cutmarks_width
{\scratchskip\ifempty\cutmarkhoffset\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi
\setbox\scratchbox\hpack{\verticalcuts}%
- \llap{\copy\scratchbox\hskip\scratchskip}%
+ \llap{\copy\scratchbox\kern\scratchskip}%
\ifzeropt\d_pack_cutmarks_depth
\hfill
\else
\bgroup
\setbox\scratchbox\hpack{\baselinecuts}%
- \llap{\copy\scratchbox\hskip\scratchskip}%
+ \llap{\copy\scratchbox\kern\scratchskip}%
\hfill
- \rlap{\hskip\scratchskip\copy\scratchbox}%
+ \rlap{\kern\scratchskip\copy\scratchbox}%
\egroup
\fi
- \rlap{\hskip\scratchskip\copy\scratchbox}}%
+ \rlap{\kern\scratchskip\copy\scratchbox}}%
\blap{\vskip\scratchskip\copy\scratchbox}}%
\ht\scratchbox\d_pack_cutmarks_height
\dp\scratchbox\d_pack_cutmarks_depth
diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl
index 1daa8bcf7..7ce169f42 100644
--- a/tex/context/base/mkxl/pack-rul.mkxl
+++ b/tex/context/base/mkxl/pack-rul.mkxl
@@ -1982,6 +1982,14 @@
\dp\b_framed_normal\d_framed_locator_dp
\hpack{\box\b_framed_normal}} % why do we pack .. danger of loosing?
+\installframedlocator \v!inline
+ {}
+ {\scratchoffset\dimexpr\strutdp+\d_framed_applied_offset\relax
+ \boxyoffset\b_framed_normal\dimexpr\boxyoffset\b_framed_normal-\scratchoffset\relax
+ \ht\b_framed_normal\dimexpr\ht\b_framed_normal-\scratchoffset\relax
+ \dp\b_framed_normal\dimexpr\strutdp+\d_framed_applied_offset\relax
+ \box\b_framed_normal}
+
% also used in fastlocalframed
\newdimension\d_framed_original_wd
@@ -2759,7 +2767,7 @@
{\setupframedtexts[\currentframedtext][#2]%
\doifsomething{#1}{\setframedtextparameter\c!location{#1}}% does not listen to #3
\setfalse\c_framed_text_location_none
- \csname\??framedtextlocation\framedtextparameter\c!location\endcsname
+ \begincsname\??framedtextlocation\framedtextparameter\c!location\endcsname
\resetframedtextparameter\c!location
\pack_framed_text_check
\setbox\b_framed_normal\vbox % \vpack
diff --git a/tex/context/base/mkxl/page-com.mkxl b/tex/context/base/mkxl/page-com.mkxl
index ae408f384..d492cb054 100644
--- a/tex/context/base/mkxl/page-com.mkxl
+++ b/tex/context/base/mkxl/page-com.mkxl
@@ -84,28 +84,28 @@
\defcsname\??pagecommentlocations\v!bottom\endcsname
{\setuplayout[\c!location=]%
- \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=\vss,\c!left=\hskip\d_page_comments_offset,\c!right=]%
+ \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=\vss,\c!left=\hkern\d_page_comments_offset,\c!right=]%
\d_page_comments_page_height\dimexpr\paperheight+2\d_page_comments_offset+\d_page_comments_distance+\d_page_comments_height\relax
\d_page_comments_page_width \dimexpr\paperwidth +2\d_page_comments_offset\relax
\defineoverlay[\v!pagecomment][\page_comments_top_bottom]}
\defcsname\??pagecommentlocations\v!top\endcsname
{\setuplayout[\c!location=]%
- \setuppapersize[\c!top=\vss,\c!bottom=\vskip\d_page_comments_offset,\c!left=\hskip\d_page_comments_offset,\c!right=]%
+ \setuppapersize[\c!top=\vss,\c!bottom=\vskip\d_page_comments_offset,\c!left=\hkern\d_page_comments_offset,\c!right=]%
\d_page_comments_page_height\dimexpr\paperheight+2\d_page_comments_offset+\d_page_comments_distance+\d_page_comments_height\relax
\d_page_comments_page_width \dimexpr\paperwidth +2\d_page_comments_offset\relax
\defineoverlay[\v!pagecomment][\page_comments_top_bottom]}
\defcsname\??pagecommentlocations\v!left\endcsname
{\setuplayout[\c!location=]%
- \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=,\c!left=\hss,\c!right=\hskip\d_page_comments_offset]%
+ \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=,\c!left=\hss,\c!right=\hkern\d_page_comments_offset]%
\d_page_comments_page_height\dimexpr\paperheight+2\d_page_comments_offset\relax
\d_page_comments_page_width \dimexpr\paperwidth +2\d_page_comments_offset+\d_page_comments_distance+\d_page_comments_width\relax
\defineoverlay[\v!pagecomment][\page_comments_left_right]}
\defcsname\??pagecommentlocations\v!right\endcsname
{\setuplayout[\c!location=]%
- \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=,\c!left=\hskip\d_page_comments_offset,\c!right =\hss]%
+ \setuppapersize[\c!top=\vskip\d_page_comments_offset,\c!bottom=,\c!left=\hkern\d_page_comments_offset,\c!right =\hss]%
\d_page_comments_page_height\dimexpr\paperheight+2\d_page_comments_offset\relax
\d_page_comments_page_width \dimexpr\paperwidth +2\d_page_comments_offset+\d_page_comments_distance+\d_page_comments_width\relax
\defineoverlay[\v!pagecomment][\page_comments_left_right]}
@@ -123,7 +123,7 @@
\vskip\d_page_comments_offset
\vss
\fi
- \hskip\d_page_comments_offset
+ \hkern\d_page_comments_offset
\vbox to \d_page_comments_height
{%\forgetall
\hsize\paperwidth
@@ -142,9 +142,9 @@
\protected\def\page_comments_left_right
{\hpack to \printpaperwidth
{\ifx\p_page_commands_location\v!right
- \hskip\dimexpr\paperwidth+\d_page_comments_distance+\d_page_comments_offset\relax
+ \hkern\dimexpr\paperwidth+\d_page_comments_distance+\d_page_comments_offset\relax
\else
- \hskip\d_page_comments_offset
+ \hkern\d_page_comments_offset
\hss
\fi
\vbox to \printpaperheight
@@ -158,9 +158,9 @@
\vss}%
\ifx\p_page_commands_location\v!right
\hss
- \hskip\d_page_comments_offset
+ \hkern\d_page_comments_offset
\else
- \hskip\dimexpr\paperwidth+\d_page_comments_distance+\d_page_comments_offset\relax
+ \hkern\dimexpr\paperwidth+\d_page_comments_distance+\d_page_comments_offset\relax
\fi}}
\permanent\protected\defcsname\e!start\v!pagecomment\endcsname
diff --git a/tex/context/base/mkxl/page-imp.mkxl b/tex/context/base/mkxl/page-imp.mkxl
index 4c192c554..e4c7a29ba 100644
--- a/tex/context/base/mkxl/page-imp.mkxl
+++ b/tex/context/base/mkxl/page-imp.mkxl
@@ -459,7 +459,7 @@
{\setbox\scratchbox\vpack to \arrangedpageY\paperheight
{\offinterlineskip
\vskip#4\paperheight
- \hskip#3\paperwidth
+ \hkern#3\paperwidth
\dorotatebox{\ifcase#2 0\else180\fi}\hpack{\box#1}%
\vfill}%
\wd\scratchbox\zeropoint
@@ -1272,10 +1272,10 @@
{\ifvoid\arrangedpageB\else
\unhbox\arrangedpageB
\ifdim\v_page_target_dx>\zeropoint
- \hskip\v_page_target_dx
+ \hkern\v_page_target_dx
\else
\hss
- \hskip\v_page_target_dx
+ \hkern\v_page_target_dx
\hss
\fi
\fi
@@ -1412,7 +1412,7 @@
\setbox#1\vpack
{\offinterlineskip
\vskip\d_page_boxes_v_shifts
- \hskip\d_page_boxes_h_shifts
+ \hkern\d_page_boxes_h_shifts
\box#1}%
\next}
diff --git a/tex/context/base/mkxl/page-mix.mkxl b/tex/context/base/mkxl/page-mix.mkxl
index 3d1179483..3da317956 100644
--- a/tex/context/base/mkxl/page-mix.mkxl
+++ b/tex/context/base/mkxl/page-mix.mkxl
@@ -98,7 +98,7 @@
\c!step=.25\lineheight, % needs some experimenting
%\c!splitmethod=\v!fixed, % will be default
\c!direction=\v!normal, % new (also todo in the new columnsets)
- \c!notes=\v!yes,
+ % \c!notes=\v!yes, % needs an update because now we flush weirdly inside the columns
\c!define=\v!yes,
\c!method=\ifinner\s!box\else\s!otr\fi] % automatic as suggested by WS
@@ -568,6 +568,8 @@
%D The common initialization:
+%D !!! todo: notes \automigrationmode\zerocount as well as notes=yes
+
\def\page_mix_initialize_columns
{\page_mix_enable_grid_snapping
%
@@ -584,7 +586,11 @@
\leftskip \zeropoint
\rightskip\zeropoint
%
- \doifelse{\mixedcolumnsparameter\c!notes}\v!yes\settrue\setfalse\c_page_mix_process_notes
+ \ifcstok{\mixedcolumnsparameter\c!notes}\v!yes
+ \settrue \c_page_mix_process_notes
+ \else
+ \setfalse\c_page_mix_process_notes
+ \fi
\ifconditional\c_page_mix_process_notes \else
\startpostponingnotes
\fi
@@ -606,7 +612,7 @@
\useblankparameter \mixedcolumnsparameter
\useprofileparameter\mixedcolumnsparameter % new
%
- \automigrationmode\zerocount % for now
+ \automigrationmode\zerocount % for now (see notes=yes)
%
\nofcolumns\c_page_mix_n_of_columns} % public
diff --git a/tex/context/base/mkxl/page-mrk.mkxl b/tex/context/base/mkxl/page-mrk.mkxl
index 597cff17d..380bbb980 100644
--- a/tex/context/base/mkxl/page-mrk.mkxl
+++ b/tex/context/base/mkxl/page-mrk.mkxl
@@ -73,7 +73,7 @@
l=\pagecutmarklength,o=\pagecutmarkoffset}%
\egroup
\wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
- \hskip-\scratchwidth\box\scratchbox}
+ \hkern-\scratchwidth\box\scratchbox}
\def\page_marks_add_marking
{\setlayoutcomponentattribute{\v!print:\v!marking}%
@@ -84,7 +84,7 @@
l=\pagecutmarklength,o=\pagecutmarkoffset}%
\egroup
\wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
- \hskip-\scratchwidth\box\scratchbox}
+ \hkern-\scratchwidth\box\scratchbox}
\def\page_marks_add_lines
{\setlayoutcomponentattribute{\v!print:\v!lines}%
@@ -96,7 +96,7 @@
x=\the\c_page_marks_nx,y=\the\c_page_marks_ny}%
\egroup
\wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
- \hskip-\scratchwidth\box\scratchbox}
+ \hkern-\scratchwidth\box\scratchbox}
\def\page_marks_add_number
{\setlayoutcomponentattribute{\v!print:\v!number}%
@@ -108,7 +108,7 @@
n=\number\ifcase\arrangeno\realpageno\else\arrangeno\fi}%
\egroup
\wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
- \hskip-\scratchwidth\box\scratchbox}
+ \hkern-\scratchwidth\box\scratchbox}
\def\page_marks_add_page_indeed#1%
{\setbox#1\hpack\bgroup
diff --git a/tex/context/base/mkxl/page-pcl.mkxl b/tex/context/base/mkxl/page-pcl.mkxl
index d6298982c..040cdb2ec 100644
--- a/tex/context/base/mkxl/page-pcl.mkxl
+++ b/tex/context/base/mkxl/page-pcl.mkxl
@@ -377,7 +377,7 @@
\global\setfalse\c_page_floats_flushing}
\def\page_floats_show_pack_state_indeed#1%
- {\llap{\smash{\backgroundline[black]{\strut\smallinfofont\white#1\space\the\nofcollectedfloats\space of\space\the\savednoffloats:\the\hsize}}\hskip.25\emwidth}}
+ {\llap{\smash{\backgroundline[black]{\strut\smallinfofont\white#1\space\the\nofcollectedfloats\space of\space\the\savednoffloats:\the\hsize}}\hkern.25\emwidth}}
\installtextracker
{floats.collecting}
diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl
index 3ed15ad98..c39dc179c 100644
--- a/tex/context/base/mkxl/publ-ini.mkxl
+++ b/tex/context/base/mkxl/publ-ini.mkxl
@@ -16,8 +16,6 @@
% TODO: s! vs v! for default and neutral key/values
% todo: too many refs in list
-% TODO A.-B. Foo (dash as connector, see JMH)
-
% todo: no need for all these %'s
% todo: tagging
@@ -428,6 +426,7 @@
\permanent\protected\def\btxcommabreak {\removeunwantedspaces,\hskip\zeropoint plus .5\emwidth\relax}
\permanent\protected\def\btxcolon {\removeunwantedspaces:\space}
\permanent\protected\def\btxsemicolon {\removeunwantedspaces;\space}
+\permanent\protected\def\btxhyphen {\removeunwantedspaces-}
\permanent\protected\def\btxlparent {\removeunwantedspaces\space(} % obsolete
\permanent\protected\def\btxrparent {\removeunwantedspaces)\space} % obsolete
\permanent\protected\def\btxleftparenthesis {\removeunwantedspaces\space(}
@@ -438,7 +437,6 @@
\permanent\protected\def\btxrightbracket {\removeunwantedspaces]\space}
\permanent\protected\def\btxrightbracketperiod {\removeunwantedspaces].\space}
\permanent\protected\def\btxrightbracketcomma {\removeunwantedspaces],\space}
-\permanent\protected\def\btxhyphen {\removeunwantedspaces-}
%D Variables:
@@ -1994,7 +1992,7 @@
\c!otherstext={\btxspace et al.},
\c!separator:firstnames={\btxspace},
\c!separator:juniors={\btxspace},
- \c!separator:vons={\btxspace},
+ \c!separator:vons={\btxnobreakspace},
\c!separator:initials={\btxspace},
\c!connector:initials={\btxhyphen},
\c!stopper:initials={.},
diff --git a/tex/context/base/mkxl/spac-ali.mkxl b/tex/context/base/mkxl/spac-ali.mkxl
index 9d9feab9b..ec8bffbc5 100644
--- a/tex/context/base/mkxl/spac-ali.mkxl
+++ b/tex/context/base/mkxl/spac-ali.mkxl
@@ -312,7 +312,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_one_fil % new
+ \parfillrightskip \s_zero_plus_one_fil % new
\setfalse \raggedonelinerstate % now here
\enforced\aliased\let\updateraggedskips\relax} % no need for adaption
@@ -327,7 +327,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -342,7 +342,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -357,7 +357,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_one_fil
+ \parfillrightskip \zeropoint % \s_zero_plus_one_fil
%\parindent \parindent
\relax}
@@ -371,7 +371,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -385,7 +385,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -399,7 +399,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
%\parindent \parindent
\relax}
@@ -414,7 +414,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \zeropoint % \s_zero_plus_zero
\parindent \zeropoint
\relax}
@@ -428,7 +428,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \zeropoint\s!plus\v_spac_align_fill_amount_double\relax
+ \parfillrightskip \zeropoint\s!plus\v_spac_align_fill_amount_double\relax
\parindent \zeropoint
\relax}
@@ -441,8 +441,8 @@
\xspaceskip \zeropoint
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
- \parfillskip \zeropoint
\parfillleftskip \zeropoint\s!plus\v_spac_align_fill_amount_extreme\relax
+ \parfillrightskip \zeropoint
\parindent \zeropoint
\relax}
@@ -457,7 +457,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint
\parfillleftskip \zeropoint
- \parfillskip \s_zero_plus_zero
+ \parfillrightskip \s_zero_plus_zero
%\parindent \parindent
\relax}
@@ -472,7 +472,7 @@
\parinitleftskip \zeropoint
\parinitrightskip \zeropoint\s!plus\v_spac_align_fill_amount_extreme\relax
\parfillleftskip \zeropoint\s!plus\v_spac_align_fill_amount_extreme\relax
- \parfillskip \zeropoint
+ \parfillrightskip \zeropoint
\parindent \zeropoint
\relax}
@@ -525,7 +525,8 @@
\else
\spac_align_set_horizontal_very_right
\fi
- \parfillskip\zeropoint
+ %\parfillleftskip\zeropoint
+ \parfillrightskip\zeropoint
\or
% 7 centered last line
\spac_align_set_horizontal_centered_last_line
@@ -534,7 +535,8 @@
\spac_align_set_horizontal_flushedright_last_line
\or
% 9 paragraph
- \parfillskip\zeropoint
+ %\parfillleftskip\zeropoint
+ \parfillrightskip\zeropoint
\or
% 10 slanted
\spac_align_set_horizontal_slanted
@@ -610,6 +612,7 @@
\c_spac_align_state_direction \zerocount % what is default ?
\c_spac_align_state_page \zerocount
\c_spac_align_state_par_fill \zerocount
+ \lastlinefit\zerocount
\ifcsname\??aligncommand\m_spac_align_named\endcsname
\lastnamedcs
\else
@@ -815,6 +818,8 @@
\defcsname\??aligncommand 1*\v!more\endcsname{\toksapp\t_spac_align_collected{\looseness\plusone}}
\defcsname\??aligncommand 2*\v!more\endcsname{\toksapp\t_spac_align_collected{\looseness\plustwo}}
+\defcsname\??aligncommand \v!fit\endcsname{\toksapp\t_spac_align_collected{\lastlinefit\plusone}}
+
%defcsname\??aligncommand ...\endcsname{\toksapp\t_spac_align_collected{\nopenalties}}
%defcsname\??aligncommand ...\endcsname{\toksapp\t_spac_align_collected{\setdefaultpenalties}}
@@ -839,7 +844,7 @@
\fi}
\protected\def\spac_align_flush_parfill_indeed#1%
- {\parfillskip
+ {\parfillrightskip
#1\directhspaceamount\v!final
% plus \dimexpr\availablehsize-#1\directhspaceamount\v!final\relax
plus 1fill
@@ -956,8 +961,8 @@
\defcsname\??alignhorizontal\v!flushright\endcsname{\enforced\let\raggedbox\spac_align_horizontal_flushright}
\defcsname\??alignhorizontal\v!center \endcsname{\enforced\let\raggedbox\spac_align_horizontal_center}
-% The next one can be in use so we keep it around but one should
-% be aware of possible interference.
+% The next one can be in use so we keep it around but one should be aware of
+% possible interference. But it will be removed at some point!
\permanent\protected\def\setraggedskips#1#2#3#4#5#6#7% never change this name (todo: inline this one .. less tracingall)
{\enforced\permanent\protected\def\updateraggedskips{\dosetraggedskips{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
@@ -994,7 +999,7 @@
\hsize \vsize
\leftskip \rightskip
\spaceskip \xspaceskip
- \parindent \parfillskip
+ \parindent \parfillrightskip
\hyphenpenalty \exhyphenpenalty \automatichyphenpenalty \explicithyphenpenalty
\displaywidowpenalty \widowpenalty \clubpenalty \brokenpenalty
\doublehyphendemerits \finalhyphendemerits \adjdemerits
@@ -1168,7 +1173,7 @@
% {\registerparwrapper
% {\v!word:\v!right}
% {\begingroup
-% \frozen\parfillskip \zeropoint
+% \frozen\parfillrightskip \zeropoint
% \frozen\finalhyphendemerits\zerocount
% \endgroup}
% {\doifelseparwrapper{\v!word:\v!right}%
@@ -1190,8 +1195,8 @@
{\registerparwrapper
{\v!word:\v!right}
{\begingroup
- \frozen\parfillskip \zeropoint
- \frozen\finalhyphendemerits\zerocount
+ \frozen\parfillrightskip \zeropoint % frozen ?
+ \frozen\finalhyphendemerits\zerocount % frozen ?
\endgroup}
{\doifelseparwrapper{\v!word:\v!right}{\unregisterparwrapper{\v!word:\v!right}}\donothing
\removeunwantedspaces
diff --git a/tex/context/base/mkxl/spac-hor.mkxl b/tex/context/base/mkxl/spac-hor.mkxl
index ab15e7a6e..853f4c902 100644
--- a/tex/context/base/mkxl/spac-hor.mkxl
+++ b/tex/context/base/mkxl/spac-hor.mkxl
@@ -19,7 +19,7 @@
\registerctxluafile{spac-hor}{autosuffix}
-\aliased\let\parfillrightskip\parfillskip
+\ifdefined\parfillrightskip\else \aliased\let\parfillrightskip\parfillskip \fi
\bitwiseflip \normalizelinemode \normalizelinenormalizecode
\bitwiseflip \normalizelinemode \parindentskipnormalizecode
diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl
index 640d493b9..79718cfb2 100644
--- a/tex/context/base/mkxl/spac-ver.mkxl
+++ b/tex/context/base/mkxl/spac-ver.mkxl
@@ -1782,12 +1782,12 @@
\hskip-.5\lineheight\relax
\ifcase\gridboxlinenomode\or
\rlap
- {\hskip\dimexpr.2\bodyfontsize+\scratchdimen\relax
+ {\kern\dimexpr.2\bodyfontsize+\scratchdimen\relax
\infofont\hbox to \emwidth{\hss\recurselevel}}%
\or
\llap
{\infofont\hbox to \emwidth{\hss\recurselevel}%
- \hskip.2\bodyfontsize}%
+ \kern.2\bodyfontsize}%
\fi
\vrule
\s!height \gridboxwidth
@@ -2225,10 +2225,10 @@
\scratchwidth\dimexpr\wd\nextbox+\scratchdistance\relax
\ifx\m_spac_hanging_location\v!right
\frozen\hangindent\ifconditional\displaylefttoright-\fi\scratchwidth
- \rlap{\hskip\dimexpr\hsize-\leftskip-\wd\nextbox\relax\box\nextbox}% \leftskip is new
+ \rlap{\kern\dimexpr\hsize-\leftskip-\wd\nextbox\relax\box\nextbox}% \leftskip is new
\else
\frozen\hangindent\ifconditional\displaylefttoright\else-\fi\scratchwidth
- \llap{\box\nextbox\hskip\scratchdistance}%
+ \llap{\box\nextbox\kern\scratchdistance}%
\fi
\ignorespaces}
diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl
index 3c6772dc0..b8d05fb33 100644
--- a/tex/context/base/mkxl/strc-mat.mkxl
+++ b/tex/context/base/mkxl/strc-mat.mkxl
@@ -29,7 +29,6 @@
%\c!numberstyle=,
%\c!numbercolor=,
%\c!numbercommand=,
- %\c!margin=,
%\c!align=,
%\c!separator=,
% \c!splitmethod=\v!both, % first|last|both|<empty>
@@ -44,12 +43,16 @@
\c!spaceafter=\formulaparameter\c!spacebefore,
\c!spaceinbetween=\v!quarterline,
\c!width=\hsize,
- \c!leftmargin=\zeropoint,
- \c!rightmargin=\zeropoint,
+ \c!margin=\zeropoint,
+ \c!leftmargin=\formulaparameter\c!margin,
+ \c!rightmargin=\formulaparameter\c!margin,
\c!indentnext=\v!no,
\c!alternative=\s!default,
\c!strut=\v!yes, % per 2022-04, was \v!no
\c!numberstrut=\v!yes, % \v!no \v!yes \v!always
+ \c!margindistance=\zeropoint,
+ \c!leftmargindistance=\formulaparameter\c!margindistance,
+ \c!rightmargindistance=\formulaparameter\c!margindistance,
\c!numberthreshold=\emwidth,
\c!numberdistance=2\emwidth]
@@ -341,6 +344,15 @@
{\begingroup
\rm % determines the distance and main font
\edef\p_location{\formulaparameter\c!location}%
+ \ifx\p_location\v!atrightmargin
+ \ifzeropt\s_strc_formulas_margin_right
+ \let\p_location\v!right
+ \fi
+ \orelse\ifx\p_location\v!atleftmargin
+ \ifzeropt\s_strc_formulas_margin_left
+ \let\p_location\v!left
+ \fi
+ \fi
\strc_formulas_show_references
\ifx\p_location\v!right
\strc_formulas_add_distance\plusone\v!left\formulaparameter
@@ -485,26 +497,6 @@
\theformuladestinationattribute\currentnestedformulaattribute
\fi}
-% \def\strc_formulas_handle_numbering_indeed
-% {\ifempty\namedformulaentry
-% \doifelsetext\currentnestedformulasuffix
-% {\strc_counters_increment\v!formula
-% \ifcstok{+}\currentnestedformulasuffix
-% \strc_counters_increment_sub\v!formula\plustwo
-% \else
-% \strc_counters_setown_sub\v!formula\plustwo\currentnestedformulasuffix
-% \fi}%
-% {\ifempty\currentplaceformulasuffix\else
-% \let\currentnestedformulasuffix \currentplaceformulasuffix
-% \let\currentnestedformulareference\currentplaceformulareference
-% \strc_formulas_place_number_nested_check
-% \fi
-% \strc_counters_increment\v!formula}%
-% \fi
-% \glettonothing\currentplaceformulasuffix
-% \glettonothing\currentnestedformulasuffix
-% \placecurrentformulanumber}
-
\def\strc_formulas_handle_numbering_indeed
{\ifempty\namedformulaentry
\doifelsetext\currentnestedformulasuffix
@@ -701,6 +693,7 @@
\newconditional\c_strc_formulas_packed
\newconditional\c_strc_formulas_depth
\newbox \b_strc_formulas_number
+\newdimen \d_strc_formulas_number
\def\strc_formulas_display_space_before_normal
{% not ok, try \stopformula\par\startformula vs \stopformula\startformula
@@ -857,7 +850,7 @@
\scratchdimentwo \ifconditional\c_strc_formulas_tight\formulaparameter\c!numberthreshold\else\zeropoint\fi\relax
\scratchdimenthree.5\exheight
\ifcase\scratchdimentwo\else\ifx#2\v!left
- \middlered
+ \darkred
\kern-\scratchdimentwo
\vrule
\s!height\scratchdimenthree
@@ -865,14 +858,14 @@
\s!width \scratchdimentwo
\fi\fi
\ifcase\scratchdimenone\else
- \ifcase#1\or\middlegreen\else\middleblue\fi
+ \ifcase#1\or\darkgreen\else\darkblue\fi
\vrule
\s!height\scratchdimenthree
\s!depth \scratchdimenthree
\s!width \scratchdimenone
\fi
\ifcase\scratchdimentwo\else\ifx#2\v!right
- \middlered
+ \darkred
\vrule
\s!height\scratchdimenthree
\s!depth \scratchdimenthree
@@ -960,11 +953,6 @@
\global\c_strc_math_split_mode\c_strc_math_flow_mode
\fi
\mathpenaltiesmode\plusone
- \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
- \global\setfalse\c_strc_math_indent
- \else
- \global\settrue\c_strc_math_indent % otherwise no breaks
- \fi
\global\d_strc_math_indent\zeropoint}
\def\strc_math_set_number_location
@@ -1035,26 +1023,6 @@
\boundary\c_bndr_mathalign
\fi}
-% \tolerant\protected\def\strc_math_skip_here[#1]%
-% {% no strut as it will influence fences
-% \ifconditional\c_strc_math_trace_hang
-% \strc_math_trace_okay{darkblue}{S #1}%
-% \fi
-% \scratchdimen\dimexpr\formulaparameter\c!textmargin\relax
-% \ifchkdim#1\or
-% \d_strc_math_hang_state#1%
-% \orelse\ifchknum#1\or
-% \d_strc_math_hang_state#1\scratchdimen
-% \orelse\iftok{#1}{+}%
-% \advanceby\d_strc_math_hang_state\scratchdimen
-% \orelse\iftok{#1}{-}%
-% \advanceby\d_strc_math_hang_state-\scratchdimen
-% \else
-% \d_strc_math_hang_state\scratchdimen
-% \fi
-% \kern\d_strc_math_hang_state
-% \strc_math_pickup_again}
-
\newboundary\c_bndr_skiphere
\tolerant\protected\def\strc_math_skip_here[#1]%
@@ -1091,49 +1059,6 @@
%
% \blank[line] \ruledhbox{zzzz} \blank[line]
-% \tolerant\protected\def\strc_math_text_here[#1]#:#*#=%
-% {\ifparameter#2\or
-% \ifnum\lastboundary=\c_math_begin_boundary\else
-% \ifcstok{#1}\v!right\else
-% \strc_math_break_here
-% \fi
-% \fi
-% \vadjust
-% \ifcstok{#1}\v!before
-% pre
-% \orelse\ifcstok{#1}\v!left
-% pre
-% baseline
-% depth before -\thousandpoint
-% \orelse\ifcstok{#1}\v!right
-% post
-% baseline
-% \fi
-% \bgroup
-% \hbox to \displaywidth \bgroup
-% \strut
-% \ifcstok{#1}\v!right
-% \hfill#2%
-% \else
-% #2\hss
-% \fi
-% \strut
-% \egroup
-% \egroup
-% \ifcstok{#1}\v!right
-% \strc_math_break_here
-% \else
-% % \mathatom class \mathexplicitcode{}%
-% \strc_math_pickup_again
-% \fi
-% \orelse\ifcstok{#1}\v!page
-% \strc_math_page_here
-% \orelse\ifcstok{#1}\v!samepage
-% \strc_math_same_here
-% \else
-% \strc_math_break_here
-% \fi}
-
\definelocalboxes
[\v!lefttext]
[\c!command=\localmarginlefttext\zeropoint,
@@ -1152,10 +1077,10 @@
\installcorenamespace{mathbreakhere}
\def\strc_math_text_here_right#1%
- {\localbox[\v!righttext]{\llap{#1\kern\leftskip}}}
+ {\localbox[\v!righttext]{\llap{#1\kern\rightskip}}}
\def\strc_math_text_here_left#1%
- {\localbox[\v!lefttext]{\rlap{\kern\rightskip#1}}}
+ {\localbox[\v!lefttext]{\rlap{\kern\leftskip#1}}}
\def\strc_math_text_here_before#1%
{\vadjust pre \bgroup
@@ -1285,7 +1210,7 @@
\newconstant\c_strc_math_split_status
\prependtoks
- \c_strc_math_ragged_status\plustwo
+ \c_strc_math_ragged_status\plustwo % middle
\c_strc_math_split_status \zerocount
\to \everymathematics
@@ -1298,29 +1223,31 @@
{\raggedright
\mathgluemode\plustwo
\c_strc_math_ragged_status\plusone
+ \setfalse\c_strc_math_number_swapped
\updateparagraphproperties} % not needed
\defcsname\??mathtextalign\v!middle\endcsname
{\raggedcenter
\mathgluemode\plustwo
\c_strc_math_ragged_status\plustwo
+ \setfalse\c_strc_math_number_swapped
\updateparagraphproperties} % not needed
\defcsname\??mathtextalign\v!flushright\endcsname
{\raggedleft
\mathgluemode\plustwo
\c_strc_math_ragged_status\plusthree
+ \setfalse\c_strc_math_number_swapped
\updateparagraphproperties} % not needed
-\defcsname\??mathtextalign\v!slanted\endcsname
+\defcsname\??mathtextalign\v!slanted\endcsname % maybe move bottom to number location
{\raggedslanted
%\mathgluemode\plustwo
\c_strc_math_ragged_status\plustwo
- \ifcase\c_strc_math_number_location\or
- \parinitleftskip\wd\b_strc_formulas_number % should normally fit
- \else
- \parfillrightskip\wd\b_strc_formulas_number % should normally fit
- \fi
+ \edef\p_distance{\formulaparameter\c!leftmargindistance}%
+ \parinitleftskip \ifx\p_distance\v!number \wd\b_strc_formulas_number \else \p_distance \fi
+ \edef\p_distance{\formulaparameter\c!rightmargindistance}%
+ \parfillrightskip\ifx\p_distance\v!number \wd\b_strc_formulas_number \else \p_distance \fi
\updateparagraphproperties} % not needed
\def\strc_math_setup_align
@@ -1328,6 +1255,8 @@
\lastnamedcs\else\begincsname\??mathtextalign\v!middle\endcsname
\fi}
+% split : wrap (box) and flow (yes)
+
\defcsname\??mathtextalign\v!flushleft:\v!auto\endcsname
{\raggedright
\mathgluemode\plustwo
@@ -1335,14 +1264,14 @@
\strc_math_analyze_box}
\defcsname\??mathtextalign\v!middle:\v!auto\endcsname
- {\raggedright
- \mathgluemode\plustwo
- \c_strc_math_ragged_status\plustwo
- \strc_math_analyze_box}
+ {\raggedright % needed for the lua magick (stage 1)
+ \mathgluemode\plustwo % only shrink (otherwise inconsistent)
+ \c_strc_math_ragged_status\plustwo % needed for the lua magick (stage 2)
+ \strc_math_analyze_box} % lua magick
\defcsname\??mathtextalign\v!flushright:\v!auto\endcsname
{\raggedright
- \mathgluemode\plustwo
+ \mathgluemode\plustwo % only shrink
\c_strc_math_ragged_status\plusthree
\strc_math_analyze_box}
@@ -1391,25 +1320,30 @@
\appendtoks
\global\d_strc_math_indent \zeropoint
\global\c_strc_math_n_of_lines \zerocount
- \global\d_strc_math_max_width \zeropoint
- \global\d_strc_math_first_width \zeropoint
\global\d_strc_math_first_height\zeropoint
- \global\d_strc_math_last_width \zeropoint
+ \global\d_strc_math_first_left \zeropoint
+ \global\d_strc_math_first_right \zeropoint
+ \global\d_strc_math_last_left \zeropoint
+ \global\d_strc_math_last_right \zeropoint
\global\d_strc_math_last_depth \zeropoint
+ \global\d_strc_math_max_right \zeropoint
+ \global\d_strc_math_max_left \zeropoint
+ \global\d_math_strc_hangindent \zeropoint
+ \global\c_math_strc_hangafter \zeropoint
\to \everyresetformulas
\newbox\b_strc_math_display % most code is in math-ali (for historical reasons)
-\newgluespec\s_strc_formulas_margin_left
-\newgluespec\s_strc_formulas_margin_right
+\newgluespec\s_strc_formulas_margin_left % maybe just dimen
+\newgluespec\s_strc_formulas_margin_right % idem
\def\strc_formulas_set_paragraph
{%\setlocalhsize
%\hsize\localhsize
%
\d_strc_formulas_display_width\formulaparameter\c!width\relax
- \s_strc_formulas_margin_left \leftskip
- \s_strc_formulas_margin_right\rightskip
+% \s_strc_formulas_margin_left \leftskip
+% \s_strc_formulas_margin_right\rightskip
\edef\p_margin{\formulaparameter\c!leftmargin}%
\ifempty\p_margin \else
\doadaptleftskip\p_margin
@@ -1418,85 +1352,39 @@
\ifempty\p_margin \else
\doadaptrightskip\p_margin
\fi
- \edef\p_margin{\formulaparameter\c!margin}%
- \ifempty\p_margin \else
- \doadaptleftskip\p_margin
- \doadaptrightskip\p_margin
- \fi
- % this was lost
+% \edef\p_margin{\formulaparameter\c!margin}%
+% \ifempty\p_margin \else
+% \doadaptleftskip\p_margin
+% \doadaptrightskip\p_margin
+% \fi
+ \s_strc_formulas_margin_left \leftskip
+ \s_strc_formulas_margin_right\rightskip
\edef\p_interlinespace{\formulaparameter\c!interlinespace}%
\ifempty\p_interlinespace\else\baselineskip\p_interlinespace\fi
- % and is now back
\global\setfalse\c_strc_math_aligned_here
\hsize\d_strc_formulas_display_width
\displaywidth\hsize
\displayindent\zeropoint}
-% \def\strc_math_analyze_box
-% {\clf_handlemathhang
-% stage \plusone
-% alignstate \c_strc_math_ragged_status
-% box \b_strc_math_display
-% distance \formulaparameter\c!textdistance
-% \relax
-% %\holdingmigrations\zerocount
-% \setbox\b_strc_math_display\vbox\bgroup % \vtop
-% \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
-% % we can't end up here
-% \orelse\ifconditional\c_strc_math_aligned_here
-% \ifzeropt\d_strc_math_indent\else
-% \hangafter\plusone
-% \hangindent\d_strc_math_indent
-% \fi
-% % \strc_math_setup_align % _inner
-% \else
-% \strc_math_setup_align
-% \fi
-% % \strc_math_setup_spacing\formulaparameter
-% \strc_math_setup_penalties
-% \unhbox\b_strc_math_display
-% \egroup
-% \clf_handlemathhang
-% stage \ifconditional\c_strc_math_aligned_here \plustwo \else \plusthree \fi
-% % alignstate \c_strc_math_ragged_status
-% % box \b_strc_math_display
-% % distance \formulaparameter\c!textdistance
-% \relax
-% %
-% \begingroup
-% \edef\v_spac_whitespace_current{\formulaparameter\c!spaceinbetween}%
-% \spac_whitespace_setup
-% \clf_handlemathhang
-% stage \plusfour
-% inbetween 1\parskip
-% height \strutht
-% depth \strutdp
-% \relax
-% \endgroup}
-
\def\strc_math_analyze_box
{\clf_handlemathhang
stage \plusone
alignstate \c_strc_math_ragged_status
box \b_strc_math_display
distance \formulaparameter\c!textdistance
+ leftmargin \the\dimexpr\s_strc_formulas_margin_left\relax
+ rightmargin \the\dimexpr\s_strc_formulas_margin_right\relax
\relax
%\holdingmigrations\zerocount
\setbox\b_strc_math_display\vbox\bgroup % \vtop
- \ifnum\c_strc_math_split_mode=\c_strc_math_line_mode
- % we can't end up here
- \orelse\ifconditional\c_strc_math_aligned_here
+ % beware: everypar is doing sidefloats here so we then have hang values set
+ % but we have no local leftskip and rightskip as they are reflected in hsize
+ \strc_formulas_trigger_side_box
+ \ifconditional\c_strc_math_aligned_here
\ifzeropt\d_strc_math_indent\else
-% \ifnum\c_page_sides_hangafter=\zerocount
-% \hangafter\plusone
-% \hangindent\d_strc_math_indent
-% \else
- % this might become the default anyway:
- \advanceby\leftskip\d_strc_math_indent
- \hskip-\d_strc_math_indent
-% \fi
+ \advanceby\leftskip\d_strc_math_indent % which is why we see a leftskip reported !
+ \hskip-\d_strc_math_indent
\fi
- % \strc_math_setup_align % _inner
\else
\strc_math_setup_align
\fi
@@ -1523,49 +1411,34 @@
\relax
\endgroup}
-\def\strc_math_show_margins_there
- {\vadjust pre \bgroup
- \c_attr_visual\attributeunsetvalue
- \hbox to \hsize \bgroup
- \setbox\scratchbox\hbox to \hsize\bgroup
- \bgroup\darkred \vrule \s!width\leftskip \egroup\hss
- \bgroup\darkgray\leaders\vrule\hfill \egroup\hss
- \bgroup\white \vrule \s!width\emwidth \egroup\hss
- \bgroup\darkgray\leaders\vrule\hfill \egroup\hss
- \bgroup\darkblue\vrule \s!width\rightskip\egroup
- \egroup
- \ht\scratchbox1.2\exheight
- \dp\scratchbox0.4\exheight
- \strut
- \box\scratchbox
- \hskip-\hsize
- \hbox to \hsize \bgroup
- \white
- \infofont
- \hskip1\leftskip
- \quad
- \formulaparameter\c!split
- \quad
- \formulaparameter\c!align
- \egroup
- \egroup
- \egroup}
-
\let\strc_math_inject_show_margins_here\relax
-\def\strc_math_show_margins_indeed
- {\gdef\strc_math_inject_show_margins_here
- {\strc_math_show_margins_there
- \glet\strc_math_inject_show_margins_here\relax}%
- \appendtoks\strc_math_inject_show_margins_here\to\everypar}
+\integerdef\c_strc_math_positioning\zerocount
+
+%D For practical reasons this one is kept extern:
+
+\newconditional\c_strc_math_ignore_number % for testing space compatibility
+
+\fetchmodulecommand \showmathmargins \f!math_run
\installtextracker
{math.showmargins}
- {\let\strc_math_show_margins\strc_math_show_margins_indeed}
- {\let\strc_math_show_margins\relax}
+ {\def\strc_math_show_margins{\showmathmargins[\v!all]}%
+ \let\strc_math_flush_number_box\strc_math_flush_number_box_visual}
+ {\let\strc_math_show_margins\relax
+ \let\strc_math_flush_number_box\strc_math_flush_number_box_normal}
+
+\installtextracker
+ {math.showmargins.less}
+ {\def\strc_math_show_margins{\showmathmargins}%
+ \let\strc_math_flush_number_box\strc_math_flush_number_box_visual}
+ {\let\strc_math_show_margins\relax
+ \let\strc_math_flush_number_box\strc_math_flush_number_box_normal}
\let\strc_math_show_margins\relax
+%D Till here.
+
\def\strc_math_set_options#1%
{\setfalse\c_strc_formulas_tight
\setfalse\c_strc_formulas_packed
@@ -1583,8 +1456,46 @@
\rawprocesscommacommand[\p_option]\strc_formulas_option
\fi}
+% This is an experiment!
+
+% \lettonothing\strc_formulas_start_side_box
+% \lettonothing\strc_formulas_stop_side_box
+% \lettonothing\strc_formulas_check_side_box
+% \lettonothing\strc_formulas_trigger_side_box
+
+\newdimen\d_strc_math_side_width
+
+\def\strc_formulas_check_side_box
+ {\doifelsesidefloat
+ {\d_strc_math_side_width\d_page_sides_width}%
+ {\d_strc_math_side_width\zeropoint}}
+
+\def\strc_formulas_start_side_box
+ {\ifzeropt\d_strc_math_side_width\else
+ \advance\displaywidth-\d_strc_math_side_width
+ \ifnum\c_page_sides_checks_done<\plustwo
+ % see \strc_formulas_display_space_before_normal
+ \vkern-\strutht % quite a hack
+ \fi
+ \dontleavehmode\dbox
+ \fi
+ \bgroup}
+
+\def\strc_formulas_stop_side_box
+ {\egroup}
+
+\def\strc_formulas_trigger_side_box
+ {\ifzeropt\d_strc_math_side_width\else
+ \advance\hsize-\d_strc_math_side_width
+ \forgeteverypar
+ \dontleavehmode
+ \fi}
+
+% End of experiment.
+
\tolerant\protected\def\strc_formulas_start_formula#1#:#*[#2]% setting leftskip adaption is slow !
- {\ifhmode
+ {\strc_formulas_check_side_box
+ \ifhmode
\par
\fi
\bgroup % HERE
@@ -1853,15 +1764,20 @@
{\xdef\currentplaceformulasuffix{#1}%
\strc_formulas_place_nop}
-\protected\def\strc_formulas_place_nop
- {\doifelsenextchar$\strc_formulas_place_pickup\strc_formulas_place_indeed} % [ref]$$ [ref]\start
+%D We no longer picku p $$ as this is now equivalent to inline:
-\protected\def\strc_formulas_place_indeed
- {\strc_formulas_place_numbering}
+% \protected\def\strc_formulas_place_nop
+% {\doifelsenextchar$\strc_formulas_place_pickup\strc_formulas_place_indeed} % [ref]$$ [ref]\start
+%
+% \protected\def\strc_formulas_place_indeed
+% {\strc_formulas_place_numbering}
+%
+% \protected\def\strc_formulas_place_pickup$$#1$$%
+% {\strc_formulas_place_numbering
+% \strc_formulas_start_formula{}#1\strc_formulas_stop_formula}
-\protected\def\strc_formulas_place_pickup$$#1$$%
- {\strc_formulas_place_numbering
- \strc_formulas_start_formula{}#1\strc_formulas_stop_formula}
+\protected\def\strc_formulas_place_nop
+ {\strc_formulas_place_numbering}
% \let\startplaceformula\placeformula
% \let\stopplaceformula \relax
@@ -1984,15 +1900,15 @@
% \stopplaceformula
% \stoptext
+% Relaxing in the macro is really needed because otherwise we get spurious
+% numbers probably due to some % interference with other local variables
+
\def\strc_formulas_place_number_in_box
{\dostarttagged\t!formulacaption\empty
- % this is really needed, otherwise we get spurious numbers probably due to some
- % interference with other local variables .. also keep an eye on eqtest in the
- % MS tests
- \glet\strc_formulas_place_number \relax
- %\glet\strc_formulas_place_number_nested\gobbletwoarguments
- %
+ \glet\strc_formulas_place_number \relax
+ %\glet\strc_formulas_place_number_nested\gobbletwoarguments
\global\setbox\b_strc_formulas_number\naturalhbox{\strc_formulas_number_indeed}%
+ \global\d_strc_formulas_number\wd\b_strc_formulas_number
\dostoptagged}
\let\strc_formulas_flush_number\relax
diff --git a/tex/context/base/mkxl/strc-ref.lmt b/tex/context/base/mkxl/strc-ref.lmt
index 272e7e992..45177c5db 100644
--- a/tex/context/base/mkxl/strc-ref.lmt
+++ b/tex/context/base/mkxl/strc-ref.lmt
@@ -1654,6 +1654,9 @@ local function identify_inner(set,var,prefix,collected,derived)
end
--
local n, list = resolvers.jobs.currentstructure()
+-- print(prefix)
+-- inspect(set)
+-- inspect(list)
if list then
for i=#list,1,-1 do
local l = list[i]
@@ -1661,8 +1664,9 @@ local function identify_inner(set,var,prefix,collected,derived)
if i then
i = i[inner]
if i then
- -- return finish_inner(set,var,"",i)
- return finish_inner(set,var,l,i)
+local p = i.references.prefix or l -- which is what we use in the destination
+-- return finish_inner(set,var,l,i)
+ return finish_inner(set,var,p,i)
end
end
end
diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl
index db100f0dd..09d742e56 100644
--- a/tex/context/base/mkxl/strc-sec.mkxl
+++ b/tex/context/base/mkxl/strc-sec.mkxl
@@ -225,6 +225,12 @@
titledata {
label {\detokenize\expandafter{\currentstructurelabel}}
title {\detokenize\expandafter{\currentstructuretitle}}
+% alternative 1:
+% label {\detokened\currentstructurelabel}
+% title {\detokened\currentstructuretitle}
+% alternative 2, detokened scanner:
+% label \currentstructurelabel
+% title \currentstructuretitle
\ifx\currentstructurebookmark\currentstructuretitle \else
bookmark {\detokenize\expandafter{\currentstructurebookmark}}
\fi
diff --git a/tex/context/base/mkxl/syst-con.lmt b/tex/context/base/mkxl/syst-con.lmt
new file mode 100644
index 000000000..a429b4d92
--- /dev/null
+++ b/tex/context/base/mkxl/syst-con.lmt
@@ -0,0 +1,113 @@
+if not modules then modules = { } end modules ['syst-con'] = {
+ version = 1.001,
+ comment = "companion to syst-con.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local tonumber = tonumber
+local math = math
+local utfchar = utf.char
+local gsub = string.gsub
+local concat, reverse = table.concat, table.reverse
+
+converters = converters or { }
+local converters = converters
+
+local context = context
+local commands = commands
+local implement = interfaces.implement
+
+local formatters = string.formatters
+
+function converters.hexstringtonumber(n) tonumber(n,16) end
+function converters.octstringtonumber(n) tonumber(n, 8) end
+
+local f_lchexnumber = formatters["%x"]
+local f_uchexnumber = formatters["%X"]
+local f_lchexnumbers = formatters["%02x"]
+local f_uchexnumbers = formatters["%02X"]
+local f_octnumber = formatters["%03o"]
+local nicenumber = formatters["%0.6F"] -- or N
+
+local lchexnumber = function(n) if n < 0 then n = 0x100000000 + n end return f_lchexnumber (n) end
+local uchexnumber = function(n) if n < 0 then n = 0x100000000 + n end return f_uchexnumber (n) end
+local lchexnumbers = function(n) if n < 0 then n = 0x100000000 + n end return f_lchexnumbers(n) end
+local uchexnumbers = function(n) if n < 0 then n = 0x100000000 + n end return f_uchexnumbers(n) end
+local octnumber = function(n) if n < 0 then n = 0x100000000 + n end return f_octnumber (n) end
+
+converters.lchexnumber = lchexnumber
+converters.uchexnumber = uchexnumber
+converters.lchexnumbers = lchexnumbers
+converters.uchexnumbers = uchexnumbers
+converters.octnumber = octnumber
+converters.nicenumber = nicenumber
+
+implement { name = "hexstringtonumber", actions = { tonumber, context }, arguments = { "integer", 16 } }
+implement { name = "octstringtonumber", actions = { tonumber, context }, arguments = { "integer", 8 } }
+
+implement { name = "rawcharacter", actions = function(n) context(utfchar(0x110000+n)) end, arguments = "integer" }
+
+implement { name = "lchexnumber", actions = { lchexnumber, context }, arguments = "integer" }
+implement { name = "uchexnumber", actions = { uchexnumber, context }, arguments = "integer" }
+implement { name = "lchexnumbers", actions = { lchexnumbers, context }, arguments = "integer" }
+implement { name = "uchexnumbers", actions = { uchexnumbers, context }, arguments = "integer" }
+implement { name = "octnumber", actions = { octnumber, context }, arguments = "integer" }
+
+-- replaced by posits
+
+implement { name = "sin", actions = { math.sin, nicenumber, context }, arguments = "number" }
+implement { name = "cos", actions = { math.cos, nicenumber, context }, arguments = "number" }
+implement { name = "tan", actions = { math.tan, nicenumber, context }, arguments = "number" }
+
+implement { name = "sind", actions = { math.sind, nicenumber, context }, arguments = "number" }
+implement { name = "cosd", actions = { math.cosd, nicenumber, context }, arguments = "number" }
+implement { name = "tand", actions = { math.tand, nicenumber, context }, arguments = "number" }
+
+-- only as commands
+
+function commands.format(fmt,...) context((gsub(fmt,"@","%%")),...) end
+
+implement {
+ name = "formatone", -- used as such so no name change here
+ public = true,
+ protected = true,
+ arguments = "2 strings",
+ actions = function(f,s) context((gsub(f,"@","%%")),s) end,
+}
+
+local function tobits(b,w,d)
+ local t = { }
+ if not w then
+ w = 32
+ end
+ local m = d
+ local k = 0
+ for i=1,w do
+ k = k + 1 ; t[k] = (b & 0x1) == 1 and "1" or "0"
+ if m then
+ m = m - 1
+ if m == 0 then
+ k = k + 1 ; t[k] = " "
+ m = d
+ end
+ end
+ b = b >> 1
+ end
+ return concat(reverse(t))
+end
+
+implement {
+ name = "tobits",
+ public = true,
+ arguments = "3 integers",
+ actions = function(w,d,n) context(tobits(n,w,d)) end, -- fast enough
+}
+
+implement {
+ name = "tohexa",
+ public = true,
+ arguments = "2 integers",
+ actions = function(w,n) context("0x%0"..w.."X",n) end, -- somewhat slow
+}
diff --git a/tex/context/base/mkxl/syst-con.mkxl b/tex/context/base/mkxl/syst-con.mkxl
index ed4a4f3c5..0b88f8ddf 100644
--- a/tex/context/base/mkxl/syst-con.mkxl
+++ b/tex/context/base/mkxl/syst-con.mkxl
@@ -41,13 +41,6 @@
\permanent\def\hexstringtonumber#1{\clf_hexstringtonumber\numexpr#1\relax}
\permanent\def\octstringtonumber#1{\clf_octstringtonumber\numexpr#1\relax}
-%D \macros{rawcharacter}
-%D
-%D This macro can be used to produce proper 8 bit characters that we sometimes need
-%D in backends and round||trips.
-
-\permanent\def\rawcharacter#1{\clf_rawcharacter\numexpr#1\relax}
-
%D \macros{twodigits, threedigits}
%D
%D These macros provides two or three digits always:
@@ -85,4 +78,12 @@
%D The \type {\modulatednumber} and \type {\realnumber} macros have been removed.
+%D \macros{tobits}
+%D
+%D Thso macro expects a number of bits, chunk size and the number.
+%D
+%D \starttyping
+%D \tobits 32 4 "00000003
+%D \stoptyping
+
\protect \endinput
diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl
index 039e9456b..bcf2bfc69 100644
--- a/tex/context/base/mkxl/syst-ini.mkxl
+++ b/tex/context/base/mkxl/syst-ini.mkxl
@@ -1169,11 +1169,11 @@
%D Sometimes kerns make more sense than glue but we need to be in the right mode:
-\permanent\protected\def\vkern {\ifhmode\par \fi\kern}
-\permanent\protected\def\hkern {\ifvmode\dontleavehmode\fi\kern}
+\ifdefined\vkern \else \permanent\protected\def\vkern {\ifhmode\par \fi\kern} \fi
+\ifdefined\hkern \else \permanent\protected\def\hkern {\ifvmode\dontleavehmode\fi\kern} \fi
-\permanent\protected\def\vpenalty{\ifhmode\par \fi\penalty}
-\permanent\protected\def\hpenalty{\ifvmode\dontleavehmode\fi\penalty}
+\ifdefined\vpenalty \else \permanent\protected\def\vpenalty{\ifhmode\par \fi\penalty} \fi
+\ifdefined\hpenalty \else \permanent\protected\def\hpenalty{\ifvmode\dontleavehmode\fi\penalty} \fi
%D Again a few kind-of-extensions the core. These come from plain \TEX\ but are
%D probably not used in \CONTEXT.
diff --git a/tex/context/base/mkxl/tabl-ltb.mkxl b/tex/context/base/mkxl/tabl-ltb.mkxl
index 7fcdba6f2..f060c5e12 100644
--- a/tex/context/base/mkxl/tabl-ltb.mkxl
+++ b/tex/context/base/mkxl/tabl-ltb.mkxl
@@ -301,7 +301,7 @@
\c!height=\ifempty\p_height\ht\scratchbox\else\p_height\fi,
\c!depth=\ifempty\p_depth \dp\scratchbox\else\p_depth \fi,
\c!width=\wd\scratchbox]%
- \hskip-\wd\scratchbox\box\scratchbox}}
+ \hkern-\wd\scratchbox\box\scratchbox}}
\def\tabl_lines_wrap_up_auto_r
{\hpack
@@ -313,7 +313,7 @@
\c!height=\ht\scratchbox,
\c!depth=\dp\scratchbox,
\c!width=\wd\scratchbox]%
- \hskip-\wd\scratchbox\box\scratchbox}}
+ \hkern-\wd\scratchbox\box\scratchbox}}
\def\tabl_lines_wrap_up_line
{\backgroundline[\linetablecparameter\c!backgroundcolor]{\box\scratchbox}}
diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl
index b82dcb585..fd51541af 100644
--- a/tex/context/base/mkxl/tabl-ntb.mkxl
+++ b/tex/context/base/mkxl/tabl-ntb.mkxl
@@ -1478,9 +1478,9 @@
\dostoptagged}
\protected\def\tabl_ntb_span#1%
- {\hskip\tabl_ntb_get_dis\c_tabl_ntb_col
+ {\hkern\tabl_ntb_get_dis\c_tabl_ntb_col
\localcontrolledloop\plusone#1\plusone
- {\hskip\tabl_ntb_get_wid\c_tabl_ntb_col\relax
+ {\hkern\tabl_ntb_get_wid\c_tabl_ntb_col\relax
\global\advanceby\c_tabl_ntb_col\plusone}}
\protected\def\tabl_ntb_skip#1%
@@ -2168,7 +2168,7 @@
\tabl_ntb_anchor_start{#1}{#2}%
\inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop}%
\tabl_ntb_anchor_stop
- \hskip\tabl_ntb_get_dis{#2}%
+ \hkern\tabl_ntb_get_dis{#2}%
\endgroup}
\newtoks\everyresetTABLEyes
diff --git a/tex/context/base/mkxl/toks-aux.lmt b/tex/context/base/mkxl/toks-aux.lmt
index 2027ed78e..d9adb1d67 100644
--- a/tex/context/base/mkxl/toks-aux.lmt
+++ b/tex/context/base/mkxl/toks-aux.lmt
@@ -192,6 +192,7 @@ tex.normalizeparcodes = getthem(tex.getnormalizeparvalues, "normalizepar
tex.automigrationcodes = getthem(tex.getautomigrationvalues, "automigrationcode")
tex.parcontextcodes = getthem(tex.getparcontextvalues, "parcontextcode")
tex.textcontrolcodes = getthem(tex.gettextcontrolvalues ) -- only at lua end
+tex.fitnesscodes = getthem(tex.getfitnessvalues ) -- only at lua end
tex.listanchorcodes = getthem(tex.getlistanchorvalues, "listanchorcode")
tex.listsigncodes = getthem(tex.getlistsignvalues, "listsigncode")
tex.classoptioncodes = getthem(tex.getmathclassoptionvalues, "classoptioncode")
diff --git a/tex/context/base/mkxl/toks-ini.lmt b/tex/context/base/mkxl/toks-ini.lmt
index d45e3ae1c..e232fae0d 100644
--- a/tex/context/base/mkxl/toks-ini.lmt
+++ b/tex/context/base/mkxl/toks-ini.lmt
@@ -56,6 +56,7 @@ local scanluainteger = token.scanluainteger
local scanluacardinal = token.scanluacardinal
local scanintegerargument = token.scanintegerargument
local scandimenargument = token.scandimenargument
+local scandetokened = token.scandetokened
local scannumber = token.scannumber
local scanboolean = token.scanboolean
@@ -186,6 +187,7 @@ tokens.scanners = { -- these expand
keywordcs = scankeywordcs,
csname = scancsname,
nextchar = scannextchar,
+ detokened = scandetokened,
next = token.scannext,
nextexpanded = token.scannextexpanded,
diff --git a/tex/context/base/mkxl/toks-scn.lmt b/tex/context/base/mkxl/toks-scn.lmt
index 855bca6ad..5e6a5e8ad 100644
--- a/tex/context/base/mkxl/toks-scn.lmt
+++ b/tex/context/base/mkxl/toks-scn.lmt
@@ -44,6 +44,7 @@ local scangluespec = scanners.gluespec
local scancsname = scanners.csname
local scanintegerargument = scanners.integerargument
local scandimenargument = scanners.dimenargument
+local scandetokened = scanners.detokened
local todimen = number.todimen
local toboolean = toboolean
@@ -258,6 +259,7 @@ local shortcuts = {
scanargumentasis = scanargumentasis,
scanintegerargument = scanintegerargument,
scandimenargument = scandimenargument,
+ scandetokened = scandetokened,
todimen = todimen,
tonumber = tonumber,
tostring = tostring,
diff --git a/tex/context/base/mkxl/trac-tex.lmt b/tex/context/base/mkxl/trac-tex.lmt
new file mode 100644
index 000000000..df125cb12
--- /dev/null
+++ b/tex/context/base/mkxl/trac-tex.lmt
@@ -0,0 +1,113 @@
+if not modules then modules = { } end modules ['trac-tex'] = {
+ version = 1.001,
+ comment = "companion to trac-deb.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local texhashtokens = tex.hashtokens
+
+local trackers = trackers
+local token = token
+local saved = { }
+local create = token.create
+local undefined = create("undefined").command
+
+function trackers.savehash()
+ saved = texhashtokens()
+ return saved
+end
+
+function trackers.dumphashtofile(filename,delta)
+ local list = { }
+ local hash = texhashtokens()
+ local create = token.create
+ for i=1,#hash do
+ local name = hash[i]
+ if not delta or not saved[name] then
+ local token = create(name)
+ if token.command ~= undefined then
+ local category = token.cmdname
+ local dk = list[category]
+ if not dk then
+ dk = {
+ names = { },
+ found = 0,
+ -- code = token[1],
+ }
+ list[category] = dk
+ end
+ if token.protected then
+ if token.expandable then
+ dk.names[name] = "ep"
+ else
+ dk.names[name] = "-p"
+ end
+ else
+ if token.expandable then
+ dk.names[name] = "ep"
+ else
+ dk.names[name] = "--"
+ end
+ end
+ dk.found = dk.found + 1
+ end
+ end
+ end
+ table.save(filename or tex.jobname .. "-hash.log",list)
+end
+
+local delta = nil
+
+local function dump_hash(wanteddelta)
+ if delta == nil then
+ saved = saved or trackers.savehash()
+ luatex.registerstopactions(1,function() dump_hash(nil,wanteddelta) end) -- at front
+ end
+ delta = wanteddelta
+end
+
+directives.register("system.dumphash", function() dump_hash(false) end)
+directives.register("system.dumpdelta", function() dump_hash(true ) end)
+
+local function saveusedfilesintrees(format)
+ local data = {
+ jobname = environment.jobname or "?",
+ version = environment.version or "?",
+ kind = environment.kind or "?",
+ files = resolvers.foundintrees()
+ }
+ local filename = file.replacesuffix(environment.jobname or "context-job",'jlg')
+ if format == "lua" then
+ io.savedata(filename,table.serialize(data,true))
+ else
+ io.savedata(filename,table.toxml(data,"job"))
+ end
+end
+
+directives.register("system.dumpfiles", function(v)
+ luatex.registerstopactions(function() saveusedfilesintrees(v) end)
+end)
+
+local profiled = table.setmetatableindex("number")
+
+interfaces.implement {
+ name = "profilemacro",
+ arguments = "csname",
+ actions = function(cs)
+ profiled[cs] = profiled[cs] + 1
+ end,
+}
+
+interfaces.implement {
+ name = "showprofiledmacros",
+ public = true,
+ protected = true,
+ actions = function(cs)
+ for k, v in table.sortedhash(profiled) do
+ logs.report("profiled", "%s : %i",k,v)
+ end
+ end,
+}
+
diff --git a/tex/context/base/mkxl/trac-tex.mkxl b/tex/context/base/mkxl/trac-tex.mkxl
index cf46bed26..2926a90b2 100644
--- a/tex/context/base/mkxl/trac-tex.mkxl
+++ b/tex/context/base/mkxl/trac-tex.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Tracking Macros / TeX}
-\registerctxluafile{trac-tex}{}
+\registerctxluafile{trac-tex}{autosuffix}
%D All tracing flags at the \TEX\ end will be redone this way so
%D that we have a similar mechanism for \TEX\ and \LUA. Also, the
@@ -40,31 +40,26 @@
\permanent\protected\def\nomkivstatistics{\enabledirectives[system.nostatistics]}
-%D This is not really a tracker but for decades it lived in my \type {cont-loc}
-%D file. I moved it here because I wanted someone else to use it. This macro is not
-%D really useful for users. I kept the \LUA\ variant in \type {cont-loc.mkiv}.
+%D Finally this one got moved from cont-exp to here (replacing the old one):
-\installcorenamespace{profilemacrocount}
-\installcorenamespace{profilemacromacro}
-
-\newtoks\t_syst_profile
-
-\appendtoks
- \the\t_syst_profile
-\to \everystoptext
+\installcorenamespace{profilemacro}
\permanent\protected\def\profilemacro#1% an oldie, but modernized a bit
{\edef\p_name{\csstring#1}%
- \ifcsname\??profilemacrocount\p_name\endcsname \else
- \expandafter\newinteger\csname\??profilemacrocount\p_name\endcsname
- \letcsname\??profilemacromacro\p_name\endcsname#1%
- \xtoksapp\t_syst_profile
- {\writestatus
- {profile}%
- {\string#1: \noexpand\the\csname\??profilemacrocount\p_name\endcsname}}%
- \enforced\protected\xdef#1%
- {\global\advanceby\csname\??profilemacrocount\p_name\endcsname\plusone
- \expandafter\noexpand\csname\??profilemacromacro\p_name\endcsname}%
+ \ifcsname\??profilemacro\p_name\endcsname \else
+ \aliased\letcsname\??profilemacro\p_name\endcsname#1%
+ % \enforced\protected\xdef#1%
+ \untraced\enforced\ifflags#1\protected\protected\fi\xdef#1%
+ {\noexpand\clf_profilemacro\noexpand#1%
+ \expandafter\noexpand\csname\??profilemacro\p_name\endcsname}%
\fi}
+% \appendtoks
+% {\appendtoks\showprofiledmacros\to\everystoptext}%
+% \to \everydump
+
+\appendtoks
+ \showprofiledmacros
+\to \everystoptext
+
\protect \endinput
diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt
index 9b467de29..b97a8d7d1 100644
--- a/tex/context/base/mkxl/trac-vis.lmt
+++ b/tex/context/base/mkxl/trac-vis.lmt
@@ -180,12 +180,21 @@ local userrule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule")
local outlinerule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule")
local emptyrule -- bah, not yet defined: todo, delayed(nuts.rules,"userrule")
-local function initialize()
- --
+local function getusedfont()
if not usedfont then
-- we use a narrow monospaced font -- infofont ?
visualizers.setfont(fonts.definers.define { name = "lmmonoltcond10regular", size = tex.sp("4pt") })
end
+ return usedfont
+end
+
+visualizers.getusedfont = getusedfont
+
+local function initialize()
+ --
+ if not usedfont then
+ getusedfont()
+ end
--
for mode, value in next, modes do
local tag = formatters["v_%s"](mode)
@@ -903,11 +912,8 @@ end
rest = emptyrule(wd,ht,dp) -- we accept some overhead
elseif what == "_D_" then
-- also the other line
- local up = nil
local list = getlist(current)
- if list then
- up = getheight(list)
- end
+ local up = list and getheight(list) or 0
rest = userrule {
width = wd,
height = ht,
@@ -1861,6 +1867,8 @@ do
local saved = current
if trace_math then
head, current = ruledmath(head,current)
+ elseif trace_penalty then
+ head, current = ruledpenalty(head,current,false,true)
end
elseif id == dir_code then
if trace_dir then
diff --git a/tex/context/base/mkxl/typo-brk.lmt b/tex/context/base/mkxl/typo-brk.lmt
index 3a7b69db9..c5532c291 100644
--- a/tex/context/base/mkxl/typo-brk.lmt
+++ b/tex/context/base/mkxl/typo-brk.lmt
@@ -406,7 +406,7 @@ local enabled = false
function breakpoints.define(name)
local data = numbers[name]
if data then
- -- error
+ report_breakpoints("there is already a breakpoints class %a",name)
else
local number = #mapping + 1
local data = {
@@ -439,6 +439,8 @@ function breakpoints.setreplacement(name,char,language,settings)
middle = middle ~= "" and middle or nil,
skip = settings.range == v_yes,
} -- was { type or 1, before or 1, after or 1 }
+ else
+ report_breakpoints("there is no breakpoints class %a",name)
end
end
diff --git a/tex/context/base/mkxl/typo-brk.mkxl b/tex/context/base/mkxl/typo-brk.mkxl
index 0988e3a6b..3e386de20 100644
--- a/tex/context/base/mkxl/typo-brk.mkxl
+++ b/tex/context/base/mkxl/typo-brk.mkxl
@@ -27,6 +27,14 @@
% see below: \exhyphenchar \minusone % we use a different order than base tex, so we really need this
+% \definebreakpoints [test]
+%
+% \definebreakpoint [test][:][nleft=3,nright=3,type=1]
+% \definebreakpoint [test][/][nleft=3,nright=3,type=1]
+%
+% {\setbreakpoints[test]\hsize1mm\nohyphens x boundary:boundary/boundary\par}
+% {\setbreakpoints[test]\hsize1mm x boundary:boundary/boundary\par} % still hyphenated
+
\permanent\tolerant\protected\def\definebreakpoints[#1]%
{\clf_definebreakpoints{#1}} % todo: public implementor
@@ -82,7 +90,7 @@
% \stop
% \mainlanguage[czech]
-% \definebreakpoint [compound] [\number`-] [language=cs,nleft=3,nright=3,type=4]
+% \definebreakpoint [compound] [-] [language=cs,nleft=3,nright=3,type=4]
% \setbreakpoints[compound]
% \start \hsize 1mm test-test \par \stop
diff --git a/tex/context/base/mkxl/typo-del.mkxl b/tex/context/base/mkxl/typo-del.mkxl
index bd427b954..025d6ffcf 100644
--- a/tex/context/base/mkxl/typo-del.mkxl
+++ b/tex/context/base/mkxl/typo-del.mkxl
@@ -655,7 +655,7 @@
\dontleavehmode
\edef\p_delimited_margin{\delimitedtextparameter\c!location}%
\ifx\p_delimited_margin\v!margin
- \hskip-\wd\scratchbox
+ \kern-\wd\scratchbox
\fi
\box\scratchbox
\dostoptagged}
diff --git a/tex/context/base/mkxl/typo-itm.mkxl b/tex/context/base/mkxl/typo-itm.mkxl
index 5a10cfc9d..46d46dfb3 100644
--- a/tex/context/base/mkxl/typo-itm.mkxl
+++ b/tex/context/base/mkxl/typo-itm.mkxl
@@ -235,7 +235,7 @@
\typo_items_construct_items_boxes{#1}%
\noindent\hbox\bgroup
\ifvoid\b_typo_items_symbols \else
- \llap{\box\b_typo_items_symbols\hskip\d_typo_items_distance}%
+ \llap{\box\b_typo_items_symbols\kern\d_typo_items_distance}%
\fi
\box\b_typo_items_texts
\egroup}
diff --git a/tex/context/base/mkxl/typo-mar.mkxl b/tex/context/base/mkxl/typo-mar.mkxl
index 85161c942..395406f42 100644
--- a/tex/context/base/mkxl/typo-mar.mkxl
+++ b/tex/context/base/mkxl/typo-mar.mkxl
@@ -469,7 +469,7 @@
\executeifdefined{\headalternativeparameter\c!margintext}\margintext {
\ifconditional\headshownumber
\headnumbercontent
- \hskip\headnumberdistance
+ \hkern\headnumberdistance
\fi
\headtextcontent
}
diff --git a/tex/context/fonts/mkiv/modern-math.lfg b/tex/context/fonts/mkiv/modern-math.lfg
index ef99513b9..c52b7a70b 100644
--- a/tex/context/fonts/mkiv/modern-math.lfg
+++ b/tex/context/fonts/mkiv/modern-math.lfg
@@ -28,7 +28,7 @@ return {
-- SuperscriptBottomMaxWithSubscript = 344, -- 344 in font .8 exheight
-- SuperscriptBottomMin = 108, -- 108 in font .25 exheight
SuperscriptShiftUp = 413, -- 363 in font (multiplied with 4.9547/4.3536, got 413)
- SuperscriptShiftUpCramped = 413, -- 289 in font (no distinction, old TeX)
+ SuperscriptShiftUpCramped = 329, -- 289 in font (no distinction, old TeX)
PrimeShiftUp = "1.1*SuperscriptShiftUp",
PrimeShiftUpCramped = "1.1*SuperscriptShiftUp",
-- PrimeRaisePercent = 0, -- set to 0 in math-act
diff --git a/tex/context/fonts/mkiv/newcomputermodern-math.lfg b/tex/context/fonts/mkiv/newcomputermodern-math.lfg
index 12c6e8b23..7b505c91f 100644
--- a/tex/context/fonts/mkiv/newcomputermodern-math.lfg
+++ b/tex/context/fonts/mkiv/newcomputermodern-math.lfg
@@ -79,7 +79,7 @@ return {
SubscriptShiftDownWithSuperscript = 247, -- relates to the previous one (see math-act)
SuperscriptBaselineDropMax = 386, -- 250 in font (multiplied by 4.6333/2.99 (values in cm/values in lm))
SuperscriptShiftUp = 413, -- 363 in font (multiplied with 4.9547/4.3536, got 413)
- SuperscriptShiftUpCramped = 413, -- 289 in font (no distinction, old TeX)
+ SuperscriptShiftUpCramped = 329, -- 289 in font (same factor as uncramped one (no distinction, old TeX)
PrimeShiftUp = "1.1*SuperscriptShiftUp",
PrimeShiftUpCramped = "1.1*SuperscriptShiftUp",
},
diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml
index 996ca4f05..7062012f5 100644
--- a/tex/context/interface/mkiv/context-en.xml
+++ b/tex/context/interface/mkiv/context-en.xml
@@ -257,6 +257,8 @@
<cd:constant type="more"/>
<cd:constant type="1*more"/>
<cd:constant type="2*more"/>
+ <cd:constant type="fit"/>
+ <cd:constant type="profile"/>
</cd:keywords>
</cd:arguments>
</cd:command>
diff --git a/tex/context/interface/mkiv/i-align.xml b/tex/context/interface/mkiv/i-align.xml
index 46afca897..67b708281 100644
--- a/tex/context/interface/mkiv/i-align.xml
+++ b/tex/context/interface/mkiv/i-align.xml
@@ -61,6 +61,8 @@
<cd:constant type="more"/>
<cd:constant type="1*more"/>
<cd:constant type="2*more"/>
+ <cd:constant type="fit"/>
+ <cd:constant type="profile"/>
<!--
<cd:constant type="cd:name"/>
-->
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index ee5d4853c..0a88e801a 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 1160ae482..788e6ace3 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkxl/s-math-show.mkxl b/tex/context/modules/mkxl/s-math-show.mkxl
new file mode 100644
index 000000000..456ecc60b
--- /dev/null
+++ b/tex/context/modules/mkxl/s-math-show.mkxl
@@ -0,0 +1,138 @@
+%D \module
+%D [ file=math-run,
+%D version=2023.05.18,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Runtime loaded commands,
+%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.
+
+\unprotect
+
+\permanent\tolerant\protected\gdef\showmathmargins[#1]%
+ {\bgroup
+ \par
+ \c_attr_visual\attributeunsetvalue
+ \ruledhbox to \hsize \bgroup
+ \setbox\scratchbox\hbox to \hsize\bgroup
+ \scratchheight2\lineheight
+ \scratchwidth \onepoint
+ \infofont
+ \ifcstok{#1}\v!all
+ \llap\bgroup
+ \setupinterlinespace
+ \vbox yoffset -\lineheight\bgroup
+ \forgetall
+ \setstrut
+ % \llap{\the \c_strc_math_n_of_lines \enspace \#l}\par
+ \llap{\withoutpt\d_strc_math_first_left \enspace fl}\par
+ \llap{\withoutpt\d_strc_math_last_left \enspace ll}\par
+ \llap{\withoutpt\d_strc_math_max_left \enspace ml}\par
+ \llap{\withoutpt\d_strc_formulas_number \enspace wd}\par
+ \egroup
+ \quad
+ \egroup
+ \fi
+ \ifzeropt\s_strc_formulas_margin_left\else
+ \bgroup\darkred
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \kern-\scratchwidth
+ \vrule \s!width \s_strc_formulas_margin_left
+ \kern-\scratchwidth
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \egroup
+ \fi
+ \ifdim\d_math_strc_hangindent>\zeropoint
+ \bgroup\darkred
+ \vrule \s!width \d_math_strc_hangindent \s!depth 2\exheight \s!height-\exheight
+ \kern-\d_math_strc_hangindent
+ \egroup
+ \fi
+ \bgroup\darkgray
+ \leaders\vrule\hfill
+ \egroup
+ \bgroup\darkgreen
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \egroup
+ \bgroup\darkgray
+ \leaders\vrule\hfill
+ \egroup
+ \ifdim\d_math_strc_hangindent<\zeropoint
+ \bgroup\darkblue
+ \kern\d_math_strc_hangindent
+ \vrule \s!width -\d_math_strc_hangindent \s!depth 2\exheight \s!height-\exheight
+ \egroup
+ \fi
+ \ifzeropt\s_strc_formulas_margin_right\else
+ \bgroup\darkblue
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \kern-\scratchwidth
+ \vrule \s!width \s_strc_formulas_margin_right
+ \kern-\scratchwidth
+ \srule \s!width \scratchwidth \s!height \scratchheight
+ \egroup
+ \fi
+ \ifcstok{#1}\v!all
+ \rlap\bgroup
+ \setupinterlinespace
+ \quad
+ \vbox yoffset -\lineheight\bgroup
+ \forgetall
+ \setstrut
+ \rlap{fr\enspace\withoutpt\d_strc_math_first_right}\par
+ \rlap{lr\enspace\withoutpt\d_strc_math_last_right }\par
+ \rlap{mr\enspace\withoutpt\d_strc_math_max_right }\par
+ \rlap
+ {\formulaparameter\c!location:\enspace
+ p=\the\c_strc_math_positioning\enspace
+ a=\the\c_strc_math_ragged_status\enspace
+ l=\the\c_strc_math_number_location\enspace
+ v=\the\c_strc_math_number_variant}\par
+ \egroup
+ \egroup
+ \fi
+ \global\c_strc_math_positioning\zerocount
+ \egroup
+ \ht\scratchbox1.2\exheight
+ \dp\scratchbox0.4\exheight
+ \strut
+ \box\scratchbox
+ \kern-\hsize
+ \hbox to \hsize \bgroup
+ \white
+ \infofont
+ \kern\s_strc_formulas_margin_left
+ \quad
+ [\the\s_strc_formulas_margin_left]%
+ \hss
+ [\c!split=\iftok{\formulaparameter\c!split}\emptytoks\v!yes \else\formulaparameter\c!split\fi]%
+ \quad
+ [\c!align=\iftok{\formulaparameter\c!align}\emptytoks\v!middle\else\formulaparameter\c!align\fi]%
+ \ifcstok{#1}\v!all\else
+ \quad
+ [\c!location=\formulaparameter\c!location]%
+ \fi
+ \hss
+ [\the\s_strc_formulas_margin_right]%
+ \quad
+ \kern\s_strc_formulas_margin_right
+ \egroup
+ \egroup
+ \par
+ \egroup}
+
+\protect
+
+\continueifinputfile{s-math-show.mkxl}
+
+\starttext
+
+\startformula
+ a + b = c
+\stopformula
+
+\stoptext
diff --git a/tex/context/modules/mkxl/s-text-tests.mkxl b/tex/context/modules/mkxl/s-text-tests.mkxl
index 6766a7a09..e21c3a5b3 100644
--- a/tex/context/modules/mkxl/s-text-tests.mkxl
+++ b/tex/context/modules/mkxl/s-text-tests.mkxl
@@ -15,6 +15,28 @@
%D Here we collect some tests that later will become proper macros.
+\starttext
+ \setuppapersize[S4]
+ \showmakeup[line]
+ \def\Test#1{\start\setupheadertexts[\string#1]#1\samplefile{ward}\page\stop}
+
+ \Test\notragged
+ \Test\raggedleft
+ \Test\raggedcenter
+ \Test\raggedright
+ \Test\veryraggedleft
+ \Test\veryraggedcenter
+ \Test\veryraggedright
+ \Test\raggedwidecenter
+ \Test\centeredlastline
+ \Test\flushedrightlastline
+ \Test\ttraggedright
+ \Test\forgetragged
+ \Test\raggedslanted
+\stoptext
+
+% fonts
+
\usebodyfont[bonum]
\usebodyfont[cambria]
\usebodyfont[concrete]
diff --git a/tex/context/modules/third/mtx-install-imp-modules.lua b/tex/context/modules/third/mtx-install-imp-modules.lua
index 66e986a87..bb9b661df 100644
--- a/tex/context/modules/third/mtx-install-imp-modules.lua
+++ b/tex/context/modules/third/mtx-install-imp-modules.lua
@@ -1,5 +1,7 @@
-- from the context garden
+-- incorrectly packaged: metaducks, sudoku, aquamints
+
return {
name = "mtx-install-imp-modules",
version = "1.00",
@@ -7,19 +9,19 @@ return {
author = "Hans Hagen & others",
copyright = "ConTeXt development team",
lists = {
- ["pocketdiary"] = { url = "modules", zips = { "Collection-of-calendars-based-on-PocketDiary-module.zip" } },
+ ["pocketdiary"] = { url = "modules", zips = { "PocketDiary-V2.zip", "Environment-for-collating-marks.zip", "Collection-of-calendars-based-on-PocketDiary-module.zip" } },
["collating"] = { url = "modules", zips = { "Environment-for-collating-marks.zip" } },
["account"] = { url = "modules", zips = { "t-account.zip" } },
["algorithmic"] = { url = "modules", zips = { "t-algorithmic.zip" } },
["animation"] = { url = "modules", zips = { "t-animation.zip" } },
["annotation"] = { url = "modules", zips = { "t-annotation.zip" } },
- ["aquamints"] = { url = "modules", zips = { "aquamints.zip" } },
+ -- ["aquamints"] = { url = "modules", zips = { "aquamints.zip" } }, -- has top level files
["bibmod-doc"] = { url = "modules", zips = { "bibmod-doc.zip" } },
-- ["bnf-0.3"] = { url = "modules", zips = { "t-bnf-0.3.zip" } },
["bnf"] = { url = "modules", zips = { "t-bnf.zip" } },
["chromato"] = { url = "modules", zips = { "t-chromato.zip" } },
- ["cmscbf"] = { url = "modules", zips = { "t-cmscbf.zip" } },
- ["cmttbf"] = { url = "modules", zips = { "t-cmttbf.zip" } },
+ -- ["cmscbf"] = { url = "modules", zips = { "t-cmscbf.zip" } }, -- obsolete
+ -- ["cmttbf"] = { url = "modules", zips = { "t-cmttbf.zip" } }, -- obsolete
["crossref"] = { url = "modules", zips = { "t-crossref.zip" } },
["cyrillicnumbers"] = { url = "modules", zips = { "t-cyrillicnumbers.zip" } },
["degrade"] = { url = "modules", zips = { "t-degrade.zip" } },
@@ -42,9 +44,9 @@ return {
["letter"] = { url = "modules", zips = { "t-letter.zip" } },
["letterspace"] = { url = "modules", zips = { "t-letterspace.mkiv.zip" } },
["lettrine"] = { url = "modules", zips = { "t-lettrine.zip" } },
- ["lua-widow-control"] = { url = "modules", zips = { "lua-widow-control.zip" } },
+ ["lua-widow-control"] = { url = "modules", zips = { "lua-widow-control.zip" } }, -- we wipe the non context stuff
["mathsets"] = { url = "modules", zips = { "t-mathsets.zip" } },
- ["metaducks"] = { url = "modules", zips = { "metaducks.zip" } },
+ -- ["metaducks"] = { url = "modules", zips = { "metaducks.zip" } }, -- has top level files
["pret-c.lua"] = { url = "modules", zips = { "pret-c.lua.zip" } },
["rst"] = { url = "modules", zips = { "t-rst.zip" } },
["rsteps"] = { url = "modules", zips = { "t-rsteps.zip" } },
@@ -52,9 +54,9 @@ return {
["simplefonts"] = { url = "modules", zips = { "t-simplefonts.zip" } },
["simpleslides"] = { url = "modules", zips = { "t-simpleslides.zip" } },
["stormfontsupport"] = { url = "modules", zips = { "stormfontsupport.zip" } },
- ["sudoku"] = { url = "modules", zips = { "sudoku.zip" } },
+ -- ["sudoku"] = { url = "modules", zips = { "sudoku.zip" } }, -- has top level files
["taspresent"] = { url = "modules", zips = { "t-taspresent.zip" } },
- ["texshow"] = { url = "modules", zips = { "u-texshow.zip" } },
+ -- ["texshow"] = { url = "modules", zips = { "u-texshow.zip" } },
["title"] = { url = "modules", zips = { "t-title.zip" } },
["transliterator"] = { url = "modules", zips = { "t-transliterator.zip" } },
["typearea"] = { url = "modules", zips = { "t-typearea.zip" } },
diff --git a/tex/context/sample/common/knuthmath.tex b/tex/context/sample/common/knuthmath.tex
new file mode 100644
index 000000000..9890bb2ba
--- /dev/null
+++ b/tex/context/sample/common/knuthmath.tex
@@ -0,0 +1,3 @@
+Many readers will skim over formulas on their first reading of your exposition.
+Therefore, your sentences should flow smoothly when all but the simplest formulas
+are replaced by \quotation {blah} or some other grunting noise.
diff --git a/tex/context/sample/common/samples.tex b/tex/context/sample/common/samples.tex
index df5b38211..d9a39b3e6 100644
--- a/tex/context/sample/common/samples.tex
+++ b/tex/context/sample/common/samples.tex
@@ -13,6 +13,7 @@ used in testing bibliographic references and citations.
\HL
\NC stork.tex \NC David F. Stork \NC Hal's Legacy\NC \NR
\NC knuth.tex \NC Donald E. Knuth \NC \NC \NR
+\NC knuthmath.tex \NC Donald E. Knuth \NC Mathematical Writing (1987), §1 item 13, p.3 \NC \NR
\NC tufte.tex \NC Edward R. Tufte \NC \NC \NR
\NC reich.tex \NC Steve Reich \NC City Life (1995) \NC \NR
\NC materie.tex \NC Louis Andriessen \NC De Materie \NC \NR
@@ -44,10 +45,10 @@ used in testing bibliographic references and citations.
Quercus, London, 2006 \NC \NR
%NC schwarzenegger.tex \NC Arnold Schwarzenegger \NC Several places on the World Wide Web. \NC \NR
\NC carey.tex \NC Nessa Carey \NC The Epigenetics Revolution,
- Columbia University Press, 2012, p. 195 \NC \NR
+ Columbia University Press, 2012, p.195 \NC \NR
\NC waltham.tex \NC David Waltham \NC Lucky Planet, why earth is exceptional and what that
means for life in the universe,
- Icon Books Ltd, London, 2014, p. 168 \NC \NR
+ Icon Books Ltd, London, 2014, p.168 \NC \NR
\NC sapolsky.tex \NC Robert M. Sapolsky \NC Why Zebras Don't Have Ulsters,
St Martin's Press, 2004 \NC \NR
\NC mcnish.tex \NC Hollie McNish \NC Poetry versus Orchestra, Hollie McNish and Metropole
@@ -91,4 +92,6 @@ used in testing bibliographic references and citations.
% The Schwarzenegger letter was originally typeset at a width equivalent to 16.1cm in
% a default ConTeXt setup.
+% math-kontinuitet-sv.tex : persson|--|sundqvist.tex (infinitesimalkalkyl)
+
\stoptext
diff --git a/tex/context/sample/math/math-knuth-dt.tex b/tex/context/sample/math/math-knuth-dt.tex
new file mode 100644
index 000000000..e32681437
--- /dev/null
+++ b/tex/context/sample/math/math-knuth-dt.tex
@@ -0,0 +1,13 @@
+{\bf 15.} (This procedure maintains four integers $(A, B, C, D)$ with the invariant meaning
+that \quotation{our remaining job is to output the continued fraction for $(Ay + B)/(Cy + D)$,
+where $y$ is the input yet to come.}) Initially set $j \leftarrow k \leftarrow 0$, $(A, B, C, D) \leftarrow (a, b, c, d)$;
+then input $x_j$ and set $(A, B, C, D) \leftarrow (Ax_j + B, A, Cx_j + D, C)$, $j \leftarrow j + 1$, one or
+more times until $C + D$ has the same sign as $C$. (When $j > 1$ and the input has not
+terminated, we know that $1 < y < \infty$; and when $C + D$ has the same sign as $C$ we
+know therefore that $(Ay + B)/(Cy + D)$ lies between $(A + B)/(C + D)$ and $A/C$.)
+Now comes the general step: If no integer lies strictly between $(A + B)/(C + D)$
+and $A/C$, output $X_k \leftarrow \lfloor A/C \rfloor$, and set $(A, B, C, D) \leftarrow (C, D, A - X_ k C, B - X_k D)$,
+$k \leftarrow k + 1$; otherwise input $x_j$ and set $(A, B,C, D) \leftarrow (Ax_j + B, A, Cx_j + D,C)$,
+$j \leftarrow j + 1$. The general step is repeated ad infinitum. However, if at any time the
+\emph{final} $x_j$ is input, the algorithm immediately switches gears: It outputs the continued
+fraction for $(Ax_j + B)/(Cx_j + D)$, using Euclid's algorithm, and terminates.
diff --git a/tex/context/sample/math/math-kontinuitet-sv.tex b/tex/context/sample/math/math-kontinuitet-sv.tex
new file mode 100644
index 000000000..0e633d6f2
--- /dev/null
+++ b/tex/context/sample/math/math-kontinuitet-sv.tex
@@ -0,0 +1,8 @@
+Ett alternativt sätt att uttrycka att $f$ är kontinuerlig i $a$ är att $a\in D_f$
+och att det givet $\epsilon>0$ existerar $\delta>0$ sådant att
+$\fenced[bar][size=0]{f(a+h) - f(a)} < \epsilon$ så snart
+$\fenced[bar][size=0]{h} < \delta$ och $a+h$ tillhör definitionsmängden för $f$.
+Ytterligare ett sätt att uttrycka att $f$ är kontinuerlig i $a$ är att det för
+varje $\epsilon$-omgivning $B(f(a),\epsilon)$ av $f(a)$ finns en
+$\delta$-omgivning $B(a,\delta)$ av $a$ så att $f$ avbildar $B(a,\delta)\cap D_f$
+in i $B(f(a),\epsilon)$, dvs.\ $f(B(a,\delta)) \subset B(f(a),\epsilon)$.
diff --git a/tex/context/sample/third/alfredsson-sv.tex b/tex/context/sample/third/alfredsson-sv.tex
new file mode 100644
index 000000000..e31e26270
--- /dev/null
+++ b/tex/context/sample/third/alfredsson-sv.tex
@@ -0,0 +1,6 @@
+Det var så förbannat kallt ute att det blev isbildning i näshåren på mig och så
+småning om långt ut i mustascherna, som sakta styvnade. Någon ordentlig pälsmössa
+hade jag inte, bara min engelska tyghatt, som jag drog ner så långt jag kunde och
+till slut gav jag fan i hur det såg ut och knöt halsduken om. Halvspringande
+knarrade jag fram över snön i allén för att hinna tillbaks till hotellet innan
+jag helt koagulerade till en isstod.
diff --git a/tex/context/sample/third/falstaff-sv.tex b/tex/context/sample/third/falstaff-sv.tex
new file mode 100644
index 000000000..94bee1532
--- /dev/null
+++ b/tex/context/sample/third/falstaff-sv.tex
@@ -0,0 +1,5 @@
+För att stafva flerstafviga ord kräfvas ord med flera stafvelser. Sådana ord
+kunna mot ringa kostnad anskaffas genom kommissionärer i landsorten eller också
+genom att slå upp någon bok. Ett godt exempel på flerstafviga ord är
+riksdagsmannautskottssuppleantbostadsstäderskevikariebarnbarnsbyxor. Detta ord är
+dock ett af de lättare. Ett svårare ord är deremot lejon.
diff --git a/tex/context/sample/third/lansburgh-letterspacing-sv.tex b/tex/context/sample/third/lansburgh-letterspacing-sv.tex
new file mode 100644
index 000000000..c62367aeb
--- /dev/null
+++ b/tex/context/sample/third/lansburgh-letterspacing-sv.tex
@@ -0,0 +1,6 @@
+Spärrning av betonade (ej av filologiska eller andra skäl urskilda) ord eller
+meningar inom löpande text är typografiskt störande i alla språk och bör undvikas
+så mycket som möjligt. I engelskan är en sådan spärrning okänd och bör
+automatiskt ersättas med kursiv, om detta kan ske utan principiella ingripanden i
+manuskriptets disposition i övrigt. Samma gäller för franskan. Spärrning måste i
+tyskan tolereras mera än i något annat språk. Svenskan intar en medelställning.
diff --git a/tex/context/sample/third/readme.txt b/tex/context/sample/third/readme.txt
index 24fc809e4..6a5ccc06e 100644
--- a/tex/context/sample/third/readme.txt
+++ b/tex/context/sample/third/readme.txt
@@ -126,3 +126,26 @@ vallejo-trilce-es.tex
------------------------------------------------------------------------------------
Poema XXXIII
+
+------------------------------------------------------------------------------------
+alfredsson-sv.tex
+------------------------------------------------------------------------------------
+
+Hans Alfredsson - En ond man
+
+------------------------------------------------------------------------------------
+falstaff-sv.tex
+------------------------------------------------------------------------------------
+
+En hvar sin egen professor eller Allt menskligt vetande i sammandrag. Kortfattad
+encyklopedi af Falstaff Fakir
+
+------------------------------------------------------------------------------------
+lansburgh-letterspacing-sv
+------------------------------------------------------------------------------------
+
+% Lansburgh - Sättningsregler
+% A paragraph on letterspacing
+
+
+
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index e3a64d42f..29ab7c585 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 : 2023-05-08 17:36
+-- merge date : 2023-05-27 12:11
do -- begin closure to overcome local limits and interference
@@ -24852,7 +24852,9 @@ local function unifyglyphs(fontdata,usenames)
if colors then
for i=1,#colors do
local c=colors[i]
- c.slot=indices[c.slot]
+ if c then
+ c.slot=indices[c.slot]
+ end
end
end
end
diff --git a/web2c/readme.txt b/web2c/readme.txt
index 1f19746c0..2eb5b5d98 100644
--- a/web2c/readme.txt
+++ b/web2c/readme.txt
@@ -1,5 +1,5 @@
-In order for context and its tools to be able to locate files in the tds
-compliant tree you need to copy 'contextcnf.lua' to 'texmfcnf.lua'. There
-is a fallback to 'contextcnf.lua' when no 'texmfcnf.lua' is found. You can
-have multiple 'texmfcnf.lua' files which means that you can overload global
-settings.
+In order for context and its tools to be able to locate files in the tds
+compliant tree you need to copy 'contextcnf.lua' to 'texmfcnf.lua'. There
+is a fallback to 'contextcnf.lua' when no 'texmfcnf.lua' is found. You can
+have multiple 'texmfcnf.lua' files which means that you can overload global
+settings.