summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2023-03-11 21:00:25 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2023-03-11 21:00:25 +0000
commitbd5f31bb35702541bb4bec1b2baebcbe0c819cb0 (patch)
treef5010460144a7bee0cda0f7b3b4597967d130664 /Master/texmf-dist
parentd1fde8e3b4d1398c86dcca013fcc8b40f0a6a558 (diff)
Update ConTeXt
git-svn-id: svn://tug.org/texlive/trunk@66546 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/context/documents/general/manuals/musings.pdfbin1469208 -> 2144254 bytes
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel-buffers.tex506
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex7
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-toocomplex.tex2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex1
-rw-r--r--Master/texmf-dist/metapost/context/base/common/mp-remapped-boxes.mp1
-rw-r--r--Master/texmf-dist/metapost/context/base/common/mp-remapped-hatching.mp10
-rwxr-xr-xMaster/texmf-dist/scripts/context/lua/mtxrun.lua75
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/char-def.lua6
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/context.mkiv2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/data-ini.lua39
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/grph-con.lua12
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/l-dir.lua23
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/l-file.lua22
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua93
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/lpdf-nod.lua26
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/mult-def.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/page-flt.lua8
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/status-files.pdfbin24604 -> 24650 bytes
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/status-lua.pdfbin265851 -> 266630 bytes
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/strc-def.mkiv2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua5
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/typo-prc.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-client.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-ffi.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-library.lua2
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-sqlite.lua1
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-sql.lua29
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/anch-pos.lmt4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/context.mkxl16
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-con.mkxl25
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt60
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/file-syn.lmt79
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/file-syn.mklx8
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lang-lab.lmt37
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl10
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/libs-imp-sqlite.lmt3
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt20
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/lpdf-mis.lmt17
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx117
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-act.lmt20
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl60
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl5
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl160
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt137
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/mlib-ctx.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/mlib-fio.lmt17
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/mult-dim.mklx2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt15
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/node-aux.lmt16
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl30
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-lin.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-one.mkxl91
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-sel.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/page-txt.mklx21
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/spac-ver.lmt2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-def.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-flt.lmt53
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx71
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt64
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx34
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt138
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-mat.lmt30
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl45
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt169
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt153
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl122
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl15
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-syn.lmt420
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl65
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.lmt143
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl95
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl16
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt10
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl42
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-fkr.lmt122
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-fkr.mkxl6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-inj.lmt119
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-inj.mkxl2
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-man.lmt119
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-prc.lmt129
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx7
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-rep.lmt135
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-rep.mkxl6
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-scr.mkxl38
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-spa.lmt4
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-wrp.lmt95
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-wrp.mkxl13
-rw-r--r--Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg12
-rw-r--r--Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl7
-rw-r--r--Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua22
-rw-r--r--Master/texmf-dist/web2c/texmfcnf.lua233
100 files changed, 4012 insertions, 634 deletions
diff --git a/Master/texmf-dist/doc/context/documents/general/manuals/musings.pdf b/Master/texmf-dist/doc/context/documents/general/manuals/musings.pdf
index 69197240f0b..a02e1b6a1da 100644
--- a/Master/texmf-dist/doc/context/documents/general/manuals/musings.pdf
+++ b/Master/texmf-dist/doc/context/documents/general/manuals/musings.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel-buffers.tex b/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel-buffers.tex
new file mode 100644
index 00000000000..5c600cd6feb
--- /dev/null
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/lowlevel/lowlevel-buffers.tex
@@ -0,0 +1,506 @@
+% language=us runpath=texruns:manuals/lowlevel
+
+\environment lowlevel-style
+
+\startdocument
+ [title=buffers,
+ color=middlegreen]
+
+\startsectionlevel[title=Preamble]
+
+Buffers are not that low level but it makes sense to discuss them in this
+perspective because it relates to tokenization, internal representation and
+manipulating.
+
+{\em In due time we can describe some more commands and details here. This
+is a start. Feel free to tell me what needs to be explained.}
+
+\stopsectionlevel
+
+\startsectionlevel[title=Encoding]
+
+Normally processing a document starts with reading from file. In the past we were
+talking single bytes that were then maps onto a specific input encoding that
+itself matches the encoding of a font. When you enter an \quote {a} its (normally
+\ASCII) number 97 becomes the index into a font. That same number is also used in
+the hyphenator which is why font encoding and hyphenation are strongly related.
+If in an eight bit \TEX\ engine you need a precomposed \quote {รค} you have to use
+an encoding that has that character in some slot with again matching fonts and
+patterns. The actually used font can have the {\em shapes} in different slots and
+remapping is then done in the backend code using encoding and mapping files. When
+\OPENTYPE\ fonts are used the relationship between characters (input) and glyphs
+(rendering) also depends on the application of font features.
+
+In eight bit environments all this brings a bit of a resource management
+nightmare along with complex installation of new fonts. It also puts strain on
+the macro package, especially when you want to mix different input encodings onto
+different font encodings and thereby pattern encodings in the same document. You
+can compare this with code pages in operating system, but imagine them
+potentially being mixed in one document, which can happen when you mix multiple
+languages where the accumulated number of different characters exceeds 256. You
+end up switching between encodings. One way to deal with it is making special
+characters active and let their meaning differ per situation. That is for
+instance how in \MKII\ we handled \UTF8\ and thereby got around distributing
+multiple pattern files per language as we only needed to encoding them in \UTF\
+and then remap them to the required encoding when loading patterns. A mental
+exercise is wondering how to support \CJK\ scripts in an eight bit \MKII,
+something that actually can be done with some effort.
+
+The good news is that when we moved from \MKII\ to \MKIV\ we went exclusively
+\UTF8\ because that is what the \LUATEX\ engine expects. Upto four bytes are read
+in and translated into one \UNICODE\ character. The internal representation is a
+32 bit integer (four bytes) instead of a single byte. That also means that in the
+transition we got rid of quite some encoding related low level font and pattern
+handling. We still support input encodings (called regimes in \CONTEXT) but I'm
+pretty sure that nowadays no one uses input other than \UTF8. While \CONTEXT\ is
+normally quite upward compatible this is one area where there were fundamental
+changes.
+
+There is still some interpretation going on when reading from file: for instance,
+we need to normalize the \UNICODE\ input, and we feed the engine separate lines
+on demand. Apart from that, some characters like the backslash, dollar sign and
+curly braces have special meaning so for accessing them as characters we have to
+use commands that inject those characters. That didn't change when we went from
+\MKII\ to \MKIV. In practice it's never really a problem unless you find yourself
+in one of the following situations:
+
+\startitemize
+\startitem
+ {\em Example code has to be typeset as|-|is, so braces etc.\ are just that.}
+ This means that we have to change the way characters are interpreted.
+ Typesetting code is needed when you want to document \TEX\ and macros which
+ is why mechanisms for that have to be present right from the start.
+\stopitem
+\startitem
+ {\em Content is collected and used later.} A separation of content and usage
+ later on often helps making a source look cleaner. Examples are \quotation
+ {wrapping a table in a buffer} and \quotation {including that buffer when a
+ table is placed} using the placement macros.
+\stopitem
+\startitem
+ {\em Embedded \METAPOST\ and \LUA\ code.} These languages come with different
+ interpretation of some characters and especially \METAPOST\ code is often
+ stored first and used (processed) later.
+\stopitem
+\startitem
+ {\em The content comes from a different source.} Examples are \XML\ files
+ where angle brackets are special but for instance braces aren't. The data is
+ interpreted as a stream or as a structured tree.
+\stopitem
+\startitem
+ {\em The content is generated.} It can for instance come from \LUA, where
+ bytes (representing \UTF) is just text and no special characters are to be
+ intercepted. Or it can come from a database (using a library).
+\stopitem
+\stopitemize
+
+For these reasons \CONTEXT\ always had ways to store data in ways that makes this
+possible. The details on how that is done might have changed over versions, been
+optimized, extended with additional interfaces and features but given where we
+come from most has been there from the start.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Performance]
+
+When \TEX\ came around, the bottlenecks in running \TEX\ were the processor,
+memory and disks and depending on the way one used it the speed of the console or
+terminal; so, basically the whole system. One could sit there and wait for the
+page counters (\typ {[1] [2] ..} to show up. It was possible to run \TEX\ on a
+personal computer but it was somewhat resource hungry: one needed a decent disk
+(a 10 MB hard disk was huge and with todays phone camera snapshots that sounds
+crazy). One could use memory extenders to get around the 640K limitation (keep in
+mind that the programs and operating systems also took space). This all meant
+that one could not afford to store too many tokens in memory but even using files
+for all kind of (multi|-|pass) trickery was demanding.
+
+When processors became faster and memory plenty the disk became the bottleneck,
+but that changed when \SSD's showed up. Combined with already present file
+caching that had some impact. We are now in a situation that \CPU\ cores don't
+get that much faster (at least not twice as fast per iteration) and with \TEX\
+being a single core byte cruncher we're more or less in a situation where
+performance has to come from efficient programming. That means that, given enough
+memory, in some cases storing in tokens wins over storing in files, but it is no
+rule. In practice there is not much difference so one can even more than
+yesterday choose for the most convenient method. Just assume that the \CONTEXT\
+code, combined with \LUAMETATEX\ will give you what you need with a reasonable
+performance. When in doubt, test with simple test files and it that works out
+well compared to the real code, try to figure out where \quote {mistakes} are
+made. Inefficient \LUA\ and \TEX\ code has way more impact than storing a few
+more tokens or using some files.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Files]
+
+Nearly always files are read once per run. The content (mixed with commands) is
+scanned and macros are expanded and|/|or text is typeset as we go. Internally the
+\LUAMETATEX\ engine is in \quotation {scanning from file}, \quotation {scanning
+from token lists}, or \quotation {scanning from \LUA\ output} mode. The first
+mode is (in principle) the slowest because \UTF\ sequences are converted to
+tokens (numbers) but there is no way around it. The second method is fast because
+we already have these numbers, but we need to take into account where the linked
+list of tokens comes from. If it is converted runtime from for instance file
+input or macro expansion we need to add the involved overhead. But scanning a
+stored macro body is pretty efficient especially when the macro is part of the
+loaded macro package (format file). The third method is comparable with reading
+from file but here we need to add the overhead involved with storing the \LUA\
+output into data structures suitable for \TEX's input mechanism, which can
+involve memory allocation outside the reserved pool of tokens. On modern systems
+that is not really a problem. It is good to keep in mind that when \TEX\ was
+written much attention was paid to optimization and in \LUAMETATEX\ we even went
+a bit further, also because we know what kind of input, processing and output
+we're dealing with.
+
+When reading from file or \LUA\ output we interpret bytes turned \UTF\ numbers
+and that is when catcode regimes kick in: characters are interpreted according to
+the catcode properties: escape character (backslash), curly braces (grouping and
+arguments), dollars (math), etc.\ While with reading from token lists these
+catcodes are already taken care of and we're basically interpreting meanings
+instead of characters. By changing the catcode regime we can for instance typeset
+content verbatim from files and \LUA\ strings but when reading from token lists
+we're sort of frozen. There are tricks to reinterpret the token list but that
+comes with overhead and limitations.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Macros]
+
+A macro can be seen as a named token with a meaning attached. In \LUAMETATEX\
+macros can take up to 15 arguments (six more than regular \TEX) that can be
+separated by so called delimiters. A token has a command property (operator) and
+a value (operand). Because a \UNICODE\ character doesn't need all four bytes of
+an integer and because in the engine numbers, dimensions and pointers are limited
+in size we can store all of these efficiently with the command code. Here the
+body of \type {\foo} is a list of three tokens:
+
+\starttyping
+\def\foo{abc} \foo \foo \foo
+\stoptyping
+
+When the engine fetches a token from a list it will interpret the command and
+when it fetches from file it will create tokens on the fly and then interpret
+those. When a file or list is exhausted the engine pops the stack and continues
+at the previous level. Because macros are already tokenized they are more
+efficient than file input. For more about macros you can consult the low level
+document about them.
+
+The more you use a macro, the more it pays off compared to a file. However don't
+overestimate this, because in the end the typesetting and expanding all kind of
+other involved macros might reduce the file overhead to noise.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Token lists]
+
+A token list is like a macro but is part of the variable (register) system. It
+is just a list (so no arguments) and you can append and prepend to that list.
+
+\starttyping
+\toks123={abc} \the\toks123
+\scratchtoks{abc} \the\scratchtoks
+\stoptyping
+
+Here \type {\scratchtoks} is defined with \type {\newtoks} which creates an
+efficient reference to a list so that, contrary to the first line, no register
+number has to be scanned. There are low level manuals about tokens and registers
+that you can read if you want to know more about this. As with macros the list in
+this example is three tokens long. Contrary to macros there is no macro overhead
+as there is no need to check for arguments. \footnote {In \LUAMETATEX\ a macro
+without arguments is also quite efficient.}
+
+Because they use more or less the same storage method macros and token list
+registers perform the same. The power of registers comes from some additional
+manipulators in \LUATEX\ (and \LUAMETATEX) and the fact that one can control
+expansion with \type {\the}, although that later advantage is compensated with
+extensions to the macro language (like \type {\protected} macro definitions).
+
+\stopsectionlevel
+
+\startsectionlevel[title=Buffers]
+
+Buffers are something specific for \CONTEXT\ and they have always been part of
+this system. A buffer is defined as follows:
+
+\startbuffer
+\startbuffer[one]
+line 1
+line 2
+\stopbuffer
+\stopbuffer
+
+\typebuffer
+
+Among the operations on buffers the next two are used most often:
+
+\starttyping
+\typebuffer[one]
+\getbuffer[one]
+\stoptyping
+
+Scanning a buffer at the \TEX\ end takes a little effort because when we start
+reading the catcodes are ignored and for instance backslashes and curly braces
+are retained. Hardly any interpretation takes place. The same is true for
+spacing, so multiple spaces are not collapsed and newlines stay. The tokenized
+content of a buffer is converted back to a string and that content is then read
+in as a pseudo file when we need it. So, basically buffers are files! In \MKII\
+they actually were files (in the \type {\jobname} name space and suffix \type
+{tmp}), but in \MKIV\ they are stored in and managed by \LUA. That also means
+that you can set them very efficiently at the \LUA\ end:
+
+\starttyping
+\startluacode
+buffers.assign("one",[[
+line 1
+line 2
+]])
+\stopluacode
+\stoptyping
+
+Always keep in mind that buffers eventually are read as files: character by
+character, and at that time the content gets (as with other files) tokenized. A
+buffer name is optional. You can nest buffers, with and without names.
+
+Because \CONTEXT\ is very much about re-use of content and selective processing
+we have an (already old) subsystem for defining named blocks of text (using \type
+{\begin...} and \type {\end...} tagging. These blocks are stored just like
+buffers but selective flushing is part of the concept. Think of coding an
+educational document with explanations, questions, answers and then typesetting
+only the explanations, or the explanation along width some questions. Other
+components can be typeset later so one can make for instance a special book(let)
+with answers that either of not repeats the questions. Here we need features like
+synchronization of numbers so that's why we cannot really use buffers. An
+alternative is to use \XML\ and filter from that.
+
+The \typ {\definebuffer} command defines a new buffer environment. When you set
+buffers in \LUA\ you don't need to define a buffer because likely you don't need
+the \type {\start} and \type {\stop} commands. Instead of \typ {\getbuffer} you
+can also use \typ {\getdefinedbuffer} with defined buffers. In that case the
+\type {before} and \type {after} keys of that specific instance are used.
+
+The \typ {\getinlinebuffer} command, which like the getters takes a list of
+buffer names, ignores leading and trailing spaces. When multiple buffers are
+flushed this way, spacing between buffers is retained.
+
+The most important aspect of buffers is that the content is {\em not} interpreted
+and tokenized: the bytes stay as they are.
+
+\startbuffer
+\definebuffer[MyBuffer]
+
+\startMyBuffer
+\bold{this is
+a buffer}
+\stopMyBuffer
+
+\typeMyBuffer \getMyBuffer
+\stopbuffer
+
+\typebuffer
+
+These commands result in:
+
+\getbuffer
+
+There are not that many parameters that can be set: \type {before}, \type {after}
+and \type {strip} (when set to \type {no} leading and trailing spacing will be
+kept. The \type {\stop...} command, in our example \typ {\stopMyBuffer}, can be
+defined independent to so something after the buffer has be read and stored but
+by default nothing is done.
+
+You can test if a buffer exists with \typ {\doifelsebuffer} (expandable) and \typ
+{\doifelsebufferempty} (unexpandable). A buffer is kept in memory unless it gets
+wiped clean with \typ {resetbuffer}.
+
+\starttyping
+\savebuffer [MyBuffer][temp] % gets name: jobname-temp.tmp
+\savebufferinfile[MyBuffer][temp.log] % gets name: temp.log
+\stoptyping
+
+You can also stepwise fill such a buffer:
+
+\starttyping
+\definesavebuffer[slide]
+
+\startslide
+ \starttext
+\stopslide
+\startslide
+ slide 1
+\stopslide
+text 1 \par
+\startslide
+ slide 2
+\stopslide
+text 2 \par
+\startslide
+ \stoptext
+\stopslide
+\stoptyping
+
+After this you will have a file \type {\jobname-slide.tex} that has the two lines
+wrapped as text. You can set up a \quote {save buffer} to use a different
+filename (with the \type {file} key), a different prefix using \type {prefix} and
+you can set up a \type {directory}. A different name is set with the \type {list}
+key.
+
+You can assign content to a buffer with a somewhat clumsy interface where we use
+the delimiter \type {\endbuffer}. The only restriction is that this delimiter
+cannot be part of the content:
+
+\starttyping
+\setbuffer[name]here comes some text\endbuffer
+\stoptyping
+
+For more details and obscure commands that are used in other commands
+you can peek into the source.
+
+% These are somewhat obscure:
+%
+% \getbufferdata{...}
+% \grabbufferdatadirect % name start stop
+% \grabbufferdata % was: \dostartbuffer
+% \thebuffernumber
+% \thedefinedbuffer
+
+Using buffers in the \CLD\ interface is tricky because of the catcode magick that is
+involved but there are setters and getters:
+
+\starttabulate[|T|T|]
+\BC function \BC arguments \NC \NR
+\ML
+\NC buffers.assign \NC name, content [,catcodes] \NC \NR
+%NC buffers.raw \NC \NC \NR
+\NC buffers.erase \NC name \NC \NR
+\NC buffers.prepend \NC name, content \NC \NR
+\NC buffers.append \NC name, content \NC \NR
+\NC buffers.exists \NC name \NC \NR
+\NC buffers.empty \NC name \NC \NR
+\NC buffers.getcontent \NC name \NC \NR
+\NC buffers.getlines \NC name \NC \NR
+%NC buffers.collectcontent \NC \NC \NR
+%NC buffers.loadcontent \NC \NC \NR
+%NC buffers.get \NC \NC \NR
+%NC buffers.getmkiv \NC \NC \NR
+%NC buffers.gettexbuffer \NC \NC \NR
+%NC buffers.run \NC \NC \NR
+\stoptabulate
+
+There are a few more helpers that are used in other (low level) commands. Their
+functionality might adapt to their usage there. The \typ {context.startbuffer}
+and \typ {context.stopbuffer} are somewhat differently defined than regular
+\CLD\ commands.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Setups]
+
+A setup is basically a macro but is stored and accessed in a namespace separated
+from ordinary macros. One important characteristic is that inside setups newlines
+are ignored.
+
+\startbuffer
+\startsetups MySetupA
+ This is line 1
+ and this is line 2
+\stopsetups
+
+\setup{MySetupA}
+\stopbuffer
+
+\typebuffer {\bf \getbuffer}
+
+A simple way out is to add a comment character preceded by a space. Instead you
+can also use \type {\space}:
+
+\startbuffer
+\startsetups [MySetupB]
+ This is line 1 %
+ and this is line 2\space
+ while here we have line 3
+\stopsetups
+
+\setup[MySetupB]
+\stopbuffer
+
+\typebuffer {\bf \getbuffer}
+
+You can use square brackets instead of space delimited names in definitions and
+also in calling up a (list of) setup(s). The \type {\directsetup} command takes a
+single setup name and is therefore more efficient.
+
+Setups are basically simple macros although there is some magic involved that
+comes from their usage in for instance \XML\ where we pass an argument. That
+means we can do the following:
+
+\startbuffer
+\startsetups MySetupC
+ before#1after
+\stopsetups
+
+\setupwithargument{MySetupC}{ {\em and} }
+\stopbuffer
+
+\typebuffer {\bf \getbuffer}
+
+Because a setup is a macro, the body is a linked list of tokens where each token
+takes 8 bytes of memory, so \type {MySetupC} has 12 tokens that take 96 bytes of
+memory (plus some overhead related to macro management).
+
+\stopsectionlevel
+
+\startsectionlevel[title=\XML]
+
+Discussing \XML\ is outside the scope of this document but it is worth mentioning
+that once an \XML\ tree is read is, the content is stored in strings and can be
+filtered into \TEX, where it is interpreted as if coming from files (in this case
+\LUA\ strings). If needed the content can be interpreted as \TEX\ input.
+
+\stopsectionlevel
+
+\startsectionlevel[title=\LUA]
+
+As mentioned already, output from \LUA\ is stored and when a \LUA\ call finishes
+it ends up on the so called input stack. Every time the engine needs a token it
+will fetch from the input stack and the top of the stack can represent a file,
+token list or \LUA\ output. Interpreting bytes from files or \LUA\ strings
+results in tokens. As a side note: \LUA\ output can also be already tokenized,
+because we can actually write tokens and nodes from \LUA, but that's more an
+implementation detail that makes the \LUA\ input stack entries a bit more
+complex. It is normally not something users will do when they use \LUA\ in their
+documents.
+
+\stopsectionlevel
+
+\startsectionlevel[title=Protection]
+
+When you define macros there is the danger of overloading some defined by the
+system. Best use CamelCase so that you stay away from clashes. You can enable
+some checking:
+
+\starttyping
+\enabledirectives[overloadmode=warning]
+\stoptyping
+
+or when you want to quit on a clash:
+
+\starttyping
+\enabledirectives[overloadmode=error]
+\stoptyping
+
+When these trackers are enabled you can get around the check with:
+
+\starttyping
+\pushoverloadmode
+ ...
+\popoverloadmode
+\stoptyping
+
+But delay that till you're sure that redefining is okay.
+
+\stopsectionlevel
+
+% efficiency
+
+\stopdocument
+
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex
index bb20761bc7a..f845fed1711 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/luametatex/luametatex.tex
@@ -105,6 +105,13 @@
% means that 43 pages per seconds is now the new normal but that might of course
% become less again as we evolve.
+% 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
+% unlikely to happen any time soon. With tabulateusesize and tabulatesparseskips
+% experimends enabled we needed 8.1 second and 44.3 pps.
+
% \enableexperiments [tabulateusesize]
% \enableexperiments [tabulatesparseskips]
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-toocomplex.tex b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-toocomplex.tex
index 103dd19069b..f12f15c1eee 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-toocomplex.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings-toocomplex.tex
@@ -387,3 +387,5 @@ is not needed any more by then.
\stopsection
\stopchapter
+
+\stopcomponent
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex
index 13bf4f4ef93..bccab890a38 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/musings/musings.tex
@@ -28,6 +28,7 @@
% \component musings-whytex-again
\component musings-dontusetex
\component musings-speed
+ \component musings-texlive
\stopbodymatter
\stopproduct
diff --git a/Master/texmf-dist/metapost/context/base/common/mp-remapped-boxes.mp b/Master/texmf-dist/metapost/context/base/common/mp-remapped-boxes.mp
new file mode 100644
index 00000000000..f9cb4a5bb1c
--- /dev/null
+++ b/Master/texmf-dist/metapost/context/base/common/mp-remapped-boxes.mp
@@ -0,0 +1 @@
+scantokens("input mp-xbox.mp" & (if metapostversion > 2 : "xl" else : "iv" fi)) ;
diff --git a/Master/texmf-dist/metapost/context/base/common/mp-remapped-hatching.mp b/Master/texmf-dist/metapost/context/base/common/mp-remapped-hatching.mp
new file mode 100644
index 00000000000..ae63b676ea0
--- /dev/null
+++ b/Master/texmf-dist/metapost/context/base/common/mp-remapped-hatching.mp
@@ -0,0 +1,10 @@
+% This is placeholder for Bogluslaw Jackowski's hatching.mp file which can be found in
+% the public domain and dates from 2000. It provides:
+%
+% draw hatched (fullcircle scaled 10cm) (45, 4, 1) withcolor "red" ;
+%
+% interim hatch_match := 1;
+%
+% This macro is not in mp-tool so this is a placeholder. The hatching macro doesn't fit
+% into metafun because it assume withcolor to behave in a certain way. Also, we use more
+% efficient path constructor.
diff --git a/Master/texmf-dist/scripts/context/lua/mtxrun.lua b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
index a00dc59288c..306f84a1ca6 100755
--- a/Master/texmf-dist/scripts/context/lua/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
@@ -4298,7 +4298,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-file"] = package.loaded["l-file"] or true
--- original size: 22186, stripped down to: 10313
+-- original size: 22637, stripped down to: 10595
if not modules then modules={} end modules ['l-file']={
version=1.001,
@@ -4704,9 +4704,23 @@ function file.withinbase(path)
end
return true
end
-local symlinkattributes=lfs.symlinkattributes
-function lfs.readlink(name)
- return symlinkattributes(name,"target") or nil
+do
+ local symlinktarget=lfs.symlinktarget
+ local symlinkattributes=lfs.symlinkattributes
+ if symlinktarget then
+ function lfs.readlink(name)
+ local target=symlinktarget(name)
+ return name~=target and name or nil
+ end
+ elseif symlinkattributes then
+ function lfs.readlink(name)
+ return symlinkattributes(name,"target") or nil
+ end
+ else
+ function lfs.readlink(name)
+ return nil
+ end
+ end
end
@@ -5122,7 +5136,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-dir"] = package.loaded["l-dir"] or true
--- original size: 18217, stripped down to: 10792
+-- original size: 18893, stripped down to: 11170
if not modules then modules={} end modules ['l-dir']={
version=1.001,
@@ -5586,6 +5600,23 @@ do
return str
end
end
+ function dir.expandlink(dir,report)
+ local curdir=currentdir()
+ local trace=type(report)=="function"
+ if chdir(dir) then
+ local newdir=currentdir()
+ if newdir~=dir and trace then
+ report("following symlink %a to %a",dir,newdir)
+ end
+ chdir(curdir)
+ return newdir
+ else
+ if trace then
+ report("unable to check path %a",dir)
+ end
+ return dir
+ end
+ end
end
file.expandname=dir.expandname
local stack={}
@@ -20734,7 +20765,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["data-ini"] = package.loaded["data-ini"] or true
--- original size: 10947, stripped down to: 7176
+-- original size: 10636, stripped down to: 7049
if not modules then modules={} end modules ['data-ini']={
version=1.001,
@@ -20745,9 +20776,11 @@ if not modules then modules={} end modules ['data-ini']={
}
local next,type,getmetatable,rawset=next,type,getmetatable,rawset
local gsub,find,gmatch,char=string.gsub,string.find,string.gmatch,string.char
-local filedirname,filebasename,filejoin=file.dirname,file.basename,file.join
+local filedirname,filebasename,filejoin,replacesuffix=file.dirname,file.basename,file.join,file.replacesuffix
local ostype,osname,osuname,ossetenv,osgetenv=os.type,os.name,os.uname,os.setenv,os.getenv
local sortedpairs=table.sortedpairs
+local isfile,currentdir=lfs.isfile,lfs.currentdir
+local expandlink=dir.expandlink
local P,S,R,C,Cs,Cc,lpegmatch=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg.match
local trace_locating=false trackers.register("resolvers.locating",function(v) trace_locating=v end)
local trace_expansions=false trackers.register("resolvers.expansions",function(v) trace_expansions=v end)
@@ -20797,10 +20830,11 @@ do
if not environment.ownmain then
environment.ownmain=status and string.match(string.lower(status.banner),"this is ([%a]+)") or "luatex"
end
- local ownbin=environment.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
+ local ownbin=environment.ownbin or os.selfbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luametatex"
local ownpath=environment.ownpath or os.selfdir
- ownbin=file.collapsepath(ownbin)
+ ownbin=file.collapsepath(ownbin)
ownpath=file.collapsepath(ownpath)
+ ownpath=expandlink(ownpath,trace_locating and report_initialization)
if not ownpath or ownpath=="" or ownpath=="unset" then
ownpath=args[-1] or arg[-1]
ownpath=ownpath and filedirname(gsub(ownpath,"\\","/"))
@@ -20814,27 +20848,14 @@ do
end
if not ownpath or ownpath=="" then
if os.binsuffix~="" then
- binary=file.replacesuffix(binary,os.binsuffix)
+ binary=replacesuffix(binary,os.binsuffix)
end
local path=osgetenv("PATH")
if path then
for p in gmatch(path,"[^"..io.pathseparator.."]+") do
local b=filejoin(p,binary)
- if lfs.isfile(b) then
- local olddir=lfs.currentdir()
- if lfs.chdir(p) then
- local pp=lfs.currentdir()
- if trace_locating and p~=pp then
- report_initialization("following symlink %a to %a",p,pp)
- end
- ownpath=pp
- lfs.chdir(olddir)
- else
- if trace_locating then
- report_initialization("unable to check path %a",p)
- end
- ownpath=p
- end
+ if isfile(b) then
+ ownpath=expandlink(p,trace_locating and report_initialization)
break
end
end
@@ -26072,8 +26093,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 : 1034927
--- stripped bytes : 407861
+-- original bytes : 1035743
+-- stripped bytes : 408144
-- end library merge
diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-def.lua b/Master/texmf-dist/tex/context/base/mkiv/char-def.lua
index 1aea51318fa..5e9d7d05a8b 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/char-def.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/char-def.lua
@@ -64034,6 +64034,8 @@ characters.data={
combining=0xE6,
description="COMBINING LEFT ARROW ABOVE",
direction="nsm",
+ mathclass="topaccent",
+ mathstretch="h",
linebreak="cm",
unicodeslot=0x20D6,
},
@@ -64248,6 +64250,8 @@ characters.data={
description="COMBINING LEFT ARROW BELOW",
direction="nsm",
linebreak="cm",
+ mathclass="bottomaccent",
+ mathstretch="h",
unicodeslot=0x20EE,
},
[0x20EF]={
@@ -64256,6 +64260,8 @@ characters.data={
description="COMBINING RIGHT ARROW BELOW",
direction="nsm",
linebreak="cm",
+ mathclass="bottomaccent",
+ mathstretch="h",
unicodeslot=0x20EF,
},
[0x20F0]={
diff --git a/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua
index 0bdc60379d4..9b5e705ca78 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua
@@ -99,7 +99,7 @@ local tonut = node.direct.todirect
local tonode = node.direct.tonode
local newtoken = token.new
-local createtoken = token.create
+----- createtoken = token.create
local istoken = token.istoken or token.is_token
local setluatoken = token.setlua or token.set_lua
diff --git a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv
index 2ff5bba1fbd..22e4d4baeac 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2023.02.23 21:26}
+\newcontextversion{2023.03.10 12:15}
%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/Master/texmf-dist/tex/context/base/mkiv/context.mkiv b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv
index 7a7e2e8d5c3..1c9effa6a4c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv
@@ -49,7 +49,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2023.02.23 21:26}
+\edef\contextversion{2023.03.10 12:15}
%D Kind of special:
diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/data-ini.lua
index 6cf5669b3e7..57a800d8321 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/data-ini.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/data-ini.lua
@@ -8,9 +8,11 @@ if not modules then modules = { } end modules ['data-ini'] = {
local next, type, getmetatable, rawset = next, type, getmetatable, rawset
local gsub, find, gmatch, char = string.gsub, string.find, string.gmatch, string.char
-local filedirname, filebasename, filejoin = file.dirname, file.basename, file.join
+local filedirname, filebasename, filejoin, replacesuffix = file.dirname, file.basename, file.join, file.replacesuffix
local ostype, osname, osuname, ossetenv, osgetenv = os.type, os.name, os.uname, os.setenv, os.getenv
local sortedpairs = table.sortedpairs
+local isfile, currentdir = lfs.isfile, lfs.currentdir
+local expandlink = dir.expandlink
local P, S, R, C, Cs, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.match
@@ -103,12 +105,20 @@ do
environment.ownmain = status and string.match(string.lower(status.banner),"this is ([%a]+)") or "luatex"
end
- local ownbin = environment.ownbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luatex"
+ local ownbin = environment.ownbin or os.selfbin or args[-2] or arg[-2] or args[-1] or arg[-1] or arg[0] or "luametatex"
local ownpath = environment.ownpath or os.selfdir
- ownbin = file.collapsepath(ownbin)
+ ownbin = file.collapsepath(ownbin) -- This one an actually also contain the path!
ownpath = file.collapsepath(ownpath)
+ -- We need to follow the symlink on osx - texlive. This only works luametatex and
+ -- lmtx so we might as wel forget about luatex/mkiv there. The regular context
+ -- installation doesn't have this link issue. I tried several variants but in the
+ -- end the chdir variants was most reliable. Everything else is ugly. (Experimtal
+ -- code is in data-osx.lua).
+
+ ownpath = expandlink(ownpath,trace_locating and report_initialization)
+
if not ownpath or ownpath == "" or ownpath == "unset" then
ownpath = args[-1] or arg[-1]
ownpath = ownpath and filedirname(gsub(ownpath,"\\","/"))
@@ -122,31 +132,14 @@ do
end
if not ownpath or ownpath == "" then
if os.binsuffix ~= "" then
- binary = file.replacesuffix(binary,os.binsuffix)
+ binary = replacesuffix(binary,os.binsuffix)
end
local path = osgetenv("PATH")
if path then
for p in gmatch(path,"[^"..io.pathseparator.."]+") do
local b = filejoin(p,binary)
- if lfs.isfile(b) then
- -- we assume that after changing to the path the currentdir function
- -- resolves to the real location and use this side effect here; this
- -- trick is needed because on the mac installations use symlinks in the
- -- path instead of real locations
- local olddir = lfs.currentdir()
- if lfs.chdir(p) then
- local pp = lfs.currentdir()
- if trace_locating and p ~= pp then
- report_initialization("following symlink %a to %a",p,pp)
- end
- ownpath = pp
- lfs.chdir(olddir)
- else
- if trace_locating then
- report_initialization("unable to check path %a",p)
- end
- ownpath = p
- end
+ if isfile(b) then
+ ownpath = expandlink(p,trace_locating and report_initialization)
break
end
end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/grph-con.lua b/Master/texmf-dist/tex/context/base/mkiv/grph-con.lua
index fdae2223bda..fcc8c931d27 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/grph-con.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/grph-con.lua
@@ -312,7 +312,7 @@ do -- png | jpg | profiles
-- [[convert %?colorspace: -colorspace "%colorspace%" ?%]]
local rgbprofile = "srgb_v4_icc_preference.icc" -- srgb.icc
- local cmykprofile = "isocoated_v2_300_eci.icc" -- isocoated_v2_eci.icc
+ local cmykprofile = "isocoated_v2_eci.icc" -- isocoated_v2_300_eci.icc
directives.register("graphics.conversion.rgbprofile", function(v) rgbprofile = type(v) == "string" and v or rgbprofile end)
directives.register("graphics.conversion.cmykprofile",function(v) cmykprofile = type(v) == "string" and v or cmykprofile end)
@@ -320,9 +320,14 @@ do -- png | jpg | profiles
local jpgconverters = converters.jpg
local pngconverters = converters.png
+ local findfile = resolvers.findfile
+
local function profiles()
if not isfile(rgbprofile) then
- local found = resolvers.findfile(rgbprofile)
+ local found = findfile(rgbprofile)
+ if not found or found == "" then
+ found = findfile("colo-imp-"..rgbprofile)
+ end
if found and found ~= "" then
rgbprofile = found
else
@@ -331,6 +336,9 @@ do -- png | jpg | profiles
end
if not isfile(cmykprofile) then
local found = resolvers.findfile(cmykprofile)
+ if not found or found == "" then
+ found = findfile("colo-imp-"..cmykprofile)
+ end
if found and found ~= "" then
cmykprofile = found
else
diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua b/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua
index ac8e2f4e8e1..3e24e4e2a12 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua
@@ -197,7 +197,7 @@ local function collectpattern(path,patt,recurse,result)
if not find(path,"/$") then
path = path .. '/'
end
- for name in scanner, first do -- cna be optimized
+ for name in scanner, first do -- can be optimized
if name == "." then
-- skip
elseif name == ".." then
@@ -596,6 +596,27 @@ do
end
+ -- This go there anc check works okay in tricky situation as we encounter
+ -- on osx, where tex installations use rather complex chains of links.
+
+ function dir.expandlink(dir,report)
+ local curdir = currentdir()
+ local trace = type(report) == "function"
+ if chdir(dir) then
+ local newdir = currentdir()
+ if newdir ~= dir and trace then
+ report("following symlink %a to %a",dir,newdir)
+ end
+ chdir(curdir)
+ return newdir
+ else
+ if trace then
+ report("unable to check path %a",dir)
+ end
+ return dir
+ end
+ end
+
end
file.expandname = dir.expandname -- for convenience
diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-file.lua b/Master/texmf-dist/tex/context/base/mkiv/l-file.lua
index 9f8fd654833..70f8188dc15 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/l-file.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/l-file.lua
@@ -741,8 +741,24 @@ end
-- not used in context but was in luatex once:
-local symlinkattributes = lfs.symlinkattributes
+do
+
+ local symlinktarget = lfs.symlinktarget -- luametatex (always returns string)
+ local symlinkattributes = lfs.symlinkattributes -- luatex (can return nil)
+
+ if symlinktarget then
+ function lfs.readlink(name)
+ local target = symlinktarget(name)
+ return name ~= target and name or nil
+ end
+ elseif symlinkattributes then
+ function lfs.readlink(name)
+ return symlinkattributes(name,"target") or nil
+ end
+ else
+ function lfs.readlink(name)
+ return nil
+ end
+ end
-function lfs.readlink(name)
- return symlinkattributes(name,"target") or nil
end
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua b/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua
index 1b278926ec3..cb8053fb69c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lang-txt.lua
@@ -25,7 +25,7 @@ if not modules then modules = { } end modules ['lang-txt'] = {
-- bg Bulgarian Vladislav Hinkin, Aleลก ฤŽurฤanskรฝ (2019)
-- ca Catalan ...; additions Javier Gambin Monzo + Samuel Conca Coles (2022)
-- cn Chinese Wang Lei, ...
--- cs Czech Tom Hudec, Petr Sojka, Richard Gabriel
+-- cs Czech Tom Hudec, Petr Sojka, Richard Gabriel; additions Tomรกลก Hรกla (2022)
-- da Danish Arne Jorgensen
-- de German Tobias Burnus, ...
-- en English Hans Hagen, ...
@@ -52,7 +52,7 @@ if not modules then modules = { } end modules ['lang-txt'] = {
-- pt Portuguese Pedro F. M. Mendonรงa
-- ro Romanian Dan Seracu, ...
-- ru Russian Olga Briginets, Alexander Bokovoy, Victor Figurnov, ...
--- sk Slovak Tomรกลก Hรกla (2012)
+-- sk Slovak Tomรกลก Hรกla (2012, 2022)
-- sl Slovenian Mojca Miklavec
-- sr Serbian Ivan Peลกiฤ‡ (2020)
-- sr-latn Serbian Ivan Peลกiฤ‡ (2020)
@@ -84,6 +84,7 @@ data.labels={
["be"]="ะฃ",
["bg"]="ะฒ",
["ca"]="En",
+ ["cs"]={ "In", "V" },
["de"]="In",
["en"]="In",
["eo"]="En",
@@ -92,6 +93,7 @@ data.labels={
["fr"]="Dans",
["hy"]="ี„ีฅีป",
["mk"]="ะฒะพ",
+ ["sk"]={ "In", "V" },
["sr"]="ะฃ",
["sr-latn"]="U",
},
@@ -101,6 +103,7 @@ data.labels={
["be"]="ะัƒะผะฐั€",
["bg"]="ะฝะพะผะตั€",
["ca"]="Nombre",
+ ["cs"]="ฤŒรญslo",
["de"]="Nummer",
["en"]="Number",
["eo"]="Nombro",
@@ -110,6 +113,7 @@ data.labels={
["hy"]="ี€ีกีดีกึ€",
["mk"]="ะ‘ั€ะพั˜",
["nl"]="Nummer",
+ ["sk"]="ฤŒรญslo",
["sr"]="ะ‘ั€ะพั˜",
["sr-latn"]="Broj",
},
@@ -119,6 +123,7 @@ data.labels={
["be"]="ะ“ัƒะบ",
["bg"]="ะพะฑะตะผ",
["ca"]="Volum",
+ ["cs"]="Svazek",
["de"]="Band",
["en"]="Volume",
["eo"]="Volumo",
@@ -129,6 +134,7 @@ data.labels={
["hy"]="ิพีกีพีกีฌ",
["mk"]="ะขะพะผ",
["nl"]="Deel",
+ ["sk"]="Zvรคzok",
["sr"]="ะขะพะผ",
["sr-latn"]="Tom",
},
@@ -138,6 +144,7 @@ data.labels={
["be"]="i",
["bg"]="a",
["ca"]="i",
+ ["cs"]="a",
["de"]="und",
["en"]="and",
["eo"]="kaj",
@@ -149,6 +156,7 @@ data.labels={
["it"]="e",
["mk"]="ะธ",
["nl"]="en",
+ ["sk"]="a",
["sr"]="ะธ",
["sr-latn"]="i",
},
@@ -158,6 +166,7 @@ data.labels={
["be"]="ะ’ั‹ะดะฐะฝะฝะต",
["bg"]="ะธะทะดะฐะฝะธะต",
["ca"]="Ediciรณ",
+ ["cs"]="Vydรกnรญ",
["de"]="Auflage",
["en"]="edition",
["eo"]="eldono",
@@ -170,6 +179,7 @@ data.labels={
["it"]="edizione",
["mk"]="ะธะทะดะฐะฝะธะต",
["nl"]="editie",
+ ["sk"]="Vydanie",
["sr"]="ะธะทะดะฐัšะต",
["sr-latn"]="izdanje",
},
@@ -179,6 +189,7 @@ data.labels={
["be"]="ะ ัะดะฐะบั‚ะฐั€",
["bg"]="ั€ะตะดะฐะบั‚ะพั€",
["ca"]="Editor",
+ ["cs"]={ "Editor", "Editorka" },
["de"]="Herausgeber",
["en"]="editor",
["eo"]="eldonisto",
@@ -189,6 +200,7 @@ data.labels={
["hy"]="ีญีดีขีกีฃีซึ€",
["it"]="a cura di",
["mk"]="ัƒั€ะตะดะฝะธะบ",
+ ["sk"]={ "Editor", "Editorka" },
["sr"]="ัƒั€ะตะดะฝะธะบ",
["sr-latn"]="urednik",
},
@@ -198,6 +210,7 @@ data.labels={
["be"]="ะ ัะดะฐะบั‚ะฐั€ั‹",
["bg"]="ั€ะตะดะฐะบั‚ะพั€ะธ",
["ca"]="Editors",
+ ["cs"]="Editoล™i",
["de"]="Herausgeber",
["en"]="editors",
["eo"]="eldonistoj",
@@ -207,15 +220,29 @@ data.labels={
["hy"]="ีญีดีขีกีฃีซึ€ีถีฅึ€",
["it"]="a cura di",
["mk"]="ัƒั€ะตะดะฝะธั†ะธ",
+ ["sk"]="Editori",
["sr"]="ัƒั€ะตะดะฝะธั†ะธ",
["sr-latn"]="urednici",
},
},
+ ["editors:f"]={
+ ["labels"]={
+ ["cs"]="Editorky",
+ ["sk"]="Editorky",
+ },
+ },
+ ["editors:m"]={
+ ["labels"]={
+ ["cs"]="Editoล™i",
+ ["sk"]="Editori",
+ },
+ },
["in"]={
["labels"]={
["be"]="ัƒ",
["bg"]="ะฒ",
["ca"]="en",
+ ["cs"]="v",
["de"]="in",
["en"]="in",
["eo"]="en",
@@ -224,6 +251,7 @@ data.labels={
["fr"]="dans",
["hy"]="ีดีฅีป",
["mk"]="ะฒะพ",
+ ["sk"]="v",
["sr"]="ัƒ",
["sr-latn"]="u",
},
@@ -233,6 +261,7 @@ data.labels={
["be"]="ะ”ั‹ะฟะปะพะผะฝะฐั ั€ะฐะฑะพั‚ะฐ",
["bg"]="ะดะธะฟะปะพะผะฝะฐ ั€ะฐะฑะพั‚ะฐ",
["ca"]="Tesi de maestria",
+ ["cs"]="Diplomovรก prรกce",
["de"]="Masterarbeit",
["en"]="Master's thesis",
["eo"]="Magistreca disertaฤตo",
@@ -245,6 +274,7 @@ data.labels={
["it"]="Tesi di laurea",
["mk"]="ะœะฐะณะธัั‚ะตั€ัะบะฐ ะดะธัะตั€ั‚ะฐั†ะธั˜ะฐ",
["nl"]="Masterproef",
+ ["sk"]="Diplomovรก prรกca",
["sr"]="ะœะฐัั‚ะตั€ ะดะธัะตั€ั‚ะฐั†ะธั˜ะฐ",
["sr-latn"]="Master disertacija",
},
@@ -254,6 +284,7 @@ data.labels={
["be"]="ะฝัƒะผะฐั€",
["bg"]="ะฝะพะผะตั€",
["ca"]="nombre",
+ ["cs"]="ฤรญslo",
["de"]="Nummer",
["en"]="number",
["eo"]="numero",
@@ -264,6 +295,7 @@ data.labels={
["hy"]="ีฐีกีดีกึ€",
["mk"]="ะฑั€ะพั˜",
["nl"]="nummer",
+ ["sk"]="ฤรญslo",
["sr"]="ะฑั€ะพั˜",
["sr-latn"]="broj",
},
@@ -273,6 +305,7 @@ data.labels={
["be"]="ะท",
["bg"]="ะฝะฐ",
["ca"]="de",
+ ["cs"]="z",
["de"]="von",
["en"]="of",
["eo"]="de",
@@ -281,6 +314,7 @@ data.labels={
["hy"]="-ีซึ",
["mk"]="ะพะด",
["nl"]="van",
+ ["sk"]="z",
["sr"]="ะพะด",
["sr-latn"]="od",
},
@@ -288,6 +322,7 @@ data.labels={
["others"]={
["labels"]={
["ca"]="et al.",
+ ["cs"]={ "a~kol.", "et al."},
["de"]="et al.",
["en"]="et al.",
["eo"]="aliaj",
@@ -296,6 +331,7 @@ data.labels={
["fr"]="et al.",
["hy"]="ีฅึ‚ ีกีตีฌีถ",
["mk"]="ะธ ะดั€.",
+ ["sk"]={ "a~kol.", "et al."},
["sr"]="ะธ ะดั€.",
["sr-latn"]="i dr.",
},
@@ -304,6 +340,7 @@ data.labels={
["labels"]={
["be"]="ัั‚ะฐั€.",
["ca"]="p.",
+ ["cs"]="s.",
["de"]="S.",
["en"]="p.",
["eo"]="p.",
@@ -313,6 +350,7 @@ data.labels={
["fr"]="p.",
["hy"]="ีงีป",
["mk"]="ัั‚ั€.",
+ ["sk"]="s.",
["sr"]="ัั‚ั€.",
["sr-latn"]="str.",
},
@@ -322,6 +360,7 @@ data.labels={
["be"]="ัั‚ะฐั€ะพะฝะบะฐ",
["bg"]="ัั‚ั€ะฐะฝะธ",
["ca"]="pagines",
+ ["cs"]="strany",
["de"]="Seiten",
["en"]="pages",
["eo"]="paฤoj",
@@ -333,6 +372,7 @@ data.labels={
["hy"]="ีงีปีฅึ€",
["mk"]="ัั‚ั€ะฐะฝะธั†ะธ",
["nl"]="paginas",
+ ["sk"]="strany",
["sr"]="ัั‚ั€ะฐะฝะธั†a",
["sr-latn"]="stranica",
},
@@ -342,6 +382,7 @@ data.labels={
["be"]="ะฟะฐั‚ัะฝั‚",
["bg"]="ะฟะฐั‚ะตะฝั‚",
["ca"]="Patent",
+ ["cs"]="Patent",
["de"]="Patent",
["en"]="Patent",
["eo"]="Patento",
@@ -353,6 +394,7 @@ data.labels={
["it"]="Brevetto",
["mk"]="ะŸะฐั‚ะตะฝั‚",
["nl"]="Octrooi",
+ ["sk"]="Patent",
["sr"]="ะŸะฐั‚ะตะฝั‚",
["sr-latn"]="Patent",
},
@@ -362,6 +404,7 @@ data.labels={
["be"]="ะ”ะพะบั‚ะฐั€ัะบะฐั ะดั‹ัะตั€ั‚ะฐั†ั‹ั",
["bg"]="ะดะธัะตั€ั‚ะฐั‡ะฝะฐ ั€ะฐะฑะพั‚ะฐ",
["ca"]="Tesi doctoral",
+ ["cs"]="Disertaฤnรญ prรกce",
["de"]="Dissertation",
["en"]="PhD thesis",
["eo"]="Doktoriฤa disertaฤตo",
@@ -373,6 +416,7 @@ data.labels={
["it"]="Tesi di dottorato",
["mk"]="ะ”ะพะบั‚ะพั€ัะบะฐ ะดะธัะตั€ั‚ะฐั†ะธั˜ะฐ",
["nl"]="Proefschrift",
+ ["sk"]="Dizertaฤnรก prรกca",
["sr"]="ะ”ะพะบั‚ะพั€ัะบะฐ ะดะธัะตั€ั‚ะฐั†ะธั˜ะฐ",
["sr-latn"]="Doktorska disertacija",
},
@@ -380,6 +424,7 @@ data.labels={
["pp"]={
["labels"]={
["ca"]="pp",
+ ["cs"]="s.",
["de"]="S.",
["en"]="pp.",
["eo"]="pp.",
@@ -388,6 +433,7 @@ data.labels={
["fa"]="ุตุต",
["hy"]="ีงีป",
["mk"]="ัั‚ั€.",
+ ["sk"]="s.",
["sr"]="ัั‚ั€.",
["sr-latn"]="str.",
},
@@ -397,6 +443,7 @@ data.labels={
["be"]="ะขัั…ะฝั–ั‡ะฝั‹ ะดะฐะบะปะฐะด",
["bg"]="ั‚ะตั…ะฝะธั‡ะตัะบะธ ะดะพะบะปะฐะด",
["ca"]="Report tecnic",
+ ["cs"]="Technickรก zprรกva",
["de"]="Technischer Bericht",
["en"]="Technical report",
["eo"]="Teknika raporto",
@@ -409,6 +456,7 @@ data.labels={
["it"]="Relazione tecnica",
["mk"]="ะขะตั…ะฝะธั‡ะบะธ ะธะทะฒะตัˆั‚ะฐั˜",
["nl"]="Technisch rapport",
+ ["sk"]="Technickรก zprรกva",
["sr"]="ะขะตั…ะฝะธั‡ะบะธ ะธะทะฒะตัˆั‚ะฐั˜",
["sr-latn"]="Tehniฤki izveลกtaj",
},
@@ -418,6 +466,7 @@ data.labels={
["be"]="ะณัƒั‡ะฝะฐัั†ัŒ",
["bg"]="ะพะฑะตะผ",
["ca"]="volum",
+ ["cs"]="svazek",
["de"]="Band",
["en"]="volume",
["eo"]="volumo",
@@ -428,6 +477,7 @@ data.labels={
["hy"]="ีฎีกีพีกีฌ",
["mk"]="ั‚ะพะผ",
["nl"]="deel",
+ ["sk"]="zvรคzok",
["sr"]="ั‚ะพะผ",
["sr-latn"]="tom",
},
@@ -437,6 +487,7 @@ data.labels={
["be"]="ะท",
["bg"]="ััŠั",
["ca"]="en",
+ ["cs"]="s",
["de"]="mit",
["en"]="with",
["eo"]="kun",
@@ -448,6 +499,7 @@ data.labels={
["it"]="con",
["mk"]="ัะพ",
["nl"]="met",
+ ["sk"]="s",
["sr"]="ัะฐ",
["sr-latn"]="sa",
},
@@ -500,7 +552,7 @@ data.labels={
["sr-latn"]="arccosh",
},
},
- ["arcctg"]={
+ ["arccot"]={
["labels"]={
["ca"]="arc cot",
["cs"]="arccotg",
@@ -666,7 +718,7 @@ data.labels={
["sr-latn"]="cosec",
},
},
- ["ctg"]={
+--[[ ["ctg"]={
["labels"]={
["ca"]="cot",
["cs"]="cotg",
@@ -682,6 +734,7 @@ data.labels={
["sr-latn"]="ctg",
},
},
+--]]
["deg"]={
["labels"]={
["ca"]="gr",
@@ -712,9 +765,11 @@ data.labels={
["diff"]={
["labels"]={
["ca"]="d",
+ ["cs"]="d",
["en"]="d",
["eo"]="dif",
- ["hy"]="diff",
+ ["hy"]="d",
+ ["sk"]="d",
},
},
["dim"]={
@@ -903,7 +958,7 @@ data.labels={
},
["ln"]={
["labels"]={
- ["ca"]="En",
+ ["ca"]="ln",
["cs"]="ln",
["en"]="ln",
["eo"]="ln",
@@ -947,14 +1002,16 @@ data.labels={
["median"]={
["labels"]={
["ca"]="mitjana",
- ["cs"]="\\tilde",
+ -- ["cs"]="\\tilde", -- won't work
+ ["cs"]="Me",
["en"]="median",
["eo"]="mediano",
["es"]="Mediana",
["fi"]="mediaani",
["fr"]="mรฉdiane",
["hy"]="ีดีซีปีซีถ",
- ["sk"]="\\tilde",
+ -- ["sk"]="\\tilde", -- won't work
+ ["sk"]="Med",
["sr"]="median",
["sr-latn"]="median",
},
@@ -1501,6 +1558,7 @@ data.labels={
["labels"]={
["bg"]="ะดะตะฝ",
["ca"]="dia",
+ ["cs"]="den", -- {"den", "dne" }
["de"]="Tag",
["en"]="day",
["eo"]="tago",
@@ -1512,6 +1570,7 @@ data.labels={
["kr"]="์ผ",
["mk"]="ะดะตะฝ",
["nl"]="dag",
+ ["sk"]="deลˆ", -- {"deลˆ", "dลˆa" }
["sr"]="ะดะฐะฝ",
["sr-latn"]="dan",
},
@@ -1756,25 +1815,30 @@ data.labels={
},
["following:plural"]={
["labels"]={
+ ["cs"]="nรกsl.",
["de"]="ff.",
["en"]="ff.",
["eo"]="sekvv",
["fr"]=hairspace .. "sqq",
["hy"]="ff.",
+ ["sk"]="nรกsl.",
},
},
["following:singular"]={
["labels"]={
+ ["cs"]="nรกsl.",
["de"]="f.",
["en"]="f.",
["eo"]="sekv",
["fr"]=hairspace .. "sq",
["hy"]="f.",
+ ["sk"]="nรกsl.",
},
},
["followingpage"]={
["labels"]={
["ca"]="en la seguent pagina",
+ ["cs"]="na nรกsledujรญcรญ stranฤ›",
["de"]="auf einer Folgeseite",
["en"]="on a following page",
["eo"]="je sekvanta paฤo",
@@ -1786,6 +1850,7 @@ data.labels={
["hy"]="ี€ีกีปีธึ€ีค ีงีปีธึ‚ีด",
["mk"]="ะฝะฐ ัะปะตะดะฝะฐั‚ะฐ ัั‚ั€ะฐะฝะธั†ะฐ",
["nl"]="op een volgende bladzijde",
+ ["sk"]="na nasledujรบcej strane",
["sr"]="ะฝะฐ ัะปะตะดะตั›ะพั˜ ัั‚ั€ะฐะฝะธั†ะธ",
["sr-latn"]="na sledeฤ‡oj stranici",
},
@@ -2979,6 +3044,7 @@ data.labels={
["precedingpage"]={
["labels"]={
["ca"]="en una pagina anterior",
+ ["cs"]="na pล™edchozรญ stranฤ›",
["de"]="oben", -- "auf der vorigen Seite" ok, but not "auf einer vorigen Seite"
["en"]="on a preceding page",
["eo"]="sur antaลญa paฤo",
@@ -2990,6 +3056,7 @@ data.labels={
["hy"]="ีถีกีญีธึ€ีค ีงีป",
["mk"]="ะฝะฐ ะฟั€ะตั‚ั…ะพะดะฝะฐั‚ะฐ ัั‚ั€ะฐะฝะธั†ะฐ",
["nl"]="op een voorgaande bladzijde",
+ ["sk"]="na predchรกdzajรบcej strane",
["sr"]="ะฝะฐ ะฟั€ะตั‚ั…ะพะดะฝะพั˜ ัั‚ั€ะฐะฝะธั†ะธ",
["sr-latn"]="na prethodnoj stranici",
},
@@ -3678,6 +3745,7 @@ data.labels={
["labels"]={
["bg"]="ะณะพะดะธะฝะฐ",
["ca"]="any",
+ ["cs"]="rok",
["de"]="Jahr",
["en"]="year",
["eo"]="jaro",
@@ -3690,6 +3758,7 @@ data.labels={
["kr"]="๋…„",
["mk"]="ะณะพะดะธะฝะฐ",
["nl"]="jaar",
+ ["sk"]="rok",
["sr"]="ะณะพะดะธะฝะฐ",
["sr-latn"]="godina",
},
@@ -3704,7 +3773,7 @@ data.labels={
["bg"]="ะกัŠะบั€ะฐั‰ะตะฝะธั",
["ca"]="Abreviacions",
["cn"]="็ผฉ็•ฅ่ฏญ",
- ["cs"]="Zkratky",
+ ["cs"]="Seznam zkratek", --"Zkratky"
["da"]="Forkortelser",
["de"]="Abkรผrzungen",
["en"]="Abbreviations",
@@ -3731,7 +3800,7 @@ data.labels={
["pt"]="Abreviaturas",
["ro"]="Abrevieri",
["ru"]="ะกะฟะธัะพะบ ัะพะบั€ะฐั‰ะตะฝะธะน",
- ["sk"]="Skratky",
+ ["sk"]="Zoznam skratiek", -- "Skratky"
["sl"]="Kratice",
["sr"]="ะกะบั€ะฐั›ะตะฝะธั†ะต",
["sr-latn"]="Skraฤ‡enice",
@@ -3914,7 +3983,7 @@ data.labels={
["pt"]="รndice",
["ro"]="Index",
["ru"]="ะะปั„ะฐะฒะธั‚ะฝั‹ะน ัƒะบะฐะทะฐั‚ะตะปัŒ",
- ["sk"]="Zoznam",
+ ["sk"]="Register",
["sl"]="Stvarno kazalo",
["sr"]="ะ˜ะฝะดะตะบั ะฟะพั˜ะผะพะฒะฐ",
["sr-latn"]="Indeks pojmova",
@@ -4161,6 +4230,8 @@ functions.acosh = functions.arccosh
functions.atanh = functions.arctanh
functions.tg = functions.tan
+functions.ctg = functions.cot
functions.arctg = functions.arctan
+functions.arcctg = functions.arccot
functions.arctgh = functions.arctanh
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lpdf-nod.lua b/Master/texmf-dist/tex/context/base/mkiv/lpdf-nod.lua
index 6702ed506b9..ce7cbd5c310 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/lpdf-nod.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/lpdf-nod.lua
@@ -69,18 +69,22 @@ end
-- We only define this for testing as we don't need it:
-local lateliteralnode = register(new_node(whatsit_code, lateliteralwhatsit_code))
-
-function nodepool.lateliteral(mode,str)
- local t = copy_node(lateliteralnode)
- if str then
- setfield(t,"mode",literals[mode] and mode or pageliteral_code)
- setdata(t,str)
- else
- setfield(t,"mode",pageliteral_code)
- setdata(t,mode)
+if lateliteralwhatsit_code then
+
+ local lateliteralnode = register(new_node(whatsit_code, lateliteralwhatsit_code))
+
+ function nodepool.lateliteral(mode,str)
+ local t = copy_node(lateliteralnode)
+ if str then
+ setfield(t,"mode",literals[mode] and mode or pageliteral_code)
+ setdata(t,str)
+ else
+ setfield(t,"mode",pageliteral_code)
+ setdata(t,mode)
+ end
+ return t
end
- return t
+
end
local savenode = register(new_node(whatsit_code, savewhatsit_code))
diff --git a/Master/texmf-dist/tex/context/base/mkiv/mult-def.lua b/Master/texmf-dist/tex/context/base/mkiv/mult-def.lua
index 4ac85137108..b0aba96d694 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/mult-def.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/mult-def.lua
@@ -8660,6 +8660,10 @@ return {
["fr"]="entrees",
["nl"]="ingangen",
},
+ ["extradata"]={
+ ["en"]="extradata",
+ ["nl"]="extragegevens",
+ },
["processors"]={
["en"]="processors",
},
@@ -12319,6 +12323,10 @@ return {
["pe"]="ุฑูˆุดโ€Œู…ุชู†",
["ro"]="textmethod",
},
+ ["lasttextseparator"]={
+ ["en"]="lasttextseparator",
+ ["nl"]="laatstetekstscheider",
+ },
["textseparator"]={
["cs"]="oddelovactextu",
["de"]="textseparator",
diff --git a/Master/texmf-dist/tex/context/base/mkiv/page-flt.lua b/Master/texmf-dist/tex/context/base/mkiv/page-flt.lua
index 7c222084035..8df38b406aa 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/page-flt.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/page-flt.lua
@@ -51,6 +51,8 @@ local function initialize()
return {
text = { },
page = { },
+ top = { },
+ bottom = { },
leftpage = { },
rightpage = { },
somewhere = { },
@@ -317,11 +319,13 @@ function floats.checkedpagefloat(packed)
end
function floats.nofstacked(which)
- return #stacks[which or default] or 0
+ local s = stacks[which or default]
+ return s and #s or 0
end
function floats.hasstacked(which)
- return (#stacks[which or default] or 0) > 0
+ local s = stacks[which or default]
+ return (s and #s or 0) > 0
end
-- todo: check for digits !
diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf
index 5e4560e8410..c073662c578 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf
+++ b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf
index c403fd6c524..5bced88ec0d 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf
+++ b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/Master/texmf-dist/tex/context/base/mkiv/strc-def.mkiv b/Master/texmf-dist/tex/context/base/mkiv/strc-def.mkiv
index 52b3b3ad972..520a9e3111c 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/strc-def.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/strc-def.mkiv
@@ -27,6 +27,8 @@
% \part{second} \chapter{gamma} \section{a} \section{b} \subsection{x} \subsection{y} \chapter{delta}
% \stoptext
+\defineseparatorset [\v!none] [] []
+
\defineseparatorset [\s!default] [] [.]
\defineconversionset [\s!default] [] [numbers]
\defineresetset [\s!default] [] [1] % each level
diff --git a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua b/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua
index 98d2f66c08d..c5137794181 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/toks-scn.lua
@@ -347,6 +347,11 @@ local presets = {
["2 arguments"] = { "argument", "argument" },
["3 arguments"] = { "argument", "argument", "argument" },
["4 arguments"] = { "argument", "argument", "argument", "argument" },
+
+ ["1 integer"] = { "integer" },
+ ["2 integers"] = { "integer", "integer" },
+ ["3 integers"] = { "integer", "integer", "integer" },
+ ["4 integers"] = { "integer", "integer", "integer", "integer" },
}
tokens.presets = presets
diff --git a/Master/texmf-dist/tex/context/base/mkiv/typo-prc.lua b/Master/texmf-dist/tex/context/base/mkiv/typo-prc.lua
index 2704149db99..72b159e9cac 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/typo-prc.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/typo-prc.lua
@@ -15,7 +15,7 @@ local implement = interfaces.implement
local formatters = string.formatters
-typesetters.processors = typesetters.processors or { }
+typesetters.processors = typesetters.processors or { }
local processors = typesetters.processors
local trace_processors = false
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-client.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-client.lua
index a2763feac4c..2f72ef13824 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-client.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-client.lua
@@ -23,7 +23,6 @@ local preparetemplate = helpers.preparetemplate
local splitdata = helpers.splitdata
local replacetemplate = utilities.templates.replace
local serialize = sql.serialize
-local deserialize = sql.deserialize
local getserver = sql.getserver
local osclock = os.gettimeofday
@@ -264,6 +263,7 @@ end
local wraptemplate = [[
local converters = utilities.sql.converters
local deserialize = utilities.sql.deserialize
+local fromjson = utilities.sql.fromjson
local tostring = tostring
local tonumber = tonumber
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-ffi.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-ffi.lua
index cbfd7bcf5f6..9cf306df775 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-ffi.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-ffi.lua
@@ -169,7 +169,6 @@ local validspecification = helpers.validspecification
local querysplitter = helpers.querysplitter
local dataprepared = helpers.preparetemplate
local serialize = sql.serialize
-local deserialize = sql.deserialize
local mysql_open_session = mysql.mysql_init
@@ -564,6 +563,7 @@ local ffi_tostring = ffi.string
local converters = utilities.sql.converters
local deserialize = utilities.sql.deserialize
+local fromjson = utilities.sql.fromjson
local tostring = tostring
local tonumber = tonumber
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-library.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-library.lua
index dbbeb32cc46..e43afc2f375 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-library.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-library.lua
@@ -79,7 +79,6 @@ local validspecification = helpers.validspecification
local querysplitter = helpers.querysplitter
local dataprepared = helpers.preparetemplate
local serialize = sql.serialize
-local deserialize = sql.deserialize
local formatters = string.formatters
local initialize = mysql.mysql
@@ -251,6 +250,7 @@ end
local wraptemplate = [[
local converters = utilities.sql.converters
local deserialize = utilities.sql.deserialize
+local fromjson = utilities.sql.fromjson
local tostring = tostring
local tonumber = tonumber
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-sqlite.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-sqlite.lua
index 781c92c896d..a82244bade3 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-sqlite.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-sql-imp-sqlite.lua
@@ -234,6 +234,7 @@ end
local wraptemplate = [[
local converters = utilities.sql.converters
local deserialize = utilities.sql.deserialize
+local fromjson = utilities.sql.fromjson
local tostring = tostring
local tonumber = tonumber
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sql.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sql.lua
index 55c4961f7da..f729acfb945 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-sql.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-sql.lua
@@ -87,12 +87,22 @@ sql.helpers = helpers
local serialize = table.fastserialize
local deserialize = table.deserialize
+local json = require("util-jsn")
+local tojson = json.tostring
+local fromjson = json.tolua
+
sql.serialize = serialize
sql.deserialize = deserialize
helpers.serialize = serialize -- bonus
helpers.deserialize = deserialize -- bonus
+sql.tojson = tojson
+sql.fromjson = fromjson
+
+helpers.tojson = tojson -- bonus
+helpers.fromjson = fromjson -- bonus
+
local defaults = { __index =
{
resultfile = "result.dat",
@@ -174,6 +184,8 @@ local function makeconverter(entries,celltemplate,wraptemplate)
assignments[#assignments+1] = format("[%q] = tab_%s[%s],",name,#converters,value)
elseif kind == "deserialize" then
assignments[#assignments+1] = format("[%q] = deserialize(%s),",name,value)
+ elseif kind == "fromjson" then
+ assignments[#assignments+1] = format("[%q] = fromjson(%s),",name,value)
elseif kind == "key" then
-- hashed instead of indexed
key = value
@@ -392,13 +404,25 @@ function sql.usedatabase(presets,datatable)
name = name or "data"
for i=1,#records do
local record = records[i]
- local data = record[name]
+ local data = record[name]
if data then
record[name] = deserialize(data)
end
end
end
end
+ local function unpackjson(records,name)
+ if records then
+ name = name or "json"
+ for i=1,#records do
+ local record = records[i]
+ local data = record[name]
+ if data then
+ record[name] = fromjson(data)
+ end
+ end
+ end
+ end
return {
usedmethod = usedmethod,
presets = preset,
@@ -408,7 +432,10 @@ function sql.usedatabase(presets,datatable)
execute = execute,
serialize = serialize,
deserialize = deserialize,
+ tojson = tojson,
+ fromjson = fromjson,
unpackdata = unpackdata,
+ unpackjson = unpackjson,
}
else
report_state("missing name in usedatabase specification")
diff --git a/Master/texmf-dist/tex/context/base/mkxl/anch-pos.lmt b/Master/texmf-dist/tex/context/base/mkxl/anch-pos.lmt
index 79a0da09744..07a6ecf33f9 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/anch-pos.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/anch-pos.lmt
@@ -2280,13 +2280,13 @@ implement {
implement {
name = "markregionbox",
- arguments = { "integer", "integer" },
+ arguments = "2 integers",
actions = markregionbox
}
implement {
name = "setregionbox",
- arguments = { "integer", "integer" },
+ arguments = "2 integers",
actions = setregionbox
}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt b/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt
index 02d9a6cb62c..0e0297381bf 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/char-tex.lmt
@@ -583,7 +583,7 @@ implement {
implement {
name = "uchar",
- arguments = { "integer", "integer" },
+ arguments = "2 integers",
actions = function(h,l)
context(utfchar(h*256+l))
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl b/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl
index 129e3d54531..ef7c4071708 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2023.02.23 21:26}
+\newcontextversion{2023.03.10 12:15}
%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/Master/texmf-dist/tex/context/base/mkxl/context.mkxl b/Master/texmf-dist/tex/context/base/mkxl/context.mkxl
index 809fbc307d3..8f9513510e9 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/context.mkxl
+++ b/Master/texmf-dist/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.02.23 21:26}
+\immutable\edef\contextversion{2023.03.10 12:15}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -702,7 +702,6 @@
% c:/data/develop/context/sources/file-ini.lua
% c:/data/develop/context/sources/file-lib.lua
% c:/data/develop/context/sources/file-res.lua
-% c:/data/develop/context/sources/file-syn.lua
% c:/data/develop/context/sources/font-afk.lua
% c:/data/develop/context/sources/font-agl.lua
@@ -782,7 +781,7 @@
% c:/data/develop/context/sources/meta-pdf.lua
% c:/data/develop/context/sources/meta-tex.lua
-% c:/data/develop/context/sources/mult-aux.lua
+% c:/data/develop/context/sources/mult-aux.lua % move some to s-system-*
% c:/data/develop/context/sources/mult-fmt.lua
% c:/data/develop/context/sources/page-cst.lua
@@ -822,17 +821,13 @@
% c:/data/develop/context/sources/strc-blk.lua
% c:/data/develop/context/sources/strc-con.lua
% c:/data/develop/context/sources/strc-doc.lua
-% c:/data/develop/context/sources/strc-flt.lua
% c:/data/develop/context/sources/strc-ini.lua
-% c:/data/develop/context/sources/strc-itm.lua
% c:/data/develop/context/sources/strc-lev.lua
-% c:/data/develop/context/sources/strc-mat.lua
% c:/data/develop/context/sources/strc-num.lua
% c:/data/develop/context/sources/strc-pag.lua
-% c:/data/develop/context/sources/strc-syn.lua
% c:/data/develop/context/sources/strc-usr.lua
-% c:/data/develop/context/sources/syst-cmp.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
@@ -842,10 +837,5 @@
% c:/data/develop/context/sources/typo-cln.lua -- wrong name for what it does
% c:/data/develop/context/sources/typo-dha.lua
-% c:/data/develop/context/sources/typo-fkr.lua
-% c:/data/develop/context/sources/typo-inj.lua
-% c:/data/develop/context/sources/typo-man.lua
-% c:/data/develop/context/sources/typo-prc.lua
-% c:/data/develop/context/sources/typo-rep.lua
% c:/data/develop/context/sources/unic-ini.lua
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-con.mkxl b/Master/texmf-dist/tex/context/base/mkxl/core-con.mkxl
index f9aa1a69d18..bf607c34d07 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/core-con.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-con.mkxl
@@ -86,14 +86,14 @@
\permanent\def\Alphabeticnumerals#1{\clf_Alphabetic\numexpr#1\relax{}}
\permanent\def\thainumerals #1{\clf_alphabetic\numexpr#1\relax{thai}}
-\permanent\def\devanagarinumerals#1{\clf_decimals\numexpr#1\relax{devanagari}}
-\permanent\def\malayalamnumerals #1{\clf_decimals\numexpr#1\relax{malayalam}}
-\permanent\def\tamilnumerals #1{\clf_decimals\numexpr#1\relax{tamil}}
-\permanent\def\kannadanumerals #1{\clf_decimals\numexpr#1\relax{kannada}}
-\permanent\def\telugunumerals #1{\clf_decimals\numexpr#1\relax{telugu}}
-\permanent\def\bengalinumerals #1{\clf_decimals\numexpr#1\relax{bengali}}
-\permanent\def\gujaratinumerals #1{\clf_decimals\numexpr#1\relax{gujarati}}
-\permanent\def\gurmurkhinumerals #1{\clf_decimals\numexpr#1\relax{gurmurkhi}}
+\permanent\def\devanagarinumerals#1{\clf_decimals \numexpr#1\relax{devanagari}}
+\permanent\def\malayalamnumerals #1{\clf_decimals \numexpr#1\relax{malayalam}}
+\permanent\def\tamilnumerals #1{\clf_decimals \numexpr#1\relax{tamil}}
+\permanent\def\kannadanumerals #1{\clf_decimals \numexpr#1\relax{kannada}}
+\permanent\def\telugunumerals #1{\clf_decimals \numexpr#1\relax{telugu}}
+\permanent\def\bengalinumerals #1{\clf_decimals \numexpr#1\relax{bengali}}
+\permanent\def\gujaratinumerals #1{\clf_decimals \numexpr#1\relax{gujarati}}
+\permanent\def\gurmurkhinumerals #1{\clf_decimals \numexpr#1\relax{gurmurkhi}}
\permanent\def\tibetannumerals #1{\clf_alphabetic\numexpr#1\relax{tibetan}}
\permanent\def\greeknumerals #1{\clf_alphabetic\numexpr#1\relax{greek}}
\permanent\def\Greeknumerals #1{\clf_Alphabetic\numexpr#1\relax{greek}}
@@ -102,6 +102,9 @@
\permanent\def\arabicdecimals #1{\clf_decimals \numexpr#1\relax{arabic}}
\permanent\def\persiandecimals #1{\clf_decimals \numexpr#1\relax{persian}}
+\permanent\def\mathgreeknumerals #1{\im{\clf_alphabetic\numexpr#1\relax{greek}}}
+\permanent\def\mathGreeknumerals #1{\im{\clf_Alphabetic\numexpr#1\relax{greek}}}
+
\aliased \let\arabicexnumerals \persiannumerals
\permanent\def\koreannumerals #1{\clf_alphabetic\numexpr#1\relax{korean}}
@@ -711,6 +714,9 @@
\defineconversion [\v!greek] [\greeknumerals]
\defineconversion [\v!Greek] [\Greeknumerals]
+\defineconversion [\s!math:\v!greek] [\mathgreeknumerals]
+\defineconversion [\s!math:\v!Greek] [\mathGreeknumerals]
+
\defineconversion [g] [\greeknumerals]
\defineconversion [G] [\Greeknumerals]
@@ -745,6 +751,9 @@
\defineconversion [arabicdecimals] [\arabicdecimals]
\defineconversion [persiandecimals] [\persiandecimals]
+\defineconversion [mathgreeknumerals] [\mathgreeknumerals]
+\defineconversion [mathGreeknumerals] [\mathGreeknumerals]
+
\defineconversion [koreannumerals] [\koreannumerals]
\defineconversion [koreanparennumerals] [\koreanparenthesisnumerals] % for old times sake (for a while)
\defineconversion [koreanparenthesisnumerals]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt b/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt
index 48737d7f62f..966428b36b1 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/core-uti.lmt
@@ -20,7 +20,7 @@ saves much runtime but at the cost of more memory usage.</p>
local math = math
local next, type, tostring, tonumber, setmetatable, load = next, type, tostring, tonumber, setmetatable, load
local format, match = string.format, string.match
-local concat = table.concat
+local concat, sortedkeys = table.concat, table.sortedkeys
local definetable = utilities.tables.definetable
local accesstable = utilities.tables.accesstable
@@ -282,7 +282,7 @@ directives.register("job.pack",function(v) job.pack = v end)
local savedfiles = { }
local loadedfiles = { } -- for now only timers
-local otherfiles = { } -- for now only timers
+local othercache = { }
function job.save(filename) -- we could return a table but it can get pretty large
statistics.starttiming(savedfiles)
@@ -381,18 +381,12 @@ function job.load(filename)
statistics.stoptiming(loadedfiles)
end
-local othercache = { }
-
-function job.loadother(filename,cache)
- local unpacked = false
+function job.loadother(filename)
statistics.starttiming(loadedfiles)
filename = file.addsuffix(filename,"tuc")
- if cache then
- unpacked = othercache[filename]
- end
+ local unpacked = othercache[filename]
if not unpacked then
-- so we can register the same name twice(in loading order)
- otherfiles[#otherfiles+1] = file.nameonly(filename)
local utilitydata = load(filename)
if utilitydata then
local jobpacker = utilitydata.job.packed
@@ -408,34 +402,12 @@ function job.loadother(filename,cache)
end
end
unpacked.job.packed = nil -- nicer in inspecting
- if cache then
- othercache[filename] = unpacked
- end
- --
- local lists = utilitydata.structures.lists.collected or { }
- local sections = utilitydata.structures.sections.collected or { }
- local pages = utilitydata.structures.pages .collected or { }
- for i=1,#lists do
- local entry = lists[i]
- local references = entry.references
- if references then
- local section = references.section
- local realpage = references.realpage
- -- maybe entry.* instead:
- references.sectiondata = section and sections[section]
- references.pagedata = realpage and pages[realpage]
- -- get rid of these, maybe even crash as these are bogus
- -- references.internal = nil
- -- references.realpage = nil
- -- references.section = nil
- references.x = nil
- references.y = nil
- end
- end
- --
- -- also do the references here
+ othercache[filename] = unpacked
+ --
+ structures.lists .integrate(utilitydata)
+ structures.registers .integrate(utilitydata)
+ structures.references.integrate(utilitydata)
--
- structures.references.registerfromlist(lists,derived,pages,sections)
end
end
statistics.stoptiming(loadedfiles)
@@ -447,17 +419,19 @@ statistics.register("startup time", function()
end)
statistics.register("jobdata time",function()
+ local elapsedsave = statistics.elapsedtime(savedfiles)
+ local elapsedload = statistics.elapsedtime(loadedfiles)
if enabled then
- if #otherfiles > 0 then
- return format("%s seconds saving, %s seconds loading, other files: %s",statistics.elapsedtime(savedfiles),statistics.elapsedtime(loadedfiles),concat(otherfiles," "))
+ if next(othercache) then
+ return format("%s seconds saving, %s seconds loading, other files: %s",elapsedsave,elapsedload,concat(sortedkeys(othercache), ", "))
else
- return format("%s seconds saving, %s seconds loading",statistics.elapsedtime(savedfiles),statistics.elapsedtime(loadedfiles))
+ return format("%s seconds saving, %s seconds loading",elapsedsave,elapsedload)
end
else
- if #otherfiles > 0 then
- return format("nothing saved, %s seconds loading, other files: %s",statistics.elapsedtime(loadedfiles),concat(otherfiles," "))
+ if next(othercache) then
+ return format("nothing saved, %s seconds loading, other files: %s",elapsedload,concat(sortedkeys(othercache), ", "))
else
- return format("nothing saved, %s seconds loading",statistics.elapsedtime(loadedfiles))
+ return format("nothing saved, %s seconds loading",elapsedload)
end
end
end)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/file-syn.lmt b/Master/texmf-dist/tex/context/base/mkxl/file-syn.lmt
new file mode 100644
index 00000000000..1c3010b43bc
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/file-syn.lmt
@@ -0,0 +1,79 @@
+if not modules then modules = { } end modules ['file-syn'] = {
+ version = 1.001,
+ comment = "companion to file-syn.mkvi",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+
+environment.filesynonyms = environment.filesynonyms or { }
+local filesynonyms = environment.filesynonyms
+
+local settings_to_array = utilities.parsers.settings_to_array
+local findfile = resolvers.findfile
+
+local implement = interfaces.implement
+
+storage.register("environment/filesynonyms", filesynonyms, "environment.filesynonyms")
+
+local function truefilename(name)
+ local realname = filesynonyms[name] or name
+ if realname ~= name then
+ return truefilename(realname)
+ else
+ return realname
+ end
+end
+
+environment.truefilename = truefilename
+
+function environment.definefilesynonym(name,realname)
+ if name and realname then
+ local names = settings_to_array(name)
+ for i=1,#names do
+ local name = names[i]
+ local synonym = filesynonyms[name]
+ if synonym then
+ interfaces.showmessage("files",1,{ name or "?", realname or "?", synonym or "?" })
+ end
+ filesynonyms[name] = realname
+ end
+ end
+end
+
+function environment.definefilefallback(name,alternatives)
+ if name and alternatives then
+ local names = settings_to_array(alternatives)
+ for i=1,#names do
+ local realname = findfile(names[i])
+ if realname ~= "" then
+ filesynonyms[name] = realname
+ break
+ end
+ end
+ end
+end
+
+implement {
+ name = "truefilename",
+ public = true,
+ actions = { truefilename, context },
+ arguments = "argument"
+}
+
+implement {
+ name = "definefilesynonym",
+ public = true,
+ protected = true,
+ actions = environment.definefilesynonym,
+ arguments = "2 optionals"
+}
+
+implement {
+ name = "definefilefallback",
+ public = true,
+ protected = true,
+ actions = environment,definefilefallback,
+ arguments = "2 optionals"
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/file-syn.mklx b/Master/texmf-dist/tex/context/base/mkxl/file-syn.mklx
index 25f36f742fc..3bbf15c4c17 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/file-syn.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/file-syn.mklx
@@ -15,7 +15,7 @@
\unprotect
-\registerctxluafile{file-syn}{}
+\registerctxluafile{file-syn}{autosuffix}
%D \macros
%D {definefilesynonym,definefilefallback}
@@ -42,8 +42,8 @@
%D \usemodules[pictex,chemie,unit]
%D \stoptyping
-\permanent\tolerant\def\definefilesynonym [#name]#spacer[#realname]{\clf_definefilesynonym {#name}{#realname}}
-\permanent\tolerant\def\definefilefallback[#name]#spacer[#alternatives]{\clf_definefilefallback{#name}{#alternatives}}
+% \permanent\tolerant\def\definefilesynonym [#name]#spacer[#realname]{\clf_definefilesynonym {#name}{#realname}}
+% \permanent\tolerant\def\definefilefallback[#name]#spacer[#alternatives]{\clf_definefilefallback{#name}{#alternatives}}
%D \macros
%D {truefilename}
@@ -56,6 +56,6 @@
%D
%D The implementation shows that nesting is supported.
-\permanent\def\truefilename#1{\clf_truefilename{#1}}
+% \permanent\def\truefilename#1{\clf_truefilename{#1}}
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lang-lab.lmt b/Master/texmf-dist/tex/context/base/mkxl/lang-lab.lmt
index b82721b7656..f1f9b358087 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lang-lab.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lang-lab.lmt
@@ -91,29 +91,28 @@ function labels.define(class,name,prefixed)
report_labels("defining label set %a",name)
for tag, data in next, list do
tag = variables[tag] or tag
- if data.hidden then
- -- skip
- elseif prefixed then
- local first, second = lpegmatch(splitter,tag)
- if second then
- if rawget(variables,first) then
- if rawget(variables,second) then
- definelanguagelabels(data,class,f_key_key(first,second),tag)
+ if not data.hidden then
+ local key = tag
+ if prefixed then
+ local first, second = lpegmatch(splitter,tag)
+ if second then
+ if rawget(variables,first) then
+ if rawget(variables,second) then
+ key = f_key_key(first,second)
+ else
+ key = f_key_raw(first,second)
+ end
+ elseif rawget(variables,second) then
+ key = f_raw_key(first,second)
else
- definelanguagelabels(data,class,f_key_raw(first,second),tag)
+ key = f_raw_raw(first,second)
end
- elseif rawget(variables,second) then
- definelanguagelabels(data,class,f_raw_key(first,second),tag)
- else
- definelanguagelabels(data,class,f_raw_raw(first,second),tag)
+ elseif rawget(variables,rawtag) then
+ key = f_key(tag)
end
- elseif rawget(variables,rawtag) then
- definelanguagelabels(data,class,f_key(tag),tag)
- else
- definelanguagelabels(data,class,tag,tag)
end
- else
- definelanguagelabels(data,class,tag,tag)
+ -- report_labels("defining class %a, key %a, tag %a",class,key,tag)
+ definelanguagelabels(data,class,key,tag)
end
end
else
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl b/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl
index a1d758f0979..6152d287412 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/lang-lab.mkxl
@@ -50,10 +50,10 @@
%D These commands accept all kind of inputs:
%D
%D \starttyping
-%D \setuplabeltext [language] [labellabel=text]
-%D \setuplabeltext [language] [labellabel=text,labellabel=text,...]
-%D \setuplabeltext [labellabel=text]
-%D \setuplabeltext [labellabel=text,labellabel=text,...]
+%D \setuplabeltext [language] [label1=text]
+%D \setuplabeltext [language] [label1=text,label2=text,...]
+%D \setuplabeltext [label1=text]
+%D \setuplabeltext [label1=text,label2=text,...]
%D \stoptyping
%D
%D The last two cases concern the current language.
@@ -141,7 +141,7 @@
\else
\enforced\let\thetextprefix\dummytextprefix
\fi}%
- \permanent \instance\protected\def#6##1{#3{##1}\expandafter\firstoftwoarguments \thetextprefix}% \flushleftlabelclass
+ \permanent\instance\protected\def#6##1{#3{##1}\expandafter\firstoftwoarguments \thetextprefix}% \flushleftlabelclass
\permanent\instance\protected\def#7##1{#3{##1}\expandafter\secondoftwoarguments \thetextprefix}% \flushrightlabelclass
\permanent\instance\protected\def#8##1{#3{##1}\expandafter\lang_labels_flush_both\thetextprefix}% \flushbothlabelclass #2
\permanent\instance\protected\def#9##1{#3{##1}\expandafter\firstoftwoarguments \thetextprefix}% \flushleftlabelclass
diff --git a/Master/texmf-dist/tex/context/base/mkxl/libs-imp-sqlite.lmt b/Master/texmf-dist/tex/context/base/mkxl/libs-imp-sqlite.lmt
index 5d38986f347..0d1f77d176b 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/libs-imp-sqlite.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/libs-imp-sqlite.lmt
@@ -100,7 +100,7 @@ local function execute(specification)
end
end
else
- db = open_db(filename)
+ db = sqlite_open(filename)
preamble = f_preamble(filename,base,base)
end
if not db then
@@ -156,6 +156,7 @@ end
local wraptemplate = [[
local converters = utilities.sql.converters
local deserialize = utilities.sql.deserialize
+local fromjson = utilities.sql.fromjson
local tostring = tostring
local tonumber = tonumber
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt
index 1d47c162071..f443632b82b 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -2130,6 +2130,20 @@ local finalize do
local f_group = formatters["Gp%d"]
local f_image = formatters["Im%d"]
+ local function checkedbox(mediabox,otherbox,what)
+ if otherbox and #mediabox == 4 and #otherbox == 4 then
+ local done = false
+ if otherbox[1] < mediabox[1] then done = true ; otherbox[1] = mediabox[1] end
+ if otherbox[2] < mediabox[2] then done = true ; otherbox[2] = mediabox[2] end
+ if otherbox[3] > mediabox[3] then done = true ; otherbox[3] = mediabox[3] end
+ if otherbox[4] > mediabox[4] then done = true ; otherbox[4] = mediabox[4] end
+ if done then
+ report("limiting %a to 'MediaBox'",what)
+ end
+ end
+ return otherbox
+ end
+
finalize = function(driver,details)
if not details then
@@ -2226,9 +2240,9 @@ else
-- Indirect objects don't work in all viewers.
- if TrimBox then pageattributes.TrimBox = pdfsharedobject(TrimBox ) end
- if CropBox then pageattributes.CropBox = pdfsharedobject(CropBox ) end
- if BleedBox then pageattributes.BleedBox = pdfsharedobject(BleedBox) end
+ if TrimBox then pageattributes.TrimBox = pdfsharedobject(checkedbox(bbox,TrimBox,"TrimBox")) end
+ if CropBox then pageattributes.CropBox = pdfsharedobject(checkedbox(bbox,CropBox,"CropBox")) end
+ if BleedBox then pageattributes.BleedBox = pdfsharedobject(checkedbox(bbox,BleedBox,"BleedBox")) end
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/lpdf-mis.lmt b/Master/texmf-dist/tex/context/base/mkxl/lpdf-mis.lmt
index a3a78c49ff8..577dbed5a96 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/lpdf-mis.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/lpdf-mis.lmt
@@ -415,14 +415,7 @@ local function documentspecification()
addtocatalog("Lang", pdfstring(tokens.getters.macro("currentmainlanguage")))
end
--- temp hack: the mediabox is not under our control and has a precision of 5 digits
-
-local factor = number.dimenfactors.bp
-local f_value = formatters["%.6N"]
-
-local function boxvalue(n) -- we could share them
- return pdfverbose(f_value(factor * n))
-end
+local bpfactor = number.dimenfactors.bp
local function pagespecification()
local canvas = getcanvas()
@@ -439,10 +432,10 @@ local function pagespecification()
local function extrabox(WhatBox,offset,always)
if offset ~= 0 or always then
addtopageattributes(WhatBox, pdfarray {
- boxvalue(llx + offset),
- boxvalue(lly + offset),
- boxvalue(urx - offset),
- boxvalue(ury - offset),
+ (llx + offset) * bpfactor,
+ (lly + offset) * bpfactor,
+ (urx - offset) * bpfactor,
+ (ury - offset) * bpfactor,
})
end
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx b/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx
index 6e25c413fe3..49f97ae9c1c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-acc.mklx
@@ -57,23 +57,35 @@
[\v!bottom]
[\v!both]
+\setupmathaccents
+ [\v!top]
+ [i=\v!auto]
+
+\setupmathaccents
+ [\v!both]
+ [i=\v!auto]
+
+\setupmathaccents
+ [\v!bottom]
+ [i=]
+
\permanent\tolerant\protected\def\definemathtopaccent[#1]#*[#2]#*[#3]% class name top
{\ifparameter#3\or
- \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_make_double {#1}\plusone{\number#3}\zerocount}%
+ \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_make_double {#1}\plusone{\number#3}\zerocount}%
\else
\frozen\protected\instance\edefcsname#1\endcsname{\math_accent_make_double\noexpand\currentmathaccent\plusone{\number#2}\zerocount}%
\fi}
\permanent\tolerant\protected\def\definemathbottomaccent[#1]#*[#2]#*[#3]% class name bottom
{\ifparameter#3\or
- \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_make_double {#1}\plustwo\zerocount{\number#3}}%
+ \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_make_double {#1}\plustwo\zerocount{\number#3}}%
\else
\frozen\protected\instance\edefcsname#1\endcsname{\math_accent_make_double\noexpand\currentmathaccent\plustwo\zerocount{\number#2}}%
\fi}
\permanent\tolerant\protected\def\definemathdoubleaccent[#1]#*[#2]#*[#3]#*[#4]% class name top bottom
{\ifparameter#4\or
- \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_make_double {#1}\plusthree{\number#3}{\number#4}}%
+ \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_make_double {#1}\plusthree{\number#3}{\number#4}}%
\else
\frozen\protected\instance\edefcsname#1\endcsname{\math_accent_make_double\noexpand\currentmathaccent\plusthree{\number#2}{\number#3}}%
\fi}
@@ -97,16 +109,16 @@
\fam\zerocount#bottom
\or
both \m_fixed
- \fam\zerocount#top
\fam\zerocount#bottom
+ \fam\zerocount#top
\fi
- {\ifconditional\c_math_accent_auto_dotless\mathdotless\fi#content}%
+ {\ifcstok{\mathaccentparameter{i}}\v!auto\mathdotless\fi#content}%
\stopusemathstyleparameter
\endmathgroup}
%D Relative new:
-\newconditional\c_math_accent_auto_dotless \settrue\c_math_accent_auto_dotless % cf opentype math
+% \newconditional\c_math_accent_auto_dotless \settrue\c_math_accent_auto_dotless % cf opentype math
% \aliased\let\normalgrave\grave
% \aliased\let\normalddot \ddot
@@ -125,39 +137,100 @@
% These retain the given unicode values ... but can stretch when configured
% to do so: \setupmathaccent[\v!top][\c!stretch=\v!yes]
-\definemathtopaccent[\v!top][grave]["0060] % these are old school
-\definemathtopaccent[\v!top][ddot] ["00A8]
-\definemathtopaccent[\v!top][bar] ["00AF]
-\definemathtopaccent[\v!top][acute]["00B4]
-\definemathtopaccent[\v!top][hat] ["02C6]
-\definemathtopaccent[\v!top][check]["02C7]
-\definemathtopaccent[\v!top][breve]["02D8]
-\definemathtopaccent[\v!top][dot] ["02D9]
-\definemathtopaccent[\v!top][ring] ["02DA]
-\definemathtopaccent[\v!top][tilde]["02DC]
-\definemathtopaccent[\v!top][dddot]["20DB]
+% Extended/modified below
+%
+% \definemathtopaccent[\v!top][grave]["0060] % these are old school
+% \definemathtopaccent[\v!top][ddot] ["00A8]
+% \definemathtopaccent[\v!top][bar] ["00AF]
+% \definemathtopaccent[\v!top][acute]["00B4]
+% \definemathtopaccent[\v!top][hat] ["02C6]
+% \definemathtopaccent[\v!top][check]["02C7]
+% \definemathtopaccent[\v!top][breve]["02D8]
+% \definemathtopaccent[\v!top][dot] ["02D9]
+% \definemathtopaccent[\v!top][ring] ["02DA]
+% \definemathtopaccent[\v!top][tilde]["02DC]
+% \definemathtopaccent[\v!top][dddot]["20DB]
+
+\definemathtopaccent[\v!top][grave] ["0300]
+\definemathtopaccent[\v!top][acute] ["0301]
+\definemathtopaccent[\v!top][hat] ["0302]
+\definemathtopaccent[\v!top][tilde] ["0303]
+\definemathtopaccent[\v!top][bar] ["0304]
+%definemathtopaccent[\v!top][overbar] ["0305]% We expect overbar to stretch, so later
+\definemathtopaccent[\v!top][breve] ["0306]
+\definemathtopaccent[\v!top][dot] ["0307]
+\definemathtopaccent[\v!top][ddot] ["0308]
+\definemathtopaccent[\v!top][overhook]["0309]
+\definemathtopaccent[\v!top][ring] ["030A]
+\definemathtopaccent[\v!top][check] ["030C]
+
+% Here starts the weird unicode ones
+
+%definemathtopaccent[\v!top][candra] ["0310]
+%definemathtopaccent[\v!top][overturnedcomma] ["0312]
+%definemathtopaccent[\v!top][overcommatopright] ["0315]
+%definemathtopaccent[\v!top][leftangleabove] ["031A]
+\definemathtopaccent[\v!top][leftharpoonaccent] ["20D0]
+\definemathtopaccent[\v!top][rightharpoonaccent] ["20D1]
+%definemathtopaccent[\v!top][verticaloverlayaccent]["20D2]
+%definemathtopaccent[\v!top][vec] ["20D7]% We expect vec to stretch, so later
+\definemathtopaccent[\v!top][dddot] ["20DB]
+\definemathtopaccent[\v!top][ddddot] ["20DC]
+%definemathtopaccent[\v!top][annuityaccent] ["20E7]
+%definemathtopaccent[\v!top][overbracketaccent] ["20E9]
+%definemathtopaccent[\v!top][asterixaccent] ["20F0]
+
+% Weird ones (why no single and double underdots in unicode?)
+
+%definemathbottomaccent[\v!bottom][underdot] ["0323]%Conflicting
+%definemathbottomaccent[\v!bottom][underddot] ["0324]
+%definemathbottomaccent[\v!bottom][underdddot]["20E8]
\definemathaccent
[\v!top:\v!stretch]
[\v!top]
[\c!stretch=\v!yes]
+\definemathaccent
+ [\v!bottom:\v!stretch]
+ [\v!bottom]
+ [\c!stretch=\v!yes]
+
+\definemathaccent
+ [\v!both:\v!stretch]
+ [\v!both]
+ [\c!stretch=\v!yes]
+
%D We have a problem. We can use stackers but then we need to adapt the dimensions
%D which is font dependent. So, for now we keep them as accents.
\definemathtopaccent[\v!top:\v!stretch][widegrave]["0300] % these are generic modern
-\definemathtopaccent[\v!top:\v!stretch][wideddot] ["0308]
-\definemathtopaccent[\v!top:\v!stretch][widebar] ["0304]
\definemathtopaccent[\v!top:\v!stretch][wideacute]["0301]
\definemathtopaccent[\v!top:\v!stretch][widehat] ["0302]
-\definemathtopaccent[\v!top:\v!stretch][widecheck]["030C]
+\definemathtopaccent[\v!top:\v!stretch][widetilde]["0303]
+\definemathtopaccent[\v!top:\v!stretch][widebar] ["0305]%or 305
\definemathtopaccent[\v!top:\v!stretch][widebreve]["0306]
\definemathtopaccent[\v!top:\v!stretch][widedot] ["0307]
+\definemathtopaccent[\v!top:\v!stretch][wideddot] ["0308]
\definemathtopaccent[\v!top:\v!stretch][widering] ["030A]
-\definemathtopaccent[\v!top:\v!stretch][widetilde]["0303]
+\definemathtopaccent[\v!top:\v!stretch][widecheck]["030C]
\definemathtopaccent[\v!top:\v!stretch][widedddot]["20DB]
-\definemathtopaccent[\v!top:\v!stretch][vec] ["20D7] % clumsy notation for vectors
+\definemathtopaccent[\v!top:\v!stretch][vec]["20D7] % clumsy notation for vectors
+
+\definemathtopaccent[\v!top:\v!stretch][wideoverleftharpoon] ["20D0]
+\definemathtopaccent[\v!top:\v!stretch][wideoverrightharpoon] ["20D1]
+\definemathtopaccent[\v!top:\v!stretch][wideoverleftarrow] ["20D6]
+\definemathtopaccent[\v!top:\v!stretch][wideoverrightarrow] ["20D7]
+\definemathtopaccent[\v!top:\v!stretch][wideoverleftrightarrow]["20E1]
+
+\definemathbottomaccent[\v!bottom:\v!stretch][wideundertilde]["0330]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderbar]["0332]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftrightarrow]["034D]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightharpoon]["20EC]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftharpoon]["20ED]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftarrow]["20EE]
+\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightarrow]["20EF]
\aliased\let\mathring\ring % for a while
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt
index 370415c8185..a6614aaa508 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-act.lmt
@@ -2624,6 +2624,20 @@ end
do
+ function mathtweaks.inspect(target,original,parameters)
+ local characters = target.characters
+ local slot = parameters.slot or parameters.unicode
+ if slot then
+ -- todo: show unicode
+ report_math(formatters["%C data:"](slot))
+ inspect(characters[slot])
+ end
+ end
+
+end
+
+do
+
local single <const> = 0x003D
local double <const> = 0x2A75
local triple <const> = 0x2A76
@@ -3886,13 +3900,13 @@ mathematics.horizontalcode = horizontalcode
interfaces.implement { -- can be public with two times "integerargument"
name = "extensiblecode",
- arguments = { "integer", "integer" },
+ arguments = "2 integers",
actions = { extensiblecode, context }
}
interfaces.implement { -- can be public with two times "integerargument"
name = "horizontalcode",
- arguments = { "integer", "integer" },
+ arguments = "2 integers",
actions = function(family,unicode)
local kind, loffset, roffset = horizontalcode(family,unicode)
texsetdimen(d_scratchleftoffset, loffset)
@@ -3939,7 +3953,7 @@ end
interfaces.implement {
name = "mathvariantcode",
public = true,
- arguments = { "integer", "integer" },
+ arguments = "2 integers",
actions = { mathematics.variantcode, context },
}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl
index baaa4666a85..b37887332d2 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-ali.mkxl
@@ -330,6 +330,7 @@
\tabskip\centeringskip % fails in some cases
\aligntab
\span
+\hss % for MS to test this
\boundary\c_math_align_r_marker
\math_alignment_lbox{\aligncontent}%
\tabskip\zeropoint}%
@@ -1593,6 +1594,9 @@
\newdimension\d_math_matrix_margin_t
\newdimension\d_math_matrix_margin_b
+\newdimension\d_math_matrix_max_left
+\newdimension\d_math_matrix_max_right
+
\newboundary \c_math_matrix_ornament_l
\newboundary \c_math_matrix_ornament_r
\newboundary \c_math_matrix_ornament_t
@@ -1610,7 +1614,7 @@
{\NC
\enablematrixornaments
\global\settrue\c_math_matrix_text
- \global\settrue#1
+ \global\settrue#1%
\boundary#2%
\ignorespaces}
@@ -1642,6 +1646,8 @@
\d_math_matrix_margin_r\mathmatrixparameter\c!rightmargin\relax
\d_math_matrix_margin_t\strutdp
\d_math_matrix_margin_b\strutht
+ \global\d_math_matrix_max_left \zeropoint
+ \global\d_math_matrix_max_right\zeropoint
%\tabskip.5\d_math_eqalign_distance
\tabskip\zeropoint
\math_matrix_pickup
@@ -1672,6 +1678,9 @@
\mathmatrixright % experimental hook
\egroup}
+\permanent\protected\def\mathmatrixmaxleftwidth {\d_math_matrix_max_left }
+\permanent\protected\def\mathmatrixmaxrightwidth{\d_math_matrix_max_right}
+
\let\math_matrix_strut \strut
\let\math_matrix_set_style\relax
@@ -1752,7 +1761,7 @@
\normalstopimath
\egroup
\ifconditional\c_math_matrix_text
- \ifcstok{\mathmatrixparameter\c!left\mathmatrixparameter\c!right}\emptytoks\else
+ \ifcstok{\mathmatrixparameter\c!left\mathmatrixparameter\c!right\mathmatrixparameter\c!fences}\emptytoks\else
\scratchdistance\dimexpr(\wd\scratchbox-\scratchwidth)/\plustwo\relax
\advanceby\d_math_matrix_margin_l\scratchdistance
\advanceby\d_math_matrix_margin_r\scratchdistance
@@ -1765,7 +1774,15 @@
\ifconditional\c_math_matrix_text_t
\ht\scratchbox\dimexpr\ht\scratchbox+\lineheight\relax
\fi
- \box\scratchbox}
+ \edef\p_leftedge {\mathmatrixparameter\c!leftedge }%
+ \edef\p_rightedge{\mathmatrixparameter\c!rightedge}%
+ \ifempty\p_leftedge\else
+ \hskip\dimexpr\d_math_matrix_max_left+\p_leftedge\relax
+ \fi
+ \box\scratchbox
+ \ifempty\p_rightedge\else
+ \hskip\dimexpr\d_math_matrix_max_right+\p_rightedge\relax
+ \fi}
\definemathmatrix[matrix]
\definemathmatrix[\v!mathmatrix]
@@ -1957,24 +1974,53 @@
% \definemathmatrix[matrix:bars] [\c!left={\left|\mskip\thinmuskip},\c!right={\mskip\thinmuskip\right|},\c!align=\v!middle]
\definemathmatrix
+ [matrix:none]
+ [\c!align=\v!middle,
+ \c!simplecommand=matrix]
+
+\definemathmatrix
[matrix:brackets]
[\c!fences=bracket,
- \c!align=\v!middle]
+ \c!align=\v!middle,
+ \c!simplecommand=bmatrix]
\definemathmatrix
[matrix:parentheses]
[\c!fences=parenthesis,
- \c!align=\v!middle]
+ \c!align=\v!middle,
+ \c!simplecommand=pmatrix]
\definemathmatrix
[matrix:bars]
[\c!fences=bar,
- \c!align=\v!middle]
+ \c!align=\v!middle,
+ \c!simplecommand=vmatrix]
+
+\definemathmatrix
+ [matrix:doublebars]
+ [\c!fences=doublebar,
+ \c!align=\v!middle,
+ \c!simplecommand=vvmatrix]
+
+\definemathmatrix
+ [matrix:triplebars]
+ [\c!fences=triplebar,
+ \c!align=\v!middle,
+ \c!simplecommand=vvvmatrix]
+
+\definemathmatrix
+ [matrix:groups]
+ [\c!fences=group,
+ \c!align=\v!middle,
+ \c!simplecommand=gmatrix]
\definemathmatrix
[matrix:braces]
[\c!fences=brace,
- \c!align=\v!middle]
+ \c!align=\v!middle,
+ \c!simplecommand=bracematrix]%Seldom used, bmatrix occupied by brackets
+
+% MPS: Is this one really used? Yes, in the test suite ...
\definemathmatrix
[thematrix]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl
index be33bac8619..a423a6a7934 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-def.mkxl
@@ -74,6 +74,11 @@
\definemathfunction [tan]
\definemathfunction [diff]
+% When [\c!command=] the label kicks in:
+
+\definemathfunction [cs:median] [\c!command=\widetilde]
+\definemathfunction [sk:median] [\c!command=\widetilde]
+
\aliased\let\normalmatharg\arg % todo: maybe automatically
%D This needs checking:
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl
index c76d7313a35..7d0c8ef81fc 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-ini.mkxl
@@ -1932,37 +1932,135 @@
% \startformula[functionstyle=sans] \sin(x) = 10 \stopformula
% \stopTEXpage
-\protected\def\math_function_handle#1#2#3%
+% \protected\def\math_function_handle#1#2#3%
+% {\begingroup
+% \resetdummyparameter\c!mathlimits
+% \getdummyparameters[#1]%
+% \edef\p_limits{\dummyparameter\c!mathlimits}%
+% \mathatom
+% mathfont
+% class \mathfunctioncode
+% \ifx\p_limits\v!no
+% nolimits
+% \orelse\ifx\p_limits\v!yes
+% limits
+% \orelse\ifx\p_limits\v!auto
+% nolimits
+% limits
+% \fi
+% \bgroup % textfont
+% \math_tags_mfunctionlab{#3}\c_apply_function
+% \usemathematicscolorparameter\c!functioncolor
+% \edef\p_functionstyle{\mathematicsparameter\c!functionstyle}%
+% \ifempty\p_functionstyle
+% \expandafter\math_upright
+% \orelse\ifcsname\??alternativestyle\p_functionstyle\endcsname
+% \expandafter\lastnamedcs
+% \else
+% \expandafter\p_functionstyle
+% \fi
+% #2{#3}%
+% \egroup
+% \endgroup}
+
+\installcorenamespace{mathfunction}
+
+\installcommandhandler \??mathfunction {mathfunction} \??mathfunction
+
+\appendtoks
+ \frozen\protected\edefcsname\currentmathfunction\endcsname{\math_function_handle\plusone{\currentmathfunction}{}}% \instance
+\to \everydefinemathfunction
+
+\aliased\let\setupmathfunctions\setupmathfunction
+
+\setupmathfunctions
+ [\c!color=\mathematicsparameter\c!functioncolor,
+ \c!style=\mathematicsparameter\c!functionstyle]
+
+\def\math_function_handle_normal#1#2#3%
{\begingroup
- \resetdummyparameter\c!mathlimits
- \getdummyparameters[#1]%
- \edef\p_limits{\dummyparameter\c!mathlimits}%
- \mathatom
- mathfont
- class \mathfunctioncode
- \ifx\p_limits\v!no
- nolimits
- \orelse\ifx\p_limits\v!yes
- limits
- \orelse\ifx\p_limits\v!auto
- nolimits
- limits
- \fi
- \bgroup % textfont
- \math_tags_mfunctionlab{#3}\c_apply_function
- \usemathematicscolorparameter\c!functioncolor
- \edef\p_functionstyle{\mathematicsparameter\c!functionstyle}%
- \ifempty\p_functionstyle
- \expandafter\math_upright
- \orelse\ifcsname\??alternativestyle\p_functionstyle\endcsname
- \expandafter\lastnamedcs
- \else
- \expandafter\p_functionstyle
- \fi
- #2{#3}%
- \egroup
+ \edef\currentmathfunction{#2}%
+ \setupcurrentmathfunction[#3]%
+ \edef\p_limits{\mathfunctionparameter\c!mathlimits}%
+ \mathatom
+ mathfont
+ class \mathfunctioncode
+ \ifx\p_limits\v!no
+ nolimits
+ \orelse\ifx\p_limits\v!yes
+ limits
+ \orelse\ifx\p_limits\v!auto
+ nolimits
+ limits
+ \fi
+ \bgroup % textfont
+%
+% for now we reserve command for languages and it completely bypasses
+% the atom!
+%
+% \edef\p_command{\mathfunctionparameter\c!command}%
+% \ifempty\p_command
+ \math_tags_mfunctionlab{#2}\c_apply_function
+ \usemathfunctioncolorparameter\c!color
+ \edef\p_functionstyle{\mathfunctionparameter\c!style}%
+ \ifempty\p_functionstyle
+ \expandafter\math_upright
+ \orelse\ifcsname\??alternativestyle\p_functionstyle\endcsname
+ \expandafter\lastnamedcs
+ \else
+ \expandafter\p_functionstyle
+ \fi
+ \ifcase#1\relax
+ \expandafter\firstofoneargument
+ \or
+ \expandafter\mathlabeltext
+ \fi{#2}%
+% \else
+% \p_command\relax
+% \fi
+ \egroup
\endgroup}
+\def\math_function_handle_language_indeed#1#2#3%
+ {\edef\currentmathfunction{#2}%
+ \setupcurrentmathfunction[#3]%
+ \edef\p_command{\mathfunctionparameter\c!command}%
+ \ifempty\p_command
+ \endgroup\math_function_handle_normal#1{#2}{#3}%
+ \else
+ \normalexpanded{\endgroup\p_command\expandafter}%
+ \fi}
+
+\def\math_function_handle_language#1#2%
+ {\begingroup
+ \let\math_function_handle\math_function_handle_language_indeed
+ \csname\currentmainlanguage:#2\endcsname}
+
+\tolerant\protected\def\math_function_handle#1#2#3%
+ {\ifcsname\currentmainlanguage:#2\endcsname
+ \expandafter\math_function_handle_language
+ \else
+ \expandafter\math_function_handle_normal
+ \fi#1{#2}{#3}}
+
+\permanent\tolerant\protected\def\mfunctionlabeltext[#1]%
+ {\math_function_handle\plusone{#1}{}}
+
+% \mfunction [settings][name] [settings]{name} [name] {name}
+
+\permanent\tolerant\protected\def\mfunction[#1]%
+ {\ifhastok={#1}%
+ \expandafter\mfunction_yes
+ \orelse\ifparameter#1\or
+ \expandafter\mfunction_nop
+ \else
+ \expandafter\mfunction_yop
+ \fi{#1}}
+
+\permanent\tolerant\protected\def\mfunction_yes#1#*[#2]#;#3{\math_function_handle\zerocount{#2#3}{#1}}
+\permanent\protected\def\mfunction_nop #1{\math_function_handle\zerocount{#1}{}}
+\permanent\protected\def\mfunction_yop #1#2{\math_function_handle\zerocount{#2}{}}
+
\appendtoks
\edef\p_functionstyle{\formulaparameter\c!functionstyle}%
\ifempty\p_functionstyle\else
@@ -1974,12 +2072,6 @@
\fi
\to \everybeforedisplayformula
-\permanent\tolerant\protected\def\mfunction [#1]{\math_function_handle{#1}\firstofoneargument}
-\permanent\tolerant\protected\def\mfunctionlabeltext[#1]{\math_function_handle{#1}\mathlabeltext}
-
-\permanent\tolerant\protected\def\definemathfunction[#1]#*[#2]%
- {\frozen\protected\defcsname#1\endcsname{\math_function_handle{#2}\mathlabeltext{#1}}} % \instance
-
\let\math_tags_mfunctiontxt\gobbletwoarguments
\let\math_tags_mfunctionlab\gobbletwoarguments
diff --git a/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt b/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt
index 126bb739b07..9875f8b2d93 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/math-spa.lmt
@@ -28,6 +28,7 @@ local tonode = nodes.tonode
local getid = nuts.getid
local getsubtype = nuts.getsubtype
local getnext = nuts.getnext
+local getprev = nuts.getprev
local getwidth = nuts.getwidth
local getdata = nuts.getdata
local getdepth = nuts.getdepth
@@ -47,6 +48,7 @@ local nextboundary = nuts.traversers.boundary
local nextnode = nuts.traversers.node
local texsetdimen = tex.setdimen
+local texgetdimen = tex.getdimen
local texsetcount = tex.setcount
local texisdimen = tex.isdimen
local texiscount = tex.iscount
@@ -63,44 +65,125 @@ 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 function moveon(s)
+ for n, id, subtype in nextnode, getnext(s) do
+ s = n
+ if id == kern_code then
+ -- move on (s_2 case)
+ elseif id == glue_code then
+ -- move on
+ elseif id == penalty_code then
+ -- move on (untested)
+ elseif id == hlist_code and subtype == ghost_code then
+ -- move on
+ else
+ break
+ end
+ end
+ return s
+end
+
+-- stages[1] = function(specification,stage)
+-- local box = getbox(specification.box)
+-- local head = getlist(box)
+-- local align = specification.alignstate
+-- local distance = specification.distance
+-- for s in nextboundary, head do
+-- local data = getdata(s)
+-- if data == boundary then
+-- -- todo: skip over ghost, maybe penalty, maybe glues all in one loop
+-- s = moveon(s)
+-- for n, id, subtype in nextnode, getnext(s) do
+-- s = n
+-- if id == kern_code then
+-- -- move on (s_2 case)
+-- elseif id == glue_code then
+-- -- move on
+-- elseif id == penalty_code then
+-- -- move on (untested)
+-- elseif id == hlist_code and subtype == ghost_code then
+-- -- move on
+-- else
+-- break
+-- end
+-- end
+-- distance = distance + getdimensions(head,s)
+-- break
+-- end
+-- end
+-- texsetdimen("global",d_strc_math_indent,distance)
+-- if align == 2 then
+-- for n in nextglue, head do
+-- setglue(n,getwidth(n),0,0,0,0)
+-- end
+-- end
+-- end
+
+-- -- todo: skip over ghost, maybe penalty, maybe glues all in one loop
+--
+-- local n = getnext(s)
+-- if n and getid(n) == kern_code then -- also needed
+-- n = getnext(n)
+-- end
+-- while n and getid(n) == hlist_code and getsubtype(n) == ghost_code do
+-- n = getnext(n)
+-- end
+-- while n and getid(n) == glue_code do
+-- if n and getid(n) == glue_code then
+-- n = getnext(n)
+-- end
+
+local getpenalty = nuts.getpenalty
+
stages[1] = function(specification,stage)
local box = getbox(specification.box)
local head = getlist(box)
local align = specification.alignstate
local distance = specification.distance
+ local found = { }
+ local max = 0
for s in nextboundary, head do
- if getdata(s) == boundary then
- -- todo: skip over ghost, maybe penalty, maybe glues all in one loop
--- local n = getnext(s)
--- if n and getid(n) == kern_code then -- also needed
--- n = getnext(n)
--- end
--- while n and getid(n) == hlist_code and getsubtype(n) == ghost_code do
--- n = getnext(n)
--- end
--- -- while n and getid(n) == glue_code do
--- if n and getid(n) == glue_code then
--- n = getnext(n)
--- end
- for n, id, subtype in nextnode, getnext(s) do
- s = n
- if id == kern_code then
- -- move on (s_2 case)
- elseif id == glue_code then
- -- move on
- elseif id == penalty_code then
- -- move on (untested)
- elseif id == hlist_code and subtype == ghost_code then
- -- move on
- else
+ local data = getdata(s)
+ if data == boundary then
+ s = moveon(s)
+ found[#found+1] = { s, 0, head }
+ end
+ end
+ if #found > 0 then
+ if found[1] then
+ max = distance + getdimensions(head,found[1][1])
+ found[1][2] = max
+ end
+ for i=2,#found do
+ local f = found[i]
+ local n = f[1]
+ local p = n
+ while p do
+ if getid(p) == penalty_code and getpenalty(p) == -10000 then
+ local d = distance + getdimensions(p,n)
+ f[2] = d
+ f[3] = p
+ if d > max then
+ max = d
+ end
break
end
+ p = getprev(p)
end
- distance = distance + getdimensions(head,s)
- break
+ end
+ -- we use a hangindent so we need to treat the first one
+ local f = found[1]
+ local delta = f[2] - max
+ if delta ~= 0 then
+ nuts.insertafter(head,moveon(head),nuts.pool.kern(-delta))
+ end
+ for i=2,#found do
+ local f = found[i]
+ local delta = f[2] - max
+ nuts.insertafter(head,moveon(f[3]),nuts.pool.kern(-f[2])) -- check head
end
end
- texsetdimen("global",d_strc_math_indent,distance)
+ texsetdimen("global",d_strc_math_indent,max)
if align == 2 then
for n in nextglue, head do
setglue(n,getwidth(n),0,0,0,0)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/mlib-ctx.lmt b/Master/texmf-dist/tex/context/base/mkxl/mlib-ctx.lmt
index 8ed6b0b00c5..1ee21db38ac 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/mlib-ctx.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/mlib-ctx.lmt
@@ -231,7 +231,7 @@ implement {
implement {
name = "mpsetoutercolor",
actions = function(...) metapost.setoutercolor(...) end, -- not yet implemented
- arguments = { "integer", "integer", "integer", "integer" }
+ arguments = "4 integers",
}
-- this has to become a codeinjection
diff --git a/Master/texmf-dist/tex/context/base/mkxl/mlib-fio.lmt b/Master/texmf-dist/tex/context/base/mkxl/mlib-fio.lmt
index 07c9275beca..57984839f12 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/mlib-fio.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/mlib-fio.lmt
@@ -69,15 +69,24 @@ local splitlines = string.splitlines
local suffixlist = { "mpxl", "mpiv", "mp" } -- no "mf"
+local remapped = {
+ -- We don't yet have an interface for adding more here but when needed
+ -- there will be one.
+ ["hatching.mp"] = "mp-remapped-hatching.mp",
+ ["boxes.mp"] = "mp-remapped-boxes.mp",
+ ["hatching"] = "mp-remapped-hatching.mp",
+ ["boxes"] = "mp-remapped-boxes.mp",
+}
+
local function findmpfile(name,ftype)
+ local usedname = remapped[name] or name
local validtyp = validftype(ftype)
- -- local fullname = findfile(name,validtyp)
- local fullname = findtexfile(name,validtyp)
+ local fullname = findtexfile(usedname,validtyp)
if fullname and fullname ~= "" then
return fullname
- elseif suffix(name) == "" then
+ elseif suffix(usedname) == "" then
for i=1,#suffixlist do
- fullname = findfile(addsuffix(name,suffixlist[i]),validtyp)
+ fullname = findfile(addsuffix(usedname,suffixlist[i]),validtyp)
if fullname and fullname ~= "" then
return fullname
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/mult-dim.mklx b/Master/texmf-dist/tex/context/base/mkxl/mult-dim.mklx
index 0526b3775a1..e2ed1993caa 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/mult-dim.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/mult-dim.mklx
@@ -88,7 +88,7 @@
%D \macros
%D {assignvalue}
%D
-%D A variant that does not assume dimenions ios the following:
+%D A variant that does not assume dimenions is the following:
%D
%D \starttyping
%D \assignvalue
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt
index 510e56b8ec4..ba2ccdde7d6 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-ali.lmt
@@ -343,6 +343,7 @@ do
local nextnode = nuts.traversers.node
local texgetdimen = tex.getdimen
+ local texsetdimen = tex.setdimen
local texgetglue = tex.getglue
local texget = tex.get
@@ -405,12 +406,12 @@ do
if subtype == linepenalty_code then
if l == 1 then
if splitmethod == v_both or splitmethod == v_first then
-print("FIRST")
+-- print("FIRST")
setpenalty(n, 10000)
end
elseif l == noflines then
if splitmethod == v_both or splitmethod == v_last then
-print("LAST")
+-- print("LAST")
setpenalty(n, 10000)
end
end
@@ -772,6 +773,8 @@ end
local topornament = tex.boundaries.system("c_math_matrix_ornament_t")
local bottomornament = tex.boundaries.system("c_math_matrix_ornament_b")
+ local verticalline = tex.boundaries.system("c_math_matrix_vl_boundary")
+
local left = 0
local right = 0
local nofcells = 0
@@ -802,7 +805,11 @@ end
c = c + 1
for bound in nextboundary, list do
local ornament = getdata(bound)
- if ornament == leftornament then
+ if ornament == verticalline then
+ -- this hack is is beyond ugly as we omit and span
+ c = c + 1
+ break
+ elseif ornament == leftornament then
if c == 1 then
local w = getwidth(cell)
if w > left then
@@ -874,6 +881,8 @@ end
rights = false
tops = false
bottoms = false
+ texsetdimen("global","d_math_matrix_max_left", left)
+ texsetdimen("global","d_math_matrix_max_right",right)
end
end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/node-aux.lmt b/Master/texmf-dist/tex/context/base/mkxl/node-aux.lmt
index a640addc1ed..9794d4ab807 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/node-aux.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/node-aux.lmt
@@ -98,6 +98,22 @@ function nodes.takebox(id)
end
end
+if not nuts.migratebox then -- todo: add to nodes.direct, or maybe getmigrate, setmigrate
+
+ local setpre = nuts.setpre
+ local setpost = nuts.setpost
+ local getpre = nuts.getpre
+ local getpost = nuts.getpost
+
+ function nuts.migratebox(source,target)
+ setpre(target,getpre(source))
+ setpost(target,getpost(source))
+ setpre(source)
+ setpost(source)
+ end
+
+end
+
local splitbox = tex.splitbox
nodes.splitbox = splitbox
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl b/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl
index 8808ef00b6c..ae2bd4cf8e9 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-flt.mkxl
@@ -167,6 +167,36 @@
\blank[\rootfloatparameter\c!spaceafter]%
\fi}}
+%D Not the best name for a command:
+%D
+%D \starttyping
+%D \samplefile{tufte}
+%D \placefigure[somewhere:a]{}{\externalfigure[dummy-001]}
+%D \samplefile{tufte}
+%D \placefigure{}{\externalfigure[dummy-002]}
+%D \samplefile{tufte}
+%D \startplacefigure[location={somewhere:b,tight}]
+%D \externalfigure[dummy-003]
+%D \stopplacefigure
+%D \samplefile{tufte}
+%D \placefigure{}{\externalfigure[dummy-004]}
+%D \page
+%D \placesavedfloat[figure][b][location={none,left}] \samplefile{tufte}
+%D \placesavedfloat[figure][a]
+%D % \placenamedfloat[figure][*]
+%D % \placenamedfloat[figure][b]
+%D \stoptyping
+
+\newbox\b_strc_float_saved
+
+\permanent\tolerant\protected\def\placesavedfloat[#1]#*[#2]#*[#3]% experiment for Alan B
+ {\clf_flushlabeledfloat\s!somewhere{#2}\relax
+ %\def\currentfloat{#1}%
+ \setbox\b_strc_float_saved\vpack{\box\floatbox}%
+ \startplacefloat[#1][\c!location=\v!none,#3]%
+ \box\b_strc_float_saved
+ \stopplacefloat}
+
% \setupcaption [figure] [align=flushleft]
% \setupcaption [figure-1] [align=flushleft,leftmargin=10mm]
% \setupcaption [figure-2] [align=flushleft,leftmargin=10mm,rightmargin=-10mm,width=\textwidth]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-lin.lmt b/Master/texmf-dist/tex/context/base/mkxl/page-lin.lmt
index f50031ab300..3c20feaee8c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-lin.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-lin.lmt
@@ -414,5 +414,5 @@ end
implement {
name = "addlinenumbers",
actions = boxed.addlinenumbers,
- arguments = { "integer", "integer", "integer" }
+ arguments = "3 integers",
}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-one.mkxl b/Master/texmf-dist/tex/context/base/mkxl/page-one.mkxl
index 8571c29829a..aece474a793 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-one.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-one.mkxl
@@ -366,6 +366,10 @@
\protected\def\page_one_command_set_top_insertions
{\bgroup
+ % a bit strange place but okay
+ \page_one_command_set_always_insertions_top
+ \page_one_command_set_always_insertions_bottom
+ %
\ifconditional\c_page_floats_some_waiting
\noffloatinserts\zerocount
\let\totaltopinserted\!!zeropoint
@@ -756,22 +760,79 @@
\fi
\fi}}
+% \def\page_one_place_float_otherwise_else
+% {\doifelseinset\v!always\floatlocationmethod
+% {\page_otr_command_check_if_float_fits
+% \ifconditional\c_page_floats_room
+% \page_one_place_float_auto_top_bottom
+% \else
+% \showmessage\m!floatblocks9\empty
+% \page_floats_resave\s!text
+% \fi}
+% {\page_otr_command_check_if_float_fits
+% \ifconditional\c_page_floats_room
+% \page_one_place_float_auto_top_bottom
+% \else
+% \page_floats_save\s!text
+% \nonoindentation
+% \fi}}
+
+% Some new always top/bottom trickery.
+%
+% Musical timestamp: 2023/3/2, listening to / watching Camille Bigeault on YT
+% (ANATMAN, Room 8, and others), a bit late discovery, creative drumming! Gavin
+% Harrison level creativity.
+
\def\page_one_place_float_otherwise_else
- {\doifelseinset\v!always\floatlocationmethod
- {\page_otr_command_check_if_float_fits
- \ifconditional\c_page_floats_room
- \page_one_place_float_auto_top_bottom
- \else
- \showmessage\m!floatblocks9\empty
- \page_floats_resave\s!text
- \fi}
- {\page_otr_command_check_if_float_fits
- \ifconditional\c_page_floats_room
- \page_one_place_float_auto_top_bottom
- \else
- \page_floats_save\s!text
- \nonoindentation
- \fi}}
+ {\doifelseinset\v!always\floatlocationmethod
+ {\page_otr_command_check_if_float_fits
+ \ifconditional\c_page_floats_room
+ \page_one_place_float_auto_top_bottom
+ \else
+ \showmessage\m!floatblocks9\empty
+ \doifelseinset\v!top\floatlocationmethod
+ {\page_floats_save\s!top}
+ {\doifelseinset\v!bottom\floatlocationmethod
+ {\page_floats_save\s!bottom}
+ {\page_floats_resave\s!text}}%
+ \fi}
+ {\page_otr_command_check_if_float_fits
+ \ifconditional\c_page_floats_room
+ \page_one_place_float_auto_top_bottom
+ \else
+ \page_floats_save\s!text
+ \nonoindentation
+ \fi}}
+
+\protected\def\page_one_command_set_always_insertions_bottom_indeed
+ {\page_floats_flush\s!bottom\plusone
+ \floatingpenalty\zerocount
+ \page_inserts_inject\namedinsertionnumber\s!bottomfloat\bgroup
+ \forgetall
+ \blank[\rootfloatparameter\c!spacebefore]%
+ \page_otr_command_flush_float_box
+ \egroup}
+
+\protected\def\page_one_command_set_always_insertions_bottom % will become an otr command
+ {\ifzero\nofstackedfloatsincategory\s!bottom\else
+ \page_one_command_set_always_insertions_bottom_indeed
+ \expandafter\page_one_command_set_always_insertions_bottom
+ \fi}
+
+\protected\def\page_one_command_set_always_insertions_top_indeed
+ {\page_floats_flush\s!top\plusone
+ \floatingpenalty\zerocount
+ \page_inserts_inject\namedinsertionnumber\s!bottomfloat\bgroup
+ \forgetall
+ \blank[\rootfloatparameter\c!spacebefore]%
+ \page_otr_command_flush_float_box
+ \egroup}
+
+\protected\def\page_one_command_set_always_insertions_top % will become an otr command
+ {\ifzero\nofstackedfloatsincategory\s!top\else
+ \page_one_command_set_always_insertions_top_indeed
+ \expandafter\page_one_command_set_always_insertions_top
+ \fi}
\mutable\def\floatautofactor{.5}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-sel.lmt b/Master/texmf-dist/tex/context/base/mkxl/page-sel.lmt
index a6ea84f472a..2ca93c039d0 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-sel.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-sel.lmt
@@ -19,7 +19,7 @@ do
local filedata = sections[filename]
if not filedata then
filedata = {
- data = job.loadother(addsuffix(filename,"tuc")) or false,
+ data = job.loadother(filename,"tuc") or false,
list = { }
}
sections[filename] = filedata
diff --git a/Master/texmf-dist/tex/context/base/mkxl/page-txt.mklx b/Master/texmf-dist/tex/context/base/mkxl/page-txt.mklx
index 76aa15cabf5..67ca325b2a9 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/page-txt.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/page-txt.mklx
@@ -728,18 +728,31 @@
%D A few more page breakers:
+% \installpagebreakmethod \v!empty
+% {\page_otr_flush_all_floats
+% \page_otr_command_next_page
+% \doifnot{\namedlayoutelementparameter\v!header\c!state}\v!stop{\setuplayoutelement[\v!header][\c!state=\v!empty]}%
+% \doifnot{\namedlayoutelementparameter\v!footer\c!state}\v!stop{\setuplayoutelement[\v!footer][\c!state=\v!empty]}%
+% \page_otr_insert_dummy_page}
+%
+% \installpagebreakmethod \v!header
+% {\doifnot{\namedlayoutelementparameter\v!header\c!state}\v!stop{\setuplayoutelement[\v!header][\c!state=\v!empty]}}
+%
+% \installpagebreakmethod \v!footer
+% {\doifnot{\namedlayoutelementparameter\v!footer\c!state}\v!stop{\setuplayoutelement[\v!footer][\c!state=\v!empty]}}
+
\installpagebreakmethod \v!empty
{\page_otr_flush_all_floats
\page_otr_command_next_page
- \doifnot{\namedlayoutelementparameter\v!header\c!state}\v!stop{\setuplayoutelement[\v!header][\c!state=\v!empty]}%
- \doifnot{\namedlayoutelementparameter\v!footer\c!state}\v!stop{\setuplayoutelement[\v!footer][\c!state=\v!empty]}%
+ \ifcstok{\namedlayoutelementparameter\v!header\c!state}\v!stop\else\setuplayoutelement[\v!header][\c!state=\v!empty]\fi
+ \ifcstok{\namedlayoutelementparameter\v!footer\c!state}\v!stop\else\setuplayoutelement[\v!footer][\c!state=\v!empty]\fi
\page_otr_insert_dummy_page}
\installpagebreakmethod \v!header
- {\doifnot{\namedlayoutelementparameter\v!header\c!state}\v!stop{\setuplayoutelement[\v!header][\c!state=\v!empty]}}
+ {\ifcstok{\namedlayoutelementparameter\v!header\c!state}\v!stop\else\setuplayoutelement[\v!header][\c!state=\v!empty]\fi}
\installpagebreakmethod \v!footer
- {\doifnot{\namedlayoutelementparameter\v!footer\c!state}\v!stop{\setuplayoutelement[\v!footer][\c!state=\v!empty]}}
+ {\ifcstok{\namedlayoutelementparameter\v!footer\c!state}\v!stop\else\setuplayoutelement[\v!footer][\c!state=\v!empty]\fi}
%D While the header and footer lines are moved away from the main text, the top and
%D bottom lines are centered.
diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-ver.lmt b/Master/texmf-dist/tex/context/base/mkxl/spac-ver.lmt
index 06032bcce9d..a2b02c34c3e 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/spac-ver.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/spac-ver.lmt
@@ -2830,7 +2830,7 @@ do
name = "vspacingsnap",
actions = vspacing.snapbox,
scope = "private",
- arguments = { "integer", "integer" }
+ arguments = "2 integers",
}
implement {
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-def.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-def.mkxl
index 52b3b3ad972..520a9e3111c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-def.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-def.mkxl
@@ -27,6 +27,8 @@
% \part{second} \chapter{gamma} \section{a} \section{b} \subsection{x} \subsection{y} \chapter{delta}
% \stoptext
+\defineseparatorset [\v!none] [] []
+
\defineseparatorset [\s!default] [] [.]
\defineconversionset [\s!default] [] [numbers]
\defineresetset [\s!default] [] [1] % each level
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-flt.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-flt.lmt
new file mode 100644
index 00000000000..e47046f8c80
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-flt.lmt
@@ -0,0 +1,53 @@
+if not modules then modules = { } end modules ['strc-flt'] = {
+ version = 1.001,
+ comment = "companion to strc-flt.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- nothing
+
+local sequencers = utilities.sequencers
+local appendaction = sequencers.appendaction
+local enableaction = sequencers.enableaction
+local disableaction = sequencers.disableaction
+
+local texgetdimen = tex.getdimen
+local texgetoutputactive = tex.getoutputactive
+
+local trace = trackers.register("structure.sidefloats.pageflush")
+local report = logs.reporter("structure","floats")
+
+local forcepageflush = builders.vspacing.forcepageflush
+
+local d_page_sides_vsize = tex.isdimen("d_page_sides_vsize")
+
+function builders.checksidefloat(mode,indented)
+ if not texgetoutputactive() then
+ local s = texgetdimen(d_page_sides_vsize)
+ if s > 0 then
+ if trace then
+ report("force flushing page state, height %p",s)
+ end
+ forcepageflush()
+ end
+ else
+ -- we don't have side floats outside the main vertical list
+ end
+ return indented
+end
+
+-- These two lines might move to task-ini.lmt where we currently only deal
+-- with node handlers:
+
+appendaction ("paragraph","system","builders.checksidefloat")
+disableaction("paragraph","builders.checksidefloat")
+
+interfaces.implement {
+ name = "enablesidefloatchecker",
+ onlyonce = true,
+ actions = function()
+ enableaction("paragraph","builders.checksidefloat")
+ end,
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx
index 55b825fe1e9..6af22631a80 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-flt.mklx
@@ -15,10 +15,12 @@
\writestatus{loading}{ConTeXt Structure Macros / Float Numbering}
-\registerctxluafile{strc-flt}{}
-
\unprotect
+\ifdefined\d_page_sides_vsize \else \newdimension\d_page_sides_vsize \fi
+
+\registerctxluafile{strc-flt}{autosuffix}
+
% todo: a keyword for this (and then a settings->hash for speed)
%
% \setuplayout[width=middle,backspace=3cm]
@@ -737,10 +739,10 @@
\strc_floats_set_current_tag{#tag}%
\strc_floats_reset_variables
% save
- \edef\m_location {\floatcaptionparameter\c!location}%
- \edef\m_topoffset {\floatcaptionparameter\c!topoffset}%
- \edef\m_bottomoffset{\floatcaptionparameter\c!bottomoffset}%
- \edef\m_freeregion {\floatcaptionparameter\c!freeregion}%
+ \edef\p_location {\floatcaptionparameter\c!location}%
+ \edef\p_topoffset {\floatcaptionparameter\c!topoffset}%
+ \edef\p_bottomoffset{\floatcaptionparameter\c!bottomoffset}%
+ \edef\P_freeregion {\floatcaptionparameter\c!freeregion}%
% preset
\resetfloatcaptionparameter \c!location
\setexpandedfloatcaptionparameter\c!topoffset {\floatparameter\c!topoffset}%
@@ -773,10 +775,10 @@
\setexpandedfloatparameter\c!bottomoffset{\floatcaptionparameter\c!bottomoffset}%
\setexpandedfloatparameter\c!freeregion {\floatcaptionparameter\c!freeregion}%
% restore
- \letfloatcaptionparameter\c!location \m_location
- \letfloatcaptionparameter\c!topoffset \m_topoffset
- \letfloatcaptionparameter\c!bottomoffset\m_bottomoffset
- \letfloatcaptionparameter\c!freeregion \m_freeregion
+ \letfloatcaptionparameter\c!location \p_location
+ \letfloatcaptionparameter\c!topoffset \p_topoffset
+ \letfloatcaptionparameter\c!bottomoffset\p_bottomoffset
+ \letfloatcaptionparameter\c!freeregion \P_freeregion
%
\strc_floats_analyze_location
\doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal
@@ -2127,15 +2129,38 @@
\hpack{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}%
\fi}
+\def\strc_floats_build_box_top_stack_normal_tight
+ {\hpack{\box\b_strc_floats_caption}%
+ \strc_floats_between_stack
+ \hpack{\box\b_strc_floats_content}}
+
+\def\strc_floats_build_box_bottom_stack_normal_tight
+ {\hpack{\box\b_strc_floats_content}%
+ \strc_floats_between_stack
+ \hpack{\box\b_strc_floats_caption}}
+
\def\strc_floats_build_box_top_stack_normal
{\doifelseinset\v!overlay{\floatcaptionparameter\c!location}
\strc_floats_build_box_top_stack_normal_overlay
- \strc_floats_build_box_top_stack_normal_content}
+ {\doifelseinset\v!tight{\floatlocation}
+ \strc_floats_build_box_top_stack_normal_tight
+ \strc_floats_build_box_top_stack_normal_content}}
\def\strc_floats_build_box_bottom_stack_normal
- {\doifinset\v!overlay{\floatcaptionparameter\c!location}
+ {\doifelseinset\v!overlay{\floatcaptionparameter\c!location}
\strc_floats_build_box_bottom_stack_normal_overlay
- \strc_floats_build_box_bottom_stack_normal_content}
+ {\doifelseinset\v!tight{\floatlocation}
+ \strc_floats_build_box_bottom_stack_normal_tight
+ \strc_floats_build_box_bottom_stack_normal_content}}
+
+% \def\strc_floats_build_box_bottom_stack_normal
+% {\ifhasxtoks{,\v!overlay,}{,\floatcaptionparameter\c!location,}%
+% \strc_floats_build_box_bottom_stack_normal_overlay
+% \orelse\ifhasxtoks{,\v!tight,}{,\floatlocation,}%
+% \strc_floats_build_box_bottom_stack_normal_tight
+% \else
+% \strc_floats_build_box_bottom_stack_normal_content
+% \fi}
\def\strc_floats_build_box_top_stack_grid
{\dp\b_strc_floats_caption\strutdepth
@@ -2264,16 +2289,30 @@
\def\strc_floats_build_box_after
{\doifelseframed\floatframedparameter\strc_floats_build_box_after_indeed\relax}
+% \def\strc_floats_build_box_after_indeed
+% {\global\setbox\floatbox\hpack
+% {\edef\m_width{\floatframedparameter\c!width}%
+% \ifx\m_width\v!fit
+% \let\m_width\floatwidth
+% \orelse\ifx\m_width\v!broad
+% \let\m_width\v!fit
+% \fi
+% \letfloatframedparameter\c!strut\v!no
+% \letfloatframedparameter\c!width\m_width
+% \inheritedfloatframedframed
+% {\box\floatbox}}}
+
\def\strc_floats_build_box_after_indeed
{\global\setbox\floatbox\hpack
{\edef\m_width{\floatframedparameter\c!width}%
\ifx\m_width\v!fit
- \let\m_width\floatwidth
+ \letfloatframedparameter\c!width\floatwidth
\orelse\ifx\m_width\v!broad
- \let\m_width\v!fit
+ \letfloatframedparameter\c!width\v!fit
+ \else
+ \letfloatframedparameter\c!width\m_width % expanded, not really needed
\fi
\letfloatframedparameter\c!strut\v!no
- \letfloatframedparameter\c!width\m_width
\inheritedfloatframedframed
{\box\floatbox}}}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt
new file mode 100644
index 00000000000..f9153c98e8b
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.lmt
@@ -0,0 +1,64 @@
+if not modules then modules = { } end modules ['strc-itm'] = {
+ version = 1.001,
+ comment = "companion to strc-itm.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local structures = structures
+local itemgroups = structures.itemgroups
+local jobpasses = job.passes
+
+local implement = interfaces.implement
+
+local setvariable = jobpasses.save
+local getvariable = jobpasses.getfield
+
+local texsetcount = tex.setcount
+local texsetdimen = tex.setdimen
+
+local f_stamp = string.formatters["itemgroup:%s:%s"]
+local counts = table.setmetatableindex("number")
+
+local c_strc_itemgroups_max_items = tex.iscount("c_strc_itemgroups_max_items")
+local d_strc_itemgroups_max_width = tex.isdimen("d_strc_itemgroups_max_width")
+
+-- We keep the counter at the Lua end so we can group the items within
+-- an itemgroup which in turn makes for less passes when one itemgroup
+-- entry is added or removed.
+
+local trialtypesetting = context.trialtypesetting
+
+local function analyzeitemgroup(name,level)
+ local n = counts[name]
+ if level == 1 then
+ n = n + 1
+ counts[name] = n
+ end
+ local stamp = f_stamp(name,n)
+ texsetcount(c_strc_itemgroups_max_items,getvariable(stamp,level,1,0))
+ texsetdimen(d_strc_itemgroups_max_width,getvariable(stamp,level,2,0))
+end
+
+local function registeritemgroup(name,level,nofitems,maxwidth)
+ local n = counts[name]
+ if not trialtypesetting() then
+ -- no trialtypsetting
+ setvariable(f_stamp(name,n), { nofitems, maxwidth }, level)
+ elseif level == 1 then
+ counts[name] = n - 1
+ end
+end
+
+implement {
+ name = "analyzeitemgroup",
+ actions = analyzeitemgroup,
+ arguments = { "string", "integer" }
+}
+
+implement {
+ name = "registeritemgroup",
+ actions = registeritemgroup,
+ arguments = { "string", "integer", "integer", "dimen" }
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx
index a3a4c004076..737580a274d 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-itm.mklx
@@ -13,7 +13,12 @@
\writestatus{loading}{ConTeXt Structure Macros / Itemgroups}
-\registerctxluafile{strc-itm}{}
+\unprotect
+
+\newdimension\d_strc_itemgroups_max_width
+\newinteger \c_strc_itemgroups_max_items
+
+\registerctxluafile{strc-itm}{autosuffix}
%D As we analyze/register widths and such we could as well push and pop the numbers
%D at the \LUA\ end (which saves a few calls).
@@ -170,8 +175,6 @@
% \item {test} is this okay?
% \stopitemize
-\unprotect
-
\newconditional\c_strc_itemgroups_sub
\newconditional\c_strc_itemgroups_head
\newconditional\c_strc_itemgroups_intro
@@ -216,8 +219,10 @@
\newdimension \d_strc_itemgroups_list_width
\newdimension \d_strc_itemgroups_asked_width
-\newdimension \d_strc_itemgroups_max_width \def\d_strc_itemgroups_max_width_reference{\d_strc_itemgroups_max_width}
-\newinteger \c_strc_itemgroups_max_items
+%newdimension \d_strc_itemgroups_max_width % defined already, used at the Lua end
+%newinteger \c_strc_itemgroups_max_items % idem
+
+\def\d_strc_itemgroups_max_width_reference{\d_strc_itemgroups_max_width} % no alias!
\newinteger \c_strc_itemgroups_n_of_items
\newinteger \c_strc_itemgroups_nesting
@@ -1221,7 +1226,16 @@
% WS: make the distance between items customizable, think about better default values -> see itemize-1.tex
\strc_itemgroups_set_text_item_distance% HH: moved out and made configurable (sort of)
\removeunwantedspaces
- \hskip\m_strc_itemgroups_text_distance\relax
+ \ifnum\numexpr\c_strc_itemgroups_n_of_items+\plusone\relax=\c_strc_itemgroups_max_items
+ \itemgroupparameter\c!lasttextseparator
+ \else
+ \itemgroupparameter\c!textseparator
+ \fi
+ \ifempty\m_strc_itemgroups_text_distance
+ % safeguard
+ \else
+ \hskip\m_strc_itemgroups_text_distance\relax
+ \fi
\fi
\else
\strc_itemgroups_between_command
@@ -1502,7 +1516,9 @@
\dostoptagged
\fi
\box\b_strc_itemgroups
- \hskip\interwordspace}%
+ \ifzerodim\wd\b_strc_itemgroups\else
+ \hskip\interwordspace % not configureable (yet), could be \c!textdistance
+ \fi}%
\nobreak}
\def\strc_itemgroups_handle_groups_inline_item
@@ -1659,7 +1675,7 @@
\protected\def\strc_itemgroups_set_text_item_distance
{\edef\m_strc_itemgroups_text_distance{\itemgroupparameter\c!textdistance}%
\ifempty\m_strc_itemgroups_text_distance
- %
+ % \let\m_strc_itemgroups_text_distance\zeropoint % safeguard elsewhere
\orelse\ifcsname\??itemgroupdistance\m_strc_itemgroups_text_distance\endcsname
\lastnamedcs
\else
@@ -1978,6 +1994,8 @@
\c!criterium=\v!all, % permits 0 and negative numbers
%\c!option=,
\c!textdistance=\v!space, % none big medium small <dimension>
+ \c!lasttextseparator=\itemgroupparameter\c!textseparator,
+ %\c!lasttextseparator=,
\c!command=\strc_itemgroups_default_command,
\c!indenting=\v!next,
%\c!alignsymbol=v!no,
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt
index 359fbd6b64c..b60b7520875 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.lmt
@@ -95,6 +95,7 @@ local v_intro = variables.intro
local v_here = variables.here
local v_component = variables.component
local v_product = variables.product
+local v_file = variables.file
local v_local = variables["local"]
local v_default = variables.default
@@ -443,6 +444,42 @@ local listsorters = {
local filters = setmetatableindex(function(t,k) return t[v_default] end)
+
+local used = { }
+
+function lists.use(tag,filename,class)
+ used[tag] = {
+ names = names, -- optional
+ filename = filename,
+ data = job.loadother(filename),
+ }
+end
+
+implement {
+ name = "uselist",
+ arguments = "3 strings",
+ actions = lists.use,
+}
+
+filters.external = function(specification)
+ local collected = specification.collected or { }
+ local result = { }
+ local nofresult = 0
+ local all = specification.all
+ local names = specification.names
+ setmetatableindex(result,{ external = specification.reference }) -- brr, we also have the name in
+ for i=1,#collected do
+ local v = collected[i]
+ local m = v.metadata
+ if m and names[m.name] or all then
+ nofresult = nofresult + 1
+ result[nofresult] = v
+ end
+ end
+ return result
+end
+
+
local function filtercollected(specification)
--
local names = specification.names or { }
@@ -453,10 +490,10 @@ local function filtercollected(specification)
local forced = specification.forced or { }
local nested = specification.nested or false
local sortorder = specification.sortorder or specification.order
- --
local numbers = documents.data.numbers
local depth = documents.data.depth
local block = false -- all
+ --
local wantedblock, wantedcriterium = lpegmatch(splitter,criterium) -- block:criterium
if wantedblock == "" or wantedblock == v_all or wantedblock == v_text then
criterium = wantedcriterium ~= "" and wantedcriterium or criterium
@@ -473,7 +510,7 @@ local function filtercollected(specification)
names = settings_to_set(names)
end
local all = not next(names) or names[v_all] or false
- --
+ -- --
specification.names = names
specification.criterium = criterium
specification.number = 0 -- obsolete
@@ -853,47 +890,26 @@ filters[v_component] = function(specification)
return result
end
--- filters[v_product] = function(specification)
--- local reference = specification.reference
--- if reference and reference ~= "" then
--- -- local utilitydata = job.loadother(reference,true)
--- local fullname = file.replacesuffix(reference,"tuc")
--- if lfs.isfile(fullname) then
--- local utilitydata = job.loadother(fullname)
--- if utilitydata then
--- local collected = utilitydata.structures.lists.collected or { }
--- setmetatableindex(collected,{ external = reference })
--- return collected
--- end
--- end
--- end
--- return { }
--- end
-
filters[v_product] = function(specification)
local reference = specification.reference
if reference and reference ~= "" then
- local utilitydata = job.loadother(reference,true)
--- local fullname = file.replacesuffix(reference,"tuc")
--- if lfs.isfile(fullname) then
--- local utilitydata = job.loadother(fullname)
- if utilitydata then
- local collected = utilitydata.structures.lists.collected or { }
- local result = { }
- local nofresult = 0
- local all = specification.all
- local names = specification.names
+ local utilitydata = job.loadother(reference)
+ if utilitydata then
+ local collected = utilitydata.structures.lists.collected or { }
+ local result = { }
+ local nofresult = 0
+ local all = specification.all
+ local names = specification.names
setmetatableindex(result,{ external = reference }) -- brr
- for i=1,#collected do
- local v = collected[i]
- local m = v.metadata
- if m and names[m.name] or all then
- nofresult = nofresult + 1
- result[nofresult] = v
- end
+ for i=1,#collected do
+ local v = collected[i]
+ local m = v.metadata
+ if m and names[m.name] or all then
+ nofresult = nofresult + 1
+ result[nofresult] = v
end
- return result
--- end
+ end
+ return result
end
end
return { }
@@ -977,6 +993,14 @@ function lists.getresult(r)
end
function lists.process(specification)
+ local names = specification.names
+ local external = used[names or ""]
+ if external then
+ specification.reference = names
+ specification.names = external.names
+ specification.collected = external.data.structures.lists.collected
+ specification.criterium = "external"
+ end
local result = filtercollected(specification)
local total = #result
lists.result = result
@@ -1542,3 +1566,41 @@ function lists.reordered(entry)
end
return numberdata
end
+
+-- external data
+
+function lists.integrate(utilitydata)
+ local filename = utilitydata.comment.file
+ if filename then
+ local structures = utilitydata.structures
+ if structures then
+ local lists = structures.lists.collected or { }
+ if lists then
+ local sections = structures.sections.collected or { }
+ local pages = structures.pages.collected or { }
+ for i=1,#lists do
+ local entry = lists[i]
+ local references = entry.references
+ if references then
+ local section = references.section
+ local realpage = references.realpage
+ -- maybe entry.* instead:
+ references.sectiondata = section and sections[section]
+ references.pagedata = realpage and pages[realpage]
+ -- get rid of these, maybe even crash as these are bogus
+ -- references.internal = nil
+ -- references.realpage = nil
+ -- references.section = nil
+ if references.x then
+ references.x = nil
+ end
+ if references.y then
+ references.y = nil
+ end
+ references.external = filename
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx
index 66a801241ee..6b8f2504f03 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-lst.mklx
@@ -78,6 +78,12 @@
%\c!expansion=,
\c!limittext=\languageparameter\c!limittext] % not used currently
+%D Kind of new:
+
+\permanent\protected\tolerant\def\uselist[#1]#*[#2]#*[#3]% tag file
+ {\doifelsefiledefined{#1}{}{\usefile[#1][#2]}%
+ \clf_uselist{#1}{#2}{#3}}
+
%D Helpers:
\permanent\protected\def\usenestedliststyleandcolor#style#color% will change
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-mat.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-mat.lmt
new file mode 100644
index 00000000000..3b2458eac7d
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-mat.lmt
@@ -0,0 +1,30 @@
+if not modules then modules = { } end modules ['strc-mat'] = {
+ version = 1.001,
+ comment = "companion to strc-mat.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local structures = structures
+
+local lists = structures.lists
+local sections = structures.sections
+local helpers = structures.helpers
+----- formulas = structures.formulas --reserved
+
+function helpers.formulanumber(data,spec)
+ if data then
+ local formulanumber = data.formulanumber
+ if formulanumber then
+ sections.number(data,spec,"formulanumber","formulanumber","number")
+ end
+ end
+end
+
+function lists.formulanumber(name,n,spec)
+ local result = lists.result
+ if result then
+ helpers.formulanumber(result[n])
+ end
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl
index bcbe4a6f87f..2e6c21ad27f 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-mat.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Structure Macros / Math Numbering}
-\registerctxluafile{strc-mat}{}
+\registerctxluafile{strc-mat}{autosuffix}
% -- we have potential for captions
% -- this module will use the commandhandler
@@ -141,6 +141,12 @@
\permanent\protected\defcsname\e!start\v!formula\endcsname{\strc_formulas_start_formula{}}
\permanent\protected\defcsname\e!stop \v!formula\endcsname{\strc_formulas_stop_formula}
+\permanent\protected\def\startnamedformula[#1]%
+ {\strc_formulas_start_formula{#1}}
+
+\permanent\protected\def\stopnamedformula
+ {\strc_formulas_stop_formula}
+
\let\strc_formulas_start_formula\relax % defined later
\let\strc_formulas_stop_formula \relax % defined later
@@ -975,13 +981,12 @@
\setupformula
% [\c!split=\v!no,
- [\c!split=\v!text, % multi line no page breaks
+ [\c!split=\v!yes,
\c!numberlocation=,
\c!textdistance=\zeropoint,
- %\c!interlinespace=1.5\lineheight,
+ \c!interlinespace=1.125\lineheight, % back again, to be tuned
\c!textmargin=2\emwidth,
- \c!numbermethod=\v!down,
- \c!interlinespace=]
+ \c!numbermethod=\v!down]
% for the moment (when testing) we use a penalty 1
@@ -1206,12 +1211,15 @@
\fi{#2}%
\fi}
+\def\strc_math_break_here_indeed
+ {\strut\break}
+
\protected\def\strc_math_page_here
{\ifmmode
\ifconditional\c_strc_math_trace_hang
\strc_math_trace_okay{darkyellow}{B P}%
\fi
- \break
+ \strc_math_break_here_indeed
\vadjust pre {\vfill\penalty-100000}%
\strc_math_pickup_again
\fi}
@@ -1221,7 +1229,7 @@
\ifconditional\c_strc_math_trace_hang
\strc_math_trace_okay{darkyellow}{B S}%
\fi
- \break
+ \strc_math_break_here_indeed
\vadjust pre {\penalty\plustenthousand}%
\strc_math_pickup_again
\fi}
@@ -1231,7 +1239,7 @@
\ifconditional\c_strc_math_trace_hang
\strc_math_trace_okay{darkgreen}{B}%
\fi
- \break
+ \strc_math_break_here_indeed
\strc_math_pickup_again
\fi}
@@ -1392,7 +1400,10 @@
\doadaptleftskip\p_margin
\doadaptrightskip\p_margin
\fi
- %
+ % this was lost
+ \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
@@ -1557,7 +1568,8 @@
\iftrialtypesetting\else
\global\advanceby\c_strc_formulas_n\plusone
\fi
- \def\currentformula{#1}%
+ \edef\currentformula{#1}%
+ \usesetupsparameter\formulaparameter % new
\dostarttaggedchained\t!formula\currentformula\??formula
\strc_math_set_options{#2}%
\strc_math_set_split
@@ -1998,6 +2010,19 @@
%D New:
%D
%D \setupformula[snap=yes,snapstep=medium]
+%D
+%D \startbuffer
+%D We test \dorecurse{20}{$x^{#1}$ and $\frac{1}{#1}^x$ and $\sqrt[#1]{x}$ and }that's it.
+%D \stopbuffer
+%D
+%D \startcombination[nx=2,ny=3,location=top]
+%D {\ruledvbox{\hsize.45\textwidth \setupformula[snap=no] \showboxes \enabletrackers [math.snapping=darkred] \getbuffer}} {}
+%D {\ruledvbox{\hsize.45\textwidth \setupformula[snap=no] \disabletrackers[math.snapping] \getbuffer}} {}
+%D {\ruledvbox{\hsize.45\textwidth \setupformula[snap=yes,snapstep=small] \showboxes \darkgreen \enabletrackers [math.snapping=darkred] \getbuffer}} {}
+%D {\ruledvbox{\hsize.45\textwidth \setupformula[snap=yes,snapstep=small] \darkgreen \disabletrackers[math.snapping] \getbuffer}} {}
+%D {\ruledvbox{\hsize.45\textwidth \setupformula[snap=yes,snapstep=big] \showboxes \darkblue \enabletrackers [math.snapping=darkred] \getbuffer}} {}
+%D {\ruledvbox{\hsize.45\textwidth \setupformula[snap=yes,snapstep=big] \darkblue \disabletrackers[math.snapping] \getbuffer}} {}
+%D \stopcombination
\definesystemattribute[mathsnap][public]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt
index b97a1619b3f..26b1894753c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.lmt
@@ -18,7 +18,7 @@ local format, gmatch, match, strip = string.format, string.gmatch, string.match,
local floor = math.floor
local rawget, tonumber, type, next = rawget, tonumber, type, next
local lpegmatch = lpeg.match
-local insert, remove, copytable = table.insert, table.remove, table.copy
+local insert, remove, copytable, sortedhash = table.insert, table.remove, table.copy, table.sortedhash
local formatters = string.formatters
local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match
@@ -130,6 +130,9 @@ local c_locationcount = texiscount("locationcount")
local c_locationorder = texiscount("locationorder")
local c_lastdestinationattribute = texiscount("lastdestinationattribute")
+local p_splitter = lpeg.splitat(":")
+local p_lower = lpeg.patterns.utf8lower
+
local context = context
local ctx_pushcatcodes = context.pushcatcodes
@@ -494,7 +497,7 @@ implement {
-- no metatable here .. better be sparse
-local function register_from_list(collected,derived,pages,sections)
+local function register_from_list(collected,derived,external)
local derived_g = derived[""] -- global
local derived_p = nil
local derived_c = nil
@@ -556,11 +559,24 @@ local function register_from_list(collected,derived,pages,sections)
end
end
-references.registerfromlist = function(collected,pages,sections)
- register_from_list(collected,derived,pages,sections)
+function references.integrate(utilitydata)
+ local filename = utilitydata.comment.file
+ if filename then
+ -- lists are already internalized
+ local structures = utilitydata.structures
+ if structures then
+ local lists = structures.lists.collected
+ if lists then
+ register_from_list(lists,derived,filename)
+ end
+ end
+ end
end
-references.registerinitializer(function() register_from_list(lists.collected,derived) end)
+references.registerinitializer(function()
+ -- the main document
+ register_from_list(lists.collected,derived)
+end)
-- tracing
@@ -953,7 +969,8 @@ local function resolve(prefix,reference,args,set) -- we start with prefix,refere
local var = splitreference(ri)
if var then
var.reference = ri
- local vo, vi = var.outer, var.inner
+ local vo = var.outer
+ local vi = var.inner
-- we catch this here .. it's a way to pass references with commas
if vi == "name" then
local arguments = var.arguments
@@ -1154,11 +1171,14 @@ local function loadproductreferences(productname,componentname,utilitydata)
report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a",
"product","regular",productname,prefix,reference)
end
- if not reference.sectiondata then
- reference.sectiondata = sections[reference.section or false]
- end
- if not reference.pagedata then
- reference.pagedata = pages[reference.realpage or false]
+ local references = data.references
+ if references then
+ if not references.sectiondata then
+ references.sectiondata = sections[references.section or false]
+ end
+ if not references.pagedata then
+ references.pagedata = pages[references.realpage or false]
+ end
end
end
end
@@ -1296,26 +1316,37 @@ end)
function references.loadpresets(product,component) -- we can consider a special components hash
if product and component and product~= "" and component ~= "" and not productdata.product then -- maybe: productdata.filename ~= filename
- productdata.product = product
+ productdata.product = product
productdata.component = component
-- todo: use other locator
- local fullname = file.replacesuffix(product,"tuc")
- if lfs.isfile(fullname) then
- local utilitydata = job.loadother(fullname)
- if utilitydata then
- if trace_importing then
- report_importing("loading references for component %a of product %a from %a",component,product,fullname)
- end
- loadproductvariables (product,component,utilitydata)
- loadproductreferences(product,component,utilitydata)
- loadproductcomponents(product,component,utilitydata)
+ local utilitydata = job.loadother(product)
+ if utilitydata then
+ if trace_importing then
+ report_importing("loading references for component %a of product %a",component,product)
end
+ loadproductvariables (product,component,utilitydata)
+ loadproductcomponents(product,component,utilitydata)
+ loadproductreferences(product,component,utilitydata)
+-- loadproductcomponents(product,component,utilitydata)
end
end
end
references.productdata = productdata
+implement {
+ name = "usereferences",
+ public = true,
+ protected = true,
+ arguments = "optional",
+ actions = function(product)
+ local utilitydata = job.loadother(product)
+ if utilitydata then
+ loadexternalreferences(product,utilitydata)
+ end
+ end
+}
+
local useproduct = commands.useproduct
if useproduct then
@@ -1392,6 +1423,10 @@ local function report_identify_outer(set,var,i,type)
end
end
+local function report_identify_auto(set,var,i,type)
+ report_identifying("type %a, reference %a, using auto outer %a",type,reference,var.outer)
+end
+
local function identify_special(set,var,i)
local special = var.special
local s = specials[special]
@@ -1547,6 +1582,61 @@ local function unprefixed_inner(set,var,prefix,collected,derived,tobesaved)
return var
end
+local function identify_auto(set,var,i)
+ local inner = var.inner
+ local prefix = set.prefix or ""
+ if prefix == "" then
+ prefix, inner = lpegmatch(p_splitter,inner)
+ if not inner then
+ inner = var.inner
+ prefix = false
+ end
+ end
+ local function okay(o,where)
+ var.outer = o
+ if trace_identifying then
+ report_identify_auto(set,var,i,where)
+ end
+ return true
+ end
+ for o, odata in sortedhash(externals) do
+ if o == outer or not odata then
+ -- skip this one
+ elseif prefix and prefix ~= "" then
+ local pdata = odata[prefix]
+ if pdata then
+ local r = pdata[inner]
+ if r then
+ return okay(o,"2h")
+ end
+ end
+ -- escape from prefix
+-- local pdata = odata[""]
+-- if pdata then
+-- local r = pdata[inner]
+-- if r then
+-- return okay(o,"2h")
+-- end
+-- end
+ else
+ for p, pdata in sortedhash(odata) do
+ local r = pdata[inner]
+ if r then
+ return okay(o,"2j")
+ end
+ end
+ local pdata = odata[""]
+ if pdata then
+ r = pdata[inner]
+ if r then
+ return okay(o,"2k")
+ end
+ end
+ end
+ end
+ return false
+end
+
local function identify_outer(set,var,i)
local outer = var.outer
local inner = var.inner
@@ -1587,18 +1677,6 @@ local function identify_outer(set,var,i)
end
end
end
- local external = productdata.componentreferences[outer]
- if external then
- local v = identify_inner(set,var,"",external)
- if v then
- v.kind = "outer with inner"
- set.external = true
- if trace_identifying then
- report_identify_outer(set,v,i,"2c")
- end
- return v
- end
- end
local external = productdata.productreferences[outer]
if external then
local vi = external[inner]
@@ -1612,6 +1690,18 @@ local function identify_outer(set,var,i)
return var
end
end
+ local external = productdata.componentreferences[outer]
+ if external then
+ local v = identify_inner(set,var,"",external)
+ if v then
+ v.kind = "outer with inner"
+ set.external = true
+ if trace_identifying then
+ report_identify_outer(set,v,i,"2c")
+ end
+ return v
+ end
+ end
-- the rest
local special = var.special
local arguments = var.arguments
@@ -1675,6 +1765,7 @@ end
local function identify_inner_or_outer(set,var,i)
-- here we fall back on product data
local inner = var.inner
+
if inner and inner ~= "" then
-- first we look up in collected and derived using the current prefix
@@ -1689,6 +1780,10 @@ local function identify_inner_or_outer(set,var,i)
return v
end
+ if var.inner == var.reference and identify_auto(set,var,i) and var.outer and var.outer ~= "" then
+ return identify_outer(set,var,i)
+ end
+
-- nest we look at each component (but we can omit the already consulted one
local jobstructure = job.structure
@@ -1861,6 +1956,9 @@ local function identify(prefix,reference)
elseif spe then
var = identify_special(set,var,i)
elseif var.outer then
+ if var.outer == "auto" then
+ identify_auto(set,var,i)
+ end
var = identify_outer(set,var,i)
elseif var.arguments then
var = identify_arguments(set,var,i)
@@ -2837,9 +2935,6 @@ end
-- experimental:
-local p_splitter = lpeg.splitat(":")
-local p_lower = lpeg.patterns.utf8lower
-
-- We can cache lowercased titles which saves a lot of time, but then
-- we can better have a global cache with weak keys.
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx
index e7073b36ded..a1b6ac22d45 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-ref.mklx
@@ -557,7 +557,7 @@
%D \NC \NC $\star$ \NC \NC\NR
%D \stoptabulate
-\permanent\protected\def\usereferences[#filename]{} % obsolete
+% \permanent\protected\def\usereferences[#filename]{} % defined at the lua end
%D As mentioned we will also use the cross reference mechanism for navigational
%D purposes. The main reason for this is that we want to treat both categories
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt
index a3a7dae6c88..b66b229212c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.lmt
@@ -1037,38 +1037,72 @@ function registers.finalize(data,options) -- maps character to index (order)
data.result = split
end
--- local function analyzeregister(class,options)
--- local data = collected[class]
--- if data and data.entries then
--- options = options or { }
--- sorters.setlanguage(options.language,options.method,options.numberorder)
--- registers.filter(data,options) -- filter entries into results (criteria)
--- registers.prepare(data,options) -- adds split table parallel to list table
--- registers.sort(data,options) -- sorts results
--- registers.unique(data,options) -- get rid of duplicates
--- registers.finalize(data,options) -- split result in ranges
--- data.metadata.sorted = true
--- return data.metadata.nofsorted or 0
--- else
--- return 0
--- end
--- end
+local used = { }
+
+function registers.use(tag,filename,class,prefix)
+ used[tag] = {
+ class = class,
+ filename = filename,
+ data = job.loadother(filename),
+ prefix = prefix or class,
+ }
+end
+
+implement {
+ name = "useregister",
+ arguments = "4 strings",
+ actions = registers.use,
+}
+
+implement {
+ name = "registerprefix",
+ arguments = "string",
+ actions = function(tag)
+ local u = used[tag]
+ if u then
+ context(u.prefix)
+ end
+ end
+}
+
+function registers.tweak(data,options)
+ -- Just in case it's needed.
+end
local function analyzeregister(class,options)
local data = rawget(collected,class)
if not data then
- local list = utilities.parsers.settings_to_array(class)
- local entries = { }
- local metadata = false
+ local list = utilities.parsers.settings_to_array(class)
+ local entries = { }
+ local nofentries = 0
+ local metadata = false
for i=1,#list do
local l = list[i]
+ local u = used[l]
local d = collected[l]
- local e = d.entries
- for i=1,#e do
- entries[#entries+1] = e[i]
+ if u then
+ local collected = u.data.structures.registers.collected
+ local class = u.class
+ if collected and class then
+ d = collected[class]
+ end
end
- if not metadata then
- metadata = d.metadata
+ if d then
+ local e = d.entries
+ local u = u and { u.prefix } or nil
+ for i=1,#e do
+ local ei = e[i]
+ nofentries = nofentries + 1
+ entries[nofentries] = ei
+ if u then
+ local eil = ei.list
+ eil[#eil+1] = u
+ ei.external = l -- this is the (current) abstract tag, used for prefix
+ end
+ end
+ if not metadata then
+ metadata = d.metadata
+ end
end
end
data = {
@@ -1080,11 +1114,12 @@ local function analyzeregister(class,options)
if data and data.entries then
options = options or { }
sorters.setlanguage(options.language,options.method,options.numberorder)
- registers.filter(data,options) -- filter entries into results (criteria)
- registers.prepare(data,options) -- adds split table parallel to list table
- registers.sort(data,options) -- sorts results
- registers.unique(data,options) -- get rid of duplicates
- registers.finalize(data,options) -- split result in ranges
+ registers.filter(data,options) -- filter entries into results (criteria)
+ registers.prepare(data,options) -- adds split table parallel to list table
+ registers.sort(data,options) -- sorts results
+ registers.unique(data,options) -- get rid of duplicates
+ registers.tweak(data,options) -- plugin
+ registers.finalize(data,options)-- split result in ranges
data.metadata.sorted = true
return data.metadata.nofsorted or 0
else
@@ -1131,12 +1166,12 @@ local function pagerange(f_entry,t_entry,is_last,prefixspec,pagespec)
ctx_registerpagerange(
f_entry.metadata.name or "",
f_entry.processors and f_entry.processors[2] or "",
- fer.internal or 0,
+ f_entry.external or fer.internal or 0,
fer.realpage or 0,
function()
h_prefixpage(f_entry,prefixspec,pagespec)
end,
- ter.internal or 0,
+ t_entry.external or ter.internal or 0,
ter.lastrealpage or ter.realpage or 0,
function()
if is_last then
@@ -1153,7 +1188,7 @@ local function pagenumber(entry,prefixspec,pagespec)
ctx_registeronepage(
entry.metadata.name or "",
entry.processors and entry.processors[2] or "",
- er.internal or 0,
+ entry.external or er.internal or 0,
er.realpage or 0,
function() h_prefixpage(entry,prefixspec,pagespec) end
)
@@ -1162,9 +1197,10 @@ end
local function packed(f_entry,t_entry)
local fer = f_entry.references
local ter = t_entry.references
+-- todo: make sure we don't end up here with external
ctx_registerpacked(
- fer.internal or 0,
- ter.internal or 0
+ f_entry.external or fer.internal or 0,
+ t_entry.external or ter.internal or 0
)
end
@@ -1286,6 +1322,10 @@ function registers.flush(data,options,prefixspec,pagespec)
-- report_registers("invalid see entry in register %a, reference %a",entry.metadata.name,list[1][1])
end
end
+ if entry.external then
+ local list = entry.list
+ list[#list] = nil
+ end
end
-- ok, this is tricky: we use e[i] delayed so we need it to be local
-- but we don't want to allocate too many entries so there we go
@@ -1497,7 +1537,7 @@ function registers.flush(data,options,prefixspec,pagespec)
local seeword = entry.seeword
local seetext = seeword.text or ""
local processor = seeword.processor or (entry.processors and entry.processors[1]) or ""
- local seeindex = entry.references.seeindex or ""
+ local seeindex = entry.external or entry.references.seeindex or ""
ctx_registerseeword(
metadata.name or "",
i,
@@ -1696,3 +1736,46 @@ interfaces.implement {
arguments = { "string", "string", "integer" },
actions = { registers.findinternal, context },
}
+
+-- external data
+
+function registers.integrate(utilitydata)
+ local filename = utilitydata.comment.file
+ if filename then
+ local structures = utilitydata.structures
+ if structures then
+ local registers = structures.registers.collected or { }
+ if registers then
+ local sections = structures.sections.collected or { }
+ local pages = structures.pages .collected or { }
+ for class, register in next, registers do
+ local entries = register.entries
+ if entries then
+ for i=1,#entries do
+ local entry = entries[i]
+ local references = entry.references
+ if references then
+ local section = references.section
+ local realpage = references.realpage
+ -- maybe entry.* instead:
+ references.sectiondata = section and sections[section]
+ references.pagedata = realpage and pages[realpage]
+ -- get rid of these, maybe even crash as these are bogus
+ -- references.internal = nil -- or 0
+ -- references.realpage = nil -- or 0
+ -- references.section = nil -- or 0
+ if references.x then
+ references.x = nil
+ end
+ if references.y then
+ references.y = nil
+ end
+ references.external = filename -- not really needed
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl
index 485b68b746c..afe3d27a09c 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-reg.mkxl
@@ -757,6 +757,41 @@
% todo \index{todo}
% \stoptext
+%D Kind of new:
+
+% % index-1.tex:
+%
+% \setupinteraction[state=start]
+% \starttext
+% test \index{entry WB.1} \page empty \page
+% test \index{another WB.1} \page empty \page
+% test \index{onemore WB.1} \page empty \page
+% test \index{whatever WB.1} \page empty \page
+% test \index{common} \page empty \page
+% \placeregister[index]
+% \stoptext
+%
+% % index-2.tex:
+%
+% \setupinteraction[state=start]
+% \defineregister[xedni]
+% \useregister[workbook][index-1][index][WB ]
+% \starttext
+% test \index{onemore TB.1} \page
+% test \index{another TB.1} \page
+% test \index{entry TB.1} \page
+% test \index{common} \page
+% test \xedni{onemore TB.2} \page
+% test \xedni{another TB.2} \page
+% test \xedni{entry TB.2} \page
+% test \xedni{common} \page
+% \placeregister[index,xedni,workbook]
+% \stoptext
+
+\permanent\protected\tolerant\def\useregister[#1]#*[#2]#*[#3]#*[#4]% tag file class prefix
+ {\doifelsefiledefined{#1}{}{\usefile[#1][#2]}%
+ \clf_useregister{#1}{#2}{#3}{#4}}
+
%D Character rendering (sections):
\installcorenamespace{registerindicator}
@@ -1070,17 +1105,45 @@
\let\currentregisterrealpage\!!zerocount % todo: more general accessor
-\permanent\protected\def\withregisterpagecommand#1#2#3#4%
+% keep as reference
+%
+% \permanent\protected\def\withregisterpagecommand#1#2#3#4%
+% {\ifcase#3\relax
+% {\tt [entry\space not\space flushed]}%
+% \else
+% \def\currentregisterpageindex{#2}%
+% \def\currentregisterrealpage{#3}%
+% \iflocation
+% \strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]%
+% \else
+% \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}%
+% \fi
+% \fi}
+%
+% todo: adapt \strc_references_goto_internal to take an extra argument, the ref
+
+\permanent\protected\def\withregisterpagecommand#1#2#3#4% #1:processor #2:internal #3:realpage #4:page
{\ifcase#3\relax
{\tt [entry\space not\space flushed]}%
\else
\def\currentregisterpageindex{#2}%
\def\currentregisterrealpage{#3}%
- \iflocation
- \strc_references_goto_internal{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]%
+ \ifchknum\currentregisterpageindex\or
+ \lettonothing\currentregisterpageprefix
\else
- \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}%
+ \def\currentregisterpageprefix{\clf_registerprefix{\currentregisterpageindex}}%
\fi
+ \iflocation
+ \ifempty\currentregisterpageprefix
+ \strc_references_get_simple_reference{internal(\currentregisterpageindex)}%
+ \else
+ \strc_references_get_simple_reference{\currentregisterpageindex::page(\currentregisterrealpage)}%
+ \fi
+ \global\lastsavedreferenceattribute\currentreferenceattribute
+ \c_attr_reference\currentreferenceattribute
+ \setlocationattributes
+ \fi
+ \applyprocessor{#1}{\currentregisterpageprefix\registerparameter\c!pagecommand{#4}}%
\fi}
\lettonothing\m_current_register
@@ -1151,7 +1214,9 @@
\iflocation
\def\currentregisterseeindex{#4}%
\ifconditional\c_strc_registers_text_interaction
- \strc_references_goto_internal{\setlocationcolor\doapplyregisterentrycommand{#2}{#5}}[internal(#3)]%
+ \ifchknum\currentregisterpageindex\or
+ \strc_references_goto_internal{\setlocationcolor\doapplyregisterentrycommand{#2}{#5}}[internal(#3)]%
+ \fi
\else
\doapplyregisterentrycommand{#2}{#5}%
\fi
@@ -1179,6 +1244,30 @@
\applyprocessor{#1}{#2}%
\fi}
+% \permanent\protected\def\defaultregisterseeword#1#2#3#4#5#6#7% class i n #3:processor #4:internal #5:seeindex #6:word
+% {\pushcurrentregister{#1}%
+% \ifnum#2=\plusone
+% \registerpageseparator
+% \fi
+% \global\setconstant\c_strc_registers_page_state\plustwo
+% \def\currentregisterpageindex{#5}%
+% \dostarttagged\t!registersee\empty
+% \settrue\c_strc_registers_page_done
+% \iflocation
+% \def\currentregisterseeindex{#6}%
+% \else
+% \lettonothing\currentregisterseeindex
+% \fi
+% \ifnum#2=\plusone
+% \labeltexts\v!see{\doapplyregisterseecommand{#4}{#7}}%
+% \orelse\ifnum#2=#3\relax
+% \labeltexts\v!and{\doapplyregisterseecommand{#4}{#7}}%
+% \else
+% ,\space\doapplyregisterseecommand{#4}{#7}%
+% \fi
+% \dostoptagged
+% \popcurrentregister}
+
\permanent\protected\def\defaultregisterseeword#1#2#3#4#5#6#7% class i n #3:processor #4:internal #5:seeindex #6:word
{\pushcurrentregister{#1}%
\ifnum#2=\plusone
@@ -1186,19 +1275,30 @@
\fi
\global\setconstant\c_strc_registers_page_state\plustwo
\def\currentregisterpageindex{#5}%
+ \def\currentregisterseeindex{#6}%
\dostarttagged\t!registersee\empty
\settrue\c_strc_registers_page_done
- \iflocation
- \def\currentregisterseeindex{#6}%
+ \ifchknum\currentregisterseeindex\or
+ \lettonothing\currentregisterpageprefix
\else
- \lettonothing\currentregisterseeindex
+ \def\currentregisterpageprefix{\clf_registerprefix{\currentregisterseeindex}}%
+ \fi
+ \iflocation
+ \ifempty\currentregisterpageprefix
+ \strc_references_get_simple_reference{internal(\currentregisterseeindex)}%
+ \else
+ \strc_references_get_simple_reference{\currentregisterpageindex::page(\currentregisterrealpage)}%
+ \fi
+ \global\lastsavedreferenceattribute\currentreferenceattribute
+ \c_attr_reference\currentreferenceattribute
+ \setlocationattributes
\fi
\ifnum#2=\plusone
- \labeltexts\v!see{\doapplyregisterseecommand{#4}{#7}}%
+ \labeltexts\v!see{\doapplyregisterseecommand{#4}{\currentregisterpageprefix#7}}%
\orelse\ifnum#2=#3\relax
- \labeltexts\v!and{\doapplyregisterseecommand{#4}{#7}}%
+ \labeltexts\v!and{\doapplyregisterseecommand{#4}{\currentregisterpageprefix#7}}%
\else
- ,\space\doapplyregisterseecommand{#4}{#7}%
+ ,\space\doapplyregisterseecommand{#4}{\currentregisterpageprefix#7}%
\fi
\dostoptagged
\popcurrentregister}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl
index 002945208f2..227d24704dc 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-sec.mkxl
@@ -125,6 +125,8 @@
% \section{bla 2} \subsection{bla 2 1} \subsection{bla 2 2}
% }
+\mutable\lettonothing\currentstructureextradata
+
\protected\def\strc_sectioning_register#1#2#3% #1=interfaced-settings, #2=optional user data (not yet supported)
{\begingroup
\setupstructure[\c!name={#1},#2]%
@@ -143,6 +145,7 @@
\xdef\currentstructuresaveinlist {\structureparameter\c!saveinlist}%
\xdef\currentstructureincrementnumber{\structureparameter\c!incrementnumber}%
\xdef\currentstructureplaceholder {\structureparameter\c!placeholder}%
+ \xdef\currentstructureextradata {\structureparameter\c!extradata}%
\ifx\currentstructureexpansion\s!xml
\xmlstartraw
\xdef\currentstructuretitle {\structureparameter\c!title}%
@@ -774,10 +777,6 @@
\newtoks\everyheadsynchronization
-% \appendtoks
-% \currentstructuresynchronize
-% \to \everyheadsynchronization
-
\aliased\let\currentstructuresynchronize\donothing
\appendtoks
@@ -785,9 +784,15 @@
\enforced\glet\currentstructuresynchronize\donothing
\to \everyheadsynchronization
+
\permanent\protected\def\theheadsynchronization % public
{% no, interferes: \signalcharacter
- \the\everyheadsynchronization}
+ \the\everyheadsynchronization
+ % new, this might move to a better place, e.g. first in the box
+ \currentstructureextradata
+ \lettonothing\currentstructureextradata
+ % done (can be used for e.g. index entries)
+ }
% BEWARE: \marking[section]{my text} does not work as we use list indices instead
% so we need a 'keep track of raw set option' (or maybe a funny internal prefix)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-syn.lmt b/Master/texmf-dist/tex/context/base/mkxl/strc-syn.lmt
new file mode 100644
index 00000000000..940b982a72e
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-syn.lmt
@@ -0,0 +1,420 @@
+if not modules then modules = { } end modules ['strc-syn'] = {
+ version = 1.001,
+ comment = "companion to str-syn.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local next, type = next, type
+local sortedkeys = table.sortedkeys
+
+local context = context
+local implement = interfaces.implement
+
+local allocate = utilities.storage.allocate
+
+local sorters = sorters
+
+local structures = structures
+local synonyms = structures.synonyms
+local tags = structures.tags
+
+local collected = allocate()
+local tobesaved = allocate()
+
+local firstofsplit = sorters.firstofsplit
+local strip = sorters.strip
+local splitter = sorters.splitters.utf
+
+synonyms.collected = collected
+synonyms.tobesaved = tobesaved
+
+local progressions = { } -- false=not_yet_shown true=shown
+
+local variables = interfaces.variables
+local v_all = variables.all
+local v_current = variables.current
+
+local function initializer()
+ collected = synonyms.collected
+ tobesaved = synonyms.tobesaved
+end
+
+local function finalizer()
+ for entry, data in next, tobesaved do
+ data.hash = nil
+ -- being sparse can be an option but often we actually do want the
+ -- whole list so we don't do this ... only as possible option
+ --
+-- maybe pages = sortedkeys(pages) is more efficient
+ --
+ -- local entries = data.entries
+ -- local t = { }
+ -- local n = 0
+ -- for i=1,#entries do
+ -- local e = entries[i]
+ -- if e.definition.shown then
+ -- n = n + 1
+ -- t[n] = e
+ -- end
+ -- end
+ -- data.entries = t
+ end
+end
+
+job.register('structures.synonyms.collected', tobesaved, initializer, finalizer)
+
+-- todo: allocate becomes metatable
+
+table.setmetatableindex(tobesaved,function(t,k)
+ local v = {
+ metadata = {
+ language = 'en',
+ sorted = false,
+ class = v
+ },
+ entries = {
+ },
+ hash = {
+ }
+ }
+ t[k] = v
+ return v
+end)
+
+function synonyms.define(class,kind)
+ local data = tobesaved[class]
+ data.metadata.kind = kind
+end
+
+function synonyms.register(class,kind,spec)
+ local data = tobesaved[class]
+ local hash = data.hash
+ local definition = spec.definition
+ local tag = definition.tag or ""
+ data.metadata.kind = kind -- runtime, not saved in format (yet)
+ if not hash[tag] then
+ local entries = data.entries
+ entries[#entries+1] = spec
+ hash[tag] = spec
+ end
+end
+
+function synonyms.registerused(class,tag)
+ local data = tobesaved[class]
+ local okay = data.hash[tag]
+ if okay then
+ local definition = okay.definition
+ definition.used = true
+ definition.list = true
+ end
+end
+
+function synonyms.registershown(class,tag)
+ local data = tobesaved[class]
+ local okay = data.hash[tag]
+ if okay then
+ local definition = okay.definition
+ definition.shown = true
+ definition.list = true
+ end
+end
+
+function synonyms.isused(class,tag)
+ local data = tobesaved[class]
+ local okay = data.hash[tag]
+ return okay and okay.definition.used or false
+end
+
+function synonyms.isshown(class,tag)
+ local data = tobesaved[class]
+ local okay = data.hash[tag]
+ return okay and okay.definition.shown or false
+end
+
+local function resetused(class)
+ for tag, data in next, tobesaved[class].hash do
+ data.definition.used = nil
+ end
+end
+
+local function resetshown(class)
+ for tag, data in next, tobesaved[class].hash do
+ data.definition.shown = nil
+ end
+end
+
+local function resetlist(class)
+ for tag, data in next, tobesaved[class].hash do
+ data.definition.list = nil
+ end
+end
+
+local function resetall(class)
+ for tag, data in next, tobesaved[class].hash do
+ local definition = data.definition
+ definition.used = nil
+ definition.shown = nil
+ definition.list = nil
+ end
+end
+
+synonyms.resetused = resetused
+synonyms.resetshown = resetshown
+synonyms.resetlist = resetlist
+synonyms.resetall = resetall
+
+function synonyms.reset(class,what)
+ if what == "progress" then
+ progressions = { }
+ elseif what == "used" then
+ resetused(class)
+ elseif what == "shown" then
+ resetshown(class)
+ elseif what == "list" then
+ resetlist(class)
+ else
+ resetall(class)
+ end
+end
+
+function synonyms.synonym(class,tag)
+ local data = tobesaved[class]
+ local okay = data.hash[tag]
+ if okay then
+ local definition = okay.definition
+ definition.used = true
+ definition.list = true
+ context(definition.synonym)
+ end
+ if progressions[tag] == nil then
+ progressions[tag] = false -- not yet shown
+ end
+end
+
+function synonyms.meaning(class,tag)
+ local data = tobesaved[class]
+ local okay = data.hash[tag]
+ if okay then
+ local definition = okay.definition
+ definition.shown = true
+ definition.list = true
+ context(definition.meaning)
+ end
+end
+
+function synonyms.pages(class,tag)
+ local data = tobesaved[class]
+ local okay = data.hash[tag]
+ if okay then
+ local definition = okay.definition
+ local pages = definition.pages
+ if pages and next(pages) then
+ context("%,t",sortedkeys(pages))
+ end
+ end
+end
+
+local ctx_latelua = context.latelua
+
+local function enhance(data)
+ local page = tex.getcount("realpageno")
+ data.pages[page] = true
+end
+
+function synonyms.enhance(class,tag)
+ local data = tobesaved[class]
+ local okay = data.hash[tag]
+ if okay then
+ local definition = okay.definition
+ local pages = definition.pages
+ if not pages then
+ pages = { }
+ definition.pages = pages
+ end
+ ctx_latelua { action = enhance, pages = pages }
+ end
+end
+
+synonyms.compare = sorters.comparers.basic -- (a,b)
+
+function synonyms.filter(data,options)
+ local result = { }
+ local entries = data.entries
+ local criterium = options and options.criterium
+ if criterium == v_all then
+ for i=1,#entries do
+ result[i] = entries[i]
+ end
+ else
+ for i=1,#entries do
+ local entry = entries[i]
+ local definition = entry.definition
+ if definition.list then
+ local tag = definition.tag
+ local done = progressions[tag]
+ if done == false then
+ result[#result+1] = entry
+ progressions[tag] = true
+ end
+ end
+ end
+ if criterium == v_current then
+ progressions = { }
+ end
+ end
+ data.result = result
+end
+
+function synonyms.prepare(data)
+ local result = data.result
+ if result then
+ for i=1, #result do
+ local entry = result[i]
+ local definition = entry.definition
+ if definition then
+ local srt = definition.sortkey or ""
+ local tag = definition.tag or ""
+ local key = (srt ~= "" and srt) or (tag ~= "" and tag) or definition.synonym
+ if key then
+ entry.split = splitter(strip(key))
+ end
+ end
+ end
+ end
+end
+
+function synonyms.sort(data,options)
+ sorters.sort(data.result,synonyms.compare)
+ data.metadata.sorted = true
+end
+
+function synonyms.finalize(data,options) -- mostly the same as registers so we will generalize it: sorters.split
+ local result = data.result
+ local split = { }
+ local nofsplit = 0
+ local lasttag = nil
+ local lasttag = nil
+ local nofdone = 0
+ for k=1,#result do
+ local entry = result[k]
+ local first, tag = firstofsplit(entry)
+ if tag ~= lasttag then
+ -- if trace_registers then
+ -- report_registers("splitting at %a",tag)
+ -- end
+ done = { }
+ nofdone = 0
+ nofsplit = nofsplit + 1
+ lasttag = tag
+ split[nofsplit] = { tag = tag, data = done }
+ end
+ nofdone = nofdone + 1
+ done[nofdone] = entry
+ end
+ data.result = split
+end
+
+-- for now, maybe at some point we will do a multipass or so
+-- maybe pass the settings differently
+
+local ctx_synonymentry = context.synonymentry
+
+function synonyms.flush(data,options)
+ local result = data.result
+ for i=1,#result do
+ local sublist = result[i]
+ local data = sublist.data
+ for d=1,#data do
+ local entry = data[d].definition
+ ctx_synonymentry(d,entry.tag,entry.synonym,entry.meaning or "")
+ end
+ end
+ data.result = nil
+ data.metadata.sorted = false
+end
+
+function synonyms.analyzed(class,options)
+ local data = collected[class]
+ if data and data.entries then
+ options = options or { }
+ sorters.setlanguage(options.language,options.method)
+ synonyms.filter(data,options) -- filters entries to result
+ synonyms.prepare(data,options) -- adds split table parallel to list table
+ synonyms.sort(data,options) -- sorts entries in result
+ synonyms.finalize(data,options) -- do things with data.entries
+ data.metadata.sorted = true
+ end
+ return data and data.metadata.sorted and data.result and next(data.result)
+end
+
+function synonyms.process(class,options)
+ if synonyms.analyzed(class,options) then
+ synonyms.flush(collected[class],options)
+ end
+end
+
+-- todo: local higher up
+
+implement { name = "registerusedsynonym", actions = synonyms.registerused, arguments = "2 strings" }
+implement { name = "registershownsynonym", actions = synonyms.registershown, arguments = "2 strings" }
+implement { name = "synonymmeaning", actions = synonyms.meaning, arguments = "2 arguments" }
+implement { name = "synonymname", actions = synonyms.synonym, arguments = "2 arguments" }
+implement { name = "synonympages", actions = synonyms.pages, arguments = "2 arguments" }
+implement { name = "enhancesynonym", actions = synonyms.enhance, arguments = "2 arguments" }
+-- { name = "resetusedsynonyms", actions = resetused, arguments = "string" }
+-- { name = "resetshownsynonyms", actions = resetshown, arguments = "string" }
+-- { name = "resetlistsynonyms", actions = resetlist, arguments = "string" }
+implement { name = "resetsynonyms", actions = synonyms.reset, arguments = "2 strings" }
+
+implement {
+ name = "doifelsesynonymused",
+ actions = { synonyms.isused, commands.doifelse },
+ arguments = "2 arguments",
+}
+
+implement {
+ name = "doifelsesynonymshown",
+ actions = { synonyms.isshown, commands.doifelse },
+ arguments = "2 arguments",
+}
+
+implement {
+ name = "registersynonym",
+ actions = synonyms.register,
+ arguments = {
+ "string",
+ "string",
+ {
+ { "metadata", {
+ { "catcodes", "integer" },
+ { "coding" },
+ { "xmlroot" }
+ }
+ },
+ {
+ "definition", {
+ { "tag" },
+ { "synonym" },
+ { "meaning" },
+ { "sortkey" },
+ { "used", "boolean" }
+ }
+ }
+ }
+ }
+}
+
+implement {
+ name = "processsynonyms",
+ actions = synonyms.process,
+ arguments = {
+ "string",
+ {
+ { "criterium" },
+ { "language" },
+ { "method" }
+ }
+ }
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl b/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl
index af6d0c6e204..9b4c37ceb53 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/strc-syn.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Structure Macros / Synonyms and Sorting}
-\registerctxluafile{strc-syn}{}
+\registerctxluafile{strc-syn}{autosuffix}
%D Although we could nowadays build this on top of regular lists we keep this
%D more efficient variant around. Eventually we can add some options to lists
@@ -354,24 +354,37 @@
}%
\relax
\ifx\currentsynonymoption\v!yes
- \instance\setuxvalue\currentsynonymtag{\strc_synonyms_insert{\currentsynonym}{\currentsynonymtag}}%
+ %\instance\setuxvalue\currentsynonymtag{\strc_synonyms_insert{\currentsynonym}{\currentsynonymtag}}%
+ \protected\instance\xdefcsname\currentsynonymtag\endcsname
+ {\strc_synonyms_insert{\currentsynonym}{\currentsynonymtag}}%
\fi
\fi
\endgroup}
\permanent\tolerant\protected\def\registersynonym [#1]#*[#2]{\clf_registerusedsynonym{#1}{#2}}
-\permanent \protected\def\currentsynonymname {\clf_synonymname{\currentsimplelist}{\currentsynonymtag}}
-\permanent \protected\def\currentsynonymmeaning {\clf_synonymmeaning{\currentsimplelist}{\currentsynonymtag}}
-\permanent \protected\def\doifelsecurrentsynonymused {\clf_doifelsesynonymused{\currentsimplelist}{\currentsynonymtag}}
-\permanent \protected\def\doifelsecurrentsynonymshown{\clf_doifelsesynonymshown{\currentsimplelist}{\currentsynonymtag}}
+\permanent \protected\def\currentsynonymname {\clf_synonymname\currentsimplelist\currentsynonymtag}
+\permanent \protected\def\currentsynonymmeaning {\clf_synonymmeaning\currentsimplelist\currentsynonymtag}
+\permanent \protected\def\currentsynonympages {\clf_synonympages\currentsimplelist\currentsynonymtag}
+\permanent \protected\def\doifelsecurrentsynonymused {\clf_doifelsesynonymused\currentsimplelist\currentsynonymtag}
+\permanent \protected\def\doifelsecurrentsynonymshown{\clf_doifelsesynonymshown\currentsimplelist\currentsynonymtag}
\permanent \protected\def\resetusedsynonyms [#1]{\clf_resetsynonyms{#1}{used}}
\permanent \protected\def\resetshownsynonyms [#1]{\clf_resetsynonyms{#1}{shown}}
\permanent \protected\def\resetlistsynonyms [#1]{\clf_resetsynonyms{#1}{list}}
\permanent \protected\def\resetsynonyms [#1]{\clf_resetsynonyms{#1}{all}}
\permanent \protected\def\resetsynonymsprogress [#1]{\clf_resetsynonyms{#1}{progress}}
+\permanent\protected\def\registercurrentsynonympage % \registercurrentsortingpage
+ {\ifcstok{\simplelistparameter\v!page}\v!yes
+ \clf_enhancesynonym\currentsimplelist\currentsortingtag
+ \fi}
+
\aliased\let\rawsynonymname \clf_synonymname
\aliased\let\rawsynonymmeaning\clf_synonymmeaning
+\aliased\let\rawsynonympages \clf_synonympages
+
+\permanent\protected\def\synonymname [#1]#*[#2]{\clf_synonymname {#1}{#2}}
+\permanent\protected\def\synonymmeaning[#1]#*[#2]{\clf_synonymmeaning{#1}{#2}}
+\permanent\protected\def\synonympages [#1]#*[#2]{\clf_synonympages {#1}{#2}}
\installcorenamespace{simplelistalternative} % specific ways of rendering a list
\installcorenamespace{simplelistrenderings} % a namespace for setups (rather local)
@@ -424,6 +437,7 @@
\dostarttaggedchained\t!synonym\currentsynonym\??simplelist
\dotagsynonym
\usesimpleliststyleandcolor\c!synonymstyle\c!synonymcolor
+ \registercurrentsynonympage
\simplelistparameter\c!synonymcommand{\currentsynonymname}%
\dostoptagged
\endgroup
@@ -523,9 +537,7 @@
\aliased\let\setupsorting\setupsimplelist
-% if #3=\relax or \v!none, then no command but still protected
-
-% these might become private
+% some of these might become private
\mutable\lettonothing\currentsortingoption
\mutable\lettonothing\currentsortingcoding
@@ -536,10 +548,14 @@
\permanent\tolerant\protected\def\definesorting[#1]#*[#2]#*[#3]%
{\ifnum\lastarguments=\plusthree
- \doifnot{#3}\v!none
- {\ifx#3\relax \else
- \protected\instance\def#3##1{\strc_sorting_insert{#1}{##1}}%
- \fi}%
+ %\ifparameter#3\or
+ \ifcstok{#3}\v!none
+ % skip
+ \orelse\ifrelax#3\relax
+ % skip
+ \else
+ \protected\instance\def#3##1{\strc_sorting_insert{#1}{##1}}%
+ \fi
\frozen\instance\protected\defcsname#1\endcsname{\definesort[\v!no][#1]}%
\else
\frozen\instance\protected\defcsname#1\endcsname{\definesort[\v!yes][#1]}%
@@ -600,14 +616,25 @@
}%
\relax
\ifx\currentsortingoption\v!yes
- \instance\setuxvalue\currentsortingtag{\strc_sorting_insert{\currentsorting}{\currentsortingtag}}%
+ %\instance\setuxvalue\currentsortingtag{\strc_sorting_insert{\currentsorting}{\currentsortingtag}}%
+ \protected\instance\xdefcsname\currentsortingtag\endcsname
+ {\strc_sorting_insert{\currentsorting}{\currentsortingtag}}%
\fi
\fi
\endgroup}
-\permanent\protected\def\currentsortingname {\clf_synonymname {\currentsimplelist}{\currentsortingtag}}
-\permanent\protected\def\doifelsecurrentsortingused {\clf_doifelsesynonymused {\currentsimplelist}{\currentsortingtag}}
-\permanent\protected\def\resetusedsortings [#1]{\clf_resetusedsynonyms {#1}}
+\permanent\protected\def\currentsortingname {\clf_synonymname\currentsimplelist\currentsortingtag}
+\permanent\protected\def\currentsortingpages {\clf_synonympages\currentsimplelist\currentsortingtag}
+\permanent\protected\def\doifelsecurrentsortingused {\clf_doifelsesynonymused\currentsimplelist\currentsortingtag}
+\permanent\protected\def\resetusedsortings [#1]{\clf_resetusedsynonyms{#1}}
+
+\permanent\protected\def\sortingname [#1]#*[#2]{\clf_synonymname {#1}{#2}}
+\permanent\protected\def\sortingpages[#1]#*[#2]{\clf_synonympages{#1}{#2}}
+
+\aliased\let\rawsortingname \clf_synonymname
+\aliased\let\rawsortingpages\clf_synonymmeaning
+
+\aliased\let\registercurrentsortingpage\registercurrentsynonympage
\setupsimplelist
[\v!sorting]
@@ -641,6 +668,7 @@
\dostarttaggedchained\t!sorting\currentsorting\??simplelist
\dotagsorting
\usesimpleliststyleandcolor\c!style\c!color
+ \registercurrentsortingpage
\currentsortingname
\dostoptagged
\endgroup
@@ -649,6 +677,9 @@
\permanent\tolerant\protected\def\registersort[#1]#*[#2]%
{\clf_registerusedsynonym{#1}{#2}}
+\permanent\tolerant\protected\def\registersortpage[#1]#*[#2]%
+ {\clf_enhancesynonym{#1}{#2}}
+
% before after
%
% maybe just 'commandset' and then combine
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.lmt b/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.lmt
new file mode 100644
index 00000000000..a307d046a8a
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.lmt
@@ -0,0 +1,143 @@
+if not modules then modules = { } end modules ['tabl-ntb'] = {
+ version = 1.001,
+ comment = "companion to tabl-ntb.mkxl",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local context = context
+
+local a_tablesection = attributes.system("tablesection")
+
+local hlist_code = nodes.nodecodes.hlist
+
+local nuts = nodes.nuts
+local tonode = nuts.tonode
+local getbox = nuts.getbox
+local getlist = nuts.getlist
+local getid = nuts.getid
+local getnext = nuts.getnext
+local setnext = nuts.setnext
+local getattr = nuts.getattr
+local copylist = nuts.copylist
+local flushlist = nuts.flushlist
+
+local integer_value = tokens.values.integer
+
+local implement = interfaces.implement
+
+local list = { }
+local sections = { }
+
+local function check(b)
+ local c = getbox(b)
+ local l = c and getlist(c)
+ local d = false
+ local n = 0
+ while l do
+ if getid(l) == hlist_code then
+ local line = getattr(l,a_tablesection)
+ if line and line ~= d then
+ local s = sections[line]
+ if s then
+ local count = s[2]
+ local last = l
+ local next = getnext(l)
+ while next and count > 0 do
+ last = next
+ next = getnext(next)
+ count = count - 1
+ end
+ setnext(last)
+ list[line] = { l, copylist(l) }
+ if next then
+ setnext(last,next)
+ end
+ d = line
+ end
+ end
+ n = n + 1
+ end
+ l = getnext(l)
+ end
+end
+
+local function reset(b)
+ for k, v in next, list do
+ flushlist(v[2])
+ end
+ list = { }
+ sections = { }
+end
+
+local function locate(b)
+ local c = getbox(b)
+ local l = c and getlist(c)
+ while l do
+ if getid(l) == hlist_code then
+ local line = getattr(l,a_tablesection)
+ if line then
+ local v = list[line]
+ if v and v[1] ~= l then
+ return line
+ end
+ end
+ return 0
+ end
+ l = getnext(l)
+ end
+ return 0
+end
+
+local function fetch(n)
+ local b = list[n]
+ if b then
+ b = copylist(b[2])
+ return tonode(b)
+ end
+end
+
+implement {
+ name = "tabl_ntb_set_sec",
+ public = true,
+ arguments = { "integer", "integer", "integer" },
+ actions = function(n,m,count)
+ sections[n] = { m, count }
+ end,
+}
+
+implement {
+ name = "tabl_ntb_get_sec",
+ public = true,
+ arguments = "integer",
+ usage = "value",
+ actions = function(n)
+ local s = sections[n]
+ return integer_value, s and s[1] or 0
+ end,
+}
+
+implement {
+ name = "ntb_split_section_check",
+ arguments = "integer",
+ actions = check,
+}
+
+implement {
+ name = "ntb_split_section_reset",
+ arguments = "integer",
+ actions = reset,
+}
+
+implement {
+ name = "ntb_split_section_locate",
+ arguments = "integer",
+ actions = { locate, context },
+}
+
+implement {
+ name = "ntb_split_section_fetch",
+ arguments = "integer",
+ actions = { fetch, context },
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl
index 6eb926b09e4..414a04f3a1b 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-ntb.mkxl
@@ -24,6 +24,8 @@
\writestatus{loading}{ConTeXt Table Macros / Natural Tables}
+\registerctxluafile{tabl-ntb}{autosuffix}
+
% sometimes this helps (with nc going wild): \setupTABLE[maxwidth=100cm]
%
% bug: width 3cm is not honored and column becomes too wide as given width is added
@@ -2295,6 +2297,99 @@
\permanent\protected\def\bTRs[#1]#2\eTRs
{\normalexpanded{\bTR[\begincsname\??naturaltablesetup#1\endcsname]}#2\eTR}
+%D This is new (for Ramkumar, Kb)
+%D
+%D \starttyping
+%D \bTABLE[split=repeat]
+%D \bTABLEhead
+%D \bTR \bTH \darkblue header \eTH \bTH \darkblue done \eTH \eTR
+%D \eTABLEhead
+%D \dorecurse{12}{
+%D \bTABLEbody
+%D \bTABLEsection
+%D \bTR \bTD \darkred line #1.1 \eTD \bTD \darkred done \eTD \eTR
+%D \bTR \bTD \darkred line #1.2 \eTD \bTD \darkred done \eTD \eTR
+%D \eTABLEsection
+%D \bTABLEsection[repeat=2]
+%D \bTR[samepage=after] \bTH \darkorange header #1.1 \eTH \bTH \darkorange done \eTH \eTR
+%D \bTR[samepage=after] \bTH \darkorange header #1.2 \eTH \bTH \darkorange done \eTH \eTR
+%D \bTR \bTD \darkgreen hline #1.3 \eTD \bTD \darkgreen done \eTD \eTR
+%D \bTR \bTD \darkgreen hline #1.4 \eTD \bTD \darkgreen done \eTD \eTR
+%D \bTR \bTD \darkgreen hline #1.5 \eTD \bTD \darkgreen done \eTD \eTR
+%D \eTABLEsection
+%D \eTABLEbody
+%D }
+%D \eTABLE
+%D \stoptyping
+
+\definesystemattribute[tablesection][public]
+
+\newinteger\c_tabl_ntb_section
+\newinteger\c_tabl_ntb_section_repeat
+
+\def\tabl_ntb_section_mark_indeed
+ {\ifcase\c_tabl_ntb_section_repeat
+ \tabl_ntb_set_sec\c_tabl_ntb_maximum_row\zerocount\zerocount
+ \else
+ \tabl_ntb_set_sec\c_tabl_ntb_maximum_row\c_tabl_ntb_section\c_tabl_ntb_section_repeat
+ \fi}
+
+\def\tabl_ntb_section_checkup_indeed
+ {\scratchcounter\tabl_ntb_get_sec\c_tabl_ntb_row\relax
+ \ifcase\scratchcounter
+ \c_attr_tablesection\attributeunsetvalue
+ \else
+ \c_attr_tablesection\scratchcounter
+ \fi}
+
+\def\tabl_ntb_section_split_indeed
+ {\scratchcounter\clf_ntb_split_section_locate\b_split_content\relax
+ \ifcase\scratchcounter\else
+ \clf_ntb_split_section_fetch\scratchcounter
+ \fi}
+
+\def\tabl_ntb_section_wrapup_indeed
+ {\clf_ntb_split_section_reset\b_split_content
+ \tabl_ntb_section_setup}
+
+\def\tabl_ntb_section_install_indeed
+ {\clf_ntb_split_section_check\b_split_content
+ \t_split_section{\tabl_ntb_section_split}}
+
+\def\tabl_ntb_section_disable
+ {\glet\tabl_ntb_section_mark \relax
+ \glet\tabl_ntb_section_checkup\relax
+ \glet\tabl_ntb_section_split \relax
+ \glet\tabl_ntb_section_install\relax
+ \glet\tabl_ntb_section_wrapup \relax}
+
+\def\tabl_ntb_section_enable
+ {\let\tabl_ntb_section_enable \relax
+ \glet\tabl_ntb_section_mark \tabl_ntb_section_mark_indeed
+ \glet\tabl_ntb_section_checkup\tabl_ntb_section_checkup_indeed
+ \glet\tabl_ntb_section_split \tabl_ntb_section_split_indeed
+ \glet\tabl_ntb_section_install\tabl_ntb_section_install_indeed
+ \glet\tabl_ntb_section_wrapup \tabl_ntb_section_wrapup_indeed}
+
+\def\tabl_ntb_section_setup
+ {\global\c_tabl_ntb_section_repeat\zerocount
+ \c_tabl_ntb_section\zerocount
+ \tabl_ntb_section_disable}
+
+\tolerant\permanent\protected\def\bTABLEsection[#1]%
+ {\ifempty{#1}%
+ \global\c_tabl_ntb_section_repeat\zerocount
+ \else
+ \letdummyparameter\c!repeat\zerocount
+ \getdummyparameters[#1]%
+ \global\c_tabl_ntb_section_repeat\dummyparameter\c!repeat\relax
+ \fi
+ \global\advanceby\c_tabl_ntb_section\plusone
+ \tabl_ntb_section_enable}
+
+\permanent\protected\def\eTABLEsection
+ {\global\c_tabl_ntb_section_repeat\zerocount}
+
\protect \endinput
% todo: mode: first|next (of niets)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl b/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl
index b3b4b4c886c..6c4c3fd47a1 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-tbl.mkxl
@@ -1997,23 +1997,23 @@
\edef\currenttabulatemove{#1}%
\setupcurrenttabulatemove[#2]%
\fi
- \edef\m_orientation{\theorientation{\tabulatemoveparameter\c!orientation}}%
- \edef\m_xoffset {\tabulatemoveparameter\c!xoffset}%
- \edef\m_yoffset {\tabulatemoveparameter\c!yoffset}%
+ \edef\p_orientation{\theorientation{\tabulatemoveparameter\c!orientation}}%
+ \edef\p_xoffset {\tabulatemoveparameter\c!xoffset}%
+ \edef\p_yoffset {\tabulatemoveparameter\c!yoffset}%
\scratchyoffset
- \ifx\m_yoffset\v!depth
+ \ifx\p_yoffset\v!depth
-\strutdp
- \orelse\ifx\m_yoffset\v!height
+ \orelse\ifx\p_yoffset\v!height
-\strutht
\else
- \m_yoffset
+ \p_yoffset
\fi
\relax
- \scratchxoffset\m_xoffset\relax
+ \scratchxoffset\p_xoffset\relax
\xdef\tabl_tabulate_tm
{\ifzeropt\scratchxoffset\else\s!xmove \the\scratchxoffset\fi % or move
\ifzeropt\scratchyoffset\else\s!ymove \the\scratchyoffset\fi % or move
- \ifzero \m_orientation \else\s!orientation\m_orientation \fi
+ \ifzero \p_orientation \else\s!orientation\p_orientation \fi
}%
\endlocalcontrol
\noalign\tabl_tabulate_tm{}}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt b/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt
index b69bfd87346..c475d62330a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/tabl-xtb.lmt
@@ -79,6 +79,7 @@ local copynodelist = nuts.copylist
local hpacknodelist = nuts.hpack
local flushnodelist = nuts.flushlist
local takebox = nuts.takebox
+local migratebox = nuts.migratebox
local nodepool = nuts.pool
@@ -562,7 +563,7 @@ end
local function showwidths(where,widths,autowidths)
local result = { }
for i=1,#widths do
- result[#result+1] = format("%12s%s",points(widths[i]),autowidths[i] and "*" or " ")
+ result[i] = format("%12s%s",points(widths[i]),autowidths[i] and "*" or " ")
end
return report_xtable("%s widths: %s",where,concat(result," "))
end
@@ -872,6 +873,7 @@ function xtables.construct()
-- setwhd(list,0,0,0)
-- faster:
local h = new_hlist(list)
+ migratebox(list,h)
list = h
--
if start then
diff --git a/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt b/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt
index 6d4ebfcc2d4..57376ae2be8 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/task-ini.lmt
@@ -63,6 +63,7 @@ appendaction("processors", "lists", "typesetters.rubies.check",
appendaction("processors", "lists", "typesetters.characteralign.handler", nil, "nut", "disabled" )
appendaction("processors", "lists", "typesetters.spacings.handler", nil, "nut", "disabled" )
appendaction("processors", "lists", "typesetters.kerns.handler", nil, "nut", "disabled" )
+appendaction("processors", "lists", "typesetters.tighten.handler", nil, "nut", "disabled" )
appendaction("processors", "lists", "typesetters.digits.handler", nil, "nut", "disabled" )
appendaction("processors", "lists", "typesetters.italics.handler", nil, "nut", "disabled" )
appendaction("processors", "lists", "languages.visualizediscretionaries", nil, "nut", "disabled" )
@@ -226,3 +227,8 @@ directives.register("nodes.basepass", function(v)
disableaction("processors", "builders.kernel.kerning")
end
end)
+
+-- These are different and currently done in strc-flt.lmt but it might move here:
+--
+-- utilities.sequencers.appendaction ("paragraph","system","builders.checksidefloat")
+-- utilities.sequencers.disableaction("paragraph","builders.checksidefloat")
diff --git a/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt b/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt
index 5af351939f1..ab531a46288 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/toks-scn.lmt
@@ -358,6 +358,16 @@ local presets = {
["2 arguments"] = { "argument", "argument" },
["3 arguments"] = { "argument", "argument", "argument" },
["4 arguments"] = { "argument", "argument", "argument", "argument" },
+
+ ["1 integer"] = { "integer" },
+ ["2 integers"] = { "integer", "integer" },
+ ["3 integers"] = { "integer", "integer", "integer" },
+ ["4 integers"] = { "integer", "integer", "integer", "integer" },
+
+ ["1 optional"] = { "optional" },
+ ["2 optionals"] = { "optional", "optional" },
+ ["3 optionals"] = { "optional", "optional", "optional" },
+ ["4 optionals"] = { "optional", "optional", "optional", "optional" },
}
tokens.presets = presets
diff --git a/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl b/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl
index 5b83f287e48..62dd3c9ab4b 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/type-set.mkxl
@@ -105,26 +105,28 @@
\definefilesynonym [type-imp-eulernovum.mkiv] [type-imp-euler.mkiv]
\definefilesynonym [type-imp-eulernova.mkiv] [type-imp-euler.mkiv]
-\definefilesynonym [type-imp-euler-with-pagella.mkiv] [type-imp-euler.mkiv]
-\definefilesynonym [type-imp-pagella-with-euler.mkiv] [type-imp-euler.mkiv]
-
-\definefilesynonym [type-imp-mdbch.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mdugm.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mdput.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mdici.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mdpgd.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mdpus.mkiv] [type-imp-mathdesign.mkiv]
-
-\definefilesynonym [type-imp-mathdesignch.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mathdesigngm.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mathdesignut.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mathdesignci.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mathdesigngd.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mathdesignus.mkiv] [type-imp-mathdesign.mkiv]
-
-\definefilesynonym [type-imp-mathdesigncharter.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mathdesigngaramond.mkiv] [type-imp-mathdesign.mkiv]
-\definefilesynonym [type-imp-mathdesignutopia.mkiv] [type-imp-mathdesign.mkiv]
+\definefilesynonym [type-imp-euler-with-pagella.mkiv] [type-imp-euler.mkxl]
+\definefilesynonym [type-imp-pagella-with-euler.mkiv] [type-imp-euler.mkxl]
+\definefilesynonym [type-imp-euleroverpagella.mkiv] [type-imp-euler.mkxl]
+\definefilesynonym [type-imp-pagellaovereuler.mkiv] [type-imp-euler.mkxl]
+
+%definefilesynonym [type-imp-mdbch.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mdugm.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mdput.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mdici.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mdpgd.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mdpus.mkiv] [type-imp-mathdesign.mkiv]
+
+%definefilesynonym [type-imp-mathdesignch.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mathdesigngm.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mathdesignut.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mathdesignci.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mathdesigngd.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mathdesignus.mkiv] [type-imp-mathdesign.mkiv]
+
+%definefilesynonym [type-imp-mathdesigncharter.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mathdesigngaramond.mkiv] [type-imp-mathdesign.mkiv]
+%definefilesynonym [type-imp-mathdesignutopia.mkiv] [type-imp-mathdesign.mkiv]
\definefilesynonym [type-imp-cows.mkiv] [type-imp-koeielettersot.mkiv]
\definefilesynonym [type-imp-sheep.mkiv] [type-imp-koeielettersot.mkiv]
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-fkr.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-fkr.lmt
new file mode 100644
index 00000000000..3491c9effaf
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-fkr.lmt
@@ -0,0 +1,122 @@
+if not modules then modules = { } end modules ['typo-fkr'] = {
+ version = 1.001,
+ comment = "companion to typo-fkr.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local nuts = nodes.nuts
+local getid = nuts.getid
+local getnext = nuts.getnext
+local getattr = nuts.getattr
+local isglyph = nuts.isglyph
+
+local nodecodes = nodes.nodecodes
+local glyph_code = nodecodes.glyph
+
+local fontdata = fonts.hashes.identifiers
+local getkernpair = fonts.handlers.otf.getkern
+
+local insertbefore = nuts.insertbefore
+local new_kern = nuts.pool.fontkern
+
+local enableaction = nodes.tasks.enableaction
+
+local a_extrakern = attributes.private("extrafontkern")
+
+-- 0=none 1=min 2=max 3=mixed
+
+typesetters.fontkerns = { }
+
+function typesetters.fontkerns.handler(head)
+ local current = head
+ local lastfont = nil
+ local lastchar = nil
+ local lastdata = nil
+ while current do
+ local char, font = isglyph(current)
+ if char then
+ local a = getattr(current,a_extrakern)
+ if a then
+ if font ~= lastfont then
+ if a > 0 and lastchar then
+ if not lastdata then
+ lastdata = fontdata[lastfont]
+ end
+ local kern = nil
+ local data = fontdata[font]
+ local kern1 = getkernpair(lastdata,lastchar,char)
+ local kern2 = getkernpair(data,lastchar,char)
+ if a == 1 then
+ kern = kern1 > kern2 and kern2 or kern1 -- min
+ elseif a == 2 then
+ kern = kern1 > kern2 and kern1 or kern2 -- max
+ else -- 3
+ kern = (kern1 + kern2)/2 -- mixed
+ end
+ if kern ~= 0 then
+ head = insertbefore(head,current,new_kern(kern))
+ end
+ lastdata = data
+ else
+ lastdata = nil
+ end
+ elseif lastchar then
+ if not lastdata then
+ lastdata = fontdata[lastfont]
+ end
+ local kern = getkernpair(lastdata,lastchar,char)
+ if kern ~= 0 then
+ head = insertbefore(head,current,new_kern(kern))
+ end
+ end
+ lastchar = char
+ lastfont = font
+ elseif lastfont then
+ lastfont = nil
+ lastchar = nil
+ lastdata = nil
+ end
+ elseif lastfont then
+ lastfont = nil
+ lastchar = nil
+ lastdata = nil
+ end
+ current = getnext(current)
+ end
+ return head
+end
+
+do
+
+ local variables = interfaces.variables
+ local unsetvalue = attributes.unsetvalue
+ local enabled = false
+ local setattribute = tex.setattribute
+
+ local values = {
+ [variables.none ] = 0,
+ [variables.min ] = 1,
+ [variables.max ] = 2,
+ [variables.mixed] = 3,
+ [variables.reset] = unsetvalue,
+ }
+
+ local function setextrafontkerns(str)
+ if not enabled then
+ enableaction("processors","typesetters.fontkerns.handler")
+ enabled = true
+ end
+ setattribute(a_extrakern,str and values[str] or unsetvalue)
+ end
+
+ interfaces.implement {
+ name = "setextrafontkerns",
+ public = true,
+ protected = true,
+ arguments = "optional",
+ actions = setextrafontkerns,
+ }
+
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-fkr.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-fkr.mkxl
index f56294dc057..726e02646db 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-fkr.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-fkr.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Typesetting Macros / Additional Font Kerning}
-\registerctxluafile{typo-fkr}{}
+\registerctxluafile{typo-fkr}{autosuffix}
\definesystemattribute[extrafontkern][public]
@@ -25,8 +25,8 @@
% mixed : mean value across fonts
% reset : disable
-\permanent\protected\def\setextrafontkerns[#1]% % can be public implementor
- {\clf_setextrafontkerns{#1}}
+% \permanent\protected\def\setextrafontkerns[#1]% defined at the lua end
+% {\clf_setextrafontkerns{#1}}
\permanent\protected\def\resetextrafontkerns
{\c_attr_extrafontkern\attributeunsetvalue}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-inj.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-inj.lmt
new file mode 100644
index 00000000000..238524a94a3
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-inj.lmt
@@ -0,0 +1,119 @@
+if not modules then modules = { } end modules ['typo-inj'] = { -- was node-par
+ version = 1.001,
+ comment = "companion to typo-inj.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local tonumber = tonumber
+
+local context = context
+local implement = interfaces.implement
+
+local injectors = { }
+typesetters.injectors = injectors
+local list = { }
+injectors.list = list
+local showall = false
+
+local settings_to_array = utilities.parsers.settings_to_array
+
+local variables = interfaces.variables
+local v_next = variables.next
+local v_previous = variables.previous
+
+local ctx_domarkinjector = context.domarkinjector
+local ctx_doactivateinjector = context.doactivateinjector
+
+table.setmetatableindex(list,function(t,k)
+ local v = {
+ counter = 0,
+ actions = { },
+ show = false,
+ active = false,
+ }
+ t[k] = v
+ return v
+end)
+
+function injectors.reset(name)
+ list[name] = nil
+end
+
+local function activate(injector,name)
+ if not injector.active then
+ ctx_doactivateinjector(name)
+ injector.active = true
+ if showall then
+ -- in case we already enabled tracing
+ injector.show = true
+ end
+ end
+end
+
+function injectors.set(name,numbers,command)
+ local injector = list[name]
+ local actions = injector.actions
+ local places = settings_to_array(numbers)
+ for i=1,#places do
+ actions[tonumber(places[i])] = command
+ end
+ -- not: injector.show = true
+ activate(injector,name)
+end
+
+function injectors.show(name)
+ if not name or name == "" then
+ showall = true
+ local names = settings_to_array(name)
+ for name, injector in next, list do
+ injector.show = true
+ activate(injector,name)
+ end
+ else
+ local names = settings_to_array(name)
+ for i=1,#names do
+ local name = names[i]
+ local injector = list[name]
+ if injector then
+ injector.show = true
+ activate(injector,name)
+ end
+ end
+ end
+end
+
+function injectors.mark(name,show)
+ local injector = list[name]
+ local n = injector.counter + 1
+ injector.counter = n
+ if showall or injector.show then
+ ctx_domarkinjector(injector.actions[n] and 1 or 0,n)
+ end
+end
+
+function injectors.check(name,n) -- we could also accent n = number : +/- 2
+ local injector = list[name]
+ if not n or n == "" or n == v_next then
+ n = injector.counter + 1
+ elseif n == v_previous then
+ n = injector.counter
+ else
+ n = tonumber(n) or 0
+ end
+ local action = injector.actions[n]
+ if action then
+ context(action)
+ end
+end
+
+-- maybe string -> argument
+
+implement { name = "resetinjector", actions = injectors.reset, arguments = "string" }
+implement { name = "showinjector", actions = injectors.show, arguments = "string" }
+implement { name = "setinjector", actions = injectors.set, arguments = "3 strings" }
+implement { name = "markinjector", actions = injectors.mark, arguments = "string" }
+implement { name = "checkinjector", actions = injectors.check, arguments = "2 strings" }
+--------- { name = "checkpreviousinjector", actions = injectors.check, arguments = { "string", v_previous } }
+--------- { name = "checknextinjector", actions = injectors.check, arguments = { "string", v_next } }
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-inj.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-inj.mkxl
index bf329482ed2..04c4f677cc4 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-inj.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-inj.mkxl
@@ -24,7 +24,7 @@
\unprotect
-\registerctxluafile{typo-inj}{}
+\registerctxluafile{typo-inj}{autosuffix}
% todo: no need in trialmode
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-man.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-man.lmt
new file mode 100644
index 00000000000..051e888f1df
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-man.lmt
@@ -0,0 +1,119 @@
+if not modules then modules = { } end modules ['typo-man'] = {
+ version = 1.001,
+ comment = "companion to typo-prc.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+if not characters then
+ -- for testing stand-alone
+ require("char-def")
+ require("char-ini")
+end
+
+local lpegmatch = lpeg.match
+local P, R, C, Ct, Cs, Carg = lpeg.P, lpeg.R, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.Carg
+local global = global or _G
+
+local methods = {
+ uppercase = characters.upper,
+ lowercase = characters.lower,
+ Word = converters.Word,
+ Words = converters.Words,
+}
+
+local function nothing(s) return s end -- we already have that one somewhere
+
+-- table.setmetatableindex(methods,function(t,k)
+-- t[k] = nothing
+-- return nothing
+-- end)
+
+local splitter = lpeg.tsplitat(".")
+
+table.setmetatableindex(methods,function(t,k)
+ local s = lpegmatch(splitter,k)
+ local v = global
+ for i=1,#s do
+ v = v[s[i]]
+ if not v then
+ break
+ end
+ end
+ if not v or v == global then
+ v = nothing
+ end
+ t[k] = v
+ return v
+end)
+
+local whitespace = lpeg.patterns.whitespace^0
+local separator = whitespace * P("->") * whitespace
+local pair = C((1-separator)^1) * separator * C(P(1)^0)
+local list = Ct((C((1-separator)^1) * separator)^1) * C(P(1)^0)
+
+local pattern = Carg(1) * pair / function(methods,operation,str)
+ return methods[operation](str) or str
+end
+
+local function apply(str,m)
+ return lpegmatch(pattern,str,1,m or methods) or str
+end
+
+local function splitspecification(field,m)
+ local m, f = lpegmatch(list,field,1,m or methods)
+ if m then
+ return m, f or field
+ else
+ return nil, field
+ end
+end
+
+local function applyspecification(actions,str)
+ if actions then
+ for i=1,#actions do
+ local action = methods[actions[i]]
+ if action then
+ str = action(str) or str
+ end
+ end
+ end
+ return str
+end
+
+if not typesetters then typesetters = { } end
+
+typesetters.manipulators = {
+ methods = methods,
+ apply = apply,
+ patterns = {
+ pair = pair,
+ list = list,
+ },
+ splitspecification = splitspecification,
+ applyspecification = applyspecification,
+}
+
+local pattern = Cs((1 - P(1) * P(-1))^0 * (P(".")/"" + P(1)))
+
+methods.stripperiod = function(str) return lpegmatch(pattern,str) end
+
+-- print(apply("hans"))
+-- print(apply("uppercase->hans"))
+-- print(apply("string.reverse -> hans"))
+-- print(apply("uppercase->hans",{ uppercase = string.reverse } ))
+
+-- print(applyspecification(splitspecification("hans")))
+-- print(applyspecification(splitspecification("lowercase->uppercase->hans")))
+-- print(applyspecification(splitspecification("uppercase->stripperiod->hans.")))
+
+if commands then
+
+ local context = context
+
+ function commands.manipulated(str)
+ context(apply(str))
+ end
+
+end
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-prc.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-prc.lmt
new file mode 100644
index 00000000000..72b159e9cac
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-prc.lmt
@@ -0,0 +1,129 @@
+if not modules then modules = { } end modules ['typo-prc'] = {
+ version = 1.001,
+ comment = "companion to typo-prc.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local lpegmatch, patterns, P, C, Cs = lpeg.match, lpeg.patterns, lpeg.P, lpeg.C, lpeg.Cs
+
+-- processors: syntax: processor->data ... not ok yet
+
+local context = context
+local implement = interfaces.implement
+
+local formatters = string.formatters
+
+typesetters.processors = typesetters.processors or { }
+local processors = typesetters.processors
+
+local trace_processors = false
+local report_processors = logs.reporter("processors")
+local registered = { }
+
+local ctx_applyprocessor = context.applyprocessor
+local ctx_firstofoneargument = context.firstofoneargument
+
+trackers.register("typesetters.processors", function(v) trace_processors = v end)
+
+function processors.register(p)
+ registered[p] = true
+end
+
+function processors.reset(p)
+ registered[p] = nil
+end
+
+--~ local splitter = lpeg.splitat("->",true) -- also support =>
+
+local becomes = P('->')
+local processor = (1-becomes)^1
+local splitter = C(processor) * becomes * Cs(patterns.argument + patterns.content)
+
+function processors.split(str,nocheck)
+ local p, s = lpegmatch(splitter,str)
+ if p and (nocheck or registered[p]) then
+ return p, s
+ else
+ return false, str
+ end
+end
+
+function processors.apply(p,s)
+ local str = p
+ if s == nil then
+ p, s = lpegmatch(splitter,p)
+ end
+ if p and registered[p] then
+ if trace_processors then
+ report_processors("applying %s processor %a, argument: %s","known",p,s)
+ end
+ ctx_applyprocessor(p,s)
+ elseif s then
+ if trace_processors then
+ report_processors("applying %s processor %a, argument: %s","unknown",p,s)
+ end
+ context(s)
+ elseif str then
+ if trace_processors then
+ report_processors("applying %s processor, data: %s","ignored",str)
+ end
+ context(str)
+ end
+end
+
+function processors.startapply(p,s)
+ local str = p
+ if s == nil then
+ p, s = lpegmatch(splitter,p)
+ end
+ if p and registered[p] then
+ if trace_processors then
+ report_processors("start applying %s processor %a","known",p)
+ end
+ ctx_applyprocessor(p)
+ context("{")
+ return s
+ elseif p then
+ if trace_processors then
+ report_processors("start applying %s processor %a","unknown",p)
+ end
+ ctx_firstofoneargument()
+ context("{")
+ return s
+ else
+ if trace_processors then
+ report_processors("start applying %s processor","ignored")
+ end
+ ctx_firstofoneargument()
+ context("{")
+ return str
+ end
+end
+
+function processors.stopapply()
+ context("}")
+ if trace_processors then
+ report_processors("stop applying processor")
+ end
+end
+
+function processors.tostring(str)
+ local p, s = lpegmatch(splitter,str)
+ if registered[p] then
+ return formatters["\\applyprocessor{%s}{%s}"](p,s)
+ else
+ return str
+ end
+end
+
+function processors.stripped(str)
+ local p, s = lpegmatch(splitter,str)
+ return s or str
+end
+
+-- interface
+
+implement { name = "registerstructureprocessor", actions = processors.register, arguments = "string" }
+implement { name = "resetstructureprocessor", actions = processors.reset, arguments = "string" }
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx b/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx
index 9531949b8f4..f2df329860f 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-prc.mklx
@@ -16,8 +16,8 @@
%D For the moment manipulators are loaded here too, as they're in the same category
%D as processors. This might change. (They are used in publications.)
-\registerctxluafile{typo-prc}{}
-\registerctxluafile{typo-man}{}
+\registerctxluafile{typo-prc}{autosuffix}
+\registerctxluafile{typo-man}{autosuffix}
\unprotect
@@ -72,8 +72,7 @@
\fi}
\def\typo_processor_apply
- {\edef\p_state{\processorparameter\c!state}%
- \ifx\p_state\v!stop
+ {\ifcstok{\processorparameter\c!state}\v!stop
\expandafter\firstofoneargument
\else
\expandafter\typo_processor_apply_indeed
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-rep.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-rep.lmt
new file mode 100644
index 00000000000..683b483efda
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-rep.lmt
@@ -0,0 +1,135 @@
+if not modules then modules = { } end modules ['typo-rep'] = {
+ version = 1.001,
+ comment = "companion to node-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This was rather boring to program (more of the same) but I could
+-- endure it by listening to a couple cd's by The Scene and The Lau
+-- on the squeezebox on my desk.
+
+local next, type, tonumber = next, type, tonumber
+
+local trace_stripping = false trackers.register("nodes.stripping", function(v) trace_stripping = v end)
+ trackers.register("fonts.stripping", function(v) trace_stripping = v end)
+
+local report_stripping = logs.reporter("fonts","stripping")
+
+local nodes = nodes
+local enableaction = nodes.tasks.enableaction
+
+local nuts = nodes.nuts
+
+local getnext = nuts.getnext
+local getchar = nuts.getchar
+local isglyph = nuts.isglyph
+
+local getattr = nuts.getattr
+
+local remove_node = nuts.remove
+local replace_node = nuts.replace
+local copy_node = nuts.copy
+
+local nodecodes = nodes.nodecodes
+
+local chardata = characters.data
+local collected = false
+
+local a_stripping = attributes.private("stripping")
+
+local texsetattribute = tex.setattribute
+local unsetvalue = attributes.unsetvalue
+
+local v_reset = interfaces.variables.reset
+
+-- todo: other namespace -> typesetters
+
+nodes.stripping = nodes.stripping or { } local stripping = nodes.stripping
+stripping.glyphs = stripping.glyphs or { } local glyphs = stripping.glyphs
+
+local function initialize()
+ for k, v in next, chardata do
+ if v.category == "cf" and not v.visible and not glyphs[k] then
+ glyphs[k] = true
+ end
+ end
+ initialize = nil
+end
+
+local function process(what,head,current,char)
+ if what == true then
+ if trace_stripping then
+ report_stripping("deleting %C from text",char)
+ end
+ head, current = remove_node(head,current,true)
+ elseif type(what) == "function" then
+ head, current = what(head,current)
+ current = getnext(current)
+ if trace_stripping then
+ report_stripping("processing %C in text",char)
+ end
+ elseif what then -- assume node
+ head, current = replace_node(head,current,copy_node(what))
+ current = getnext(current)
+ if trace_stripping then
+ report_stripping("replacing %C in text",char)
+ end
+ end
+ return head, current
+end
+
+function nodes.handlers.stripping(head) -- use loop
+ local current = head
+ while current do
+ local char, id = isglyph(current)
+ if char then
+ -- it's more efficient to keep track of what needs to be kept
+ local todo = getattr(current,a_stripping)
+ if todo == 1 then
+ local what = glyphs[char]
+ if what then
+ head, current = process(what,head,current,char)
+ else -- handling of spacing etc has to be done elsewhere
+ current = getnext(current)
+ end
+ else
+ current = getnext(current)
+ end
+ else
+ current = getnext(current)
+ end
+ end
+ return head
+end
+
+local enabled = false
+
+function stripping.set(n) -- number or 'reset'
+ if n == v_reset then
+ n = unsetvalue
+ else
+ n = tonumber(n)
+ if n then
+ if not enabled then
+ if initialize then initialize() end
+ enableaction("processors","nodes.handlers.stripping")
+ enabled = true
+ end
+ else
+ n = unsetvalue
+ end
+ end
+ texsetattribute(a_stripping,n)
+end
+
+-- interface
+
+interfaces.implement {
+ name = "setcharacterstripping",
+ public = true,
+ protected = true,
+ actions = stripping.set,
+ arguments = "optional"
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-rep.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-rep.mkxl
index 6e0a9a22ce0..aa70c556499 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-rep.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-rep.mkxl
@@ -24,12 +24,12 @@
\unprotect
-\registerctxluafile{typo-rep}{}
+\registerctxluafile{typo-rep}{autosuffix}
\definesystemattribute[stripping][public]
-\permanent\protected\def\setcharacterstripping[#1]%
- {\clf_setcharacterstripping{#1}}
+% \permanent\protected\def\setcharacterstripping[#1]% defined at the lua end
+% {\clf_setcharacterstripping{#1}}
\permanent\protected\def\resetcharacterstripping
{\c_attr_stripping\attributeunsetvalue}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-scr.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-scr.mkxl
index bb67228cdc0..159b0be6b58 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-scr.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-scr.mkxl
@@ -48,11 +48,36 @@
\appendtoks \frozen\protected\edefcsname\currentlow \endcsname{\typo_scripts_low [\currentlow ]}\to \everydefinelow
\appendtoks \frozen\protected\edefcsname\currenthigh\endcsname{\typo_scripts_high[\currenthigh]}\to \everydefinehigh
+\def\typo_scripts_distance#1%
+ {\edef\p_distance{#1\c!distance}%
+ \ifx\p_distance\v!tight
+ \tightfitboundary
+ \else
+ \kern\p_distance\relax
+ \fi}
+
+%D \startbuffer
+%D \setuplow [distance=\zeropoint]
+%D \setuphigh[distance=\zeropoint]
+%D
+%D {\showglyphs f\high{x}\quad p\high{x}\quad}
+%D
+%D \setuplow [\c!distance=\v!tight]
+%D \setuphigh[\c!distance=\v!tight]
+%D
+%D {\showglyphs f\high{x}\quad p\high{x}\quad}
+%D \stopbuffer
+%D
+%D \typebuffer {\getbuffer}
+
+% \type{f\kern\tightfitcompensation\high{x}}
+% \type{f\tightfitboundary \high{x}}
+
\protected\def\typo_scripts_low[#1]#2%
{\dontleavehmode
\begingroup
\edef\currentlow{#1}%
- \kern\lowparameter\c!distance\relax
+ \typo_scripts_distance\lowparameter
\setbox\scratchbox\runninghbox\bgroup
\lower\lowparameter\c!down\hbox\bgroup
\ifempty\fontsize
@@ -78,7 +103,7 @@
{\dontleavehmode
\begingroup
\edef\currenthigh{#1}%
- \kern\highparameter\c!distance\relax
+ \typo_scripts_distance\highparameter
\setbox\scratchbox\runninghbox\bgroup
\raise\highparameter\c!up\hbox\bgroup
\ifempty\fontsize
@@ -131,15 +156,15 @@
\c!down=.58\exheight] % values
\appendtoks
- \frozen\setuevalue\currentlowhigh{\typo_scripts_lowhigh[\currentlowhigh]}%
+ \frozen\edefcsname\currentlowhigh\endcsname{\typo_scripts_lowhigh[\currentlowhigh]}%
\to \everydefinelowhigh
\tolerant\protected\def\typo_scripts_lowhigh[#1]#*[#2]#:#3#4% todo: align .. [#1] is compatible hack
{\dontleavehmode
\runninghbox\bgroup
\edef\currentlowhigh{#1}%
+ \typo_scripts_distance\lowhighparameter
\dostarttagged\t!subsup\currentlowhigh
- \scratchdimen\lowhighparameter\c!distance\relax
\setbox\plusfour\hpack{\typo_scripts_lowhigh_low_high\lower\c!down\t!sub{#3}}%
\setbox\plussix \hpack{\typo_scripts_lowhigh_low_high\raise\c!up \t!sup{#4}}%
\edef\p_align{#2}%
@@ -163,8 +188,7 @@
\egroup}
\def\typo_scripts_lowhigh_low_high#1#2#3#4%
- {\kern\scratchdimen
- \setbox\scratchbox\hpack\bgroup
+ {\setbox\scratchbox\hpack\bgroup
#1\lowhighparameter#2\hbox\bgroup
\ifempty\fontsize
\ifmmode
@@ -221,7 +245,7 @@
\c!down=.8\struthtdp]
\appendtoks
- \frozen\setuevalue\currentlowmidhigh{\typo_scripts_lowmidhigh[\currentlowmidhigh]}%
+ \frozen\edefcsname\currentlowmidhigh\endcsname{\typo_scripts_lowmidhigh[\currentlowmidhigh]}%
\to \everydefinelowmidhigh
\protected\def\typo_scripts_lowmidhigh[#1]#2#3#4%
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-spa.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-spa.lmt
index 88ade876ed7..f06ac7913d8 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-spa.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-spa.lmt
@@ -15,6 +15,7 @@ local report_spacing = logs.reporter("typesetting","spacing")
local nodes, fonts, node = nodes, fonts, node
local fonthashes = fonts.hashes
+local chardata = fonthashes.characters
local quaddata = fonthashes.quads
local texsetattribute = tex.setattribute
@@ -92,6 +93,9 @@ function spacings.handler(head)
local alternative = map.alternative
local quad = quaddata[font]
local prev = getprev(start)
+ if not chardata[font][char] then
+ report_spacing("missing character %C in font %i",char,font)
+ end
if left and left ~= 0 and prev then
local ok = false
local prevprev = getprev(prev)
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-wrp.lmt b/Master/texmf-dist/tex/context/base/mkxl/typo-wrp.lmt
index 5b31c401591..b77e2753221 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-wrp.lmt
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-wrp.lmt
@@ -9,7 +9,9 @@ if not modules then modules = { } end modules ['typo-wrp'] = {
-- begin/end par wrapping stuff ... more to come
local boundary_code = nodes.nodecodes.boundary
+local glyph_code = nodes.nodecodes.glyph
local wordboundary_code = nodes.boundarycodes.word
+local userboundary_code = nodes.boundarycodes.user
local nuts = nodes.nuts
@@ -17,16 +19,25 @@ local findtail = nuts.tail
local getprev = nuts.getprev
local setnext = nuts.setnext
local getid = nuts.getid
+local getdata = nuts.getdata
+local isglyph = nuts.isglyph
local getsubtype = nuts.getsubtype
local getattr = nuts.getattr
local flushnodelist = nuts.flushlist
+local traverse_boundary = nuts.traversers.boundary
+local insertnodebefore = nuts.insertbefore
+local newkern = nuts.pool.kern
+
+local fontdata = fonts.hashes.identifiers
local enableaction = nodes.tasks.enableaction
+local implement = interfaces.implement
+
local wrappers = { }
typesetters.wrappers = wrappers
-local trace_wrappers = trackers.register("typesetters.wrappers",function(v) trace_wrappers = v end)
+local trace_wrappers trackers.register("typesetters.wrappers",function(v) trace_wrappers = v end)
local report = logs.reporter("paragraphs","wrappers")
-- In luametatex we don't have the parfilskip attached yet but we can have final glue
@@ -64,18 +75,86 @@ local function remove_dangling_crlf(head,tail)
return head, tail
end
-function wrappers.handler(head)
- if head then
- local tail = findtail(head)
- head, tail = remove_dangling_crlf(head,tail) -- will be action chain
+implement {
+ name = "enablecrlf",
+ onlyonce = true,
+ actions = function()
+ enableaction("processors","typesetters.wrappers.handler")
+ end
+}
+
+-- Here's a solution for a trivial challenge by MS who got it from the internet
+-- (SE). If needed we can make it a bit more granular.
+
+local tighten = { }
+typesetters.tighten = tighten
+
+local trace_tighten trackers.register("typesetters.tighten",function(v) trace_tighten = v end)
+local report = logs.reporter("typesetters","tighten")
+
+local a_tightfit_boundary = tex.boundaries.system("c_tightfit_boundary") -- private, not defined with \defineboundary
+
+local function bbcompensation(font,char)
+ local tfmdata = fontdata[font]
+ local character = tfmdata.characters[char]
+ if character then
+ local compensation = character.compensation
+ if not compensation then
+ local description = tfmdata.descriptions[char]
+ if description then
+ local boundingbox = description.boundingbox
+ return boundingbox and (boundingbox[3] - (description.width or 0)) * tfmdata.parameters.hfactor
+ end
+ character.compensation = compensation
+ end
+ end
+ return 0
+end
+
+function tighten.handler(head)
+ for n, subtype in traverse_boundary, head do
+ if subtype == userboundary_code and getdata(n) == a_tightfit_boundary then
+ local prev = getprev(n)
+ if prev then
+ local char, font = isglyph(prev)
+ if char then
+ local compensation = bbcompensation(font,char)
+ if compensation > 0 then
+ if trace_tighten then
+ report("compensating %p after %C",compensation,char)
+ end
+ insertnodebefore(head,n,newkern(compensation))
+ end
+ end
+ end
+ end
end
return head
end
-interfaces.implement {
- name = "enablecrlf",
+implement {
+ name = "enabletighten",
onlyonce = true,
actions = function()
- enableaction("processors","typesetters.wrappers.handler")
+ enableaction("processors","typesetters.tighten.handler")
end
}
+
+local dimension_value = tokens.values.dimension
+local texgetnest = tex.getnest
+
+implement {
+ name = "tightfitcompensation",
+ public = true,
+ protected = true,
+ usage = "value",
+ actions = function()
+ local list = texgetnest()
+ if list then
+ list = list.tail
+ end
+ return
+ dimension_value,
+ list and list.id == glyph_code and bbcompensation(list.font,list.char) or 0
+ end,
+}
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-wrp.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-wrp.mkxl
index 71559a8a3a5..2f536bc061a 100644
--- a/Master/texmf-dist/tex/context/base/mkxl/typo-wrp.mkxl
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-wrp.mkxl
@@ -59,4 +59,17 @@
\let\spac_crlf\space
\to \everysimplifycommands
+% experiment, triggered by MS:
+%
+% \type{f\kern\tightfitcompensation\high{x}}
+% \type{f\tightfitboundary \high{x}}
+
+% \tightfitcompensation : defined at the lua end
+
+\newboundary\c_tightfit_boundary
+
+\permanent\protected\def\tightfitboundary
+ {\clf_enabletighten
+ \boundary\c_tightfit_boundary}
+
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg
index 409b17cbc42..67ad3841f95 100644
--- a/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg
+++ b/Master/texmf-dist/tex/context/fonts/mkiv/kpfonts-math.lfg
@@ -134,7 +134,17 @@ return {
tweak = "setoptions",
set = { "ignorekerndimensions" }
},
- },
+-- {
+-- tweak = "inspect",
+-- unicode = 0x2192
+-- },
+-- {
+-- tweak = "inspect",
+-- unicode = 0x20EF
+-- },
+-- {
+ }
+
},
alternates = {
-- italic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Lowercase Italic" },
diff --git a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl
index 3d6c649d667..21544d14e59 100644
--- a/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl
+++ b/Master/texmf-dist/tex/context/modules/mkxl/m-tikz.mkxl
@@ -67,6 +67,12 @@
\overloadmode\zerocount
+\newtoks\everytikzpicture
+
+% \appendtoks
+% \resetcharacterspacing
+% \to \everytikzpicture
+
\permanent\protected\def\starttikzsettings
{\pushoverloadmode
\pushmacro\meaning
@@ -81,6 +87,7 @@
\permanent\protected\def\starttikzpicture
{\dontleavehmode
\hcontainer\bgroup
+ \the\everytikzpicture
\autoparagraphmode\zerocount
\pushmacro\meaning
\let\meaning\meaningless
diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua
index e5c4b57eb7f..614793314d7 100644
--- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/Master/texmf-dist/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-02-23 21:26
+-- merge date : 2023-03-10 12:15
do -- begin closure to overcome local limits and interference
@@ -2952,9 +2952,23 @@ function file.withinbase(path)
end
return true
end
-local symlinkattributes=lfs.symlinkattributes
-function lfs.readlink(name)
- return symlinkattributes(name,"target") or nil
+do
+ local symlinktarget=lfs.symlinktarget
+ local symlinkattributes=lfs.symlinkattributes
+ if symlinktarget then
+ function lfs.readlink(name)
+ local target=symlinktarget(name)
+ return name~=target and name or nil
+ end
+ elseif symlinkattributes then
+ function lfs.readlink(name)
+ return symlinkattributes(name,"target") or nil
+ end
+ else
+ function lfs.readlink(name)
+ return nil
+ end
+ end
end
end -- closure
diff --git a/Master/texmf-dist/web2c/texmfcnf.lua b/Master/texmf-dist/web2c/texmfcnf.lua
index 9fd2d8e5988..dedadd1965a 100644
--- a/Master/texmf-dist/web2c/texmfcnf.lua
+++ b/Master/texmf-dist/web2c/texmfcnf.lua
@@ -1,79 +1,98 @@
--- public domain
+-- todo: come up with an auto-texlive identification (texmf-dist)
--- ConTeXt needs a properly expanded TEXMFLOCAL, so here is a
--- bit of lua code to make that happen
-
-local texmflocal = resolvers.prefixes.selfautoparent();
-texmflocal = string.gsub(texmflocal, "20%d%d$", "texmf-local");
+local hiddentexlivepath = ".texlive2023"
return {
type = "configuration",
- version = "1.1.0",
- date = "2012-05-24",
- time = "12:12:12",
- comment = "ConTeXt MkIV configuration file",
+ version = "1.1.3",
+ date = "2023-03-10", -- 2021-05-12 2011-06-02
+ time = "14:59:00",
+ comment = "ConTeXt MkIV and LMTX configuration file",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ target = "texlive",
content = {
- -- Originally there was support for engines and progname but I don't expect
- -- other engines to use this file, so first engines were removed. After that
- -- if made sense also to get rid of progname. At some point specific formats
- -- will be supported but then as a subtable with fallbacks, which sounds more
- -- natural. Also, at some point the paths will become tables. For the moment
- -- I don't care too much about it as extending is easy.
+ -- Originally there was support for engines and progname but I don't expect other engines to
+ -- use this file, so first engines were removed. After that if made sense also to get rid of
+ -- progname. In principle we could support multiple formats here (using subtables) but time
+ -- has demonstrated that we only have one format (the original ideas was to make a base layer
+ -- but I don't see it being used to it would be waste of time). So, after a decade it was
+ -- time to prune and update this file, also because LMTX has a few more features.
variables = {
- -- The following variable is predefined (but can be overloaded) and in
- -- most cases you can leve this one untouched. The built-in definition
- -- permits relocation of the tree.
+ -- The following variable is predefined (but can be overloaded) and in most cases you can
+ -- leave this one untouched. The built-in definition permits relocation of the tree.
--
- -- TEXMFCNF = "{selfautodir:,selfautoparent:}{,{/share,}/texmf{-local,}/web2c}"
+ -- if this_is_texlive then
+ -- resolvers.luacnfspec = 'selfautodir:;selfautoparent:;{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
+ -- else
+ -- resolvers.luacnfspec = 'home:texmf/web2c;selfautoparent:texmf{-local,-context,}/web2c'
+ -- end
--
- -- more readable than "selfautoparent:{/texmf{-local,}{,/web2c},}}" is:
+ -- more readable is:
--
-- TEXMFCNF = {
- -- "selfautoparent:/texmf-local",
- -- "selfautoparent:/texmf-local/web2c",
- -- "selfautoparent:/texmf-dist",
- -- "selfautoparent:/texmf/web2c",
- -- "selfautoparent:",
+ -- "home:texmf/web2c,
+ -- "selfautoparent:texmf-local/web2c",
+ -- "selfautoparent:texmf-context/web2c",
+ -- "selfautoparent:texmf/web2c",
-- }
- -- only used for FONTCONFIG_PATH & TEXMFCACHE in TeX Live
+ -- We have only one cache path but there can be more. The first writable one will be taken
+ -- but there can be more readable paths.
- TEXMFSYSVAR = "selfautoparent:texmf-var",
- TEXMFVAR = "home:.texlive2023/texmf-var",
+ -- standalone:
+
+ -- TEXMFCACHE = "$SELFAUTOPARENT/texmf-cache",
- -- We have only one cache path but there can be more. The first writable one
- -- will be chosen but there can be more readable paths.
+ -- texlive
+ TEXMFVAR = "home:" .. hiddentexlivepath .. "/texmf-var",
+ TEXMFCONFIG = "home:" .. hiddentexlivepath .. "/texmf-config",
+ TEXMFSYSVAR = "selfautoparent:texmf-var",
TEXMFCACHE = "$TEXMFSYSVAR;$TEXMFVAR",
- TEXMFCONFIG = "home:.texlive2023/texmf-config",
- -- I don't like this texmf under home and texmf-home would make more
- -- sense. One never knows what installers put under texmf anywhere and
- -- sorting out problems will be a pain. But on the other hand ... home
- -- mess is normally under the users own responsibility.
+ -- I don't like this texmf under home and texmf-home would make more sense. One never knows
+ -- what installers put under texmf anywhere and sorting out problems will be a pain. But on
+ -- the other hand ... home mess is normally the users own responsibility.
--
- -- By using prefixes we don't get expanded paths in the cache __path__
- -- entry. This makes the tex root relocatable.
+ -- By using prefixes we don't get expanded paths in the cache __path__ entry. This makes the
+ -- tex root relocatable.
TEXMFOS = "selfautodir:",
- TEXMFDIST = "selfautoparent:texmf-dist",
- TEXMFLOCAL = texmflocal,
+ -- standalone:
+
+ -- TEXMFSYSTEM = "selfautoparent:texmf-$SELFAUTOSYSTEM",
+ -- TEXMFMAIN = "selfautoparent:texmf",
+ -- TEXMFCONTEXT = "selfautoparent:texmf-context",
+ -- TEXMFMODULES = "selfautoparent:texmf-modules",
+
+ -- texlive:
+
+ TEXMFDIST = "selfautoparent:texmf-dist",
TEXMFSYSCONFIG = "selfautoparent:texmf-config",
+
+ -- The texmf-local path is only used for (maybe) some additional configuration file.
+
+ TEXMFLOCAL = "selfautoparent:texmf-local",
TEXMFFONTS = "selfautoparent:texmf-fonts",
TEXMFPROJECT = "selfautoparent:texmf-project",
TEXMFHOME = "home:texmf",
-- TEXMFHOME = os.name == "macosx" and "home:Library/texmf" or "home:texmf",
- -- We need texmfos for a few rare files but as I have a few more bin trees
- -- a hack is needed. Maybe other users also have texmf-platform-new trees.
+ -- We need texmfos for a few rare files but as I have a few more bin trees a hack is needed.
+ -- Maybe other users also have texmf-platform-new trees, but so far I've never heard of it.
+
+ -- standalone:
+
+ -- TEXMF = "{$TEXMFHOME,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFMODULES,!!$TEXMFCONTEXT,!!$TEXMFSYSTEM,!!$TEXMFMAIN}",
+
+ -- texlive:
TEXMF = "{$TEXMFCONFIG,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFDIST}",
@@ -81,11 +100,11 @@ return {
ENCFONTS = ".;$TEXMF/fonts/data//;$TEXMF/fonts/enc/{dvips,pdftex}//",
VFFONTS = ".;$TEXMF/fonts/{data,vf}//",
TFMFONTS = ".;$TEXMF/fonts/{data,tfm}//",
+ PKFONTS = ".;$TEXMF/fonts/{data,pk}//",
T1FONTS = ".;$TEXMF/fonts/{data,type1}//;$OSFONTDIR",
AFMFONTS = ".;$TEXMF/fonts/{data,afm}//;$OSFONTDIR",
TTFONTS = ".;$TEXMF/fonts/{data,truetype}//;$OSFONTDIR",
OPENTYPEFONTS = ".;$TEXMF/fonts/{data,opentype}//;$OSFONTDIR",
- CMAPFONTS = ".;$TEXMF/fonts/cmap//",
FONTFEATURES = ".;$TEXMF/fonts/{data,fea}//;$OPENTYPEFONTS;$TTFONTS;$T1FONTS;$AFMFONTS",
FONTCIDMAPS = ".;$TEXMF/fonts/{data,cid}//",
OFMFONTS = ".;$TEXMF/fonts/{data,ofm,tfm}//",
@@ -101,12 +120,12 @@ return {
PYTHONINPUTS = ".;$TEXMF/scripts/context/python",
RUBYINPUTS = ".;$TEXMF/scripts/context/ruby",
LUAINPUTS = ".;$TEXINPUTS;$TEXMF/scripts/context/lua//",
- CLUAINPUTS = ".;$SELFAUTOLOC/lib/{context,luatex,}/lua//",
+ CLUAINPUTS = ".;$SELFAUTOLOC/lib/$engine//",
-- Not really used by MkIV so they might go away.
- BIBINPUTS = ".;$TEXMF/bibtex/bib//",
- BSTINPUTS = ".;$TEXMF/bibtex/bst//",
+ BIBINPUTS = ".;$TEXMF/bibtex/bib//;$TEXMF/tex/context//",
+ BSTINPUTS = ".;$TEXMF/bibtex/bst//;$TEXMF/tex/context//",
-- Experimental
@@ -115,28 +134,65 @@ return {
-- A few special ones that will change some day.
FONTCONFIG_FILE = "fonts.conf",
+
+ -- standalone
+
+ -- FONTCONFIG_PATH = "$TEXMFSYSTEM/fonts/conf",
+
+ --texlive
+
FONTCONFIG_PATH = "$TEXMFSYSVAR/fonts/conf",
},
- -- We have a few reserved subtables. These control runtime behaviour. The
- -- keys have names like 'foo.bar' which means that you have to use keys
- -- like ['foo.bar'] so for convenience we also support 'foo_bar'.
+ -- We have a few reserved subtables. These control runtime behaviour. Some are frozen at
+ -- at startup time, others can be changed any time.
directives = {
- -- There are a few variables that determine the engines
- -- limits. Most will fade away when we close in on version 1.
-
- ["luatex.expanddepth"] = "10000", -- 10000
- ["luatex.hashextra"] = "100000", -- 0
- ["luatex.nestsize"] = "1000", -- 50
- ["luatex.maxinopen"] = "500", -- 15
- ["luatex.maxprintline"] = " 10000", -- 79
- ["luatex.maxstrings"] = "500000", -- 15000 -- obsolete
- ["luatex.paramsize"] = "25000", -- 60
- ["luatex.savesize"] = "50000", -- 4000
- ["luatex.stacksize"] = "10000", -- 300
+ -- The default settings are actually set at startup so the values below overload
+ -- them. You can also specify a plus field which will bump a value and in LMTX a
+ -- step field that sets the incremental allocation of memory (because there we don't
+ -- allocate all at once).
+
+ -- texconfig.max_print_line = 100000
+ -- texconfig.function_size = 32768
+ -- texconfig.properties_size = 10000
+
+ -- These are for luametatex:
+
+ ["luametatex.errorlinesize"] = { size = 250 }, -- max = 255
+ ["luametatex.halferrorlinesize"] = { size = 250 }, -- max = 255
+ ["luametatex.expandsize"] = { size = 10000 }, -- max = 1000000
+ ["luametatex.stringsize"] = { size = 500000, step = 100000 }, -- max = 2097151 -- number of strings
+ ["luametatex.poolsize"] = { size = 10000000, step = 1000000 }, -- max = 100000000 -- chars in string
+ ["luametatex.hashsize"] = { size = 250000, step = 100000 }, -- max = 2097151
+ ["luametatex.nodesize"] = { size = 50000000, step = 500000 }, -- max = 50000000
+ ["luametatex.tokensize"] = { size = 10000000, step = 250000 }, -- max = 10000000
+ ["luametatex.buffersize"] = { size = 10000000, step = 1000000 }, -- max = 100000000
+ ["luametatex.inputsize"] = { size = 100000, step = 10000 }, -- max = 100000 -- aka stack
+ ["luametatex.filesize"] = { size = 2000, step = 200 }, -- max = 2000
+ ["luametatex.nestsize"] = { size = 10000, step = 1000 }, -- max = 10000
+ ["luametatex.parametersize"] = { size = 100000, step = 10000 }, -- max = 100000
+ ["luametatex.savesize"] = { size = 500000, step = 10000 }, -- max = 500000
+ ["luametatex.fontsize"] = { size = 100000, step = 250 }, -- max = 100000
+ ["luametatex.languagesize"] = { size = 250, step = 250 }, -- max = 10000
+ ["luametatex.marksize"] = { size = 250, step = 50 }, -- max = 10000
+ ["luametatex.insertsize"] = { size = 250, step = 25 }, -- max = 250
+
+ -- These are for luatex:
+
+ ["luatex.errorline"] = 250,
+ ["luatex.halferrorline"] = 125,
+ ["luatex.expanddepth"] = 10000,
+ ["luatex.hashextra"] = 100000,
+ ["luatex.nestsize"] = 1000,
+ ["luatex.maxinopen"] = 500,
+ ["luatex.maxprintline"] = 10000,
+ ["luatex.maxstrings"] = 500000,
+ ["luatex.paramsize"] = 25000,
+ ["luatex.savesize"] = 100000,
+ ["luatex.stacksize"] = 100000,
-- A few process related variables come next.
@@ -146,35 +202,68 @@ return {
["system.compile.cleanup"] = "no", -- remove tma files
["system.compile.strip"] = "yes", -- strip tmc files
- -- The io modes are similar to the traditional ones. Possible values
- -- are all, paranoid and restricted.
+ -- The io modes are similar to the traditional ones. Possible values are all, paranoid
+ -- and restricted.
["system.outputmode"] = "restricted",
["system.inputmode"] = "any",
- -- The following variable is under consideration. We do have protection
- -- mechanims but it's not enabled by default.
+ -- The following variable is under consideration. We do have protection mechanims but
+ -- it's not enabled by default.
["system.commandmode"] = "any", -- any none list
["system.commandlist"] = "mtxrun, convert, inkscape, gs, imagemagick, curl, bibtex, pstoedit",
- -- The mplib library support mechanisms have their own
- -- configuration. Normally these variables can be left as
- -- they are.
+ -- The mplib library support mechanisms have their own configuration. Normally these
+ -- variables can be left as they are.
["mplib.texerrors"] = "yes",
- -- Normally you can leave the font related directives untouched
- -- as they only make sense when testing.
+ -- Normally you can leave the font related directives untouched as they only make sense
+ -- when testing.
-- ["fonts.autoreload"] = "no",
- -- ["fonts.otf.loader.method"] = "table", -- table mixed sparse
-- ["fonts.otf.loader.cleanup"] = "0", -- 0 1 2 3
-- In an edit cycle it can be handy to launch an editor. The
-- preferred one can be set here.
- -- ["pdfview.method"] = "okular", -- default (often acrobat) xpdf okular
+ -- ["pdfview.method"] = "sumatra",
+
+ -- ["system.engine"] = "luajittex",
+ -- ["fonts.usesystemfonts"] = false,
+ -- ["modules.permitunprefixed"] = false,
+ -- ["resolvers.otherwise"] = false,
+
+ -- Sandboxing has been available for a while but is probably never used to maybe that mechanism
+ -- should be removed some day. Normally you will configure this in a local configuration file. By
+ -- default we are rather permissive. The next list comes from my machine:
+
+ -- ["system.rootlist"] = { "/data" }, -- { { "/data", "read" }, ... }
+
+ -- ["system.executionmode"] = "list", -- none | list | all
+ -- ["system.executionlist"] = {
+ -- "context",
+ -- "bibtex", "mlbibcontext",
+ -- "curl",
+ -- "gswin64c", "gswin32c", "gs",
+ -- "gm", "graphicmagick",
+ -- "pdftops",
+ -- "pstoedit",
+ -- "inkscape",
+ -- "woff2_decompress",
+ -- "hb-shape",
+ -- },
+ --
+ -- ["system.librarymode"] = "list", -- none | list | all
+ -- ["system.librarylist"] = {
+ -- "mysql",
+ -- "sqlite3",
+ -- "libharfbuzz", "libharfbuzz-0",
+ -- },
+ -- -- ["system.librarynames"] = {
+ -- -- ["libcurl"] = { "libcurl", "libcurl-4" },
+ -- -- },
},