From 80c6e1a9d95b03212dfaf529e0266286828573e0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 28 Jan 2022 22:25:15 +0000 Subject: optex (28jan22) git-svn-id: svn://tug.org/texlive/trunk@61779 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/optex/base/basic-macros.opm | 2 +- Master/texmf-dist/tex/optex/base/doc.opm | 2 +- Master/texmf-dist/tex/optex/base/fnotes.opm | 5 +- Master/texmf-dist/tex/optex/base/fonts-select.opm | 5 +- Master/texmf-dist/tex/optex/base/hyperlinks.opm | 24 ++++--- Master/texmf-dist/tex/optex/base/languages.opm | 2 +- Master/texmf-dist/tex/optex/base/multicolumns.opm | 2 +- Master/texmf-dist/tex/optex/base/optex.ini | 2 +- Master/texmf-dist/tex/optex/base/optex.lua | 9 +++ Master/texmf-dist/tex/optex/base/others.opm | 80 ++++++++++++++++++++-- Master/texmf-dist/tex/optex/base/plain-macros.opm | 27 ++++++-- Master/texmf-dist/tex/optex/base/prefixed.opm | 10 +-- Master/texmf-dist/tex/optex/base/references.opm | 46 +++++++++---- Master/texmf-dist/tex/optex/base/sections.opm | 4 +- Master/texmf-dist/tex/optex/base/styles.opm | 4 +- Master/texmf-dist/tex/optex/base/unimath-codes.opm | 8 ++- Master/texmf-dist/tex/optex/base/verbatim.opm | 2 +- 17 files changed, 180 insertions(+), 54 deletions(-) (limited to 'Master/texmf-dist/tex/optex') diff --git a/Master/texmf-dist/tex/optex/base/basic-macros.opm b/Master/texmf-dist/tex/optex/base/basic-macros.opm index 912be5e0364..2e8c98d6e3e 100644 --- a/Master/texmf-dist/tex/optex/base/basic-macros.opm +++ b/Master/texmf-dist/tex/optex/base/basic-macros.opm @@ -106,7 +106,7 @@ \_cod ------------------------------ \_def\_loggingall{\_tracingcommands=3 \_tracingstats=2 \_tracingpages=1 - \_tracingoutput=1 \_tracinglostchars=1 \_tracingmacros=3 + \_tracingoutput=1 \_tracingmacros=3 % \_tracinglostchars=2 is already set \_tracingparagraphs=1 \_tracingrestores=1 \_tracingscantokens=1 \_tracingifs=1 \_tracinggroups=1 \_tracingassigns=1 } \_def\_tracingall{\_tracingonline=1 \_loggingall} diff --git a/Master/texmf-dist/tex/optex/base/doc.opm b/Master/texmf-dist/tex/optex/base/doc.opm index 34a00dc1e97..cb2b976e7c5 100644 --- a/Master/texmf-dist/tex/optex/base/doc.opm +++ b/Master/texmf-dist/tex/optex/base/doc.opm @@ -134,7 +134,7 @@ \_ifx\_printfilename\_relax \_penalty \_ttpenalty \_fi \_vskip-4pt \_noindent\_rlap{\Yellow \_vrule height8pt depth5pt width\_hsize}% \_printfilename - \_indent \_printverblinenum #1\par} + \_indent \_printverblinenum #1\_par} \_def\_printfilename{\_hbox to0pt{% \_hskip\_hsize\_vbox to0pt{\_vss\_llap{\Brown\docfile}\_kern7.5pt}\_hss}% diff --git a/Master/texmf-dist/tex/optex/base/fnotes.opm b/Master/texmf-dist/tex/optex/base/fnotes.opm index 62912d04001..661d54c33f2 100644 --- a/Master/texmf-dist/tex/optex/base/fnotes.opm +++ b/Master/texmf-dist/tex/optex/base/fnotes.opm @@ -129,12 +129,13 @@ The \`\_mnoteD``{}` macro sets the position of the marginal note. The outer box of marginal note has zero width and zero depth and it is appended after current line using `\vadjust` primitive or it is inverted to vertical mode - as a box with `\vskip-\baselineskip` followed. + as a box shifted down by `\parskip` and with `\vskip-\baselineskip` followed. \_cod ----------------------------- \_def\_mnote #1#{\_ifx^#1^\_else \_mnoteC#1\_end \_fi \_mnoteD} \_def\_mnoteC up#1\_end{\_mnoteskip=#1\_relax} % \mnote up {} syntax -\_long\_def\_mnoteD#1{\_ifvmode {\_mnoteA{#1}}\_nobreak\_vskip-\_baselineskip \_else +\_long\_def\_mnoteD#1{% + \_ifvmode \_vskip\_parskip{\_mnoteA{#1}}\_nobreak\_vskip-\_baselineskip\_vskip-\_parskip \_else \_lower\_dp\_strutbox\_hbox{}\_vadjust{\_kern-\_dp\_strutbox \_mnoteA{#1}\_kern\_dp\_strutbox}% \_fi } diff --git a/Master/texmf-dist/tex/optex/base/fonts-select.opm b/Master/texmf-dist/tex/optex/base/fonts-select.opm index 355a71a1913..d8d3982ba62 100644 --- a/Master/texmf-dist/tex/optex/base/fonts-select.opm +++ b/Master/texmf-dist/tex/optex/base/fonts-select.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \fontfam {Fonts selection system <2021-07-16>} % preloaded in format +\_codedecl \fontfam {Fonts selection system <2021-09-24>} % preloaded in format \_doc ----------------------------- The variant selectors \^`\rm`, \^`\bf`, \^`\it`, \^`\bi`, \^`\tt` @@ -175,7 +175,7 @@ \_cod ----------------------------- \_def\_famdecl [#1]#2#3#4#5#6#7#8{% - \_initunifonts \_uniaccents + \_initunifonts \_unichars \_uniaccents \_unless\_ifcsname _f:\_csstring#2:main.fam\_endcsname \_isfont{#7}\_iffalse \_opwarning{Family [#1] skipped, font "#7" not found}\_ea\_ea\_ea\_endinput \_else @@ -1011,6 +1011,7 @@ Luaotfload documentation for more information. \endinput +2021-09-24 \_unichars used in \initunifonts 2021-07-16 \initunifonts: optex_hook_into_luaotfload added. 2021-05-23 concept of \_fontfeatures macro re-implemented 2021-05-02 simpler \_resizefont, better concept of doc, moving parts from fonts-resize diff --git a/Master/texmf-dist/tex/optex/base/hyperlinks.opm b/Master/texmf-dist/tex/optex/base/hyperlinks.opm index ef205f3aa23..4c2007cddb8 100644 --- a/Master/texmf-dist/tex/optex/base/hyperlinks.opm +++ b/Master/texmf-dist/tex/optex/base/hyperlinks.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \ulink {Hyperlinks <2021-05-14>} % preloaded in format +\_codedecl \ulink {Hyperlinks <2021-08-31>} % preloaded in format \_doc ---------------------------- \`\dest``[:]` creates a destination of internal links. The @@ -27,19 +27,19 @@ \_doc ---------------------------- Each hyperlink is created internally by \`\_xlink``{}{}{}{}`. This macro expands to `\_quitvmode{}` by default, i.e.\ no active - hyperlink is created, only is printed in horizontal mode. - If \^`\hyperlinks` is used, then `\_xlink` gets meaning of - \`\_xlinkactive` and hyperlinks are created using `\pdfstartlink`, + hyperlink is created, only is printed in horizontal mode (and in a group). + If \^`\hyperlinks` is used, then `\_xlink` gets the meaning of + \`\_xlinkactive` and hyperlinks are created by the `\pdfstartlink`/% `\pdfendlink` primitives. The has given only when - hyperlink is created. But if `\_linkcolor` is defined, it has - precedence. + hyperlink is created. If `\_linkcolor` is defined, it has + precedence over . \nl The \`\_linkdimens` macro declares the dimensions of link area. \nl A specific action can be defined for each link by the macro `\_action{}`. \OpTeX/ defines only \`\_urlaction``{}`. The default link action (when `\_action` is not defined) is - `goto mame{:}` (creates an internal link). It is declared in the + `goto name{:}` (an internal link). It is declared in the \`\_linkactions``{}{}` macro. \nl The `\_pdfstartlink` primitive uses `attr{\_pdfborder{}}`. The @@ -91,14 +91,15 @@ \_public \ilink \ulink \link ; \_doc ---------------------------- - \`\hyperlinks``{}{}` activates `\dest`, `\xlink`, - in order they create links. + \`\hyperlinks``` activates `\dest`, `\xlink`, + so that they create links. Not setting colors (`\hyperlinks{}{}`) is also + supported. \_cod ---------------------------- \_def\_hyperlinks#1#2{% \_let\_dest=\_destactive \_let\_xlink=\_xlinkactive - \_let\_ilinkcolor=#1% - \_let\_elinkcolor=#2% + \_let\_ilinkcolor=#1\_empty + \_let\_elinkcolor=#2\_empty \_public \dest \xlink ;% } \_public \hyperlinks ; @@ -201,6 +202,7 @@ Another example `\def\_tocborder{1 0 0}` causes red frames in TOC \_endinput +2021-08-31 \hyperlinks{}{} allowed, bug fixed 2021-05-14 \_xlink introduced, \link, \ilink, \ulink re-implemented. 2021-05-12 \url: triplet :// instead //, \_urlslashslash removed. 2021-05-11 \url reimplemented, \_urlxskip added. diff --git a/Master/texmf-dist/tex/optex/base/languages.opm b/Master/texmf-dist/tex/optex/base/languages.opm index 19b1813edd8..26e0c626288 100644 --- a/Master/texmf-dist/tex/optex/base/languages.opm +++ b/Master/texmf-dist/tex/optex/base/languages.opm @@ -37,7 +37,7 @@ \_langw cs Kapitola Tabulka Obrázek Věc \_langw de Kapitel Tabelle Abbildung Betreff \_langw es Capítulo Tabla Figura Sujeto -\_langw fr Chaptire Tableau Figure Matière +\_langw fr Chapitre Tableau Figure Matière \_langw it Capitolo Tabella Fig. Oggetto \_langw pl Rozdział Tabela Ilustracja Temat \_langw gr Κεφάλαιο Πίνακας Σχήμα θέμα diff --git a/Master/texmf-dist/tex/optex/base/multicolumns.opm b/Master/texmf-dist/tex/optex/base/multicolumns.opm index 1a32db62b7b..f0489630431 100644 --- a/Master/texmf-dist/tex/optex/base/multicolumns.opm +++ b/Master/texmf-dist/tex/optex/base/multicolumns.opm @@ -31,7 +31,7 @@ \_advance\_hsize by\_colsep \_divide\_hsize by\_Ncols \_advance\_hsize by-\_colsep \_mullines=0 - \_def\par{\_ifhmode\_endgraf\_global\_advance\_mullines by\_prevgraf\_fi}% + \_def\_par{\_ifhmode\_endgraf\_global\_advance\_mullines by\_prevgraf\_fi}% } \_def\_endmulti{\_vskip-\_prevdepth\_vfil \_ea\_egroup\_ea\_egroup\_ea\_baselineskip\_the\_baselineskip\_relax diff --git a/Master/texmf-dist/tex/optex/base/optex.ini b/Master/texmf-dist/tex/optex/base/optex.ini index e51a8824df3..4ccc482d8fa 100644 --- a/Master/texmf-dist/tex/optex/base/optex.ini +++ b/Master/texmf-dist/tex/optex/base/optex.ini @@ -21,7 +21,7 @@ % OpTeX version -\def\optexversion{1.04 Aug.2021} +\def\optexversion{1.05 Jan.2022} \def\fmtname{OpTeX} \let\fmtversion=\optexversion diff --git a/Master/texmf-dist/tex/optex/base/optex.lua b/Master/texmf-dist/tex/optex/base/optex.lua index 5114ea21e98..19eeb6328b3 100644 --- a/Master/texmf-dist/tex/optex/base/optex.lua +++ b/Master/texmf-dist/tex/optex/base/optex.lua @@ -419,12 +419,17 @@ end, "_tracingmacros") -- inject PDF literals according to attributes. -- local node_id = node.id +local node_subtype = node.subtype local glyph_id = node_id("glyph") local rule_id = node_id("rule") local glue_id = node_id("glue") local hlist_id = node_id("hlist") local vlist_id = node_id("vlist") local disc_id = node_id("disc") +local whatsit_id = node_id("whatsit") +local pdfliteral_id = node_subtype("pdf_literal") +local pdfsave_id = node_subtype("pdf_save") +local pdfrestore_id = node_subtype("pdf_restore") local token_getmacro = token.get_macro local direct = node.direct @@ -517,6 +522,10 @@ local function is_color_needed(head, n, id, subtype) -- returns non-stroke, stro return true, true end return true, false + elseif id == whatsit_id and (subtype == pdfliteral_id + or subtype == pdfsave_id + or subtype == pdfrestore_id) then + return true, true end return false, false end diff --git a/Master/texmf-dist/tex/optex/base/others.opm b/Master/texmf-dist/tex/optex/base/others.opm index a6dc2064eb4..0c9f4cae6a0 100644 --- a/Master/texmf-dist/tex/optex/base/others.opm +++ b/Master/texmf-dist/tex/optex/base/others.opm @@ -80,15 +80,15 @@ usages of `\lipsum` are fully expandable. If you want to have all printings of `\lipsum` expandable, use dummy `\lipsum[0]` first. - `\lipsum` adds `\par` after each printed paragraph. If you don't need - such `\par` here, use \`\lipsumtext``[]`. - This macro prints only one selected paragraph and does not add `\par`. + `\lipsum` adds `\_par` after each printed paragraph. If you don't need + such `\_par` here, use \`\lipsumtext``[]`. + This macro prints only one selected paragraph and does not add `\_par`. \_cod ---------------------------- \_def\_lipsumtext[#1]{\_lipsumload\_cs{_lip:#1}} \_def\_lipsum[#1]{\_lipsumA #1\_empty-\_empty\_end} \_def\_lipsumA #1-#2\_empty#3\_end{% - \_fornum #1..\_ifx^#2^#1\_else#2\_fi \_do {\_lipsumtext[##1]\par}} + \_fornum #1..\_ifx^#2^#1\_else#2\_fi \_do {\_lipsumtext[##1]\_par}} \_def\_lipsumload{{% \_setbox0=\_vbox{\_tmpnum=0 % vertical mode during \input lipsum.ltd.tex \_def\ProvidesFile##1[##2]{}% @@ -100,6 +100,78 @@ \_public \lipsum \lipsumtext ; \_let \lorem=\lipsum + \_doc ----------------------------- + Lua\TeX/ version 1.14 and newer provides `\partokenname` which allows to + specify something different than `\par` at empty lines. We set `\_par` + (see bellow) in \OpTeX/ version 1.04+ and newer. Some macros were rewritten + due to this change. And we copy old versions of these changed macros here + in order to allow to use older Lua\TeX/ versions where `\partokenname` is + not provided.\nl + Note that your macros where a parameter is separated by the empty line + must be changed too. Use `\def\macro #1\_par{...}` instead + `\def\macro #1\par{...}`. + \_cod ----------------------------- + +\_ifx\_partokenname\_undefined % LuaTeX 1.13 or older: + + \_def\_begmulti #1 {\_par\_bgroup\_wipeepar\_multiskip\_penalty0 \_def\_Ncols{#1} + \_setbox6=\_vbox\_bgroup\_bgroup \_let\_setxhsize=\_relax \_penalty-99 + \_advance\_hsize by\_colsep + \_divide\_hsize by\_Ncols \_advance\_hsize by-\_colsep + \_mullines=0 + \_def\par{\_ifhmode\_endgraf\_global\_advance\_mullines by\_prevgraf\_fi}% + } + \_def\_incaption {\_bgroup + \_ifcsname _\_tmpa num\_endcsname \_ea\_incr \_csname _\_tmpa num\_endcsname + \_else \_opwarning{Unknown caption /\_tmpa}\_fi + \_edef\_thecapnum {\_csname _the\_tmpa num\_endcsname}% + \_edef\_thecaptitle{\_mtext{\_tmpa}}% + \_ea\_the \_csname _everycaption\_tmpa\_endcsname + \_def\_par{\_nbpar\_egroup}\_let\par=\_par + \_cs{_printcaption\_tmpa}% + } + \_def\_boxlines{% + \_def\_boxlinesE{\_ifhmode\_egroup\_empty\_fi}% + \_def\_nl{\_boxlinesE}% + \_bgroup \_lccode`\~=`\^^M\_lowercase{\_egroup\_let~}\_boxlinesE + \_everypar{\_setbox0=\_lastbox\_endgraf + \_hbox\_bgroup \_catcode`\^^M=13 \_let\par=\_nl \_aftergroup\_boxlinesC}% + } + \_def\_letter{ + \_def\_address{\_vtop\_bgroup\_boxlines \_parskip=0pt \_let\par=\_egroup} + \_def\_subject{{\_bf \_mtext{subj}: }} + \_public \address \subject ; + \_typosize[11/14] + \_vsize=\_dimexpr \_topskip + 49\_baselineskip \_relax % added 2020-03-28 + \_parindent=0pt + \_parskip=\_medskipamount + \_nopagenumbers + } + \_def\_printverbline#1{\_putttpenalty \_indent \_printverblinenum \_kern\_ttshift #1\par} + \_public \begmulti \boxlines \letter ; + +\_else % LuaTeX 1.14 or newer: + + \_doc ----------------------------- + We set `\partokenneame` to `\_par` in order to keep the name `\par` in + user name space. I.e. a user can say `\def\par{paragraph}` for example + without crash of processing the document. Se section~\ref[prefixed] for + more details about the name space concept.\nl + Moreover, we set `\partokencontext` to one in order to the `\_par` token + is inserted not only at empty lines, but also at the end of `\vbox`, `\vtop` and + `\vcenter` if horizontal mode is opened here. This differs from default + \TeX/ behavior where horizontal mode is closed in these cases without + inserting par token.\nl + We set \`\_partokenset` to defined value 1 in order to the macro programmer can + easily check these settings in \OpTeX/ format by + `\ifx\_partokenset\undefined ... \else ...\fi`. + \_cod ----------------------------- + + \_partokenname\_par + \_partokencontext=1 + \_let\_partokenset=1 +\_fi + \_endcode 2021-08-02 \SetLipsumLanguage added, fix for new lipusm version diff --git a/Master/texmf-dist/tex/optex/base/plain-macros.opm b/Master/texmf-dist/tex/optex/base/plain-macros.opm index b878d96ce84..2f4d2da65c6 100644 --- a/Master/texmf-dist/tex/optex/base/plain-macros.opm +++ b/Master/texmf-dist/tex/optex/base/plain-macros.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \magstep {Macros from plain TeX <2021-04-09>} % preloaded in format +\_codedecl \magstep {Macros from plain TeX <2021-09-24>} % preloaded in format \_doc ----------------------------- The \`\dospecials` works like in plain TeX but does nothing with `_`. @@ -48,11 +48,11 @@ Plain \TeX/ classical \`\obeylines` and \`\obeyspaces`. \_cod ----------------------------- -% In \obeylines, we say `\let^^M=\par' instead of `\def^^M{\par}' -% since this allows, for example, `\let\par=\cr \obeylines \halign{...' +% In \obeylines, we say `\let^^M=\_par' instead of `\def^^M{\_par}' +% since this allows, for example, `\let\_par=\cr \obeylines \halign{...' {\_catcode`\^^M=13 % these lines must end with % \_gdef\_obeylines{\_catcode`\^^M=13\_let^^M\_par}% - \_global\_let^^M=\par} % this is in case ^^M appears in a \write + \_global\_let^^M=\_par} % this is in case ^^M appears in a \write \_def\_obeyspaces{\_catcode`\ =13 } {\_obeyspaces\_global\_let =\_space} \_public \obeylines \obeyspaces ; @@ -210,8 +210,7 @@ \_def\_{\_hbox{_}} \_def\dag{\_errmessage{\_usedirectly †}} \_def\ddag{\_errmessage{\_usedirectly ‡}} -%\_def\copyright{\_errmessage{\_usedirectly ©}} -\_def\copyright{©} % << example, what to do +\_def\copyright{\_errmessage{\_usedirectly ©}} %\_def\Orb{\_mathhexbox20D} % obsolete (part of Copyright) %\_def\P{\_mathhexbox27B} % obsolete @@ -219,6 +218,21 @@ \_def \_mathhexbox #1#2#3{\_leavevmode \_hbox{$\_math \_mathchar"#1#2#3$}} \_public \mathhexbox ; + \_doc ----------------------------- + The \`\_unichars` macro is run in \^`\initunifonts`, + Unicodes are used instead old plain \TeX/ settings. + \_cod ----------------------------- + +\def\_unichars{% characters with different codes in Unicode: + \_chardef\ss=`ß + \_chardef\oe=`œ + \_chardef\OE=`Œ + \_chardef\S=`§ + \_chardef\dag`† + \_chardef\ddag`‡ + \_chardef\copyright`© +} + \_doc ----------------------------- Accents. The macros \`\ooalign`, \`\d`, \`\b`, \`\c`, \`\dots`, @@ -344,5 +358,6 @@ \_endcode % ------------------------------------- +2021-09-24 ... \_unichars introduced 2021-04-09 ... \_public\showhyphens, bug fixed 2020-02-14 ... released diff --git a/Master/texmf-dist/tex/optex/base/prefixed.opm b/Master/texmf-dist/tex/optex/base/prefixed.opm index 6dec64c7e5e..d15ee4140de 100644 --- a/Master/texmf-dist/tex/optex/base/prefixed.opm +++ b/Master/texmf-dist/tex/optex/base/prefixed.opm @@ -175,12 +175,12 @@ In this documentation: if both variants of a control sequence are declared the unprefixed variant. The code typically defines the prefixed variant and then the \^`\public` (or `\_public`) macro is used. -\secc Namespace of control sequences for users +\secc[user-ns] Namespace of control sequences for users -Users can define or declare any control sequence with a name without any `_`. -This does not make any problem. Only one exception is the reserved control -sequence `\par`. It is generated by the tokenizer (at empty lines) -and used as internal in \TeX/. +Users can (re)define or (re)declare any control sequence with a name without any `_`. +This does not make any problem in internal \OpTeX/ macros.\fnote +{The token `\par` is in user name space too from \OpTeX/ 1.04+ and +Lua\TeX/ 1.14, see also the end of section~\ref[others].} User can define or declare control sequences with `_` character, for example `\my_control_sequence`, but with the following exceptions: diff --git a/Master/texmf-dist/tex/optex/base/references.opm b/Master/texmf-dist/tex/optex/base/references.opm index eb884c4f1df..51b1b9591af 100644 --- a/Master/texmf-dist/tex/optex/base/references.opm +++ b/Master/texmf-dist/tex/optex/base/references.opm @@ -24,11 +24,10 @@ \_doc ---------------------------- \`\_Xlabel` `{