summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-03-11 22:04:51 +0000
committerKarl Berry <karl@freefriends.org>2022-03-11 22:04:51 +0000
commit41bf581d1e01e395d0eaeb2fc50b36d0cd3c92bc (patch)
treeb9f337374b98fdf7d3e27331951e6b3429998bb6
parent594f56d8c6dd122d6841c134070753e69276d5cf (diff)
optex (11mar22) (branch)
git-svn-id: svn://tug.org/texlive/branches/branch2021.final@62641 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/optex/base/README15
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-doc.pdfbin1399602 -> 1409811 bytes
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-doc.tex4
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-math.tex25
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-techdoc.tex19
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-userdoc.tex40
-rw-r--r--Master/texmf-dist/tex/optex/base/alloc.opm42
-rw-r--r--Master/texmf-dist/tex/optex/base/bib-iso690.opm7
-rw-r--r--Master/texmf-dist/tex/optex/base/colors.opm42
-rw-r--r--Master/texmf-dist/tex/optex/base/doc.opm4
-rw-r--r--Master/texmf-dist/tex/optex/base/f-heros.opm9
-rw-r--r--Master/texmf-dist/tex/optex/base/f-lmfonts.opm4
-rw-r--r--Master/texmf-dist/tex/optex/base/fonts-catalog.opm15
-rw-r--r--Master/texmf-dist/tex/optex/base/fonts-opmac.opm9
-rw-r--r--Master/texmf-dist/tex/optex/base/fonts-preload.opm39
-rw-r--r--Master/texmf-dist/tex/optex/base/fonts-resize.opm286
-rw-r--r--Master/texmf-dist/tex/optex/base/fonts-select.opm366
-rw-r--r--Master/texmf-dist/tex/optex/base/graphics.opm59
-rw-r--r--Master/texmf-dist/tex/optex/base/hisyntax-lua.opm86
-rw-r--r--Master/texmf-dist/tex/optex/base/hyphen-lan.opm252
-rw-r--r--Master/texmf-dist/tex/optex/base/keyval.opm21
-rw-r--r--Master/texmf-dist/tex/optex/base/lang-data.opm100
-rw-r--r--Master/texmf-dist/tex/optex/base/lang-decl.opm312
-rw-r--r--Master/texmf-dist/tex/optex/base/languages.opm147
-rw-r--r--Master/texmf-dist/tex/optex/base/makeindex.opm66
-rw-r--r--Master/texmf-dist/tex/optex/base/math-preload.opm24
-rw-r--r--Master/texmf-dist/tex/optex/base/math-unicode.opm2
-rw-r--r--Master/texmf-dist/tex/optex/base/optex.ini8
-rw-r--r--Master/texmf-dist/tex/optex/base/optex.lua139
-rw-r--r--Master/texmf-dist/tex/optex/base/others.opm24
-rw-r--r--Master/texmf-dist/tex/optex/base/output.opm14
-rw-r--r--Master/texmf-dist/tex/optex/base/parameters.opm23
-rw-r--r--Master/texmf-dist/tex/optex/base/plain-macros.opm10
-rw-r--r--Master/texmf-dist/tex/optex/base/ref-file.opm23
-rw-r--r--Master/texmf-dist/tex/optex/base/references.opm2
-rw-r--r--Master/texmf-dist/tex/optex/base/slides.opm17
-rw-r--r--Master/texmf-dist/tex/optex/base/table.opm9
-rw-r--r--Master/texmf-dist/tex/optex/base/uni-lcuc.opm2
-rw-r--r--Master/texmf-dist/tex/optex/base/unimath-codes.opm72
-rw-r--r--Master/texmf-dist/tex/optex/base/unimath-table.opm2
-rw-r--r--Master/texmf-dist/tex/optex/base/usebib.opm5
-rw-r--r--Master/texmf-dist/tex/optex/base/verbatim.opm5
-rw-r--r--Master/texmf-dist/tex/optex/pkg/minim-mp.opm16
-rw-r--r--Master/texmf-dist/tex/optex/pkg/minim-pdf.opm96
-rw-r--r--Master/texmf-dist/tex/optex/pkg/minim.opm188
-rw-r--r--Master/texmf-dist/tex/optex/pkg/plain-at.opm9
-rw-r--r--Master/texmf-dist/tex/optex/pkg/tikz.opm123
47 files changed, 1796 insertions, 986 deletions
diff --git a/Master/texmf-dist/doc/optex/base/README b/Master/texmf-dist/doc/optex/base/README
index bd8d5824e87..bb17d1359c1 100644
--- a/Master/texmf-dist/doc/optex/base/README
+++ b/Master/texmf-dist/doc/optex/base/README
@@ -1,6 +1,9 @@
OpTeX: the LuaTeX format based on Plain TeX and OPmac
-Author: Petr Olsak, <petr@olsak.net>
+Author: Petr Olsak, <petr@olsak.net>
+
+Co-author: Michal Vlasák, <lahcim8@gmail.com>
+ (Lua code, colors by attributes, interface to tikz, minim)
This software is in public domain.
@@ -19,6 +22,16 @@ doc/ ... PDF version of the OpTeX documentation and sources.
History:
+<1.06> Mar. 2022:
+ \transparency selector using attributes implemented.
+ Interface to minim (minim-mp.opm, minim-pdf.opm) introduced.
+ Interface to TikZ (tikz.opm) improved.
+ PDF page resources: management by Lua code implemented.
+ Possibility of preloading no fonts to the format by \let\fontspreload=\relax.
+ hisyntax-lua.opm introduced.
+ plain-at.opm macros included to the format.
+ Language/hyphenations macros reimplemented, phrases file introduced.
+ Font selection: low level macros reimplemented, \fontsel introduced.
<1.05> Jan. 2022:
\_par used internally instead \par if \partokenname is available.
Extended format \ref[label]{text} and \pgref[label]{text} introduced.
diff --git a/Master/texmf-dist/doc/optex/base/optex-doc.pdf b/Master/texmf-dist/doc/optex/base/optex-doc.pdf
index 85260e0fdc2..00e43671f9e 100644
--- a/Master/texmf-dist/doc/optex/base/optex-doc.pdf
+++ b/Master/texmf-dist/doc/optex/base/optex-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/optex/base/optex-doc.tex b/Master/texmf-dist/doc/optex/base/optex-doc.tex
index 1c9af23aa9f..daed675cd8c 100644
--- a/Master/texmf-dist/doc/optex/base/optex-doc.tex
+++ b/Master/texmf-dist/doc/optex/base/optex-doc.tex
@@ -21,9 +21,9 @@
\tit Format Based on Plain \TeX/ and OPmac\fnotemark1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\hfill Version 1.05
+\hfill Version 1.06
-\centerline{\it Petr Olšák, 2020, 2021}
+\centerline{\it Petr Olšák, 2020, 2021, 2022}
\bigskip
\centerline{\url{http://petr.olsak.net/optex}}
diff --git a/Master/texmf-dist/doc/optex/base/optex-math.tex b/Master/texmf-dist/doc/optex/base/optex-math.tex
index 4c9d5dd01ff..dbdd7800cfc 100644
--- a/Master/texmf-dist/doc/optex/base/optex-math.tex
+++ b/Master/texmf-dist/doc/optex/base/optex-math.tex
@@ -576,6 +576,17 @@ There are more scalable accents in Unicode math fonts:
\x`\overleftrightarrow` $\overleftrightarrow{abc}$,
\x`\overleftharpoon` $\overleftharpoon{abc}$,
\x`\overrightharpoon` $\overrightharpoon{abc}$,
+\x`\wideoverbar` $\wideoverbar{abc}$,
+\x`\widebreve` $\widebreve{abc}$,
+\x`\widecheck` $\widecheck{abc}$,\nl
+\x`\wideutilde` $\wideutilde{abc}$,
+\x`\mathunderbar` $\mathunderbar{abc}$,
+\x`\underleftrightarrow` $\underleftrightarrow{abc}$,
+\x`\widebridgeabove` $\widebridgeabove{abc}$,\nl
+\x`\underrightharpoondown` $\underrightharpoondown{abc}$,
+\x`\underleftharpoondown` $\underleftharpoondown{abc}$,
+\x`\underleftarrow` $\underleftarrow{abc}$,\nl
+\x`\underrightarrow` $\underrightarrow{abc}$.
\secc Fixed math accents
@@ -703,19 +714,17 @@ previous listing of math alphabets and sets as default:
Moreover, it defines the alphabet selectors at user level (see section 1.3.3
of the \OpTeX/ manual). For example
\begtt \typosize[10/12]
-\def\rm {\_tryload\_tenrm \_inmath{\_rmavariables \_rmdigits}}
+\_def\_marm {\_inmath{\_rmavariables \_rmdigits}} % \_mamrm is used in \rm
\endtt
%
-The first part
-\new \OpTeX/
-`\_tryload\_tenrm` is applicable for text fonts and the
-`\_inmath` part is processed only in math mode and sets the math alphabets.
-You can see the file `unimath-codes.opm` where all user-level selectors are
+`\_inmath` runs it parameter only in math mode and sets the math alphabets.
+You can see the file `unimath-codes.opm` where all these selectors are
defined. You can redefine them. For example, \OpTeX/ defines `\bf` as a math
alphabet selector that selects sans serif bold in math. This is the common
-notation for vectors, tensors, and matrices. If you dislike this, then you can define:
+notation for vectors, tensors, and matrices. If you dislike this (maybe
+because plain \TeX/ has different defaults), then you can define:
\begtt \typosize[10/12]
-\def\bf {\_tryloadbf\_tenbf \_inmath{\_bfvariables\_bfdigits\_bfgreek\_bfGreek}}
+\_def\_mabf {\_inmath{\_bfvariables\_bfdigits\_bfgreek\_bfGreek}} % used in \bf
\endtt
diff --git a/Master/texmf-dist/doc/optex/base/optex-techdoc.tex b/Master/texmf-dist/doc/optex/base/optex-techdoc.tex
index 1748e9f3eaa..5a51ba4d8ac 100644
--- a/Master/texmf-dist/doc/optex/base/optex-techdoc.tex
+++ b/Master/texmf-dist/doc/optex/base/optex-techdoc.tex
@@ -117,7 +117,7 @@ The second bundle of \OpTeX/ macros is here.
\printdoctail keyval.opm
\printdoc keyval.opm
-\sec Plain \TeX/ macros
+\sec[plain] Plain \TeX/ macros
All macros from plain \TeX/ are rewritten here.
Differences are mentioned in the documentation below.
\printdoc plain-macros.opm
@@ -128,8 +128,8 @@ Differences are mentioned in the documentation below.
\printdoctail fonts-resize.opm
\secc[fresize] Implementation of resizing
-Only \"resizing" macros are implemented here. Other aspects of Font
-Selection System and their implementation are desribed in
+Only \"resizing" macros and \^`\initunifonts` are implemented here.
+Other aspects of Font Selection System and their implementation are desribed in
section~\ref[fselect].
\printdoc fonts-resize.opm
@@ -248,11 +248,12 @@ The `\margins` macro is documented in the section~\ref[marg].
\sec Multilingual support
\secc Lowercase, uppercase codes
\printdoctail uni-lcuc.opm
-\secc Hyphenations
-\printdoc hyphen-lan.opm
-\printdoctail hyphen-lan.opm
+%\printdoc hyphen-lan.opm
+%\printdoctail hyphen-lan.opm
\secc[langphrases] Multilingual phrases and quotation marks
\printdoc languages.opm
+\secc[langdecl] Languages declaration
+\printdoc lang-decl.opm
\sec[others] Other macros
Miscellaneous macros are here.
@@ -273,12 +274,6 @@ The allocations are declared in subsection~\ref[lua-alloc], calbacks are
implemented in subsection~\ref[callbacks] and handling with colors can be
found in the subsection~\ref[lua-colors].
-\newtoks \_hisyntaxlua
-\_hisyntaxlua={%
- \_hicolor C \Green
- \_replfromto {--}{^^J} {\z C{--#1}^^J}%
-}
-
{\everytt={\typosize[8/10]\_let\_printverbline=\_printcodeline \medskip}
\commentchars-- \def\docfile{optex.lua} \ttline=-1
\_def\_printcomments{\_medskip
diff --git a/Master/texmf-dist/doc/optex/base/optex-userdoc.tex b/Master/texmf-dist/doc/optex/base/optex-userdoc.tex
index 3fefc226573..3e623faa244 100644
--- a/Master/texmf-dist/doc/optex/base/optex-userdoc.tex
+++ b/Master/texmf-dist/doc/optex/base/optex-userdoc.tex
@@ -1343,7 +1343,7 @@ using this empty internal name.
\sec Graphics
%%%%%%%%%%%%%
-\secc Colors
+\secc Colors, transparency
%%%%%%%%%%%
\OpTeX/ provides a small number of color selectors:
@@ -1369,7 +1369,8 @@ or one grey component (using \^`\setgreycolor`). For example
\def \DarkGrey {\setgreycolor{.1}}
\endtt
-\new
+The color selectors work locally in groups like font selectors.
+
The command \^`\morecolors` reads more definitions of color selectors from
the \LaTeX/ file `x11nam.def`.
There are about 300 color names like
@@ -1377,10 +1378,6 @@ There are about 300 color names like
name, then the letters B, C, etc. are appended to the name in \OpTeX/. For example
`\Chocolate` is Chocolate1, `\ChocolateB` is Chocolate2 etc.
-\new
-The color selectors work locally in groups by default. See
-the technical documentation, section~\ref[colors] for more information.
-
The basic colors \^`\Blue`, \^`\Red`, \^`\Cyan`, \^`\Yellow` etc.\ are defined
with CMYK components using \^`\setcmykcolor`.
On the other hand, you can define a color with three
@@ -1397,7 +1394,6 @@ presentations). On the other hand, CMYK makes colors more true\fnote
using ICC profile for your printer.}
for printing.
-\new
You can define your color by a linear combination of previously defined colors using
\^`\colordef`. For example:
@@ -1435,6 +1431,14 @@ The `\coloron` macro can be defined as follows:
\coloron\Yellow\Brown{Brown text on yellow background}
\endtt
+The \^`\transparency``<number>` sets the transparency amount of following
+typesetting material until the current group is closed.
+The <number> must be in the range 0..255,
+zero means no transparency (solid objects), 255 means
+full transparency (invisible objects). You can see the effect when
+overlapping one object over another.
+
+
\secc Images
%%%%%%%%%%%
@@ -1613,12 +1617,12 @@ available in your \TeX/ system.
\new
Only USenglish patterns (original from Plain \TeX/) are preloaded.
Hyphenation patterns of all other languages are loaded on demand when you first use
-the `\<iso-code>lang` command in your document.
+the `\<lang-id>lang` command in your document.
For example \^`\delang` for German, \^`\cslang` for
-Czech, \^`\pllang` for Polish. The <iso-code> is a shortcut
+Czech, \^`\pllang` for Polish. The <lang-id> is a shortcut
of the language (mostly from ISO 639-1).
-You can list all available languages by \^`\langlist`
-macro. This macro prints now:
+You can list all available languages including their <lang-id>'s by the
+\^`\langlist` macro. It prints now:
\medskip
{\typosize[8.5/11.5]\emergencystretch=4em \hbadness=4000
@@ -1741,7 +1745,7 @@ macros if you need them. On the other hand, if your source document is structure
to more files (with individual chapters or sections), use simply the `\input` primitive.
The macro packages intended to \OpTeX/ have the name `*.opm`.
-The following packages are distributed as part of \OpTeX/:
+The list of packages supported by \OpTeX/ follows. Most of them are directly part of \OpTeX/:
\begitems
* `qrcode.opm` enables to create QR codes.
* `tikz.opm` does `\input tikz.tex`, i.e.\ loads Ti{\it k\/}Z. It adds \OpTeX/-specific code.
@@ -1749,7 +1753,9 @@ The following packages are distributed as part of \OpTeX/:
includes settings for microtypographic extensions (protrusions+expanding fonts).
* `vlna.opm` enables to protect of one-letter prepositions and more things automatically.
* `emoji.opm` defines `\emoji{<name>}` command for colored emoticons.
-* `plain-at.opm` defines the old names from plain \TeX/.
+* \ulink[https://github.com/vlasakm/optex-minim]{\tt minim-mp.opm} enables
+ `\directmetapost` using \ulink[https://ctan.org/pkg/minim-mp]{\tt minim-mp}
+ and \ulink[https://ctan.org/pkg/minim]{\tt minim} packages.
* \ulink[https://ctan.org/tex-archive/macros/luatex/optex/pdfextra/pdfextra-doc.pdf]{\tt pdfextra.opm}
allows the use of many extra features from PDF standard (by M. Vlasák).
\enditems
@@ -1956,10 +1962,10 @@ documentation.
All macros of Plain \TeX/ are re-written in \OpTeX/. Common macros should
work in the same sense as in original Plain \TeX. Internal control sequences
-like `\p@` or `\f@@t` are removed and mostly replaced by control sequences
-prefixed by `_` (like `\_this`). If you need to use the basic set of old Plain
-\TeX/ control sequences like `\p@` (for example you are reading an old macro file),
-use `\load[plain-at]`.
+like `\f@@t` are removed and mostly replaced by control sequences
+prefixed by `_` (like `\_this`). Only a basic set of old Plain
+\TeX/ control sequences like `\p@`, `\z@`, `\dimen@` are provided
+but not recommended for new macros.
All primitives and common macros have two
control sequences with the same meaning: in prefixed and unprefixed form.
diff --git a/Master/texmf-dist/tex/optex/base/alloc.opm b/Master/texmf-dist/tex/optex/base/alloc.opm
index 13252cae708..51bd2579623 100644
--- a/Master/texmf-dist/tex/optex/base/alloc.opm
+++ b/Master/texmf-dist/tex/optex/base/alloc.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \newdimen {Allocators for registers <2021-02-15>} % preloaded in format
+\_codedecl \newdimen {Allocators for registers <2022-03-07>} % preloaded in format
\_doc -----------------------------
The limits are set first.
@@ -15,20 +15,22 @@
\_chardef\_mairead = 15
\_chardef\_maiwrite = 15
\_chardef\_maifam = 255
+\_chardef\_mailanguage = 16380 % In fact 16383, but we reserve next numbers for dummy patterns
\_doc -----------------------------
Each allocation macro needs its own counter.
\_cod -----------------------------
-\_countdef\_countalloc=10 \_countalloc=255
-\_countdef\_dimenalloc=11 \_dimenalloc=255
-\_countdef\_skipalloc=12 \_skipalloc=255
-\_countdef\_muskipalloc=13 \_muskipalloc=255
-\_countdef\_boxalloc=14 \_boxalloc=255
-\_countdef\_toksalloc=15 \_toksalloc=255
-\_countdef\_readalloc=16 \_readalloc=-1
-\_countdef\_writealloc=17 \_writealloc=-1
-\_countdef\_famalloc=18 \_famalloc=3
+\_countdef\_countalloc=10 \_countalloc=255
+\_countdef\_dimenalloc=11 \_dimenalloc=255
+\_countdef\_skipalloc=12 \_skipalloc=255
+\_countdef\_muskipalloc=13 \_muskipalloc=255
+\_countdef\_boxalloc=14 \_boxalloc=255
+\_countdef\_toksalloc=15 \_toksalloc=255
+\_countdef\_readalloc=16 \_readalloc=-1
+\_countdef\_writealloc=17 \_writealloc=0 % should be -1 but there is bug in new luatex
+\_countdef\_famalloc=18 \_famalloc=3
+\_countdef\_languagealloc=19 \_languagealloc=0
\_doc -----------------------------
The common allocation macro
@@ -51,7 +53,7 @@
\_doc -----------------------------
The allocation macros
\`\newcount`, \`\newdimen`, \`\newskip`, \`\newmuskip`, \`\newbox`,
- \`\newtoks`, \`\newread`, \`\newwrite` and \`\newfam`
+ \`\newtoks`, \`\newread`, \`\newwrite`, \`\newfam`, and \`\newlanguage`
are defined here.
\_cod -----------------------------
@@ -64,8 +66,10 @@
\_def\_newread #1{\_allocator #1{read}\_chardef}
\_def\_newwrite #1{\_allocator #1{write}\_chardef}
\_def\_newfam #1{\_allocator #1{fam}\_chardef}
+\_def\_newlanguage #1{\_allocator #1{language}\_chardef}
-\_public \newcount \newdimen \newskip \newmuskip \newbox \newtoks \newread \newwrite \newfam ;
+\_public \newcount \newdimen \newskip \newmuskip \newbox \newtoks
+ \newread \newwrite \newfam \newlanguage ;
\_doc -----------------------------
The \`\newinsert` macro is defined differently than others.
@@ -86,19 +90,25 @@
\_public \newinsert ;
\_doc -----------------------------
- Other allocation macros \`\newattribute` and \`\newcatcodetable`
+ Other allocation macros \`\newmarks`. \`\newattribute` and \`\newcatcodetable`
have their counter allocated by the `\newcount` macro.
+ \`\_noattr` is constant `-"7FFFFFFF`, i.e. unused attribute
\_cod -----------------------------
+\_newcount \_marksalloc \_marksalloc=0 % start at 1, 0 is \mark
+\_chardef\_maimarks=\_maicount
+\_def\_newmarks #1{\_allocator #1{marks}\_chardef}
+
\_newcount \_attributealloc \_attributealloc=0
-\_chardef\_maiattribute=\_maicount
+\_chardef\_maiattribute=\_numexpr\_maicount -1\_relax
+\_attributedef\_noattr \_maicount
\_def\_newattribute #1{\_allocator #1{attribute}\_attributedef}
\_newcount \_catcodetablealloc \_catcodetablealloc=10
\_chardef\_maicatcodetable=32767
\_def\_newcatcodetable #1{\_allocator #1{catcodetable}\_chardef}
-\_public \newattribute \newcatcodetable ;
+\_public \newmarks \newattribute \newcatcodetable ;
\_doc -----------------------------
We declare public and private versions of `\tmpnum` and `\tmpdim`
@@ -168,6 +178,8 @@ the array-like declarator of counters.
\_endinput
+2022-03-07 \_noattr allocated
+2022-02-19 \_newlanguage introduced
2021-02-15 \_advance -> \_incr, \_decr
2020-05-12 \newmath -> \newfam bug fixing
2020-01-23 released
diff --git a/Master/texmf-dist/tex/optex/base/bib-iso690.opm b/Master/texmf-dist/tex/optex/base/bib-iso690.opm
index 696084d8bbe..5c39c6a6e57 100644
--- a/Master/texmf-dist/tex/optex/base/bib-iso690.opm
+++ b/Master/texmf-dist/tex/optex/base/bib-iso690.opm
@@ -1,6 +1,6 @@
% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_undefined {BIB style (iso690) <2021-04-07>} % loaded on demand by \usebib
+\_codedecl \_undefined {BIB style (iso690) <2022-02-04>} % loaded on demand by \usebib
\_ifx\_optexbibstyle\_undefined \_errmessage
{This file can be read by: \_string\usebib/? (iso690) bibfiles command only}
@@ -122,7 +122,9 @@
\_CreateField {lang}
\_def\_setlang#1{\_ifx#1\_empty \_else
- \_ifcsname _mt:bib.and:#1\_endcsname \_language=\_csname _#1Patt\_endcsname \_relax
+ \_setbox0=\_vbox{\_langinput{#1}}%
+ \_ifcsname _mt:bib.and:#1\_endcsname
+ \_language=\_csname _#1Patt\_endcsname \_relax
\_else \_opwarning{No phrases for "#1" used by [\EntryKey] in .bib}%
\_fi\_fi
}
@@ -905,5 +907,6 @@ Other options in the option field are silently ignored.
\_endinput
+2022-02-04 ... \_langinput used in \_setlang
2021-04-07 ... \biboptions toks declaration moved, bug fixed.
2020-03-10 ... released
diff --git a/Master/texmf-dist/tex/optex/base/colors.opm b/Master/texmf-dist/tex/optex/base/colors.opm
index 6ef8fc9dcf7..36afcb3862f 100644
--- a/Master/texmf-dist/tex/optex/base/colors.opm
+++ b/Master/texmf-dist/tex/optex/base/colors.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \colordef {Colors <2021-07-16>} % preloaded in format
+\_codedecl \colordef {Colors <2022-03-07>} % preloaded in format
\_doc -----------------------------
The basic colors in CMYK
@@ -72,14 +72,11 @@
\_color:<attribute-value> ... expands to <data> <fill-op>
\_color-s:<attribute-value> ... expands to <data> <stroke-op>
\endtt
- The \`\_resetcolor` un-sets the color attribute, it means that default
- color (black) shall be used.
\_cod -----------------------------
\_newattribute \_colorattr
\_newcount \_colorcnt \_colorcnt=1 % allocations start at 1
\_protected\_def\_setcolor{\_colorprefix\_colorattr=\_translatecolor}
-\_def\_resetcolor{\_colorattr=-"7FFFFFFF }
\_def\_translatecolor#1#2#3{\_ifcsname _color::#1 #2\_endcsname\_lastnamedcs\_relax
\_else
\_colorcnt
@@ -108,6 +105,41 @@
\_localcolor
\_doc -----------------------------
+ The attribute \`\_transpattr` is allocated and set by the
+ \`\transparency``<number>` macro. If such level of the tranparency was
+ never used in the document then
+ \^`\addextgstate{tr<number>}`\code{\{<</ca X /CA X>>\}} is applied
+ (where `X` is `(255-<number>)/255`).
+ This information is used when shipout is processed (similarly as colors).
+ It means `/tr<number> gs` is inserted when the attribute is changed.\nl
+ \`\_resetattrs` resets the \^`\_colorattr` and \^`\_transpattr`
+ to their initial value `-"7FFFFFFF`.
+ \_cod -----------------------------
+
+\_newattribute\_transpattr
+\_def\_transparency {\_afterassignment\_transparencyA \_transpattr}
+\_def\_transparencyA{%
+ \_ifnum\_transpattr<1 \_transpattr=\_noattr \_fi
+ \_ifnum\_transpattr>255 \_opwarning{\_noexpand\transparency > 255 not allowed}%
+ \_transpattr=\_noattr
+ \_else
+ \_ifcsname _transp:\_the\_transpattr\_endcsname \_else
+ \_edef\_transpv{\_expr{(255-\_the\_transpattr)/255}}%
+ \_addextgstate{tr\_the\_transpattr}{<</ca \_transpv\_space /CA \_transpv>>}%
+ \_sxdef{_transp:\_the\_transpattr}{}%
+ \_ifcsname _transp:0\_endcsname \_else
+ \_addextgstate{tr0}{<</ca 1 /CA 1>>}%
+ \_sxdef{_transp:0}{}%
+ \_fi
+ \_fi
+ \_fi
+}
+\_def\_thetransparency{\_ifnum \_transpattr=-"7FFFFFFF 0\_else \_the\_transpattr \_fi}
+\_def\_resetattrs{\_colorattr=\_noattr \_transpattr=\_noattr}
+
+\_public \transparency \thetransparency ;
+
+ \_doc -----------------------------
We use Lua codes for RGB to CMYK or CMYK to RGB conversions and for
addition color components in the \^`\colordef` macro.
The \`\_rgbtocmyk` `<R> <G> <B> ;` expands to `<C> <M> <Y> <K>` and
@@ -411,6 +443,8 @@ and it is used in \^`\rgbcolordef` or if it is printed when \^`\onlyrgb` is decl
\_endinput
+2022-03-07 \_resetattrs instead \_resetcolor
+2022-03-05 \transparency added
2021-07-16 colors reimplemented, now they are based on attributes
2021-05-28 \rgbcmykmap introduced
2020-04-22 \replstring\tmpb{+ }{+}, {- }{-} added in \colordef, bug fixed
diff --git a/Master/texmf-dist/tex/optex/base/doc.opm b/Master/texmf-dist/tex/optex/base/doc.opm
index cb2b976e7c5..82c6bde8c63 100644
--- a/Master/texmf-dist/tex/optex/base/doc.opm
+++ b/Master/texmf-dist/tex/optex/base/doc.opm
@@ -253,7 +253,7 @@
The \^`\printdoc` `<filename><space>` and \^`\printdoctail` `<filename><space>`
commands are defined after the file `doc.opm` is load by \^`\load`~`[doc]`.
-The `\printcoc` starts reading of given `<filename>` from the second line.
+The `\printdoc` starts reading of given `<filename>` from the second line.
The file is read in {\em the listing mode}.
The `\prindoctail` starts reading given `<filename>` from the
first occurrence of the `\_endcode`. The file is read
@@ -263,7 +263,7 @@ The {\em listing mode} prints the lines as a listing of a code. This mode is
finished when first {\visiblesp` \_doc`} occurs or first `\_endcode`
occurs. At least two spaces or one tab
character must precede before such `\_doc`. On the other
-hand, the `\_encode` must be at the left edge of the line without spaces.
+hand, the `\_endcode` must be at the left edge of the line without spaces.
If this rule is not met then the listing mode continues.
If the first line or the last line of the listing mode is empty then such
diff --git a/Master/texmf-dist/tex/optex/base/f-heros.opm b/Master/texmf-dist/tex/optex/base/f-heros.opm
index 2195774b887..e7055d84f84 100644
--- a/Master/texmf-dist/tex/optex/base/f-heros.opm
+++ b/Master/texmf-dist/tex/optex/base/f-heros.opm
@@ -237,6 +237,15 @@ See the font family file `f-lmfonts.opm` or `f-poltawski.opm` where you can find
the example of the optical sizes declaration including documentation about
it.
+Several fonts don't switch to the font features if the features are
+specified directly as documented above. You must add the `script=latn;`
+specification to the features string when using these fonts, see
+`f-baskerville.opm` for example. The reason: these fonts don't follow the
+OpenType specification and they don't set the `DFLT` script but only scripts
+with given names like `latn`. And the tables implementing all font features
+are included here. You can check the internals of the font by FontForge:
+View / Show~ATT / OpenType Tables / GSUB. Do you see the `DFLT` script here?
+
If you need to create a font family file with a non-Unicode font, you can do it.
The `\_fontnamegen` must expand to the name of TFM file in this case. But we
don't prefer such font family files, because they are usable only with
diff --git a/Master/texmf-dist/tex/optex/base/f-lmfonts.opm b/Master/texmf-dist/tex/optex/base/f-lmfonts.opm
index 5356680e9d3..8fe1d34b95d 100644
--- a/Master/texmf-dist/tex/optex/base/f-lmfonts.opm
+++ b/Master/texmf-dist/tex/optex/base/f-lmfonts.opm
@@ -106,8 +106,8 @@ Note: Text fonts support optical sizes, but LatinModern-Math only for scripts.^^
\_onlyif subfam=tt: {\_fvars r b isl bisl }}
\_moddef \caps {\_onlyif subfam=rm,tt: {\_fvars rc . ic . }}
-\_def \_tryloadtt {\_fontdef\_tentt{\_LMfonts \_addto\_fontfeatures{-tlig;}\_ttset \_rm}}
-\_private \LMfonts \ttset ; % used in \_tryloadtt
+%\_famvardef\tt{\_LMfonts \_addto\_fontfeatures{-tlig;}\_ttset \_rm}
+%\_private \LMfonts \ttset ; % used in \tt, % removed 2022-02-22
\_initfontfamily % new font family must be initialized
diff --git a/Master/texmf-dist/tex/optex/base/fonts-catalog.opm b/Master/texmf-dist/tex/optex/base/fonts-catalog.opm
index 3cd02e7b277..6576e5fb116 100644
--- a/Master/texmf-dist/tex/optex/base/fonts-catalog.opm
+++ b/Master/texmf-dist/tex/optex/base/fonts-catalog.opm
@@ -1,13 +1,13 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_undefined {Font catalogue <2020-02-26>} % loaded on demand by \fontfam[catalog]
+\_codedecl \_undefined {Font catalogue <2022-02-22>} % loaded on demand by \fontfam[catalog]
\_tracinglostchars=1 % only to log file
\_initunifonts
\_begingroup
\_istoksempty\_catalogmathsample \_iftrue \_noloadmath \_fi
-\_font\_ttfixed=[LMMono10-Regular]\_relax
+\_global\_font\_ttfixed=[LMMono10-Regular]\_relax
\_fontlet\_smalltt=\_ttfixed at7pt
\_suppressfontnotfounderror=1
@@ -66,16 +66,16 @@
\_def\_wlog#1{\_nobreak\_smallskip
\_hbox to\_hsize{\_hskip25pt
- \_edef\_tmp{#1}\_replstring\_tmp{^^J}{\_par}%
+ \_edef\_tmp{#1}\_replstring\_tmp{^^J}{\_endgraf}%
\_smalltt \_noindent \_ea \string \_csname \_currfamily\_endcsname
\_vtop{\leftskip=1em \_baselineskip=9pt \_tmp \_par}\_hss
\_if\_relax\_the\_famfrom\_relax \_else from: \_the\_famfrom \_fi
}
}
-\_def\0#1{\_ifnum#1<10 0\_fi\_the#1}
-\_footline={\_hfil\_ttfixed\_the\_pageno\_hfil}
-\_headline={\_ttfixed Font Catalogue generated by \_OpTeX/ \_hfill \_the\_year-\0\_month-\0\_day}
+\_gdef\0#1{\_ifnum#1<10 0\_fi\_the#1}
+\_global\_footline={\_hfil\_ttfixed\_the\_pageno\_hfil}
+\_global\_headline={\_ttfixed Font Catalogue generated by \_OpTeX/ \_hfill \_the\_year-\0\_month-\0\_day}
\_parindent=0pt
\_ttfixed
@@ -131,6 +131,7 @@ as default for \OpTeX/) or in the file \code{fams-local.opm}. The second file
does not exist by default but users can create it. The syntax rules are
described in the \code{fams-ini.opm} file.
-
\_endcode % -------------------------------------
+2022-02-22 \_ttfixed, \footline set as global, bug fixed
+2020-02-26 released
diff --git a/Master/texmf-dist/tex/optex/base/fonts-opmac.opm b/Master/texmf-dist/tex/optex/base/fonts-opmac.opm
index 025df761a59..158f19299ea 100644
--- a/Master/texmf-dist/tex/optex/base/fonts-opmac.opm
+++ b/Master/texmf-dist/tex/optex/base/fonts-opmac.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \typosize {Font managing macros from OPmac <2021-03-10>} % preloaded in format
+\_codedecl \typosize {Font managing macros from OPmac <2022-02-22>} % preloaded in format
\_doc -----------------------------
\`\typosize` `[<font-size>/<baselineskip>]` sets given parameters.
@@ -104,7 +104,7 @@
\_mainbaselineskip=\_baselineskip
\_mainfosize=\_optsize
\_topskip=\_mainfosize \_splittopskip=\_topskip
- \_ifmmode \_else \_bf \_it \_bi \_rm \_fi % load all basic variants of the family
+ \_ifmmode \_else \_rm \_fi % load and initialize \rm variant
\_ifnum \_mfontsrule>0 \_normalmath \_fi % load math fonts first
\_let \_setmainvalues =\_setmainvaluesL
}
@@ -191,8 +191,8 @@
\_let\it =\_bi \_let\rm =\_bf \_let\_normalmath=\_boldmath \_bf
\_runboldmath
\_ifx\_ncharrmA\_undefined \_protected\_addto\rm{\_fam0 }\_protected\_addto\it{\_fam1 }%
- \_else \_protected\_def\rm {\_tryloadbf \_tenbf \_inmath{\_rmvariables \_rmdigits}}%
- \_protected\_def\it {\_tryloadbi \_tenbi \_inmath{\_itvariables}}%
+ \_else \_protected\_def\rm {\_fmodbf \_fontsel \_marm}%
+ \_protected\_def\it {\_fmodbi \_fontsel \_mait}%
\_fi
}
\_def\_runboldmath{\_boldmath}
@@ -218,6 +218,7 @@
\_endcode % -------------------------------------
History:
+2022-02-22 \_setmainvalues: only \rm initialized
2021-03-10 \boldify corrected
2021-03-09 \mfontsrule and \_setmathfonts introduced
2020-12-12 \_rmfixed fixed
diff --git a/Master/texmf-dist/tex/optex/base/fonts-preload.opm b/Master/texmf-dist/tex/optex/base/fonts-preload.opm
index d56d5c0a78a..8562da786c6 100644
--- a/Master/texmf-dist/tex/optex/base/fonts-preload.opm
+++ b/Master/texmf-dist/tex/optex/base/fonts-preload.opm
@@ -1,24 +1,32 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \tenrm {Latin Modern fonts (EC) preloaded <2020-01-23>} % preloaded in format
+\_codedecl \tenrm {Latin Modern fonts (EC) preloaded <2022-02-12>} % preloaded in format
+
+\_ifx\fontspreload\_relax
+ \_let\_tenrm=\_nullfont \_let\_tenbf=\_nullfont \_let\_tenit=\_nullfont
+ \_let\_tenbi=\_nullfont \_let\_tentt=\_nullfont
+\_else
+ % Only few text fonts are preloaded:
+ % allow missing fonts during format generation
+ \_suppressfontnotfounderror=1
+ \_font\_tenrm=ec-lmr10 % roman text
+ \_font\_tenbf=ec-lmbx10 % boldface extended
+ \_font\_tenit=ec-lmri10 % text italic
+ \_font\_tenbi=ec-lmbxi10 % bold italic
+ \_font\_tentt=ec-lmtt10 % typewriter
+ \_suppressfontnotfounderror=0
+\_fi
-% Only few text fonts are preloaded:
-
-\_font\_tenrm=ec-lmr10 % roman text
-\_font\_tenbf=ec-lmbx10 % boldface extended
-\_font\_tenit=ec-lmri10 % text italic
-\_font\_tenbi=ec-lmbxi10 % bold italic
-\_font\_tentt=ec-lmtt10 % typewriter
\_tenrm
\_public \tenrm \tenbf \tenit \tenbi \tentt ;
\_endcode %---------------------------------------------------
-The format in lua\TeX/ can download only non-Unicode fonts. Latin Modern EC is
+The format in Lua\TeX/ can download only non-Unicode fonts. Latin Modern EC is
loaded here. These fonts are totally unusable in LuaTeX when languages with out
of ASCII or ISO-8859-1 alphabets are used (for example Czech). We load only
-a few 8bit fonts here especially for simple testing the format.
+a few 8bit fonts here especially for simple testing of the format.
But, if the user needs to do more serious work, he/she can
use `\fontfam` macro to load a selected font family of Unicode fonts.
@@ -34,3 +42,14 @@ are declared as `\public` here but only for backward compatibility. We don't
use them in the Font Selection System. But the protected versions of these
control sequences are used in the Font Selection System.
+If the `*.tfm` files are missing during format generation then the format is
+succesfully generated without any pre-loaded fonts. It doesn't matter if each
+document processed by \OpTeX/ declares Unicode fonts. You can create such
+fonts-less format anyway if you set \`\fontspreload` to `\relax` before
+`\input optex.ini`, i.e.:
+`luatex -ini '\let\fontspreload=\relax \input optex.ini'`
+
+\_endinput
+
+2022-02-12: \fontspreload added
+2020-01-23: released
diff --git a/Master/texmf-dist/tex/optex/base/fonts-resize.opm b/Master/texmf-dist/tex/optex/base/fonts-resize.opm
index 68ebf763db4..e49303f3775 100644
--- a/Master/texmf-dist/tex/optex/base/fonts-resize.opm
+++ b/Master/texmf-dist/tex/optex/base/fonts-resize.opm
@@ -1,11 +1,35 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \setfontsize {Font resizing macros <2021-05-02>} % preloaded in format
+\_codedecl \setfontsize {Font resizing macros <2022-02-22>} % preloaded in format
\_doc -----------------------------
- The \`\setfontsize` `{<sizespec>}` saves the `<sizespec>` to the \`\_sizespec` macro.
- The \`\_optsize` value is calculated from the `<sizespec>`.
- If the `<sizepec>` is in the `mag<number>` format then the contents of
+ \`\initunifonts` macro extends \LuaTeX's font capabilities,
+ in order to be able to load Unicode fonts. Unfortunately, this part of
+ \OpTeX/ depends on the `luaotfload` package, which adapts Con\TeX/t's generic
+ font loader for plain \TeX/ and \LaTeX. `luaotfload` uses Lua functions
+ from \LaTeX's `luatexbase` namespace, we provide our own replacements.
+ \^`\initunifonts` sets itself to relax because we don't want to do
+ this work twice.
+ \_cod -----------------------------
+
+\_def\_initunifonts {%
+ \_directlua{%
+ require('luaotfload-main')
+ luaotfload.main()
+ optex_hook_into_luaotfload()
+ }%
+ \_glet \_fmodtt=\_unifmodtt % use \_ttunifont for \tt
+ \_glet \_initunifonts=\_relax % we need not to do this work twice
+ \_glet \initunifonts=\_relax
+}
+\_public \initunifonts ;
+
+ \_doc -----------------------------
+ The \`\setfontsize` `{<size spec>}` saves the `<size spec>` to the \`\_sizespec` macro.
+ The \`\_optsize` value is calculated from the `<size spec>`.
+ If the <size spec> is in the format `scaled<factor>` then
+ `\_optsize` is set from \`\defaultoptsize`.
+ If the `<size spec>` is in the `mag<number>` format then the contents of
the `\_sizespec` macro is re-calculated to the `at<dimen>` format using
previous `\_optsize` value.
\par \goodbreak
@@ -18,7 +42,6 @@
\_def\_setfontsize #1{%
\_edef\_sizespec{#1}%
\_ea \_setoptsize \_sizespec\_relax
- \_reloading
}
\_def\_setoptsize {\_isnextchar a{\_setoptsizeA}
{\_isnextchar m{\_setoptsizeC}{\_setoptsizeB}}}
@@ -33,80 +56,84 @@
\_public \setfontsize \defaultoptsize ;
\_doc -----------------------------
+ The `\fontname` primitive returns the <font file name> optionally
+ followed by <size spec>. The \`\xfontname` macro expands to <font file name>
+ without <size spec>. We need to remove the part `<space>at<dimen>` from
+ `\fontname` output. The letters `at` have category 12.
+ \_cod -----------------------------
+
+\_edef\_stringat{\_string a\_string t}
+\_edef\_xfontname#1{\_unexpanded{\_ea\_xfontnameA\_fontname}#1 \_stringat\_relax}
+\_expanded{\_def\_noexpand\_xfontnameA#1 \_stringat#2\_relax}{#1}
+
+ \_doc -----------------------------
\`\fontlet` `<font switch A> <font switch B> <size spec>` does
\begtt \catcode`\<=13
- \font <font switch A> = <fontname> <sizespec>
+ \font <font switch A> = {<font file name>} <size spec>
\endtt
- The `<fontname>` is extracted using the primitive command `\_fontname <font switch B>`.
+ Note, that the `\_xfontname` output is converted due to optical size data using `\_optfn`.
\_cod -----------------------------
-\_def\_fontlet#1#2{\_ifx #2=\_ea\_fontlet \_ea#1\_else
- \_ea\_font\_ea#1\_ea\_rfontskipat\_fontname#2 \_relax\_space \_fi
-}
-\_public \fontlet ;
+\_def\_fontlet#1#2{\_ifx #2=\_ea\_fontlet \_ea#1\_else \_font #1{\_optfn{\_xfontname#2}}\_fi}
+\_public \xfontname \fontlet ;
\_doc -----------------------------
- \`\newcurrfontsize` `<size spec>` sets current font size to the `<size spec>`
- It is implemented by \^`\fontlet`.
- The font switch of the current font is extracted by `\_the\_font`.
- We must re-create the control sequence `\_the\_font` because
- its original meaning is set to \"inaccessible" by \TeX/ when `\font`
- primitive is started.
+ \`\newcurrfontsize` `<size spec>` does
+ \^`\fontlet` `<saved switch>=\font <size spec>\_relax <saved switch>`.
+ It changes the current font at the given <size spec>.
\nl
- \`\resizethefont` is implemented by `\newcurrfontsize` using data from
+ \`\resizethefont` is implemented by \^`\newcurrfontsize` using data from
the \^`\_sizespec` macro.
\_cod -----------------------------
\_def \_newcurrfontsize #1{% \newcurrfontsize{at25pt}
- \_edef\_tmp{\_ea\_csstring \_the\_font}%
- \_ea \_fontlet \_csname \_tmp\_ea\_endcsname \_the\_font \_space #1\_relax
- \_ea\_fontloaded \_csname \_tmp \_ea\_endcsname \_csname \_tmp\_endcsname
+ \_ea\_def \_ea\_tmp \_ea{\_csname \_ea\_csstring \_the\_font \_endcsname}%
+ \_ea\_fontlet \_tmp \_font #1\_relax
+ \_ea\_fontloaded \_tmp
+ \_tmp
}
\_protected\_def \_resizethefont{\_newcurrfontsize\_sizespec}
-
- \_public \newcurrfontsize \resizethefont ;
+\_public \newcurrfontsize \resizethefont ;
\_doc -----------------------------
The \`\_regtfm` `<font id> <optical size data>`
- saves the <optical size data> concerned to `<font id>`.
+ registers optical sizes data directly by the font file names.
+ This can be used for `tfm` files or OpenType files without
+ various font features. See also \`\_regoptsizes` in section~\ref[optsizes].
+ The `\_regtfm` command saves the <optical size data> concerned to the `<font id>`.
The `<optical size data>` is in the form as shown below in the code where
`\_regtfm` is used.
\nl
- The \`\_wichtfm` `<fontname>` expands to the `<fontname>` or to the corrected
- `<fontname>` read from the `<optical size data>`. It is used in the
- \^`\_rfontskipat` macro and it is used in \^`\fontlet` macro.
- It means that each `<fontname>` generated by the `\fontname` primitive in the
- `\fontlet` macro is processed by the `\_whichtfm`. The real `<fontname>` or
- corrected `<fontname>` (depending on the optical data does not exist or exist)
- is the output of the expansion before `\font` primitive takes this output
- as its parameter.
-
- The implementation detail: The `\_<font id>:reg` is defined as the
- `<optical size data>` and all control sequences `\_<fontname>:reg`
+ The \`\_optfn` `<fontname>` expands to the `<fontname>` or to the corrected
+ `<fontname>` read from the `<optical size data>` registered by `\_regtfm`.
+ It is used in the \^`\fontlet` macro.
+
+ The implementation detail: The `\_reg:<font id>` is defined as the
+ `<optical size data>` and all control sequences `\_reg:<fontname>`
from this data line have the same meaning because of the
- \`\_reversetfm` macro. The `\_whichtfm` expands this data line and apply
- \`\_dowhichtfm`. This macro selects the right result from the data line
+ \`\_reversetfm` macro. The `\_optfn` expands this data line and apply
+ \`\_runoptfn`. This macro selects the right result from the data line
by testing with the current `\_optsize` value.
\_cod -----------------------------
-\_def\_regtfm #1 0 #2 *{\_ea\_def \_csname _#1:reg\_endcsname{#2 16380 \_relax}%
+\_def\_regtfm #1 0 #2 *{\_ea\_def \_csname _reg:#1\_endcsname{#2 16380 \_relax}%
\_def\_tmpa{#1}\_reversetfm #2 * %
}
\_def\_reversetfm #1 #2 {% we need this data for \_setmathfamily
- \_ea\_let\_csname _#1:reg\_ea\_endcsname
- \_csname _\_tmpa:reg\_endcsname
+ \_ea\_let\_csname _reg:#1\_ea\_endcsname
+ \_csname _reg:\_tmpa\_endcsname
\_if*#2\_else \_ea\_reversetfm \_fi
}
-\_def\_whichtfm #1{%
- \_ifcsname _#1:reg\_endcsname
- \_ea\_ea\_ea \_dowhichtfm
- \_csname _#1:reg\_ea\_endcsname
+\_def\_optfn #1{%
+ \_ifcsname _reg:#1\_endcsname
+ \_ea\_ea\_ea \_runoptfn
+ \_csname _reg:#1\_ea\_endcsname
\_else
#1%
\_fi
}
-\_def\_dowhichtfm #1 #2 {%
- \_ifdim\_optsize<#2pt #1\_ea\_ignoretfm\_else \_ea\_dowhichtfm
+\_def\_runoptfn #1 #2 {%
+ \_ifdim\_optsize<#2pt #1\_ea\_ignoretfm\_else \_ea\_runoptfn
\_fi
}
\_def\_ignoretfm #1\_relax{}
@@ -116,24 +143,66 @@
\_cod -----------------------------
\_regtfm lmr 0 ec-lmr5 5.5 ec-lmr6 6.5 ec-lmr7 7.5 ec-lmr8 8.5 ec-lmr9 9.5
- ec-lmr10 11.1 ec-lmr12 15 ec-lmr17 *
+ ec-lmr10 11.1 ec-lmr12 15 ec-lmr17 *
\_regtfm lmbx 0 ec-lmbx5 5.5 ec-lmbx6 6.5 ec-lmbx7 7.5 ec-lmbx8 8.5 ec-lmbx9 9.5
- ec-lmbx10 11.1 ec-lmbx12 *
+ ec-lmbx10 11.1 ec-lmbx12 *
\_regtfm lmri 0 ec-lmri7 7.5 ec-lmri8 8.5 ec-lmri9 9.5 ec-lmri10 11.1 ec-lmri12 *
\_regtfm lmtt 0 ec-lmtt8 8.5 ec-lmtt9 9.5 ec-lmtt10 11.1 ec-lmtt12 *
\_endcode %---------------------------------------------------
-\sec[setfontsize] Scaling fonts in text mode (low-level macros)
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\sec[fontprimitive] Using `\font` primitive directly
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-This section describes single part of Font Selection System: resizing fonts
-to various sizes. This feature is available in both modes: TFM mode
-(initialized when format starts) and OTF mode (after \~`\fontfam` or
-\~`\initunifonts` is used).
+You can declare a new {\em font switch} by `\font` primitive:
+\begtt \catcode`\<=13
+\font \<font switch> = <font file name> <size spec>
+% for example:
+\font \tipa = tipa10 at12pt % the font tipa10 at 10pt is loaded
+% usage:
+{\tipa TEXT} % the TEXT is printed in the loaded font.
+\endtt
+The <size spec> can be empty or `at<dimen>` or `scaled<scale factor>`. The
+<font file name> must be terminated by space or surrounded in the braces.
+
+\OpTeX/ starts with `\font` primitive which is able to read only `tfm` files.
+i.e.\ the `<font file name>.tfm` (and additional data for glyphs)
+must be correctly installed in your system. If you want to load
+OpenType `otf` or `ttf` font files, use the declarator \^`\initunifonts`.
+This command adds additional features to the `\font` primitive which
+gives the extended syntax:
+\begtt \catcode`\<=13
+\font \<font switch> = {[<font file name>]:<font features>} <size spec>
+% or
+\font \<font switch> = {<font name>:<font features>} <size spec>
+\endtt
+where <font file name> is name of the OpenType font file without extension
+(extensions `.otf` or `.ttf` are assumed). The braces in the syntax
+are optional, use them when the <font file name> or <font name> includes spaces.
+The original syntax for `tfm` files is also available. Example:
+\begtt
+\initunifonts
+\font\crimson=[Crimson-Roman] at11pt % the font Crimson-Regular.otf is loaded
+\font\crimsonff=[Crimson-Roman]:+smcp;+onum at11pt % The same font is re-loaded
+ % with font features
+{\crimson Text 12345} % normal text in Crimson-Regular
+{\crimsonff Text 12345} % Crimson-Regular with small capitals and old digits
+\endtt
+\^`\initunifonts` loads the implementation of the `\font`
+primitive from `luaotfload` package. More information is available
+in the `luaotfload-latex.pdf` file.
+
+Note, that \^`\fontfam` does (among other things) \^`\initunifonts`
+internally. You need not to specify it if \^`\fontfam` is used.
+
+It seems that you must decide about final size of the font before it is
+loaded by the `\font` primitive. It is not exactly true; \OpTeX/ offers
+powerful possibility to resize the font already loaded on demand.
+See the example at the end of next subsection.
-\secc The `\setfontsize` macro
+
+\secc[setfontsize] The `\setfontsize` macro
The \^`\setfontsize` `{<size spec>}`
saves the information about `<size spec>`. This information is taken into
@@ -148,7 +217,7 @@ or `\resizethefont` is used. The `<size spec>` can be:
scaled in respect to the current size of the fonts given by the previous
\^`\setfontsize` command.
\enditems
-The initialization value in \OpTeX/ is given by `\setfontsize{at10pt}`.
+The initial value in \OpTeX/ is given by `\setfontsize{at10pt}`.
The \^`\resizethefont` resizes the currently selected font to the size given by previous
\^`\setfontsize`. For example
@@ -172,81 +241,88 @@ typography.
Text \smaller text \smaller text \smaller text.
\endtt
-\secc[fontprimitive] The `\font` primitive
-
-If you load a font directly by `\font` primitive and you want to
-create a size-dependent selector for such font then you can use
-\~`\resizethefont`:
-
-\begtt
-\font\tencomfortaa=Comfortaa-Regular-T1 at10pt
-\def\comfortaa{\tencomfortaa\resizethefont}
-
-\comfortaa The 10 pt text is here
-\setfontsize{at12pt}
-\comfortaa The 12 pt text is here
-\endtt
-%
-The example above uses the 8\,bit `tfm` font. You can use Unicode font too, of
-course. The \^`\fontfam` macro initializes the extended `\font` primitive
-features for \LuaTeX/ (see section \ref[exfont]).
-If you didn't use this command, you must initialize
-these features by the \^`\initunifonts` command explicitly, for example:
+The \^`\resizethefont` works with arbitrary current font, for example with the
+font loaded directly by `\font` primitive. For example:
\begtt
\initunifonts
-\font\tencyklop=[cyklop-regular] at10pt % the font cyklop-regular.otf is loaded
-\def\cyklop{\tencyklop\resizethefont}
+\font\tencrimson=[Crimson-Roman]:+onum % font Crimson-Regular at 10 pt is loaded
+\def\crimson{\tencrimson\resizethefont} % \crimson uses the font size on demand
-\cyklop The 10 pt text is here
+\crimson The 10 pt text is here.
\setfontsize{at12pt}
-\cyklop The 12 pt text is here
+\crimson The 12 pt text is here.
\endtt
+This is not only an academical example. The `\csrimson` command defined here
+behaves like variant selector in the Font Selection System (section~\ref[fontsystem]).
+It takes only information about size from the font context, but it is
+sufficient. You can use it in titles, footnotes, etc. The font size
+depending on surrounding size is automatically selected.
+
\secc[fontlet] The \code{\\fontlet} declarator
We have another command for scaling: \^`\fontlet` which can resize
arbitrary font given by its font switch.
-This font switch was declared by the
-`\font` primitive or the \~`\fontdef` macro.
-
\begtt \catcode`\<=13
- \fontlet \<newfont> = \<fontswitch> <sizespec>
+ \fontlet \<new font switch> = \<given font switch> <size spec>
example:
\fontlet \bigfont = \_tenbf at15pt
\endtt
+The `\<given font switch>` must be declared previously by `\font` or
+\^`\fontlet` or \~`\fontdef`. The `\<new font switch>` is declared as the
+same font at given <size spec>. The equal sign in the syntax is optional.
+You can declare `\<new font switch>` as the scaled current font by
+\begtt \catcode`\<=13
+\fontlet \<new font switch> = \font <size spec>
+\endtt
-The resulted `\bigfont` is the same as in the previous example where \~`\fontdef`
-was used. The advantage of \~`\fontdef` macro will be more clear when you load
-font families by `\fontfam` and you are using more font modifiers declared
-in such families.
-
-Summary: you can declare font switches:
-\begitems
-* by the `\font` primitive if you know the font file,
-* by the \^`\fontlet` command if you know the font switch and the size, or
-* by the \~`\fontdef` command if you know the variant and modifiers.
-\enditems
\secc Optical sizes
There are font families with more font files where almost the same font is
implemented in various design sizes: `cmr5`, `cmr6`, `cmr7`, `cmr8`, `cmr9`,
`cmr10`, `cmr12`, `cmr17` for example. This feature is called \"optical
-sizes". \OpTeX/ chooses a font with an optical size closest to desired size
-specified by the \^`\setfontsize`, when `at<dimen>` or `mag<coefficient>` is used.
-When `scaled<scale factor>` is used then optical size is chosen using the value
-of the `\defaultoptsize` register and such font is scaled by the specified
-`<scale factor>`. There is `\defaultoptsize=10pt` by default.
-
-Font collections with optical sizes must be registered by the
-\^`\_regtfm` for `tfm` files or \^`\_regoptsizes` for Unicode fonts.
-\OpTeX/ registers 8bit Latin Modern fonts in the format
-and OTF Latin Modern fonts in the `f-lmfonts.opm` file.
+sizes". Each design size is implemented in its individual font file and \OpTeX/ is
+able to choose right file if various optical sizes and corresponding file
+names are declared for the font by \^`\_regtfm` or \^`\_regoptsizes` command.
+The command \^`\setfontsize` sets the internal reuirements for
+optical size if the parameter is in the format `at<dimen>` or `mag<factor>`.
+Then the command \^`\resizethefont` or variant selectors try to choose
+the font suitable for the required optical size. For example
+\begtt
+\fontfam[lm]
+ The text is printed in font [lmroman10-regular] at 10 pt.
+\setfontsize{at13pt}\rm
+ Now in the text is printed in [lmroman12-regular] at 13 pt.
+\endtt
See also section~\ref[optsizes].
+
+\secc Font rendering
+
+If \^`\initunifonts` isn't declared then \OpTeX/ uses classical font
+renderer (like in `pdftex`). The extended font renderer implemented in the
+Luaotfload package is started after \^`\initunifonts`.
+
+The \OpTeX/ format uses `luatex` engine by default but
+you can initialize it by `luahbtex` engine too. Then the harfbuzz library is
+ready to use for font rendering as an alternative to built-in font renderer
+from Luaotfload. The harfbuzz library gives more features for rendering
+Indic and Arabic scripts. But it is not used as default, you need to specify
+`mode=harf` in the fontfeatures field when `\font` is used. Moreover, when
+`mode=harf` is used, then you must specify `script` too. For example
+
+\begtt
+\font\devafont=[NotoSansDevanagari-Regular]:mode=harf;script=dev2
+\endtt
+%
+If the `luahbtex` engine is not used then `mode=harf` is ignored. See
+Luaotfload documentation for more information.
+
\_endinput
+2022-02-22 Font Selection System reimplemented, \fontsel introduced
2021-05-02 better concept of doc, moving parts to fonts-select
2021-04-17 \_fontloaded, \_newfontloaded introduced
2020-04-17 \resizethefont introduced
diff --git a/Master/texmf-dist/tex/optex/base/fonts-select.opm b/Master/texmf-dist/tex/optex/base/fonts-select.opm
index d8d3982ba62..33d331150b9 100644
--- a/Master/texmf-dist/tex/optex/base/fonts-select.opm
+++ b/Master/texmf-dist/tex/optex/base/fonts-select.opm
@@ -1,116 +1,72 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \fontfam {Fonts selection system <2021-09-24>} % preloaded in format
+\_codedecl \fontfam {Fonts selection system <2022-02-22>} % preloaded in format
\_doc -----------------------------
- The variant selectors \^`\rm`, \^`\bf`, \^`\it`, \^`\bi`, \^`\tt`
- are defined (roughly speaking) by
- \begtt \catcode`\<=13
- \def\<XX> {\_tryload<XX>\_ten<XX>}
- \endtt
- where <XX> is \"internal variant name" `rm` or `bf` or `it` or `bi` or `tt`.
- There are five \"internal font switchers" `\_tenrm`, `\_tenbf`, `\_tenit`,
- `\_tenbi` and `\_tentt`. They are used almost for all fonts selected by the Fonts
- Selection System. For example, `\_tenbf` is the switcher for bold variant of
- the current family in the current font context. The \^`\bf` macro is defined as
- `\_tryloadbf \_tenbf`. If the font context (font family, font size, features)
- is not changed, then `\_tryloadbf` is `\relax` and `\_tenbf` font switcher selects
- given font. If the font context is changed, then `\_tryloadbf` is re-defined (see
- \^`\_reloading` macro) to load new bold variant of the font using \^`\_resizefont`
- The loaded font is saved to `\_tenbf` switcher and `\_tryloadbf` returns
- back to the `\relax` meaning. So, `\bf` macro loads
- new font with current font context and then selects it by `\_tenbf`
- selector. The word \"ten" is used here
- only for historical reason; the font can be at arbitrary size.
- \nl
- The \`\_reloading` macro is run whenever font context is changed.
- It activates `\_tryload<XX>` for `<XX>` in `rm`, `bf`, `it` and `bi`.
- The \`\_loadf``{<XX>}\ten<XX>` is processed for this.
- \nl
- The \`\_tryloadtt` is implemented differently because we want to keep
- family independence for `\tt` macro, see section~\ref[tt].
- So, `\_tryloadtt` is defined constantly as \"loading `\tt` font" and it is
- not re-defined to `\relax`. On the other hand, `\_tryloadtt` is
- re-defined in the \^`\initunifonts` macro or when
- \~`\famvardef``\tt` is used.
+ The main principle of the Font Selection System is: run one or more
+ modifiers followed by \^`\fontsel`. Modifiers save data and \^`\fontsel`
+ selects the font considering saved data. Each basic variant selector
+ \`\rm`, \`\bf`, \`\it`, \`\bi`, and \`\tt` runs internal variant modifier
+ \`\_fmodrm`, \`\_fmodbf`, \`\_fmodit`, \`\_fmodbi` and \`\_fmodtt`.
+ These modifiers save their data to the \`\_famv` macro which is
+ `rm` or `bf` or `it` or `bi` or `tt`. The \`\currvar` selector
+ is \^`\fontsel` by default, but variant selectors declared by
+ \^`\famvardef` change it.
\_cod -----------------------------
-\_def\_reloading{\_loadf{rm}\_tenrm \_loadf{bf}\_tenbf \_loadf{it}\_tenit \_loadf{bi}\_tenbi}
-\_def\_loadf#1#2{\_sdef{_tryload#1}{\_ifmmode \_else \_resizefont{#1}#2\_fi}}
-\_def\_tryloadtt{\_resizefont{tt}\_tentt} % only in TFM mode
-
-\_let\_tryloadrm=\_relax
-\_let\_tryloadbf=\_relax
-\_let\_tryloadit=\_relax
-\_let\_tryloadbi=\_relax
-
- \_doc ----------------------------
- The Font Selection system allows to use \`\currvar`
- instead of an explicitly specified variant selector. The current variant
- is extracted from `\the\font` output which could be the `\_ten<XX>` control
- sequence. Then `\currvar` expands to `\_rm` or `\_it` etc.
- \_cod ----------------------------
-
-\_protected \_def \_currvar{\_cs{_currvar:\_ea \_csstring \_the\_font}}
-\_sdef{_currvar:_tenrm}{\_rm}
-\_sdef{_currvar:_tenbf}{\_bf}
-\_sdef{_currvar:_tenit}{\_it}
-\_sdef{_currvar:_tenbi}{\_bi}
-\_sdef{_currvar:_tentt}{\_tt}
-\_public \currvar ;
+\_def\_famv{rm} % default value
+\_protected\_def \_fmodrm {\_def\_famv{rm}}
+\_protected\_def \_fmodbf {\_def\_famv{bf}}
+\_protected\_def \_fmodit {\_def\_famv{it}}
+\_protected\_def \_fmodbi {\_def\_famv{bi}}
+\_protected\_def \_fmodtt {\_def\_famv{tt}}
+
+\_protected\_def \_rm {\_fmodrm \_fontsel \_marm}
+\_protected\_def \_bf {\_fmodbf \_fontsel \_mabf}
+\_protected\_def \_it {\_fmodit \_fontsel \_mait}
+\_protected\_def \_bi {\_fmodbi \_fontsel \_mabi}
+\_protected\_def \_tt {\_fmodtt \_fontsel \_matt}
+\_protected\_def \_currvar {\_fontsel} \_protected\_def \currvar{\_currvar}
+\_public \rm \bf \it \bi \tt ;
\_doc -----------------------------
- The \`\_resizefont` `{<variant-name>}\<font switch>` is the heart of the
- Fonts Selection System. It resizes the font given by the variant with
- respect to the current font context and sets a new <font-switch>.
- The <variant-name> is `rm` or `bf` or `it` or `bi` or `tt`.
- The new <font-switch> is declared (roughly speaking) by:
- \begtt \catcode`<=13
- \_font <font switch> = <fontname of>\_ten<variant-name> \_sizespec % in TFM mode
- \_font <font switch> = {\_fontnamegen} \_sizespec % in OTF mode
- \endtt
- The font is loaded by \`\_doresizefont``<font switch>`. This macro has
- meaning \`\_doresizetfmfont` in TFM mode (default in format) and it
- switches to \^`\_doresizeunifont` when \^`\initunifonts` is used.\nl
- The `<fontname of>` is generated by the `\fontname` \TeX/ primitive where
- \`\_rfontskipat` removes the `at<dimen>` part of the `\fontname` output.\nl
- The \`\_whatresize` is defined as `<variant-name>`.\nl
- The \^`\_fontloaded``<font switch>` is a macro which can be used for
- post-processing when a font is loaded.
+ The \`\fontsel` creates the <font switch> in the format `\_ten<famv>`
+ and loads the font associated to the <font switch>.
+ The loading is done by:
+ \begitems \style a
+ * `\letfont <font switch> = \savedswitch \_sizespec`
+ * `\font <font switch> = \fontnamegen \_sizespec`
+ \enditems
+ The a) variant is used when \~`\_fontnamegen` isn't defined, i.e.\
+ \^`\fontfam` wasn't used: only basic variant and \^`\_sizespec` is taken
+ into account. The b) variant is processed when \^`\fontfam` was used:
+ all data saved by all font modifiers are used during expansion of \^`\_fontnamegen`.\nl
+ After the font is loaded, final job is done by \`\_fontselA``<font-switch>`.
\_cod -----------------------------
-\_def\_resizefont#1#2{%
- \_edef\_whatresize{#1}\_doresizefont#2\_relax \_fontloaded #2%
- \_lastmagsize=\_zo
- \_if t\_ignoresecond#1\_else \_slet{_tryload#1}{_relax}\_fi
+\_protected\_def \_fontsel {%
+ \_ifx\_fontnamegen\_undefined % \fontfam was not used
+ \_ea\_let \_ea\_tmpf \_csname _ten\_famv\_endcsname
+ \_ea\_fontlet \_csname _ten\_xfamv\_endcsname \_tmpf \_sizespec
+ \_else % \fontfam is used
+ \_ea\_font \_csname _ten\_xfamv\_endcsname {\_fontnamegen}\_sizespec
+ \_fi \_relax
+ \_ea \_fontselA \_csname _ten\_xfamv\_endcsname
}
-\_def\_doresizetfmfont#1{\_logfont{#1}%
- \_ea\_font\_ea#1\_ea\_rfontskipat
- \_fontname \_cs{_ten\_whatresize} \_relax\_space \_sizespec \_relax
+\_def\_fontselA #1{%
+ \_protected\_def \_currvar {\_fontsel}% default value of \_currvar
+ \_logfont #1% font selecting should be logged.
+ \_setwsp #1% wordspace setting
+ \_fontloaded #1% initial settings if font is loaded firstly
+ #1% select the font
}
-\_let\_doresizefont=\_doresizetfmfont
-\_def\_logfont#1{} % default is no logging of used fonts
+\_def \_logfont #1{}
+\_def \_xfamv {\_famv}
-\_def\_rfontskipat#1{\_ifx#1"\_ea\_rfskipatX \_else\_ea\_rfskipatN\_ea#1\_fi}
-\_def\_rfskipatX #1" #2\_relax{"\_whichtfm{#1}"}
-\_def\_rfskipatN #1 #2\_relax{\_whichtfm{#1}}
+\_public \fontsel ;
\_doc -----------------------------
- \`\_doresizeunifont``<font-switch>` implements the OTF mode of
- loading fonts \^`\_doresizefont`.
- There is a fallback to TFM mode if \^`\_fontnamegen` is not defined.\nl
- The \^`\_fontnamegen` expands to the font name/file:font-features
- depending on the current font context.
- \_cod -----------------------------
-
-\_def\_doresizeunifont #1{\_logfont{#1}%
- \_ifx\_fontnamegen\_undefined \_doresizetfmfont#1\_else
- \_font#1={\_fontnamegen} \_sizespec \_relax \_setwsp#1\_relax
- \_fi
-}
-
- \_doc -----------------------------
- If a font is loaded by \^`\_resizefont` or \^`\resizethefont` then the
+ If a font is loaded by macros \^`\fontsel` or \^`\resizethefont` then the
\`\_fontloaded``<font switch>` is called immediately after it. If the font
is loaded first then its `\skewchar` is equal to $-1$. We run
\`\_newfontloaded``<font switch>` and set `\skewchar=-2` in this case.
@@ -120,7 +76,7 @@
globally saved to the font (like `\fontdimen`). If it is used in math
typesetting then it is set to a positive value.\nl
The `\_newfontloaded` should be defined for micro-typographic configuration of
- fonts, for example. See
+ fonts, for example. The `mte.opm` package uses it. See also
\ulink[http://petr.olsak.net/optex/optex-tricks.html\#fontexpand]{\OpTeX/ trick 0058}.
\_cod -----------------------------
@@ -128,36 +84,32 @@
\_def\_newfontloaded #1{}
\_doc -----------------------------
- \`\initunifonts` macro extends \LuaTeX's font capabalities,
- in order to be able to load Unicode fonts. Unfortunately, this part of
- \OpTeX/ depends on the `luaotfload` package, which adapts Con\TeX/t's generic
- font loader for plain \TeX/ and \LaTeX. `luaotfload` uses Lua functions
- from \LaTeX's `luatexbase` namespace, we provide our own replacements.
- Moreover, `\initunifont` switches with
- the \^`\_doresizefont` macro to OTF mode which is represented by the
- macro \^`\_doresizeunifont`.
- Finally, \^`\initunifonts` sets itself to relax because we don't want to do
- this work twice.\nl
- \`\_ttunifont` is default font for `\tt` variant.
+ \`\_ttunifont` is default font for \^`\tt` variant when \^`\initunifonts` is declared.
User can re-define it or use \^`\famvardef``\tt`.
+ The \`\_unifmodtt` macro is used instead \^`\_fmodtt` after
+ \^`\initunifonts`. It ignores the loading part of the following \^`\fontsel`
+ and do loading itself.
\_cod -----------------------------
-\_def\_initunifonts {%
- \_directlua{%
- require('luaotfload-main')
- luaotfload.main()
- optex_hook_into_luaotfload()
- }%
- \_gdef\_rfskipatX ##1" ##2\_relax{"##1"}%
- \_global\_let \_doresizefont=\_doresizeunifont
- \_gdef\_tryloadtt {\_begingroup \_let\_fontnamegen\_ttunifont % \tt uses \_ttunifont
- \_resizefont{tt}\_tentt\_relax \_ea\_endgroup \_ea\_let \_ea\_tentt \_the\_tentt}%
- \_global\_let \_initunifonts=\_relax % we need not to do this work twice
- \_global\_let \initunifonts=\_relax
-}
\_def\_ttunifont{[lmmono10-regular]:\_fontfeatures-tlig;}
+\_def\_unifmodtt\_fontsel{% ignore following \_fontsel
+ \_ea\_font \_csname _ten\_ttfamv\_endcsname {\_ttunifont}\_sizespec \_relax
+ \_ea\_fontselA \_csname _ten\_ttfamv\_endcsname
+ \_def \_currvar{\_tt}%
+}
+\_def\_ttfamv{tt}
-\_public \initunifonts ;
+ \_doc ----------------------------
+ A large part of the Font Selection System was re-implemented in Feb. 2022.
+ We want to keep backward compatibility:
+ \_cod ----------------------------
+
+\_def \_tryloadrm\_tenrm {\_fmodrm \_fontsel}
+\_def \_tryloadbf\_tenbf {\_fmodbf \_fontsel}
+\_def \_tryloadit\_tenit {\_fmodit \_fontsel}
+\_def \_tryloadbi\_tenbi {\_fmodbi \_fontsel}
+\_def \_tryloadtt\_tentt {\_fmodtt \_fontsel}
+\_def \_reloading {}
\_doc -----------------------------
The \`\_famdecl` `[<Family Name>] \<Famselector> {<comment>} {<modifiers>} {<variants>} {<math>}`\nl
@@ -186,10 +138,10 @@
\_protected\_edef#2{\_def\_noexpand\_currfamily{\_csstring #2}\_unexpanded{#8\_resetfam}}%
\_ea \_let \_csname _f:\_currfamily:main.fam\_endcsname =#2%
\_fi
- \_else \_csname _f:\_csstring#2:main.fam\_endcsname \_reloading \_rm \_ea \_endinput \_fi
+ \_else \_csname _f:\_csstring#2:main.fam\_endcsname \_rm \_ea \_endinput \_fi
}
\_def\_initfontfamily{%
- \_csname _f:\_currfamily:main.fam\_endcsname \_reloading \_rm
+ \_csname _f:\_currfamily:main.fam\_endcsname \_rm
}
\_doc -----------------------------
@@ -225,7 +177,7 @@
\_sdef{_fvar:bi}{#4}%
\_ifx.#4\_slet{_fvar:bi}{_fvar:it}\_fi
}
-\_def\_currV{\_cs{_fvar:\_whatresize}}
+\_def\_currV{\_trycs{_fvar:\_famv}{rm}}
\_def\_V{ }
\_def \_fsetV #1 {\_fsetVa #1,=,}
\_def \_fsetVa #1=#2,{\_isempty{#1}\_iffalse
@@ -248,33 +200,31 @@
the warning. When the `\_currfamily` value is
changed then we can declare the same `\<modifier>` with a different meaning.
- When a user declares a prefixed variant of the `\<modifier>` then unprefixed
- modifier name is used in internal macros, this is the reason why we are using
- the \`\_remifirstunderscore``\_tmp` (where `\_tmp` expands to
- `_<something>` or to `<something>`. The `\_remifirstunderscore`
- redefines `\_tmp` in the way that it
- expands only to `<something>` without the first `_`.
-
\`\_setnewmeaning` `<cs-name>=\_tmpa <by-what>` does exactly `\_let <csname>=\_tmpa`
but warning is printed if <cs-name> is defined already and it is not a variant
selector or font modifier.
\`\_addtomodlist` `<font modifier>` adds given modifier to \`\_modlist`
- macro. This list is used after `\resetmod` when a new family is selected by
+ macro. This list is used after \^`\resetmod` when a new family is selected by
a family selector, see \`\_resetfam` macro.
This allows reinitializing the same current modifiers in the font context
after the family is changed.
\_cod -----------------------------
-\_def \_moddef #1#2{\_edef\_tmp{\_csstring#1}%
- \_sdef{_f:\_currfamily:\_tmp}{\_addtomodlist#1#2\_reloading}%
+\_def \_moddef #1#2{%
+ \_edef\_tmp{\_csstring#1}%
+ \_sdef{_f:\_currfamily:\_tmp}{\_addtomodlist#1#2}%
\_protected \_edef \_tmpa{\_noexpand\_famdepend\_noexpand#1{_f:\_noexpand\_currfamily:\_tmp}}%
\_setnewmeaning #1=\_tmpa \moddef
}
\_protected \_def\_resetmod {\_cs{_f:\_currfamily:resetmod}} % private variant of \resetmod
-\_def \_resetfam{\_def\_addtomodlist##1{}\_resetmod
+\_def \_resetfam{%
+ \_def\_addtomodlist##1{}\_resetmod
\_edef \_modlist{\_ea}\_modlist
\_let\_addtomodlist=\_addtomodlistb
+ \_ifcsname _f:\_currfamily:\_ea\_csstring \_currvar \_endcsname
+ \_else \_ea\_ifx\_currvar\_tt \_else \_def\_currvar{\_fontsel}\_fi
+ \_fi % corrected \_currvar in the new family
}
\_def \_currfamily{} % default current family is empty
\_def \_modlist{} % list of currently used modifiers
@@ -304,60 +254,39 @@
<font-switch>.
We want to declare <font-switch> in its real name directly by `\font` primitive in
order to save this name for reporting later (in overfull messages, for
- example). This is the reason why \^`\_loadf` is re-defined locally here.
- The <variant selector> used in <data> expands to `\_tryload<XX> \_ten<XX>`.
- The modified `\_tryload<XX>`
- removes `\_ten<XX>` and does `\_resizefont{<XX>}<font-swith><font-switch>`,
- i.e.\ a font is loaded using real `<font-switch>` name and then it is selected
- as the current font.
+ example). This is the reason why \`\_xfamv` and \`\_ttfamv` are re-defined locally here.
+ They have precedence when \^`\fontsel` constructs the <font switch> name.
\_cod -----------------------------
\_def\_fontdef #1#2{\_begingroup
- \_def\_loadf##1##2{\_sdef{_tryload##1}####1{\_resizefont{##1}#1#1}}%
- \_reloading \_let\_reloading=\_relax
- #2\_ea\_endgroup \_ea\_let \_ea#1\_the\_font
+ \_edef\_xfamv{\_csstring#1}\_let\_ttfamv\_xfamv #2%
+ \_ea\_endgroup\_ea \_let\_ea #1\_the\_font
}
\_public \fontdef ;
\_doc -----------------------------
- The \`\famvardef` `\<XX> {<data>}` does, roughly speaking:
+ The \`\famvardef` `\xxx {<data>}` does, roughly speaking:
\begtt \catcode`\<=13
- \def \<XX> {\fontdef\_ten<XX> {<data>}\_ten<XX>}
+ \def \xxx {{<data>\ea}\the\font \def\_currvar{\xxx}}
\endtt
- but the macro `\<XX>` is declared as family-dependent.
- So, the real \^`\famvardef` `\<XX> {<data>}`
- uses analogical trick like \^`\moddef` with
- the \^`\_famdepend` macro. The \^`\famvardef` loads
- the auxiliary \`\_famvardefA` `\<XX> \_ten<XX> \_tryload<XX> {<data>}`.
- It does:
- \begitems
- * `\def \_tryload:<currfam>:<XX> {`\^`\fontdef`` \_ten<XX> {<data>}}` loads font `\_ten<XX>`,
- * `\protected\def \<XX> {\_famdepend \<XX> {_f:<currfam>:<XX>}}`,
- * `\def \_f:<currfam>:<XX> {\_tryload:<currfam>:<XX>\_ten<XX>}` keeps family dependent definition,
- * `\def \_currvar:_ten<XX> {\<XX>}` in order to the \^`\currvar` macro work correctly.
- \enditems
- `\famvardef\tt` behaves somewhat differently: it doesn't re-define the
- `\tt` macro which is defined as `\_tryloadtt \_tentt` in sections~\ref[math-preload]
- and~\ref[unimath-codes]. It only re-defines the internal `\_tryloadtt` macro.
- Note, that you cannot use `\tt` inside `\famvardef\tt`. So, new `\tt`
- macro does not load \^`\_ttunifont` but uses font from a standard variant
- rm, bf, it or bi with given font context.
+ but the macro `\xxx` is declared as family-dependent.
+ It is analogically as in `\moddef`.
+ The `\xxx` is defined as `\_famdepend\xxx{_f:\_currfamily:xxx}`
+ and `\_f:<currfam>:xxx` is defined as mentioned.\nl
+ `\famvardef\tt` behaves somewhat differently: it defines internal version
+ `\_tt` (it is used in \^`\_ttfont` and \^`\_urlfont`) and set `\tt` to
+ the same meaning.
\_cod -----------------------------
-\_def\_famvardef#1{\_edef\_tmp{\_csstring#1}%
- \_ea\_famvardefA \_ea#1\_csname _ten\_tmp\_ea\_endcsname
- \_csname _tryload:\_currfamily:\_tmp\_endcsname
-}
-\_def\_famvardefA #1#2#3#4{% #1=\XX #2=\_tenXX #3=\_tryload:currfam:XX #4=data
- \_isinlist{.\_rm\_bf\_it\_bi\currvar\_currvar}#1\_iftrue
- \_opwarning{\_string\famvardef:
- You cannot re-declare standard variant selector \_string#1}%
- \_else
- \_def#3{\_fontdef#2{#4}}%
- \_protected\_edef\_tmpa{\_noexpand\_famdepend\_noexpand#1{_f:\_noexpand\_currfamily:\_tmp}}%
- \_ifx #1\_tt \_let\_tryloadtt=#3\_else \_setnewmeaning #1=\_tmpa \famvardef \_fi
- \_sdef{_f:\_currfamily:\_tmp}{#3#2}%
- \_sdef{_currvar:\_csstring#2}{#1}%
+\_def\_famvardef#1#2{%
+ \_sdef{_f:\_currfamily:\_csstring#1}%
+ {{\_edef\_xfamv{\_csstring#1}\_let\_ttfamv\_xfamv #2\_ea}\_the\_font \_def\_currvar{#1}}%
+ \_protected\_edef\_tmpa {%
+ \_noexpand\_famdepend\_noexpand#1{_f:\_noexpand\_currfamily:\_csstring#1}}%
+ \_ifx #1\tt
+ \_protected\_def\_tt{{\_def\_xfamv{tt}#2\_ea}\_the\_font \_def\_currvar{\_tt}}%
+ \_let\tt=\_tt
+ \_else \_setnewmeaning #1=\_tmpa \famvardef
\_fi
}
\_public \famvardef ;
@@ -472,7 +401,7 @@
\begitems
* \`\_defaultfontfeatures` -- used for each font,
* \`\_ffadded` -- features added by \^`\setff`,
- * \`\_ffcolor` -- features added by \^`\setfontcolor`,
+ * \`\_ffcolor` -- features added by \^`\setfontcolor` (this is obsolette)
* \`\_ffletterspace` -- features added by \^`\setletterspace`,
* \`\_ffwordspace` -- features added by \^`\setwordspace`.
\enditems
@@ -494,33 +423,31 @@
\_def \_setff #1{%
\_ifx^#1^\_def\_ffadded{}\_else \_edef\_ffadded{\_ffadded #1;}\_fi
- \_reloading
}
\_public \setff ;
\_doc -----------------------------
- The \`\setfontcolor` and \`\setletterspace` are macros based on the
- special font features provided by \LuaTeX/ (and by \XeTeX/ too but it is not
- our business). The \`\setwordspace` recalculates the `\fontdimen2,3,4`
+ \`\setletterspace` is based on the
+ special font features provided by `luaotfload` package.
+ The \`\setwordspace` recalculates the `\fontdimen2,3,4`
of the font using the \`\setwsp` macro which is used by the
- \^`\_doresizeunifont` macro. It activates a dummy font feature `+Ws` too in
+ \^`\_fontselA` macro. It activates a dummy font feature `+Ws` too in
order the font is reloded by the `\font` primitive (with independent
`\fontdimen` registers).
+ \`\setfontcolor` is kept here only for backward compatibility but not
+ recommended. Use real color switches and the \^`\transparency` instead.
\_cod -----------------------------
\_def \_setfontcolor #1{%
\_edef\_tmp{\_calculatefontcolor{#1}}%
\_ifx\_tmp\_empty \_def\_ffcolor{}\_else \_edef\_ffcolor{color=\_tmp;}\_fi
- \_reloading
}
\_def \_setletterspace #1{%
\_if^#1^\_def\_ffletterspace{}\_else \_edef\_ffletterspace{letterspace=#1;}\_fi
- \_reloading
}
\_def \_setwordspace #1{%
\_if^#1^\_def\_setwsp##1{}\_def\_ffwordspace{}%
\_else \_def\_setwsp{\_setwspA#1/}\_def\_ffwordspace{+Ws;}\_fi
- \_reloading
}
\_def\_setwsp #1{}
\_def\_setwspA #1{\_ifx/#1\_ea\_setwspB \_else\_afterfi{\_setwspC#1}\_fi}
@@ -576,7 +503,7 @@ was documented in the section~\ref[fontfam].
We distinguish between
\begitems
-* {\em font switchers}, they are declared by the `\font` primitive or by
+* {\em font switches}, they are declared by the `\font` primitive or by
\^`\fontlet` or \~`\fontdef` macros, they select given font.
* {\em variant selectors}, there are four basic variant selectors
\^`\rm`, \^`\bf`, \^`\it`, \^`\bi`, there is a special selector \^`\currvar`.
@@ -605,7 +532,7 @@ selection of real font when the variant selector is processed. It includes the
value of {\em current family}, current font size, and
more values stored by font modifiers.
-The {\em family context} is the current family value stored in the font
+The {\em family context} is the current family name stored in the font
context. The variant selectors declared by \~`\famvardef` and
font modifiers declared by \~`\moddef` are dependent on the {\em family context}.
They can have the same names but different behavior in different families.
@@ -653,7 +580,7 @@ It keeps the current variant and the font of such variant is
reloaded with respect to the current font context by the previously given family
selector and font modifiers.
-You can use the \^`\setfontsize` `{<sizespec>}` command in the same sense as
+You can use the \^`\setfontsize` `{<size spec>}` command in the same sense as
other font modifiers. It saves information about font size to the font
context. See section~\ref[setfontsize]. Example:
@@ -679,7 +606,7 @@ this and you are satisfied with 8bit math CM+AMS fonts preloaded in the
font family.
If you want to use your specially selected Unicode-math font then use
-\^`\loadmath` `{[<font_file>]}` or \^`\loadmath` `{<font_name>}` before first
+\^`\loadmath` `{[<font file>]}` or \^`\loadmath` `{<font name>}` before first
`\fontfam` is used.
@@ -707,7 +634,7 @@ family selectors and defined font macros doing something with fonts.
\begitems
* \"built-in" font modifiers are \^`\setfontsize` (see
section~\ref[setfontsize]), \~`\setff` (see section~\ref[setff]),
- \~`\setfontcolor`, \~`\setletterspace` and \~`\setwordspace`
+ \~`\setletterspace` and \~`\setwordspace`
(see section~\ref[specff]). They are independent of font family.
* Font modifiers declared by \~`\moddef` depend on the font family and they
are typically declared in font family files, see
@@ -831,7 +758,7 @@ from LatinModern font family is used.
The \^`\tt` variant selector is used in \OpTeX/ internal macros
\^`\_ttfont` (verbatim texts) and \^`\_urlfont` (printing URL's).
-You can redefine the behavior of `\tt` by \^`\famvardef`. For example:
+The behavior of \^`\tt` can be re-defined by \^`\famvardef`. For example:
\begtt
\fontfam[Cursor]
@@ -843,8 +770,8 @@ Test in Termes: {\tt text}. {\Heros\rm Test in Heros: {\tt text}}.
Test in URL \url{http://something.org}.
\endtt
%
-You can see that `\tt` stay family independent. This is a special feature only
-for `\tt` selector. New definition is used in \^`\_ttfont` and \^`\_urlfont` too.
+You can see that \^`\tt` stay family independent. This is a special feature only
+for \^`\tt` selector. New definitions of \^`\_ttfont` and \^`\_urlfont` are done too.
It is recommended to use `\setff{-liga;-tlig}` to suppress the
ligatures in typewriter fonts.
@@ -914,9 +841,8 @@ the font family), we have following font modifiers (independent of font
family):
\begtt \catcode`\<=13
-\setfontsize{<sizespec>} % sets the font size
+\setfontsize{<size spec>} % sets the font size
\setff{<font feature>} % adds the font feature
-\setfontcolor{<color>} % sets font color
\setletterspace{<number>} % sets letter spacing
\setwordspace{<scaling>} % modifies word spacing
\endtt
@@ -924,17 +850,6 @@ family):
The \^`\setfontsize` command is described in the section \ref[setfontsize].
The \^`\setff` command was described in previous subsection.
-\^`\setfontcolor` `{<color>}` specifies the color and the opacity of the text.
-The <color> parameter should be in the hexadecimal format of four bytes
-`<red><green><blue><opacity>`, for example `FF0080FF` means full red, zero
-green, half blue and full opacity. You can use names `red`, `green`, `blue`,
-`yellow`, `cyan`, `magenta`, `white`, `grey`, `lgrey` (without the backslash)
-instead of the hexadecimal specification.
-The empty parameter `<color>` means default black color.
-
-These colors of fonts are implemented using \LuaTeX/ internal font feature. This
-is different approach than using colors in section \ref[colors].
-
\^`\setletterspace` `{<number>}` specifies the letter spacing of the font. The
`<number>` is a decimal number without unit. The unit is supposed as 1/100 of
the font size. I.e. `2.5` means 0.25 pt when the font is at 10 pt size. The
@@ -981,36 +896,9 @@ with Unicode fonts loaded by \^`\fontfam`.
\printdoctail fams-ini.opm
-\secc[exfont] Notices about extension of `\font` primitive
-%---------------------------------------------------------
-
-Unicode fonts are loaded by extended `\font` primitive. This extension is
-not activated in \OpTeX/ by default, \^`\initunifonts` macro activates it.
-You need not use \^`\initunifonts` explicitly if \^`\fontfam` macro is
-used because \^`\fontfam` runs it internally.
-
-The \^`\initunifonts` loads the Lua code from the Luaotfload package which
-implements the `\font` primitive extension. See its
-documentation `luaotfload-latex.pdf` for information about
-all possibilities of extended `\font` primitive.
-
-The \OpTeX/ format is initialized by `luatex` engine by default but
-you can initialize it by `luahbtex` engine too. Then the harfbuzz library is
-ready to use for font rendering as an alternative to built-in font renderer
-from Luaotfload. The harfbuzz library gives more features for rendering
-Indic and Arabic scripts. But it is not used as default, you need to specify
-`mode=harf` in the fontfeatures field when `\font` is used. Moreover, when
-`mode=harf` is used, then you must specify `script` too. For example
-
-\begtt
-\font\devafont=[NotoSansDevanagari-Regular]:mode=harf;script=dev2
-\endtt
-%
-If the `luahbtex` engine is not used then `mode=harf` is ignored. See
-Luaotfload documentation for more information.
-
\endinput
+2022-02-22 Font Selection System reimplemented, \fontsel introduced
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
diff --git a/Master/texmf-dist/tex/optex/base/graphics.opm b/Master/texmf-dist/tex/optex/base/graphics.opm
index 4c72528e480..b54b52c9263 100644
--- a/Master/texmf-dist/tex/optex/base/graphics.opm
+++ b/Master/texmf-dist/tex/optex/base/graphics.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \inspic {Graphics <2021-07-16>} % preloaded in format
+\_codedecl \inspic {Graphics <2022-03-05>} % preloaded in format
\_doc -----------------------------
\`\inspic` accepts old syntax `\inspic <filename><space>`
@@ -233,6 +233,10 @@
filling color.\nl
The \`\_setflcolors` uses the \^`\_setcolor` macro to separate filling (non-stroking)
color and stroking color.
+ The \`\_coc` macro means \"create oval or circle" and it expands to
+ the stroking primitve `S` or filling primitive `f` or boh `B`. Only boundary
+ stroking is performed after `\fcolor=\relax`. You cannot combine
+ `\fcolor=\relax` with `\shadow=Y`.
\_cod -----------------------------
\_newdimen \_lwidth
@@ -273,7 +277,7 @@
\_doshadow\_oval
\_fi
\_pdfliteral{q \_bp{\_lwidth} w \_tmp
- \_oval{\_bp{\_wd0}}{\_bp{\_ht0+\_dp0}}{\_bp{\_roundness}} B Q}\_vss}%
+ \_oval{\_bp{\_wd0}}{\_bp{\_ht0+\_dp0}}{\_bp{\_roundness}} \_coc\_space Q}\_vss}%
\_ht0=\_dimexpr\_ht0+\_dimen1 \_relax \_dp0=\_dimexpr\_dp0+\_dimen1 \_relax
\_box0
\_kern\_dimen0}%
@@ -302,7 +306,7 @@
\_doshadow\_circlet
\_fi
\_pdfliteral{q \_bp{\_lwidth} w \_tmp \_mv{\_bp{.5\_wd0}}{\_bp{(\_ht0-\_dp0)/2}}
- {\_circle{\_bp{\_dimen2}}{\_bp{\_dimen3}} B} Q}%
+ {\_circle{\_bp{\_dimen2}}{\_bp{\_dimen3}} \_coc} Q}%
\_ifdim\_dimen1=\_zo \_else
\_ht0=\_dimexpr \_ht0+\_dimen1 \_relax \_dp0=\_dimexpr \_dp0+\_dimen1 \_relax \_fi
\_box0
@@ -310,41 +314,31 @@
\_egroup % of \vbox\bgroup
}
\_def\_circlet#1#2#3{\_circle{#1}{#2}}
+\_def\_coc{\_ifx\_fcolorvalue\_relax S\_else \_ifdim\_lwidth=0pt f\_else B\_fi\_fi}
\_public \inoval \incircle \ratio \lwidth \fcolor \lcolor \shadow \overlapmargins ;
\_doc -----------------------------
Just before defining shadows, which require special graphics states, we
- define means for managing these graphics states. This is important, because
- otherwise our use of `\pdfpageresources` register might clash with other
- packages (TikZ) or even with our other usage (slides).
-
- The macro \`\addextgstate``<PDF name> <PDF dictionary>` shall be used for
- adding more graphics states. It must be used {\em after} `\dump`. First use
- of it detects PGF/TikZ and either uses its mechanism or defines our own. Our
- mechanism is very similar though -- use single `/ExtGState` dictionary for all
- pages (`\pdfpageresources` just points to it).
+ define means for managing these graphics states and other PDF page resources
+ (graphics states, patterns, shadings, etc.). Our mechanism, defined mostly
+ in Lua (see \ref[lua-pdf-resources], uses single dictionary for each PDF page
+ resource type (extgstate, etc.) for all pages (`\pdfpageresources` just
+ points to it).
+
+ The macro \`\addextgstate``{<PDF name>}{<PDF dictionary>}` is a use of that
+ general mechanism and shall be used for adding more graphics states. It must
+ be used {\em after} `\dump`. It's general variant defined in Lua is
+ \^`\_addpageresource` `{<resource type>}{<PDF name>}{<PDF dictionary>}`. You can
+ use `\pageresources` or \^`\_pageresources` if you need to insert resource
+ entries to manually created PDF XObjects.
\_cod -----------------------------
-\_def\_initpageresources{%
- \_glet\_initpageresources=\_relax
- \_ifcsname pgf@sys@addpdfresource@extgs@plain\_endcsname
- % TikZ loaded
- \_global\_slet{_addextgstate}{pgf@sys@addpdfresource@extgs@plain}%
- \_else
- % TikZ not loaded
- \_pdfobj reserveobjnum% not to be used in iniTeX
- \_xdef\_extgstatesobj{\_the\_pdflastobj}%
- \_expanded{\_global\_pdfpageresources={/ExtGState \_extgstatesobj\_space 0 R}}%
- \_global\_addto\_byehook{\_immediate\_pdfobj useobjnum\_extgstatesobj {<<\_extgstates>>}}%
- \_gdef\_extgstates{}%
- \_gdef\_addextgstate##1{\_xdef\_extgstates{\_extgstates\_space##1}}%
- \_fi
-}
-% first initialize page resources, then execute new meaning of itself
-\_def\_addextgstate#1{\_initpageresources \_addextgstate{#1}}
+\_def\_addextgstate{\_addpageresource{ExtGState}}
\_public \addextgstate ;
+\_def\pageresources{\_pageresources}
+\_def\addpageresource{\_addpageresource}
\_doc -----------------------------
A shadow effect is implemented here. The shadow is equal to the
@@ -362,8 +356,8 @@
\_def\_shadowb{1} % 2*shadowb = blurring area thickness
\_def\_insertshadowresources{%
- \_addextgstate{/op1 <</ca \_shadowdarknessA>>}%
- \_addextgstate{/op2 <</ca \_shadowdarknessB>>}%
+ \_addextgstate{op1}{<</ca \_shadowdarknessA>>}%
+ \_addextgstate{op2}{<</ca \_shadowdarknessB>>}%
\_glet\_insertshadowresources=\_relax
}
@@ -453,8 +447,9 @@ the \^`\transformbox{<transformation>}{\copy\mypic}`.
\_endinput
+2022-03-05: \_addextgstate, \pageresources, \addpageresources added
+2022-03-03: \_coc introduced
2021-07-16: \inoval, \incircle are more simple, using attribitecolor features
2021-03-19: \inkinspic: pictures in subdirectories, bug fixed
2020-12-21: \puttext: \box0 in goup, bugfix
2020-04-12: \_public \clipinoval \clipincircle ; added, bug fixed
-
diff --git a/Master/texmf-dist/tex/optex/base/hisyntax-lua.opm b/Master/texmf-dist/tex/optex/base/hisyntax-lua.opm
new file mode 100644
index 00000000000..f02bf03b0a9
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/base/hisyntax-lua.opm
@@ -0,0 +1,86 @@
+%% This is part of the OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \_hisyntaxlua {Syntax highlighting for Lua sources <2021-06-29>}
+
+\_newtoks \_hisyntaxlua \_newtoks \_hicolorslua
+
+\_global\_hicolorslua={% colors for the Lua language
+ \_hicolor K \Red % Keywords
+ \_hicolor S \Magenta % Strings
+ \_hicolor C \Green % Comments
+ \_hicolor N \Cyan % Numbers
+ \_hicolor P \Blue % Preprocessor
+ \_hicolor O \Blue % Other tokens
+}
+\_global\_hisyntaxlua={%
+ \_the\_hicolorslua
+ \_let\c=\_relax \_let\e=\_relax \_let\o=\_relax
+ \_replfromto {--[}{--]} {\x C{--[#1--]}}% multi line comment --[...--]
+ \_replfromto {--}{^^J} {\z C{--#1}^^J}% single line comment --...
+ \_replthis {\_string\"} {{\_string\"}}% \" protected inside strings
+ \_replthis {\_string\'} {{\_string\'}}% \' protected inside strings
+ \_replfromto {"}{"} {\x S{"#1"}}% "..."
+ \_replfromto {'}{'} {\x S{'#1'}}% "..."
+ % missing: [[, [=[, [==[ strings, " ' in string of other kind
+ \_edef\_tmpa {{<<}{>>}{//}{==}{\_string~=}{<=}{>=}{::}{...}{..}%
+ +-*/\_pcent^\_csstring\#\_string&\_string~|%
+ <>=()]\_string{\_string}[];:,.}% other tokens
+ \_ea \_foreach \_tmpa
+ \_do {\_replthis{#1}{\n\o{#1}\n}}%
+ \_foreach % keywords
+ {and}{break}{do}{else}{elseif}{end}{false}{for}{function}{goto}%
+ {if}{in}{local}{nil}{not}{or}{repeat}{return}{then}{true}{until}{while}%
+ \_do {\_replthis{\n#1\n}{\z K{#1}}}%
+ \_replthis{.}{\n.\n} % numbers
+ \_foreach 0123456789
+ \_do {\_replfromto{\n#1}{\n}{\c#1##1\e}}%
+ \_replthis{\e.\c}{.}%
+ \_replthis{\e.\n}{.\e}%
+ \_replthis{\n.\c}{\c.}%
+ \_replthis{e\e\o+\c}{e+}\_replthis{e\e\o-\c}{e-}%
+ \_replthis{E\e\o+\c}{E+}\_replthis{E\e\o-\c}{E-}%
+ \_def\o#1{\z O{#1}}%
+ \_def\c#1\e{\z N{#1}}%
+}
+
+\_endcode %------------------------------------------------
+
+The list of keywords and special symbols comes from the Lua 5.3 Reference
+Manual\fnote{\url{https://www.lua.org/manual/5.3/manual.html\#3}}, otherwise
+this is mostly a port of `hisyntax-c.opm`.
+
+
+\begtt \hisyntax{lua}
+and break do else elseif end
+false for function goto if in
+local nil not or repeat return
+then true until while
+
+ + - * / % ^ #
+ & ~ | << >> //
+ == ~= <= >= < > =
+ ( ) { } [ ] ::
+ ; : , . .. ...
+
+a = 'alo\n123"'
+a = "alo\n123\""
+a = '\97lo\10\04923"'
+a = [[alo
+123"]]
+a = [==[
+alo
+123"]==]
+
+3 345 0xff 0xBEBADA
+
+3.0 3.1416 314.16e-2 0.31416E1 34e1
+0x0.1E 0xA23p-4 0X1.921FB54442D18P+1
+
+1+1 2+a
+
+
+--[ multi line
+comment
+--]
+print(1+1)
+\endtt
diff --git a/Master/texmf-dist/tex/optex/base/hyphen-lan.opm b/Master/texmf-dist/tex/optex/base/hyphen-lan.opm
deleted file mode 100644
index 7a6c790d1f4..00000000000
--- a/Master/texmf-dist/tex/optex/base/hyphen-lan.opm
+++ /dev/null
@@ -1,252 +0,0 @@
-%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-
-\_codedecl \langlist {Initialization of hypenation patterns <2021-03-29>} % preloaded in format
-
- \_doc -----------------------------
- The <iso-code> means a shortcut of language name (mostly by ISO 639-1).
- The following control sequences are used for language switching:
- \begitems
- * `\_lan:<number>` expands to `<iso-code>` of the language.
- The <number> is an internal number of languages used as a value of
- `\language` register.
- * `\_ulan:<long-lang>` expands to `<iso-code>` too. This is transformation
- from long name of language (lowercase letters) to <iso-code>.
- * `\_<iso-code>Patt` (for example `\_csPatt`) is the language `<number>` declared by `\chardef`.
- * `\<iso-code>lang`
- (for example \`\enlang`, \`\cslang`, \`\sklang`, \`\delang`, \`\pllang`)
- is language selector. It exists in two states
- \begitems
- * Initialization state: when `\<iso-code>lang` is used first then it
- must load the patterns into memory using Lua code. If it is done then
- the `\<iso-code>lang` re-defines itself to the processing state.
- * Processing state: it only sets `\language=\_<iso-code>Patt`, i.e it
- selects the hyphenation patterns. It does a little more
- language-dependent work, as mentioned below.
- \enditems
- * `\_langspecific:<isocode>` is processed by `\<iso-code>lang` and it
- should include language-specific macros declared by the user or macro designer.
- \enditems
- The USenglish patters are preloaded first:
- \_cod -----------------------------
-
-\_chardef\_enPatt=0
-\_def\_pattlist{\_enPatt=0}
-\_def\_langlist{en(USenglish)}
-\_sdef{_lan:0}{en}
-\_sdef{_ulan:usenglish}{en}
-\_def\_enlang{\_uselang{en}\_enPatt23} % \lefthyph=2 \righthyph=3
-\_def\enlang{\_enlang}
-\_sdef{_langspecific:en}{\_nonfrenchspacing}
-
-\_lefthyphenmin=2 \_righthyphenmin=3 % disallow x- or -xx breaks
-\_input hyphen % en(USenglish) patterns from TeX82
-
- \_doc -----------------------------
- \`\_preplang` `<iso-code> <long-lang> <hyph-file-spec> <number> <pre-hyph><post-hyph>`
- prepares the\nl `\<iso-code>lang` to its initialization state. Roughly
- speaking, it does:
- \begtt \catcode`\<=13
- \chardef\_<iso-code>Patt = <number>
- \def\_lan:<number> {<iso-code>}
- \def\_ulan:<long-lang> {<iso-code>}
- \def\_<iso-code>lang {%
- \_loadpattrs <hyph-file-spec> <number> <long-lang> % loads patterns using Lua code
- \gdef\_<iso-code>lang {\_uselang{<iso-code>}\_<iso-code>Patt <pre-hyph><post-hyph>}
- \_<iso-code>lang % runs itself in processing state
- }
- \def\<iso-code>lang {\_<iso-code>lang} % public version \<iso-code>lang
- \endtt
- You can see that `\<iso-code>lang` runs \^`\_loadpattrs` and
- \^`\_uselang` first (in initialization state) and it runs
- only \^`\_uselang` when it is called again (in processing state).
- \_cod -----------------------------
-
-\_def\_preplang #1 #2 #3 #4 #5 {%
- \_ea\_chardef \_csname _#1Patt\_endcsname=#4
- \_sdef{_lan:#4}{#1}\_lowercase{\_sdef{_ulan:#2}}{#1}%
- \_def\_next{\_ea\_noexpand\_csname _#1lang\_endcsname}%
- \_ea\_edef \_csname _#1lang\_endcsname {%
- \_noexpand\_loadpattrs #3 #4 #2 % loads patterns
- \_gdef\_next{\_noexpand\_uselang{#1}\_csname _#1Patt\_endcsname #5}% re-defines itself
- \_next % runs itself in processing state
- }
- \_addto\_langlist{ #1(#2)}%
- \_sdef{#1lang\_ea}\_ea{\_csname _#1lang\_endcsname}% unprefixed \<isocode>lang
-}
-
- \_doc -----------------------------
- \`\_loadpattrs` `<hyph-file-spec> <number> <long-lang>`
- loads hyphenation patterns and hyphenation exceptions for given language
- and registers them as `\language=<number>`.
-
- The <hyph-file-spec> is a part of full file name wich is read:
- `hyph-<hyph-file-spec>.tex`. The patterns and hyphenation exceptions
- are saved here in UTF-8 encoding.
- The <hyph-file-spec> should be a list of individual <hyph-file-spec>'s
- separated by commas, see the language Serbian below for an example.
- \_cod -----------------------------
-
-\_def\_loadpattrs#1 #2 #3 {%
- \_wlog{Loading hyphenation #3: (#1) \_string\language=#2}%
- \_begingroup\_setbox0=\_vbox{% we don't want spaces in horizontal mode
- \_language=#2\_def\\{#3}%
- \_let\patterns=\_patterns \_let\hyphenation=\_hyphenation \_def\message##1{}%
- \_loadpattrsA #1,,%
- }\_endgroup
-}
-\_def\_loadpattrsA #1,{\_ifx,#1,\_else
- \_isfile {hyph-#1}\_iftrue \_opinput{hyph-#1}%
- \_else \_opwarning{No hyph. patterns #1 for \\, missing package?}%
- \_def\_opwarning##1{}\_fi
- \_ea \_loadpattrsA \_fi
-}
-
- \_doc -----------------------------
- \`\_uselang``{<iso-code>}\_<iso-code>Patt <pre-hyph><post-hyph>`\nl
- sets `\language`, `\lefthyphenmin`, `\righthyphenmin` and runs
- `\frenchspacing`. This default language-dependent settings
- should be re-declared by `\_langspecific:<iso-code>` which is run
- finally (it is `\relax` by default, only `\_langspecific:en` runs
- \^`\nonfrenchspacing`).
- \_cod -----------------------------
-
-\_def\_uselang#1#2#3#4{\_language=#2\_lefthyphenmin=#3\_righthyphenmin=#4\_relax
- \_frenchspacing % \nonfrenchspacing can be set in \cs{_langspecific:lan}
- \_cs{_langspecific:#1}%
-}
- \_doc -----------------------------
- The \`\uselanguage` `{<long-lang>}` is defined here
- (for compatibility with e-plain users).
- \_cod -----------------------------
-
-\_def\_uselanguage#1{\_lowercase{\_cs{_\_cs{_ulan:#1}lang}}}
-\_public \uselanguage ;
-
- \_doc -----------------------------
- The numbers for languages are declared as fixed constants (no
- auto-generated). This concept is inspired by CSplain.
- There are typical numbers of languages in CSplain: 5=Czech in IL2,
- 15=Czech in T1 and 115=Czech in Unicode. We keep these constants
- but we load only Unicode patterns (greater than 100), of course.
- \_cod -----------------------------
-
-\_preplang enus USenglishmax en-us 100 23
-\_preplang engb UKenglish en-gb 101 23
-\_preplang it Italian it 102 22
-\_preplang ia Interlingua ia 103 22
-\_preplang id Indonesian id 104 22
-
-\_preplang cs Czech cs 115 23
-\_preplang sk Slovak sk 116 23
-\_preplang de nGerman de-1996 121 22
-\_preplang fr French fr 122 22
-\_preplang pl Polish pl 123 22
-\_preplang cy Welsh cy 124 23
-\_preplang da Danish da 125 22
-\_preplang es Spanish es 126 22
-\_preplang sl Slovenian sl 128 22
-\_preplang fi Finnish fi 129 22
-\_preplang hu Hungarian hu 130 22
-\_preplang tr Turkish tr 131 22
-\_preplang et Estonian et 132 23
-\_preplang eu Basque eu 133 22
-\_preplang ga Irish ga 134 23
-\_preplang nb Bokmal nb 135 22
-\_preplang nn Nynorsk nn 136 22
-\_preplang nl Dutch nl 137 22
-\_preplang pt Portuguese pt 138 23
-\_preplang ro Romanian ro 139 22
-\_preplang hr Croatian hr 140 22
-\_preplang zh Pinyin zh-latn-pinyin 141 11
-\_preplang is Icelandic is 142 22
-\_preplang hsb Uppersorbian hsb 143 22
-\_preplang af Afrikaans af 144 12
-\_preplang gl Galician gl 145 22
-\_preplang kmr Kurmanji kmr 146 22
-\_preplang tk Turkmen tk 147 22
-\_preplang la Latin la 148 22
-\_preplang lac classicLatin la-x-classic 149 22
-\_preplang lal liturgicalLatin la-x-liturgic 150 22
-\_preplang elm monoGreek el-monoton 201 11
-\_preplang elp Greek el-polyton 202 11
-\_preplang grc ancientGreek grc 203 11
-\_preplang ca Catalan ca 204 22
-\_preplang cop Coptic cop 205 11
-\_preplang mn Mongolian mn-cyrl 206 22
-\_preplang sa Sanskrit sa 207 13
-\_preplang ru Russian ru 208 22
-\_preplang uk Ukrainian uk 209 22
-\_preplang hy Armenian hy 210 12
-\_preplang as Assamese as 211 11
-\_preplang hi Hindi hi 212 11
-\_preplang kn Kannada kn 213 11
-\_preplang lv Latvian lv 215 22
-\_preplang lt Lithuanian lt 216 22
-\_preplang ml Malayalam ml 217 11
-\_preplang mr Marathi mr 218 11
-\_preplang or Oriya or 219 11
-\_preplang pa Panjabi pa 220 11
-\_preplang ta Tamil ta 221 11
-\_preplang te Telugu te 222 11
-
-\_preplang be Belarusian be 223 22
-\_preplang bg Bulgarian bg 224 22
-\_preplang bn Bengali bn 225 11
-\_preplang cu churchslavonic cu 226 12
-\_preplang deo oldGerman de-1901 227 22
-\_preplang gsw swissGerman de-ch-1901 228 22
-\_preplang eo Esperanto eo 229 22
-\_preplang fur Friulan fur 230 22
-\_preplang gu Gujarati gu 231 11
-\_preplang ka Georgian ka 232 12
-\_preplang mk Macedonian mk 233 22
-\_preplang oc Occitan oc 234 22
-\_preplang pi Pali pi 235 12
-\_preplang pms Piedmontese pms 236 22
-\_preplang rm Romansh rm 237 22
-\_preplang sr Serbian sh-cyrl,sh-latn 238 22
-\_preplang sv Swedish sv 239 22
-\_preplang th Thai th 240 23
-\_preplang ethi Ethiopic mul-ethi 241 11
-\_preplang fis schoolFinnish fi-x-school 242 11
-
- \_doc -----------------------------
- The \`\langlist` includes names of all languages which are ready to load
- and use their hyphenation patterns. This list is printed to the terminal and
- to log at ini\TeX/ state here. It can be used when processing documents too.
- \_cod -----------------------------
-
-\_message{Language hyph.patterns ready to load: \_langlist.
- Use \_string\<shortname>lang to initialize language,
- \_string\cslang\_space for example}
-
-\_public \langlist ;
-
-\_endcode % ---------------------------------------------
-
-
-Maybe, you need to do more language-specific actions than just switching
-hyphenation patterns. For example, you need to load a specific font with a
-specific script used in the selected language, you can define macros for
-quotation marks depending on the language, etc.
-
-The example shows how to declare such language-specific things.
-
-\begtt
-\def\langset #1 #2{\sdef{_langspecific:#1}{#2}}
-
-\langset fr {... declare French quotation marks}
-\langset de {... declare German quotation marks}
-\langset gr {... switch to Greek fonts family}
-... etc.
-\endtt
-
-Note that you need not set language-specific phrases (like `\today`)
-by this code. Another concept is used for such tasks. See the
-section~\ref[langphrases] for more details.
-
-\_endinput
-
-2021-03-29 \_preplang schoolFinnish added
-2020-11-11 load patterns without lua code
-2020-03-10 released
diff --git a/Master/texmf-dist/tex/optex/base/keyval.opm b/Master/texmf-dist/tex/optex/base/keyval.opm
index b0462296b37..7d089ce6b1f 100644
--- a/Master/texmf-dist/tex/optex/base/keyval.opm
+++ b/Master/texmf-dist/tex/optex/base/keyval.opm
@@ -4,7 +4,7 @@
\_doc ----------------------------
{\bf Implementation.}
- The \`\readkv` expands its parameter and does replace-strings in order to
+ The \`\readkv``<list>` expands its parameter and does replace-strings in order to
remove spaces around equal signs and after commas. Double commas are
removed. Then \`\_kvscan` reads the parameters list finished by the double
comma and saves values to `\_kv:<key>` macros.\nl
@@ -38,31 +38,30 @@ or
\myframe [frame-color=\Blue] {text2} % other parameters are default
\endtt
%
-You can define `\myframe` as follows:
+or simply `\myframe {text3}`. You can define `\myframe` as follows:
\begtt
\def\myframedefaults{% defaults:
frame-color=\Black, % color of frame rules
- text-color=\Black, % color ot text nside the frame
+ text-color=\Black, % color ot text inside the frame
rule-width=0.4pt, % width of rules used in the frame
margins=2pt, % space between text inside and rules.
}
\optdef\myframe [] #1{\bgroup
- \ea\addto\ea\myframedefaults\ea{\ea,\the\opt}%
- \readkv\myframedefaults
+ \readkv\myframedefaults \readkv{\the\opt}%
\rulewidth=\kv{rule-width}
\hhkern=\kv{margins}\vvkern=\kv{margins}\relax
\kv{frame-color}\frame{\kv{text-color}\strut #1}%
- \egroup}
+ \egroup
+}
\endtt
%
We recommend using \^`\optdef` for defining macros with optional parameters
written in `[]`. Then the optional parameters are saved in the \^`\opt` tokens
-register. First: we append the \^`\opt` (actual optional parameters) to
-`\myframedefault` by \^`\addto` macro.
-Second: we read the parameters by
-\^`\readkv{<pramaters list>}` macro.
-Third: the values can be used by expandable \^`\kv{<key>}` macro.
+register. First: we read default parameters by \^`\readkv\myframedefaults`
+and secondly the actual parameters are read by \^`\readkv{\the\opt}`.
+The last setting wins.
+Third: the values can be used by the expandable \^`\kv{<key>}` macro.
The \^`\kv{<key>}` returns `???` if such key is not declared.
You can use keys without values in the parameters list too, but with
diff --git a/Master/texmf-dist/tex/optex/base/lang-data.opm b/Master/texmf-dist/tex/optex/base/lang-data.opm
new file mode 100644
index 00000000000..8201976cb55
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/base/lang-data.opm
@@ -0,0 +1,100 @@
+%% This is part of the OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \_langdata {Language dependent data <2022-02-19>} % only en, cs preloaded in format
+
+\_langdata en {English} % -----------------------------------------------
+\_langw en Chapter Table Figure Subject
+\_langb en {, and } { et al.} { ed.} {cit.~} {Vol.~} {No.~} {pp.~} {~p.} {,~ed.} {,~eds.}
+ {Available from } {Available also from }
+ {Bachelor's Thesis} {Master's Thesis} {Ph.D. Thesis}
+\_monthw en January February March April May June
+ July August September October November December
+\_sdef{_mt:today:en}{\_mtext{m\_the\_month} \_the\_day, \_the\_year}
+\_quotationmarks en {“”‘’}
+
+\_let \_sortingdataen = \_sortingdatacs % it can be shared with Czech
+\_let \_ignoredcharsen = \_ignoredcharscs
+\_def \_compoundcharsen {}
+
+\_langdata cs {Czech} % ------------------------------------------------
+% Chapter Table Figure Subject
+\_langw cs Kapitola Tabulka Obrázek Věc
+% {, and } { et al.} { ed.} {cit.~} {Vol.~} {No.~} {pp.~} {~p.} {,~ed.} {,~eds.}
+% {Available from } {Available also from }
+% {Bachelor's Thesis} {Master's Thesis} {Ph.D. Thesis}
+\_langb cs { a } { a~kol.} { vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editoři}
+ {Dostupné na } {Dostupné též na }
+ {Bakalářská práce} {Diplomová práce} {Disertační práce}
+% January February March April May June
+% July August September October November December
+\_monthw cs ledna února března dubna května června
+ července srpna září října listopadu prosince
+\_sdef{_mt:today:cs}{\_the\_day.~\_mtext{m\_the\_month} \_the\_year} % date format
+\_quotationmarks cs {„“‚‘}
+
+%\_def\_sortingdatacs {...} % all these macros are preloaded in the format,
+%\_def\_compoundcharscs {...} % see section 2.33 or file makeindex.tex.
+%\_def\_ignoredcharscs {...}
+
+\_langdata de {German} % ------------------------------------------------
+\_langw de Kapitel Tabelle Abbildung Betreff
+\_quotationmarks de {„“‚‘}
+% todo
+
+\_langdata it {Italian} % ------------------------------------------------
+\_langw it Capitolo Tabella Fig. Oggetto
+\_monthw it gennaio febbraio marzo aprile maggio giugno
+ luglio agosto settembre ottobre novembre dicembre
+\_quotationmarks it {“”«»}
+% todo
+
+\_langdata es {Spanish} % ------------------------------------------------
+\_langw es Capítulo Tabla Figura Sujeto
+\_quotationmarks es {“”«»}
+% todo
+
+\_langdata fr {French} % ------------------------------------------------
+\_langw fr Chapitre Tableau Figure Matière
+\_quotationmarks fr {“”«»}
+% toto
+
+\_langdata pl {Polish} % ------------------------------------------------
+\_langw pl Rozdział Tabela Ilustracja Temat
+\_quotationmarks pl {“”«»}
+% todo
+
+\_langdata el {Greek} % ------------------------------------------------
+\_langw el Κεφάλαιο Πίνακας Σχήμα θέμα
+\_quotationmarks el {“”«»}
+% todo
+
+\_langdata ru {Russian} % ------------------------------------------------
+\_langw ru Глава Таблица Рисунок Предмет
+\_quotationmarks ru {“”«»}
+% todo
+
+\_langdata sk {Slovak} % ------------------------------------------------
+\_langw sk Kapitola Tabuľka Obrázok Vec
+\_langb sk { a } { a~kol.} { vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editori}
+ {Dostupné na } {Dostupné tiež na }
+ {Bakalárska práca} {Diplomová práca} {Dizertačná práca}
+\_monthw sk januára februára marca apríla mája júna
+ júla augusta septembra októbra novembra decembra
+\_sdef{_mt:today:sk}{\_the\_day.~\_mtext{m\_the\_month} \_the\_year} % date format
+\_quotationmarks sk {„“‚‘}
+
+\_let \_sortingdatask = \_sortingdatacs % it can be shared with Czech
+\_let \_compoundcharssk = \_compoundcharscs
+\_let \_ignoredcharssk = \_ignoredcharscs
+
+\_langdata pt {Portuguese} % ------------------------------------------------
+\_langw pt Capítulo Tabela Figura Assunto
+\_monthw pt janeiro fevereiro março abril maio junho julho agosto
+ setembro outubro novembro dezembro
+\_sdef{_mt:today:pt}{\_the\_day~de \_mtext{m\_the\_month}~ de \_the\_year}
+% todo
+
+\_endcode
+
+2022-02-19: concept finalized, but data still far of competness
+2022-02-04: released
diff --git a/Master/texmf-dist/tex/optex/base/lang-decl.opm b/Master/texmf-dist/tex/optex/base/lang-decl.opm
new file mode 100644
index 00000000000..87a13b88ce8
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/base/lang-decl.opm
@@ -0,0 +1,312 @@
+%% This is part of the OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \langlist {Languages declaration <2022-02-19>} % preloaded in format
+
+ \_doc -----------------------------
+ \`\_preplang` `<lang-id> <LongName> <lang-tag> <hyph-tag> <lr-hyph>`
+ declares a new language. The parameters (separated by space) are
+ \begitems
+ * <lang-id>: language identifier. It should be derived from ISO 639-1 code
+ but additional letters can be eventually added because <lang-id> must be used
+ uniquely in the whole declaration list. The \^`\_preplang` macro creates
+ the language switch `\_<lang-id>lang` and defines also `\<lang-id>lang`
+ as a macro which expands to `\_<lang-id>lang`. For example, `\_preplang cs Czech ...`
+ creates `\_cslang` as the language switch and defines
+ `\def\cslang{\_cslang}`.
+ * <LongName>: full name of the language.
+ * <lang-tag>: language tag, which is used for setting language-dependent phrases
+ and sorting data. If a language have two or more hyphenation
+ patterns but a single phrases set, then we declare this language
+ more than once with the same <lang-tag> but different <lang-hyph>.
+ * <hyph-tag>: a part of the file name where the hyphenation patterns
+ are prepared in Unicode. The full file name is `hyph-<hyph-tag>.tex`.
+ If <hyph-tag> is `{}` then no hyphenation patterns are loaded.
+ * <lr-hyph>: two digits, they denote `\lefthyphenmin` and
+ `\righthyphenmin` values.
+ \enditems
+ \^`\_preplang` allocates a new internal number by \^`\newlanguage\_<lang-id>Patt`
+ which will be bound to the hyphenation patterns. But the patterns nor other language
+ data are not read at this moment. The `\_<lang-id>lang` is defined as \^`\_langinit`.
+ When the `\_<lang-id>lang` switch is used firstly in a document then the language is
+ initialized, i.e.\ hyphenation patterns and language-dependent data are read.
+ The `\_<lang-id>lang` is re-defined itself after such initialization.
+ \^`\_preplang` does also `\def\_ulan:<longname> {<lang-id>}`, this is needed
+ for the \^`\uselanguage` macro.
+ \_cod -----------------------------
+
+\_def\_preplang #1 #2 #3 #4 #5#6{% lang-id LongName lang-tag hyph-tag lr-hyph
+ \_ifcsname _#1lang\_endcsname \_else
+ \_ea\_newlanguage\_csname _#1Patt\_endcsname
+ \_xdef\_langlist{\_langlist\_space#1(#2)}%
+ \_fi
+ \_lowercase{\_sxdef{_ulan:#2}}{#1}%
+ \_slet{_#1lang}{_relax}%
+ \_sxdef {#1lang}{\_cs{_#1lang}}%
+ \_sxdef {_#1lang}{\_noexpand\_langinit \_cs{_#1lang}#1(#2)#3[#4]#5#6}%
+}
+ \_doc -----------------------------
+ The \^`\_preplang` macro adds `<lang-id>(<LongName>)` to the `\_langlist` macro
+ which is accessible by \`\langlist`. It can be used for reporting declared
+ languages.
+ \_cod -----------------------------
+
+\_def\langlist{\_langlist}
+\_def\_langlist{en(USEnglish)}
+
+ \_doc -----------------------------
+ All languages with hyphenation patterns provided by \TeX/live are
+ declared here. The language switches \`\cslang`, \`\sklang`,
+ \`\delang`, \`\pllang` and many others are declared.
+ You can declare more languages by \^`\_preplang` in your
+ document, if you want.\nl
+ The usage of \^`\_preplang` with <lang-id> already declared is allowed.
+ The language is re-declared in this case. This can be used in your document
+ before first usage of the `\<lang-id>lang` switch.
+ \_cod -----------------------------
+
+% lang-id LongName lang-tag hyph-tag lr-hyph
+\_preplang enus USenglishmax en en-us 23
+% Europe:
+\_preplang engb UKenglish en en-gb 23
+\_preplang be Belarusian be be 22
+\_preplang bg Bulgarian bg bg 22
+\_preplang ca Catalan ca ca 22
+\_preplang hr Croatian hr hr 22
+\_preplang cs Czech cs cs 23
+\_preplang da Danish da da 22
+\_preplang nl Dutch nl nl 22
+\_preplang et Estonian et et 23
+\_preplang fi Finnish fi fi 22
+\_preplang fis schoolFinnish fi fi-x-school 11
+\_preplang fr French fr fr 22
+\_preplang de nGerman de de-1996 22
+\_preplang deo oldGerman de de-1901 22
+\_preplang gsw swissGerman de de-ch-1901 22
+\_preplang elm monoGreek el el-monoton 11
+\_preplang elp Greek el el-polyton 11
+\_preplang grc ancientGreek grc grc 11
+\_preplang hu Hungarian hu hu 22
+\_preplang is Icelandic is is 22
+\_preplang ga Irish ga ga 23
+\_preplang it Italian it it 22
+\_preplang la Latin la la 22
+\_preplang lac classicLatin la la-x-classic 22
+\_preplang lal liturgicalLatin la la-x-liturgic 22
+\_preplang lv Latvian lv lv 22
+\_preplang lt Lithuanian lt lt 22
+\_preplang mk Macedonian mk mk 22
+\_preplang pl Polish pl pl 22
+\_preplang pt Portuguese pt pt 23
+\_preplang ro Romanian ro ro 22
+\_preplang rm Romansh rm rm 22
+\_preplang ru Russian ru ru 22
+\_preplang srl Serbian sr-latn sh-latn 22
+\_preplang src SerbianCyrl sr-cyrl sh-cyrl 22
+\_preplang sk Slovak sk sk 23
+\_preplang sl Slovenian sl sl 22
+\_preplang es Spanish es es 22
+\_preplang sv Swedish sv sv 22
+\_preplang uk Ukrainian uk uk 22
+\_preplang cy Welsh cy cy 23
+% Others:
+\_preplang af Afrikaans af af 12
+\_preplang hy Armenian hy hy 12
+\_preplang as Assamese as as 11
+\_preplang eu Basque eu eu 22
+\_preplang bn Bengali bn bn 11
+\_preplang nb Bokmal nb nb 22
+\_preplang cop Coptic cop cop 11
+\_preplang cu churchslavonic cu cu 12
+\_preplang eo Esperanto eo eo 22
+\_preplang ethi Ethiopic ethi mul-ethi 11
+\_preplang fur Friulan fur fur 22
+\_preplang gl Galician gl gl 22
+\_preplang ka Georgian ka ka 12
+\_preplang gu Gujarati gu gu 11
+\_preplang hi Hindi hi hi 11
+\_preplang id Indonesian id id 22
+\_preplang ia Interlingua ia ia 22
+\_preplang kn Kannada kn kn 11
+\_preplang kmr Kurmanji kmr kmr 22
+\_preplang ml Malayalam ml ml 11
+\_preplang mr Marathi mr mr 11
+\_preplang mn Mongolian mn mn-cyrl 22
+\_preplang nn Nynorsk nn nn 22
+\_preplang oc Occitan oc oc 22
+\_preplang or Oriya or or 11
+\_preplang pi Pali pi pi 12
+\_preplang pa Panjabi pa pa 11
+\_preplang pms Piedmontese pms pms 22
+\_preplang zh Pinyin zh zh-latn-pinyin 11
+\_preplang sa Sanskrit sa sa 13
+\_preplang ta Tamil ta ta 11
+\_preplang te Telugu te te 11
+\_preplang th Thai th th 23
+\_preplang tr Turkish tr tr 22
+\_preplang tk Turkmen tk tk 22
+\_preplang hsb Uppersorbian hsb hsb 22
+
+ \_doc -----------------------------
+ \`\_preplangmore` `<lang-id><space>{<text>}` declares more activities
+ of the language switch. The <text> is processed whenever
+ `\_<lang-id>lang` is invoked. If \^`\_preplangmore` is not declared
+ for given language then \`\_langdefault` is processed.\nl
+ You can implement selecting a required script for given language, for
+ example:
+ \begtt
+ \_preplangmore ru {\_frenchspacing \_setff{script=cyrl}\selectcyrlfont}
+ \_addto\_langdefaut {\_setff{}\selectlatnfont}
+ \endtt
+ The macros `\selectcyrlfont` and `\selectlatnfont` are not defined in
+ \OpTeX/. If you follow this example, you have to define them after your
+ decision what fonts will be used in your specific situation.
+ \_cod -----------------------------
+
+\_def\_preplangmore #1 #2{\_ea \_gdef \_csname _langspecific:#1\_endcsname{#2}}
+\_def\_langdefault{\_frenchspacing}
+
+\_preplangmore en {\_nonfrenchspacing}
+\_preplangmore enus {\_nonfrenchspacing}
+\_def\_langdefault {\_frenchspacing}
+
+ \_doc -----------------------------
+ The default `\language=0` is US-English with original hyphenation patterns
+ preloaded in the format (see the end of section~\ref[plain]).
+ We define `\_enlang` and \`\enlang` switches.
+ Note that if no language switch is used in the document then
+ `\language=0` and US-English patterns are used, but \^`\nonfrenchspacing`
+ isn't set.
+ \_cod -----------------------------
+
+\_chardef\_enPatt=0
+\_sdef{_lan:0}{en}
+\_sdef{_ulan:usenglish}{en}
+\_def\_enlang{\_uselang{en}\_enPatt23} % \lefthyph=2 \righthyph=3
+\_def\enlang{\_enlang}
+
+ \_doc -----------------------------
+ The list of declared languages are reported during format generation.
+ \_cod -----------------------------
+
+\_message{Declared languages: \_langlist.
+ Use \_string\<lang-id>lang to initialize language,
+ \_string\cslang\_space for example.}
+
+ \_doc -----------------------------
+ Each language switch `\_<lang-id>lang` defined by \^`\_preplang` has its initial state\nl
+ \`\_langinit` `\<switch> <lang-id>(<LongName>)<lang-tag>[<hyph-tag>]<lr-hyph>`.
+ The \^`\_langinit` macro does:
+ \begitems
+ * The internal language <number> is extracted from `\_the\_<lang-id>Patt`.
+ * `\def \_lan:<number> {<lang-tag>}` for mapping from `\language` number to the <lang-tag>.
+ * loads `hyph-<hyph-tag>.tex` file with hyphenation patterns when `\language=<number>`.
+ * loads the part of `lang-data.opm` file with language-dependent phrases
+ using \^`\_langinput`.
+ * `\def \_<lang-id>lang {\_uselang{<lang-id>}\_<lang-id>Patt <lr-hyph>}`,
+ i.e. the switch redefines itself for doing a \"normal job" when the
+ language switch is used repeatedly.
+ * Runs itself (i.e. `\_<lang-id>lang`) again for doing the \"normal job" firstly.
+ \enditems
+ \_cod -----------------------------
+
+\_def\_langinit #1#2(#3)#4[#5]#6#7{% \_switch lang-id(LongName)lang-tag[hyph-file]lr-hyph
+ \_sxdef{_lan:\_ea\_the\_csname _#2Patt\_endcsname}{#4}%
+ \_begingroup \_setbox0=\_vbox{% we don't want spaces in horizontal mode
+ \_setctable\_optexcatcodes
+ % loading patterns:
+ \_language=\cs{_#2Patt}\_relax
+ \_ifx^#5^\_else
+ \_wlog{Loading hyphenation for #3: \_string\language=\_the\_language\_space(#5)}%
+ \_let\patterns=\_patterns \_let\hyphenation=\_hyphenation \_def\message##1{}%
+ \_isfile {hyph-#5}\_iftrue \_input{hyph-#5}%
+ \_else \_opwarning{No hyph. patterns #5 for #3, missing package?}\_fi
+ \_fi
+ % loading language data:
+ \_langinput{#4}%
+ }\_endgroup
+ \xdef#1{\noexpand\_uselang{#2}\_csname _#2Patt\_endcsname #6#7}%
+ #1% do language switch
+}
+
+ \_doc -----------------------------
+ \`\_uselang``{<lang-id>}\_<lang-id>Patt <pre-hyph><post-hyph>`
+ is used as \"normal job" of the switch.
+ It sets `\language`, `\lefthyphenmin`, `\righthyphenmin`.
+ Finally, it runs data from \^`\_preplangmore` or runs \^`\_langdefault`.
+ \_cod -----------------------------
+
+\_def\_uselang#1#2#3#4{\_language=#2\_lefthyphenmin=#3\_righthyphenmin=#4\_relax
+ \_trycs{_langspecific:#1}{\_langdefault}%
+}
+
+ \_doc -----------------------------
+ The \`\uselanguage` `{<LongName>}` macro is defined here
+ (for compatibility with e-plain users). Its parameter is case insensitive.
+ \_cod -----------------------------
+
+\_def\_uselanguage#1{\_def\_tmp{#1}\_lowercase{\_cs{_\_trycs{_ulan:#1}{0x}lang}}}
+\_sdef{_0xlang}{\_opwarning{\_string\uselanguage{\_tmp}: Unknown language name, ignored}}
+\_public \uselanguage ;
+
+ \_doc -----------------------------
+ The \"language data" include declarations of
+ rules for sorting (see section~\ref[makeindex]),
+ language-dependent phrases and quotation marks (see section~\ref[langphrases]).
+ The language data are collected in the single `lang-data.opm` file.
+ Appropriate parts of this file is read by \^`\_langinput{<lang-tag>}`.
+ First few lines of the file looks like:
+ {\maxlines=47 \printdoc lang-data.opm }%
+ There are analogical declaration for more languages here. Unfortunately, this
+ file is far for completeness. I welcome you send me a part of declaration
+ for your language.
+
+ If your language is missing in this file then a warning is reported during
+ language initialization. You can create your private declaration in your
+ macros (analogical as in the `lang-data.opm` file
+ but without the \^`\_langdata` prefix).
+ Then you will want to remove the warning about missing data. This can be
+ done by \`\nolanginput``{<lang-tag>}` given before initialization of your
+ language.
+
+ The whole file `lang-data.opm` is not preloaded in the format because
+ I suppose a plenty languages here and I don't want to waste the \TeX/ memory
+ by these declarations. Each part of this file prefixed by
+ \`\_langdata` `<lang-tag> {<LongName>}` is read separately
+ when \`\_langinput``{<lang-tag>}` is used. And it is used
+ in the \^`\_langinit` macro (i.e.\ when the language is initialized),
+ so the appropriate part of this file is read automatically on demand.
+
+ If the part of the `lang-data.opm` concerned by <lang-tag> is read already
+ then `\_li:<lang-tag>` is set to `R` and we don't read this part of the file again.
+ \_cod -----------------------------
+
+\_def\_langinput #1{%
+ \_unless \_ifcsname _li:#1\_endcsname
+ \_bgroup
+ \_edef\_tmp{\_noexpand\_langdata #1 }\_everyeof\_ea{\_tmp{}}%
+ \_long \_ea\_def \_ea\_tmp \_ea##\_ea1\_tmp{\_readlangdata{#1}}%
+ \_globaldefs=1
+ \_ea\_tmp \_input{lang-data.opm}%
+ \_ea\_glet \_csname _li:#1\_endcsname R%
+ \_egroup
+ \_fi
+}
+\_def\_readlangdata #1#2{%
+ \_ifx^#2^\_opwarning{Missing data for language "#1" in lang-data.opm}%
+ \_else \_wlog{Reading data for the language #2 (#1)}%
+ \_fi
+}
+\_def\_langdata #1 #2{\_endinput}
+\_def\_nolanginput #1{\_ea\_glet \_csname _li:#1\_endcsname N}
+\_public \nolanginput ;
+
+ \_doc -----------------------------
+ Data of two preferred languages are preloaded in the format:
+ \_cod -----------------------------
+
+\_langinput{en} \_langinput{cs}
+
+\_endcode
+
+2022-02-19 \_langinput moved here
+2022-02-17 released, original file was hyphen-lan.opm
diff --git a/Master/texmf-dist/tex/optex/base/languages.opm b/Master/texmf-dist/tex/optex/base/languages.opm
index 26e0c626288..4ae66ef1f47 100644
--- a/Master/texmf-dist/tex/optex/base/languages.opm
+++ b/Master/texmf-dist/tex/optex/base/languages.opm
@@ -1,30 +1,30 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_mtext {Languages <2021-05-23>} % preloaded in format
+\_codedecl \_mtext {Languages <2022-02-19>} % preloaded in format
\_doc -----------------------------
- Only four words are generated by \OpTeX/ macros: \"Chapter",
- \"Table", \"Figure" and \"Subject". These phrases can be generated depending
- on the current value of `\language` register, if you use \`\_mtext``{<phrase-id>}`,
+ Four words are generated by \OpTeX/ macros: \"Chapter",
+ \"Table", \"Figure" and \"Subject". These phrases are generated depending
+ on the current value of the `\language` register, if you use \`\_mtext``{<phrase-id>}`,
specially `\_mtext{chap}`, `\_mtext{t}`, `\_mtext{f}` or `\_mtext{subj}`.
If your macros generate more words then
- you can define such words by `\sdef{_mt:<phrase-id>:<lang>}` where
- `<phrase-id>` is a label for the declared word and `<lang>` is a language shortcut
- (iso code).
+ you can define such words by `\sdef{_mt:<phrase-id>:<lang-tag>}` where
+ `<phrase-id>` is a label for the declared word and `<lang-tag>` is a language shortcut
+ declared by \~`\_preplang`.
\_cod -----------------------------
\_def\_mtext#1{\_trycs{_mt:#1:\_trycs{_lan:\_the\_language}{en}}
{\_csname _mt:#1:en\_endcsname}}
-\_sdef{_mt:chap:en}{Chapter} \_sdef{_mt:chap:cs}{Kapitola} \_sdef{_mt:chap:sk}{Kapitola}
-\_sdef{_mt:t:en}{Table} \_sdef{_mt:t:cs}{Tabulka} \_sdef{_mt:t:sk}{Tabuľka}
-\_sdef{_mt:f:en}{Figure} \_sdef{_mt:f:cs}{Obrázek} \_sdef{_mt:f:sk}{Obrázok}
-\_sdef{_mt:subj:en}{Subject} \_sdef{_mt:subj:cs}{Věc} \_sdef{_mt:subj:sk}{Vec}
-
\_doc -----------------------------
- Using \`\_langw` `<lang> <chapter> <table> <figure> <subject>` you can
- declare these words more effectively:
- \maxlines=13
+ We can declare such language-dependent words by
+ \begtt
+ \_sdef{_mt:chap:en}{Chapter} \_sdef{_mt:chap:cs}{Kapitola}
+ \_sdef{_mt:t:en}{Table} \_sdef{_mt:t:cs}{Tabulka}
+ \endtt
+ etc. but we use more \"compact" macro
+ \`\_langw` `<lang-tag> <chapter> <table> <figure> <subject>`
+ for declaring them.
\_cod -----------------------------
\_def \_langw #1 #2 #3 #4 #5 {%
@@ -32,20 +32,29 @@
\_sdef{_mt:subj:#1}{#5}%
}
-\_langw en Chapter Table Figure Subject
-%--------------------------------------------------------------
-\_langw cs Kapitola Tabulka Obrázek Věc
-\_langw de Kapitel Tabelle Abbildung Betreff
-\_langw es Capítulo Tabla Figura Sujeto
-\_langw fr Chapitre Tableau Figure Matière
-\_langw it Capitolo Tabella Fig. Oggetto
-\_langw pl Rozdział Tabela Ilustracja Temat
-\_langw gr Κεφάλαιο Πίνακας Σχήμα θέμα
-\_langw ru Глава Таблица Рисунок Предмет
-\_langw sk Kapitola Tabuľka Obrázok Vec
+ \_doc -----------------------------
+ More phrases are auto-generated in bibliography references. They are declared by\nl
+ \`\_langb` `<lang-tag> {<and>} {<et-al>} {<ed>} {<cit>} {<vol>} {<no>} {<pp>} {<p>} {<ed>} {<eds>}`\nl
+ ` {<avail-from>} {<avali-to>} {<ba-thesis>} {<ma-thesis>} {<phd-thesis>}`.
+ It is used similar way as the \^`\_langw` above. Both these macros are used
+ in `lang-data.opm` file, see the end of section~\ref[langdecl].
+ \_cod -----------------------------
+
+\_def\_langb#1 #2#3#4#5#6#7#8#9{\_def\_mbib##1##2{\_sdef{_mt:bib.##2:#1}{##1}}%
+ \_mbib{#2}{and}\_mbib{#3}{etal}\_mbib{#4}{edition}\_mbib{#5}{citedate}\_mbib{#6}{volume}%
+ \_mbib{#7}{number}\_mbib{#8}{prepages}\_mbib{#9}{postpages}\_langbA}
+\_def\_langbA#1#2#3#4#5#6#7{\_mbib{#1}{editor}\_mbib{#2}{editors}\_mbib{#3}{available}%
+ \_mbib{#4}{availablealso}\_mbib{#5}{bachthesis}\_mbib{#6}{masthesis}\_mbib{#7}{phdthesis}}
\_doc -----------------------------
- You can add more words as you wish. For example \`\today` macro:
+ \`\today` macro needs auto-generated words for each name of the month.\nl
+ \`\_monthw` `<lang-tag> <January> <February> ... <December>` is used for
+ decaring them.\nl
+ The language-dependent format for printing date should be declared like
+ \begtt
+ \_sdef{_mt:today:en}{\_mtext{m\_the\_month} \_the\_day, \_the\_year}
+ \endtt
+ This example declares date format for English where <lang-tag> is `en`.
\_cod -----------------------------
\_def \_monthw #1 #2 #3 #4 #5 #6 #7 {%
@@ -57,21 +66,6 @@
\_sdef{_mt:m7:#1}{#2}\_sdef{_mt:m8:#1}{#3}\_sdef{_mt:m9:#1}{#4}%
\_sdef{_mt:m10:#1}{#5}\_sdef{_mt:m11:#1}{#6}\_sdef{_mt:m12:#1}{#7}%
}
-
-\_monthw en January February March April May June
- July August September October November December
-\_monthw cs ledna února března dubna května června
- července srpna září října listopadu prosince
-\_monthw sk januára februára marca apríla mája júna
- júla augusta septembra októbra novembra decembra
-\_monthw it gennaio febbraio marzo aprile maggio giugno
- luglio agosto settembre ottobre novembre dicembre
-
-
-\_sdef{_mt:today:en}{\_mtext{m\_the\_month} \_the\_day, \_the\_year}
-\_sdef{_mt:today:cs}{\_the\_day.~\_mtext{m\_the\_month} \_the\_year}
-\_slet{_mt:today:sk}{_mt:today:cs}
-
\_def\_today{\_mtext{today}}
\_public \today ;
@@ -86,24 +80,29 @@
User can declare quotes by \^`\quoteschars``<clqq><crqq><clq><crq>`, where
`<clqq>...<crqq>` are normal quotes and `<clq>...<crq>` are alternative quotes.
or use \`\altquotes` to swap between the meaning of these two types of quotes.
- \nl
- \`\enquotes`, \`\csquotes`, \`\dequotes`, \`\frquotes` etc. are defined here.
+ \`\enquotes`, \`\csquotes`, \`\frquotes`, \`\dequotes`, \`\skquotes` are defined here.
+ Languages in general provide the \`\quotes` declaration macro. It declares the
+ quotation marks depending on the actual selected language. For example,
+ `\eslang \quotes` declares Spanish language including its quotation marks
+ used for `\"<text>"` and `\'<text>'`. The language-dependent quotation
+ marks should be declared by \`\_quotationmarks` `<lang-tag> {<clqq><crqq><clq><crq>}`
+ in the `lang-data.opm` file.
\_cod -----------------------------
\_def \_enquotes {\_quoteschars “”‘’}
\_def \_csquotes {\_quoteschars „“‚‘}
\_def \_frquotes {\_quoteschars “”«»}
-\_let \_plquotes = \_frquotes
-\_let \_esquotes = \_frquotes
-\_let \_grquotes = \_frquotes
-\_let \_ruquotes = \_frquotes
-\_let \_itquotes = \_frquotes
-\_let \_skquotes = \_csquotes
\_let \_dequotes = \_csquotes
+\_let \_skquotes = \_csquotes
+
+\_def \_quotes {\_trycs{_qt:\_trycs{_lan:\_the\_language}{en}}{\_enquotes}}
+\_def \_quotationmarks #1 #2{\_sdef{_qt:#1}{\_quoteschars #2}}
+
+\_public \quotes \enquotes \csquotes \frquotes \dequotes \skquotes ;
\_doc -----------------------------
The \`\quoteschars``<lqq><rqq><lq><rq>` defines `\"` and `\"` as `\_qqA`
- in in normal mode and as expadable macros in outline mode.
+ in normal mode and as expadable macros in outline mode.
We want to well process the common cases: \code{\\"`&`"} or \code{\\"`\{`"}.
This is the reason why the quotes parameter is read in verbatim mode and retokenized
again by `\scantextokens`. We want to allow to quote the quotes mark
@@ -136,52 +135,12 @@
\_def\_activequotes{\_let\_actqq=\"\_adef"{\_actqq}\_let\_actq=\'\_adef'{\_actq}%
\_regmacro{}{}{\_adef"{\"}\_adef'{\'}}}
-\_public \quoteschars \activequotes \enquotes \csquotes \skquotes \frquotes \plquotes
- \esquotes \grquotes \ruquotes \itquotes \dequotes ;
-
- \_doc -----------------------------
- Bibliography references generated by \^`\usebib` uses more
- language-dependent phrases. They are declared here. We don't want to save
- all these phrases into the format, so the trick with {`\_endinput`}
- is used here. When \^`\usebib` is processed then the following part of the file
- `languages.opm` is read again.
-
- Only phrases of few languages are declared here now. If you want to declare
- phrases of your language, please create an \"issue" or a \"request" at
- \url{https://github.com/olsak/OpTeX} or send me an email with new
- phrases for your language (or language you know:). I am ready to put them here.
- Temporarily, you can put your definitions into `\bibtexhook` token list.
- \_cod -----------------------------
-
-\_endinput % don't save these \def's to the format
-
-\_def\_langb#1 #2#3#4#5#6#7#8#9{\_def\_mbib##1##2{\_sdef{_mt:bib.##2:#1}{##1}}%
- \_mbib{#2}{and}\_mbib{#3}{etal}\_mbib{#4}{edition}\_mbib{#5}{citedate}\_mbib{#6}{volume}%
- \_mbib{#7}{number}\_mbib{#8}{prepages}\_mbib{#9}{postpages}\_langbA}
-\_def\_langbA#1#2#3#4#5#6#7{\_mbib{#1}{editor}\_mbib{#2}{editors}\_mbib{#3}{available}%
- \_mbib{#4}{availablealso}\_mbib{#5}{bachthesis}\_mbib{#6}{masthesis}\_mbib{#7}{phdthesis}}
-
-\_langb en {, and } { et al.} { ed.} {cit.~} {Vol.~} {No.~} {pp.~} {~p.} {,~ed.} {,~eds.}
- {Available from } {Available also from }
- {Bachelor's Thesis} {Master's Thesis} {Ph.D. Thesis}
-%------------------------------------------------------------------------------------------
-\_langb cs { a } { a~kol.} { vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editoři}
- {Dostupné na } {Dostupné též na }
- {Bakalářská práce} {Diplomová práce} {Disertační práce}
-\_langb sk { a } { a~kol.} { vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editoři}
- {Dostupné na } {Dostupné tiež na }
- {Bakalárska práca} {Diplomová práca} {Dizertačná práca}
-
-% \_<lang>dateformat year/month/day\relax, for example: \_csdateformat 2020/05/21\relax
-% This is used in iso690 bib-style when the field "citedate" is used.
-
-\_def\_endateformat #1/#2/#3\relax{#1-#2-#3}
-% \_csdateformat 2020/05/21\relax -> \hbox{21. 5. 2020}
-\_def\_csdateformat #1/#2/#3\relax{\hbox{\_tmpnum=#3 \_the\_tmpnum. \_tmpnum=#2 \_the\_tmpnum. #1}}
-\_let\_skdateformat =\_csdateformat
+\_public \quoteschars \activequotes ;
\_endcode % -------------------------------------
+2022-02-19 \quotes, \_quotationmarks introduced
+2022-02-04 \_langinput, words-lan.opm introduced
2021-05-23 \_monthw: bug fix
2021-01-21 more robust quotes in outlines
2020-12-05 bib phrases moved here
diff --git a/Master/texmf-dist/tex/optex/base/makeindex.opm b/Master/texmf-dist/tex/optex/base/makeindex.opm
index 4de0d815fdd..7e99859719a 100644
--- a/Master/texmf-dist/tex/optex/base/makeindex.opm
+++ b/Master/texmf-dist/tex/optex/base/makeindex.opm
@@ -1,10 +1,12 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \makeindex {Makeindex and sorting <2021-02-15>} % preloaded in format
+\_codedecl \makeindex {Makeindex and sorting <2022-02-19>} % preloaded in format
\_doc -----------------------------
\^`\makeindex` implements sorting algorithm at \TeX/ macro-language level.
- You need not any external program.
+ You need not any external program. The sorting can be used for various
+ other applications, see an example in
+ \ulink[http://petr.olsak.net/optex/optex-tricks.html\#sort]{\OpTeX/ trick~0068}.
There are two passes in the sorting algorithm. The primary pass does not
distinguish between a group of letters (typically non-accented and
@@ -14,12 +16,14 @@
before acute before circumflex before ring. At less priority: lowercase
letters must be before uppercase letters.
- The \`\_sortingdata``<iso-code>` implements these rules for the language
- <iso-code>. The groups between commas are not distinguished in the first
+ The \`\_sortingdata``<lang-tag>` implements these rules for the language
+ given by <lang-tag>. The <lang-tag> is typicaly ISO 639-1 code of the language
+ and it is declared by \~`\_preplang` defined in section~\ref[langdecl].
+ The \`\_sortingdatacs` for Czech rules is defined below.
+ The groups between commas are not distinguished in the first
pass. The second pass distinguishes all characters mentioned in the
- `\_sortingdata<iso-code>` (commas are ignored). The order of letters
- in the `\_sortingdata<iso-code>` macro is significant for the sorting algorithm.
- The Czech rules (`cs`) are implemented here:
+ `\_sortingdata<lang-tag>` (commas are ignored). The order of letters
+ in the `\_sortingdata<lang-tag>` macro is significant for the sorting algorithm.
\_cod -----------------------------
\_def \_sortingdatacs {%
@@ -59,45 +63,34 @@
}
\_doc -----------------------------
- Characters ignored by the sorting algorithm are declared in \`\_ignoredchars``<iso-code>`.
- The compound characters (two or more characters interpreted as one
- character in the sorting algorithm) are mapped to single invisible characters
- in \`\_compoundchars``<iso-code>`. Czech rules declare ch or Ch or CH as
- a single letter sorted between H and I. See \`\_sortingdatacs` above where
- these declared characters are used.
-
- The characters declared in `\_ignoredchars` are ignored in the first pass
+ Characters to be ignored are declared in \`\_ignoredchars``<lang-tag>`.
+ See \`\_ignoredcharscs` for Czech rules. These characters are ignored in the first pass
without additional condition. All characters are taken into account in
- second pass: ASCII characters with code $\string<65$ are sorted first if they
- are not mentioned in the `\_sortingdata<iso-code>` macro.
+ the second pass: ASCII characters with code $\string<65$ are sorted first if they
+ are not mentioned in the \^`\_sortingdata``<lang-tag>` macro.
Others not mentioned characters have undefined behavior during sorting.
+
+ The compound characters (two or more characters interpreted as one
+ character in the sorting algorithm) are mapped to single invisible characters
+ in \`\_compoundchars``<lang-tag>`, see \`\_compoundcharscs` below for Czech rules,
+ where ch or Ch or CH are declared as a single letter sorted between H and I.
+ See \^`\_sortingdatacs` above where these declared characters are used.
\_cod -----------------------------
\_def \_ignoredcharscs {.,;?!:'"|()[]<>=+}
\_def \_compoundcharscs {ch:^^T Ch:^^U CH:^^V} % DZ etc. are sorted normally
\_doc -----------------------------
- Slovak sorting rules are the same as Czech. The macro `\_sortingdatacs`
- includes Slovak letters too. Compound characters are the same.
- English sorting rules can be defined by `\_sortingdatacs` too because
- English alphabet is a subset of the Czech and Slovak alphabets. Only
- difference: \`\_compoundcharsen` is empty in English rules.
-
You can declare these macros for more languages if you wish to use
`\makeindex` with sorting rules with respect to your language.
Note: if you need to map compound characters to a character, don't use
- `^^I` or `^^M` because these characters have very specific category codes.
- And use space to separate more mappings, like in \`\_compoundcharscs` above.
- \_cod -----------------------------
+ `^^I`, `^^J` or `^^M` because these characters have very specific category codes.
+ And use spaces to separate more mappings, like in \^`\_compoundcharscs` above.
+
+ If you create `\_sortingdata` etc. for your language, please, send them
+ to me. I am ready to add them to the file `lang-data.opm` in a new \OpTeX/ release.
+ See also section~\ref[langdecl].
-\_let \_sortingdatask = \_sortingdatacs
-\_let \_compoundcharssk = \_compoundcharscs
-\_let \_ignoredcharssk = \_ignoredcharscs
-\_let \_sortingdataen = \_sortingdatacs
-\_def \_compoundcharsen {}
-\_let \_ignoredcharsen = \_ignoredcharscs
-
- \_doc -----------------------------
Preparing to primary pass is implemented by the \`\_setprimarysorting` macro.
It is called from `\makeindex` macro and all processing of sorting is in a group.
\_cod -----------------------------
@@ -160,7 +153,7 @@
\_doc -----------------------------
Macro \`\_isAleB` `\,<string1> \,<string2>` returns the result of comparison
of given two strings to \`\_ifAleB` control sequence. Usage:
- `\isAleB \,<string1> \,<string2> \_ifAleB ... \_else ... \_fi`
+ `\_isAleB \,<string1> \,<string2> \_ifAleB ... \_else ... \_fi`
The converted strings (in respect of the data prepared for first pass)
must be saved as values of `\,<string1>` and `\,<string2>` macros.
The reason is speed: we don't want to convert them repeatedly in each
@@ -247,7 +240,7 @@
The current language (chosen for hyphenation patterns) is used for
sorting data. If the macro \`\_sortinglang`
- is defined as `<iso-code>` (for example `\def\sortinglang{de}`)
+ is defined as `<lang-tag>` (for example `\def\_sortinglang{de}` for German)
then this has precedence and current language is not used.
Moreover, if you specify \`\_asciisortingtrue` then ASCII
sorting will be processed and all language sorting data will be ignored.
@@ -457,6 +450,7 @@
\_endcode % -------------------------------------
+2022-02-19 \_sotringdataen etc. moved to lang-data.opm file
2021-02-15 \_expandafter -> \_ea
2021-02-01 secodary sorting: start from code 65
2020-04-21 \isempty \iffalse ... \fi added to \iindex
diff --git a/Master/texmf-dist/tex/optex/base/math-preload.opm b/Master/texmf-dist/tex/optex/base/math-preload.opm
index 0ec9abae2f7..fde73e7e657 100644
--- a/Master/texmf-dist/tex/optex/base/math-preload.opm
+++ b/Master/texmf-dist/tex/optex/base/math-preload.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \normalmath {Math fonts CM + AMS preloaded <2020-05-06>} % preloaded in format
+\_codedecl \normalmath {Math fonts CM + AMS preloaded <2022-02-22>} % preloaded in format
\_doc ------------------------------
We have two math macros \`\normalmath` for the normal shape of all math
@@ -59,11 +59,11 @@
%\_chardef\_ttfam = 10
%\_chardef\_itfam = 11
-\_protected\_def \_rm {\_tryloadrm \_tenrm \_fam0 }
-\_protected\_def \_bf {\_tryloadbf \_tenbf \_fam\_bffam}
-\_protected\_def \_it {\_tryloadit \_tenit \_fam1 }
-\_protected\_def \_bi {\_tryloadbi \_tenbi \_fam\_bifam}
-\_protected\_def \_tt {\_tryloadtt \_tentt}
+\_protected\_def \_marm {\_fam0 }
+\_protected\_def \_mabf {\_fam\_bffam}
+\_protected\_def \_mait {\_fam1 }
+\_protected\_def \_mabi {\_fam\_bifam}
+\_protected\_def \_matt {}
\_protected\_def \_mit {\_fam1 }
\_protected\_def \_cal {\_fam2 }
@@ -71,7 +71,7 @@
\_protected\_def \_frak {\_fam7 } % fraktur
\_protected\_def \_script {\_fam6 } % more extensive script than \cal
-\_public \rm \bf \it \bi \tt \mit \cal \bbchar \frak \script ;
+\_public \mit \cal \bbchar \frak \script ;
\_doc -----------------------------
The optical sizes of Computer Modern fonts, AMS, and other fonts
@@ -149,9 +149,9 @@
\_def\_loadmathfamily #1 #2 {%
\_edef\_optsizesave{\_the\_optsize}%
- \_optsize=\_sizemtext \_font\_mF=\_whichtfm{#2} at\_optsize \_textfont#1=\_mF
- \_optsize=\_sizemscript \_font\_mF=\_whichtfm{#2} at\_optsize \_scriptfont#1=\_mF
- \_optsize=\_sizemsscript \_font\_mF=\_whichtfm{#2} at\_optsize \_scriptscriptfont#1=\_mF
+ \_optsize=\_sizemtext \_font\_mF=\_optfn{#2} at\_optsize \_textfont#1=\_mF
+ \_optsize=\_sizemscript \_font\_mF=\_optfn{#2} at\_optsize \_scriptfont#1=\_mF
+ \_optsize=\_sizemsscript \_font\_mF=\_optfn{#2} at\_optsize \_scriptscriptfont#1=\_mF
\_optsize=\_optsizesave \_ptmunit=\_ptunit
}
\_def\_setmathfamily #1 #2{\_let\_mF=#2%
@@ -198,7 +198,8 @@
\_cod -----------------------------
\_suppressfontnotfounderror=1
-\_setmathsizes[10/7/5]\_normalmath
+\_setmathsizes[10/7/5]
+\_ifx\fontspreload\_relax \_else \_normalmath \_fi
\_suppressfontnotfounderror=0
@@ -223,5 +224,6 @@ For example
\_endinput
+2022-02-22: \rm, \it, etc moved to fonts-select, \_marm, \_mait etc. introduced
2020-05-06: \itfam, \ttfam removed, (Unicode math preferred)
2020-04-14: \skewchar\fam6 added
diff --git a/Master/texmf-dist/tex/optex/base/math-unicode.opm b/Master/texmf-dist/tex/optex/base/math-unicode.opm
index eaa0e72fbfa..a092d081c27 100644
--- a/Master/texmf-dist/tex/optex/base/math-unicode.opm
+++ b/Master/texmf-dist/tex/optex/base/math-unicode.opm
@@ -243,7 +243,7 @@ The \^`\loadmath` macro was succesfully tested on:
\printdoc math-unicode.opm
-\secc[unimath-codes] Macros and codes set when \code{\\loadmatfont} is processed
+\secc[unimath-codes] Macros and codes set when `\loadmath` is processed firstly
The file `unimath-codes.opm` is loaded when the \^`\loadmath` is used. The
macros here redefines globally all encoding dependent settings declared in
diff --git a/Master/texmf-dist/tex/optex/base/optex.ini b/Master/texmf-dist/tex/optex/base/optex.ini
index 4ccc482d8fa..3323491b2ca 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.05 Jan.2022}
+\def\optexversion{1.06 Mar.2022}
\def\fmtname{OpTeX}
\let\fmtversion=\optexversion
@@ -39,7 +39,7 @@
% Basic .opm syntax:
\let\_endcode =\endinput
-\def \_codedecl #1#2{\message{#2^^J}}% information about .opm file
+\def \_codedecl #1#2{\immediate\write-1{#2}}% information about .opm file
\long\def\_doc#1\_cod#2 {} % skip documentation
% Initialization:
@@ -84,8 +84,8 @@
\input styles.opm % styles \report, \letter
\input logos.opm % standard logos
\input uni-lcuc.opm % Setting lccodes and uccodes for Unicode characters
-\input hyphen-lan.opm % initialization of hyphenation patterns
-\input languages.opm % languages
+\input languages.opm % Languages macros
+\input lang-decl.opm % Languages declaration
\input others.opm % miscellaneous
\_directlua{
diff --git a/Master/texmf-dist/tex/optex/base/optex.lua b/Master/texmf-dist/tex/optex/base/optex.lua
index 19eeb6328b3..3bec088b60d 100644
--- a/Master/texmf-dist/tex/optex/base/optex.lua
+++ b/Master/texmf-dist/tex/optex/base/optex.lua
@@ -2,6 +2,8 @@
-- The basic lua functions and declarations used in \OpTeX/ are here
+local fmt = string.format
+
-- \medskip\secc General^^M
--
-- Define namespace where some \OpTeX/ functions will be added.
@@ -49,9 +51,8 @@ end
-- Allocator for Lua functions ("pseudoprimitives"). It passes variadic
-- arguments (\"`...`") like `"global"` to `token.set_lua`.
local function_table = lua.get_functions_table()
-local luafnalloc = 0
function define_lua_command(csname, fn, ...)
- luafnalloc = luafnalloc + 1
+ local luafnalloc = #function_table + 1
token.set_lua(csname, luafnalloc, ...) -- WARNING: needs LuaTeX 1.08 (2019) or newer
function_table[luafnalloc] = fn
end
@@ -411,8 +412,74 @@ callback.add_to_callback("input_level_string", function(n)
return ""
end
end, "_tracingmacros")
+-- \medskip\secc[lua-pdf-resources] Management of PDF page resources^^M
+--
+-- Traditionally, pdf\TeX/ allowed managing PDF page resources (graphics
+-- states, patterns, shadings, etc.) using a single toks register,
+-- `\pdfpageresources`. This is insufficient due to the expected PDF object
+-- structer and also because many \"packages" want to add page resources and
+-- thus fight for the access to that register. We add a finer alternative,
+-- which allows adding different kinds of resources to a global page resources
+-- dictionary. Note that some resource types (fonts and XObjects) are already
+-- managed by \LuaTeX/ and shouldn't be added!
+--
+-- XObject forms can also use resources, but there are several ways to make
+-- \LuaTeX/ reference resources from forms. It is hence left up to the user to
+-- insert page resources managed by us, if they need them. For that, use
+-- `pdf.get_page_resources()`, or the below \TeX/ alternative for that.
+--
+local pdfdict_mt = {
+ __tostring = function(dict)
+ local out = {"<<"}
+ for k, v in pairs(dict) do
+ out[#out+1] = fmt("/%s %s", tostring(k), tostring(v))
+ end
+ out[#out+1] = ">>"
+ return table.concat(out, "\n")
+ end,
+}
+local function pdf_dict(t)
+ return setmetatable(t or {}, pdfdict_mt)
+end
+--
+local resource_dict_objects = {}
+local page_resources = {}
+function pdf.add_page_resource(type, name, value)
+ local resources = page_resources[type]
+ if not resources then
+ local obj = pdf.reserveobj()
+ pdf.setpageresources(fmt("%s /%s %d 0 R", pdf.get_page_resources(), type, obj))
+ resource_dict_objects[type] = obj
+ resources = pdf_dict()
+ page_resources[type] = resources
+ end
+ page_resources[type][name] = value
+end
+function pdf.get_page_resources()
+ return pdf.getpageresources() or ""
+end
+--
+-- New \"pseudo" primitives are introduced.
+-- \`\_addpageresource``{<type>}{<PDF name>}{<PDF dict>}` adds more reources
+-- of given resource <type> to our data structure.
+-- \`\_pageresources` expands to the saved <type>s and object numbers.
+define_lua_command("_addpageresource", function()
+ pdf.add_page_resource(token.scan_string(), token.scan_string(), token.scan_string())
+end)
+define_lua_command("_pageresources", function()
+ tex.print(pdf.get_page_resources())
+end)
+--
+-- We write the objects with resources to the PDF file in the `finish_pdffile`
+-- callback.
+callback.add_to_callback("finish_pdffile", function()
+ for type, dict in pairs(page_resources) do
+ local obj = resource_dict_objects[type]
+ pdf.immediateobj(obj, tostring(dict))
+ end
+end)
--
--- \medskip\secc[lua-colors] Handling of colors using attributes^^M
+-- \medskip\secc[lua-colors] Handling of colors and transparency using attributes^^M
--
-- Because \LuaTeX/ doesn't do anything with attributes, we have to add meaning
-- to them. We do this by intercepting \TeX/ just before it ships out a page and
@@ -447,10 +514,10 @@ local insertbefore = direct.insert_before
local copy = direct.copy
local traverse = direct.traverse
local one_bp = tex.sp("1bp")
-local string_format = string.format
--
-- The attribute for coloring is allocated in `colors.opm`
local color_attribute = registernumber("_colorattr")
+local transp_attribute = registernumber("_transpattr")
--
-- Now we define function which creates whatsit nodes with PDF literals. We do
-- this by creating a base literal, which we then copy and customize.
@@ -464,16 +531,17 @@ local function pdfliteral(str)
end
optex.directpdfliteral = pdfliteral
--
--- The function {\Red`colorize`}`(head, current, current_stroke)` goes through
--- a node list and injects PDF literals according to attributes.
+-- The function {\Red`colorize`}`(head, current, current_stroke, current_tr)`
+-- goes through a node list and injects PDF literals according to attributes.
-- Its arguments are the head of the list to be colored and the current color
--- for fills and strokes. It is a recursive function – nested
+-- for fills and strokes and the current trasparency attribute.
+-- It is a recursive function – nested
-- horizontal and vertical lists are handled in the same way. Only the
-- attributes of “content” nodes (glyphs, rules, etc.) matter. Users drawing
-- with PDF literals have to set color themselves.
--
--- Whatsit node with color setting PDF literal is injected only when a
--- different color is needed. Our injection does not care about boxing levels,
+-- Whatsit node with color setting PDF literal is injected only when a different
+-- color or transparency is needed. Our injection does not care about boxing levels,
-- but this isn't a problem, since PDF literal whatsits just instruct the
-- `\shipout` related procedures to emit the literal.
--
@@ -499,21 +567,13 @@ optex.directpdfliteral = pdfliteral
-- We use the `node.direct` way of working with nodes. This is less safe, and
-- certainly not idiomatic Lua, but faster and codewise more close to the way
-- \TeX/ works with nodes.
-local function is_color_needed(head, n, id, subtype) -- returns non-stroke, stroke color needed
+local function is_color_needed(head, n, id, subtype) -- returns fill, stroke color needed
if id == glyph_id then
return true, false
elseif id == glue_id then
n = getleader(n)
if n then
- id = getid(n)
- if id == hlist_id or id == vlist_id then
- -- leaders with hlist/vlist get single color
- return true, false
- else -- rule
- -- stretchy leaders with rules are tricky,
- -- just set both colors for safety
- return true, true
- end
+ return true, true
end
elseif id == rule_id then
local width, height, depth = getwhd(n)
@@ -530,45 +590,56 @@ local function is_color_needed(head, n, id, subtype) -- returns non-stroke, stro
return false, false
end
-local function colorize(head, current, current_stroke)
+local function colorize(head, current, current_stroke, current_tr)
for n, id, subtype in traverse(head) do
if id == hlist_id or id == vlist_id then
-- nested list, just recurse
local list = getlist(n)
- list, current, current_stroke = colorize(list, current, current_stroke)
+ list, current, current_stroke, current_tr =
+ colorize(list, current, current_stroke, current_tr)
setlist(n, list)
elseif id == disc_id then
-- at this point only no-break (replace) list is of any interest
local replace = getfield(n, "replace")
if replace then
- replace, current, current_stroke = colorize(replace, current, current_stroke)
+ replace, current, current_stroke, current_tr =
+ colorize(replace, current, current_stroke, current_tr)
setfield(n, "replace", replace)
end
else
- local nonstroke_needed, stroke_needed = is_color_needed(head, n, id, subtype)
+ local fill_needed, stroke_needed = is_color_needed(head, n, id, subtype)
local new = getattribute(n, color_attribute) or 0
- local newcolor = nil
- if current ~= new and nonstroke_needed then
- newcolor = token_getmacro("_color:"..new)
+ local newtr = getattribute(n, transp_attribute) or 0
+ local newliteral = nil
+ if current ~= new and fill_needed then
+ newliteral = token_getmacro("_color:"..new)
current = new
end
if current_stroke ~= new and stroke_needed then
local stroke_color = token_getmacro("_color-s:"..current)
if stroke_color then
- if newcolor then
- newcolor = string_format("%s %s", newcolor, stroke_color)
+ if newliteral then
+ newliteral = fmt("%s %s", newliteral, stroke_color)
else
- newcolor = stroke_color
+ newliteral = stroke_color
end
current_stroke = new
end
end
- if newcolor then
- head = insertbefore(head, n, pdfliteral(newcolor))
+ if newtr ~= current_tr and fill_needed then -- (fill_ or stroke_needed) = fill_neded
+ if newliteral ~= nil then
+ newliteral = fmt("%s /tr%d gs", newliteral, newtr)
+ else
+ newliteral = fmt("/tr%d gs", newtr)
+ end
+ current_tr = newtr
+ end
+ if newliteral then
+ head = insertbefore(head, n, pdfliteral(newliteral))
end
end
end
- return head, current, current_stroke
+ return head, current, current_stroke, current_tr
end
--
-- Colorization should be run just before shipout. We use our custom callback
@@ -578,7 +649,7 @@ callback.add_to_callback("pre_shipout_filter", function(list)
-- By setting initial color to -1 we force initial setting of color on
-- every page. This is useful for transparently supporting other default
-- colors than black (although it has a price for each normal document).
- local list = colorize(todirect(list), -1, -1)
+ local list = colorize(todirect(list), -1, -1, 0)
return tonode(list)
end, "_colors")
--
@@ -609,5 +680,7 @@ function optex_hook_into_luaotfload()
end
-- History:
+ -- 2022-03-07 transparency in the colorize() function, current_tr added
+ -- 2022-03-05 resources management added
-- 2021-07-16 support for colors via attributes added
-- 2020-11-11 optex.lua released
diff --git a/Master/texmf-dist/tex/optex/base/others.opm b/Master/texmf-dist/tex/optex/base/others.opm
index 0c9f4cae6a0..3b5edcfa982 100644
--- a/Master/texmf-dist/tex/optex/base/others.opm
+++ b/Master/texmf-dist/tex/optex/base/others.opm
@@ -51,11 +51,29 @@
\let ^^a0=~
\_doc ----------------------------
- TikZ needs these funny control sequences.
+ Old macro packages need these funny control sequences.
+ We don't use them in new macros.
\_cod ----------------------------
-\_ea\_toksdef \_csname toks@\_endcsname=0
-\_ea\_let \_csname voidb@x\_endcsname=\_voidbox
+\_catcode`\@=11
+\_let\z@=\_zo \_let\z@skip=\_zoskip
+\_newdimen\p@ \p@=1pt
+\_toksdef\toks@=0
+\_let\voidb@x=\_voidbox
+\_chardef\@ne=1 \_chardef\tw@=2 \_chardef\thr@@=3 \_chardef\sixt@@n=16
+\_mathchardef\@m=1000 \_mathchardef\@M=10000 \_mathchardef\@MM=20000
+\_countdef\m@ne=22 \m@ne=-1
+\_chardef\@cclv=255 \_mathchardef\@cclvi=256
+\_skipdef\skip@=0
+\_dimendef\dimen@=0 \_dimendef\dimen@i=1
+\_dimendef\dimen@ii=2
+\_countdef\count@=255
+\_def\m@th{\_mathsurround\z@}
+\_def\o@lign{\_lineskiplimit\z@ \_oalign}
+\_def\n@space{\_nulldelimiterspace\z@ \m@th}
+\_newdimen\p@renwd \p@renwd=8.75pt
+\_def\alloc@#1#2#3#4#5{\_allocator#5{\_csstring#2}#3}
+\_catcode`\@=12
\_doc ----------------------------
We don't want to read `opmac.tex` unless `\input opmac` is specified.
diff --git a/Master/texmf-dist/tex/optex/base/output.opm b/Master/texmf-dist/tex/optex/base/output.opm
index ffe41c5387f..c74d99d371d 100644
--- a/Master/texmf-dist/tex/optex/base/output.opm
+++ b/Master/texmf-dist/tex/optex/base/output.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \nopagenumbers {Output routine <2021-07-16>} % preloaded in format
+\_codedecl \nopagenumbers {Output routine <2021-03-07>} % preloaded in format
\_doc -----------------------------
\`\_optexoutput` is the default output routine. You can create another...\nl
@@ -63,12 +63,13 @@
New is only \`\_backgroundbox`. It is `\vbox` with zero height with its
contents (from \^`\pgbackground`) extended down. It is shifted directly to the
left-upper corner of the paper.\nl
- The \^`\_resetcolor` used here means that all newly created texts in
- output routine (texts used in headline, footline) have default color.
+ The \^`\_resetattrs` used here means that all newly created texts in
+ output routine (texts used in headline, footline) have default color
+ and no transparency.
\_cod -----------------------------
\_def\_completepage{\_vbox{%
- \_resetcolor
+ \_resetattrs
\_istoksempty \_pgbackground
\_iffalse \_backgroundbox{\_the\_pgbackground}\_nointerlineskip \_fi
\_makeheadline
@@ -155,7 +156,7 @@
\_def \_opfootnote #1#2{\_insert\_footins\_bgroup
\_interlinepenalty=\_interfootnotelinepenalty
\_leftskip=\_zo \_rightskip=\_zo \_spaceskip=\_zo \_xspaceskip=\_zo \_relax
- \_resetcolor
+ \_resetattrs
#1\_relax % local settings used by \fnote macro
\_splittopskip=\_ht\_strutbox % top baseline for broken footnotes
\_splitmaxdepth=\_dp\_strutbox \_floatingpenalty=20000
@@ -186,7 +187,7 @@
\_skip\_topins=\_zoskip % no space added when a topinsert is present
\_count\_topins=1000 % magnification factor (1 to 1)
\_dimen\_topins=\_maxdimen % no limit per page
-\_def \_oins {\_par \_begingroup\_setbox0=\_vbox\_bgroup\_resetcolor} % start a \_vbox
+\_def \_oins {\_par \_begingroup\_setbox0=\_vbox\_bgroup\_resetattrs} % start a \_vbox
\_def \_endinsert {\_par\_egroup % finish the \_vbox
\_ifumid \_dimen0=\_ht0 \_advance\_dimen0 by\_dp0 \_advance\_dimen0 by\_baselineskip
\_advance\_dimen0 by\_pagetotal \_advance\_dimen0 by-\_pageshrink
@@ -257,6 +258,7 @@ The output routine \^`\_optexoutput` is similar as in plain \TeX. It does:
\_endinput
+2022-03-07 \_resetattrs instead \_resetcolor
2021-07-16 output routine supports colors via attributes
2021-02-25 \_draftbox improved
2021-02-15 \_advance -> \_decr
diff --git a/Master/texmf-dist/tex/optex/base/parameters.opm b/Master/texmf-dist/tex/optex/base/parameters.opm
index 5379617d6c1..6e690e5214b 100644
--- a/Master/texmf-dist/tex/optex/base/parameters.opm
+++ b/Master/texmf-dist/tex/optex/base/parameters.opm
@@ -58,7 +58,10 @@
\_doc -----------------------------
\secc Plain \TeX/ registers
- Allocate registers that are used just like in plain \TeX/.
+ Allocate registers that are used just like in plain \TeX/.\nl
+ \`\smallskipamount`, \`\medskipamount`, \`\bigskipamount`,
+ \`\normalbaselineskip`, \`\normallineskip`,\nl \`\normallineskiplimit`,
+ \`\jot`, \`\interdisplaylinepenalty`, \`\interfootnotelinepenalty`.
\_cod -----------------------------
% We also define special registers that function like parameters:
@@ -72,6 +75,15 @@
\_newcount\_interdisplaylinepenalty \_interdisplaylinepenalty=100
\_newcount\_interfootnotelinepenalty \_interfootnotelinepenalty=100
+\_public \smallskipamount \medskipamount \bigskipamount
+ \normalbaselineskip \normallineskip \normallineskiplimit
+ \jot \interdisplaylinepenalty \interfootnotelinepenalty ;
+
+ \_doc -----------------------------
+ Plain \TeX/ macros for setting parameters.
+ \`\normalbaselines`, \`\frenchspacing`, \`\nonfrenchspacing`.
+ \_cod -----------------------------
+
\_def\_normalbaselines{\_lineskip=\_normallineskip
\_baselineskip=\_normalbaselineskip \_lineskiplimit=\_normallineskiplimit}
@@ -80,10 +92,7 @@
\_def\_nonfrenchspacing{\_sfcode`\.=3000 \_sfcode`\?=3000 \_sfcode`\!=3000
\_sfcode`\:=2000 \_sfcode`\;=1500 \_sfcode`\,=1250 }
-\_public \normalbaselines \frenchspacing \nonfrenchspacing
- \smallskipamount \medskipamount \bigskipamount
- \normalbaselineskip \normallineskip \normallineskiplimit
- \jot \interdisplaylinepenalty \interfootnotelinepenalty ;
+\_public \normalbaselines \frenchspacing \nonfrenchspacing ;
\_doc -----------------------------
\secc Different settings than in plain \TeX/
@@ -91,9 +100,9 @@
Default \"baseline setting" is for 10\,pt fonts (like in plain \TeX/).
But `\typosize` and `\typoscale` macros re-declare it if another font size is used.
- The \`\nonfrenchspacing` is not set by default because
+ The \^`\nonfrenchspacing` is not set by default because
the author of \OpTeX/ is living in Europe.
- If you set `\enlang` hyphenation patterns then `\nonfrenchspacing`
+ If you set `\enlang` hyphenation patterns then \^`\nonfrenchspacing`
is set.
\_cod -----------------------------
diff --git a/Master/texmf-dist/tex/optex/base/plain-macros.opm b/Master/texmf-dist/tex/optex/base/plain-macros.opm
index 2f4d2da65c6..6909abff09f 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-09-24>} % preloaded in format
+\_codedecl \magstep {Macros from plain TeX <2022-02-19>} % preloaded in format
\_doc -----------------------------
The \`\dospecials` works like in plain TeX but does nothing with `_`.
@@ -356,8 +356,16 @@
\_def \_bye {\_par \_vfill \_supereject \_byehook \_end}
\_public \showhyphens \bye ;
+ \_doc -----------------------------
+ Plain \TeX/ reads `hyphen.tex` with patterns as `\language=0`. We do the same.
+ \_cod -----------------------------
+
+\_lefthyphenmin=2 \_righthyphenmin=3 % disallow x- or -xx breaks
+\_input hyphen % en(USenglish) patterns from TeX82
+
\_endcode % -------------------------------------
+2022-02-19 ... \input hyphen.tex moved here (format file is 80k smaller)
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/ref-file.opm b/Master/texmf-dist/tex/optex/base/ref-file.opm
index 95e960bc12a..7f9c619009e 100644
--- a/Master/texmf-dist/tex/optex/base/ref-file.opm
+++ b/Master/texmf-dist/tex/optex/base/ref-file.opm
@@ -59,6 +59,7 @@
\_gdef\_wref ##1##2{\_write\_reffile{\_bslash\_csstring##1##2}}%
\_immediate\_write\_reffile {\_pcent\_pcent\_space OpTeX <\_optexversion> - REF file}%
\_immediate\_wref \Xrefversion{{\_REFversion}}%
+ \_ifx\_refdecldata\_empty \_else \_refdeclwrite \_fi
\_gdef\_openref{}%
}
\_def\_ewref #1#2{\_edef\_ewrefA{#2}\_ea\_wref\_ea#1\_ea{\_ewrefA}}
@@ -88,7 +89,7 @@
You cannot define your own `.ref` macros before `.ref` file is read
because it is read in `\everyjob`. But you can define such macros by using
\`\refdecl``{<definitions of your ref macros>}`.
- This command immediately writes `<definitions of your ref macros>` to the
+ This command writes `<definitions of your ref macros>` to the
`.ref` file. Then the next lines written to the `.ref` file can include
your macros.
An example from CTUstyle2:
@@ -100,13 +101,23 @@
}
\endtt
We must read `<definitions of your ref macros>` while `#` has the catcode 12,
- because we don't want to duplicate each `#` in the `.ref` file.
+ because we don't want to duplicate each `#` in the `.ref` file.\nl
+ `\refdecl` appends its data to the \`\_refdecldata` macro. It is
+ pushed to the `.ref` file immediatelly only if the file is opened
+ already. Otherwise we are waiting to `\openref` because we don't want
+ to open the `.ref` file if it is unnecessary.
\_cod \_fin -----------------
-\_def\_refdecl{\_bgroup \_catcode`\#=12 \_refdeclA}
-\_def\_refdeclA #1{\egroup\_openref
- \_immediate\_write\_reffile {\_pcent\_space \_string \refdecl:}%
- \_immediate\_write\_reffile {\_detokenize{#1}}%
+\_def\_refdecldata{}
+\_def\_refdecl{\_bgroup \_catcode`\#=12 \_catcode`\\=12 \_catcode`\ =12 \_refdeclA}
+\_def\_refdeclA#1{\_egroup
+ \_ifx\_refdecldata\_empty\_else \_global\_addto\_refdecldata{^^J}\_fi
+ \_global\_addto\_refdecldata{#1}%
+ \_ifx\_openref\_empty \_refdeclwrite \_fi
+}
+\_def\_refdeclwrite{%
+ \_immediate\_write\_reffile{\_pcent\_space \_string\refdecl:^^J\_detokenize\_ea{\_refdecldata}}%
+ \_gdef\_refdecldata{}%
}
\_public \refdecl ;
diff --git a/Master/texmf-dist/tex/optex/base/references.opm b/Master/texmf-dist/tex/optex/base/references.opm
index 51b1b9591af..c26320b046c 100644
--- a/Master/texmf-dist/tex/optex/base/references.opm
+++ b/Master/texmf-dist/tex/optex/base/references.opm
@@ -30,7 +30,7 @@
\_def\_Xlabel#1#2{\_sdef{_lab:#1}{#2}\_sxdef{_pgref:#1}{\_currpage}}
\_doc ----------------------------
- \`\label``[<label>]` saves the declared label to `\_lastlabel` and
+ \`\label``[<label>]` saves the declared label to \`\_lastlabel` and
\`\wlabel``{<text>}` uses the `\_lastlabel` and activates
`\_wref\_Xlabel{<label>}{<text>}`.
\_cod ----------------------------
diff --git a/Master/texmf-dist/tex/optex/base/slides.opm b/Master/texmf-dist/tex/optex/base/slides.opm
index 0fed12ac7fd..4a006c38c14 100644
--- a/Master/texmf-dist/tex/optex/base/slides.opm
+++ b/Master/texmf-dist/tex/optex/base/slides.opm
@@ -1,6 +1,6 @@
% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \slideshow {Slides style for OpTeX <2021-04-22>} % loaded on demand by \slides
+\_codedecl \slideshow {Slides style for OpTeX <2022-03-08>} % loaded on demand by \slides
\_doc -----------------------------
Default margins and design is declared here.
@@ -56,14 +56,8 @@
For transparency we need to define special graphics states.
\_cod -----------------------------
-\_addextgstate{/Invisible <</ca 0 /CA 0>>}
-\_addextgstate {/Visible <</ca 1 /CA 1>>}
-
-\_def\_Invisible {\_pdfliteral{/Invisible gs}}
-\_def\_Visible {\_pdfliteral{/Visible gs}}
-\_def\_Transparent {\_Invisible \_aftergroup \_Visible}
-
-\_public \Invisible \Visible \Transparent ;
+\_def\_Transparent {\_transparency255 }
+\_public \Transparent ;
\_def\_use#1#2{\_ifnum\_layernum#1\_relax#2\_fi}
\_def\_pshow#1{\_use{=#1}\Red \_use{<#1}\_Transparent \_ignorespaces}
@@ -108,7 +102,7 @@
The `\bye` macro is redefined here as an alternative to `\pg.`.
\_cod -----------------------------
-\_def\_endslides{\_byehook \_end}
+\_def\_endslides{\_vfill \_supereject \_byehook \_end}
\_def\bye{\_pg.}
\_doc -----------------------------
@@ -298,6 +292,9 @@
The user manual of \OpTeX/ slides are in `op-slides.tex` file.
+2022-03-08 \Transparent re-defined, \Visible, \Invisible removed
+2022-03-05 \_addextgstate: new syntax used
+2022-03-03 \supereject in \_endslides before \_byehook added
2021-04-22 \adef* moved back, bug fixed in more-macros.opm
2021-04-21 \adef* removed from slides.opm, bug fixed
2021-04-19 \_byehook added to \_endslides.
diff --git a/Master/texmf-dist/tex/optex/base/table.opm b/Master/texmf-dist/tex/optex/base/table.opm
index d10e916bbe6..fd66bd9ff56 100644
--- a/Master/texmf-dist/tex/optex/base/table.opm
+++ b/Master/texmf-dist/tex/optex/base/table.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \table {Basic macros for OpTeX <2021-08-04>} % preloaded in format
+\_codedecl \table {Basic macros for OpTeX <2022-02-25>} % preloaded in format
\_doc -----------------------------
The result of the \`\table``{<declaration>}{<data>}` macro is inserted into
@@ -225,9 +225,9 @@
We don't want vertical line after red A to be in red.
\_cod -----------------------------
-\_def\_tabdeclarec{\_the\_tabiteml{\_hfil##\_unsskip\_hfil}\_the\_tabitemr}
-\_def\_tabdeclarel{\_the\_tabiteml{\_relax##\_unsskip\_hfil}\_the\_tabitemr}
-\_def\_tabdeclarer{\_the\_tabiteml{\_hfil##\_unsskip}\_the\_tabitemr}
+\_def\_tabdeclarec{\_the\_tabiteml \_begingroup\_hfil##\_unsskip\_hfil\_endgroup \_the\_tabitemr}
+\_def\_tabdeclarel{\_the\_tabiteml \_begingroup ##\_unsskip\_hfil\_endgroup \_the\_tabitemr}
+\_def\_tabdeclarer{\_the\_tabiteml \_begingroup\_hfil##\_unsskip\_endgroup \_the\_tabitemr}
\_doc -----------------------------
The \`\_paramtabdeclarep``{<data>}` is invoked when `p{<data>}`
@@ -583,6 +583,7 @@ after the second one.
\_endinput
+2022-02-25 {}->\(begin|end)group in \_tabdeclare(l|r|c), bug when \tabitem(l|r)={$} fixed.
2021-08-04 \_patamtabdeclarep reimplemented.
2021-07-16 grouping based on colors via attributes.
2021-06-03 \scantextokens added to \_partabitem, bug fixed.
diff --git a/Master/texmf-dist/tex/optex/base/uni-lcuc.opm b/Master/texmf-dist/tex/optex/base/uni-lcuc.opm
index e56b3b9228b..0cd8bfe6e50 100644
--- a/Master/texmf-dist/tex/optex/base/uni-lcuc.opm
+++ b/Master/texmf-dist/tex/optex/base/uni-lcuc.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_wterm{Setting lccodes and uccodes for Unicode characters <2021-04-07>} % preloaded in format.
+\_wlog{Setting lccodes and uccodes for Unicode characters <2021-04-07>} % preloaded in format.
\_isfile{UnicodeData.txt}\_iftrue
\_begingroup
diff --git a/Master/texmf-dist/tex/optex/base/unimath-codes.opm b/Master/texmf-dist/tex/optex/base/unimath-codes.opm
index ea40116ab89..ec0067890e4 100644
--- a/Master/texmf-dist/tex/optex/base/unimath-codes.opm
+++ b/Master/texmf-dist/tex/optex/base/unimath-codes.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_ncharrmA {Uni math codes <2022-01-06>} % preloaded on demand by \loadmath
+\_codedecl \_ncharrmA {Uni math codes <2022-02-22>} % preloaded on demand by \loadmath
\_doc -----------------------------
The control sequences for `\alpha`, `\beta` etc are redefined here.
@@ -108,18 +108,14 @@
\_protected\_def\_ttdigits {\_umathrange{0-9}71\_digitttO}
\_doc -----------------------------
- The \`\cal`, \`\bbchar`, \`\frak`, \`\script` and
- the \`\rm`, \`\bf`, \`\it`, \`\bi`, \`\tt` are defined here.
- Their \"8bit definitions" from the file `math-preload.opm`
- (section~\ref[math-preload]) are removed.\nl
+ The math alphabets \`\cal`, \`\bbchar`, \`\frak`, \`\script` are re-defined
+ here. The \`\_marm`, \`\_mabf`, \`\_mait`, \`\_mabi`, \`\_matt`
+ used in \^`\rm`, \^`\bf`, \^`\it`, \^`\bi` are re-defined too.\nl
You can redefine them again if you need different behavior (for example
you don't want to use sans serif bold in math). What to do:
- \begtt \advance\hsize by2em
- \_protected\_def\_bf
- {\_tryloadbf\_tenbf \_inmath{\_bfvariables\_bfgreek\_bfGreek\_bfdigits}}
- \_protected\_def\_bi
- {\_tryloadbi\_tenbi \_inmath{\_bivariables\_bigreek\_bfGreek\_bfdigits}}
- \_public \bf \bi ;
+ \begtt
+ \_protected\_def\_mabf {\_inmath{\_bfvariables\_bfgreek\_bfGreek\_bfdigits}}
+ \_protected\_def\_mabi {\_inmath{\_bivariables\_bigreek\_bfGreek\_bfdigits}}
\endtt
\`\_inmath` `{<cmds>}` applies `<cmds>` only in math mode.
\_cod -----------------------------
@@ -130,13 +126,11 @@
% For example, you need upright lowercase greek letters, you don't need
% \bf and \bi behave as sans serif in math, ...
-\_protected\_def\_rm {\_tryloadrm \_tenrm \_inmath{\_rmvariables \_rmdigits}}
-\_protected\_def\_it {\_tryloadit \_tenit \_inmath{\_itvariables \_itGreek}}
-\_protected\_def\_bf
- {\_tryloadbf \_tenbf \_inmath{\_bsansvariables \_bsansgreek \_bsansGreek \_bsansdigits}}
-\_protected\_def\_bi
- {\_tryloadbi \_tenbi \_inmath{\_bisansvariables \_bisansgreek \_bsansGreek \_bsansdigits}}
-\_protected\_def\_tt {\_tryloadtt \_tentt \_inmath{\_ttvariables \_ttdigits}}
+\_protected\_def\_marm {\_inmath{\_rmvariables \_rmdigits}}
+\_protected\_def\_mait {\_inmath{\_itvariables \_itGreek}}
+\_protected\_def\_mabf {\_inmath{\_bsansvariables \_bsansgreek \_bsansGreek \_bsansdigits}}
+\_protected\_def\_mabi {\_inmath{\_bisansvariables \_bisansgreek \_bsansGreek \_bsansdigits}}
+\_protected\_def\_matt {\_inmath{\_ttvariables \_ttdigits}}
\_protected\_def\_bbchar {\_bbvariables \_bbdigits}
\_protected\_def\_cal {\_calvariables}
\_protected\_def\_frak {\_frakvariables}
@@ -145,7 +139,7 @@
\_protected\_def\_script {\_rmvariables \_fam4 }
\_protected\_def\_mit {\_itvariables \_rmdigits \_itgreek \_rmGreek }
-\_public \rm \it \bf \bi \tt \bbchar \cal \frak \misans \mbisans \script \mit ;
+\_public \bbchar \cal \frak \misans \mbisans \script \mit ;
\_doc -----------------------------
Each Unicode slot carries information about math type. This is saved in
@@ -243,22 +237,34 @@
\_protected\_def \Vert {\_Udelimiter 0 1 "02016 }
\_protected\_def \Vvert {\_Udelimiter 0 1 "02980 }
-\_protected\_def \_overbrace #1{\mathop {\Umathaccent 7 1 "023DE{#1}}\limits}
-\_protected\_def \_underbrace #1{\mathop {\Umathaccent bottom 7 1 "023DF{#1}}\limits}
-\_protected\_def \_overparen #1{\mathop {\Umathaccent 7 1 "023DC{#1}}\limits}
-\_protected\_def \_underparen #1{\mathop {\Umathaccent bottom 7 1 "023DD{#1}}\limits}
-\_protected\_def \_overbracket #1{\mathop {\Umathaccent 7 1 "023B4{#1}}\limits}
-\_protected\_def \_underbracket #1{\mathop {\Umathaccent bottom 7 1 "023B5{#1}}\limits}
+\_protected\_def \_overbrace #1{\_mathop {\_Umathaccent 7 1 "023DE{#1}}\_limits}
+\_protected\_def \_underbrace #1{\_mathop {\_Umathaccent bottom 7 1 "023DF{#1}}\_limits}
+\_protected\_def \_overparen #1{\_mathop {\_Umathaccent 7 1 "023DC{#1}}\_limits}
+\_protected\_def \_underparen #1{\_mathop {\_Umathaccent bottom 7 1 "023DD{#1}}\_limits}
+\_protected\_def \_overbracket #1{\_mathop {\_Umathaccent 7 1 "023B4{#1}}\_limits}
+\_protected\_def \_underbracket #1{\_mathop {\_Umathaccent bottom 7 1 "023B5{#1}}\_limits}
\_public \overbrace \underbrace \overparen \underparen \overbracket \underbracket ;
-\_protected\def \widehat {\Umathaccent 7 1 "00302 }
-\_protected\def \widetilde {\Umathaccent 7 1 "00303 }
-\_protected\def \overleftharpoon {\Umathaccent 7 1 "020D0 }
-\_protected\def \overrightharpoon {\Umathaccent 7 1 "020D1 }
-\_protected\def \overleftarrow {\Umathaccent 7 1 "020D6 }
-\_protected\def \overrightarrow {\Umathaccent 7 1 "020D7 }
-\_protected\def \overleftrightarrow {\Umathaccent 7 1 "020E1 }
+\_protected\_def \widehat {\_Umathaccent 7 1 "00302 }
+\_protected\_def \widetilde {\_Umathaccent 7 1 "00303 }
+\_protected\_def \overleftharpoon {\_Umathaccent 7 1 "020D0 }
+\_protected\_def \overrightharpoon {\_Umathaccent 7 1 "020D1 }
+\_protected\_def \overleftarrow {\_Umathaccent 7 1 "020D6 }
+\_protected\_def \overrightarrow {\_Umathaccent 7 1 "020D7 }
+\_protected\_def \overleftrightarrow {\_Umathaccent 7 1 "020E1 }
+
+\_protected\_def \wideoverbar {\_Umathaccent 7 1 "00305 }
+\_protected\_def \widebreve {\_Umathaccent 7 1 "00306 }
+\_protected\_def \widecheck {\_Umathaccent 7 1 "0030C }
+\_protected\_def \wideutilde {\_Umathaccent bottom 7 1 "00330 }
+\_protected\_def \mathunderbar {\_Umathaccent bottom 7 1 "00332 }
+\_protected\_def \underleftrightarrow {\_Umathaccent bottom 7 1 "0034D }
+\_protected\_def \widebridgeabove {\_Umathaccent 7 1 "020E9 }
+\_protected\_def \underrightharpoondown {\_Umathaccent bottom 7 1 "020EC }
+\_protected\_def \underleftharpoondown {\_Umathaccent bottom 7 1 "020ED }
+\_protected\_def \underleftarrow {\_Umathaccent bottom 7 1 "020EE }
+\_protected\_def \underrightarrow {\_Umathaccent bottom 7 1 "020EF }
\_mathchardef\ldotp="612E
\_let\|=\Vert
@@ -443,6 +449,8 @@ for technical details about Unicode-math.
\_endinput
History:
+2022-02-22 \rm, \bf etc. moved to font-select, \_marm, \_mabf etc. introduced
+2022-02-08 several wide math accents added
2022-01-06 \varTheta corrected
2021-09-15 \square, \blacksquare defined
2021-04-25 \triangleright: typo fixed
diff --git a/Master/texmf-dist/tex/optex/base/unimath-table.opm b/Master/texmf-dist/tex/optex/base/unimath-table.opm
index 252c1fc26ac..9c2556e3032 100644
--- a/Master/texmf-dist/tex/optex/base/unimath-table.opm
+++ b/Master/texmf-dist/tex/optex/base/unimath-table.opm
@@ -165,7 +165,7 @@
\UnicodeMathSymbol{"020E4}{\enclosetriangle }{\mathord}{combining enclosing upward pointing triangle}%
\UnicodeMathSymbol{"020E7}{\annuity }{\mathaccent}{combining annuity symbol}%
\UnicodeMathSymbol{"020E8}{\threeunderdot }{\mathbotaccent}{combining triple underdot}%
-\UnicodeMathSymbol{"020E9}{\widebridgeabove }{\mathaccent}{combining wide bridge above}%
+\UnicodeMathSymbol{"020E9}{\widebridgeabove }{\mathaccentwide}{combining wide bridge above}%
\UnicodeMathSymbol{"020EC}{\underrightharpoondown }{\mathbotaccentwide}{combining rightwards harpoon with barb downwards}%
\UnicodeMathSymbol{"020ED}{\underleftharpoondown }{\mathbotaccentwide}{combining leftwards harpoon with barb downwards}%
\UnicodeMathSymbol{"020EE}{\underleftarrow }{\mathbotaccentwide}{combining left arrow below}%
diff --git a/Master/texmf-dist/tex/optex/base/usebib.opm b/Master/texmf-dist/tex/optex/base/usebib.opm
index 0b515fcfba3..ab2f1068113 100644
--- a/Master/texmf-dist/tex/optex/base/usebib.opm
+++ b/Master/texmf-dist/tex/optex/base/usebib.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \MakeReference {Reading bib databases <2021-04-30>} % loaded on demand by \usebib
+\_codedecl \MakeReference {Reading bib databases <2022-02-04>} % loaded on demand by \usebib
\_doc -----------------------------
Loading the `librarian.tex` macro package. See `texdoc librarian`
@@ -33,7 +33,6 @@
\_emergencystretch=.3\_hsize
\_def\_optexbibstyle{#2}%
\_setctable\_optexcatcodes
- \_ea \_skiptoendinput \_input languages.opm
\_input bib-#2.opm
\_the \_bibtexhook
\_ifcsname _mt:bib.and:\_cs{_lan:\_the\_language}\_endcsname \_else
@@ -55,7 +54,6 @@
\_egroup
\_fi
}
-\_long\_def\_skiptoendinput#1\_endinput{}
\_def\_readbibentry#1#{\_readbibentryA}
\_def\_readbibentryA#1{\_readbibentryB#1,,\_relax!.}
\_def\_readbibentryB#1#2,#3\_relax!.{\_addto\_citelist{\_citeI[#1#2]}}
@@ -367,6 +365,7 @@ character is sorted before `A`.
History:
--------
+2022-02-04 reading tail of languages.opm removed
2021-04-30 \RetrieveField declared as private, bug fixed.
2021-04-13 \bibpart implemented
2021-04-13 \_bibgl introduced (used by \slides)
diff --git a/Master/texmf-dist/tex/optex/base/verbatim.opm b/Master/texmf-dist/tex/optex/base/verbatim.opm
index e3d423691ed..3c20ead1b67 100644
--- a/Master/texmf-dist/tex/optex/base/verbatim.opm
+++ b/Master/texmf-dist/tex/optex/base/verbatim.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \begtt {Verbatim <2021-04-18>} % preloaded in format
+\_codedecl \begtt {Verbatim <2022-02-22>} % preloaded in format
\_doc ----------------------------
The internal parameters
@@ -350,7 +350,7 @@
}
\_def\_testcommentchars #1\_iftrue{\_iffalse} % default value of \_testcommentchar
\_def\_printcomments{\_ttskip
- {\_catcodetable0 \_reloading \_rm \_everypar={}%
+ {\_catcodetable0 \_rm \_everypar={}%
\_noindent \_ignorespaces \_scantextokens\_ea{\_vcomments}\_par}%
\_ttskip
}
@@ -376,6 +376,7 @@
\_endinput
History:
+2022-02-22 ... \_reloading removed due to changes in font-select
2021-04-18 ... \_protrudechars=0 added
2021-04-07 ... \_savemathsb, \_restoremathsb introduced
2021-01-22 ... \activettchar changed to \verbchar
diff --git a/Master/texmf-dist/tex/optex/pkg/minim-mp.opm b/Master/texmf-dist/tex/optex/pkg/minim-mp.opm
new file mode 100644
index 00000000000..72462d86c27
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/pkg/minim-mp.opm
@@ -0,0 +1,16 @@
+% This is macro package used by OpTeX, see http://petr.olsak.net/optex
+% minim-mp.opm, Michal Vlasák <lahcim8@gmail.com>, 2022
+% see also https://github.com/vlasakm/optex-minim
+
+\_codedecl \_minimmp_used {Minim-PDF for \OpTeX/}
+\_namespace{minimmp}
+
+\_def\.used{}
+
+\_load[minim]
+
+\_input minim-mp
+
+\_endnamespace
+\_endcode
+
diff --git a/Master/texmf-dist/tex/optex/pkg/minim-pdf.opm b/Master/texmf-dist/tex/optex/pkg/minim-pdf.opm
new file mode 100644
index 00000000000..3c4c0c73317
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/pkg/minim-pdf.opm
@@ -0,0 +1,96 @@
+% This is macro package used by OpTeX, see http://petr.olsak.net/optex
+% minim-pdf.opm, Michal Vlasák <lahcim8@gmail.com>, 2022
+% see also https://github.com/vlasakm/optex-minim
+
+\_codedecl \nohyphlang {Minim-PDF for \OpTeX/}
+\_namespace{minimpdf}
+
+ \_doc
+ Before loading `minim-pdf` we do a few preparations. Most importantly
+ adjusting core of minim, which is done in `minim.opm`.
+ \_cod
+
+\_load[minim]
+
+\_catcode`\@=11
+\_catcode`\:=11
+
+ \_doc
+ Minim hooks into language mechanism with standard \eTeX/
+ `\uselanguage@hook`. It can then translate language names (e.g
+ \"SwissGerman") into BCP 47 language identifiers (e.g. \"de-ch-1901", the
+ naming scheme of the `hyph-utf8` package) which are then embedded into
+ tagged PDFs. For simplicity, we use what \OpTeX/ calls \"lang-tag" (e.g.
+ \"de") which may not be precise enough (i.e. the right thing for Swiss
+ German would be \"de-ch") and may even be wrong(?).
+
+ When e.g. `\gswlang` (Swiss German) is used, `\uselang{gsw}\_gswPatt<...>`
+ is called in \OpTeX/. We use the fact, the there is mapping from language
+ register numbers (`\_gswPatt`) to \"lang-tag"s (\"de"). To avoid confusion
+ with any other language mappings, we prefix what we give to minim with `o:`.
+
+ We also don't incorporate the \eTeX/ `\uselanguage@hook`, but call minim's
+ callback directly, maybe it will cause less trouble with other packages
+ (since we don't pass standard names to the callback) and also gives a better
+ idea of what happens.
+ \_cod
+
+\_let\.uselang=\_uselang
+\_def\_uselang#1#2#3#4{%
+ \.uselang{#1}{#2}{#3}{#4}%
+ % just set this everytime, doesn't hurt
+ \setlanguagecode{o:#1}{\_cs{_lan:\_the#2}}%
+ \minim:uselanguagecallback{o:#1}%
+}
+
+ \_doc
+ If not detected, a few \"dummy" languages would be (in erroneous ways)
+ defined by minim: like \"nohyph" and \"undetermined". We define a few dummy
+ control sequences, to make minim not define them, since we define them
+ ourselves below. They are used in standard way, but their \"ISO codes" are weird:
+
+ \begtt
+ \nohyphlang
+ \nolanglang
+ \uncodedlang
+ \undeterminedlang
+ \endtt
+ \_cod
+
+\_let\lang@nohyph=\_empty
+\_let\lang@nolang=\_empty
+\_let\lang@uncoded=\_empty
+\_let\lang@undetermined=\_empty
+
+\_preplang nohyph nohyph und {} 11
+\_preplang nolang nolang und {} 11
+\_preplang uncoded uncoded und {} 11
+\_preplang undetermined undetermined und {} 11
+
+ \_doc
+ Now we actually load `minim-pdf`.
+ \_cod
+
+\_input minim-pdf
+
+ \_doc
+ Users aren't supposed to define custom languages in \OpTeX/, forbid that.
+ \_cod
+
+\_def\_tmp{\errmessage{don't use this command with OpTeX}}
+\_let\newnamedddialect=\_tmp
+\_let\newnameddllanguage=\_tmp
+
+ \_doc
+ Since a language may already be set (at least the default Knuth english),
+ then we need to tell minim about it, by reexecuting the language command
+ (like `\enlang`), thus calling into minim through the above mentioned hook.
+ \_cod
+
+% set the current language again to let minim know what it is
+\_cs{\_cs{_lan:\_the\_language}lang}
+
+
+% catcodes changes don't propage, since this file is loaded with \opinput
+\_endnamespace
+\_endcode
diff --git a/Master/texmf-dist/tex/optex/pkg/minim.opm b/Master/texmf-dist/tex/optex/pkg/minim.opm
new file mode 100644
index 00000000000..79298552d11
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/pkg/minim.opm
@@ -0,0 +1,188 @@
+% This is used by OpTeX packages minim-mp, minim-pdf, see http://petr.olsak.net/optex
+% minim.opm, Michal Vlasák <lahcim8@gmail.com>, 2022
+% see also https://github.com/vlasakm/optex-minim
+
+\_def\_optexminim_version{0.1}
+\_codedecl \optexminim_loaded {Minim compatibility for \OpTeX/ (v\_optexminim_version)}
+
+ \_doc
+ When we want to use minim with \OpTeX/, we need to accomodate for their
+ differences. Particularly in allocations. Because of Esger Renkema's
+ graciousness, minim has been modified in ways that make it easier to
+ integrate with \OpTeX/. So even when the two formats normally disagree on a
+ lot of core things (allocations, callbacks) they can end up working together.
+
+ \OpTeX/ defines most allocation macros in `alloc.opm` and some Lua
+ allocation functions in `optex.lua`. Minim \"packages" are not standalone,
+ they all depend on core routines defined in `minim-alloc.tex` and
+ `minim-alloc.lua` respectively. Minim as a format preloads a stripped
+ version of `etex.src` so the Lua code makes some assumptions about that
+ (i.e. expects local allocators).
+
+ Both \OpTeX/ and minim want to make it possible to register more functions
+ for a single callback, by chaining their calls and `callback.register()`ing
+ only a proxy function. While minim stays close to the `callback` interface
+ from \LuaTeX/, \OpTeX/ is a subset of the \LaTeX/ `luatexbase` interface.
+ But minim now can work on top of ltluatex by using its functions instead of
+ `callback.register()`, so we don't have to do anything to support it in
+ \OpTeX/!
+
+ Firstly, because we only change what is defined by others, we actually need
+ a dummy macro for `\_codedecl`, to prevent loading this file more than once.
+ \_cod
+
+\_catcode`\@=11
+% dummy macro to signalize that we are loaded
+\_let\optexminim_loaded=\empty
+
+ \_doc
+ In general, there are four allocator types expected by minim:
+
+ \begitems
+ * Knuth allocators from `plain.tex` (like `\newcount`). These are already
+ defined by \OpTeX/. Although minim itself sets the old `\allocationnumber`
+ counter, which is not even defined in \OpTeX/.
+
+ * Global allocators from `etex.src` (like `\globcount`). These are not
+ defined by \OpTeX/, since they no longer make sense (\LuaTeX/ doesn't use
+ sparse arrays for registers). Minim defines them to be the classic Knuth
+ allocators if it doesn't find them on the TeX side, but expects them from
+ the Lua side.
+
+ * Local allocators from `etex.src` (like `\loccount`). Concept of local
+ allocators is completely missing in \OpTeX/. The semantics of local
+ allocation in Lua is weird too, so we try to avoid these, since minim also
+ doesn't define their Lua variants.
+
+ * \LuaTeX/ allocators from `ltluatex.tex` (like `\newattribute`). Subset of
+ these is in \OpTeX/ (only atributes, which are also allocatable in Lua, and
+ catcode tables). But minim tries to be compatible with \LaTeX/ and patches
+ its routines if it detects them.
+ \enditems
+
+ For defining \TeX/ commands implemented in Lua, \OpTeX/ has
+ `define_lua_command`, which actually does the allocation and definition at
+ the same time, and allows to do so only from Lua end.
+
+ Historically (in my opinion unfortunately) \LaTeX/ made the allocations of
+ these functions available from \TeX/ end, and the \"lua define" operation is
+ thus a two step process which involves synchronization with \TeX/.
+
+ `minim-alloc` actually defines a `luadef` function which is like
+ `define_lua_command`, but is backed by the minim allocator. To make this
+ work, we just need to set the \LaTeX/ register to the index of last
+ allocated function, since it allocates at counter plus one. Then minim will
+ start where \OpTeX/ stopped, and we will later define `define_lua_command`
+ to be just minim's `luadef`.
+
+ We tell the number of allocated function by going through the table of
+ actually used functions. This is not that robust, because while
+ `define_lua_command` allocates sequentially, the provided functions may be
+ `nil`, which breaks the code below.
+ \_cod
+
+\_newcount\allocationnumber
+
+% for synchronisation of allocated Lua functions
+\_ea\_newcount\_csname e@alloc@luafunction@count\_endcsname
+
+\directlua{
+ local function_table = lua.get_functions_table()
+ % minim allocates at count + 1 for "new" allocators, so this works
+ tex.setcount("global", "e@alloc@luafunction@count", \csstring\#function_table)
+}
+
+ \_doc
+ We also get PDF resources out of the way now. Minim is ready to use \OpTeX's
+ PDF resource management, but also has compatibility layer for PGF, which is
+ not needed in \OpTeX/. We prevent loading the problematic \TeX/ file.
+ \_cod
+
+\_let\minimpdfresourcesloaded=\_empty
+
+ \_doc
+ The preparations are over. We load `minim-alloc.tex`.
+ \_cod
+
+\input minim-alloc
+
+ \_doc
+ Both \LaTeX/ and the minim inspired catcode table allocators initialize the
+ catcode tables with `\initcatcodetable` (i.e. ini\TeX/ catcodes). \OpTeX/
+ merely allocates the registers. \LuaTeX/ doesn't allow to activate
+ unitialized catcode table, therefore activation with either
+ `\initcatcodetable` or `\savecatcodetable` is necessary before use. To
+ ensure compatibility with foreign macros, we also issue `\initcatcodetable`
+ on allocation in the public version of `\newcatcodetable`.
+ \_cod
+
+\_def\newcatcodetable#1{\_newcatcodetable#1\_initcatcodetable#1}
+
+ \_doc
+ By now, the Knuthian allocators are dealt with. \eTeX/ global and local
+ allocators are undefined, but the global ones are expected in minim's Lua
+ code with their hardcoded counter register numbers. This is unacceptable,
+ since in this range (`\count260` to `\count266`) \OpTeX/ has already made
+ allocations. Thus we need to replace these Lua functions with similar
+ definitions. For some, \OpTeX/ also has a different idea whether the counter
+ represent the last or next allocated register number, so we correct that as
+ well.
+
+ We also don't forget to actually set `define_lua_command` to be minim's
+ `luadef`.
+ \_cod
+
+\directlua{
+ local minimalloc = require("minim-alloc")
+
+ define_lua_command = minimalloc.luadef
+
+ % these are allocators already defined in OpTeX that we need to repair
+ local toreplace = {
+ "count",
+ "dimen",
+ "skip",
+ "muskip",
+ "box",
+ "toks",
+ "marks",
+ "attribute",
+ "catcodetable",
+ }
+
+ for _, alloc in ipairs(toreplace) do
+ local cache = {}
+ local countername = string.format("_\_pcent salloc", alloc)
+ minimalloc["new_"..alloc] = function(id)
+ local n = cache[id]
+ if not n then
+ n = tex.getcount(countername) + 1
+ tex.setcount("global", countername, n)
+ if id then
+ cache[id] = n
+ end
+ minimalloc.log(
+ "\_nbb\_pcent s\_pcent d : \_pcent s", alloc, n, id or "<unnamed>")
+ end
+ return n
+ end
+ end
+}
+
+ \_doc
+ We also need to do something about `minim-hooks.tex`, which hooks into
+ `\shipout`, but the default \OpTeX/ output routine (and perhaps also the
+ user ones) use `\_shipout`.
+
+ Minim also adds to `\everypar`, but that is fine.
+ \_cod
+
+\_let\shipout\_shipout
+
+\input minim-hooks
+
+\_catcode`\:=11
+\_let\_shipout\minim:shipout:new
+
+% catcodes changes don't propage, since this file is loaded with \opinput
+\_endcode
diff --git a/Master/texmf-dist/tex/optex/pkg/plain-at.opm b/Master/texmf-dist/tex/optex/pkg/plain-at.opm
index 3277d7b24ea..47495d2f2f4 100644
--- a/Master/texmf-dist/tex/optex/pkg/plain-at.opm
+++ b/Master/texmf-dist/tex/optex/pkg/plain-at.opm
@@ -2,6 +2,11 @@
\_codedecl \_undefined {Obscure @ names from plain TeX <2020-05-22>}
+\_opwarning{plain-at.opm is obsolete, ignored. @-names defined in the format}
+
+\_endcode
+
+% Old version of plain-at.opm follows:
\_setctable \_optexcatcodes
% PlainTeX obscure names:
\_catcode`\@=11
@@ -28,6 +33,7 @@
\_def\n@space{\_nulldelimiterspace\z@ \m@th}
\_newdimen\p@renwd \p@renwd=8.75pt
\_def\alloc@#1#2#3#4#5{\_allocator#5{\_csstring#2}#3}
+\_catcode`\@=12
\_restorectable
\_endcode
@@ -41,3 +47,6 @@ can load this file in such cases. For example:
\endtt
\_endinput
+
+2022-02-15: marked obsolete
+2020-12-20: released
diff --git a/Master/texmf-dist/tex/optex/pkg/tikz.opm b/Master/texmf-dist/tex/optex/pkg/tikz.opm
index da2657d5fcb..84743a18b68 100644
--- a/Master/texmf-dist/tex/optex/pkg/tikz.opm
+++ b/Master/texmf-dist/tex/optex/pkg/tikz.opm
@@ -1,17 +1,88 @@
% This is macro package used by OpTeX, see http://petr.olsak.net/optex
-\_codedecl \tikzpicture {TikZ for OpTeX <2021-07-15>}
+\_codedecl \tikzpicture {TikZ for OpTeX <2022-02-11>}
+\_namespace{pgf}
+\_catcode`\@=11
\_doc
This package is \OpTeX/'s compatibility layer for PGF/TikZ. When users do
`\load[tikz]` they expect `tikz.tex` to be loaded, but this file gets loaded
instead. It does load `tikz.tex`, but also does fixups.
- First we load TikZ itself.
+ We want to change some definitions in `pgfutil-plain.def` and
+ `pgfsys-luatex.def`. We need to do that in right times, so we manually
+ emulate some files from PGF to ensure we do things in the correct order.
+ \_cod
+
+%tikz.tex
+% pgf.tex
+% pgfrcs.tex
+% pgfutil-common.tex
+% pgfutil-common-lists.tex
+% pgfutil-plain.tex
+% pgfrcs.code.tex
+% pgfcore.tex
+% pgfsys.tex
+% pgfsrcs.tex
+% pgfsys.code.tex
+% driver
+% pgfcore.code.tex
+% pgffor.tex
+% pgfrcs.tex
+% pgfkeys.code.tex
+% pgffor.code.tex
+% tikz.code.tex
+\def\pgfrcsincluded{}
+\input pgfutil-common.tex
+
+ \_doc
+ We load macros from `pgfutil-plain.def` because they are most
+ similar to macros we actually need. But there are several differences.
+ We don't want to load the output routine hack realized by
+ `\input atbegshi.sty\relax \AtBeginShipout{...}` in `pgfutil-plain.def`.
+ This is the reason why we re-define `\input` temporarily.
\_cod
-\_input tikz.tex
+\def\input#1\relax{}
+\def\AtBeginShipout#1{}
+\_input pgfutil-plain.def
+\let\input=\_input
+\let\AtBeginShipout=\_undefined
+\let\end=\_end
+
+ \_doc
+ More changes should be done for macros loaded from `pgfutil-plain.def`.
+ These changes follows.
+ \_cod
+
+% Writing to auxiliary files, customized
+
+\_let\pgfutil@aux@read@hook=\_relax
+\_def\pgfutil@writetoaux#1{}
+
+
+% Driver detection, customized
+
+\def\pgfsysdriver{pgfsys-luatex.def}
+
+
+% Font stuff, \_typosize to fixed sizes used, math fonts are scaled too
+
+\def\pgfutil@font@tiny{\_typosize[5/]}
+\def\pgfutil@font@scriptsize{\_typosize[7/]}
+\def\pgfutil@font@footnotesize{\_typosize[8/]}
+\def\pgfutil@font@small{\_typosize[9/]}
+\def\pgfutil@font@normalsize{\_typosize[10/]}
+\def\pgfutil@font@large{\_typosize[12/]}
+\def\pgfutil@font@Large{\_typosize[14.4/]}
+\def\pgfutil@font@huge{\_typosize[20.74/]}
+\def\pgfutil@font@Huge{\_typosize[24.88/]}
+
+\def\pgfutil@font@normalfont{\_rm}
+\def\pgfutil@font@itshape{\_it}
+\def\pgfutil@font@bfseries{\_bf}
+\def\pgfutil@selectfont{\_rm}
\_doc
PGF's `\pgfutil@everybye` hooks into `\end`, but normally \OpTeX/ uses the
@@ -19,9 +90,34 @@
hopefully be preserved by all \OpTeX/ macro writers.
\_cod
-\_addto\_byehook{\_the\_cs{pgfutil@everybye}}
+\_addto\_byehook{\_the\pgfutil@everybye}
\_doc
+ Make PGF/TikZ use our PDF resource management. Our functions expect split
+ key and value.
+ \_cod
+
+\_def\.kvsplit#1{\_ea\.kvsplitA\_expanded{#1}\_end}
+\_def\.kvsplitA#1/#2 #3\_end{{#2}{#3}}
+
+\_def\pgfutil@addpdfresource@extgs{\_addpageresource{ExtGState}\.kvsplit}
+\_def\pgfutil@addpdfresource@colorspaces{\_addpageresource{ColorSpace}\.kvsplit}
+\_def\pgfutil@addpdfresource@patterns{\_addpageresource{Pattern}\.kvsplit}
+\_let\pgfutil@setuppdfresources=\_relax
+\_let\pgf@sys@pdf@check@resources=\_relax
+\_def\pgf@sys@pdf@possible@resources{\_pageresources}
+
+\_input pgfrcs.code.tex
+\ProvidesPackageRCS{pgf.tex}
+\_input pgfcore.tex
+\usepgfmodule{shapes,plot}
+\_input pgffor.tex
+\_input tikz.code.tex
+
+ \_doc
+ More changes should be done for macros loaded from `pgfsys-luatex.def`.
+ These changes follows.
+
There is a general disagreement about the use/meaning of `\hoffset` and
`\voffset` -- \LaTeX/, the \LaTeX/ `crop`
package\fnote{\url{https://www.ctan.org/pkg/crop}}, TikZ, and \OpTeX/ all
@@ -34,6 +130,23 @@
$(0, 0)$).
\_cod
-\_sdef{pgf@sys@pdf@mark@pos@pgfpageorigin}{\pgfpointorigin}
+\_def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfpointorigin}
+\_refdecl{%
+ \_def\.Xpgfsysmark#1#2#3{\_sdef{pgf@sys@pdf@mark@pos@#1}{\pgfqpoint{#2sp}{#3sp}}}%
+}
+
+\_def\pgfsys@markposition#1{%
+ \_openref
+ \_savepos
+ \_edef\.tmp{#1}%
+ \_ea\_wref\_ea\.Xpgfsysmark\_ea{\_ea{\.tmp}{\_the\_lastxpos}{\_the\_lastypos}}%
+}
+
+% don't worry about reseting catcodes - we are at the end of \opinput'ed file
+\_endnamespace
\_endcode
+
+History:
+2022-03-05 resources management re-implemented
+2021-07-15 released