diff options
author | Karl Berry <karl@freefriends.org> | 2024-02-14 21:31:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-02-14 21:31:38 +0000 |
commit | a4c1d1a1e418ee73c93150594d94bb80c5455ec8 (patch) | |
tree | e2968ee69d63bffbf5f3fb81ef116ac73b083bb7 /Master/texmf-dist | |
parent | 0ac73e799c615f6509cd7f86227d602f16ca1a76 (diff) |
optex (14feb24)
git-svn-id: svn://tug.org/texlive/trunk@69861 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
32 files changed, 696 insertions, 94 deletions
diff --git a/Master/texmf-dist/doc/optex/base/README b/Master/texmf-dist/doc/optex/base/README index 3dab8b68f15..aa84d46627b 100644 --- a/Master/texmf-dist/doc/optex/base/README +++ b/Master/texmf-dist/doc/optex/base/README @@ -22,6 +22,11 @@ doc/ ... PDF version of the OpTeX documentation and sources. History: +<1.14> Feb 2024: + More links in doc: TeX primitives linked to TeX in a Nutshell. + \trykv returns unexpanded value of the key=value pair. + \bracedparam reimplemented, improved. + \optdef can create an expandable macro. <1.13> Nov 2023: \usebib completely reimplemented, libranian package not needed from now. Selected OpTeX tricks are automatically loaded when a relevant macro is used. diff --git a/Master/texmf-dist/doc/optex/base/optex-doc.pdf b/Master/texmf-dist/doc/optex/base/optex-doc.pdf Binary files differindex aebe78c6343..731b1ab1795 100644 --- a/Master/texmf-dist/doc/optex/base/optex-doc.pdf +++ b/Master/texmf-dist/doc/optex/base/optex-doc.pdf diff --git a/Master/texmf-dist/doc/optex/base/optex-doc.tex b/Master/texmf-dist/doc/optex/base/optex-doc.tex index d780ceeeefb..eb0fcc56825 100644 --- a/Master/texmf-dist/doc/optex/base/optex-doc.tex +++ b/Master/texmf-dist/doc/optex/base/optex-doc.tex @@ -21,9 +21,9 @@ \tit Format Based on Plain \TeX/ and OPmac\fnotemark1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\hfill Version 1.13 +\hfill Version 1.14 -\centerline{\it Petr Olšák, 2020, 2021, 2022, 2023} +\centerline{\it Petr Olšák, 2020, 2021, 2022, 2023, 2024} \bigskip \centerline{\url{http://petr.olsak.net/optex}} @@ -65,7 +65,7 @@ The main goal of \OpTeX/ is: If you need to customize your document or you need to use something very specific, then you can copy relevant parts of \OpTeX/ macros into your macro file and do changes to these macros here. This is a significant difference from -\LaTeX/ or ConTeXt, which is an attempt to create a new user level with a +\LaTeX/ or \ConTeXt/, which is an attempt to create a new user level with a plenty of non-primitive parameters and syntax hiding \TeX/ internals. The macros from \OpTeX/ are simple and straightforward because they solve only what is explicitly needed, they do not create a new user level for @@ -113,13 +113,28 @@ document \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf] \nonum\chap Index \noindent -There are all control sequences used in \OpTeX/ except \TeX/ primitives. -If you want to know something about \TeX/ primitives then you can use another index from -\ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf\#ref:index]{\TeX/ in a Nutshell}. +Control sequences declared by \OpTeX/ have page list here and they are +internal links to their main documentation point. \TeX/ primitives used by +\OpTeX/ have no page list here and they are external links to +\ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf]{\TeX/ in a Nutshell} +to the place where the primitive is briefly described. +%Only primitives used in \OpTeX/ macros are listed here. There are much more +%primitives implemented in \LuaTeX/, see +%\ulink[https://www.pragma-ade.com/general/manuals/luatex.pdf]{\LuaTeX/ manual}, +%section \"primitives". % active links directly to the main documentation point but not to the pages: -\def\_printii #1&{\noindent\hskip-\iindent \link[cs:#1]\Blue{\bslash #1} } +\def\_printii #1&{% + \noindent\hskip-\iindent + \ea\ifx \csname,#1\endcsname \empty % primitive + \_dest[cs:#1]% main documentation point for primitives is in the Index + \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf\#cs:#1]{\bslash#1} + \ea\ea\ea\nopages + \else \link[cs:#1]\Blue{\bslash #1} % OpTeX macro + \fi +} \def\_pgprintA #1{#1} +\def\nopages#1&{*\_par} \begmulti 3 \tt \makeindex \endmulti \bye diff --git a/Master/texmf-dist/doc/optex/base/optex-techdoc.tex b/Master/texmf-dist/doc/optex/base/optex-techdoc.tex index 78156194047..894f2d8cd3f 100644 --- a/Master/texmf-dist/doc/optex/base/optex-techdoc.tex +++ b/Master/texmf-dist/doc/optex/base/optex-techdoc.tex @@ -5,6 +5,7 @@ % (three times) to create whole documentation including all references and the index. \load [doc.opm] +\input primitives \thisoutline {TECHNICAL DOCUMENTATION} diff --git a/Master/texmf-dist/doc/optex/base/optex-userdoc.tex b/Master/texmf-dist/doc/optex/base/optex-userdoc.tex index 61157b0d31d..c99e63c21d0 100644 --- a/Master/texmf-dist/doc/optex/base/optex-userdoc.tex +++ b/Master/texmf-dist/doc/optex/base/optex-userdoc.tex @@ -1896,7 +1896,7 @@ tests, if the current point is at odd page regardless of asynchronous processing \tpg[perpage]\t\incrpp. \t\thepp, \t\thepplast, \t\truepage\ does per-page counting of objects. -\tpg[keystrokes]\t\keystoke\ +\tpg[keystrokes]\t\keystroke\ prints given text in a keystroke-like frame. \tpg[longtable]\t\longtable\ @@ -1905,15 +1905,21 @@ alows to break a table to more pages and repeates header. \tpg[lot]\t\makeLOF, \t\makeLOT, \t\captionF, \t\captionT\ create list of tables and list of figures similar to \^`\maketoc`. +\tpg[onlyifnew]\t\onlyifnew\ +only define a macro if it is not already defined. + +\tpg[pgforeground]\t\pgforeground\ +adds material to the foreground of each page. + \tpg[linnum]\t\pstart, \t\pend\ dispalys line numbers of the marked text in the margin. -\tpg[shadedframe]\t\shadedframe\ -colored rectangular frames with simple shadows. - \tpg[roundframe]\t\roundframe\ colored frames with rounded corners and many options. +\tpg[shadedframe]\t\shadedframe\ +colored rectangular frames with simple shadows. + \tpg[scaleto]\t\scaleto, \t\scaletof\ text font size changed to the desired width. @@ -2072,8 +2078,8 @@ documentation. 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. - See also \~`\iskv`, \~`\readkv`, \~`\kvx`, \~`\nokvx`.\nl +\~`\kv` `{<key>}` expands to a value given by key=value. + See also \~`\trykv`, \~`\iskv`, \~`\readkv`, \~`\kvx`, \~`\nokvx`.\nl \^`\loop` `...` \^`\repeat` is classical Plain \TeX/ loop.\nl \^`\mathstyles`` {<math list>}` enables to create macros dependent on current math style.\nl \~`\_namespace`` {<pkg>}` declares name space used by package writers.\nl diff --git a/Master/texmf-dist/doc/optex/base/primitives.tex b/Master/texmf-dist/doc/optex/base/primitives.tex new file mode 100644 index 00000000000..11ced8bca16 --- /dev/null +++ b/Master/texmf-dist/doc/optex/base/primitives.tex @@ -0,0 +1,387 @@ +%% This is part of the OpTeX project, see http://petr.olsak.net/optex + +% There is a list of TeX primitives used by OpTeX, they are printed in the Index. + +\def\addprimitive#1{\_ea\addprimitiveA \_csname,\_csstring#1\_endcsname} +\def\addprimitiveA#1{\ifx#1\relax\_addto\_iilist#1\fi \_gdef#1{}} +\def\_intlink{\_link[cs:\_tmpa]{\choosecolor}{\_csstring\\\_tmpb}} +\def\choosecolor{\_ea\ifx\csname,\_tmpa\endcsname\empty \primcolor\else\ulinkcolor\fi} +\def\primcolor{\setcmykcolor{.7 0 .7 .5}} + +\xargs\addprimitive +%\above +\abovedisplayshortskip +\abovedisplayskip +%\abovewithdelims +\accent +\adjdemerits +\advance +\afterassignment +\aftergroup +\atop +\atopwithdelims +\attributedef +\baselineskip +%\batchmode +\begingroup +\belowdisplayshortskip +\belowdisplayskip +\binoppenalty +%\botmark +\box +\boxmaxdepth +\breakafterdirmode +\brokenpenalty +%\catcode +\catcodetable +\char +\chardef +\cleaders +\closein +\closeout +\clubpenalty +\copy +\countdef +\cr +\crampeddisplaystyle +\crampedscriptstyle +\crampedscriptscriptstyle +\crampedtextstyle +\crcr +\csname +\csstring +\day +\def +\defaulthyphenchar +\defaultskewchar +\delcode +\delimiter +\delimiterfactor +\delimitershortfall +\detokenize +\dimen +\dimendef +\dimexpr +\directlua +\discretionary +%\displaylimits +\displaystyle +\displaywidowpenalty +\displaywidth +\divide +\doublehyphendemerits +\dump +\edef +%\efcode +\else +\emergencystretch +\end +\endcsname +\endgroup +\endinput +\endlinechar +\eqno +\errmessage +\errorcontextlines +%\errorstopmode +\escapechar +\everycr +\everydisplay +\everyeof +%\everyhbox +\everyjob +\everymath +\everypar +%\everyvbox +\exhyphenpenalty +\expandafter +\expanded +\fi +\finalhyphendemerits +\firstmark +\floatingpenalty +\font +\fontdimen +\fontname +\futurelet +\gdef +\glet +\global +\globaldefs +\halign +\hangafter +\hangindent +\hbadness +\hbox +\hfil +\hfill +%\hfilneg +\hfuzz +\hoffset +\hrule +\hsize +\hskip +\hss +\hyphenation +\hyphenchar +\hyphenpenalty +\if +\ifcase +\ifcat +\ifcsname +\ifdim +\ifeof +\iffalse +%\ifhbox +\ifhmode +\ifinner +\ifmmode +\ifnum +\ifodd +\iftrue +%\ifvbox +\ifvmode +\ifvoid +\ifx +\ignorespaces +\immediate +\immediateassigned +\immediateassignment +\indent +\input +\inputlineno +\interlinepenalty +\jobname +\kern +%\knaccode +%\knbccode +%\knbscode +\language +\lastbox +\lastnamedcs +\lastpenalty +\lastskip +\lccode +\leaders +\left +\lefthyphenmin +\leftskip +\leqno +\let +%\letterspacefont +\limits +\linepenalty +\lineskip +\lineskiplimit +\long +%\looseness +\lower +\lowercase +%\lpcode +\luaescapestring +\mag +\mark +\mathaccent +\mathbin +\mathchar +\mathchardef +\mathchoice +\mathclose +\mathcode +\matheqdirmode +\mathop +\mathopen +\mathord +\mathpunct +\mathrel +\mathsurround +\maxdepth +\meaning +\medmuskip +\message +\middle +\mkern +\month +\moveleft +\moveright +\mskip +\multiply +\muskip +\muskipdef +\newlinechar +\noalign +\noexpand +\noindent +\nolimits +\nonscript +%\nonstopmode +\nulldelimiterspace +\nullfont +\number +\numexpr +\omit +\openin +\openout +\outer +\output +\outputmode +\outputpenalty +\over +\overfullrule +%\overwithdelims +\par +\parfillskip +\parindent +%\parshape +\parskip +\patterns +%\pdfadjustinterwordglue +%\pdfadjustspacing +\pdfcatalog +%\pdfcolorstack +\pdfdest +\pdfendlink +\pdfextension +\pdffeedback +%\pdffontexpand +\pdfhorigin +\pdfinfo +\pdflastximage +\pdflastxpos +\pdflastypos +\pdfliteral +%\pdfnormaldeviate +\pdfoutline +\pdfpageheight +\pdfpagewidth +%\pdfprotrudechars +\pdfrefximage +\pdfrestore +\pdfsave +\pdfsavepos +\pdfsetmatrix +%\pdfsetrandomseed +\pdfstartlink +%\pdfstrcmp +%\pdfuniformdeviate +\pdfvariable +\pdfvorigin +\pdfximage +\penalty +\postdisplaypenalty +\predisplaypenalty +\pretolerance +\prevdepth +\prevgraph +\protected +\protrudechars +\radical +\raise +\read +\relax +\relpenalty +\right +\righthyphenmin +\rightskip +\romannumeral +\root +%\rpcode +\savecatcodetable +\scantextokens +\scantokens +\scriptfont +\scriptscriptfont +\scriptscriptstyle +\scriptstyle +%\scrollmode +\setbox +\sfcode +%\shbscode +\shipout +\show +\showbox +\showboxbreadth +\showboxdepth +\showlists +\showthe +\skewchar +\skip +\skipdef +\spacefactor +\spaceskip +\span +%\special +\splitmaxdepth +\splittopskip +\sqrt +%\stbscode +\string +\suppressfontnotfounderror +\tabskip +\textfont +\textstyle +\the +\thickmuskip +\thinmuskip +\time +\toks +\toksdef +\tolerance +%\topmark +\topskip +\tracingassigns +\tracingcommands +\tracinggroups +\tracingifs +\tracinglostchars +\tracingmacros +\tracingonline +\tracingoutput +\tracingpages +\tracingparagraphs +\tracingrestores +\tracingscantokens +\tracingstats +\uccode +\Uchar +\uchyph +\Udelcode +\Udelimiter +\Umathaccent +\Umathchar +\Umathchardef +\Umathcode +\unexpanded +\unhbox +\unhcopy +\unless +\unpenalty +\unskip +\unvbox +\unvcopy +\uppercase +\Uradical +\vadjust +\valign +\vbadness +\vbox +\vcenter +\vfil +\vfill +\vfilneg +\vfuzz +\voffset +\vrule +\vsize +\vskip +\vsplit +\vss +\vtop +\wd +\widowpenalty +\write +\xdef +%\xleaders +\xspaceskip +\year +; diff --git a/Master/texmf-dist/tex/optex/base/alloc.opm b/Master/texmf-dist/tex/optex/base/alloc.opm index fae88d286ed..180adddeff4 100644 --- a/Master/texmf-dist/tex/optex/base/alloc.opm +++ b/Master/texmf-dist/tex/optex/base/alloc.opm @@ -120,19 +120,18 @@ \_newdimen \tmpdim \_newdimen \_tmpdim \_doc ----------------------------- - A few registers are initialized like in plain\TeX/. We absolutely + A few registers: \`\maxdimen`, \`\hideskip` and + \`\centering` are initialized like in plain\TeX/. We absolutely don't support the `@`category dance, so `\z@skip` - `\z@`, `\p@` etc. are defined but not recommended in \OpTeX/. - - The \`\_zo` and \`\_zoskip` (equivalents to `\z@` and `\z@skip`) - are declared here and used in some internal macros of \OpTeX/ - for improving speed. + `\z@`, `\p@` etc. are defined but not recommended. + The \`\_zo`, \`\_zoskip` and \`\voidbox` (equivalents to + `\z@`, `\z@skip` and `\voidb@x`) are preferred in \OpTeX. \_cod ----------------------------- \_newdimen\_maxdimen \_maxdimen=16383.99999pt % the largest legal <dimen> -\_newdimen\_zo \_zo=0pt \_newskip\_hideskip \_hideskip=-1000pt plus 1fill % negative but can grow \_newskip\_centering \_centering=0pt plus 1000pt minus 1000pt +\_newdimen\_zo \_zo=0pt \_newskip\_zoskip \_zoskip=0pt plus0pt minus0pt \_newbox\_voidbox % permanently void box register diff --git a/Master/texmf-dist/tex/optex/base/doc.opm b/Master/texmf-dist/tex/optex/base/doc.opm index fb96d35007e..c334019de29 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-12-11>} % loaded on demand by \load[doc] +\_codedecl \printdoc {Macros for documentation printing <2023-12-10>} % loaded on demand by \load[doc] \_doc ----------------------------- General decalarations. @@ -41,8 +41,6 @@ \_doc ----------------------------- The listing mode is implemented here. The \`\maxlines` is maximal lines of code printed in the listing mode. - The \code{\\catcode`\\.=11} sets dot as letter in listngs (for package - documentation where `\.foo` sequeces exist). \_cod ----------------------------- \_newcount \_maxlines \_maxlines=100000 @@ -54,7 +52,7 @@ \_typosize[8/10] \_let\_printverbline=\_printcodeline \_ttline=\_inputlineno - \_setverb \_catcode`\.=11 + \_setverb \_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}% @@ -88,7 +86,8 @@ the first `_` or `.` is removed from `\_tmpa` and the test is repeated. \_cod ----------------------------- -\_def\_makecs{\_def\_tmpa{}\_futurelet\_next\_makecsA} +\_def\_makecs{\_def\_tmpa{}\_futurelet\_next\_makecsD} +\_def\_makecsD{\_if.\_next \_ea\_makecsB \_else \_ea\_makecsA \_fi} % \.foo is accepted \_def\_makecsA{\_ifcat a\_noexpand\_next \_ea\_makecsB \_else \_ea\_makecsF \_fi} \_def\_makecsB#1{\_addto\_tmpa{#1}\_futurelet\_next\_makecsA} \_def\_makecsF{\_let\_tmpb=\_tmpa @@ -363,6 +362,7 @@ have the same meaning: `\optexdoclink` in this example. And \endinput +2023-12-10 \catcode`.=11 removed, issue solved by \_makecsD. 2022-12-11 \_opwaning "Second main documentation point" introduced. 2022-12-11 \_docrefcodes added (bug due to 2022-11-13 fixed). 2022-11-21 magenta color for internal links instead green. diff --git a/Master/texmf-dist/tex/optex/base/f-fbb.opm b/Master/texmf-dist/tex/optex/base/f-fbb.opm new file mode 100644 index 00000000000..ac69a89a992 --- /dev/null +++ b/Master/texmf-dist/tex/optex/base/f-fbb.opm @@ -0,0 +1,26 @@ +%% This is part of the OpTeX project, see http://petr.olsak.net/optex + +\_famdecl [fbb] \FBembo {Bembo–like fonts derived from Cardo} + {\caps \swash} {\rm \bf \it \bi} {} + {[fbb-Regular]} + {\_def\_fontnamegen {[fbb-\_currV]:script=latn;\_capsV\_swaV\_fontfeatures}} + +\_wlog{\_detokenize{% +Modifier:^^J + \caps ...... caps & small caps + old digits^^J + \swash ..... alternative Q letter and some other characters^^J +}} + +\_moddef \resetmod {\_fsetV caps={},swa={} \_fvars Regular Bold Italic BoldItalic } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } +\_moddef \swash {\_fsetV swa=+swsh;+salt; } + +\_initfontfamily % new font family must be initialized + +\_endcode + +See historical notice in texdoc fbb. + +See the file `f-heros.opm` for information about principles of such +font-macro-files. + diff --git a/Master/texmf-dist/tex/optex/base/f-gentium.opm b/Master/texmf-dist/tex/optex/base/f-gentium.opm new file mode 100644 index 00000000000..e6775695c23 --- /dev/null +++ b/Master/texmf-dist/tex/optex/base/f-gentium.opm @@ -0,0 +1,26 @@ +%% This is part of the OpTeX project, see http://petr.olsak.net/optex + +\_famdecl [Gentium] \Gentium {Serif free fonts, support Greek, Cyrillic, IPA} + {\caps} {\rm \bf \it \bi} {Termes} + {[GentiumPlus-Regular]} + {\_def\_fontnamegen {[Gentium\_bkV Plus-\_currV]:\_capsV\_fontfeatures}} + +\_wlog{\_detokenize{% +Modifiers:^^J + \caps ...... caps & small caps^^J + \book ...... Book variants (a little bolder)^^J +}} + +\_moddef \resetmod {\_fsetV caps={} \_fsetV bk={} \_fvars Regular Bold Italic BoldItalic } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } +\_moddef \book {\_fsetV bk=Book } + +\_initfontfamily % new font family must be initialized + +\_loadmath {[texgyretermes-math]} + +\_endcode + +See the file `f-heros.opm` for information about principles of such +font-macro-files. + diff --git a/Master/texmf-dist/tex/optex/base/fams-ini.opm b/Master/texmf-dist/tex/optex/base/fams-ini.opm index 6dc19ca9b1f..7d3f0332a83 100644 --- a/Master/texmf-dist/tex/optex/base/fams-ini.opm +++ b/Master/texmf-dist/tex/optex/base/fams-ini.opm @@ -107,6 +107,11 @@ \caps: {\rm\bf\it\bi} \caps\semibold: {\bf\bi} \caps\sans: {\rm\bf\it} -: {\mono\initials\displ\keybr} } +\_famfrom{Victor Gaultney} +\_faminfo [Gentium] {Serif free fonts, support Greek, Cyrrilic, IPA} {f-gentium} + { -,\caps,\book,\book\caps: {\rm\bf\it\bi} } +\_famalias [GentiumPro] + \_famfrom {Daniel Flipo} \_faminfo [KP fonts] {KP fonts -- Johannes Kepler project} {f-kpfonts} { -,\light,\sans,\mono, \caps, \caps\light, \caps\sans,\caps\mono,\swash: {\rm\bf\it\bi} } @@ -249,6 +254,11 @@ \_faminfo [GFSBodoni] {Based on Bodoni with greek letters} {f-gfsbodoni} { -: {\rm\bf\it\bi} \caps: {\rm} } +\_famfrom {David J. Perry, Michael Sharpe} +\_faminfo [fbb] {Bembo–like fonts derived from Cardo} {f-fbb} + { -,\caps: {\rm\bf\it\bi} \swash: {\rm} } +\_famalias [Bembo] \_famalias [FBembo] + \_famfrom {bBox Type GmbH, Carrois Corporate GbR, Edenspiekermann AG} \_faminfo [Fira] {Humanist sans-serif, originally designed for Firefox OS} {f-fira} { \thin,\light,\book,-,\medium,\mono,\mono\medium,% diff --git a/Master/texmf-dist/tex/optex/base/fonts-opmac.opm b/Master/texmf-dist/tex/optex/base/fonts-opmac.opm index 158f19299ea..ca4d38b4ce1 100644 --- a/Master/texmf-dist/tex/optex/base/fonts-opmac.opm +++ b/Master/texmf-dist/tex/optex/base/fonts-opmac.opm @@ -171,10 +171,12 @@ \_ea\_ifx \_the\_font \_tenbi \_additcorr \_bf \_else \_it \_aftergroup\_afteritcorr\_fi\_fi\_fi } -\_def\_additcorr{\_ifdim\_lastskip>\_zo - \_skip0=\_lastskip \_unskip\_italcorr \_hskip\_skip0 \_else\_italcorr \_fi} +\_def\_additcorr{\_ifhmode \_ifdim\_lastskip>\_zo + \_skip0=\_lastskip \_unskip \_additcorrA \_hskip\_skip0 \_else \_additcorrA \_fi\_fi} +\_def\_additcorrA{\_ifnum\_lastpenalty=\_zo \_italcorr \_else + \_ea\_unpenalty \_ea\_italcorr \_ea\_penalty \_the\_lastpenalty \_relax \_fi} \_def\_afteritcorr{\_futurelet\_next\_afteritcorrA} -\_def\_afteritcorrA{\_ifx\_next.\_else\_ifx\_next,\_else \_italcorr \_fi\_fi} +\_def\_afteritcorrA{\_ifhmode \_ifx\_next.\_else\_ifx\_next,\_else \_italcorr \_fi\_fi\_fi} \_let\_italcorr=\/ \_doc ----------------------------- @@ -218,6 +220,7 @@ \_endcode % ------------------------------------- History: +2024-01-25 \em: \_additcorr reimplemented to be more robust 2022-02-22 \_setmainvalues: only \rm initialized 2021-03-10 \boldify corrected 2021-03-09 \mfontsrule and \_setmathfonts introduced diff --git a/Master/texmf-dist/tex/optex/base/fonts-preload.opm b/Master/texmf-dist/tex/optex/base/fonts-preload.opm index 8562da786c6..82387970e68 100644 --- a/Master/texmf-dist/tex/optex/base/fonts-preload.opm +++ b/Master/texmf-dist/tex/optex/base/fonts-preload.opm @@ -24,14 +24,14 @@ \_endcode %--------------------------------------------------- The format in Lua\TeX/ can download only non-Unicode fonts. Latin Modern EC is -loaded here. These fonts are totally unusable in LuaTeX when languages with out +loaded here. These fonts are totally unusable in \LuaTeX/ when languages with out of ASCII or ISO-8859-1 alphabets are used (for example Czech). We load only a few 8bit fonts here especially for simple testing of the format. But, if the user needs to do more serious work, he/she can -use `\fontfam` macro to load a selected font family of Unicode fonts. +use \^`\fontfam` macro to load a selected font family of Unicode fonts. We have a dilemma: when the Unicode fonts cannot be preloaded in the format then the basic -font set can be loaded by `\everyjob`. But why to load a set of fonts at the +font set can be loaded by \^`\everyjob`. But why to load a set of fonts at the beginning of every job when it is highly likely that the user will load something completely different. Our decision is: there is a basic 8bit font set in the format (for testing purposes only) and the user should load diff --git a/Master/texmf-dist/tex/optex/base/fonts-resize.opm b/Master/texmf-dist/tex/optex/base/fonts-resize.opm index 323e1d72a0c..f4dd3c40339 100644 --- a/Master/texmf-dist/tex/optex/base/fonts-resize.opm +++ b/Master/texmf-dist/tex/optex/base/fonts-resize.opm @@ -5,7 +5,7 @@ \_doc ----------------------------- \`\initunifonts` macro extends \LuaTeX's font capabilities, in order to be able to load Unicode fonts. Unfortunately, this part of - \OpTeX/ depends on the `luaotfload` package, which adapts Con\TeX/t's generic + \OpTeX/ depends on the `luaotfload` package, which adapts \ConTeXt's generic font loader for plain \TeX/ and \LaTeX. `luaotfload` uses Lua functions from \LaTeX's `luatexbase` namespace, we provide our own replacements. \^`\initunifonts` sets itself to relax because we don't want to do @@ -62,7 +62,8 @@ The `\fontname` primitive returns the <font file name> optionally followed by <size spec>. The \`\xfontname` macro expands to <font file name> without <size spec>. We need to remove the part `<space>at<dimen>` from - `\fontname` output. The letters `at` have category 12. + `\fontname` output. The letters `at` have category 12 in the \`\_stringat` + macro. \_cod ----------------------------- \_edef\_stringat{\_string a\_string t} diff --git a/Master/texmf-dist/tex/optex/base/hyperlinks.opm b/Master/texmf-dist/tex/optex/base/hyperlinks.opm index 1d15b5e7341..7c3e78635aa 100644 --- a/Master/texmf-dist/tex/optex/base/hyperlinks.opm +++ b/Master/texmf-dist/tex/optex/base/hyperlinks.opm @@ -6,11 +6,12 @@ \`\dest``[<type>:<spec>]` creates a destination of internal links. The destination is declared in the format `<type>:<spec>`. If the \^`\hyperlinks` command in not used, then `\dest` does nothing else it is set to `\_destactive`. - The \`\_destactive` is implemented by `\_pdfdest` primitive. It creates a box + The \`\_destactive` is implemented by `\_pdfdest` primitive. It creates a + box using \`\_destbox``[<type>:<spec>]` in which the destination is shifted by \`\_destheight`. The reason is that the destination is exactly at the top border of the PDF viewer but we want to see - the line where the destination is. The destination box is positioned by a - different way dependent on the current vertical or horizontal mode. + the line where the destination is. The destination box is positioned + differently dependent on the current vertical or horizontal mode. \_cod ---------------------------- \_def\_destheight{1.4em} diff --git a/Master/texmf-dist/tex/optex/base/if-macros.opm b/Master/texmf-dist/tex/optex/base/if-macros.opm index 415b2c01c88..eae011ae260 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 <2023-10-17>} % preloaded in format +\_codedecl \newif {Special if-macros, is-macros and loops <2023-12-07>} % preloaded in format \_doc ---------------------------- \secc Classical \code{\\newif} @@ -95,8 +95,8 @@ \_immediateassignment \_long\_gdef\_fbody#2{\_testparam##1..\_iftrue #3\_ea\_fbody\_fi}% \_fbody #1#2\_finbody\_getforstack } -\_def\_testparam#1#2#3\_iftrue{\_ifx###1\_empty\_ea\_finbody\_else} -\_def\_finbody#1\_finbody{} +\_long\_def\_testparam#1#2#3\_iftrue{\_ifx###1\_empty\_ea\_finbody\_else} +\_long\_def\_finbody#1\_finbody{} \_long\_def\foreach #1\do#2#{\_isempty{#2}\_iftrue \_afterfi{\_foreachA{#1}{##1}}\_else\_afterfi{\_foreachA{#1}{#2}}\_fi} @@ -376,6 +376,7 @@ \_endcode +2023-12-07 \_testparam define \long (big fixed) 2023-10-17 \qcasesof introduced, \xcasesof reimplemented. 2023-01-16 \isnextchar created expandable. 2022-12-02 \xcasesof: its first parameter is \long too. diff --git a/Master/texmf-dist/tex/optex/base/keyval.opm b/Master/texmf-dist/tex/optex/base/keyval.opm index 68f3fea5369..645a3b33a56 100644 --- a/Master/texmf-dist/tex/optex/base/keyval.opm +++ b/Master/texmf-dist/tex/optex/base/keyval.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \readkv {Key-value dictionaries <2023-10-23>} % preloaded in format +\_codedecl \readkv {Key-value dictionaries <2023-11-24>} % preloaded in format \_doc ---------------------------- {\bf Implementation.}\nl @@ -12,8 +12,10 @@ <value> after it.\nl The \`\kvx``{<key>}{<code>}` defines the `\_kvx:<dict>:<key>#1` macro and \`\nokvx``{<code>}` defines the `\_nokvx:<dict>:<key>` macro.\nl - The \`\kv``{<key>}` expands the `\_kv:<dict>:<key>` macro. If this macro isn't - defined then \`\_kvunknown` is processed. You can re-define it if you want.\nl + The \`\trykv``{<key>}{<code>}` + returns unexpanded value of <key> if declared, else it runs <code>.\nl + The \`\kv``{<key>}` returns expanded value of <key> if declared, + else returns expanded value of `.notdef` key else expands \`\_kvunknown`.\nl The \`\iskv``{<key>}\iftrue` (or `\iffalse`) is the test, if the `<key>` is defined in current <dict>. \_cod ---------------------------- @@ -28,12 +30,14 @@ {\_trycs{_nokvx:\_the\_kvdict}{\_ea\_ignoreit}{#1}\_ea\_ignoreit}{#2}} \_def\_kvx#1#2{\_sdef{_kvx:\_the\_kvdict:#1}##1{#2}} \_def\_nokvx#1{\_sdef{_nokvx:\_the\_kvdict}##1\_ea\_ignoreit##2{#1}} -\_def\_kv#1{\_trycs{\_kvcs#1}{\_kvunknown}} +\_def\_trykv#1{\_ea\_trykvA \_begincsname\_kvcs#1\_endcsname \_ignoreit} +\_def\_trykvA#1{\_ifx #1\_ignoreit \_ea\_useit\_else \_unexpanded\_ea{#1}\_fi} +\_def\_kv#1{\_expanded{\_trykv{#1}{\_trykv{.\_csstring\notdef}{\_kvunknown}}}} \_def\_iskv#1#2{#2\_else\_ea\_unless\_fi \_ifcsname\_kvcs#1\_endcsname} \_def\_kvcs{_kv:\_the\_kvdict:} \_def\_kvunknown{???} -\public \readkv \kvx \nokvx \kv \iskv ; +\public \readkv \kvx \nokvx \kv \trykv \iskv ; \_endcode @@ -75,7 +79,13 @@ register. First: we read default parameters by \^`\readkv\myframedefaults` and secondly the actual parameters are read by \^`\readkv{\the\opt}`. The last setting wins. Third: the values can be used by the expandable \^`\kv{<key>}` macro. -The \^`\kv{<key>}` returns `???` if such key is not declared. +The \^`\kv{<key>}` returns `???` if such a <key> isn't declared +but if `.notdef` key is declared then its value is returned in this case. + +The \^`\kv{<key>}` macro fully expands the value of key. If you don't want to expand +the value, use \^`\trykv``{<key>}{<code>}`. It returns unexpanded value of <key> if +declared else returns expanded <code>. For example +`\edef\macro{\trykv{key}{}}` defines `\macro` as the unexpanded value of the `key`. You can use keys without values in the parameters list too. Then you can ask if the key is declared by \^`\iskv``{<key>}\iftrue` @@ -114,7 +124,7 @@ for undeclared <key>. Example: `\nokvx{\opwarning{Unknown option "#1"}}`. The default dictionary name (where key-value pairs are processed) is empty. You can use your specific dictionary by -\^`\kvdict``={<name>}`. Then `\redakv`, `\kv`, `\iskv`, `\kvx` and `\nokvx` +\^`\kvdict``={<name>}`. Then `\redakv`, `\kv`, `\trykv`, `\iskv`, `\kvx` and `\nokvx` macros use this named dictionary of <key>/<value> pairs. Package options can be processed when `\kvdict={pkg:<pkg>}`, example is the `\mathset` macro in @@ -128,6 +138,7 @@ A more extensive example can be found in \_endinput +2023-11-24 \trykv introduced. 2023-10-23 minor changes in \readkv, empty key isn't processed. 2023-03-11 \nokvx: \fi bug (due to \afterfi in \trycs) fixed. 2023-01-13 \kvx parameter added, \nokvx introduced. diff --git a/Master/texmf-dist/tex/optex/base/logos.opm b/Master/texmf-dist/tex/optex/base/logos.opm index a510a74a304..1168c25b58f 100644 --- a/Master/texmf-dist/tex/optex/base/logos.opm +++ b/Master/texmf-dist/tex/optex/base/logos.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \TeX {Logos TeX, LuaTeX, etc. <2020-02-28>} % preloaded in format +\_codedecl \TeX {Logos TeX, LuaTeX, etc. <2024-02-12>} % preloaded in format \_doc ---------------------------- Despite plain \TeX/ each macro for logos ends by \`\ignoreslash`. @@ -20,6 +20,18 @@ \_public \TeX \OpTeX \LuaTeX \XeTeX \ignoreslash ; + \_doc ---------------------------- + The \`\ConTeXt` logo is implemented as in the \ConTeXt/ format itself. + The kerning between \"Con" and \"\TeX/t" is calculated by measuring the kerning + between the letters \"T" and \"e". + \_cod ---------------------------- + +\_protected\_def \_ConTeXt{\_begingroup + Con\_setbox0=\_hbox{T\_kern\_zo e}\_setbox1=\_hbox{Te}{\_kern\_dimexpr\_wd1 -\_wd0}% + \_TeX t\_endgroup\_ignoreslash} + +\_public \ConTeXt ; + \_doc ----------------------------- The \`\_slantcorr` macro expands to the slant-correction of the current font. It is used to shifting A if the \`\LaTeX` logo is in italic. @@ -53,9 +65,12 @@ \_def\TeX{TeX\_ignslash}\_def\OpTeX{OpTeX\_ignslash}% \_def\LuaTeX{LuaTeX\_ignslash}\_def\XeTeX{XeTeX\_ignslash}% \_def\LaTeX{LaTeX\_ignslash}\_def\OPmac{OPmac\_ignslash}% + \_def\ConTeXt{ConTeXt\_ignslash}% \_def\CS{CS}\_def\csplain{csplain\_ignslash}% } \_public \ignslash ; \_endcode +2024-02-12 ConTeXt logo added. +2020-02-28 Released. diff --git a/Master/texmf-dist/tex/optex/base/margins.opm b/Master/texmf-dist/tex/optex/base/margins.opm index 0f544fc5dd6..c77926f9ad1 100644 --- a/Master/texmf-dist/tex/optex/base/margins.opm +++ b/Master/texmf-dist/tex/optex/base/margins.opm @@ -64,7 +64,9 @@ \_doc ---------------------------- \`\magscale` `[<factor>]` does `\mag=<factor>` and recalculates page - dimensions to their true values. + dimensions to their true values.\nl + \`\_truedimen``<dimen-register>` retunrs true value of <dimen-register> + regardless of `\mag`. \_cod ---------------------------- \_def\_trueunit{} diff --git a/Master/texmf-dist/tex/optex/base/math-macros.opm b/Master/texmf-dist/tex/optex/base/math-macros.opm index 00adc9f1aaf..fa4317f25ae 100644 --- a/Master/texmf-dist/tex/optex/base/math-macros.opm +++ b/Master/texmf-dist/tex/optex/base/math-macros.opm @@ -347,7 +347,10 @@ names from plain\TeX/ with `@` character are re-written in a more readable form.\nl \`\sp` is an alternative for `^`. The \`\sb` alternative for `_` was defined - at line 27 of the file `math-macros.opm`. + at line 27 of the file `math-macros.opm`.\nl + \`\_thinsk`, \`\_medsk`, \`\_thicksk` and \`\_thinneg` should be used + instead `\,`, `\>`, `\;` and `\!` in macros because a user can re-define + these single-letter sequences. \_cod ----------------------------- \_let\_sp=^ \public \sp ; diff --git a/Master/texmf-dist/tex/optex/base/more-macros.opm b/Master/texmf-dist/tex/optex/base/more-macros.opm index 8c622432340..3f4916a9c3d 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 <2023-01-18>} % preloaded in format +\_codedecl \eoldef {OpTeX useful macros <2024-02-10>} % preloaded in format \_doc ----------------------------- We define \`\opinput` `{<file name>}` macro which @@ -119,8 +119,9 @@ \_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}}% + \_def#1{\_isnextchar[{\_cs{_oA:\_csstring#1}}{\_cs{_oA:\_csstring#1}[#2]}}% + \_sdef{_oA:\_csstring#1}[##1]{% + \_immediateassignment\_opt={##1}\_cs{_oB:\_csstring#1\_nospaceafter}}% \_sdef{_oB:\_csstring#1\_nospaceafter}% } \_def\_nospaceafter#1{\_ea#1\_romannumeral-`\.\_noexpand} @@ -130,12 +131,21 @@ \_public \opt \optdef \nospaceafter \nospacefuturelet ; \_doc ----------------------------- + \`\_noprefix` `<cs>` works like `\csstring` `<cs>`, but ignores not only + the first backlash but the second~\"`_`" ignores too (if it follows the + backslash). + \_cod ----------------------------- + +\_def\_noprefix#1{\_ea\_noprefixA \_csstring#1\_empty\_fin} +\_def\_noprefixA #1#2\_fin{\_if _#1\_else #1\_fi #2} + + \_doc ----------------------------- The declarator \`\eoldef``\macro #1{<replacement text>}` defines a `\macro` which scans its parameter to the end of the current line. This is the parameter `#1` which can be used in the `<replacement text>`. The catcode of the `\endlinechar` is reset temporarily when the parameter is scanned. - The macro defined by `\eoldef` cannot be used with its parameter inside + The macro defined by \^`\eoldef` cannot be used with its parameter inside other macros because the catcode dancing is not possible here. But the \`\bracedparam``\macro{<parameter>}` can be used here. The `\bracedparam` is a prefix that re-sets temporarily the `\macro` to a `\macro` with @@ -146,15 +156,16 @@ \_cod ----------------------------- \_def\_eoldef #1{\_def #1{\_begingroup \_catcode`\^^M=12 \_eoldefA #1}% - \_ea\_def\_csname _\_csstring #1:M\_endcsname} + \_ea\_def\_csname _eol:\_noprefix #1\_endcsname} \_catcode`\^^M=12 % -\_def\_eoldefA #1#2^^M{\_endgroup\_csname _\_csstring #1:M\_endcsname{#2}}% +\_def\_eoldefA #1#2^^M{\_endgroup\_csname _eol:\_noprefix #1\_endcsname{#2}}% \_normalcatcodes % \_eoldef\_skiptoeol#1{} -\_def\_bracedparam#1{\_ifcsname _\_csstring #1:M\_endcsname - \_csname _\_csstring #1:M\_ea \_endcsname - \_else \_csname _in\_csstring #1\_ea \_endcsname \_fi + +\_def\_bracedparam#1{% + \_trycs{_eol:\_noprefix#1}% + {\_errmessage{\_string\bracedparam: \_string#1 isn't defined by \_string\eoldef}}% } \_public \eoldef \skiptoeol \bracedparam ; @@ -270,7 +281,8 @@ \endtt You can use expandable \`\expr``{<expression>}` for analogical purposes. It expands to the value of the `<expression>` at expand processor level. - The `<expression>` can include `+-*/()` and decimal numbers in common syntax. + The `<expression>` can include `+-*/^()` and decimal numbers in common syntax. + Moreover, `a//b` means integer division and `a\%b` is remainder. The math functions (and pi constant) have to be prefixed by `math.`, because it is processed by Lua interpreter. For example `\expr{math.pi*math.sqrt(2)}`. @@ -298,6 +310,21 @@ \_public \expr \bp ; + \_doc ----------------------------- + The \^`\expr` and \^`\bp` macros return their results with given number of decimal + digits even if there are trailing zeros. There is the \^`\nnum` macro to + \"normalize" such decimal numbers. \`\nnum``{<number>}` expands its parameter + and removes trailing zeros after decimal point and removes the decimal point + if nothing follows. For example, use `\nnum{\expr[10]{<expression>}}`. + The `\nnum` macro is fully expandable. + \_cod ----------------------------- + +\_def\_nnum #1{\_ea\_nnumA\_expanded{#1}.\_fin} +\_def\_nnumA #1.#2\_fin{#1\_ifx~#2~\_else \_nnumB #20.\_fin \_fi} +\_def\_nnumB #10.#2\_fin{\_ifx~#2~\_nnumC#1\_else \_nnumB #1.0.\_fin \_fi} +\_def\_nnumC #1.{\_ifx~#1~\_else .#1\_fi} +\_public \nnum ; + \_doc ------------------ You can write \^`\setpos``[<label>]` somewhere and the position of such \^`\setpos``[<label>]` can be referenced by \^`\posx``[<label>]`, @@ -374,6 +401,9 @@ \_endcode % ------------------------------------- +2024-02-10 \optdef reimplemented, it can create expandable macros now. +2024-01-18 \bracedparam reimplemented. +2023-12-04 \nnum introduced 2023-01-18 \bp, \expr have optional syntax for setting dec-digits 2022-11-24 \setpos, \posx, \posy moved from OpTeX trick here 2022-11-22 \docgen writes banner to log diff --git a/Master/texmf-dist/tex/optex/base/optex-tricks.opm b/Master/texmf-dist/tex/optex/base/optex-tricks.opm index 89fc7dd5e74..456a7472e1c 100644 --- a/Master/texmf-dist/tex/optex/base/optex-tricks.opm +++ b/Master/texmf-dist/tex/optex/base/optex-tricks.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \_undefined {OpTeX tricks ready to autoload <2023-11-15>} % chunks loaded on demand +\_codedecl \_undefined {OpTeX tricks ready to autoload <2024-02-13>} % chunks loaded on demand % Selected OpTeX tricks are here, they are auto-loaded if the macro is used first % namespace: optextrick @@ -97,13 +97,14 @@ \_trick 105 \directoutput ; %%%%%%%%%%% -\_def\directoutput{\_begingroup \_afterassignment\.directoutputA \_setbox0=} +\_newbox\.outbox +\_def\directoutput{\_begingroup \_afterassignment\.directoutputA \_setbox\.outbox=} \_def\.directoutputA{\_aftergroup \.directoutputB} -\_def\.directoutputB{\_preshipout0\_box0 - \_pdfpageheight=\_dimexpr\_ht0+\_dp0+2\_vvkern \_relax - \_pdfpagewidth=\_dimexpr\_wd0+2\_hhkern\_relax +\_def\.directoutputB{\_preshipout\.outbox\_box\.outbox + \_pdfpageheight=\_dimexpr\_ht\.outbox+\_dp\.outbox+2\_vvkern \_relax + \_pdfpagewidth=\_dimexpr\_wd\.outbox+2\_hhkern\_relax \_hoffset=\_hhkern \_voffset=\_vvkern - \_shipout\_box0 + \_shipout\_box\.outbox \_incr\_pageno \_endgroup } @@ -735,12 +736,47 @@ +\_topskip \_relax } +\_trick 0129 \pgforeground ; +%%%%%%%%%%%% + +\_newtoks \pgforeground + +\_addto\_makefootline{ + \_istoksempty\pgforeground \_iffalse + \_vskip-\_prevdepth + \_vskip-\_vsize + \_vskip-\_voffset + \_istoksempty\_footline \_iffalse \_vskip-\_footlinedist \_fi + \_nointerlineskip + \_moveleft\_hoffset \_vbox{\_the\pgforeground} + \_fi +} + +\_trick 0130 \onlyifnew ; +%%%%%%%%%%%% + +\_def \onlyifnew#1#2{\_begingroup% + \_edef\.tmpA{\_csstring #2}% + \_edef\.tmpB{\_string #2}% + \_ea\_ifcsname\.tmpA\_endcsname% + \_ifx\.tmpA\.tmpB% #2 has no backslash + \_def\.onlyifnewA{#1{_optextrick_onlyifnewB}}\_else% + \_def\.onlyifnewA{#1\_optextrick_onlyifnewB}\_fi% + \_else% + \_ifx\.tmpA\.tmpB% + \_def\.onlyifnewA{#1{#2}}\_else% + \_def\.onlyifnewA{#1#2}\_fi% + \_fi\_ea\_endgroup\.onlyifnewA} + +%%%%%%%%%%%% \_trick end ; \_endcode +2024-02-13 \onlyifnew added +2024-02-12 \pgforeground added 2023-11-15 \correctvsize added -2023-11-09 \makeLOF, \makeLOT aded +2023-11-09 \makeLOF, \makeLOT added 2023-11-08 \ispageodd, \seccc added 2023-11-07 \settabs \import \incrpp added 2023-11-05 \twoblocks, \pstart added diff --git a/Master/texmf-dist/tex/optex/base/optex.ini b/Master/texmf-dist/tex/optex/base/optex.ini index b65832faf84..a659f43dc8b 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.13 Nov 2023} +\def\optexversion{1.14 Feb 2024} \def\fmtname{OpTeX} \let\fmtversion=\optexversion diff --git a/Master/texmf-dist/tex/optex/base/others.opm b/Master/texmf-dist/tex/optex/base/others.opm index 9926c98fef4..9b7e3a7ead8 100644 --- a/Master/texmf-dist/tex/optex/base/others.opm +++ b/Master/texmf-dist/tex/optex/base/others.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \uv {Miscenaleous <2023-10-17>} % preloaded in format +\_codedecl \uv {Miscenaleous <2023-12-23>} % preloaded in format \_doc ---------------------------- \`\useOpTeX` and \`\useoptex` are declared as `\relax`. @@ -105,13 +105,14 @@ first sentence from the paragraph <number> using \`\_lipsumdot`. \_cod ---------------------------- +\_newbox\_nonebox \_def\_lipsumtext[#1]{\_lipsumload\_cs{_lip:#1}} \_def\_lipsum[#1]{\_lipsumA #1.]{#1}} \_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 + \_setbox\_nonebox=\_vbox{\_tmpnum=0 % vertical mode during \input lipsum.ltd.tex \_def\ProvidesFile##1[##2]{}% \_def\SetLipsumLanguage##1{}% \_def\NewLipsumPar{\_incr\_tmpnum \_sxdef{_lip:\_the\_tmpnum}}% @@ -149,7 +150,7 @@ \_savecatcodetable\_tmpcatcodes \_catcodetable\_tmpcatcodes \_long\_def\_loadtrickA ##1\_trick##2#1##3;{##1}% \_wlog{Loading trick macros for \_string#1}% - \_setbox0=\_vbox{\_globaldefs=1 \_ea\_loadtrickA \_input {optex-tricks.opm}}% + \_setbox\_nonebox=\_vbox{\_globaldefs=1 \_ea\_loadtrickA \_input {optex-tricks.opm}}% \_restorectable \_endnamespace } \_def\_trick #1;{\_endinput} @@ -161,7 +162,8 @@ \shadedframe \roundframe \cancel \ignoreinspic \keystroke \colortab \crx \crtop \crbot \crmid \longtable \vcent \vbot \tnote \tabnodes \tablebefore \framedblocks \twoblocks \pstart \settabs \import \incrpp \ispageodd - \iniseccc \seccc \makeLOF \makeLOT \captionF \captionT \correctvsize ; + \iniseccc \seccc \makeLOF \makeLOT \captionF \captionT \correctvsize \pgforeground + \onlyifnew ; \_sdef{_item:m}{\_loadtrick{\style m}\_cs{_item:m}} \_doc ----------------------------- @@ -238,6 +240,7 @@ \_endcode +2023-12-23 \_nonebox instead box 0 introduced. 2023-10-17 \_loadtrick introduced. 2022-05-04 \lipsum[<num>]. changed to \lipsum[<num>.] to keep macro expandable. 2022-04-21 syntax \lipsum[<num>]. introduced. diff --git a/Master/texmf-dist/tex/optex/base/parameters.opm b/Master/texmf-dist/tex/optex/base/parameters.opm index f831fa6a2df..05abe422757 100644 --- a/Master/texmf-dist/tex/optex/base/parameters.opm +++ b/Master/texmf-dist/tex/optex/base/parameters.opm @@ -144,12 +144,12 @@ \_voffset=25mm \_hsize=160mm % 210mm (from A4 size) - 2*25mm (default margins) \_vsize=244mm % 297mm (from A4 size) - 2*25mm (default margins) -3mm baseline correction -\_pagewidth=210 true mm -\_pageheight=297 true mm +\_pdfpagewidth=210 true mm +\_pdfpageheight=297 true mm \_doc ----------------------------- If you insist on plain \TeX/ values of these parameters then you can - call the `\plaintexsetting` macro. + call the \`\plaintexsetting` macro. \_cod ----------------------------- \_def\_plaintexsetting{% @@ -162,8 +162,8 @@ \_voffset=0pt \_hsize=6.5in \_vsize=8.9in - \_pagewidth=8.5 true in - \_pageheight=11 true in + \_pdfpagewidth=8.5 true in + \_pdfpageheight=11 true in \_nonfrenchspacing } \_public \plaintexsetting ; diff --git a/Master/texmf-dist/tex/optex/base/plain-macros.opm b/Master/texmf-dist/tex/optex/base/plain-macros.opm index 6ae59108b50..f3aa8c53347 100644 --- a/Master/texmf-dist/tex/optex/base/plain-macros.opm +++ b/Master/texmf-dist/tex/optex/base/plain-macros.opm @@ -8,6 +8,8 @@ \begtt \addto \dospecials{\do\_} \endtt + \`\active` is character constant 13, we can use it in the context + \code{\\catcode`}<character>\code{=\\active}. \_cod ----------------------------- \_def\_dospecials {\do\ \do\\\do\{\do\}\do\$\do\&% @@ -138,6 +140,7 @@ \_doc ----------------------------- The \`\strutbox` is declared as 10pt size dependent (like in plain \TeX), but the macro `\_setbaselineskip` (from `fonts-opmac.opm`) redefines it. + The `\strut` macro puts the \^`\strutbox`. \_cod ----------------------------- \_newbox\_strutbox @@ -162,8 +165,8 @@ \_doc ----------------------------- Tabbing macros are omitted because they are obsolete. \nl - Indentation and others. \`\textindent`, \`\item`, \`\itemitem`, - \`\narrower`, \`\raggedright`, \`\ttraggedright`, \`\leavevmode`. + Indentation and similar macros are defined here: \`\hang`, \`\textindent`, + \`\item`, \`\itemitem`, \`\narrower`, \`\raggedright`, \`\ttraggedright`, \`\leavevmode`. \_cod ----------------------------- \_def \_hang {\_hangindent\_parindent} @@ -181,7 +184,7 @@ \_doc ----------------------------- Few character codes are set for backward compatibility. But old obscurities - (from plain TeX) based on \`\mathhexbox` + (from plain \TeX) based on \`\mathhexbox` are not supported -- an error message and recommendation to directly using the desired character is implemented by the \`\_usedirectly` macro). @@ -219,7 +222,7 @@ \_public \mathhexbox ; \_doc ----------------------------- - The \`\_unichars` macro is run in \~`\initunifonts`, + The \`\_unichars` macro is run when Unicode font family is loaded, Unicodes are used instead old plain \TeX/ settings. \_cod ----------------------------- @@ -263,6 +266,9 @@ macro \`\oldaccents` which defines accented macros. \nl Much more usable is to define these control sequences for other purposes. + \nl + The \`\_uniaccents` macro redeclares codes for accents and it is run when + Unicode font family is loaded. \_cod ----------------------------- \_def \_oldaccents {% @@ -342,7 +348,7 @@ \rightarrowfill \leftarrowfill \downbracefill \upbracefill ; \_doc ----------------------------- - The last part of plain \TeX/ macros: \`\magnification`, \`\bye`. + The last part of plain \TeX/ macros: \`\magnification`, \`\showhyphens`, \`\bye`. Note that math macros are defined in the `math-macros.opm` file (section~\ref[math-macros]). \_cod ----------------------------- @@ -361,7 +367,7 @@ \_public \showhyphens \bye ; \_doc ----------------------------- - Plain \TeX/ reads `hyphen.tex` with patterns as `\language=0`. We do the same. + Plain \TeX/ reads `hyphen.tex` with patterns when \^`\language``=0`. We do the same. \_cod ----------------------------- \_lefthyphenmin=2 \_righthyphenmin=3 % disallow x- or -xx breaks diff --git a/Master/texmf-dist/tex/optex/base/prefixed.opm b/Master/texmf-dist/tex/optex/base/prefixed.opm index 3d25b0c8949..89aa0b4966a 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 <2022-11-25>} % preloaded in format +\_codedecl \public {Prefixing and code syntax <2024-02-02>} % preloaded in format \_doc --------- All \TeX/ primitives have alternative control sequence `\_hbox` `\_string`, ... @@ -97,6 +97,8 @@ \_def \_nspublic {\_xargs \_nspublicA} \_def \_nspublicA #1{% \_checkexists \_nspublic {\_pkglabel _\_csstring #1}% + \_ifcsname _eol:\_ea\_ignoreit\_pkglabel _\_csstring #1\_endcsname % defined by \eoldef + \_slet {_eol:\_csstring #1}{_eol:\_ea\_ignoreit\_pkglabel _\_csstring #1}\_fi \_ea\_newpublic \_ea\_let \_ea#1\_csname \_pkglabel _\_csstring #1\_endcsname } \_def \_nsprivate {\_xargs \_nsprivateA} @@ -388,6 +390,8 @@ can look like. Another good and short example is \endinput +2024-02-02 \_nspublicA bug correction (#1 may be set as \outer) +2024-01-18 \_nspublic modified in order to \eoldef+\bracedparam 2023-01-30 doc. about namespaces rewritten 2022-11-25 \_resetnamespace: moved \gdef\_namesp:#1 {} to \_namespace 2022-11-24 \newpublic introduced, \_checkexists with only two parameters. diff --git a/Master/texmf-dist/tex/optex/base/sections.opm b/Master/texmf-dist/tex/optex/base/sections.opm index ef5958e7888..de647475efd 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 <2023-05-02>} % preloaded in format +\_codedecl \chap {Titles, chapters, sections, subsections <2024-01-19>} % preloaded in format \_doc --------------------------- We are using scaled fonts for titles @@ -28,7 +28,7 @@ \_nobreak\_bigskip } \_def\_tit{\_scantoeol\_printtit} -\_let\_intit=\_printtit % used by \bracedparam +\_sdef{_eol:tit}{\_printtit} % enables \bracedparam\tit{title} \_public \tit ; @@ -156,7 +156,7 @@ \_doc ---------------------------- The \`\notoc` and \`\nonum` prefixes are implemented by - internal `\_ifnotoc` and `\_ifnonum`. They are reset + internal \`\_ifnotoc` and \`\_ifnonum`. They are reset after each chapter/section/subsection by the \`\_resetnonumnotoc` macro. \_cod ---------------------------- @@ -179,6 +179,10 @@ \_optdef\_secc[]{\_trylabel \_scantoeol\_insecc} \_def\_trylabel{\_istoksempty\_opt\_iffalse \_label[\_the\_opt]\_fi} +\_sdef{_eol:chap}{\_inchap} % enebles \bracedparam\chap{title} +\_sdef{_eol:sec}{\_insec} % enables \bracedparam\sec{title} +\_sdef{_eol:secc}{\_insecc} % enables \bracedparam\secc{title} + \_def\_inchap #1{\_par \_sectionlevel=1 \_def \_savedtitle {#1}% saved to .ref file \_ifnonum \_else {\_globaldefs=1 \_incr\_chapnum \_chapx}\_fi @@ -317,12 +321,14 @@ `\secl3` is `\secc` and all more levels (for <number>$>3$) are printed by the common \`\_seclp` macro. It declares only a simple design. If there is a requirement to use such more levels then the book designer can - define something different here. + define something different here.\nl + The variant `\_eol:secl` is defined to enable \^`\bracedparam``\secl<number> {<title-text>}`. \_cod ----------------------------- -\_def\_secl{\_afterassignment\_secla \_sectionlevel=} +\_def\_secl{\_let\_secle=\_ea \_afterassignment\_secla \_sectionlevel=} +\_sdef{_eol:secl}{\_def\_secle{\_ea\_bracedparam\_ea}\_afterassignment\_secla \_sectionlevel=} \_def\_secla{\_ifcase\_sectionlevel - \_or\_ea\_chap\_or\_ea\_sec\_or\_ea\_secc\_else\_ea\_seclp\_fi} + \_or \_secle\_chap \_or \_secle\_sec \_or \_secle\_secc \_else \_ea \_seclp\_fi} \_eoldef\_seclp#1{\_par \_ifnum\_lastpenalty=0 \_removelastskip\_medskip\_fi \_noindent{\_bf #1}\_vadjust{\_nobreak}\_nl\_ignorepars} \_def\_ignorepars{\_isnextchar\_par{\_ignoresecond\_ignorepars}{}} @@ -473,6 +479,8 @@ \_endcode % ------------------------------------- +2024-01-19 \bracedparam\secl enalbed +2024-01-18 \tit, \chap, \sec, \secc: added cooperation with new \bracedparam 2023-05-02 \_numprint used 2022-10-19 More robust \caption (two opened groups, \_printcaption introduced) 2022-08-02 Penalties in \_printsec, \_printsecc changed diff --git a/Master/texmf-dist/tex/optex/base/unimath-codes.opm b/Master/texmf-dist/tex/optex/base/unimath-codes.opm index 66be7487d4d..d2b7e0e1e31 100644 --- a/Master/texmf-dist/tex/optex/base/unimath-codes.opm +++ b/Master/texmf-dist/tex/optex/base/unimath-codes.opm @@ -198,7 +198,8 @@ } \_doc ----------------------------- - The math alphabets \`\cal`, \`\bbchar`, \`\frak`, \`\script` are re-defined + The math alphabets \`\cal`, \`\bbchar`, \`\frak`, \`\script`, + \`\misans`, \`\mbisans` are re-defined here. The \`\_marm`, \`\_mabf`, \`\_mait`, \`\_mabi`, \`\_matt` used in \^`\rm`, \^`\bf`, \^`\it`, \^`\bi` are re-defined too.\nl You can redefine them again if you need different behavior (for example @@ -548,7 +549,7 @@ \secc More Unicode-math examples Example of using additional math font is in section 5.3 in the -\ulink[http://petr.olsak.net/ftp/olsak/optex/optex-math.pdf]{\tt optex-math.pdf} documentation +\ulink[http://petr.olsak.net/ftp/olsak/optex/optex-math.pdf]{\tt optex-math.pdf} documentation. More examples are in the \ulink[http://petr.olsak.net/optex/optex-tricks.html]{OpTeX tricks} and in the \ulink[https://petr.olsak.net/ftp/olsak/optex/math-doc.pdf]{math.opm} package. diff --git a/Master/texmf-dist/tex/optex/base/unimath-macros.opm b/Master/texmf-dist/tex/optex/base/unimath-macros.opm index 35842e674d2..ac926b5e89e 100644 --- a/Master/texmf-dist/tex/optex/base/unimath-macros.opm +++ b/Master/texmf-dist/tex/optex/base/unimath-macros.opm @@ -181,7 +181,9 @@ \`\themathcodefam``<math-char>` and \`\themathcodechar``<math-char>` macros. The parameter <math-char> is a math character or it is a macro like `\doteq`, `\times`. Moreower, \`\thedelcodefam``<math-char>` and \`\thedelcodechar``<math-char>` - return delcode quaitities of givem math character. + return delcode quaitities of given math character. + All these commands use the common Lua code defined in + the \`\_getmathcode``<code>{<math or del>}<character number>` macro. \_cod ----------------------------- \_def\_getmathcode#1#2{\_directlua{tex.print(tex.get#2code(token.scan_int())[#1])}} diff --git a/Master/texmf-dist/tex/optex/demo/op-mathalign.tex b/Master/texmf-dist/tex/optex/demo/op-mathalign.tex index b2524ee80da..7770a8d0e21 100644 --- a/Master/texmf-dist/tex/optex/demo/op-mathalign.tex +++ b/Master/texmf-dist/tex/optex/demo/op-mathalign.tex @@ -44,7 +44,7 @@ \tit Math alignment examples The document \url{https://www.ntg.nl/maps/34/06.pdf} shows examples how to -do special math alignments in display mode in ConTeXt (and in \LaTeX/ for +do special math alignments in display mode in \ConTeXt/ (and in \LaTeX/ for comparison). We present the same examples here. They are created in \OpTeX/ and the \LaTeX/ source is shown for comparison. diff --git a/Master/texmf-dist/tex/optex/pkg/mte.opm b/Master/texmf-dist/tex/optex/pkg/mte.opm index 0c8b22152a4..5352d5dd782 100644 --- a/Master/texmf-dist/tex/optex/pkg/mte.opm +++ b/Master/texmf-dist/tex/optex/pkg/mte.opm @@ -658,7 +658,7 @@ You can define your own protrusion or expansion values: copy macros as you wish using `\def`. Such definition has precedence. Similar definitions can be in some font family files too, so: do your definition after all `\fontfam` if you want to keep the precedence. -All such definitions must be performed before the `\mteinit` command. +All such definitions must be performed before the \^`\enablemte` command. You can use `\def\_mte_P` for data of protrusion for all fonts which has general precedence. For example, if you want to protrude hyphen |