summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-12-03 21:02:14 +0000
committerKarl Berry <karl@freefriends.org>2022-12-03 21:02:14 +0000
commit29bf525f876e4654f4acff755e0ec7b925041c2e (patch)
tree9e1d83b02eecb573645616613dc073cccad2b079
parent1b14d7809c520eb9ccb785f44c93c1616351f54e (diff)
optex (3dec22)
git-svn-id: svn://tug.org/texlive/trunk@65185 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/optex/base/README11
-rw-r--r--Master/texmf-dist/doc/optex/base/mte-doc.tex26
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-doc.pdfbin1437685 -> 1484007 bytes
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-doc.tex2
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-math.tex33
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-techdoc.tex8
-rw-r--r--Master/texmf-dist/doc/optex/base/optex-userdoc.tex32
-rw-r--r--Master/texmf-dist/tex/optex/base/alloc.opm5
-rw-r--r--Master/texmf-dist/tex/optex/base/basic-macros.opm22
-rw-r--r--Master/texmf-dist/tex/optex/base/bib-simple.opm49
-rw-r--r--Master/texmf-dist/tex/optex/base/cite-bib.opm2
-rw-r--r--Master/texmf-dist/tex/optex/base/doc.opm34
-rw-r--r--Master/texmf-dist/tex/optex/base/f-heros.opm17
-rw-r--r--Master/texmf-dist/tex/optex/base/f-iwona.opm26
-rw-r--r--Master/texmf-dist/tex/optex/base/f-kurier.opm26
-rw-r--r--Master/texmf-dist/tex/optex/base/f-lato.opm34
-rw-r--r--Master/texmf-dist/tex/optex/base/fams-ini.opm19
-rw-r--r--Master/texmf-dist/tex/optex/base/fnotes.opm4
-rw-r--r--Master/texmf-dist/tex/optex/base/fonts-catalog.opm2
-rw-r--r--Master/texmf-dist/tex/optex/base/fonts-resize.opm72
-rw-r--r--Master/texmf-dist/tex/optex/base/fonts-select.opm25
-rw-r--r--Master/texmf-dist/tex/optex/base/graphics.opm12
-rw-r--r--Master/texmf-dist/tex/optex/base/hi-syntax.opm20
-rw-r--r--Master/texmf-dist/tex/optex/base/hyperlinks.opm6
-rw-r--r--Master/texmf-dist/tex/optex/base/if-macros.opm63
-rw-r--r--Master/texmf-dist/tex/optex/base/lang-data.opm24
-rw-r--r--Master/texmf-dist/tex/optex/base/lang-decl.opm16
-rw-r--r--Master/texmf-dist/tex/optex/base/languages.opm7
-rw-r--r--Master/texmf-dist/tex/optex/base/makeindex.opm6
-rw-r--r--Master/texmf-dist/tex/optex/base/math-preload.opm63
-rw-r--r--Master/texmf-dist/tex/optex/base/more-macros.opm119
-rw-r--r--Master/texmf-dist/tex/optex/base/multicolumns.opm7
-rw-r--r--Master/texmf-dist/tex/optex/base/optex.ini6
-rw-r--r--Master/texmf-dist/tex/optex/base/optex.lua107
-rw-r--r--Master/texmf-dist/tex/optex/base/others.opm8
-rw-r--r--Master/texmf-dist/tex/optex/base/output.opm7
-rw-r--r--Master/texmf-dist/tex/optex/base/pdfuni-string.opm12
-rw-r--r--Master/texmf-dist/tex/optex/base/plain-macros.opm19
-rw-r--r--Master/texmf-dist/tex/optex/base/prefixed.opm178
-rw-r--r--Master/texmf-dist/tex/optex/base/ref-file.opm2
-rw-r--r--Master/texmf-dist/tex/optex/base/references.opm6
-rw-r--r--Master/texmf-dist/tex/optex/base/sections.opm27
-rw-r--r--Master/texmf-dist/tex/optex/base/table.opm14
-rw-r--r--Master/texmf-dist/tex/optex/base/unimath-codes.opm65
-rw-r--r--Master/texmf-dist/tex/optex/base/unimath-macros.opm (renamed from Master/texmf-dist/tex/optex/base/math-unicode.opm)151
-rw-r--r--Master/texmf-dist/tex/optex/base/verbatim.opm10
-rw-r--r--Master/texmf-dist/tex/optex/pkg/math.opm639
-rw-r--r--Master/texmf-dist/tex/optex/pkg/mte.opm32
48 files changed, 1640 insertions, 435 deletions
diff --git a/Master/texmf-dist/doc/optex/base/README b/Master/texmf-dist/doc/optex/base/README
index 0cd39b8770e..f6a86e51d2e 100644
--- a/Master/texmf-dist/doc/optex/base/README
+++ b/Master/texmf-dist/doc/optex/base/README
@@ -22,6 +22,17 @@ doc/ ... PDF version of the OpTeX documentation and sources.
History:
+<1.09> Dec 2022:
+ New math.opm package: doing math more comfortable.
+ The math.opm package can be a package template for macro writers.
+ \docgen for printing doucumantation of packages introduced.
+ unimath control sequences are almost all declared by \chardef, no \mathchardef.
+ \casesof, \currfile, \nospaceafter (tools for macro programmers) introduced.
+ \setpos, \posx, \posy moved from OpTeX trick to the format.
+ \sfont, \ufont introduced.
+ More robust \caption parameter.
+ Lato, Kurier, Iwona font families registered.
+ Minor more improvements and bug fixing.
<1.08> Aug 2022:
Sorting rules for German, French, Polish, Hungarian, ... added.
Font files for Montserrat, STIX, XITS, STIXtwo, Overlock added.
diff --git a/Master/texmf-dist/doc/optex/base/mte-doc.tex b/Master/texmf-dist/doc/optex/base/mte-doc.tex
deleted file mode 100644
index 030f023d3f7..00000000000
--- a/Master/texmf-dist/doc/optex/base/mte-doc.tex
+++ /dev/null
@@ -1,26 +0,0 @@
-% This is part of mte.opm macro package for OpTeX
-
-% Run optex mte-doc
-% (two times) to generate documentation including references and the index.
-
-\load [doc]
-
-\def\elink[#1]#2{%
- \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf\#cs:#1]%
- {\tt\string#2}%
-}
-\def\olink[#1]#2{%
- \ulink[http://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf\#cs:#1]%
- {\tt\string#2}%
-}
-\let\_urllinkcolor=\Cyan
-
-\printdoctail mte.opm
-\printdoc mte.opm
-
-\nonum\sec Index
-\begmulti 3
-\tt \makeindex
-\endmulti
-
-\bye
diff --git a/Master/texmf-dist/doc/optex/base/optex-doc.pdf b/Master/texmf-dist/doc/optex/base/optex-doc.pdf
index bf9f70a3267..666e8793e6e 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 785a181b1da..de9639a5767 100644
--- a/Master/texmf-dist/doc/optex/base/optex-doc.tex
+++ b/Master/texmf-dist/doc/optex/base/optex-doc.tex
@@ -21,7 +21,7 @@
\tit Format Based on Plain \TeX/ and OPmac\fnotemark1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\hfill Version 1.08
+\hfill Version 1.09
\centerline{\it Petr Olšák, 2020, 2021, 2022}
diff --git a/Master/texmf-dist/doc/optex/base/optex-math.tex b/Master/texmf-dist/doc/optex/base/optex-math.tex
index ab127ea7622..e94b742d660 100644
--- a/Master/texmf-dist/doc/optex/base/optex-math.tex
+++ b/Master/texmf-dist/doc/optex/base/optex-math.tex
@@ -37,6 +37,20 @@
\def\x`{\bgroup\_setverb\xx}
\bgroup \lccode\string`\.=\string`\` \lowercase{\egroup \def\xx #1#2.{\i #2 \egroup `#1#2.}}
+\bgroup
+\globaldefs=-1
+\def\refs{} \tmpnum=0
+\def\_Xtoc#1#2#3{\incr\tmpnum
+ \ea\addto \ea\refs \expanded{{\noexpand\sdef{r:#3}{\the\tmpnum}}}
+ \scantoeol\ignoreit
+}
+\isfile{optex-doc.ref}\iftrue \input{optex-doc.ref}\fi
+\ea
+\egroup
+\refs
+
+\def\urloptexdoc{https://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf}
+\def\optexdoc[#1]{\ea\ulink\expanded{[\urloptexdoc\#toc:\trycs{r:#1}{}]}}
\hyperlinks\Green\Green
@@ -69,8 +83,8 @@ There are more types of extensions: e\TeX, lua\TeX/, Unicode math and
is appended to the red triangle to inform you about the extension type.
Nevertheless, \OpTeX/ user doesn't have to worry about it, all extensions
are available if Unicode Math font is loaded (e.g., by the command
-`\fonfam[lmfonts]`). See section 1.3.3 in \OpTeX/ documentation about
-loading Unicode math fonts.
+`\fonfam[lmfonts]`). See \optexdoc[1.3.3]{section 1.3.3} in \OpTeX/
+documentation about loading Unicode math fonts.
{\iindent=2em
\bigskip
@@ -109,7 +123,8 @@ The math atoms are \ii single/math/object {\em single math objects} or
\fnote{In \OpTeX/, the character `_` can be interpreted as a part of
the control sequence name, not as the subscript constructor. But in common cases,
constructions of math atoms are interpreted exactly as in plain \TeX. See sections
- 2.2.2 and 2.14 of \OpTeX/ documentation for more details. If you want to
+ \optexdoc[2.2.2]{2.2.2} and \optexdoc[2.15]{2.15}
+ of \OpTeX/ documentation for more details. If you want to
be sure that `_` is just a subscript constructor in \OpTeX/ then you can set \code{\\catcode`\\_=8}
but after this, you cannot use control sequences with `_` character.}
The constructors for exponent `^` and subscript `_` can be used in arbitrary order
@@ -644,8 +659,8 @@ in another than this default shape, then we can use
\x`\mit`, \x`\rm`, \x`\it`, \x`\bf`, \x`\cal`.
\new \OpTeX/
\OpTeX/ supports more such selectors \x`\script`, \x`\frak`, \x`\bbchar`, \x`\bi`, see
-section 1.3.3 in the \OpTeX/ documentation. The math selectors have local
-validity in the group.
+\optexdoc[1.3.3]{section 1.3.3} in the \OpTeX/ documentation.
+The math selectors have local validity in the group.
The control sequences \x`\rm`, \x`\it`, \x`\bf`, and \x`\bi` act as variant selectors
of fonts in non-math mode (text mode) and they act
@@ -1410,7 +1425,7 @@ operator:
$$
\sum/_{\eqlines{\baselineskip=.7\baselineskip}\eqstyle{\scriptstyle}\eqalign{
i &\in A \cr
- \quad j &\in B\cup C \cr
+ j &\in B\cup C \cr
m &\in C }}
i + j + m
$$
@@ -1418,7 +1433,7 @@ $$
$$
\sum_{\eqlines{\baselineskip=.7\baselineskip}\eqstyle{\scriptstyle}\eqalign{
i &\in A \cr
- \quad j &\in B\cup C \cr
+ j &\in B\cup C \cr
m &\in C }}
i + j + m
$$
@@ -1585,8 +1600,8 @@ characters from main math font and these additional fonts. This can be
usable if the main math font doesn't include all desired characters or you
dislike some character shapes from main font. \OpTeX/ enables to load
additional math fonts by `\addUmathfont` and characters from additional
-fonts can be declared by `\resetmathchars`. See the section 2.16 of \OpTeX/
-documentation for more details about this.
+fonts can be declared by `\mathchars`. See the \optexdoc[2.16]{section 2.16}
+of \OpTeX/ documentation for more details about this.
The rest of this section includes an example which shows another task: how
to combine main Unicode math font with old 8-bit math font `bbold10.tfm`.
diff --git a/Master/texmf-dist/doc/optex/base/optex-techdoc.tex b/Master/texmf-dist/doc/optex/base/optex-techdoc.tex
index 5a51ba4d8ac..78156194047 100644
--- a/Master/texmf-dist/doc/optex/base/optex-techdoc.tex
+++ b/Master/texmf-dist/doc/optex/base/optex-techdoc.tex
@@ -87,7 +87,7 @@ the `\dump` command.
}
\printdoctail prefixed.opm
-\secc The implementation of the namespaces
+\secc The implementation of the namespaces and macros for macro-files
\printdoc prefixed.opm
\sec pdf\TeX/ initialization
@@ -145,7 +145,7 @@ section~\ref[fselect].
\printdoc math-macros.opm
\sec Unicode-math fonts
-\printdoctail math-unicode.opm
+\printdoctail unimath-macros.opm
\sec[opmac-fonts] Scaling fonts in document (high-level macros)
These macros are documented in section~\ref[sizes] from the user point of view.
@@ -274,7 +274,7 @@ 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].
-{\everytt={\typosize[8/10]\_let\_printverbline=\_printcodeline \medskip}
+{\everytt={\typosize[8/10]\_let\_printverbline=\_printcodeline \_hfuzz=1em \medskip}
\commentchars-- \def\docfile{optex.lua} \ttline=-1
\_def\_printcomments{\_medskip
{\_catcodetable0 \_typosize[10/12]\_everypar={}\_scantextokens\_ea{\_vcomments}\par}%
@@ -285,7 +285,7 @@ found in the subsection~\ref[lua-colors].
}
-\sec Printing documentation
+\sec[doc] Printing documentation
\printdoctail doc.opm
\printdoc doc.opm
diff --git a/Master/texmf-dist/doc/optex/base/optex-userdoc.tex b/Master/texmf-dist/doc/optex/base/optex-userdoc.tex
index 23609f7bad6..e04014b991f 100644
--- a/Master/texmf-dist/doc/optex/base/optex-userdoc.tex
+++ b/Master/texmf-dist/doc/optex/base/optex-userdoc.tex
@@ -237,8 +237,8 @@ to \^`\fontfam[lmfonts]`. Several aliases are prepared, thus
If you write \^`\fontfam[?]` then all font families registered in \OpTeX/
are listed on the terminal and in the log file.
If you write \^`\fontfam[catalog]` then a catalog of all fonts registered in
-\OpTeX/ and available in your \TeX/ system is printed. The instructions
-on how to register your own font family are appended in the catalog.
+\OpTeX/ and available in your \TeX/ system is printed.
+See also \ulink[http://petr.olsak.net/ftp/olsak/optex/op-catalog.pdf]{this catalog}.
If the family is loaded then {\em font modifiers} applicable in such font family
are listed on the terminal: (`\caps`, `\cond` for example).
@@ -1128,7 +1128,7 @@ this item occurs is listed in the index entry. So you can type:
The \ii resistor resistor is a passive electrical component ...
\endtt
-You cannot double the word if you use the \^`\iid` instead of \^`\ii`:
+You don't have to double the word if you use the \^`\iid` instead of \^`\ii`:
\begtt
The \iid resistor is a passive electrical component ...
@@ -1304,7 +1304,7 @@ The usage is:
\endtt
The <bib-base> is one or more `*.bib` database source files (separated by
-spaces and without extension) and the <style> is the part of the filename
+commas and without extension) and the <style> is the part of the filename
`bib-<style>.opm` where the formatting of the references list is
defined. \OpTeX/ supports `simple` or `iso690` styles. The features of
the `iso690` style is documented in the section~\ref[isobib] in detail.
@@ -1746,7 +1746,11 @@ to more files (with individual chapters or sections), use simply the `\input` pr
The macro packages intended to \OpTeX/ have the name `*.opm`.
The list of packages supported by \OpTeX/ follows. Most of them are directly part of \OpTeX/:
-\begitems
+\begitems \typosize[9/11]
+* \ulink[https://petr.olsak.net/ftp/olsak/optex/math-doc.pdf]{\tt math.opm}
+ provides usable features for math typesetting and shows
+ \ulink[https://petr.olsak.net/ftp/olsak/optex/math-doc.pdf\#ref:pkgtemplate]
+ {how to create new packages}.
* `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.
* \ulink[http://petr.olsak.net/ftp/olsak/optex/mte-doc.pdf]{\tt mte.opm}
@@ -1907,14 +1911,19 @@ More information about such macros can be found in the technical documentation.
You can use hyperlinks here in order to go to the appropriate place of the technical
documentation.
-\medskip \noindent
-\^`\addto`` \macro{<text>}` adds <text> at the end of `\macro` body.\nl
+\bgroup \medskip \noindent \typosize[9/11]
+\^`\addto` `\macro{<text>}` adds <text> at the end of `\macro` body,
+\^`\aheadto` `\macro{<text>}` puts <text> at the begin.\nl
\^`\adef` `<char>{<body>}` defines <char> active character with meaning <body>.\nl
\^`\afterfi` `{<text>}<ignored>\fi` expands to `\fi<text>`.\nl
+\^`\basefilename` \^`\currfile` returns the name of the file currently read.\nl
\^`\bp`` {<dimen expression>}` expands \TeX/ dimension to decimal number in `bp` without unit.\nl
+\^`\casesof` `<token> <list of cases>` expands to a given case by meaning of the `<token>`.
+ See also \^`\xcasesof`.\nl
\~`\_codedecl`` <sequence> {<info>}` is used at beginning of macro files.\nl
\~`\colordef`` \macro {<mix of colors>}` declares `\macro` as color switch.\nl
\^`\cs` `{<string>}` expands `\<string>`.\nl
+\^`\cstochar` `<sequence>` converts <sequence> to <character> if there was `\let<sequence>=<character>`.\nl
\~`\_doc` `...` \~`\_cod` encloses documenation text in the macro code.\nl
\^`\eoldef`` \macro #1{<body>}` defines `\macro` with parameter separated to end of line.\nl
\~`\_endcode` closes the part of macro code in macro files.\nl
@@ -1931,8 +1940,8 @@ documentation.
\^`\ignoreit` `<one>`, \^`\ignoresecond` `<one><two>` ignores given parameter.\nl
`\expandafter` \^`\ignorept` `\the<dimen>` expands to decimal number <dimen> without `pt`.\nl
\~`\isempty`, \~`\istoksempty`, \~`\isequal`, \~`\ismacro`, \~`\isdefined`, \~`\isinlist`
-\~`\isfile`, \~`\isfont` do various tests. Example: \~`\isinlist\list{<text>}\iftrue` does
- `\iftrue` if <text> is in `\list`.\nl
+\~`\isfile`, \~`\isfont` do various tests.\nl
+ Example: \~`\isinlist\list{<text>}\iftrue` does `\iftrue` if <text> is in `\list`.\nl
\^`\isnextchar`` <char>{<text1>}{<text2>}` performs <text1> if next
character is <char>, else <text2>.\nl
\~`\kv` `{<key>}` expands to value when key-value parameters are used.\nl
@@ -1942,9 +1951,12 @@ documentation.
\^`\newcount`, \^`\newdimen` etc. are classical Plain \TeX/ allocators.\nl
\^`\newif` `\iffoo` declares boolean `\iffoo` as in Plain \TeX/.\nl
\^`\_newifi` `\_iffoo` declares boolean `\_iffoo`.\nl
+\^`\nospaceafter``\macro`, \^`\nospacefuturelet`: they ignore the following optional space.\nl
\^`\opinput`` {<filename>}` reads file like `\input` but with standard catcodes.\nl
\^`\optdef`` \macro [<opt-default>] <parameters>{<body>}` defines `\macro` with [opt.parameter].\nl
\^`\opwarning` `{<text>}` prints <text> to the terminal and .log file as warning.\nl
+\~`\posx``[<label>]`, \~`\posy``[<label>]`, \~`\pospg``[<label>]`
+ provide coordinates of absolute position of the \~`\setpos``[<label>]`.
\~`\private`` <sequence> <sequence> ... ;` declares <sequence>s for private name space.\nl
\~`\public`` <sequence> <sequence> ... ;` declares <sequence>s for public name space.\nl
\~`\readkv` `\macro` reads parameters from `\macro` in key-value format.\nl
@@ -1958,7 +1970,7 @@ documentation.
\^`\wlog`` {<text>}` writes <text> to .log file.\nl
\^`\wterm`` {<text>}` writes <text> to the terminal and .log file.\nl
\^`\xargs`` <what> <token> <token> ... ;` repeats <what><token> for each <token>.\nl
-\unpenalty\unskip
+\unpenalty\unskip \par \egroup
\sec Compatibility with Plain \TeX/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/Master/texmf-dist/tex/optex/base/alloc.opm b/Master/texmf-dist/tex/optex/base/alloc.opm
index ae77d3074e8..d4f823fec4a 100644
--- a/Master/texmf-dist/tex/optex/base/alloc.opm
+++ b/Master/texmf-dist/tex/optex/base/alloc.opm
@@ -121,10 +121,9 @@
\_doc -----------------------------
A few registers are initialized like in plain\TeX/. We absolutely
don't support the `@`category dance, so `\z@skip`
- `\z@`, `\p@` etc. are not defined in \OpTeX/. If you need such
- control sequences then you can initialize them by `\load[plain-at]`.
+ `\z@`, `\p@` etc. are defined but not recommended in \OpTeX/.
- Only the \`\_zo` and \`\_zoskip` (equivalents to `\z@` and `\z@skip`)
+ The \`\_zo` and \`\_zoskip` (equivalents to `\z@` and `\z@skip`)
are declared here and used in some internal macros of \OpTeX/
for improving speed.
\_cod -----------------------------
diff --git a/Master/texmf-dist/tex/optex/base/basic-macros.opm b/Master/texmf-dist/tex/optex/base/basic-macros.opm
index 2e8c98d6e3e..ae5c833140d 100644
--- a/Master/texmf-dist/tex/optex/base/basic-macros.opm
+++ b/Master/texmf-dist/tex/optex/base/basic-macros.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \sdef {Basic macros for OpTeX <2021-07-20>} % preloaded in format
+\_codedecl \sdef {Basic macros for OpTeX <2022-11-22>} % preloaded in format
\_doc ------------------------------
\`\bgroup`, \`\egroup`, \`\empty`, \`\space`, and \`\null`
@@ -77,11 +77,15 @@
\_public \cs \trycs ;
\_doc ------------------------------
- \`\addto` `\macro{<text>}` adds `<text>` to your `\macro`, which must be defined.
+ \`\addto` `\macro{<text>}` adds `<text>` to your `\macro`, which must be defined.\nl
+ \`\aheadto` `\macro{<text>}` defines `\macro` as `<text>` followed by the
+ original `\macro` body.
\_cod ------------------------------
\_long\_def \_addto #1#2{\_ea\_def\_ea#1\_ea{#1#2}}
-\_public \addto ;
+\_long\_def \_aheadto #1#2{\_edef#1{\_unexpanded{#2}\_unexpanded\_ea{#1}}}
+
+\_public \addto \aheadto ;
\_doc -----------------------------
\`\incr``<counter>` increases `<counter>` by one globally.
@@ -112,6 +116,15 @@
\_def\_tracingall{\_tracingonline=1 \_loggingall}
\_public \loggingall \tracingall ;
+ \_doc ------------------------
+ The `\optexversion` and `\fmtname` are defined in the `optex.ini` file.
+ Maybe, somebody will need a private version of these macros.
+ We add \`\_banner` used in `\everyjob` and in \~`\docgen`
+ \_cod ------------------------
+
+\_def\_banner {This is OpTeX (Olsak's Plain TeX), version <\_optexversion>}%
+\_private \optexversion \fmtname ;
+
\_doc ------------------------------
\`\_byehook` is used in the \^`\bye` macro.
Write a warning if the user did not load a Unicode Font.
@@ -129,6 +142,9 @@
\_endcode % -------------------------------------
+2022-11-22: \_banner definition moved here
+2022-11-18: \ahead introduced
+2022-10-29: \_fin introduced
2021-07-20: \_unresovedrefs removed from \_byehook
2021-07-18: \_byehook: checking `ref` file consistency added.
2021-05-16: \slet reimplemented (to allow \slet{foo}{undefined}).
diff --git a/Master/texmf-dist/tex/optex/base/bib-simple.opm b/Master/texmf-dist/tex/optex/base/bib-simple.opm
index fe1730ba67c..3af9a1b9271 100644
--- a/Master/texmf-dist/tex/optex/base/bib-simple.opm
+++ b/Master/texmf-dist/tex/optex/base/bib-simple.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_undefined {BIB style (simple) <2022-05-10>} % loaded on demand by \usebib
+\_codedecl \_undefined {BIB style (simple) <2022-10-10>} % loaded on demand by \usebib
\_ifx\_optexbibstyle\_undefined \_errmessage
{This file can be read by: \_string\usebib/? (simple) bibfiles command only}
@@ -36,6 +36,7 @@
}
\_def\_preurl{\_hfil\_break}
+\_def\_Inclause{In:~}
% Non-standard fieldnames:
@@ -56,9 +57,9 @@
\_setbibmark
}
\_sdef{_print:book}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
- \_bprintb [title] {{\_em##1}.\ }{\_bibwarning}%
- \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{}%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
+ \_bprinta [edition] {*\_mtext{bib.edition}\ }{}%
\_bprinta [address] {*: }{\_bibwarning}%
\_bprinta [publisher] {*, }{\_bibwarning}%
\_bprinta [year] {*.\ }{\_bibwarning}%
@@ -66,21 +67,21 @@
\_bprintb [url] {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:article}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
- \_bprinta [title] {*.\ }{\_bibwarning}%
- \_bprintb [journal] {{\_em##1}.\ }{\_bibwarning}%
- \_bprinta [year] {*, }{}%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
+ \_bprinta [title] {*\:\ }{\_bibwarning}%
+ \_bprintb [journal] {{\_em##1}\:\ }{\_bibwarning}%
+ \_bprinta [year] {*\_bprintv[volume,number,pages]{,}{.} }{}%
\_bprinta [volume] {* }{}%
- \_bprinta [number] {(*), }{}%
+ \_bprinta [number] {(*)\_bprintv[pages]{,}{.} }{}%
\_bprinta [pages] {*.\ }{}%
\_bprintb [doi] {DOI~\_ulink[http://dx.doi.org/##1]{##1}.\ }{}%
}
\_sdef{_print:inbook}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
- \_bprintb [title] {{\_em##1.}\ }{\_bibwarning}%
- In:~%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
+ \_Inclause
\_bprinta [!editor] {*,~eds.\ }{}%
- \_bprintb [booktitle] {{\_em##1}.\ }{\_bibwarning}%
+ \_bprintb [booktitle] {{\_em##1}\:\ }{\_bibwarning}%
\_bprinta [address] {*: }{\_bibwarning}%
\_bprinta [publisher] {*, }{\_bibwarning}%
\_bprinta [year] {*.\ }{\_bibwarning}%
@@ -92,12 +93,12 @@
\_slet{_print:inproceedings}{_print:inbook}
\_sdef{_print:incolection}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
- \_bprintb [title] {{\_em##1}.\ }{\_bibwarning}%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
\_bprinta [crossreff] {In~\_cite[*]. }{%
\_bprinta [booktitle] {*. }{\_bibwarning}%
\_bprinta [!editor] {*,~eds.\ }{\_bibwarning}%
- \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{\_bibwarning}%
+ \_bprinta [edition] {*\_mtext{bib.edition}\ }{\_bibwarning}%
\_bprinta [address] {*: }{\_bibwarning}%
\_bprinta [publisher] {*, }{\_bibwarning}%
\_bprinta [year] {*.\ }{\_bibwarning}%
@@ -105,9 +106,9 @@
\_bprintb [url] {\_preurl\_url{####1}. }{}}%
}
\_sdef{_print:conference}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
\_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
- \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{}%
+ \_bprinta [edition] {*\_mtext{bib.edition}\ }{}%
\_bprinta [address] {*: }{\_bibwarning}%
\_bprinta [publisher] {*, }{\_bibwarning}%
\_bprinta [year] {*.\ }{\_bibwarning}%
@@ -115,7 +116,7 @@
\_bprintb [url] {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:thesis}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
\_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
\_bprinta [type] {*,\ }{\_bibwarning}%
\_bprinta [school] {*.\ }{}%
@@ -124,31 +125,31 @@
\_bprintb [url] {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:proceedings}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
\_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
\_bprinta [publisher] {*.\ }{%
\_bprinta [organization] {*.\ }{\_bibwarning}}%
}
\_sdef{_print:techreport}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
\_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
\_mtext{bib.techreport}.
\_bprinta [institution] {*.\ }{}%
}
\_sdef{_print:booklet}{%
- \_bprinta [!author] {*\:\ }{\_bibwarning}%
+ \_bprinta [!author] {*.\ }{\_bibwarning}%
\_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
\_bprinta [howpublished] {*.\ }{\_bibwarning}%
}
\_sdef{_print:manual}{%
- \_bprinta [!author] {*\:\ }{}%
+ \_bprinta [!author] {*.\ }{}%
\_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}%
\_bprinta [year] {*.\ }{}%
\_bprinta [institution] {*.\ }{}%
\_bprintb [url] {\_preurl\_url{##1}. }{}%
}
\_sdef{_print:misc}{%
- \_bprinta [!author] {*\:\ }{}%
+ \_bprinta [!author] {*.\ }{}%
\_bprintb [title] {{\_em##1}\:\ }{}%
\_bprinta [howpublished] {*.\ }{}%
\_bprinta [institution] {*.\ }{}%
diff --git a/Master/texmf-dist/tex/optex/base/cite-bib.opm b/Master/texmf-dist/tex/optex/base/cite-bib.opm
index adef0eaef87..9dc32a2632a 100644
--- a/Master/texmf-dist/tex/optex/base/cite-bib.opm
+++ b/Master/texmf-dist/tex/optex/base/cite-bib.opm
@@ -232,7 +232,7 @@
\_cod -----------------------------
\_def\_bib[#1]{\_def\_tmp{\_isnextchar={\_bibA[#1]}{\_bibmark={}\_bibB[#1]}}%
- \_ea\_tmp\_romannumeral-`\.} % ignore optional space
+ \_nospaceafter\_tmp} % ignore optional space
\_def\_bibA[#1]=#2{\_bibmark={#2}\_bibB[#1]}
\_def\_bibB[#1]{\_par \_bibskip
\_bibgl\_advance\_bibnum by1
diff --git a/Master/texmf-dist/tex/optex/base/doc.opm b/Master/texmf-dist/tex/optex/base/doc.opm
index bde1dcc848f..dc5d037e72d 100644
--- a/Master/texmf-dist/tex/optex/base/doc.opm
+++ b/Master/texmf-dist/tex/optex/base/doc.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \printdoc {Macros for documentation printing <2022-07-01>} % loaded on demand by \load[doc]
+\_codedecl \printdoc {Macros for documentation printing <2022-11-21>} % loaded on demand by \load[doc]
\_doc -----------------------------
General decalarations.
@@ -11,8 +11,10 @@
\_let \mlinkcolor=\Red % main doc. points
\_let \ulinkcolor=\Blue % user doc. points
\_let \fnamecolor=\Brown % file names in listing headers
-\_def \bgverbcolor {\_setcmykcolor{0 0 .3 .03}} % background for listings
-\_hyperlinks \Green \Green
+\_def \bgverbcolor {\_setcmykcolor{0 0 .3 .03}} % background for listings
+\_def \outlinkcolor {\_setcmykcolor{1 0 1 .2}} % green for outerlinks
+\_def \inlinkcolor {\_setcmykcolor{0 1 0 .1}} % magenta for internal links
+\_hyperlinks \inlinkcolor \outlinkcolor
\_enlang
\_enquotes
@@ -39,7 +41,7 @@
\_doc -----------------------------
The listing mode is implemented here. The \`\maxlines`
is maximal lines of code printed in the listing mode.
- The \`\_catcodedot` sets dot as letter in listngs (for package
+ The \code{\\catcode`\\.=11} sets dot as letter in listngs (for package
documentation where `\.foo` sequeces exist).
\_cod -----------------------------
@@ -52,7 +54,7 @@
\_typosize[8/10]
\_let\_printverbline=\_printcodeline
\_ttline=\_inputlineno
- \_setverb \_catcodedot
+ \_setverb \_catcode`\.=11
\_ifnum\_ttline<0 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi
\_adef{ }{\ }\_adef\^^I{\t}\_parindent=\_ttindent \_parskip=0pt
\_def\t{\_hskip \_dimexpr\_tabspaces em/2\_relax}%
@@ -74,7 +76,6 @@
\_edef\_Doc{\_asp\_asp\_bslash _doc}
\_bgroup \_lccode`~=`\^^I \_lowercase{\_egroup\_edef\_Doctab{\_noexpand~\_bslash _doc}}
\_edef\_Endcode{\_noexpand\_empty\_bslash _endcode}
-\_def\_catcodedot{\_catcode`\.=11 }
\_doc -----------------------------
The scanner of the control sequences in the listing mode replaces all
@@ -101,16 +102,16 @@
\_def\_processinput{%
\_let\_start=\_relax
\_ea\_replstring\_ea\_tmpb\_ea{\_aspace^^J}{^^J}
- \_addto\_tmpb{\_end}%
+ \_addto\_tmpb{\_fin}%
\_isinlist\_tmpb{\_start^^J}\_iftrue \_advance\_ttline by1\_fi
\_replstring\_tmpb{\_start^^J}{\_start}%
\_replstring\_tmpb{\_start}{}%
- \_replstring\_tmpb{^^J\_end}{\_end}%
- \_replstring\_tmpb{^^J\_end}{}%
- \_replstring\_tmpb{\_end}{}%
+ \_replstring\_tmpb{^^J\_fin}{\_fin}%
+ \_replstring\_tmpb{^^J\_fin}{}%
+ \_replstring\_tmpb{\_fin}{}%
\_ea\_prepareverbdata\_ea\_tmpb\_ea{\_tmpb^^J}%
\_replthis{\_csstring\\}{\_noexpand\_makecs}%
- \_ea\_printverb \_tmpb\_end
+ \_ea\_printverb \_tmpb\_fin
\_par
\_endgroup \_ttskip
\_isnextchar\_par{}{\_noindent}%
@@ -145,7 +146,7 @@
}
\_everytt={\_let\_printverblinenum=\_relax}
-\_long\_def\_endverbprinting#1\_end#2\_end{\_fi\_fi \_global\_maxlines=100000
+\_long\_def\_endverbprinting#1\_fin#2\_fin{\_fi\_fi \_global\_maxlines=100000
\_noindent\_typosize[8/]\_dots etc. (see {\_tt\fnamecolor\docfile})}
\_doc -----------------------------
@@ -206,10 +207,9 @@
catcodes using the `\_afteroad` macro.
\_cod -----------------------------
-\_def\_afterload{\_catcode`\<=13 \_catcode`\`=13 \_catcode`\.=11
- \_wlog {doc.opm: catcodes of < and ` activated, catcode of . is letter.}%
+\_def\_afterload{\_catcode`\<=13 \_catcode`\`=13
+ \_wlog {doc.opm: catcodes of < and ` activated.}%
}
-\_catcode`.=11
\_doc -----------------------------
The \code{<something>} will be print as <something>.
@@ -219,7 +219,7 @@
\_catcode`\<=13
\_def<#1>{$\langle\hbox{\it#1\/}\rangle$}
-\_everyintt{\_catcode`\<=13 }
+\_everyintt{\_catcode`\<=13 \_catcode`\.=11 }
\_doc -----------------------------
Main documentation points and hyperlinks to/from it.
@@ -357,6 +357,8 @@ have the same meaning: `\optexdoclink` in this example. And
\endinput
+2022-11-21 magenta color for internal links instead green.
+2022-11-13 \catcode`.=11: only local settings
2022-07-01 \_printii improved, colors declaration part added.
2021-05-15 \_endinput shifted after \_processinput when \_endcode is scanned.
2021-05-14 \_catcodedot, \_Doctab introduced.
diff --git a/Master/texmf-dist/tex/optex/base/f-heros.opm b/Master/texmf-dist/tex/optex/base/f-heros.opm
index 7848b7f9d25..2531573ca4b 100644
--- a/Master/texmf-dist/tex/optex/base/f-heros.opm
+++ b/Master/texmf-dist/tex/optex/base/f-heros.opm
@@ -21,11 +21,8 @@ Modifiers:^^J
\_ifmathloading
\_loadmath {[FiraMath-Regular]}
- \_addto\_normalmath{\_loadumathfamily 5 {xitsmath-regular}{} }
- \_addto\_boldmath {\_loadumathfamily 5 {xitsmath-bold}{} }
- \_addto\_frak{\_fam5 }\_addto\_cal{\_fam5 } \_public \frak \cal ;
- \_normalmath
- \_wterm{MATH-FONT(5): "[XITSMath-Regular/Bold]" -- used for \_string\cal, \_string\frak}
+ \_addUmathfont \_xits {[XITSMath-Regular]}{} {[XITSMath-Bold]}{} {}
+ \_addto\_frak{\_fam\_xits}\_addto\_cal{\_fam\_xits} \_public \frak \cal ;
% \bf, \bi from FiraMath:
\_let\_bsansvariables=\_bfvariables
\_let\_bsansGreek=\_bfGreek
@@ -34,14 +31,8 @@ Modifiers:^^J
\_let\_bisansvariables=\_bivariables
\_let\_bisansgreek=\_bigreek
% \_resetmathchars <fam-number> <list of \Umathchardef csnames> ;
- \_def\_resetmathchars #1{\_chardef\_mafam=#1\_relax \_xargs \_resetmathcharX}
- \_def\_resetmathcharX#1{\_ea\_resetmathcharY
- \_directlua{tex.print(string.format("\_pcent08X", \_the#1))}#1}
- \_def\_resetmathcharY#1#2#3#4#5#6#7#8#9{%
- \_Umathchardef #9\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8
- \_Umathcode "#4#5#6#7#8=\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8 }
- \_resetmathchars 5 \bigtriangleup \bigblacktriangleup \blacktriangle
- \vartriangle \smallblacktriangleright ; % ... etc. you can add more
+ \_mathchars \_xits {\bigtriangleup \bigblacktriangleup \blacktriangle
+ \vartriangle \smallblacktriangleright} % ... etc. you can add more
\_fi
\_endcode
diff --git a/Master/texmf-dist/tex/optex/base/f-iwona.opm b/Master/texmf-dist/tex/optex/base/f-iwona.opm
new file mode 100644
index 00000000000..702ac6a06a0
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/base/f-iwona.opm
@@ -0,0 +1,26 @@
+%% This is part of the OpTeX project, see http://petr.olsak.net/optex
+
+\_famdecl [Iwona] \Iwona {Sans serif typeface derived from Kurier}
+ {\caps \cond \light \medium \bolder} {\rm \bf \it \bi} {}
+ {[Iwona-Regular]}
+ {\_def\_fontnamegen{[Iwona\_condV\_weightV-\_currV]:\_capsV\_fontfeatures}}
+
+\_wlog{\_detokenize{%
+Modifiers:^^J
+ \caps ...... caps & small caps^^J
+ \cond ...... condensed variants^^J
+ \light ..... light (only \rm \it)^^J
+ \medium .... medium (only \rm \it)^^J
+ \bolder .... heavy (only \rm \it)
+}}
+
+\_moddef \resetmod {\_fsetV caps={},cond={},weight={} \_fvars Regular Bold Italic BoldItalic }
+\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; }
+\_moddef \nocaps {\_fsetV caps={} }
+\_moddef \cond {\_fsetV cond=Cond }
+\_moddef \light {\_fsetV weight=Light \_fvars Regular . Italic . }
+\_moddef \medium {\_fsetV weight=Medium \_fvars Regular . Italic . }
+\_moddef \bolder {\_fsetV weight=Heavy \_fvars Regular . Italic . }
+\_moddef \nocond {\_fsetV cond={} }
+
+\_initfontfamily % new font family must be initialized
diff --git a/Master/texmf-dist/tex/optex/base/f-kurier.opm b/Master/texmf-dist/tex/optex/base/f-kurier.opm
new file mode 100644
index 00000000000..ca1a6e381e0
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/base/f-kurier.opm
@@ -0,0 +1,26 @@
+%% This is part of the OpTeX project, see http://petr.olsak.net/optex
+
+\_famdecl [Kurier] \Kurier {Two element sans serif typeface}
+ {\caps \cond \light \medium \bolder} {\rm \bf \it \bi} {}
+ {[Kurier-Regular]}
+ {\_def\_fontnamegen{[Kurier\_condV\_weightV-\_currV]:\_capsV\_fontfeatures}}
+
+\_wlog{\_detokenize{%
+Modifiers:^^J
+ \caps ...... caps & small caps^^J
+ \cond ...... condensed variants^^J
+ \light ..... light (only \rm \it)^^J
+ \medium .... medium (only \rm \it)^^J
+ \bolder .... heavy (only \rm \it)
+}}
+
+\_moddef \resetmod {\_fsetV caps={},cond={},weight={} \_fvars Regular Bold Italic BoldItalic }
+\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; }
+\_moddef \nocaps {\_fsetV caps={} }
+\_moddef \cond {\_fsetV cond=Cond }
+\_moddef \light {\_fsetV weight=Light \_fvars Regular . Italic . }
+\_moddef \medium {\_fsetV weight=Medium \_fvars Regular . Italic . }
+\_moddef \bolder {\_fsetV weight=Heavy \_fvars Regular . Italic . }
+\_moddef \nocond {\_fsetV cond={} }
+
+\_initfontfamily % new font family must be initialized
diff --git a/Master/texmf-dist/tex/optex/base/f-lato.opm b/Master/texmf-dist/tex/optex/base/f-lato.opm
new file mode 100644
index 00000000000..bedb33a8a25
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/base/f-lato.opm
@@ -0,0 +1,34 @@
+%% This is part of the OpTeX project, see http://petr.olsak.net/optex
+
+\_famdecl [Lato] \Lato {Geometric grotesk, many weights}
+ {\hair \thin \light \normal \book \bolder} {} {}
+ {[Lato-Regular]}
+ {\_def\_fontnamegen {[Lato-\_currV]:\_capsV\_fontfeatures}}
+
+\_wlog{\_detokenize{%
+Modifier: \caps .... Old digits only (caps not provided)^^J%
+Modifiers (face weight):^^J
+ \hair ...... \rm, \it = Hair, \bf, \bi = Normal^^J
+ \thin ...... \rm, \it = Thin, \bf, \bi = Medium^^J
+ \light ..... \rm, \it = Light, \bf, \bi = Semibold^^J
+ \normal .... \rm, \it = Normal, \bf, \bi = Bold^^J
+ \book ...... \rm, \it = Medium, \bf, \bi = Heavy^^J
+ \bolder .... \rm, \it = Semibold, \bf, \bi = Black^^J%
+}}
+
+\_moddef \resetmod {\_fsetV caps={} \_fvars Regular Bold Italic BoldItalic }
+\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; }
+\_moddef \hair {\_fvars Hairline Regular HairlineItalic Italic }
+\_moddef \thin {\_fvars Thin Medium ThinItalic MediumItalic }
+\_moddef \light {\_fvars Light Semibold LightItalic SemiboldItalic }
+\_moddef \normal {\_fvars Regular Bold Italic BoldItalic }
+\_moddef \book {\_fvars Medium Heavy MediumItalic HeavyItalic }
+\_moddef \bolder {\_fvars Semibold Black SemiboldItalic BlackItalic }
+
+\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; }
+\_moddef \nocaps {\_fsetV caps={} }
+
+\_initfontfamily % new font family must be initialized
+
+\_endcode
+
diff --git a/Master/texmf-dist/tex/optex/base/fams-ini.opm b/Master/texmf-dist/tex/optex/base/fams-ini.opm
index ad3ace24f3e..505887f46e7 100644
--- a/Master/texmf-dist/tex/optex/base/fams-ini.opm
+++ b/Master/texmf-dist/tex/optex/base/fams-ini.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-% Version <2020-02-28>. Loaded in format and secondly on demand by \fontfam[catalog]
+% Version <2022-10-18>. Loaded in format and secondly on demand by \fontfam[catalog]
\_famtext {Special name for printing a catalog :}
@@ -169,6 +169,23 @@
\caps, \caps\cond: {\rm\bf\it\bi} \caps\ttset: {\rm\bf}
}
+\_famfrom {Malgorzata Budyta, Janusz Marian Nowacki}
+\_faminfo [Kurier] {Two element sans serif typeface} {f-kurier}
+ { -,\cond,\caps,\caps\cond: {\rm\it\bf\bi}
+ \light,\light\cond,\medium,\medium\cond,\bolder,\bolder\cond: {\rm\it}
+ }
+\_faminfo [Iwona] {Sans serif typeface derived from Kurier} {f-iwona}
+ { -,\cond,\caps,\caps\cond: {\rm\it\bf\bi}
+ \light,\light\cond,\medium,\medium\cond,\bolder,\bolder\cond: {\rm\it}
+ }
+
+\_famfrom {tyPoland Lukasz Dziedzic}
+\_faminfo [Lato] {Geometric grotesk, many weights} {f-lato}
+ { \hair: {\rm\it} \thin: {\rm\it} \light: {\rm\it} -: {\rm\it}
+ \book: {\rm\it} \bolder: {\rm\it} -: {\bf\bi}
+ \book: {\bf\bi} \bolder: {\bf\bi}
+ }
+
\_famfrom {Julieta Ulanovsky, http://www.zkysky.com.ar}
\_faminfo [Montserrat] {Inspired from old posters in Montserat in Buenos Aires} {f-montserrat}
{ -,\caps,\alter: {\rm\bf\it\bi} \xlight,\elight,\light,-,\medium,\semibold: {\rm\it}
diff --git a/Master/texmf-dist/tex/optex/base/fnotes.opm b/Master/texmf-dist/tex/optex/base/fnotes.opm
index 661d54c33f2..8f56ba1aea0 100644
--- a/Master/texmf-dist/tex/optex/base/fnotes.opm
+++ b/Master/texmf-dist/tex/optex/base/fnotes.opm
@@ -132,8 +132,8 @@
as a box shifted down by `\parskip` and with `\vskip-\baselineskip` followed.
\_cod -----------------------------
-\_def\_mnote #1#{\_ifx^#1^\_else \_mnoteC#1\_end \_fi \_mnoteD}
-\_def\_mnoteC up#1\_end{\_mnoteskip=#1\_relax} % \mnote up<dimen> {<text>} syntax
+\_def\_mnote #1#{\_ifx^#1^\_else \_mnoteC#1\_fin \_fi \_mnoteD}
+\_def\_mnoteC up#1\_fin{\_mnoteskip=#1\_relax} % \mnote up<dimen> {<text>} syntax
\_long\_def\_mnoteD#1{%
\_ifvmode \_vskip\_parskip{\_mnoteA{#1}}\_nobreak\_vskip-\_baselineskip\_vskip-\_parskip \_else
\_lower\_dp\_strutbox\_hbox{}\_vadjust{\_kern-\_dp\_strutbox \_mnoteA{#1}\_kern\_dp\_strutbox}%
diff --git a/Master/texmf-dist/tex/optex/base/fonts-catalog.opm b/Master/texmf-dist/tex/optex/base/fonts-catalog.opm
index cdd77359f12..347c94b1459 100644
--- a/Master/texmf-dist/tex/optex/base/fonts-catalog.opm
+++ b/Master/texmf-dist/tex/optex/base/fonts-catalog.opm
@@ -47,7 +47,7 @@
}
\_def\_dosamples #1:#2{\_ifx^#2^\_else
\_def\_printvars{#2}%
- \_ea\_dosamplesA\_romannumeral-`\.#1,,%
+ \_nospaceafter\_dosamplesA #1,,%
\_ea\_dosamples\_fi
}
\_def\_dosamplesA#1,{%
diff --git a/Master/texmf-dist/tex/optex/base/fonts-resize.opm b/Master/texmf-dist/tex/optex/base/fonts-resize.opm
index e49303f3775..34885d44bd7 100644
--- a/Master/texmf-dist/tex/optex/base/fonts-resize.opm
+++ b/Master/texmf-dist/tex/optex/base/fonts-resize.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \setfontsize {Font resizing macros <2022-02-22>} % preloaded in format
+\_codedecl \setfontsize {Font resizing macros <2022-11-08>} % preloaded in format
\_doc -----------------------------
\`\initunifonts` macro extends \LuaTeX's font capabilities,
@@ -10,19 +10,22 @@
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.
+ \`\ufont` is a shortcut of \^`\initunifonts`~`\font`.
\_cod -----------------------------
-\_def\_initunifonts {%
+\_protected\_def \_initunifonts {%
\_directlua{%
require('luaotfload-main')
luaotfload.main()
- optex_hook_into_luaotfload()
+ 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 ;
+\_protected\_def \_ufont {\_initunifonts \_font}
+
+\_public \initunifonts \ufont ;
\_doc -----------------------------
The \`\setfontsize` `{<size spec>}` saves the `<size spec>` to the \`\_sizespec` macro.
@@ -74,7 +77,8 @@
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 \_font #1{\_optfn{\_xfontname#2}}\_fi}
+\_protected\_def \_fontlet #1#2{\_ifx #2=\_ea\_fontlet \_ea#1\_else
+ \_ea\_font \_ea#1\_expanded{{\_optfn{\_xfontname#2}}}\_fi}
\_public \xfontname \fontlet ;
\_doc -----------------------------
@@ -83,17 +87,21 @@
It changes the current font at the given <size spec>.
\nl
\`\resizethefont` is implemented by \^`\newcurrfontsize` using data from
- the \^`\_sizespec` macro.
+ the \^`\_sizespec` macro.\nl
+ \`\sfont` has the same syntax like `\font` primitive, but declares a
+ macro which selects the font and sets its size properly dependent on the
+ current size.
\_cod -----------------------------
-\_def \_newcurrfontsize #1{% \newcurrfontsize{at25pt}
- \_ea\_def \_ea\_tmp \_ea{\_csname \_ea\_csstring \_the\_font \_endcsname}%
- \_ea\_fontlet \_tmp \_font #1\_relax
- \_ea\_fontloaded \_tmp
- \_tmp
+% \newcurrfontsize{at25pt}
+\_def \_newcurrfontsize {\_ea\_newcurrfontsizeA \_csname \_ea\_csstring \_the\_font \_endcsname}
+\_def \_newcurrfontsizeA #1#2{\_fontlet #1\_font #2\_relax \_fontloaded#1#1}
+\_protected\_def \_resizethefont {\_newcurrfontsize\_sizespec}
+\_protected\_def \_sfont #1{%
+ \_protected\_edef #1{\_csname _sfont:\_csstring#1\_endcsname \_resizethefont}%
+ \_initunifonts \_ea\_font \_csname _sfont:\_csstring#1\_endcsname
}
-\_protected\_def \_resizethefont{\_newcurrfontsize\_sizespec}
-\_public \newcurrfontsize \resizethefont ;
+\_public \newcurrfontsize \resizethefont \sfont ;
\_doc -----------------------------
The \`\_regtfm` `<font id> <optical size data>`
@@ -169,7 +177,8 @@ The <size spec> can be empty or `at<dimen>` or `scaled<scale factor>`. The
\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`.
+OpenType `otf` or `ttf` font files, use the declarator \^`\initunifonts`
+before first `\font` primitive.
This command adds additional features to the `\font` primitive which
gives the extended syntax:
\begtt \catcode`\<=13
@@ -193,8 +202,9 @@ The original syntax for `tfm` files is also available. Example:
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.
+You can use \^`\ufont` macro which runs \^`\initunifonts` followed by `\font`
+primitive. And \^`\fontfam` does (among other things) \^`\initunifonts`
+too. You need not to specify \^`\initunifonts` if \^`\fontfam` or \^`\ufont` 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
@@ -245,8 +255,7 @@ The \^`\resizethefont` works with arbitrary current font, for example with the
font loaded directly by `\font` primitive. For example:
\begtt
-\initunifonts
-\font\tencrimson=[Crimson-Roman]:+onum % font Crimson-Regular at 10 pt is loaded
+\ufont\tencrimson=[Crimson-Roman]:+onum % font Crimson-Regular at 10 pt is loaded
\def\crimson{\tencrimson\resizethefont} % \crimson uses the font size on demand
\crimson The 10 pt text is here.
@@ -258,6 +267,26 @@ behaves like variant selector in the Font Selection System (section~\ref[fontsys
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.
+There is a shortcut \^`\sfont` with the same syntax like `\font` primitive,
+it declares a macro which selects the font and does resizing depending on
+the current size. So, the example above can be realized by
+`\sfont\crimson=[Crimson-Roman]:+onum`.
+
+\secc The `\font`-like commands summary
+
+\begitems
+* `\font` is \TeX/ primitive. When \OpTeX/ starts, then it accepts only
+ classical \TeX/ syntax and doesn't allow to load Unicode fonts.
+ Once \^`\initunifonts` (or \^`\fontfam`) is used, the `\font` primitive is
+ re-initialized: now it accepts extended syntax and it is able to load Unicode
+ OpenType fonts.
+* \^`\ufont` is a shortcut of `\initunifonts \font`. I.e.\ it behaves like
+ `\font` and accepts extended syntax immediatelly.
+* \^`\sfont` has syntax like extended `\font`. It declares a macro which
+ selects the given font and resizes it to the current size (given by
+ \^`\setfontsize`). In various part of document (text, footnotes, titles), the
+ size of this font is selected by the declared macro properly.
+\enditems
\secc[fontlet] The \code{\\fontlet} declarator
@@ -288,13 +317,13 @@ 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
+Then the command \^`\resizethefont` or \^`\fontlet` 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.
+ Now, the text is printed in [lmroman12-regular] at 13 pt.
\endtt
See also section~\ref[optsizes].
@@ -322,6 +351,9 @@ Luaotfload documentation for more information.
\_endinput
+2022-11-08 \sfont introduced, \protected: \initunifont, \ufont, \fontlet
+2022-11-07 \fontlet \a\a: bug fixed
+2022-10-14 \ufont introduced
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
diff --git a/Master/texmf-dist/tex/optex/base/fonts-select.opm b/Master/texmf-dist/tex/optex/base/fonts-select.opm
index 33d331150b9..7e00c9baea1 100644
--- a/Master/texmf-dist/tex/optex/base/fonts-select.opm
+++ b/Master/texmf-dist/tex/optex/base/fonts-select.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \fontfam {Fonts selection system <2022-02-22>} % preloaded in format
+\_codedecl \fontfam {Fonts selection system <2022-12-01>} % preloaded in format
\_doc -----------------------------
The main principle of the Font Selection System is: run one or more
@@ -161,7 +161,7 @@
runs <what> only if the `\_<key>V` is defined as `<value-a>` or
`<value-b>` or ... or `<value-z>`.
\nl
- \`\_prepcommalist` `ab,{},cd,\_end,` expands to `ab,,cd,` (auxiliary macro
+ \`\_prepcommalist` `ab,{},cd,\_fin,` expands to `ab,,cd,` (auxiliary macro
used in `\_onlyif`).\nl
\`\_ffonum` is a shortcut for oldstyle digits font features used in
font family files. You can do `\let\_ffonum=\ignoreit` if you don't want
@@ -184,10 +184,10 @@
\_ifx,#1\_else\_sdef{_#1V}{#2}\_ea\_ea\_ea\_fsetVa\_fi\_fi
}
\_def \_onlyif #1=#2:#3{%
- \_edef\_act{\_noexpand\_isinlist{,\_prepcommalist #2,\_end,}{,\_cs{_#1V},}}\_act
+ \_edef\_act{\_noexpand\_isinlist{,\_prepcommalist #2,\_fin,}{,\_cs{_#1V},}}\_act
\_iftrue #3\_fi
}
-\_def\_prepcommalist#1,{\_ifx\_end#1\_empty\_else #1,\_ea\_prepcommalist\_fi}
+\_def\_prepcommalist#1,{\_ifx\_fin#1\_empty\_else #1,\_ea\_prepcommalist\_fi}
\_def\_ffonum {+onum;+pnum}
\_doc -----------------------------
@@ -258,7 +258,7 @@
They have precedence when \^`\fontsel` constructs the <font switch> name.
\_cod -----------------------------
-\_def\_fontdef #1#2{\_begingroup
+\_protected\_def \_fontdef #1#2{\_begingroup
\_edef\_xfamv{\_csstring#1}\_let\_ttfamv\_xfamv #2%
\_ea\_endgroup\_ea \_let\_ea #1\_the\_font
}
@@ -278,7 +278,7 @@
the same meaning.
\_cod -----------------------------
-\_def\_famvardef#1#2{%
+\_protected\_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 {%
@@ -307,7 +307,7 @@
terminal and to the log file.
\_cod -----------------------------
-\_def\_fontfam[#1]{%
+\_protected\_def \_fontfam [#1]{%
\_lowercase{\_edef\_famname{\_ea\_removespaces #1 {} }}%
\_isfile {f-\_famname.opm}\_iftrue \_opinput {f-\_famname.opm}%
\_else
@@ -349,8 +349,9 @@
\`\_famtext` does nothing or prints the text on the terminal.
\nl
\`\_faminfo` `[<Family Name>] {<comments>} {<file-name>} {<mod-plus-vars>}`
- does\nl `\_def \_famf:<familyname> {<file-name>}` or prints information on
- the terminal.
+ does\nl `\_def \_famf:<familyname> {<file-name>}` (only if <file-name> differs
+ from `f-<familyname>`) or prints information on the terminal. The
+ <mod-plus-vars> data are used when printing the font catalog.
\nl
\`\_famalias` `[<Family Alias>]` does `\def \_famf:<familyalias> {<file-name>}`
where `<file-name>` is stored from the previous `\_faminfo` command. Or
@@ -364,8 +365,8 @@
\_def\_famtext #1{}
\_def\_faminfo [#1]#2#3#4{%
\_lowercase{\_edef\_tmp{\_ea\_removespaces #1 {} }}%
- \_sdef{_famf:\_tmp}{#3}%
- \_def\_famfile{#3}%
+ \_edef\_tmpa{f-\_tmp}\_def\_famfile{#3}%
+ \_unless\_ifx\_tmpa\_famfile \_sdef{_famf:\_tmp}{#3}\_fi
}
\_def\_famalias [#1]{%
\_lowercase{\_edef\_tmpa{\_ea\_removespaces #1 {} }}%
@@ -898,6 +899,8 @@ with Unicode fonts loaded by \^`\fontfam`.
\endinput
+2022-12-01 \faminfo saves f-<filename> to the format only when needed
+2022-11-08 \protected: \fontdef, \famvardef, \fontfam
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.
diff --git a/Master/texmf-dist/tex/optex/base/graphics.opm b/Master/texmf-dist/tex/optex/base/graphics.opm
index b54b52c9263..77e78cef237 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 <2022-03-05>} % preloaded in format
+\_codedecl \inspic {Graphics <2022-11-05>} % preloaded in format
\_doc -----------------------------
\`\inspic` accepts old syntax `\inspic <filename><space>`
@@ -47,8 +47,8 @@
\_newtoks\_inkdefs \_inkdefs={%
\_def\makeatletter#1\makeatother{}%
- \_def\includegraphics[#1]#2{\_inkscanpage#1,page=,\_end \_inspic{\_the\_tmptoks}\_hss}%
- \_def\_inkscanpage#1page=#2,#3\_end{\_ifx,#2,\_else\_def\_picparams{page#2}\_fi}%
+ \_def\includegraphics[#1]#2{\_inkscanpage#1,page=,\_fin \_inspic{\_the\_tmptoks}\_hss}%
+ \_def\_inkscanpage#1page=#2,#3\_fin{\_ifx,#2,\_else\_def\_picparams{page#2}\_fi}%
\_def\put(#1,#2)#3{\_nointerlineskip\_vbox to\_zo{\_vss\_hbox to\_zo{\_kern#1\_picwidth
\_pdfsave\_hbox to\_zo{#3}\_pdfrestore\_hss}\_kern#2\_picwidth}}%
\_def\begin#1{\_csname _begin#1\_endcsname}%
@@ -169,7 +169,7 @@
}
\_def\_puttext{\_ea\_ea\_ea\_puttextA\_scantwodimens}
-\_def\_puttextA#1#2#3{{\_setbox0=\_hbox{{#3}}\_dimen1=#1sp \_dimen2=#2sp \_puttextB}}
+\_long\_def\_puttextA#1#2#3{{\_setbox0=\_hbox{{#3}}\_dimen1=#1sp \_dimen2=#2sp \_puttextB}}
\_def\_puttextB{%
\_ifvmode
\_ifdim\_prevdepth>\_zo \_vskip-\_prevdepth \_relax \_fi
@@ -383,7 +383,7 @@
\_ea \_shadowlayer \_fi
}%
\_pdfliteral{q /op1 gs 0 g 1 0 0 1 \_shadowmoveto\_space cm
- \_ifx#1\_circlet 1 0 0 1 \_expr{\_bp{.5\_wd0}} \_expr{\_bp{(\_ht0-\_dp0)/2}} cm
+ \_ifx#1\_circlet 1 0 0 1 \_bp{.5\_wd0} \_bp{(\_ht0-\_dp0)/2} cm
\_else 1 0 0 1 -\_shadowb\_space -\_shadowb\_space cm \_fi
\_shadowlayer Q}
}}
@@ -447,6 +447,8 @@ the \^`\transformbox{<transformation>}{\copy\mypic}`.
\_endinput
+2022-11-05 \_doshadow: renduntant \_expr from \_expr{\_bp{...}} removed
+2022-10-18 \_puttextA defined \long, bug fixed
2022-03-05: \_addextgstate, \pageresources, \addpageresources added
2022-03-03: \_coc introduced
2021-07-16: \inoval, \incircle are more simple, using attribitecolor features
diff --git a/Master/texmf-dist/tex/optex/base/hi-syntax.opm b/Master/texmf-dist/tex/optex/base/hi-syntax.opm
index 586cfed69eb..c708be05636 100644
--- a/Master/texmf-dist/tex/optex/base/hi-syntax.opm
+++ b/Master/texmf-dist/tex/optex/base/hi-syntax.opm
@@ -23,15 +23,15 @@
\_def\_replfromto #1#2{\_edef\_tmpa{{#1}{#2}}\_ea\_replfromtoE\_tmpa}
\_def\_replfromtoE#1#2#3{% #1=from #2=to #3=replacement
\_def\_replfrom##1#1##2{\_addto\_tmpb{##1}%
- \_ifx\_end##2\_ea\_replstop \_else \_afterfi{\_replto##2}\_fi}%
+ \_ifx\_fin##2\_ea\_replstop \_else \_afterfi{\_replto##2}\_fi}%
\_def\_replto##1#2##2{%
- \_ifx\_end##2\_afterfi{\_replfin##1}\_else
+ \_ifx\_fin##2\_afterfi{\_replfin##1}\_else
\_addto\_tmpb{#3}%
\_afterfi{\_replfrom##2}\_fi}%
- \_def\_replfin##1#1\_end{\_addto\_tmpb{#3}\_replstop}%
- \_edef\_tmpb{\_ea}\_ea\_replfrom\_tmpb#1\_end#2\_end\_end\_relax
+ \_def\_replfin##1#1\_fin{\_addto\_tmpb{#3}\_replstop}%
+ \_edef\_tmpb{\_ea}\_ea\_replfrom\_tmpb#1\_fin#2\_fin\_fin\_relax
}
-\_def\_replstop#1\_end\_relax{}
+\_def\_replstop#1\_fin\_relax{}
\_def\_finrepl{}
\_doc -----------------------------
@@ -55,12 +55,12 @@
The \`\_xscan` macro replaces occurrences of `\x` by `\z` in the post-processing
phase. The construct `\x <letter>{<text>}` expands to `\_xscan {<letter>}<text>^^J^`.
- If `#3` is `\_end` then it signals that something wrong happens, the
+ If `#3` is `\_fin` then it signals that something wrong happens, the
`<from>` was not terminated by legal `<to>` when `\replfromto` did work.
We must to fix this by using the \`\_xscanR` macro.
\_cod -----------------------------
-\_def\_xscan#1#2^^J#3{\_ifx\_end#3 \_ea\_xscanR\_fi
+\_def\_xscan#1#2^^J#3{\_ifx\_fin#3 \_ea\_xscanR\_fi
\z{#1}{#2}%
\_ifx^#3\_else ^^J\_afterfi{\_xscan{#1}#3}\_fi}
\_def\_xscanR#1\_fi#2^{^^J}
@@ -86,8 +86,8 @@
\_def\_hisyntax#1{\_def\_prepareverbdata##1##2{%
\_let\n=\_relax \_let\b=\_relax \_def\t{\n\_noexpand\t\n}\_let\_start=\_relax
- \_adef{ }{\n\_noexpand\ \n}\_edef\_tmpb{\_start^^J##2\_end}%
- \_replthis{^^J}{\n^^J\b\n}\_replthis{\b\n\_end}{\_end}%
+ \_adef{ }{\n\_noexpand\ \n}\_edef\_tmpb{\_start^^J##2\_fin}%
+ \_replthis{^^J}{\n^^J\b\n}\_replthis{\b\n\_fin}{\_fin}%
\_let\x=\_relax \_let\y=\_relax \_let\z=\_relax \_let\t=\_relax
\_hicomments % keeps comments declared by \commentchars
\_endlinechar=`\^^M
@@ -104,7 +104,7 @@
\_the\_hicolors % colors which have precedece
\_else\_opwarning{Syntax "\_tmpa" undeclared (no file hisyntax-\_tmpa.opm)}
\_fi\_fi
- \_replthis{\_start\n^^J}{}\_replthis{^^J\_end}{^^J}%
+ \_replthis{\_start\n^^J}{}\_replthis{^^J\_fin}{^^J}%
\_def\n{}\_def\b{}\_adef{ }{\_dsp}%
\_bgroup \_lccode`\~=`\ \_lowercase{\_egroup\_def\ {\_noexpand~}}%
\_def\w####1{####1}\_def\x####1####2{\_xscan{####1}####2^^J^}%
diff --git a/Master/texmf-dist/tex/optex/base/hyperlinks.opm b/Master/texmf-dist/tex/optex/base/hyperlinks.opm
index 4c2007cddb8..7505436f168 100644
--- a/Master/texmf-dist/tex/optex/base/hyperlinks.opm
+++ b/Master/texmf-dist/tex/optex/base/hyperlinks.opm
@@ -136,10 +136,10 @@
\_replstring\_tmpb{[||]}{{gb|}}%
\_replstring\_tmpb{ }{{ }}%
\_replstring\_tmpb{://}{{://}}%
- \_ea\_ulink \_ea[\_ea{\_tmpa}] {\_urlfont \_ea\_urlA\_tmpb\_end}%
+ \_ea\_ulink \_ea[\_ea{\_tmpa}] {\_urlfont \_ea\_urlA\_tmpb\_fin}%
}}
-\_def\_urlA#1{\_ifx\_end#1\_else \_urlC{}{#1}\_fi}
-\_def\_urlB#1{\_ifx\_end#1\_else \_urlC{\_urlxskip}{#1}\_fi}
+\_def\_urlA#1{\_ifx\_fin#1\_else \_urlC{}{#1}\_fi}
+\_def\_urlB#1{\_ifx\_fin#1\_else \_urlC{\_urlxskip}{#1}\_fi}
\_def\_urlC#1#2{%
\_ifcsname _ur:#2\_endcsname \_lastnamedcs \_ea\_ea\_ea \_urlA
\_else #1#2\_ea\_ea\_ea \_urlB \_fi
diff --git a/Master/texmf-dist/tex/optex/base/if-macros.opm b/Master/texmf-dist/tex/optex/base/if-macros.opm
index 8f6082a27a9..9113b5f8beb 100644
--- a/Master/texmf-dist/tex/optex/base/if-macros.opm
+++ b/Master/texmf-dist/tex/optex/base/if-macros.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \newif {Special if-macros, is-macros and loops <2022-05-04>} % preloaded in format
+\_codedecl \newif {Special if-macros, is-macros and loops <2022-12-02>} % preloaded in format
\_doc ----------------------------
\secc Classical \code{\\newif}
@@ -32,9 +32,12 @@
\_doc ----------------------------
\`\afterfi` `{<what to do>}<ignored>\fi` closes condition by `\fi` and processes
<what to do>. Usage:
- \begtt
- \if<something> \afterfi{<result is true>} \else \afterfi{<resut is false>} \fi
+ \begtt \catcode`<=13
+ \if<something> \afterfi{<result is true>} \else \afterfi{<result is false>} \fi
\endtt
+ Nested `\if..\afterfi{\if..\afterfi{...}\fi}\fi` are possible. Another approach is mentioned
+ in \ulink[http://petr.olsak.net/optex/optex-tricks.html\#fiinif]{OpTeX trick 0098}
+ which also solves the `\fi` in `\if` problem.
\_cod ----------------------------
\_long\_def \_afterfi#1#2\_fi{\_fi#1}
@@ -302,9 +305,63 @@
\_public \isnextchar ;
+ \_doc ----------------------------
+ \`\casesof` `<token> <list of cases>` implements something similar to
+ the `switch` command known from C language. It is expandable macro. The
+ <list of cases> is a list of arbitrary number of pairs in the format
+ `<token>`\,`{<what to do>}` which must be finalized by the pair
+ `\_finc {<what to do else>}`. The optional spaces after <token>s
+ and between listed cases are ignored. The usage of \^`\casesof` looks like:
+ \begtt \catcode`<=13
+ \casesof <token>
+ <token-1> {<what to do if token=token-1>}
+ <token-2> {<what to do if token=token-2>}
+ ...
+ <token-n> {<what to do if token=token-n>}
+ \_finc {<what to do in other cases>}
+ \endtt
+ The meaning of tokens are compared by `\ifx` primitive.
+ The parts `<what to do>` can be finalized by a macro which can read more
+ data from the input stream as its parameters.
+ \_cod ----------------------------
+
+\_long\_def \_casesof #1#2#3{\_ifx #2\_finc \_ea\_ignoresecond \_else \_ea\_usesecond \_fi
+ {#3}{\_ifx#1#2\_ea\_ignoresecond \_else \_ea\_usesecond \_fi {\_finc{#3}}{\_casesof#1}}%
+}
+\_long\_def \_finc #1#2\_finc#3{#1}
+
+\_public \casesof ;
+
+ \_doc -----------------------------
+ \`\xcasesof` `<list of pairs>` extends the features of the macro \^`\casesof`.
+ Each pair from the `<list of pairs>` is in the format
+ `{<if statement>}{<what to do>}`, only the last pair must have the different
+ format: `\_finc {<what to do else>}`. The `<if statement>` can be arbitrary
+ primitive `\if*` condition (optionally prefixed by `\unless`) and it must be closed
+ in its expansion. It means that `{\ifnum\mycount>0}` is bad, `{\ifnum\mycount>0 }`
+ is correct. Optional spaces between parameters are ignored. Example:
+ \begtt
+ \message {The \tmpnum has \xcasesof
+ {\ifnum\tmpnum>0 } {positive}
+ {\ifnum\tmpnum=0 } {equal to zero}
+ \_finc {negative} value}
+ \endtt
+ The \^`\xcasesof` macro works with principle: first true condition wins,
+ next conditions are not evaluated.
+ \_cod -----------------------------
+
+\_long\_def \_xcasesof #1{\_xcasesofA #1\_finc}
+\_long\_def \_xcasesofA #1#2\_finc #3{%
+ \_ifx #1\_finc \_ea\_ignoresecond\_else \_ea\_usesecond\_fi
+ {#3}{#1#2\_ea\_ignoresecond\_else \_ea\_usesecond\_fi {\_finc{#3}}{\_xcasesof}}%
+}
+\_public \xcasesof ;
\_endcode
+2022-12-02 \xcasesof: its first parameter is \long too.
+2022-11-29 renamed to \casesof, \xcasesof.
+2022-11-26 \casesby, \casesbyif introduced.
2022-05-04 \isinlist created expandable.
2022-03-30 \afterfi defined as \long.
2021-08-02 more robust \fornum: \fi moved by \afterfi
diff --git a/Master/texmf-dist/tex/optex/base/lang-data.opm b/Master/texmf-dist/tex/optex/base/lang-data.opm
index 6e11f8bd9a8..e1b68e5dde1 100644
--- a/Master/texmf-dist/tex/optex/base/lang-data.opm
+++ b/Master/texmf-dist/tex/optex/base/lang-data.opm
@@ -1,10 +1,10 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_langdata {Language dependent data <2022-06-28>} % only en, cs preloaded in format
+\_codedecl \_langdata {Language dependent data <2022-10-11>} % 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.}
+\_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
@@ -19,10 +19,10 @@
\_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.}
+% {, 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}
+\_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
@@ -31,6 +31,8 @@
července srpna září října listopadu prosince
\_sdef{_mt:today:cs}{\_the\_day.~\_mtext{m\_the\_month} \_the\_year} % date format
\_quotationmarks cs {„“‚‘}
+\_preplangmore cs {\_frenchspacing \_postexhyphenchar=`\-
+ \_def\_langreset{\_postexhyphenchar=0 }}
\_let \_sortingdatacs = \_sortingdatalatin
\_let \_ignoredcharscs = \_ignoredcharsgeneric
@@ -101,7 +103,12 @@
\_langw hu Fejezet Táblázat Ábra Téma
\_quotationmarks hu {„”»«}
%todo
-\_let \_sortingdatahu = \_sortingdatalatin
+\_def \_sortingdatahu {%
+ /,{ },-,&,@,%
+ aAáÁ,bB,cC,dD,eEéÉ,fF,gG,hH,iIíÍ,jJ,kK,lL,mM,nN,oOóÓ,öÖőŐ,%
+ pP,qQ,rR,sS,tT,uUúÚ,üÜűŰ,vV,wW,xX,yY,zZ,^^Z,%
+ 0,1,2,3,4,5,6,7,8,9,'%
+}
\_let \_ignoredcharshu = \_ignoredcharsgeneric
\_def \_compoundcharshu {cs:c^^Z Cs:C^^Z CS:C^^Z
dzz:d^^Z^^Z Dzz:D^^Z^^Z DZZ:D^^Z^^Z dz:d^^Z Dz:D^^Z DZ:D^^Z
@@ -128,13 +135,15 @@
\_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}
+\_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 {„“‚‘}
+\_preplangmore sk {\_frenchspacing \_postexhyphenchar=`\-
+ \_def\_langreset{\_postexhyphenchar=0 }}
\_let \_sortingdatask = \_sortingdatalatin
\_let \_ignoredcharssk = \_ignoredcharsgeneric
@@ -150,6 +159,9 @@
\_endcode
+2022-10-11: \postexhyphenchar setting added to cs and sk languages
+2022-10-10: { ed.} changed to {\,ed.}
+2022-08-31: \_sortingdatahu corrected
2022-06-28: Spanish, Polish, French, Swedish, Hungarian sorting rules added
2022-06-28: German sorting rules added
2022-02-19: concept finalized, but data still far of completness
diff --git a/Master/texmf-dist/tex/optex/base/lang-decl.opm b/Master/texmf-dist/tex/optex/base/lang-decl.opm
index 3b9f9e727d2..d6b562ed45a 100644
--- a/Master/texmf-dist/tex/optex/base/lang-decl.opm
+++ b/Master/texmf-dist/tex/optex/base/lang-decl.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \langlist {Languages declaration <2022-02-19>} % preloaded in format
+\_codedecl \langlist {Languages declaration <2022-10-11>} % preloaded in format
\_doc -----------------------------
\`\_preplang` `<lang-id> <LongName> <lang-tag> <hyph-tag> <lr-hyph>`
@@ -163,13 +163,22 @@
\_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 \`\_langreset` is processed before macros declared by \^`\_preplangmore`
+ or before \^`\_langdefault`. If you set something for
+ your language by \^`\_preplangmore` then use `\def\_langreset{<settings>}`
+ in this code too in order to return default values for all other languages.
+ See `cs` part of `lang-data.opm` file for an example.
+ \_cod -----------------------------
+
+\_def\_langreset {}
+
+ \_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.
@@ -236,7 +245,7 @@
\_cod -----------------------------
\_def\_uselang#1#2#3#4{\_language=#2\_lefthyphenmin=#3\_righthyphenmin=#4\_relax
- \_trycs{_langspecific:#1}{\_langdefault}%
+ \_langreset \_def\_langreset{}\_trycs{_langspecific:#1}{\_langdefault}%
}
\_doc -----------------------------
@@ -310,5 +319,6 @@
\_endcode
+2022-10-11 \_langreset introduced
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 4ae66ef1f47..1d7558444c5 100644
--- a/Master/texmf-dist/tex/optex/base/languages.opm
+++ b/Master/texmf-dist/tex/optex/base/languages.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_mtext {Languages <2022-02-19>} % preloaded in format
+\_codedecl \_mtext {Languages <2022-11-18>} % preloaded in format
\_doc -----------------------------
Four words are generated by \OpTeX/ macros: \"Chapter",
@@ -120,8 +120,8 @@
\_def\_qqA#1#2#3{\_bgroup\_setverb \_catcode`\ =10
\_isnextchar\_bgroup{\_catcode`\{=1 \_catcode`\}=2 #1#2#3}{#1#2#3}}
-\_long\_def\_qqB#1#2#3"{\_egroup#1\_scantextokens{#3}#2}
-\_long\_def\_qqC#1#2#3'{\_egroup#1\_scantextokens{#3}#2}
+\_def\_qqB#1#2#3"{\_egroup#1\_scantextokens{#3}#2}
+\_def\_qqC#1#2#3'{\_egroup#1\_scantextokens{#3}#2}
\_def\_regquotes#1#2#3#4{\_bgroup \_lccode`~=`#2\_lowercase{\_egroup \_def#1##1~}{#3##1#4}}
\_doc -----------------------------
@@ -139,6 +139,7 @@
\_endcode % -------------------------------------
+2022-11-18 \"..." are not \long now
2022-02-19 \quotes, \_quotationmarks introduced
2022-02-04 \_langinput, words-lan.opm introduced
2021-05-23 \_monthw: bug fix
diff --git a/Master/texmf-dist/tex/optex/base/makeindex.opm b/Master/texmf-dist/tex/optex/base/makeindex.opm
index ba503525591..36b4a48c08d 100644
--- a/Master/texmf-dist/tex/optex/base/makeindex.opm
+++ b/Master/texmf-dist/tex/optex/base/makeindex.opm
@@ -285,7 +285,7 @@
\_addto\_iilist{#1#2,}% % dvojice skupin vyresena
\_sortreturn{\_fif\_mergesort}% % \mergesort dalsi
\_fi
- \_ifx\_end#3% % neco,konec (#1#2=neco)
+ \_ifx\_fin#3% % neco,konec (#1#2=neco)
\_ifx\_empty\_iilist % neco=kompletni setrideny seznam
\_def\_iilist{#1#2}%
\_sortreturn{\_fif\_fif\_gobbletoend}% % koncim
@@ -303,7 +303,7 @@
\_relax % zarazka, na ktere se zastavi \sortreturn
}
\_def\_sortreturn#1#2\_fi\_relax{#1} \_def\_fif{\_fi}
-\_def\_gobbletoend #1\_end{}
+\_def\_gobbletoend #1\_fin{}
\_doc -----------------------------
The \`\_dosorting` `\list` macro redefines `\list` as sorted `\list`.
@@ -342,7 +342,7 @@
\_csname _secondpass\_sortinglang \_endcsname % activates \_reversewords if needed
\_def \_act##1{\_addto #1{##1,}}%
\_edef #1{\_ea}\_ea\_xargs \_ea\_act #1;% commas between items added, mergesort initialized
- \_edef \_iilist{\_ea}\_ea\_mergesort #1\_end,\_end
+ \_edef \_iilist{\_ea}\_ea\_mergesort #1\_fin,\_fin
\_ea\_endgroup
\_ea\_def\_ea#1\_ea{\_iilist}%
}
diff --git a/Master/texmf-dist/tex/optex/base/math-preload.opm b/Master/texmf-dist/tex/optex/base/math-preload.opm
index 9f73ef24d12..a3ac3e44b3b 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 <2022-07-22>} % preloaded in format
+\_codedecl \normalmath {Math fonts CM + AMS preloaded <2022-12-01>} % preloaded in format
\_doc ------------------------------
We have two math macros \`\normalmath` for the normal shape of all math
@@ -126,47 +126,49 @@
like `\_loadmathfamily` does it. But the second parameter is a
`\<font-switch>` declared previously by the `\font` primitive.
\nl
+ The `<number>` is saved by \^`\_loadmathfamily`, \^`\_setmathfamily`
+ to the \`\_mfam`.
+ \nl
The font family is loaded at \`\_sizemtext`, \`\_sizemscript` and
\`\_sizemsscript` sizes. These sizes are set by the
\`\setmathsizes` `[<text-size>/<script-size>/<scriptscript-size>]` macro.
These parameters are given in the \`\ptmunit` unit, it is set to
1\`\ptunit` and it is set to 1\,pt by default.
\nl
- \`\_corrmsize` `<factor><space>` can be used just before
- `\_loadmathfamily` or `\_setmathfamily`.
- The `<factor>` is decimal number, it denotes
- scale-factor \"size of loaded math font in `\textstyle` : size of text font".
- You can use it in `\_normalmath` or `\_boldmath` macros if you want to do a
- corrections (for example due to different ex-height in text and math
- font). The `\_corrmsize` is applied only to one following
- `\_loadmathfamily` or `\_setmathfamily`. If it is missing
- then the `<factor>` is 1 for such math family (i.e.\ no size corrections).
+ \`\_mfactor` sets scaling factor for given math fonts family
+ related to text font size. It does the setting `\_ptmunit=<factor>\_ptunit` where
+ the <factor> is defined by `\sdef{_mfactor:<family>}{<factor>}`.
+ For eample, you can set `\sdef{_mfactor:1}{0.95}` if you found that
+ this scaling of math family 1 gives better visual compatibility
+ with used text fonts. If not declared then scaling factor is~1.
\_cod -----------------------------
-\_def\_corrmsize#1 {\_ptmunit=#1\_ptunit} % for corrections of sizes in diferent fonts
-
-\_def\_loadmathfamily #1 #2 {%
+\_def\_loadmathfamily {\_afterassignment\_loadmathfamilyA \_chardef\_mfam}
+\_def\_loadmathfamilyA #1 {\_mfactor
\_edef\_optsizesave{\_the\_optsize}%
- \_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
+ \_optsize=\_sizemtext \_font\_mF \_optfn{#1} at\_optsize \_textfont\_mfam=\_mF
+ \_optsize=\_sizemscript \_font\_mF \_optfn{#1} at\_optsize \_scriptfont\_mfam=\_mF
+ \_optsize=\_sizemsscript \_font\_mF \_optfn{#1} at\_optsize \_scriptscriptfont\_mfam=\_mF
+ \_optsize=\_optsizesave
}
-\_def\_setmathfamily #1 #2{\_let\_mF=#2%
+\_def\_setmathfamily {\_afterassignment\_setmathfamilyA \_chardef\_mfam}
+\_def\_setmathfamilyA #1{\_mfactor \_let\_mF=#1%
\_edef\_optsizesave{\_the\_optsize}%
- \_optsize=\_sizemtext \_fontlet#2=#2 at\_optsize \_textfont#1=#2%
- \_optsize=\_sizemscript \_fontlet#2=#2 at\_optsize \_scriptfont#1=#2%
- \_optsize=\_sizemsscript \_fontlet#2=#2 at\_optsize \_scriptscriptfont#1=#2%
- \_optsize=\_optsizesave \_ptmunit=\_ptunit \_let#2=\_mF
+ \_optsize=\_sizemtext \_fontlet#1#1at\_optsize \_textfont\_mfam=#1%
+ \_optsize=\_sizemscript \_fontlet#1#1at\_optsize \_scriptfont\_mfam=#1%
+ \_optsize=\_sizemsscript \_fontlet#1#1at\_optsize \_scriptscriptfont\_mfam=#1%
+ \_optsize=\_optsizesave \_let#1=\_mF
}
\_def\_setmathsizes[#1/#2/#3]{\_ptmunit=\_ptunit
\_def\_sizemtext{#1\_ptmunit}\_def\_sizemscript{#2\_ptmunit}%
\_def\_sizemsscript{#3\_ptmunit}%
}
+\_def\_mfactor{\_ptmunit=\_trycs{_mfactor:\_the\_mfam}{}\_ptunit}
+
\_newdimen\_ptunit \_ptunit=1pt
\_newdimen\_ptmunit \_ptmunit=1\_ptunit
-\_public \setmathsizes \ptunit \ptmunit ;
+\_public \setmathsizes \ptunit ;
\_doc -----------------------------
\`\_setmathparam``<luatex-param> {<factor>}` sets
@@ -176,10 +178,14 @@
\_cod -----------------------------
\_def\_setmathparam#1#2{%
- #1\_displaystyle =#2\_fontdimen6\_textfont1
- #1\_textstyle =#2\_fontdimen6\_textfont1
- #1\_scriptstyle =#2\_fontdimen6\_scriptfont1
- #1\_scriptscriptstyle =#2\_fontdimen6\_scriptscriptfont1
+ #1\_displaystyle =#2\_fontdimen6\_textfont1
+ #1\_crampeddisplaystyle =#2\_fontdimen6\_textfont1
+ #1\_textstyle =#2\_fontdimen6\_textfont1
+ #1\_crampedtextstyle =#2\_fontdimen6\_textfont1
+ #1\_scriptstyle =#2\_fontdimen6\_scriptfont1
+ #1\_crampedscriptstyle =#2\_fontdimen6\_scriptfont1
+ #1\_scriptscriptstyle =#2\_fontdimen6\_scriptscriptfont1
+ #1\_crampedscriptscriptstyle =#2\_fontdimen6\_scriptscriptfont1
}
\_doc -----------------------------
@@ -243,6 +249,9 @@ For example
\_endinput
+2022-12-01 reading number by \_loadmathfamily, \_setmathfamily more robust
+2022-11-16: \_corrmsize removed, \_mfactor introduced
+2022-09-04: \crampedstyles setings added.
2022-07-22: \_setmathparam\_Umathspaceafterscript added.
2022-02-22: \rm, \it, etc moved to fonts-select, \_marm, \_mait etc. introduced
2020-05-06: \itfam, \ttfam removed, (Unicode math preferred)
diff --git a/Master/texmf-dist/tex/optex/base/more-macros.opm b/Master/texmf-dist/tex/optex/base/more-macros.opm
index f2564581840..418e71b7749 100644
--- a/Master/texmf-dist/tex/optex/base/more-macros.opm
+++ b/Master/texmf-dist/tex/optex/base/more-macros.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \eoldef {OpTeX useful macros <2022-05-24>} % preloaded in format
+\_codedecl \eoldef {OpTeX useful macros <2022-11-24>} % preloaded in format
\_doc -----------------------------
We define \`\opinput` `{<file name>}` macro which
@@ -89,7 +89,7 @@
loaded file is forgotten after the `\opinput`.
\_cod -----------------------------
-\_def \_load [#1]{\_loadA #1,,,\_end}
+\_def \_load [#1]{\_savemathsb \_loadA #1,,,\_end \_restoremathsb}
\_def \_loadA #1#2,{\_ifx,#1 \_ea \_loadE \_else \_loadB{#1#2}\_ea\_loadA\_fi}
\_def \_loadB #1{%
\_ifcsname _load:#1\_endcsname \_else
@@ -105,25 +105,29 @@
The declarator \`\optdef``\macro [<opt default>] <params>{<replacement text>}`
defines the `\macro` with the optional parameter followed by normal parameters
declared in `<params>`. The optional parameter must be used as the first
- first parameter in brackets `[...]`. If it isn't used then <opt default>
+ parameter in brackets `[...]`. If it isn't used then <opt default>
is taken into account. The `<replacement text>` can use `\the\opt`
because optional parameter is saved to the \`\opt` tokens register.
Note the difference from \LaTeX/ concept where the optional parameter is
in `#1`. \OpTeX/ uses `#1` as the first normal parameter (if declared).
- The \`\_nospaceafter` ignores the following optional space at expand
+ The \`\nospaceafter` ignores the following optional space at expand
processor level using the negative `\romannumeral` trick.
+ The \`\nospacefuturelet` bahaves like `\futurelet` primitive, but it
+ ignores the following optional space and works at expand processor level.
\_cod -----------------------------
+\_newtoks\_opt
\_def\_optdef#1[#2]{%
\_def#1{\_opt={#2}\_isnextchar[{\_cs{_oA:\_csstring#1}}{\_cs{_oB:\_csstring#1}}}%
\_sdef{_oA:\_csstring#1}[##1]{\_opt={##1}\_cs{_oB:\_csstring#1\_nospaceafter}}%
\_sdef{_oB:\_csstring#1\_nospaceafter}%
}
-\_def\_nospaceafter#1{\_ea#1\_romannumeral-`\.}
-\_newtoks\_opt
+\_def\_nospaceafter#1{\_ea#1\_romannumeral-`\.\_noexpand}
+\_def\_nospacefuturelet#1#2{\_ea\_immediateassignment
+ \_ea\_futurelet\_ea#1\_ea#2\_romannumeral-`\.\_noexpand}
-\_public \opt \optdef ;
+\_public \opt \optdef \nospaceafter \nospacefuturelet ;
\_doc -----------------------------
The declarator \`\eoldef``\macro #1{<replacement text>}` defines a `\macro`
@@ -150,8 +154,8 @@
\_eoldef\_skiptoeol#1{}
\_def\_bracedparam#1{\_ifcsname _\_csstring #1:M\_endcsname
\_csname _\_csstring #1:M\_ea \_endcsname
- \_else \_csname __in\_csstring #1:M\_ea \_endcsname \_fi
-}
+ \_else \_csname _in\_csstring #1\_ea \_endcsname \_fi
+}
\_public \eoldef \skiptoeol \bracedparam ;
\_doc -----------------------------
@@ -170,10 +174,10 @@
the next line continues.
\_cod -----------------------------
-\_def\_scantoeol#1{\def\_tmp{#1}\_begingroup \_setscancatcodes \_scantoeolA}
+\_def\_scantoeol#1{\_begingroup \_setscancatcodes \_scantoeolA #1}
\_def\_setscancatcodes{\_setverb \_catcode`\^^M=12\_catcode`\^=7\_catcode`\ =10\_catcode`\^^J=14 }
\_catcode`\^^M=12 %
-\_def\_scantoeolA#1^^M{\_endgroup \_tmp{#1}}%
+\_def\_scantoeolA#1#2^^M{\_endgroup #1{#2}}%
\_normalcatcodes %
\_public \scantoeol ;
@@ -194,13 +198,20 @@
It finishes processing or appends the next part to `\_tmptoks` separated by
<textB> and continues loop. The final part of the macro removes the last `?`
from resulting `\_tmptoks` and defines a new version of the `\foo`.
+
+ The \^`\replstring` macro is not expandable, but you can create your
+ expandable macro, for example:
+ \begtt
+ \def\replAB#1{\immediateassigned{\def\tmp{#1}\replstring\tmp{A}{B}}\the\_tmptoks}
+ \replAB {text A \and A} % expands to "text B \and B"
+ \endtt
\_cod -----------------------------
\_newtoks\_tmptoks
\_catcode`!=3 \_catcode`?=3
\_def\_replstring #1#2#3{% \replstring #1{stringA}{stringB}
\_long\_def\_replacestringsA##1#2{\_tmptoks{##1}\_replacestringsB}%
- \_long\_def\_replacestringsB##1#2{\_ifx!##1\_relax \_else \_toksapp\_tmptoks{#3##1}%
+ \_long\_def\_replacestringsB##1#2{\_ifx!##1\_relax \_else \_tmptoks\_ea{\_the\_tmptoks#3##1}%
\_ea\_replacestringsB\_fi}%
\_ea\_replacestringsA #1?#2!#2%
\_long\_def\_replacestringsA##1?{\_tmptoks{##1}\_edef#1{\_the\_tmptoks}}%
@@ -232,7 +243,22 @@
\_def\_removespaces #1 {\_isempty{#1}\_iffalse #1\_ea\_removespaces\_fi}
\_ea\_def \_ea\_ignorept \_ea#\_ea1\_detokenize{pt}{#1}
-\public \removespaces \ignorept ;
+\_public \removespaces \ignorept ;
+
+ \_doc -----------------------------
+ If you do `\let\foo=a` then it is not simple to return from `\foo` to the original
+ character code of `a`. You can write \code{`a} but you cannot write \code{`\\foo}.
+ The macro \`\cstochar``<sequence>` solves this problem. If the sequence
+ is equal to a character then it expands to this character (always with
+ catcode 12). If it isn't equal to a character then it expands to nothing.
+ You can say \code{\\expanded{`\\cstochar\\foo}} if you want to extract
+ the character code.
+ \_cod -----------------------------
+
+\_def\_cstochar#1{\_ea\_cstocharA\_meaning#1 {} {} \_fin}
+\_def\_cstocharA#1 #2 #3 #4\_fin{\_isinlist{#1#2}-\_iffalse #3\_fi}
+
+\_public \cstochar ;
\_doc -----------------------------
You can use expandable \`\bp``{<dimen>}` convertor from
@@ -262,6 +288,53 @@
\_public \expr \bp ;
\_doc ------------------
+ You can write \^`\setpos``[<label>]` somewhere and the position of such
+ \^`\setpos``[<label>]` can be referenced by \^`\posx``[<label>]`,
+ \^`\posy``[<label>]` and \^`\pospg``[<label>]`. The first two macros
+ expand to $x$ and $y$ position measured from left-bottom corner of the page
+ (dimen values) and \^`\pospg[<label>]` expands to the <gpageno>, i.e.\ to
+ the page number counted from one at beginning of the document.
+ These values are available in the second (and more) \TeX/ run, because the
+ information is saved to `.ref` file and restored from it at the beginning of
+ the \TeX/ job. If these values are not known then mentioned macros expand to
+ 0sp, 0sp and 0. The following example implements `\linefrom[<label>]` and
+ `\lineto[<label>]` macros. The line connecting these two points is drawn
+ (after second \TeX/ run):
+ \begtt
+ \def\linefrom[#1]{\setpos[#1:f]\drawlinefromto[#1]}
+ \def\lineto [#1]{\setpos[#1:t]}
+ \def\drawlinefromto[#1]{\ifnum\pospg[#1:f]>0 \ifnum\pospg[#1:f]=\pospg[#1:t]
+ \pdfliteral{q 0 0 m 1 0 0 RG % << red color
+ \expr{\bp{\posx[#1:t]}-\bp{\posx[#1:f]}}
+ \expr{\bp{\posy[#1:t]}-\bp{\posy[#1:f]}} l S Q}\fi\fi
+ }
+ This is a text.\linefrom[A]\par
+ This is second paragraph with a text.\lineto[A]
+ Try to reverse from-to and watch the changes.
+ \endtt
+ The coordinates are saved to the `.ref` file in the format
+ \`\_Xpos``{<label>}{<x-pos>}{<y-pos>}`. The \^`\_Xpos` macro defines
+ `\_pos:<label>` as `{<x-pos>}{<y-pos>}{<total-pg>}{<rel-pg>}`.
+ We need to read only given parameter by `\_posi`, `\_posii` or `\_posiii`
+ auxiliary macros. The implementation of
+ \`\setpos`, \`\posx` and \`\posy` macros are based on `\padsavepos`
+ `\pdflastxpos` and `\pdflastypos` pdf\TeX/ primitives. The \`\pospg`
+ simply reads the data from the \~`\_currpage` macro.
+ \_cod ------------------
+
+\_def\_Xpos#1#2#3{\_sxdef{_pos:#1}{{#2}{#3}\_currpage}}
+\_def\_setpos[#1]{\_openref\_pdfsavepos
+ \_ewref\_Xpos{{#1}\_unexpanded{{\_the\_pdflastxpos}{\_the\_pdflastypos}}}}
+
+\_def\_posx [#1]{\_ea \_posi \_expanded {\_trycs{_pos:#1}{{0}{}{}{}}sp}}
+\_def\_posy [#1]{\_ea \_posii \_expanded {\_trycs{_pos:#1}{{}{0}{}{}}sp}}
+\_def\_pospg[#1]{\_ea \_posiii \_expanded {\_trycs{_pos:#1}{{}{}{0}{}}}}
+
+\_def\_posi #1#2#3#4{#1} \_def\_posii #1#2#3#4{#2} \_def\_posiii #1#2#3#4{#3}
+
+\_public \setpos \posx \posy \pospg ;
+
+ \_doc ------------------
The pair {\`\_doc` ... \`\_cod`} is used for documenting macros and to
printing the technical documentation of the \OpTeX/. The syntax is:
{\begtt \catcode`\<=13
@@ -276,8 +349,28 @@
\_long\_def\_doc #1\_cod {\_skiptoeol}
+ \_doc ------------------
+ \`\docgen` processes lines before `\_codedecl` because the version text
+ in the macro `\_<pkg>_version` can be defined here. The package
+ documentation can print it. \^`\docgen` prints banner to log because TeX doesn't do it
+ when command line doesn't begin with the main file name after parameters.
+ \_cod ------------------
+
+\_def\_docgen #1 {\_ea \_docgenA \_input{#1.opm}}
+\_long \_def\_docgenA #1\_codedecl#2\_endcode #3\_doc {#1\_wlog{\_banner}\_skiptoeol}
+
+\_public \docgen ;
+
\_endcode % -------------------------------------
+2022-11-24 \setpos, \posx, \posy moved from OpTeX trick here
+2022-11-22 \docgen writes banner to log
+2022-11-20 \docgen reads lines before \_codedecl in order to define pkg. version
+2022-11-18 \cstochar introduced
+2022-11-13 \docgen introduced, \bracedparam corrected, \scantoeol modified
+2022-11-05 \replstring can be expandable using \immediateassigned: \toksapp replaced
+2022-11-03 \nospacefuturelet added.
+2022-10-27 \_savemathsb ...\_restoremathsb added to \load (eg. \load[xstring])
2022-05-24 \optdef: used \csstring instead \string, bug fixed.
2021-04-25 \normalcatcodes: typo fixed
2021-04-22 \the\_currctable replaced by \the\_catcodetable, bug fixed.
diff --git a/Master/texmf-dist/tex/optex/base/multicolumns.opm b/Master/texmf-dist/tex/optex/base/multicolumns.opm
index 83ed0f9e109..d84aef69c6f 100644
--- a/Master/texmf-dist/tex/optex/base/multicolumns.opm
+++ b/Master/texmf-dist/tex/optex/base/multicolumns.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \begmulti {Balanced columns <2022-05-05>} % preloaded in format
+\_codedecl \begmulti {Balanced columns <2022-11-26>} % preloaded in format
\_doc -----------------------------
\`\_betweencolumns` or \`\_leftofcolumns` or \`\_rightofcolumns` include
@@ -37,7 +37,9 @@
\_newcount\_mullines
-\_def\_begmulti #1 {\_par\_bgroup\_wipeepar \_multiskip \_def\_Ncols{#1}
+\_def\_begmulti #1 {\_par\_bgroup\_wipeepar
+ \_ifnum\_lastpenalty>10000 \_vskip4.5\_baselineskip\_penalty9999 \_vskip-4.5\_baselineskip \_fi
+ \_multiskip \_def\_Ncols{#1}
\_setbox6=\_vbox\_bgroup\_bgroup \_let\_setxhsize=\_relax \_penalty-99
%% \hsize := column width = (\hsize+\colsep) / n - \colsep
\_setbox0=\_hbox{\_leftofcolumns\_rightofcolumns}%
@@ -142,6 +144,7 @@
\_endcode % -------------------------------------
+2022-11-26 \at least three lines in the beginning of \begmulti at the page
2022-05-05 `\_betweencolumns` etc. introduced.
2021-05-20 Colors inside \begmulti...\endmuti, bug fixed
2020-03-26 Introduced
diff --git a/Master/texmf-dist/tex/optex/base/optex.ini b/Master/texmf-dist/tex/optex/base/optex.ini
index 05e052f82b1..4941ead57c1 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.08 Aug 2022}
+\def\optexversion{1.09 Dec 2022}
\def\fmtname{OpTeX}
\let\fmtversion=\optexversion
@@ -60,7 +60,7 @@
\input fonts-select.opm % font selection system
\input math-preload.opm % math fams CM + AMS preloaded
\input math-macros.opm % basic macros for math plus mathchardefs
-\input math-unicode.opm % macros for loading UnicodeMath fonts
+\input unimath-macros.opm % macros for loading UnicodeMath fonts
\input fonts-opmac.opm % font managing macros from OPmac
\input output.opm % output routine
\input margins.opm % macros for margins setting
@@ -94,7 +94,7 @@
}
\_everyjob = {%
- \_message{This is OpTeX (Olsak's Plain TeX), version <\optexversion>^^J}%
+ \_message{\_banner^^J}%
\_directlua{lua.bytecode[1]()}% load OpTeX's Lua code
\_mathsbon % replaces \int_a^b to \int _a^b
\_inputref % inputs \jobname.ref if exists
diff --git a/Master/texmf-dist/tex/optex/base/optex.lua b/Master/texmf-dist/tex/optex/base/optex.lua
index 3bec088b60d..40915fd6d40 100644
--- a/Master/texmf-dist/tex/optex/base/optex.lua
+++ b/Master/texmf-dist/tex/optex/base/optex.lua
@@ -8,7 +8,8 @@ local fmt = string.format
--
-- Define namespace where some \OpTeX/ functions will be added.
-optex = optex or {}
+local optex = _ENV.optex or {}
+_ENV.optex = optex
-- Error function used by following functions for critical errors.
local function err(message)
@@ -17,12 +18,14 @@ end
--
-- For a `\chardef`'d, `\countdef`'d, etc., csname return corresponding register
-- number. The responsibility of providing a `\XXdef`'d name is on the caller.
-function registernumber(name)
+local function registernumber(name)
return token.create(name).index
end
+_ENV.registernumber = registernumber
+optex.registernumber = registernumber
--
-- MD5 hash of given file.
-function mdfive(file)
+function optex.mdfive(file)
local fh = io.open(file, "rb")
if fh then
local data = fh:read("*a")
@@ -32,7 +35,8 @@ function mdfive(file)
end
--
-- \medskip\secc[lua-alloc] Allocators^^M
-alloc = alloc or {}
+local alloc = _ENV.alloc or {}
+_ENV.alloc = alloc
--
-- An attribute allocator in Lua that cooperates with normal \OpTeX/ allocator.
local attributes = {}
@@ -51,17 +55,17 @@ end
-- Allocator for Lua functions ("pseudoprimitives"). It passes variadic
-- arguments (\"`...`") like `"global"` to `token.set_lua`.
local function_table = lua.get_functions_table()
-function define_lua_command(csname, fn, ...)
+local function define_lua_command(csname, fn, ...)
local luafnalloc = #function_table + 1
token.set_lua(csname, luafnalloc, ...) -- WARNING: needs LuaTeX 1.08 (2019) or newer
function_table[luafnalloc] = fn
end
---
--- `provides_module` is needed by older version of luaotfload
-provides_module = function() end
+_ENV.define_lua_command = define_lua_command
+optex.define_lua_command = define_lua_command
--
-- \medskip\secc[callbacks] Callbacks^^M
-callback = callback or {}
+local callback = _ENV.callback or {}
+_ENV.callback = callback
--
-- Save `callback.register` function for internal use.
local callback_register = callback.register
@@ -388,17 +392,18 @@ end)
--
-- Compatibility with \LaTeX/ through luatexbase namespace. Needed for
-- luaotfload.
-luatexbase = {
+_ENV.luatexbase = {
registernumber = registernumber,
attributes = attributes,
- provides_module = provides_module,
+ -- `provides_module` is needed by older version of luaotfload
+ provides_module = function() end,
new_attribute = alloc.new_attribute,
callback_descriptions = callback.callback_descriptions,
create_callback = callback.create_callback,
add_to_callback = callback.add_to_callback,
remove_from_callback = callback.remove_from_callback,
call_callback = callback.call_callback,
- callbacktypes = {}
+ callbacktypes = {},
}
--
-- `\tracingmacros` callback registered.
@@ -441,6 +446,7 @@ local pdfdict_mt = {
local function pdf_dict(t)
return setmetatable(t or {}, pdfdict_mt)
end
+optex.pdf_dict = pdf_dict
--
local resource_dict_objects = {}
local page_resources = {}
@@ -653,34 +659,67 @@ callback.add_to_callback("pre_shipout_filter", function(list)
return tonode(list)
end, "_colors")
--
--- We also hook into `luaotfload`'s handling of color. Instead of the default
--- behavior (inserting colorstack whatsits) we set our own attribute. The hook
--- has to be registered {\em after} `luaotfload` is loaded.
-function optex_hook_into_luaotfload()
- if not luaotfload.set_colorhandler then
- return -- old luaotfload, colored fonts will be broken
+-- We also hook into `luaotfload`'s handling of color and transparency. Instead
+-- of the default behavior (inserting colorstack whatsits) we set our own
+-- attribute. On top of that, we take care of transparency resources ourselves.
+--
+-- The hook has to be registered {\em after} `luaotfload` is loaded.
+local setattribute = direct.set_attribute
+local token_setmacro = token.set_macro
+local color_count = registernumber("_colorcnt")
+local tex_getcount, tex_setcount = tex.getcount, tex.setcount
+--
+local function set_node_color(n, color) -- "1 0 0 rg" or "0 g", etc.
+ local attr = tonumber(token_getmacro("_color::"..color))
+ if not attr then
+ attr = tex_getcount(color_count)
+ tex_setcount(color_count, attr + 1)
+ local strattr = tostring(attr)
+ token_setmacro("_color::"..color, strattr)
+ token_setmacro("_color:"..strattr, color)
+ token_setmacro("_color-s:"..strattr, string.upper(color))
end
- local setattribute = direct.set_attribute
- local token_setmacro = token.set_macro
- local color_count = registernumber("_colorcnt")
- local tex_getcount, tex_setcount = tex.getcount, tex.setcount
- luaotfload.set_colorhandler(function(head, n, rgbcolor) -- rgbcolor = "1 0 0 rg"
- local attr = tonumber(token_getmacro("_color::"..rgbcolor))
- if not attr then
- attr = tex_getcount(color_count)
- tex_setcount(color_count, attr + 1)
- local strattr = tostring(attr)
- token_setmacro("_color::"..rgbcolor, strattr)
- token_setmacro("_color:"..strattr, rgbcolor)
- -- no stroke color set
- end
- setattribute(n, color_attribute, attr)
+ setattribute(todirect(n), color_attribute, attr)
+end
+optex.set_node_color = set_node_color
+--
+function optex.hook_into_luaotfload()
+ -- color support for luaotfload v3.13+, otherwise broken
+ pcall(luaotfload.set_colorhandler, function(head, n, rgbcolor) -- rgbcolor = "1 0 0 rg"
+ set_node_color(n, rgbcolor)
return head, n
end)
+
+ -- transparency support for luaotfload v3.22+, otherwise broken
+ pcall(function()
+ luatexbase.add_to_callback("luaotfload.parse_transparent", function(input) -- from "00" to "FF"
+ -- in luaotfload: 0 = transparent, 255 = opaque
+ -- in optex: 0 = opaque, 255 = transparent
+ local alpha = tonumber(input, 16)
+ if not alpha then
+ tex.error("Invalid transparency specification passed to font")
+ return nil
+ elseif alpha == 255 then
+ return nil -- this allows luaotfload to skip calling us for opaque style
+ end
+ local transp = 255 - alpha
+ local transpv = fmt("%.3f", alpha / 255)
+ pdf.add_page_resource("ExtGState", fmt("tr%d", transp), pdf_dict{ca = transpv, CA = transpv})
+ pdf.add_page_resource("ExtGState", "tr0", pdf_dict{ca = 1, CA = 1})
+ return transp -- will be passed to the below function
+ end, "optex")
+
+ luaotfload.set_transparenthandler(function(head, n, transp)
+ setattribute(n, transp_attribute, transp)
+ return head, n
+ end)
+ end)
end
-- History:
- -- 2022-03-07 transparency in the colorize() function, current_tr added
+ -- 2022-08-25 expose some useful functions in `optex` namespace
+ -- 2022-08-24 luaotfload transparency with attributes added
+ -- 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 47bfe573fde..98df836f763 100644
--- a/Master/texmf-dist/tex/optex/base/others.opm
+++ b/Master/texmf-dist/tex/optex/base/others.opm
@@ -107,8 +107,8 @@
\_def\_lipsumtext[#1]{\_lipsumload\_cs{_lip:#1}}
\_def\_lipsum[#1]{\_lipsumA #1.]{#1}}
-\_def\_lipsumA #1.#2]#3{\_ifx^#2^\_lipsumB #1\_empty-\_empty\_end \_else \_lipsumdot[#1].\_fi}
-\_def\_lipsumB #1-#2\_empty#3\_end{%
+\_def\_lipsumA #1.#2]#3{\_ifx^#2^\_lipsumB #1\_empty-\_empty\_fin \_else \_lipsumdot[#1].\_fi}
+\_def\_lipsumB #1-#2\_empty#3\_fin{%
\_fornum #1..\_ifx^#2^#1\_else#2\_fi \_do {\_lipsumtext[##1]\_par}}
\_def\_lipsumload{{%
\_setbox0=\_vbox{\_tmpnum=0 % vertical mode during \input lipsum.ltd.tex
@@ -118,8 +118,8 @@
\_opinput {lipsum.ltd.tex}%
\_global\_let\_lipsumload=\_empty
}}}
-\_def\_lipsumdot[#1]{\_lipsumload \_ea\_ea\_ea \_lipsumdotA \_csname _lip:#1\_endcsname.\_end}
-\_def\_lipsumdotA #1.#2\_end {#1}
+\_def\_lipsumdot[#1]{\_lipsumload \_ea\_ea\_ea \_lipsumdotA \_csname _lip:#1\_endcsname.\_fin}
+\_def\_lipsumdotA #1.#2\_fin {#1}
\_public \lipsum \lipsumtext ;
\_let \lorem=\lipsum
diff --git a/Master/texmf-dist/tex/optex/base/output.opm b/Master/texmf-dist/tex/optex/base/output.opm
index c74d99d371d..095cfda4b3d 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-03-07>} % preloaded in format
+\_codedecl \nopagenumbers {Output routine <2022-10-20>} % preloaded in format
\_doc -----------------------------
\`\_optexoutput` is the default output routine. You can create another...\nl
@@ -86,7 +86,7 @@
\_def\_makeheadline {\_istoksempty \_headline \_iffalse
\_vbox to\_zo{\_vss
\_baselineskip=\_headlinedist \_lineskiplimit=-\_maxdimen
- \_hbox to\_xhsize{\_the\_headline}\_hbox{}}\_nointerlineskip
+ \_hbox to\_xhsize{\_normalbaselines\_the\_headline}\_hbox{}}\_nointerlineskip
\_fi
}
@@ -96,7 +96,7 @@
\_def\_makefootline{\_istoksempty \_footline \_iffalse
\_baselineskip=\_footlinedist
- \_lineskiplimit=-\_maxdimen \_hbox to\_xhsize{\_the\_footline}
+ \_lineskiplimit=-\_maxdimen \_hbox to\_xhsize{\_normalbaselines\_the\_footline}
\_fi
}
@@ -258,6 +258,7 @@ The output routine \^`\_optexoutput` is similar as in plain \TeX. It does:
\_endinput
+2022-10-22 \_normalbaselines added to \makehead/foot/line
2022-03-07 \_resetattrs instead \_resetcolor
2021-07-16 output routine supports colors via attributes
2021-02-25 \_draftbox improved
diff --git a/Master/texmf-dist/tex/optex/base/pdfuni-string.opm b/Master/texmf-dist/tex/optex/base/pdfuni-string.opm
index 89a479895ae..4e5a29e9db4 100644
--- a/Master/texmf-dist/tex/optex/base/pdfuni-string.opm
+++ b/Master/texmf-dist/tex/optex/base/pdfuni-string.opm
@@ -51,8 +51,8 @@
\_escapechar=-1
\_edef#1{#1\_empty}%
\_escapechar=`\\
- \_ea\_edef \_ea#1\_ea{\_ea\_removeoutmath #1$\_end$}% $x$ -> x
- \_ea\_edef \_ea#1\_ea{\_ea\_removeoutbraces #1{\_end}}% {x} -> x
+ \_ea\_edef \_ea#1\_ea{\_ea\_removeoutmath #1$\_fin$}% $x$ -> x
+ \_ea\_edef \_ea#1\_ea{\_ea\_removeoutbraces #1{\_fin}}% {x} -> x
\_edef#1{\_detokenize\_ea{#1}}%
\_replstring#1{ }{{ }}% text text -> text{ }text
\_catcode`\\=12 \_let\\=\_bslash
@@ -69,8 +69,8 @@
}
\_def\_removeoutbraces #1#{#1\_removeoutbracesA}
-\_def\_removeoutbracesA #1{\_ifx\_end#1\_else #1\_ea\_removeoutbraces\_fi}
-\_def\_removeoutmath #1$#2${#1\_ifx\_end#2\_else #2\_ea\_removeoutmath\_fi}
+\_def\_removeoutbracesA #1{\_ifx\_fin#1\_else #1\_ea\_removeoutbraces\_fi}
+\_def\_removeoutmath #1$#2${#1\_ifx\_fin#2\_else #2\_ea\_removeoutmath\_fi}
\_doc -----------------------------
The \`\_prepinverb``<macro><separator>{<text>}`,
@@ -83,9 +83,9 @@
\_def\_prepinverb#1#2#3{\_def#1{}%
\_def\_dotmpb ##1#2##2{\_addto#1{\_scantextokens{\_unexpanded{##1}}}%
- \_ifx\_end##2\_else\_ea\_dotmpbA\_ea##2\_fi}%
+ \_ifx\_fin##2\_else\_ea\_dotmpbA\_ea##2\_fi}%
\_def\_dotmpbA ##1#2{\_addto#1{##1}\_dotmpb}%
- \_dotmpb#3#2\_end
+ \_dotmpb#3#2\_fin
}
\_doc -----------------------------
diff --git a/Master/texmf-dist/tex/optex/base/plain-macros.opm b/Master/texmf-dist/tex/optex/base/plain-macros.opm
index 6909abff09f..6ae59108b50 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 <2022-02-19>} % preloaded in format
+\_codedecl \magstep {Macros from plain TeX <2022-10-11>} % preloaded in format
\_doc -----------------------------
The \`\dospecials` works like in plain TeX but does nothing with `_`.
@@ -200,7 +200,7 @@
\_chardef\AE="C6
\_chardef\OE="D7
\_chardef\O="D8
-\_chardef\i="11 \chardef\j="12 % dotless letters
+\_chardef\i="19 \chardef\j="1A % dotless letters
\_chardef\aa="E5
\_chardef\AA="C5
\_chardef\S="9F
@@ -219,15 +219,19 @@
\_public \mathhexbox ;
\_doc -----------------------------
- The \`\_unichars` macro is run in \^`\initunifonts`,
+ The \`\_unichars` macro is run in \~`\initunifonts`,
Unicodes are used instead old plain \TeX/ settings.
\_cod -----------------------------
-\def\_unichars{% characters with different codes in Unicode:
+\def\_unichars{% Plain TeX character sequences with different codes in Unicode:
\_chardef\ss=`ß
- \_chardef\oe=`œ
- \_chardef\OE=`Œ
- \_chardef\S=`§
+ \_chardef\ae=`æ \_chardef\AE=`Æ
+ \_chardef\oe=`œ \_chardef\OE=`Œ
+ \_chardef\o=`ø \_chardef\O=`Ø
+ \_chardef\aa=`å \_chardef\AA=`Å
+ \_chardef\l=`ł \_chardef\L=`Ł
+ \_chardef\i=`ı \_chardef\j=`ȷ
+ \_chardef\S=`§ \_chardef\P=`¶
\_chardef\dag`†
\_chardef\ddag`‡
\_chardef\copyright`©
@@ -365,6 +369,7 @@
\_endcode % -------------------------------------
+2022-10-11 ... \_unichars extended
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
diff --git a/Master/texmf-dist/tex/optex/base/prefixed.opm b/Master/texmf-dist/tex/optex/base/prefixed.opm
index d15ee4140de..a599e0ec856 100644
--- a/Master/texmf-dist/tex/optex/base/prefixed.opm
+++ b/Master/texmf-dist/tex/optex/base/prefixed.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \public {Prefixing and code syntax <2021-08-16>} % preloaded in format
+\_codedecl \public {Prefixing and code syntax <2022-11-25>} % preloaded in format
\_doc ---------
All \TeX/ primitives have alternative control sequence `\_hbox` `\_string`, ...
@@ -21,15 +21,19 @@
private form of \`\_ea`
because there is high probability that `\ea` will be redefined by the user.
\nl
- \`\public` `<sequence> <sequence> ... ;` does
+ \`\public` `\<sequence> \<sequence> ... ;` does
`\let \<sequence> = \_<sequence>` for all sequences.
\nl
- \`\private` `<sequence> <sequence> ...;` does
+ \`\private` `\<sequence> \<sequence> ...;` does
`\let \_<sequence> = \<sequence>` for all sequences.
\nl
- \`\_checkexists` `<where> <prefix><sequence>` prints error
- if the control sequence propagated to
- a new name space by `\public` etc. macros is not declared.
+ \`\newpublic``<do>\<sequence>` prints warning if `\<sequence>`
+ is declared already. Then runs `<do>\<sequence>`.\nl
+ \`\_checkexists` `<where> {<sequence-string>}` prints error
+ if the control sequence given by its name <sequence-string>
+ is not declared. This check is used in `\public`, `\private`,
+ `\_nspublic` and `\_nsprivate` macros in order to avoid mistakes
+ in names when declaring new control sequences.
\nl
\`\xargs` `<what> <sequence> <sequence> ... ;`
does `<what><sequence>` for each sequences.
@@ -42,62 +46,42 @@
\_def \_pkglabel{}
\_def \_public {\_xargs \_publicA}
\_def \_publicA #1{%
- \_checkexists \public _#1%
+ \_checkexists \public {_\_csstring#1}%
\_ea\_let \_ea#1\_csname _\_csstring #1\_endcsname
}
\_def \_private {\_xargs \_privateA}
\_def \_privateA #1{%
- \_checkexists \private {}#1%
+ \_checkexists \private {\_csstring #1}%
\_ea\_let \_csname _\_csstring #1\_endcsname =#1%
}
-\_def\_checkexists #1#2#3{\_unless \_ifcsname #2\_csstring#3\_endcsname
- \_errmessage {\_string#1: \_bslash#2\_csstring#3 must be declared}\_fi
-}
-\_public \public \private \xargs \ea ;
-
- \_doc -----------------------
- Each macro file should begin with \`\_codedecl` `\macro {<info>}`.
- If the `\macro` is defined already then the `\endpinput` protects to read
- such file more than once. Else the <info> is printed to the terminal
- and the file is read.\nl
- The {\`\_endcode`} is defined as `\endinput` in the `optex.ini` file.
- \`\wterm` `{<text>}` prints the `<text>` to the terminal and to the `.log` file,
- \`\wlog` `{<text>}` prints the `<text>` only to the `.log` file (as in plain \TeX)
- \_cod -----------------------
-
-\_def \_codedecl #1#2{%
- \_ifx #1\_undefined \_wlog{#2}%
- \_else \_ea \_endinput \_fi
+\_def\_checkexists #1#2{\_unless \_ifcsname #2\_endcsname
+ \_errmessage {\_string#1: \_bslash#2 must be declared}\_fi
}
-\_def \_wterm {\_immediate \_write16 }
-\_def \_wlog {\_immediate\_write-1 } % write on log file (only)
-
-\_public \wterm \wlog ;
-
- \_doc ------------------------
- The `\optexversion` and `\fmtname` are defined in the `optex.ini` file.
- Maybe, somebody will need a private version of these macros.
- \_cod ------------------------
-
-\_private \optexversion \fmtname ;
+\_def\_newpublic #1#2{\_unless\_ifx #2\_undefined
+ \_opwarning{\_string#2 is redefined%
+ \_ifx\_pkglabel\_empty \_else\_space by the \_ea\_ignoreit\_pkglabel\_space package\_fi}\_fi
+ #1#2%
+}
+\_public \public \private \newpublic \xargs \ea ;
\_doc -----------------------------
- The `\_mathsbon` and `\_mathsboff` are defined in `math-macros.opm` file.
- Now, we define the macros
+ We define the macros
\`\_namespace` `{<pkg label>}`, \`\_resetnamespace` `{<pkg label>}`, \`\_endnamespace`,
- \`\_nspublic` and \`\_nsprivate`
+ \`\_pkglabel`, \`\_nspublic`, and \`\_nsprivate`
for package writers, see section~\ref[pkg-namespace].{\hbadness=2200\par}
\_cod -----------------------------
\_def \_pkglabel{}
\_def\_namespace #1{%
- \_ifcsname namesp:#1\_endcsname \_errmessage
+ \_ifcsname _namesp:#1\_endcsname \_errmessage
{The name space "#1" is used already, it cannot be used twice}%
\_endinput
- \_else \_resetnamespace{#1}\_fi
+ \_else
+ \_ea \_gdef \_csname _namesp:#1\_endcsname {}%
+ \_resetnamespace{#1}\_fi
}
\_def\_resetnamespace #1{%
- \_ea \_gdef \_csname namesp:#1\_endcsname {}%
+ \_unless \_ifx \_pkglabel\_empty \_endnamespace \_fi
\_gdef \_pkglabel{_#1}%
\_directlua{
callback.add_to_callback("process_input_buffer",
@@ -110,20 +94,60 @@
\_directlua{ callback.remove_from_callback("process_input_buffer", "_namespace") }%
\_gdef \_pkglabel{}%
}
-
\_def \_nspublic {\_xargs \_nspublicA}
\_def \_nspublicA #1{%
- \_checkexists \nspublic {\_pkglabel _}#1%
- \_unless\_ifx #1\_undefined
- \_opwarning{\_ea\_ignoreit\_pkglabel\_space redefines the meaning of \_string#1}\_fi
- \_ea\_let \_ea#1\_csname \_pkglabel _\_csstring #1\_endcsname
+ \_checkexists \_nspublic {\_pkglabel _\_csstring #1}%
+ \_ea\_newpublic \_ea\_let \_ea#1\_csname \_pkglabel _\_csstring #1\_endcsname
}
\_def \_nsprivate {\_xargs \_nsprivateA}
\_def \_nsprivateA #1{%
- \_checkexists \nsprivate {}#1%
+ \_checkexists \_nsprivate {\_csstring #1}%
\_ea\_let \_csname \_pkglabel _\_csstring #1\_endcsname =#1%
}
+ \_doc -----------------------
+ Each macro file should begin with \`\_codedecl` `\macro {<info>}`.
+ If the `\macro` is defined already then the `\endpinput` protects to read
+ such file more than once. Else the <info> is printed to the terminal
+ and the file is read.
+ The {\`\_endcode`} is defined as `\endinput` in the `optex.ini` file.
+ \`\wterm` `{<text>}` prints the `<text>` to the terminal and to the `.log` file,
+ \`\wlog` `{<text>}` prints the `<text>` only to the `.log` file (as in plain \TeX)
+ \_cod -----------------------
+
+\_def \_codedecl #1#2{%
+ \_ifx #1\_undefined \_wlog{@:[\_basefilename\_currfile] #2}%
+ \_else \_ea \_endinput \_fi
+}
+\_def \_wterm {\_immediate \_write16 }
+\_def \_wlog {\_immediate\_write-1 } % write on log file (only)
+
+\_public \wterm \wlog ;
+
+ \_doc -----------------------------
+ \`\currfile` returns the name of the current input file including its path.\nl
+ \`\basefilename``\currfile` returns base name of
+ the current file, without its path and extension.\nl
+ \`\_nofilepath` `<text>/<with>/<slashes>/\_fin` expands to the last segment
+ separated by slashes.\nl
+ \`\_nofileext` `<filename>.\_fin` expands to the file name without extension.
+ \_cod -----------------------------
+
+\_def\_currfile{\_directlua{tex.print(status.filename)}}
+\_def\_basefilename #1{\_ea\_nofileext\_expanded{\_ea\_ea\_ea\_nofilepath#1/\_fin}.\_fin}
+\_def\_nofilepath #1/#2{\ifx#2\_fin #1\_else \_ea\_nofilepath \_ea#2\_fi}
+\_def\_nofileext #1.#2\_fin{#1}
+
+\_public \currfile \basefilename ;
+
+ \_doc ------------------------------
+ We define \`\_fin` as a useless macro. Suppose that its meaning will be never
+ used for another control sequence. You can use `\_fin` as a final delimiter
+ of a list of tokens and your macro can ask `\ifx\_fin#1` in order to
+ decide that the list of tokens is finalized.
+ \_cod ------------------------------
+
+\_protected\_long \_def \_fin \_fin {}
\_endcode %----------------------------------------------------
@@ -216,25 +240,48 @@ features can be lost (printing percent character by `\%` for example).
\secc Macro files syntax
-Each segment of \OpTeX/ macros is stored in one file with `.opm` extension
+Segments of \OpTeX/ macros or external macro packages
+are stored in files with `.opm` extension
(means OPtex Macros). Your local macros should be in a normal `*.tex` file.
The code in macro files starts by \^`\_codedecl` and ends by \^`\_endcode`.
The \^`\_endcode` is equivalent for `\endinput`, so documentation can follow.
The \^`\_codedecl` has syntax:
-\begtt
-\_codedecl \sequence {Name <version>}
+\begtt \catcode`<=13 \adef!{\string}
+\_codedecl \sequence {<short title> !<<version>>}
\endtt
-If the mentioned `\sequence` is defined, then \^`\_codedecl` does the same as
+If the mentioned `\sequence` is undefined then \^`\_codedecl` prints the message
+\begtt \catcode`<=13 \adef!{\string}
+@:[<file name>] <short title> !<<version>>
+\endtt
+to the log file and \TeX/ continues with reading the following macros.
+If the `\sequence` is defined, then \^`\_codedecl` acts like
`\endinput`: this protects from reading the file twice. We suppose, that
`\sequence` is defined in the macro file.
-It is possible to use the \^`\_doc` ... \^`\_cod` pair between the macro lines.
-The documentation text should be here. It is ignored when macros are read
-but it can be printed using `doc.opm` macros like in this documentation.
-
+It is possible to use the \^`\_doc` ... \^`\_cod` pair between the macro
+definitions. The documentation text should be here.
+It is ignored when macros are read.
+
+The \^`\_doc` ... \^`\_cod` parts can be printed after \^`\load[doc]`
+using \~`\printdoc` macro, see section~\ref[doc].
+If you have created a documented macro file `pkgname.opm` then you can
+put macros for creating your documentation between
+first pair of \^`\_doc` ... \^`\_cod` used after \^`\_endcode`.
+These macros should \^`\load[doc]` and must be finished by \^`\bye`.
+Then you have code+documentation together in a single file and
+user can generate the documentation of our package by
+\^`\docgen` used at command line:
+\begtt
+optex -jobname pkgname-doc '\docgen pkgname'
+\endtt
+Example of a \^`\_doc` ... \^`\_cod` code used for creating the
+documentation using \^`\docgen` can be found in the `math.opm` file. You can see
+\ulink[https://petr.olsak.net/ftp/olsak/optex/math-doc.pdf]{its documentation}, especially
+\ulink[https://petr.olsak.net/ftp/olsak/optex/math-doc.pdf\#ref:pkgtemplate]
+{section about creating packages}.
\secc[pkg-namespace] Name spaces for package writers
@@ -255,12 +302,23 @@ The scope of the \^`\_namespace` command ends at the \^`\_endnamespace` command
or when another \^`\_namespace` is used. This command checks
if the same package label is not declared by the \^`\_namespace` twice.
-The \^`\_nspublic` macro does `\let\foo = \_<pkg>_foo` when
+\^`\_nspublic` `<list of sequences> ;`
+does `\let\foo = \_<pkg>_foo` for each given sequence when
\^`\_namespace{<pkg>}` is declared. Moreover, it prints a warning if `\foo` is
defined already. The \^`\_nsprivate` macro does reverse
operation to it without warnings. Example: you can define `\def\.macro{...}` and then
set it to the user name space by `\_nspublic \macro;`.
+It could happen that a package writer needs to declare a control sequence
+(say `\foo`) directly without setting it in `\_<pkg>_foo` name space
+followed by using \^`\_nspublic`. The \^`\newpublic` prefix should be used in this
+case, for example `\_newpublic\_def\foo` or `\_newpublic\_chardef\foo` or
+`\_newpublic{\_long\_def}\foo`. The \^`\newpublic``<do>\<sequence>` prints
+a warning if the declared `\<sequence>` is defined already and then runs
+`<do>\<sequence>`. The reason of the warning is the same as when
+\^`\_nspublic` warns about doing re-declaration of control sequences already
+declared.
+
Don't load other packages (which are using their own namespace) inside your
namespace. Do load them before your \^`\_namespace`~`{<pkg>}` is
initialized. Or close your namespace by \^`\_endnamespace` and open it again
@@ -315,6 +373,10 @@ can look like.
\endinput
+2022-11-25 \_resetnamespace: moved \gdef\_namesp:#1 {} to \_namespace
+2022-11-24 \newpublic introduced, \_checkexists with only two parameters.
+2022-11-22 \currfile introduced and used in \_codedecl
+2022-11-13 \_resetnamespace corrected
2021-08-16 \_wlog moved from basic macros, \_codedecl uses \_wlog only.
2021-04-25 \_checkexists introduced
2021-02-15 \_expandafter -> \_ea in \_codedecl
diff --git a/Master/texmf-dist/tex/optex/base/ref-file.opm b/Master/texmf-dist/tex/optex/base/ref-file.opm
index 7f9c619009e..922150f9f5d 100644
--- a/Master/texmf-dist/tex/optex/base/ref-file.opm
+++ b/Master/texmf-dist/tex/optex/base/ref-file.opm
@@ -29,7 +29,7 @@
printed. Try running `optex op-demo` twice to see the effect.
\_cod --------------------------
-\_def\_mdfive#1{\_directlua{mdfive("#1")}}
+\_def\_mdfive#1{\_directlua{optex.mdfive("#1")}}
\_def\_prevrefhash{}
\_doc --------------------------
diff --git a/Master/texmf-dist/tex/optex/base/references.opm b/Master/texmf-dist/tex/optex/base/references.opm
index c26320b046c..9da2bca30fb 100644
--- a/Master/texmf-dist/tex/optex/base/references.opm
+++ b/Master/texmf-dist/tex/optex/base/references.opm
@@ -94,9 +94,9 @@
but the optional `@` in the `<given-text>` is replaced by the `<implicit-text>` first.
\_cod -----------------------------
-\_def\_reftext #1#2{\_isatin #2@\_iffalse #2\_else\_reftextA{#1}#2\_end \_fi}
-\_def\_reftextA #1#2@#3\_end {#2#1#3}
-\_def\_isatin #1@#2\_iffalse {\_ifx\_end#2\_end}
+\_def\_reftext #1#2{\_isatin #2@\_iffalse #2\_else\_reftextA{#1}#2\_fin \_fi}
+\_def\_reftextA #1#2@#3\_fin {#2#1#3}
+\_def\_isatin #1@#2\_iffalse {\_ifx\_fin#2\_fin}
\_doc -----------------------------
Default \`\_printlabel` is empty macro (labels are not printed).
diff --git a/Master/texmf-dist/tex/optex/base/sections.opm b/Master/texmf-dist/tex/optex/base/sections.opm
index 9ff2c2d4367..7d7a78232bd 100644
--- a/Master/texmf-dist/tex/optex/base/sections.opm
+++ b/Master/texmf-dist/tex/optex/base/sections.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \chap {Titles, chapters, sections, subsections <2022-08-02>} % preloaded in format
+\_codedecl \chap {Titles, chapters, sections, subsections <2022-10-19>} % preloaded in format
\_doc ---------------------------
We are using scaled fonts for titles
@@ -28,6 +28,7 @@
\_nobreak\_bigskip
}
\_def\_tit{\_scantoeol\_printtit}
+\_let\_intit=\_printtit % used by \bracedparam
\_public \tit ;
@@ -332,9 +333,11 @@
The \`\caption``/<letter>` increases `\_<letter>num` counter,
edefines \`\_thecapnum` as `\_the<letter>num` and
defines \`\_thecaptitle` as language-dependent word using \^`\_mtext`,
+ declares default format by \^`\_captionformat``{<letter>}` and
runs the `\_everycaption<letter>` tokens register.
- The group opened by `\caption` is finalized by first `\_par` from
- an empty line or from `\vskip` or from `\endinsert`.
+ The two groups opened by `\caption` are finalized by first `\_par` from
+ an empty line or from `\vskip`, `\cskip` or from `\endinsert`.
+ If a \code{\}} occurs first then `\_par` from `\aftergroup` is processed.
The `\_printcaption<letter>` is called, it starts with
printing of the caption.\nl
The \`\cskip` macro inserts nonbreakable vertical space between the caption and
@@ -348,8 +351,11 @@
\_else \_opwarning{Unknown caption /\_tmpa}\_fi
\_edef\_thecapnum {\_csname _the\_tmpa num\_endcsname}%
\_edef\_thecaptitle{\_mtext{\_tmpa}}%
+ \_ea\_captionformat\_ea{\_tmpa}%
\_ea\_the \_csname _everycaption\_tmpa\_endcsname
- \_def\_par{\_nbpar\_egroup}%
+ \_def\_par{\_ifhmode\_nbpar\_egroup\_egroup\_fi}%
+ \_ifx\par\_endgraf \_let\par=\_par \_fi
+ \_bgroup \_aftergroup\_par
\_cs{_printcaption\_tmpa}%
}
\_def \_cskip {\_par\_nobreak\_medskip} % space between caption and the object
@@ -359,12 +365,15 @@
\_doc -----------------------------
The \`\_printcaptiont` and \`\_printcaptionf` macros start in vertical mode.
They switch to horizontal mode and use `\_wlabel\_thecapnum` (in order to
- make reference and hyperlink destination) a they can use:
+ make reference and hyperlink destination). They can use:
\begitems
* \^`\_thecaptitle` ... expands to the word Table or Figure (depending on
the current language).
* \^`\_thecapnum` ... expands to `\the<letter>num` (caption number).
\enditems
+ The macro \^`\_printcaptiont` (or `f`) is processed inside group and the
+ `\_par` can be run after this group. If you want to re-define formating
+ parameters for `\_par`, do this in the macro \^`\_captionformat`.
The \`\_captionsep` inserts a separator between auto-generated
caption number and the following caption text. Default separator
is `\_enspace` but if the caption text starts with dot or colon, then
@@ -375,7 +384,7 @@
\_def \_printcaptiont {%
\_noindent \_wlabel\_thecapnum {\_bf\_thecaptitle~\_thecapnum}%
- \_narrowlastlinecentered\_iindent \_futurelet\_next\_captionsep
+ \_futurelet\_next\_captionsep
}
\_def\_captionsep{\_ifx\_next.\_ea\_bfnext \_else\_ifx\_next:\_ea\_ea\_ea\_bfnext
\_else \_enspace \_fi\_fi}
@@ -392,11 +401,14 @@
\def\_theanum {\_othe\_chapnum.\_the\_secnum.\_the\_anum}
\sdef{_mt:a:en}{Algorithm} \sdef{_mt:a:cs}{Algoritmus} % + your language...
\endtt
- The default format of `\caption` text is a paragraph in block narrower by
+ The format of the \^`\caption` text is given by the
+ \`\_captionformat``{<caption-letter>}` macro.
+ The default format for `t` and `f` is a paragraph in block narrower by
`\_iindent` and with the last line is centered. This setting is done by
the \`\_narrowlastlinecentered` macro.
\_cod -----------------------------
+\_def\_captionformat#1{\_narrowlastlinecentered\_iindent}
\_def\_narrowlastlinecentered#1{%
\_leftskip=#1plus1fil
\_rightskip=#1plus-1fil
@@ -461,6 +473,7 @@
\_endcode % -------------------------------------
+2022-10-19 More robust \caption (two opened groups, \_printcaption introduced)
2022-08-02 Penalties in \_printsec, \_printsecc changed
2022-07-11 \_printchap: \_prevdepth=0pt added, see issue 100
2021-03-03 \_captionsep introduced, \_othe used in \_thetnum, \_thefnum.
diff --git a/Master/texmf-dist/tex/optex/base/table.opm b/Master/texmf-dist/tex/optex/base/table.opm
index 26131897fc9..1866c0486d1 100644
--- a/Master/texmf-dist/tex/optex/base/table.opm
+++ b/Master/texmf-dist/tex/optex/base/table.opm
@@ -22,12 +22,12 @@
\_cod -----------------------------
\_newifi \_ifpxto
-\_def\_table#1#{\_tablebox\_bgroup \_tableW#1\_empty\_end
+\_def\_table#1#{\_tablebox\_bgroup \_tableW#1\_empty\_fin
\_bgroup \_catcodetable\_optexcatcodes \_tableA}
-\_def\_tableW#1#2\_end{\_pxtofalse
+\_def\_tableW#1#2\_fin{\_pxtofalse
\_ifx#1\_empty \_def\_tablew{}\_else
- \_ifx#1p \_def\_tablew{}\_tableWx#2\_end \_else \_def\_tablew{#1#2}\_fi\_fi}
-\_def\_tableWx xto#1\_end{\_tmpdim=#1\_relax \_pxtotrue}
+ \_ifx#1p \_def\_tablew{}\_tableWx#2\_fin \_else \_def\_tablew{#1#2}\_fi\_fi}
+\_def\_tableWx xto#1\_fin{\_tmpdim=#1\_relax \_pxtotrue}
\_public \table ;
\_doc -----------------------------
@@ -337,12 +337,12 @@
\_def\_tablinefil{\_leaders\_hrule\_hfil}
\_def\_crlp#1{\_crcr \_zerotabrule \_noalign{\_kern-\_drulewidth}%
- \_omit \_xdef\_crlplist{#1}\_xdef\_crlplist{,\_ea}\_ea\_crlpA\_crlplist,\_end,%
+ \_omit \_xdef\_crlplist{#1}\_xdef\_crlplist{,\_ea}\_ea\_crlpA\_crlplist,\_fin,%
\_global\_tmpnum=0 \_gdef\_dditem{\_omit\_crlpD}%
\_gdef\_vvitem{\_kern\_vvkern\_kern\_drulewidth}\_gdef\_vvitemA{\_kern\_drulewidth}%
\_vvleft\_crlpD\_ddlinedata \_global\_tmpnum=0 \_crcr \_zerotabrule}
-\_def\_crlpA#1,{\_ifx\_end#1\_else \_crlpB#1-\_end,\_ea\_crlpA\_fi}
-\_def\_crlpB#1#2-#3,{\_ifx\_end#3\_xdef\_crlplist{\_crlplist#1#2,}\_else\_crlpC#1#2-#3,\_fi}
+\_def\_crlpA#1,{\_ifx\_fin#1\_else \_crlpB#1-\_fin,\_ea\_crlpA\_fi}
+\_def\_crlpB#1#2-#3,{\_ifx\_fin#3\_xdef\_crlplist{\_crlplist#1#2,}\_else\_crlpC#1#2-#3,\_fi}
\_def\_crlpC#1-#2-#3,{\_tmpnum=#1\_relax
\_loop \_xdef\_crlplist{\_crlplist\_the\_tmpnum,}\_ifnum\_tmpnum<#2\_advance\_tmpnum by1 \_repeat}
\_def\_crlpD{\_incr\_tmpnum \_edef\_tmpa{\_noexpand\_isinlist\_noexpand\_crlplist{,\_the\_tmpnum,}}%
diff --git a/Master/texmf-dist/tex/optex/base/unimath-codes.opm b/Master/texmf-dist/tex/optex/base/unimath-codes.opm
index 229ea4575d5..418d0d28aa1 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-07-20>} % preloaded on demand by \loadmath
+\_codedecl \_ncharrmA {Uni math codes <2022-11-20>} % preloaded on demand by \loadmath
\_doc -----------------------------
The control sequences for `\alpha`, `\beta` etc are redefined here.
@@ -170,19 +170,30 @@
\_doc -----------------------------
Each math symbol has its declaration in the file `unicode-math-table.tex`
which is copied to `unimath-table.opm`. The file has the following format:
- {\vitt{unimath-table.opm}\verbinput (70-85) unimath-table.opm }
- We have to read this information and convert it to the Unicode math codes.
+ {\vitt{unimath-table.opm}\verbinput (36-41) unimath-table.opm }
+ We have to read this information and set given control sequences to
+ the relevant Unicode characters using `\chardef`. We don't use `\mathchardef`
+ for them because the want to manage the matcodes (class, family, slot)
+ only at single place: at Unicode characters. Control sequeces declared here
+ are only pointers to these Unicode characters. Exceptions are delimiters and
+ math accents.\nl
+ If the character is delimiter then we declare \_d:<sequence> to be the
+ `\chardef` equivalent of the character and `\let<sequence>=<character>`
+ because `\left`, `\right` doesn't like `\chardef` equivalent of the
+ character although it has its own delcode.
\_cod -----------------------------
\_begingroup % \input unimath-table.opm (it is a copy of unicode-math-table.tex):
\_def\UnicodeMathSymbol #1#2#3#4{%
- \_ifnum#1=\_Umathcodenum#1 % the code isn't set by mathclass.opm
- \_Umathchardef#2=0 1 #1 \_Umathcode#1=0 1 #1
- \_else \_Umathcharnumdef#2=\_Umathcodenum#1 \_fi
- \_ifx#3\_mathopen \_def#2{\_Udelimiter 4 1 #1 }\_fi
- \_ifx#3\_mathclose \_def#2{\_Udelimiter 5 1 #1 }\_fi
- \_ifx#3\_mathaccent \_def#2{\_Umathaccent fixed 7 1 #1 }\_fi
+ \_chardef#2=#1 % control sequence is only pointer to Unicode character
+ \_ifnum#1=\_Umathcodenum#1 \_Umathcode#1=0 1 #1 \_fi % it isn't set by mathclass.opm
+ \_ifx#3\_mathopen \_setdelimiter#2\_fi
+ \_ifx#3\_mathclose \_setdelimiter#2\_fi
+ \_ifx#3\mathfence \_setdelimiter#2\_fi
+ \_ifx#3\_mathaccent \_protected\_def#2{\_Umathaccent fixed 7 1 #1 }\_fi
}
+ \_def\mathfence{F}%
+ \_def\_setdelimiter#1{\_expanded{\_let\_cs{_d:\_csstring#1}=#1\_let#1=\Uchar#1}}
\_globaldefs=1 \_input unimath-table.opm
\_endgroup
@@ -203,10 +214,8 @@
% mathclas defines ! as Ord, plain.tex as Close
\_Umathcode `! = 5 1 `! % keep plain.tex declaration
-\_Umathchardef \mathexclam = 5 1 `!
% mathclas defines ? as Punct, plain.tex as Close
\_Umathcode `? = 5 1 `? % keep plain.tex declaration
-\_Umathchardef \mathquestion = 5 1 `?
\_Umathcode `* = 2 1 "02217 % equivalent to \ast, like in plain TeX
@@ -222,22 +231,24 @@
\_public \sqrt \cuberoot \fourthroot ;
-\_def\_intwithnolimits#1#2 {\_ifx#1\_relax \_else
- \_ea\_let\_csname\_csstring#1op\_endcsname=#1%
- \_ea\_def\_ea #1\_ea{\_csname\_csstring#1op\_endcsname \_nolimits}%
- \_bgroup \_lccode`\~=#2 \_lowercase{\_egroup \_mathcode`~="8000 \_let ~=#1}%
+ \_doc -----------------------------
+ We save the `\mathcode` of `\int` to `\_intop` using `\Umathchardef` and
+ declare Unicode character `\int` as math-active and define it
+ as `\_intop\_nolimits`. We define `\intop` as `\_intop` for users
+ (intergral with normal limits).
+ We do this with other int-like operators listed below too.
+ \_cod -----------------------------
+
+\_def\_intwithnolimits#1{\_ifx#1\_relax \_else
+ \_ea\_Umathcharnumdef\_csname _\_csstring#1op\_endcsname=\_Umathcodenum#1%
+ \_ea\_def \_csname\_csstring#1op\_ea\_endcsname\_ea{\_csname _\_csstring#1op\_endcsname}%
+ \_bgroup \_lccode`\~=#1 \_lowercase{\_egroup
+ \_ea\_def\_ea~\_ea{\_csname _\_csstring#1op\_endcsname\_nolimits}\_mathcode`~="8000 }%
\_ea \_intwithnolimits \_fi
}
-\_intwithnolimits \int "0222B \iint "0222C \iiint "0222D
- \oint "0222E \oiint "0222F \oiiint "02230
- \intclockwise "02231 \varointclockwise "02232 \ointctrclockwise "02233
- \sumint "02A0B \iiiint "02A0C \intbar "02A0D \intBar "02A0E \fint "02A0F
- \pointint "02A15 \sqint "02A16 \intlarhk "02A17 \intx "02A18
- \intcap "02A19 \intcup "02A1A \upint "02A1B \lowint "02A1C \_relax "0
-
-\_protected\_def \vert {\_Udelimiter 0 1 "07C }
-\_protected\_def \Vert {\_Udelimiter 0 1 "02016 }
-\_protected\_def \Vvert {\_Udelimiter 0 1 "02980 }
+\_intwithnolimits \int \iint \iiint \oint \oiint \oiiint
+ \intclockwise \varointclockwise \ointctrclockwise \sumint \iiiint \intbar \intBar \fint
+ \pointint \sqint \intlarhk \intx \intcap \intcup \upint \lowint \_relax
\_protected\_def \_overbrace #1{\_mathop {\_Umathaccent 7 1 "023DE{#1}}\_limits}
\_protected\_def \_underbrace #1{\_mathop {\_Umathaccent bottom 7 1 "023DF{#1}}\_limits}
@@ -274,7 +285,6 @@
\_global\_Umathcode "22EF = 0 1 "22EF % mathclass says that it is Rel
\_global\_Umathcode "002E = 0 1 "002E % mathclass says that dot is Punct
-\_global\_Umathchardef \unicodecdots = 0 1 "22EF
\_global\_Umathcode `/ = 0 1 `/ % mathclass says that / is Bin, Plain TeX says that it is Ord.
@@ -451,6 +461,9 @@ for technical details about Unicode-math.
\_endinput
History:
+2022-11-20 \mathfence's get delimiter code too
+2022-11-18 Delimiters re-implemented
+2022-11-17 \Umathchardef replaced by \chardef
2022-07-20 \Umathcode for copyright declared
2022-02-22 \rm, \bf etc. moved to font-select, \_marm, \_mabf etc. introduced
2022-02-08 several wide math accents added
diff --git a/Master/texmf-dist/tex/optex/base/math-unicode.opm b/Master/texmf-dist/tex/optex/base/unimath-macros.opm
index 22db1d095e1..96f87a6a9b3 100644
--- a/Master/texmf-dist/tex/optex/base/math-unicode.opm
+++ b/Master/texmf-dist/tex/optex/base/unimath-macros.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \loadmath {Unicode Math fonts <2022-07-22>} % preloaded in format
+\_codedecl \loadmath {Unicode Math fonts <2022-12-01>} % preloaded in format
\_doc -----------------------------
\`\loadmath` `{<Unicode-math font>}` loads the given font. It does:
@@ -66,16 +66,18 @@
math families (5, 6, 7, etc.) in the \^`\normalmath` macro.
\nl
The default value of \^`\_normalunimath` shows a combination of base Unicode-math
- font with 8bit Math font at family 4. See definition of `\script` macro where
+ font at family 1 with 8bit Math font at family 4. See definition of `\script` macro where
`\fam4` is used.
\_cod -----------------------------
\_def\_normalunimath{%
+ \_setmathfamily 0 \_tenrm % font for non-math objects in math mode
\_loadumathfamily 1 {\_unimathfont}{} % Base font
\_loadmathfamily 4 rsfs % script
\_setunimathdimens
}%
\_def\_boldunimath{%
+ \_setmathfamily 0 \_tenbf % font for non-math objects in math mode
\_ifx\_unimathboldfont \_undefined
\_loadumathfamily 1 {\_unimathfont}{embolden=1.7;} % Base faked bold
\_else
@@ -117,14 +119,10 @@
The `<font features>` are added to the default
\`\_mfontfeatures` and to the size-dependent features `ssty=1`
if script size is asked or `ssty=2` if scriptscriptsize is asked.\nl
- \`\_mparams``<number>` inserts additional font feature `nomathparam`
- if the <number> of the family is greater than 3. Lua\TeX/ sets math
- parameters (thickness of fraction rules etc., see section 7.4 in Lua\TeX/
- documentation) repeatedly from loaded math
- fonts if `nomathparam` is not given. We want to load these parameters only
- from fonts at families 0--3 (and actually we are using only family 1 as main math font).\nl
- The \^`\_corrmsize` `<factor><space>` can be used just before
- `\_loadumathfamily`, see section~\ref[math-preload] for more information.\nl
+ \`\_mparams` can insert additional font features
+ dependig on the current `\_mfam`.\nl
+ The \^`\_mfactor` `<family><space>` sets scaling factor,
+ see section~\ref[math-preload] for more information.\nl
The \`\_textmff`, \`\_scriptmff` and \`\_sscriptmff` are font
features for text, script and sscript sizes respectively. They are
locally re-defined in \^`\mathbox` macro.
@@ -133,16 +131,16 @@
\_def\_umathname#1#2{"#1:\_mfontfeatures#2"}
\_def\_mfontfeatures{mode=base;script=math;}
-\_def\_loadumathfamily #1 #2#3 {%
- \_font\_mF=\_umathname{#2}{\_textmff \_mparams{#1}#3} at\_sizemtext \_textfont #1=\_mF
- \_font\_mF=\_umathname{#2}{\_scriptmff \_mparams{#1}#3} at\_sizemtext \_scriptfont #1=\_mF
- \_font\_mF=\_umathname{#2}{\_sscriptmff\_mparams{#1}#3} at\_sizemtext \_scriptscriptfont#1=\_mF
- \_ptmunit=\_ptunit
+\_def\_loadumathfamily{\_afterassignment\_loadumathfamilyA \_chardef\_mfam}
+\_def\_loadumathfamilyA #1#2 {\_mfactor
+ \_font\_mF \_umathname{#1}{\_textmff \_mparams #2} at\_sizemtext \_textfont \_mfam=\_mF
+ \_font\_mF \_umathname{#1}{\_scriptmff \_mparams #2} at\_sizemtext \_scriptfont \_mfam=\_mF
+ \_font\_mF \_umathname{#1}{\_sscriptmff\_mparams #2} at\_sizemtext \_scriptscriptfont\_mfam=\_mF
}
\_def\_textmff {ssty=0;mathsize=1;}
\_def\_scriptmff {ssty=1;mathsize=2;}
\_def\_sscriptmff{ssty=2;mathsize=3;}
-\_def\_mparams#1{\_ifnum#1>3 nomathparam;\_fi}
+\_def\_mparams{}
\_doc -----------------------------
Unicode math font includes all typical math alphabets together, user needs not to
@@ -210,6 +208,8 @@
\~`\normalmath` and \~`\boldmath` macros. Note that allocationos using
\^`\newfam` starts from 43 because numbers 1--42 are reserved for direct
usage without \^`\newfam`.
+ We use \^`\aheadto` here because we want to read the main family 1 as
+ last one (for definitive setting of math parameters).
\_cod -----------------------------
\_def\_addUmathfont #1#2#3#4#5#6{% #1: fam (will be set), #2#3: normal font, #4#5: bold font
@@ -217,11 +217,12 @@
\_else \_isfont{#2}\_iffalse \_opwarning{font #2 is unavailable}%
\_else
\_newfam#1\_relax
- \_global\_addto\_normalmath{\_corrmsize#6 \_loadumathfamily #1 {#2}{#3} }%
+ \_sdef{_mfactor:\_the\_numexpr#1\_relax}{#6}%
+ \_global\_aheadto\_normalmath{\_loadumathfamily #1{#2}{#3} }%
\_ifx\_relax#4\_relax
- \_global\_addto\_boldmath{\_corrmsize#6 \_loadumathfamily #1 {#2}{embolden=1.7;} }%
+ \_global\_aheadto\_boldmath{\_loadumathfamily #1{#2}{embolden=1.7;} }%
\_else
- \_global\_addto\_boldmath{\_corrmsize#6 \_loadumathfamily #1 {#4}{#5} }%
+ \_global\_aheadto\_boldmath{\_loadumathfamily #1{#4}{#5} }%
\_fi
\_normalmath
\_wterm{add-MATH-FONT: #1=\the#1, "#2", \ifx"#4"\else bold: "#4"\fi}%
@@ -229,27 +230,58 @@
}
\_doc -----------------------------
- \`\resetmathchars` `<fam> <list of sequences> ;`
- saves <fam> to \`\_mafam` and applies \`\_resetmathcharsX`
- to each sequence from <list of sequences>.
+ \`\mathchars` `<fam> {<list of sequences>}`
+ saves <fam> to \`\_mafam` and runs for each sequence from the <list of sequences>
+ the relevant code settings.
The `\directlua` chunk prints the 8-digits hexadecimal code of the
- sequence followed by the sequence itself. The digts are scanned by \`\_resetmathcharsY`
- and new `\Umathchardef` and `\Umathcode` is declared. Note that the used
+ sequence followed by the sequence itself. The digts are scanned by \`\_mathcharsB`
+ and new `\Umathcode` is declared.\nl
+ If there exist \_d:<sequence> (i.e.\ it is delimiter) then `\Udelcode` is
+ redeclared too. Finally, in case of `\int`-like operators the
+ `\_intop` sequence is redeclared by `\Umathchardef`. Note that the used
primitives have the syntax:
\begtt \catcode`<=13
- \Umathchardef <sequence> <math class> <math family> <slot number>
- \Umathcode <code> <math class> <math family> <slot number>
+ \Umathchardef <sequence> = <math class> <math family> <slot number>
+ \Umathcode <code> = <math class> <math family> <slot number>
+ \Udelcode <code> = <math family> <slot number>
\endtt
\_cod -----------------------------
-\_def\_resetmathchars #1{\_chardef\_mafam=#1\_relax \_xargs \_resetmathcharX}
-\_def\_resetmathcharX#1{\_ea\_resetmathcharY
- \_directlua{tex.print(string.format("\_pcent08X", \_the#1))}#1}
-\_def\_resetmathcharY#1#2#3#4#5#6#7#8#9{% #9 is given \math-sequence
- \_Umathchardef #9\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8
- \_Umathcode "#4#5#6#7#8=\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8
+\_def\_mathchars {\_afterassignment\_mathcharsA \_chardef\_mafam=}
+\_def\_mathcharsA #1{\_foreach #1\_do{%
+ \_ifcsname _d:\_csstring##1\_endcsname \_ea \_mathcharsD \_csname _d:\_csstring##1\_endcsname
+ \_else \_mathcharsC ##1\_fi
+}}
+\_def\_mathcharsC #1{\_ea\_mathcharsB
+ \_directlua{tex.print(string.format("\_pcent08X", \_the\_Umathcode#1))}#1%
}
-\_public \addUmathfont \resetmathchars ;
+\_def\_mathcharsB #1#2#3#4#5#6#7#8#9{% #9 is given \math-sequence
+ \_ifcsname _\_csstring#9op\_endcsname
+ \_ea \_Umathchardef \_csname _\_csstring#9op\_endcsname=1 \_mafam #9\_relax
+ \_else
+ \_Umathcode "#4#5#6#7#8=\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8
+ \_fi
+}
+\_def\_mathcharsD #1{\_mathcharsC #1\_relax \_Udelcode #1=\_mafam #1\_relax}
+
+ \_doc -----------------------------
+ \`\mathcodes` `<fam> {<list of pairs>}` sets mathcodes of given
+ characters with explicit <class>es. Each pair can be `<class>{<list of chars>}`
+ and `<list of chars>` can include \`\Urange` `<from>-<to>`.
+ This is reason why we apply `\expanded` to the `<list of chars>`
+ before reading it by \^`\foreach`: the \^`\Urange` is expandable
+ and expands to the relevant list of characters.
+ \_cod -----------------------------
+
+\_def\_mathcodes{\_afterassignment\_mathcodesA\_chardef\_mafam=}
+\_def\_mathcodesA#1{%
+ \_foreach #1\_do ##1##2{%
+ \_ea\_foreach\_expanded{##2}\_do{\_Umathcode `####1=##1\_mafam`####1}%
+ }%
+}
+\_def\_Urange #1-#2{\_fornum `#1..`#2\_do{\_Uchar##1 }}
+
+\_public \addUmathfont \mathchars \mathcodes \Urange ;
\_endcode
@@ -286,31 +318,55 @@ Example:
\addUmathfont \xits {[XITSMath-Regular]}{} {[XITSMath-Bold]}{} {}
\endtt
%
-declares `latinmodern-math` as main math font (its bold variant is \"faked bold")
-and the additional math font `\xits` is `XITSMath-Regular` for normal
-printing and `XITSMath-Bold` for bold printing.
+declares `latinmodern-math` as main math font (its bold variant is \"faked bold").
+The additional math font family `\xits` is declared in the example. It uses
+`XITSMath-Regular` for normal printing and `XITSMath-Bold` for bold printing.
-All characters used in math formula is printed from main math font by
-default. But you can redeclare a list of characters for printing from
-additional font by \^`\resetmathchars` `\famname <list of sequences> ;`. For
+All characters used in math formula are printed from main math font by
+default. But you can re-declare characters for printing from
+additional font by \^`\mathchars` `\famname {<list of sequences>}`. For
example:
\begtt
-\resetmathchars \xits \stareq \triangleq \veeeq \wedgeq ;
+\mathchars \xits {\stareq \triangleq \veeeq \wedgeq}
\endtt
%
sets the characters `\stareq`, `\triangleq`, `\veeeq`, `\wedgeq` from
-the `\xits` additional font. You can see all possible sequences by
-`\input print-unimath.opm`.
-If you want to use whole math alphabet from additional math font, use
-`\addto\selector{\fam\famname}`, for example `\addto\cal{\fam\xits}`
+the `\xits` additional font. The <list of sequences> can include
+control sequences from the `unicode-table.tex`, but no math
+accents. These contol sequences can be printed by `\input print-unimath.opm`.
+
+The \^`\mathchars` macro keeps the class and slot of declared math objects
+and re-declares only family of them. It is applied to all control
+sequences given in the parameter. The relevant math codes are re-declared.
+
+Use `\addto\selector{\fam\famname}` if you want to print whole math alphabet
+from an additional math font. For example `\addto\cal{\fam\xits}`
declares all `\cal` characters from the `\xits` font loaded by
\^`\addUmathfont`.
+The \^`\mathcodes` macro provides comfortable settings of math codes of math
+objects. Its syntax is \^`\mathcodes` `<family> {<list-of-pairs>}`. Each pair
+in the <list-of-pairs> is `<class-number><character>` (separated by optional
+space) or `<class-number>{<list-of-characters>}`. The <list-of-characters>
+includes declared characters or \^`\Urange` `<from>-<to>` which is equal to the
+list of characters beginning <from> and ending <to>, for example
+`\Urange a-d` is equal to `abcd`.
+
+The \^`\mathcodes` macro declares mathcode of given characters internally by
+\begtt \catcode`<=13
+\Umathcode `<character> = <class-number> <family> `<character>
+\endtt
+
+The \^`\mathcodes` macro sets math codes of given Unicode characters.
+The relevant control sequence from `unicode-table.tex` changes its
+behavior too. For example, If you change math code of × then the
+`\times` control sequence will behave like new declared ×.
+
\secc Unicode-math macros preloaded in the format
-\printdoc math-unicode.opm
+\printdoc unimath-macros.opm
\secc[unimath-codes] Macros and codes set when `\loadmath` is processed firstly
@@ -329,6 +385,11 @@ the section~\ref[math-macros].
\_endinput
+2022-12-01 reading number by \_loadumathfamily more robust
+2022-11-18 \mathchars improved, \Udelcodes are set too, \addUmathfont uses \ahead
+2022-11-17 \Umathchardef replaced by \chardef
+2022-11-16 \resetmathchars removed, \mathchars, \mathcodes introduced
+2022-11-13 \_setfontfamily 0 added.
2022-07-22 \Umathspaceafterscript setting added.
2022-06-10 \addUmathfont and \resetmathchars added.
2021-08-16 \_loadumathfamily simplified, used mathsize= font feature.
diff --git a/Master/texmf-dist/tex/optex/base/verbatim.opm b/Master/texmf-dist/tex/optex/base/verbatim.opm
index 201dc66fd9e..ac00369d337 100644
--- a/Master/texmf-dist/tex/optex/base/verbatim.opm
+++ b/Master/texmf-dist/tex/optex/base/verbatim.opm
@@ -138,7 +138,7 @@
}
\_ea\_def\_ea\_startverb \_ea#\_ea1\_csstring\\endtt#2^^J{%
\_prepareverbdata\_tmpb{#1^^J}%
- \_ea\_printverb \_tmpb\_end
+ \_ea\_printverb \_tmpb\_fin
\_par \_restoremathsb
\_endgroup \_ttskip
\_isnextchar\_par{}{\_noindent}%
@@ -172,10 +172,10 @@
\_ifx\_printverblinenum\_relax \_else \_incr\_ttline \_fi
\_testcommentchars #1\_relax\_relax\_relax
\_iftrue
- \_ifx\_end#2\_printcomments\_fi
+ \_ifx\_fin#2\_printcomments\_fi
\_else
\_ifx\_vcomments\_empty\_else \_printcomments \_def\_vcomments{}\_fi
- \_ifx\_end#2%
+ \_ifx\_fin#2%
\_bgroup \_adef{ }{}\_def\t{}% if the last line is emtpy, we don't print it
\_ifcat&#1&\_egroup \_ifx\_printverblinenum\_relax \_else \_decr\_ttline \_fi
\_else\_egroup \_printverbline{#1}\_fi
@@ -183,7 +183,7 @@
\_printverbline{#1}%
\_fi
\_fi
- \_unless\_ifx\_end#2\_afterfi{\_printverb#2}\_fi
+ \_unless\_ifx\_fin#2\_afterfi{\_printverb#2}\_fi
}
\_def\_printverbline#1{\_putttpenalty \_indent \_printverblinenum \_kern\_ttshift #1\_par}
\_def\_initverblinenum{\_tenrm \_thefontscale[700]\_ea\_let\_ea\_sevenrm\_the\_font}
@@ -274,7 +274,7 @@
\_repeat
\_ea\_prepareverbdata \_ea \_tmpb\_ea{\_tmpb^^J}%
\_catcode`\ =10 \_catcode`\%=9 % used in \commentchars comments
- \_ea\_printverb \_tmpb\_end
+ \_ea\_printverb \_tmpb\_fin
\_ttlinesave
\_par \_restoremathsb
\_endgroup
diff --git a/Master/texmf-dist/tex/optex/pkg/math.opm b/Master/texmf-dist/tex/optex/pkg/math.opm
new file mode 100644
index 00000000000..5b0f29dd2f9
--- /dev/null
+++ b/Master/texmf-dist/tex/optex/pkg/math.opm
@@ -0,0 +1,639 @@
+% This is macro package used by OpTeX, see http://petr.olsak.net/optex
+% math.opm, Petr Olšák <petr@olsak.net>, 2022
+% This file can serve as an template for other package files
+% See end of the file for more information
+
+\_def\_math_version {0.02, 2022-11-26}
+\_codedecl \replacemissingchars {Doing math more comfortable <\_math_version>}
+\_namespace{math}
+
+ \_doc
+ \`\bigp`, \`\Bigp`, \`\biggp`, \`\Biggp`, \`\autop`, \`\normalp` are inspired from
+ \tricklink[bigp]{0094}
+ \_cod
+
+\_def\.bigp #1{\.fparam{#1}\_bigl\_bigr}
+\_def\.Bigp #1{\.fparam{#1}\_Bigl\_Bigr}
+\_def\.biggp#1{\.fparam{#1}\_biggl\_biggr}
+\_def\.Biggp#1{\.fparam{#1}\_Biggl\_Biggr}
+\_def\.autop#1{\.fparam{#1}\_left\_right}
+\_def\.normalp#1{\.fparam{#1}\_relax\_relax}
+\_def\.fparam#1#2#3{%
+ \_isequal .{#1}\_iffalse #1\_fi
+ \_let\.bigleft=#2\_let\.bigright=#3\_nospacefuturelet\.next\.fparamA}
+\_def\.fparamA{%
+ \_ifx\.next(\.afterrelax{\.fparamB()}\_fi
+ \_ifx\.next[\.afterrelax{\.fparamB[]}\_fi
+ \_ifx\.next\{\.afterrelax{\.fparamB\{\}}\_fi
+ \_ifx\.next\_bgroup \_def\.lparen{\{}\_def\.rparen{\}}\.afterrelax{\.fparamC}\_fi
+ \_relax
+}
+\_def\.fparamB#1#2{%
+ \_def\.lparen{#1}\_def\.rparen{#2}%
+ \_def\.next#1##1#2{\_trick_ensurebalanced#1#2\.fparamC{##1}}%
+ \.next
+}
+\_def\.fparamC#1{%
+ \_ifx\.bigleft\_left \_mathopen{}\_fi
+ \.bigleft\.lparen{#1}\.bigright\.rparen
+ \_ifx\.bigright\_right \_mathclose{}\_fi
+}
+\_def\.afterrelax#1#2\_relax{\_fi#1}
+
+\_nspublic \bigp \Bigp \biggp \Biggp \autop \normalp ;
+
+ \_doc
+ We need macro \`\.ensurebalanced` for balancing nested parentheses from
+ \tricklink[balancing]{0043}. We use `trick` namespace for these macros.
+ \_cod
+
+\_resetnamespace{trick}
+ \_def\.ensurebalanced#1#2#3{\_immediateassigned{%
+ \_def\.balopen{#1}\_def\.balclose{#2}\_let\.balaction=#3%
+ \_def\.readnextbal##1##2#2{\.ensurebalancedA{##1#2##2}}}%
+ \.ensurebalancedA}
+ \_def\.ensurebalancedA#1{\.isbalanced#1%
+ \_iftrue\_afterfi{\.balaction{#1}}\_else\_afterfi{\.readnextbal{#1}}\_fi}
+ \_def\.isbalanced#1\_iftrue{\_immediateassignment\_tmpnum=0 \.isbalancedA#1{\.isbalanced}}
+ \_def\.isbalancedA#1#{\.countbalanced#1\.isbalanced \.isbalancedB}
+ \_def\.isbalancedB#1{%
+ \_ifx\.isbalanced#1\_afterfi{\_cs{ifnum}\_tmpnum=0 }\_else\_ea\.isbalancedA\_fi}
+ \_def\.countbalanced#1{\_ea\_ifx\.balopen #1\_immediateassignment\_incr\_tmpnum\_fi
+ \_ea\_ifx\.balclose#1\_immediateassignment\_decr\_tmpnum\_fi
+ \_ifx\.isbalanced#1\_else\_ea\.countbalanced\_fi}
+\_resetnamespace{math}
+
+ \_doc
+ \`\smartdots` re-sets `\dots` to `\.dots`.
+ The `\.dots` lets `\.next` using `\futurelet` and checks the `\.next`:
+ It it is declared by `\_chardef` then `\.mchar` is the real Unicode character
+ with `\chardef`ed code.
+ If `\.next` is a real Unicode character then `\.mchar` includes it. This
+ is done by the expandable \o`\cstochar` macro provided by \OpTeX/.
+ If `\.next` is something else (i.e.\ `\.mchar` is empty) then print
+ \o`\ldots` else print \o`\cdots` for Op, Bin, Rel, Open, Close math
+ classes of the `\.next` math object or prints \o`\ldots` in other cases.
+ \_cod
+
+\_def\.smartdots {\_let\dots=\.dots}
+\_def\.dots{\_relax \_ifmmode \_ea\.specdots \_else \_dots \_fi}
+\_def\.specdots{\_futurelet\.next\.specdotsA}
+\_def\.specdotsA{%
+ \.ischardef\.next\_iftrue \_edef\.mchar{\_Uchar\.next}%
+ \_else \_edef\.mchar{\_cstochar\.next}%
+ \_fi
+ \_ifx\.mchar\_empty \_ldots
+ \_else \_Umathcharnumdef\.next=\_Umathcode\_ea`\.mchar \_relax
+ \_ifcase \.readclass\.next
+ \_ldots\_or \_cdots\_or \_cdots\_or \_cdots\_or \_cdots\_or \_cdots \_else \_ldots \_fi
+ \_fi
+}
+\_def\.ischardef #1\_iftrue {\_ea\.ischardefA\_meaning#1\_fin}
+\_def\.ischardefA #1#2#3#4#5#6\_fin {\_def\.tmpa{#1#2#3#4#5}\_ifx\.tmpa\.stringchar}
+\_edef\.stringchar{\_string\char}
+\_def\.readclass#1{\_ea\.readclassA\_meaning#1\_fin}
+\_def\.readclassA#1"#2"#3\_fin{#2}
+
+\_nspublic \smartdots ;
+
+ \_doc
+ \`\smartvert` sets `|` as math-active charcter and declares it
+ equal to `\.autovert` macro. This macro checks two variants: there
+ is single `|` or there is double `||`. It runs \`\.autovertA` or
+ \`\.autoVertA`. These macros find the closing `|` or `||` and use
+ `|` or `‖` in context of `\left`, `\right`. The \`\singlevert`
+ is declared here if a user want to use a single vertical bar.
+ \_cod
+
+\_newpublic \_mathchardef \_singlevert=\_mathcode`|
+\_def\.autovert {\_isnextchar|{\.autoVertA}{\.autovertA}}
+\_def\.autovertA #1|{\_mathopen{}\_mathclose{\_left|#1\_right|}}
+\_def\.autoVertA|#1||{\_mathopen{}\_mathclose{\_left‖#1\_right‖}}
+\_bgroup \_lccode`\~=`\| \_lowercase{\_egroup
+ \_def\.smartvert{\_let~=\.autovert \_mathcode`|="8000 }}
+
+\_nspublic \smartvert ;
+
+ \_doc
+ The control sequences \`\N`, \`\Z`, \`\Q`, \`\R`, \`\C`
+ \`\sgn`, \`\argmin`, \`\argmax`, \`\grad`, \`\rank`, \`\tr`, \`\diag`, \`\Span`,
+ \`\Rng`, \`\Null`, \`\Ker`, \`\Res`, \`\tg`, \`\arctg`,
+ \`\frac`, \`\dfrac`, \`\tfrac`, \`\.`
+ are defined directly in the user space by \o`\_newpublic`.
+ \_cod
+
+\_newpublic\_def \N {{\_bbchar N}}
+\_newpublic\_def \Z {{\_bbchar Z}}
+\_newpublic\_def \Q {{\_bbchar Q}}
+\_newpublic\_def \R {{\_bbchar R}}
+\_newpublic\_def \C {{\_bbchar C}}
+
+\_newpublic\_def \sgn {\_mathop{\_rm sgn}\_nolimits}
+\_newpublic\_def \argmin {\_mathop{\_rm argmin}}
+\_newpublic\_def \argmax {\_mathop{\_rm argmax}}
+\_newpublic\_def \grad {\_mathop{\_rm grad}\_nolimits}
+\_newpublic\_def \rank {\_mathop{\_rm rank}\_nolimits}
+\_newpublic\_def \tr {\_mathop{\_rm tr}\_nolimits}
+\_newpublic\_def \diag {\_mathop{\_rm diag}\_nolimits}
+\_newpublic\_def \Span {\_mathop{\_rm Span}\_nolimits}
+\_newpublic\_def \Rng {\_mathop{\_rm Rng}\_nolimits}
+\_newpublic\_def \Null {\_mathop{\_rm Null}\_nolimits}
+\_newpublic\_def \Ker {\_mathop{\_rm Ker}\_nolimits}
+\_newpublic\_def \Res {\_mathop{\_rm Res}\_nolimits}
+\_newpublic\_def \tg {\_mathop{\_rm tg}\_nolimits}
+\_newpublic\_def \arctg {\_mathop{\_rm arctg}\_nolimits}
+
+\_newpublic\_def \frac #1#2{{{#1}\_over#2}}
+\_newpublic\_def \dfrac #1#2{{\_displaystyle{{#1}\_over#2}}}
+\_newpublic\_def \tfrac #1#2{{\_textstyle{{#1}\_over#2}}}
+
+\_newpublic\_def \.#1{{\_bf#1}}
+
+ \_doc
+ The \`\toright` and \`\toleft` macros are based on the
+ \o`\setpos` and \o`\posx` macros. The printing point is shifted by `\posx`
+ to the left (i.e.\ to the left boundary of the sheet) and then it is shifted
+ to the desired space by `\kern\hoffset+\hsize`.
+ This idea is moved from \tricklink[torighteq]{0028}.
+ \_cod
+
+\_newcount \.tomarginno
+\_def\.toright #1{\_incr\.tomarginno {\_setpos[_math_tr:\_the\.tomarginno]%
+ \_rlap{\_kern-\_posx[_math_tr:\_the\.tomarginno]\_kern\_hoffset\_kern\_hsize\_llap{#1}}}}
+\_def\.toleft #1{\_incr\.tomarginno {\_setpos[_math_tr:\_the\.tomarginno]%
+ \_rlap{\_kern-\_posx[_math_tr:\_the\.tomarginno]\_kern\_hoffset\_rlap{#1}}}}
+
+\_nspublic \toright \toleft ;
+
+ \_doc
+ The \`\subeqmark` works because the internal \O`\_thednum`
+ is re-defined. The \`\.dnumpost` is added here. If you want to use another format
+ for \O`\_thednum` then you have to add the \`\.dnumpost` to it too.
+ \_cod
+
+\_def \_thednum {(\_the\_dnum \.dnumpost)}
+\_def\.dnumpost{}
+\_def\.subeqmark #1{\_def\.dnumpost{#1}\_lowercase{\_ifx a#1}\_else \_decr\_dnum\_fi \_eqmark}
+
+\_nspublic \subeqmark ;
+
+ \_doc
+ \`\textvariables`, \`\textdigits`, \`\textmoremath` initialize
+ new two families 5, 6 using `\.textmathini` and sets `\mathcode`s
+ of given characters to these families.
+ Moreover, `\textvariables` adds `\fam` register setting to `\rm` and `\it`
+ selectors and re-set Greek variables to use only math font (because we
+ are not sure if Greek letters are in the current text fonts).
+ \_cod
+
+\_def\.textmathini{%
+ \_fontdef\.mathrm{\_rm}\_fontdef\.mathit{\_it}%
+ \_fontdef\.mathbf{\_bf}\_fontdef\.mathbi{\_bi}%
+ \_addto\_normalmath{%
+ \_setmathfamily 5 \.mathrm
+ \_setmathfamily 6 \.mathit
+ }%
+ \_addto\_boldmath{%
+ \_setmathfamily 5 \.mathbf
+ \_setmathfamily 6 \.mathbi
+ }%
+ \_normalmath
+ \_let\.textmathini=\_relax
+}
+\_def\.textvariables {\.textmathini \_mathcodes 6 {7{\_Urange a-z \_Urange A-Z}}%
+ \_addto\_marm {\_fam5 }\_addto\_mait{\_fam6 }%
+ \_protected\_def\_itgreek {\_umathrangegreek01\_greekita}%
+ \_protected\_def\_rmgreek {\_umathrangegreek01\_greekrma}%
+ \_protected\_def\_itGreek {\_umathrangeGREEK01\_greekitA \_setnablait}
+ \_protected\_def\_rmGreek {\_umathrangeGREEK01\_greekrmA \_setnablarm}
+ \_itgreek \_rmGreek
+}
+\_def\.textdigits {\.textmathini \_mathcodes 5 {7{\_Urange 0-9}}}
+\_def\.textmoremath {\.textmathini
+ \_mathcodes 5 {5{!?} 2{*+-} 3{=<>} 6{,:;} 0{./|} 4{([\{} 5{\})]}}%
+ \_Umathcode `- = 2 5 "2212 % hyphen behaves like minus in math mode
+}
+\_nspublic \textvariables \textdigits \textmoremath ;
+
+ \_doc
+ \`\replacemissingchars``<family>` defines `\UnicodeMathSymbol` and reads
+ `unimath-table.opm`, i.e.\ it does for each math character following
+ if the character is missing in main math font and if it is present in
+ added font and if it is not already replaced character then apply new math
+ code or `\Umathaccent` definition. Its name is added to `\.alist` or
+ `\.clist`. The new codes are declared by `\matchars<family>{<expanded>\clist}`.
+ The `\.rlist` is the list of characters already replaced. They are not
+ replaced again if a new `\replacemissingchars` is used.
+ \_cod
+
+\_def\.rlist{}
+\_def\.replacemissingchars#1{%
+ \_def\.alist{}\_def\.clist{}
+ \_def\UnicodeMathSymbol##1##2##3##4{%
+ \_iffontchar\_textfont1##1 \_else % not in main math font
+ \_iffontchar\_textfont#1 ##1 % is presnet in added font
+ \_isinlist\.rlist{##2}\_iffalse % not already replaced
+ \_ifx##3\_mathaccent
+ \_protected\_def##2{\_Umathaccent fixed 7 #1 ##1 }%
+ \_addto\.alist{##2}%
+ \_else
+ \_addto\.clist{##2}%
+ \_fi\_fi\_fi\_fi
+ }
+ \_input unimath-table.opm
+ \_wlog{^^J\_string\replacemissingchars: From \_string\fam=\_string#1 is printed now:^^J%
+ CHARACTERS: \.clist^^JACCENTS: \.alist^^J}%
+ \_ea\_mathchars \_expanded{\_noexpand#1{\.clist}}%
+ \_edef\.rlist{\.rlist\.clist\.alist}%
+ \_def\.alist{}\_def\.clist{}\_let\UnicodeMathSymbol=\_undefined
+}
+\_nspublic \replacemissingchars ;
+
+ \_doc
+ \`\scriptspaces``{<s-rel>}{<s-bin>}{<ss-rel>}{<ss-bin>}`
+ sets internal \LuaTeX/ registers represented by
+ appropriate primitives, see section 7.5 in the \LuaTeX/ manual.
+ \_cod
+
+\_def\.scriptspaces #1#2#3#4{%
+ \_Umathordrelspacing\_scriptstyle=\.orzeromu{#1}\_relax
+ \_Umathrelordspacing\_scriptstyle=\.orzeromu{#1}\_relax
+ \_Umathordrelspacing\_crampedscriptstyle=\.orzeromu{#1}\_relax
+ \_Umathrelordspacing\_crampedscriptstyle=\.orzeromu{#1}\_relax
+ \_Umathordbinspacing\_scriptstyle=\.orzeromu{#2}\_relax
+ \_Umathbinordspacing\_scriptstyle=\.orzeromu{#2}\_relax
+ \_Umathordbinspacing\_crampedscriptstyle=\.orzeromu{#2}\_relax
+ \_Umathbinordspacing\_crampedscriptstyle=\.orzeromu{#2}\_relax
+ \_Umathordrelspacing\_scriptscriptstyle=\.orzeromu{#3}\_relax
+ \_Umathrelordspacing\_scriptscriptstyle=\.orzeromu{#3}\_relax
+ \_Umathordrelspacing\_crampedscriptscriptstyle=\.orzeromu{#3}\_relax
+ \_Umathrelordspacing\_crampedscriptscriptstyle=\.orzeromu{#3}\_relax
+ \_Umathordbinspacing\_scriptscriptstyle=\.orzeromu{#4}\_relax
+ \_Umathbinordspacing\_scriptscriptstyle=\.orzeromu{#4}\_relax
+ \_Umathordbinspacing\_crampedscriptscriptstyle=\.orzeromu{#4}\_relax
+ \_Umathbinordspacing\_crampedscriptscriptstyle=\.orzeromu{#4}\_relax
+}
+\_def\.orzeromu#1{\_ifx^#1^0mu\_else#1\_fi}
+
+\_nspublic \scriptspaces ;
+
+\_endnamespace
+\_endcode
+
+\sec Summary
+
+This package provides various extensions usable for math typesetting. Mostly
+of them are inspired from
+\ulink[http://petr.olsak.net/optex/optex-tricks.html]{\OpTeX/ tricks} www page.
+
+The following macros are defined in this package:
+\begitems
+* \~`\bigp`, \~`\Bigp`, \~`\biggp`, \~`\Biggp`, \~`\autop`, \~`\normalp`
+ gives better controlling of sizes of parentheses.
+* \~`\smartdots` declares `\dots` macro more intelligent.
+ \~`\smartvert` declares \"`|`" for better spacing.
+* There are many common math macros for sets or for operators, for example
+ \~`\R` or \~`\sgn`.
+* \~`\toright`, \~`\toleft` puts the \o`\eqmark` to desired position,
+ \~`\subeqmark` prints the given suffix as a part of the equation mark.
+* \~`\scriptspaces` sets more spaces around rel, bin in script and scripscript styles.
+* \~`\textvariables`, \~`\textdigits`, \~`\textmoremath`
+ enables characters from used text font in math mode
+ (variables, digits, more characters).
+* \~`\replacemissingchars` allows to re-declare all characters missing in math font
+ for printing them from additional math font.
+\enditems
+
+This package is not definitive. I plan to add more features in new versions
+if needed. Moreover, this package gives an example for package writers how
+to write their own packages, see section~\ref[pkgtemplate].
+
+\sec Controlled sizes of parentheses
+
+If you write `$f(x(y+z))$` then the outer parentheses should be bigger.
+Classical Plain \TeX/ provides macros \O`\bigl`, \O`\bigr`, etc., they can
+be used in this manner: `$f\bigl(x(y+z)\bigr)$`. But the source file looks
+bad with such markup. Better is to say that parentheses have to be bigger
+using a single prefix before functional symbol, i.e. `$\bigp f(x(y+z))$`.
+This should be print the same as previous example with \O`\bigl`, \O`\bigr`.
+
+The prefixes \^`\bigp` (big pair), \^`\Bigp` (Big pair),
+\^`\biggp` (bigg pair) and \^`\Biggp` (Bigg pair) are provided,
+they can be used before a functional symbol. The scaled parentheses
+surrounding the functional parameter can be (...) or [...] or `\{`...`\}` or
+\{...\}. I.e.\ `\Bigp\Gamma [x]` is the same as `\Gamma \Bigl[x\bigr]`.
+Moreover, the functional parameter gets its own \TeX/ group, so
+`\Bigp G(a\over2)` results to `G\Bigl({a\over2}\bigr)`.
+There are two more prefixes \^`\autop` and \^`\normalp`. First one applies
+`\left`, `\right` to the parentheses of the parameter, second one keeps
+the parentheses unscaled. If you want to scale the parentheses without
+preceding functional symbol then use dot instead this symbol, for example
+`\Bigp.(a)` is equal to `\Bigl(a\Bigr)`.
+
+Examples:
+\begtt
+$$
+ \displaylines{
+ \Biggp F (1+\biggp g (1+\Bigp f(1+\bigp f(1+f(x))))) \cr
+ f(x(y+z)),\quad \bigp f(x(y+z)),\quad \autop f (a\over b)\cr
+ \Bigp f(a\over b+c),\quad \Bigp f(x^2\over2),\quad \Bigp.(a\over b)
+ }
+$$
+\endtt
+gives:
+$$
+ \displaylines{
+ \Biggp F (1+\biggp g (1+\Bigp f(1+\bigp f(1+f(x))))) \cr
+ f(x(y+z)),\quad \bigp f(x(y+z)),\quad \autop f (a\over b)\cr
+ \Bigp f(a\over b+c),\quad \Bigp f(x^2\over2),\quad \Bigp.(a\over b)
+ }
+$$
+
+\sec Intelligent `\dots` like in AMS\TeX
+
+AMS\TeX/ provides \o`\dots` macro which works depending on the context. If it is surrounded
+by symbols like $+$, $-$, $=$ then it works like \o`\cdots`, if it is surrounded by
+comma or similar symbols then it works like \o`\ldots`.
+This package keeps \o`\dots` unchanged but it is changed (and behaves as
+mentioned above) after the \^`\smartdots` declaration.
+
+\smartdots
+You can try this after the \^`\smartdots` declaration:
+\medskip
+
+`$a_1, a_2, \dots, a_n$ ` prints $a_1, a_2, \dots, a_n$,
+
+`$a_1 + a_2 + \dots + a_n$ ` prints $a_1 + a_2 + \dots + a_n$,
+
+
+\sec Using vertical bars with better spacing
+
+The character \"`|`" is declared with Ord class by default in Plain \TeX/,
+but we are using it typically in the context `$|x|$`. It means there should
+be Open and Close classes. This example gives correct result but try to use
+`$|-1|$` which gives bad spacing: $|-1|$.
+And `$||x||$` gives bad result too.
+
+When you declare \^`\smartvert`, these problems are solved. Moreover, the
+\"`|`" or \"`||`" are expected to be always in pairs and they are scaled by
+`\left` and `\right` primitives automatically. If you don't want to use it
+in a pair, use \^`\singlevert` or `\big|`, or `\Big|` etc. Compare
+the result of `$|\sum a_n|+||x||$`:
+$$
+ \eqalign{
+ |\sum a_n|+||x|| &\quad \hbox{if \scantextokens{`\smartvert`} isn't initialized,}\cr
+ \smartvert
+ |\sum a_n|+||x|| &\quad \hbox{if \scantextokens{`\smartvert`} is initialized.}
+ }
+$$
+
+\sec Basic and typical macros for sets, functions etc.
+
+These typical macros are defined in `math.opm`:
+\^`\N` for $\N$, \^`\Z` for $\Z$, \^`\Q` for $\Q$, \^`\R` for $\R$, \^`\C` for $\C$,
+\^`\sgn`, \^`\argmin`, \^`\argmax`, \^`\grad`, \^`\rank`, \^`\tr`, \^`\diag`, \^`\Span`, \^`\Rng`,
+\^`\Null`, \^`\Ker`, \^`\Res`, \^`\tg`, \^`\arctg`.
+
+I hate the \^`\frac`, \^`\dfrac` and \^`\tfrac` macros defined in \LaTeX/
+but someone may want to use them. This package defines them.
+But I note: usage of `$1\over2$` for $1\over2$
+is much more understandable than \LaTeX's `$\frac12$`.
+
+The vectors and matrices are ususally printed by `{\bf A}{\bf x}`.
+The package provides a shortcut `\.<letter>` to do the same, so user can write
+`\.A\.x` for multiplication of a matrix $\.A$ by a vector $\.x$.
+We strictly don't recommend usage of `\.`, `\v`, `\=`, etc.\ for accents, so
+`math.opm` can define `\.` differently than the classical meaning \"dotaccent".
+
+\sec Equation marks in atypical cases
+
+We want to put equation marks `\eqmark` in more lines in display mode when we
+are using macros not designed for such case. For example in the lines of
+the `\cases` macro:
+
+\begtt
+$$ f(x) = \cases{0 & for $x<0$\toright\eqmark \cr
+ 1 & otherwise\toright\eqmark } $$
+\endtt
+This puts the equation marks to the right margin in each line generated by
+the `\cases` macro.
+$$ f(x) = \cases{0 & for $x\string<0$\toright\eqmark \cr
+ 1 & otherwise\toright\eqmark }
+$$
+The \^`\toright`\o`\eqmark` is used here. Analogically,
+\^`\toleft`\o`\eqmark` puts the equation mark to the left margin.
+The position of these marks are correct after second or more \TeX/ run
+because \TeX/ needs to read data from its previous run in this case.
+
+Sometime we want to declare a bunch of equations with the same numeric
+equation marks but with different suffixes, for example (1.1a), (1.1b). We
+provide the macro \^`\subeqmark``<suffix>` here.
+If `<suffix>` is `a` or `A` then \^`\subeqmark` starts a new bunch of
+equations with the next number. Following `\subeqmark b`, `\subeqmark c`,
+etc.\ use the same equation number, they differ only by given suffixes:
+You can put `[<label>]` after `<suffix>` for referencing purposes.
+Example:
+
+\begtt
+$$\adef~{\kern.5em }
+ \eqalignno{
+ x + 2y + 3z &= 600 & \subeqmark a \cr
+ 12x + ~y - 3z &= -7 & \subeqmark b[label] \cr
+ 4x - ~y + 5z &= ~5 & \subeqmark c \cr
+ }
+$$
+The equation~\ref[label] has negative right side. Moreover, it applies
+$$
+ a^2 + b^2 = c^2. \eqmark
+$$
+\endtt
+prints
+$$\adef~{\kern.5em }
+ \eqalignno{
+ x + 2y + 3z &= 600 & \subeqmark a \cr
+ 12x + ~y - 3z &= -7 & \subeqmark b[label] \cr
+ 4x - ~y + 5z &= ~5 & \subeqmark c \cr
+ }
+$$
+The equation~\ref[label] has negative right side. Moreover, it applies
+$$
+ a^2 + b^2 = c^2. \eqmark
+$$
+
+\sec Setting more spaces in script styles
+
+Classical \TeX/ puts \n`\thickmuskip` around relations and \n`\medmuskip` around
+binary operators only in \n`\textstyle` and \n`\displaystyle`. These spaces are
+missing in \n`\scripstyle` and \n`\scriptscriptstyle`. It means that we get, for
+example
+$$
+ \sum_{i=j+1}^\infty a_i
+$$
+The formula $i=k+1$ has no spaces here, so it looks unattractive. \LuaTeX/
+provides better control of all such spaces, so `math.opm` declares the macro
+\^`\scriptspaces``{<s-rel>}{<s-bin>}{<ss-rel>}{<ss-bin>}` for setting
+these spaces. <s-rel> is \"muskip" value used around relations in \n`\scriptstyle`,
+<s-bin> is \"muskip" used around binary operators in \n`\scriptstyle` and the
+last two parameters gives these spacing in \n`\scriptscriptstyle`.
+If a parameter is empty, it means that it has zero value.
+For example after `\scriptspaces {2mu}{1.3mu}{}{}`
+the formula mentioned above looks like
+$$
+ \scriptspaces {2mu}{1.3mu}{}{}
+ \sum_{i=j+1}^\infty a_i
+$$
+It looks better, doesn't it?
+
+\sec Variables and digits from currently used text font
+
+When Unicode math font is loaded then all variables and digits are printed
+from it in math mode. If you are using text fonts with another visual
+concept then you can see a differences when you use digits in text mode and in
+math mode. You can specify \^`\textdigits` if you want to use digits from
+current text `\rm` font in math and \^`\textvariables` if you want to use
+variables from current text `\it` font in math.
+You can set printing of
++−*/=<>\{([])\} from text `\rm` font in math by \^`\textmoremath`.
+You can inspire from the \^`\textmoremath` macro and set more similar
+characters from text font.
+
+You have to load a text font family (using \o`\fontfam` for example) first and
+use \^`\textdigits`, \^`\textvariables`, \^`\textmoremath` after it. This is
+due to these macros reads {\em current} text \o`\rm` and \o`\it` fonts and set
+them to math printing.
+
+Note that we cannot avoid a visual incompatibility of parentheses when they
+are use in the context \n`\left`, \n`\right`. These parentheses must be printed
+from math font always because text font is unable to create bigger versions of
+them.
+
+\sec Replacing all missing math characters from another font
+
+If we load an additional math font by \o`\addUmathfont`, for example:
+\begtt
+\addUmathfont \xits {[XITSMath-Regular]}{} {[XITSMath-Bold]}{} {}
+\endtt
+then we can re-declare the code of arbitrary math character in such a way
+that it is printed from this additional font. It can be done by \o`\mathchars`
+provided by \OpTeX/, for example:
+\begtt
+\mathchars \xits {\leftdasharrow \updasharrow \rightdasharrow \downdasharrow}
+\endtt
+But this method enables to re-declare only selected characters. Maybe, you
+want to re-declare {\em all} Unicode math characters which are missing in the main font.
+This can be done by \^`\replacemissingchars`\,`<family>` provided by the
+`math.opm`. For example
+\begtt
+\replacemissingchars \xits
+\endtt
+replaces all characters missing in the main font by characters from the
+`\xits` declared by previous \o`\addUmathfont`.
+The names of all replaced characters are printed in log file.
+If the additional math font doesn't provide all Unicode math characters
+then you can load a next additional math font using another \o`\addUmathfont` and do
+\^`\replacemissingchars`\,`<family>` again. Only those characters not replaced
+by previous steps are replaced.
+
+
+\sec[pkgtemplate] General recommendation for writing packages
+
+This section has nothing common with the subject of this package but this package
+can serve as inspiration for another package writers. It should be a template
+for another `<pkg>.opm` files. We emphasize several principles here.
+The basic information can be found in
+\ulink[https://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf\#ref:prefixed]
+{section 2.2} of the \OpTeX/ manual.
+Try to run\fnote{Run it three times because Table of contents and Index are created.}
+\begtt
+optex -jobname math-doc '\docgen math'
+\endtt
+for creating this documentation. You can see (from the log file) that the
+`math.opm` is read four times during this process. First one is due to
+\o`\docgen`~`math`. It skips the part before \o`\_endcode` and searches the
+following {`\_doc...\_cod`} pair in the file and processes it (see the end
+of the file `math.opm`). The macros and main instruction about generating
+toc, index, etc.\ are here. First instruction is \o`\load``[doc,math]` which
+initializes `doc` mode of \OpTeX/ and loads `math.opm` secondly because we
+want to show some effects provided by this package. Then there is
+\o`\printdoctail`~`math.opm` which loads the `math.opm` again and prints the
+documentation starting from \o`\_endcode`. Finally, there is
+\o`\printdoc`~`math.opm` which prints the codes mixed by the documentation
+text inside pairs {`\_doc...\_cod`}. This causes the fourth loading of the
+`math.opm` file.
+
+The first part of the `math.opm` file looks like:
+\begtt \catcode`\<=13 \adef!{\string}
+% Optional comments
+
+\_def\_<pkg>_version {<version-number>, <version-date>}
+\_codedecl \pkgsequence {Doing the life more comfortable !<\_<pkg>_version>}
+\_namespace{<pkg>}
+\endtt
+The `\_<pkg>_version` macro should be declared here. The macro should expand
+to version number followed by version date. User can check
+the package version simply by expanding this macro after the package is
+loaded. And we want to have this data only at single place of the file.
+You may check the log file if the text given by `\_codedecl` isn't too long
+and isn't broken to more lines. Keeping single line is better because users can
+`grep @:` on log file in order to get information of all loaded packages
+and their version numbers.
+
+The \o`\_namespace``{<pkg>}` opens the name space used by your package where all
+`\.foo` are internally transformed to `\_<pkg>_foo`. Next part of the file
+includes the code itself documented in {`\_doc...\_cod`} pairs. It is
+finished by \o`\_endnamespace` which finalizes the scope where `\.foo` are
+transformed to `\_<pkg>_foo` and by \o`\_endcode` which does \n`\endinput` when
+the macros are load. Final part of the file after \o`\_endcode` can include
+more detailed documentation.
+
+If you have any idea of creating a macro package, you probably start with
+experimental macros in user name space. It means that there are
+`\def\mymacro` etc. Once such a code is working, you can include it to the
+macro package introduced by \o`\_namespace``{<pkg>}`. You have to go through
+your code carefully sequence per sequence and insert `_` or `.` in front of
+their name. The \"`_`" have to be used if the sequence is a primitive or
+\OpTeX/ macro and the \"`.`" if it is your macro. So, the code fragment
+`\def\mymacro` have to be rewritten to `\_def\.mymacro`. If the macro
+`\mymacro` is intended for usage in the user space, then append
+`\_nspublic \mymacro ;` too.
+
+Sometimes you may want to define a macro only for user space. Then
+use prefix \O`\_newpublic` before your declaration, see declaration of
+ \^`\sgn` in this package as an exampe. The reason is: if
+a user has defined such a macro already then the warning is printed.
+The user can read this warning and declare the macro after
+`\load[<pkg>]` in this case.
+
+ \_doc
+ \load [doc,math]
+ \def\opurl{http://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf}
+ \def\tnurl{http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf}
+ \def\trurl{http://petr.olsak.net/optex/optex-tricks.html}
+ \def\tricklink[#1]#2{\ea\ulink \ea[\trurl\##1]{\OpTeX/ trick #2}}
+ \def\exlink#1#2{\ea\ulink\expanded{[#2\csstring#1]{\hbox{\tt\string#1\,}}}}
+ \def\o`#1`{\exlink#1{\opurl\#cs:^}}
+ \def\O`#1`{\exlink#1{\opurl\#cs:}}
+ \def\n`#1`{\exlink#1{\tnurl\#cs:}}
+ \outlines 0
+
+ \tit Macros for doing math more comfortable
+ \hfill Version: \_math_version \par
+ \centerline{\it Petr Olšák\/\fnotemark1, 2022}
+ \fnotetext{\url{https://petr.olsak.net}}
+
+ \notoc\nonum\sec Table of contents
+ \maketoc
+ \printdoctail math.opm % prints the documantation written after \_endcode
+ \sec Implementation
+ \printdoc math.opm % prints \_doc...\_cod parts + code before \_endcode
+ \nonum\sec Index
+ \begmulti 3
+ \tt \makeindex % prints index in three columns
+ \endmulti
+ \bye
+ \_cod
+
+\endinput
+
+0.02, 2022-11-26: \smartvert introduced
+0.01, 2022-11-25: released
diff --git a/Master/texmf-dist/tex/optex/pkg/mte.opm b/Master/texmf-dist/tex/optex/pkg/mte.opm
index e0687001d6d..0c8b22152a4 100644
--- a/Master/texmf-dist/tex/optex/pkg/mte.opm
+++ b/Master/texmf-dist/tex/optex/pkg/mte.opm
@@ -2,7 +2,8 @@
% mte.opm, Petr Olšák <petr@olsak.net>, 2021
% See end of the file for more information
-\_codedecl \enablemte {MicroTypographic Extension <2021-05-23>}
+\_def \_mte_version {0.1, 2021-05-23}
+\_codedecl \enablemte {MicroTypographic Extension <\_mte_version>}
\_namespace{mte}
\_doc -------------------
@@ -608,6 +609,7 @@
\_endcode
\tit MicroTypographic Extensions for \OpTeX/
+\hfill v. \_mte_version
\centerline{\it Petr Olšák, 2021}
\bigskip
@@ -680,6 +682,30 @@ that a specific font family needs different microtypographic data, please
let me know. I can add extra definitions to appropriate font family
file.
-\_endinput
+\_doc
+ % Run optex -jobname mte-doc '\docgen mte'
+ % (two times) to generate documentation including references and the index.
+
+ \load [doc]
+
+ \def\elink[#1]#2{%
+ \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf\#cs:#1]%
+ {\tt\string#2}%
+ }
+ \def\olink[#1]#2{%
+ \ulink[http://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf\#cs:#1]%
+ {\tt\string#2}%
+ }
+
+ \printdoctail mte.opm
+ \printdoc mte.opm
-Use "optex mte-doc.tex" (twice) to generate documentation from this file.
+ \nonum\sec Index
+ \begmulti 3
+ \tt \makeindex
+ \endmulti
+
+ \bye
+\_cod
+
+\_endinput