summaryrefslogtreecommitdiff
path: root/macros/luatex/optex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/optex')
-rw-r--r--macros/luatex/optex/README6
-rw-r--r--macros/luatex/optex/colors.opm31
-rw-r--r--macros/luatex/optex/doc/optex-doc.pdfbin163979 -> 172562 bytes
-rw-r--r--macros/luatex/optex/doc/optex-doc.tex128
-rw-r--r--macros/luatex/optex/fnotes.opm14
-rw-r--r--macros/luatex/optex/fonts-opmac.opm3
-rw-r--r--macros/luatex/optex/graphics.opm249
-rw-r--r--macros/luatex/optex/lists.opm29
-rw-r--r--macros/luatex/optex/makeindex.opm12
-rw-r--r--macros/luatex/optex/multicolumns.opm10
-rw-r--r--macros/luatex/optex/op-slides.tex20
-rw-r--r--macros/luatex/optex/optex.ini4
-rw-r--r--macros/luatex/optex/others.opm5
-rw-r--r--macros/luatex/optex/output.opm15
-rw-r--r--macros/luatex/optex/parameters.opm29
-rw-r--r--macros/luatex/optex/sections.opm58
-rw-r--r--macros/luatex/optex/slides.opm6
-rw-r--r--macros/luatex/optex/styles.opm4
-rw-r--r--macros/luatex/optex/verbatim.opm4
19 files changed, 553 insertions, 74 deletions
diff --git a/macros/luatex/optex/README b/macros/luatex/optex/README
index 5217287f83..2c8fa6652c 100644
--- a/macros/luatex/optex/README
+++ b/macros/luatex/optex/README
@@ -8,6 +8,12 @@ See http://petr.olsak.net/optex
History:
+<0.08> \numberedpar implmented. \emergencystretch=20pt added as default.
+ \inoval, \incircle, \clipinoval, \clipincircle imlemented.
+ \puttext, \putpic x,y instead -y,x (incompatible change!)
+ footnotes have separated color stack now.
+ \fnotelinks implemented.
+ Lists by \begitems...\enditems improved (\novspaces \_vspacehalf, \ilevel).
<0.07> demos: op-letter.tex and op-slides.tex added.
\inkinspic, \transformbox, \slides added.
documentation improved and updated.
diff --git a/macros/luatex/optex/colors.opm b/macros/luatex/optex/colors.opm
index c4ce83ecd9..90d3d6d7a3 100644
--- a/macros/luatex/optex/colors.opm
+++ b/macros/luatex/optex/colors.opm
@@ -37,9 +37,9 @@
\_def\_setcmykcolor#1{\_setcolor{\_formatcmyk{#1}}}
\_def\_setrgbcolor#1{\_setcolor{\_formatrgb{#1}}}
\_def\_setgreycolor#1{\_setcolor{\_formatgrey{#1}}}
-\_def\_formatcmyk#1{#1 k #1 K}
-\_def\_formatrgb#1{#1 rg #1 RG}
-\_def\_formatgrey#1{#1 g #1 G}
+\_def\_formatcmyk#1{\_fillstroke{#1 k}{#1 K}}
+\_def\_formatrgb#1{\_fillstroke{#1 rg}{#1 RG}}
+\_def\_formatgrey#1{\_fillstroke{#1 g}{#1 G}}
\_public \setcmykcolor \setrgbcolor \setgreycolor ;
\_doc -----------------------------
@@ -50,15 +50,19 @@
The `\onlycmyk` macro does a similar work, it re-defines `\_formatrgb`
macro. The Grey color space is unnchanged and works in both main
settings (RGB or CMYK) without collisions.
+ The `\_fillstroke` uses the same color for fills and strokes.
+ If only fills are needed to declare do `\def\_fillstroke#1#2{#1}`.
+ If only strokes are needed to declare do `\def\_fillstroke#1#2{#2}`.
\_cod -----------------------------
+\_def\_fillstroke#1#2{#1 #2}
\_def\_onlyrgb{\_def\Red{\_setrgbcolor{1 0 0}}%
\_def\Green{\_setrgbcolor{0 1 0}}\_def\Blue{\_setrgbcolor{0 0 1}}%
\_let\_colordef=\_rgbcolordef
- \_def\_formatrgb##1{##1 rg ##1 RG}%
- \_def\_formatcmyk##1{\_cmyktorgb ##1 ; rg \_cmyktorgb ##1 ; RG}}
-\_def\_onlycmyk{\_def\_formatcmyk##1{##1 k ##1 K}%
- \_def\_formatrgb##1{\_rgbtocmyk ##1 ; k \_rgbtocmyk ##1 ; K}}
+ \_def\_formatrgb##1{\_fillstroke{##1 rg}{##1 RG}}%
+ \_def\_formatcmyk##1{\_fillstroke{\_cmyktorgb ##1 ; rg}{\_cmyktorgb ##1 ; RG}}}
+\_def\_onlycmyk{\_def\_formatcmyk##1{\_fillstroke{##1 k}{##1 K}}%
+ \_def\_formatrgb##1{\_fillstroke{\_rgbtocmyk ##1 ; k}{\_rgbtocmyk ##1 ; K}}}
\_public \onlyrgb \onlycmyk ;
\_doc -----------------------------
@@ -81,7 +85,8 @@
}
\_def\_pdfblackcolor{0 g 0 G}
\_edef\_currentcolor{\_pdfblackcolor}
-\_def\_ensureblackA#1{\_colorstackpush\_pdfblackcolor #1\_colorstackpop}
+\_def\_ensureblackA#1{\_global\_let\_openfnotestack=\_openfnotestackA
+ \_colorstackpush\_pdfblackcolor #1\_colorstackpop}
\_doc -----------------------------
The colorstack is initialized here and basic macros
@@ -95,6 +100,16 @@
\_def\_colorstackset#1{\_pdfcolorstack\_colorstackcnt set{#1}}
\_doc -----------------------------
+ We need to open a special color stack for footnotes, because footnotes
+ can follow on next pages and their colors are independent on colors
+ used in man page-body.
+ \_cod -----------------------------
+
+%\_mathchardef\_fnotestack=\_pdfcolorstackinit page {0 g 0 G}
+% must be in \everyjob^^^
+\_def \_openfnotestackA {\_pdfcolorstack\_fnotestack current}
+
+ \_doc -----------------------------
We use lua codes for RGB to CMYK or CMYK to RGB conversions and for
addition color components in the `\colordef` macro.
`\_rgbtocmyk <R> <G> <B> ;` expands to <C> <M> <Y> <K>.
diff --git a/macros/luatex/optex/doc/optex-doc.pdf b/macros/luatex/optex/doc/optex-doc.pdf
index 8ce027841f..b366233d9f 100644
--- a/macros/luatex/optex/doc/optex-doc.pdf
+++ b/macros/luatex/optex/doc/optex-doc.pdf
Binary files differ
diff --git a/macros/luatex/optex/doc/optex-doc.tex b/macros/luatex/optex/doc/optex-doc.tex
index 7035a0866f..0a1b6b5d8a 100644
--- a/macros/luatex/optex/doc/optex-doc.tex
+++ b/macros/luatex/optex/doc/optex-doc.tex
@@ -22,7 +22,7 @@
\tit \OpTeX/\nl Format Based on Plain \TeX/ and OPmac\fnotemark1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\hfill Version 0.07
+\hfill Version 0.08
\centerline{\it Petr Olšák, 2020}
@@ -529,10 +529,10 @@ contents if `\notoc` precedes.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Apart from chapters, sections and subsections, there are another
-automatically numbered objects: equations and captions for tables and
-figures.
+automatically numbered objects: equations, captions for tables and
+figures. The user can declare more numbered object.
-If user writes the `\eqmark` as the last element of the display mode then
+If the user writes the `\eqmark` as the last element of the display mode then
this equation is numbered. The equation number is printed in brackets. This number
resets in each section by default.
@@ -556,7 +556,7 @@ The `\cskip` creates appropriate vertical space between them. Example:
\begtt
\caption/t The dependency of the computer-dependency on the age.
\cskip
-\hfil\table{rl}{
+\noindent\hfil\table{rl}{
age & value \crl\noalign{\smallskip}
0--1 & unmeasured \cr
1--6 & observable \cr
@@ -572,7 +572,8 @@ This example produces:
\medskip
\caption/t The dependency of the computer-dependency on the age.
\cskip
-\hfil\table{rl}{age & value \crl\noalign{\smallskip}
+\noindent\hfil\table{rl}{
+ age & value \crl\noalign{\smallskip}
0--1 & unmeasured \cr
1--6 & observable \cr
6--12 & significant \cr
@@ -602,6 +603,28 @@ Example:
\endinsert
\endtt
+\new
+There are five prepared counters `A`, `B`, `C`, `D` and `E`.
+They are reset in each chapter and section\fnote
+{This feature can be changed, see the `sections.opm` in the technical documentation.}.
+They can be used in context of `\numberedpar <letter>{<text>}`
+macro. For example:
+\begtt
+\def\theorem {\numberedpar A{Theorem}}
+\def\corollary {\numberedpar A{Corollary}}
+\def\definition {\numberedpar B{Definition}}
+\def\example {\numberedpar C{Example}}
+\endtt
+%
+Three independent numbers are used in this example. One for Theorems and Corollaries
+second for Definitions and third for Examples. The user can write
+`\theorem Let $M$ be...` and the new paragraph is started with the text:
+{\bf Theorem 2.3.1.} Let $M$ be...
+You can add an optional parameter in brackets. For example,
+`\theorem [(L'Hôpital's rule)] Let $f$, $g$ be...`
+is printed like {\bf Theorem 2.4.2 (L'Hôpital's rule).} Let $f$, $g$ be...
+
+
\secc References
%%%%%%%%%%%%%%%
@@ -618,7 +641,7 @@ Example:
\begtt
\sec[beatle] About Beatles
-\hfil\table{rl}{...} % the table
+\noindent\hfil\table{rl}{...} % the table
\cskip
\caption/t [comp-depend] The dependency of the computer-dependency on the age.
@@ -634,6 +657,11 @@ If there are forward referenced objects then user have to run \TeX{} twice.
During each pass, the working `*.ref` file (with references data) is created
and this file is used (if it exists) at the beginning of the document.
+You can use `\label[<label>]` before `\theorem`, `\definition` (macros defined by
+`\numberedpar`) if you want to reference these numbered objects.
+You can't use `\theorem[<label>]` because the optional parameter
+is reserved to another purpose.
+
You can create a reference to whatever else by commands
`\label[<label>]\wlabel{<text>}`. The connection between <label> and
<text> is established. The `\ref[<label>]` will print <text>.
@@ -642,6 +670,7 @@ By default, labels are not printed, of course. But if you are preparing a
draft version of document, you can declare `\showlabels`. The labels
are printed at their destination places after such declaration.
+
\secc Hyperlinks, outlines
%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -677,6 +706,11 @@ color. Example:
By default these macros are not defined. It means that no frames are created.
+The hyperlinked footnotes can be activated by `\fnotelinks <color-fnt> <color-fnf>`
+where footnote marks in text have `<color-fnt>` and the same footnote marks
+in footnotes have <color-fnf>. You can define relevant borders
+`\fntborder` and `\fnfborder` analogically as `\pgboreder` (for example).
+
There are \"low level" commands to create the links. You can specify the
destination of the internal link by `\dest[<type>:<label>]`. The
active text linked to the `\dest` can be created by
@@ -774,7 +808,16 @@ Another style can be defined by the command `\sdef{_item:<style>}{<text>}`.
Default item can be set by `\defaultitem={<text>}`.
The list environments can be nested. Each new level of item is indented by
next multiple of `\iindent` which is set to `\parindent` by default.
-More information about design of lists of items are in the `lists.opm` file.
+The `\ilevel` register says what level of items is currently processed.
+Each `\begitems` starts `\everylist` tokens register. You can set, for
+example:
+\begtt
+\everylist={\ifcase\ilevel\or \style X \or \style x \else \style - \fi}
+\endtt
+
+You can say `\begitems \novspaces` if you don't want vertical spaces above
+and below the list.
+More information about design of lists of items should be found in the `lists.opm` file.
\secc Tables
%%%%%%%%%%%
@@ -795,7 +838,7 @@ These letters can be combined by the `|` character (vertical line). Example
generates the following result:
\bigskip
-\hfil\table{||lc|r||}{ \crl
+\noindent\hfil\table{||lc|r||}{ \crl
Month & commodity & price \crli \tskip2pt
January & notebook & \$ 700 \cr
February & skateboard & \$ 100 \cr
@@ -1428,6 +1471,7 @@ third: \pdfsave \pdfrotate{-15.3}\pdfsetmatrix{2 0 1.5 2}\rlap{text3}\pdfrestore
You can see that \TeX/ knows nothing about dimensions of transfomed material,
it treats it as with a zero dimension object.
+\new
This problem is solved by the `\transformbox{<transformation>}{<text>}`
macro which puts the transformed
material to a box with relevant dimension. The <transfromation> parameter
@@ -1440,6 +1484,70 @@ creates \frame{\transformbox{\pdfscale{1}{1.5}\pdfrotate{-10}}{moj}}.
The `\rotbox{<deg>}{<text>}` is a shortcut for
`\transformbox{\pdfrotate{<deg>}}{<text>}`.
+\secc Ovals, circles
+%%%%%%%%%%%%%%%%%%%%
+
+\new
+The `\inoval{<text>}` creates a box like this: \inoval{text}.
+Multiline text can be put in an oval by the command `\inoval{\vbox{<text>}}`.
+Local settings can be set by
+`\inoval[<settings>]{<text>}` or you can re-declare global settings by
+`\ovalparams={<settings>}`. The default settings are:
+
+\begtt
+\ovalparams={\roudness=2pt % diameter of circles in the corners
+ \fcolor=\Yellow % color used for filling oval
+ \lcolor=\Red % line color used in the border
+ \lwidth=0.5bp % line width in the border
+ \shadow=N % use a shadow effect
+ \overlapmargins=N % ignore margins by surrounding text
+ \hhkern=0pt \vvkern=0pt} % left-righ margin, top-bottom margin
+\endtt
+The total distance from text to oval boundary is `\hhkern+\roudness` at the left and right
+sides and
+`\vvkern+\roundness` at the top and bottom sides of the text.
+
+If you need a setting for the `<text>` (color, size, font etc.), use
+`\oval{<text settings><text>}`.
+
+\new
+The `\incircle[\ratio=1.8]{<text>}` creates a box like this \incircle[\ratio=1.8]{text}.
+The `\ratio` is width/height. The usage is analogical like for oval.
+The default settings of parameters are
+
+\begtt
+\circleparams={\ratio=1 \fcolor=\Yellow \lcolor=\Red \lwidth=0.5bp
+ \shadow=N \ignoremargins=N \hhkern=2pt \vvkern=2pt}
+\endtt
+
+\new
+The macros `\clipinoval <x> <y> <width> <height> {<text>}`
+and `\clipincircle` (with the same parameters)
+print the `<text>` when a clipping path (oval or cirle) with given
+`<with>` and `<height>` shifted its center by `<x>` to right and by `<y>` to up
+is used.
+The `\roundness=5mm` is default for `\clipingoval` and user can change it.
+Example:
+
+\begtt
+\clipingcircle 3cm 3.5cm 6cm 7cm {\picw=6cm \inspic{myphoto.jpg}}
+\endtt
+
+\secc Putting images and texts wherever
+
+\new
+The `\puttext <x> <y> {<text>}` puts the `<text>` shifted by `<x>` right and by
+`<y>` up from current point of typesetting and does'n not change the
+position of the current point. Assume coordinate system with origin in the
+current point. Then `\puttext <x> <y> {<text>}` puts the text at the
+coordinates `<x>`, `<y>`. More exactly the left edge of its baseline is at that
+position.
+
+\new
+The `\putpic <x> <y> <width> <height> {<image>}` puts the `<image>` of given
+`<width>` and `<height>` at given position (its left-bottom corner).
+You can write `\nospec` instead `<width>` or `<height>` if this parameter is
+not given.
\sec Others
%%%%%%%%%%%
@@ -1503,7 +1611,7 @@ You can simply define your own quotes as shown in `languages.opm` file.
The `\"` is used for quotes visualy more similar to the `"` character which
can be primary quotes or secondary quotes depending on the language rules.
May be you want to alternate meaning of these two types of quotes. Use
-`\<isocode>quotes\atlquotes` in such case.
+`\<isocode>quotes\altquotes` in such case.
\secc Pre-defined styles
%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/macros/luatex/optex/fnotes.opm b/macros/luatex/optex/fnotes.opm
index 9f9a9d3f5e..91365879a9 100644
--- a/macros/luatex/optex/fnotes.opm
+++ b/macros/luatex/optex/fnotes.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \fnote {Footnotes, marginal notes OpTeX <2020-03-19>} % loaded in format
+\_codedecl \fnote {Footnotes, marginal notes OpTeX <2020-03-20>} % loaded in format
\_doc -----------------------------
\begitems
@@ -41,16 +41,20 @@
footnote itself, then you can define `\_printfnotemarkA` and `\_printfnotemarkB`.
The following example shows an implementation of hyperlinked footnotes
(from text to footnote and bacward):
- \begtt
- \def\_printfnotemarkA{\ilink[fnB:\the\gfnotenum]{\_printfnotemark}\dest[fnA::\the\gfnotenum]}
- \def\_printfnotemarkB{\ilink[fnA:\the\gfnotenum]{\_printfnotemark}\dest[fnB::\the\gfnotenum]}
- \endtt
\_cod -----------------------------
\_def \_printfnotemark {$^{\_fnotenum}$} % default footnote mark
\_def \_printfnotemarkA {\_printfnotemark} % footnote marks used in text
\_def \_printfnotemarkB {\_printfnotemark} % footnote marks used in front of footnotes
+\_def \_fnotelinks#1#2{% <inText color> <inFootnote color>
+ \_def\_printfnotemarkA{\_link[fnt:\the\_gfnotenum]{\_localcolor#1}{\_printfnotemark}%
+ \_dest[fnf:\the\_gfnotenum]}%
+ \_def\_printfnotemarkB{\_link[fnf:\the\_gfnotenum]{\_localcolor#2}{\_printfnotemark}%
+ \_dest[fnt:\the\_gfnotenum]}%
+}
+\public \fnotelinks ;
+
\_doc ----------------------------
Each footnote saves the `\_Xfnote` (without parameter) to the `.ref`
file (if `\openref`). We can create the mapping from <gfnotenum> to <pgfnotenum>
diff --git a/macros/luatex/optex/fonts-opmac.opm b/macros/luatex/optex/fonts-opmac.opm
index 20d6d45bf3..7827d76c65 100644
--- a/macros/luatex/optex/fonts-opmac.opm
+++ b/macros/luatex/optex/fonts-opmac.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \typosize {Font managing macros from OPmac <2020-02-29>} % loaded in format
+\_codedecl \typosize {Font managing macros from OPmac <2020-03-27>} % loaded in format
\_protected\_def \_typosize [#1/#2]{%
\_textfontsize{#1}\_mathfontsize{#1}\_setbaselineskip{#2}%
@@ -45,6 +45,7 @@
\_def\_setmainvalues {%
\_mainbaselineskip=\_baselineskip
\_mainfosize=\_optsize
+ \_topskip=\_mainfosize \_splittopskip=\_topskip % added 2020-03-27
\_bf \_it \_bi \_rm \_normalmath % load fonts if \typosize is running firstly
\_let \_setmainvalues =\_setmainvaluesL
}
diff --git a/macros/luatex/optex/graphics.opm b/macros/luatex/optex/graphics.opm
index d4a868a3d1..92a1a7a804 100644
--- a/macros/luatex/optex/graphics.opm
+++ b/macros/luatex/optex/graphics.opm
@@ -1,13 +1,13 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \inspic {Graphics <2020-03-18>} % preloaded in format
+\_codedecl \inspic {Graphics <2020-03-29>} % preloaded in format
\_doc -----------------------------
`\inspic` accepts old syntax `\inspic <filename><space>`
or new syntax `\inspic{<filename>}`. So, we need to define
two auxiliary macros `\_inspicA` and `\_inspicB`.
- You can include more `\pdfximage` parameters (like `page=`)
+ You can include more `\pdfximage` parameters (like `page<number>`)
in the `\_picparams` macro.
All `\inspic` macros are surrounded in `\hbox` in order user can
@@ -146,11 +146,11 @@
The `\_scantwodimens` scans two objects with the syntactic rule <dimen>
and returns `{<number>}{<number>}` in sp unit.
- The `\puttext <down> <right>{<text>}` puts the <text> to desired place:
+ The `\puttext <right> <up>{<text>}` puts the <text> to desired place:
From current point moves <down> and <right>, puts the <text> and returns
back. The cuuren tpoint is unchanged after this macro ends.
- The `\putpic <down> <right> <width> <height> {<image-file>}`
+ The `\putpic <right> <up> <width> <height> {<image-file>}`
does `\puttext` with the image scaled to desired <width> and <height>.
If <with> or <height> is zero, natural dimension is used.
The `\nospec` is a shortcut to such natural dimension.
@@ -158,18 +158,18 @@
\_def\_scantwodimens{%
\_directlua{tex.print(string.format('{\_pcent d}{\_pcent d}',
- token.scan_dimen(),token.scan_dimen{}))}%
+ token.scan_dimen(),token.scan_dimen()))}%
}
\_def\_puttext{\_ea\_ea\_ea\_puttextA\_scantwodimens}
\_def\_puttextA#1#2#3{\_setbox0=\_hbox{{#3}}\_dimen1=#1sp \_dimen2=#2sp \_puttextB}
\_def\_puttextB{%
- \_ifvmode
+ \_ifvmode
\_ifdim\_prevdepth>0pt \_vskip-\_prevdepth \_relax \_fi
\_nointerlineskip
\_fi
\_wd0=0pt \_ht0=0pt \_dp0=0pt
- \_vbox to0pt{\_kern\_dimen1 \_hbox to0pt{\_kern\_dimen2 \_box0\_hss}\_vss}}
+ \_vbox to0pt{\_kern-\_dimen2 \_hbox to0pt{\_kern\_dimen1 \_box0\_hss}\_vss}}
\_def\_putpic{\_ea\_ea\_ea\_putpicA\_scantwodimens}
\_def\_putpicA#1#2{\_dimen1=#1sp \_dimen2=#2sp \_ea\_ea\_ea\_putpicB\_scantwodimens}
@@ -183,5 +183,240 @@
\_def\nospec{0pt}
\_public \puttext \putpic \backgroundpic ;
+ \_doc -----------------------------
+ You can use expandable `\_bp{<dimen>}` convertor from
+ \TeX/ `<dimen>` (or from an expression accepted by
+ `\dimexpr` primitive) to a decimal value in big points
+ (used as natural unit in the PDF format). So, you can write, for example:
+ \begtt
+ \pdfliteral{q \_bp{.3\hsize-2mm} \_bp{2mm} m 0 \_bp{-4mm} l S Q}
+ \endtt
+ You can use expandable `\_expr{<expression>}` for analogical purposes.
+ The `<expression>` can include `+-*/()` and decimal numbers in common syntax.
+ \_cod -----------------------------
+
+\_def\_decdigits{3} % digits after decimal point in \_bp and \_expr outputs.
+\_def\_pttopb{%
+ \_directlua{tex.print(string.format('\_pcent.\_decdigits f',
+ token.scan_dimen()/65781.76))}% pt to bp conversion
+}
+\def\_bp#1{\_ea\_pttopb\_dimexpr#1\_relax}
+\def\_expr#1{\_directlua{tex.print(string.format('\_pcent.\_decdigits f',#1))}}
+
+ \_doc -----------------------------
+ `\)circle<x><y>` creates an ellipse with `<x>` axis and `<y>` axix.
+ The origin is in the center.
+ `\_oval<x><y><roudness>` creates an oval with `<x>`, `<y>` size and with
+ given `<roundness>`. The real size is bigger by 2`<roundness>`. The
+ orgigin is at the left bottom corner.
+ `\_mv<x><y>{<curve>}` moves current point to `<x>`, `<y>`, crates the
+ `<curve>` and retuns back the current point.
+ All these macros are fully expandable and they can be used in the
+ `\pdfliteral` argument.
+ \_cod -----------------------------
+
+\def\_circle#1#2{\_expr{.5*(#1)} 0 m
+ \_expr{.5*(#1)} \_expr{.276*(#2)} \_expr{.276*(#1)} \_expr{.5*(#2)} 0 \_expr{.5*(#2)} c
+ \_expr{-.276*(#1)} \_expr{.5*(#2)} \_expr{-.5*(#1)} \_expr{.276*(#2)} \_expr{-.5*(#1)} 0 c
+ \_expr{-.5*(#1)} \_expr{-.276*(#2)} \_expr{-.276*(#1)} \_expr{-.5*(#2)} 0 \_expr{-.5*(#2)} c
+ \_expr{.276*(#1)} \_expr{-.5*(#2)} \_expr{.5*(#1)} \_expr{-.276*(#2)} \_expr{.5*(#1)} 0 c h}
+
+\def\_oval#1#2#3{0 \_expr{-(#3)} m \_expr{#1} \_expr{-(#3)} l
+ \_expr{(#1)+.552*(#3)} \_expr{-(#3)} \_expr{(#1)+(#3)} \_expr{-.552*(#3)}
+ \_expr{(#1)+(#3)} 0 c
+ \_expr{(#1)+(#3)} \_expr{#2} l
+ \_expr{(#1)+(#3)} \_expr{(#2)+.552*(#3)} \_expr{(#1)+.552*(#3)} \_expr{(#2)+(#3)}
+ \_expr{#1} \_expr{(#2)+(#3)} c
+ 0 \_expr{(#2)+(#3)} l
+ \_expr{-.552*(#3)} \_expr{(#2)+(#3)} \_expr{-(#3)} \_expr{(#2)+.552*(#3)}
+ \_expr{-(#3)} \_expr{#2} c
+ \_expr{-(#3)} 0 l
+ \_expr{-(#3)} \_expr{-.552*(#3)} \_expr{-.552*(#3)} \_expr{-(#3)} 0 \_expr{-(#3)} c h}
+
+\def\_mv#1#2#3{1 0 0 1 \_expr{#1} \_expr{#2} cm #3 1 0 0 1 \_expr{-(#1)} \_expr{-(#2)} cm}
+
+ \_doc -----------------------------
+ The `\inoval` is an example of `\_oval` usage.
+ The `\incircle` is an example of `\_circle` usage.
+ \_cod -----------------------------
+
+\_newdimen \_lwidth
+\_def\_fcolor{\_let\_fcolorvalue}
+\_def\_lcolor{\_let\_lcolorvalue}
+\_def\_shadow{\_let\_shadowvalue}
+\_def\_overlapmargins{\_let\_overlapmarginsvalue}
+\_def\_ratio{\isnextchar ={\_ratioA}{\_ratioA=}}
+\_def\_ratioA =#1 {\_def\_ratiovalue{#1}}
+\_def\_touppervalue#1{\_ifx#1n\_let#1=N\_fi}
+
+\_def\_setflcolors#1{% use only in a group
+ \_def\_setcolor##1{##1}%
+ \_def\_fillstroke##1##2{##1}%
+ \_edef#1{\_fcolorvalue}%
+ \_def\_fillstroke##1##2{##2}%
+ \_edef#1{#1\_space\_lcolorvalue\_space}%
+}
+
+\_optdef\_inoval[]{\_vbox\_bgroup
+ \_roundness=2pt \_fcolor=\Yellow \_lcolor=\Red \_lwidth=.5bp
+ \_shadow=N \_overlapmargins=N \_hhkern=0pt \_vvkern=0pt
+ \_the\_ovalparams \_relax \_the\_opt \_relax
+ \_touppervalue\_overlapmarginsvalue \_touppervalue\_shadowvalue
+ \_ifx\_overlapmarginsvalue N%
+ \_advance\_hsize by-2\_hhkern \_advance\_hsize by-2\_roundness \_fi
+ \_setbox0=\_hbox\_bgroup\_bgroup \_aftergroup\_inovalA \_kern\_hhkern \_let\_next=%
+}
+\_def\_inovalA{\_isnextchar\_colorstackpop\_inovalB\_inovalC}
+\_def\_inovalB#1{#1\_isnextchar\_colorstackpop\_inovalB\_inovalC}
+\_def\_inovalC{\_egroup % of \setbox0=\hbox\bgroup
+ \_ifdim\_vvkern=0pt \_else \_ht0=\_dimexpr\_ht0+\_vvkern \_relax
+ \_dp0=\_dimexpr\_dp0+\_vvkern \_relax \_fi
+ \_ifdim\_hhkern=0pt \_else \_wd0=\_dimexpr\_wd0+\_hhkern \_relax \_fi
+ \_ifx\_overlapmarginsvalue N\_dimen0=\_roundness \_dimen1=\_roundness
+ \_else \_dimen0=-\_hhkern \_dimen1=-\_vvkern \_fi
+ \_setflcolors\_tmp
+ \_hbox{\_kern\_dimen0
+ \_vbox to0pt{\_kern\_dp0
+ \_ifx\_shadowvalue N\_else
+ \_edef\_tmpb{{\_bp{\_wd0+\_lwidth}}{\_bp{\_ht0+\_dp0+\_lwidth}}{\_bp{\_roundness}}}%
+ \_doshadow\_oval
+ \_fi
+ \_pdfliteral{q \_bp{\_lwidth} w \_tmp
+ \_oval{\_bp{\wd0}}{\_bp{\_ht0+\_dp0}}{\_bp{\_roundness}} B Q}\_vss}%
+ \_ht0=\_dimexpr\_ht0+\_dimen1 \_relax \_dp0=\_dimexpr\_dp0+\_dimen1 \_relax
+ \_box0
+ \_kern\_dimen0}%
+ \_egroup % of \vbox\bgroup
+}
+\_optdef\_incircle[]{\_vbox\_bgroup
+ \_ratio=1 \_fcolor=\Yellow \_lcolor=\Red \_lwidth=.5bp
+ \_shadow=N \_overlapmargins=N \_hhkern=3pt \_vvkern=3pt
+ \_ea\_the \_ea\_circleparams \_space \_relax
+ \_ea\_the \_ea\_opt \_space \_relax
+ \_touppervalue\_overlapmarginsvalue \_touppervalue\_shadowvalue
+ \_setbox0=\_hbox\_bgroup\_bgroup \_aftergroup\_incircleA \_kern\_hhkern \_let\_next=%
+}
+\_def\_incircleA {\_isnextchar\_colorstackpop\_incircleB\_incircleC}
+\_def\_incircleB #1{#1\_isnextchar\_colorstackpop\_incircleB\_incircleC}
+\_def\_incircleC {\_egroup % of \setbox0=\hbox\bgroup
+ \_wd0=\dimexpr \_wd0+\_hhkern \_relax
+ \_ht0=\dimexpr \_ht0+\_vvkern \_relax \_dp0=\dimexpr \_dp0+\_vvkern \_relax
+ \_ifdim \_ratiovalue\_dimexpr \_ht0+\_dp0 > \_wd0
+ \_dimen3=\_dimexpr \_ht0+\_dp0 \_relax \_dimen2=\_ratiovalue\_dimen3
+ \_else \_dimen2=\_wd0 \_dimen3=\_expr{1/\_ratiovalue}\_dimen2 \fi
+ \_setflcolors\_tmp
+ \_ifx\_overlapmarginsvalue N\_dimen0=0pt \_dimen1=0pt
+ \_else \_dimen0=-\hhkern \_dimen1=-\vvkern \_fi
+ \_hbox{\_kern\dimen0
+ \_ifx\_shadowvalue N\_else
+ \_edef\_tmpb{{\_bp{\_dimen2+\_lwidth}}{\_bp{\_dimen3+\_lwidth}}{}}%
+ \_doshadow\_circlet
+ \_fi
+ \_pdfliteral{q \_bp{\_lwidth} w \_tmp \_mv{\_bp{.5\_wd0}}{\_bp{(\ht0-\dp0)/2}}
+ {\_circle{\_bp{\_dimen2}}{\_bp{\_dimen3}} B} Q}%
+ \_ifdim\_dimen1=0pt \_else
+ \_ht0=\dimexpr \_ht0+\_dimen1 \_relax \_dp0=\dimexpr \_dp0+\_dimen1 \_relax \_fi
+ \_box0
+ \_kern\_dimen0}
+ \_egroup % of \vbox\bgroup
+}
+\_def\_circlet#1#2#3{\_circle{#1}{#2}}
+
+\_public
+ \inoval \incircle \ratio \lwidth \fcolor \lcolor \shadow \overlapmargins ;
+
+ \_doc -----------------------------
+ A shadow effect is implemented here. The shadow is equal to the
+ silhouette of the given path in gray-transparent color shifted by
+ `\shadowmoveto` vector and with blurred boundary.
+ A waistline with the width 2*`\shadowb` around the boundary is blurred.
+ The `\shadowlevels` levels of transparent shapes is used for creating
+ this effect. The `\shadowlevels+1/2` level is equal to the shifted given path.
+ \_cod -----------------------------
+
+\_def\_shadowlevels{9} % number of layers for blurr effect
+\_def\_shadowdarknessA{0.025} % transparency of first shadowlevels/2 layers
+\_def\_shadowdarknessB{0.07} % transparency of second half of layers
+\_def\_shadowmoveto{1.8 -2.5} % vector defines shifting layer (in bp)
+\_def\_shadowb{1} % 2*shadowb = blurring area thickness
+
+ \_doc -----------------------------
+ The `\_pdfpageresources` primitive is used to define transparency.
+ It does not work when used in a box. So, we use it at begining of
+ output routine. The modification of output routine is done only once
+ when the shadow effect is used first.
+ \_cod -----------------------------
+
+\_def\_insertshadowresources{%
+ \_global\_addto\_begoutput{\_setshadowresources}%
+ \_xdef\_setshadowresources{%
+ \_pdfpageresources{/ExtGState
+ <<
+ /op1 << /Type /ExtGState /ca \_shadowdarknessA >>
+ /op2 << /Type /ExtGState /ca \_shadowdarknessB >>
+ >>
+ }%
+ }%
+ \_global\_let\_insertshadowresources=\_relax
+}
+\_def\_doshadow#1{\_vbox{%
+ \_insertshadowresources
+ \_tmpnum=\_numexpr (\_shadowlevels-1)/2 \_relax
+ \_edef\_tmpfin{\_the\_tmpnum}%
+ \_ifnum\_tmpfin=0 \_def\_shadowb{0}\_def\_shadowstep{0}%
+ \_else \_edef\_shadowstep{\_expr{\_shadowb/\_tmpfin}}\_fi
+ \_def\_tmpa##1##2##3{\_def\_tmpb
+ {#1{##1+2*\_the\_tmpnum*\_shadowstep}{##2+2*\_the\_tmpnum*\_shadowstep}{##3}}}%
+ \_ea \_tmpa \_tmpb
+ \_def\_shadowlayer{%
+ \_ifnum\_tmpnum=0 /op2 gs \_fi
+ \_tmpb\_space f
+ \_immediateassignment\_advance\_tmpnum by-1
+ \_ifnum-\_tmpfin<\_tmpnum
+ \_ifx#1\_oval 1 0 0 1 \_shadowstep\_space \_shadowstep\_space cm \_fi
+ \_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
+ \_else 1 0 0 1 -\_shadowb\_space -\_shadowb\_space cm \_fi
+ \_shadowlayer Q}
+}}
+
+ \_doc -----------------------------
+ A generic macro `\clipinpath{<x>}{<y>}{<curve>}{<text>}` declares
+ a clipping path by <curve> shifted by <x>, <y>. The <text> is typesset
+ when such clipping path is active. Dimensions are given by bp without the unit here.
+ Macros `\clipinoval <x> <y> <width> <height> {<text>}` and
+ `\clipincircle <x> <y> <width> <height> {<text>}` are defined here.
+ These marcos read normal \TeX/ dimensions in their parameters.
+ \_cod -----------------------------
+
+\_def\_clipinpath#1#2#3#4{% #1=x-pos[bp], #2=y-pos[bp], #3=curve, #4=text
+ \_hbox{\setbox0=\hbox{{#4}}%
+ \_tmpdim=\wd0 \wd0=0pt
+ \_pdfliteral{q \_mv{#1}{#2}{#3 W n}}%
+ \_box0\_pdfliteral{Q}\_kern\_tmpdim
+ }%
+}
+
+\_def\_clipinoval {\_ea\_ea\_ea\_clipinovalA\_scantwodimens}
+\_def\_clipinovalA #1#2{%
+ \_def\_tmp{{#1/65781.76}{#2/65781.76}}%
+ \_ea\_ea\_ea\_clipinovalB\_scantwodimens
+}
+\_def\_clipinovalB{\_ea\_clipinovalC\_tmp}
+\_def\_clipinovalC#1#2#3#4{%
+ \_ea\_clipinpath{#1-(#3/131563.52)+(\_bp{\_roundness})}{#2-(#4/131563.52)+(\_bp{\_roundness})}%
+ {\_oval{#3/65781.76-(\_bp{2\_roundness})}{#4/65781.76-(\_bp{2\_roundness})}{\_bp{\_roundness}}}%
+}
+\_def\_clipincircle {\_ea\_ea\_ea\_clipincircleA\_scantwodimens}
+\_def\_clipincircleA #1#2{%
+ \_def\_tmp{{#1/65781.76}{#2/65781.76}}%
+ \_ea\_ea\_ea\_clipincircleB\_scantwodimens
+}
+\_def\_clipincircleB#1#2{%
+ \_ea\_clipinpath\_tmp{\_circle{#1/65781.76}{#2/65781.76}}%
+}
+
\_endcode % -------------------------------------
diff --git a/macros/luatex/optex/lists.opm b/macros/luatex/optex/lists.opm
index adc28a3617..067fa4a7d9 100644
--- a/macros/luatex/optex/lists.opm
+++ b/macros/luatex/optex/lists.opm
@@ -6,11 +6,20 @@
`\aboveliskip` is used above the list of items,
`\belowliskip` is used below the list of items and
`\interliskip` is used between items.
+ `\listskipA` is used as `\listskipamount` at level 1 of items.
+ `\listskipB` is used as `\listskipamount` at other levels.
\_cod -----------------------------
-\_def\_aboveliskip {\_removelastskip \_penalty-100 \_medskip}
-\_def\_belowliskip {\_penalty-200 \_medskip}
+\_def\_aboveliskip {\_removelastskip \_penalty-100 \_vskip\_listskipamount}
+\_def\_belowliskip {\_penalty-200 \_vskip\_listskipamount}
\_def\_interliskip {}
+\_def\_listskipA {\_medskipamount}
+\_def\_listskipB {0pt plus.5\smallskipamount}
+
+\_def\_setlistskip {%
+ \_ifnum \_ilevel = 1 \_listskipamount = \_listskipA \_relax
+ \_else \_listskipamount = \_listskipB \_relax
+ \_fi}
\_doc -----------------------------
The `\itemnum` is localy reset to zero in each group declared by
@@ -27,20 +36,30 @@
\_newcount\_itemnum \_itemnum=0
\_newtoks\_printitem
-\_def\_begitems{\_par \_ifnum\_lastpenalty<10000 \_aboveliskip \_fi
+\_def\_begitems{\_par
\_bgroup
+ \_advance \_ilevel by1
+ \_setlistskip
+ \_ifnum\_lastpenalty<10000 \_aboveliskip \_fi
\_itemnum=0 \_adef*{\_startitem}
\_advance\_leftskip by\_iindent
\_printitem=\_defaultitem
- \_the\_everybegitems
+ \_the\_everylist \_relax
}
-\_def\_enditems{\_par\_egroup\_belowliskip}
+\_def\_enditems{\_par\_belowliskip\_egroup}
\_def\_startitem{\_par \_ifnum\_itemnum>0 \_interliskip \_fi
\_advance\_itemnum by1
\_the\_everyitem \_noindent\_llap{\_the\_printitem}\_ignorespaces
}
+ \_doc ----------------------------
+ `\novspaces` sets `\listsipamount` to 0pt.
+ \_cod ----------------------------
+
+\_def\_novspaces {\_removelastskip \_listskipamount=0pt \_relax}
+\_public \novspaces ;
+
\_doc -----------------------------
Various item marks are saved in `\_item:<letter>` macros.
You ca re-define then or define more such macros.
diff --git a/macros/luatex/optex/makeindex.opm b/macros/luatex/optex/makeindex.opm
index 5f13f5ca5a..2a783d8895 100644
--- a/macros/luatex/optex/makeindex.opm
+++ b/macros/luatex/optex/makeindex.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \makeindex {Makeindex and sorting <2020-03-16>} % loaded in format
+\_codedecl \makeindex {Makeindex and sorting <2020-04-26>} % loaded in format
\_doc -----------------------------
`\makeindex` implements sorting algorithm at \TeX/ macrolanguage level.
@@ -67,8 +67,10 @@
these declared characters are used.
The characters declared in `\_ignoredchars` are ignored in first pass
- without additional condidion. They are ignored in second pass only if
- they are not mentioned in the `\_sortingdata<iso-code>` macro.
+ without additional condidion. All characters are taken into acount in
+ second pass: ASCII characters with code $<65$ are sorted first if they
+ are not mentioned in the `\_sortingdata<iso-code>` macro.
+ Others not mentioned characters have undefined behavior during sorting.
\_cod -----------------------------
\_def \_ignoredcharscs {.,;?!:'"|()[]<>=+}
@@ -116,7 +118,7 @@
\_ifx##1,\_advance\_tmpnum by1
\_else \_lccode`##1=\_tmpnum \_fi
\_ea\_act \_fi}%
- \_tmpnum=60 \_ea\_act \_sortingdata \_relax
+ \_tmpnum=65 \_ea\_act \_sortingdata \_relax
\_def \_act ##1{\_ifx##1\_relax \_else
\_lccode`##1=`\^^I
\_ea\_act \_fi}%
@@ -131,7 +133,7 @@
\_def \_act ##1{\_ifx##1\_relax \_else
\_ifx##1,\_else \_advance\_tmpnum by1 \_lccode`##1=\_tmpnum \_fi
\_ea\_act \_fi}%
- \_tmpnum=60 \_ea\_act \_sortingdata \_relax
+ \_tmpnum=65 \_ea\_act \_sortingdata \_relax
}
\_doc -----------------------------
diff --git a/macros/luatex/optex/multicolumns.opm b/macros/luatex/optex/multicolumns.opm
index 291eb1cfd0..cf4d26bbb4 100644
--- a/macros/luatex/optex/multicolumns.opm
+++ b/macros/luatex/optex/multicolumns.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \begmulti {Balanced columns <2020-03-08>} % preloaded in format
+\_codedecl \begmulti {Balanced columns <2020-03-26>} % preloaded in format
\_doc -----------------------------
This code is documented in detail in the \"\TeX/book naruby", pages 244--246,
@@ -33,7 +33,7 @@
\_def\par{\_ifhmode\_endgraf\_global\_advance\_mullines by\_prevgraf\_fi}%
}
\_def\_endmulti{\_vskip-\_prevdepth\_vfil
- \_expandafter\_egroup\_expandafter\_baselineskip\_the\_baselineskip\_relax
+ \_ea\_egroup\_ea\_baselineskip\_the\_baselineskip\_relax
\_dimen0=.8\_maxdimen \_tmpnum=\_dimen0 \_divide\_tmpnum by\_baselineskip
\_splittopskip=\_baselineskip
\_setbox1=\_vsplit6 to0pt
@@ -68,10 +68,10 @@
\_divide\_dimen0 by\_Ncols \_relax
\_ifx\_balancecolumns\_flushcolumns \_advance\_dimen0 by-.5\_vsize \_fi
\_dimen1=\_vsize \_corrsize{\_dimen1}\_dimen2=\_dimen1
- \_advance\_dimen2 by-\_Ncols\_baselineskip
+ \_advance\_dimen2 by-\_baselineskip
%% split the material to more pages?
\_ifvoid6 \_else
- \_ifdim \_dimen0>\_dimen2 \_expandafter\_expandafter\_expandafter \_splitpart
+ \_ifdim \_dimen0>\_dimen2 \_ea\_ea\_ea \_splitpart
\_else \_balancecolumns % last balancing
\_fi \_fi
}
@@ -88,7 +88,7 @@
\_ifvoid6 \_else
\_advance \_dimen0 by.2\_baselineskip
\_setbox6=\_copy7
- \_expandafter \_tmp \_fi}\_tmp
+ \_ea \_tmp \_fi}\_tmp
\_hbox{}\_nobreak\_vskip-\_splittopskip \_nointerlineskip
\_hbox to\_hsize{\_unhbox1\_unskip}%
\_egroup
diff --git a/macros/luatex/optex/op-slides.tex b/macros/luatex/optex/op-slides.tex
index fb691fcd9d..1787cf3aff 100644
--- a/macros/luatex/optex/op-slides.tex
+++ b/macros/luatex/optex/op-slides.tex
@@ -167,32 +167,32 @@ The previous page was created by:
\pg; %------------------------------------------------------------------
-\sec Putting images and text wherever
+\sec Putting images and texts wherever
-* `\puttext <down> <right> {<text>}` puts a <text> to the desired place:
- It moves the current point <down> and <right>, puts the <text> and returns
+* `\puttext <right> <up> {<text>}` puts a <text> to the desired place:
+ It moves the current point <right> and <up>, puts the <text> and returns
back, so the typesetting continues from previous position. The parameters
- <down> and <right> are dimensions. For example
+ <right> and <up> are dimensions. For example
\begtt
-\puttext -50mm 0mm {\Red HELLO}
+\puttext 0mm 50mm {\Red HELLO}
\endtt
- \puttext -50mm 0mm {\Red HELLO}
+ \puttext 0mm 50mm {\Red HELLO}
prints red HELLO, as shown here.\pg+
-* `\putpic <down> <right> <width> <height> {<image-file>}`
+* `\putpic <right> <up> <width> <height> {<image-file>}`
puts the image with desired <width> and <height> at the position like
`\puttext` puts the text.
- \putpic -20mm .8\hsize 30mm \nospec {op-ring.png}
+ \putpic .8\hsize 20mm 30mm \nospec {op-ring.png}
* The ring above is the result of
\begtt
-\putpic -20mm .8\hsize 30mm \nospec {op-ring.png}
+\putpic .8\hsize 20mm 30mm \nospec {op-ring.png}
\endtt
%
- used ad beginning of this paragraph.\pg+
+ used at beginning of this paragraph.\pg+
* Use `\nospec` for <width> or <height> of the image if you don't want to specify both
dimensions (because you don't want to change the image aspect ratio).
diff --git a/macros/luatex/optex/optex.ini b/macros/luatex/optex/optex.ini
index e4a09eec0a..31d5f5171a 100644
--- a/macros/luatex/optex/optex.ini
+++ b/macros/luatex/optex/optex.ini
@@ -16,11 +16,12 @@
\catcode `\^^I=10 % ascii tab is a blank space
\catcode `\_=11 % underline can be used in control sequences
\catcode `\~=13 % tilde is active
+\catcode `\^^a0=13 % non breaking space in Unicode
\catcode 127=12 % normal character
% OpTeX version
-\def\optexversion{Alpha 0.07 Mar 2020}
+\def\optexversion{Alpha 0.08 Mar 2020}
% Engine testing:
@@ -86,6 +87,7 @@
\_everyjob = {%
\_message{This is OpTeX (Olsak's Plain TeX), version <\optexversion>^^J}%
+ \_mathchardef\_fnotestack=\_pdfcolorstackinit page {0 g 0 G}%
\_mathsbon % replaces \int_a^b to \int _a^b
\_inputref % inputs \jobname.ref if exists
}
diff --git a/macros/luatex/optex/others.opm b/macros/luatex/optex/others.opm
index 4c6b49dd2d..6c656ec0e0 100644
--- a/macros/luatex/optex/others.opm
+++ b/macros/luatex/optex/others.opm
@@ -27,11 +27,16 @@
\_let\chyph=\cslang \_let\shyph=\sklang
\_let\csUnicode=\csPatt \_let\czUnicode=\csPatt \_let\skUnicode=\skPatt
+% classical \ten* macros (keeps only preloaded fonts!)
+
\_let \letfont = \_fontlet
\_let \tenrm = \_tenrm \_let \tenbf = \_tenbf
\_let \tenit = \_tenit \_let \tenbi = \_tenbi
\_let \tentt = \_tentt
+% non breaking space in Unicode
+
+\let ^^a0=~
% TikZ needs these control sequences:
diff --git a/macros/luatex/optex/output.opm b/macros/luatex/optex/output.opm
index a81e5e8c0a..a10779e7a8 100644
--- a/macros/luatex/optex/output.opm
+++ b/macros/luatex/optex/output.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \nopagenumbers {Output routine <2020-03-15>} % preloaded in format
+\_codedecl \nopagenumbers {Output routine <2020-03-28>} % preloaded in format
\_doc -----------------------------
`\_optexouput` is default output routine. You can create another...
@@ -59,6 +59,7 @@
\_ensureblack{\_makefootline}}%
}
\_def \_ensureblack #1{#1} % will be re-defined by color macros
+\_let \_openfnotestack = \_relax % will be re-defined by color macros
\_def \_backgroundbox #1{\_moveleft\_hoffset\_vbox to0pt{\_kern-\voffset #1\_vss}}
\_doc -----------------------------
@@ -94,7 +95,7 @@
\_dimen0=\dp255 \_unvbox255 % open up \box255
\_ifvoid\_footins \_else % footnote info is present
\_vskip\_skip\_footins
- \_ensureblack{\_footnoterule \_unvbox\_footins}\fi
+ \_ensureblack{\_footnoterule \_openfnotestack \_unvbox\_footins}\fi
\_ifraggedbottom \kern-\_dimen0 \_vfil \_fi
}
\_def \_pagedest {{\_def\_destheight{25pt}\_dest[pg:\_the\_gpageno]}}
@@ -132,14 +133,18 @@
\_def \_opfootnote #1#2{\_insert\_footins\_bgroup
\_interlinepenalty=\_interfootnotelinepenalty
\_leftskip=0pt \_rightskip=0pt \_spaceskip=0pt \_xspaceskip=0pt \_relax
+ \_let\_colorstackcnt=\_fnotestack % special color stack for footnotes
#1\_relax % local settings used by \fnote macro
\_splittopskip=\_ht\_strutbox % top baseline for broken footnotes
\_splitmaxdepth=\_dp\_strutbox \_floatingpenalty=20000
\_textindent{#2}\_footstrut
- \_isnextchar \_bgroup {\_bgroup \_aftergroup\_vfootA \_let\_next=}{\_vfootB}%
+ \_isnextchar \_bgroup
+ {\_bgroup \_aftergroup\_vfootA \_afterassignment\_ignorespaces \_let\_next=}{\_vfootB}%
}
-\_def\_vfootA{\_strut\_egroup}
-\_def\_vfootB #1{#1\_vfootA}
+\_def\_vfootA{\_unskip\_strut\_isnextchar\_colorstackpop\_closefncolor\_vfootF}
+\_def\_vfootB #1{#1\_uskip\_strut\_vfootF}
+\_def\_vfootF{\_egroup} % close \_insert\_footins\_bgroup
+\_def\_closefncolor#1{#1\_isnextchar\_colorstackpop\_closefncolor\_vfootF}
\_def \_footstrut {\_vbox to\_splittopskip{}}
\_skip\_footins=\_bigskipamount % space added when footnote is present
\_count\_footins=1000 % footnote magnification factor (1 to 1)
diff --git a/macros/luatex/optex/parameters.opm b/macros/luatex/optex/parameters.opm
index 4ae0aa4d98..2a85a08159 100644
--- a/macros/luatex/optex/parameters.opm
+++ b/macros/luatex/optex/parameters.opm
@@ -97,6 +97,9 @@
and set default page dimensions as A4, no letter.
\_cod -----------------------------
+\_emergencystretch=20pt % we want to use third pass of aparagraph building algoritmh
+ % we need not to keep the compatibility with old documents
+
\_clubpenalty=10000 % after first line of paragraph
\_widowpenalty=10000 % before last line of paragraph
@@ -121,6 +124,7 @@
\_cod -----------------------------
\_def\_plaintexsetting{%
+ \_emergencystretch=0pt
\_clubpenalty=150
\_widowpenalty=150
\_pdfvorigin=1in
@@ -242,14 +246,16 @@
The default item mark used between `\bgitems` and `\enditems` is bullet.
The `\everyitem` token list is applied in vertical mode
at the start of each item.
- The `\everybegitems` token list is applied after group is openem by
+ The `\everylist` token list is applied after group is openem by
`\begitems`.
\_cod -----------------------------
\_newtoks\_defaultitem \_defaultitem={$\_bullet$\_enspace}
\_newtoks\_everyitem
-\_newtoks\_everybegitems
-\_public \defaultitem \everyitem \everybegitems ;
+\_newtoks\_everylist
+\_newskip \_listskipamount \_listskipamount=\_medskipamount
+\_newcount \_ilevel
+\_public \defaultitem \everyitem \everylist \listskipamount \ilevel ;
\_doc -----------------------------
The `\tit` macro includes `\vglue\titskip` above the title of the document.
@@ -417,6 +423,23 @@
\_newtoks \_pgbackground \_pgbackground={} % for page background
\_public \pgbackground ;
+ \_doc -----------------------------
+ The parameters used in `\inoval` and `\incircle` macros.
+ The default values (documented in user manual) are set in the macros.
+ User can re-set thse values using tokens \ovalparams, \circleparams.
+ \_cod -----------------------------
+
+\_newtoks \_ovalparams
+\_newtoks \_circleparams
+%\_ovalparams={\_roundness=2pt \_fcolor=\Yellow \_lcolor=\Red \_lwidth=.5bp
+% \_shadow=N \_overlapmargins=N \_hhkern=0pt \_vvkern=0pt }
+%\_circleparams={\_ratio=1 \_fcolor=\Yellow \_lcolor=\Red \_lwidth=.5bp
+% \_shadow=N \_overlapmargins=N \_hhkern=3pt \_vvkern=3pt}
+
+\_newdimen \_roundness \_roundness=5mm % used in \clippingoval macro
+
+\_public \ovalparams \circleparams \roundness ;
+
\_endcode %----------------------------------------------------
diff --git a/macros/luatex/optex/sections.opm b/macros/luatex/optex/sections.opm
index dae71df77a..2a7629560c 100644
--- a/macros/luatex/optex/sections.opm
+++ b/macros/luatex/optex/sections.opm
@@ -128,10 +128,13 @@
\_newcount \_fnum % figure numbers
\_newcount \_dnum % numbered display maths
-\_def \_chapx {\_incr\_chapnum \_secnum=0 \_seccnum=0 \_tnum=0 \_fnum=0 \_dnum=0 \_lfnotenum=0 }
-\_def \_secx {\_incr\_secnum \_seccnum=0 \_tnum=0 \_fnum=0 \_dnum=0 }
+\_def \_chapx {\_incr\_chapnum \_secnum=0 \_seccnum=0 \_resetcountchap \_lfnotenum=0 }
+\_def \_secx {\_incr\_secnum \_seccnum=0 \_resetcountsec }
\_def \_seccx {\_incr\_seccnum }
+\_def \_resetcountchap {\_tnum=0 \_fnum=0 \_dnum=0 }
+\_def \_resetcountsec {\_tnum=0 \_fnum=0 }
+
\_def \_thechapnum {\_the\_chapnum}
\_def \_thesecnum {\_othe\_chapnum.\_the\_secnum}
\_def \_theseccnum {\_othe\_chapnum.\_the\_secnum.\_the\_seccnum}
@@ -350,6 +353,55 @@
}
\_public \eqmark ;
-\_endcode % -------------------------------------
+ \_doc -----------------------------
+ The `\numberedpar <letter>{<name>}` is implemented here.
+ You can say `\let\resetcountsec=\relax` if you don't want to reset
+ counters A, B, C, D, E nor `\fnum` nor `\tnum` in sections, but only in
+ chapters. Or you can define you own concept of `\_chapx` and `\_secx`
+ macros (see above). Then you will want to re-define `\_theAnum`, `\_thefnum`
+ etc. macros.
+ \_cod -----------------------------
+
+\_newcount\_counterA \_newcount\_counterB \_newcount\_counterC
+\_newcount\_counterD \_newcount\_counterE
+
+\_def\_resetcounters{\_counterA=0 \_counterB=0 \_counterC=0 \_counterD=0 \_counterE=0 }
+\_addto \_resetcountchap {\_resetcounters}
+\_addto \_resetcountsec {\_resetcounters}
+
+\_def \_theAnum {\_othe\_chapnum.\_othe\_secnum.\_the\_counterA}
+\_def \_theBnum {\_othe\_chapnum.\_othe\_secnum.\_the\_counterB}
+\_def \_theCnum {\_othe\_chapnum.\_othe\_secnum.\_the\_counterC}
+\_def \_theDnum {\_othe\_chapnum.\_othe\_secnum.\_the\_counterD}
+\_def \_theEnum {\_othe\_chapnum.\_othe\_secnum.\_the\_counterE}
+
+\_def\_numberedpar#1#2{\_ea \_incr \_csname _counter#1\_endcsname
+ \_def\_tmpa{#1}\_def\_tmpb{#2}\_numberedparparam}
+\_optdef\_numberedparparam[]{%
+ \_ea \_printnumberedpar \_csname _the\_tmpa num\_ea\_endcsname\_ea{\_tmpb}}
+ \_doc -----------------------------
+ The `\_printnumberedpar \theXnum {<name>}` opens numbered paragraph and
+ prints it. The optional parameter is in `\_the\_opt`. You can re-define
+ it if you need another design.
+
+ `\_printnumberedpar` need not to be re-define if you only need to print
+ Theorems in italic and to insert vertical skips (for example). You can do this
+ by the following:
+ \_begtt
+ \def\theorem {\medskip\bgroup\it \numberedpar A{Theorem}}
+ \def\endtheorem {\par\egroup\medskip}
+ \_endtt
+ \theorem Let $M$ be... \endtheorem
+ \_cod -----------------------------
+
+\_def \_printnumberedpar #1#2{\_par
+ \_noindent\_wlabel #1%
+ {\bf #2 #1\_istoksempty\_opt\_iffalse \_space \_the\_opt \_fi.}\_space
+ \_ignorespaces
+}
+\_public \numberedpar ;
+
+
+\_endcode % -------------------------------------
diff --git a/macros/luatex/optex/slides.opm b/macros/luatex/optex/slides.opm
index faff579798..135a2bdce4 100644
--- a/macros/luatex/optex/slides.opm
+++ b/macros/luatex/optex/slides.opm
@@ -69,15 +69,15 @@
the next text after `\pg+`.
\_cod -----------------------------
-\_newcount\_ilevel \_newcount\_gilevel
+\_newcount\_gilevel
\_def\*{*}
\_adef*{\_startitem}
\_sdef{_item:X}{\Blue\_raise.2ex\_fullrectangle{.8ex}\_kern.5em}
\_sdef{_item:x}{\Blue\_raise.3ex\_fullrectangle{.6ex}\_kern.4em}
\_style X
-\_addto\_begitems{\_style x }\public \begitems ;
\_def\_egroups{\_par\_global\_gilevel=\_ilevel \_egroup}
-\_everybegitems={\_advance\_ilevel by1 \_addto\_egroups{\_egroup}}
+\_everylist={\_novspaces \_ifcase\_ilevel \_or \_style x \_else \_style - \_fi
+ \_addto\_egroups{\_egroup}}
\_doc -----------------------------
The default values of `\pg;`, `\pg+` and `\pg.` are very simple.
diff --git a/macros/luatex/optex/styles.opm b/macros/luatex/optex/styles.opm
index 13aaec91b2..d2ef38a013 100644
--- a/macros/luatex/optex/styles.opm
+++ b/macros/luatex/optex/styles.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \report {Basic styles of OpTeX <2020-03-18>} % preloaded in format
+\_codedecl \report {Basic styles of OpTeX <2020-03-28>} % preloaded in format
\_doc -----------------------------
The `{\boxlines <line-1><eol><line-2><eol>...<line-n><eol>}`
@@ -28,6 +28,7 @@
\_def\_report{
\_typosize[11/13.2]
+ \_vsize=\_dimexpr \_topskip + 52\_baselineskip \_relax % added 2020-03-28
\_let\_titfont=\_chapfont
\_titskip=3ex
\_eoldef\_author##1{\_removelastskip\_bigskip
@@ -42,6 +43,7 @@
\_def\_subject{{\_bf \_mtext{subj}: }}
\_public \address \subject ;
\_typosize[11/14]
+ \_vsize=\_dimexpr \_topskip + 49\_baselineskip \_relax % added 2020-03-28
\_parindent=0pt
\_parskip=\_medskipamount
\_nopagenumbers
diff --git a/macros/luatex/optex/verbatim.opm b/macros/luatex/optex/verbatim.opm
index c7593a7d7a..cfd9ed4354 100644
--- a/macros/luatex/optex/verbatim.opm
+++ b/macros/luatex/optex/verbatim.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \begtt {Verbatim <2020-03-18>} % preloaded in format
+\_codedecl \begtt {Verbatim <2020-03-21>} % preloaded in format
\_doc ----------------------------
The internal parameters for verbatim macros are set.
@@ -146,7 +146,7 @@
\_fi
}
\_def\_prepareverbdata#1#2{\_def#1{#2}}
-\_def\_printverbline#1{\_penalty \_ttpenalty \_indent \_printverblinenum #1 \par}
+\_def\_printverbline#1{\_penalty \_ttpenalty \_indent \_printverblinenum #1\par}
\_def\_initverblinenum{\_tenrm \_thefontscale[700]\_ea\_let\_ea\_sevenrm\_the\_font}
\_def\_printverblinenum{\_global\_advance\_ttline by1 \_llap{\_sevenrm \_the\_ttline\_kern.9em}}