texlive[66396] branches/branch2022.final/Master/texmf-dist: minim
commits+karl at tug.org
commits+karl at tug.org
Mon Mar 6 22:40:36 CET 2023
Revision: 66396
http://tug.org/svn/texlive?view=revision&revision=66396
Author: karl
Date: 2023-03-06 22:40:36 +0100 (Mon, 06 Mar 2023)
Log Message:
-----------
minim (all) (6mar23) (branch)
Modified Paths:
--------------
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/README
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim-alloc.doc
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim.doc
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim.pdf
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/README
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/minim-math.doc
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/minim-math.pdf
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/README
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.doc
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.pdf
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/README
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.doc
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.pdf
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/README
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.doc
branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.pdf
branches/branch2022.final/Master/texmf-dist/metapost/minim-mp/minim.mp
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-alloc.lua
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-alloc.tex
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-callbacks.lua
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-doc.sty
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-pdfresources.lua
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-math/minim-math.lua
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-math/minim-math.tex
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-mp/minim-mp.lua
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.lua
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.tex
branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-xmp/minim-xmp.lua
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/README
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/README 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/README 2023-03-06 21:40:36 UTC (rev 66396)
@@ -1,4 +1,4 @@
-Version: 2022/1.1
+Version: 2023/1.2
SUMMARY
@@ -31,6 +31,12 @@
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:
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim-alloc.doc
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim-alloc.doc 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim-alloc.doc 2023-03-06 21:40:36 UTC (rev 66396)
@@ -233,7 +233,7 @@
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}⟧
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim.doc
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim.doc 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim.doc 2023-03-06 21:40:36 UTC (rev 66396)
@@ -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
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim/minim.pdf
===================================================================
(Binary files differ)
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/README
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/README 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/README 2023-03-06 21:40:36 UTC (rev 66396)
@@ -1,4 +1,4 @@
-Version: 2022/1.1
+Version: 2023/1.2
SUMMARY
@@ -18,6 +18,13 @@
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:
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/minim-math.doc
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/minim-math.doc 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/minim-math.doc 2023-03-06 21:40:36 UTC (rev 66396)
@@ -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 @@
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,7 +211,21 @@
⟦$$\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
The following remarks on mathematical typesetting have no relation to the
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-math/minim-math.pdf
===================================================================
(Binary files differ)
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/README
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/README 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/README 2023-03-06 21:40:36 UTC (rev 66396)
@@ -1,4 +1,4 @@
-Version: 2022/1.1
+Version: 2023/1.2
SUMMARY
@@ -19,6 +19,11 @@
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:
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.doc
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.doc 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.doc 2023-03-06 21:40:36 UTC (rev 66396)
@@ -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 @@
⟦*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
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-mp/minim-mp.pdf
===================================================================
(Binary files differ)
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/README
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/README 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/README 2023-03-06 21:40:36 UTC (rev 66396)
@@ -1,4 +1,4 @@
-Version: 2022/1.1
+Version: 2023/1.2
SUMMARY
@@ -27,6 +27,17 @@
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:
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.doc
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.doc 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.doc 2023-03-06 21:40:36 UTC (rev 66396)
@@ -14,8 +14,8 @@
\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 @@
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 @@
\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 @@
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⟧.
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-pdf/minim-pdf.pdf
===================================================================
(Binary files differ)
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/README
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/README 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/README 2023-03-06 21:40:36 UTC (rev 66396)
@@ -1,4 +1,4 @@
-Version: 2022/1.1
+Version: 2023/1.2
SUMMARY
@@ -21,6 +21,10 @@
HISTORY
+2023/1.2 (3/3/2022)
+
+ No new features.
+
2022/1.1 (3/3/2022)
New features:
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.doc
===================================================================
--- branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.doc 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.doc 2023-03-06 21:40:36 UTC (rev 66396)
@@ -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
Modified: branches/branch2022.final/Master/texmf-dist/doc/luatex/minim-xmp/minim-xmp.pdf
===================================================================
(Binary files differ)
Modified: branches/branch2022.final/Master/texmf-dist/metapost/minim-mp/minim.mp
===================================================================
--- branches/branch2022.final/Master/texmf-dist/metapost/minim-mp/minim.mp 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/metapost/minim-mp/minim.mp 2023-03-06 21:40:36 UTC (rev 66396)
@@ -1,6 +1,8 @@
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;
@@ -7,8 +9,6 @@
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 @@
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 @@
% 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;
+
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-alloc.lua
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-alloc.lua 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-alloc.lua 2023-03-06 21:40:36 UTC (rev 66396)
@@ -50,8 +50,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
end
-- save tables (and restore modules)
local saved_tables = [[
-
+
-- include all saved tables in this bytecode register
local t = ]]..M.table_to_text(tables)..[[
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-alloc.tex
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-alloc.tex 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-alloc.tex 2023-03-06 21:40:36 UTC (rev 66396)
@@ -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
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-callbacks.lua
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-callbacks.lua 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-callbacks.lua 2023-03-06 21:40:36 UTC (rev 66396)
@@ -217,7 +217,7 @@
-- 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 @@
do_log('restore callback: %s', n)
M.primitiveregister (n,f)
end
-saved = nil
--
@@ -317,7 +316,7 @@
callback.register = M.primitiveregister
log = do_log
-local function alog(msg, ...)
+alog = function(msg, ...)
texio.write('log', string.format(msg, ...))
end
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-doc.sty
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-doc.sty 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-doc.sty 2023-03-06 21:40:36 UTC (rev 66396)
@@ -178,6 +178,7 @@
\autotagformulas
+\def\mailname{minim}
\def\maketitle{%
\setembeddedfilesmoddate {\getmetadata date}
\begingroup
@@ -189,7 +190,7 @@
\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
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-pdfresources.lua
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-pdfresources.lua 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim/minim-pdfresources.lua 2023-03-06 21:40:36 UTC (rev 66396)
@@ -73,7 +73,7 @@
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>'
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-math/minim-math.lua
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-math/minim-math.lua 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-math/minim-math.lua 2023-03-06 21:40:36 UTC (rev 66396)
@@ -365,8 +365,9 @@
-- 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 @@
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 function tex_accent(class, num, char)
- kind = kind or ''
return '\\math:'..accents[class]..'{'..num..'}'..char
end
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-math/minim-math.tex
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-math/minim-math.tex 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-math/minim-math.tex 2023-03-06 21:40:36 UTC (rev 66396)
@@ -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,9 +137,27 @@
% 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
\Umathchardef\colon "6"0"3A
@@ -439,14 +457,19 @@
\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}}
\def\mop #1{\mathop {\mathstyle{up}#1}\nolimits}
@@ -504,7 +527,49 @@
\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
\mathstyle{clear}
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-mp/minim-mp.lua
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-mp/minim-mp.lua 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-mp/minim-mp.lua 2023-03-06 21:40:36 UTC (rev 66396)
@@ -58,12 +58,12 @@
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 @@
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 @@
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 @@
--
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
-- 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 @@
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 @@
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 @@
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 @@
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')
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.lua
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.lua 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.lua 2023-03-06 21:40:36 UTC (rev 66396)
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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,6 +505,7 @@
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)
@@ -496,30 +512,31 @@
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
@@ -526,6 +543,7 @@
alloc.luadef('tagging:startelement', function()
local s = options_scanner()
+ :string('id')
:string('type') -- 'section', 'group', 'block' etc.
:argument('alt')
:argument('actual')
@@ -545,12 +563,36 @@
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
-- All content items should be explicitly opened and closed, per page, by the
@@ -583,13 +625,13 @@
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 @@
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 @@
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 @@
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 @@
: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 @@
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 @@
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 @@
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
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.tex
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.tex 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-pdf/minim-pdf.tex 2023-03-06 21:40:36 UTC (rev 66396)
@@ -118,7 +118,20 @@
\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
% \nextpartag {H}
@@ -131,21 +144,9 @@
\startelement{\the\nextpartag}\fi
\nextpartag{P}\fi \fi}
-%
1 tagging helper macros
+%
1 tagging tables
-% \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}}}}
-
-% \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,8 +221,9 @@
\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}%
\def\tagging:table{\tagging:mktlist{#1}}%
@@ -201,10 +230,24 @@
\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
% \formulafilename
@@ -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}}
Modified: branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-xmp/minim-xmp.lua
===================================================================
--- branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-xmp/minim-xmp.lua 2023-03-06 21:39:56 UTC (rev 66395)
+++ branches/branch2022.final/Master/texmf-dist/tex/luatex/minim-xmp/minim-xmp.lua 2023-03-06 21:40:36 UTC (rev 66396)
@@ -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 @@
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 @@
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>')
More information about the tex-live-commits
mailing list.