diff options
author | Karl Berry <karl@freefriends.org> | 2023-03-06 21:39:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-03-06 21:39:56 +0000 |
commit | 6b55d88293fd8665fbdecde56bb693157fac7f35 (patch) | |
tree | 7f43817fc6f7c63cb3dd928bbc0b9d6f565ba483 | |
parent | bd2947b936a22094e2869f7ec2921ba03f7d9218 (diff) |
minim (all) (6mar23)
git-svn-id: svn://tug.org/texlive/trunk@66395 c570f23f-e606-0410-a88d-b1316a301751
28 files changed, 397 insertions, 128 deletions
diff --git a/Master/texmf-dist/doc/luatex/minim-math/README b/Master/texmf-dist/doc/luatex/minim-math/README index 2463570ef86..e6f44401e2f 100644 --- a/Master/texmf-dist/doc/luatex/minim-math/README +++ b/Master/texmf-dist/doc/luatex/minim-math/README @@ -1,4 +1,4 @@ -Version: 2022/1.1 +Version: 2023/1.2 SUMMARY @@ -18,6 +18,13 @@ In order to obtain the typeset manual of this package, simply say: HISTORY +2023/1.2 (1/1/2023) + + Minor additions: + + * Add \unaryminus and \smartdecimalcomma + * Add convenience functions for numbering displayed equations. + 2022/1.1 (1/1/2022) Minor changes: diff --git a/Master/texmf-dist/doc/luatex/minim-math/minim-math.doc b/Master/texmf-dist/doc/luatex/minim-math/minim-math.doc index 79ff1dee718..d458876b41e 100644 --- a/Master/texmf-dist/doc/luatex/minim-math/minim-math.doc +++ b/Master/texmf-dist/doc/luatex/minim-math/minim-math.doc @@ -8,8 +8,8 @@ \else \startmetadata author {Esger Renkema} title {minim-math} - date {2022-03-03} - version {2022/1.1} + date {2023-03-03} + version {2023/1.2} keywords {LuaTeX; Plain TeX; Unicode mathematics} stopmetadata \maketitle \fi @@ -117,6 +117,8 @@ sizes, too. Say ⟦*\decimalcomma⟧ and have commas appear as $\decimalcomma1,2$ instead of~$1,2$ (⟦*\nodecimalcomma⟧ restores the default). +Say ⟦*\smartdecimalcomma⟧ for a comma that only acts as punctuation when not +immediately followed by a digit. The explicit ⟦*\comma⟧, like ⟦*\colon⟧, will always be punctuation. The behaviour of limits on integral signs can be set by redefining @@ -209,6 +211,20 @@ brackets: ⟦$$\underbrace[=1]{(x^2+∥penalty0y^2)}$$⟧ gives $$\underbrace[=1]{(x^2 + y^2)}.$$ +Finally, the following (entirely optional) alternative to using dollar signs is +provided, which also offers slight improvements in the spacing of displayed +equations: +\stopformulatagging\Ustartdisplaymath +\halign{# \hfil&#\quad&#\hfil\cr +&⟦\[ ... \]⟧&inline mathematics\cr +⟦\display⟧&⟦\[ ... \]⟧&display mathematics\cr +⟦\displaynr {nr}⟧&⟦\[ ... \]⟧&numbered display mathematics\cr +⟦\displaynr⟧&⟦\[ ... \]⟧&automatically numbered display mathematics\cr +}\Ustopdisplaymath\startformulatagging + +The automatic display numbering uses the count ⟦\equationnumber⟧ and the token +list ⟦\setequationnumber⟧ internally. All displays created this way can be made +left-aligned by saying ⟦\leftdisplaystrue⟧. \section Best practices diff --git a/Master/texmf-dist/doc/luatex/minim-math/minim-math.pdf b/Master/texmf-dist/doc/luatex/minim-math/minim-math.pdf Binary files differindex 33e9aec9f6c..6a80c7a07e8 100644 --- a/Master/texmf-dist/doc/luatex/minim-math/minim-math.pdf +++ b/Master/texmf-dist/doc/luatex/minim-math/minim-math.pdf diff --git a/Master/texmf-dist/doc/luatex/minim-mp/README b/Master/texmf-dist/doc/luatex/minim-mp/README index 2e04ee1050f..b28f8c42673 100644 --- a/Master/texmf-dist/doc/luatex/minim-mp/README +++ b/Master/texmf-dist/doc/luatex/minim-mp/README @@ -1,4 +1,4 @@ -Version: 2022/1.1 +Version: 2023/1.2 SUMMARY @@ -19,6 +19,11 @@ In order to obtain the typeset manual of this package, simply say: HISTORY +2023/1.2 (3/3/2023) + + * Add a few more metapost macros. + * Various small bug fixes. + 2022/1.1 (3/3/2022) New features: diff --git a/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.doc b/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.doc index b7fb47f4163..af84cd15811 100644 --- a/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.doc +++ b/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.doc @@ -8,8 +8,8 @@ \else \startmetadata author {Esger Renkema} title {minim-mp} - date {2022-03-03} - version {2022/1.1} + date {2023-03-03} + version {2023/1.2} keywords {LuaTeX; Plain TeX; MetaPost; mplib} stopmetadata \maketitle \fi @@ -291,6 +291,11 @@ cmyk-colours ⟦*cyan⟧, ⟦*magenta⟧, ⟦*yellow⟧ and ⟦*key⟧. The macr ⟦*clockwise⟧, ⟦*xshifted⟧, ⟦*yshifted⟧, ⟦*hflip⟧ and ⟦*vflip⟧, where the flips are defined in such a way that ⟦p & hflip p⟧ gives the expected result. +Version 1.2 brought the following additions: ⟦*save_pair⟧, ⟦*save_path⟧ etc. +etc. that save and declare in one go; the missing trigonometric functions +⟦*tand⟧, ⟦*arcsind⟧, ⟦*arccosd⟧ and ⟦*arctand⟧, and the unit circle segment +drawing function ⟦*arc(⟧$θ_0$⟦*,⟧$θ_ℓ$⟦*)⟧ (taking a starting angle and arc +length, both in degrees). \section Lua interface %1 diff --git a/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.pdf b/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.pdf Binary files differindex 1011878d1e1..15ada22b367 100644 --- a/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.pdf +++ b/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.pdf diff --git a/Master/texmf-dist/doc/luatex/minim-pdf/README b/Master/texmf-dist/doc/luatex/minim-pdf/README index d8f2b19c6ed..cff08578237 100644 --- a/Master/texmf-dist/doc/luatex/minim-pdf/README +++ b/Master/texmf-dist/doc/luatex/minim-pdf/README @@ -1,4 +1,4 @@ -Version: 2022/1.1 +Version: 2023/1.2 SUMMARY @@ -27,6 +27,17 @@ In order to obtain the typeset manual of this package, simply say: HISTORY +2023/1.2 (3/3/2023) + + Breaking changes: + + * \marktablerow no longer implies \marktablecell. + + New features: + + * Support the use of an IDTree in the document structure. + * Add \tagattribute, \settagid and \showstructure. + 2022/1.1 (3/3/2022) New features: diff --git a/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.doc b/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.doc index 71e8cea89cc..3030378bcb9 100644 --- a/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.doc +++ b/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.doc @@ -14,8 +14,8 @@ all other features of the package are described here. \else \startmetadata author {Esger Renkema} title {minim-pdf} - date {2022-03-03} - version {2022/1.1} + date {2023-03-03} + version {2023/1.2} keywords {LuaTeX; Plain TeX; PDF/A; Tagged PDF; accessibility; a11y; hypertext; bookmarks; document outline; associated files} stopmetadata @@ -292,6 +292,8 @@ Keep in mind that the reassignment is local: if a paragraph marked with Auto-marking paragraphs can be (locally) disabled or enabled by saying ⟦*\markparagraphsfalse⟧ or ⟦*\markparagraphstrue⟧. +You can query the place in the document structure of any point with +⟦*\showdocumentstructure⟧. \section Structure element aliases %1 @@ -324,21 +326,26 @@ current SE from a named identifier ⟦\name⟧. \section Structure element options %1 -The ⟦\startelement⟧ command allows a few options that are not mentioned -above: its full syntax is ⟦*\startelement <options> {Tag}⟧. +The ⟦\startelement⟧ command allows a few options that are not mentioned above: +its full syntax is ⟦*\startelement <options> {Tag}⟧. The three most useful options are ⟦alt⟧ for setting an alt-text (the ⟦/Alt⟧ entry in the structure element dicionary), ⟦actual⟧ for a text replacement (⟦/ActualText⟧) and ⟦lang⟧ for the language (⟦/Lang⟧; see the next section). The alternative and actual texts can also be given after the fact with -⟦*\setalttext{...}⟧ and ⟦*\setactualtext{...}⟧; these apply to the current +⟦*\setalttext {...}⟧ and ⟦*\setactualtext {...}⟧; these apply to the current structure element. Structure element attributes can be given with -⟦attr <owner> <key> <value>⟧, e.g. ⟦attr Layout Placement /Inline⟧. +⟦attr <owner> <key> <value>⟧, e.g. ⟦attr Layout Placement /Inline⟧ or added +later with ⟦*\tagattribute⟧. Note that for the ⟦owner⟧ and ⟦key⟧ the initial slash must be omitted; the ⟦value⟧ on the other hand will be written to the pdf verbatim. Any number of attributes can be added. +An identifier can be set with the ⟦id⟧ option, or after the fact with +⟦*\settagid {...}⟧. This identifier will be added to the ⟦IDTree⟧ and is +entirely optional; you will probably already know when you need it. + Finally, structure element classes can be given with the ⟦class <classname>⟧ keyword, which can be repeated. Classes can be defined with @@ -394,8 +401,9 @@ the ⟦lbl⟧ is a section number and can also be empty.) For marking up tables, a whole array of helper macros is available. First, ⟦*\marktable⟧ should be given \emph{before} the ⟦\halign⟧. -Then, in the template, the first cell should start with ⟦*\marktablerow⟧ and -each subsequent cell with ⟦*\marktablecell⟧. +Then, in the template, the first cell should start with ⟦*\marktablerow⟧ +⟦*\marktablecell⟧ and +each subsequent cell with ⟦\marktablecell⟧. If your table starts with a header, insert ⟦*\marktableheader⟧ before it and ⟦*\marktablebody⟧ after. Before a table footer, insert ⟦*\marktablefooter⟧. diff --git a/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.pdf b/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.pdf Binary files differindex 414e577186a..39500a7985b 100644 --- a/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.pdf +++ b/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.pdf diff --git a/Master/texmf-dist/doc/luatex/minim-xmp/README b/Master/texmf-dist/doc/luatex/minim-xmp/README index 46d9d3cc6e3..4b983bddeb1 100644 --- a/Master/texmf-dist/doc/luatex/minim-xmp/README +++ b/Master/texmf-dist/doc/luatex/minim-xmp/README @@ -1,4 +1,4 @@ -Version: 2022/1.1 +Version: 2023/1.2 SUMMARY @@ -21,6 +21,10 @@ In order to obtain the typeset manual of this package, simply say: HISTORY +2023/1.2 (3/3/2022) + + No new features. + 2022/1.1 (3/3/2022) New features: diff --git a/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.doc b/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.doc index 57fe527d2c8..651373e2b6c 100644 --- a/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.doc +++ b/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.doc @@ -8,8 +8,8 @@ \else \startmetadata author {Esger Renkema} title {minim-xmp} - date {2022-03-03} - version {2022/1.1} + date {2023-03-03} + version {2023/1.2} keywords {LuaTeX; Plain TeX; XMP; metadata; PDF/A;} stopmetadata \maketitle \fi diff --git a/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.pdf b/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.pdf Binary files differindex 11c86a9d673..b5011cd8e0a 100644 --- a/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.pdf +++ b/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.pdf diff --git a/Master/texmf-dist/doc/luatex/minim/README b/Master/texmf-dist/doc/luatex/minim/README index 31c34b28bfc..2114fa4fb44 100644 --- a/Master/texmf-dist/doc/luatex/minim/README +++ b/Master/texmf-dist/doc/luatex/minim/README @@ -1,4 +1,4 @@ -Version: 2022/1.1 +Version: 2023/1.2 SUMMARY @@ -31,6 +31,12 @@ the packages mentioned above. HISTORY +2023/1.2 (3/3/2023) + + * Added \Ucharcat, as in XeTeX. + * Gave sensible definitions to unicode space characters. + * Updated the manual to reflect the latest versions of the other minims. + 2022/1.1 (3/3/2022) Major changes: diff --git a/Master/texmf-dist/doc/luatex/minim/minim-alloc.doc b/Master/texmf-dist/doc/luatex/minim/minim-alloc.doc index edf268c81df..4aec2d39fcd 100644 --- a/Master/texmf-dist/doc/luatex/minim/minim-alloc.doc +++ b/Master/texmf-dist/doc/luatex/minim/minim-alloc.doc @@ -233,7 +233,7 @@ in into an eternal loop, however. On the tex side, ⟦*\voidbox⟧, ⟦*\ignore⟧, ⟦*\spacechar⟧, ⟦*\unbrace⟧, ⟦*\firstoftwo⟧ and ⟦*\secondoftwo⟧ should be self-explanatory and -uncontroversial additions. For looking ahead, you can use +uncontroversial additions. ⟦*\Ucharcat⟧ works as in xetex. For looking ahead, you can use ⟦*\nextif \token {executed if present} {executed if not}⟧ or its siblings ⟦*\nextifx⟧ and ⟦*\nextifcat⟧. For defining macros with optional arguments, ⟦*\withoptions[default]{code}⟧ diff --git a/Master/texmf-dist/doc/luatex/minim/minim.doc b/Master/texmf-dist/doc/luatex/minim/minim.doc index a0ad8f2d4a1..7061917398d 100644 --- a/Master/texmf-dist/doc/luatex/minim/minim.doc +++ b/Master/texmf-dist/doc/luatex/minim/minim.doc @@ -4,8 +4,8 @@ \startmetadata author {Esger Renkema} title {minim} - date {2022-03-03} - version {2022/1.1} + date {2023-03-03} + version {2023/1.2} keywords {LuaTeX; Plain TeX; MetaPost; PDF/A; Tagged PDF; accessibility; a11y; Unicode mathematics; XMP; metadata; hypertext; bookmarks} stopmetadata diff --git a/Master/texmf-dist/doc/luatex/minim/minim.pdf b/Master/texmf-dist/doc/luatex/minim/minim.pdf Binary files differindex 1596eb65d42..3685ecf7fdb 100644 --- a/Master/texmf-dist/doc/luatex/minim/minim.pdf +++ b/Master/texmf-dist/doc/luatex/minim/minim.pdf diff --git a/Master/texmf-dist/metapost/minim-mp/minim.mp b/Master/texmf-dist/metapost/minim-mp/minim.mp index f3f03eb3d0e..0bbaa2a27c4 100644 --- a/Master/texmf-dist/metapost/minim-mp/minim.mp +++ b/Master/texmf-dist/metapost/minim-mp/minim.mp @@ -1,14 +1,14 @@ delimiters (); +message "Loading the minim extension macros"; + % redefine some constants to work with the new numerical engines numeric mm, cm, pt, pc, dd, cc; pc = 12 pt; cc = 12 dd; cm = 10 mm; 803 pt = 800; 127 mm = 360; 1157 dd = 1238 pt; eps := 1/2048; infinity := 64*64-epsilon; -message "Loading the minim extension macros"; - % interaction with tex vardef baseline expr o = fill if numeric o : (0,o) else: o fi @@ -114,6 +114,8 @@ def endpattern (expr xstep, ystep) = newinternal tilingtype; tilingtype:=1; _patterns_._last_ := 0; +message "Loading additional definitions"; + % shorthands primarydef p xshifted x = p shifted (x,0) enddef; primarydef p yshifted y = p shifted (0,y) enddef; @@ -141,4 +143,35 @@ key = (0,0,0,1); % constants pi := 355/113; +% shorthands +def save_pair text t = save t; pair t; enddef; +def save_path text t = save t; path t; enddef; +def save_color text t = save t; color t; enddef; +def save_cmykcolor text t = save t; cmykcolor t; enddef; +def save_transform text t = save t; transform t; enddef; +def save_boolean text t = save t; boolean t; enddef; +def save_string text t = save t; string t; enddef; + +% missing trigonometric functions +vardef tand primary x = sind(x)/cosd(x) enddef; +vardef arcsind primary x = angle((1+-+x, x)) enddef; +vardef arccosd primary x = angle((x, 1+-+x)) enddef; +vardef arctand primary x = angle(1, x) enddef; + +% segments of the circle (counterclockwise) +vardef arc (expr thetafrom, thetalen) = + save n, d, l, theta; save_path a; save_pair p, c; + n = ceiling(thetalen / 45); % number of segments (45° is max segment length) + d = thetalen / n; % angle of each segment + l = 4/3 * tand(d/4); % length of control points + theta := thetafrom; + p := (cosd theta, sind theta); + c := l * (-sind theta, cosd theta); + a := p for _ = 1 upto n: + .. controls (p + c) + hide(theta := theta + d; + p := (cosd theta, sind theta); + c := l * (-sind theta, cosd theta);) + and (p - c) .. p + endfor; a enddef; diff --git a/Master/texmf-dist/tex/luatex/minim-math/minim-math.lua b/Master/texmf-dist/tex/luatex/minim-math/minim-math.lua index 6373809e433..a4540a92b23 100644 --- a/Master/texmf-dist/tex/luatex/minim-math/minim-math.lua +++ b/Master/texmf-dist/tex/luatex/minim-math/minim-math.lua @@ -365,8 +365,9 @@ end -- list of noads. --]] -local listmathfields = { 'head', 'nucleus', 'sub', 'sup', 'accent', 'bot_accent', - 'display', 'text', 'script', 'scriptscript', 'num', 'denom', 'degree', 'next' } +local listmathfields = { 'head', 'nucleus', 'sub', 'sup', 'accent', + 'bot_accent', 'display', 'text', 'script', 'scriptscript', 'num', 'denom', + 'degree', 'next' } -- note that ‘next’ should be last! local function noad_iterator (head) local nodelist = { link=nil, content=head } @@ -385,7 +386,7 @@ end local math_char = node.id ('math_char') -local function inspect_noads (h,d,n) +local function inspect_noads (h, _, _) for nd in noad_iterator (h) do if nd.id == math_char then local sa = node.has_attribute(nd, style_attribute) @@ -431,7 +432,6 @@ local is_delimiter = } local function tex_accent(class, num, char) - kind = kind or '' return '\\math:'..accents[class]..'{'..num..'}'..char end diff --git a/Master/texmf-dist/tex/luatex/minim-math/minim-math.tex b/Master/texmf-dist/tex/luatex/minim-math/minim-math.tex index 06fb632a5c0..d24a6693dcc 100644 --- a/Master/texmf-dist/tex/luatex/minim-math/minim-math.tex +++ b/Master/texmf-dist/tex/luatex/minim-math/minim-math.tex @@ -77,7 +77,7 @@ \protected\def\mbb#1{{\mathstyle{bb}#1}} \protected\def\frak#1{{\mathstyle{frak}#1}} \protected\def\bffrak#1{{\mathstyle{bffrak}#1}} -\protected\def\scr#1{{\mathstyle{scr}#1}} \let\mcal = \cal +\protected\def\scr#1{{\mathstyle{scr}#1}} \let\mcal = \scr \protected\def\bfscr#1{{\mathstyle{bfscr}#1}} \let\bfcal = \bfscr % 1 Processing the character table @@ -137,8 +137,26 @@ % decimal comma settings \explicitmathchar \comma +\Umathchardef \ordcomma "0"0"2C +\protected\def\smartcomma{% + \futurelet\smartcomma:next\smartcomma:do} +\def\smartcomma:do{\let\smartcomma:c\comma + \ifx0\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx1\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx2\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx3\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx4\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx5\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx6\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx7\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx8\smartcomma:next\let\smartcomma:c\ordcomma\fi + \ifx9\smartcomma:next\let\smartcomma:c\ordcomma\fi + \smartcomma:c} + \protected\def\decimalcomma {\Umathcode`\, = 0 \Umathcharfam`\, `\,} \protected\def\nodecimalcomma{\Umathcode`\, = 6 \Umathcharfam`\, `\,} +\protected\def\smartdecimalcomma{\mathlet,\smartcomma} + % set the colon to how it used to be \Umathcode`\:="3"0"2236 % \ratio @@ -439,13 +457,18 @@ \def\norm#1{\left\vert#1\right\vert} \let \abs=\norm \def\Norm#1{\left\Vert#1\right\Vert} -% a smaller inverse-function sign -\protected\def\inv{^{\scriptscriptstyle - \mathbin{\setbox0=\hbox{$\scriptscriptstyle-$} - \kern.75\wd0 \pdfextension save +% a slightly smaller unary minus +\def\unaryminus{\mathord{\mathpalette\unaryminus:make{}}} +\def\unaryminus:make#1#2{% + \setbox0 = \hbox{$#1-$} + \kern .75\wd0 + \pdfextension save \pdfextension setmatrix{.75 0 0 1} - \kern-\wd0\box0 \pdfextension restore} - \mkern-2mu 1}} + \kern -\wd0 \box0 + \pdfextension restore} + +% a smaller inverse-function sign +\protected\def\inv{^{\scriptscriptstyle\unaryminus1}}% % upright multiletter symbols \def\mord#1{\mathord{\mathstyle{up}#1}} @@ -504,6 +527,48 @@ \newmathop {End} \newmathop {Aut} \newmathop {Dom} \newmathop {Codom} +% 1 Displayed equations + +\newif\ifdisplay: +\newif\ifdisplay:nr +\newif\ifleftdisplays +\newtoks\setdisplaynr +\newtoks\display:specialnr +\display:specialnr{\the\setdisplaynr} + +% \display +\protected\def\display{\display:true} +% \displaynr {nr} +\protected\def\displaynr{\display:true\display:nrtrue + \nextifcat\bgroup\display:specialnr\relax} + +% \[ ... \] +\protected\def\[{\ifdisplay:\expandafter\startdisplay\else\Ustartmath\fi} +\protected\def\]{\global\expandafter\display:false + \ifdisplay:\expandafter\stopdisplay\else\Ustopmath\fi} + +\protected\def\startdisplay{% + % if the display starts a paragraph, omit baselineskip + % and ensure that the long \beforedisplayskip is used + \ifvmode \nointerlineskip + \noindent \hbox to .5\hsize{\hss}\fi + \Ustartdisplaymath + % for left-aligned equations, force manual placement + \ifleftdisplays\muskip0mu\fi} +\protected\def\stopdisplay{% + \ifleftdisplays + \hskip\displaywidth minus\displaywidth\fi + \global\expandafter\display:nrfalse + \ifdisplay:nr + \eqno\the\display:specialnr + \global\display:specialnr{\the\setdisplay:nr}\fi + \Ustopdisplaymath + \ignorespaces} + +% default equation numbering +\newcount\equationnumber \equationnumber = 0 +\setdisplaynr{\global\advance\eqnr1(\the\equationnumber)} + % standard mappings diff --git a/Master/texmf-dist/tex/luatex/minim-mp/minim-mp.lua b/Master/texmf-dist/tex/luatex/minim-mp/minim-mp.lua index 366313e60ba..a247c494992 100644 --- a/Master/texmf-dist/tex/luatex/minim-mp/minim-mp.lua +++ b/Master/texmf-dist/tex/luatex/minim-mp/minim-mp.lua @@ -58,12 +58,12 @@ function A.save(append) stroke = st.stroke, fill = st.fill } - append:node(node.new(8, 30)) -- q + append:node(node.new('whatsit', 'pdf_save')) -- q end function A.restore(append) append.state[#append.state] = nil - append:node(node.new(8, 31)) -- Q + append:node(node.new('whatsit', 'pdf_restore')) -- Q end -- The following callback is executed just before the final step of surrounding @@ -138,7 +138,7 @@ function A.printobj(append, obj) if obj.pen then local x = obj.pen.type or 'not elliptical' append:literal('%% pen: see below, form: %s', x) - local x = mplib.pen_info(obj) + x = mplib.pen_info(obj) append:literal('%% | width: %s', tostring(x.width)) append:literal('%% | sx: %s', tostring(x.sx)) append:literal('%% | sy: %s', tostring(x.sy)) @@ -197,7 +197,7 @@ local function curve_fmt(...) end function A.literal(append, fmt, ...) - local lit = node.new(8,16) -- pdf_literal + local lit = node.new('whatsit', 'pdf_literal') lit.data = fmt:format(...) append:node(lit) end @@ -484,9 +484,9 @@ M.postscripts = postscripts --2 choosing a parser -local function split_specials(specials) - if not specials then return function() return end end - local l = specials:explode('\r') +local function split_specials(thespecials) + if not thespecials then return function() return end end + local l = thespecials:explode('\r') local i, n = 0, #l return function() if i < n then i = i + 1 else return end @@ -627,7 +627,7 @@ end postscripts.pdfcomment = prescripts.pdfcomment prescripts.latelua = function(append, str, object) - local n = node.new(8,7) -- late_lua + local n = node.new('whatsit', 'late_lua') n.data = str append:node(n) end @@ -637,7 +637,7 @@ prescripts.OTYPE = function(append, str, object) append.object_info.otype = append.object_info.otype or str end -specials.BASELINE = function(append, str, object) +specials.BASELINE = function(append, _, object) -- object is a ‘fill’ statement with only a single point in its path (and -- will thus not have to be transformed). append.baseline = object.path[1].y_coord @@ -684,8 +684,8 @@ local function make_pattern_xform(head, bb) return string.format(' /Resources << /XObject << /PTempl %d 0 R >> >>', xform), '/PTempl Do' end -local function definepattern(head, user, bb) - local bb = bbox_fmt(table.unpack(bb)) +local function definepattern(head, user, bbox) + local bb = bbox_fmt(table.unpack(bbox)) local pat, literals, resources = { write = write_pattern_object }, { } -- pattern content for n in node.traverse(head) do @@ -755,9 +755,9 @@ local function make_surrounding_box(nd_id, head) end local function wrap_picture(head, tx, ty) - local horizontal = make_surrounding_box(0, head) - local vertical = make_surrounding_box(1, horizontal) - local outer = make_surrounding_box(0, vertical) + local horizontal = make_surrounding_box('hlist', head) + local vertical = make_surrounding_box('vlist', horizontal) + local outer = make_surrounding_box('hlist', vertical) vertical.shift = tex.sp('-'..ty..'bp') horizontal.shift = tex.sp(''..tx..'bp') return outer @@ -765,7 +765,7 @@ end local function apply_transform(rect, box) local sx, rx, ry, sy, tx, ty = get_transform(rect) - local transform = node.new(8,29) -- pdf_setmatrix + local transform = node.new('whatsit', 'pdf_setmatrix') transform.next, box.prev = box, transform transform.data = string.format('%f %f %f %f', sx, rx, ry, sy) return wrap_picture(transform, tx, ty) @@ -780,14 +780,14 @@ function A.box(append, object, box) append:restore() end -specials.TEXBOX = function(append, box, object) - local box = tex.getbox(tonumber(box)) +specials.TEXBOX = function(append, boxnr, object) + local box = tex.getbox(tonumber(boxnr)) append:box(object, node.copy_list(box)) end specials.CHAR = function(append, data, object) local char, font, xo, yo = table.unpack(data:explode(' ')) - local n = node.new(29) -- glyph + local n = node.new('glyph') n.char, n.font, n.xoffset, n.yoffset = tonumber(char), tonumber(font), tonumber(xo), tonumber(yo) append:box(object, node.hpack(n)) @@ -849,7 +849,7 @@ local function print_log (nr, res, why) -- write out the log log('┌ %smetapost instance %s (%d)', why or '', i.jobname, i.nr) for _,line in ipairs(report) do - log('│ '..line) + log('│ %s', line) end log('└ %s', print_status(res.status)) -- generate error or warning if needed @@ -1198,9 +1198,9 @@ function M.close (nr) local res = i.instance:finish() print_log(nr, res, 'closing ') end - for _, nr in ipairs(i.boxes) do + for _, b in ipairs(i.boxes) do -- remove allocated boxes - tex.box[nr] = nil + tex.box[b] = nil end instances[nr] = false end @@ -1216,6 +1216,7 @@ local function retrieve(nr, name) else image = results.first end + if not image then return end results.count = results.count - 1 if image.prev then if image.next then @@ -1251,7 +1252,7 @@ function M.get_image(nr, name) end function M.shipout(nr) - local ox, oy = pdf.getorigin + local ox, oy = pdf.getorigin() local ho, vo = tex.hoffset, tex.voffset pdf.setorigin() tex.hoffset = 0 @@ -1280,7 +1281,8 @@ alloc.luadef('runmetapost', function() end, 'protected') alloc.luadef('runmetapostimage', function() local i = scan_int() - M.run(i, 'beginfig(0); '..scan_string()..' endfig;') + local code = 'beginfig(0)'..scan_string()..';endfig;' + M.run(i, code) node.write(M.get_image(i)) end, 'protected') diff --git a/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.lua b/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.lua index 96725523d29..72070366d3c 100644 --- a/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.lua +++ b/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.lua @@ -1,5 +1,5 @@ -local M = { } +local M = { } local alloc = require('minim-alloc') local cb = require('minim-callbacks') alloc.remember('minim-hooks') @@ -56,7 +56,7 @@ local function full_traverse(head) end local function pdf_err(n, msg) - local m = node.new(8,16) -- pdf_literal + local m = node.new('whatsit', 'pdf_literal') m.mode, m.token = 2, '%% Warning: '..msg node.insert_after(n, n, m) end @@ -95,7 +95,7 @@ end local marker_whatsit = alloc.new_whatsit('tagged pdf marker') local function make_whatsit(t, se, order) - local n = node.new(8, 8); -- user_defined + local n = node.new('whatsit', 'user_defined'); n.user_id, n.type = marker_whatsit, 108 n[current_struct] = se or tex.attribute['tagging:current:se'] n[current_order] = order or tex.attribute['tagging:element:order'] @@ -247,7 +247,7 @@ end, 'protected') local function stable_sort_on_order_field(unsorted) -- n.b. ‘unsorted’ is likely to closely resemble two concatenated -- monotonously increasing lists. - local sorted, oldsorted = { unsorted[1] }, nil + local sorted, oldsorted = { unsorted[1] } local i, next, c = 2, unsorted[2], nil while next do oldsorted, sorted = sorted, { } @@ -336,6 +336,7 @@ local function write_structure() if #structure == 1 then return end -- reserve object numbers, prepare for writing local root_obj, parent_tree_obj = pdf.reserveobj(), pdf.reserveobj() + local id_tree, id_tree_obj = { }, pdf.reserveobj() structure[1].parent = { objnum = root_obj } for _, se in ipairs(structure) do if not se.hidden then se.objnum = pdf.reserveobj() end @@ -345,13 +346,14 @@ local function write_structure() add_to_catalog('/StructTreeRoot %s 0 R', root_obj) -- write the structure tree root pdf.immediateobj(root_obj, string.format( - '<< /Type/StructTreeRoot /K %d 0 R /ParentTree %d 0 R%s%s >>', - structure[1].objnum, parent_tree_obj, make_rolemap(), make_classmap())) + '<< /Type/StructTreeRoot /K %d 0 R /ParentTree %d 0 R /IDTree %d 0 R%s%s >>', + structure[1].objnum, parent_tree_obj, id_tree_obj, make_rolemap(), make_classmap())) -- write structure elements for _, se in ipairs(structure) do if not se.hidden then local res = { '<<' } insert_formatted(res, '/Type/StructElem /S%s /P %d 0 R', pdf_name(se.struct), se.parent.objnum) + if se.id then id_tree[se.id] = se.objnum; insert_formatted(res, '/ID %s', pdf_string(se.id)) end if se.lang and se.lang ~= se.parent.lang then insert_formatted(res, '/Lang (%s)', se.lang) end if se.alt then insert_formatted(res, '/Alt %s', pdf_string(se.alt)) end if se.actual then insert_formatted(res, '/ActualText %s', pdf_string(se.actual)) end @@ -380,7 +382,7 @@ local function write_structure() pdf.immediateobj(se.objnum, table.concat(res, ' ')) end end - -- write the parent tree + -- write the parent tree (a number tree) local res = { '<< /Nums [' } for i, parents in ipairs(parent_tree) do -- i, parents = StructParents index + 1, list of structure elems @@ -398,6 +400,19 @@ local function write_structure() end table.insert(res, '] >>') pdf.immediateobj(parent_tree_obj, table.concat(res, '\n')) + -- write the id tree (a name tree) + local ids = { } + for k, _ in pairs(id_tree) do + -- luatex uses the C locale, + table.insert(ids, k) + end + table.sort(ids) + res = { '<< /Names ['} + for _, id in ipairs(ids) do + insert_formatted(res, '%s %d 0 R', pdf_string(id), id_tree[id]) + end + table.insert(res, '] >>') + pdf.immediateobj(id_tree_obj, table.concat(res, '\n')) end -- 1 languages @@ -466,7 +481,7 @@ end function M.close_structure_node(stype, raiseerror) local strict = tex.count['strictstructuretagging'] > 0 - local current, open = current_structure_element(), false + local current, open = current_structure_element() if strict then open = current.struct == stype and current.parent else @@ -490,42 +505,45 @@ alloc.luadef('tagging:ensurestopelement', function() end, 'protected') function M.open_structure_node(n) + -- retrieve defaults for the structure type local info = structure_types[n.struct] if not info then alloc.err('Unknown structure type %s replaced with NonStruct', n.struct) n.struct, info = 'NonStruct', structure_types.NonStruct end info.inuse = true + -- attributes: set default from se info + n.attributes = n.attr or { }; n.attr = nil if info.attributes then - n.attributes = n.attr or { } - for k1,v1 in pairs(info.attributes) do - n.attributes[k1] = n.attributes[k1] or { } - for k2, v2 in pairs(v1) do - n.attributes[k1][k2] = n.attributes[k1][k2] or v2 + for o,kv in pairs(info.attributes) do + n.attributes[o] = n.attributes[o] or { } + for k, v in pairs(kv) do + n.attributes[o][k] = n.attributes[o][k] or v end end - else - n.attributes = n.attr end + -- bookkeeping: order and parent can be forced (needed for asynchronous elements) n.index = #structure + 1 n.children = { } - -- order and parent can be forced (needed for asynchronous elements) n.order = n.order or tex.getattribute(current_order) n.parent = (n.parent and structure[n.parent]) or determine_parent_node(current_structure_element(), n) table.insert(structure, n) + -- determine the proper language code if n.lang then - n.lang = get_language_code(n.lang) + n.lang = M.get_language_code(n.lang) else local lang = tex.getattribute(current_lang) n.lang = language_codes[lang] end + -- hacks for out-of-sync elements if not n.hidden then table.insert(n.parent.children, n) end if not n.async then tex.setattribute(current_struct, #structure) end end alloc.luadef('tagging:startelement', function() local s = options_scanner() + :string('id') :string('type') -- 'section', 'group', 'block' etc. :argument('alt') :argument('actual') @@ -545,11 +563,35 @@ alloc.luadef('tagging:actual', function() current_structure_element().actual = token.scan_string() end) +local function add_attribute(se, o, k, v) + se.attributes = se.attributes or { } + se.attributes[o] = se.attributes[o] or { } + se.attributes[o][k] = v +end + +alloc.luadef('tagging:attribute', function() + add_attribute(current_structure_element(), + token.scan_string(), token.scan_string(), token.scan_string()) +end) + alloc.luadef('newattributeclass', function() local s = options_scanner():subtable('attr') attribute_classes[token.scan_string()] = s:scan().attr end, 'protected') +alloc.luadef('tagging:tagid', function() + current_structure_element().id = token.scan_string() +end) + +alloc.luadef('tagging:getshowstructure', function() + local e, lst = current_structure_element(), { string.format ('%d', + tex.attribute[current_struct]) } + while e do + table.insert(lst, string.format('%s (%d)', e.struct, e.index)) + e = e.parent + end + tex.toks['tagging:showtoks'] = table.concat(lst, ' < ') +end, 'protected') -- 1 marking content items @@ -583,13 +625,13 @@ end clear_page_tagging_parameters() local function new_open_mci_node(se, order) - local n = node.new(8,7) -- late_lua + local n = node.new('whatsit', 'late_lua') n.token = string.format('_open_mci_node_(%d, %d)', se, order) return n end local function pdf_literal(token) - local n = node.new(8,16) -- pdf_literal + local n = node.new('whatsit', 'pdf_literal') n.mode, n.token = 1, token return n end @@ -613,7 +655,7 @@ end) function M.mark_content_items(box) local se, order, art, open local start_node, end_node, parent_node - local pageobj = pdf.getpageref(status.total_pages + 1) + local lastpageobj = pdf.getpageref(status.total_pages + 1) -- helper functions for inserting mci markers local insert_tags = function(end_parent) if not open then return end @@ -639,7 +681,7 @@ function M.mark_content_items(box) elseif marker and marker.what == 'art_stop' then end_node = n insert_tags(b); - open_artifacts[art], art = nil, nil + if art then open_artifacts[art], art = nil, nil end elseif stat and stat >10 and stat ~=art then -- broken artifact insert_tags(b); start_content(n, b) @@ -657,7 +699,7 @@ function M.mark_content_items(box) local _se, _order = n[current_struct], n[current_order] local link = structure[_se] if link.struct == 'Link' then - table.insert(link.children, { objnum = n.objnum, order = _order, pageobj = pageobj }) + table.insert(link.children, { objnum = n.objnum, order = _order, lastpageobj = lastpageobj }) n.link_attr = string.format('%s /StructParent %d', n.link_attr, #parent_tree) table.insert(parent_tree, _se) else @@ -859,7 +901,7 @@ alloc.luadef('embedfile', function() :keyword('uncompressed') :scan() if not t.name then - t.name = t.file or aloc.err('No name specified for embedded file stream') + t.name = t.file or alloc.err('No name specified for embedded file stream') end t.name = pdf_string(t.name or '(unnamed)') local fs, ef = M.embed_file(t, t.global) @@ -891,7 +933,7 @@ function M.mark_discretionaries(head, gc) table.insert(actual, c.char) end -- special case: a single hyphen - if #actual == 0 and pre.char and pre.char == 0x2D then + if #actual == 0 and pre and pre.char and pre.char == 0x2D then actual = '' -- soft hyphen U+00AD elseif #actual > 0 then actual = string.utfcharacter(table.unpack(actual)) @@ -903,7 +945,7 @@ function M.mark_discretionaries(head, gc) struct = 'Span', parent = se, order = order, actual = actual } -- apply the new se to pre and post for n, _ in full_traverse(pre) do n[current_struct] = #structure end - for n, _ in full_traverse(past) do n[current_struct] = #structure end + for n, _ in full_traverse(post) do n[current_struct] = #structure end end ::continue:: end @@ -930,7 +972,7 @@ function M.mark_spaces(head, gc) end local function create_space(n) - local s = node.new(29) -- glyph + local s = node.new('glyph') s.char, s.font, s.attr = 0x20, n[space_attr], n.attr local b = node.hpack(s) b.width, b.height, b.depth = 0, 0, 0 diff --git a/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.tex b/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.tex index 630c374d412..a8fe5aeea6e 100644 --- a/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.tex +++ b/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.tex @@ -118,6 +118,19 @@ \protected\def\setactualtext{\iftagging:enabled \expandafter\tagging:actual\fi} +% \tagattribute Owner Key /verbatim_value +\protected\def\tagattribute{\iftagging:enabled + \expandafter\tagging:attribute\fi} + +% \settagid {name} +\protected\def\settagid{\iftagging:enabled + \expandafter\tagging:tagid\fi} + +% \showstructure +\newtoks\tagging:showtoks +\protected\def\showstructure{% + \tagging:getshowstructure + \showthe\tagging:showtoks} % 1 auto-marking paragraphs @@ -131,21 +144,9 @@ \startelement{\the\nextpartag}\fi \nextpartag{P}\fi \fi} -% 1 tagging helper macros - -% \marktocentry {destination}{label}{title}{filler}{page} -\def\marktocentry#1#2#3#4#5{% - \ifx\marktocentry#1\marktocentry - \def\marktocentry:link##1{##1}\else - \def\marktocentry:link##1{\hyperlink dest{#1}##1\endlink}\fi - \markelement{TOCI}{\nextpartag{}\quitvmode - \ifx\marktocentry#2\marktocentry\else - \markelement{Lbl}{\marktocentry:link{#2}}\fi - \markelement{Reference}{\marktocentry:link{#3% - \ifx\marktocentry#4\marktocentry\else - \markartifact{Layout}{#4}\fi#5}}}} +% 1 tagging tables -% \marktable \halign {\marktablerow#&\marktablecell#\cr +% \marktable \halign {\marktablerow\marktablecell#&\marktablecell#\cr % \marktableheader % Header & cells \cr % \marktablebody @@ -153,30 +154,57 @@ % \marktablefooter % ... & ... \cr ... } % +% lots of variables and constants +\newcount\tagging:tablec +\newcount\tagging:tablerow +\newcount\tagging:tablecol +\newcount\tagging:tablecolspan \tagging:tablecolspan 1 +\newcount\tagging:tablerowspan \tagging:tablerowspan 1 +\newcount\tagging:i +\def\tagging:TH{TH} +\def\tagging:TD{TD} +% initialising variables \def\marktable{\startelement{Table}% - \def\tagging:cell{TD}} + \global\advance\tagging:tablec1 + \global\tagging:tablerow0 + \global\tagging:tablecol0 + \global\def\tagging:tablecolheaders{}% + \global\def\tagging:tablerowheaders{}% + \global\let\tagging:cell\tagging:TD} +% the header \def\marktableheader{% - \noalign{\gdef\tagging:cell{TH}% + \noalign{\global\let\tagging:cell\tagging:TH \startelement{THead}% \savecurrentelementto\tagging:tpart}} +% the body \def\marktablebody{% - \noalign{\gdef\tagging:cell{TD}% + \noalign{\global\let\tagging:cell\tagging:TD \startelement{TBody}% \savecurrentelementto\tagging:tpart}} +% the footer \def\marktablefooter{% \noalign{\startelement{TFoot}% \savecurrentelementto\tagging:tpart}} -\def\marktablerow{ +% rows +\def\marktablerow{% + \global\advance\tagging:tablerow1 + \global\tagging:tablecol0 \unless\ifdefined\tagging:tpart \startelement{TBody}% \savecurrentelementto\tagging:tpart\fi \continueelementfrom\tagging:tpart \startelement{TR}% - \savecurrentelementto\tagging:row - \startelement{\tagging:cell}} + \savecurrentelementto\tagging:row} +% cells \def\marktablecell{% + \global\advance\tagging:tablecol1 \continueelementfrom\tagging:row - \startelement{\tagging:cell}} + \startelement{\tagging:cell}% + \tagging:assignheaders} +% table headers +\def\tagging:assignheaders{% + % TODO + } % \automarktable \halign ... { ... } \def\automarktable#1#{\marktable @@ -184,7 +212,7 @@ \afterassignment\tagging:table \let\tagging:tmp= } \def\tagging:mktrow#1#2\cr{\iftrue - \tagging:mktcell{#1\bgroup\marktablerow#2}\fi + \tagging:mktcell{#1\bgroup\marktablerow\marktablecell#2}\fi #3&\tagging:mktrow&\cr} \def\tagging:mktcell#1#2\fi#3&{\fi \ifx\tagging:mktrow#3\tagging:mkthdr{#1}\fi @@ -193,7 +221,8 @@ \tagging:mktcell{#1&\marktablecell#3}\fi} \def\tagging:mkthdr#1#2\cr#3\cr{\fi#1\cr \marktableheader#3\cr\marktablebody} -\def\tagging:fi{\fi} + +% 1 tagging helper macros % \marktableaslist \halign ... { ... } \def\marktableaslist#1#{\startelement{L}% @@ -201,9 +230,23 @@ \afterassignment\tagging:table \let\tagging:tmp= } \def\tagging:mktlist#1#2&{#1\bgroup - \startelement{LI}\savecurrentelement - \startelement{Lbl}#2&\continueelement - \startelement{LBody}} + \startelement{LI}\savecurrentelementto\tagging:li + \startelement{Lbl}#2&\continueelementfrom\tagging:li + \startelement{LBody}\savecurrentelementto\tagging:lbody} + +% \marktocentry {destination}{label}{title}{filler}{page} +\def\marktocentry#1#2#3#4#5{% + \ifx\marktocentry#1\marktocentry + \def\marktocentry:link##1{##1}\else + \def\marktocentry:link##1{\hyperlink dest{#1}##1\endlink}\fi + \markelement{TOCI}{\nextpartag{}\quitvmode + \ifx\marktocentry#2\marktocentry\else + \markelement{Lbl}{\marktocentry:link{#2}}\fi + \markelement{Reference}{\marktocentry:link{#3% + \ifx\marktocentry#4\marktocentry\else + \markartifact{Layout}{#4}\fi#5}}}} + +% 1 tagging formulas % \autotagformulas % \stopformulatagging ... \startformulatagging @@ -339,6 +382,7 @@ \minim:default:rgb:profile \if#2A\writedocumentstructure1\fi \input minim-xmp + \pdfvariable omitcidset 1 \setmetadata pdfaid:conformance{#2}% \setmetadata pdfaid:part{#3}} diff --git a/Master/texmf-dist/tex/luatex/minim-xmp/minim-xmp.lua b/Master/texmf-dist/tex/luatex/minim-xmp/minim-xmp.lua index 95275aef358..d6867a4c9bf 100644 --- a/Master/texmf-dist/tex/luatex/minim-xmp/minim-xmp.lua +++ b/Master/texmf-dist/tex/luatex/minim-xmp/minim-xmp.lua @@ -1,5 +1,5 @@ -local M = { } +local M = { } local alloc = require('minim-alloc') alloc.remember('minim-xmp') local cb = require('minim-callbacks') @@ -82,14 +82,14 @@ function M.add_valuetype(prefix, name, t) for n, f in pairs(t.fields) do fields[n] = { type = f.type or f[1], description = f.description or f[2] } end - M.getters[name] = function(t, k) + M.getters[name] = function(tt, k) if k then return (fields[k] or alloc.err('Unknown field ‘%s’', k)) - and t and t[k] or 'not found' + and tt and tt[k] or 'not found' else local res = { } - for k, v in sorted_pairs(t) do - table.insert(res, string.format('/{%s} {%s}', k, v)) + for kk, v in sorted_pairs(tt) do + table.insert(res, string.format('/{%s} {%s}', kk, v)) end return table.concat(res, ' ') end @@ -302,9 +302,9 @@ local function get_metadata_extensions() add(' <pdfaType:description>%s</pdfaType:description>', vtype.description) if vtype.fields then add(' <pdfaType:field>\n <rdf:Seq>') - for name, field in sorted_pairs(vtype.fields) do + for fname, field in sorted_pairs(vtype.fields) do add(' <rdf:li rdf:parseType="Resource">') - add(' <pdfaField:name>%s</pdfaField:name>', name) + add(' <pdfaField:name>%s</pdfaField:name>', fname) add(' <pdfaField:valueType>%s</pdfaField:valueType>', field.type) add(' <pdfaField:description>%s</pdfaField:description>', field.description) add(' </rdf:li>') diff --git a/Master/texmf-dist/tex/luatex/minim/minim-alloc.lua b/Master/texmf-dist/tex/luatex/minim/minim-alloc.lua index 8f6a69ed0d5..3775aafa437 100644 --- a/Master/texmf-dist/tex/luatex/minim/minim-alloc.lua +++ b/Master/texmf-dist/tex/luatex/minim/minim-alloc.lua @@ -50,8 +50,8 @@ local function pdf_hex_string(text) insert_formatted(str, '%04x', i) else i = i - 0x10000 - m = math.floor(i/0x400) + 0xd800 - n = ( i % 0x400 ) + 0xdc00 + local m = math.floor(i/0x400) + 0xd800 + local n = ( i % 0x400 ) + 0xdc00 insert_formatted(str, '%04x%04x', m, n) end end @@ -177,7 +177,7 @@ end function M.table_to_text (tbl) local r = { } for i,t in pairs(tbl) do - local l = '' + local l if type(i) == 'string' then l = string.format('[%q] = ', i) else @@ -282,7 +282,7 @@ M.luadef('minim:currentfile', function() end) -- make pdf_string() available as \pdfstring{...} -M.luadef('pdfstring', function() M.pdf_string(token.scan_string()) end) +M.luadef('pdfstring', function() tex.sprint(M.pdf_string(token.scan_string())) end) -- uselanguage hook callback cb.new_callback('uselanguage', 'simple') @@ -291,6 +291,12 @@ M.luadef('minim:uselanguagecallback', function() cb.call_callback('uselanguage', langname) end) +-- copy of \Ucharcat from xetex +M.luadef('Ucharcat', function() + local chr, cat = token.scan_int(), token.scan_int() + token.put_next(token.new(chr, cat)) +end) + --1 dumping information to the format file -- reserve a bytecode register @@ -302,7 +308,7 @@ token.set_macro('minim:restoremodules', '\\luabytecodecall'..saved_tables_byteco local function dump_saved_tables() M.msg('pre_dump: save modules and tables to format file') -- save modules - for i,name in ipairs (modules) do + for _, name in ipairs (modules) do if not modules[name] then M.msg('saving module '..name) -- reserve (if necessary) a bytecode register @@ -313,7 +319,7 @@ local function dump_saved_tables() end -- save tables (and restore modules) local saved_tables = [[ - + -- include all saved tables in this bytecode register local t = ]]..M.table_to_text(tables)..[[ diff --git a/Master/texmf-dist/tex/luatex/minim/minim-alloc.tex b/Master/texmf-dist/tex/luatex/minim/minim-alloc.tex index 8752c2e3362..4110301413e 100644 --- a/Master/texmf-dist/tex/luatex/minim/minim-alloc.tex +++ b/Master/texmf-dist/tex/luatex/minim/minim-alloc.tex @@ -10,6 +10,21 @@ \suppressoutererror = 1 \frenchspacing +% unicode space characters +\def\hairspace{\kern .1em } +\def\threeperemspace{\kern .33333em } +\def\fourperemspace {\kern .25em } +\catcode"00A0 = \active \letcharcode"00A0 = ~ % no-break +\catcode"2002 = \active \letcharcode"2002 = \enskip +\catcode"2003 = \active \letcharcode"2003 = \quad +\catcode"2004 = \active \letcharcode"2004 = \threeperemspace +\catcode"2005 = \active \letcharcode"2005 = \fourperemspace +\catcode"2006 = \active \letcharcode"2006 = \thinspace % six-per-em +\catcode"2008 = \active \letcharcode"2008 = \thinspace % punctuation +\catcode"2009 = \active \letcharcode"2009 = \thinspace % thin +\catcode"200A = \active \letcharcode"200A = \hairspace % hair +\catcode"202F = \active \letcharcode"202F = \thinspace % narrow no-break + % 1 programming macros \newbox\voidbox \setbox0=\box\voidbox diff --git a/Master/texmf-dist/tex/luatex/minim/minim-callbacks.lua b/Master/texmf-dist/tex/luatex/minim/minim-callbacks.lua index af3db59e243..b0ecc1a711e 100644 --- a/Master/texmf-dist/tex/luatex/minim/minim-callbacks.lua +++ b/Master/texmf-dist/tex/luatex/minim/minim-callbacks.lua @@ -217,7 +217,7 @@ end -- TODO: preserve return values local primitively_registered = { } function M.primitiveregister(cb, f) - local rv = false + local rv, _ if f == nil then f = primitively_registered[cb] if f == nil then @@ -307,7 +307,6 @@ for n,f in pairs(primitively_registered) do do_log('restore callback: %s', n) M.primitiveregister (n,f) end -saved = nil -- @@ -317,7 +316,7 @@ callback.list = M.list callback.register = M.primitiveregister log = do_log -local function alog(msg, ...) +alog = function(msg, ...) texio.write('log', string.format(msg, ...)) end diff --git a/Master/texmf-dist/tex/luatex/minim/minim-doc.sty b/Master/texmf-dist/tex/luatex/minim/minim-doc.sty index 93e770153b4..5da6494c5e2 100644 --- a/Master/texmf-dist/tex/luatex/minim/minim-doc.sty +++ b/Master/texmf-dist/tex/luatex/minim/minim-doc.sty @@ -178,6 +178,7 @@ endfig;} \autotagformulas +\def\mailname{minim} \def\maketitle{% \setembeddedfilesmoddate {\getmetadata date} \begingroup @@ -189,7 +190,7 @@ endfig;} \qquad##\quad&##\hfil\cr author&\getmetadata author\cr contact&{\def\tmp{@}\def\TMP{.}% - minim\tmp elrenkema\TMP nl}\cr} + \mailname\tmp elrenkema\TMP nl}\cr} \smallskip} % 1 Chapters and full manuals diff --git a/Master/texmf-dist/tex/luatex/minim/minim-pdfresources.lua b/Master/texmf-dist/tex/luatex/minim/minim-pdfresources.lua index bc09aeaf401..e6a06e783e1 100644 --- a/Master/texmf-dist/tex/luatex/minim/minim-pdfresources.lua +++ b/Master/texmf-dist/tex/luatex/minim/minim-pdfresources.lua @@ -73,7 +73,7 @@ if not M.self_destruct then pdf.add_page_resource = M.add_global_resource end --- for nonglobal resources, every use must be markes with a late_lua node. from +-- for nonglobal resources, every use must be marked with a late_lua node. from -- those, the M.use_resouce() function will be called automatically. -- local page_resources = init_resources() -- name ↦ '/Key <value>' |