summaryrefslogtreecommitdiff
path: root/macros/luatex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-02-10 03:01:13 +0000
committerNorbert Preining <norbert@preining.info>2021-02-10 03:01:13 +0000
commit7428e668f046bec10d1200214789e40390fa51e7 (patch)
treed28de61e9d3ed96c80ebf2300d0ba3d6a76414e6 /macros/luatex
parent1350502b809c028b8f123dec94ca92782eda564f (diff)
CTAN sync 202102100301
Diffstat (limited to 'macros/luatex')
-rw-r--r--macros/luatex/optex/README9
-rw-r--r--macros/luatex/optex/base/basic-macros.opm37
-rw-r--r--macros/luatex/optex/base/cite-bib.opm2
-rw-r--r--macros/luatex/optex/base/doc.opm2
-rw-r--r--macros/luatex/optex/base/fonts-select.opm6
-rw-r--r--macros/luatex/optex/base/hyperlinks.opm5
-rw-r--r--macros/luatex/optex/base/if-macros.opm14
-rw-r--r--macros/luatex/optex/base/languages.opm24
-rw-r--r--macros/luatex/optex/base/makeindex.opm11
-rw-r--r--macros/luatex/optex/base/maketoc.opm49
-rw-r--r--macros/luatex/optex/base/math-macros.opm32
-rw-r--r--macros/luatex/optex/base/math-preload.opm24
-rw-r--r--macros/luatex/optex/base/math-unicode.opm6
-rw-r--r--macros/luatex/optex/base/more-macros.opm2
-rw-r--r--macros/luatex/optex/base/optex.ini2
-rw-r--r--macros/luatex/optex/base/others.opm2
-rw-r--r--macros/luatex/optex/base/outlines.opm42
-rw-r--r--macros/luatex/optex/base/parameters.opm42
-rw-r--r--macros/luatex/optex/base/pdfuni-string.opm71
-rw-r--r--macros/luatex/optex/base/ref-file.opm14
-rw-r--r--macros/luatex/optex/base/references.opm5
-rw-r--r--macros/luatex/optex/base/sections.opm52
-rw-r--r--macros/luatex/optex/base/slides.opm6
-rw-r--r--macros/luatex/optex/base/table.opm19
-rw-r--r--macros/luatex/optex/base/unimath-codes.opm40
-rw-r--r--macros/luatex/optex/base/unimath-table.opm3
-rw-r--r--macros/luatex/optex/base/verbatim.opm16
-rw-r--r--macros/luatex/optex/demo/op-demo.tex4
-rw-r--r--macros/luatex/optex/demo/op-slides.tex2
-rw-r--r--macros/luatex/optex/doc/omls.tex832
-rw-r--r--macros/luatex/optex/doc/optex-doc.pdfbin1362584 -> 1366580 bytes
-rw-r--r--macros/luatex/optex/doc/optex-doc.tex4
-rw-r--r--macros/luatex/optex/doc/optex-math.tex6
-rw-r--r--macros/luatex/optex/doc/optex-techdoc.tex2
-rw-r--r--macros/luatex/optex/doc/optex-userdoc.tex45
35 files changed, 1203 insertions, 229 deletions
diff --git a/macros/luatex/optex/README b/macros/luatex/optex/README
index 50d4f1d165..6c5ae30b5a 100644
--- a/macros/luatex/optex/README
+++ b/macros/luatex/optex/README
@@ -19,7 +19,14 @@ doc/ ... PDF version of the OpTeX documentation and sources.
History:
-<0.19> Jan. 2020
+<1.00> Feb. 2021
+ The OMLS (OpTeX Markup Language Standard) was developed. It helps to create
+ convertors from/to OpTeX documents and similar applications.
+ \pdfunidef re-imeplemted.
+ \thisoutline introduced.
+ \verbchar introduced instead \activettchar.
+ Bugs fixing.
+<0.19> Jan. 2021
emoji support as pkg/emoji.opm.
non-braakable places generated by luavlna, suported as pkg/vlna.opm.
\begblock...\endblock introduced.
diff --git a/macros/luatex/optex/base/basic-macros.opm b/macros/luatex/optex/base/basic-macros.opm
index 3f0f7a5c24..4d465c3010 100644
--- a/macros/luatex/optex/base/basic-macros.opm
+++ b/macros/luatex/optex/base/basic-macros.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \sdef {Basic macros for OpTeX <2021-01-08>} % loaded in format
+\_codedecl \sdef {Basic macros for OpTeX <2021-02-03>} % loaded in format
\_doc ------------------------------
\`\bgroup`, \`\egroup`, \`\empty`, \`\space`, \`\null` and \`\wlog`
@@ -12,31 +12,31 @@
\_def \_space { }
\_def \_null {\_hbox{}}
\_def \_wlog {\_immediate\_write-1 } % write on log file (only)
-
\_public \bgroup \egroup \empty \space \null \wlog ;
\_doc ------------------------------
- \`\ignoreit` ignores next token or `{<text>}`, \`\ignoresecond`
- uses first, ignores second parameter and \`\usesecond`
- ignores first, uses second parameter.
+ \`\ignoreit` ignores next token or `{<text>}`,
+ \`\useit``{<text>}` expands to `<text>` (removes outer braces),
+ \`\ignoresecond` uses first, ignores second parameter and
+ \`\usesecond` ignores first, uses second parameter.
\_cod ------------------------------
\_long\_def \_ignoreit #1{}
+\_long\_def \_useit #1{#1}
\_long\_def \_ignoresecond #1#2{#1}
\_long\_def \_usesecond #1#2{#2}
-
-\_public \ignoreit \ignoresecond \usesecond ;
+\_public \ignoreit \useit \ignoresecond \usesecond ;
\_doc ------------------------------
\`\bslash` is \"normal backslash" with category code 12.
- \`\nbb` and \`\pcent` are double backslash and normal~`%`,
- they should be used in Lua codes, for example.
+ \`\nbb` is double backslash
+ and \`\pcent` is normal~`%`.
+ They can be used in Lua codes, for example.
\_cod ------------------------------
\_edef \_bslash {\_csstring\\}
\_edef \_nbb {\_bslash\_bslash}
\_edef \_pcent{\_csstring\%}
-
\_public \bslash \nbb \pcent ;
\_doc ------------------------------
@@ -52,13 +52,12 @@
\_def \_sdef #1{\_ea\_def \_csname#1\_endcsname}
\_def \_sxdef #1{\_ea\_xdef \_csname#1\_endcsname}
\_def \_slet #1#2{\_ea\_let \_csname#1\_ea\_endcsname \_csname#2\_endcsname}
-
\_public \sdef \sxdef \slet ;
\_doc ------------------------------
\`\adef` `{<char>}{<body>}` puts the <char> as active character and defines it
as `{<body>}`. You can declare a macro with parameters too. For example
- `\adef @#1{...$1...}`.
+ `\adef @#1{...#1...}`.
\_cod ------------------------------
\_def \_adef #1{\_catcode`#1=13 \_begingroup \_lccode`\~=`#1\_lowercase{\_endgroup\_def~}}
@@ -73,7 +72,7 @@
\_cod ------------------------------
\_def \_cs #1{\_csname#1\_endcsname}
-\_def \_trycs#1#2{\_ifcsname #1\_endcsname \_csname #1\_endcsname \_else #2\_fi}
+\_def \_trycs#1#2{\_ifcsname #1\_endcsname \_csname #1\_ea\_endcsname \_else #2\_fi}
\_public \cs \trycs ;
\_doc ------------------------------
@@ -83,6 +82,15 @@
\_long\_def \_addto #1#2{\_ea\_def\_ea#1\_ea{#1#2}}
\_public \addto ;
+ \_doc -----------------------------
+ \`\incr``<counter>` increases `<counter>` by one globally.
+ \`\decr``<counter>` decreases `<counter>` by one globally.
+ \_cod -----------------------------
+
+\_def\_incr #1{\_global\_advance#1by1 }
+\_def\_decr #1{\_global\_advance#1by-1 }
+\_public \incr \decr ;
+
\_doc ------------------------------
\`\opwarning` `{<text>}` prints warning on the terminal and to the log file.
\_cod ------------------------------
@@ -101,7 +109,6 @@
\_tracingparagraphs=1 \_tracingrestores=1 \_tracingscantokens=1
\_tracingifs=1 \_tracinggroups=1 \_tracingassigns=1 }
\_def\_tracingall{\_tracingonline=1 \_loggingall}
-
\_public \loggingall \tracingall ;
\_doc ------------------------------
@@ -116,6 +123,8 @@
\_endcode % -------------------------------------
+2021-02-03: \useit defined.
+2021-01-22: \trycs: \ea added in order to be able to use cs with parameters
2021-01-08: \opwarning format changed (secondly, hope that conclusively)
2020-10-12: \opwarning: line numbers added
2020-02-14: introduced
diff --git a/macros/luatex/optex/base/cite-bib.opm b/macros/luatex/optex/base/cite-bib.opm
index 6327877fbe..26a5b17bd4 100644
--- a/macros/luatex/optex/base/cite-bib.opm
+++ b/macros/luatex/optex/base/cite-bib.opm
@@ -173,7 +173,7 @@
\_def\_nonumcitations{\_lastcitenum=0\_def\_sortcitesA{}\_def\_etalchar##1{$^{##1}$}%
\_def\_citelinkA##1{\_isdefined{_bim:##1}\_iftrue \_csname _bim:##1\_endcsname
- \_else ##1\_opwarning{\_noexpand\nonumcitations + empty bibmark. Maybe bad bib-style}\_fi}
+ \_else ##1\_opwarning{\_noexpand\nonumcitations + empty bibmark. Maybe bad bib-style}\_fi}%
}
\_def\_citelinkA{}
diff --git a/macros/luatex/optex/base/doc.opm b/macros/luatex/optex/base/doc.opm
index 9c979e9849..ce571a9e81 100644
--- a/macros/luatex/optex/base/doc.opm
+++ b/macros/luatex/optex/base/doc.opm
@@ -193,7 +193,7 @@
then use \code{\\_forwardlink\\`\\foo`}.
\_cod -----------------------------
-\_activettchar`
+\_verbchar`
\_def\`#1`{\_leavevmode\_edef\_tmp{\_csstring#1}\_iindex{\_tmp}%
\_ifcsname cs:\_tmp\_endcsname\_else \_dest[cs:\_tmp]\_fi
diff --git a/macros/luatex/optex/base/fonts-select.opm b/macros/luatex/optex/base/fonts-select.opm
index 69cf8909bc..9066d4fed5 100644
--- a/macros/luatex/optex/base/fonts-select.opm
+++ b/macros/luatex/optex/base/fonts-select.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \fontfam {Fonts selection system <2020-12-12>} % preloaded in format
+\_codedecl \fontfam {Fonts selection system <2020-01-27>} % preloaded in format
\_doc -----------------------------
\`\initunifonts` macro extends \LuaTeX's font capabalities,
@@ -19,10 +19,7 @@
\_def\_initunifonts {%
\directlua{%
require('luaotfload-main')
- print_bak = print
- print = function () end
luaotfload.main()
- print = print_bak % "print hack" until luaotfload will be corrected
}%
\_gdef\_rfskipatX ##1" ##2\_relax{"##1"}%
\_global\_let \_doresizefont=\_doresizeunifont
@@ -837,6 +834,7 @@ Luaotfload documentation for more information.
\endinput
+2021-01-27 lua hack (print function) removed because luaotfload 3.17 removes bug.
2020-12-12 \_modlist added, doc improved
2020-04-18 \_tryloadfamslocal introduced
\_fontdecl -> \_famdecl with different concept
diff --git a/macros/luatex/optex/base/hyperlinks.opm b/macros/luatex/optex/base/hyperlinks.opm
index 6e123596c2..5fc8a32233 100644
--- a/macros/luatex/optex/base/hyperlinks.opm
+++ b/macros/luatex/optex/base/hyperlinks.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \ulink {Hyperlinks <2020-04-22>} % preloaded in format
+\_codedecl \ulink {Hyperlinks <2021-01-27>} % preloaded in format
\_doc ----------------------------
\`\dest``[<type>:<spec>]` creates a destination of internal links. The
@@ -88,7 +88,7 @@
\_let\_dest=\_destactive \_let\_link=\_linkactive
\_def\_ilink[##1]##2{\_link[##1]{\_localcolor#1}{##2}}%
\_def\_ulink[##1]##2{\_urlactive[url:##1]{\_localcolor#2}{##2}}%
- \_public \dest \ilink \ulink ;%
+ \_public \dest \ilink \ulink \link ;%
}
\_public \hyperlinks ;
@@ -152,5 +152,6 @@ of internal links are created at the same destination place:
\_endinput
+2021-01-27 \public \link added to \hyperlinks, bug fixed.
2020-04-22 \| in \url: bug fixed
2020-03-15 introduced \ No newline at end of file
diff --git a/macros/luatex/optex/base/if-macros.opm b/macros/luatex/optex/base/if-macros.opm
index 0e7e401558..462e496017 100644
--- a/macros/luatex/optex/base/if-macros.opm
+++ b/macros/luatex/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 <2020-05-22>} % preloaded in format
+\_codedecl \newif {Special if-macros, is-macros and loops <2021-02-03>} % preloaded in format
\_doc ----------------------------
\secc Classical \code{\\newif}
@@ -55,7 +55,7 @@
\_cod ----------------------------
\_long\_def \_loop #1\_repeat{\_def\_body{#1}\_iterate}
-\_def \loop #1\repeat{\_def\_body{#1}\_iterate}
+\_long\_def \loop #1\repeat{\_def\_body{#1}\_iterate}
\_let \_repeat=\_fi % this makes \loop...\if...\repeat skippable
\_let \repeat=\_fi
\_def \_iterate {\_body \_ea \_iterate \_fi}
@@ -93,7 +93,7 @@
\_def\_testparam#1#2#3\_iftrue{\_ifx###1\_empty\_ea\_finbody\_else}
\_def\_finbody#1\_finbody{}
-\_def\foreach #1\do#2#{\_isempty{#2}\_iftrue
+\_long\_def\foreach #1\do#2#{\_isempty{#2}\_iftrue
\_afterfi{\_foreachA{#1}{##1}}\_else\_afterfi{\_foreachA{#1}{#2}}\_fi}
\_doc -----------------------------
@@ -147,15 +147,18 @@
\_sxdef{_frnum:\_the\_forlevel\_ea}{\_the\_frnum}%
\_global\_slet{_fbody:\_the\_forlevel}{_fbody}%
\_fi
- \_global\_advance\_forlevel by1
+ \_incr\_forlevel
}}
\_def\_getforstack{\_immediateassigned{%
- \_global\_advance\_forlevel by-1
+ \_decr\_forlevel
\_ifnum\_forlevel>0
\_global\_slet{_fbody}{_fbody:\_the\_forlevel}%
\_global\_frnum=\_cs{_frnum:\_the\_forlevel}\_space
\_fi
}}
+\_ifx\_immediateassignment\_undefined % for compatibility with older LuaTeX
+ \_let\_immediateassigned=\_useit \_let\_immediateassignment=\_empty
+\_fi
\_doc ----------------------------
User can define own expandable \"foreach" macro by
@@ -301,6 +304,7 @@
\_endcode
+2021-02-03 public version of \loop and \foreach are \long
2020-05-22 \foreach, \fornum: all settings are global, independent on TeX group
2020-05-06 \isnextchar: \let\tmp=#1 -> \let\tmp= #1 (bug fix, #1 should be space)
2020-05-02 \newif bug fix
diff --git a/macros/luatex/optex/base/languages.opm b/macros/luatex/optex/base/languages.opm
index 52b52f775e..ff9373b720 100644
--- a/macros/luatex/optex/base/languages.opm
+++ b/macros/luatex/optex/base/languages.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_mtext {Languages <2020-12-05>} % preloaded in format
+\_codedecl \_mtext {Languages <2021-01-21>} % preloaded in format
\_doc -----------------------------
Only four words are generated by \OpTeX/ macros: \"Chapter",
@@ -110,17 +110,20 @@
itself by \code{\\"{`"`}"}. This is the reason why the sub-verbatim mode is
used when the first character is \code{\{} in the parameter.\nl
The `\"` is defined as `\_qqA\_qqB<lqq><rqq>` and `\'` as `\_qqA\_qqC<lq><rq>`.
- The \`\_qqA``\_qqB<clqq><crqq>` runs \`\_qqB``<lqq><rqq><text>"`.
+ The \`\_qqA``\_qqB<clqq><crqq>` runs \`\_qqB``<lqq><rqq><text>"`.\nl
+ The \`\_regquotes``\""<L><R>` does `\def\"#1"{<L>#1<R>}` for outlines but the `"`
+ separator is active (because `"` and `'` are active in \^`\pdfunidef`).
\_cod -----------------------------
\_def \_quoteschars #1#2#3#4{\_def\_altquotes{\_quoteschars#3#4#1#2}\_public\altquotes;%
\_protected\_def \"{\_qqA\_qqB#1#2}\_protected\_def \'{\_qqA\_qqC#3#4}%
- \_regmacro{}{}{\_def \"##1"{#1##1#2}\_def \'##1'{#3##1#4}}}
+ \_regmacro{}{}{\_regquotes\""#1#2\_regquotes\''#3#4}}
\_def\_qqA#1#2#3{\_bgroup\_setverb \_catcode`\ =10
\_isnextchar\_bgroup{\_catcode`\{=1 \_catcode`\}=2 #1#2#3}{#1#2#3}}
\_long\_def\_qqB#1#2#3"{\_egroup#1\_scantextokens{#3}#2}
\_long\_def\_qqC#1#2#3'{\_egroup#1\_scantextokens{#3}#2}
+\_def\_regquotes#1#2#3#4{\_bgroup \_lccode`~=`#2\_lowercase{\_egroup \_def#1##1~}{#3##1#4}}
\_doc -----------------------------
Sometimes should be usable to leave the markup `"such"` or `'such'` i.e.~without
@@ -128,20 +131,10 @@
by the \`\activequotes` macro and leave quotes without the first backslash.
First, declare `\<iso-code>quotes`, then \^`\altquotes` (if needed) and finally
\^`\activequotes`.
-
- \`\_resetaquotes` redefines expandable version of `\"<text>"` and `\'<text>'`
- used in outlines in order to the delimiter is {\em active} character. We
- are testing if \^`\quoteschars` were used now because the error in outlines
- can be more confusing.
\_cod -----------------------------
-\_def\_activequotes{\_adef"{\"}\_adef'{\'}\_resetaquotes}
-
-\_bgroup \_catcode`,=13 \_lccode`\~=`\" \_lccode`\,=`\' \_lowercase{\_egroup
- \_def\_resetaquotes{%
- \_bgroup \_the\_regoul \_edef\_tmp{\"?"}\_egroup % test if \quoteschar were used
- \_regmacro{}{}{\_edef\"##1~{\"##1"}\_edef\'##1,{\'##1'}}}
-}
+\_def\_activequotes{\_let\_actqq=\"\_adef"{\_actqq}\_let\_actq=\'\_adef'{\_actq}%
+ \_regmacro{}{}{\_adef"{\"}\_adef'{\'}}}
\_public \quoteschars \activequotes \enquotes \csquotes \skquotes \frquotes \plquotes
\esquotes \grquotes \ruquotes \itquotes \dequotes ;
@@ -189,6 +182,7 @@
\_endcode % -------------------------------------
+2021-01-21 more robust quotes in outlines
2020-12-05 bib phrases moved here
2020-04-29 Obrazek -> Abbildung: bug fixed
2020-03-15 introduced
diff --git a/macros/luatex/optex/base/makeindex.opm b/macros/luatex/optex/base/makeindex.opm
index 22b09e396b..8c58f7085c 100644
--- a/macros/luatex/optex/base/makeindex.opm
+++ b/macros/luatex/optex/base/makeindex.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \makeindex {Makeindex and sorting <2020-04-26>} % loaded in format
+\_codedecl \makeindex {Makeindex and sorting <2021-02-01>} % loaded in format
\_doc -----------------------------
\^`\makeindex` implements sorting algorithm at \TeX/ macro-language level.
@@ -68,7 +68,7 @@
The characters declared in `\_ignoredchars` are ignored in the first pass
without additional condition. All characters are taken into account in
- second pass: ASCII characters with code $\lq65$ are sorted first if they
+ second pass: ASCII characters with code $\string<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 -----------------------------
@@ -133,7 +133,7 @@
\_def \_act ##1{\_ifx##1\_relax \_else
\_ifx##1,\_else \_advance\_tmpnum by1 \_lccode`##1=\_tmpnum \_fi
\_ea\_act \_fi}%
- \_tmpnum=65 \_ea\_act \_sortingdata \_relax
+ \_tmpnum=64 \_ea\_act \_sortingdata \_relax
}
\_doc -----------------------------
@@ -401,8 +401,8 @@
All other variants of indexing macros expand internally to `\iindex`.
\_cod -----------------------------
-\_def\_iindex#1{\_isempty{#1}\_iffalse\_openref{\def~{ }%
- \edef\_act{\_noexpand\_wref\_noexpand\_Xindex{{#1}{\_iitypesaved}}}\_act}\_fi}
+\_def\_iindex#1{\_isempty{#1}\_iffalse
+ \_openref{\_def~{ }\_ewref\_Xindex{{#1}{\_iitypesaved}}}\_fi}
\_public \iindex ;
\_doc -----------------------------
@@ -457,5 +457,6 @@
\_endcode % -------------------------------------
+2021-02-01 secodary sorting: start from code 65
2020-04-21 \isempty \iffalse ... \fi added to \iindex
2020-03-26 introduced
diff --git a/macros/luatex/optex/base/maketoc.opm b/macros/luatex/optex/base/maketoc.opm
index 84e699d67d..8dfd821640 100644
--- a/macros/luatex/optex/base/maketoc.opm
+++ b/macros/luatex/optex/base/maketoc.opm
@@ -1,16 +1,17 @@
% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \maketoc {Macros for maketoc <2020-03-12>} % preloaded in format
+\_codedecl \maketoc {Macros for maketoc <2020-02-09>} % preloaded in format
\_doc ------------------------------------
- \`\_Xtoc` `{<level>}{<type>}{<number>}<title>` (in `.ref` file) reads the
- specified data and appends them to the \`\_toclist` as
- \^`\_tocline``{<level>}{<type>}{<number>}{<title>}{<gpageno>}{<pageno>}`
+ \`\_Xtoc` `{<level>}{<type>}{<number>}{<o-title>}<title>` (in `.ref` file) reads
+ given data and appends them to the \`\_toclist` as
+ \^`\_tocline``{<level>}{<type>}{<number>}{<o-title>}{<title>}{<gpageno>}{<pageno>}`
where:
\begitems
* `<level>`: 0 reserved, 1: chapter, 2: section, 3: subsection
* `<type>`: the type of the level, i.e. chap, sec, secc
* `<number>`: the number of the chapter/section/subsection in the format 1.2.3
+ * `<o-title>`: outlines title, if differs from `<title>`.
* `<title>`: the title text
* `<gpageno>`: the page number numbered from 1 independently of pagination
* `<pageno>`: the page number used in the pagination
@@ -25,13 +26,13 @@
\_def\_toclist{}
\_newifi \_ifischap \_ischapfalse
-\_def\_Xtoc#1#2#3{\_ifnum#1=0 \_ischaptrue\_fi
- \_addto\_toclist{\_tocline{#1}{#2}{#3}}\_scantoeol\_XtocA}
+\_def\_Xtoc#1#2#3#4{\_ifnum#1=0 \_ischaptrue\_fi
+ \_addto\_toclist{\_tocline{#1}{#2}{#3}{#4}}\_scantoeol\_XtocA}
\_def\_XtocA#1{\_addto\_toclist{{#1}}\_ea\_addto\_ea\_toclist\_ea{\_currpage}}
\_doc ------------------------------------
- \`\_tocline``{<level>}{<type>}{<number>}{<title>}{<gpageno>}{<pageno>}` prints
- the record to the table of contents. It opens group, reduces `\_leftskip`,
+ \`\_tocline``{<level>}{<type>}{<number>}{<o-title>}{<title>}{<gpageno>}{<pageno>}`
+ prints the record to the table of contents. It opens group, reduces `\_leftskip`,
`\_rightskip`, runs the \^`\everytocline` (user can customise the design of TOC
here) and runs `\_tocl:<level> {<number>}{<title>}{<pageno>}` macro.
This macro starts with vertical mode,
@@ -53,15 +54,15 @@
\_cod ------------------------------------
\_newcount \_tocrefnum
-\_def\_tocline#1#2#3#4#5#6{%
+\_def\_tocline#1#2#3#4#5#6#7{%
\_advance\_tocrefnum by1
\_bgroup
\_leftskip=\_iindent \_rightskip=2\_iindent
\_ifischap \_advance\_leftskip by \_iindent \_fi
- \_def\_pgn{\_ilink[pg:#5]}%
+ \_def\_pgn{\_ilink[pg:#6]}%
\_the\_everytocline
\_ifcsname _tocl:#1\_endcsname
- \_cs{_tocl:#1}{#3}{\_scantextokens{#4}}{#6}\_par
+ \_cs{_tocl:#1}{#3}{\_scantextokens{#5}}{#7}\_par
\_fi
\_egroup
}
@@ -96,6 +97,29 @@
\_def\_tocpar{\_nobreak \_hskip-2\_iindent\_null \_par}
\_doc -----------------------------------
+ If you want a special formating of TOC with adding more
+ special lines (no generated as titles from `\chap`, `\sec`, `\secc`), you
+ can define `\addtotoc{<level>}{<type>}{<number>}{<o-title>}{<title>}` macro:
+ \begtt
+ \def\addtotoc#1#2#3#4#5{%
+ \incr\_tocrefnum
+ \_dest[toc:\_the\_tocrefnum]%
+ \_ewref\_Xtoc{{#1}{#2}{#3}{#4}#5}%
+ }
+ \endtt
+ and you can declare special lines (or something else)
+ as an unused level (10 in the following example):
+ \begtt
+ \sdef{_tocl:10}#1#2#3{\medskip\hbox{\Blue #2}\medskip}
+ \endtt
+ Now, users can add a blue line into TOC by
+ \begtt \catcode`\<=13
+ \addtotoc{10}{blue-line}{}{\relax}{<blue text to be added in the TOC>}
+ \endtt
+ anywhere in the document. Note that `\relax` in the fourth parameter
+ means that outline will be not generated. And second parameter
+ `blue-line` is only a comment (unused in macros).
+
\`\maketoc` prints warning if TOC data is empty, else it creates TOC by
running \^`\_toclist`
\_cod ----------------------------------
@@ -124,6 +148,7 @@
\_endcode
+2021-02-09 \thisoutline implemented
2020-04-23 \_tocpar introduced (incompatible change)
2020-04-22 \_pg -> \_pgn (incompatible change)
-2020-03-12 introduced \ No newline at end of file
+2020-03-12 introduced
diff --git a/macros/luatex/optex/base/math-macros.opm b/macros/luatex/optex/base/math-macros.opm
index a087d31c68..6d5278d5c2 100644
--- a/macros/luatex/optex/base/math-macros.opm
+++ b/macros/luatex/optex/base/math-macros.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \sin {Math macros plus mathchardefs <2020-06-13>} % preloaded in format
+\_codedecl \sin {Math macros plus mathchardefs <2021-02-04>} % preloaded in format
\_doc -----------------------------
The category code of the character `_` remains as the letter (11) and the mathocode
@@ -594,7 +594,7 @@
\_cod -----------------------------
\_protected\_def\_matrix#1{\_null\_thinsk
- \_edef\_stylenum{\_the\_numexpr\_mathstyle/2\_relax}%
+ \_edef\_tmpa{\_the\_numexpr \_mathstyle/4\_relax}% 0 0 1 1 1 1 2 2
\_vcenter{\_matrixbaselines\_math
\_ialign{\_the\_lmfil$\_matrixstyle##$\_hfil&&\_quad\_the\_lmfil$\_matrixstyle##$\_hfil\_crcr
\_mathstrut\_crcr\_noalign{\_kern-\_baselineskip}
@@ -602,22 +602,22 @@
\_def\_matrixbaselines{\_normalbaselines \_def\_matrixstyle{}%
\_let\_matrixbaselines=\_relax % \matrix inside matrix does not change size again
- \_ifcase\_stylenum \_or \_matrixscriptbaselines \_or \_matrixscriptbaselines
+ \_ifcase\_tmpa \_or
+ \_baselineskip=.7\_baselineskip \_def\_quad {\_hskip.7em\_relax}%
+ \_let\_matrixstyle=\_scriptstyle
\_or
- \_baselineskip=.5\_baselineskip
- \_def\_quad {\_hskip.5em\_relax}%
+ \_baselineskip=.5\_baselineskip \_def\_quad {\_hskip.5em\_relax}%
\_let\_matrixstyle=\_scriptscriptstyle
\_fi
}
-\_def\_matrixscriptbaselines{\_baselineskip=.7\_baselineskip
- \_def\_quad {\_hskip.7em\_relax}\_let\_matrixstyle=\_scriptstyle
-}
\_protected\_def\_pmatrix#1{\_left(\_matrix{#1}\_right)}
\_public \matrix \pmatrix ;
\_doc -----------------------------
- The \`\cases` and `\bordermatrix` macros are identical from plain \TeX/.
+ The \`\cases` and \`\bordermatrix` macros are almost identical as in plain \TeX/.
+ You can simply re-define `\bordermatrix` with other delimiters
+ using the common \`\_bordermatrixwithdelims` macro.
\_cod -----------------------------
\_protected\_long\_def\_cases#1{\_left\{\_thinsk\_vcenter{\_normalbaselines\_math
@@ -625,13 +625,14 @@
\_newdimen\_ptrenwd
\_ptrenwd=8.75pt % width of the big left (
-\_protected\_def\_bordermatrix#1{\_begingroup \_math
- \_setbox0=\_vbox{\_bordermatrixA #1\_stopbmatrix}%
+\_protected\_def\_bordermatrix{\_bordermatrixwithdelims()}
+\_def\_bordermatrixwithdelims#1#2#3{\_begingroup \_math
+ \_setbox0=\_vbox{\_bordermatrixA #3\_stopbmatrix}%
\_setbox2=\_vbox{\_unvcopy0 \_global\_setbox1=\_lastbox}%
\_setbox2=\_hbox{\_unhbox1 \_unskip\_global\_setbox1=\_lastbox}%
- \_setbox2=\_hbox{$\_kern\_wd1 \_kern-\_ptrenwd\_left(\_kern-\_wd1
+ \_setbox2=\_hbox{$\_kern\_wd1 \_kern-\_ptrenwd\_left#1\_kern-\_wd1
\_global\_setbox1=\_vbox{\_box1 \_kern.2em}%
- \_vcenter{\_kern-\_ht1 \_unvbox0 \_kern-\_baselineskip}\_thinsk\_right)$}%
+ \_vcenter{\_kern-\_ht1 \_unvbox0 \_kern-\_baselineskip}\_thinsk\_right#2$}%
\_null\_thicksk\_vbox{\_kern\_ht1 \_box2}\_endgroup}
\_def\_bordermatrixA #1\cr#2\_stopbmatrix{%
\_ialign{$##$\_hfil\_kern.2em\_kern\_ptrenwd&\_thinspace\_hfil$##$\_hfil
@@ -1054,7 +1055,10 @@
\_endcode %---------------------------------------------------
-2020=12-17 \box0->\hbox{\box0} in \_finphant and \_finsmash, see https://tex.stackexchange.com/questions/574997/
+2021-02-04 \_bordermatrixwithdelims introduced.
+2021-01-23 better expession for math styles in \matrix
+2021-01-22 bad use of \_stylenum in \matrix + bad value (bug fix: \_stylenum->\_mtstylenum)
+2020-12-17 \box0->\hbox{\box0} in \_finphant and \_finsmash, see https://tex.stackexchange.com/questions/574997/
2020-06-14 \borermatrix, \cases corrected
2020-06-13 \adots introduced, \matrix smaller in T mode too.
2020-06-03 \notin corrected
diff --git a/macros/luatex/optex/base/math-preload.opm b/macros/luatex/optex/base/math-preload.opm
index 7f6aaa6fdb..0ec9abae2f 100644
--- a/macros/luatex/optex/base/math-preload.opm
+++ b/macros/luatex/optex/base/math-preload.opm
@@ -134,28 +134,34 @@
These parameters are given in the \`\ptmunit` unit, it is set to
1\`\ptunit` and it is set to 1\,pt by default.
\nl
- \`\_corrmsizes` should be used in the \^`\normalmath` and \^`\boldmath`
- macros if you need a size correction when a selected math family is
- loaded. It is similar to ex-height correction but for math fonts.
+ \`\_corrmsize` `<factor><space>` can be used just before
+ `\_loadmathfamily` or `\_setmathfamily`.
+ The `<factor>` is decimal number, it denotes
+ scale-factor \"size of loaded math font in `\textstyle` : size of text font".
+ You can use it in `\_normalmath` or `\_boldmath` macros if you want to do a
+ corrections (for example due to different ex-height in text and math
+ font). The `\_corrmsize` is applied only to one following
+ `\_loadmathfamily` or `\_setmathfamily`. If it is missing
+ then the `<factor>` is 1 for such math family (i.e.\ no size corrections).
\_cod -----------------------------
-\_def\_corrmsizes{\_ptmunit=1\_ptunit\_relax} % for corrections of sizes in diferent fomts
+\_def\_corrmsize#1 {\_ptmunit=#1\_ptunit} % for corrections of sizes in diferent fonts
-\_def\_loadmathfamily #1 #2 {\_chardef\_tmp#1\_corrmsizes
+\_def\_loadmathfamily #1 #2 {%
\_edef\_optsizesave{\_the\_optsize}%
\_optsize=\_sizemtext \_font\_mF=\_whichtfm{#2} at\_optsize \_textfont#1=\_mF
\_optsize=\_sizemscript \_font\_mF=\_whichtfm{#2} at\_optsize \_scriptfont#1=\_mF
\_optsize=\_sizemsscript \_font\_mF=\_whichtfm{#2} at\_optsize \_scriptscriptfont#1=\_mF
- \_optsize=\_optsizesave \_relax
+ \_optsize=\_optsizesave \_ptmunit=\_ptunit
}
-\_def\_setmathfamily #1 #2{\_let\_mF=#2\_chardef\_tmp#1\_corrmsizes
+\_def\_setmathfamily #1 #2{\_let\_mF=#2%
\_edef\_optsizesave{\_the\_optsize}%
\_optsize=\_sizemtext \_fontlet#2=#2 at\_optsize \_textfont#1=#2%
\_optsize=\_sizemscript \_fontlet#2=#2 at\_optsize \_scriptfont#1=#2%
\_optsize=\_sizemsscript \_fontlet#2=#2 at\_optsize \_scriptscriptfont#1=#2%
- \_optsize=\_optsizesave \_let#2=\_mF
+ \_optsize=\_optsizesave \_ptmunit=\_ptunit \_let#2=\_mF
}
-\_def\_setmathsizes[#1/#2/#3]{%
+\_def\_setmathsizes[#1/#2/#3]{\_ptmunit=\_ptunit
\_def\_sizemtext{#1\_ptmunit}\_def\_sizemscript{#2\_ptmunit}%
\_def\_sizemsscript{#3\_ptmunit}%
}
diff --git a/macros/luatex/optex/base/math-unicode.opm b/macros/luatex/optex/base/math-unicode.opm
index f857deb175..680da012d6 100644
--- a/macros/luatex/optex/base/math-unicode.opm
+++ b/macros/luatex/optex/base/math-unicode.opm
@@ -118,7 +118,9 @@
If the math family 1 is loaded then the family 2 and 3 are set by the same
font because \TeX/ needs to read dimension information about generating
math formulae from these three math families. All information needed by
- \TeX/ is collected in single Unicode-math font.
+ \TeX/ is collected in single Unicode-math font.\nl
+ The \^`\_corrmsize` `<factor><space>` can be used just before
+ `\_loadumathfamily`, see section~\ref[math-preload] for more information.
\_cod -----------------------------
\_def\_umathname#1#2{"#1:\_mfontfeatures#2"}
@@ -132,7 +134,7 @@
\_ifnum#1=1 \_scriptfont2=\_mF \_scriptfont3=\_mF \_fi
\_optsize=\_sizemsscript \_font\_mF=\_umathname{#2}{+ssty=1;#3} at\_optsize\_scriptscriptfont#1=\_mF
\_ifnum#1=1 \_scriptscriptfont2=\_mF \_scriptscriptfont3=\_mF \_fi
- \_optsize=\_optsizesave \_relax
+ \_optsize=\_optsizesave \_ptmunit=\_ptunit
}
\_doc -----------------------------
diff --git a/macros/luatex/optex/base/more-macros.opm b/macros/luatex/optex/base/more-macros.opm
index 406139b16f..d5ce88c1a6 100644
--- a/macros/luatex/optex/base/more-macros.opm
+++ b/macros/luatex/optex/base/more-macros.opm
@@ -214,7 +214,7 @@
The \`\catcode` primitive is redefined here. Why?
There is very common cases like \code{\\catcode`}`<something>`
or `\catcode"<number>` but these characters
- \code{\`} or \code{"} can be set as active (typically by `\activettchar` macro).
+ \code{\`} or \code{"} can be set as active (typically by `\verbchar` macro).
Nothing problematic happens if re-defined `\catcode` is used in this case.
If you really need primitive `\catcode` then you can use `\_catcode`.
diff --git a/macros/luatex/optex/base/optex.ini b/macros/luatex/optex/base/optex.ini
index 9a4aeace8e..3826ccf0e1 100644
--- a/macros/luatex/optex/base/optex.ini
+++ b/macros/luatex/optex/base/optex.ini
@@ -21,7 +21,7 @@
% OpTeX version
-\def\optexversion{Beta 0.19 Jan.2021}
+\def\optexversion{1.00 Feb.2021}
\def\fmtname{OpTeX}
% Engine testing:
diff --git a/macros/luatex/optex/base/others.opm b/macros/luatex/optex/base/others.opm
index d96edc4dba..6ff15d4332 100644
--- a/macros/luatex/optex/base/others.opm
+++ b/macros/luatex/optex/base/others.opm
@@ -92,7 +92,7 @@
\_def\_lipsumload{{%
\_setbox0=\_vbox{\_tmpnum=0 % vertical mode during \input lipsum.ltd.tex
\_def\ProvidesFile##1[##2]{}%
- \_def\NewLipsumPar{\_advance\_tmpnum by1 \_sxdef{_lip:\_the\_tmpnum}}%
+ \_def\NewLipsumPar{\_incr\_tmpnum \_sxdef{_lip:\_the\_tmpnum}}%
\_opinput {lipsum.ltd.tex}%
\_global\_let\_lipsumload=\_empty
}}}
diff --git a/macros/luatex/optex/base/outlines.opm b/macros/luatex/optex/base/outlines.opm
index d1082f9580..ad05c97edc 100644
--- a/macros/luatex/optex/base/outlines.opm
+++ b/macros/luatex/optex/base/outlines.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \outlines {PDF outlines <2020-03-12>} % preloaded in format
+\_codedecl \outlines {PDF outlines <2021-02-09>} % preloaded in format
\_def\_outlines#1{\_pdfcatalog{/PageMode/UseOutlines}\_openref
\_ifx\_toclist\_empty
@@ -16,13 +16,15 @@
\_toclist}% create outlines
\_fi
}
-\_def\_outlinesA#1#2#3#4#5#6{%
- \_advance\_count#1 by1
- \_ifcase#1\_or
- \_addoneol{_ol:\_the\_count0}\_or
- \_addoneol{_ol:\_the\_count0:\_the\_count1}\_or
- \_addoneol{_ol:\_the\_count0:\_the\_count1:\_the\_count2}\_or
- \_addoneol{_ol:\_the\_count0:\_the\_count1:\_the\_count2:\_the\_count3}\_fi
+\_def\_outlinesA#1#2#3#4#5#6#7{%
+ \_isequal{\relax}{#4}\_iffalse
+ \_advance\_count#1 by1
+ \_ifcase#1\_or
+ \_addoneol{_ol:\_the\_count0}\_or
+ \_addoneol{_ol:\_the\_count0:\_the\_count1}\_or
+ \_addoneol{_ol:\_the\_count0:\_the\_count1:\_the\_count2}\_or
+ \_addoneol{_ol:\_the\_count0:\_the\_count1:\_the\_count2:\_the\_count3}\_fi
+ \_fi
}
\_def\_addoneol#1{%
\_ifcsname #1\_endcsname
@@ -31,19 +33,21 @@
\_else \_sxdef{#1}{1}%
\_fi
}
-\_def\_outlinesB#1#2#3#4#5#6{%
- \_advance\_count#1 by1
- \_ifcase#1%
- \_tmpnum=\_trycs{_ol:\_the\_count0}{0}\_or
- \_tmpnum=\_trycs{_ol:\_the\_count0:\_the\_count1}{0}\_relax\_or
- \_tmpnum=\_trycs{_ol:\_the\_count0:\_the\_count1:\_the\_count2}{0}\_relax\_or
- \_tmpnum=\_trycs{_ol:\_the\_count0:\_the\_count1:\_the\_count2:\_the\_count3}{0}\_relax\_or
- \_tmpnum = 0\_relax\_fi
- \_pdfunidef\_tmp{#4}%
+\_def\_outlinesB#1#2#3#4#5#6#7{%
\_advance\_tocrefnum by1
- \_outlinesC{#1}{toc:\_the\_tocrefnum}{\_ifnum#1<\_outlinelevel\_space\_else-\_fi}{\_tmpnum}{\_tmp}%
+ \_isequal{\relax}{#4}\_iffalse
+ \_advance\_count#1 by1
+ \_ifcase#1%
+ \_tmpnum=\_trycs{_ol:\_the\_count0}{0}\_or
+ \_tmpnum=\_trycs{_ol:\_the\_count0:\_the\_count1}{0}\_relax\_or
+ \_tmpnum=\_trycs{_ol:\_the\_count0:\_the\_count1:\_the\_count2}{0}\_relax\_or
+ \_tmpnum=\_trycs{_ol:\_the\_count0:\_the\_count1:\_the\_count2:\_the\_count3}{0}\_relax\_or
+ \_tmpnum = 0\_relax\_fi
+ \_isempty{#4}\_iftrue \_pdfunidef\_tmp{#5}\_else \_pdfunidef\_tmp{#4}\_fi
+ \_outlinesC{toc:\_the\_tocrefnum}{\_ifnum#1<\_outlinelevel\_space\_else-\_fi}{\_tmpnum}{\_tmp}%
+ \_fi
}
-\_def\_outlinesC#1#2#3#4#5{\_pdfoutline goto name{#2} count #3#4{#5}\_relax}
+\_def\_outlinesC#1#2#3#4{\_pdfoutline goto name{#1} count #2#3{#4}\_relax}
\_newcount\_oulnum
\_def\_insertoutline#1{\_global\_advance\_oulnum by1
diff --git a/macros/luatex/optex/base/parameters.opm b/macros/luatex/optex/base/parameters.opm
index addc6e9b8e..c8df6eec49 100644
--- a/macros/luatex/optex/base/parameters.opm
+++ b/macros/luatex/optex/base/parameters.opm
@@ -166,7 +166,7 @@
The \`\picdir` tokens list can include a directory where image files
(loaded by `\inspic`) are saved. Empty `\picdir` (default value) means
that image files are in the current directory (or somewhere in the \TeX/
- system where \LuaTeX/can find them). If you set a non-empty value to
+ system where \LuaTeX/ can find them). If you set a non-empty value to
the `\picdir`, then it must end by `/` character, for example
`\picdir={img/}` means that there exists a directory `img` in your
current directory and the image files are stored here.
@@ -185,10 +185,10 @@
a nonzero value then the height is given, the width is calculated. If both
parameters are non-zero, the height and width are given and the aspect
ratio of the image is (probably) broken. We recommend setting these
- parameters locally in the group where `\inspic` is used in order to not
+ parameters locally in the group where \^`\inspic` is used in order to not
influence the dimensions of other images. But there exist many
situations you need to put the same dimensions to more images,
- so you can set this parameter only once before more `\inspic` macros.
+ so you can set this parameter only once before more \^`\inspic` macros.
\_cod -----------------------------
\_newdimen\_picwidth \_picwidth=0pt \_let\picw=\_picwidth
@@ -197,21 +197,21 @@
\_doc -----------------------------
The \`\everytt` is the token list used in
- `\begtt`...`\endtt` environment and
- in the verbatim group opened by `\verbinput` macro. You can include a
+ \^`\begtt`...\^`\endtt` environment and
+ in the verbatim group opened by \^`\verbinput` macro. You can include a
code which is processed inside the group after basic settings were done
On the other hand, it is processed before the scanner of verbatim text is started.
Your macros should influence scanner (catcode settings) or printing
process of the verbatim code or both.
- The code from the line immediately after `\begtt` is processed after
- the `\everytt`. This code should overwrite `\everytt` settings. Use
- `\everytt` for all verbatim environments in your document and use a code
- after `\begtt` locally only for this environment.
+ The code from the line immediately after \^`\begtt` is processed after
+ the \^`\everytt`. This code should overwrite \^`\everytt` settings. Use
+ \^`\everytt` for all verbatim environments in your document and use a code
+ after \^`\begtt` locally only for this environment.
The \`\everyintt` token list does similar work
but acts in the in-line verbatim
- text processed by a pair of `\activettchar` characters or by `\code{<text>}`.
+ text processed by a pair of \^`\verbchar` characters or by \^`\code``{<text>}`.
You can set `\everyintt={\Red}` for example if you want in-line verbatim
in red color.
\_cod -----------------------------
@@ -222,12 +222,12 @@
\_doc -----------------------------
The \`\ttline` is used
- in `\begtt`...`\endtt` environment or in the code
- printed by `\verbinput`. If `\ttline` is positive or zero, then the
+ in \^`\begtt`...\^`\endtt` environment or in the code
+ printed by \^`\verbinput`. If `\ttline` is positive or zero, then the
verbatim code has numbered lines from `\ttline+1`. The `\ttline`
register is re-set to a new value after a code piece is printed, so next
code pieces have numbered lines continuously. If `\ttline=-1`, then
- `\begtt`...`\endtt` lines are without numbers and `\verbinput` lines
+ \^`\begtt`...\^`\endtt` lines are without numbers and \^`\verbinput` lines
show the line numbers of inputted file. If `\ttline`\code{<-1}
then no line numbers are printed.
\_cod -----------------------------
@@ -237,8 +237,8 @@
\_doc -----------------------------
The \`\ttindent` gives default indentation
- of verbatim lines printed by `\begtt`...`\endtt` pair or by
- `\verbinput`.
+ of verbatim lines printed by \^`\begtt`...\^`\endtt` pair or by
+ \^`\verbinput`.
\nl
The \`\ttshift` gives the amount of shift of all verbatim lines to the right.
Despite the \^`\ttindent`, it does not shift the line numbers, only
@@ -283,13 +283,13 @@
\_public \hicolors ;
\_doc -----------------------------
- The default item mark used between `\begitems` and `\enditems` is the bullet.
+ The default item mark used between \^`\begitems` and \^`\enditems` is the bullet.
The \`\defaultitem` tokens list declares this default item mark.
\nl
The \`\everyitem` tokens list is applied in vertical mode
at the start of each item.
\nl
- The \`\everylist` tokens list is applied after the group is opened by
+ The \`\everylist` tokens list is applied after the group is opened by \^`\begitems`
\nl
The \`\ilevel` keeps the value of the current nesting level of the items list.
\nl
@@ -305,14 +305,14 @@
\_public \defaultitem \everyitem \everylist \listskipamount \ilevel ;
\_doc -----------------------------
- The `\tit` macro includes `\vglue`\`\titskip` above the title of the document.
+ The \^`\tit` macro includes `\vglue`\`\titskip` above the title of the document.
\_cod -----------------------------
\_newskip\_titskip \_titskip=40pt \_relax % \vglue above title printed by \tit
\_public \titskip ;
\_doc ----------------------------
- The `\begmulti` `\endmulti` pair creates more columns. The parameter
+ The \^`\begmulti` and \^`\endmulti` pair creates more columns. The parameter
\`\colsep` declares the space between columns. If $n$ columns are specified
then we have $n-1$ `\colseps` and $n$ columns in total `\hsize`. This
gives the definite result of the width of the columns.
@@ -358,7 +358,7 @@
\_public \everyii ;
\_doc -----------------------------
- The \`\everymnote` is used in the `\mnote` group before `\noindent` which
+ The \`\everymnote` is used in the \^`\mnote` group before `\noindent` which
immediately precedes marginal note text.
\nl
The \`\mnotesize` is the horizontal size of the marginal notes.
@@ -372,7 +372,7 @@
\_public \everymnote \mnotesize \mnoteindent ;
\_doc -----------------------------
- The `\table` parameters follow. The \`\thistable` tokens list
+ The \^`\table` parameters follow. The \`\thistable` tokens list
register should be used for giving an exception for only one `\table`
which follows. It should change locally other parameters of the `\table`.
It is reset to an empty list after the table is printed.
diff --git a/macros/luatex/optex/base/pdfuni-string.opm b/macros/luatex/optex/base/pdfuni-string.opm
index f9e28582d5..25781ddfb4 100644
--- a/macros/luatex/optex/base/pdfuni-string.opm
+++ b/macros/luatex/optex/base/pdfuni-string.opm
@@ -1,23 +1,29 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \pdfunidef {PDFunicode strings for outlines <2020-03-12>} % preloaded in format
+\_codedecl \pdfunidef {PDFunicode strings for outlines <2021-02-08>} % preloaded in format
\_doc -----------------------------
- The \`\_octalprint` is a Lua script that prints the character code in the
- octal notation.
+ \`\_hexprint` is a command defined in Lua, that scans a number and expands
+ to its UTF-16 Big Endian encoded form for use in PDF hexadecimal strings.
\_cod -----------------------------
-\_edef\_octalprint#1#2{\_noexpand\_directlua{% #1=character-code #2=character
- if ('#2'>='A' and '#2'<='Z') or ('#2'>='a' and '#2'<='z') then
- tex.print(string.format('000\_pcent s',"#2"))
- else
- local num=#1\_pcent256
- tex.print(string.format('\_pcent 03o\_nbb\_pcent03o',(#1-num)/256,num))
- end
+\bgroup
+\_catcode`\%=12
+\_gdef\_hexprint{\_directlua{
+ local num = token.scan_int()
+ if num < 0x10000 then
+ tex.print(string.format("%04X", num))
+ else
+ num = num - 0x10000
+ local high = bit32.rshift(num, 10) + 0xD800
+ local low = bit32.band(num, 0x3FF) + 0xDC00
+ tex.print(string.format("%04X%04X", high, low))
+ end
}}
+\egroup
\_doc -----------------------------
- \`\pdfunidef``\macro{<text>}` does more things than only converting to octal notation.
+ \`\pdfunidef``\macro{<text>}` does more things than only converting to hexadecimal PDF string.
The <text> can be scanned in verbatim mode (it is true becuase \^`\_Xtoc`
reads the <text> in verbatim mode). First `\edef` do
`\_scantextokens\unexpanded` and second `\edef` expands the parameter
@@ -26,11 +32,15 @@
Then \`\_removeoutbraces` converts `..{x}..` to `..x..`.
Finally, the <text> is detokenized, spaces are preprocessed using \^`\replstring`
and then the \`\_pdfunidefB` is repeated on each character. It calls the
- `\directlua` chunk to print octal numbers in the macro \^`\_octalprint`.
+ `\directlua` chunk to print hexadecimal numbers in the macro \^`\_hexprint`.\nl
+ Characters for quotes (and separators for quotes) are activated by first
+ `\_scatextokens` and they are defined as the same non-active characters.
+ But `\_regoul` can change this definition.
\_cod -----------------------------
\_def\_pdfunidef#1#2{%
\_begingroup
+ \_catcodetable\_optexcatcodes \_adef"{"}\_adef'{'}%
\_the\_regoul \_relax % \_regmacro alternatives of logos etc.
\_ifx\_savedttchar\_undefined \_def#1{\_scantextokens{\_unexpanded{#2}}}%
\_else \_lccode`\;=\_savedttchar \_lowercase{\_prepinverb#1;}{#2}\fi
@@ -43,19 +53,17 @@
\_edef#1{\_detokenize\_ea{#1}}%
\_replstring#1{ }{{ }}% text text -> text{ }text
\_catcode`\\=12 \_let\\=\_bslash
- \_edef\_out{\\376\\377}%
+ \_edef\_out{<FEFF}
\_ea\_pdfunidefB#1^% text -> \_out in octal
\_ea
\_endgroup
- \_ea\_def\_ea#1\_ea{\_out}
+ \_ea\_def\_ea#1\_ea{\_out>}
}
\_def\_pdfunidefB#1{%
\_ifx^#1\_else
- \_tmpnum=`#1
- \_pdfunidefC{\_luaescapestring{#1}}%
+ \_edef\_out{\_out \_hexprint `#1}
\_ea\_pdfunidefB \_fi
}
-\_def\_pdfunidefC #1{\_edef\_out{\_out \\\_ea\_octalprint\_ea{\_the\_tmpnum}{#1}}}
\_def\_removeoutbraces #1#{#1\_removeoutbracesA}
\_def\_removeoutbracesA #1{\_ifx\_end#1\_else #1\_ea\_removeoutbraces\_fi}
@@ -91,22 +99,29 @@
\_endcode % --------------------------------
-There are only two encodings for PDF strings (used in PDFoutlines, PDFinfo
-, etc.). The first one is PDFDocEncoding which is one-byte encoding, but most
-Czech or Slovak characters are missing here.
+There are only two encodings for PDF strings (used in PDFoutlines, PDFinfo,
+etc.). The first one is PDFDocEncoding which is single-byte encoding, but it
+misses most international characters.
-The second encoding is PDFunicode encoding which is implemented in this file.
+The second encoding is Big Endian UTF-16 which is implemented in this file. It
+encodes a single character in either two or four bytes.
This encoding is \TeX/-discomfortable because it looks like
\begtt
-\376\377\000C\000v\000i\001\015\000e\000n\000\355\000\040\000j\000e\000\040
-\000z\000\341\000t\001\033\001\176
+<FEFF 0043 0076 0069 010D 0065 006E 00ED 0020 006A 0065 0020 007A 00E1 0074
+011B 017E 0020 0061 0020 0078 2208 D835DD44>
\endtt
-This example is the real encoding of the string "Cvičení je zátěž". You can see
-that this is UTF-16 encoding (two bytes per character) with two starting
-bytes FEFF. Moreover, each byte is encoded by three octal digits preceded by
-a backslash. The only exception is the visible ASCII character encoding: such
-a character is encoded by its real byte preceded by `\000`.
+This example shows a hexadecimal PDF string (enclosed in \code{<>} as opposed
+to the literal PDF string enclosed in `()`). In these strings each byte is
+represented by two hexadecimal characters (`0-9`, `A-F`). You can tell the
+encoding is UTF-16BE, becuase it starts with \"Byte order mark" `FEFF`. Each
+unicode character is then encoded in one or two byte pairs. The example string
+corresponds to the text \"Cvičení je zátěž a ${\rm x} ∈ 𝕄$". Notice the 4 bytes
+for the last character, $𝕄$. (Even the whitespace would be OK in a PDF file,
+because it should be ignored by PDF viewers, but \LuaTeX\ doesn't allow it.)
+\_endinput
+2021-02-08 \_octalprint -> \_hexprint
+2020-03-12 Released
diff --git a/macros/luatex/optex/base/ref-file.opm b/macros/luatex/optex/base/ref-file.opm
index fd7c1101d7..d594bf88c0 100644
--- a/macros/luatex/optex/base/ref-file.opm
+++ b/macros/luatex/optex/base/ref-file.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \openref {File for references <2020-02-14>} % preloaded in format
+\_codedecl \openref {File for references <2021-02-05>} % preloaded in format
\_doc --------------------------
The \`\_inputref` macro is used in `\everyjob`. It reads `\jobname.ref` file
@@ -34,7 +34,10 @@
the \`\_wref` `\<macro>{<data>}` is redefined in order to
save the line `\<macro><data>` to the `.ref` file using asynchronous
`\write` primitive. Finally, the `\_openref` destroys itself, because we
- need not open the file again.
+ need not open the file again.\nl
+ The `\_wref``<csname>{<params>}` does exactly `\write\_reffile{\string<csname><params>}`
+ in this case and \`\_ewref``<csname>{<params>}` does
+ `\write\_reffile{\string<csname><expanded-params>}`.
\_cod ---------------------
\_def\_openref {%
@@ -47,7 +50,8 @@
\_immediate\_write\_reffile {\_pcent\_pcent\_space OPTeX <\_optexversion> - REF file (#1)}%
\_immediate\_wref \Xrefversion{{\_REFversion}}%
}
-\def\openref{\_openref}
+\_def\_ewref #1#2{\_edef\_ewrefA{#2}\_ea\_wref\_ea#1\_ea{\_ewrefA}}
+\_def\openref{\_openref}
\_doc ----------------------
We are using the convention that the macros used in `.ref` file are named
@@ -65,7 +69,7 @@
versa.
\_cod ----------------------
-\_def\_REFversion{4} % actual version of .ref files in OpTeX
+\_def\_REFversion{5} % actual version of .ref files in OpTeX
\_def\_Xrefversion#1{\_ifnum #1=\_REFversion\_relax \_else \_endinput \_fi}
\_public \Xrefversion ; % we want to ignore .ref files generated by OPmac
@@ -107,7 +111,7 @@ The `.ref` file looks like:
\begtt \catcode`\<=13
\Xrefversion{<ref-version>}
\_Xpage{<gpageno>}{<pageno>}
-\_Xtoc{<level>}{<type>}{<text>}<title>
+\_Xtoc{<level>}{<type>}{<text>}{}<title>
\_Xlabel{<label>}{<text>}
\_Xlabel{<label>}{<text>}
...
diff --git a/macros/luatex/optex/base/references.opm b/macros/luatex/optex/base/references.opm
index 27e4f8d632..03c8f6955c 100644
--- a/macros/luatex/optex/base/references.opm
+++ b/macros/luatex/optex/base/references.opm
@@ -27,7 +27,7 @@
\_doc ----------------------------
\`\label``[<label>]` saves the decalred label to `\_lastlabel` and
\`\wlabel``{<text>}` uses the `\_lastlabel` and activates
- `\wref\_Xlabel{<label>}{<text>}`.
+ `\_wref\_Xlabel{<label>}{<text>}`.
\_cod ----------------------------
\_def\_label[#1]{\_isempty{#1}\_iftrue \_global\_let \_lastlabel=\_undefined
@@ -39,8 +39,7 @@
\_ifx\_lastlabel\_undefined \_else
\_dest[ref:\_lastlabel]%
\_printlabel\_lastlabel
- \_edef\_tmp{{\_lastlabel}{#1}}%
- \_ea\_wref \_ea\_Xlabel \_ea{\_tmp}%
+ \_ewref \_Xlabel {{\_lastlabel}{#1}}%
\_sxdef{_lab:\_lastlabel}{#1}\_sxdef{l0:\_lastlabel}{}%
\_global\_let\_lastlabel=\_undefined
\_fi
diff --git a/macros/luatex/optex/base/sections.opm b/macros/luatex/optex/base/sections.opm
index 66dc9cd9e0..5e50fa3b9f 100644
--- a/macros/luatex/optex/base/sections.opm
+++ b/macros/luatex/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 <2020-03-28>} % preloaded in format
+\_codedecl \chap {Titles, chapters, sections, subsections <2021-02-09>} % preloaded in format
\_doc ---------------------------
We are using scaled fonts for titles
@@ -97,7 +97,8 @@
* `\_sectionlevel=1` -- chapters (used in `\chap`)
* `\_sectionlevel=2` -- sections (used in `\sec`)
* `\_sectionlevel=3` -- subsections (used in `\secc`)
- * `\_sectionlevel=4` -- subsubsections (unused by default)
+ * `\_sectionlevel=4` -- subsubsections (unused by default, see the
+ \ulink[http://petr.olsak.net/optex/optex-tricks.html\#seccc]{\OpTeX/ trick 0033})
\enditems
\_cod --------------------------
@@ -130,7 +131,6 @@
subsections <num>.<num>. On the other hand, if chapter is used in the
document then `\_chapnum>0` and sections have numbers` <num>.<num>`
and subsections have numbers `<num>.<num>.<num>`.
-
\_cod --------------------------
\_newcount \_chapnum % chapters
@@ -152,7 +152,6 @@
\_def \_thednum {(\_the\_dnum)}
\_def\_othe #1.{\_ifnum#1>0 \_the#1.\_fi}
-\_def\_incr #1{\_global\_advance#1by1 }
\_doc ----------------------------
The \`\notoc` and \`\nonum` prefixes are implemented by
@@ -204,12 +203,11 @@
\_doc ----------------------------
The \`\_printrefnum``[<pre>@<post>]` macro is used in `\_print*` macros.
- \nl
- The \`\_wtotoc` `{<level>}{<info>}{<ref-num>}{<title-text>}`
- macro expands its parameters and does \^`\_wref`.
Note that the `<tite-text>` is `\detokenize`d before `\_wref`, so the
problem of \"fragile macros" from old \LaTeX/ never occurs.
+ This fourth parameter is not delimited by `{...}` but by end of line.
+ This gives possibility to have unbalanced braces in inline verbatim in titles.
\_cod ----------------------------
\_def \_printrefnum [#1@#2]{\_leavevmode % we must be in horizontal mode
@@ -217,12 +215,20 @@
\_wlabel \_therefnum % references, if `\label[<label>]` is declared
\_ifnotoc \_else \_incr \_tocrefnum
\_dest[toc:\_the\_tocrefnum]%
- \_wtotoc{\_the\_sectionlevel}{\_secinfo}%
- {\_therefnum}{\_detokenize\_ea{\_savedtitle}}%
+ \_ewref\_Xtoc{{\_the\_sectionlevel}{\_secinfo}%
+ {\_therefnum}{\_theoutline}\_detokenize\_ea{\_savedtitle}}%
\_fi
+ \_gdef\_theoutline{}%
}
-\_def \_wtotoc #1#2#3#4{\_edef\_tmp{{#1}{#2}{#3}{#4}}\_ea\_wtotocA\_tmp}
-\_def \_wtotocA #1#2#3#4{\_wref\_Xtoc{{#1}{#2}{#3}#4}}
+
+ \_doc -----------------------------
+ \`\thisoutline``{<text>}` saves text to the \`\_theoutline` macro.
+ \^`\_printrefnum` uses it and removes it.
+ \_cod -----------------------------
+
+\_def\_theoutline{}
+\_def\_thisoutline#1{\_gdef\_theoutline{#1}}
+\_public \thisoutline ;
\_doc -----------------------------
The \`\_abovetitle``{<penaltyA>}{<skipA>}` and \`\_belowtitle``{<skipB>}` pair
@@ -256,7 +262,7 @@
\_def\_nbpar{{\_interlinepenalty=10000\_endgraf}}
-\_protected\_def\_nl{\_hfil\_break}
+\_protected\_def\_nl{\_unskip\_hfil\_break}
\_regmacro {\_def\_nl{\_unskip\_space}} {\_def\_nl{\_unskip\_space}} {\_def\_nl{ }}
\_regmacro {\_def\nl{\_unskip\_space}} {\_def\nl{\_unskip\_space}} {\_def\nl{ }}
@@ -321,7 +327,10 @@
\_public \secl ;
\_doc -----------------------------
- The \`\caption``/<letter>` uses `\_<letter>num` counter.
+ The \`\caption``/<letter>` increases `\_<letter>num` counter,
+ edefines \`\_thecapnum` as `\_the<letter>num` and
+ defines \`\_thecaptitle` as language-dependent word using \^`\_mtext`,
+ runs the `\_everycaption<letter>` tokens register.
The group opened by `\caption` is finalized by first `\par` from
an empty line or from `\vskip` or from `\endinsert`.
The `\_printcaption<letter>` is called, it starts with
@@ -350,9 +359,9 @@
They switch to horizontal mode and use `\_wlabel\_thecapnum` (in order to
make reference and hyperlink destination) a they can use:
\begitems
- * `\_thecaptitle` ... expands to the word Table or Figure (depending on
- the current language).
- * `\_thecapnum` ... expands to `\the<letter>num` (caption number).
+ * \^`\_thecaptitle` ... expands to the word Table or Figure (depending on
+ the current language).
+ * \^`\_thecapnum` ... expands to `\the<letter>num` (caption number).
\enditems
\_cod -----------------------------
@@ -363,6 +372,15 @@
\_let \_printcaptionf = \_printcaptiont % caption of figures = caption of tables
\_doc -----------------------------
+ If you want to declare a new type of `\caption` with independent counter,
+ you can use following lines, where `\caption/a` for Algorithms are
+ declared:
+ \begtt
+ \let\_printcaptiona = \_printcaptionf \let\_everycaptiona = \_everycaptionf
+ \newcount\_anum \addto\_secx {\_anum=0 }
+ \def\_theanum {\_othe\_chapnum.\_the\_secnum.\_the\_anum}
+ \sdef{_mt:a:en}{Algorithm} \sdef{_mt:a:cs}{Algoritmus} % + your language...
+ \endtt
The default format of `\caption` text is a paragraph in block narrower by
`\_iindent` and with the last line is centered. This setting is done by
the \`\_narrowlastlinecentered` macro.
@@ -432,6 +450,8 @@
\_endcode % -------------------------------------
+2021-02-09 \thisoutline implemented
+2021-01-26 \_nl: \unskip added
2021-01-11 \secl introduced
2021-01-05 \_thednum printed in text mode in its both occurences.
2020-04-28 \_secfonts etc: \_boldify is last.
diff --git a/macros/luatex/optex/base/slides.opm b/macros/luatex/optex/base/slides.opm
index deba85c746..5ee4346674 100644
--- a/macros/luatex/optex/base/slides.opm
+++ b/macros/luatex/optex/base/slides.opm
@@ -1,6 +1,6 @@
% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \slideshow {Slides style for OpTeX <2020-03-19>} % loaded on demand by \slides
+\_codedecl \slideshow {Slides style for OpTeX <2021-01-16>} % loaded on demand by \slides
\_doc -----------------------------
Default margins and design is declared here.
@@ -197,7 +197,7 @@
\_maxlayers=0
\_long\_def\_layersactive #1 #2\endlayers{%
- \_par\_egroup
+ \_par\_penalty0\_egroup
\_gdef\_layertext{#2}%
\_global\_maxlayers=#1
\_setbox\_slidepageB=\_vbox\_bgroup
@@ -232,3 +232,5 @@
The user manual of \OpTeX/ slides are in `op-slides.tex` file.
+2021-01-16 \layers at empty page raises error: problem fixed
+2020-03-19 slides introduced
diff --git a/macros/luatex/optex/base/table.opm b/macros/luatex/optex/base/table.opm
index 09ece437ea..d6edaff20f 100644
--- a/macros/luatex/optex/base/table.opm
+++ b/macros/luatex/optex/base/table.opm
@@ -1,10 +1,10 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \table {Basic macros for OpTeX <2020-05-26>} % preloaded in format
+\_codedecl \table {Basic macros for OpTeX <2021-01-27>} % preloaded in format
\_doc -----------------------------
The result of the \`\table``{<declaration>}{<data>}` macro is inserted into
- `\_tablebox`. You can change default value if you want by
+ \`\_tablebox`. You can change default value if you want by
`\let\_tablebox=\vtop` or `\let\_tablebox=\relax`.
\_cod -----------------------------
@@ -95,7 +95,7 @@
work in special cases here like \code{`\{`} for example.
\_cod -----------------------------
-\_def\_tableB #1{\_egroup \_def\_tmpb{#1}%
+\_long\_def\_tableB #1{\_egroup \_def\_tmpb{#1}%
\_replstring\_tmpb{\crl}{\_crcr\crl}\_replstring\_tmpb{\crll}{\_crcr\crll}%
\_replstring\_tmpb{\crli}{\_crcr\crli}\_replstring\_tmpb{\crlli}{\_crcr\crlli}%
\_replstring\_tmpb{\crlp}{\_crcr\crlp}%
@@ -199,8 +199,8 @@
\_doc -----------------------------
The default \"declaration letters" `c`, `l`, `r` and `p` are declared
- by setting \`\tabdeclarec`, \`\tabdeclarel`, \`\tabdeclarer` and
- \`\paramtabdeclarep` macros. In general, define
+ by setting \`\_tabdeclarec`, \`\_tabdeclarel`, \`\_tabdeclarer` and
+ \`\_paramtabdeclarep` macros. In general, define
`\def\_tabdeclare<letter>{...}` for a non-parametric
letter and `\def\_paramtabdeclare<letter>{...}` for a letter with a parameter.
The double hash `##` must be in the definition, it is replaced by a real table item data.
@@ -269,8 +269,7 @@
\_def\_crlpB#1#2-#3,{\_ifx\_end#3\_xdef\_crlplist{\_crlplist#1#2,}\_else\_crlpC#1#2-#3,\_fi}
\_def\_crlpC#1-#2-#3,{\_tmpnum=#1\_relax
\_loop \_xdef\_crlplist{\_crlplist\_the\_tmpnum,}\_ifnum\_tmpnum<#2\_advance\_tmpnum by1 \_repeat}
-\_def\_crlpD{\_global\_advance\_tmpnum by1
- \_edef\_tmpa{\_noexpand\_isinlist\_noexpand\_crlplist{,\_the\_tmpnum,}}%
+\_def\_crlpD{\_incr\_tmpnum \_edef\_tmpa{\_noexpand\_isinlist\_noexpand\_crlplist{,\_the\_tmpnum,}}%
\_tmpa\_iftrue \_kern-\_drulewidth \_tablinefil \_kern-\_drulewidth\_else\_hfil \_fi}
\_def\_tskip{\_afterassignment\_tskipA \_tmpdim}
@@ -296,7 +295,7 @@
\_public \mspan ;
\_doc -----------------------------
- The \`\vspan``{<number>}{<text>}` implementation is here.
+ The \`\vspan``<number>{<text>}` implementation is here.
We need to lower the box by
\begtt \catcode`\<=13
(<number>-1)*(\ht+\dp of \tabstrut) / 2.
@@ -305,7 +304,8 @@
then use braces.
\_cod -----------------------------
-\_def\_vspan#1#2{\_vtop to\_zo{\_hbox{\_lower \_dimexpr
+\_def\_vspan#1#2#{\_vspanA{#1#2}}
+\_def\_vspanA#1#2{\_vtop to\_zo{\_hbox{\_lower \_dimexpr
#1\_dimexpr(\_ht\_tstrutbox+\_dp\_tstrutbox)/2\_relax
-\_dimexpr(\_ht\_tstrutbox+\_dp\_tstrutbox)/2\_relax \_hbox{#2}}\_vss}}
\_public \vspan ;
@@ -511,6 +511,7 @@ after the second one.
\_endinput
+2021-01-27 \_tableB: \long\def added, \vspan syntax improved
2020-05-26 \eqbox implemented
2020-05-20 \colnum implemented.
\vspan implemented.
diff --git a/macros/luatex/optex/base/unimath-codes.opm b/macros/luatex/optex/base/unimath-codes.opm
index 21a9b1caeb..a52a9a02cb 100644
--- a/macros/luatex/optex/base/unimath-codes.opm
+++ b/macros/luatex/optex/base/unimath-codes.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_ncharrmA {Uni math codes <2020-11-13>} % preloaded on demand by \loadmath
+\_codedecl \_ncharrmA {Uni math codes <2021-02-03>} % preloaded on demand by \loadmath
\_doc -----------------------------
The control sequences for `\alpha`, `\beta` etc are redefined here.
@@ -158,7 +158,7 @@
}
\_catcode`#=14
\_everypar={\_setbox0=\_lastbox \_par \_p}
- \_input mathclass.opm
+ \_setbox0=\_vbox{\_input mathclass.opm }
\_endgroup
\_doc -----------------------------
@@ -170,7 +170,9 @@
\_begingroup % \input unimath-table.opm (it is a copy of unicode-math-table.tex):
\_def\UnicodeMathSymbol #1#2#3#4{%
- \_global\_Umathcharnumdef#2=\_Umathcodenum#1\_relax
+ \_ifnum#1=\_Umathcodenum#1 % the code isn't set by mathclass.opm
+ \_global\_Umathchardef#2=0 1 #1 \_global\_Umathcode#1=0 1 #1
+ \_else \_global\_Umathcharnumdef#2=\_Umathcodenum#1 \_fi
\_ifx#3\_mathopen \_gdef#2{\_Udelimiter 4 1 #1 }\_fi
\_ifx#3\_mathclose \_gdef#2{\_Udelimiter 5 1 #1 }\_fi
\_ifx#3\_mathaccent \_gdef#2{\_Umathaccent fixed 7 1 #1 }\_fi
@@ -187,10 +189,21 @@
\_mit % default math alphabets setting
+% hyphen character is transformed to minus:
\_Umathcode `- = 2 1 "2212
-%\_Umathcode`: = 3 1 "3A % mathclass defines it as 6 1 "3A (punctuation)
+
+% mathclass defines : as Punct, plain.tex as Rel, we keep mathclass,
+% i.e. there is difference from plain.tex, you can use $f:A\to B$.
+
\_let\{=\lbrace \_let\}=\rbrace
+% mathclas defines ! as Ord, plain.tex as Close
+\_Umathcode `! = 5 1 `! % keep plain.tex declaration
+\_Umathchardef \mathexclam = 5 1 `!
+% mathclas defines ? as Punct, plain.tex as Close
+\_Umathcode `? = 5 1 `? % keep plain.tex declaration
+\_Umathchardef \mathquestion = 5 1 `?
+
\_protected\_def \_sqrt {\_Uradical 1 "0221A }
\_protected\_def \_cuberoot {\_Uradical 1 "0221B }
\_protected\_def \_fourthroot {\_Uradical 1 "0221C }
@@ -241,6 +254,20 @@
\_global\_Umathcode `/ = 0 1 `/ % mathclass says that / is Bin, Plain TeX says that it is Ord.
+% compressed dots in S and SS styles (usable in \matrix when it is in T, S and SS style)
+\_protected\_def \vdots {\_relax \_ifnum \_mathstyle>3 \_unicodevdots \_else \_vdots \_fi}
+\_protected\_def \ddots {\_relax \_ifnum \_mathstyle>3 \_unicodeddots \_else \_ddots \_fi}
+\_protected\_def \adots {\_relax \_ifnum \_mathstyle>3 \_unicodeadots \_else \_adots \_fi}
+
+% Unicode superscripts (²) and subscripts as simple macros with \mathcode"8000
+\_bgroup
+ \_def\_tmp#1#2{\_global\_mathcode#1="8000 \_lccode`\~=#1 \_lowercase{\_gdef~}{#2}}
+ \_fornum 0..1 \_do {\_tmp{"207#1}{{^#1}}}
+ \_tmp{"B2}{{^2}}\_tmp{"B3}{{^3}}
+ \_fornum 4..9 \_do {\_tmp{"207#1}{{^#1}}}
+ \_fornum 0..9 \_do {\_tmp{"208#1}{{_#1}}}
+\_egroup
+
\_doc -----------------------------
Aliases are declared here. They are names not mentioned in the `unimath-table.opm` file
but commonly used in \TeX.
@@ -379,7 +406,7 @@
\ldotp \cdotp \bullet \triangleleft \trianglerigt \mapstochar \rightarrow
\prime \lhook \rightarrow \leftarrow \rhook \triangleright \triangleleft
\Relbar \Rightarrow \relbar \rightarrow \Leftarrow \mapstochar
- \longrightarrow \Longleftrightarrow \vdots \ddots ;
+ \longrightarrow \Longleftrightarrow \unicodevdots \unicodeddots \unicodeadots ;
\_endcode
@@ -398,6 +425,9 @@ for technical details about Unicode-math.
\_endinput
History:
+2021-02-03 Unicode superscripts, subscripts declared
+2021-01-31 Mathcode of ! ? set to Close, codes undeclared in mathclass set correctly
+2021-01-23 Compressed \vdots, \ddots, \adots in script(script)style.
2020-11-13 Bug fix: \colon declared
2020-06-13 Umathcode of / declared as in Plain TeX
2020-06-07 \_itgreek \_itGreek, \_rmgreek \_rmGreek etc. introduced, names changed
diff --git a/macros/luatex/optex/base/unimath-table.opm b/macros/luatex/optex/base/unimath-table.opm
index 066f57d352..252c1fc26a 100644
--- a/macros/luatex/optex/base/unimath-table.opm
+++ b/macros/luatex/optex/base/unimath-table.opm
@@ -3,6 +3,7 @@
% Only \ddots, \adots and \vdots are called differently:
% \unicodeddots, \unicodeadots and \unicodevdots
+% \mathquestion: Ord -> Close (because plain.tex declares it as Close)
\UnicodeMathSymbol{"00021}{\mathexclam }{\mathclose}{exclamation mark}%
\UnicodeMathSymbol{"00023}{\mathoctothorpe }{\mathord}{number sign}%
@@ -20,7 +21,7 @@
\UnicodeMathSymbol{"0003C}{\less }{\mathrel}{less-than sign r:}%
\UnicodeMathSymbol{"0003D}{\equal }{\mathrel}{equals sign r:}%
\UnicodeMathSymbol{"0003E}{\greater }{\mathrel}{greater-than sign r:}%
-\UnicodeMathSymbol{"0003F}{\mathquestion }{\mathord}{question mark}%
+\UnicodeMathSymbol{"0003F}{\mathquestion }{\mathclose}{question mark}%
\UnicodeMathSymbol{"00040}{\mathatsign }{\mathord}{commercial at}%
\UnicodeMathSymbol{"0005B}{\lbrack }{\mathopen}{left square bracket}%
\UnicodeMathSymbol{"0005C}{\backslash }{\mathord}{reverse solidus}%
diff --git a/macros/luatex/optex/base/verbatim.opm b/macros/luatex/optex/base/verbatim.opm
index dc701c96eb..8fd20ee531 100644
--- a/macros/luatex/optex/base/verbatim.opm
+++ b/macros/luatex/optex/base/verbatim.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \begtt {Verbatim <2020-11-13>} % preloaded in format
+\_codedecl \begtt {Verbatim <2021-01-22>} % preloaded in format
\_doc ----------------------------
The internal parameters
@@ -59,13 +59,13 @@
\_def\_setverb{\_catcodetable\_verbatimcatcodes }%
\_doc ----------------------------
- \`\activettchar``<char>` saves original catcode of previously declared `<char>` (if
+ \`\verbchar``<char>` saves original catcode of previously declared `<char>` (if
such character was declared) using \`\_savedttchar` and \`\_savedttcharc`
values. Then new such values are stored. The declared character is activated
by `\_adef` as a macro (active character) which opens a group,
does `\_setverb` and other settings and reads its parameter until second the same
character. This is done by the \`\_readverb` macro. Finally, it prints scanned
- `<text>` by \^`\_printinverbatim` and closes group. Suppose that `\activettchar"` is
+ `<text>` by \^`\_printinverbatim` and closes group. Suppose that `\verbchar"` is
used. Then the following work is schematically done:
\begtt
\_def "{\_begingroup \_setverb ... \_readverb}
@@ -75,14 +75,15 @@
deactivates it.
\_cod ----------------------------
-\_def\_activettchar#1{%
+\_def\_verbchar#1{%
\_ifx\_savedttchar\_undefined\_else \_catcode\_savedttchar=\_savedttcharc \_fi
\_chardef\_savedttchar=`#1
\_chardef\_savedttcharc=\_catcode`#1
\_adef{#1}{\_begingroup \_setverb \_adef{ }{\_dsp}\_ttfont \_the\_everyintt\_relax \_readverb}%
\_def\_readverb ##1#1{\_printinverbatim{##1}\_endgroup}%
}
-\_public \activettchar ;
+\_let \_activettchar=\_verbchar % for backward compatibility
+\_public \verbchar \activettchar ;
\_doc ----------------------------
\`\begtt` is defined only as public. We don't need a private `\_begtt` variant.
@@ -158,7 +159,7 @@
\_cod ----------------------------
\_def\_printverb #1^^J#2{%
- \_ifx\_printverblinenum\_relax \_else \_global\_advance\_ttline by1 \_fi
+ \_ifx\_printverblinenum\_relax \_else \_incr\_ttline \_fi
\_testcommentchars #1\_relax\_relax\_relax
\_iftrue
\_ifx\_end#2 \_printcomments\_fi
@@ -269,7 +270,7 @@
\_ttskip
\_isnextchar\_par{}{\_noindent}%
}
-\_def\_vireadline{\_read\_vifile to \_tmp \_global\_advance\_viline by1 }
+\_def\_vireadline{\_read\_vifile to \_tmp \_incr\_viline }
\_def\_visaveline{\_ea\_addto\_ea\_tmpb\_ea{\_tmp}}
\_public \verbinput ;
@@ -362,6 +363,7 @@
\_endinput
History:
+2020-01-22 ... \activettchar changed to \verbchar
2020-12-30 ... \secc followed by \begtt must be unbreakable
2020-11-13 ... \commentchars implemented
2020-04-22 ... \ttshift introduced
diff --git a/macros/luatex/optex/demo/op-demo.tex b/macros/luatex/optex/demo/op-demo.tex
index c116682e59..e17b2f0b2f 100644
--- a/macros/luatex/optex/demo/op-demo.tex
+++ b/macros/luatex/optex/demo/op-demo.tex
@@ -6,7 +6,7 @@
\typosize[9/10.5] % 9pt font / 10.5pt baselineskip
\parindent=10pt % typesetting parameters
\hyperlinks \Blue\Blue % active hyperlinks
-\activettchar` % in-text verbatim by `...`
+\verbchar` % in-text verbatim by `...`
\everyintt={\Red} % in-text verbatim Red
\enquotes % use \"text" for English quotation
@@ -89,7 +89,7 @@ can be added if you need to refer to a figure.
\sec Verbatim
In-text verbatim is surrounded by the character declared
-by `\activettchar` sequence. The listing can be surrounded
+by `\verbchar` sequence. The listing can be surrounded
by `\begtt` and `\endtt` sequences
\begtt
This is verbatim.
diff --git a/macros/luatex/optex/demo/op-slides.tex b/macros/luatex/optex/demo/op-slides.tex
index 8c9bca24fc..45b65fb657 100644
--- a/macros/luatex/optex/demo/op-slides.tex
+++ b/macros/luatex/optex/demo/op-slides.tex
@@ -9,7 +9,7 @@
\hyperlinks\Blue\Blue % hyperlinks are used in the title page
\backgroundpic{op-slides-bg.png} % background picture
-\activettchar` % inline verbatim
+\verbchar` % inline verbatim
\enquotes % English quotes \"..."
\slideshow %------------------------------------------------------------
diff --git a/macros/luatex/optex/doc/omls.tex b/macros/luatex/optex/doc/omls.tex
new file mode 100644
index 0000000000..f161f151d7
--- /dev/null
+++ b/macros/luatex/optex/doc/omls.tex
@@ -0,0 +1,832 @@
+\fontfam[lm]
+
+\adef<#1>{\ifcsname s:#1\endcsname
+ \link[s:#1]{}{\Blue$\langle$\hbox{\it#1\/}$\rangle$}%
+ \else {\Blue$\langle$\hbox{\it#1\/}$\rangle$}\fi}
+\everyintt={\catcode`<=13 \Red}
+\verbchar`
+\enlang
+\enquotes
+
+\def\r[#1]{\label[#1]\wlabel{\the\_itemnum}}
+\def\:{$\to$}
+\let\_narrowlastlinecentered=\ignoreit
+\_def\_printsecc#1{\_par
+ \_abovetitle{\_penalty-200}{\_medskip\_smallskip}
+ {\_seccfont \_noindent \_raggedright \_printrefnum[@\_quad]%
+ \_label[\the\_secnum.\the\_seccnum]\wlabel{\the\_secnum.\the\_seccnum}#1\_nbpar}%
+ \_nobreak \_belowtitle{\_medskip}%
+ \_firstnoindent
+}
+\def\.`{\bgroup\catcode`\ =12 \scancs}
+\def\scancs#1{\egroup
+ \immediate\_wref\Xknowncs{\string#1{\the\_secnum.\the\_seccnum}}%
+ \ea`\string#1%
+}
+\def\printcs#1{\ea\printcsred\csstring#1;~\ref[#1] \ }
+\def\printcsred,#1;{{\Red\tt \bslash#1}}
+\def\printknowncs{\ifx\knowncslist\undefined \let\knowncslist=\empty \fi
+ \ifx\knowncslist\empty TeX me again...\else
+ \_dosorting\knowncslist \ea\xargs \ea\printcs \knowncslist;\fi}
+
+\def\~`<#1>`{<#1>\sxdef{s:#1}{}\dest[s:#1]}
+
+\refdecl{
+ \def\knowncslist{}^^J
+ \def\Xknowncs#1#2{%
+ \sxdef{,\csstring#1}{#2}%
+ \global\ea\addto\ea\knowncslist\ea{\csname,\csstring#1\endcsname}%
+ }
+}
+\sdef{_item:c}{\pdfsave\llap{\pdfscale{1.3}{1.3}$\circ$\enspace}\pdfrestore}
+
+%\parindent=15pt \iindent=\parindent \ttindent=\parindent
+%\ttindent=0pt
+\everylist={\advance\ttindent by-1em}
+\hyperlinks \Green \Green
+\def\cskip{\par\nobreak}
+\def\begblock{\medskip\hbox\bgroup\vrule\vbox\bgroup\hrule\smallskip
+ \_fnset\leftskip=\parindent \rightskip=\parindent \medskip\noindent}
+\def\endblock{\medskip\hrule\egroup\vrule\egroup}
+
+\def\raggedright{\rightskip=10pt plus1fil\relax}
+\def\optexmanual{\ulink[http://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf]{\OpTeX/ manual}}
+
+\titskip=1cm
+
+\hfill Version 0.1
+
+\tit \OpTeX/ Markup Language Standard
+
+{\it\hfil Petr Olšák, 2021}\bigskip
+
+The \OpTeX/ markup language standard (OMLS) declares a list of control
+sequences used in \OpTeX/ documents including their syntax and sematic. The
+listed control sequences in OMLS in section~\ref[listcs] in table~\ref[alistcs]
+are called {\it known} and other control sequences are {\it unknown}.
+
+The main reason for OMLS is to give instructions on how to program convertors
+from \OpTeX/ documents to another formats (Html, Markdown, \LaTeX/) or how
+to interpret the \OpTeX/ document sources in such applications as
+{\tt texcount} or text editors\fnote
+{We suppose advanced editor features: color highlighting, sections/chapters folding,
+ auto-completions, etc.}.
+These converters and applications are called {\it cnv-programs} in this document.
+
+We suppose that if you need absolute control over the typography of the
+document when it is converted to PDF pages, then you use \OpTeX/ itself. If
+you need to create other formats of the same document then you can use a
+cnv-program which accepts OMLS. The result is a document without
+typographical instructions like dimensions of pages, margins, paginations
+and headers, selection of a font-family, dimensions of the fonts, etc.\ You can
+imagine the result of such a conversion as a single Html page where more
+typographical features can be controlled in a different way, for example by
+an external CSS file. This is a reason why control sequences like `\fontfam` or
+`\margins` are ignored by cnv-programs.
+
+Obviously, \TeX/ and \OpTeX/ itself gives possibility to declare various
+input formats for various purposes. Sometimes (in very special cases) there
+exists a good reason to declare a different and special input format by
+\TeX/ macros. But if the source of the document respects the OMLS then it is
+reasonably transformable to other formats by cnv-programs. We hope that
+OMLS-ready documents cover a very large set of typical documents used these
+days.
+
+We suppose that cnv-programs work internally with strings of source lines
+without tokenization. This is one of the great differences in processing the
+document directly by \OpTeX/ and using a cnv-program. The second difference is
+that the expansion process of macros is not implemented in cnv-programs in
+its full range. We respect that the result of cnv-programs will be different
+than from processing directly by \OpTeX/. But this is not a bug, this is
+the feature. We concentrate on the fixed syntax and sematic given by OMLS of the
+\OpTeX/ document and we throw behind the head the typographical
+exactness of the document which can be done only directly by \TeX/ (and it is
+exactly described in \TeX/book, for example).
+
+\notoc\nonum\sec Table of contents
+
+\begmulti 2
+\maketoc
+\endmulti
+\vfil\break
+
+\sec Syntactical rules
+
+The syntactical elements are described as strings here. No \TeX/'s tokenization is
+taken into account. The rule with a smaller number has precedence.
+
+\begitems \style n
+* end of line or end of file \: \~`<eol>`.\r[eol]
+* `%%:` at beginning of the line \: \~`<cnv-declarator>`, see section~\ref[cnv-decl].
+* `<cnv-declarator><text><eol>` is interpreted specially.
+* space or a tab-character \: \~`<space>`.
+* non-empty sequence of `<space>`s \: \~`<spaces>`.\r[spcs]
+* an empty line or a line only with `<spaces>` \: \~`<empty-line>`.
+* a character `a`--`z` or `A`--`Z` \: \~`<letter>`.
+* a `<letter>` or `_` \: \~`<specletter>`.
+* a character different from previous rule or `<eol>` or `<spaces>` \: \~`<non-specletter>`
+* `\<non-specletter>` \: \~`<singlechar-control-sequence>`.\r[scs]
+* a non-empty sequence of `<specletter>`s \: \~`<letters-seq>`.
+* `\<letters-seq><non-specletter>` \: \~`<multiletter-control-sequence>``<non-specletter>`.
+* `%<text><eol>` \: `<comment>` and it is completely ignored including `<eol>`.\r[com]
+* `<spaces>` at beginning of the line marks that the line as {\it indented}.
+* `<spaces>` at beginning of the line \: are ignored.\r[bspace]
+* `<spaces><eol>` or `<eol>` \: `<spaces>`.\r[eolrm]
+* `<multileter-control-sequence><spaces>` \: `<multileter-control-sequence>`.\r[csspace]
+* `<multiletter-control-sequence>` or `<singlechar-control-sequence>` \: \~`<control-sequence>`.\r[cs]
+* `<spaces>` \: `<space>`.\r[sspace]
+* `~` \: non-breakable space.
+* text where all pairs `{` and `}` match at arbitrary level \: \~`<balanced-text>`.\r[balt]
+* `{<balanced-text>}` can be interpreted as a parameter of a `<control-sequence>`, see section~\ref[listcs].
+* The `{` alone not used by previous rule opens a group and the `}` alone closes the same group.\r[group]
+* There are two main modes: h-mode, v-mode\fnote
+ {this is great simplification of real \TeX/ modes.}.
+ The document processing starts in v-mode.
+* In v-mode: a `<non-space>` character or a control sequence listed
+ in table~\ref[vtohmode] swithes to h-mode.
+* In h-mode: an `<empty-line>` or a control sequence listed in table~\ref[htovmode] switches to v-mode.\r[htov]
+* The switching from v-mode to h-mode \: a paragraph begins.
+* The switching from h-mode to v-mode \: the current paragraph ends.
+* `$<text>$` or `$$<text>$$` \: process `<text>` in math-mode, see section~\ref[math].
+* a non-empty sequence of digits with optional `+` or `-` in the front \: \~`<number>`.
+* `<number>` with optional dot inside the sequence of digits \: \~`<decimal-number>`.
+* a pair of letters listed in the table~\ref[tex-units] \: \~`<tex-unit>`.
+* optional space, i.e.\ `<space>` or nothing \: \~`<o-space>`.
+* `<decimal-number><o-space><tex-unit><o-space>` \: \~`<dimen>`.
+* `<control-sequence>` not listed in table~\ref[alistcs] nor in configuration \: \~`<unknown-control-sequence>`.\r[unkncs]
+* `=<o-space>` or `<o-space>` \: \~`<o-equal>`.
+* `<unknown-control-sequence><o-equal><dimen>` \: should be completely ignored.\r[eqdim]
+* `<unknown-control-sequence><o-equal><number>` \: should be completely ignored.
+* `<unknown-control-sequence>=<o-space>{<balanced-text>}` \: should be completely ignored.
+* `<unknown-control-sequence>[<balanced-text>]` \: should be completely ignored.\r[ibkt]
+* `<unknown-control-sequence>` \: should be ignored.\r[ignore]
+* `<control-sequence>`s are processed as described in section~\ref[listcs] or
+ by a configuration of the cnv-program.
+\enditems
+
+\bigskip
+\label[vtohmode]\caption/t
+List of control sequences which switch from v-mode to h-mode.
+\cskip
+\begblock
+`\`<space>,
+`\hfil`,
+`\hfill`,
+`\hskip`,
+`\hss`,
+`\indent`,
+`\leavevmode`,
+`\noindent`,
+`\quad`,
+`\qquad`,
+`\vrule`.
+\endblock
+
+\bigskip
+\label[htovmode]\caption/t
+List of control sequences which switch from h-mode to v-mode.
+\cskip
+\begblock
+`\begblock`,
+`\begitems`,
+`\begmulti`,
+`\begtt`,
+`\bib`,
+`\bigskip`,
+`\bye`,
+`\caption`,
+`\chap`,
+`\cskip`,
+`\end`,
+`\endblock`,
+`\enditems`,
+`\endmulti`
+`\hrule`,
+`\medskip`,
+`\par`,
+`\sec`,
+`\secc`,
+`\secl`,
+`\smallskip`,
+`\vfil`,
+`\vskip`.
+\endblock
+
+\bigskip
+\label[tex-units]\caption/t
+List of \TeX/ units.
+\cskip
+\begblock
+`bp`,
+`cc`,
+`cm`,
+`dd`,
+`em`,
+`ex`,
+`in`,
+`mm`,
+`pc`,
+`pt`,
+`sp`.
+\endblock
+
+\nonum\secc Examples
+
+\begitems
+* `\%` is `<control-sequence>` by rules \ref[scs], \ref[cs]. It does not start
+ comment, because rule \ref[scs] has precedence before rule \ref[com].
+* `\%<space>`: the `<space>` is kept, but `\foo<space>`: the space is removed
+ by rule~\ref[csspace].
+* `wordA<spaces><eol><spaces>wordB` is `wordA<space>wordB` by rules~\ref[bspace],
+ \ref[eolrm], and~\ref[sspace].
+* `\kern-3pt` should be ignored, because `\kern` is `<unknown-control-sequence>` and rule
+ \ref[eqdim] is applied.
+* `\vskip42mm` should finalize paragraph in h-mode by rule~\ref[htov] and then it
+ is ignored by rule~\ref[eqdim] because `\vskip` is
+ `<unknown-control-sequence>` not listed in table~\ref[alistcs].
+* `\typosize[12/16]` is ignored by rule~\ref[ibkt].
+* `\foo{text}` is `{text}` (i.e. `text` in a group) by rules~\ref[ignore] and~\ref[group].
+\enditems
+
+\sec Scanning parameters
+
+If a control sequence listed in rules above or in the section~\ref[listcs]
+has a parameter, the parameter is scanned
+as a string with interpretation only those rules which are needed to
+determine the boundary of the parameters. For example `\tit <title><eol>`
+applies only rule~\ref[eol] during scanning the parameter, i.e.\ `<title>`
+is a string telemetered by the end of the line or the end of the file.
+Or `\fnote{<balanced-text>}` applies only rule~\ref[balt].
+
+If the parameter is in the format `{<something>}` then the `<something>` is
+always meant as `<balanced-text>`. We don't specify the type `<balanced-text>`
+explicitly here, so we refer to `\fnote{<text>}` and not
+`\fnote{<balanced-text>}`, for example.
+
+The spaces before the scanned parameter are optional
+and they are ignored. Spaces inside `{`...`}` are not ignored.
+
+If the parameter is in the format `{<something>}` and the first non-space
+character is not `{` then the parameter is this first non-space character or
+a `<control-sequence>` if the first non-space character is~`\`. For example
+`\fnote a` is equal to `\fnote{a}`. The difference from this rule is given
+for `\input`, `\verbinput`,`\inspic` and `\inkinspic` control sequences in
+section~\ref[listcs].
+
+If the parameter is scanned as a string already then
+all syntactical rules are applied when it is used. For example:
+\begtt
+\tit This is a title
+\endtt
+the parameter is scanned as `This is a title` and the rules~\ref[spcs]
+and~\ref[sspace] are applied when it is used.
+
+
+\sec Declaration and text parts of the document
+
+A typical \OpTeX/ document has two parts. A declaration part, where
+macros are defined by `\def` and friends, fonts and sizes are declared, etc.
+This part should be ignored by cnv-programs.
+The second part includes the document text with a markup using well-declared control
+sequences. The cnv-program has to interpret the second part.
+
+So, the cnv-program starts in declaration-skipping mode and it switches to
+the text mode later.
+
+When cnv-program is in declaration-skipping mode then all indented lines are
+ignored. And lines which begins by `}` or by a <control-sequence> not listed
+in table~\ref[textopen] are ignored too.
+
+If the line begins by a character other than `}` or by a <control-sequence>
+listed in table~\ref[textopen] then cnv-program switches to text mode. All
+texts are interpreted from this line including this one.
+
+User can say explicitly where the second part of the document starts by
+`%%:text` given at beginning of a line. Moreover, if `%%:decl` is given at
+beginning of a line, then all text between `%%:decl` and `%%:text` is
+ignored, only other possible `<cnv-declarator>`s are processed here.
+It means that the declaration part and the text part of the document can be
+simply determined by the pair `%%:decl` and `%%:text`.
+
+\bigskip
+\label[textopen]\caption/t
+List of control sequences which start the text mode.
+\cskip
+\begblock \raggedright
+`\address`,
+`\begblock`,
+`\begitems`,
+`\begmulti`,
+`\begtt`,
+`\bf`,
+`\bi`,
+`\bib`,
+`\caption`,
+`\cite`,
+`\clipinoval`,
+`\clipincircle`,
+`\ecite`,
+`\fnote`,
+`\frame`,
+`\hfil`,
+`\hfill`,
+`\ii`,
+`\iid`,
+`\incircle`,
+`\inkinspic`,
+`\inoval`,
+`\inspic`,
+`\it`,
+`\LaTeX`,
+`\LuaTeX`,
+`\maketoc`,
+`\mnote`,
+`\OpTeX`,
+`\putpic`,
+`\puttext`,
+`\rcite`,
+`\rm`,
+`\rotbox`,
+`\sec`,
+`\secc`,
+`\secl`,
+`\table`,
+`\TeX`,
+`\tit`,
+`\usebib`,
+`\verbinput`.
+\endblock
+
+
+\sec[cnv-decl] The `%%:` declarators
+
+The `%%:` declarators are ignored when the document is processed by \TeX/
+but they can give instructions to cnv-programs. The `%%:` must be placed at
+beginning of the line. The list of `%%:` declarators follows:
+
+\begitems
+* `%%:decl` -- the following text is ignored until `%%:text` occurs. Only
+ other `%%:` declarators are interpreted.
+* `%%:text` -- the following text must be interpreted in text mode.
+* `%%:to <format> <config-file>` -- if the cnv-program converts to the
+ <format> then it has to use the <config-file>. For example:
+ \begtt
+ %%:to html html-mydocument.cfg
+ %%:to markdown markdown-mydocument.cfg
+ %%:to latex preamble-mydocument.cfg
+ \endtt
+ The language of the config files are not a part of this standard, we
+ suppose something to be natural for used cnv-program. The config file should
+ give additional rules for interpreting control sequences not listed in the
+ section~\ref[listcs] (see rule~\ref[unkncs]). For example a tool for
+ defining a behavior of unknown control sequences can be here.
+ These definitions can depend on the converted document and on the output
+ format and they can be given in the configuration files.
+* `%%:app <application> <config-file>` -- behaves like `%%;to` but the
+ cnv-program name instead output format is given here.
+* `%%:do <format-or-app> <action>` -- does an `<action>` if `<format-or-app>`
+ is output format or used cnv\hbox{-}program name. The `<action>` syntax depends
+ on used cnv-program and it typicaly does a change in its configuration or
+ give a command to it.
+* `%%:skip <formats-or-apps>` -- ignores all following lines until another `%%:` occurs
+ if the output format or application name is included in the `<formats-or-apps>`
+ space-separated list. Example:
+ \begtt
+ %%:skip html markdown
+ This text is not interpreted when Html or Markdown output is generated.
+ %%:
+ \endtt
+ If the `<formats-or-apps>` is empty then the `%%:skip` is applied for
+ each cnv-program and for each output.
+* `%%:if <formats-or-apps>` -- processes following lines until another `%%:`
+ only if the output format or application name is included in the
+ `<formats-or-apps>` space-separated list. Other cnv-programs or output formats
+ not mentioned here skip these lines. Note that \TeX/ processes such lines always.
+ But you can use `\ignoreit{<text>}` which is processed as
+ `{<text>}` by cnv-programs (see rule~\ref[ignore]) but it is ignored by \OpTeX.
+ Example:
+ \begtt
+ %%:if html latex
+ \ignoreit{\input{file.tex}}
+ %%:
+ \endtt
+ The `file.tex` in this example is processed only if \LaTeX/ or Html output is generated.
+* `%%:use` -- the next single line is fully interpreted unless cnv-program ignores
+ declarations by `%%:decl` or because it is in declaration-skipping mode.
+ Example:
+ \begtt
+ %%:use
+ \verbchar` \picdir={img/}
+ \endtt
+ The example shows how cnv-program is able to read `\verbchar` or
+ `\picdir` settings in the declaration\hbox{-}skipping mode although these control
+ sequences are not listed in table~\ref[textopen].
+* `%%:quotes <qql> <qqr> <ql> <qr>` -- declares \~`<qql>` and \~`<qqr>` (left
+ and right double quotation marks), \~`<ql>` and \~`<qr>` (left and right single
+ quotation mark). They are used when `\"` or `\'` control sequences are
+ processed. Default: unset, i.e.\ `\"` and `\'` are interpreted as
+ unknown control sequences.
+\enditems
+
+
+\sec[listcs] List of known control sequences
+
+The phrase \"should be" is used very often when the interpretation of
+control sequences is declared here. It means that this is only a common
+interpretation, but differences are possible due to the type of the output
+format and used cnv-program. For example, when we convert to \LaTeX\, then
+`\-` and `\/` are not ignored but they are re-written without change to the
+output of the \LaTeX/ source file.
+
+\bigskip
+\label[alistcs]
+\caption/t List of known control sequences alphabeticaly sorted.
+\cskip
+\begblock
+\raggedright \printknowncs
+\endblock
+
+
+\secc Character-like control sequences
+
+\begitems
+* \.`\%`, \.`\$`, \.`\&`,\.`\#` respectively \: should be normal characters
+ `%`, `$`, `&`, `#` respectively.
+* \.`\bslash` \: normal character `\`.
+* \.`\space`, `\<space>`, `\<eol>` \: space.
+* `\,` \: should be small space or space.
+* \.`\quad`, \.`\qquad` \: should be bigger space or more spaces.
+* \.`\-`, \.`\/` \: should be ignored.
+* \.`\"<text>"` or \.`\'<text>'` \: `<clqq><text><crqq>` or `<clq><text><crq>`,
+ only if `%%:quotes` are set.
+\enditems
+
+\secc Input files
+
+\begitems
+* \.`\input {<file-name>}` or `\input <file-name><space>` should redirect the
+ input to given file. At the end of the input-ed file or at \.`\endinput` the
+ reading of the current file continues. The file is read from the current
+ directory, but the <file-name> should include the full path to the file
+ or relative path starting from the current directory. First, the file
+ `<file-name>.tex` is tried to read and if it doesn't exist then
+ the file `<file-name>` is read.
+* \.`\picdir <o-equal>{<text>}` saves `<text>` to `<picdir-value>`. By
+ default, `<picdir-value>` is empty.
+* \.`\inspic {<file-name>}` or `\inspic <file-name><space>` should include the
+ given picture from the `<picdir-value><file-name>`.
+* \.`\inkinspic {<file-name>}` or `\inkinspic <file-name><space>` behaves like
+ `\inspic`.
+* \.`\verinput <ignore> (<lines>) <file-name><space>` should include the
+ <file-name> (only given lines) as a verbatim text, i.\,e. without any
+ syntactical interpretation.
+* \.`\usebib/<letter> (<style>) <file-names>` should use files from
+ `<file-names>` to generate the list of bib references. The `<file-names>`
+ is comma separated list (the `.bib` extension is appended to
+ each such file name). Only cited bib records should be used in this
+ bib-references, i.e. their label must be used in a `\cite[<labels>]` or
+ `\rcite[<labels>]` or `\ecite[<label>]`.
+ What bib fields are used in bib records depends on the cnv-program and
+ on its configuration. Maybe, simple cnv-programs should generate nothing here.
+\enditems
+
+\secc Titles
+
+\begitems
+* \.`\tit <title><eof>` should be a title of the document.
+* \.`\chap <title><eof>` or `\chap [<label>] <title><eof>` is the title of
+ first level.
+* \.`\sec <title><eof>` or `\sec [<label>] <title><eof>` is the title of
+ second level.
+* \.`\secc <title><eof>` or `\secc [<label>] <title><eof>` is the title of
+ third level.
+* \.`\secl<level> <title><eof>` is the title of given level.
+\enditems
+
+\secc Fonts
+
+\.`\rm` selects upright normal font (it is selected by default), \.`\it` selects
+italic, \.`\bf` selects upright bold font, \.`\bi` selects bold italic and
+\.`\tt` selects a monospaced font, \.`\em` select italic (if upright is current) or upright
+(if italic is current). The font sizes or other font features are typically ignored
+by cnv-programs. The actual font selection is closed at the end of the current group.
+The groups are given:
+\begitems
+* explicitly by `{` and `}` characters (which are not delimiters of
+ parameters of known control sequences),
+* implicitly: parameters of control sequences listed in table~\ref[groupcs]
+ are processed in a group and blocks of text enclosed by
+ `\begitems`...`\enditems`, `\begblock`...`\endblock`, `\begmulti`...`\endmulti`
+ are processed in a group.
+ Each item in `\table` is in a group.
+\enditems
+
+\label[groupcs]
+\caption/t Parameters of following control sequences are processed in a group.
+\cskip
+\begblock
+`\caption`,
+`\chap`,
+`\fnote`,
+`\mnote`,
+`\sec`,
+`\secc`,
+`\tit`.
+\endblock
+
+\secc Colors
+
+\.`\Red`, \.`\Green`, \.`\Blue`, \.`\Cyan`, \.`\Magenta`, \.`\Yellow`, \.`\White`,
+\.`\Black`, and \.`\Brown` should select the given color of the font. The selection
+is closed at the end of the current group (like font selectors).
+
+\secc Blockquotes
+
+The blockquote\fnote
+{The terminology is borrowed from Markdown.}
+is opened by \.`\begblock` and closed by \.`\endblock`.
+Blockquotes can contain multiple paragraphs and can contain nested
+blockquotes.
+
+\secc Lists
+
+The list is opened by \.`\begitems` and closed by \.`\enditems`. The `*` starts
+a new item in this environment. Nested lists are allowed.
+
+The type of items (ordered/unordered)
+is given by \.`\style <character>`, see section 1.4.5 in the
+\optexmanual. Default type is unordered (bullets are used).
+
+
+\secc Code blocks (verbatim texts)
+
+Code blocks are inline verbatim or display verbatim.
+
+\begitems
+* \.`\begtt <ignored><eol><text>\endtt<ignored><eol>` processes `<text>` in
+ \"display verbatim mode", i.\,e. there are no special characters, each character
+ is processed without special interpretation, the <eol>s are end of lines.
+ The text at the same line after `\begtt` and after `\endtt` (if any) is
+ ignored.
+* \.`\verbchar <character>` declares `<verbchar>`. By default, it is undeclared.\nl
+ New `\verbchar <character>` rewrites previous setting. The setting is
+ local in the group.
+* Inline verbatim is enclosed in the pairs of `<verbchar>`s.
+ The text between two `<verbchar>`s is processed without special interpretation.
+ Only possibly <eol>s are replaced by space.
+ Example:
+ \begtt
+ %%:use
+ \verbchar`
+ Now, `$this %text ~\` is processed as inline verbatim.
+ \endtt
+ gives: Now, `$this %text ~\` is processed as inline verbatim.
+* \.`\code{<text>}` processes `<text>` like inline verbatim, but
+ all `\<character>` are processed as `<character>`, specially `\{` and `\}`
+ are `{` and `}` but without taking them into `<balanced-text>` rule,
+ `\\` is `\` but do not create a `<control-sequence>`, etc.
+\enditems
+
+
+\secc Multiclolumns
+
+\.`\begmulti <number><space>` opens the group and \.`\endmulti`
+closes the group. If output format allows multi-columns then
+the text enclosed between `\begmulti <number><space>` and matching
+`\endmulti` should be printed in `<number>` balanced columns.
+
+
+\secc Links
+
+\begitems
+* \.`\url{<text>}` creates `<text>` as an external link which points to `<text>`.
+ The `\<character>` is interpreted as `<character>` in `<text>` with one
+ exception: `\|` is ignored.
+* \.`\ulink[<url>]{<text>}` creates `<text>` as an external link which points
+ to `<url>`. The `\<character>` is interpreted as `<character>` only in
+ `<url>` parameter.
+* \.`\label[<label>]` sets the `<label>`. First following occurence of `\chap`, `\sec`,
+ `\secc`, `\caption` or `\eqmark` sets this `<label>` as bounded to its
+ position in the document.
+* \.`\ref[<label>]` should create an internal link to the position given by
+ `\chap`, `\sec`, `\secc`, `\caption` or `\eqmark`,
+ if `[<label>]` is used as the parameter of this control sequence
+ else if `<label>` is bounded here by previous `\label[<label>]`
+ The visual aspect of the link
+ is not declared by OMLS because we don't suppose that the chapters,
+ sections, equations, etc.\ are automatically numbered by exactly the same way as in
+ \OpTeX/. A recommendation should be: create a simple sequence of numbers over
+ all internal links.
+* \.`\pgref[<label>]` should be replaced by `??` if cnv-program generates single-page
+ output (like Html, Markdown). Unfortunately, we get the irrelevant phrases in the output:
+ \"{\tt The problem is shown at the page ??}".
+ Users can declare `%%:skip` for such cases.
+* \.`\bib[<label>]` or `\bib[<label>]<o-space>=<o-space>{<ignored>}` should open the new bib
+ record. More exactly, it closes previous paragraph (if h-mode is current)
+ and opens new h-mode. Then prints an auto-generated reference number in
+ `[...]`. Following text is interpreted as a bib record until the h-mode ends.
+* \.`\cite[<labels>]` should create internal links to corresponding bib
+ records generated by `\usebib` or by `\bib`. The `<labels>` is a comma-separated list
+ of labels used in `.bib` files or in `\bib` commands to indicate
+ the corresponding bib record. The labels should be replaced by auto-generated
+ reference numbers used in bib records. All reference numbers created by
+ single `\cite` should be enclosed by single `[...]`. These numbers are
+ internal links. If the cnv-program does not implement this complicated
+ bib machinery then `\cite[<labels>]` should print only `[<labels>]`.
+* \.`\rcite[<labels>]` does the same as `\cite[<labels>]` but doesn't print
+ outer `[...]`.
+* \.`\ecite[<label>]{<text>}` creates the link to corresponding bib record,
+ `<text>` is is hyperlinked (no the auto-generated reference number).
+* \.`\maketoc` should create a list of titles from all `\chap`, `\sec` and `\secc`
+ used in the document if they are not preceded by \.`\notoc`. All lines in
+ this list should include internal links to the position where the corresponding title
+ is used.
+\enditems
+
+\secc Tables
+
+\begitems
+* \.`\caption/<letter>` opens a caption. More exactly, if current mode is
+ h-mode, then switch to v-mode first (i.e.\ close the current paragraph).
+ Then switch from v-mode to h-mode and put a <caption-head>. The following
+ text should be interpreted as the caption text until h-mode ends.
+ If <letter> is `t` then <caption-head> is `Table` followed
+ by an auto-generated number. If the <letter> is `f` then <caption-head> is
+ `Figure` followed by an auto-generated number. The configuration of
+ cnv-programs shoud allow different words than default `Table` or `Figure` (for
+ example, if another language is used).
+* \.`\table<ignored>{<declaration>}{<data>}` should create a table. The fidelity
+ rate of created output depends heavily on the used cnv-program and the output
+ format. We don't suppose that all aspects of \OpTeX/ tables are implemented.
+ The following features are listed in their priority of implementation.
+ \begitems \style c
+ * Items in `<data>` are separated by `&`.
+ The last item in each row is separated by end-row separator: \.`\cr`, \.`\crl`, \.`\crll`,
+ \.`\crli`, \.`\crlli`, or \.`\crlp{<list>}`. If there are $n$ columns in
+ the table then we have $n-1$ `&` separators and one end-row separator
+ for each table row.
+ There can be an optional end-row separator at the first item in `<data>` and
+ it should be ignored. The `<data>` can end without the end-row separator, it
+ should be added here.
+ * Spaces around `&` and before end-row separator are ignored.
+ * \.`\noalign{<text>}` and \.`\tskip <dimen>` should be ignored.
+ * Colum declarators in <declaration> should be interpreted: `l` (left aligned), `c` (center
+ aligned), `r` (right aligned) or `p{<ignored>}` (paragraph-like item).
+ * The `<number><letter>` or `<number>{<text>}` should be interpreted as
+ `<number>`-times repeated `<letter>` or `<text>` in `<declaration>`.
+ * \.`\vspan<decimal-number>{<text>}` should be an item with only `<text>`.
+ * \.`\mspan<number>[<decl>]{<text>}` should create `<text>` as an item which
+ spans over `<number>` columns. It is used instead `<number>` real
+ items, i.e.\ `<number>`$-1$ separators `&` aren't used here.
+ * Rules in the table should be interpreted, i.e. `|` in <declaration>
+ should be not ignored and
+ various end-row separators should be distinguished (see \optexmanual,
+ section 1.4.6).
+ * The aligning of `p{<p-data>}` columns should be interpreded by reading
+ \.`\fL`, \.`\fR`, \.`\fC`, \.`\fS` and \.`\fX` control sequences in `<p-data>`.
+ See \optexmanual, section 1.4.6.
+ \enditems
+\enditems
+
+\secc Footnotes, marginal notes
+
+\begitems
+* \.`\fnote{<text>}` should create a footnote link as an auto-generated
+ reference number.
+ The `<text>` should be appended at the end of the document labeled by this
+ reference number. Another alternative (for Html output, for example): the mouse over
+ the reference number riases an auto-popup `<text>`.
+* \.`\fnotemark<number>` should create a pointer to a next declared
+ footnote as auto-generated reference number. The `<text>` of the footnote is
+ declared after that by \.`\fnotetext{<text>}`. Exact behavior: if the
+ reference number of the last processed `\fnote` is $n$ then
+ `\fnotemark<number>` uses the value
+ $n+{}$`<number>` as its reference number. A set of `\fnotemark`s
+ is followed by an equally large set of `\fnotetext{<text>}`. First one
+ have reference number $n+1$, second $n+2$, etc. When whole set of `\fnotetext{<text>}`
+ is processed then $n$ is reset to the last reference number used here.
+* \.`\mnote <ignored>{<text>}` should be created as auto-popup `<text>` or the `<text>`
+ is inserted at the margin.
+\enditems
+
+\secc Tagging for index
+
+We don't suppose that the cnv-program can generate the alphabetically sorted
+index. So, the markup for creating the index should be ignored:
+
+\begitems
+* \.`\ii <word><space>` (where `<word>` is a sequence of non-space characters)
+ should be ignored.
+* \.`\iid <word><space>` is `<word><space>` by default, but
+ if `,` or `.` follows after `<space>` then the `<space>` is removed.
+\enditems
+
+\secc Logos
+
+\.`\TeX`, \.`\LuaTeX`, \.`\OpTeX`, \.`\LaTeX`, respectively \:
+`TeX`, `LuaTeX`, `OpTeX`, `LaTeX`, respectively. If `/` follows
+these control sequences then it is ignored. Other logos should be declared
+in the configuration of the cnv-program.
+
+\secc What should be ignored
+
+\begitems
+* \.`\def<text>{<text>}` and other variants with \.`\gdef`, \.`\edef`, \.`\xdef`.
+ Reason: user can insert a special definition in the `%%:text` part of the
+ document in order to solve a problem. But cnv-program should ignore~it.
+* \.`\outlines{<text>}`, \.`\insertoutline{<text>}` and \.`\thisoutline{<text>}`.
+\enditems
+
+
+\sec[math] Math mode processing
+
+There are two math modes, inline: `$<formula>$` or display: `$$<formula>$$`.
+We suppose that `<formula>` will be processed by MathJax or similar
+software. So, the `<formula>` should be kept without changes in cnv-program
+output, but there are exceptions:
+
+\begitems
+* `$<sign><decimal-number>$` should be transformed to non-math text
+ `<sign><decimal-number>`. The `<sign>` is~`+` or~`-` or nothing.
+ The `<decimal-number>` can include `,` (comma) instead `.` (period).
+ If the `<sign>` is~`-` (character U+002D) then
+ it must be converted to `−` (character U+2212, math minus).
+* `{\bbchar <text>}` should be converted to `\mathbb{<text>}`, because
+ MathJax doesn't understand `\bbchar`. `$\bbchar <text>$` should be
+ converted to `$\mathbb{<text>}$`.
+* `{\frak <text>}` or `$\frak <text>$` \:
+ `\mathfrak{<text>}` or `$\mathfrak{<text>}$`.
+* `{\script <text>}` or `$\script <text>$` \:
+ `\mathscr{<text>}` or `$\mathscr{<text>}$`.
+* `\eqmark`, `\eqmark[<label>]` \: `\leqno (<num>)`, where `<num>` is
+ auto-generated number. Or it should be completely ignored.
+* It is strongly recommended to allow users to declare another replacement
+ rules over `<formula>` in configuration files of cnv-programs.
+\enditems
+
+
+\sec Notes on various conversions
+
+The cnv-programs behave differently because output formats have different
+concepts and are intended for different purposes. The following sections
+mention the main differences for typical conversions.
+
+\secc To Html
+
+The Html document is one single page. If we want to split the document to more
+pages, then we can use `%%:do html <action>` in positions where the document
+should be split (the syntax of `<action>` depends on the used cnv-program.)
+
+The design of Html pages should be declared by CSS files.
+
+Pictures inserted by `\inspic` should be inserted into the Html page as
+\code{<img src="...">}, so the picture files must be installed in
+the webserver to render the Html page correctly in a web browser.
+
+The `\maketoc` used in the \OpTeX/ document means that the Table of contents should
+be here. It should be generated by the cnv-program, two-pass processing is
+needed because the cnv-program needs to read all titles of `\chap`, `\sec` and
+`\secc`. Another approach is to read the `.ref` file produced by \OpTeX/.
+
+
+\secc To Markdown
+
+Markdown source file is \"one-page document" too. The principles a
+re similar to conversion to Html.
+
+\secc From Markdown
+
+The cnv-program which does such a reverse conversion should be very useful for
+people they prefer even clearer markup than in \OpTeX/.
+
+\secc To \LaTeX
+
+\LaTeX/ gives the same main feature as \OpTeX/: it can generate PDF
+output from a source file. But different macros, a different concept, and
+a different markup are used.
+
+The main reason for such conversion is that journal editors
+require \LaTeX/ source file, but user want to prepare their real document in
+more comfortable (\OpTeX/) markup and with more simple macros.
+
+This conversion should keep almost all features. For example, the
+`\pgref[<label>]` is converted to `\pageref{<label>}`. The cnv-program
+needs not to generate a Table of contents, bibliography references, etc. Only
+appropriate \LaTeX/ markup must be used.
+
+The contents of generated \LaTeX/ preamble should be configurable.
+
+
+\secc From \LaTeX
+
+The reverse conversion from \LaTeX/ to \OpTeX/ can be usable
+for people, they want to switch to creating their documents in \OpTeX/.
+
+The cnv-program must solve additional problem in this type of conversion.
+There are various math \LaTeX/ environments, they must be converted to
+plain~\TeX/ syntax of math typesetting. For example:\nl
+`\begin{array}...\end{array}` \: `\matrix{...}`,\nl
+`\begin{align*}...\end{align*}` \: `$$\eqalign{...}$$`\nl
+`\frac{...}{...}` \: `{...\over...}`.
+
+\bye
diff --git a/macros/luatex/optex/doc/optex-doc.pdf b/macros/luatex/optex/doc/optex-doc.pdf
index aacd564a60..4bd55547cb 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 4ce127f903..f8fcc45ca0 100644
--- a/macros/luatex/optex/doc/optex-doc.tex
+++ b/macros/luatex/optex/doc/optex-doc.tex
@@ -20,7 +20,7 @@
\tit Format Based on Plain \TeX/ and OPmac\fnotemark1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\hfill Version 0.19
+\hfill Version 1.00
\centerline{\it Petr Olšák, 2020, 2021}
@@ -92,6 +92,8 @@ document \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf]
\notoc\nonum \sec Contents
\maketoc
+\thisoutline {USER DOCUMENTATION}
+
\chap User documentation
\input optex-userdoc
diff --git a/macros/luatex/optex/doc/optex-math.tex b/macros/luatex/optex/doc/optex-math.tex
index c36459f74e..2fd21af218 100644
--- a/macros/luatex/optex/doc/optex-math.tex
+++ b/macros/luatex/optex/doc/optex-math.tex
@@ -13,7 +13,7 @@
\def\new #1 {\mnote{\Red$\blacktriangleleft$\,\sans\setfontsize{at9pt}\rm#1}}
\fixmnotes\right
\enquotes
-\activettchar`
+\verbchar`
\catcode`\<=13
\def<#1>{$\langle\hbox{\it#1\/}\rangle$}
\everyintt={\catcode`\<=13 }
@@ -47,7 +47,7 @@
\tit Typesetting Math with \OpTeX/
-\hfill Version 02, October 2020
+\hfill Version 03, January 2021
\author Petr Olšák
@@ -1475,7 +1475,7 @@ $$ \eqalignno{
\secc[fams] Math families
-\TeX/can use more than one math font in math mode. This was a
+\TeX/ can use more than one math font in math mode. This was a
necessity in the old days when only 128-characters fonts existed.
Each math font used in math mode has its \ii math/family {\em math family} represented by a number.
Math family is a collection of three (almost) equal fonts in three sizes:
diff --git a/macros/luatex/optex/doc/optex-techdoc.tex b/macros/luatex/optex/doc/optex-techdoc.tex
index 2c0a71cc27..4ae25a9c7e 100644
--- a/macros/luatex/optex/doc/optex-techdoc.tex
+++ b/macros/luatex/optex/doc/optex-techdoc.tex
@@ -6,6 +6,8 @@
\load [doc.opm]
+\thisoutline {TECHNICAL DOCUMENTATION}
+
\chap Technical documentation
This documentation is written in the source files `*.opm` between
diff --git a/macros/luatex/optex/doc/optex-userdoc.tex b/macros/luatex/optex/doc/optex-userdoc.tex
index 8f2fe4d3d3..899b1d55aa 100644
--- a/macros/luatex/optex/doc/optex-userdoc.tex
+++ b/macros/luatex/optex/doc/optex-userdoc.tex
@@ -650,7 +650,7 @@ The \^`\url` macro prints its parameter in \~`\tt` font and creates a potential
breakpoints in it (after slash or dot, for example). If the \^`\hyperlinks`
declaration is used then the parameter of \^`\url` is treated as an external URL link.
An example: `\url{http://www.olsak.net}` creates \url{http://www.olsak.net}.
-The characters \code{\%}, `\`, `#`, `{` and `}` have to be protected by
+The characters \code{\%}, `\`, `#`, `{`, and `}` have to be protected by
backslash in the \^`\url` argument, the other special characters `~`,
`^`, `&` can be written as single character\fnote
{More exactly, there are the same rules as for `\code` command, see
@@ -663,6 +663,8 @@ If the linked text have to be different than the URL, you can use
`\ulink[http://petr.olsak.net/optex]{\OpTeX/ page}`
outputs to the text
\ulink[http://petr.olsak.net/optex]{\OpTeX/ page}.
+The characters \code{\%}, `\`, `#`, `{`, and `}` must by escaped in
+the <url> parameter.
The PDF format provides {\em outlines} which are notes placed in the special frame of
the PDF viewer. These notes can be managed as a structured and hyperlinked
@@ -683,6 +685,11 @@ the main level~0. These entries can be placed before the table of contents (crea
by \^`\outlines`) or after it. Their hyperlink destination is in the place
where the \^`\insertoutline` macro is used.
+The command \^`\thisoutline{<text>}` uses <text> in the outline instead of default
+title text for the first following `\chap`, `\sec`, or `\secc`.
+Special case: \^`\thisoutline{\relax}` doesn't create any outline for the following
+`\chap`, `\sec`, or `\secc`.
+
\secc Lists
%%%%%%%%%%
@@ -768,9 +775,9 @@ These letters can be combined by the `|` character (vertical line). Example
July & yacht & k\$ 170 \crl}
\endtt
%
-generates the following result:
+generates the result:
-\medskip
+\vskip-\medskipamount
\noindent\hfil\table{||lc|r||}{ \crl
Month & commodity & price \crli \tskip2pt
January & notebook & \$ 700 \cr
@@ -902,29 +909,28 @@ You can use this for creating tables like in the following example:
& Exclusive & \mspan3[c|]{} &\mspan3[c|] X \crl
\vspan2{II} & Informal & \mspan3[c|] X &\mspan3[c|] X \crlp{2-8}
& Formal & \mspan6[c|] X \crl
- \vspan2{III} & Informal & \vspan2 O & X & X &\mspan2[c|] X & \vspan2 O \crlp{2,4-7}
+ \vspan2{III} & Informal & \vspan2{O} & X & X &\mspan2[c|] X & \vspan2{O} \crlp{2,4-7}
& Formal & &\mspan4[c|] X & \crl
}}\pdfrestore}
\hangindent=-7.5cm \hangafter=0
-The <number> parameter of \^`\vspan` must be one-digit number.
-If you want to set more digits then use braces.
-You can use non-integer values too if you feel that the
-result is better, for example \^`\vspan{2.1}{text}`.
+You can use \^`\vspan` with non-integer parameter too if you feel that the
+result looks better, for example \^`\vspan2.1{text}`.
\hangindent=-7.5cm \hangafter=0
The rule width of tables and implicit width of all `\vrule`s and `\hrule`s
can be set by the command \^`\rulewidth=<dimen>`. The default value given
by \TeX/ is 0.4\,pt.
+\hangindent=-7.5cm \hangafter=-2
The `c`, `l`, `r` and `p` are default \"declaration letters" but you can define
more such letters by `\def\_tabdeclare<letter>{<left>##<right>}`.
More about it is in technical documentation in section~\ref[table.impl].
-See the definition of the \^`\tabdeclarec` macro, for example.
+See the definition of the \^`\_tabdeclarec` macro, for example.
The `:` columns boundary declarator is described in section~\ref[table.bound].
The tables with given width can be declared by `to<size>` or `pxto<size>`.
-More about it is in section~\ref[table.w]
+More about it is in section~\ref[table.w].
Many tips about tables can be seen on the site
\url{http://petr.olsak.net/optex/optex-tricks.html}.
@@ -935,7 +941,7 @@ The display verbatim text have to be surrounded by the \^`\begtt` and
\^`\endtt` couple.
The in-line verbatim have to be tagged (before and after)
by a character which is declared by
-\^`\activettchar``<char>`. For example \code{\\activettchar`}
+\^`\verbchar``<char>`. For example \code{\\verbchar`}
declares the character \code{`}
for in-line verbatim markup.
And you can use \code{`\\relax`} for
@@ -974,7 +980,7 @@ the parameter of \^`\everytt` is read. So you don't have to worry about active
categories in this parameter.
There is an alternative to \^`\everytt` named \^`\everyintt` which is used for
-in-line verbatim surrounded by an \^`\activettchar` or processed by the \~`\code`
+in-line verbatim surrounded by an \^`\verbchar` or processed by the \~`\code`
command.
The \^`\everytt` is applied to all \^`\begtt...`\^`\endtt` environments (if it is not
@@ -997,7 +1003,7 @@ Each occurrence of ? will be changed to ! and vice versa.
@
\endtt
-The in-line verbatim surrounded by an `\activettchar` doesn't work in
+The in-line verbatim surrounded by a \^`\verbchar` doesn't work in
parameter of macros and macro definitions. (It works in titles declared by
\~`\chap`, \~`\sec` etc. and in \~`\fnote`s, because these macros are
specially defined in \OpTeX/).
@@ -1556,10 +1562,11 @@ 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
+The \^`\putpic` `<x> <y> <width> <height> {<image-file>}` puts an image
+given by `<image-file>` (including extension) 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.
+You can write \^`\nospec` instead `<width>` or `<height>` if this parameter
+is not specified.
\sec Others
%%%%%%%%%%%
@@ -1795,7 +1802,7 @@ put it as the first command in your document:
~endblock' % end of block of text
~begtt' % start a verbatim text
~endtt' % end verbatim text
-~activettchar' X % initialization character X for in-text verbatim
+~verbchar' X % initialization character X for in-text verbatim
~code' % another alternative for in-text verbatim
~verbinput' % verbatim extract from the external file
~begmulti' num % start multicolumn text (num columns)
@@ -1873,7 +1880,8 @@ documentation.
\^`\foreach` `<list>\do <parameters>{<what>}` is exapandable loop over <list>.\nl
\^`\foreachdef` `\macro <parameters>{<what>}` declares expandable `\macro` as loop over <list>.\nl
\^`\fornum` `<from>..<to>\do {<what>}` is expanadable loop with numeric variable.\nl
-\^`\ignoreit` `<one>`, \^`\ignoresecond` `<one><two>`, \^`\usesecond` `<one><two>` ignores parameters.\nl
+\^`\incr` `<counter>` increases and \^`\decr` `<counter>` decreases `<counter>` by one globally.\nl
+\^`\ignoreit` `<one>`, \^`\ignoresecond` `<one><two>` ignores given parameter.\nl
`\expandafter` \^`\ignorept` `\the<dimen>` expands to decimal number <dimen> without `pt`.\nl
\~`\isempty`, \~`\istoksempty`, \~`\isequal`, \~`\ismacro`, \~`\isdefined`, \~`\isinlist`
\~`\isfile`, \~`\isfont` do various tests. Example: \~`\isinlist\list{<text>}\iftrue` does
@@ -1899,6 +1907,7 @@ documentation.
\^`\slet` `{<stringA>}{<stringB>}` behaves like `\let\<stringA>=\<stringB>`\nl
\^`\sxdef` `{<string>}<parameters>{<body>}` behaves like `\xdef\<string><parameters>{<body>}`.\nl
\^`\trycs`` {<string>}{<text>}` expands `\<string>` if it is defined else expands <text>.\nl
+\^`\useit` `<one>`, \^`\usesecond` `<one><two>` uses given parameter.\nl
\^`\wlog`` {<text>}` writes <text> to .log file.\nl
\^`\wterm`` {<text>}` writes <text> to the terminal and .log file.\nl
\^`\xargs`` <what> <token> <token> ... ;` repeats <what><token> for each <token>.\nl